Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Nov 2008 17:54:30 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r185184 - in stable/7/sys: . geom/part modules/cxgb
Message-ID:  <200811221754.mAMHsUiN025130@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811221754.mAMHsUiN025130>