All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yifei Chu <Chuyf26@linux.alibaba.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH v3] nvmet: verify the hostid when looking up a controller
Date: Thu, 03 Sep 2026 10:37:14 +0800	[thread overview]
Message-ID: <178840303415.121937.10499065434948720286@linux.alibaba.com> (raw)
In-Reply-To: <20260902140400.GB23598@lst.de>

On Wed, Sep 02, 2026 at 04:04:00PM +0200, Christoph Hellwig wrote:
> So?  The hostid does not identify a controller.

Agreed, the controller is identified by cntlid and hostnqn. The
check is not about identifying the controller; it is about the host
identity bound to the controller at creation time:

- The fabrics connect path has a dedicated status for rejecting a
  connect because of the host identity: NVME_SC_CONNECT_INVALID_HOST
  (include/linux/nvme.h). nvmet already returns it from
  nvmet_alloc_ctrl() when the hostnqn is not allowed, but the hostid
  half of the host identity is never compared when io queues attach
  to an existing controller.

- The Linux host fills the same hostid into every connect capsule
  (nvmf_connect_data_prep() copies ctrl->opts->host->id, used by
  both the admin and the io connect path), and it refuses locally to
  pair one hostnqn with a different hostid ("maintain unambiguous
  host identification"). A conforming host therefore can never fail
  this check.

- nvmet consumes ctrl->hostid as the host identity: persistent
  reservation registrants and holders are keyed by it
  (drivers/nvme/target/pr.c). Letting an io connect with a different
  hostid attach its queues to the controller attributes those queues
  to a host the controller was not created for.

Comparing both halves of the host identity in the lookup is the
symmetric counterpart of the existing hostnqn comparison. If the
nvme maintainers disagree, I will drop the patch.

Yifei Chu


      reply	other threads:[~2026-09-03  2:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 10:12 [PATCH v2] nvmet: verify the hostid when looking up a controller Yifei Chu
2026-08-30 21:27 ` Sagi Grimberg
2026-08-31  2:36   ` [PATCH v3] " Yifei Chu
2026-09-02 14:04     ` Christoph Hellwig
2026-09-03  2:37       ` Yifei Chu [this message]

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=178840303415.121937.10499065434948720286@linux.alibaba.com \
    --to=chuyf26@linux.alibaba.com \
    --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.