driver core: Call dma_cleanup() on the test_remove path
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 24 Jul 2023 17:40:46 +0000 (14:40 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Aug 2023 06:31:41 +0000 (08:31 +0200)
commitf429378a9bf84d79a7e2cae05d2e3384cf7d68ba
tree0327437fe611c95fa15b0adb5144428925ac16a5
parent22d2381bbd70a5853c2ee77522f4965139672db9
driver core: Call dma_cleanup() on the test_remove path

When test_remove is enabled really_probe() does not properly pair
dma_configure() with dma_remove(), it will end up calling dma_configure()
twice. This corrupts the owner_cnt and renders the group unusable with
VFIO/etc.

Add the missing cleanup before going back to re_probe.

Fixes: 25f3bcfc54bc ("driver core: Add dma_cleanup callback in bus_type")
Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Tested-by: Zenghui Yu <yuzenghui@huawei.com>
Closes: https://lore.kernel.org/all/6472f254-c3c4-8610-4a37-8d9dfdd54ce8@huawei.com/
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/0-v2-4deed94e283e+40948-really_probe_dma_cleanup_jgg@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/dd.c