mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH] mm/secretmem: disable memfd_secret() if secretmem_init() fails
Date: Wed, 2 Dec 2026 18:00:51 +0200	[thread overview]
Message-ID: <axBAs1J30yJf3zI3@kernel.org> (raw)
In-Reply-To: <c5a883ed-5d8c-4fad-a911-4c09b1a70acb@kernel.org>

On Wed, Dec 02, 2026 at 01:44:34PM +0100, David Hildenbrand (Arm) wrote:
> On 12/2/26 12:38, Mike Rapoport wrote:
> > From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
> > 
> > If kern_mount() fails in secretmem_init(), secretmem_mnt holds an error
> > pointer, but secretmem_enable remains set. A later memfd_secret() call
> > then dereferences secretmem_mnt in secretmem_file_create() and oopses.
> > 
> > At fs_initcall time kern_mount() of a pseudo filesystem realistically
> > fails only when a memory allocation fails, so this is unlikely to happen
> > in practice.
> > 
> > Clear secretmem_enable when kern_mount() fails, so that memfd_secret()
> > returns -ENOSYS as if secretmem was disabled.
> > 
> > Reported-by: Sashiko <sashiko-bot@kernel.org>
> > Closes: https://sashiko.dev/bug/linux-ad411cd2-f343-445a-b61d-9fb3eb712762
> > Fixes: 4eb5bbde3ccb ("mm: fix dereferencing possible ERR_PTR")
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> > ---
> 
> Unlikely to happen, so I guess no need for stable.

Indeed
 
> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
> 
> -- 
> Cheers,
> 
> David

-- 
Sincerely yours,
Mike.

      reply	other threads:[~2026-12-02 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 11:38 Mike Rapoport
2026-12-02 12:44 ` David Hildenbrand (Arm)
2026-12-02 16:00   ` Mike Rapoport [this message]

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=axBAs1J30yJf3zI3@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sashiko-bot@kernel.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

all inboxes | Powered by JetHome®