summaryrefslogtreecommitdiff
path: root/lib/ext2fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2005-01-05 03:16:09 -0500
committerTheodore Ts'o <tytso@mit.edu>2005-01-05 03:16:09 -0500
commitbc1b803214dc462efc9307ce0dbe0fc004f8a3e8 (patch)
tree04b78d844ab914c11d9f2f2eb7e604231e619641 /lib/ext2fs
parent6e82cd7e953bc6f00c47ca8f29c61d61fb39d3d3 (diff)
downloade2fsprogs-bc1b803214dc462efc9307ce0dbe0fc004f8a3e8.tar.gz
dupfs.c (ext2fs_dup_handle): Make sure the new filesystem handle
has its own copy of the orig_super data structure. (This is a better way of fixing a double-free problem in resize2fs which Fedora attempted to fix in e2fsprogs-1.35-double_free.patch. Addresses Red Hat Bugzilla #132707.)
Diffstat (limited to 'lib/ext2fs')
-rw-r--r--lib/ext2fs/ChangeLog9
-rw-r--r--lib/ext2fs/dupfs.c8
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 3d8f4353..048bb4ff 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,12 @@
+2005-01-05 Theodore Ts'o <tytso@mit.edu>
+
+ * dupfs.c (ext2fs_dup_handle): Make sure the new filesystem handle
+ has its own copy of the orig_super data structure. (This
+ is a better way of fixing a double-free problem in
+ resize2fs which Fedora attempted to fix in
+ e2fsprogs-1.35-double_free.patch. Addresses Red Hat
+ Bugzilla #132707.)
+
2004-12-23 Theodore Ts'o <tytso@mit.edu>
* inode.c (ext2fs_flush_icache): When flushing the icache, clear
diff --git a/lib/ext2fs/dupfs.c b/lib/ext2fs/dupfs.c
index 5c1c6f3e..f8919c22 100644
--- a/lib/ext2fs/dupfs.c
+++ b/lib/ext2fs/dupfs.c
@@ -1,7 +1,7 @@
/*
* dupfs.c --- duplicate a ext2 filesystem handle
*
- * Copyright (C) 1997 Theodore Ts'o.
+ * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
@@ -33,6 +33,7 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest)
*fs = *src;
fs->device_name = 0;
fs->super = 0;
+ fs->orig_super = 0;
fs->group_desc = 0;
fs->inode_map = 0;
fs->block_map = 0;
@@ -53,6 +54,11 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest)
goto errout;
memcpy(fs->super, src->super, SUPERBLOCK_SIZE);
+ retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->orig_super);
+ if (retval)
+ goto errout;
+ memcpy(fs->orig_super, src->orig_super, SUPERBLOCK_SIZE);
+
retval = ext2fs_get_mem((size_t) fs->desc_blocks * fs->blocksize,
&fs->group_desc);
if (retval)