netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: James Chapman <jchapman@katalix.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, dsahern@kernel.org,
	tparkin@katalix.com
Subject: Re: [PATCH net-next 03/15] l2tp: have l2tp_ip_destroy_sock use ip_flush_pending_frames
Date: Sun, 11 Aug 2024 15:40:59 -0700	[thread overview]
Message-ID: <Zrk9+7a0doax82Kd@pop-os.localdomain> (raw)
In-Reply-To: <8491d89e8ae68206971f35c572190ac8b7882c1d.1722265212.git.jchapman@katalix.com>

On Mon, Jul 29, 2024 at 04:38:02PM +0100, James Chapman wrote:
> Use the recently exported ip_flush_pending_frames instead of a
> free-coded version and lock the socket while we call it.

Hmm? Isn't skb_queue_purge() closer to the original code?

This is clearly not a trivial cleanup, so what are you trying to fix?

> 
> Signed-off-by: James Chapman <jchapman@katalix.com>
> Signed-off-by: Tom Parkin <tparkin@katalix.com>
> ---
>  net/l2tp/l2tp_ip.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
> index 78243f993cda..f21dcbf3efd5 100644
> --- a/net/l2tp/l2tp_ip.c
> +++ b/net/l2tp/l2tp_ip.c
> @@ -236,10 +236,10 @@ static void l2tp_ip_close(struct sock *sk, long timeout)
>  static void l2tp_ip_destroy_sock(struct sock *sk)
>  {
>  	struct l2tp_tunnel *tunnel;
> -	struct sk_buff *skb;
>  
> -	while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL)
> -		kfree_skb(skb);
> +	lock_sock(sk);


Are you sure you really want this sock lock?

> +	ip_flush_pending_frames(sk);

So who sets inet_sk(sk)->cork.base for l2tp socket?

Thanks.

  reply	other threads:[~2024-08-11 22:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 15:37 [PATCH net-next 00/15] l2tp: simplify tunnel and session cleanup James Chapman
2024-07-29 15:38 ` [PATCH net-next 01/15] l2tp: lookup tunnel from socket without using sk_user_data James Chapman
2024-07-29 15:38 ` [PATCH net-next 02/15] ipv4: export ip_flush_pending_frames James Chapman
2024-07-29 15:38 ` [PATCH net-next 03/15] l2tp: have l2tp_ip_destroy_sock use ip_flush_pending_frames James Chapman
2024-08-11 22:40   ` Cong Wang [this message]
2024-08-12 15:28     ` James Chapman
2024-07-29 15:38 ` [PATCH net-next 04/15] l2tp: don't use tunnel socket sk_user_data in ppp procfs output James Chapman
2024-07-29 15:38 ` [PATCH net-next 05/15] l2tp: don't set sk_user_data in tunnel socket James Chapman
2024-07-29 15:38 ` [PATCH net-next 06/15] l2tp: remove unused tunnel magic field James Chapman
2024-07-29 15:38 ` [PATCH net-next 07/15] l2tp: simplify tunnel and socket cleanup James Chapman
2024-07-29 15:38 ` [PATCH net-next 08/15] l2tp: delete sessions using work queue James Chapman
2024-07-29 15:38 ` [PATCH net-next 09/15] l2tp: free sessions using rcu James Chapman
2024-07-29 15:38 ` [PATCH net-next 10/15] l2tp: refactor ppp socket/session relationship James Chapman
2024-07-29 15:38 ` [PATCH net-next 11/15] l2tp: prevent possible tunnel refcount underflow James Chapman
2024-07-29 15:38 ` [PATCH net-next 12/15] l2tp: use rcu list add/del when updating lists James Chapman
2024-07-29 15:38 ` [PATCH net-next 13/15] l2tp: add idr consistency check in session_register James Chapman
2024-07-29 15:38 ` [PATCH net-next 14/15] l2tp: cleanup eth/ppp pseudowire setup code James Chapman
2024-07-29 15:38 ` [PATCH net-next 15/15] l2tp: use pre_exit pernet hook to avoid rcu_barrier James Chapman
2024-07-31  8:30 ` [PATCH net-next 00/15] l2tp: simplify tunnel and session cleanup 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=Zrk9+7a0doax82Kd@pop-os.localdomain \
    --to=xiyou.wangcong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=jchapman@katalix.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tparkin@katalix.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 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).