Skip to content

Commit

Permalink
Input: evdev - fix overflow in compat_ioctl
Browse files Browse the repository at this point in the history
When exporting input device bitmaps via compat_ioctl on BIG_ENDIAN
platforms evdev calculates data size incorrectly. This causes buffer
overflow if user specifies buffer smaller than maxlen.

Signed-off-by: Kenichi Nagai <kenichi3.nagai@toshiba.co.jp>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Kenichi Nagai authored and Linus Torvalds committed May 11, 2007
1 parent 435b71b commit bf61f8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit,

if (compat) {
len = NBITS_COMPAT(maxbit) * sizeof(compat_long_t);
if (len < maxlen)
if (len > maxlen)
len = maxlen;

for (i = 0; i < len / sizeof(compat_long_t); i++)
Expand Down

0 comments on commit bf61f8d

Please sign in to comment.