Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Reject open when attach didn't complete successfully.



details:   https://anonhg.NetBSD.org/src/rev/5d1cb80b1538
branches:  trunk
changeset: 744673:5d1cb80b1538
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Feb 10 10:05:55 2020 +0000

description:
Reject open when attach didn't complete successfully.

diffstat:

 sys/dev/ld.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 1c8639678e33 -r 5d1cb80b1538 sys/dev/ld.c
--- a/sys/dev/ld.c      Mon Feb 10 09:15:27 2020 +0000
+++ b/sys/dev/ld.c      Mon Feb 10 10:05:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.107 2019/10/06 06:10:44 mlelstv Exp $ */
+/*     $NetBSD: ld.c,v 1.108 2020/02/10 10:05:55 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.107 2019/10/06 06:10:44 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.108 2020/02/10 10:05:55 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -296,6 +296,10 @@
        unit = DISKUNIT(dev);
        if ((sc = device_lookup_private(&ld_cd, unit)) == NULL)
                return (ENXIO);
+
+       if ((sc->sc_flags & LDF_ENABLED) == 0)
+               return (ENODEV);
+
        dksc = &sc->sc_dksc;
 
        return dk_open(dksc, dev, flags, fmt, l);



Home | Main Index | Thread Index | Old Index