| From | Ben Hutchings <> | Date | Mon, 06 Nov 2017 23:03:02 +0000 | Subject | [PATCH 3.16 046/294] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd() |
| |
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
commit dd75cfa6d3216c79c695f5af13e52208afe374ad upstream.
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> Signed-off-by: Doug Ledford <dledford@redhat.com> [bwh: Backported to 3.16: keep calling ocrdma_mbx_dealloc_pd()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -565,7 +565,8 @@ err: if (is_uctx_pd) { ocrdma_release_ucontext_pd(uctx); } else { - status = ocrdma_mbx_dealloc_pd(dev, pd); + if (ocrdma_mbx_dealloc_pd(dev, pd)) + pr_err("%s: ocrdma_mbx_dealloc_pd() failed\n", __func__); kfree(pd); } exit:
|