Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge check rawvp before doing ioctl or strategy.



details:   https://anonhg.NetBSD.org/src/rev/650aca35f2a9
branches:  trunk
changeset: 762848:650aca35f2a9
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 03 03:39:08 2011 +0000

description:
check rawvp before doing ioctl or strategy.

diffstat:

 sys/dev/dkwedge/dk.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 323bc9bbbdd9 -r 650aca35f2a9 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Wed Mar 02 22:42:01 2011 +0000
+++ b/sys/dev/dkwedge/dk.c      Thu Mar 03 03:39:08 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.59 2011/02/28 18:28:20 christos Exp $ */
+/*     $NetBSD: dk.c,v 1.60 2011/03/03 03:39:08 christos Exp $ */
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.59 2011/02/28 18:28:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.60 2011/03/03 03:39:08 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1115,7 +1115,9 @@
                bp->b_error = ENODEV;
                goto done;
        }
-       if (sc->sc_state != DKW_STATE_RUNNING) {
+
+       if (sc->sc_state != DKW_STATE_RUNNING ||
+           sc->sc_parent->dk_rawvp == NULL) {
                bp->b_error = ENXIO;
                goto done;
        }
@@ -1330,6 +1332,8 @@
                return (ENODEV);
        if (sc->sc_state != DKW_STATE_RUNNING)
                return (ENXIO);
+       if (sc->sc_parent->dk_rawvp == NULL)
+               return (ENXIO);
 
        error = disk_ioctl(&sc->sc_dk, cmd, data, flag, l);
        if (error != EPASSTHROUGH)



Home | Main Index | Thread Index | Old Index