diff mbox series

Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()"

Message ID 20191129001930.651128-1-joel@jms.id.au
State Accepted
Commit 6e78c01fde9023e0701f3af880c1fd9de6e4e8e3
Headers show
Series Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()" | expand

Commit Message

Joel Stanley Nov. 29, 2019, 12:19 a.m. UTC
This reverts commit f2538f999345405f7d2e1194c0c8efa4e11f7b3a. The patch
stopped JFFS2 from being able to mount an existing filesystem with the
following errors:

 jffs2: error: (77) jffs2_build_inode_fragtree: Add node to tree failed -22
 jffs2: error: (77) jffs2_do_read_inode_internal: Failed to build final fragtree for inode #5377: error -22

Fixes: f2538f999345 ("jffs2: Fix possible null-pointer dereferences...")
Cc: stable@vger.kernel.org
Suggested-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>

---
5.4 cannot mount (some?) jffs2 filesystems without this fix. Hou pointed
this out[1] a while back but the fix didn't make it in. It's still
broken in -next.

[1] https://lore.kernel.org/lkml/2758feea-8d6e-c690-5cac-d42213f2024b@huawei.com/

 fs/jffs2/nodelist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.24.0

Comments

Richard Weinberger Nov. 29, 2019, 10:28 a.m. UTC | #1
----- Ursprüngliche Mail -----
> Von: "Joel Stanley" <joel@jms.id.au>

> An: "David Woodhouse" <dwmw2@infradead.org>, "richard" <richard@nod.at>, "Jia-Ju Bai" <baijiaju1990@gmail.com>, "Al

> Viro" <viro@zeniv.linux.org.uk>, "OpenBMC Maillist" <openbmc@lists.ozlabs.org>, "linux-mtd"

> <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>

> CC: "stable" <stable@vger.kernel.org>, "Hou Tao" <houtao1@huawei.com>

> Gesendet: Freitag, 29. November 2019 01:19:30

> Betreff: [PATCH] Revert "jffs2: Fix possible null-pointer dereferences in jffs2_add_frag_to_fragtree()"


> This reverts commit f2538f999345405f7d2e1194c0c8efa4e11f7b3a. The patch

> stopped JFFS2 from being able to mount an existing filesystem with the

> following errors:

> 

> jffs2: error: (77) jffs2_build_inode_fragtree: Add node to tree failed -22

> jffs2: error: (77) jffs2_do_read_inode_internal: Failed to build final fragtree

> for inode #5377: error -22

> 

> Fixes: f2538f999345 ("jffs2: Fix possible null-pointer dereferences...")

> Cc: stable@vger.kernel.org

> Suggested-by: Hou Tao <houtao1@huawei.com>

> Signed-off-by: Joel Stanley <joel@jms.id.au>

> ---

> 5.4 cannot mount (some?) jffs2 filesystems without this fix. Hou pointed

> this out[1] a while back but the fix didn't make it in. It's still

> broken in -next.


queued into -next.

Thanks,
//richard
diff mbox series

Patch

diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 021a4a2190ee..b86c78d178c6 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -226,7 +226,7 @@  static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *r
 		lastend = this->ofs + this->size;
 	} else {
 		dbg_fragtree2("lookup gave no frag\n");
-		return -EINVAL;
+		lastend = 0;
 	}
 
 	/* See if we ran off the end of the fragtree */