Message ID | 20240927114610.1278935-1-hui.wang@canonical.com (mailing list archive) |
---|---|
State | Accepted |
Commit | c283782fc5d60c4d8169137c6f955aa3553d3b3d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: phy: realtek: Check the index value in led_hw_control_get | expand |
On 9/27/24 1:46 PM, Hui Wang wrote: > 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@canonical.com> Reviewed-by: Marek Vasut <marex@denx.de> Thanks !
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Fri, 27 Sep 2024 19:46:10 +0800 you wrote: > 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@canonical.com> > > [...] Here is the summary with links: - net: phy: realtek: Check the index value in led_hw_control_get https://git.kernel.org/netdev/net/c/c283782fc5d6 You are awesome, thank you!
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 25e5bfbb6f89..c15d2f66ef0d 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;
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@canonical.com> --- drivers/net/phy/realtek.c | 3 +++ 1 file changed, 3 insertions(+)