]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: wangxun: limit tx_max_coalesced_frames_irq
authorJiawen Wu <jiawenwu@trustnetic.com>
Thu, 21 Aug 2025 02:34:06 +0000 (10:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:34:15 +0000 (15:34 -0500)
[ Upstream commit fd4aa243f154a80bbeb3dd311d2114eeb538f479 ]

Add limitation on tx_max_coalesced_frames_irq as 0 ~ 65535, because
'wx->tx_work_limit' is declared as a member of type u16.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250821023408.53472-3-jiawenwu@trustnetic.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c

index abe5921dde02001533e8dc8ff7b43dc6692d97ff..87c0af203dc4d0cd16a968f2de5234ef29e54e45 100644 (file)
@@ -319,8 +319,11 @@ int wx_set_coalesce(struct net_device *netdev,
                        return -EOPNOTSUPP;
        }
 
-       if (ec->tx_max_coalesced_frames_irq)
-               wx->tx_work_limit = ec->tx_max_coalesced_frames_irq;
+       if (ec->tx_max_coalesced_frames_irq > U16_MAX  ||
+           !ec->tx_max_coalesced_frames_irq)
+               return -EINVAL;
+
+       wx->tx_work_limit = ec->tx_max_coalesced_frames_irq;
 
        if (wx->mac.type == wx_mac_sp)
                max_eitr = WX_SP_MAX_EITR;