summaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2018-10-08 14:28:54 -0700
committerChristoph Hellwig <hch@lst.de>2018-10-17 08:58:24 +0200
commit35da77d556c17980f9bd6892828a70d7a1a8a145 (patch)
treef0f8deb52659026d4405735f5f9c998b3991730d /drivers/nvme
parent43a6f8fb619730fe5989e2430669626b2b5e13a0 (diff)
downloadlinux-35da77d556c17980f9bd6892828a70d7a1a8a145.tar.bz2
nvmet-rdma: check for timeout in nvme_rdma_wait_for_cm()
Check whether queue->cm_error holds a value before reading it. This patch addresses Coverity ID 1373774: unchecked return value. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/rdma.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index dc042017c293..e7be903041a8 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -233,8 +233,15 @@ static void nvme_rdma_qp_event(struct ib_event *event, void *context)
static int nvme_rdma_wait_for_cm(struct nvme_rdma_queue *queue)
{
- wait_for_completion_interruptible_timeout(&queue->cm_done,
+ int ret;
+
+ ret = wait_for_completion_interruptible_timeout(&queue->cm_done,
msecs_to_jiffies(NVME_RDMA_CONNECT_TIMEOUT_MS) + 1);
+ if (ret < 0)
+ return ret;
+ if (ret == 0)
+ return -ETIMEDOUT;
+ WARN_ON_ONCE(queue->cm_error > 0);
return queue->cm_error;
}