From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Christian Brauner <brauner@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 1/6] cred: add prepare credential guard
Date: Wed, 25 Nov 2026 21:03:45 -0500 [thread overview]
Message-ID: <20261126020308.1696715-1-sashal@kernel.org> (raw)
In-Reply-To: <2026112548-vowed-carded-1ef2@gregkh>
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit c8ad3098e1272444b6c75910d6196a36f5c8bc17 ]
A lot of code uses the following pattern:
* prepare new credentials
* modify them for their use-case
* drop them
Support that easier with the new guard infrastructure.
Link: https://patch.msgid.link/20251103-work-creds-guards-prepare_creds-v1-1-b447b82f2c9b@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: 86e2facd8630 ("ovl: bump the impure dir version when linking a file with origin")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/cred.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index be2cd07b174c5..418c4a4ac2955 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -278,6 +278,11 @@ static inline void put_cred(const struct cred *cred)
put_cred_many(cred, 1);
}
+DEFINE_CLASS(prepare_creds,
+ struct cred *,
+ if (_T) put_cred(_T),
+ prepare_creds(), void)
+
DEFINE_FREE(put_cred, struct cred *, if (!IS_ERR_OR_NULL(_T)) put_cred(_T))
/**
--
2.53.0
next prev parent reply other threads:[~2026-11-26 2:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 10:44 FAILED: patch "[PATCH] ovl: bump the impure dir version when linking a file with" failed to apply to 6.18-stable tree gregkh
2026-11-26 2:03 ` Sasha Levin [this message]
2026-11-26 2:03 ` [PATCH 6.18.y 2/6] ovl: port ovl_create_or_link() to cred guard Sasha Levin
2026-11-26 2:03 ` [PATCH 6.18.y 3/6] ovl: add ovl_override_creator_creds " Sasha Levin
2026-11-26 2:03 ` [PATCH 6.18.y 4/6] ovl: reflow ovl_create_or_link() Sasha Levin
2026-11-26 2:03 ` [PATCH 6.18.y 5/6] ovl: port ovl_create_or_link() to new ovl_override_creator_creds cleanup guard Sasha Levin
2026-11-28 23:00 ` Amir Goldstein
2026-11-26 2:03 ` [PATCH 6.18.y 6/6] ovl: bump the impure dir version when linking a file with origin 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=20261126020308.1696715-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=brauner@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.