Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3328910rwa; Tue, 23 Aug 2022 02:58:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR7D362w8egPriuKdyT86vyTLRPN28yjqL+gOeE84G3Z/e+tjSL6R8fiRvjPU/sYVj5F+h59 X-Received: by 2002:a17:907:6d0d:b0:73d:9983:2c12 with SMTP id sa13-20020a1709076d0d00b0073d99832c12mr2142292ejc.195.1661248718096; Tue, 23 Aug 2022 02:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248718; cv=none; d=google.com; s=arc-20160816; b=glyAReTEcsS//kI9gU7tWYb0HKkAZ93N7l0wh9TR39QAGsAgnxdslkB9Acp0NoKfcK b8rsupWP24xVhf1IjuMa0kQXHjo1oQ2pVe5RD9KhqP/R2pcqoi9g9erH6D22qqES4aL0 IfC7CRGsQMlU1GUaNOMnhRyjlKIoLM1MpVAJ/cF2lRT2OEFyGfHdILvsyt7eP0cmbZLF 56rAn0kc4mfS3L86xTgpN8aZvbuU+hsyscFnIROGE59XaYYjyEeeHZj9BCO397jtn663 mhMzOJFhI6IiuwPKOgbvx7zlH4wJsFv1gkFMDbUEr+weB3lTEvu7YPB60HXib40VcnOr F8+g== 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=Xdf/BMdFJJteNunUetnCzhGXUbGKBYr5XF+ovfulgOo=; b=ZenOfZJsWWefc3rdU1uR4VdeFx6qRaE32AEUL5M/KNVauxaLdUPciXLMDqNwKwmzts d3Vy+3JClC1IBjOBLlGHkPKvNwxZReTeU++39XxoOcrwBOC5cGxUsML2CRl36J9pLe98 dnDKs79O1AVk/TnLGH077v/9y0CdVFtTQJ+7okVwF81XoXh4NAmf/o3bjlnZ/jPUdK+5 DAqP0zxJyUcFIrvsspfrjk4WaTSuNb7zEthjE2l4aO/KepXepeF/aehqeUhVjUXM6vpl y9o52BFuC8aTo1BpZdwAyhjZGumNLt95Aj7+6ma4/x39u3LOeaSRDJcKdySL5zkX2dcP JsgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0CRtaL3a; 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 nb36-20020a1709071ca400b0073d615565fesi8640795ejc.494.2022.08.23.02.58.10; Tue, 23 Aug 2022 02:58:38 -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=0CRtaL3a; 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 S1350527AbiHWJcP (ORCPT + 99 others); Tue, 23 Aug 2022 05:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350694AbiHWJan (ORCPT ); Tue, 23 Aug 2022 05:30:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567B777E98; Tue, 23 Aug 2022 01:37:50 -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 0B61FB81C59; Tue, 23 Aug 2022 08:36:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37C8EC433D6; Tue, 23 Aug 2022 08:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243797; bh=8+uI3dGK+g1A3bAEeGbQ0dbGyAfd+7/26+/vSwy/3pA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0CRtaL3aF9XPGKEqFuLbWDlnyCuMQWp4s1F+A1uVVlQc2QSNHSB4RWnUXFuUZ5/1W 3od4gpa7A8EVhLIIeECPXBFIFzTZmbrSKVqfUnSTBdvDjKQFaSPVLJdRcWn18xkEKP maMQsRZQ/ukqzZT1w2zbEyocXXWP4FoGXe5NITyU= 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.14 024/229] fs: Add missing umask strip in vfs_tmpfile Date: Tue, 23 Aug 2022 10:23:05 +0200 Message-Id: <20220823080054.313390750@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 @@ -3465,6 +3465,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;