]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cdc-acm: fix uninitialized variable
authorOliver Neukum <oneukum@suse.com>
Wed, 2 Nov 2016 13:42:52 +0000 (14:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Nov 2016 09:51:47 +0000 (10:51 +0100)
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@suse.com>
Reported-by: Victor Sologoubov <victor0@rambler.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c

index 41c4edcfb0afe195a5cbabe5874d50afac4afa77..3ca9fdb0a271bd1c07345fec8dd1c01ed43728ef 100644 (file)
@@ -1173,6 +1173,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*/