[ofa-general] [PATCH] core: Check that the function reg_phys_mr is not NULL before executing it
Dotan Barak
dotanb at dev.mellanox.co.il
Tue Oct 9 08:48:02 PDT 2007
Check that the function reg_phys_mr is not NULL before executing it.
There are devices (for example: mlx4) that their low level driver
doesn't support this verb, so this patch will prevent kernel oops on them.
Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>
---
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 86ed8af..e2d54cb 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -672,6 +672,9 @@ struct ib_mr *ib_reg_phys_mr(struct ib_pd *pd,
{
struct ib_mr *mr;
+ if (!pd->device->reg_phys_mr)
+ return -ENOSYS;
+
mr = pd->device->reg_phys_mr(pd, phys_buf_array, num_phys_buf,
mr_access_flags, iova_start);
More information about the general
mailing list