Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3501351pxb; Mon, 18 Oct 2021 17:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwdOKXbrWXyeTPtnTEB0YQxQrjgB/DMMQdLKCDLRXGHwvOfNGGo5q/BtBFG+5Bb85EB4jN X-Received: by 2002:a05:6402:4382:: with SMTP id o2mr47956233edc.271.1634601764420; Mon, 18 Oct 2021 17:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634601764; cv=none; d=google.com; s=arc-20160816; b=yN0qrqaq9DMAKhIbEDwQytS1sw5FQcm0uMBYX/WWps5G1iKTvUD1+vmViSAJse8xyi 0rZnDebjQ5I2mZRez1zIa6yHuoExcjGArw4ItfEDdWNqw43a6bztnptLF45X9J9lUR8a HJuWrRtJb+GMGKzQ5p3UdEstj9nz833LVy07+yySGdYKvjqGQZbnIi9tINhQGtcyd7Uf 5/O4JUQXj7V77d8OZPp+FhQqwkPWoWwolKAA8FGnn5v5/BghMBaC5yAuYlXzg5oXVfOq KRt322/VCCsTOIFEWR7W+X60uWO72dOc9HHKHM99TTVjCz7gBp1Ir6/RPT7dGN8NJ5KS IeeQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3CUt5gKK38EefaHxVj1mWE2g28wGXezzBE+tYqWa5ic=; b=PUThmAYIWyHnfUI7Pxif2ivuQA0LmoTx6yDgE5fBQRphX8BxCMHgFNVpyq7ynPFVw9 9uINH+bau/OJm70G5UjHtlWsL/XoKwT20Qf9eRNQpiqOndt4tr2lKXPQ3E3rLIzy+hZ1 Hs8WMdW3KUeduSb183PXG/Y7OK+B5iPiscTr+tlkRiDDWWBNaaEBA9ggvpnOHtAL5lM6 C0TeZ7deW8BkHEIfshccXmFte1C+CBByeRZo16ZZQFwbix87c+0cRjSArcuiu1CfWzU2 /J1PwDXnPNL3uoPiyq0Lc6kwCLk0Pya2+GpKa1fQg/hOgwrmWjwelTMgD1I+EgaV9NN7 cnWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si20859418edu.358.2021.10.18.17.02.21; Mon, 18 Oct 2021 17:02:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233888AbhJSAEA (ORCPT + 99 others); Mon, 18 Oct 2021 20:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhJSAEA (ORCPT ); Mon, 18 Oct 2021 20:04:00 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09864C06161C; Mon, 18 Oct 2021 17:01:48 -0700 (PDT) Received: from localhost (unknown [IPv6:2804:14c:124:8a08::1007]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 45B4C1F41A9C; Tue, 19 Oct 2021 01:01:45 +0100 (BST) From: Gabriel Krisman Bertazi To: jack@suse.com, amir73il@gmail.com Cc: djwong@kernel.org, tytso@mit.edu, david@fromorbit.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH v8 11/32] fsnotify: Protect fsnotify_handle_inode_event from no-inode events Date: Mon, 18 Oct 2021 20:59:54 -0300 Message-Id: <20211019000015.1666608-12-krisman@collabora.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019000015.1666608-1-krisman@collabora.com> References: <20211019000015.1666608-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org FAN_FS_ERROR allows events without inodes - i.e. for file system-wide errors. Even though fsnotify_handle_inode_event is not currently used by fanotify, this patch protects this path to handle this new case. Suggested-by: Amir Goldstein Signed-off-by: Gabriel Krisman Bertazi --- fs/notify/fsnotify.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index fde3a1115a17..47f931fb571c 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -252,6 +252,9 @@ static int fsnotify_handle_inode_event(struct fsnotify_group *group, if (WARN_ON_ONCE(!ops->handle_inode_event)) return 0; + if (!inode) + return 0; + if ((inode_mark->mask & FS_EXCL_UNLINK) && path && d_unlinked(path->dentry)) return 0; -- 2.33.0