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-next>] [day] [month] [year] [list]
Date:	Fri, 06 Jan 2012 20:47:37 -0800
From:	"Darrick J. Wong" <djwong@...ibm.com>
To:	Theodore Tso <tytso@....edu>, "Darrick J. Wong" <djwong@...ibm.com>
Cc:	linux-ext4@...r.kernel.org
Subject: [PATCH] libext2fs: When truncating file, punch out blocks at end

Currently, ext2fs_file_set_size2 punches out data blocks between the end of the
file and infinity when truncate_block <= old_truncate (i.e. when you've made
the file longer).  This is not a useful behavior, particularly since it *fails*
to punch out the data blocks when the file is shortened (i.e. truncate_block <
old_truncate).  This seems to be the result of the test being backwards, so fix
the code to punch only when the file is getting shorter.

Signed-off-by: Darrick J. Wong <djwong@...ibm.com>
---
 lib/ext2fs/fileio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c
index d56f5b5..8751635 100644
--- a/lib/ext2fs/fileio.c
+++ b/lib/ext2fs/fileio.c
@@ -389,7 +389,7 @@ errcode_t ext2fs_file_set_size2(ext2_file_t file, ext2_off64_t size)
 			return retval;
 	}
 
-	if (truncate_block <= old_truncate)
+	if (truncate_block >= old_truncate)
 		return 0;
 
 	return ext2fs_punch(file->fs, file->ino, &file->inode, 0,

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