The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Simon Liebold <simonlie@amazon.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Eric Sandeen <sandeen@redhat.com>,
	Christian Brauner <brauner@kernel.org>,
	<driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Cc: Simon Liebold <simonlie@amazon.de>, <stable@vger.kernel.org>
Subject: [PATCH] devtmpfs: restore mount option reconfiguration on get_tree
Date: Mon, 10 Aug 2026 08:34:38 +0000	[thread overview]
Message-ID: <20260810083438.764684-1-simonlie@amazon.de> (raw)

Commit cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in
public instance") converted devtmpfs to the new mount API but dropped
the reconfigure_single() call that reapplied mount options.

This causes userspace-requested mount options to be silently ignored.

To reproduce, boot a system where systemd mounts /dev with a size
option (e.g. size=4m), then check the actual size:

    findmnt -n -o SIZE --bytes /dev

On an affected kernel this returns ~50% of RAM instead of the
requested size.

Fix by calling fc->ops->reconfigure() after obtaining the superblock
reference in devtmpfs_get_tree().

Fixes: cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in public instance")
Cc: stable@vger.kernel.org
Signed-off-by: Simon Liebold <simonlie@amazon.de>
---
 drivers/base/devtmpfs.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index b1c4ceb65026e..44683dde04377 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -72,14 +72,25 @@ static struct file_system_type internal_fs_type = {
 	.kill_sb = kill_anon_super,
 };
 
-/* Simply take a ref on the existing mount */
+/* Take a ref on the existing mount and reconfigure to apply mount options. */
 static int devtmpfs_get_tree(struct fs_context *fc)
 {
 	struct super_block *sb = mnt->mnt_sb;
+	int err;
 
 	atomic_inc(&sb->s_active);
 	down_write(&sb->s_umount);
 	fc->root = dget(sb->s_root);
+
+	if (fc->ops->reconfigure) {
+		err = fc->ops->reconfigure(fc);
+		if (err) {
+			dput(fc->root);
+			fc->root = NULL;
+			deactivate_locked_super(sb);
+			return err;
+		}
+	}
 	return 0;
 }
 

base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
-- 
2.50.1


                 reply	other threads:[~2026-08-10  8:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260810083438.764684-1-simonlie@amazon.de \
    --to=simonlie@amazon.de \
    --cc=brauner@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sandeen@redhat.com \
    --cc=stable@vger.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