diff options
| author | Malaya Kumar Rout <mrout@redhat.com> | 2026-01-05 16:07:29 +0530 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-01-08 16:55:21 +0100 |
| commit | e25348c5405c38c7b5e7b833898f2d205289186a (patch) | |
| tree | e470d56263273acd99ab6f1994d2916d3d46ea7d /include/uapi/linux/netdev.h | |
| parent | 54b603f2db6b95495bc33a8f2bde80f044baff9a (diff) | |
PM: EM: Fix memory leak in em_create_pd() error path
When ida_alloc() fails in em_create_pd(), the function returns without
freeing the previously allocated 'pd' structure, leading to a memory leak.
The 'pd' pointer is allocated either at line 436 (for CPU devices with
cpumask) or line 442 (for other devices) using kzalloc().
Additionally, the function incorrectly returns -ENOMEM when ida_alloc()
fails, ignoring the actual error code returned by ida_alloc(), which can
fail for reasons other than memory exhaustion.
Fix both issues by:
1. Freeing the 'pd' structure with kfree() when ida_alloc() fails
2. Returning the actual error code from ida_alloc() instead of -ENOMEM
This ensures proper cleanup on the error path and accurate error reporting.
Fixes: cbe5aeedecc7 ("PM: EM: Assign a unique ID when creating a performance domain")
Signed-off-by: Malaya Kumar Rout <mrout@redhat.com>
Reviewed-by: Changwoo Min <changwoo@igalia.com>
Link: https://patch.msgid.link/20260105103730.65626-1-mrout@redhat.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/uapi/linux/netdev.h')
0 files changed, 0 insertions, 0 deletions
