linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb()
       [not found] <87r1169hs2.fsf@cloudflare.com>
@ 2022-09-08 23:15 ` Peilin Ye
  2022-09-13 18:40   ` [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb() Peilin Ye
  2022-09-16 14:40   ` [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb() patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Peilin Ye @ 2022-09-08 23:15 UTC (permalink / raw)
  To: Eric Dumazet, David S. Miller, Hideaki YOSHIFUJI, David Ahern,
	Jakub Kicinski, Paolo Abeni
  Cc: Peilin Ye, Cong Wang, Jakub Sitnicki, netdev, linux-kernel, Peilin Ye

From: Peilin Ye <peilin.ye@bytedance.com>

Prevent tcp_read_skb() from flooding the syslog.

Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
---
 net/ipv4/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8230be00ecca..9251c99d3cfd 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1766,7 +1766,7 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
 		return 0;
 
 	__skb_unlink(skb, &sk->sk_receive_queue);
-	WARN_ON(!skb_set_owner_sk_safe(skb, sk));
+	WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
 	copied = recv_actor(sk, skb);
 	if (copied >= 0) {
 		seq += copied;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb()
  2022-09-08 23:15 ` [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb() Peilin Ye
@ 2022-09-13 18:40   ` Peilin Ye
  2022-09-13 19:30     ` Peilin Ye
  2022-09-16 14:40   ` [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb() patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Peilin Ye @ 2022-09-13 18:40 UTC (permalink / raw)
  To: Eric Dumazet, David S. Miller, Hideaki YOSHIFUJI, David Ahern,
	Jakub Kicinski, Paolo Abeni
  Cc: Peilin Ye, Cong Wang, netdev, linux-kernel, Peilin Ye

From: Peilin Ye <peilin.ye@bytedance.com>

Prevent tcp_read_skb() and udp_read_skb() from flooding the syslog.

Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
---
change since v1:
  - do the same to udp_read_skb() (Cong Wang)

Cong's tcp_read_skb() fix [1] depends on this patch.

[1] https://lore.kernel.org/netdev/20220912173553.235838-1-xiyou.wangcong@gmail.com/

Thanks,
Peilin Ye

 net/ipv4/tcp.c | 2 +-
 net/ipv4/udp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8230be00ecca..9251c99d3cfd 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1766,7 +1766,7 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
 		return 0;
 
 	__skb_unlink(skb, &sk->sk_receive_queue);
-	WARN_ON(!skb_set_owner_sk_safe(skb, sk));
+	WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
 	copied = recv_actor(sk, skb);
 	if (copied >= 0) {
 		seq += copied;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cd72158e953a..560d9eadeaa5 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1821,7 +1821,7 @@ int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
 			continue;
 		}
 
-		WARN_ON(!skb_set_owner_sk_safe(skb, sk));
+		WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
 		used = recv_actor(sk, skb);
 		if (used <= 0) {
 			if (!copied)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb()
  2022-09-13 18:40   ` [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb() Peilin Ye
@ 2022-09-13 19:30     ` Peilin Ye
  2022-09-14  7:51       ` Peilin Ye
  0 siblings, 1 reply; 5+ messages in thread
From: Peilin Ye @ 2022-09-13 19:30 UTC (permalink / raw)
  To: Eric Dumazet, David S. Miller, Hideaki YOSHIFUJI, David Ahern,
	Jakub Kicinski, Paolo Abeni
  Cc: Peilin Ye, Cong Wang, netdev, linux-kernel

On Tue, Sep 13, 2022 at 11:40:16AM -0700, Peilin Ye wrote:
> Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
> Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>

Sorry, I forgot to add Fixes: tag.

Those WARN_ON() come from different commits.  I will split this into two
in v3 to make it easier.

Thanks,
Peilin Ye


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb()
  2022-09-13 19:30     ` Peilin Ye
@ 2022-09-14  7:51       ` Peilin Ye
  0 siblings, 0 replies; 5+ messages in thread
From: Peilin Ye @ 2022-09-14  7:51 UTC (permalink / raw)
  To: Eric Dumazet, David S. Miller, Hideaki YOSHIFUJI, David Ahern,
	Jakub Kicinski, Paolo Abeni
  Cc: Peilin Ye, Cong Wang, netdev, linux-kernel

On Tue, Sep 13, 2022 at 12:30:50PM -0700, Peilin Ye wrote:
> On Tue, Sep 13, 2022 at 11:40:16AM -0700, Peilin Ye wrote:
> > Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
> > Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
> 
> Sorry, I forgot to add Fixes: tag.
> 
> Those WARN_ON() come from different commits.  I will split this into two
> in v3 to make it easier.

Cong suggested not sending v3 since this is not fixing a bug, and thus
no need to add Fixes: tags.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb()
  2022-09-08 23:15 ` [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb() Peilin Ye
  2022-09-13 18:40   ` [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb() Peilin Ye
@ 2022-09-16 14:40   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-16 14:40 UTC (permalink / raw)
  To: Peilin Ye
  Cc: edumazet, davem, yoshfuji, dsahern, kuba, pabeni, peilin.ye,
	cong.wang, jakub, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu,  8 Sep 2022 16:15:23 -0700 you wrote:
> From: Peilin Ye <peilin.ye@bytedance.com>
> 
> Prevent tcp_read_skb() from flooding the syslog.
> 
> Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
> Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
> 
> [...]

Here is the summary with links:
  - [net] tcp: Use WARN_ON_ONCE() in tcp_read_skb()
    https://git.kernel.org/netdev/net/c/96628951869c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-16 14:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87r1169hs2.fsf@cloudflare.com>
2022-09-08 23:15 ` [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb() Peilin Ye
2022-09-13 18:40   ` [PATCH net v2] net: Use WARN_ON_ONCE() in {tcp,udp}_read_skb() Peilin Ye
2022-09-13 19:30     ` Peilin Ye
2022-09-14  7:51       ` Peilin Ye
2022-09-16 14:40   ` [PATCH net] tcp: Use WARN_ON_ONCE() in tcp_read_skb() patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).