Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5650423iog; Thu, 23 Jun 2022 02:34:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5m4FKu68lyHb2dVecpkK+wSV9MxwNwvm3TBi7lUAfgu15jRZA3LYRELzBg2QlBlEzmqMw X-Received: by 2002:a17:907:c29:b0:704:fbb:1943 with SMTP id ga41-20020a1709070c2900b007040fbb1943mr7361874ejc.486.1655976846225; Thu, 23 Jun 2022 02:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655976846; cv=none; d=google.com; s=arc-20160816; b=wSrlrHg85jxV2hnZ7ube3mt8tY0/SjN05aCBXDbphICqg3BymZomGSSxq25feWMXVR kxBlaCXU9OatwvvxyPaIz24MRmYTCOmqREdPcRi6CV+lepSSMTHxQ0hWBqa07MCMQhvT MnQJCg2AsLhI8bvPVit+7NOJLbIHWMez5ibmR8BDf+aBzddbYKHknCKbPx8zL24q24RD Bdx6sdYvkYU91Vjgw/ICJDd8JV8tS0fX6iRJL0YoDfc0uXWbpEiFiSen5XpScHyanou/ DBo0CKTYi3Y5lCJlDcsRj4Q8t8f2JfgWX+SFyXcKcpFSGe9dRWhUs5pRs+1dZFQGjbsk g/eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=CgKFu42pVNbutALOPAyFG9CSppEVlH9cLVPLNYXxSDc=; b=dnIR/3emNAHThoW0mRmk5Y0N5WB0sISBRAtT+GeaC1ft+adUP1ihTM47aaszFV6gTv EuDeBQSY3nBD79n2Vk1LCEc3iFPEiT6ewpStcRI4casc0DfGfGLiqL/cUv0rJ38/qGIC G2bvHkRQSi8XQJ7lS068vnmDXFaD5ZPfb+oY7KgNCx+9RP0Z+4zwXtLiAGBazmXYZ7M0 6QtyhYOHZ+/XiMcTlAphlGpGw02yMa7GTuhDRYKNYWl0CIzXpT2X6fuCOJ5/3rdHq8xy iIsYPXnZNy1+MDa2oeG2WLiPQ632SJ3rvwtPJNk7SswOKbQqs46+TMSg8VDmc6HXrmAx gxHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TgWNIU0s; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt9-20020a1709072d8900b006ff20273cccsi26527786ejc.231.2022.06.23.02.33.39; Thu, 23 Jun 2022 02:34:06 -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=@gmail.com header.s=20210112 header.b=TgWNIU0s; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbiFWIyK (ORCPT + 99 others); Thu, 23 Jun 2022 04:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbiFWIyJ (ORCPT ); Thu, 23 Jun 2022 04:54:09 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9041B10559; Thu, 23 Jun 2022 01:54:08 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so1931459pjz.1; Thu, 23 Jun 2022 01:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=CgKFu42pVNbutALOPAyFG9CSppEVlH9cLVPLNYXxSDc=; b=TgWNIU0sVyugoVfuKJctmkNZR5g0jvh0wU5ej56Yfj8LnJBA9GMeWdwdhUSMYSgoXs vQDKVqw/SQcLjxA6/cIeb94CZs1VsmNQ6GwJB6IJv0D225ciqF3j0ah5Dwf5EqDSVesa CtyH9WAqCOdvoJk/R+N1Skk10gECKlAb6cb3lXNW1C/t3+kk7Y+WxD7UhsX5Rg34YvAD ka98Ju44pZ9q5Uyu484L4Bu1HrO6aFYSqCJ4MbLOeuNZRKcysCfXRBVL6aNmIBRT68eB ofV6E8LNIUBAeYDxaouMz9r1DAJmdqTBJA/as3Zg5s1BJrN41K9F11mCIQGtkPe6QYno lVDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CgKFu42pVNbutALOPAyFG9CSppEVlH9cLVPLNYXxSDc=; b=P6STkgsi6t+yRoJNKGvwwsqqGAAor0X6/lv7QdmsshA7STrWGTV+kfEqnI+puH7nCZ TfE/M0oKVd0rBvg0q1A3Eq/JEJkDOOlqJID1rOJw1qfWyYAcFAXyQa2hKLUKY5D5Ufqt 8wIbXLJYQtiZIiyacAaJUuj1wUUqprFRLlXTSnEKD5aXvydO8LyPbFtWhhMI14I9Wdtp 4PVL3rOab6tPK1zpPB/LC+5ruRbGulw5bEhFsS/kMatyiYehcU18QkxsQyTU0mjERatC IPPjZy7H/Mb5pSOnvzq4p+LBUGU8rSnPZBG9vA7UaR0Edb6ZJTRKRKpMMLa6etmJdFvZ Tt2g== X-Gm-Message-State: AJIora90Y4I9dMjoEHFOZhTz9dML/G4pJoLesQMiUmEpUWCLBQwqK85v tujgDnYHUWh3zMfaE//PpNOfDk8WoBM= X-Received: by 2002:a17:903:120f:b0:15f:99f:9597 with SMTP id l15-20020a170903120f00b0015f099f9597mr38034320plh.45.1655974447951; Thu, 23 Jun 2022 01:54:07 -0700 (PDT) Received: from carrot.localdomain (i114-185-17-44.s42.a014.ap.plala.or.jp. [114.185.17.44]) by smtp.gmail.com with ESMTPSA id c11-20020aa7952b000000b0052521fd273fsm8387644pfp.218.2022.06.23.01.54.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2022 01:54:05 -0700 (PDT) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs , LKML Subject: [PATCH] nilfs2: fix incorrect masking of permission flags for symlinks Date: Thu, 23 Jun 2022 17:54:01 +0900 Message-Id: <1655974441-5612-1-git-send-email-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 The permission flags of newly created symlinks are wrongly dropped on nilfs2 with the current umask value even though symlinks should have 777 (rwxrwxrwx) permissions: $ umask 0022 $ touch file && ln -s file symlink; ls -l file symlink -rw-r--r--. 1 root root 0 Jun 23 16:29 file lrwxr-xr-x. 1 root root 4 Jun 23 16:29 symlink -> file This fixes the bug by inserting a missing check that excludes symlinks. Reported-by: Tommy Pettersson Reported-by: Ciprian Craciun Signed-off-by: Ryusuke Konishi Tested-by: Ryusuke Konishi --- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 1344f7d475d3..aecda4fc95f5 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -198,6 +198,9 @@ static inline int nilfs_acl_chmod(struct inode *inode) static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) { + if (S_ISLNK(inode->i_mode)) + return 0; + inode->i_mode &= ~current_umask(); return 0; } -- 1.8.3.1