From: Jarkko Sakkinen <jarkko@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: David Howells <dhowells@redhat.com>,
bpf@vger.kernel.org, dm-devel@lists.linux.dev,
fsverity@lists.linux.dev, keyrings@vger.kernel.org,
linux-security-module@vger.kernel.org,
Alasdair Kergon <agk@redhat.com>,
Alexei Starovoitov <ast@kernel.org>, Alex Shi <alexs@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Andrii Nakryiko <andrii@kernel.org>,
Benjamin Marzinski <bmarzins@redhat.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Dongliang Mu <dzm91@hust.edu.cn>,
Eduard Zingerman <eddyz87@gmail.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
Eric Biggers <ebiggers@kernel.org>,
Ignat Korchagin <ignat@linux.win>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
James Morris <jmorris@namei.org>, Jiri Olsa <jolsa@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Paul Moore <paul@paul-moore.com>,
Randy Dunlap <rdunlap@infradead.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Song Liu <song@kernel.org>, "Theodore Y. Ts'o" <tytso@mit.edu>,
Yanteng Si <si.yanteng@linux.dev>,
Yonghong Song <yonghong.song@linux.dev>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v8 2/3] KEYS: Replace assoc_array with rhashtable
Date: Tue, 10 Nov 2026 07:21:27 +0200 [thread overview]
Message-ID: <avKp1xpBZBNeCrl5@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-206254@kernel.org>
On Tue, Nov 10, 2026 at 05:03:58AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [Critical] keys: uninitialized return value in __key_link_begin() on
> link replacement
> - [Critical] keys: goto jumps past __free(kfree) initialization in
> __key_link_begin()
I'll retract using cleanup.h shenanigans i.e.
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 60309f18e3a5..04d9a98c0f31 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -1185,6 +1185,7 @@ int __key_link_begin(struct key *keyring,
const struct keyring_index_key *index_key,
struct keyring_edit *edit)
{
+ struct keyring_link *link = NULL;
struct keyring_link *replace;
struct keyring_index *links;
int ret;
@@ -1211,7 +1212,7 @@ int __key_link_begin(struct key *keyring,
goto out;
}
- struct keyring_link *link __free(kfree) = kzalloc_obj(struct keyring_link);
+ link = kzalloc_obj(struct keyring_link);
if (!link) {
ret = -ENOMEM;
goto out;
@@ -1239,10 +1240,13 @@ int __key_link_begin(struct key *keyring,
}
}
- edit->new = no_free_ptr(link);
+ edit->new = link;
edit->old = replace;
+ ret = 0;
out:
+ if (ret && link)
+ kfree(link);
kleave(" = %d", ret);
return ret;
}
I went clearly over the top with the cleanup.h macros (lessons learned).
Br, Jarkko
next prev parent reply other threads:[~2026-11-10 5:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 4:40 [PATCH v8 0/3] KEYS: Replace assoc_array with rhashtable Jarkko Sakkinen
2026-11-10 4:40 ` [PATCH v8 1/3] KEYS: Introduce keyring_is_empty() Jarkko Sakkinen
2026-11-10 4:46 ` sashiko-bot
2026-11-10 4:40 ` [PATCH v8 2/3] KEYS: Replace assoc_array with rhashtable Jarkko Sakkinen
2026-11-10 5:03 ` sashiko-bot
2026-11-10 5:21 ` Jarkko Sakkinen [this message]
2026-11-10 4:40 ` [PATCH v8 3/3] lib: Remove assoc_array Jarkko Sakkinen
2026-11-10 4:45 ` sashiko-bot
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=avKp1xpBZBNeCrl5@kernel.org \
--to=jarkko@kernel.org \
--cc=agk@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bmarzins@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=dhowells@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=dzm91@hust.edu.cn \
--cc=ebiggers@kernel.org \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=fsverity@lists.linux.dev \
--cc=ignat@linux.win \
--cc=ihor.solodrai@linux.dev \
--cc=jmorris@namei.org \
--cc=jolsa@kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mpatocka@redhat.com \
--cc=paul@paul-moore.com \
--cc=rdunlap@infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=serge@hallyn.com \
--cc=si.yanteng@linux.dev \
--cc=skhan@linuxfoundation.org \
--cc=snitzer@kernel.org \
--cc=song@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=yonghong.song@linux.dev \
/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