Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1651571ybi; Fri, 12 Jul 2019 21:13:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6kLDczj36yH2yCLmlrnAc5vJWwhWdv8XzMIrjULqSLwckTTL204u+XFT04pswFjD6Dlq/ X-Received: by 2002:a17:902:12d:: with SMTP id 42mr14965203plb.187.1562991212724; Fri, 12 Jul 2019 21:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562991212; cv=none; d=google.com; s=arc-20160816; b=OL5z5LKdwjDQAN5zl60Xb800qz1zz30DNxvDBvEguAWFBbr8hCH4IIuTnoUmfaD4zm uzGTOvIULNsEvkK+SHaONCBU1D804wXLr1ReinQjrNTPPTuohh+0DFhJINSsbIgX3QQk oWUOpP+c0oi8i2MeR/ei6bPtlLp/aXDB176FoLpamD2KMYrCN/DD+16mQEaa2q7cD2UK Q8Ccr/R7zUIDrXl72BCY9cVY9Mhet02RrntIw2rAovFZdFqxVBhOTaP4PKeajic7OZik Vm/4Xo4JdZOjB4he0XnOIYIVN8TIxdfa6ZBdmcY58lP8EVBRFiqIz673puEZcF7oSNNa +LZg== 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 :message-id:date:subject:cc:to:from; bh=RC0+96a9Zeylt9WKb9523p7zTKtnnfKoUemYONJozXQ=; b=F1+bFsdcbLk5kN+WwQAJxrA7nQL//8YUU1WETQQwLgdMWEbBHkWuVtL6h+ksxaTdCa ZROs0yEG6WY3dCf2D55EgSQQtz6LcFqZpZ6SR3jjsRQbiCGysz3bPa6ufpPSVMw7eJwS 7g1d4UC/3cKWu+Dv+Rd5K6CFa7axAuGYSMv8K1XhHAq20wrv6AJTSLnz4pBfchwk0XDz XYly9sLCTJqegjjuAQZEd4kSvkpFSvoi6ZxXzNoEVWTxE3wyq2+1CCGNeaTx0h3X1Dx7 pDTqkyGpAKUJZZ4qns1ENLanwQiBnWOUxM4+J5mkO2w539ysgg/mXhE1wYCZTODgnBYu mYig== 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 v9si9366923plp.4.2019.07.12.21.13.18; Fri, 12 Jul 2019 21:13:32 -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 S1727488AbfGMEMn (ORCPT + 99 others); Sat, 13 Jul 2019 00:12:43 -0400 Received: from nibbler.cm4all.net ([82.165.145.151]:37169 "EHLO nibbler.cm4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726395AbfGMEMm (ORCPT ); Sat, 13 Jul 2019 00:12:42 -0400 Received: from localhost (localhost [127.0.0.1]) by nibbler.cm4all.net (Postfix) with ESMTP id BC931C018A for ; Sat, 13 Jul 2019 06:12:19 +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 BiINKmHZdAb0 for ; Sat, 13 Jul 2019 06:12:19 +0200 (CEST) Received: from zero.intern.cm-ag (zero.intern.cm-ag [172.30.16.10]) by nibbler.cm4all.net (Postfix) with SMTP id 915FCC01AA for ; Sat, 13 Jul 2019 06:12:19 +0200 (CEST) Received: (qmail 30898 invoked from network); 13 Jul 2019 06:43:57 +0200 Received: from unknown (HELO rabbit.intern.cm-ag) (172.30.3.1) by zero.intern.cm-ag with SMTP; 13 Jul 2019 06:43:57 +0200 Received: by rabbit.intern.cm-ag (Postfix, from userid 1023) id 50825460C4C; Sat, 13 Jul 2019 06:12:14 +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 1/4] fs/posix_acl: apply umask if superblock disables ACL support Date: Sat, 13 Jul 2019 06:11:57 +0200 Message-Id: <20190713041200.18566-1-mk@cm4all.com> X-Mailer: git-send-email 2.20.1 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 posix_acl_create() applies the umask only if the inode has no ACL (= NULL) or if ACLs are not supported by the filesystem driver (= -EOPNOTSUPP). However, this happens only after after the IS_POSIXACL() check succeeeded. If the superblock doesn't enable ACL support, umask will never be applied. A filesystem which has no ACL support will of course not enable SB_POSIXACL, rendering the umask-applying code path unreachable. This fixes a bug which causes the umask to be ignored with O_TMPFILE on tmpfs: 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/posix_acl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 84ad1c90d535..4071c66f234a 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -589,9 +589,14 @@ posix_acl_create(struct inode *dir, umode_t *mode, *acl = NULL; *default_acl = NULL; - if (S_ISLNK(*mode) || !IS_POSIXACL(dir)) + if (S_ISLNK(*mode)) return 0; + if (!IS_POSIXACL(dir)) { + *mode &= ~current_umask(); + return 0; + } + p = get_acl(dir, ACL_TYPE_DEFAULT); if (!p || p == ERR_PTR(-EOPNOTSUPP)) { *mode &= ~current_umask(); -- 2.20.1