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 X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 291DDC433E3 for ; Mon, 17 Aug 2020 18:19:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A9E320738 for ; Mon, 17 Aug 2020 18:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597688370; bh=sb12qdwsO26+j8IXpIgXscG3bNqXO8PzacHekRh78nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0x1A369PZoEHxaanbkbfb/4T+0+bA+nrVfnnKwqpFT17N9biOiALB7F21VRwqE5C2 gHOtyv/nmF2ZBoOmDxbGJuXkvHBh5/6kHgOo3mZ0MWVKUmQN4089oBTae0ge3jV/6h Bg4mqSzPfzeso3vDHSZNVH6ZoDuW4LwI5Vb+c0l0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390683AbgHQST2 (ORCPT ); Mon, 17 Aug 2020 14:19:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:53300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388155AbgHQQF1 (ORCPT ); Mon, 17 Aug 2020 12:05:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC1D6208C7; Mon, 17 Aug 2020 16:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680319; bh=sb12qdwsO26+j8IXpIgXscG3bNqXO8PzacHekRh78nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5qVwCBz6zWRGWN4fJ45SKb/ZP76WxiYJv9Pu9VpTvxpt8zEQdyZ4oG/KtX5PLL0d Y+x+5LQlhtTaXlgrCVqWy22Zyj3CSjxTu8Pznayf2WvdCriEL9KbyazMKugAlyBkql r5E2Nc7KH/0mDEWrSTfckwh6Y/+RMBy2SXaHqjkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Amir Goldstein , Jan Kara , Sasha Levin Subject: [PATCH 5.4 140/270] kernfs: do not call fsnotify() with name without a parent Date: Mon, 17 Aug 2020 17:15:41 +0200 Message-Id: <20200817143802.784782913@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amir Goldstein [ Upstream commit 9991bb84b27a2594187898f261866cfc50255454 ] When creating an FS_MODIFY event on inode itself (not on parent) the file_name argument should be NULL. The change to send a non NULL name to inode itself was done on purpuse as part of another commit, as Tejun writes: "...While at it, supply the target file name to fsnotify() from kernfs_node->name.". But this is wrong practice and inconsistent with inotify behavior when watching a single file. When a child is being watched (as opposed to the parent directory) the inotify event should contain the watch descriptor, but not the file name. Fixes: df6a58c5c5aa ("kernfs: don't depend on d_find_any_alias()...") Link: https://lore.kernel.org/r/20200708111156.24659-5-amir73il@gmail.com Acked-by: Tejun Heo Acked-by: Greg Kroah-Hartman Signed-off-by: Amir Goldstein Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/kernfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index e8c792b496166..c35bbaa194862 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -912,7 +912,7 @@ static void kernfs_notify_workfn(struct work_struct *work) } fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, - &name, 0); + NULL, 0); iput(inode); } -- 2.25.1