linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] certs: Prevent spurious errors on repeated blacklisting
@ 2022-11-04  1:47 Thomas Weißschuh
  2022-11-07 13:12 ` Mickaël Salaün
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Weißschuh @ 2022-11-04  1:47 UTC (permalink / raw)
  To: David Howells, David Woodhouse
  Cc: Thomas Weißschuh, keyrings, linux-kernel, Mickaël Salaün

When the blacklist keyring was changed to allow updates from the root
user it gained an ->update() function that disallows all updates.
When the a hash is blacklisted multiple times from the builtin or
firmware-provided blacklist this spams prominent logs during boot:

[    0.890814] blacklist: Problem blacklisting hash (-13)

As all these repeated calls to mark_raw_hash_blacklisted() would create
the same keyring entry again anyways these errors can be safely ignored.

Fixes: 6364d106e041 ("certs: Allow root user to append signed hashes to the blacklist keyring")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 certs/blacklist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/certs/blacklist.c b/certs/blacklist.c
index 41f10601cc72..5f7f2882ced7 100644
--- a/certs/blacklist.c
+++ b/certs/blacklist.c
@@ -191,7 +191,9 @@ static int mark_raw_hash_blacklisted(const char *hash)
 				   BLACKLIST_KEY_PERM,
 				   KEY_ALLOC_NOT_IN_QUOTA |
 				   KEY_ALLOC_BUILT_IN);
-	if (IS_ERR(key)) {
+
+	/* Blacklisting the same hash twice fails but would be idempotent */
+	if (IS_ERR(key) && PTR_ERR(key) != -EACCES) {
 		pr_err("Problem blacklisting hash (%ld)\n", PTR_ERR(key));
 		return PTR_ERR(key);
 	}

base-commit: ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-15 23:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04  1:47 [PATCH] certs: Prevent spurious errors on repeated blacklisting Thomas Weißschuh
2022-11-07 13:12 ` Mickaël Salaün
2022-11-07 15:55   ` Thomas Weißschuh
2022-11-07 16:20     ` Mickaël Salaün
2022-11-07 16:35       ` Thomas Weißschuh
2022-11-07 19:40         ` Mickaël Salaün
2022-11-15 23:57           ` Jarkko Sakkinen
2022-11-09 15:50   ` Eric Snowberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).