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

commit 5654699fb38512bdbfc0f892ce54fce75bdc2bab upstream.

Make sure to verify the number of ports requested by subdriver to avoid
writing beyond the end of fixed-size array in interface data.

The current usb-serial implementation is limited to eight ports per
interface but failed to verify that the number of ports requested by a
subdriver (which could have been determined from device descriptors) 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: s/ddev/\&interface->dev/]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/serial/usb-serial.c