cxl: Fix struct pid leak when attaching a process through kernel API
Subsystems (2)
PATCH 1/1 cxl: Fix struct pid leak when attaching a process through kernel API
When the cxl driver creates a context, it stores the pid of the calling task, and mistakenly increments the reference count of the struct pid twice, once through get_task_pid(), once through get_pid(). The reference count is only decremented once on detach. As a result, a struct pid is leaked and it reduces the number of processes that can run simultaneously by one.
The fix is to simply remove the call to get_pid().
There is a separate patch for the user API, since it goes to different kernel versions.
--- drivers/misc/cxl/api.c | 1 - 1 file changed, 1 deletion(-)
drivers/misc/cxl/api.c +0 -1
@@ -176,7 +176,6 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed,if (task) { ctx->pid =get_task_pid (task,PIDTYPE_PID ); -get_pid (ctx->pid); kernel = false; }
Signature · 1 line
1.9.1
Quoted 8 lines · Frederic Barrat
When the cxl driver creates a context, it stores the pid of the calling task, and mistakenly increments the reference count of the struct pid twice, once through
get_task_pid(), once throughget_pid(). The reference count is only decremented once on detach. As a result, a struct pid is leaked and it reduces the number of processes that can run simultaneously by one.
The fix is to simply remove the call toget_pid().
Quoted 5 lines
There is a separate patch for the user API, since it goes to different kernel versions.
Signed-off-by Frederic Barrat <[email protected]>Cc <[email protected]> # 4.3+
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited