Skip to content

Commit c283782

Browse files
jason77-wangkuba-moo
authored andcommitted
net: phy: realtek: Check the index value in led_hw_control_get
Just like rtl8211f_led_hw_is_supported() and rtl8211f_led_hw_control_set(), the rtl8211f_led_hw_control_get() also needs to check the index value, otherwise the caller is likely to get an incorrect rules. Fixes: 1778480 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F") Signed-off-by: Hui Wang <hui.wang@canonical.com> Reviewed-by: Marek Vasut <marex@denx.de> Link: https://patch.msgid.link/20240927114610.1278935-1-hui.wang@canonical.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent aec7291 commit c283782

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/phy/realtek.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,9 @@ static int rtl8211f_led_hw_control_get(struct phy_device *phydev, u8 index,
527527
{
528528
int val;
529529

530+
if (index >= RTL8211F_LED_COUNT)
531+
return -EINVAL;
532+
530533
val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR);
531534
if (val < 0)
532535
return val;

0 commit comments

Comments
 (0)