summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAmery Hung <ameryhung@gmail.com>2025-09-22 16:33:49 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-11-13 15:34:07 -0500
commita7ced9d338c7bdce3194eb2ea21ead16b92368f4 (patch)
tree2caca212bc2a9cee2290bcd4204a0334f757d7b7 /net
parente628b0524b37840b821ce69c4bd9ac4d0a5ff7ed (diff)
downloadlinux-a7ced9d338c7bdce3194eb2ea21ead16b92368f4.tar.gz
linux-a7ced9d338c7bdce3194eb2ea21ead16b92368f4.tar.bz2
linux-a7ced9d338c7bdce3194eb2ea21ead16b92368f4.zip
bpf: Clear pfmemalloc flag when freeing all fragments
[ Upstream commit 8f12d1137c2382c80aada8e05d7cc650cd4e403c ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-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 fef4d85fee00..89ed625e1474 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4223,6 +4223,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;
}