All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin George <martinus.gpy@gmail.com>
To: linux-nvme@lists.infradead.org
Cc: hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, hare@kernel.org
Subject: [PATCH 2/2] nvme-fabrics: use kfree_sensitive() for the old DH-HMAC-CHAP secret
Date: Mon, 16 Nov 2026 15:32:44 +0530	[thread overview]
Message-ID: <20261116100244.7824-3-marting@netapp.com> (raw)
In-Reply-To: <20261116100244.7824-1-marting@netapp.com>

When a connect string overrides dhchap_secret or dhchap_ctrl_secret,
nvmf_parse_options() frees the previous raw secret with plain kfree().
The invalid-input path already uses kfree_sensitive(), so do the same
for the replaced secret.

Signed-off-by: Martin George <marting@netapp.com>
---
 drivers/nvme/host/fabrics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index c262538523fb..5ed91557f070 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -1026,7 +1026,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 				ret = -EINVAL;
 				goto out;
 			}
-			kfree(opts->dhchap_secret);
+			kfree_sensitive(opts->dhchap_secret);
 			opts->dhchap_secret = p;
 			break;
 		case NVMF_OPT_DHCHAP_CTRL_SECRET:
@@ -1041,7 +1041,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 				ret = -EINVAL;
 				goto out;
 			}
-			kfree(opts->dhchap_ctrl_secret);
+			kfree_sensitive(opts->dhchap_ctrl_secret);
 			opts->dhchap_ctrl_secret = p;
 			break;
 		case NVMF_OPT_TLS:
-- 
2.53.0



  parent reply	other threads:[~2026-11-16 10:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 10:02 [PATCH 0/2] nvme: use kfree_sensitive() for DH-HMAC-CHAP secrets Martin George
2026-11-16 10:02 ` [PATCH 1/2] nvme-sysfs: " Martin George
2026-11-16 10:14   ` sashiko-bot
2026-11-16 13:44   ` Hannes Reinecke
2026-11-16 10:02 ` Martin George [this message]
2026-11-16 13:45   ` [PATCH 2/2] nvme-fabrics: use kfree_sensitive() for the old DH-HMAC-CHAP secret Hannes Reinecke
2026-11-16 16:18 ` [PATCH 0/2] nvme: use kfree_sensitive() for DH-HMAC-CHAP secrets Keith Busch

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=20261116100244.7824-3-marting@netapp.com \
    --to=martinus.gpy@gmail.com \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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.