mirror of https://lore.kernel.org/lkml/
 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-22 17:29 ` Doug Ledford
  0 siblings, 1 reply; 2+ 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	[flat|nested] 2+ messages in thread

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


[-- Attachment #1.1: Type: text/plain, Size: 603 bytes --]

On 7/13/2017 3:46 AM, Dan Carpenter wrote:
> 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>

This was accepted into 4.13-rc, thanks.

-- 
Doug Ledford <dledford@redhat.com>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

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

Thread overview: 2+ 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-22 17:29 ` Doug Ledford

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

all inboxes | Powered by JetHome®