net/mlx5: Make mlx5_cmd_exec_cb() a safe API
authorJason Gunthorpe <jgg@mellanox.com>
Sat, 19 Jan 2019 00:33:10 +0000 (16:33 -0800)
committerLeon Romanovsky <leonro@mellanox.com>
Thu, 24 Jan 2019 12:25:26 +0000 (14:25 +0200)
commite355477ed9e4f401e3931043df97325d38552d54
tree66e4737120f301838503d0cc8cd197ffabc85196
parent73f5a82bb3c9fce550da4a74a32b8cb064b50663
net/mlx5: Make mlx5_cmd_exec_cb() a safe API

APIs that have deferred callbacks should have some kind of cleanup
function that callers can use to fence the callbacks. Otherwise things
like module unloading can lead to dangling function pointers, or worse.

The IB MR code is the only place that calls this function and had a
really poor attempt at creating this fence. Provide a good version in
the core code as future patches will add more places that need this
fence.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/mr.c
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/mellanox/mlx5/core/mr.c
include/linux/mlx5/driver.h