linux-brain/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 UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
commit.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
compress.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
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 ubifs: Fix cut and paste error on sb type comparisons 2017-05-08 20:48:41 +02:00
debug.h UBIFS: print less 2012-08-31 17:32:58 +03:00
dir.c ubifs: Fix directory size calculation for symlinks 2018-12-29 13:39:07 +01:00
file.c mm/migrate: new migrate mode MIGRATE_SYNC_NO_COPY 2017-09-08 18:26:46 -07:00
find.c UBIFS: fix mounting problems after power cuts 2012-10-26 16:26:44 +03:00
gc.c ubifs: Remove some dead code 2016-12-12 23:06:28 +01:00
io.c ubifs: Use dirty_writeback_interval value for wbuf timer 2016-12-12 23:06:24 +01:00
ioctl.c This pull request contains updates for both UBI and UBIFS: 2017-05-13 10:23:12 -07:00
journal.c ubifs: Fix synced_i_size calculation for xattr inodes 2018-09-09 19:56:00 +02:00
Kconfig ubifs: Add CONFIG_UBIFS_FS_SECURITY to disable/enable security labels 2017-05-08 20:48:23 +02:00
key.h ubifs: Add assert to dent_key_init() 2017-07-14 22:49:06 +02:00
log.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
lprops.c ubifs: Fix memory leak in lprobs self-check 2018-09-09 19:56:00 +02:00
lpt_commit.c UBIFS: improve function-level documentation 2016-10-02 22:55:02 +02:00
lpt.c UBIFS: use kmemdup rather than duplicating its implementation 2015-10-03 20:03:14 +02:00
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 UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
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 fs: ubifs: replace CURRENT_TIME_SEC with current_time 2017-05-08 17:15:15 -07:00
orphan.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
recovery.c ubifs: Remove unnecessary assignment 2017-05-08 20:48:47 +02:00
replay.c ubifs: Handle re-linking of inodes correctly while recovery 2018-12-29 13:39:11 +01:00
sb.c fs: ubifs: replace CURRENT_TIME_SEC with current_time 2017-05-08 17:15:15 -07:00
scan.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
shrinker.c UBIFS: Remove incorrect assertion in shrink_tnc() 2014-06-02 11:28:24 +03:00
super.c ubifs: Check for name being NULL while mounting 2018-10-13 09:27:29 +02:00
tnc_commit.c ubifs: Fail commit if TNC is obviously inconsistent 2017-07-14 22:49:07 +02:00
tnc_misc.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
tnc.c ubifs: Correctly use tnc_next() in search_dh_cookie() 2019-09-19 09:08:06 +02:00
ubifs-media.h ubifs: Raise write version to 5 2016-12-12 23:07:38 +01:00
ubifs.h ubifs: Massage assert in ubifs_xattr_set() wrt. init_xattrs 2017-07-14 22:50:54 +02:00
xattr.c Revert "ubifs: xattr: Don't operate on deleted inodes" 2018-09-29 03:06:04 -07:00