From: Pavel Roskin <proski@gnu.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Re: Revision 2136 breaks two-disk configuarion
Date: Mon, 27 Apr 2009 21:37:52 -0400 [thread overview]
Message-ID: <1240882672.29799.10.camel@mj> (raw)
In-Reply-To: <1240871171.11406.106.camel@mj>
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 <grub/types.h>
#include <grub/fs.h>
+#include <grub/partition.h>
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
next prev parent reply other threads:[~2009-04-28 1:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 5:25 Revision 2136 breaks two-disk configuarion Pavel Roskin
2009-04-27 5:57 ` David Miller
2009-04-27 22:26 ` Pavel Roskin
2009-04-28 1:37 ` Pavel Roskin [this message]
2009-04-28 1:45 ` [PATCH] " David Miller
2009-04-28 3:50 ` Pavel Roskin
2009-04-28 8:59 ` David Miller
2009-04-28 13:26 ` Pavel Roskin
2009-04-28 8:59 ` David Miller
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=1240882672.29799.10.camel@mj \
--to=proski@gnu.org \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.