[PATCH] fs/jffs2: Fix potential NULL dereference in jffs2_add_frag_to_fragtree()
Haowen Bai
baihaowen at meizu.com
Fri Apr 1 00:23:30 PDT 2022
this could be null, so we need to checking null before dereference
Signed-off-by: Haowen Bai <baihaowen at meizu.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
More information about the linux-mtd
mailing list