vdpa/mlx5: Fix double release of debugfs entry
authorDragos Tatulea <dtatulea@nvidia.com>
Tue, 29 Aug 2023 17:40:09 +0000 (20:40 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 18 Oct 2023 15:29:29 +0000 (11:29 -0400)
commitf8a3db47d944a33eac1f37358db560e5aabbfbca
tree1ddfc6287049fcb42a973dff430055ad9e5ac63b
parentfab7f259227b8f70aa6d54e1de1a1f5f4729041c
vdpa/mlx5: Fix double release of debugfs entry

The error path in setup_driver deletes the debugfs entry but doesn't
clear the pointer. During .dev_del the invalid pointer will be released
again causing a crash.

This patch fixes the issue by always clearing the debugfs entry in
mlx5_vdpa_remove_debugfs. Also, stop removing the debugfs entry in
.dev_del op: the debugfs entry is already handled within the
setup_driver/teardown_driver scope.

Cc: stable@vger.kernel.org
Fixes: f0417e72add5 ("vdpa/mlx5: Add and remove debugfs in setup/teardown driver")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Message-Id: <20230829174014.928189-2-dtatulea@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vdpa/mlx5/net/debug.c
drivers/vdpa/mlx5/net/mlx5_vnet.c
drivers/vdpa/mlx5/net/mlx5_vnet.h