]> git.baikalelectronics.ru Git - kernel.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Apr 2023 09:16:41 +0000 (11:16 +0200)
commit1c409ccea37fa5e2e100da54883aaec4d1626940
tree53ed0c2fe2634054f2a0dd57ebf3e5c8e4fd62ca
parentd72097ebb927a7c1b68cfccdfc2c9779761be2bf
usb: chipidea: core: fix possible concurrent when switch role

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: 6077caa77c13 ("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>
drivers/usb/chipidea/ci.h
drivers/usb/chipidea/core.c
drivers/usb/chipidea/otg.c