diff options
author | Jack Pham <[email protected]> | 2023-01-09 23:12:18 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <[email protected]> | 2023-01-17 17:06:18 +0100 |
commit | fac4b8633fd682ecc8e9cff61cb3e33374a1c7e5 (patch) | |
tree | 852bd83204f169eb29c327238c56410bed201b02 /tools/testing/selftests/bpf/progs/test_autoload.c | |
parent | bd449ad8cee9d4b523abbdfa73e1a2a08333f331 (diff) |
usb: ucsi: Ensure connector delayed work items are flushed
During ucsi_unregister() when destroying a connector's workqueue, there
may still be pending delayed work items that haven't been scheduled yet.
Because queue_delayed_work() uses a separate timer to schedule a work
item, the destroy_workqueue() call is not aware of any pending items.
Hence when a pending item's timer expires it would then try to queue on
a dangling workqueue pointer.
Fix this by keeping track of all work items in a list, so that prior to
destroying the workqueue any pending items can be flushed. Do this by
calling mod_delayed_work() as that will cause pending items to get
queued immediately, which then allows the ensuing destroy_workqueue() to
implicitly drain all currently queued items to completion and free
themselves.
Fixes: b9aa02ca39a4 ("usb: typec: ucsi: Add polling mechanism for partner tasks like alt mode checking")
Suggested-by: Heikki Krogerus <[email protected]>
Co-developed-by: Linyu Yuan <[email protected]>
Signed-off-by: Linyu Yuan <[email protected]>
Signed-off-by: Jack Pham <[email protected]>
Reviewed-by: Heikki Krogerus <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_autoload.c')
0 files changed, 0 insertions, 0 deletions