Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1651237ybi; Fri, 12 Jul 2019 21:13:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaryYQPZmlJcugSSt7cf39WOeyA23IK1gInZtvsGGGujrYVPvI1uueBhrzZAUTbDNHtr39 X-Received: by 2002:a17:90a:bf08:: with SMTP id c8mr16179246pjs.75.1562991183388; Fri, 12 Jul 2019 21:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562991183; cv=none; d=google.com; s=arc-20160816; b=yky5XoGUQ1vnfvTBTpNV064X/XIcSeeLhd+jfyFdb9thIrZ/svPCnZwE99YUCNrsov xWhjqiWnk/Ns4BHDkxr7xRgUyf7IamKRT6ij0lNuMG8hWxFx+ix+6sRQVdLXCaLpfyq7 SYZPRXS2fyHAq6BHaDMYJIhw8FVRq3qFs3RAqjkRBF9f2e0k26Psqq5dKwAAy402qrzF MAec0uvdF/XXo9HNlZ5JzyCULtuE9qrzgYBaS9Z2TbIbKr8XEAYM5mhuzd/4MVmFTJFG LRGq7kHshjuVLxYloNFuslBbLCGRJ8/f1AKifL6DTUgFQEhwktmSJeXzMf7pgtuOYwBe +hUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WLfKIxyGMxz80yD8kJS3MX9y/tLWLfECx+h3OgJwjtc=; b=knzyN7LWBnrKPaTy6J2TnV8MnP0Li+TKQp+pQcbIOkBpN63xW9S1ttKSPwheJ+5TKR V3GucAYSq6QGnApNGw8DDu1cdF0Zj/wS529a2Jm/YaHoBsPI0/43ZNPiOUGN+VL0He7a NPFIHPE9cdW7NGKDXGdid9YQaquhoetUvJSrv2VJ5p9eTiY+D/LUugpqC6DBnjzoSLs5 L3iM3CMCikK7Jeljz4Z5XuiNac2i9tzlHRdNZVTWn9AvpaXDaLYVJibqCzffq41rldSw krxSSsbD83XutRq2siQdyGlqWmud8mA34zLPtMHgrJMjaWgy5Js3NEtwr563zq4E/IH8 3S1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si1627824pfn.32.2019.07.12.21.12.34; Fri, 12 Jul 2019 21:13:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbfGMEMc (ORCPT + 99 others); Sat, 13 Jul 2019 00:12:32 -0400 Received: from nibbler.cm4all.net ([82.165.145.151]:37139 "EHLO nibbler.cm4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbfGMEMb (ORCPT ); Sat, 13 Jul 2019 00:12:31 -0400 Received: from localhost (localhost [127.0.0.1]) by nibbler.cm4all.net (Postfix) with ESMTP id 07A79C01D4 for ; Sat, 13 Jul 2019 06:12:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at nibbler.cm4all.net Received: from nibbler.cm4all.net ([127.0.0.1]) by localhost (nibbler.cm4all.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id nVn1QQeH0XH0 for ; Sat, 13 Jul 2019 06:12:22 +0200 (CEST) Received: from zero.intern.cm-ag (zero.intern.cm-ag [172.30.16.10]) by nibbler.cm4all.net (Postfix) with SMTP id DBF0EC01AC for ; Sat, 13 Jul 2019 06:12:22 +0200 (CEST) Received: (qmail 30916 invoked from network); 13 Jul 2019 06:44:00 +0200 Received: from unknown (HELO rabbit.intern.cm-ag) (172.30.3.1) by zero.intern.cm-ag with SMTP; 13 Jul 2019 06:44:00 +0200 Received: by rabbit.intern.cm-ag (Postfix, from userid 1023) id A2D3B460C4C; Sat, 13 Jul 2019 06:12:17 +0200 (CEST) From: Max Kellermann To: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com, bfields@redhat.com, tytso@mit.edu, adilger.kernel@dilger.ca, hughd@google.com, anna.schumaker@netapp.com Cc: linux-kernel@vger.kernel.org, Max Kellermann , stable@vger.kernel.org Subject: [PATCH v2 2/4] fs/ext4/acl: apply umask if ACL support is disabled Date: Sat, 13 Jul 2019 06:11:58 +0200 Message-Id: <20190713041200.18566-2-mk@cm4all.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190713041200.18566-1-mk@cm4all.com> References: <20190713041200.18566-1-mk@cm4all.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The function ext4_init_acl() calls posix_acl_create() which is responsible for applying the umask. But without CONFIG_EXT4_FS_POSIX_ACL, ext4_init_acl() is an empty inline function, and nobody applies the umask. This fixes a bug which causes the umask to be ignored with O_TMPFILE on ext4: https://github.com/MusicPlayerDaemon/MPD/issues/558 https://bugs.gentoo.org/show_bug.cgi?id=686142#c3 https://bugzilla.kernel.org/show_bug.cgi?id=203625 Signed-off-by: Max Kellermann Cc: stable@vger.kernel.org --- fs/ext4/acl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h index 9b63f5416a2f..7f3b25b3fa6d 100644 --- a/fs/ext4/acl.h +++ b/fs/ext4/acl.h @@ -67,6 +67,11 @@ extern int ext4_init_acl(handle_t *, struct inode *, struct inode *); static inline int ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir) { + /* usually, the umask is applied by posix_acl_create(), but if + ext4 ACL support is disabled at compile time, we need to do + it here, because posix_acl_create() will never be called */ + inode->i_mode &= ~current_umask(); + return 0; } #endif /* CONFIG_EXT4_FS_POSIX_ACL */ -- 2.20.1