netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock
@ 2024-08-19 14:33 James Chapman
  2024-08-19 15:00 ` Eric Dumazet
  2024-08-21  0:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: James Chapman @ 2024-08-19 14:33 UTC (permalink / raw)
  To: netdev; +Cc: davem, edumazet, kuba, pabeni, dsahern, tparkin, xiyou.wangcong

Recent commit ed8ebee6def7 ("l2tp: have l2tp_ip_destroy_sock use
ip_flush_pending_frames") was incorrect in that l2tp_ip does not use
socket cork and ip_flush_pending_frames is for sockets that do. Use
__skb_queue_purge instead and remove the unnecessary lock.

Also unexport ip_flush_pending_frames since it was originally exported
in commit 4ff8863419cd ("ipv4: export ip_flush_pending_frames") for
l2tp and is not used by other modules.

Suggested-by: xiyou.wangcong@gmail.com
Signed-off-by: James Chapman <jchapman@katalix.com>
---
  v4:
    - use __skb_queue_purge (eric)
  v3: https://lore.kernel.org/netdev/20240816080751.2811310-1-jchapman@katalix.com/
    - put signoff above change history
  v2: https://lore.kernel.org/all/20240815074311.1238511-1-jchapman@katalix.com/
    - also unexport ip_flush_pending_frames (cong)
  v1: https://lore.kernel.org/all/20240813093914.501183-1-jchapman@katalix.com/
---
 net/ipv4/ip_output.c | 1 -
 net/l2tp/l2tp_ip.c   | 4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 8a10a7c67834..b90d0f78ac80 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1534,7 +1534,6 @@ void ip_flush_pending_frames(struct sock *sk)
 {
 	__ip_flush_pending_frames(sk, &sk->sk_write_queue, &inet_sk(sk)->cork.base);
 }
-EXPORT_SYMBOL_GPL(ip_flush_pending_frames);
 
 struct sk_buff *ip_make_skb(struct sock *sk,
 			    struct flowi4 *fl4,
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 39f3f1334c4a..4bc24fddfd52 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -258,9 +258,7 @@ static void l2tp_ip_destroy_sock(struct sock *sk)
 {
 	struct l2tp_tunnel *tunnel;
 
-	lock_sock(sk);
-	ip_flush_pending_frames(sk);
-	release_sock(sk);
+	__skb_queue_purge(&sk->sk_write_queue);
 
 	tunnel = l2tp_sk_to_tunnel(sk);
 	if (tunnel) {
-- 
2.34.1


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

* Re: [PATCH net-next v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock
  2024-08-19 14:33 [PATCH net-next v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock James Chapman
@ 2024-08-19 15:00 ` Eric Dumazet
  2024-08-21  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2024-08-19 15:00 UTC (permalink / raw)
  To: James Chapman
  Cc: netdev, davem, kuba, pabeni, dsahern, tparkin, xiyou.wangcong

On Mon, Aug 19, 2024 at 4:33 PM James Chapman <jchapman@katalix.com> wrote:
>
> Recent commit ed8ebee6def7 ("l2tp: have l2tp_ip_destroy_sock use
> ip_flush_pending_frames") was incorrect in that l2tp_ip does not use
> socket cork and ip_flush_pending_frames is for sockets that do. Use
> __skb_queue_purge instead and remove the unnecessary lock.
>
> Also unexport ip_flush_pending_frames since it was originally exported
> in commit 4ff8863419cd ("ipv4: export ip_flush_pending_frames") for
> l2tp and is not used by other modules.
>

Reviewed-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net-next v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock
  2024-08-19 14:33 [PATCH net-next v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock James Chapman
  2024-08-19 15:00 ` Eric Dumazet
@ 2024-08-21  0:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-21  0:00 UTC (permalink / raw)
  To: James Chapman
  Cc: netdev, davem, edumazet, kuba, pabeni, dsahern, tparkin,
	xiyou.wangcong

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 19 Aug 2024 15:33:33 +0100 you wrote:
> Recent commit ed8ebee6def7 ("l2tp: have l2tp_ip_destroy_sock use
> ip_flush_pending_frames") was incorrect in that l2tp_ip does not use
> socket cork and ip_flush_pending_frames is for sockets that do. Use
> __skb_queue_purge instead and remove the unnecessary lock.
> 
> Also unexport ip_flush_pending_frames since it was originally exported
> in commit 4ff8863419cd ("ipv4: export ip_flush_pending_frames") for
> l2tp and is not used by other modules.
> 
> [...]

Here is the summary with links:
  - [net-next,v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock
    https://git.kernel.org/netdev/net-next/c/bc3dd9ed04d6

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] 3+ messages in thread

end of thread, other threads:[~2024-08-21  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19 14:33 [PATCH net-next v4] l2tp: use skb_queue_purge in l2tp_ip_destroy_sock James Chapman
2024-08-19 15:00 ` Eric Dumazet
2024-08-21  0:00 ` 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).