Commit 79074a72 authored by Gal Pressman's avatar Gal Pressman Committed by David S. Miller

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: f35f8219 ("tcp: defer skb freeing after socket lock is released")
Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent db094aa8
...@@ -2049,6 +2049,9 @@ void sk_destruct(struct sock *sk) ...@@ -2049,6 +2049,9 @@ void sk_destruct(struct sock *sk)
{ {
bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE); 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)) { if (rcu_access_pointer(sk->sk_reuseport_cb)) {
reuseport_detach_sock(sk); reuseport_detach_sock(sk);
use_call_rcu = true; use_call_rcu = true;
......
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