mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas Jeffrey <luquijeffrey@gmail.com>
To: dwmw2@infradead.org
Cc: richard@nod.at, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Lucas Jeffrey <luquijeffrey@gmail.com>,
	syzbot+3a8099322b09d8d073d1@syzkaller.appspotmail.com
Subject: [PATCH] jffs: initialize inocache to NULL when initializing a jffs2_inode_info
Date: Tue,  8 Sep 2026 23:39:55 -0300	[thread overview]
Message-ID: <20260909023955.1642244-1-luquijeffrey@gmail.com> (raw)

When a jffs2_inode_info is allocated via new_inode(), due to memory reuse it
can retain stale values from its previous use.

If the new jffs2_inode_info object allocated retains an old reference to a
freed inocache, the function jffs2_new_inode may crash if either
jffs2_init_acl_pre or jffs2_do_new_inode returns an error value because
when calling iput() with the inode it will eventually attempt to free again
the inocache.

Reported-by: syzbot+3a8099322b09d8d073d1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3a8099322b09d8d073d1
Signed-off-by: Lucas Jeffrey <luquijeffrey@gmail.com>
---
 fs/jffs2/os-linux.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 86ab014a349c..40f17218a276 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -52,6 +52,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
 {
 	f->highest_version = 0;
 	f->fragtree = RB_ROOT;
+	f->inocache = NULL;
 	f->metadata = NULL;
 	f->dents = NULL;
 	f->target = NULL;
-- 
2.43.0


             reply	other threads:[~2026-09-09  2:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  2:39 Lucas Jeffrey [this message]
2026-09-09  2:54 ` sashiko-bot
2026-09-09  5:57   ` AW: " Richard Weinberger
2026-09-10  2:53     ` Lucas Jeffrey
2026-09-09  5:33 ` AW: " Richard Weinberger
2026-09-10  3:19 ` [PATCH v2] jffs2: initialize inocache and target to NULL when allocating and initializing an jffs2_inode_info Lucas Jeffrey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909023955.1642244-1-luquijeffrey@gmail.com \
    --to=luquijeffrey@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=syzbot+3a8099322b09d8d073d1@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®