Fix a panic caused by a corrupted table when the header is
still valid. We were checking the state of the header and not the table. PR: 119868 Based on a patch from: Jaakko Heinonen <jh@saunalahti.fi> MFC after: 1 week
This commit is contained in:
parent
fd543f2759
commit
dd0db05da2
@ -625,13 +625,16 @@ g_part_gpt_read(struct g_part_table *basetable, struct g_consumer *cp)
|
||||
if (table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK &&
|
||||
table->state[GPT_ELT_SECHDR] == GPT_STATE_OK &&
|
||||
!gpt_matched_hdrs(&prihdr, &sechdr)) {
|
||||
if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK)
|
||||
if (table->state[GPT_ELT_PRITBL] == GPT_STATE_OK) {
|
||||
table->state[GPT_ELT_SECHDR] = GPT_STATE_INVALID;
|
||||
else
|
||||
table->state[GPT_ELT_SECTBL] = GPT_STATE_MISSING;
|
||||
} else {
|
||||
table->state[GPT_ELT_PRIHDR] = GPT_STATE_INVALID;
|
||||
table->state[GPT_ELT_PRITBL] = GPT_STATE_MISSING;
|
||||
}
|
||||
}
|
||||
|
||||
if (table->state[GPT_ELT_PRIHDR] != GPT_STATE_OK) {
|
||||
if (table->state[GPT_ELT_PRITBL] != GPT_STATE_OK) {
|
||||
printf("GEOM: %s: the primary GPT table is corrupt or "
|
||||
"invalid.\n", pp->name);
|
||||
printf("GEOM: %s: using the secondary instead -- recovery "
|
||||
@ -641,7 +644,7 @@ g_part_gpt_read(struct g_part_table *basetable, struct g_consumer *cp)
|
||||
if (pritbl != NULL)
|
||||
g_free(pritbl);
|
||||
} else {
|
||||
if (table->state[GPT_ELT_SECHDR] != GPT_STATE_OK) {
|
||||
if (table->state[GPT_ELT_SECTBL] != GPT_STATE_OK) {
|
||||
printf("GEOM: %s: the secondary GPT table is corrupt "
|
||||
"or invalid.\n", pp->name);
|
||||
printf("GEOM: %s: using the primary only -- recovery "
|
||||
|
Loading…
x
Reference in New Issue
Block a user