Skip to contentSkip to conversation

eth: fbnic: put back netmem reference xdp_buff_add_frag() fails

PATCH Applied Daniel Zahka 2 participants 2 messages Sep 22 – Sep 24

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

PATCH 1/1 eth: fbnic: put back netmem reference xdp_buff_add_frag() fails

fbnic_add_rx_frag() takes a page_pool reference out of the buffer's pagecnt_bias before handing the fragment to xdp_buff_add_frag(). If that call fails it has not taken ownership of the netmem: the fragment is not recorded in the shared info, and fbnic_put_pkt_buff() will not put the reference back.

Put the netmem reference back on the failure path.

---
This error path was introduced in commit 61f9a066c309 ("eth: fbnic: Use shinfo to track frags state on Rx"). This is not a fix though, because the branch is unreachable if the device is behaving correctly.

---
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +1 -0
index 447ec5522499..bbc3c9e89a38 100644
@@ -1045,6 +1045,7 @@ static void fbnic_add_rx_frag(struct fbnic_napi_vector *nv, u64 rcd,
 		pkt->add_frag_failed = true;
 		netdev_err_once(nv->napi.dev,
 				"Failed to add fragment to xdp_buff\n");
+		page_pool_put_full_netmem(qt->sub1.page_pool, netmem, true);
 	}
 }
 

---
base-commit: 6598456d72e48d779445bfec8f72114747f8b8d7
change-id: 20260922-fbnic-refcount-fix-a78b3a7e536b

Best regards,

Signature · 1 line
Daniel Zahka <[email protected]>
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Tue, 22 Sep 2026 12:53:28 -0700 you wrote:

fbnic_add_rx_frag() takes a page_pool reference out of the buffer's pagecnt_bias before handing the fragment to xdp_buff_add_frag(). If that call fails it has not taken ownership of the netmem: the fragment is not recorded in the shared info, and fbnic_put_pkt_buff() will not put the reference back.

Put the netmem reference back on the failure path.

[...]

Here is the summary with links:
- [net-next] eth: fbnic: put back netmem reference xdp_buff_add_frag() fails

    https://git.kernel.org/netdev/net-next/c/1c85ea5df86b

You are awesome, thank you!

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