Skip to contentSkip to conversation

net: veth: Page pool creation error handling for existing pools only

PATCH In review Liang Chen 2 participants 2 messages Aug 11, 2023

Subsystems (2)
lore
Share & tools
lore

Liang Chen

author
#0 lore raw

PATCH 1/1 net: veth: Page pool creation error handling for existing pools only

The failure handling procedure destroys page pools for all queues, including those that haven't had their page pool created yet. this patch introduces necessary adjustments to prevent potential risks and inconsistency with the error handling behavior.

---
 drivers/net/veth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/veth.c +2 -1
index 614f3e3efab0..509e901da41d 100644
@@ -1081,8 +1081,9 @@ static int __veth_napi_enable_range(struct net_device *dev, int start, int end)
 err_xdp_ring:
 	for (i--; i >= start; i--)
 		ptr_ring_cleanup(&priv->rq[i].xdp_ring, veth_ptr_free);
+	i = end;
 err_page_pool:
-	for (i = start; i < end; i++) {
+	for (i--; i >= start; i--) {
 		page_pool_destroy(priv->rq[i].page_pool);
 		priv->rq[i].page_pool = NULL;
 	}
Signature · 1 line
2.40.1
#1 lore raw
Quoted 8 lines · Liang Chen

The failure handling procedure destroys page pools for all queues, including those that haven't had their page pool created yet. this patch introduces necessary adjustments to prevent potential risks and inconsistency with the error handling behavior.

---

Fixes 0ebab78cbcbf ("net: veth: add page_pool for page recycling")

But not a critical fix, so net-next is okay.

Quoted 18 lines
  drivers/net/veth.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/veth.c +2 -1
index 614f3e3efab0..509e901da41d 100644
@@ -1081,8 +1081,9 @@ static int __veth_napi_enable_range(struct net_device *dev, int start, int end)
  err_xdp_ring:
  	for (i--; i >= start; i--)
  		ptr_ring_cleanup(&priv->rq[i].xdp_ring, veth_ptr_free);
+	i = end;
  err_page_pool:
-	for (i = start; i < end; i++) {
+	for (i--; i >= start; i--) {
  		page_pool_destroy(priv->rq[i].page_pool);
  		priv->rq[i].page_pool = NULL;
  	}