public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex_williamson@hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] [PATCH] linux/fs/partitions/efi.c error handling
Date: Thu, 14 Feb 2002 17:11:19 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905104@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590698806044@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]


   I was testing w/ some disks that appear to have bad partition
tables and was getting the following error messages:

SCSI device sdt: 35566480 512-byte hdwr sectors (18210 MB)
 sdt:<4>  Warning: Disk has a valid GPT signature but invalid PMBR.
  Use GNU Parted to correct disk.

Unfortunately, that's not where the problem stopped.  I got
random pointer dereference problems, and was apparently having
data structures freed out from under them.  Turns out the
find_valid_gpt() was freeing data structures more than once and
passing back pointers to freed structures.  Patch below.

	Alex

--
Alex Williamson                                  Linux Development Lab
alex_williamson@hp.com                                 Hewlett Packard
970-898-9173                                          Fort Collins, CO

[-- Attachment #2: efi.diff --]
[-- Type: text/plain, Size: 692 bytes --]

--- linux/fs/partitions/efi.c~	25 Jan 2002 20:15:06 -0000	1.2
+++ linux/fs/partitions/efi.c	14 Feb 2002 16:50:07 -0000
@@ -549,10 +549,14 @@ find_valid_gpt(struct gendisk *hd, struc
 
 		*gpt = pgpt;
 		*ptes = pptes;
-		if (agpt)
+		if (agpt) {
 			kfree(agpt);
-		if (aptes)
+			agpt = NULL;
+		}
+		if (aptes) {
 			kfree(aptes);
+			aptes = NULL;
+		}
 	} /* if primary is valid */
 	else {
 		/* Primary GPT is bad, check the Alternate GPT */
@@ -602,6 +606,8 @@ find_valid_gpt(struct gendisk *hd, struc
 	/* Both primary and alternate GPTs are bad, and/or PMBR is invalid.
 	 * This isn't our disk, return 0.
 	 */
+	*gpt = *ptes = NULL;
+
 	if (pgpt) {
 		kfree(pgpt);
 		pgpt = NULL;

  parent reply	other threads:[~2002-02-14 17:11 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-14 17:11 [Linux-ia64] [PATCH] linux/fs/partitions/efi.c error handling Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson [this message]
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 17:11 ` Alex Williamson
2002-02-14 19:05 ` Matt_Domsch
2002-02-15 14:30 ` William Lee Irwin III
2002-02-15 15:09 ` Alex Williamson
2002-02-15 20:00 ` David Mosberger
2002-02-16  0:46 ` John Hesterberg
2002-02-16  0:52 ` David Mosberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590701905104@msgid-missing \
    --to=alex_williamson@hp.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox