[PATCH net-next 0/2] net: Prepare skb extensions for reuse across scrubs
From: Jakub Sitnicki <jakub@cloudflare.com>
Date: 2026-08-31 06:27:50
Following Florian's suggestion from the discussion in [1]. The skb extension allocator retains the extension's offset after the extension is deleted. This, in theory, allows skb_ext_add() to reuse the existing storage instead of appending another copy when an extension is added again. However, it also means that we can't rely on the offset as an indicator that the extension is present. Make the extension cleanup safe, even when the offset is already allocated and set, by making the individual extension put helpers idempotent, so that they can be called multiple times. This is preparatory work to support skb extension chunk area reuse after skb scrubbing, which would be needed to persist BPF metadata skb extension across scrubs [2]. [1] https://lore.kernel.org/all/ao9UV9S7rUkyQ8jv@strlen.de/ (local) [2] https://lore.kernel.org/all/64365932-c765-472e-bf6c-b07c9ee25eaf@kernel.org/ (local) Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> --- Jakub Sitnicki (2): net: Make skb_ext_put_sp() idempotent net: Make skb_ext_put_mctp() idempotent net/core/skbuff.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)