Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2168851iof; Tue, 7 Jun 2022 22:02:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxefB3n72b9xNAIT+SselH9X+QAOuAN3x2gINUvGaQ/Opq8VdwXUIKTLAb95tnp1ScXKyGm X-Received: by 2002:a05:6a00:1513:b0:51c:3ca8:47a4 with SMTP id q19-20020a056a00151300b0051c3ca847a4mr6546844pfu.48.1654664528639; Tue, 07 Jun 2022 22:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664528; cv=none; d=google.com; s=arc-20160816; b=uez23SX5rCatfI4IIbXtj8keUsY9hO0XlpoCrJKt0np+3QctOC3X1j01dQb0rnxEEB VSbYQece3KuCRupo5uTcBwtHdpi2DsXuwTTb2J+/0LyY7HyK0fy3lAsY4dUKX7Hv80EW HEAOjrZH0LYNWtHiutskDJh3zTOvk48vCoCBTetRt9qB21qPoOW0u4jV2O2CVyoICMPI 3oBGm0IoA4mplqc521uXAOyRUV0VrDuXSjAWuBaw80RwInWh1rZK3bRgXuQH1hoye0HF +QrLH2LV8HpP+lt+0zdAV7syVc+P1A7si92OAv+wqDmzrYUWLmB6uNgvwp8svl/5JwhV uoWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vULolMmroZjXLlWiZXtAw2bviULZkfyrDwYjMhRdlTQ=; b=NIxQ0pv7qOmucKmoaVjIy1LUGg1gKnAv7fVZJtvli0sjm12zGa1zfrFu44kA+Hg3MV hlkh3xLlDFO6QxLutayXjlcNHZD1P+d2+g/tqufAa7U6WIO2R2BfA3HvM5jZ9beHSnyq d0E1UGuNjJnLVzRG83ImE+VGoqsfKMJrHOU3eVpWCf4S6ON6gQWstfBT1MeQ8j/mZflF eFeqwzR13Bh0xH1VmlWfSnXXZsOU6D+53sVB3ovFMdcl+DICSw0kxfIjHDwZ0dZPLwCD Z7IyO+kFsrmxwz9HhlnOIKMrNnVETN0T3g+ORqhHGk49tK7WYiAXBWzOX/t12FuJNrWs GjLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jOYltGsp; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b16-20020a056a00115000b00518d680f9dbsi28132739pfm.99.2022.06.07.22.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:02:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jOYltGsp; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6944B244470; Tue, 7 Jun 2022 21:30:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359204AbiFGUUO (ORCPT + 99 others); Tue, 7 Jun 2022 16:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356811AbiFGT2N (ORCPT ); Tue, 7 Jun 2022 15:28:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DFB1A1951; Tue, 7 Jun 2022 11:10:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE309B8233E; Tue, 7 Jun 2022 18:10:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 489A6C385A5; Tue, 7 Jun 2022 18:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654625452; bh=qO2K96LJDhbirD99gp0YVHECVMdEPs1haKCeGlOd7O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jOYltGspLBHE2liFTe5hNgTW/Ax/k6osF93gt4bB8W/4+arbbL8K5GviU6BNWokEH DKu8S4TwCw0Z5hRM3CT27v4pPbWXVaQzT7ptqzAU5xkzMbZlEgWcllC3K74nZamjUY +DCUuMYbf0bhzeUNblb7WDjS9YsELD0K+ZAktSNs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Perches , Konstantin Komarov Subject: [PATCH 5.17 024/772] fs/ntfs3: In function ntfs_set_acl_ex do not change inode->i_mode if called from function ntfs_init_acl Date: Tue, 7 Jun 2022 18:53:36 +0200 Message-Id: <20220607164949.726810942@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Konstantin Komarov commit 9186d472ee780fabf74424756c4c00545166157e upstream. 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: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Reviewed-by: Joe Perches Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman --- fs/ntfs3/xattr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -541,7 +541,7 @@ struct posix_acl *ntfs_get_acl(struct in static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, struct inode *inode, struct posix_acl *acl, - int type) + int type, bool init_acl) { const char *name; size_t size, name_len; @@ -554,8 +554,9 @@ static noinline int ntfs_set_acl_ex(stru 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); @@ -616,7 +617,7 @@ out: 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, false); } /* @@ -636,7 +637,7 @@ int ntfs_init_acl(struct user_namespace if (default_acl) { err = ntfs_set_acl_ex(mnt_userns, inode, default_acl, - ACL_TYPE_DEFAULT); + ACL_TYPE_DEFAULT, true); posix_acl_release(default_acl); } else { inode->i_default_acl = NULL; @@ -647,7 +648,7 @@ int ntfs_init_acl(struct user_namespace else { if (!err) err = ntfs_set_acl_ex(mnt_userns, inode, acl, - ACL_TYPE_ACCESS); + ACL_TYPE_ACCESS, true); posix_acl_release(acl); }