diff options
| author | Amery Hung <ameryhung@gmail.com> | 2025-09-23 02:33:49 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-12-07 00:12:17 +0300 |
| commit | 8429da2ca513d5ff3b1f35df8886ab4080515d32 (patch) | |
| tree | 09b412c31887d208e539cd1c80b66bdae890ac05 /include | |
| parent | 6fa59ec5dba45971a545f38dd19b41965a1e9ddd (diff) | |
| download | linux-8429da2ca513d5ff3b1f35df8886ab4080515d32.tar.xz | |
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 'include')
| -rw-r--r-- | include/net/xdp.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/xdp.h b/include/net/xdp.h index 55dbc68bfffc..8a0a69f69159 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -110,6 +110,11 @@ static __always_inline void xdp_buff_set_frag_pfmemalloc(struct xdp_buff *xdp) xdp->flags |= XDP_FLAGS_FRAGS_PF_MEMALLOC; } +static __always_inline void xdp_buff_clear_frag_pfmemalloc(struct xdp_buff *xdp) +{ + xdp->flags &= ~XDP_FLAGS_FRAGS_PF_MEMALLOC; +} + static __always_inline void xdp_init_buff(struct xdp_buff *xdp, u32 frame_sz, struct xdp_rxq_info *rxq) { |
