diff options
author | Li RongQing <lirongqing@baidu.com> | 2018-01-26 03:40:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-29 17:56:23 -0500 |
commit | 9b42d55a66d388e4dd5550107df051a9637564fc (patch) | |
tree | 685bd712d0a69e853828cb0c0331577c3c7e5df0 /net/ipv4/tcp.c | |
parent | 30e948a37839c633d18f6c4cf8a212912ba9449c (diff) |
tcp: release sk_frag.page in tcp_disconnect
socket can be disconnected and gets transformed back to a listening
socket, if sk_frag.page is not released, which will be cloned into
a new socket by sk_clone_lock, but the reference count of this page
is increased, lead to a use after free or double free issue
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index c8ed3a04b504..874c9317b8df 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2458,6 +2458,12 @@ int tcp_disconnect(struct sock *sk, int flags) | |||
2458 | 2458 | ||
2459 | WARN_ON(inet->inet_num && !icsk->icsk_bind_hash); | 2459 | WARN_ON(inet->inet_num && !icsk->icsk_bind_hash); |
2460 | 2460 | ||
2461 | if (sk->sk_frag.page) { | ||
2462 | put_page(sk->sk_frag.page); | ||
2463 | sk->sk_frag.page = NULL; | ||
2464 | sk->sk_frag.offset = 0; | ||
2465 | } | ||
2466 | |||
2461 | sk->sk_error_report(sk); | 2467 | sk->sk_error_report(sk); |
2462 | return err; | 2468 | return err; |
2463 | } | 2469 | } |