From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] fs: jffs2: don't free the symlink target twice
Date: Mon, 2 Nov 2026 15:53:02 +0100 [thread overview]
Message-ID: <20261102145302.3025815-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20261102145302.3025815-1-s.hauer@pengutronix.de>
jffs2_iget() makes f->target the inode's i_link for symlinks. Since
commit 66666e887c ("fs: free inode->i_link") the VFS frees i_link when
destroying an inode, and jffs2_destroy_inode() then frees f->target
again, so unmounting a JFFS2 that had a symlink looked up ends in a
double free.
Hand the target over to the VFS by clearing f->target once it is the
inode's i_link. Nothing else reads f->target after jffs2_iget().
Fixes: 66666e887c ("fs: free inode->i_link")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/jffs2/fs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 84f39a0f2a..1a125f9185 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -181,7 +181,9 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
case S_IFLNK:
inode->i_op = &simple_symlink_inode_operations;
+ /* the VFS frees i_link when destroying the inode */
inode->i_link = f->target;
+ f->target = NULL;
break;
case S_IFDIR:
--
2.47.3
next prev parent reply other threads:[~2026-11-02 14:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 14:53 [PATCH 1/2] fs: ubifs: " Sascha Hauer
2026-11-02 14:53 ` Sascha Hauer [this message]
2026-11-03 13:42 ` Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2026-11-02 14:52 Sascha Hauer
2026-11-02 14:52 ` [PATCH 2/2] fs: jffs2: " Sascha Hauer
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=20261102145302.3025815-2-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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