Skip to contentSkip to conversation

nvme-fc: Only call nvme_cleanup_cmd() for normal operations

PATCH Applied Daniel Wagner 5 participants 5 messages May 29, 2020 – Jun 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fc: Only call nvme_cleanup_cmd() for normal operations

Asynchronous event notifications do not have an request associated. When fcp_io() fails we unconditionally call nvme_cleanup_cmd() which leads to a crash.

Fixes 16686f3a6c3c ("nvme: move common call to nvme_cleanup_cmd to core layer")
Cc Max Gurtovoy <[email protected]>
---
 drivers/nvme/host/fc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +3 -2
index 7dfc4a2ecf1e..287a3e8ea317 100644
@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
 		opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE);
 		__nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
 
-		if (!(op->flags & FCOP_FLAGS_AEN))
+		if (!(op->flags & FCOP_FLAGS_AEN)) {
 			nvme_fc_unmap_data(ctrl, op->rq, op);
+			nvme_cleanup_cmd(op->rq);
+		}
 
-		nvme_cleanup_cmd(op->rq);
 		nvme_fc_ctrl_put(ctrl);
 
 		if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Daniel Wagner

Asynchronous event notifications do not have an request associated. When fcp_io() fails we unconditionally call nvme_cleanup_cmd() which leads to a crash.

Fixes 16686f3a6c3c ("nvme: move common call to nvme_cleanup_cmd to core layer")
Cc Max Gurtovoy <[email protected]>
---
  drivers/nvme/host/fc.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +0 -0
index 7dfc4a2ecf1e..287a3e8ea317 100644
@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
  		opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE);
  		__nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
 

drivers/nvme/host/fc.c nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · line 2310

Quoted 10 lines
drivers/nvme/host/fc.c +3 -2
-		if (!(op->flags & FCOP_FLAGS_AEN))
+		if (!(op->flags & FCOP_FLAGS_AEN)) {
  			nvme_fc_unmap_data(ctrl, op->rq, op);
+			nvme_cleanup_cmd(op->rq);
+		}
 
-		nvme_cleanup_cmd(op->rq);
  		nvme_fc_ctrl_put(ctrl);
 
  		if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Wagner
Quoted 19 lines · Daniel Wagner

Asynchronous event notifications do not have an request associated. When fcp_io() fails we unconditionally call nvme_cleanup_cmd() which leads to a crash.

Fixes 16686f3a6c3c ("nvme: move common call to nvme_cleanup_cmd to core layer")
Cc Max Gurtovoy <[email protected]>
---
  drivers/nvme/host/fc.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +0 -0
index 7dfc4a2ecf1e..287a3e8ea317 100644
@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
  		opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE);
  		__nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
 

drivers/nvme/host/fc.c nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · line 2310

Quoted 10 lines
drivers/nvme/host/fc.c +3 -2
-		if (!(op->flags & FCOP_FLAGS_AEN))
+		if (!(op->flags & FCOP_FLAGS_AEN)) {
  			nvme_fc_unmap_data(ctrl, op->rq, op);
+			nvme_cleanup_cmd(op->rq);
+		}
 
-		nvme_cleanup_cmd(op->rq);
  		nvme_fc_ctrl_put(ctrl);
 
  		if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&

-- james

Reviewed-by on v1 1/1
#3 lore raw
In reply to Daniel Wagner
Quoted 19 lines · Daniel Wagner

Asynchronous event notifications do not have an request associated. When fcp_io() fails we unconditionally call nvme_cleanup_cmd() which leads to a crash.

Fixes 16686f3a6c3c ("nvme: move common call to nvme_cleanup_cmd to core layer")
Cc Max Gurtovoy <[email protected]>
---
  drivers/nvme/host/fc.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +0 -0
index 7dfc4a2ecf1e..287a3e8ea317 100644
@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
  		opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE);
  		__nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
 

drivers/nvme/host/fc.c nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · line 2310

Quoted 10 lines
drivers/nvme/host/fc.c +3 -2
-		if (!(op->flags & FCOP_FLAGS_AEN))
+		if (!(op->flags & FCOP_FLAGS_AEN)) {
  			nvme_fc_unmap_data(ctrl, op->rq, op);
+			nvme_cleanup_cmd(op->rq);
+		}
 
-		nvme_cleanup_cmd(op->rq);
  		nvme_fc_ctrl_put(ctrl);
 
  		if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&