X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=fs%2Finotify_user.c;h=9bf2f6c09df64932bba2f88e838a240f7e4e2eea;hb=68f3e6622bb60c6b477971b56d1913077834fdcd;hp=55f6da55b7c0ec36f8e76307c512999570103e4e;hpb=fb7665544dd60e016494cd5531f5b65ddae22ddc;p=powerpc.git diff --git a/fs/inotify_user.c b/fs/inotify_user.c index 55f6da55b7..9bf2f6c09d 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c @@ -455,8 +455,16 @@ static ssize_t inotify_read(struct file *file, char __user *buf, break; kevent = inotify_dev_get_event(dev); - if (event_size + kevent->event.len > count) + if (event_size + kevent->event.len > count) { + if (ret == 0 && count > 0) { + /* + * could not get a single event because we + * didn't have enough buffer space. + */ + ret = -EINVAL; + } break; + } if (copy_to_user(buf, &kevent->event, event_size)) { ret = -EFAULT; @@ -708,10 +716,10 @@ static int __init inotify_user_setup(void) watch_cachep = kmem_cache_create("inotify_watch_cache", sizeof(struct inotify_user_watch), - 0, SLAB_PANIC, NULL, NULL); + 0, SLAB_PANIC, NULL); event_cachep = kmem_cache_create("inotify_event_cache", sizeof(struct inotify_kernel_event), - 0, SLAB_PANIC, NULL, NULL); + 0, SLAB_PANIC, NULL); return 0; }