f2fs: correct removexattr behavior for null valued extended attribute
Chao Yu
maintainerPATCH 1/1 f2fs: correct removexattr behavior for null valued extended attribute
From: Daeho Jeong <[email protected]>
__vfs_removexattr() transfers "NULL" value to the setxattr handler of the f2fs filesystem in order to remove the extended attribute. But, __f2fs_setxattr() just ignores the removal request when the value of the extended attribute is already NULL. We have to remove the extended attribute itself even if the value of that is already NULL.
We can reporduce this bug with the below:
1. touch file
2. setfattr -n "user.foo" file
3. setfattr -x "user.foo" file
4. getfattr -d file
Quoted 1 line
user.foo
--- fs/f2fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/xattr.c +1 -1
@@ -600,7 +600,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, goto exit; } -if (f2fs_xattr_value_same (here, value, size)) +if (value &&f2fs_xattr_value_same (here, value, size)) goto exit; }else if ((flags &XATTR_REPLACE )) { error = -ENODATA ;
Signature · 6 lines
2.14.1.145.gb3622a4ee ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerThanks,
Quoted 41 lines · Chao Yu
From: Daeho Jeong <[email protected]>
__vfs_removexattr()transfers "NULL" value to the setxattr handler of the f2fs filesystem in order to remove the extended attribute. But,__f2fs_setxattr()just ignores the removal request when the value of the extended attribute is already NULL. We have to remove the extended attribute itself even if the value of that is already NULL.We can reporduce this bug with the below:
1. touch file
2. setfattr -n "user.foo" file
3. setfattr -x "user.foo" file
4. getfattr -d fileQuoted 1 line
user.foo
Signed-off-by Daeho Jeong <[email protected]>Signed-off-by Youngjin Gil <[email protected]>Tested-by Hobin Woo <[email protected]>Tested-by Chao Yu <[email protected]>Reviewed-by Chao Yu <[email protected]>Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/xattr.c +1
-1@@ -600,7 +600,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, goto exit; } -if (f2fs_xattr_value_same (here, value, size)) +if (value &&f2fs_xattr_value_same (here, value, size)) goto exit; }else if ((flags &XATTR_REPLACE )) { error = -ENODATA ;Signature · 1 line
2.14.1.145.gb3622a4ee
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot