Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3409638rwa; Tue, 23 Aug 2022 04:25:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR6n0e8k5nzRcQZSYvZ1YeUz1N1LAgGPb5mjSwa811rXJn0snddXzQJEpoFL1i4TxDiGuF2t X-Received: by 2002:a05:6402:2949:b0:445:dc8d:44d with SMTP id ed9-20020a056402294900b00445dc8d044dmr3359475edb.60.1661253930606; Tue, 23 Aug 2022 04:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253930; cv=none; d=google.com; s=arc-20160816; b=by2thoDMZ7XH9JnJVIukxu0Sc9Z7c+m4EljvKbj6RJS7uJtWXKkEipo0V3B3fWLUOh oEygfwVxoWpvqn92zKyBSnvd+JuvqyyIP9g41oraDS6MuIduT70ydW1AQdwqnfCLKW5V OBztPisoN4G+5rviF+Fe+sYJKp4WDRTwbl1+doeld6v9RrLKwX+NLWwj0hioZdQGB2Zs k5gTSOFQUXggti4C5CovPrV8rUYi6KdVY0rhh8enFtxwgntQDif7FBfFgb8LBjHwE24o ufC6DuGcloL3SCht2M2NuXTLyhOFBEOHvtCdmcy7+e/I/Bt/GqzjzSegFTo3LWQQN1gB SfjQ== 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=EU+0F6FqhYbodih5iv9ka/foEl1rw3LECFMkEygODyk=; b=jLUgkSmzyASdxksQO8Stj1fa6a4MV4YJQSKVQJDhjS0dL2CUUhHD0yvhUi4jhhXGbX khq56D7Im88VnYLH/U8+rVWK9r1mogZ2D9kOdvS9JWk+AubWKosxp2S9QVdDzk6b6mdm gzPAW6Kt9Hp/fJCSm+VxUkbhb5BRqU1RtjusvSsiJlyHEE5Vhmf0ByAFr84jjCHZSu2E Yv9ckC1cadg6hLPn3VNkoeJ7UsugFtZdysZwja4jCn845LCP/WnE6HP42wQwd3CMx8ii oo4YxRDiiyiay+NTz8Tqjb3eea7f6OpnN+K15cn76rvGhYoht/1yyvPtjODMoqwV7a8j RvRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bGO7jVU5; 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 i6-20020a1709064fc600b0073d6a126ca1si9147949ejw.541.2022.08.23.04.25.04; Tue, 23 Aug 2022 04:25:30 -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=bGO7jVU5; 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 S1355276AbiHWKbf (ORCPT + 99 others); Tue, 23 Aug 2022 06:31:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353625AbiHWKPZ (ORCPT ); Tue, 23 Aug 2022 06:15:25 -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 C9D1B74372; Tue, 23 Aug 2022 02:00:40 -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 4E2A96153F; Tue, 23 Aug 2022 09:00:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DB9DC433D6; Tue, 23 Aug 2022 09:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245239; bh=6sO1DVUS28a0jhCph7kKD9enIsLvdY2Gf8SPbYtZt8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bGO7jVU56jr90RejwvdSh+tnl6+k+t2IuUbU4Rp4bdhWYbhCEjry12bcos1rYzwng hEKWlkZxi0f43AtFqPugl5BTzp/UBhYfYd2sF/9weoJ0A7u3BIL04cw2CWK817Q963 e+D0OTfLtRsFYXeaU3j3MIFnicZIVJahrjDlsdWA= 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 4.19 016/287] fs: Add missing umask strip in vfs_tmpfile Date: Tue, 23 Aug 2022 10:23:05 +0200 Message-Id: <20220823080100.830066411@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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=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: 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 @@ -3453,6 +3453,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;