diff options
author | Glauber Costa <glommer@parallels.com> | 2012-01-05 20:16:39 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-01-07 10:16:34 -0800 |
commit | f3f511e1ce6f1a6f0a5bb8320e9f802e76f6b999 (patch) | |
tree | bedb8b38bec1bdb3fa7159bc61822488984d3ce0 /net | |
parent | 356b95424cfb456e14a59eaa579422ce014c424b (diff) | |
download | linux-3.10-f3f511e1ce6f1a6f0a5bb8320e9f802e76f6b999.tar.gz linux-3.10-f3f511e1ce6f1a6f0a5bb8320e9f802e76f6b999.tar.bz2 linux-3.10-f3f511e1ce6f1a6f0a5bb8320e9f802e76f6b999.zip |
net: fix sock_clone reference mismatch with tcp memcontrol
Sockets can also be created through sock_clone. Because it copies
all data in the sock structure, it also copies the memcg-related pointer,
and all should be fine. However, since we now use reference counts in
socket creation, we are left with some sockets that have no reference
counts. It matters when we destroy them, since it leads to a mismatch.
Signed-off-by: Glauber Costa <glommer@parallels.com>
CC: David S. Miller <davem@davemloft.net>
CC: Greg Thelen <gthelen@google.com>
CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
CC: Laurent Chavey <chavey@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 002939cfc06..e80b64fbd66 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1362,6 +1362,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) sk_set_socket(newsk, NULL); newsk->sk_wq = NULL; + sk_update_clone(sk, newsk); + if (newsk->sk_prot->sockets_allocated) sk_sockets_allocated_inc(newsk); |