Re: [PATCH v5 1/4] usb: typec: ucsi: Fix null pointer dereference in trace

From: Dmitry Baryshkov
Date: Fri May 31 2024 - 15:41:01 EST


On Fri, May 10, 2024 at 08:12:41PM +0000, Jameson Thies wrote:
> From: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
>
> 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 <bleung@xxxxxxxxxxxx>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>
> Signed-off-by: Jameson Thies <jthies@xxxxxxxxxx>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>


--
With best wishes
Dmitry