Skip to content

Commit

Permalink
usb: typec: Don't try to register component master without components
Browse files Browse the repository at this point in the history
This fixes NULL pointer dereference that happens if
component master is registered with empty component match
list.

Fixes: 730b49a ("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>
  • Loading branch information
Heikki Krogerus authored and Greg Kroah-Hartman committed Jan 25, 2022
1 parent 7817adb commit 147ab53
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/typec/port-mapper.c
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 147ab53

Please sign in to comment.