]> git.baikalelectronics.ru Git - kernel.git/commit
vdpa/mlx5: Avoid processing works if workqueue was destroyed
authorEli Cohen <elic@nvidia.com>
Mon, 21 Mar 2022 14:13:03 +0000 (16:13 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 28 Mar 2022 20:54:30 +0000 (16:54 -0400)
commit882dd9d79b26d0c8b08d89f3bbf126f461dce33f
tree5fdc2652c8dfa08c0e6e60ed0df08ae3b93fead9
parent1fd54b7fd5a06104e8f3315308102f9430566dc5
vdpa/mlx5: Avoid processing works if workqueue was destroyed

If mlx5_vdpa gets unloaded while a VM is running, the workqueue will be
destroyed. However, vhost might still have reference to the kick
function and might attempt to push new works. This could lead to null
pointer dereference.

To fix this, set mvdev->wq to NULL just before destroying and verify
that the workqueue is not NULL in mlx5_vdpa_kick_vq before attempting to
push a new work.

Fixes: 463ccc085b88 ("vdpa/mlx5: Add support for control VQ and MAC setting")
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220321141303.9586-1-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/mlx5/net/mlx5_vnet.c