Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2089316iof; Tue, 7 Jun 2022 19:20:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3i9G77FxvpgxI92IBrmFAPRTZ/DtVKC2wtCRj3nXF1SfoT+WQCRHUZCZiPoD2/Gk9Wwt5 X-Received: by 2002:a63:5b13:0:b0:3c2:163c:b9cb with SMTP id p19-20020a635b13000000b003c2163cb9cbmr28109996pgb.145.1654654825368; Tue, 07 Jun 2022 19:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654654825; cv=none; d=google.com; s=arc-20160816; b=xF4KihVnLpNvpwr51y9H9dIBniyJrVuYC+7X9pnXgE81CDer/eBr19zc1S6dIfn4YQ IP8/VdKBUgos1hE4b9TmrwXnIFm9U+D68nuZ1C8NOrUJWiUdz/ZSDG6F3BU+8ewVQ3UJ DbeBVpgJndHrUyWVlJ5sRHM6rGvI8shRU5veXDV/ItXLCn7MLZUaonD+3lD3N9JXopqA 07jVS9EBLNJBAHnKw4yVCKDAIfBfWyGkqaMAcuje3CnNXe5o3Kzec+YOHCYEDheN3f9e wX9lCljlPFmUNx+m//5JcnWHTx53YBqEp6sffNGi13HJSwIXFBRFaH9kS5YIofY4UdOt UvXw== 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=1AuFpPwJTm0xL2Nji9J7dEMxxyEkLYPb2IzIMRKmVxK/nnFcbyJMEpraxDgWnI7JQR fppStIoGRUNde4Z54nFdTriWcjJjVHVUes4oAXFskng4FZ1rV1grLlnIBXVJd+aBcJkj iIM9aBUotVSqmbkBffFlaxRfrX23PbM9SNeil6ODlZH8+cNyxWbM5JdovKldqybih73d VFStVrEKlrIff32d9ZCl4tOjx7CmzK/fCWNJ/1JUKjYctmioRAe/P+m40Y4EsrQutyqc p3V2hMXAEP2OJ2o1ANSB86Lv89iQirN1rylFdlpUZ5PKoVheZPJXwaVJVULQT4hTXvhP JKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0XIe/dzP"; 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 w1-20020a1709027b8100b00162496617adsi24535662pll.142.2022.06.07.19.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:20:25 -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="0XIe/dzP"; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13EFF3A4804; Tue, 7 Jun 2022 19:07:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356477AbiFGWDb (ORCPT + 99 others); Tue, 7 Jun 2022 18:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378665AbiFGVDX (ORCPT ); Tue, 7 Jun 2022 17:03:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17B3145589; Tue, 7 Jun 2022 11:48:36 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 7F1BA61295; Tue, 7 Jun 2022 18:48:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA19C385A2; Tue, 7 Jun 2022 18:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627715; bh=qO2K96LJDhbirD99gp0YVHECVMdEPs1haKCeGlOd7O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0XIe/dzPnfwJ/bsDQODmzGdNvbFD6ABI6/rreRtwYI/IxXPWZ2lhokRnCMTsX+sgg +xH4v0fd0+59idN32kj8WqBF6+0/aM4O6zCm2QsKgYfF96pycqo3xywmt1Dk5lQWJB RG37+kbXrSCteus25fgxG6Bd5QcylBxhbTtO/t+A= 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.18 026/879] 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:52:24 +0200 Message-Id: <20220607165003.435264945@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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); }