Re: [PATCH] nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()

Hannes Reinecke <[email protected]>
Newsgroups org.infradead.lists.linux-nvme
Message-ID <[email protected]>
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 <[email protected]>
> 
> 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 <[email protected]>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.