Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp378084pxb; Mon, 25 Oct 2021 10:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzq9CwalXfnouDHCvTbp7z3xiEG9OpSzHyFKxmO5lWcu+GS7onvcoNx39dNs/cIjmnlhDaw X-Received: by 2002:a17:906:2bd5:: with SMTP id n21mr24007261ejg.337.1635181316692; Mon, 25 Oct 2021 10:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635181316; cv=none; d=google.com; s=arc-20160816; b=RDsV/azUUDHJMPhGnJ+HIzFZKQY894jHFbpr893a8LuwMfSKumqCDXeeq8k+cWTbzO hHgiyXiT0UiFVObscivRHJjh0EKmkBA1MJ77GO3p6gb4fqB32rhkyX9l4TS351FikvL6 TWJvZYzInGN29i6jWbcxOBNGXiLr7Ok75U6VD9sPAjDdU9Li3A1QcfZ+JKuB0xNTyYwR o2eNkqBPMY/oFmNUNSDnWCm9XHq5mNXHe5MtwnQ5M7W0S4h/eSBfVtTfDbqw242XjW1s 4MnGf6ezHndPepGtTVw4/q6/pP358vv2d73+juhmIkJIlqKY5t3aFQ0Nv0XR1B72fRyQ Nmrg== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=jXeqzlNUDb7Cz6wH59sPxI4xQQQ/EV06Awohr7HBZe0=; b=wrwRQfVZLVTpJh4Nk9GKRPmUNqGDH7o+reSwy4DOzKl2B9QmuSDveI8facyi5KpKXT yyQ83udFMzYjpKFsEdSv2NjVLuWqTuxLuWSCv+E3iWnbWqz0jHzE94I/yO+37rm5mgMf 4lznCg7PB/6lwEb/J9eb+91hFyBQWzTS63bz4yWfsC2JWUHCChnmqGk/CbfgrnJaDL56 J6Gd/vDgaGlxJBd6iFFFJW5rlawYiLJfiGmaqY7JE3SJmobJ96jOgWgVNl3w8FlthG/F nlEprYmDqxcuvrt+pbkt6nFQFPPQ18URKdFhWG7ApKlW3CuTt7UgjAFaBvIiDPpGzsHl P4/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=mCsObIQC; 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 su16si4275133ejb.613.2021.10.25.10.01.24; Mon, 25 Oct 2021 10:01:56 -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=mCsObIQC; 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 S234139AbhJYRAw (ORCPT + 99 others); Mon, 25 Oct 2021 13:00:52 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:56807 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234110AbhJYRAv (ORCPT ); Mon, 25 Oct 2021 13:00:51 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id CDFA7808C5; Mon, 25 Oct 2021 19:58:26 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1635181106; bh=jXeqzlNUDb7Cz6wH59sPxI4xQQQ/EV06Awohr7HBZe0=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=mCsObIQChpOOrhrxu6+r+wXspThHJw9pscmw4HwPLhhv9Y17cF6Ru1PBSN/+gtVte S6BmUA9wgbd4gI6ICDdU7JJdFbuzXaD++8x6RUmXQja+8ZGSrfxylbJPDer9VHn10V RrKKp9SS/oLJheRsWE9qAqneh6OgVg3rdmZOdbuI= Received: from [192.168.211.155] (192.168.211.155) 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; Mon, 25 Oct 2021 19:58:26 +0300 Message-ID: <67d0c9ca-2531-8a8a-ea0b-270dc921e271@paragon-software.com> Date: Mon, 25 Oct 2021 19:58:26 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: [PATCH 1/4] fs/ntfs3: In function ntfs_set_acl_ex do not change inode->i_mode if called from function ntfs_init_acl Content-Language: en-US From: Konstantin Komarov To: CC: , References: <25b9a1b5-7738-7b36-7ead-c8faa7cacc87@paragon-software.com> In-Reply-To: <25b9a1b5-7738-7b36-7ead-c8faa7cacc87@paragon-software.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.155] 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 ntfs_init_acl sets mode. ntfs_init_acl calls ntfs_set_acl_ex. ntfs_set_acl_ex must not change this mode. Fixes xfstest generic/444 Fixes: 83e8f5032e2d ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov --- fs/ntfs3/xattr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 2143099cffdf..97b5f8417d85 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -538,7 +538,7 @@ struct posix_acl *ntfs_get_acl(struct inode *inode, int type) static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, struct inode *inode, struct posix_acl *acl, - int type) + int type, int init_acl) { const char *name; size_t size, name_len; @@ -551,8 +551,9 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, switch (type) { case ACL_TYPE_ACCESS: - if (acl) { - umode_t mode = inode->i_mode; + /* Do not change i_mode if we are in init_acl */ + if (acl && !init_acl) { + umode_t mode; err = posix_acl_update_mode(mnt_userns, inode, &mode, &acl); @@ -613,7 +614,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode, struct posix_acl *acl, int type) { - return ntfs_set_acl_ex(mnt_userns, inode, acl, type); + return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0); } /* @@ -633,7 +634,7 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode, if (default_acl) { err = ntfs_set_acl_ex(mnt_userns, inode, default_acl, - ACL_TYPE_DEFAULT); + ACL_TYPE_DEFAULT, 1); posix_acl_release(default_acl); } else { inode->i_default_acl = NULL; @@ -644,7 +645,7 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode, else { if (!err) err = ntfs_set_acl_ex(mnt_userns, inode, acl, - ACL_TYPE_ACCESS); + ACL_TYPE_ACCESS, 1); posix_acl_release(acl); } -- 2.33.0