Merge branch 'fbdev/udlfb'
[cascardo/linux.git] / fs / notify / fanotify / fanotify.c
index 8d98e1f..f35794b 100644 (file)
@@ -92,7 +92,11 @@ static int fanotify_get_response_from_access(struct fsnotify_group *group,
 
        pr_debug("%s: group=%p event=%p\n", __func__, group, event);
 
-       wait_event(group->fanotify_data.access_waitq, event->response);
+       wait_event(group->fanotify_data.access_waitq, event->response ||
+                               atomic_read(&group->fanotify_data.bypass_perm));
+
+       if (!event->response) /* bypass_perm set */
+               return 0;
 
        /* userspace responded, convert to something usable */
        spin_lock(&event->lock);
@@ -131,6 +135,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
        BUILD_BUG_ON(FAN_Q_OVERFLOW != FS_Q_OVERFLOW);
        BUILD_BUG_ON(FAN_OPEN_PERM != FS_OPEN_PERM);
        BUILD_BUG_ON(FAN_ACCESS_PERM != FS_ACCESS_PERM);
+       BUILD_BUG_ON(FAN_ONDIR != FS_ISDIR);
 
        pr_debug("%s: group=%p event=%p\n", __func__, group, event);
 
@@ -195,6 +200,10 @@ static bool fanotify_should_send_event(struct fsnotify_group *group,
                BUG();
        }
 
+       if (S_ISDIR(path->dentry->d_inode->i_mode) &&
+           (marks_ignored_mask & FS_ISDIR))
+               return false;
+
        if (event_mask & marks_mask & ~marks_ignored_mask)
                return true;