From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LycGo-0005zD-I5 for mharc-grub-devel@gnu.org; Mon, 27 Apr 2009 21:38:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LycGm-0005z8-Is for grub-devel@gnu.org; Mon, 27 Apr 2009 21:38:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LycGh-0005ys-3f for grub-devel@gnu.org; Mon, 27 Apr 2009 21:37:59 -0400 Received: from [199.232.76.173] (port=45849 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LycGg-0005yp-Rl for grub-devel@gnu.org; Mon, 27 Apr 2009 21:37:54 -0400 Received: from c60.cesmail.net ([216.154.195.49]:46205) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1LycGg-0000ra-Ha for grub-devel@gnu.org; Mon, 27 Apr 2009 21:37:54 -0400 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 27 Apr 2009 21:37:53 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id A209D34C69 for ; Mon, 27 Apr 2009 21:36:29 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <1240871171.11406.106.camel@mj> References: <1240809937.4158.50.camel@ct> <20090426.225757.05232059.davem@davemloft.net> <1240871171.11406.106.camel@mj> Content-Type: text/plain Date: Mon, 27 Apr 2009 21:37:52 -0400 Message-Id: <1240882672.29799.10.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 (2.26.1-2.fc11) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] Re: Revision 2136 breaks two-disk configuarion X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2009 01:38:01 -0000 On Mon, 2009-04-27 at 18:26 -0400, Pavel Roskin wrote: > It's entirely possible that the problem is elsewhere. But I have no > experience debugging memory problems in GRUB, so it will take time > before I find out. Done! disk->partition should not be copied by reference. This patch fixes the broken magic problem. The issue with mixing device and disk functions could be addressed separately. ChangeLog: disk/fs_uuid.c (grub_fs_uuid_open): Allocate memory to copy parent's partition, don't copy it by reference, as it gets freed on close. --- disk/fs_uuid.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/disk/fs_uuid.c b/disk/fs_uuid.c index 9d83bb8..9636ce9 100644 --- a/disk/fs_uuid.c +++ b/disk/fs_uuid.c @@ -25,6 +25,7 @@ #include #include +#include static grub_device_t search_fs_uuid (const char *key, unsigned long *count) @@ -88,7 +89,16 @@ grub_fs_uuid_open (const char *name, grub_disk_t disk) disk->total_sectors = dev->disk->total_sectors; disk->has_partitions = 0; - disk->partition = dev->disk->partition; + if (dev->disk->partition) + { + disk->partition = grub_malloc (sizeof (*disk->partition)); + if (disk->partition) + grub_memcpy (disk->partition, dev->disk->partition, + sizeof (*disk->partition)); + } + else + disk->partition = NULL; + disk->data = dev->disk; return GRUB_ERR_NONE; -- Regards, Pavel Roskin