]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
usb: chipidea: core: fix possible concurrent when switch role
authorXu Yang <xu.yang_2@nxp.com>
Fri, 17 Mar 2023 06:15:16 +0000 (14:15 +0800)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Wed, 17 May 2023 11:33:38 +0000 (13:33 +0200)
commit7b4cd55fcace51f97e4c51eb33a2895e40d1eec6
treef8c59c24f9ba3d3a80d339214d772cb16ec74dd3
parent9bd4e40fa3b35ea3736a6a1a8fc86a84a68dbf61
usb: chipidea: core: fix possible concurrent when switch role

BugLink: https://bugs.launchpad.net/bugs/2016877
commit 451b15ed138ec15bffbebb58a00ebdd884c3e659 upstream.

The user may call role_store() when driver is handling
ci_handle_id_switch() which is triggerred by otg event or power lost
event. Unfortunately, the controller may go into chaos in this case.
Fix this by protecting it with mutex lock.

Fixes: a932a8041ff9 ("usb: chipidea: core: add sysfs group")
cc: <stable@vger.kernel.org>
Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20230317061516.2451728-2-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/usb/chipidea/ci.h
drivers/usb/chipidea/core.c
drivers/usb/chipidea/otg.c