public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Ryan Lee" <ryan.lee@canonical.com>,
	"Malte Schröder" <malte.schroeder@tnxip.de>,
	"Christian Brauner" <brauner@kernel.org>
Subject: Re: [PATCH] efivarfs: fix NULL dereference on resume
Date: Tue, 18 Mar 2025 03:37:38 +0000	[thread overview]
Message-ID: <20250318033738.GV2023217@ZenIV> (raw)
In-Reply-To: <3e998bf87638a442cbc6864cdcd3d8d9e08ce3e3.camel@HansenPartnership.com>

On Mon, Mar 17, 2025 at 11:06:01PM -0400, James Bottomley wrote:

> +	/* ensure single superblock is alive and pin it */
> +	if (!atomic_inc_not_zero(&s->s_active))
> +		return NOTIFY_DONE;
> +
>  	pr_info("efivarfs: resyncing variable state\n");
>  
> -	/* O_NOATIME is required to prevent oops on NULL mnt */
> +	path.dentry = sfi->sb->s_root;
> +
> +	/*
> +	 * do not add SB_KERNMOUNT which a single superblock could
> +	 * expose to userspace and which also causes MNT_INTERNAL, see
> +	 * below
> +	 */
> +	path.mnt = vfs_kern_mount(&efivarfs_type, 0,
> +				  efivarfs_type.name, NULL);

Umm...  That's probably safe, but not as a long-term solution -
it's too intimately dependent upon fs/super.c internals.
The reasons why you can't run into ->s_umount deadlock here
are non-trivial...

  reply	other threads:[~2025-03-18  3:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18  3:06 [PATCH] efivarfs: fix NULL dereference on resume James Bottomley
2025-03-18  3:37 ` Al Viro [this message]
2025-03-18  7:04   ` Ard Biesheuvel
2025-03-18  7:49     ` Al Viro
2025-03-18 12:15       ` James Bottomley
2025-03-18 14:13       ` Christian Brauner
2025-03-18 14:52         ` James Bottomley

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=20250318033738.GV2023217@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=ardb@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=malte.schroeder@tnxip.de \
    --cc=ryan.lee@canonical.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