svn commit: r185184 - in stable/7/sys: . geom/part modules/cxgb

Marcel Moolenaar marcel at FreeBSD.org
Sat Nov 22 09:54:31 PST 2008


Author: marcel
Date: Sat Nov 22 17:54:30 2008
New Revision: 185184
URL: http://svn.freebsd.org/changeset/base/185184

Log:
  MFC 184734:
  Fix a panic caused by a corrupted table when the header is
  still valid.
  
  PR:		119868
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/geom/part/g_part_gpt.c
  stable/7/sys/modules/cxgb/   (props changed)

Modified: stable/7/sys/geom/part/g_part_gpt.c
==============================================================================
--- stable/7/sys/geom/part/g_part_gpt.c	Sat Nov 22 16:55:55 2008	(r185183)
+++ stable/7/sys/geom/part/g_part_gpt.c	Sat Nov 22 17:54:30 2008	(r185184)
@@ -619,13 +619,16 @@ g_part_gpt_read(struct g_part_table *bas
 	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 "
@@ -635,7 +638,7 @@ g_part_gpt_read(struct g_part_table *bas
 		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 "


More information about the svn-src-stable mailing list