fsnotify: fix check in inotify fdinfo printing
authorJan Kara <jack@suse.cz>
Fri, 4 Sep 2015 22:43:03 +0000 (15:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Sep 2015 23:54:41 +0000 (16:54 -0700)
A check in inotify_fdinfo() checking whether mark is valid was always
true due to a bug.  Luckily we can never get to invalidated marks since
we hold mark_mutex and invalidated marks get removed from the group list
when they are invalidated under that mutex.

Anyway fix the check to make code more future proof.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/notify/fdinfo.c

index 58b7cdb..6b6f0d4 100644 (file)
@@ -76,7 +76,8 @@ static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
        struct inotify_inode_mark *inode_mark;
        struct inode *inode;
 
-       if (!(mark->flags & (FSNOTIFY_MARK_FLAG_ALIVE | FSNOTIFY_MARK_FLAG_INODE)))
+       if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE) ||
+           !(mark->flags & FSNOTIFY_MARK_FLAG_INODE))
                return;
 
        inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);