Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2889800rwb; Mon, 15 Aug 2022 13:23:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7SQyiIX6JUZIt79SMO0DPP48LmMDfGJBoABU1stDj6utqswYxOdMY+0MlBbaW017mf9ARJ X-Received: by 2002:a17:907:3f85:b0:733:3f0e:2f28 with SMTP id hr5-20020a1709073f8500b007333f0e2f28mr11171060ejc.376.1660595026935; Mon, 15 Aug 2022 13:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660595026; cv=none; d=google.com; s=arc-20160816; b=EZXijS3Hra3r2dH4CyYlvNu5yhO8l6AA7VUDg4Nh8TDwyP3aAiU5zFJKHwrrrsB/KQ NUOK3mJceFq19FVsoxls+IgzPwOIWn3Q1y3UtiFGg8Z3suYvxWQHwAycfwcjZuwPRG5h 5aWoAzhkIHhBgl6St7rXOYOAmaOOFMQ7Pi2b4dfRXRaQHOeWv3r0vpZrRWGEmA0OqNe+ ZGjHHWuVj1Onqn52z9QxbJSKU8WtxBqQuhSJvsERlqgTrggmjxGS7/2fQ4A6S7cKcBFB epz0YUf5WORmy5PR08uzkidX3rJZ3C4EhFYolFaMd7n/ChicuaUshi3c/RV8RTK0Y7G/ NGPQ== 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=82XRg+2UsgMnkUwGt2OD8/EKz7wuaDOrpF19mFDRqiQ=; b=iPYDEu/J8sJHl0zttrzd+ewGnIKlR5aMHqo/JaSBlbWJVpYQRZTBUxKM30EAEe2GLW Yx2NI74XGZKGjKx+hCV928/bTBSxX5LfyqBpSTL59uM2Ku33lOVwGjQTb60yiGroqeH2 Vv1WedLtgfpGVtxyMzCYJN1LDNgpnYoUph6prVEzqpY9fttU71sNlgR6/5538FCKyk7c LGKbYz6G+z2gmIio12RwWUDP14D9eWK56ibPeshH3eg667DIo5DLewXHCD4fDi8WlFVm lte0jKzCdyai596otBdO+4WdgC3obQAtTYZiMqOwyA6pJrB+Q0RFE3LcOnPFgX52Gq7/ 6oVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kc0BI7Z/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a50fe97000000b0043e05d2b2ccsi7469696edt.116.2022.08.15.13.23.17; Mon, 15 Aug 2022 13:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kc0BI7Z/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346446AbiHOUPr (ORCPT + 99 others); Mon, 15 Aug 2022 16:15:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244539AbiHOUKk (ORCPT ); Mon, 15 Aug 2022 16:10:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B30D6433; Mon, 15 Aug 2022 11:56:31 -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 DE6A7B81057; Mon, 15 Aug 2022 18:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6333C433D6; Mon, 15 Aug 2022 18:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589788; bh=9AXtdf7iMYEPfVdm49C8RitZ4xqPwFJVJ81OSCHZxDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kc0BI7Z/0KUTmuYCsoTYxrBql3AOaVrT+w3NkVdtj0+nfg6FMk/61AvAwetYbDh1D bjlQXlW4WpZ0OvLpns43ymmc6WzCtUQ9gGQO1wAK1gDiArDR5VlBsKVAvVCXs/NheA TqXUwnRz4Svb7p7ClfLafS3wKmCr6jn0PqqM6kmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian Brauner (Microsoft)" , "Darrick J. Wong" , Yang Xu , Jeff Layton Subject: [PATCH 5.18 0048/1095] fs: Add missing umask strip in vfs_tmpfile Date: Mon, 15 Aug 2022 19:50:47 +0200 Message-Id: <20220815180431.439109572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Yang Xu commit ac6800e279a22b28f4fc21439843025a0d5bf03e upstream. All creation paths except for O_TMPFILE handle umask in the vfs directly if the filesystem doesn't support or enable POSIX ACLs. If the filesystem does then umask handling is deferred until posix_acl_create(). Because, O_TMPFILE misses umask handling in the vfs it will not honor umask settings. Fix this by adding the missing umask handling. Link: https://lore.kernel.org/r/1657779088-2242-2-git-send-email-xuyang2018.jy@fujitsu.com Fixes: 60545d0d4610 ("[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now...") Cc: # 4.19+ Reported-by: Christian Brauner (Microsoft) Reviewed-by: Darrick J. Wong Reviewed-and-Tested-by: Jeff Layton Acked-by: Christian Brauner (Microsoft) Signed-off-by: Yang Xu Signed-off-by: Christian Brauner (Microsoft) Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -3571,6 +3571,8 @@ struct dentry *vfs_tmpfile(struct user_n child = d_alloc(dentry, &slash_name); if (unlikely(!child)) goto out_err; + if (!IS_POSIXACL(dir)) + mode &= ~current_umask(); error = dir->i_op->tmpfile(mnt_userns, dir, child, mode); if (error) goto out_err;