Commit 5add3009 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

inet: Fix virt-manager regression due to bind(0) changes.

From: Stephen Hemminger <shemminger@vyatta.com>

Fix regression introduced by a9d8f911
("inet: Allowing more than 64k connections and heavily optimize
bind(0) time.")

Based upon initial patches and feedback from Evegniy Polyakov and
Eric Dumazet.

From Eric Dumazet:
--------------------
Also there might be a problem at line 175

if (sk->sk_reuse && sk->sk_state != TCP_LISTEN && --attempts >= 0) { 
	spin_unlock(&head->lock);
	goto again;

If we entered inet_csk_get_port() with a non null snum, we can "goto again"
while it was not expected.
--------------------
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad0f9904
...@@ -172,7 +172,8 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) ...@@ -172,7 +172,8 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
} else { } else {
ret = 1; ret = 1;
if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) { if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
if (sk->sk_reuse && sk->sk_state != TCP_LISTEN && --attempts >= 0) { if (sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
smallest_size != -1 && --attempts >= 0) {
spin_unlock(&head->lock); spin_unlock(&head->lock);
goto again; goto again;
} }
......
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