Date: Wed, 8 Oct 2008 08:08:03 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r183692 - head/sys/dev/sio Message-ID: <200810080808.m98883NQ028095@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Wed Oct 8 08:08:03 2008 New Revision: 183692 URL: http://svn.freebsd.org/changeset/base/183692 Log: Add a note about a bug in how sio manages its softc. This was discovered by Dorr H. Clark. I'm not at all sure how to fix it, but wanted to document it at the very least... Modified: head/sys/dev/sio/sio.c Modified: head/sys/dev/sio/sio.c ============================================================================== --- head/sys/dev/sio/sio.c Wed Oct 8 06:39:05 2008 (r183691) +++ head/sys/dev/sio/sio.c Wed Oct 8 08:08:03 2008 (r183692) @@ -696,6 +696,14 @@ sioprobe(dev, xrid, rclk, noprobe) bus_release_resource(dev, SYS_RES_IOPORT, rid, port); if (iobase == siocniobase) result = 0; + /* + * XXX: Since we don't return 0, we shouldn't be relying on + * the softc that we set to persist to the call to attach + * since other probe routines may be called, and the malloc + * here causes subr_bus to not allocate anything for the + * other probes. Instead, this softc is preserved and other + * probe routines can corrupt it. + */ if (result != 0) { device_set_softc(dev, NULL); free(com, M_DEVBUF); @@ -773,6 +781,13 @@ sioprobe(dev, xrid, rclk, noprobe) bus_release_resource(dev, SYS_RES_IOPORT, rid, port); if (iobase == siocniobase) result = 0; + /* + * XXX: Since we don't return 0, we shouldn't be relying on the softc + * that we set to persist to the call to attach since other probe + * routines may be called, and the malloc here causes subr_bus to not + * allocate anything for the other probes. Instead, this softc is + * preserved and other probe routines can corrupt it. + */ if (result != 0) { device_set_softc(dev, NULL); free(com, M_DEVBUF);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810080808.m98883NQ028095>