]> 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:37:05 +0000 (15:37 -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 c12a4cb951f68c314f39cafe7f9686ba4b70df00..254a48ede2660b777c257186089f5e580ad93a64 100644 (file)
@@ -334,8 +334,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;
 
        switch (wx->mac.type) {
        case wx_mac_sp: