]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cdc-acm: memory leak in error case
authorOliver Neukum <oneukum@suse.de>
Thu, 20 Nov 2014 13:54:35 +0000 (14:54 +0100)
committerZefan Li <lizefan@huawei.com>
Tue, 14 Apr 2015 09:33:43 +0000 (17:33 +0800)
commit d908f8478a8d18e66c80a12adb27764920c1f1ca upstream.

If probe() fails not only the attributes need to be removed
but also the memory freed.

Reported-by: Ahmed Tamrawi <ahmedtamrawi@gmail.com>
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/class/cdc-acm.c

index 8f4a628d338254beeb79db375e4aadd176810a80..cd8550a18282f29596aeafc5f2ed175b192e86d2 100644 (file)
@@ -1429,6 +1429,7 @@ static void acm_disconnect(struct usb_interface *intf)
                                &dev_attr_wCountryCodes);
                device_remove_file(&acm->control->dev,
                                &dev_attr_iCountryCodeRelDate);
+               kfree(acm->country_codes);
        }
        device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
        usb_set_intfdata(acm->control, NULL);