From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756754AbeATWEV (ORCPT ); Sat, 20 Jan 2018 17:04:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:56646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756652AbeATWEP (ORCPT ); Sat, 20 Jan 2018 17:04:15 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0713420835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jaegeuk@kernel.org Date: Sat, 20 Jan 2018 14:04:14 -0800 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu , Daeho Jeong , Youngjin Gil Subject: Re: [PATCH] f2fs: correct removexattr behavior for null valued extended attribute Message-ID: <20180120220414.GA28167@jaegeuk-macbookpro.roam.corp.google.com> References: <20180120074633.3277-1-chao@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180120074633.3277-1-chao@kernel.org> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks, On 01/20, Chao Yu wrote: > From: Daeho Jeong > > __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 > Signed-off-by: Youngjin Gil > Tested-by: Hobin Woo > Tested-by: Chao Yu > Reviewed-by: Chao Yu > Signed-off-by: Chao Yu > --- > fs/f2fs/xattr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c > index 600162f4ddbf..ae2dfa709f5d 100644 > --- a/fs/f2fs/xattr.c > +++ b/fs/f2fs/xattr.c > @@ -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; > -- > 2.14.1.145.gb3622a4ee