All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()
@ 2026-07-06 12:54 John Garry
  2026-07-08  9:17 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Garry @ 2026-07-06 12:54 UTC (permalink / raw)
  To: hch, kbusch, sagi, axboe; +Cc: linux-nvme, John Garry

In nvme_ns_head_ctrl_ioctl(), once we drop the SRCU read lock we should
not reference the NS to lookup the controller, so use the available
controller pointer directly.

Signed-off-by: John Garry <john.g.garry@oracle.com>

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 664216eece4a6..d5a8f375953bc 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -699,7 +699,7 @@ static int nvme_ns_head_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd,
 
 	nvme_get_ctrl(ns->ctrl);
 	srcu_read_unlock(&head->srcu, srcu_idx);
-	ret = nvme_ctrl_ioctl(ns->ctrl, cmd, argp, open_for_write);
+	ret = nvme_ctrl_ioctl(ctrl, cmd, argp, open_for_write);
 
 	nvme_put_ctrl(ctrl);
 	return ret;
-- 
2.43.7



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()
  2026-07-06 12:54 [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl() John Garry
@ 2026-07-08  9:17 ` Christoph Hellwig
  2026-07-08 19:14 ` Keith Busch
  2026-07-14 13:12 ` Hannes Reinecke
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-07-08  9:17 UTC (permalink / raw)
  To: John Garry; +Cc: hch, kbusch, sagi, axboe, linux-nvme

On Mon, Jul 06, 2026 at 12:54:02PM +0000, John Garry wrote:
> In nvme_ns_head_ctrl_ioctl(), once we drop the SRCU read lock we should
> not reference the NS to lookup the controller, so use the available
> controller pointer directly.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()
  2026-07-06 12:54 [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl() John Garry
  2026-07-08  9:17 ` Christoph Hellwig
@ 2026-07-08 19:14 ` Keith Busch
  2026-07-14 13:12 ` Hannes Reinecke
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2026-07-08 19:14 UTC (permalink / raw)
  To: John Garry; +Cc: hch, sagi, axboe, linux-nvme

On Mon, Jul 06, 2026 at 12:54:02PM +0000, John Garry wrote:
> In nvme_ns_head_ctrl_ioctl(), once we drop the SRCU read lock we should
> not reference the NS to lookup the controller, so use the available
> controller pointer directly.

Thanks, applied to nvme-7.3.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()
  2026-07-06 12:54 [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl() John Garry
  2026-07-08  9:17 ` Christoph Hellwig
  2026-07-08 19:14 ` Keith Busch
@ 2026-07-14 13:12 ` Hannes Reinecke
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2026-07-14 13:12 UTC (permalink / raw)
  To: John Garry, hch, kbusch, sagi, axboe; +Cc: linux-nvme

On 7/6/26 2:54 PM, John Garry wrote:
> In nvme_ns_head_ctrl_ioctl(), once we drop the SRCU read lock we should
> not reference the NS to lookup the controller, so use the available
> controller pointer directly.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> 
> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
> index 664216eece4a6..d5a8f375953bc 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -699,7 +699,7 @@ static int nvme_ns_head_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd,
>   
>   	nvme_get_ctrl(ns->ctrl);
>   	srcu_read_unlock(&head->srcu, srcu_idx);
> -	ret = nvme_ctrl_ioctl(ns->ctrl, cmd, argp, open_for_write);
> +	ret = nvme_ctrl_ioctl(ctrl, cmd, argp, open_for_write);
>   
>   	nvme_put_ctrl(ctrl);
>   	return ret;

Reviewed-by: Hannes Reinecke <hare@kernel.org>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-14 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 12:54 [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl() John Garry
2026-07-08  9:17 ` Christoph Hellwig
2026-07-08 19:14 ` Keith Busch
2026-07-14 13:12 ` Hannes Reinecke

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.