Date: Fri, 3 Apr 2009 10:38:24 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r190669 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern Message-ID: <200904031038.n33AcOZp016515@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Apr 3 10:38:24 2009 New Revision: 190669 URL: http://svn.freebsd.org/changeset/base/190669 Log: MFC rev. 188464. Check for device_set_devclass() errors and skip driver probe/attach if any. Attach called without devclass set crashes the system. On attach/resume some ATA drivers sometimes trying to create duplicate adX device. It is surely their own problem, but it is not a reason to crash here. Approved by: re (kib) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/subr_bus.c Modified: stable/7/sys/kern/subr_bus.c ============================================================================== --- stable/7/sys/kern/subr_bus.c Fri Apr 3 10:15:00 2009 (r190668) +++ stable/7/sys/kern/subr_bus.c Fri Apr 3 10:38:24 2009 (r190669) @@ -1735,8 +1735,13 @@ device_probe_child(device_t dev, device_ dl = next_matching_driver(dc, child, dl)) { PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); device_set_driver(child, dl->driver); - if (!hasclass) - device_set_devclass(child, dl->driver->name); + if (!hasclass) { + if (device_set_devclass(child, dl->driver->name)) { + PDEBUG(("Unable to set device class")); + device_set_driver(child, NULL); + continue; + } + } /* Fetch any flags for the device before probing. */ resource_int_value(dl->driver->name, child->unit, @@ -1814,8 +1819,11 @@ device_probe_child(device_t dev, device_ return (result); /* Set the winning driver, devclass, and flags. */ - if (!child->devclass) - device_set_devclass(child, best->driver->name); + if (!child->devclass) { + result = device_set_devclass(child, best->driver->name); + if (result != 0) + return (result); + } device_set_driver(child, best->driver); resource_int_value(best->driver->name, child->unit, "flags", &child->devflags);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904031038.n33AcOZp016515>