]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
inet: Fix virt-manager regression due to bind(0) changes.
authorStephen Hemminger <shemminger@vyatta.com>
Sun, 1 Feb 2009 09:40:17 +0000 (01:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Feb 2009 09:40:17 +0000 (01:40 -0800)
From: Stephen Hemminger <shemminger@vyatta.com>

Fix regression introduced by a9d8f9110d7e953c2f2b521087a4179677843c2a
("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: David S. Miller <davem@davemloft.net>
net/ipv4/inet_connection_sock.c

index df8e72f07478cb738bcc2a0e08472929af473462..9bc6a187bdce0ca6fa66765e17f1adf62ee26f69 100644 (file)
@@ -172,7 +172,8 @@ tb_found:
                } else {
                        ret = 1;
                        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);
                                        goto again;
                                }