Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1864341rwb; Fri, 19 Aug 2022 10:39:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR5oT9N8EER1dIb+QikF7KxXJ8KZ0jbYO19e7FpSECP8Tm+fqM9egD9dNvF8+Z9ItTkrRJWG X-Received: by 2002:a05:6a00:114f:b0:528:2c7a:634c with SMTP id b15-20020a056a00114f00b005282c7a634cmr8840178pfm.41.1660930761328; Fri, 19 Aug 2022 10:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930761; cv=none; d=google.com; s=arc-20160816; b=iDJd9aE8B9X4R+W7WxYfbVdRanQgUBybccIrTkX4tpBoiW6lwMTTmT+ki/CFs5pghb /mlqkH+ZD3SkvtlbHE5+aXpvYi4b2QfL+cRe5/B34nKlZc9KFbWhC6OC5IVMNSDecGgL 9vaXFtG+FmyYIfgbh5HX919ksoQPRyLx0QqyBmm36FlIQojxy/LAI4iwCLtO8blb7qr2 9eVyELj7oca8q2LQ6uZ7bjlpGALB+o47A2GuxMHWjFSDip2kME6Vegh0DsOlnbB0XJcp mr5ORWGplUxpTdJGYCBu6Sc0XOdHkB/uK3KQaknv65ZocWD9AiQ0KlbFT3YL21mQHBA+ 0jhw== 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=zZwcwdnVqFJR9RXBxelaKI1SOS+2RiExf5Hqp0kDsqc=; b=nKuZntCVHlVKINhvmJFsBUQ7KgtPGTaiGdajnXd802xEHwPo6PHvEl6kv7Ic43Ty50 2PaL0fb5CN+Nzqpx3pngR8XFQ30F+d4mBjeoROzsGvaRt49+KhuTC7QUpoYIWZndOSx0 nmbgnNBugscOSlb9nE/3iuDGR1Tb4T4UZXJ9RRmqfpLQiIpaUtltaq5cl+4Q6iFE7K9n BPgI72owpyvAKR+0ST1ndBhovqBuQbfCtXHmoYf2P66bPYArL04Uos7J8b6E9Qu99zja NnOKERaUh3AS9R/M0KN8h4BlpYaPWAFtUwpuD/KBC6zfxdjqLEMWXQd8H6tSJFnvYVth hovQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fHehP8vB; 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 8-20020a17090a0a8800b001ec9e904597si4555360pjw.27.2022.08.19.10.39.10; Fri, 19 Aug 2022 10:39:21 -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=fHehP8vB; 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 S1350277AbiHSPtJ (ORCPT + 99 others); Fri, 19 Aug 2022 11:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350149AbiHSPsO (ORCPT ); Fri, 19 Aug 2022 11:48:14 -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 3E93A102286; Fri, 19 Aug 2022 08:47:16 -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 557F2B82813; Fri, 19 Aug 2022 15:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72B99C433D7; Fri, 19 Aug 2022 15:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924033; bh=v3Y2T2aJe3leLOnylds8Pwqy1Wb5a8LfIxRhSucAjhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fHehP8vBTFLSUjbr4ooQYvoKHgTW5pK64WlGQwkXXNnrCU4P9qjgebBD97/F4Ow8S yTOalebVeh4UliJgnCrmfrA9auWsJKjDxFNkXzQ/mHmKpZhAz3g2R4KTI78UowDUdt dCT2y3JNIQKwo9E3BToONRfkwz2Ty7tfEQtZtD8w= 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.10 033/545] fs: Add missing umask strip in vfs_tmpfile Date: Fri, 19 Aug 2022 17:36:43 +0200 Message-Id: <20220819153830.677299205@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 @@ -3272,6 +3272,8 @@ struct dentry *vfs_tmpfile(struct dentry child = d_alloc(dentry, &slash_name); if (unlikely(!child)) goto out_err; + if (!IS_POSIXACL(dir)) + mode &= ~current_umask(); error = dir->i_op->tmpfile(dir, child, mode); if (error) goto out_err;