Skip to content

Commit d16e7b6

Browse files
Heikki Krogerusgregkh
authored andcommitted
usb: typec: ucsi: displayport: Fix NULL pointer dereference
If the registration of the DisplayPort was not successful, or if the port does not support DisplayPort alt mode in the first place, the function ucsi_displayport_remove_partner() will fail with NULL pointer dereference when it attempts to access the driver data. Adding a check to the function to make sure there really is driver data for the device before modifying it. Fixes: af8622f ("usb: typec: ucsi: Support for DisplayPort alt mode") Reported-by: Andrea Gagliardi La Gala <[email protected]> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206365 Cc: [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 b63e48f commit d16e7b6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/usb/typec/ucsi/displayport.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ void ucsi_displayport_remove_partner(struct typec_altmode *alt)
271271
return;
272272

273273
dp = typec_altmode_get_drvdata(alt);
274+
if (!dp)
275+
return;
276+
274277
dp->data.conf = 0;
275278
dp->data.status = 0;
276279
dp->initialized = false;

0 commit comments

Comments
 (0)