Module Name:    src
Committed By:   ozaki-r
Date:           Thu Nov 10 03:32:04 UTC 2016

Modified Files:
        src/sys/arch/x86/x86: vmt.c

Log Message:
Fix a breakout of loops

As the comment "find first available ipv4 address" indicates,
if an IP address is found, we need to leave the two nested loops,
a loop for an interface list and a loop for IP addresses of
an interface. However, the original code broke away only from
the inner loop.

The original (wrong) behavior was non-critical, which just
returned a non-first IP address. Unfortunately, after applying
psref, the behavior may call psref_acquire twice to a target
with the same psref object, resulting in a kernel panic eventually.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/vmt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/vmt.c
diff -u src/sys/arch/x86/x86/vmt.c:1.14 src/sys/arch/x86/x86/vmt.c:1.15
--- src/sys/arch/x86/x86/vmt.c:1.14	Mon Aug  1 03:15:30 2016
+++ src/sys/arch/x86/x86/vmt.c	Thu Nov 10 03:32:04 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: vmt.c,v 1.14 2016/08/01 03:15:30 ozaki-r Exp $ */
+/* $NetBSD: vmt.c,v 1.15 2016/11/10 03:32:04 ozaki-r Exp $ */
 /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */
 
 /*
@@ -825,9 +825,10 @@ vmt_tclo_tick(void *xarg)
 
 				guest_ip = satosin(iface_addr->ifa_addr);
 				ifa_acquire(iface_addr, &psref);
-				break;
+				goto got;
 			}
 		}
+	got:
 		pserialize_read_exit(s);
 
 		if (guest_ip != NULL) {

Reply via email to