Commit 30234e26 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

drivers/usb/class/cdc-acm.c: clear dangling pointer

commit e7c8e860 upstream.

On some failures, the country_code field of an acm structure is freed
without freeing the acm structure itself.  Elsewhere, operations including
memcpy and kfree are performed on the country_code field.  The patch sets
the country_code field to NULL when it is freed, and likewise sets the
country_code_size field to 0.
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Acked-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9e9f6a20
...@@ -1183,6 +1183,8 @@ static int acm_probe(struct usb_interface *intf, ...@@ -1183,6 +1183,8 @@ static int acm_probe(struct usb_interface *intf,
i = device_create_file(&intf->dev, &dev_attr_wCountryCodes); i = device_create_file(&intf->dev, &dev_attr_wCountryCodes);
if (i < 0) { if (i < 0) {
kfree(acm->country_codes); kfree(acm->country_codes);
acm->country_codes = NULL;
acm->country_code_size = 0;
goto skip_countries; goto skip_countries;
} }
...@@ -1191,6 +1193,8 @@ static int acm_probe(struct usb_interface *intf, ...@@ -1191,6 +1193,8 @@ static int acm_probe(struct usb_interface *intf,
if (i < 0) { if (i < 0) {
device_remove_file(&intf->dev, &dev_attr_wCountryCodes); device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
kfree(acm->country_codes); kfree(acm->country_codes);
acm->country_codes = NULL;
acm->country_code_size = 0;
goto skip_countries; goto skip_countries;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment