From: James Chapman Date: Mon, 29 Jul 2024 15:38:02 +0000 (+0100) Subject: l2tp: have l2tp_ip_destroy_sock use ip_flush_pending_frames X-Git-Tag: v6.12-rc1~232^2~355^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed8ebee6def7b7b760bd4fd90c03b9e86622701c;p=thirdparty%2Fkernel%2Flinux.git l2tp: have l2tp_ip_destroy_sock use ip_flush_pending_frames 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 Signed-off-by: Tom Parkin Signed-off-by: David S. Miller --- diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 78243f993cda0..f21dcbf3efd57 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); + ip_flush_pending_frames(sk); + release_sock(sk); tunnel = l2tp_sk_to_tunnel(sk); if (tunnel) {