Messages in this thread | | | Date | Thu, 16 Jun 2022 15:11:12 +0800 | Subject | Re: [PATCH -next] driver core: fix deadlock in __driver_attach | From | "zhangwensheng (E)" <> |
| |
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@huawei.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; > } >
| |