Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3013389rwb; Mon, 15 Aug 2022 16:09:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YzAGqUdqeInqpIbiT3ypGEXvS6wtbD1eC1c6U4KXHXkO2ONJoR6kOKqfTa+5qSnPivfg1 X-Received: by 2002:a05:6402:90d:b0:443:ef4c:480f with SMTP id g13-20020a056402090d00b00443ef4c480fmr2775077edz.128.1660604947914; Mon, 15 Aug 2022 16:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604947; cv=none; d=google.com; s=arc-20160816; b=a243SfIsLP96pW0xC0EmNasNv8fQVdORnuCRfZGRqoQi6sLvJuMNoMfZTYkPw3YCFG ts+td7jklNeiibEjPKXfdi0vKNZzMh3opt4vDmwQy5Max1IwOtRn7jGtndVmFGQkPg7t gKBA4Vz25R0kG1bc2d4/I4rQl73uP0nKOc4v3z3PVDGg+CLQTwKMxDN9ilvyOEMYZ1em acqHaWzmb+se+tbSajYwWATBQJYHCx+/36TanZ92ypj2zTBawOT/9oaAyzJrwHw3pmiV 4yLrsuImInjQ8gQeSgUw8ZbH5HQDKy077KgrWbULo0JnziSZNlog2DtDMWMaJ5881jI/ b5TQ== 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=sY2M235Wvmz/04TtoIOlBjjodLRPiUa/B1w/JJoVc44=; b=NIiuFlnsky8Rl8Ox0FQ+SLsY6Jig56/JdSm2Npje7uX0QPRrWskG+UqmW/sHihBvmF CPYUcBasAKlXzPNfaJu/2Tlhg64toD0cTp0n37ksUveRs7kKUBQ4xhr3bQg0h9QgxXYh izuf5tvE0yRkcg4cMdW4AWqP564R96CVwoYuyejnv1syxTl4+uCBClsqv2F57tcsKWEO IeGbBnX9+LMneBcj2/Ijlot1V9WQcBTiw7qqbMPx2c5VceJjdztxx0b/z7bJuwLIjFQ+ 5te5D3ZlwPYzUt8Ontcy7X+hP0ohTh40nKo41JRSZGzlz+5BONg9gBWXu7jbjAKYpGcu dXFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xiT7+AXq; 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 h10-20020a05640250ca00b0043d7f8da635si9508382edb.581.2022.08.15.16.08.42; Mon, 15 Aug 2022 16:09:07 -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=xiT7+AXq; 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 S1347635AbiHOWID (ORCPT + 99 others); Mon, 15 Aug 2022 18:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350512AbiHOWCT (ORCPT ); Mon, 15 Aug 2022 18:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D92D372695; Mon, 15 Aug 2022 12:37:02 -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 766EF610A5; Mon, 15 Aug 2022 19:37:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19029C43143; Mon, 15 Aug 2022 19:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592221; bh=dyc6z0TjG+7MCpzbubP6giLnQNX48WuaU49Qi4JOdNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xiT7+AXqF1y0ZEIW+Fb/cLtVAVI3Fv6IBpp97ThcuzFvnGEKu3BJb63Yd4azE3B6C IJ8Fd63QIMfS1qHrZbs9t+O//MB3K1GGD8/Y6aoOggjixLJsKPhV5qDVAfveLhwDLS NdcDZcUJDsSTgFw5V0SfjW6luQvLkjPzhBZlQRlo= 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.19 0054/1157] fs: Add missing umask strip in vfs_tmpfile Date: Mon, 15 Aug 2022 19:50:10 +0200 Message-Id: <20220815180441.618554027@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 @@ -3565,6 +3565,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;