Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH 1/2] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd()
@ 2017-07-13  7:46 Dan Carpenter
  2017-07-13  7:46 ` [PATCH 2/2] RDMA/ocrdma: Fix error codes in ocrdma_create_srq() Dan Carpenter
  2017-07-22 17:29 ` [PATCH 1/2] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd() Doug Ledford
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-07-13  7:46 UTC (permalink / raw)
  To: Selvin Xavier, Naresh Gottumukkala
  Cc: Devesh Sharma, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Leon Romanovsky, Dasaratharaman Chandramouli,
	Niranjana Vishwanathapura, Artemy Kovalyov, Or Gerlitz,
	Dan Carpenter, ssh10, linux-rdma, linux-kernel, kernel-janitors

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@oracle.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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-22 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13  7:46 [PATCH 1/2] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd() Dan Carpenter
2017-07-13  7:46 ` [PATCH 2/2] RDMA/ocrdma: Fix error codes in ocrdma_create_srq() Dan Carpenter
2017-07-22 17:29   ` Doug Ledford
2017-07-22 17:29 ` [PATCH 1/2] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd() Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox