Skip to contentSkip to conversation

page_pool: fix incorrect mp_ops error handling

PATCH Applied Mina Almasry 3 participants 3 messages Aug 21, 2025 – Aug 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 page_pool: fix incorrect mp_ops error handling

Minor fix to the memory provider error handling, we should be jumping to free_ptr_ring in this error case rather than returning directly.

Found by code-inspection.

Fixes b400f4b87430 ("page_pool: Set `dma_sync` to false for devmem memory provider")
---
 net/core/page_pool.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/page_pool.c +4 -2
index 343a6cac21e3..ba70569bd4b0 100644
@@ -287,8 +287,10 @@ static int page_pool_init(struct page_pool *pool,
 	}
 
 	if (pool->mp_ops) {
-		if (!pool->dma_map || !pool->dma_sync)
-			return -EOPNOTSUPP;
+		if (!pool->dma_map || !pool->dma_sync) {
+			err = -EOPNOTSUPP;
+			goto free_ptr_ring;
+		}
 
 		if (WARN_ON(!is_kernel_rodata((unsigned long)pool->mp_ops))) {
 			err = -EFAULT;

base-commit: c42be534547d6e45c155c347dd792b6ad9c24def

Signature · 1 line
2.51.0.rc1.193.gad69d77794-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 33 lines · Mina Almasry

Minor fix to the memory provider error handling, we should be jumping to free_ptr_ring in this error case rather than returning directly.

Found by code-inspection.

Fixes b400f4b87430 ("page_pool: Set `dma_sync` to false for devmem memory provider")
---
 net/core/page_pool.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/page_pool.c +4 -2
index 343a6cac21e3..ba70569bd4b0 100644
@@ -287,8 +287,10 @@ static int page_pool_init(struct page_pool *pool,
        }
 
        if (pool->mp_ops) {
-               if (!pool->dma_map || !pool->dma_sync)
-                       return -EOPNOTSUPP;
+               if (!pool->dma_map || !pool->dma_sync) {
+                       err = -EOPNOTSUPP;
+                       goto free_ptr_ring;
+               }
 
                if (WARN_ON(!is_kernel_rodata((unsigned long)pool->mp_ops))) {
                        err = -EFAULT;
Quoted 4 lines

base-commit: c42be534547d6e45c155c347dd792b6ad9c24def --
2.51.0.rc1.193.gad69d77794-goog

#2 lore raw
In reply to Mina Almasry
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 21 Aug 2025 03:03:46 +0000 you wrote:

Minor fix to the memory provider error handling, we should be jumping to free_ptr_ring in this error case rather than returning directly.

Found by code-inspection.

[...]

Here is the summary with links:
- [net,v1] page_pool: fix incorrect mp_ops error handling
https://git.kernel.org/netdev/net/c/abadf0ff63be

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html