Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: Don't try to register component master without components

This fixes NULL pointer dereference that happens if
component master is registered with empty component match
list.

Fixes: 730b49aac426 ("usb: typec: port-mapper: Convert to the component framework")
Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20220124090228.41396-3-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heikki Krogerus and committed by
Greg Kroah-Hartman
147ab537 7817adb0

+2
+2
drivers/usb/typec/port-mapper.c
··· 60 60 return 0; 61 61 62 62 bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); 63 + if (!arg.match) 64 + return 0; 63 65 64 66 /* 65 67 * REVISIT: Now each connector can have only a single component master.