diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2023-07-24 20:40:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 10:42:53 +0300 |
commit | 91a05d4c12ce5f286319d0c7d4e4f95d7420384e (patch) | |
tree | cbc8487b6057a75971c69669fbbb455acf78e13a /drivers/base | |
parent | 58a3b87be681c9b0a07c4ab9524987e4846412eb (diff) | |
download | linux-91a05d4c12ce5f286319d0c7d4e4f95d7420384e.tar.xz |
driver core: Call dma_cleanup() on the test_remove path
[ Upstream commit f429378a9bf84d79a7e2cae05d2e3384cf7d68ba ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/base')
-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 97ab1468a876..380a53b6aee8 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -674,6 +674,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; |