提交 7991cb9c 编写于 作者: M Michael Chan 提交者: David S. Miller

bnxt_en: Fix ethtool -x crash when device is down.

Fix ethtool .get_rxfh() crash by checking for valid indirection table
address before copying the data.
Signed-off-by: NMichael Chan <michael.chan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 949989b3
...@@ -870,17 +870,22 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, ...@@ -870,17 +870,22 @@ static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
u8 *hfunc) u8 *hfunc)
{ {
struct bnxt *bp = netdev_priv(dev); struct bnxt *bp = netdev_priv(dev);
struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; struct bnxt_vnic_info *vnic;
int i = 0; int i = 0;
if (hfunc) if (hfunc)
*hfunc = ETH_RSS_HASH_TOP; *hfunc = ETH_RSS_HASH_TOP;
if (indir) if (!bp->vnic_info)
return 0;
vnic = &bp->vnic_info[0];
if (indir && vnic->rss_table) {
for (i = 0; i < HW_HASH_INDEX_SIZE; i++) for (i = 0; i < HW_HASH_INDEX_SIZE; i++)
indir[i] = le16_to_cpu(vnic->rss_table[i]); indir[i] = le16_to_cpu(vnic->rss_table[i]);
}
if (key) if (key && vnic->rss_hash_key)
memcpy(key, vnic->rss_hash_key, HW_HASH_KEY_SIZE); memcpy(key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册