From owner-svn-src-stable@FreeBSD.ORG Sat Nov 22 17:54:30 2008 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEC93106564A; Sat, 22 Nov 2008 17:54:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3DD98FC0C; Sat, 22 Nov 2008 17:54:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAMHsUJa025131; Sat, 22 Nov 2008 17:54:30 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAMHsUiN025130; Sat, 22 Nov 2008 17:54:30 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811221754.mAMHsUiN025130@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 22 Nov 2008 17:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185184 - in stable/7/sys: . geom/part modules/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 17:54:31 -0000 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 "