Patch "phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe()" has been added to the 5.4-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: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe()

to the 5.4-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-hisilicon-fix-an-out-of-bounds-check-in-hisi_inn.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 30bc2a85e4980476ef6a1d6f4b00be6d17ab9ec7
Author: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
Date:   Fri Jul 21 02:05:55 2023 -0700

    phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe()
    
    [ Upstream commit 13c088cf3657d70893d75cf116be937f1509cc0f ]
    
    The size of array 'priv->ports[]' is INNO_PHY_PORT_NUM.
    
    In the for loop, 'i' is used as the index for array 'priv->ports[]'
    with a check (i > INNO_PHY_PORT_NUM) which indicates that
    INNO_PHY_PORT_NUM is allowed value for 'i' in the same loop.
    
    This > comparison needs to be changed to >=, otherwise it potentially leads
    to an out of bounds write on the next iteration through the loop
    
    Fixes: ba8b0ee81fbb ("phy: add inno-usb2-phy driver for hi3798cv200 SoC")
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230721090558.3588613-1-harshit.m.mogalapalli@xxxxxxxxxx
    Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
index 9b16f13b5ab29..96162b9a2e53d 100644
--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
+++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
@@ -155,7 +155,7 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
 		phy_set_drvdata(phy, &priv->ports[i]);
 		i++;
 
-		if (i > INNO_PHY_PORT_NUM) {
+		if (i >= INNO_PHY_PORT_NUM) {
 			dev_warn(dev, "Support %d ports in maximum\n", i);
 			break;
 		}



[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