linux-stable/fs/ubifs
Richard Weinberger 72cd230b32 ubifs: Correctly use tnc_next() in search_dh_cookie()
commit bacfa94b08 upstream.

Commit c877154d30 fixed an uninitialized variable and optimized
the function to not call tnc_next() in the first iteration of the
loop. While this seemed perfectly legit and wise, it turned out to
be illegal.
If the lookup function does not find an exact match it will rewind
the cursor by 1.
The rewinded cursor will not match the name hash we are looking for
and this results in a spurious -ENOENT.
So we need to move to the next entry in case of an non-exact match,
but not if the match was exact.

While we are here, update the documentation to avoid further confusion.

Cc: Hyunchul Lee <hyc.lee@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: c877154d30 ("ubifs: Fix uninitialized variable in search_dh_cookie()")
Fixes: 781f675e2d ("ubifs: Fix unlink code wrt. double hash lookups")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-19 09:09:37 +02:00
..
budget.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
commit.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
compress.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
crypto.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
debug.c ubifs: Rework ubifs_assert() 2018-08-15 00:25:21 +02:00
debug.h ubifs: Rework ubifs_assert() 2018-08-15 00:25:21 +02:00
dir.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
file.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
find.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
gc.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
io.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
ioctl.c fs, fscrypt: add an S_ENCRYPTED inode flag 2017-10-18 19:52:36 -04:00
journal.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
Kconfig ubifs: introduce Kconfig symbol for xattr support 2018-08-15 00:25:14 +02:00
key.h ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
log.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
lprops.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
lpt.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
lpt_commit.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
Makefile ubifs: introduce Kconfig symbol for xattr support 2018-08-15 00:25:14 +02:00
master.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
misc.c ubifs: Allow setting assert action as mount parameter 2018-08-15 00:25:21 +02:00
misc.h ubifs: Allow setting assert action as mount parameter 2018-08-15 00:25:21 +02:00
orphan.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
recovery.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
replay.c ubifs: Handle re-linking of inodes correctly while recovery 2018-12-29 13:37:55 +01:00
sb.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
scan.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
shrinker.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
super.c ubifs: Fix WARN_ON logic in exit path 2018-10-13 11:05:02 +02:00
tnc.c ubifs: Correctly use tnc_next() in search_dh_cookie() 2019-09-19 09:09:37 +02:00
tnc_commit.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
tnc_misc.c ubifs: Pass struct ubifs_info to ubifs_assert() 2018-08-15 00:25:21 +02:00
ubifs-media.h ubifs: Raise write version to 5 2016-12-12 23:07:38 +01:00
ubifs.h ubifs: Rework ubifs_assert() 2018-08-15 00:25:21 +02:00
xattr.c Revert "ubifs: xattr: Don't operate on deleted inodes" 2018-09-20 21:37:41 +02:00