diff options
author | Gal Pressman <gal@nvidia.com> | 2022-01-17 11:27:33 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-01-17 13:07:47 +0000 |
commit | 79074a72d335dbd021a716d8cc65cba3b2f706ab (patch) | |
tree | 4dd25b42974029832f25bbe6ac1ec4e9e60a713b /net | |
parent | db094aa8140e6da25ba77345b24a8af0c220665e (diff) |
net: Flush deferred skb free on socket destroy
The cited Fixes patch moved to a deferred skb approach where the skbs
are not freed immediately under the socket lock. Add a WARN_ON_ONCE()
to verify the deferred list is empty on socket destroy, and empty it to
prevent potential memory leaks.
Fixes: f35f821935d8 ("tcp: defer skb freeing after socket lock is released")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index f32ec08a0c37..4ff806d71921 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2049,6 +2049,9 @@ void sk_destruct(struct sock *sk) { bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE); + WARN_ON_ONCE(!llist_empty(&sk->defer_list)); + sk_defer_free_flush(sk); + if (rcu_access_pointer(sk->sk_reuseport_cb)) { reuseport_detach_sock(sk); use_call_rcu = true; |