diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2022-01-24 12:02:28 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-25 20:37:35 +0300 |
commit | 147ab5376f18045da9f22a8262185707745bbf77 (patch) | |
tree | f8bb4849d5f6f70750580926d5fee7a300c5ea15 /drivers/usb/typec/port-mapper.c | |
parent | 7817adb03cfb52ebb5bdb25fd9fc8f683a1a09d9 (diff) | |
download | linux-147ab5376f18045da9f22a8262185707745bbf77.tar.xz |
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>
Diffstat (limited to 'drivers/usb/typec/port-mapper.c')
-rw-r--r-- | drivers/usb/typec/port-mapper.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c index b6e0c6acc628..a7d507802509 100644 --- a/drivers/usb/typec/port-mapper.c +++ b/drivers/usb/typec/port-mapper.c @@ -60,6 +60,8 @@ int typec_link_ports(struct typec_port *con) return 0; bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); + if (!arg.match) + return 0; /* * REVISIT: Now each connector can have only a single component master. |