Return-Path: Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:57581 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751674AbbKCMUi (ORCPT ); Tue, 3 Nov 2015 07:20:38 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Nov 2015 12:20:37 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id E301A17D8062 for ; Tue, 3 Nov 2015 12:20:49 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tA3CKY6p4391352 for ; Tue, 3 Nov 2015 12:20:34 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tA3CKXPu001607 for ; Tue, 3 Nov 2015 05:20:33 -0700 From: Frederic Barrat To: imunsie@au1.ibm.com, linuxppc-dev@lists.ozlabs.org Cc: Subject: [PATCH] cxl: Fix struct pid leak when attaching a process through kernel API Date: Tue, 3 Nov 2015 13:20:15 +0100 Message-Id: <1446553215-18273-1-git-send-email-fbarrat@linux.vnet.ibm.com> Sender: stable-owner@vger.kernel.org List-ID: 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. Signed-off-by: Frederic Barrat Cc: # 4.3+ --- drivers/misc/cxl/api.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c index 103baf0..94b6627 100644 --- a/drivers/misc/cxl/api.c +++ b/drivers/misc/cxl/api.c @@ -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; } -- 1.9.1