All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: edumazet@google.com, pabeni@redhat.com
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	mptcp@lists.linux.dev, matttbe@kernel.org, martineau@kernel.org,
	borisp@nvidia.com, willemdebruijn.kernel@gmail.com,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 3/3] net: skb: add compatibility warnings to skb_shift()
Date: Thu, 30 May 2024 16:36:16 -0700	[thread overview]
Message-ID: <20240530233616.85897-4-kuba@kernel.org> (raw)
In-Reply-To: <20240530233616.85897-1-kuba@kernel.org>

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>
---
 net/core/skbuff.c | 3 +++
 1 file changed, 3 insertions(+)

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;
-- 
2.45.1


  parent reply	other threads:[~2024-05-30 23:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30 23:36 [PATCH net-next 0/3] tcp: refactor skb_cmp_decrypted() checks Jakub Kicinski
2024-05-30 23:36 ` [PATCH net-next 1/3] tcp: wrap mptcp and decrypted checks into tcp_skb_can_collapse_rx() Jakub Kicinski
2024-05-31  8:39   ` Eric Dumazet
2024-05-31  8:53   ` Matthieu Baerts
2024-05-31 13:43   ` Willem de Bruijn
2024-05-30 23:36 ` [PATCH net-next 2/3] tcp: add a helper for setting EOR on tail skb Jakub Kicinski
2024-05-31  8:39   ` Eric Dumazet
2024-05-31 13:41   ` Willem de Bruijn
2024-06-01 21:56     ` Jakub Kicinski
2024-06-02  1:35       ` Willem de Bruijn
2024-05-30 23:36 ` Jakub Kicinski [this message]
2024-05-31  8:40   ` [PATCH net-next 3/3] net: skb: add compatibility warnings to skb_shift() Eric Dumazet
2024-05-31 13:41   ` Willem de Bruijn
2024-05-31  0:28 ` [PATCH net-next 0/3] tcp: refactor skb_cmp_decrypted() checks MPTCP CI
2024-06-04 11:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240530233616.85897-4-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.