Module Name:    src
Committed By:   matt
Date:           Wed Jun 26 18:47:26 UTC 2013

Modified Files:
        src/sys/kern: subr_disk_mbr.c

Log Message:
If the MBR is a protective MBR, don't bother looking at it.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/kern/subr_disk_mbr.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/kern/subr_disk_mbr.c
diff -u src/sys/kern/subr_disk_mbr.c:1.45 src/sys/kern/subr_disk_mbr.c:1.46
--- src/sys/kern/subr_disk_mbr.c:1.45	Wed Oct  3 07:05:51 2012
+++ src/sys/kern/subr_disk_mbr.c	Wed Jun 26 18:47:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk_mbr.c,v 1.45 2012/10/03 07:05:51 mlelstv Exp $	*/
+/*	$NetBSD: subr_disk_mbr.c,v 1.46 2013/06/26 18:47:26 matt Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.45 2012/10/03 07:05:51 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.46 2013/06/26 18:47:26 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -160,6 +160,15 @@ scan_mbr(mbr_args_t *a, int (*actn)(mbr_
 		if (mbr->mbr_magic != htole16(MBR_MAGIC))
 			return SCAN_CONTINUE;
 
+		/*
+		 * If this is a protective MBR, bail now.
+		 */
+		if (mbr->mbr_parts[0].mbrp_type == MBR_PTYPE_PMBR
+		    && mbr->mbr_parts[1].mbrp_type == MBR_PTYPE_UNUSED
+		    && mbr->mbr_parts[2].mbrp_type == MBR_PTYPE_UNUSED
+		    && mbr->mbr_parts[3].mbrp_type == MBR_PTYPE_UNUSED)
+			return SCAN_CONTINUE;
+
 		/* Copy data out of buffer so action can use bp */
 		memcpy(ptns, &mbr->mbr_parts, sizeof ptns);
 

Reply via email to