]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: skb: add compatibility warnings to skb_shift()
authorJakub Kicinski <kuba@kernel.org>
Thu, 30 May 2024 23:36:16 +0000 (16:36 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 4 Jun 2024 11:23:30 +0000 (13:23 +0200)
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 <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/core/skbuff.c

index 466999a7515e6c50873f84f694a74188a592cc2d..c8ac79851cd67954205cf6e8dcad6d246ce17d7e 100644 (file)
@@ -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;