Author: kib
Date: Wed May 18 22:36:58 2011
New Revision: 222086
URL: http://svn.freebsd.org/changeset/base/222086

Log:
  The CDP_ACTIVE flag is cleared at the beginning of destroy_devl(),
  and destroy_devl() drops dev_mtx. The protection against the race
  with dev_rel(), introduced in r163328, should be extended to cover
  destroy_devl() calls for the children of the destroyed dev.
  
  Reported and tested by:       joerg
  MFC after:    1 week

Modified:
  head/sys/kern/kern_conf.c

Modified: head/sys/kern/kern_conf.c
==============================================================================
--- head/sys/kern/kern_conf.c   Wed May 18 22:09:04 2011        (r222085)
+++ head/sys/kern/kern_conf.c   Wed May 18 22:36:58 2011        (r222086)
@@ -981,6 +981,8 @@ destroy_devl(struct cdev *dev)
        /* Remove name marking */
        dev->si_flags &= ~SI_NAMED;
 
+       dev->si_refcount++;     /* Avoid race with dev_rel() */
+
        /* If we are a child, remove us from the parents list */
        if (dev->si_flags & SI_CHILD) {
                LIST_REMOVE(dev, si_siblings);
@@ -997,7 +999,6 @@ destroy_devl(struct cdev *dev)
                dev->si_flags &= ~SI_CLONELIST;
        }
 
-       dev->si_refcount++;     /* Avoid race with dev_rel() */
        csw = dev->si_devsw;
        dev->si_devsw = NULL;   /* already NULL for SI_ALIAS */
        while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to