diff options
author | hujianyang <hujianyang@huawei.com> | 2014-07-29 22:37:53 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2014-07-31 08:52:51 -0400 |
commit | 25601a3c9737fed554169759582c690b98ead5d4 (patch) | |
tree | cd49fa96238af388ba347590b37a439fe7cc0c87 /fs/ubifs | |
parent | 6390e991776ec2519b4505d48dd82b0e88d359d2 (diff) |
UBIFS: Add log overlap assertions
We use a circle area to record the log nodes in ubifs. This log area
should not be overlapped. But after researching the code, I found
some conditions may lead log head wraps log ltail. Although we've
fixed the problems discovered, there may be some other issues still
left.
This patch adds assertions where lhead changes to next leb to make
sure ltail is not wrapped.
Signed-off-by: hujianyang <hujianyang@huawei.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/log.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index 518b13685b2a..a47ddfc9be6b 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -240,6 +240,7 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) | |||
240 | 240 | ||
241 | if (c->lhead_offs > c->leb_size - c->ref_node_alsz) { | 241 | if (c->lhead_offs > c->leb_size - c->ref_node_alsz) { |
242 | c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum); | 242 | c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum); |
243 | ubifs_assert(c->lhead_lnum != c->ltail_lnum); | ||
243 | c->lhead_offs = 0; | 244 | c->lhead_offs = 0; |
244 | } | 245 | } |
245 | 246 | ||
@@ -404,6 +405,7 @@ int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum) | |||
404 | /* Switch to the next log LEB */ | 405 | /* Switch to the next log LEB */ |
405 | if (c->lhead_offs) { | 406 | if (c->lhead_offs) { |
406 | c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum); | 407 | c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum); |
408 | ubifs_assert(c->lhead_lnum != c->ltail_lnum); | ||
407 | c->lhead_offs = 0; | 409 | c->lhead_offs = 0; |
408 | } | 410 | } |
409 | 411 | ||