Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4448669imw; Tue, 19 Jul 2022 06:51:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sE/3QWSGbPPJRL+Hfo1K7r+5+VykYkmfbUX14QacnYBYC3/3SYjHRmx8PHDxl0XxLFHlsD X-Received: by 2002:a05:6402:3290:b0:43a:86c4:af70 with SMTP id f16-20020a056402329000b0043a86c4af70mr43459162eda.313.1658238698424; Tue, 19 Jul 2022 06:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238698; cv=none; d=google.com; s=arc-20160816; b=aMLhuXufhnZkIyR7YEjSUomqg/XXxKEdcgrsK8VfXjzleF+n4JBiDQwzwIrxO5EY65 nKgA3EFt7USfeZFmrGbzhHqQvAbt17ywvbrIoARks+T0KqqNst98O86Ma8vF9DhltMSe ZKz5i0WHdugQ4qqkZ3P5wtiHVBBRVsg8vCHXA08cN3HUc6SRV2Oype7BpvihNBW7E4uQ 440GrAgqbm0CrudYKXtvdr/KbkB4ur3MzBicdi2VAIUh3HPgJYsfDTvQcDtMi7oEqJl8 vd2YKgeZewcuqVDzhoGzDBIGHImQMIHmBCO+rkfWlflryITjxlyaRUTwepx+RbVMhwjE gGlg== 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=/6N9eTnDiPpFIjyHPnWU6ydkQEEDW2suS97rtqOM7Q8=; b=W3pqljo3Se5XkENuFdSgLlaiiNxxxSlLTxpXtiFwBTFlFBd55HH9jXEZVxoNhA6XL1 Dq4lUqHm7m26M5Twt/06s+QARrHDWPTOSmaNi1jQM7oYHJ98h2DOjc8abTKltEOUjMMh QyifZ6NGr9PGQslbNAoObInlnRYOAom/u61Tx2xwx/6+ntl8ykk8+UrtjDd9dAyKYdoA BA4ZSzXOV/KDfWc/KFPg6TGqWfJq2ZbijNBkYgNLoQ60/1hcF5HDaIpmEbVTp6kGB4Ac Dj2DdfO0p2+Zw+Ss0ODen/0td4p9YsmhaqukeuRjR5o1aru76rqSMZzYQRuvDZHn0R5Y NKPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WEbVf5tA; 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 y2-20020a170906914200b00722e95c36efsi16669499ejw.408.2022.07.19.06.51.14; Tue, 19 Jul 2022 06:51:38 -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=WEbVf5tA; 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 S239522AbiGSMVh (ORCPT + 99 others); Tue, 19 Jul 2022 08:21:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239899AbiGSMUB (ORCPT ); Tue, 19 Jul 2022 08:20:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C744D82A; Tue, 19 Jul 2022 05:07:21 -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 9EC626173C; Tue, 19 Jul 2022 12:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70D52C341C6; Tue, 19 Jul 2022 12:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232440; bh=7ZYWiRyY+pdBvXiE3F4IZL5+o6eMslmSkCprIoHSkHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEbVf5tA+4KY0Z7NwuH6VO/QuVw8rt2EwtpZjNeSTdF+Vlt88s2k99YUlInr198Qo 7E05XmCaCWUfu+oDpyPVo0TDCBCS61ro3nsJKRUhtDaQFKV4nmxEFlY7pY9W7POMoz D8AWoZh/dbv/9XiTAg2xNcmMtsAf6PcAFY5oyX00= 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 5.10 021/112] nilfs2: fix incorrect masking of permission flags for symlinks Date: Tue, 19 Jul 2022 13:53:14 +0200 Message-Id: <20220719114628.043894903@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 @@ -198,6 +198,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; }