Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 2/4] ns: uniformly initialize ns_common
Date: Wed, 16 Sep 2026 22:19:00 -0400	[thread overview]
Message-ID: <20260917021902.3810750-2-sashal@kernel.org> (raw)
In-Reply-To: <20260917021902.3810750-1-sashal@kernel.org>

From: Christian Brauner <brauner@kernel.org>

[ Upstream commit 660def10b01b248fd97255afacb7b0e305ac833a ]

No point in cargo-culting the same code across all the different types.
Use one common initializer.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: 7812d6dab069 ("bootconfig: Fix integer overflow in initrd size check")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/proc_ns.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 75807ecef880f..5ea4835550823 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -70,6 +70,22 @@ static inline int ns_alloc_inum(struct ns_common *ns)
 	return proc_alloc_inum(&ns->inum);
 }
 
+static inline int ns_common_init(struct ns_common *ns,
+				 const struct proc_ns_operations *ops,
+				 bool alloc_inum)
+{
+	if (alloc_inum) {
+		int ret;
+		ret = proc_alloc_inum(&ns->inum);
+		if (ret)
+			return ret;
+	}
+	refcount_set(&ns->count, 1);
+	ns->stashed = NULL;
+	ns->ops = ops;
+	return 0;
+}
+
 #define ns_free_inum(ns) proc_free_inum((ns)->inum)
 
 extern struct file *proc_ns_fget(int fd);
-- 
2.53.0


  reply	other threads:[~2026-09-17  2:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 15:15 FAILED: patch "[PATCH] bootconfig: Fix integer overflow in initrd size check" failed to apply to 5.10-stable tree gregkh
2026-09-17  2:18 ` [PATCH 5.10.y 1/4] ns: move to_ns_common() to ns_common.h Sasha Levin
2026-09-17  2:19   ` Sasha Levin [this message]
2026-09-17  2:19   ` [PATCH 5.10.y 3/4] init/main: read bootconfig header with get_unaligned_le32() Sasha Levin
2026-09-17  2:19   ` [PATCH 5.10.y 4/4] bootconfig: Fix integer overflow in initrd size check Sasha Levin

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=20260917021902.3810750-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --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