2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 16:53:54 +08:00
linux-next/fs/ubifs
hujianyang 88cff0f0fb UBIFS: return -EINVAL if log head is empty
CS node is recognized as a sign in UBIFS log replay mechanism.
Log relaying during mount should find the CS node in log head
at beginning and then replay the following uncommitted buds.

Here is a bug in log replay path: If the log head, which is
indicated by @log_lnum in mst_node, is empty, current UBIFS
replay nothing and directly mount the partition without any
warning. This action will put filesystem in an abnormal state,
e.g. space management in LPT area is incorrect to the real
space usage in main area.

We reproduced this bug by fault injection: turn log head leb
into all 0xFF. UBIFS driver mount the polluted partition
normally. But errors occur while running fs_stress on this
mount:

[89068.055183] UBI error: ubi_io_read: error -74 (ECC error) while reading 59 bytes from PEB 711:33088, read 59 bytes
[89068.179877] UBIFS error (pid 10517): ubifs_check_node: bad magic 0x101031, expected 0x6101831
[89068.179882] UBIFS error (pid 10517): ubifs_check_node: bad node at LEB 591:28992
[89068.179891] Not a node, first 24 bytes:
[89068.179892] 00000000: 31 10 10 00 37 84 64 04 10 04 00 00 00 00 00 00 20 00 00 00 02 01 00 00                          1...7.d......... .......
[89068.180282] UBIFS error (pid 10517): ubifs_read_node: expected node type 2

This patch fix the problem by checking *lnum* to guarantee
the empty leb is not log head leb and return an error if the
log head leb is incorrectly empty. After this, we could catch
*log head empty* error in place.

Signed-off-by: hujianyang <hujianyang@huawei.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2015-02-10 10:06:24 +02:00
..
budget.c UBIFS: Remove unused variables in ubifs_budget_space 2014-05-13 13:45:16 +03:00
commit.c UBIFS: fix a race condition 2014-09-08 15:55:02 +03:00
compress.c UBIFS: comply with coding style 2012-08-31 17:32:57 +03:00
debug.c UBIFS: add a couple of extra asserts 2015-01-28 16:09:32 +01:00
debug.h UBIFS: print less 2012-08-31 17:32:58 +03:00
dir.c UBIFS: Add security.* XATTR support for the UBIFS 2015-01-28 16:08:54 +01:00
file.c UBIFS: Add xattr support for symlinks 2015-01-28 16:08:46 +01:00
find.c UBIFS: fix mounting problems after power cuts 2012-10-26 16:26:44 +03:00
gc.c UBIFS: remove unnecessary code in ubifs_garbage_collect 2013-10-22 13:34:27 +01:00
io.c UBIFS: kernel-doc warning fix 2014-07-19 09:53:52 +03:00
ioctl.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
journal.c UBIFS: fix a couple bugs in UBIFS xattr length calculation 2014-11-07 12:32:22 +02:00
Kconfig UBIFS: remove Kconfig debugging option 2012-05-16 19:53:46 +03:00
key.h UBIFS: mark unused key objects as invalid 2010-08-30 10:19:08 +03:00
log.c UBIFS: fix free log space calculation 2014-09-08 15:55:28 +03:00
lprops.c UBIFS: introduce categorized lprops counter 2012-10-26 16:00:26 +03:00
lpt_commit.c UBIFS: remove useless statements 2014-07-19 09:53:51 +03:00
lpt.c UBIFS: remove useless statements 2014-07-19 09:53:51 +03:00
Makefile UBIFS: remove Kconfig debugging option 2012-05-16 19:53:46 +03:00
master.c UBIFS: remove mst_mutex 2014-07-19 09:53:52 +03:00
misc.h Revert "UBIFS: add a log overlap assertion" 2014-07-28 19:15:19 +03:00
orphan.c UBIFS: remove useless statements 2014-07-19 09:53:51 +03:00
recovery.c UBIFS: kernel-doc warning fix 2014-07-19 09:53:52 +03:00
replay.c UBIFS: return -EINVAL if log head is empty 2015-02-10 10:06:24 +02:00
sb.c UBIFS: fix error path in create_default_filesystem() 2014-07-19 09:53:52 +03:00
scan.c UBIFS: fix spelling of "scanned" 2014-07-19 09:53:51 +03:00
shrinker.c UBIFS: Remove incorrect assertion in shrink_tnc() 2014-06-02 11:28:24 +03:00
super.c UBIFS: Add security.* XATTR support for the UBIFS 2015-01-28 16:08:54 +01:00
tnc_commit.c UBIFS: remove useless statements 2014-07-19 09:53:51 +03:00
tnc_misc.c UBIFS: print less 2012-08-31 17:32:58 +03:00
tnc.c UBIFS: remove useless statements 2014-07-19 09:53:51 +03:00
ubifs-media.h UBIFS: add a superblock flag for free space fix-up 2011-05-16 14:12:14 +03:00
ubifs.h UBIFS: Add security.* XATTR support for the UBIFS 2015-01-28 16:08:54 +01:00
xattr.c UBIFS: add ubifs_err() to print error reason 2015-01-28 16:09:01 +01:00