]> git.baikalelectronics.ru Git - kernel.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)
commit285b95c3944bf4441c52ab4fc1831e7718592b89
tree209d4714e9a384d70d72255283ba2a96384705ad
parente642ed4a3cc2a9797c7486874dfff290196fedb7
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: 2fbd021a3daa ("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