lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1279807398-13680-4-git-send-email-tytso@mit.edu>
Date:	Thu, 22 Jul 2010 10:03:14 -0400
From:	Theodore Ts'o <tytso@....edu>
To:	Renzo Davoli <renzo@...unibo.it>
Cc:	Ext4 Developers List <linux-ext4@...r.kernel.org>,
	Theodore Ts'o <tytso@....edu>
Subject: [PATCH 3/7] libext2fs: Don't make a copy of the inode in ext2fs_extent_open2()

Previously, ext2fs_extent_open2() copied the passed-in inode structure
into the extent handle, and the extent functions modified the copy of
the inode structure if necessary due to extent splits, etc.  Change
ext2fs_extent_open2() so that the extent functions use the inode
structure passed into ext2fs_extent_open2().  Otherwise the passed-in
inode structure could become out of date due to changes made by the
extent functions.

Signed-off-by: "Theodore Ts'o" <tytso@....edu>
---
 lib/ext2fs/extent.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index 490dbe8..5e07092 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -53,6 +53,7 @@ struct ext2_extent_handle {
 	ext2_filsys		fs;
 	ext2_ino_t 		ino;
 	struct ext2_inode	*inode;
+	struct ext2_inode	inodebuf;
 	int			type;
 	int			level;
 	int			max_depth;
@@ -165,8 +166,6 @@ extern void ext2fs_extent_free(ext2_extent_handle_t handle)
 	if (!handle)
 		return;
 
-	if (handle->inode)
-		ext2fs_free_mem(&handle->inode);
 	if (handle->path) {
 		for (i=1; i <= handle->max_depth; i++) {
 			if (handle->path[i].buf)
@@ -203,17 +202,13 @@ extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
 		return retval;
 	memset(handle, 0, sizeof(struct ext2_extent_handle));
 
-	retval = ext2fs_get_mem(sizeof(struct ext2_inode), &handle->inode);
-	if (retval)
-		goto errout;
-
 	handle->ino = ino;
 	handle->fs = fs;
 
 	if (inode) {
-		memcpy(handle->inode, inode, sizeof(struct ext2_inode));
-	}
-	else {
+		handle->inode = inode;
+	} else {
+		handle->inode = &handle->inodebuf;
 		retval = ext2fs_read_inode(fs, ino, handle->inode);
 		if (retval)
 			goto errout;
-- 
1.7.0.4

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ