[PATCH 5/16] evdev: return -EINVAL if read buffer is too small

From: Dmitry Torokhov
Date: Wed Dec 29 2004 - 03:09:53 EST



===================================================================


ChangeSet@xxxxxxxxxxx, 2004-11-12 01:28:33-05:00, dtor_core@xxxxxxxxxxxxx
Input: evdev - return -EINVAL from evdev_read if read buffer
is too small.

Based on the patch by James Lamanna.

Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx>


evdev.c | 3 +++
1 files changed, 3 insertions(+)


===================================================================



diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c 2004-12-29 01:47:32 -05:00
+++ b/drivers/input/evdev.c 2004-12-29 01:47:32 -05:00
@@ -169,6 +169,9 @@
struct evdev_list *list = file->private_data;
int retval;

+ if (count < sizeof(struct input_event))
+ return -EINVAL;
+
if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK))
return -EAGAIN;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/