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 an error path where we might scsipi_preve...



details:   https://anonhg.NetBSD.org/src/rev/2a50dd04d79e
branches:  trunk
changeset: 551613:2a50dd04d79e
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Mon Sep 08 23:43:35 2003 +0000

description:
Fix an error path where we might scsipi_prevent() on a non-removable device.

diffstat:

 sys/dev/scsipi/sd.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 17b2144ad6af -r 2a50dd04d79e sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c       Mon Sep 08 23:43:05 2003 +0000
+++ b/sys/dev/scsipi/sd.c       Mon Sep 08 23:43:35 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.204 2003/09/08 18:51:38 mycroft Exp $ */
+/*     $NetBSD: sd.c,v 1.205 2003/09/08 23:43:35 mycroft Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.204 2003/09/08 18:51:38 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.205 2003/09/08 23:43:35 mycroft Exp $");
 
 #include "opt_scsi.h"
 #include "opt_bufq.h"
@@ -510,8 +510,10 @@
 
 bad:
        if (sd->sc_dk.dk_openmask == 0) {
-               scsipi_prevent(periph, PR_ALLOW,
-                   XS_CTL_IGNORE_ILLEGAL_REQUEST | XS_CTL_IGNORE_MEDIA_CHANGE);
+               if (periph->periph_flags & PERIPH_REMOVABLE)
+                       scsipi_prevent(periph, PR_ALLOW,
+                           XS_CTL_IGNORE_ILLEGAL_REQUEST |
+                           XS_CTL_IGNORE_MEDIA_CHANGE);
                periph->periph_flags &= ~PERIPH_OPEN;
        }
 
@@ -573,11 +575,10 @@
 
                scsipi_wait_drain(periph);
 
-               if (periph->periph_flags & PERIPH_REMOVABLE) {
+               if (periph->periph_flags & PERIPH_REMOVABLE)
                        scsipi_prevent(periph, PR_ALLOW,
                            XS_CTL_IGNORE_ILLEGAL_REQUEST |
                            XS_CTL_IGNORE_NOT_READY);
-               }
                periph->periph_flags &= ~PERIPH_OPEN;
 
                scsipi_wait_drain(periph);



Home | Main Index | Thread Index | Old Index