Skip to content

Commit 22042ff

Browse files
Yuichiro Tsujigregkh
authored andcommitted
net: usb: asix_devices: Fix PHY address mask in MDIO bus initialization
[ Upstream commit 24ef2f5 ] Syzbot reported shift-out-of-bounds exception on MDIO bus initialization. The PHY address should be masked to 5 bits (0-31). Without this mask, invalid PHY addresses could be used, potentially causing issues with MDIO bus operations. Fix this by masking the PHY address with 0x1f (31 decimal) to ensure it stays within the valid range. Fixes: 4faff70 ("net: usb: asix_devices: add phy_mask for ax88772 mdio bus") Reported-by: syzbot+20537064367a0f98d597@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=20537064367a0f98d597 Tested-by: syzbot+20537064367a0f98d597@syzkaller.appspotmail.com Signed-off-by: Yuichiro Tsuji <yuichtsu@amazon.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20250818084541.1958-1-yuichtsu@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 78ba077 commit 22042ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/usb/asix_devices.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static int ax88772_init_mdio(struct usbnet *dev)
676676
priv->mdio->read = &asix_mdio_bus_read;
677677
priv->mdio->write = &asix_mdio_bus_write;
678678
priv->mdio->name = "Asix MDIO Bus";
679-
priv->mdio->phy_mask = ~(BIT(priv->phy_addr) | BIT(AX_EMBD_PHY_ADDR));
679+
priv->mdio->phy_mask = ~(BIT(priv->phy_addr & 0x1f) | BIT(AX_EMBD_PHY_ADDR));
680680
/* mii bus name is usb-<usb bus number>-<usb device number> */
681681
snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d",
682682
dev->udev->bus->busnum, dev->udev->devnum);

0 commit comments

Comments
 (0)