1
0
Fork 0
alistair23-linux/fs/ubifs
Eric Biggers 6fe20a5204 ubifs: prevent creating duplicate encrypted filenames
commit 76786a0f08 upstream.

As described in "fscrypt: add fscrypt_is_nokey_name()", it's possible to
create a duplicate filename in an encrypted directory by creating a file
concurrently with adding the directory's encryption key.

Fix this bug on ubifs by rejecting no-key dentries in ubifs_create(),
ubifs_mkdir(), ubifs_mknod(), and ubifs_symlink().

Note that ubifs doesn't actually report the duplicate filenames from
readdir, but rather it seems to replace the original dentry with a new
one (which is still wrong, just a different effect from ext4).

On ubifs, this fixes xfstest generic/595 as well as the new xfstest I
wrote specifically for this bug.

Fixes: f4f61d2cc6 ("ubifs: Implement encrypted filenames")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201118075609.120337-5-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-06 14:48:35 +01:00
..
Kconfig ubifs: Add support for zstd compression. 2019-07-08 19:43:53 +02:00
Makefile fscrypt: remove filesystem specific build config option 2019-01-23 23:56:43 -05:00
auth.c ubifs: Fix error return code in ubifs_init_authentication() 2020-12-30 11:51:25 +01:00
budget.c ubifs: Limit the number of pages in shrink_liability 2019-08-22 17:25:33 +02:00
commit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
compress.c ubifs: Add support for zstd compression. 2019-07-08 19:43:53 +02:00
crypto.c fscrypt: introduce fscrypt_decrypt_block_inplace() 2019-05-28 10:27:53 -07:00
debug.c ubifs: dent: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00
debug.h Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00
dir.c ubifs: prevent creating duplicate encrypted filenames 2021-01-06 14:48:35 +01:00
file.c ubifs: remove broken lazytime support 2020-05-27 17:46:14 +02:00
find.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
gc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
io.c ubifs: wbuf: Don't leak kernel memory to flash 2020-12-30 11:51:40 +01:00
ioctl.c ubifs: Fix FS_IOC_SETFLAGS unexpectedly clearing encrypt flag 2020-02-11 04:35:20 -08:00
journal.c ubifs: journal: Make sure to not dirty twice for auth nodes 2020-11-05 11:43:32 +01:00
key.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
log.c ubifs: remove unnecessary check in ubifs_log_start_commit 2019-07-08 19:43:51 +02:00
lprops.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
lpt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
lpt_commit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
master.c ubifs: support offline signed images 2019-07-08 19:43:52 +02:00
misc.c ubifs: Allow setting assert action as mount parameter 2018-08-15 00:25:21 +02:00
misc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
orphan.c ubifs: xattr: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00
recovery.c ubifs: Fix typo of output in get_cs_sqnum 2019-07-08 19:43:43 +02:00
replay.c ubifs: fix wrong use of crypto_shash_descsize() 2020-05-27 17:46:09 +02:00
sb.c ubifs: Fix wrong memory allocation 2020-02-11 04:35:20 -08:00
scan.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
shrinker.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
super.c ubifs: mount_ubifs: Release authentication resource in error handling path 2020-11-05 11:43:32 +01:00
tnc.c ubifs: xattr: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00
tnc_commit.c ubifs: ubifs_tnc_start_commit: Fix OOB in layout_in_gaps 2020-01-09 10:20:06 +01:00
tnc_misc.c ubifs: Fix memory leak in read_znode() error path 2019-09-15 22:11:18 +02:00
ubifs-media.h ubifs: Add support for zstd compression. 2019-07-08 19:43:53 +02:00
ubifs.h ubifs: support offline signed images 2019-07-08 19:43:52 +02:00
xattr.c ubifs: xattr: Fix some potential memory leaks while iterating entries 2020-11-05 11:43:32 +01:00