[Devel] [PATCH RHEL7 COMMIT] ms/fsnotify: fix check in inotify fdinfo printing

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 23 07:04:29 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.12
------>
commit efd7ba8c24a3ab0335e70ff9b76310338854a893
Author: Cyrill Gorcunov <gorcunov at odin.com>
Date:   Mon Nov 23 19:04:29 2015 +0400

    ms/fsnotify: fix check in inotify fdinfo printing
    
    ML: 3c53e514212455db9923c203694a72007558b48f
    
    From: Jan Kara <jack at suse.cz>
    
    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 at suse.cz>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 fs/notify/fdinfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index a2ab2c1..7c94919 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -79,7 +79,8 @@ static int 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 0;
 
 	inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);


More information about the Devel mailing list