[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71004ab9-38e0-4323-2506-38d6e71130f6@huawei.com>
Date: Thu, 16 Jun 2022 15:11:12 +0800
From: "zhangwensheng (E)" <zhangwensheng5@...wei.com>
To: <gregkh@...uxfoundation.org>, <rafael@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <yukuai3@...wei.com>
Subject: Re: [PATCH -next] driver core: fix deadlock in __driver_attach
friendly ping...
在 2022/6/8 17:43, Zhang Wensheng 写道:
> In __driver_attach function, There are also potential AA deadlock
> problem, like the commit b232b02bf3c2 ("driver core: fix deadlock
> in __device_attach").
>
> Fixes: ef0ff68351be ("driver core: Probe devices asynchronously instead of the driver")
> Signed-off-by: Zhang Wensheng <zhangwensheng5@...wei.com>
> ---
> drivers/base/dd.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 11b0fb6414d3..b766968a873c 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -1115,6 +1115,7 @@ static void __driver_attach_async_helper(void *_dev, async_cookie_t cookie)
> static int __driver_attach(struct device *dev, void *data)
> {
> struct device_driver *drv = data;
> + bool async = false;
> int ret;
>
> /*
> @@ -1153,9 +1154,11 @@ static int __driver_attach(struct device *dev, void *data)
> if (!dev->driver && !dev->p->async_driver) {
> get_device(dev);
> dev->p->async_driver = drv;
> - async_schedule_dev(__driver_attach_async_helper, dev);
> + async = true;
> }
> device_unlock(dev);
> + if (async)
> + async_schedule_dev(__driver_attach_async_helper, dev);
> return 0;
> }
>
Powered by blists - more mailing lists