From owner-p4-projects@FreeBSD.ORG Thu Feb 19 13:53:10 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6835510656D1; Thu, 19 Feb 2009 13:53:08 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A5DA10656C8 for ; Thu, 19 Feb 2009 13:53:08 +0000 (UTC) (envelope-from zec@icir.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EAEC58FC25 for ; Thu, 19 Feb 2009 13:53:07 +0000 (UTC) (envelope-from zec@icir.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n1JDr7qH063120 for ; Thu, 19 Feb 2009 13:53:07 GMT (envelope-from zec@icir.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n1JDr7NB063118 for perforce@freebsd.org; Thu, 19 Feb 2009 13:53:07 GMT (envelope-from zec@icir.org) Date: Thu, 19 Feb 2009 13:53:07 GMT Message-Id: <200902191353.n1JDr7NB063118@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@icir.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 157932 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2009 13:53:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=157932 Change 157932 by zec@zec_amdx2 on 2009/02/19 13:52:15 Fix a panic when reassigning ifnet from one vnet to another. Affected files ... .. //depot/projects/vimage/src/sys/kern/kern_vimage.c#75 edit .. //depot/projects/vimage/src/sys/net/if.c#66 edit .. //depot/projects/vimage/src/sys/net/if_var.h#28 edit Differences ... ==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#75 (text+ko) ==== @@ -382,7 +382,8 @@ IFNET_WLOCK(); ifnet_setbyindex(ifp->if_index, NULL); - while (V_if_index > 0 && ifnet_byindex(V_if_index) == NULL) + while (V_if_index > 0 && + ifnet_byindex_locked(V_if_index) == NULL) V_if_index--; IFNET_WUNLOCK(); } while (0); @@ -395,7 +396,7 @@ */ IFNET_WLOCK(); for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) { - if (ifnet_byindex(ifp->if_index) == NULL) + if (ifnet_byindex_locked(ifp->if_index) == NULL) break; } /* Catch if_index overflow. */ ==== //depot/projects/vimage/src/sys/net/if.c#66 (text+ko) ==== @@ -216,7 +216,7 @@ MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address"); MALLOC_DEFINE(M_IFMADDR, "ether_multi", "link-level multicast address"); -static struct ifnet * +struct ifnet * ifnet_byindex_locked(u_short idx) { INIT_VNET_NET(curvnet); ==== //depot/projects/vimage/src/sys/net/if_var.h#28 (text+ko) ==== @@ -704,6 +704,7 @@ void ifnet_setbyindex(u_short idx, struct ifnet *ifp); struct ifnet *ifnet_byindex(u_short idx); +struct ifnet *ifnet_byindex_locked(u_short idx); /* * Given the index, ifaddr_byindex() returns the one and only