IB/mlx5: Lock QP during page fault handling
authorMoni Shoua <monis@mellanox.com>
Thu, 8 Nov 2018 19:10:12 +0000 (21:10 +0200)
committerLeon Romanovsky <leonro@mellanox.com>
Mon, 12 Nov 2018 20:21:01 +0000 (22:21 +0200)
commit032080ab43ac02cf7446b3954ace7ccce1abcad6
treee12a406c1e3a26fccc8f07f0a611865b728d87fb
parentc99fefea2cc907c98e7f39b3571bb697c8d42106
IB/mlx5: Lock QP during page fault handling

When page fault event for a WQE arrives, the event data contains the
resource (e.g. QP) number which will later be used by the page fault
handler to retrieve the resource. Meanwhile, another context can destroy
the resource and cause use-after-free. To avoid that, take a reference on the
resource when handler starts and release it when it ends.

Page fault events for RDMA operations don't need to be protected because
the driver doesn't need to access the QP in the page fault handler.

Fixes: d9aaed838765 ("{net,IB}/mlx5: Refactor page fault handling")
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/hw/mlx5/odp.c