Input: gtco - fix crash on detecting device without endpoints
authorVladis Dronov <vdronov@redhat.com>
Thu, 31 Mar 2016 17:53:42 +0000 (10:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 May 2016 21:48:45 +0000 (14:48 -0700)
commit197b6c5f0d976420c3eeacc7589ebc5869d2d70f
tree0fd3cf0632de143b5d8f69ba82fc81c6e0d9c94f
parent95415ac5786f483c7c69145ae644bc64c2240776
Input: gtco - fix crash on detecting device without endpoints

commit 162f98dea487206d9ab79fc12ed64700667a894d upstream.

The gtco driver expects at least one valid endpoint. If given malicious
descriptors that specify 0 for the number of endpoints, it will crash in
the probe function. Ensure there is at least one endpoint on the interface
before using it.

Also let's fix a minor coding style issue.

The full correct report of this issue can be found in the public
Red Hat Bugzilla:

https://bugzilla.redhat.com/show_bug.cgi?id=1283385

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/tablet/gtco.c