Commit 7d131623 authored by Eric Paris's avatar Eric Paris

fanotify: fill in the metadata_len field on struct fanotify_event_metadata

The fanotify_event_metadata now has a field which is supposed to
indicate the length of the metadata portion of the event.  Fill in that
field as well.
Based-in-part-on-patch-by: default avatarAlexey Zaytsev <alexey.zaytsev@gmail.com>
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 62731fa0
...@@ -116,6 +116,7 @@ static int fill_event_metadata(struct fsnotify_group *group, ...@@ -116,6 +116,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
group, metadata, event); group, metadata, event);
metadata->event_len = FAN_EVENT_METADATA_LEN; metadata->event_len = FAN_EVENT_METADATA_LEN;
metadata->metadata_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION; metadata->vers = FANOTIFY_METADATA_VERSION;
metadata->mask = event->mask & FAN_ALL_OUTGOING_EVENTS; metadata->mask = event->mask & FAN_ALL_OUTGOING_EVENTS;
metadata->pid = pid_vnr(event->tgid); metadata->pid = pid_vnr(event->tgid);
...@@ -275,10 +276,11 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, ...@@ -275,10 +276,11 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
goto out_close_fd; goto out_close_fd;
ret = -EFAULT; ret = -EFAULT;
if (copy_to_user(buf, &fanotify_event_metadata, FAN_EVENT_METADATA_LEN)) if (copy_to_user(buf, &fanotify_event_metadata,
fanotify_event_metadata.event_len))
goto out_kill_access_response; goto out_kill_access_response;
return FAN_EVENT_METADATA_LEN; return fanotify_event_metadata.event_len;
out_kill_access_response: out_kill_access_response:
remove_access_response(group, event, fd); remove_access_response(group, event, fd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment