[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1386014125-13664-2-git-send-email-tytso@mit.edu>
Date: Mon, 2 Dec 2013 14:55:24 -0500
From: Theodore Ts'o <tytso@....edu>
To: Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc: kwestneat@....com, "Theodore Ts'o" <tytso@....edu>
Subject: [PATCH 2/3] libext2fs: set the fs block size to new_io in ext2fs_rewrite_to_io()
From: Kit Westneat <kwestneat@....com>
e2image manually opens a new IO channel, and then sets the file system
to use this new IO channel via ext2fs_rewrite+to_io(). We need to
make sure the IO channel is set to the file system's block size to
avoid some nasty buffer overruns.
[ Modified by tytso to use io_channel_set_blksize() ]
Signed-off-by: Kit Westneat <kwestneat@....com>
Signed-off-by: "Theodore Ts'o" <tytso@....edu>
Reviewed-by: Andreas Dilger <andreas.dilger@...el.com>
---
lib/ext2fs/openfs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 9fe1645..c38b586 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -451,8 +451,13 @@ errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io)
errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io)
{
+ errcode_t err;
+
if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0)
return EXT2_ET_NOT_IMAGE_FILE;
+ err = io_channel_set_blksize(new_io, fs->blocksize);
+ if (err)
+ return err;
fs->io = fs->image_io = new_io;
fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW |
EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY;
--
1.8.5.rc3.362.gdf10213
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists