diff options
author | Tiger Yang <tiger.yang@oracle.com> | 2008-05-14 19:05:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-14 22:11:14 -0400 |
commit | 7e01c8e5420b6c7f9d85d34c15d8c7a15c9fc720 (patch) | |
tree | 9208cb180253bd98208ae3be34ffc10526d4f949 /fs | |
parent | 0c70814c311581a6c86198db4f982aa683c68fb8 (diff) |
ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle()
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.
This situation only happens we format ext3/4 with inode size more than 128 and
we have put xattr entries both in ibody and block. The consequences about
this bug is we will lost the xattr block which pointed by i_file_acl with all
xattr entires in it. We will alloc a new xattr block and put that large value
entry in it. The old xattr block will become orphan block.
Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Cc: <linux-ext4@vger.kernel.org>
Cc: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Andreas Dilger <adilger@sun.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext3/xattr.c | 5 | ||||
-rw-r--r-- | fs/ext4/xattr.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index d4a4f0e9ff69..175414ac2210 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, | |||
1000 | i.value = NULL; | 1000 | i.value = NULL; |
1001 | error = ext3_xattr_block_set(handle, inode, &i, &bs); | 1001 | error = ext3_xattr_block_set(handle, inode, &i, &bs); |
1002 | } else if (error == -ENOSPC) { | 1002 | } else if (error == -ENOSPC) { |
1003 | if (EXT3_I(inode)->i_file_acl && !bs.s.base) { | ||
1004 | error = ext3_xattr_block_find(inode, &i, &bs); | ||
1005 | if (error) | ||
1006 | goto cleanup; | ||
1007 | } | ||
1003 | error = ext3_xattr_block_set(handle, inode, &i, &bs); | 1008 | error = ext3_xattr_block_set(handle, inode, &i, &bs); |
1004 | if (error) | 1009 | if (error) |
1005 | goto cleanup; | 1010 | goto cleanup; |
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 3fbc2c6c3d0e..ff08633f398e 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -1009,6 +1009,11 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
1009 | i.value = NULL; | 1009 | i.value = NULL; |
1010 | error = ext4_xattr_block_set(handle, inode, &i, &bs); | 1010 | error = ext4_xattr_block_set(handle, inode, &i, &bs); |
1011 | } else if (error == -ENOSPC) { | 1011 | } else if (error == -ENOSPC) { |
1012 | if (EXT4_I(inode)->i_file_acl && !bs.s.base) { | ||
1013 | error = ext4_xattr_block_find(inode, &i, &bs); | ||
1014 | if (error) | ||
1015 | goto cleanup; | ||
1016 | } | ||
1012 | error = ext4_xattr_block_set(handle, inode, &i, &bs); | 1017 | error = ext4_xattr_block_set(handle, inode, &i, &bs); |
1013 | if (error) | 1018 | if (error) |
1014 | goto cleanup; | 1019 | goto cleanup; |