[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170713074614.obgl5mxxygcluyog@mwanda>
Date: Thu, 13 Jul 2017 10:46:14 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Selvin Xavier <selvin.xavier@...adcom.com>,
Naresh Gottumukkala <bgottumukkala@...lex.com>
Cc: Devesh Sharma <devesh.sharma@...adcom.com>,
Doug Ledford <dledford@...hat.com>,
Sean Hefty <sean.hefty@...el.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
Leon Romanovsky <leon@...nel.org>,
Dasaratharaman Chandramouli
<dasaratharaman.chandramouli@...el.com>,
Niranjana Vishwanathapura <niranjana.vishwanathapura@...el.com>,
Artemy Kovalyov <artemyko@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
ssh10 <mayhs11saini@...il.com>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd()
We should preserve the original "status" error code instead of resetting
it to zero. Returning ERR_PTR(0) is the same as NULL and results in a
NULL dereference in the callers. I added a printk() on error instead.
Fixes: 45e86b33ec8b ("RDMA/ocrdma: Cache recv DB until QP moved to RTR")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 2f30bda8457a..cc317e858040 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -744,7 +744,8 @@ struct ib_pd *ocrdma_alloc_pd(struct ib_device *ibdev,
if (is_uctx_pd) {
ocrdma_release_ucontext_pd(uctx);
} else {
- status = _ocrdma_dealloc_pd(dev, pd);
+ if (_ocrdma_dealloc_pd(dev, pd))
+ pr_err("%s: _ocrdma_dealloc_pd() failed\n", __func__);
}
exit:
return ERR_PTR(status);
Powered by blists - more mailing lists