diff options
author | Jason Gunthorpe <[email protected]> | 2023-07-24 14:40:46 -0300 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2023-08-05 08:31:41 +0200 |
commit | f429378a9bf84d79a7e2cae05d2e3384cf7d68ba (patch) | |
tree | 0327437fe611c95fa15b0adb5144428925ac16a5 | |
parent | 22d2381bbd70a5853c2ee77522f4965139672db9 (diff) |
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 <[email protected]>
Tested-by: Zenghui Yu <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r-- | drivers/base/dd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 878aa7646b37..a528cec24264 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -693,6 +693,8 @@ re_probe: device_remove(dev); driver_sysfs_remove(dev); + if (dev->bus && dev->bus->dma_cleanup) + dev->bus->dma_cleanup(dev); device_unbind_cleanup(dev); goto re_probe; |