]> asedeno.scripts.mit.edu Git - linux.git/commit
IB/mlx5: Fix how advise_mr() launches async work
authorJason Gunthorpe <jgg@mellanox.com>
Sat, 12 Jan 2019 02:31:24 +0000 (19:31 -0700)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 21 Jan 2019 21:39:29 +0000 (14:39 -0700)
commit951d01b96f174ded6180e7e4e14929ef22e7da7e
tree209d4714e9a384d70d72255283ba2a96384705ad
parentd79af7242bb237d00e40092810e6828fbb929d2d
IB/mlx5: Fix how advise_mr() launches async work

Work must hold a kref on the ib_device otherwise the dev pointer can
become free before the work runs. This can happen because the work is
being pushed onto the system work queue which is not flushed during driver
unregister.

Remove the bogus use of 'reg_state':
 - While in uverbs the reg_state is guaranteed to always be
   REGISTERED
 - Testing reg_state with no locking is bogus. Use ib_device_try_get()
   to get back into a region that prevents unregistration.

For now continue with a flow that is similar to the existing code.

Fixes: 813e90b1aeaa ("IB/mlx5: Add advise_mr() support")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Reviewed-by: Moni Shoua <monis@mellanox.com>
drivers/infiniband/hw/mlx5/odp.c