Patch "usb: gadget: tegra-xudc: Fix crash in vbus_draw" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-gadget-tegra-xudc-fix-crash-in-vbus_draw.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 949e7a0cf62ceaccfc38b2acd7b858c166f0fb48
Author: Jon Hunter <jonathanh@xxxxxxxxxx>
Date:   Wed Apr 5 19:18:53 2023 +0100

    usb: gadget: tegra-xudc: Fix crash in vbus_draw
    
    [ Upstream commit 5629d31955297ca47b9283c64fff70f2f34aa528 ]
    
    Commit ac82b56bda5f ("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: ac82b56bda5f ("usb: gadget: tegra-xudc: Add vbus_draw support")
    Reviewed-by: Thierry Reding <treding@xxxxxxxxxx>
    Signed-off-by: Jon Hunter <jonathanh@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230405181854.42355-1-jonathanh@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 2b71b33725f17..5bccd64847ff7 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -2167,7 +2167,7 @@ static int tegra_xudc_gadget_vbus_draw(struct usb_gadget *gadget,
 
 	dev_dbg(xudc->dev, "%s: %u mA\n", __func__, m_a);
 
-	if (xudc->curr_usbphy->chg_type == SDP_TYPE)
+	if (xudc->curr_usbphy && xudc->curr_usbphy->chg_type == SDP_TYPE)
 		ret = usb_phy_set_power(xudc->curr_usbphy, m_a);
 
 	return ret;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux