diff options
author | hselasky <hselasky@FreeBSD.org> | 2010-12-11 08:44:10 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2010-12-11 08:44:10 +0000 |
commit | 2b010fb38d455b414e35ff14335fe7e37ed26964 (patch) | |
tree | 49cd672d4fe497c17c2f211cae2c65c9843b2547 /sys/kern | |
parent | 29af67e52c02dc751039a3117bc88ae6192e891e (diff) | |
download | FreeBSD-src-2b010fb38d455b414e35ff14335fe7e37ed26964.zip FreeBSD-src-2b010fb38d455b414e35ff14335fe7e37ed26964.tar.gz |
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)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_conf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 897a4c0..721c01e 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -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); } |