Skip to content

Commit 131b0ed

Browse files
mawilli1anguy11
authored andcommitted
iavf: validate pointers
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: 43a3d9b ("i40evf: Allow PF driver to configure RSS") Signed-off-by: Mitch Williams <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 4f04008 commit 131b0ed

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/net/ethernet/intel/iavf/iavf_ethtool.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,14 +1859,13 @@ static int iavf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
18591859

18601860
if (hfunc)
18611861
*hfunc = ETH_RSS_HASH_TOP;
1862-
if (!indir)
1863-
return 0;
1864-
1865-
memcpy(key, adapter->rss_key, adapter->rss_key_size);
1862+
if (key)
1863+
memcpy(key, adapter->rss_key, adapter->rss_key_size);
18661864

1867-
/* Each 32 bits pointed by 'indir' is stored with a lut entry */
1868-
for (i = 0; i < adapter->rss_lut_size; i++)
1869-
indir[i] = (u32)adapter->rss_lut[i];
1865+
if (indir)
1866+
/* Each 32 bits pointed by 'indir' is stored with a lut entry */
1867+
for (i = 0; i < adapter->rss_lut_size; i++)
1868+
indir[i] = (u32)adapter->rss_lut[i];
18701869

18711870
return 0;
18721871
}

0 commit comments

Comments
 (0)