[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1648797810-27042-1-git-send-email-baihaowen@meizu.com>
Date: Fri, 1 Apr 2022 15:23:30 +0800
From: Haowen Bai <baihaowen@...zu.com>
To: David Woodhouse <dwmw2@...radead.org>,
Richard Weinberger <richard@....at>
CC: Haowen Bai <baihaowen@...zu.com>, <linux-mtd@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] fs/jffs2: Fix potential NULL dereference in jffs2_add_frag_to_fragtree()
this could be null, so we need to checking null before dereference
Signed-off-by: Haowen Bai <baihaowen@...zu.com>
---
fs/jffs2/nodelist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index b86c78d178c6..ed3b3b25bfab 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -246,7 +246,7 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *r
return no_overlapping_node(c, root, newfrag, this, lastend);
}
- if (this->node)
+ if (this && this->node)
dbg_fragtree2("dealing with frag %u-%u, phys %#08x(%d).\n",
this->ofs, this->ofs + this->size,
ref_offset(this->node->raw), ref_flags(this->node->raw));
--
2.7.4
Powered by blists - more mailing lists