Commit 00403f04 authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher

i40e: don't free nonexistent rings

Not all VSIs have rings! Check to see if rings were actually allocated before
freeing them.

This prevents a panic when tx_rings[0] is not allocated.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarSibai Li <sibai.li@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 1022cb6c
...@@ -5160,11 +5160,12 @@ static s32 i40e_vsi_clear_rings(struct i40e_vsi *vsi) ...@@ -5160,11 +5160,12 @@ static s32 i40e_vsi_clear_rings(struct i40e_vsi *vsi)
{ {
int i; int i;
for (i = 0; i < vsi->alloc_queue_pairs; i++) { if (vsi->tx_rings[0])
kfree_rcu(vsi->tx_rings[i], rcu); for (i = 0; i < vsi->alloc_queue_pairs; i++) {
vsi->tx_rings[i] = NULL; kfree_rcu(vsi->tx_rings[i], rcu);
vsi->rx_rings[i] = NULL; vsi->tx_rings[i] = NULL;
} vsi->rx_rings[i] = NULL;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment