mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] rsa: fix deleting RSA keys
Date: Wed, 24 Jul 2024 11:47:02 +0200	[thread overview]
Message-ID: <20240724094702.876140-1-a.fatoum@pengutronix.de> (raw)

RSA keys are appended onto rsa_keys with rsa_key_add, so it makes sense
that rsa_key_free would remove them from the key ring's linked list.

It's possible to have "standalone" RSA keys outside the key ring, but
those would be global variables which can't be freed anyway.

There are no current users of this function.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 crypto/rsa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/rsa.c b/crypto/rsa.c
index b798badce0d0..a379b77c9acb 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -439,6 +439,8 @@ struct rsa_public_key *rsa_of_read_key(struct device_node *node)
 
 void rsa_key_free(struct rsa_public_key *key)
 {
+	list_del(&key->list);
+
 	free(key->modulus);
 	free(key->rr);
 	free(key);
-- 
2.39.2




             reply	other threads:[~2024-07-24  9:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24  9:47 Ahmad Fatoum [this message]
2024-07-30  8:15 ` Sascha Hauer

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=20240724094702.876140-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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