mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-01 00:36:40 +09:00
drivers/usb/class/cdc-acm.c: clear dangling pointer
commit e7c8e8605d 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: Julia Lawall <julia@diku.dk>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1c44ff2c1b
commit
85df277cc3
@@ -1183,6 +1183,8 @@ made_compressed_probe:
|
||||
i = device_create_file(&intf->dev, &dev_attr_wCountryCodes);
|
||||
if (i < 0) {
|
||||
kfree(acm->country_codes);
|
||||
acm->country_codes = NULL;
|
||||
acm->country_code_size = 0;
|
||||
goto skip_countries;
|
||||
}
|
||||
|
||||
@@ -1191,6 +1193,8 @@ made_compressed_probe:
|
||||
if (i < 0) {
|
||||
device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
|
||||
kfree(acm->country_codes);
|
||||
acm->country_codes = NULL;
|
||||
acm->country_code_size = 0;
|
||||
goto skip_countries;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user