]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
l2tp: have l2tp_ip_destroy_sock use ip_flush_pending_frames
authorJames Chapman <jchapman@katalix.com>
Mon, 29 Jul 2024 15:38:02 +0000 (16:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Jul 2024 08:25:12 +0000 (09:25 +0100)
Use the recently exported ip_flush_pending_frames instead of a
free-coded version and lock the socket while we call it.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_ip.c

index 78243f993cda0fb39e95ecab31de6e059e6d3013..f21dcbf3efd57a6e8712eb76eccf55865817c799 100644 (file)
@@ -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);
+       ip_flush_pending_frames(sk);
+       release_sock(sk);
 
        tunnel = l2tp_sk_to_tunnel(sk);
        if (tunnel) {