Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4369322imw; Tue, 19 Jul 2022 05:29:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vKJbMdc4D9dVP+YCC6fHZtup+UxvBUMTqnhRTeZ/DB/MMdo6BYT5BIKb0fla54ecaD9sF3 X-Received: by 2002:a17:907:2888:b0:72b:4a91:b21a with SMTP id em8-20020a170907288800b0072b4a91b21amr30674264ejc.35.1658233786662; Tue, 19 Jul 2022 05:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233786; cv=none; d=google.com; s=arc-20160816; b=bb49b0Y1Yu3yNw5Kv9kyygv1uvFWPJPWQRo95ssWPjexrfKfLn0ln+PnivcC+i3C8e J+dL7z/MMAfDXxwccClpr2vHLwYZk27iqEhXCfK3XOvo2OknaUxqr9wsEbtWR9vqzDdy V3yOIRvuEO7n66uFP8ApXv5swjdmrhtnIiUeHH9KaK63CNdA6ttBp362azLhdMFueabD 5cuguAQUiXKPt4qnw24Ah3t9hZXt+cXB/GMPvyytiVJDEex5QRSeyzKkrD49aoT1BRHA 7OjN74hIEZFTRy1hSGoqgpUVJGABVnuCtn1EedOk1UJe3qchkWcDH+HogaQTi3L4MJgX qWJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4BO/LiEXJt6gfa8Xfj0OWn8MjR6Jt/g82b1iXIzxgs8=; b=nukz9nvZka/ijCl+HVRNhYagPsPJyoF5chan7fizYeCLYRYDvJQskDsi4/A4uos8zz Dr6T5wgTy9q/Z0c4xowTeK1qDgBcc989YWA3P4ToL6/0xCWPoH9l8u2UYlmAbnLW4FtU n9t6LokAA9COUYjIRN5CPckba6GvPvBF1dysxsO2AGdzYuX8lnNJSVSoHVWrgvC6vnGs dyOxLSoumJZCruYA44e0nDltT57KxOMWEHSbzaTxb3ImXEAKCuKpOnYqnw/lRY+w2yAV 8h35BL/RxbmFXB4D3k8RMu7eqwmJg8i3BT+t92YF7GTfSIXiulyM0XdsmI3KLpuRoGJA nZGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B53K555n; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qx3-20020a170906fcc300b00722f48fa044si16766496ejb.192.2022.07.19.05.29.22; Tue, 19 Jul 2022 05:29:46 -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=@linuxfoundation.org header.s=korg header.b=B53K555n; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237493AbiGSL5j (ORCPT + 99 others); Tue, 19 Jul 2022 07:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237574AbiGSL5O (ORCPT ); Tue, 19 Jul 2022 07:57:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA3445077; Tue, 19 Jul 2022 04:56:39 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8FA0F6165E; Tue, 19 Jul 2022 11:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B7DDC341D1; Tue, 19 Jul 2022 11:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231797; bh=n0mhtTbRmKMrtDsxbt0+8JC74G0b+EOPSqVSehfbq3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B53K555nLn695Z5fuo3dRZIPlPWF3HDjIWPdqwjM4ePwcmVYk7vMEyuiAhYzcKrYU hRH8lajEXglYndkJHRoJr47XhB8RsnYEDPgXLHVJgcgnm4DAhvgjPBdk4fyLzrN8IV TsWh4yCfDhOzyTj/PIRQ2DkcATZESNl0DFEwCie4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , Tommy Pettersson , Ciprian Craciun , Andrew Morton Subject: [PATCH 4.9 06/28] nilfs2: fix incorrect masking of permission flags for symlinks Date: Tue, 19 Jul 2022 13:53:44 +0200 Message-Id: <20220719114457.110414851@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114455.701304968@linuxfoundation.org> References: <20220719114455.701304968@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Ryusuke Konishi commit 5924e6ec1585445f251ea92713eb15beb732622a upstream. 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. Link: https://lkml.kernel.org/r/1655974441-5612-1-git-send-email-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: Tommy Pettersson Reported-by: Ciprian Craciun Tested-by: Ryusuke Konishi Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -212,6 +212,9 @@ static inline int nilfs_acl_chmod(struct 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; }