From nobody Fri Sep 5 20:02:06 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A5C5C32772 for ; Tue, 23 Aug 2022 11:09:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357175AbiHWLJN (ORCPT ); Tue, 23 Aug 2022 07:09:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357426AbiHWLGx (ORCPT ); Tue, 23 Aug 2022 07:06:53 -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 234666DAFC; Tue, 23 Aug 2022 02:16:15 -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 2EA5FB81C89; Tue, 23 Aug 2022 09:16:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DEB8C433D6; Tue, 23 Aug 2022 09:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246172; bh=2sxcONQG5+13GFZKIUuuJJOdJiO6gB1QkmXN1s9SLuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1eZ/APnaLWg9demkTyL8AM9HAEt+N6sHQo3HVd/XoxwE0DNrHxTWZy0yfSG64h373 0Cc9l0wfjWPvt3KhlPjgBaB0oL3Y54CkJMUeZw90HM8p0DlTGc7GOe/Z6JTkLOXRK7 DXboOopXsAMOCar6l6gD0YT2tMCiDX+WNirE33nQ= 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.4 024/389] fs: Add missing umask strip in vfs_tmpfile Date: Tue, 23 Aug 2022 10:21:42 +0200 Message-Id: <20220823080116.708133539@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 infra= structure 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 @@ -3443,6 +3443,8 @@ struct dentry *vfs_tmpfile(struct dentry child =3D d_alloc(dentry, &slash_name); if (unlikely(!child)) goto out_err; + if (!IS_POSIXACL(dir)) + mode &=3D ~current_umask(); error =3D dir->i_op->tmpfile(dir, child, mode); if (error) goto out_err;