All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 1/2] UBIFS: fix empty log leb error
@ 2014-12-25 12:58 hujianyang
  2014-12-25 13:10 ` [PATCH RFC 2/2] UBIFS: scan all log lebs during log replay hujianyang
  0 siblings, 1 reply; 4+ messages in thread
From: hujianyang @ 2014-12-25 12:58 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, shengyong1

If first log leb which is indicated by @log_lnum in mst_node
is empty, current UBIFS will stop finding cs_node and directly
mount the partition.

This patch fix this problem by checking c->cs_sqnum to
guarantee the empty leb is not first log leb and return an
error if the first log leb is incorrectly empty.

Signed-off-by: hujianyang <hujianyang@huawei.com>
---
 fs/ubifs/replay.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
index 3187925..f13f4b2 100644
--- a/fs/ubifs/replay.c
+++ b/fs/ubifs/replay.c
@@ -846,7 +846,14 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
 	}

 	if (sleb->nodes_cnt == 0) {
-		err = 1;
+		if (unlikely(c->cs_sqnum == 0)) {
+			/* This is the first log LEB, should not be empty */
+			ubifs_err("first log leb LEB %d:%d is empty, no CS node exist",
+				  lnum, offs);
+			err = -EINVAL;
+		} else {
+			err = 1;
+		}
 		goto out;
 	}

-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-02  2:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-25 12:58 [PATCH RFC 1/2] UBIFS: fix empty log leb error hujianyang
2014-12-25 13:10 ` [PATCH RFC 2/2] UBIFS: scan all log lebs during log replay hujianyang
2015-01-31 12:46   ` Artem Bityutskiy
2015-02-02  2:49     ` hujianyang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.