Skip to content
Commit 5629d319 authored by Jon Hunter's avatar Jon Hunter Committed by Greg Kroah-Hartman
Browse files

usb: gadget: tegra-xudc: Fix crash in vbus_draw

Commit ac82b56b ("usb: gadget: tegra-xudc: Add vbus_draw support")
populated the vbus_draw callback for the Tegra XUDC driver. The function
tegra_xudc_gadget_vbus_draw(), that was added by this commit, assumes
that the pointer 'curr_usbphy' has been initialised, which is not always
the case because this is only initialised when the USB role is updated.
Fix this crash, by checking that the 'curr_usbphy' is valid before
dereferencing.

Fixes: ac82b56b

 ("usb: gadget: tegra-xudc: Add vbus_draw support")
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20230405181854.42355-1-jonathanh@nvidia.com
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9e6ca3e6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment