Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi scsidevdetached ioctl path enters scsipi code...



details:   https://anonhg.NetBSD.org/src/rev/914ebc054b89
branches:  trunk
changeset: 777962:914ebc054b89
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Mar 11 02:16:55 2012 +0000

description:
scsidevdetached ioctl path enters scsipi code without kernel lock
and this upsets the newer kasserts.  take kernel lock here.

diffstat:

 sys/dev/scsipi/scsiconf.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r bad888a33144 -r 914ebc054b89 sys/dev/scsipi/scsiconf.c
--- a/sys/dev/scsipi/scsiconf.c Sun Mar 11 01:30:56 2012 +0000
+++ b/sys/dev/scsipi/scsiconf.c Sun Mar 11 02:16:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $   */
+/*     $NetBSD: scsiconf.c,v 1.263 2012/03/11 02:16:55 mrg Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.263 2012/03/11 02:16:55 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -378,11 +378,17 @@
        target = device_locator(child, SCSIBUSCF_TARGET);
        lun = device_locator(child, SCSIBUSCF_LUN);
 
+       /* XXXSMP scsipi */
+       KERNEL_LOCK(1, curlwp);
+
        periph = scsipi_lookup_periph(chan, target, lun);
        KASSERT(periph->periph_dev == child);
 
        scsipi_remove_periph(chan, periph);
        free(periph, M_DEVBUF);
+
+       /* XXXSMP scsipi */
+       KERNEL_UNLOCK_ONE(curlwp);
 }
 
 /*



Home | Main Index | Thread Index | Old Index