Commit 95535e37 authored by Shailend Chand's avatar Shailend Chand Committed by Paolo Abeni

gve: Do not fully free QPL pages on prefill errors

The prefill function should have only removed the page count bias it
added. Fully freeing the page will cause gve_free_queue_page_list to
free a page the driver no longer owns.

Fixes: 82fd151d ("gve: Reduce alloc and copy costs in the GQ rx path")
Signed-off-by: default avatarShailend Chand <shailend@google.com>
Link: https://lore.kernel.org/r/20231014014121.2843922-1-shailend@google.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 2b10740c
...@@ -146,7 +146,7 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx) ...@@ -146,7 +146,7 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx)
err = gve_rx_alloc_buffer(priv, &priv->pdev->dev, &rx->data.page_info[i], err = gve_rx_alloc_buffer(priv, &priv->pdev->dev, &rx->data.page_info[i],
&rx->data.data_ring[i]); &rx->data.data_ring[i]);
if (err) if (err)
goto alloc_err; goto alloc_err_rda;
} }
if (!rx->data.raw_addressing) { if (!rx->data.raw_addressing) {
...@@ -171,12 +171,26 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx) ...@@ -171,12 +171,26 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx)
return slots; return slots;
alloc_err_qpl: alloc_err_qpl:
/* Fully free the copy pool pages. */
while (j--) { while (j--) {
page_ref_sub(rx->qpl_copy_pool[j].page, page_ref_sub(rx->qpl_copy_pool[j].page,
rx->qpl_copy_pool[j].pagecnt_bias - 1); rx->qpl_copy_pool[j].pagecnt_bias - 1);
put_page(rx->qpl_copy_pool[j].page); put_page(rx->qpl_copy_pool[j].page);
} }
alloc_err:
/* Do not fully free QPL pages - only remove the bias added in this
* function with gve_setup_rx_buffer.
*/
while (i--)
page_ref_sub(rx->data.page_info[i].page,
rx->data.page_info[i].pagecnt_bias - 1);
gve_unassign_qpl(priv, rx->data.qpl->id);
rx->data.qpl = NULL;
return err;
alloc_err_rda:
while (i--) while (i--)
gve_rx_free_buffer(&priv->pdev->dev, gve_rx_free_buffer(&priv->pdev->dev,
&rx->data.page_info[i], &rx->data.page_info[i],
......
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