提交 63d78b3a 编写于 作者: M Mitch Williams 提交者: Zheng Zengkai

iavf: validate pointers

stable inclusion
form stable-v5.10.82
commit 77f5ae5441f0d739c7e1780f309088143252a6ef
bugzilla: 185877 https://gitee.com/openeuler/kernel/issues/I4QU6V

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=77f5ae5441f0d739c7e1780f309088143252a6ef

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

[ Upstream commit 131b0edc ]

In some cases, the ethtool get_rxfh handler may be called with a null
key or indir parameter. So check these pointers, or you will have a very
bad day.

Fixes: 43a3d9ba ("i40evf: Allow PF driver to configure RSS")
Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
Tested-by: NTony Brelinski <tony.brelinski@intel.com>
Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 66a3f917
...@@ -991,14 +991,13 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, ...@@ -991,14 +991,13 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
if (hfunc) if (hfunc)
*hfunc = ETH_RSS_HASH_TOP; *hfunc = ETH_RSS_HASH_TOP;
if (!indir) if (key)
return 0; memcpy(key, adapter->rss_key, adapter->rss_key_size);
memcpy(key, adapter->rss_key, adapter->rss_key_size);
/* Each 32 bits pointed by 'indir' is stored with a lut entry */ if (indir)
for (i = 0; i < adapter->rss_lut_size; i++) /* Each 32 bits pointed by 'indir' is stored with a lut entry */
indir[i] = (u32)adapter->rss_lut[i]; for (i = 0; i < adapter->rss_lut_size; i++)
indir[i] = (u32)adapter->rss_lut[i];
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册