fanotify: fill in the metadata_len field on struct fanotify_event_metadata
authorEric Paris <eparis@redhat.com>
Tue, 7 Dec 2010 20:27:57 +0000 (15:27 -0500)
committerEric Paris <eparis@redhat.com>
Wed, 15 Dec 2010 18:58:18 +0000 (13:58 -0500)
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: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/fanotify/fanotify_user.c

index dccd7985e65a843a7b917437a3c1f28786a6e16a..8b61220cffc597873bc0292bbf2fcd86300f3d5c 100644 (file)
@@ -116,6 +116,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
                 group, metadata, event);
 
        metadata->event_len = FAN_EVENT_METADATA_LEN;
+       metadata->metadata_len = FAN_EVENT_METADATA_LEN;
        metadata->vers = FANOTIFY_METADATA_VERSION;
        metadata->mask = event->mask & FAN_ALL_OUTGOING_EVENTS;
        metadata->pid = pid_vnr(event->tgid);
@@ -275,10 +276,11 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
                goto out_close_fd;
 
        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;
 
-       return FAN_EVENT_METADATA_LEN;
+       return fanotify_event_metadata.event_len;
 
 out_kill_access_response:
        remove_access_response(group, event, fd);