• Wei Wang's avatar
    thermal: Fix deadlock in thermal thermal_zone_device_check · 163b00cd
    Wei Wang authored
    1851799e ("thermal: Fix use-after-free when unregistering thermal zone
    device") changed cancel_delayed_work to cancel_delayed_work_sync to avoid
    a use-after-free issue. However, cancel_delayed_work_sync could be called
    insides the WQ causing deadlock.
    
    [54109.642398] c0   1162 kworker/u17:1   D    0 11030      2 0x00000000
    [54109.642437] c0   1162 Workqueue: thermal_passive_wq thermal_zone_device_check
    [54109.642447] c0   1162 Call trace:
    [54109.642456] c0   1162  __switch_to+0x138/0x158
    [54109.642467] c0   1162  __schedule+0xba4/0x1434
    [54109.642480] c0   1162  schedule_timeout+0xa0/0xb28
    [54109.642492] c0   1162  wait_for_common+0x138/0x2e8
    [54109.642511] c0   1162  flush_work+0x348/0x40c
    [54109.642522] c0   1162  __cancel_work_timer+0x180/0x218
    [54109.642544] c0   1162  handle_thermal_trip+0x2c4/0x5a4
    [54109.642553] c0   1162  thermal_zone_device_update+0x1b4/0x25c
    [54109.642563] c0   1162  thermal_zone_device_check+0x18/0x24
    [54109.642574]...
    163b00cd
thermal_core.c 41 KB