From owner-svn-src-all@FreeBSD.ORG Thu Nov 6 16:51:33 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E07281065687; Thu, 6 Nov 2008 16:51:33 +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 CF5E38FC13; Thu, 6 Nov 2008 16:51:33 +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 mA6GpXfM060675; Thu, 6 Nov 2008 16:51:33 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA6GpX1k060674; Thu, 6 Nov 2008 16:51:33 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811061651.mA6GpX1k060674@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 6 Nov 2008 16:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184734 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2008 16:51:34 -0000 Author: marcel Date: Thu Nov 6 16:51:33 2008 New Revision: 184734 URL: http://svn.freebsd.org/changeset/base/184734 Log: 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 MFC after: 1 week Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Thu Nov 6 16:30:38 2008 (r184733) +++ head/sys/geom/part/g_part_gpt.c Thu Nov 6 16:51:33 2008 (r184734) @@ -625,13 +625,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 " @@ -641,7 +644,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 "