Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp702031pxb; Thu, 23 Sep 2021 08:56:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXptt5egJZfDYJpT6mor+thUfaFjYS8upimv52Cw2RZD5DIxc377Zdrh2ixFgdmUYwCS+4 X-Received: by 2002:a17:906:29c5:: with SMTP id y5mr4410744eje.405.1632412604554; Thu, 23 Sep 2021 08:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632412604; cv=none; d=google.com; s=arc-20160816; b=U5flftIPbmQbIfF6FkvCJ5EKYOMjlv9dVYMqjMDvYwnqi2J15C4J/8oiADarQy0HOF MPmS/6R5+xBz0DSFAhgZ2tpiSroSGyppW3U3Yd1PKe/XOGn1iq8AFlvPLgKXLkIKPVFH NjBwCw4V+KzEQdj7/sUiv59bfB7jF39guNTlcX2blYG1Qo3YmHnnktLyrCr8pBpbP2Wo qa9Se1TlMSSRrFNEIIuBZhlGonU6Ly60Rkj0weCf01YX4Zg1RRkXb7sGIqH8K8RvmViw HOpNgmHshFBEDW9GzRRkFi3HNi51hKSwagdjNXp96oFzxv3MtMhIHyAS7SI94f/ZTJGy kpog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:cc :references:to:from:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=xo6NzBG5zTDvAw5Mm7uDCLaWbmcG9uTUtIcsabAqkkg=; b=fsDJS0t4yRqTZ/kNHOFeK5ZMTTQZUn+m5Kw2cjU6AiEStOLZUvDfoAlRWcxX3VvzEb 2uhv1cqyBN1nuSmA9glcsjjDDCjHgmpHN9KXRkKsG9WNvpAe/VwPTdAaoplrusmUWd2S B79/PlfZVr5rgmEB0HGDVzo9sQu0yxi3xLVz5AvOPeR7QJt/Yr1WWQ72fswRNpgyw0Y3 LH6mbl0OKqaeNWp8Xt7AyZEs1R9CRf0EKUPkKC9o7O3RKuRNw3w5Gza+7vAkPmkKtK4J uC2nmp9XDl/lue3w81shUJGVIZNjbAALpgkVVj8njj4ZxF3R9FDa0h11qnSIS9bc70N/ aSpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=q14bBxSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e28si6149847ejm.61.2021.09.23.08.56.19; Thu, 23 Sep 2021 08:56:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=q14bBxSV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242278AbhIWP4F (ORCPT + 99 others); Thu, 23 Sep 2021 11:56:05 -0400 Received: from relayfre-01.paragon-software.com ([176.12.100.13]:35828 "EHLO relayfre-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242259AbhIWP4D (ORCPT ); Thu, 23 Sep 2021 11:56:03 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 5DF091D90; Thu, 23 Sep 2021 18:44:00 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1632411840; bh=xo6NzBG5zTDvAw5Mm7uDCLaWbmcG9uTUtIcsabAqkkg=; h=Date:Subject:From:To:References:CC:In-Reply-To; b=q14bBxSV0iNF8D2aN5Zg/iJhFJ4sOLzzr/SGZv6Y7+hYWdhvV/mqs2wxAAFUXfJbp ZpbWJkt7teA7llmoFWJDkik9YC/1j6ToJ3a28yz/6CHGaN5oVEfhDd0pbO47k56AVm FJnVvLXXDqDGgFUeAnK1N6z9kbiycWE8w9OimSxI= Received: from [192.168.211.73] (192.168.211.73) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 23 Sep 2021 18:43:59 +0300 Message-ID: <7083d062-bee3-f343-4aec-61bcc5f96414@paragon-software.com> Date: Thu, 23 Sep 2021 18:43:59 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: [PATCH v2 4/6] fs/ntfs3: Pass flags to ntfs_set_ea in ntfs_set_acl_ex Content-Language: en-US From: Konstantin Komarov To: References: CC: , In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.73] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of removing of xattr there must be XATTR_REPLACE flag and zero length. We already check XATTR_REPLACE in ntfs_set_ea, so now we pass XATTR_REPLACE to ntfs_set_ea. Signed-off-by: Konstantin Komarov --- fs/ntfs3/xattr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 3795943efc8e..70f2f9eb6b1e 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -549,6 +549,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, size_t size, name_len; void *value = NULL; int err = 0; + int flags; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; @@ -591,20 +592,24 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, } if (!acl) { + /* Remove xattr if it can be presented via mode. */ size = 0; value = NULL; + flags = XATTR_REPLACE; } else { size = posix_acl_xattr_size(acl->a_count); value = kmalloc(size, GFP_NOFS); if (!value) return -ENOMEM; - err = posix_acl_to_xattr(mnt_userns, acl, value, size); if (err < 0) goto out; + flags = 0; } - err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked); + err = ntfs_set_ea(inode, name, name_len, value, size, flags, locked); + if (err == -ENODATA && !size) + err = 0; /* Removing non existed xattr. */ if (!err) set_cached_acl(inode, type, acl); -- 2.33.0