Skip to contentSkip to conversation

UBIFS: fix oops in lprops dump function

PATCH New Artem Bityutskiy 1 participant 1 message Apr 24, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 UBIFS: fix oops in lprops dump function

From: Artem Bityutskiy <[email protected]>

The 'dbg_dump_lprop()' is trying to detect journal head LEBs when printing, so it looks at the write-buffers. However, if we are in R/O mode, we de-allocate the write-buffers, so 'dbg_dump_lprop()' oopses. This patch fixes the issue.

Note, this patch is not critical, it is only about the debugging code path, and it is unlikely that anyone but UBIFS developers would ever hit this issue.

---
 fs/ubifs/debug.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
fs/ubifs/debug.c +7 -1
index 1c5852a..063bc2b 100644
@@ -746,7 +746,13 @@ void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp)
 		if (bud->lnum == lp->lnum) {
 			int head = 0;
 			for (i = 0; i < c->jhead_cnt; i++) {
-				if (lp->lnum == c->jheads[i].wbuf.lnum) {
+				/*
+				 * Note, if we are in R/O mode or in the middle
+				 * of mounting/re-mounting, the write-buffers do
+				 * not exist.
+				 */
+				if (c->jheads &&
+				    lp->lnum == c->jheads[i].wbuf.lnum) {
 					printk(KERN_CONT ", jhead %s",
 					       dbg_jhead(i));
 					head = 1;
Signature · 1 line
1.7.2.3