From nobody Wed May 8 03:15:36 2024 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 A33B8C43334 for ; Thu, 23 Jun 2022 08:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbiFWIyK (ORCPT ); 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-Google-Smtp-Source: AGRyM1tNpAW10PD5eKdQZl31km1eJxSPdtLnll6TymTdk56uqdX65PxOh8YNlwmE9ykHzAVYf+K1Sg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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) =20 static inline int nilfs_init_acl(struct inode *inode, struct inode *dir) { + if (S_ISLNK(inode->i_mode)) + return 0; + inode->i_mode &=3D ~current_umask(); return 0; } --=20 1.8.3.1