Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst PR bin/54944: explicitly reject GPT protect...
details: https://anonhg.NetBSD.org/src/rev/19ed5ee35f8f
branches: trunk
changeset: 848694:19ed5ee35f8f
user: martin <martin%NetBSD.org@localhost>
date: Thu Feb 06 18:07:22 2020 +0000
description:
PR bin/54944: explicitly reject GPT protective MBRs.
diffstat:
usr.sbin/sysinst/mbr.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diffs (39 lines):
diff -r 0ebcbb8d7124 -r 19ed5ee35f8f usr.sbin/sysinst/mbr.c
--- a/usr.sbin/sysinst/mbr.c Thu Feb 06 16:28:10 2020 +0000
+++ b/usr.sbin/sysinst/mbr.c Thu Feb 06 18:07:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mbr.c,v 1.30 2020/01/27 21:21:22 martin Exp $ */
+/* $NetBSD: mbr.c,v 1.31 2020/02/06 18:07:22 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -156,6 +156,8 @@
struct disk_part_free_space *result, size_t max_num_result,
daddr_t min_size, daddr_t align, daddr_t lower_bound, daddr_t ignore);
+static size_t mbr_type_from_gen_desc(const struct part_type_desc *desc);
+
/*
* Notes on the extended partition editor.
*
@@ -999,6 +1001,20 @@
return NULL;
}
mbr_calc_free_space(parts);
+ if (parts->dp.num_part == 1 &&
+ parts->dp.free_space < parts->ptn_alignment) {
+ struct disk_part_info info;
+
+ /*
+ * Check if this is a GPT protective MBR
+ */
+ if (parts->dp.pscheme->get_part_info(&parts->dp, 0, &info)
+ && info.nat_type != NULL
+ && mbr_type_from_gen_desc(info.nat_type) == 0xEE) {
+ parts->dp.pscheme->free(&parts->dp);
+ return NULL;
+ }
+ }
return &parts->dp;
}
Home |
Main Index |
Thread Index |
Old Index