linux-stable/fs/ubifs
Eric Biggers 7c5cf5c43f ubifs: don't trigger assertion on invalid no-key filename
[ Upstream commit f0d07a98a0 ]

If userspace provides an invalid fscrypt no-key filename which encodes a
hash value with any of the UBIFS node type bits set (i.e. the high 3
bits), gracefully report ENOENT rather than triggering ubifs_assert().

Test case with kvm-xfstests shell:

    . fs/ubifs/config
    . ~/xfstests/common/encrypt
    dev=$(__blkdev_to_ubi_volume /dev/vdc)
    ubiupdatevol $dev -t
    mount $dev /mnt -t ubifs
    mkdir /mnt/edir
    xfs_io -c set_encpolicy /mnt/edir
    rm /mnt/edir/_,,,,,DAAAAAAAAAAAAAAAAAAAAAAAAAA

With the bug, the following assertion fails on the 'rm' command:

    [   19.066048] UBIFS error (ubi0:0 pid 379): ubifs_assert_failed: UBIFS assert failed: !(hash & ~UBIFS_S_KEY_HASH_MASK), in fs/ubifs/key.h:170

Fixes: f4f61d2cc6 ("ubifs: Implement encrypted filenames")
Cc: <stable@vger.kernel.org> # v4.10+
Link: https://lore.kernel.org/r/20200120223201.241390-5-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-14 16:32:11 -05:00
..
budget.c
commit.c
compress.c
crypto.c
debug.c
debug.h
dir.c ubifs: don't trigger assertion on invalid no-key filename 2020-02-14 16:32:11 -05:00
file.c ubifs: Fix deadlock in concurrent bulk-read and writepage 2020-02-14 16:32:10 -05:00
find.c
gc.c
io.c
ioctl.c ubifs: Fix FS_IOC_SETFLAGS unexpectedly clearing encrypt flag 2020-02-14 16:32:10 -05:00
journal.c ubifs: Fix synced_i_size calculation for xattr inodes 2018-09-09 19:56:00 +02:00
Kconfig
key.h
log.c
lprops.c ubifs: Fix memory leak in lprobs self-check 2018-09-09 19:56:00 +02:00
lpt.c
lpt_commit.c
Makefile
master.c
misc.c
misc.h
orphan.c
recovery.c
replay.c ubifs: Handle re-linking of inodes correctly while recovery 2018-12-29 13:39:11 +01:00
sb.c
scan.c
shrinker.c
super.c ubifs: Check for name being NULL while mounting 2018-10-13 09:27:29 +02:00
tnc.c ubifs: Correctly use tnc_next() in search_dh_cookie() 2019-09-19 09:08:06 +02:00
tnc_commit.c
tnc_misc.c
ubifs-media.h
ubifs.h
xattr.c Revert "ubifs: xattr: Don't operate on deleted inodes" 2018-09-29 03:06:04 -07:00