Commit 88ea8f81 authored by Daniel Wagner's avatar Daniel Wagner Committed by Christoph Hellwig
Browse files

nvmet-fcloop: update refs on tfcp_req



Track the lifetime of the in-flight tfcp_req to ensure
the object is not freed too early.

Signed-off-by: default avatarDaniel Wagner <wagi@kernel.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent fbaed6a8
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -566,6 +566,7 @@ fcloop_call_host_done(struct nvmefc_fcp_req *fcpreq,
	}

	/* release original io reference on tgt struct */
	if (tfcp_req)
		fcloop_tfcp_req_put(tfcp_req);
}

@@ -671,6 +672,7 @@ fcloop_fcp_abort_recv_work(struct work_struct *work)
		break;
	default:
		spin_unlock_irqrestore(&tfcp_req->reqlock, flags);
		fcloop_tfcp_req_put(tfcp_req);
		WARN_ON(1);
		return;
	}
@@ -958,8 +960,10 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport,

	spin_lock(&inireq->inilock);
	tfcp_req = inireq->tfcp_req;
	if (tfcp_req)
		fcloop_tfcp_req_get(tfcp_req);
	if (tfcp_req) {
		if (!fcloop_tfcp_req_get(tfcp_req))
			tfcp_req = NULL;
	}
	spin_unlock(&inireq->inilock);

	if (!tfcp_req)