Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Selvin Xavier <selvin.xavier@broadcom.com>,
	Naresh Gottumukkala <bgottumukkala@emulex.com>
Cc: Devesh Sharma <devesh.sharma@broadcom.com>,
	Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	Leon Romanovsky <leon@kernel.org>,
	Dasaratharaman Chandramouli
	<dasaratharaman.chandramouli@intel.com>,
	Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>,
	Artemy Kovalyov <artemyko@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	ssh10 <mayhs11saini@gmail.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd()
Date: Thu, 13 Jul 2017 10:46:14 +0300	[thread overview]
Message-ID: <20170713074614.obgl5mxxygcluyog@mwanda> (raw)

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);

             reply	other threads:[~2017-07-13  7:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13  7:46 Dan Carpenter [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170713074614.obgl5mxxygcluyog@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=artemyko@mellanox.com \
    --cc=bgottumukkala@emulex.com \
    --cc=dasaratharaman.chandramouli@intel.com \
    --cc=devesh.sharma@broadcom.com \
    --cc=dledford@redhat.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mayhs11saini@gmail.com \
    --cc=niranjana.vishwanathapura@intel.com \
    --cc=ogerlitz@mellanox.com \
    --cc=sean.hefty@intel.com \
    --cc=selvin.xavier@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox