Patch "phy: usb: sunplus: Fix potential null-ptr-deref in sp_usb_phy_probe()" has been added to the 6.1-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

    phy: usb: sunplus: Fix potential null-ptr-deref in sp_usb_phy_probe()

to the 6.1-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:
     phy-usb-sunplus-fix-potential-null-ptr-deref-in-sp_u.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 29cb7c2bd64ec4a58e32b0c8b034e97cafbbc824
Author: Shang XiaoJing <shangxiaojing@xxxxxxxxxx>
Date:   Fri Nov 25 10:12:22 2022 +0800

    phy: usb: sunplus: Fix potential null-ptr-deref in sp_usb_phy_probe()
    
    [ Upstream commit 17eee264ef386ef30a69dd70e36f29893b85c170 ]
    
    sp_usb_phy_probe() will call platform_get_resource_byname() that may fail
    and return NULL. devm_ioremap() will use usbphy->moon4_res_mem->start as
    input, which may causes null-ptr-deref. Check the ret value of
    platform_get_resource_byname() to avoid the null-ptr-deref.
    
    Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
    Signed-off-by: Shang XiaoJing <shangxiaojing@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221125021222.25687-1-shangxiaojing@xxxxxxxxxx
    Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
index e827b79f6d49..56de41091d63 100644
--- a/drivers/phy/sunplus/phy-sunplus-usb2.c
+++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
@@ -254,6 +254,9 @@ static int sp_usb_phy_probe(struct platform_device *pdev)
 		return PTR_ERR(usbphy->phy_regs);
 
 	usbphy->moon4_res_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "moon4");
+	if (!usbphy->moon4_res_mem)
+		return -EINVAL;
+
 	usbphy->moon4_regs = devm_ioremap(&pdev->dev, usbphy->moon4_res_mem->start,
 					  resource_size(usbphy->moon4_res_mem));
 	if (!usbphy->moon4_regs)



[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