CVE-2022-50149 Information
Description
In the Linux kernel the following vulnerability has been resolved:
driver core: fix potential deadlock in __driver_attach
In __driver_attach function There are also AA deadlock problem like the commit b232b02bf3c2 (\driver core: fix deadlock in __device_attach).
stack like commit b232b02bf3c2 (\driver core: fix deadlock in __device_attach). list below: In __driver_attach function The lock holding logic is as follows: … __driver_attach if (driver_allows_async_probing(drv)) device_lock(dev) // get lock dev async_schedule_dev(__driver_attach_async_helper dev); // func async_schedule_node async_schedule_node_domain(func) entry = kzalloc(sizeof(struct async_entry) GFP_ATOMIC); / when fail or work limit sync to execute func but __driver_attach_async_helper will get lock dev as will which will lead to A-A deadlock. / if (!entry || atomic_read(&entry_count) > MAX_WORK) func; else queue_work_node(node system_unbound_wq &entry->work) device_unlock(dev)
As above show when it is allowed to do async probes because of
out of memory or work limit async work is not be allowed to do
sync execute instead. it will lead to A-A deadlock because of
__driver_attach_async_helper getting lock dev.
Reproduce: and it can be reproduce by make the condition (if (!entry || atomic_read(&entry_count) > MAX_WORK)) untenable like below:
[ 370.785650] cho 0 > /proc/sys/kernel/hung_task_timeout_secs\ disables
this message.
[ 370.787154] task:swapper/0 state:D stack: 0 pid: 1 ppid:
0 flags:0x00004000
[ 370.788865] Call Trace:
[ 370.789374]
To fix the deadlock move the async_schedule_dev outside device_lock as we can see in async_schedule_node_domain the parameter of queue_work_node is system_unbound_wq so it can accept concurrent operations. which will also not change the code logic and will not lead to deadlock.
Reference
https://git.kernel.org/stable/c/37f908038402c9b8325763f306a1c65d88757e15 https://git.kernel.org/stable/c/70fe758352cafdee72a7b13bf9db065f9613ced8 https://git.kernel.org/stable/c/733ab0c19bf17f6ad7c2b580ede006e369d5ab1b https://git.kernel.org/stable/c/779b634714c51d05baaeff4868ce2fd9fc7399bf https://git.kernel.org/stable/c/8191b6cd9ada09b675f17446d5872eb1f77685cb https://git.kernel.org/stable/c/a93f33aeef4e6a94ae9c9d3f5b2f9085ad0572ec
Related CNNVD
CNNVD-202506-2438 (Published: 2025-06-18)
Share on: