diff options
author | Julia Lawall <julia@diku.dk> | 2011-12-23 08:02:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-04 18:52:43 -0500 |
commit | e7c8e8605d0bafc705ff27f9da98a1668427cc0f (patch) | |
tree | 28611cae53fdf460b502e4113522181e3ce3f4ce /drivers/usb | |
parent | 5632c827cbd3617613530ba0e99344192d0a31ca (diff) |
drivers/usb/class/cdc-acm.c: clear dangling pointer
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>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d9d9340abe60..57f2e1032086 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1230,6 +1230,8 @@ made_compressed_probe: | |||
1230 | i = device_create_file(&intf->dev, &dev_attr_wCountryCodes); | 1230 | i = device_create_file(&intf->dev, &dev_attr_wCountryCodes); |
1231 | if (i < 0) { | 1231 | if (i < 0) { |
1232 | kfree(acm->country_codes); | 1232 | kfree(acm->country_codes); |
1233 | acm->country_codes = NULL; | ||
1234 | acm->country_code_size = 0; | ||
1233 | goto skip_countries; | 1235 | goto skip_countries; |
1234 | } | 1236 | } |
1235 | 1237 | ||
@@ -1238,6 +1240,8 @@ made_compressed_probe: | |||
1238 | if (i < 0) { | 1240 | if (i < 0) { |
1239 | device_remove_file(&intf->dev, &dev_attr_wCountryCodes); | 1241 | device_remove_file(&intf->dev, &dev_attr_wCountryCodes); |
1240 | kfree(acm->country_codes); | 1242 | kfree(acm->country_codes); |
1243 | acm->country_codes = NULL; | ||
1244 | acm->country_code_size = 0; | ||
1241 | goto skip_countries; | 1245 | goto skip_countries; |
1242 | } | 1246 | } |
1243 | } | 1247 | } |