From mboxrd@z Thu Jan 1 00:00:00 1970 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 BDFD7C433EF for ; Wed, 20 Jul 2022 01:30:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242366AbiGTBad (ORCPT ); Tue, 19 Jul 2022 21:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242289AbiGTB3I (ORCPT ); Tue, 19 Jul 2022 21:29:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BDE0D8F; Tue, 19 Jul 2022 18:19:20 -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 ams.source.kernel.org (Postfix) with ESMTPS id C0F0EB81DC0; Wed, 20 Jul 2022 01:19:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8026CC341C6; Wed, 20 Jul 2022 01:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658279957; bh=2EAe9d/15fb9EvQLyRctfq8yKMy23iuGqG2W9wu1BFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uk9EoO5MDa4c8jWPkFM8Hae5bSLUkoF9+gxPTgbax9SAmTAx9ph3QL3h+ay3KygRj YXEqR6XPyrq0/xYC14H4lOkEZMI7B9kAd/VzdXYCp7RUIfnTXjrnqsF7FlHaUfeMlz iMtf3eUGOxvSsoGFwABOYkcTIUUK19dskunwDTmPKcMnx+Q+phD0AE4A/3VBc22uBm xhgVSw8N2ww14S2OFm+VurucDtvvSR/JMXJHXndItcFQGLxqsrpHxYUYCRGZAjq4sw wop1Npka485lFfRGnpZXIB6BIVZ5he5t8fgW4deWocSQabI3xAksNyvdZ5+S+lrOiJ V/oixs6Bqe4Xg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ryusuke Konishi , Tommy Pettersson , Ciprian Craciun , Andrew Morton , Sasha Levin , linux-nilfs@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 4/6] nilfs2: fix incorrect masking of permission flags for symlinks Date: Tue, 19 Jul 2022 21:18:55 -0400 Message-Id: <20220720011858.1025523-4-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220720011858.1025523-1-sashal@kernel.org> References: <20220720011858.1025523-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ryusuke Konishi [ Upstream commit 5924e6ec1585445f251ea92713eb15beb732622a ] 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: Sasha Levin --- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 33f8c8fc96e8..a89704271428 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -212,6 +212,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; } -- 2.35.1