Commit b4ff3c90 authored by Nagendra Tomar's avatar Nagendra Tomar Committed by David S. Miller

inet: Fix __inet_inherit_port() to correctly increment bsockets and num_owners

inet sockets corresponding to passive connections are added to the bind hash
using ___inet_inherit_port(). These sockets are later removed from the bind
hash using __inet_put_port(). These two functions are not exactly symmetrical.
__inet_put_port() decrements hashinfo->bsockets and tb->num_owners, whereas
___inet_inherit_port() does not increment them. This results in both of these
going to -ve values.

This patch fixes this by calling inet_bind_hash() from ___inet_inherit_port(),
which does the right thing.

'bsockets' and 'num_owners' were introduced by commit a9d8f911
(inet: Allowing more than 64k connections and heavily optimize bind(0))
Signed-off-by: default avatarNagendra Singh Tomar <tomer_iisc@yahoo.com>
Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c7e57f7
...@@ -133,8 +133,7 @@ int __inet_inherit_port(struct sock *sk, struct sock *child) ...@@ -133,8 +133,7 @@ int __inet_inherit_port(struct sock *sk, struct sock *child)
} }
} }
} }
sk_add_bind_node(child, &tb->owners); inet_bind_hash(child, tb, port);
inet_csk(child)->icsk_bind_hash = tb;
spin_unlock(&head->lock); spin_unlock(&head->lock);
return 0; return 0;
......
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