summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdc
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-02-27 17:16:52 +0000
committerjhb <jhb@FreeBSD.org>2007-02-27 17:16:52 +0000
commitcedb9875429363b208ae285e317318b542d7544b (patch)
treedbb0a8a73fbef51362049868921099f51297e68a /sys/dev/fdc
parente946f637f602f984354c9421c2e61b9e1a6dbd10 (diff)
downloadFreeBSD-src-cedb9875429363b208ae285e317318b542d7544b.zip
FreeBSD-src-cedb9875429363b208ae285e317318b542d7544b.tar.gz
Always protect the kthread flags with the lock and close a race with
module unload and kthread_exit(). MFC after: 3 days
Diffstat (limited to 'sys/dev/fdc')
-rw-r--r--sys/dev/fdc/fdc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 7970232..22e810b 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -1205,7 +1205,6 @@ fdc_thread(void *arg)
mtx_lock(&fdc->fdc_mtx);
}
fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE);
- wakeup(&fdc->fdc_thread);
mtx_unlock(&fdc->fdc_mtx);
kthread_exit(0);
@@ -1711,8 +1710,8 @@ fdc_detach(device_t dev)
return (error);
/* kill worker thread */
- fdc->flags |= FDC_KTHREAD_EXIT;
mtx_lock(&fdc->fdc_mtx);
+ fdc->flags |= FDC_KTHREAD_EXIT;
wakeup(&fdc->head);
while ((fdc->flags & FDC_KTHREAD_ALIVE) != 0)
msleep(&fdc->fdc_thread, &fdc->fdc_mtx, PRIBIO, "fdcdet", 0);
OpenPOWER on IntegriCloud