Commit d28c4813 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Greg Kroah-Hartman

nvme-tcp: fix possible null deref on a timed out io queue connect

commit f34e2589 upstream.

If I/O queue connect times out, we might have freed the queue socket
already, so check for that on the error path in nvme_tcp_start_queue.
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bd445693
...@@ -1423,7 +1423,8 @@ static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx) ...@@ -1423,7 +1423,8 @@ static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx)
if (!ret) { if (!ret) {
set_bit(NVME_TCP_Q_LIVE, &ctrl->queues[idx].flags); set_bit(NVME_TCP_Q_LIVE, &ctrl->queues[idx].flags);
} else { } else {
__nvme_tcp_stop_queue(&ctrl->queues[idx]); if (test_bit(NVME_TCP_Q_ALLOCATED, &ctrl->queues[idx].flags))
__nvme_tcp_stop_queue(&ctrl->queues[idx]);
dev_err(nctrl->device, dev_err(nctrl->device,
"failed to connect queue: %d ret=%d\n", idx, ret); "failed to connect queue: %d ret=%d\n", idx, ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment