summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-10-18 19:39:28 +0100
committerDoug Ledford <dledford@redhat.com>2016-12-14 11:18:17 -0500
commitea7ef2accdeaf825165cccd60b848765677bf1f2 (patch)
tree00e3f2b88b75a93163d337e002759dce98563bea
parente37a79e5d4cac3831fac3d4afbf2461f56b4b7bd (diff)
downloadblackbird-obmc-linux-ea7ef2accdeaf825165cccd60b848765677bf1f2.tar.gz
blackbird-obmc-linux-ea7ef2accdeaf825165cccd60b848765677bf1f2.zip
qedr: return -EINVAL if pd is null and avoid null ptr dereference
Currently, if pd is null then we hit a null pointer derference on accessing pd->pd_id. Instead of just printing an error message we should also return -EINVAL immediately. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/qedr/verbs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index a61514296767..b2a0eb8f73d2 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -511,8 +511,10 @@ int qedr_dealloc_pd(struct ib_pd *ibpd)
struct qedr_dev *dev = get_qedr_dev(ibpd->device);
struct qedr_pd *pd = get_qedr_pd(ibpd);
- if (!pd)
+ if (!pd) {
pr_err("Invalid PD received in dealloc_pd\n");
+ return -EINVAL;
+ }
DP_DEBUG(dev, QEDR_MSG_INIT, "Deallocating PD %d\n", pd->pd_id);
dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd->pd_id);
OpenPOWER on IntegriCloud