linux-stable/fs/ubifs
Richard Weinberger 0369bbfe7a 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:08:06 +02:00
..
budget.c
commit.c
compress.c
crypto.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debug.c
debug.h
dir.c ubifs: Fix directory size calculation for symlinks 2018-12-29 13:39:07 +01:00
file.c
find.c
gc.c
io.c
ioctl.c
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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
master.c
misc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
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