diff options
author | Jan Kara <jack@suse.cz> | 2019-01-08 16:02:44 +0300 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-02-18 14:41:16 +0300 |
commit | 40873284d7106fc0f0f4d2deae74b38fb18342cc (patch) | |
tree | 5d3965765a3d031321b026e576db2593242b77e0 /fs/notify/fanotify/fanotify.c | |
parent | ca6f86998d810d4a9fe172bf4cb6d3353636881f (diff) | |
download | linux-40873284d7106fc0f0f4d2deae74b38fb18342cc.tar.xz |
fanotify: Track permission event state
Track whether permission event got already reported to userspace and
whether userspace already answered to the permission event. Protect
stores to this field together with updates to ->response field by
group->notification_lock. This will allow aborting wait for reply to
permission event from userspace.
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify/fanotify.c')
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 4ff84bc5772e..812c975df7ec 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -85,7 +85,8 @@ static int fanotify_get_response(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->state == FAN_EVENT_ANSWERED); /* userspace responded, convert to something usable */ switch (event->response & ~FAN_AUDIT) { @@ -101,8 +102,6 @@ static int fanotify_get_response(struct fsnotify_group *group, if (event->response & FAN_AUDIT) audit_fanotify(event->response & ~FAN_AUDIT); - event->response = 0; - pr_debug("%s: group=%p event=%p about to return ret=%d\n", __func__, group, event, ret); @@ -275,6 +274,7 @@ struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, goto out; event = &pevent->fae; pevent->response = 0; + pevent->state = FAN_EVENT_INIT; goto init; } event = kmem_cache_alloc(fanotify_event_cachep, gfp); |