Module Name:    src
Committed By:   bouyer
Date:           Tue Jan 19 20:54:32 UTC 2010

Modified Files:
        src/sys/dev/ic: mfi.c

Log Message:
bio(4) is MP-safe but mfi(4) is not. So get the kernel_lock at
mfi_ioctl() entry and release it on exit.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/mfi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.30 src/sys/dev/ic/mfi.c:1.31
--- src/sys/dev/ic/mfi.c:1.30	Sun Sep 13 21:24:58 2009
+++ src/sys/dev/ic/mfi.c	Tue Jan 19 20:54:32 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.30 2009/09/13 21:24:58 dyoung Exp $ */
+/* $NetBSD: mfi.c,v 1.31 2010/01/19 20:54:32 bouyer Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom <ma...@peereboom.us>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.30 2009/09/13 21:24:58 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.31 2010/01/19 20:54:32 bouyer Exp $");
 
 #include "bio.h"
 
@@ -1412,7 +1412,10 @@
 {
 	struct mfi_softc *sc = device_private(dev);
 	int error = 0;
-	int s = splbio();
+	int s;
+
+	KERNEL_LOCK(1, curlwp);
+	s = splbio();
 
 	DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl ", DEVNAME(sc));
 
@@ -1452,6 +1455,7 @@
 		error = EINVAL;
 	}
 	splx(s);
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl return %x\n", DEVNAME(sc), error);
 	return error;

Reply via email to