OSDN Git Service

IB/mlx5: Skip non-ODP MR when handling a page fault
authorArtemy Kovalyov <artemyko@mellanox.com>
Sun, 25 Nov 2018 18:34:23 +0000 (20:34 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 26 Nov 2018 23:27:29 +0000 (16:27 -0700)
commit4d5422a309deecec906c491f8aea77593a46321d
tree8d7d9a9fd6f0afe595d638ce3f37f32c3eeca8ca
parentca088320a02537f36c243ac21794525d8eabb3bd
IB/mlx5: Skip non-ODP MR when handling a page fault

It is possible that we call pagefault_single_data_segment() with a MKey
that belongs to a memory region which is not on demand (i.e. pinned
pages). This can happen if, for instance, a WQE that points to multiple
MRs where some of them are ODP MRs and some are not.  In this case we
don't need to handle this MR in the ODP context besides reporting success.

Otherwise the code will call pagefault_mr() which will do to_ib_umem_odp()
on a non-ODP MR and thus access out of bounds.

Fixes: 7bdf65d411c1 ("IB/mlx5: Handle page faults")
Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/odp.c