Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Take fss_device_lock first when closing a fss device.
details: https://anonhg.NetBSD.org/src/rev/912ebd3d08c1
branches: trunk
changeset: 784704:912ebd3d08c1
user: hannken <hannken%NetBSD.org@localhost>
date: Wed Feb 06 09:29:46 2013 +0000
description:
Take fss_device_lock first when closing a fss device.
Fixes PR kern/47514 (Multiple dump -X triggers kernel panic in fss_ioctl)
diffstat:
sys/dev/fss.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diffs (46 lines):
diff -r 79c573fa8c94 -r 912ebd3d08c1 sys/dev/fss.c
--- a/sys/dev/fss.c Wed Feb 06 09:05:01 2013 +0000
+++ b/sys/dev/fss.c Wed Feb 06 09:29:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.83 2012/07/28 16:14:17 hannken Exp $ */
+/* $NetBSD: fss.c,v 1.84 2013/02/06 09:29:46 hannken Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.83 2012/07/28 16:14:17 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.84 2013/02/06 09:29:46 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -223,11 +223,13 @@
mflag = (mode == S_IFCHR ? FSS_CDEV_OPEN : FSS_BDEV_OPEN);
error = 0;
+ mutex_enter(&fss_device_lock);
restart:
mutex_enter(&sc->sc_slock);
if ((sc->sc_flags & (FSS_CDEV_OPEN|FSS_BDEV_OPEN)) != mflag) {
sc->sc_flags &= ~mflag;
mutex_exit(&sc->sc_slock);
+ mutex_exit(&fss_device_lock);
return 0;
}
if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
@@ -239,12 +241,9 @@
}
if ((sc->sc_flags & FSS_ACTIVE) != 0) {
mutex_exit(&sc->sc_slock);
+ mutex_exit(&fss_device_lock);
return error;
}
- if (! mutex_tryenter(&fss_device_lock)) {
- mutex_exit(&sc->sc_slock);
- goto restart;
- }
KASSERT((sc->sc_flags & FSS_ACTIVE) == 0);
KASSERT((sc->sc_flags & (FSS_CDEV_OPEN|FSS_BDEV_OPEN)) == mflag);
Home |
Main Index |
Thread Index |
Old Index