Reject (what we consider) empty/invalid fake disklabels no matter whether

we have other partitioning schemes available or not.
This commit is contained in:
martin 2019-12-15 12:01:05 +00:00
parent 3bb7993d91
commit 3a4f84ca06
3 changed files with 4 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: disklabel.c,v 1.25 2019/12/14 20:41:58 martin Exp $ */
/* $NetBSD: disklabel.c,v 1.26 2019/12/15 12:01:05 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@ -171,7 +171,6 @@ disklabel_parts_read(const char *disk, daddr_t start, daddr_t len,
char diskpath[MAXPATHLEN];
uint flags;
#ifndef DISKLABEL_NO_ONDISK_VERIFY
bool only_dl = only_have_disklabel();
bool have_raw_label = false;
/*
@ -267,7 +266,7 @@ disklabel_parts_read(const char *disk, daddr_t start, daddr_t len,
close(fd);
#ifndef DISKLABEL_NO_ONDISK_VERIFY
if (!have_raw_label && !only_dl) {
if (!have_raw_label) {
bool found_real_part = false;
if (parts->l.d_npartitions <= RAW_PART ||

View File

@ -1,4 +1,4 @@
/* $NetBSD: partitions.c,v 1.7 2019/12/13 22:12:41 martin Exp $ */
/* $NetBSD: partitions.c,v 1.8 2019/12/15 12:01:05 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@ -131,20 +131,6 @@ static bool have_only_disklabel_boot_support(const char *disk)
}
#endif
bool
only_have_disklabel(void)
{
if (num_available_part_schemes > 1)
return false;
#if RAW_PART != 2
if (available_part_schemes[0] == &only_disklabel_parts)
return true;
#endif
return available_part_schemes[0] == &disklabel_parts;
}
/*
* One time initialization
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: partitions.h,v 1.10 2019/12/13 22:12:41 martin Exp $ */
/* $NetBSD: partitions.h,v 1.11 2019/12/15 12:01:05 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@ -580,5 +580,4 @@ bool generic_adapt_foreign_part_info(
*/
void partitions_init(void);
void partitions_cleanup(void);
bool only_have_disklabel(void);