summaryrefslogtreecommitdiffstats
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
parent43a6f8fb619730fe5989e2430669626b2b5e13a0 (diff)
downloadop-kernel-dev-35da77d556c17980f9bd6892828a70d7a1a8a145.zip
op-kernel-dev-35da77d556c17980f9bd6892828a70d7a1a8a145.tar.gz
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>
-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 dc04201..e7be903 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;
}
OpenPOWER on IntegriCloud