Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2655996pxa; Mon, 17 Aug 2020 15:40:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFw8cDnZPOqBr4OnDRhVPr4k7PDOAYEUOSq1MEdWaY5dCUMe2oWnqncqiH+7E4Z2GzQWrh X-Received: by 2002:a50:ba8c:: with SMTP id x12mr17562534ede.319.1597704038616; Mon, 17 Aug 2020 15:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704038; cv=none; d=google.com; s=arc-20160816; b=wdGSiLf8s4rgU2leMoJ6pgEOWR+FffZ5+VIspqBUx9zf5xT06bxWA50KGBOvjgDyee +n4cgW39qe6FAvjk91L3b4pFvrg2q/Ch+p5QnoVQ980dDj5xxP7HNQNGI2E5+fOSJY+q U2HWX9zMG601bJMoJYmK/5C0KAoL2FFDWQz4Ho38OfHUJrax93JvfAuFZwNimFhBWlXJ wmh2yB0TO7nbmxX/MPfGPR6gktH31UFdbxBqHJ2s20ED7ZgpO2U9SdECi/Xnaze0OnXu mWic09KiSkDSYvGOeNtLGVFjmahi4+IVXICCrJ8N8AoAzJVwAXBmqk/k0aKMeEtLzbOx qMSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jAju5gXOHENJ+VA/shiA1WFggFJyS+W5CXsT3AJGGlw=; b=ABVtE548zBqInaqcAr0LNgwIK8vpZnDtJm7rB6AneQsVLQ1pftjlxS2HDZDlvsNbD1 rzXr7lH+MlypQNemjWBl13hwjnNQB5wFXGKlFAuSOUSTDdsgbrlFSyAZR4QK4SH9DSnu ZUPMMplbeV5O3blcyCGK6tnjtPWirzojhbJbBpINovW2daH/Ts/SVqsfyhBT69vOtajq AHASxLWUNr5O8PuoEuT4OUAAX7wQHvkln7nLz7IglJPlWPLo7w3y/aRNOIduvBmwvjlP zf/qsiaA5IBZf2jTRQtyifayLr/ldBmTzd607LP7O4Qb1c9lzN74VSGF4Sg6srd0E//D W7cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i5qVwCBz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si12823817ejq.223.2020.08.17.15.40.15; Mon, 17 Aug 2020 15:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i5qVwCBz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390774AbgHQSTX (ORCPT + 99 others); Mon, 17 Aug 2020 14:19:23 -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