nf_bridge_adjust_skb_data() and nf_bridge_adjust_segmented_data() push and pull skb_mac_header_len() bytes for any skb with bridge netfilter info. A pskb copy of a bridged packet, such as one made by nft dup, keeps that info, and the next patch unsets its mac header. With the mac header unset, skb_mac_header_len() underflows and the push moves skb->data out of the buffer before skb_gso_segment(): BUG: KASAN: slab-out-of-bounds in inet_gso_segment+0xd5f/0x1370 Only adjust skbs that have a mac header. Fixes: a5fedd43d5f6 ("netfilter: move skb_gso_segment into nfnetlink_queue module") Cc: stable@vger.kernel.org Signed-off-by: Theodor Arsenij Larionov Trichkine --- net/netfilter/nfnetlink_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index a8aa7ad832c3..fafadd9057cf 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c @@ -1084,13 +1084,13 @@ nf_queue_entry_dup(struct nf_queue_entry *e) */ static void nf_bridge_adjust_skb_data(struct sk_buff *skb) { - if (nf_bridge_info_get(skb)) + if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb)) __skb_push(skb, skb_mac_header_len(skb)); } static void nf_bridge_adjust_segmented_data(struct sk_buff *skb) { - if (nf_bridge_info_get(skb)) + if (nf_bridge_info_get(skb) && skb_mac_header_was_set(skb)) __skb_pull(skb, skb_mac_header_len(skb)); } #else -- 2.34.1