Commit 9ea674d7 authored by David S. Miller's avatar David S. Miller

Merge branch 'skb-leak-fixes'

Gal Pressman says:

====================
net: Couple of skb memory leak fixes

As discussed in:
https://lore.kernel.org/netdev/20220102081253.9123-1-gal@nvidia.com/

These are the two followup suggestions from Eric and Jakub.
Patch #1 adds a sk_defer_free_flush() call to the kTLS splice_read
handler.
Patch #2 verifies the defer list is empty on socket destroy, and calls a
defer free flush as well.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c0b7f7d7 79074a72
...@@ -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;
......
...@@ -2059,6 +2059,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, ...@@ -2059,6 +2059,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
splice_read_end: splice_read_end:
release_sock(sk); release_sock(sk);
sk_defer_free_flush(sk);
return copied ? : err; return copied ? : err;
} }
......
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