USB: serial: visor: handle potential invalid device configuration
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 15:41:55 +0000 (17:41 +0200)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:40 +0000 (21:36 -0400)
commita58e27f02868d084de8a8a56ff410a56b945c483
tree1ccb8dfc88cc4c4e2c0c65b8094f3aa32ecc2250
parent6b7ba4a950116f2447fa9e032cf727faa0fe6cd7
USB: serial: visor: handle potential invalid device configuration

[ Upstream commit 4842ed5bfcb9daf6660537d70503c18d38dbdbb8 ]

If we get an invalid device configuration from a palm 3 type device, we
might incorrectly parse things, and we have the potential to crash in
"interesting" ways.

Fix this up by verifying the size of the configuration passed to us by
the device, and only if it is correct, will we handle it.

Note that this also fixes an information leak of slab data.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ johan: add comment about the info leak ]
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/usb/serial/visor.c