summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorAmery Hung <ameryhung@gmail.com>2025-09-23 02:33:49 +0300
committerMartin KaFai Lau <martin.lau@kernel.org>2025-09-23 23:35:11 +0300
commit8f12d1137c2382c80aada8e05d7cc650cd4e403c (patch)
tree9bae7159d88f623ed41cbfdebf964911e01d03c9 /net/core
parent54728bd535fb3899ad51489dc1e05eb5bb53cb95 (diff)
downloadlinux-8f12d1137c2382c80aada8e05d7cc650cd4e403c.tar.xz
bpf: Clear pfmemalloc flag when freeing all fragments
It is possible for bpf_xdp_adjust_tail() to free all fragments. The kfunc currently clears the XDP_FLAGS_HAS_FRAGS bit, but not XDP_FLAGS_FRAGS_PF_MEMALLOC. So far, this has not caused a issue when building sk_buff from xdp_buff since all readers of xdp_buff->flags use the flag only when there are fragments. Clear the XDP_FLAGS_FRAGS_PF_MEMALLOC bit as well to make the flags correct. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://patch.msgid.link/20250922233356.3356453-2-ameryhung@gmail.com
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 63f3baee2daf..5837534f4352 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4210,6 +4210,7 @@ static int bpf_xdp_frags_shrink_tail(struct xdp_buff *xdp, int offset)
if (unlikely(!sinfo->nr_frags)) {
xdp_buff_clear_frags_flag(xdp);
+ xdp_buff_clear_frag_pfmemalloc(xdp);
xdp->data_end -= offset;
}