From 1edea9882fafefde06d83f510c82927ff33349d4 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 10 Apr 2011 21:52:09 +0100 Subject: [PATCH] * Merge from Ubuntu: - Fix use of freed memory when replacing existing loopback device (LP: #742967). --- debian/changelog | 3 +++ debian/patches/loopback_replace.patch | 31 +++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 35 insertions(+) create mode 100644 debian/patches/loopback_replace.patch diff --git a/debian/changelog b/debian/changelog index 28984288e..d0b655fed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ grub2 (1.99~rc1-11) UNRELEASED; urgency=low - Make grub-mount exit non-zero if opening the device or filesystem fails. - Translate GRUB error codes into OS error codes for FUSE (LP: #756456). + * Merge from Ubuntu: + - Fix use of freed memory when replacing existing loopback device + (LP: #742967). -- Colin Watson Sun, 10 Apr 2011 21:45:43 +0100 diff --git a/debian/patches/loopback_replace.patch b/debian/patches/loopback_replace.patch new file mode 100644 index 000000000..f3f8cb9c9 --- /dev/null +++ b/debian/patches/loopback_replace.patch @@ -0,0 +1,31 @@ +Description: Fix use of freed memory when replacing existing loopback device + Store the loopback device as data on loopback grub_disk structures, rather + than the file it points to. +Author: Colin Watson +Bug-Ubuntu: https://bugs.launchpad.net/bugs/742967 +Forwarded: yes +Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3162 +Last-Update: 2011-04-01 + +Index: b/grub-core/disk/loopback.c +=================================================================== +--- a/grub-core/disk/loopback.c ++++ b/grub-core/disk/loopback.c +@@ -166,7 +166,7 @@ + disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN; + disk->id = (unsigned long) dev; + +- disk->data = dev->file; ++ disk->data = dev; + + return 0; + } +@@ -175,7 +175,7 @@ + grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector, + grub_size_t size, char *buf) + { +- grub_file_t file = (grub_file_t) disk->data; ++ grub_file_t file = ((struct grub_loopback *) disk->data)->file; + grub_off_t pos; + + grub_file_seek (file, sector << GRUB_DISK_SECTOR_BITS); diff --git a/debian/patches/series b/debian/patches/series index 5e788b6d9..a1bc195e1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -31,3 +31,4 @@ mdraid1x_raid0_size.patch mdraid1x_super_offset.patch host_optimise_flush.patch mkimage_yeeloong.patch +loopback_replace.patch -- 2.39.5