aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/verbs.c
diff options
context:
space:
mode:
authorKamal Heib <kamalheib1@gmail.com>2018-07-27 21:23:05 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-07-30 20:31:09 -0600
commit0584c47bbc3b3149bfe544d4e090fb6d96addf6c (patch)
tree996265242ada89b4d65c8e6767596a0a55bce552 /drivers/infiniband/core/verbs.c
parentRDMA/core: Remove {create,destroy}_ah from mandatory verbs (diff)
downloadlinux-dev-0584c47bbc3b3149bfe544d4e090fb6d96addf6c.tar.xz
linux-dev-0584c47bbc3b3149bfe544d4e090fb6d96addf6c.zip
RDMA/core: Check for verbs callbacks before using them
Make sure the providers implement the verbs callbacks before calling them, otherwise return -EOPNOTSUPP. Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/verbs.c')
-rw-r--r--drivers/infiniband/core/verbs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index cde359d48d34..5b76c7ebfa02 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -479,6 +479,9 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
{
struct ib_ah *ah;
+ if (!pd->device->create_ah)
+ return ERR_PTR(-EOPNOTSUPP);
+
ah = pd->device->create_ah(pd, ah_attr, udata);
if (!IS_ERR(ah)) {