public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	ReiserFS Mailing List <reiserfs-devel@vger.kernel.org>,
	Edward Shishkin <edward.shishkin@gmail.com>,
	stable@kernel.org, Christian Kujau <lists@nerdbynature.de>,
	kernel@jbeekman.nl, gregsurbey@hotmail.com,
	Marco Gatti <marco.gatti@gmail.com>
Subject: [PATCH] reiserfs: Fix corruption during shrinking of xattrs
Date: Tue, 13 Apr 2010 15:39:52 -0400	[thread overview]
Message-ID: <4BC4C888.9040104@suse.com> (raw)

 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

             reply	other threads:[~2010-04-13 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 19:39 Jeff Mahoney [this message]
2010-04-14  8:32 ` [PATCH] reiserfs: Fix corruption during shrinking of xattrs Christian Kujau
2010-04-15 23:49   ` Christian Kujau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BC4C888.9040104@suse.com \
    --to=jeffm@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=edward.shishkin@gmail.com \
    --cc=gregsurbey@hotmail.com \
    --cc=kernel@jbeekman.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists@nerdbynature.de \
    --cc=marco.gatti@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox