i40e: Fix queues reservation scheme
Subsystems (2)
PATCH 1/1 i40e: Fix queues reservation scheme
Depending on the CPU count and NVM configuration, PF reset and rebuild may fail if more queues are allocated (e.g. attach XDP program), causes kernel NULL pointer dereference. The issue is that during rebuild, FDIR VSI's queue pile is not zeroed, despite no VSIs, but PF exisiting. The change causes all queue pairs released from the queue pile.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +22 -2
@@ -196,7 +196,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,return -EINVAL ; } -/* start the linear search with an imperfect hint */ +/* start from beginning because earlier areas may have been freed */ i = pile->search_hint;while (i < pile->num_entries) {/* skip already allocated entries */
@@ -227,6 +227,26 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,return ret; } +/** +* i40e_put_all_lump - return a lump of generic resource +* @pile: the pile of resource to search +* +* Returns the count of items in the lump +**/ +static void i40e_put_all_lump (struct i40e_lump_tracking *pile) +{ +u16 i; + +if (!pile) +return ; + +for (i =0 ; + i < pile->num_entries; + i++) { + pile->list[i] =0 ; + } +} +/** * i40e_put_lump - return a lump of generic resource * @pile: the pile of resource to search
@@ -13966,7 +13986,7 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) pf = vsi->back; -i40e_put_lump (pf->qp_pile, vsi->base_queue, vsi->idx); +i40e_put_all_lump (pf->qp_pile);i40e_vsi_clear_rings (vsi);i40e_vsi_free_arrays (vsi, false);
Signature · 1 line
2.27.0
Nguyen
PATCH 1/1 i40e: Fix queues reservation scheme
Quoted 8 lines · Jedrzej Jagielski
Depending on the CPU count and NVM configuration, PF reset and rebuild may fail if more queues are allocated (e.g. attach XDP program),
causes kernel NULL pointer dereference. The issue is that during rebuild,
FDIR VSI's queue pile is not zeroed, despite no VSIs, but PF exisiting.
The change causes all queue pairs released from the queue pile.
This patch doesn't apply. Please fix.
Quoted 22 lines
Fixes bc7d338fbb3f ("i40e: reinit flow for the main VSI")Signed-off-by Przemyslaw Patynowski <przemyslawx.patynowski at intel.com>
Signed-off-by Lukasz Cieplicki <[email protected]>Signed-off-by Jedrzej Jagielski <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/i40e/i40e_main.c +1
-1@@ -196,7 +196,7 @@ static int i40e_get_lump(struct i40e_pf *pf,struct i40e_lump_tracking *pile, return -EINVAL; } -/* start the linear search with an imperfect hint */ +/* start from beginning because earlier areas may have been
Quoted 1 line
freed */
Why the comment change? I don't see any code changes and I'm not seeing it start from the beginning.
Quoted 14 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +6
-0i = pile->search_hint;while (i < pile->num_entries) {/* skip already allocated entries */ @@ -227,6 +227,26 @@ static int i40e_get_lump(struct i40e_pf *pf,struct i40e_lump_tracking *pile, return ret; } +/** +* i40e_put_all_lump - return a lump of generic resource +* @pile: the pile of resource to search +* +* Returns the count of items in the lump +**/
drivers/net/ethernet/intel/i40e/i40e_main.c static int i40e_get_lump(struct i40e_pf *pf, · line 246
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +10
-0+static void i40e_put_all_lump (struct i40e_lump_tracking *pile) +{ +u16 i; + +if (!pile) +return ; + +for (i =0 ; + i < pile->num_entries; + i++) {
Please compact this and not put everything on its own line.
Quoted 17 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +4
-0+ pile->list[i] =0 ; + } +} +/** * i40e_put_lump - return a lump of generic resource * @pile: the pile of resource to search
drivers/net/ethernet/intel/i40e/i40e_main.c +1
-1@@ -13966,7 +13986,7 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) pf = vsi->back; -i40e_put_lump (pf->qp_pile, vsi->base_queue, vsi->idx); +i40e_put_all_lump (pf->qp_pile);i40e_vsi_clear_rings (vsi);
i40e_vsi_free_arrays(vsi, false);