Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Dec 2010 08:44:10 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216371 - head/sys/kern
Message-ID:  <201012110844.oBB8iASt000265@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sat Dec 11 08:44:10 2010
New Revision: 216371
URL: http://svn.freebsd.org/changeset/base/216371

Log:
  Fix race in devfs by using LIST_FIRST() instead of
  LIST_FOREACH_SAFE() when freeing the devfs private
  data entries.
  
  Reviewed by:	kib
  MFC after:	3 days
  Approved by:	thompsa (mentor)

Modified:
  head/sys/kern/kern_conf.c

Modified: head/sys/kern/kern_conf.c
==============================================================================
--- head/sys/kern/kern_conf.c	Sat Dec 11 08:32:16 2010	(r216370)
+++ head/sys/kern/kern_conf.c	Sat Dec 11 08:44:10 2010	(r216371)
@@ -926,7 +926,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,
@@ -974,7 +974,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?201012110844.oBB8iASt000265>