From: Ian Kent <raven@themaw.net>
To: Jeffin Philip <jeffinphilip14@gmail.com>
Cc: bodonnel@redhat.com, brauner@kernel.org, autofs@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+df1db6e034b3953e19f5@syzkaller.appspotmail.com,
stable@vger.kernel.org
Subject: Re: [PATCH] fs: autofs: fix memory leak in autofs_fill_super()
Date: Thu, 3 Sep 2026 20:28:32 +0800 [thread overview]
Message-ID: <29f823ee-9423-4d19-97bf-8fa951016bf9@themaw.net> (raw)
In-Reply-To: <20260903081048.132524-1-jeffinphilip14@gmail.com>
On 3/9/26 16:10, Jeffin Philip wrote:
> In autofs_fill_super(), we create a new inode using
> autofs_new_ino(), however, if we fail to create root_inode,
> (that is, root_inode failure path), we return -ENOMEM without
> freeing the new inode(ino) that we created causing a memory leak.
> Fix this by adding autofs_free_ino() to free the inode we created
> in root_inode failure path before returning ENOMEM.
>
> Reported-by: syzbot+df1db6e034b3953e19f5@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=df1db6e034b3953e19f5
> Fixes: 66917f85db60 ("autofs: add: new_inode check in autofs_fill_super()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
> ---
> fs/autofs/inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
> index c1e210cec436..6b15a3717ba7 100644
> --- a/fs/autofs/inode.c
> +++ b/fs/autofs/inode.c
> @@ -323,8 +323,10 @@ static int autofs_fill_super(struct super_block *s, struct fs_context *fc)
> return -ENOMEM;
>
> root_inode = autofs_get_inode(s, S_IFDIR | 0755);
> - if (!root_inode)
> + if (!root_inode) {
> + autofs_free_ino(ino);
> return -ENOMEM;
> + }
>
> root_inode->i_uid = ctx->uid;
> root_inode->i_gid = ctx->gid;
Thanks Jeffin, this looks better.
Signed-off-by: Ian Kent <raven@themaw.net>
Christian, can you take this one please, ;)
next prev parent reply other threads:[~2026-09-03 12:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 8:10 Jeffin Philip
2026-09-03 12:28 ` Ian Kent [this message]
2026-09-04 7:48 ` Christian Brauner
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=29f823ee-9423-4d19-97bf-8fa951016bf9@themaw.net \
--to=raven@themaw.net \
--cc=autofs@vger.kernel.org \
--cc=bodonnel@redhat.com \
--cc=brauner@kernel.org \
--cc=jeffinphilip14@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+df1db6e034b3953e19f5@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®