Input: evdev - fall back to vmalloc for client event buffer
authorDaniel Stone <daniel@fooishbar.org>
Thu, 31 Oct 2013 07:25:34 +0000 (00:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2013 18:57:18 +0000 (10:57 -0800)
commitcb8e5e98aeae9e0d845576f6f59227c9ad8f76ff
tree6133b4f542db3f429f997d9a79e30ce141ee1ef3
parent1bfdf02fc01d8b4c96cd536ee9e2552268e67784
Input: evdev - fall back to vmalloc for client event buffer

commit 92eb77d0ffbaa71b501a0a8dabf09a351bf4267f upstream.

evdev always tries to allocate the event buffer for clients using
kzalloc rather than vmalloc, presumably to avoid mapping overhead where
possible.  However, drivers like bcm5974, which claims support for
reporting 16 fingers simultaneously, can have an extraordinarily large
buffer.  The resultant contiguous order-4 allocation attempt fails due
to fragmentation, and the device is thus unusable until reboot.

Try kzalloc if we can to avoid the mapping overhead, but if that fails,
fall back to vzalloc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/evdev.c