Skip to contentSkip to conversation

cdc-acm: fix uninitialized variable

PATCH New Oliver Neukum 1 participant 1 message Nov 2, 2016

Subsystems (3)
lore
Share & tools
lore

Oliver Neukum

author maintainer
#0 lore raw

PATCH 1/1 cdc-acm: fix uninitialized variable

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 */

---
 drivers/usb/class/cdc-acm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/class/cdc-acm.c +2 -0
index 78f0f85..4ad4ca4 100644
@@ -1161,6 +1161,8 @@ static int acm_probe(struct usb_interface *intf,
 	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*/
Signature · 1 line
2.6.2