From owner-svn-src-all@FreeBSD.ORG Sun Oct 17 13:06:18 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE39D1065679; Sun, 17 Oct 2010 13:06:18 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9133E8FC15; Sun, 17 Oct 2010 13:06:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9HD6Iwf031573; Sun, 17 Oct 2010 13:06:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9HD6I6Y031570; Sun, 17 Oct 2010 13:06:18 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201010171306.o9HD6I6Y031570@svn.freebsd.org> From: Marius Strobl Date: Sun, 17 Oct 2010 13:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213967 - stable/7/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2010 13:06:18 -0000 Author: marius Date: Sun Oct 17 13:06:18 2010 New Revision: 213967 URL: http://svn.freebsd.org/changeset/base/213967 Log: r182037, r182038, r182064 When there's an error, we don't want to free the children, since it will be stack garbage. Modified: stable/7/sys/dev/mii/mlphy.c stable/7/sys/dev/mii/tlphy.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mii/mlphy.c ============================================================================== --- stable/7/sys/dev/mii/mlphy.c Sun Oct 17 12:47:07 2010 (r213966) +++ stable/7/sys/dev/mii/mlphy.c Sun Oct 17 13:06:18 2010 (r213967) @@ -194,14 +194,15 @@ mlphy_service(xsc, mii, cmd) * See if there's another PHY on this bus with us. * If so, we may need it for 10Mbps modes. */ - device_get_children(msc->ml_mii.mii_dev, &devlist, &devs); - for (i = 0; i < devs; i++) { - if (strcmp(device_get_name(devlist[i]), "mlphy")) { - other = device_get_softc(devlist[i]); - break; + if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) == 0) { + for (i = 0; i < devs; i++) { + if (strcmp(device_get_name(devlist[i]), "mlphy")) { + other = device_get_softc(devlist[i]); + break; + } } + free(devlist, M_TEMP); } - free(devlist, M_TEMP); switch (cmd) { case MII_POLLSTAT: @@ -400,6 +401,7 @@ mlphy_status(sc) int devs, i; /* See if there's another PHY on the bus with us. */ + devs = 0; device_get_children(msc->ml_mii.mii_dev, &devlist, &devs); for (i = 0; i < devs; i++) { if (strcmp(device_get_name(devlist[i]), "mlphy")) { Modified: stable/7/sys/dev/mii/tlphy.c ============================================================================== --- stable/7/sys/dev/mii/tlphy.c Sun Oct 17 12:47:07 2010 (r213966) +++ stable/7/sys/dev/mii/tlphy.c Sun Oct 17 13:06:18 2010 (r213967) @@ -150,8 +150,8 @@ tlphy_attach(device_t dev) sc->sc_mii.mii_pdata = mii; capmask = 0xFFFFFFFF; - if (mii->mii_instance) { - device_get_children(sc->sc_mii.mii_dev, &devlist, &devs); + if (mii->mii_instance && + device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) { for (i = 0; i < devs; i++) { if (strcmp(device_get_name(devlist[i]), "tlphy")) { other = device_get_softc(devlist[i]);