[PATCH net 0/2] iavf: Fix issues when setting channels concurrency

From: Ding Hui
Date: Sat Apr 08 2023 - 10:01:40 EST


There are two issues can be reproduced by the following script:

[root@host ~]# cat test-iavf-1.sh
#!/bin/bash

pf_dbsf="0000:40:01.1/0000:41:00.0"
vf0_dbsf="0000:40:01.1/0000:41:02.0"
g_pids=()

function do_set_numvf()
{
echo "set 2 vfs"
echo 2 >/sys/bus/pci/devices/${pf_dbsf}/sriov_numvfs
sleep $((RANDOM%3+1))
echo "set 0 vfs"
echo 0 >/sys/bus/pci/devices/${pf_dbsf}/sriov_numvfs
sleep $((RANDOM%3+1))
}

function do_nic_reset()
{
local nic=$(ls -1 --indicator-style=none /sys/bus/pci/devices/${vf0_dbsf}/net/)
[ -z "$nic" ] && { sleep $((RANDOM%3)) ; return 1; }
ifconfig $nic 192.168.18.5 netmask 255.255.255.0
ifconfig $nic up
echo "set $nic 1 combined"
ethtool -L $nic combined 1
echo "set $nic 4 combined"
ethtool -L $nic combined 4
sleep $((RANDOM%3))
}

function on_exit()
{
local pid
for pid in "${g_pids[@]}"; do
kill -0 "$pid" &>/dev/null && kill "$pid" &>/dev/null
done
g_pids=()
}

trap "on_exit; exit" EXIT

while :; do do_set_numvf ; done &
g_pids+=($!)
while :; do do_nic_reset ; done &
g_pids+=($!)

wait


Ding Hui (2):
iavf: Fix use-after-free in free_netdev
iavf: Fix out-of-bounds when setting channels on remove

drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 4 +++-
drivers/net/ethernet/intel/iavf/iavf_main.c | 6 +-----
2 files changed, 4 insertions(+), 6 deletions(-)

--
2.17.1