Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 2010 09:31:48 +0000 (UTC)
From:      Andrew Thompson <thompsa@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: r216611 - stable/8/sys/kern
Message-ID:  <201012210931.oBL9Vm1t047104@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Tue Dec 21 09:31:48 2010
New Revision: 216611
URL: http://svn.freebsd.org/changeset/base/216611

Log:
  MFC r216371:
   Fix race in devfs by using LIST_FIRST() instead of
   LIST_FOREACH_SAFE() when freeing the devfs private
   data entries.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/kern/kern_conf.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)

Modified: stable/8/sys/kern/kern_conf.c
==============================================================================
--- stable/8/sys/kern/kern_conf.c	Tue Dec 21 09:16:42 2010	(r216610)
+++ stable/8/sys/kern/kern_conf.c	Tue Dec 21 09:31:48 2010	(r216611)
@@ -871,7 +871,7 @@ static void
 destroy_devl(struct cdev *dev)
 {
 	struct cdevsw *csw;
-	struct cdev_privdata *p, *p1;
+	struct cdev_privdata *p;
 
 	mtx_assert(&devmtx, MA_OWNED);
 	KASSERT(dev->si_flags & SI_NAMED,
@@ -919,7 +919,7 @@ destroy_devl(struct cdev *dev)
 	dev_unlock();
 	notify_destroy(dev);
 	mtx_lock(&cdevpriv_mtx);
-	LIST_FOREACH_SAFE(p, &cdev2priv(dev)->cdp_fdpriv, cdpd_list, p1) {
+	while ((p = LIST_FIRST(&cdev2priv(dev)->cdp_fdpriv)) != NULL) {
 		devfs_destroy_cdevpriv(p);
 		mtx_lock(&cdevpriv_mtx);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012210931.oBL9Vm1t047104>