It is possible that a null pointer will be passed
to the qedr_set_common_qp_params function.
The patch adds a pointer check before dereferencing.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Andrey Shumilin <shum.sdl@nppct.ru>
---
drivers/infiniband/hw/qedr/verbs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 511c95bb3d01..09bb7fbe2bba 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -2270,6 +2270,11 @@ struct ib_qp *qedr_create_qp(struct ib_pd *ibpd,
return ERR_PTR(-ENOMEM);
}
+ if (!pd) {
+ DP_ERR(dev, "create qp: pd is NULL\n");
+ return ERR_PTR(-EINVAL);
+ }
+
qedr_set_common_qp_params(dev, qp, pd, attrs);
if (attrs->qp_type == IB_QPT_GSI) {
--
2.30.2