Bug 89101

Summary: Possible memory leak in function (reserve_range) not freeing pointer (regionid)
Product: Drivers Reporter: Ahmed Tamrawi (atamrawi)
Component: PNPAssignee: Adam Belay (ambx1)
Status: RESOLVED WILL_NOT_FIX    
Severity: normal CC: alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.17-rc1 Subsystem:
Regression: No Bisected commit-id:

Description Ahmed Tamrawi 2014-11-30 19:45:26 UTC
Function (reserve_range) in file (drivers/pnp/system.c) allocates pointer (regionid) on line (32) and passes it to function (__request_region) through the macros: (request_region) at line (38) or (request_mem_region) at line (40). However, if the resource (res) is allocated through (__request_region) function, then the pointer (res->name) points to the allocated pointer (regionid). Then, there is no way in function (free_resource) or function (release_resource) to free the pointer (regionid) or (res->name). Thus, causing a potential memory leak!

Function (reserve_range) source code reference: http://lxr.free-electrons.com/source/drivers/pnp/system.c#L25
Function (free_resource) source code reference:http://lxr.free-electrons.com/source/kernel/resource.c#L172
Function (release_resource) source code reference:http://lxr.free-electrons.com/source/kernel/resource.c#L322
Comment 1 Alan 2014-12-08 15:38:08 UTC
We never upload the reserved regions so while true, I don't think it matters