Skip to contentSkip to conversation

nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()

PATCH Applied John Garry 4 participants 4 messages Jul 6 – Jul 14 NVMe

lore
Share & tools
lore

John Garry

author
#0 lore raw

PATCH 1/1 nvme: don't reference NS after unlocking in nvme_ns_head_ctrl_ioctl()

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.

drivers/nvme/host/ioctl.c +1 -1
index 664216eece4a6..d5a8f375953bc 100644
@@ -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;
Signature · 1 line
2.43.7
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · 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.

Looks good:

maintainer Applied
#2 lore raw
In reply to John Garry
Quoted 3 lines · 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.

Thanks, applied to nvme-7.3.

Reviewed-by on v1 1/1
#3 lore raw
In reply to John Garry
Quoted 11 lines · 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.

drivers/nvme/host/ioctl.c +0 -0
index 664216eece4a6..d5a8f375953bc 100644

drivers/nvme/host/ioctl.c static int nvme_ns_head_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd, · line 705

Quoted 8 lines
drivers/nvme/host/ioctl.c +1 -1
@@ -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;

Cheers,

Hannes

Signature · 4 lines
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