[PATCH 4.8 33/92] cdc-acm: fix uninitialized variable
From: Greg Kroah-Hartman
Date: Thu Nov 17 2016 - 05:37:09 EST
4.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <oneukum@xxxxxxxx>
commit 7309aa847ead3fa561663b16779a0dde8c64cc7c upstream.
variable struct usb_cdc_parsed_header h may be used
uninitialized in acm_probe.
In kernel 4.8.
/* handle quirks deadly to normal probing*/
if (quirks == NO_UNION_NORMAL)
...
goto skip_normal_probe;
}
we bypass call to
cdc_parse_cdc_header(&h, intf, buffer, buflen);
but later use h in
if (h.usb_cdc_country_functional_desc) { /* export the country data */
Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
Reported-by: Victor Sologoubov <victor0@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/usb/class/cdc-acm.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1173,6 +1173,8 @@ static int acm_probe(struct usb_interfac
if (quirks == IGNORE_DEVICE)
return -ENODEV;
+ memset(&h, 0x00, sizeof(struct usb_cdc_parsed_header));
+
num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR;
/* handle quirks deadly to normal probing*/