public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reiserfs: Fix corruption during shrinking of xattrs
@ 2010-04-13 19:39 Jeff Mahoney
  2010-04-14  8:32 ` Christian Kujau
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Mahoney @ 2010-04-13 19:39 UTC (permalink / raw)
  To: Andrew Morton, Linux Kernel Mailing List, ReiserFS Mailing List,
	Edward Shishkin, stable, Christian Kujau, kernel, gregsurbey,
	Marco Gatti

 Commit 48b32a3553a54740d236b79a90f20147a25875e3 introduced a problem
 that causes corruption when extended attributes are replaced with a
 smaller value.

 The issue is that the reiserfs_setattr to shrink the xattr file was
 moved from before the write to after the write.

 The root issue has always been in the reiserfs xattr code, but was
 papered over by the fact that in the shrink case, the file would just
 be expanded again while the xattr was written.

 The end result is that the last 8 bytes of xattr data are lost.

 This patch fixes it to use new_size.

 This issue was reported at: https://bugzilla.kernel.org/show_bug.cgi?id=14826

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Cc: stable@kernel.org
---

 fs/reiserfs/xattr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -553,7 +560,7 @@ reiserfs_xattr_set_handle(struct reiserf
 	if (!err && new_size < i_size_read(dentry->d_inode)) {
 		struct iattr newattrs = {
 			.ia_ctime = current_fs_time(inode->i_sb),
-			.ia_size = buffer_size,
+			.ia_size = new_size,
 			.ia_valid = ATTR_SIZE | ATTR_CTIME,
 		};
 
-- 
Jeff Mahoney
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-15 23:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 19:39 [PATCH] reiserfs: Fix corruption during shrinking of xattrs Jeff Mahoney
2010-04-14  8:32 ` Christian Kujau
2010-04-15 23:49   ` Christian Kujau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox