diff options
-rw-r--r-- | fs/inotify_user.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index 55f6da55b7c0..9f2224f65a18 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, | |||
455 | break; | 455 | break; |
456 | 456 | ||
457 | kevent = inotify_dev_get_event(dev); | 457 | kevent = inotify_dev_get_event(dev); |
458 | if (event_size + kevent->event.len > count) | 458 | if (event_size + kevent->event.len > count) { |
459 | if (ret == 0 && count > 0) { | ||
460 | /* | ||
461 | * could not get a single event because we | ||
462 | * didn't have enough buffer space. | ||
463 | */ | ||
464 | ret = -EINVAL; | ||
465 | } | ||
459 | break; | 466 | break; |
467 | } | ||
460 | 468 | ||
461 | if (copy_to_user(buf, &kevent->event, event_size)) { | 469 | if (copy_to_user(buf, &kevent->event, event_size)) { |
462 | ret = -EFAULT; | 470 | ret = -EFAULT; |