linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle()
@ 2008-05-12  3:24 Tiger Yang
  2008-05-13  0:02 ` Andrew Morton
  2008-05-13  0:18 ` Eric Sandeen
  0 siblings, 2 replies; 13+ messages in thread
From: Tiger Yang @ 2008-05-12  3:24 UTC (permalink / raw)
  To: linux-ext4; +Cc: linux-fsdevel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

Hi,
I met a bug when I try to replace a xattr entry in ibody with a big size 
value. But in ibody there has no space for the new value. So it should 
set new xattr entry in block and remove the old xattr entry in ibody.

Best regards,
tiger

[-- Attachment #2: xattr.patch --]
[-- Type: text/x-patch, Size: 1323 bytes --]

This fix the uninitialized bs when we try to replace a xattr entry in ibody with the new value which require more than free space.

Signed-off-by: Tiger Yang <tiger.yang@oracle.com>

diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index a6ea4d6..e1af9bd 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1000,6 +1000,11 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 			i.value = NULL;
 			error = ext3_xattr_block_set(handle, inode, &i, &bs);
 		} else if (error == -ENOSPC) {
+			if (EXT3_I(inode)->i_file_acl && !bs.s.base) {
+				error = ext3_xattr_block_find(inode, &i, &bs);
+				if (error)
+					goto cleanup;
+			}
 			error = ext3_xattr_block_set(handle, inode, &i, &bs);
 			if (error)
 				goto cleanup;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index d796213..182a7a2 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1011,6 +1011,11 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 			i.value = NULL;
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
 		} else if (error == -ENOSPC) {
+			if (EXT4_I(inode)->i_file_acl && !bs.s.base) {
+				error = ext4_xattr_block_find(inode, &i, &bs);
+				if (error)
+					goto cleanup;
+			}
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
 			if (error)
 				goto cleanup;

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

end of thread, other threads:[~2008-05-14 22:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-12  3:24 [PATCH] ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle() Tiger Yang
2008-05-13  0:02 ` Andrew Morton
2008-05-13  2:31   ` Tiger Yang
2008-05-13 20:00     ` Andreas Dilger
2008-05-14 10:56     ` Andreas Gruenbacher
2008-05-14 16:00       ` [stable] " Greg KH
2008-05-14 17:28         ` Andrew Morton
2008-05-14 22:30           ` Theodore Tso
2008-05-14 22:54             ` Andrew Morton
2008-05-13  0:18 ` Eric Sandeen
2008-05-13  7:48   ` Tiger Yang
2008-05-13 12:48     ` Eric Sandeen
2008-05-13  8:48   ` Kalpak Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).