This is a note to let you know that I've just added the patch titled net: phy: realtek: Check the index value in led_hw_control_get to the 6.11-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: net-phy-realtek-check-the-index-value-in-led_hw_cont.patch and it can be found in the queue-6.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a2ee7089bb163d5080e1fbc1dd4a741879e2eba2 Author: Hui Wang <hui.wang@xxxxxxxxxxxxx> Date: Fri Sep 27 19:46:10 2024 +0800 net: phy: realtek: Check the index value in led_hw_control_get [ Upstream commit c283782fc5d60c4d8169137c6f955aa3553d3b3d ] 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: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F") Signed-off-by: Hui Wang <hui.wang@xxxxxxxxxxxxx> Reviewed-by: Marek Vasut <marex@xxxxxxx> Link: https://patch.msgid.link/20240927114610.1278935-1-hui.wang@xxxxxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 25e5bfbb6f89b..c15d2f66ef0dc 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -527,6 +527,9 @@ static int rtl8211f_led_hw_control_get(struct phy_device *phydev, u8 index, { int val; + if (index >= RTL8211F_LED_COUNT) + return -EINVAL; + val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR); if (val < 0) return val;