Skip to content

Commit 147ab53

Browse files
Heikki Krogerusgregkh
authored andcommitted
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: 730b49a ("usb: typec: port-mapper: Convert to the component framework") Reported-by: Mikhail Gavrilov <[email protected]> Tested-by: John Stultz <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7817adb commit 147ab53

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/usb/typec/port-mapper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ int typec_link_ports(struct typec_port *con)
6060
return 0;
6161

6262
bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match);
63+
if (!arg.match)
64+
return 0;
6365

6466
/*
6567
* REVISIT: Now each connector can have only a single component master.

0 commit comments

Comments
 (0)