USB: serial: fix potential stack buffer overflow
authorJohan Hovold <johan@kernel.org>
Wed, 27 Aug 2014 09:55:18 +0000 (11:55 +0200)
committerZefan Li <lizefan@huawei.com>
Thu, 25 Sep 2014 03:49:16 +0000 (11:49 +0800)
commit62148f769ff1041f92bf0bad4dd820615f29861f
treed73ca763fe4375a6debb7c5474b955cb6683797b
parent2f3e285da53ae6002cabb028438a65b9f9cee534
USB: serial: fix potential stack buffer overflow

commit d979e9f9ecab04c1ecca741370e30a8a498893f5 upstream.

Make sure to verify the maximum number of endpoints per type to avoid
writing beyond the end of a stack-allocated array.

The current usb-serial implementation is limited to eight ports per
interface but failed to verify that the number of endpoints of a certain
type reported by a device did not exceed this limit.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/serial/usb-serial.c