Re: [PATCH 2/3] jffs2: clean up xattr refs in jffs2_del_ino_cache instead of BUG_ON

From: Richard Weinberger

Date: Wed Dec 02 2026 - 03:02:44 EST


On Mittwoch, 2. Dezember 2026 02:18 Haris Iqbal wrote:
> I was able to reproduce the above BUG_ON hit described.
>
> One alternate way to solve it would be to move the free into
> jffs2_do_clear_inode().
>
> diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
> index 1caabff9dc91..9ff780e5f65f 100644
> --- a/fs/jffs2/readinode.c
> +++ b/fs/jffs2/readinode.c
> @@ -1439,8 +1439,10 @@ void jffs2_do_clear_inode(struct jffs2_sb_info
> *c, struct jffs2_inode_info *f)
>
> if (f->inocache && f->inocache->state != INO_STATE_CHECKING) {
> jffs2_set_inocache_state(c, f->inocache,
> INO_STATE_CHECKEDABSENT);
> - if (f->inocache->nodes == (void *)f->inocache)
> + if (f->inocache->nodes == (void *)f->inocache) {
> + jffs2_xattr_free_inode(c, f->inocache);
> jffs2_del_ino_cache(c, f->inocache);
> + }

This fixes the bug with a regular JFFS2, a crafted JFFS2 image
could still hit the BUG_ON().
On the other hand, I think it's okay that a crafted image
can trigger a BUG_ON().

Thanks,
//richard

--
​​​​​sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr:
ATU 66964118 | FN: 374287y