Skip to content

Commit

Permalink
usb: typec: ucsi: Fix null pointer dereference in trace
Browse files Browse the repository at this point in the history
[ 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]>
  • Loading branch information
apandit authored and gregkh committed Sep 8, 2024
1 parent 73ec94a commit 3b9f2d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/typec/ucsi/ucsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ ucsi_register_displayport(struct ucsi_connector *con,
bool override, int offset,
struct typec_altmode_desc *desc)
{
return NULL;
return typec_port_register_altmode(con->port, desc);
}

static inline void
Expand Down

0 comments on commit 3b9f2d9

Please sign in to comment.