svn commit: r213967 - stable/7/sys/dev/mii
Marius Strobl
marius at FreeBSD.org
Sun Oct 17 13:06:18 UTC 2010
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]);
More information about the svn-src-stable-7
mailing list