Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3927958imm; Mon, 8 Oct 2018 11:50:05 -0700 (PDT) X-Google-Smtp-Source: ACcGV62rZ1Vp9FuhpOwVPbJ9z6lmM84I9yMknH7OiH8DbrJOGQIlQHRRcQ5VtGjo+XS9yyf2AmdC X-Received: by 2002:a17:902:bb96:: with SMTP id m22-v6mr25121285pls.117.1539024605639; Mon, 08 Oct 2018 11:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024605; cv=none; d=google.com; s=arc-20160816; b=kHYE8OcqZ4gaiR2CTnrBdbSn5du2YzPG3YLe8uWwSXPztmV/AQkpNoAXjZxZpxNFWz OwFtsq7mImW2KboWZPIilDDP68KsSuwqL2VM8behRWlgA8ao0y2mOns+h5J3NdTL8F26 zgDWNTdEB11eLQQB9J6TEb3XVCdjCx/UZTRcXOQo01EwJeY/q9L6cZq4YI9J7DGiU+bV Ceho2ccFq8V+AoktTFNOq/fgBUTgMva5Nt7OZN/8VwpN1IafnVJSE6ExIrE9EbWvYCqu 75htDnG65r7beO6efvRB6KWeEwEb2zexAByNlXPh+DRFYv64kOlRYcdawMOCZxwLow1H QAWg== 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=lYoTj4yasuBsEfuCJXBKOcd/JDUKEoaBy8uBYFkNEHk=; b=M/PJgLcbi+Cz6yHP4UMTX8YoQZdgzOUYo/FZttjuHZ7jtsd9ALiqDKg+shOBM0IGQ4 Y4r/ljlQPvkCi16qFasW7MrfJxm02FRgbfro8pSdNsDoC2kna+GqwVj+iyHwefmfypam aCvk6etHzWOy6Ej1Fi+rApGbnTP2uT7plg/MrEtvcjzRWLXIaa387nquQJkl3IIOyH3i lxf2TGUWKJg8QVvNH0SHwzTD80M1i/fxOQmW+2okVbl9lGb/oLOsHcHBJ2lHv8BgldAh OicyMrIKZ2s5wJK5/qo7L6AtDwcNS4mbvf3+uNJROAvl83nuAw3ycWe6n7LaDXDkUlkA hYBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CMDyvYN1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si17561012plk.263.2018.10.08.11.49.50; Mon, 08 Oct 2018 11:50:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CMDyvYN1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731944AbeJICCv (ORCPT + 99 others); Mon, 8 Oct 2018 22:02:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:52230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730559AbeJICCu (ORCPT ); Mon, 8 Oct 2018 22:02:50 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 18737204FD; Mon, 8 Oct 2018 18:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024583; bh=sY02rBfSrvgFjMzn6Hl14GGJOO6NuVrYp1y1/fw1kS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMDyvYN18W+hjk404HZkaWkp7ZMnBbTGcm02mJnDnI9HJxtlq1hz5FrX52HEaboPa 698hDj/BRRW1U0KqvKKj1lmefQAkCtFx+Dl3H78GWpe+9EizOhopibUusMHaZfWuTX xcPqfzUhNTxf8q/Zb2Y4nyTOu22A76JmGYmHubZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amir Goldstein , Jan Kara , Sasha Levin Subject: [PATCH 4.18 064/168] fsnotify: fix ignore mask logic in fsnotify() Date: Mon, 8 Oct 2018 20:30:44 +0200 Message-Id: <20181008175622.483891230@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Amir Goldstein [ Upstream commit 9bdda4e9cf2dcecb60a0683b10ffb8cd7e5f2f45 ] Commit 92183a42898d ("fsnotify: fix ignore mask logic in send_to_group()") acknoledges the use case of ignoring an event on an inode mark, because of an ignore mask on a mount mark of the same group (i.e. I want to get all events on this file, except for the events that came from that mount). This change depends on correctly merging the inode marks and mount marks group lists, so that the mount mark ignore mask would be tested in send_to_group(). Alas, the merging of the lists did not take into account the case where event in question is not in the mask of any of the mount marks. To fix this, completely remove the tests for inode and mount event masks from the lists merging code. Fixes: 92183a42898d ("fsnotify: fix ignore mask logic in send_to_group") Signed-off-by: Amir Goldstein Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/notify/fsnotify.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -351,16 +351,9 @@ int fsnotify(struct inode *to_tell, __u3 iter_info.srcu_idx = srcu_read_lock(&fsnotify_mark_srcu); - if ((mask & FS_MODIFY) || - (test_mask & to_tell->i_fsnotify_mask)) { - iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = - fsnotify_first_mark(&to_tell->i_fsnotify_marks); - } - - if (mnt && ((mask & FS_MODIFY) || - (test_mask & mnt->mnt_fsnotify_mask))) { - iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = - fsnotify_first_mark(&to_tell->i_fsnotify_marks); + iter_info.marks[FSNOTIFY_OBJ_TYPE_INODE] = + fsnotify_first_mark(&to_tell->i_fsnotify_marks); + if (mnt) { iter_info.marks[FSNOTIFY_OBJ_TYPE_VFSMOUNT] = fsnotify_first_mark(&mnt->mnt_fsnotify_marks); }