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>
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user