aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/umem.c
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2019-03-13 12:05:59 -0700
committerJason Gunthorpe <jgg@mellanox.com>2019-03-26 16:39:40 -0300
commit4ae27444100f54e6db3a046f086ba4e70e1ac22b (patch)
tree85adca1c927a4a119487a65c9e4f1261a7f3f1aa /drivers/infiniband/core/umem.c
parentRDMA/rxe: Fix slab-out-bounds access which lead to kernel crash later (diff)
downloadlinux-dev-4ae27444100f54e6db3a046f086ba4e70e1ac22b.tar.xz
linux-dev-4ae27444100f54e6db3a046f086ba4e70e1ac22b.zip
IB/core: Ensure an invalidate_range callback on ODP MR
No device supports ODP MR without an invalidate_range callback. Warn on any any device which attempts to support ODP without supplying this callback. Then we can remove the checks for the callback within the code. This stems from the discussion https://www.spinics.net/lists/linux-rdma/msg76460.html ...which concluded this code was no longer necessary. Acked-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/umem.c')
-rw-r--r--drivers/infiniband/core/umem.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index fe5551562dbc..89a7d57f9fa5 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -138,6 +138,11 @@ struct ib_umem *ib_umem_get(struct ib_udata *udata, unsigned long addr,
mmgrab(mm);
if (access & IB_ACCESS_ON_DEMAND) {
+ if (WARN_ON_ONCE(!context->invalidate_range)) {
+ ret = -EINVAL;
+ goto umem_kfree;
+ }
+
ret = ib_umem_odp_get(to_ib_umem_odp(umem), access);
if (ret)
goto umem_kfree;