Input: sur40 - validate number of endpoints before using them
authorJohan Hovold <johan@kernel.org>
Thu, 16 Mar 2017 18:43:09 +0000 (11:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Mar 2017 07:35:15 +0000 (09:35 +0200)
commit549993001e7de0553d85c9022dc41d5b3ff7d1ff
tree1d02b8e5e02f95918200fe4017d56ec16ae1875b
parentb3c4c0c470b58dd4a5e40e11ccd9fea7fbbfa799
Input: sur40 - validate number of endpoints before using them

commit 92461f5d723037530c1f36cce93640770037812c upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory that lie beyond the end of the endpoint
array should a malicious device lack the expected endpoints.

Fixes: bdb5c57f209c ("Input: add sur40 driver for Samsung SUR40... ")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/touchscreen/sur40.c