Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi Fix locking issue triggered by drvctr -r of a...



details:   https://anonhg.NetBSD.org/src/rev/fd67c6180823
branches:  trunk
changeset: 779240:fd67c6180823
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sun May 13 01:03:13 2012 +0000

description:
Fix locking issue triggered by drvctr -r of a scsibus(4).
Pullup to netbsd-6 should be requested.

diffstat:

 sys/dev/scsipi/scsiconf.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r d5e28f23b80a -r fd67c6180823 sys/dev/scsipi/scsiconf.c
--- a/sys/dev/scsipi/scsiconf.c Sun May 13 00:47:16 2012 +0000
+++ b/sys/dev/scsipi/scsiconf.c Sun May 13 01:03:13 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsiconf.c,v 1.267 2012/04/20 20:23:21 bouyer Exp $    */
+/*     $NetBSD: scsiconf.c,v 1.268 2012/05/13 01:03:13 jakllsch 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.267 2012/04/20 20:23:21 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.268 2012/05/13 01:03:13 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -344,6 +344,9 @@
        int maxtarget, mintarget, maxlun, minlun;
        int error;
 
+       /* XXXSMP scsipi */
+       KERNEL_LOCK(1, curlwp);
+
        if (target == -1) {
                maxtarget = chan->chan_ntargets - 1;
                mintarget = 0;
@@ -371,7 +374,7 @@
                    0, curproc);
 
        if ((error = scsipi_adapter_addref(chan->chan_adapter)) != 0)
-               return (error);
+               goto ret;
        for (target = mintarget; target <= maxtarget; target++) {
                if (target == chan->chan_id)
                        continue;
@@ -392,7 +395,9 @@
                scsipi_set_xfer_mode(chan, target, 1);
        }
        scsipi_adapter_delref(chan->chan_adapter);
-       return (0);
+ret:
+       KERNEL_UNLOCK_ONE(curlwp);
+       return (error);
 }
 
 static int



Home | Main Index | Thread Index | Old Index