public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Bryan Gurney <bgurney@redhat.com>
Cc: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	axboe@kernel.dk, jmeneghi@redhat.com, mlombard@bsdbackstore.eu
Subject: Re: [PATCH 1/2] nvme: check duplicate unique identifiers in order
Date: Fri, 9 May 2025 09:33:15 -0600	[thread overview]
Message-ID: <aB4gO7mAYDO3Bm3A@kbusch-mbp> (raw)
In-Reply-To: <20250509151627.20434-1-bgurney@redhat.com>

On Fri, May 09, 2025 at 11:16:27AM -0400, Bryan Gurney wrote:
> +	if (has_uuid) {
> +		list_for_each_entry(h, &subsys->nsheads, entry)
> +			if (uuid_equal(&ids->uuid, &h->ids.uuid))
> +				return -EINVAL;
> +		return 0;
> +	}

You're returning success too early here. It may have a unique uuid, but
that doesn't mean we don't want to check for nguid and eui64 too. If
those are not unique, they need to be blanked out to make sure we don't
expose these on the namespace's sysfs attributes.

> +
> +	if (has_nguid) {
> +		list_for_each_entry(h, &subsys->nsheads, entry)
> +			if (memcmp(&ids->nguid,
> +				   &h->ids.nguid,
> +				   sizeof(ids->nguid)) == 0)
> +				return -EINVAL;
> +		return 0;
> +	}
> +
> +	if (has_eui64) {
> +		list_for_each_entry(h, &subsys->nsheads, entry)
> +			if (memcmp(&ids->eui64,
> +				   &h->ids.eui64,
> +				   sizeof(ids->eui64)) == 0)
> +				return -EINVAL;
> +		return 0;
>  	}
>  
>  	return 0;


  reply	other threads:[~2025-05-09 17:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-09 15:16 [PATCH 1/2] nvme: check duplicate unique identifiers in order Bryan Gurney
2025-05-09 15:33 ` Keith Busch [this message]
2025-05-12 15:18   ` John Meneghini
2025-05-12 16:12     ` Keith Busch
2025-06-24 15:16       ` Keith Busch
2025-07-15 19:01         ` John Meneghini
2025-07-15 19:29           ` Keith Busch
2025-07-22  7:00             ` Hannes Reinecke
2025-07-22 11:58               ` Martin K. Petersen
2025-09-12 20:32                 ` John Meneghini
2025-09-16 19:04                   ` Martin K. Petersen

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=aB4gO7mAYDO3Bm3A@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bgurney@redhat.com \
    --cc=hch@lst.de \
    --cc=jmeneghi@redhat.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mlombard@bsdbackstore.eu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox