aboutsummaryrefslogtreecommitdiffstats
path: root/sys/geom/part/g_part_gpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/geom/part/g_part_gpt.c')
-rw-r--r--sys/geom/part/g_part_gpt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index a17cb30ea806..8fd3b490c4fc 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -64,6 +64,8 @@ SYSCTL_UINT(_kern_geom_part_gpt, OID_AUTO, allow_nesting,
CTASSERT(offsetof(struct gpt_hdr, padding) == 92);
CTASSERT(sizeof(struct gpt_ent) == 128);
+extern u_int geom_part_check_integrity;
+
#define EQUUID(a,b) (memcmp(a, b, sizeof(struct uuid)) == 0)
#define MBRSIZE 512
@@ -460,8 +462,9 @@ gpt_read_hdr(struct g_part_gpt_table *table, struct g_consumer *cp,
if (hdr->hdr_lba_self != table->lba[elt])
goto fail;
hdr->hdr_lba_alt = le64toh(buf->hdr_lba_alt);
- if (hdr->hdr_lba_alt == hdr->hdr_lba_self ||
- hdr->hdr_lba_alt > last)
+ if (hdr->hdr_lba_alt == hdr->hdr_lba_self)
+ goto fail;
+ if (hdr->hdr_lba_alt > last && geom_part_check_integrity)
goto fail;
/* Check the managed area. */