* [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
* [PATCH 2/2] RDMA/ocrdma: Fix error codes in ocrdma_create_srq()
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 ` 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
1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2017-07-13 7:46 UTC (permalink / raw)
To: Selvin Xavier, Parav Pandit
Cc: Devesh Sharma, Doug Ledford, Sean Hefty, Hal Rosenstock,
Leon Romanovsky, Dasaratharaman Chandramouli, Or Gerlitz, ssh10,
Artemy Kovalyov, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
If either of these allocations fail then we return ERR_PTR(0). That's
equivalent to NULL and results in a NULL pointer dereference in the
caller.
Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index cc317e858040..27d5e8d9f08d 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1902,6 +1902,7 @@ struct ib_srq *ocrdma_create_srq(struct ib_pd *ibpd,
goto err;
if (udata == NULL) {
+ status = -ENOMEM;
srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt,
GFP_KERNEL);
if (srq->rqe_wr_id_tbl == NULL)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ 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-13 7:46 ` [PATCH 2/2] RDMA/ocrdma: Fix error codes in ocrdma_create_srq() Dan Carpenter
@ 2017-07-22 17:29 ` Doug Ledford
1 sibling, 0 replies; 4+ 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] 4+ messages in thread
* Re: [PATCH 2/2] RDMA/ocrdma: Fix error codes in ocrdma_create_srq()
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
0 siblings, 0 replies; 4+ messages in thread
From: Doug Ledford @ 2017-07-22 17:29 UTC (permalink / raw)
To: Dan Carpenter, Selvin Xavier, Parav Pandit
Cc: Devesh Sharma, Sean Hefty, Hal Rosenstock, Leon Romanovsky,
Dasaratharaman Chandramouli, Or Gerlitz, ssh10, Artemy Kovalyov,
linux-rdma, kernel-janitors
[-- Attachment #1.1: Type: text/plain, Size: 550 bytes --]
On 7/13/2017 3:46 AM, Dan Carpenter wrote:
> If either of these allocations fail then we return ERR_PTR(0). That's
> equivalent to NULL and results in a NULL pointer dereference in the
> caller.
>
> Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
> 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] 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