Date: Thu, 31 Dec 2009 12:58:08 +0000 (UTC) From: Gavin Atkinson <gavin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r201341 - stable/8/sys/dev/ciss Message-ID: <200912311258.nBVCw8o5001200@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gavin Date: Thu Dec 31 12:58:08 2009 New Revision: 201341 URL: http://svn.freebsd.org/changeset/base/201341 Log: MFC 200637: Don't panic due to unlocking an unowned mutex if we fail during attach. PR: kern/139053 Reviewed by: scottl Approved by: ed (mentor) Modified: stable/8/sys/dev/ciss/ciss.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ciss/ciss.c ============================================================================== --- stable/8/sys/dev/ciss/ciss.c Thu Dec 31 12:17:38 2009 (r201340) +++ stable/8/sys/dev/ciss/ciss.c Thu Dec 31 12:58:08 2009 (r201341) @@ -418,6 +418,7 @@ ciss_attach(device_t dev) sc = device_get_softc(dev); sc->ciss_dev = dev; + mtx_init(&sc->ciss_mtx, "cissmtx", NULL, MTX_DEF); /* * Do PCI-specific init. @@ -430,7 +431,6 @@ ciss_attach(device_t dev) */ ciss_initq_free(sc); ciss_initq_notify(sc); - mtx_init(&sc->ciss_mtx, "cissmtx", NULL, MTX_DEF); callout_init_mtx(&sc->ciss_periodic, &sc->ciss_mtx, 0); /* @@ -496,8 +496,11 @@ ciss_attach(device_t dev) error = 0; out: - if (error != 0) + if (error != 0) { + /* ciss_free() expects the mutex to be held */ + mtx_lock(&sc->ciss_mtx); ciss_free(sc); + } return(error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912311258.nBVCw8o5001200>