linux/fs/ubifs
Richard Weinberger 1cb51a15b5 ubifs: Fix journal replay wrt. xattr nodes
When replaying the journal it can happen that a journal entry points to
a garbage collected node.
This is the case when a power-cut occurred between a garbage collect run
and a commit. In such a case nodes have to be read using the failable
read functions to detect whether the found node matches what we expect.

One corner case was forgotten, when the journal contains an entry to
remove an inode all xattrs have to be removed too. UBIFS models xattr
like directory entries, so the TNC code iterates over
all xattrs of the inode and removes them too. This code re-uses the
functions for walking directories and calls ubifs_tnc_next_ent().
ubifs_tnc_next_ent() expects to be used only after the journal and
aborts when a node does not match the expected result. This behavior can
render an UBIFS volume unmountable after a power-cut when xattrs are
used.

Fix this issue by using failable read functions in ubifs_tnc_next_ent()
too when replaying the journal.
Cc: stable@vger.kernel.org
Fixes: 1e51764a3c ("UBIFS: add new flash file system")
Reported-by: Rock Lee <rockdotlee@gmail.com>
Reviewed-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
2017-01-17 14:35:58 +01:00
..
Kconfig ubifs: add CONFIG_BLOCK dependency for encryption 2017-01-17 14:32:47 +01:00
Makefile ubifs: Add skeleton for fscrypto 2016-12-12 23:07:38 +01: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 ubifs: Use FS_CFLG_OWN_PAGES 2016-12-13 16:18:16 +01:00
debug.c ubifs: Implement encrypted filenames 2016-12-12 23:07:38 +01:00
debug.h UBIFS: print less 2012-08-31 17:32:58 +03:00
dir.c ubifs: remove redundant checks for encryption key 2017-01-17 14:34:21 +01:00
file.c Merge uncontroversial parts of branch 'readlink' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs 2016-12-17 19:16:12 -08: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 ubifs: allow encryption ioctls in compat mode 2017-01-17 14:33:41 +01:00
journal.c ubifs: fix unencrypted journal write 2017-01-17 14:05:23 +01:00
key.h ubifs: Implement encrypted filenames 2016-12-12 23:07:38 +01:00
log.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
lprops.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
lpt_commit.c UBIFS: improve function-level documentation 2016-10-02 22:55:02 +02:00
master.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
misc.c ubifs: Add logging functions for ubifs_msg, ubifs_err and ubifs_warn 2016-03-20 21:36:05 +01:00
misc.h fs/ubifs: remove unnecessary new_valid_dev check 2015-11-06 23:26:48 +01:00
orphan.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
recovery.c UBIFS: Delete unnecessary checks before the function call "iput" 2015-11-06 23:26:52 +01:00
replay.c ubifs: Implement encrypted filenames 2016-12-12 23:07:38 +01:00
sb.c ubifs: Raise write version to 5 2016-12-12 23:07:38 +01: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: Add support for encrypted symlinks 2016-12-12 23:07:38 +01:00
tnc.c ubifs: Fix journal replay wrt. xattr nodes 2017-01-17 14:35:58 +01:00
tnc_commit.c ubifs: Fix assertion in layout_in_gaps() 2016-08-23 23:02:40 +02:00
tnc_misc.c UBIFS: extend debug/message capabilities 2015-03-25 11:08:41 +02:00
ubifs-media.h ubifs: Raise write version to 5 2016-12-12 23:07:38 +01:00
ubifs.h ubifs: Use fscrypt ioctl() helpers 2016-12-13 19:54:52 +01:00
xattr.c ubifs: Implement encrypted filenames 2016-12-12 23:07:38 +01:00