public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Sasha Levin <sashal@kernel.org>
Cc: ericvh@kernel.org, lucho@ionkov.net, linux_oss@crudebyte.com,
	sandeen@redhat.com, v9fs@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 9p: fix memory leak in v9fs_init_fs_context error path
Date: Wed, 25 Feb 2026 23:08:58 +0900	[thread overview]
Message-ID: <aZ8CeoJuTXYzdoTN@codewreck.org> (raw)
In-Reply-To: <20260225135745.351984-1-sashal@kernel.org>

Sasha Levin wrote on Wed, Feb 25, 2026 at 08:57:45AM -0500:
> Move the assignments of fc->ops and fc->fs_private to right after the
> kzalloc, before any fallible operations. Previously these were assigned
> at the end of the function, after the kstrdup calls for uname and aname.
> If either kstrdup failed, the error path would set fc->need_free but
> leave fc->ops NULL, so put_fs_context() would never call v9fs_free_fc()
> to free the allocated context and any already-duplicated strings.
> 
> Fixes: 1f3e4142c0eb ("9p: convert to the new mount API")
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Sasha Levin <sashal@kernel.org>

Looks correct to me (and there doesn't seem to be any side effect of
settings ops in the error path)

Pushed to my -next branch, will submit eventually.

Thanks!
-- 
Dominique

  reply	other threads:[~2026-02-25 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 13:57 [PATCH] 9p: fix memory leak in v9fs_init_fs_context error path Sasha Levin
2026-02-25 14:08 ` Dominique Martinet [this message]
2026-03-03 13:30 ` Christian Schoenebeck

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=aZ8CeoJuTXYzdoTN@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=sandeen@redhat.com \
    --cc=sashal@kernel.org \
    --cc=v9fs@lists.linux.dev \
    /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