提交 b5122289 编写于 作者: T Tariq Toukan 提交者: Yongqiang Liu

net: Fix features skip in for_each_netdev_feature()

stable inclusion
from stable-4.19.244
commit 48fed355543418c34de4b521365f438041523a1d
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5A6BA
CVE: NA

--------------------------------

[ Upstream commit 85db6352 ]

The find_next_netdev_feature() macro gets the "remaining length",
not bit index.
Passing "bit - 1" for the following iteration is wrong as it skips
the adjacent bit. Pass "bit" instead.

Fixes: 3b89ea9c ("net: Fix for_each_netdev_feature on Big endian")
Signed-off-by: NTariq Toukan <tariqt@nvidia.com>
Reviewed-by: NGal Pressman <gal@nvidia.com>
Link: https://lore.kernel.org/r/20220504080914.1918-1-tariqt@nvidia.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 eed7081d
...@@ -156,7 +156,7 @@ enum { ...@@ -156,7 +156,7 @@ enum {
#define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX)
#define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)
/* Finds the next feature with the highest number of the range of start till 0. /* Finds the next feature with the highest number of the range of start-1 till 0.
*/ */
static inline int find_next_netdev_feature(u64 feature, unsigned long start) static inline int find_next_netdev_feature(u64 feature, unsigned long start)
{ {
...@@ -175,7 +175,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start) ...@@ -175,7 +175,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
for ((bit) = find_next_netdev_feature((mask_addr), \ for ((bit) = find_next_netdev_feature((mask_addr), \
NETDEV_FEATURE_COUNT); \ NETDEV_FEATURE_COUNT); \
(bit) >= 0; \ (bit) >= 0; \
(bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) (bit) = find_next_netdev_feature((mask_addr), (bit)))
/* Features valid for ethtool to change */ /* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */ /* = all defined minus driver/device-class-related */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册