From: Jakub Kicinski Date: Thu, 30 May 2024 23:36:16 +0000 (-0700) Subject: net: skb: add compatibility warnings to skb_shift() X-Git-Tag: io_uring-6.11-20240722~71^2~261^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=99b8add01f98a8ecf498de1467e8bf13dbf02daa;p=linux-block.git net: skb: add compatibility warnings to skb_shift() According to current semantics we should never try to shift data between skbs which differ on decrypted or pp_recycle status. Signed-off-by: Jakub Kicinski Reviewed-by: Eric Dumazet Reviewed-by: Willem de Bruijn Signed-off-by: Paolo Abeni --- diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 466999a7515e..c8ac79851cd6 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4139,6 +4139,9 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen) if (skb_zcopy(tgt) || skb_zcopy(skb)) return 0; + DEBUG_NET_WARN_ON_ONCE(tgt->pp_recycle != skb->pp_recycle); + DEBUG_NET_WARN_ON_ONCE(skb_cmp_decrypted(tgt, skb)); + todo = shiftlen; from = 0; to = skb_shinfo(tgt)->nr_frags;