[PATCH 2/2] nvme-fabrics: use kfree_sensitive() for the old DH-HMAC-CHAP secret
Hannes Reinecke
hare at suse.de
Mon Nov 16 05:45:12 PST 2026
On 11/16/26 11:02 AM, Martin George wrote:
> 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 at 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:
Reviewed-by: Hannes Reinecke <hare at kernel.org>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare at suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
More information about the Linux-nvme
mailing list