public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] driver core: Call dma_cleanup() on the test_remove path
       [not found] <0-v1-8fd93768dbcf+19b-really_probe_dma_cleanup_jgg@nvidia.com>
@ 2023-07-24  3:56 ` Zenghui Yu
  2023-07-24 17:39   ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Zenghui Yu @ 2023-07-24  3:56 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Lu Baolu, Joerg Roedel,
	Linux Kernel Mailing List

+Cc: LKML

On 2023/7/22 0:20, Jason Gunthorpe wrote:
> 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>
> Closes: https://lore.kernel.org/all/6472f254-c3c4-8610-4a37-8d9dfdd54ce8@huawei.com/
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/base/dd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 878aa7646b37e4..a528cec24264ab 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -693,6 +693,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
>  
>  		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;
> 
> base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
> 

Tested-by: Zenghui Yu <yuzenghui@huawei.com>

Thanks,
Zenghui

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] driver core: Call dma_cleanup() on the test_remove path
  2023-07-24  3:56 ` [PATCH] driver core: Call dma_cleanup() on the test_remove path Zenghui Yu
@ 2023-07-24 17:39   ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2023-07-24 17:39 UTC (permalink / raw)
  To: Zenghui Yu
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Lu Baolu, Joerg Roedel,
	Linux Kernel Mailing List

On Mon, Jul 24, 2023 at 11:56:09AM +0800, Zenghui Yu wrote:
> +Cc: LKML

Oh, I accidentally missed that, I will repost this, thanks

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-24 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0-v1-8fd93768dbcf+19b-really_probe_dma_cleanup_jgg@nvidia.com>
2023-07-24  3:56 ` [PATCH] driver core: Call dma_cleanup() on the test_remove path Zenghui Yu
2023-07-24 17:39   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox