@@ -50,20 +50,20 @@ index 39f70d9..aa08380 100644
50
50
u64 lastlba, pt_size;
51
51
-
52
52
+ if (ignored)
53
- + *ignored = 0;
53
+ + *ignored = 0;
54
54
if (!ptes)
55
55
return 0;
56
56
if (!(*gpt = alloc_read_gpt_header(state, lba)))
57
57
return 0;
58
58
59
59
/* Check the GUID Partition Table signature */
60
60
- if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) {
61
- + if (le64_to_cpu((*gpt)->signature) == GPT_HEADER_SIGNATURE_IGNORED) {
62
- + pr_debug ("GUID Partition Table at LBA %llu marked IGNOREME\n",
63
- + (unsigned long long)lba);
64
- + if (ignored)
65
- + *ignored = 1;
66
- + goto fail;
61
+ + if (le64_to_cpu((*gpt)->signature) == GPT_HEADER_SIGNATURE_IGNORED) {
62
+ + pr_warn ("GUID Partition Table at LBA %llu marked IGNOREME\n",
63
+ + (unsigned long long)lba);
64
+ + if (ignored)
65
+ + *ignored = 1;
66
+ + goto fail;
67
67
+ } else if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) {
68
68
pr_debug("GUID Partition Table Header signature is wrong:"
69
69
"%lld != %lld\n",
@@ -77,7 +77,7 @@ index 39f70d9..aa08380 100644
77
77
gpt_header *pgpt = NULL, *agpt = NULL;
78
78
gpt_entry *pptes = NULL, *aptes = NULL;
79
79
legacy_mbr *legacymbr;
80
- @@ -613,13 +626,13 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
80
+ @@ -613,13 +626,16 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
81
81
}
82
82
83
83
good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA,
@@ -90,12 +90,15 @@ index 39f70d9..aa08380 100644
90
90
- if (!good_agpt && force_gpt)
91
91
- good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes);
92
92
+ &agpt, &aptes, NULL);
93
- + if (!good_agpt && (force_gpt || pgpt_ignored))
94
- + good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes, NULL);
93
+ + if (!good_agpt && (force_gpt || pgpt_ignored)){
94
+ + good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes, NULL);
95
+ + if (!good_agpt)
96
+ + pr_warn("Primary GPT invalid or ignored, but Alternate GPT is also invalid");
97
+ + }
95
98
96
99
if (!good_agpt && force_gpt && fops->alternative_gpt_sector) {
97
100
sector_t agpt_sector;
98
- @@ -628,14 +641 ,15 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
101
+ @@ -628,14 +644 ,15 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
99
102
err = fops->alternative_gpt_sector(disk, &agpt_sector);
100
103
if (!err)
101
104
good_agpt = is_gpt_valid(state, agpt_sector,
@@ -108,21 +111,32 @@ index 39f70d9..aa08380 100644
108
111
goto fail;
109
112
110
113
- compare_gpts(pgpt, agpt, lastlba);
111
- + if (!pgpt_ignored)
114
+ + if (!pgpt_ignored)
112
115
+ compare_gpts(pgpt, agpt, lastlba);
113
116
114
117
/* The good cases */
115
118
if (good_pgpt) {
116
- @@ -644,7 +658,8 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
119
+ @@ -643,8 +660,8 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
120
+ *ptes = pptes;
117
121
kfree(agpt);
118
122
kfree(aptes);
119
- if (!good_agpt)
123
+ - if (!good_agpt)
120
124
- pr_warn("Alternate GPT is invalid, using primary GPT.\n");
121
- + pr_warn("Primary GPT is %s, using alternate GPT.\n",
122
- + pgpt_ignored ? "being ignored" : " invalid");
125
+ + if (!good_agpt)
126
+ + pr_warn("Alternate GPT is invalid, using primary GPT.\n ");
123
127
return 1;
124
128
}
125
129
else if (good_agpt) {
130
+ @@ -652,7 +669,8 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
131
+ *ptes = aptes;
132
+ kfree(pgpt);
133
+ kfree(pptes);
134
+ - pr_warn("Primary GPT is invalid, using alternate GPT.\n");
135
+ + pr_warn("Primary GPT is %s, using alternate GPT.\n",
136
+ + pgpt_ignored ? "being ignored" : "invalid");
137
+ return 1;
138
+ }
139
+
126
140
diff --git a/block/partitions/efi.h b/block/partitions/efi.h
127
141
index abd0b19..36cddc8 100644
128
142
--- a/block/partitions/efi.h
0 commit comments