Commit bc3dd9ed authored by James Chapman's avatar James Chapman Committed by Jakub Kicinski

l2tp: use skb_queue_purge in l2tp_ip_destroy_sock

Recent commit ed8ebee6 ("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 4ff88634 ("ipv4: export ip_flush_pending_frames") for
l2tp and is not used by other modules.

Suggested-by: xiyou.wangcong@gmail.com
Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20240819143333.3204957-1-jchapman@katalix.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8594d9b8
...@@ -1534,7 +1534,6 @@ void ip_flush_pending_frames(struct sock *sk) ...@@ -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); __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 sk_buff *ip_make_skb(struct sock *sk,
struct flowi4 *fl4, struct flowi4 *fl4,
......
...@@ -258,9 +258,7 @@ static void l2tp_ip_destroy_sock(struct sock *sk) ...@@ -258,9 +258,7 @@ static void l2tp_ip_destroy_sock(struct sock *sk)
{ {
struct l2tp_tunnel *tunnel; struct l2tp_tunnel *tunnel;
lock_sock(sk); __skb_queue_purge(&sk->sk_write_queue);
ip_flush_pending_frames(sk);
release_sock(sk);
tunnel = l2tp_sk_to_tunnel(sk); tunnel = l2tp_sk_to_tunnel(sk);
if (tunnel) { if (tunnel) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment