]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: typec: class: Fix NULL pointer access
authorAndrei Kuchynski <akuchynski@chromium.org>
Fri, 21 Mar 2025 14:37:26 +0000 (14:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Apr 2025 12:57:36 +0000 (14:57 +0200)
commitec27386de23a511008c53aa2f3434ad180a3ca9a
treee8e76523cbfc765850fa8182403a4d8aa5ffae74
parentbea5892d0ed274e03655223d1977cf59f9aff2f2
usb: typec: class: Fix NULL pointer access

Concurrent calls to typec_partner_unlink_device can lead to a NULL pointer
dereference. This patch adds a mutex to protect USB device pointers and
prevent this issue. The same mutex protects both the device pointers and
the partner device registration.

Cc: stable@vger.kernel.org
Fixes: 59de2a56d127 ("usb: typec: Link enumerated USB devices with Type-C partner")
Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250321143728.4092417-2-akuchynski@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/class.c
drivers/usb/typec/class.h