Module Name:    src
Committed By:   mlelstv
Date:           Sun Oct  6 06:10:44 UTC 2019

Modified Files:
        src/sys/dev: ld.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/ld.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ld.c
diff -u src/sys/dev/ld.c:1.106 src/sys/dev/ld.c:1.107
--- src/sys/dev/ld.c:1.106	Tue Mar 19 07:01:14 2019
+++ src/sys/dev/ld.c	Sun Oct  6 06:10:44 2019
@@ -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 @@ ldattach(struct ld_softc *sc, const char
 		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);

Reply via email to