Commit 38ab6ca2 authored by Eric Dumazet's avatar Eric Dumazet Committed by Greg Kroah-Hartman

net: properly release sk_frag.page

commit 22a0e18e upstream.

I mistakenly added the code to release sk->sk_frag in
sk_common_release() instead of sk_destruct()

TCP sockets using sk->sk_allocation == GFP_ATOMIC do no call
sk_common_release() at close time, thus leaking one (order-3) page.

iSCSI is using such sockets.

Fixes: 5640f768 ("net: use a per task frag allocator")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a8cc8ec8
...@@ -1420,6 +1420,11 @@ static void __sk_free(struct sock *sk) ...@@ -1420,6 +1420,11 @@ static void __sk_free(struct sock *sk)
pr_debug("%s: optmem leakage (%d bytes) detected\n", pr_debug("%s: optmem leakage (%d bytes) detected\n",
__func__, atomic_read(&sk->sk_omem_alloc)); __func__, atomic_read(&sk->sk_omem_alloc));
if (sk->sk_frag.page) {
put_page(sk->sk_frag.page);
sk->sk_frag.page = NULL;
}
if (sk->sk_peer_cred) if (sk->sk_peer_cred)
put_cred(sk->sk_peer_cred); put_cred(sk->sk_peer_cred);
put_pid(sk->sk_peer_pid); put_pid(sk->sk_peer_pid);
...@@ -2598,11 +2603,6 @@ void sk_common_release(struct sock *sk) ...@@ -2598,11 +2603,6 @@ void sk_common_release(struct sock *sk)
sk_refcnt_debug_release(sk); sk_refcnt_debug_release(sk);
if (sk->sk_frag.page) {
put_page(sk->sk_frag.page);
sk->sk_frag.page = NULL;
}
sock_put(sk); sock_put(sk);
} }
EXPORT_SYMBOL(sk_common_release); EXPORT_SYMBOL(sk_common_release);
......
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