Skip to content

Commit 3b9f2d9

Browse files
apanditgregkh
authored andcommitted
usb: typec: ucsi: Fix null pointer dereference in trace
[ Upstream commit 99516f7 ] ucsi_register_altmode checks IS_ERR for the alt pointer and treats NULL as valid. When CONFIG_TYPEC_DP_ALTMODE is not enabled, ucsi_register_displayport returns NULL which causes a NULL pointer dereference in trace. Rather than return NULL, call typec_port_register_altmode to register DisplayPort alternate mode as a non-controllable mode when CONFIG_TYPEC_DP_ALTMODE is not enabled. Reviewed-by: Benson Leung <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Abhishek Pandit-Subedi <[email protected]> Signed-off-by: Jameson Thies <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 73ec94a commit 3b9f2d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/typec/ucsi/ucsi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ ucsi_register_displayport(struct ucsi_connector *con,
404404
bool override, int offset,
405405
struct typec_altmode_desc *desc)
406406
{
407-
return NULL;
407+
return typec_port_register_altmode(con->port, desc);
408408
}
409409

410410
static inline void

0 commit comments

Comments
 (0)