diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2019-04-30 01:25:48 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-05-01 15:17:15 +0200 |
commit | f34e25898a608380a60135288019c4cb6013bec8 (patch) | |
tree | d95adcdb665a4af0438de4bcc1e88b4d80c87360 /drivers/nvme | |
parent | bcache: make is_discard_enabled() static (diff) | |
download | linux-f34e25898a608380a60135288019c4cb6013bec8.tar.xz linux-f34e25898a608380a60135288019c4cb6013bec8.zip |
nvme-tcp: fix possible null deref on a timed out io queue connect
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: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/tcp.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 2405bb9c63cc..2b107a1d152b 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1423,7 +1423,8 @@ static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx) if (!ret) { set_bit(NVME_TCP_Q_LIVE, &ctrl->queues[idx].flags); } 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, "failed to connect queue: %d ret=%d\n", idx, ret); } |