Bug 88521 - Possible memory leak in acm_probe not freeing (acm->country_codes) on error path
Summary: Possible memory leak in acm_probe not freeing (acm->country_codes) on error path
Status: RESOLVED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-20 01:13 UTC by Ahmed Tamrawi
Modified: 2020-05-03 19:42 UTC (History)
2 users (show)

See Also:
Kernel Version: v3.17-rc1
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Ahmed Tamrawi 2014-11-20 01:13:47 UTC
In function (acm_probe) in file (drivers/usb/class/cdc-acm.c):

Pointer (acm->country_codes) gets allocated in line (1404) and freed in lines (1414, 1424) if the call to function (device_create_file) fails (i < 0). However, if the conditions at (1413 and 1422) evaluates to false, the function (acm_probe) exists without freeing the pointer (acm->country_codes). Thus, causing a memory leak.

Reference to function source code: http://lxr.free-electrons.com/source/drivers/usb/class/cdc-acm.c#L1404
Comment 1 Greg Kroah-Hartman 2014-11-20 01:52:16 UTC
On Thu, Nov 20, 2014 at 01:13:47AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=88521
> 
>             Bug ID: 88521
>            Summary: Possible memory leak in acm_probe not freeing
>                     (acm->country_codes) on error path

Please just send to linux-usb@vger.kernel.org
Comment 2 Wolfram Sang 2020-05-03 19:42:07 UTC
This is intended behaviour. If all conditions (= sanity checks) fail, everything is OK and we can use country_codes in the driver. The memory gets later freed in acm_port_destruct(). Closing.

Note You need to log in before you can comment on or make changes to this bug.