summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Chapman <jchapman@katalix.com>2024-07-29 16:38:02 +0100
committerDavid S. Miller <davem@davemloft.net>2024-07-31 09:25:12 +0100
commited8ebee6def7b7b760bd4fd90c03b9e86622701c (patch)
treed814a5d497060b0ed1c6faf14e9390e4e59709c8
parent4ff8863419cdc40f2c6e1ad99436e375b9b86b68 (diff)
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 <jchapman@katalix.com> Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/l2tp/l2tp_ip.c6
1 files 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);
+ ip_flush_pending_frames(sk);
+ release_sock(sk);
tunnel = l2tp_sk_to_tunnel(sk);
if (tunnel) {