]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
usb: typec: tcpm: fix tcpm unregister port but leave a pending timer
authorXu Yang <xu.yang_2@nxp.com>
Thu, 9 Dec 2021 10:15:07 +0000 (18:15 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:28 +0000 (09:49 +0100)
commitd006d709d5f0723591cd4694d08ee262892395ac
tree9eb862405c34902c5a4c2b4f5f7f5b02ea47d060
parentdcedcfe4d48e16d7b23718ea69cde71369b260f3
usb: typec: tcpm: fix tcpm unregister port but leave a pending timer

BugLink: https://bugs.launchpad.net/bugs/1956302
commit ca4d8344a72b91fb9d4c8bfbc22204b4c09c5d8f upstream.

In current design, when the tcpm port is unregisterd, the kthread_worker
will be destroyed in the last step. Inside the kthread_destroy_worker(),
the worker will flush all the works and wait for them to end. However, if
one of the works calls hrtimer_start(), this hrtimer will be pending until
timeout even though tcpm port is removed. Once the hrtimer timeout, many
strange kernel dumps appear.

Thus, we can first complete kthread_destroy_worker(), then cancel all the
hrtimers. This will guarantee that no hrtimer is pending at the end.

Fixes: 3ed8e1c2ac99 ("usb: typec: tcpm: Migrate workqueue to RT priority for processing events")
cc: <stable@vger.kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20211209101507.499096-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/usb/typec/tcpm/tcpm.c