aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2011-05-18 22:36:58 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2011-05-18 22:36:58 +0000
commitdbe66680b0eeca111740b149fac4ed45b0fdbf09 (patch)
tree8e3558bfd943ec6be8318121c6d35bd1e1bb4613
parentbc14b14d62d03e69cb35e20e604a425c56ef67d8 (diff)
downloadsrc-dbe66680b0eeca111740b149fac4ed45b0fdbf09.tar.gz
src-dbe66680b0eeca111740b149fac4ed45b0fdbf09.zip
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
Notes
Notes: svn path=/head/; revision=222086
-rw-r--r--sys/kern/kern_conf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index b2be5cc12d1a..59b876c18e55 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -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) {