From 74aa8e4bf8a5c91b5989b861005587bd5eea0e97 Mon Sep 17 00:00:00 2001 From: phcoder Date: Wed, 17 Jun 2009 13:15:33 +0000 Subject: [PATCH] 2009-06-17 Vladimir Serbinenko avoid double grub_adjust_range call. Bug reported by David Simner * kern/disk.c (grub_disk_write): change to raw disk access before calling disk_read --- ChangeLog | 7 +++++++ kern/disk.c | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6707e3ae9..2254e5956 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-17 Vladimir Serbinenko + + avoid double grub_adjust_range call. Bug reported by David Simner + + * kern/disk.c (grub_disk_write): change to raw disk access before + calling disk_read + 2009-06-17 Colin Watson * util/elf/grub-mkimage.c (usage): Prefix each option line with two diff --git a/kern/disk.c b/kern/disk.c index ad778d44e..0c54ed467 100644 --- a/kern/disk.c +++ b/kern/disk.c @@ -542,10 +542,17 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector, { char tmp_buf[GRUB_DISK_SECTOR_SIZE]; grub_size_t len; + grub_partition_t part; + part = disk->partition; + disk->partition = 0; if (grub_disk_read (disk, sector, 0, GRUB_DISK_SECTOR_SIZE, tmp_buf) != GRUB_ERR_NONE) - goto finish; + { + disk->partition = part; + goto finish; + } + disk->partition = part; len = GRUB_DISK_SECTOR_SIZE - real_offset; if (len > size)