f2fs: correct removexattr behavior for null valued extended attribute
authorDaeho Jeong <daeho.jeong@samsung.com>
Sat, 20 Jan 2018 07:46:33 +0000 (15:46 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 27 Jan 2018 21:30:35 +0000 (13:30 -0800)
commit3cafae53f3efbd1a2e7a48f463c06c6673e720a6
tree5df1303eae841ccec89fc17c09223ba7760c0ada
parent78d7fa9ac21fb883575a2ae5e0524bfa7bd9d1c7
f2fs: correct removexattr behavior for null valued extended attribute

__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
> user.foo

Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com>
Tested-by: Hobin Woo <hobin.woo@samsung.com>
Tested-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/xattr.c