Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2663093pxa; Mon, 17 Aug 2020 15:54:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqqtiO57v8W/4x4cHDPUMoJtXsMRSmMiYrdjeQAnYNYDRt01CadT/H+ePVkPz8AhMY3cYW X-Received: by 2002:a50:a2e6:: with SMTP id 93mr16471966edm.147.1597704894750; Mon, 17 Aug 2020 15:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704894; cv=none; d=google.com; s=arc-20160816; b=Bua8DLmvZejWk82MumPVPp1t0uEpYzjQ2+Kbp1C8icuqgomKm7tTdcYjPJxcEeKcV0 IpnPZrlhGSgaUGtbmAqo4jljKbVPNQi2rRr9JQOgsfb/xYGESwVlfcZyVtlyIPVihbNG B5IQf+UI1BQbCvIqMsizkNfOwi18ADjfWWVWvOn/Eq3yP3gLnEbWK3gDTsppEYrBCK+q XUxjUbnKuOGn3m9qDCz1nKq0CX64AU1FaV8GQ3cWMcYWifzfdblFEFSKpbmd2hRSe9oq V8y/1kfV6LXoMZUq3I9c3rCdjLLc+6K9MWFYJjabx7dzAoKcsWVFdsf0e/MTLr59GHqU YPPg== 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=PDco2qvM9o4fGx/jN1IJE80QQwEhj7bfBvmuiAKDY0s=; b=GQzKDRA1Cgmlh67QbNcdAmJqdJj/J90HWsCcmW0cduA1+JxWHgGtApLEayE1gZQ73W +BpAe4uAUTgdoWqoV0G40oLpt4Ro0VYfP/jes1mHPhO7YJBLUYQdFP2LyuSdz+KZs39J Fxn/q/8IvC3bsDRU7z7EoX9uYAe6SuoMxymALQT5/mm6c6NEpQnUqLOF0pVBi53fSBMH XZCNF9xwe82c8S8HxwPGQ/dseeqiHCaEhHkrrQoNlSHhMslChTm4uc78+RZjPbPnq3Td JGtsasa/uxs0q04Wvh8RI0fZx3ZrpvnJ5wriTHYFvkucHmyQ6wDjLYhUkX0dwd8xNoRl PIfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PyysUvQB; 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 h8si11987833ejd.623.2020.08.17.15.54.31; Mon, 17 Aug 2020 15:54:54 -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=PyysUvQB; 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 S1730068AbgHQTgJ (ORCPT + 99 others); Mon, 17 Aug 2020 15:36:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:45502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730038AbgHQP2x (ORCPT ); Mon, 17 Aug 2020 11:28:53 -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 9FCB22395B; Mon, 17 Aug 2020 15:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678133; bh=rByohBipMQD+Mr+NQEulKE7/oGD16WMXfdthdczdzhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PyysUvQBwypgpDe0TrRS8VF16NjNhz+8d73vjeL5qIxqhgpydEtCs9lE9zkoJvUOB NNRoCR/cmoBgEhdbr9S20TJixtm1wgHCDsiQ2jkaqjBSyGxAK5u0S+EnU2ghd8HWKS H/PB6MHN54zRzJ/lvNEqaV2L7l1NvPkRRGNKHoL0= 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.8 230/464] kernfs: do not call fsnotify() with name without a parent Date: Mon, 17 Aug 2020 17:13:03 +0200 Message-Id: <20200817143844.818016395@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@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 06b342d8462bf..e23b3f62483c4 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