Re: [syzbot] [jffs2?] KASAN: slab-use-after-free Read in jffs2_xattr_delete_inode

From: Shuai Liu

Date: Thu Nov 19 2026 - 20:04:45 EST


#syz test

Hi Richard,

Gentle ping. I posted a fix for this on 2026-11-03 [1]; it resubmits
Lucas Jeffrey's September patch with credit, as his thread had gone
quiet while the bug kept reproducing.

There has been no response so far, and the bug is still live -- 44
crashes recorded in the November monthly report [2]. The fix is a
one-liner clearing f->inocache in jffs2_init_inode_info(), consistent
with the other pointer fields there: a stale inocache survives slab
recycling after the previous mount's jffs2_free_ino_caches() and is
dereferenced by jffs2_xattr_delete_inode() on the evict() error path
when jffs2_new_inode() fails after jffs2_init_inode_info() but before
jffs2_do_new_inode() assigns a fresh inocache.

I've verified with the syzbot C reproducer under QEMU + KASAN: the UAF
triggers before the patch and is absent after it. The patch is inlined
below so syzbot can re-verify on current master.

Note that the syzbot bisection points at an unrelated block2mtd commit
(7b09acdc "mtd: block2mtd: add support for an optional custom MTD
label"); the repro mounts jffs2 on block2mtd, so that looks like
bisection noise.

Could you take a look?

Thanks,
Shuai Liu

[1] https://lore.kernel.org/all/tencent_A21BAE90D8EE04A5FB98B4168BA73C695306@xxxxxx/
[2] https://lore.kernel.org/all/6afbd91e.e6a8accb.234e85.000a.GAE@xxxxxxxxxx/

---
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -55,6 +55,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
f->metadata = NULL;
f->dents = NULL;
f->target = NULL;
+ f->inocache = NULL;
f->flags = 0;
f->usercompr = 0;
}
--