Re: [PATCH] fanotify: compare fsid when merging name event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 28-07-20 11:06:25, Amir Goldstein wrote:
> On Tue, Jul 28, 2020 at 10:42 AM Jan Kara <jack@xxxxxxx> wrote:
> >
> > On Tue 28-07-20 09:51:08, Amir Goldstein wrote:
> > > This was missed when splitting name event from fid event
> > >
> > > Fixes: cacfb956d46e ("fanotify: record name info for FAN_DIR_MODIFY event")
> > > Cc: <stable@xxxxxxxxxxxxxxx> # v5.7+
> > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> >
> > OK, but given we never enabled FAN_DIR_MODIFY in 5.7, this is just a dead
> > code there, isn't it? So it should be enough to fix this for the series
> > that's currently queued?
> 
> Doh! you are right.
> So you can just work it into the series and remove the explicit stable tag.
> If we leave the Fixes tag, stable bots will probably pick this up, but OTOH,
> there is no harm in applying the patch to stable kernel, so whatever.

Attached is what I have pushed to my tree.

									Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR
>From 8aed8cebdd973e95d20743e00e35467c7b467d0d Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@xxxxxxx>
Date: Tue, 28 Jul 2020 10:58:07 +0200
Subject: [PATCH] fanotify: compare fsid when merging name event

When merging name events, fsids of the two involved events have to
match. Otherwise we could merge events from two different filesystems
and thus effectively loose the second event.

Backporting note: Although the commit cacfb956d46e introducing this bug
was merged for 5.7, the relevant code didn't get used in the end until
7e8283af6ede ("fanotify: report parent fid + name + child fid") which
will be merged with this patch. So there's no need for backporting this.

Fixes: cacfb956d46e ("fanotify: record name info for FAN_DIR_MODIFY event")
Reported-by: Amir Goldstein <amir73il@xxxxxxxxx>
Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/notify/fanotify/fanotify.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index bd9e88e889ea..c942910a8649 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -82,6 +82,9 @@ static bool fanotify_name_event_equal(struct fanotify_name_event *fne1,
 	if (!info1->dir_fh_totlen)
 		return false;
 
+	if (!fanotify_fsid_equal(&fne1->fsid, &fne2->fsid))
+		return false;
+
 	return fanotify_info_equal(info1, info2);
 }
 
-- 
2.16.4


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux