All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: Hannes Reinecke <hare@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	 Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 4/8] nvme: parse dhchap keys during option parsing
Date: Wed, 1 Apr 2026 11:43:11 -0700	[thread overview]
Message-ID: <20260401-9844eebdfe2fe11cf72e20aa@redhat.com> (raw)
In-Reply-To: <20260317130103.107360-5-hare@kernel.org>

On Tue, Mar 17, 2026 at 02:00:59PM +0100, Hannes Reinecke wrote:
> We really should parse the dhchap keys during option parsing to avoid
> having to pass around the plain dhchap secret. During options parsing
> we will create a 'dhchap' key with a random UUID as description, and
> store the key serial in the 'opts' structure.
> This simplifies key handling as on every access the key needs to be
> looked up and checked for validity before accessing the key data.
> 
> Signed-off-by: Hannes Reinecke <hare@kernel.org>
> ---
>  drivers/nvme/host/auth.c    | 118 +++++++++++++++--------
>  drivers/nvme/host/fabrics.c |  82 +++++++++++-----
>  drivers/nvme/host/fabrics.h |   8 +-
>  drivers/nvme/host/sysfs.c   | 185 ++++++++++++++++++++++++++----------
>  4 files changed, 275 insertions(+), 118 deletions(-)
> 
...
> @@ -1290,8 +1314,18 @@ void nvmf_free_options(struct nvmf_ctrl_options *opts)
>  	kfree(opts->subsysnqn);
>  	kfree(opts->host_traddr);
>  	kfree(opts->host_iface);
> -	kfree(opts->dhchap_secret);
> -	kfree(opts->dhchap_ctrl_secret);
> +	if (opts->dhchap_key) {
> +		pr_debug("revoke dhchap host key %08x\n",
> +			 key_serial(opts->dhchap_key));
> +		key_revoke(opts->dhchap_key);
> +		key_put(opts->dhchap_key);
> +	}
> +	if (opts->dhchap_ctrl_key) {
> +		pr_debug("revoke dhchap ctrl key %08x\n",
> +			 key_serial(opts->dhchap_ctrl_key));
> +		key_revoke(opts->dhchap_key);

This is revoking the wrong key, it should be dhchap_ctrl_key.

- Chris



  reply	other threads:[~2026-04-01 18:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 13:00 [PATCHv3 0/8] nvme-auth: switch to use the kernel keyring Hannes Reinecke
2026-03-17 13:00 ` [PATCH 1/8] nvme-auth: modify nvme_auth_transform_key() to return status Hannes Reinecke
2026-03-17 13:09   ` Maurizio Lombardi
2026-03-17 14:55     ` Hannes Reinecke
2026-03-17 13:00 ` [PATCH 2/8] nvme-keyring: add 'dhchap' key type Hannes Reinecke
2026-04-01 18:13   ` Chris Leech
2026-04-07  6:18     ` Hannes Reinecke
2026-03-17 13:00 ` [PATCH 3/8] nvme-auth: switch to use 'struct key' Hannes Reinecke
2026-04-01 18:36   ` Chris Leech
2026-04-07  6:20     ` Hannes Reinecke
2026-03-17 13:00 ` [PATCH 4/8] nvme: parse dhchap keys during option parsing Hannes Reinecke
2026-04-01 18:43   ` Chris Leech [this message]
2026-04-07  6:20     ` Hannes Reinecke
2026-03-17 13:01 ` [PATCH 5/8] nvmet-auth: parse dhchap key from configfs attribute Hannes Reinecke
2026-03-17 13:01 ` [PATCH 6/8] nvme: allow to pass in key description as dhchap secret Hannes Reinecke
2026-03-17 13:01 ` [PATCH 7/8] nvme-auth: wait for authentication to finish when changing keys Hannes Reinecke
2026-03-17 13:01 ` [PATCH 8/8] nvme-fabrics: allow to pass in keyring by name Hannes Reinecke
2026-03-17 13:20 ` [PATCHv3 0/8] nvme-auth: switch to use the kernel keyring Maurizio Lombardi
2026-03-17 14:44   ` Hannes Reinecke

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=20260401-9844eebdfe2fe11cf72e20aa@redhat.com \
    --to=cleech@redhat.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.