Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Don't attach disks with sector sizes we cannot handle.



details:   https://anonhg.NetBSD.org/src/rev/a19bbce2de67
branches:  trunk
changeset: 1003966:a19bbce2de67
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Oct 06 06:10:44 2019 +0000

description:
Don't attach disks with sector sizes we cannot handle.

diffstat:

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

diffs (31 lines):

diff -r 8a3398683925 -r a19bbce2de67 sys/dev/ld.c
--- a/sys/dev/ld.c      Sun Oct 06 05:48:00 2019 +0000
+++ b/sys/dev/ld.c      Sun Oct 06 06:10:44 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.106 2019/03/19 07:01:14 mlelstv Exp $ */
+/*     $NetBSD: ld.c,v 1.107 2019/10/06 06:10:44 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.106 2019/03/19 07:01:14 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.107 2019/10/06 06:10:44 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -135,6 +135,12 @@
                return;
        }
 
+       /* don't attach a disk that we cannot handle */
+       if (sc->sc_secsize < DEV_BSIZE) {
+               sc->sc_flags &= ~LDF_ENABLED;
+               return;
+       }
+
        /* Initialise dk and disk structure. */
        dk_init(dksc, self, DKTYPE_LD);
        disk_init(&dksc->sc_dkdev, dksc->sc_xname, &lddkdriver);



Home | Main Index | Thread Index | Old Index