All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxl: Fix struct pid leak when attaching a process through user API
@ 2015-11-03 12:13 Frederic Barrat
  2015-11-03 22:25 ` Ian Munsie
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Frederic Barrat @ 2015-11-03 12:13 UTC (permalink / raw)
  To: imunsie, linuxppc-dev; +Cc: stable

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 kernel API, since it goes to
different kernel versions.

Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Cc: <stable@vger.kernel.org> # 3.18+
---
 drivers/misc/cxl/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index 7ccd299..97003ee 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -199,7 +199,7 @@ static long afu_ioctl_start_work(struct cxl_context *ctx,
 	 * behalf of another process, so the AFU's mm gets bound to the process
 	 * that performs this ioctl and not the process that opened the file.
 	 */
-	ctx->pid = get_pid(get_task_pid(current, PIDTYPE_PID));
+	ctx->pid = get_task_pid(current, PIDTYPE_PID);
 
 	trace_cxl_attach(ctx, work.work_element_descriptor, work.num_interrupts, amr);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cxl: Fix struct pid leak when attaching a process through user API
  2015-11-03 12:13 [PATCH] cxl: Fix struct pid leak when attaching a process through user API Frederic Barrat
@ 2015-11-03 22:25 ` Ian Munsie
  2015-11-03 22:45 ` Andrew Donnellan
  2016-01-26  3:11 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Ian Munsie @ 2015-11-03 22:25 UTC (permalink / raw)
  To: Frederic Barrat; +Cc: linuxppc-dev, stable

Acked-by: Ian Munsie <imunsie@au1.ibm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cxl: Fix struct pid leak when attaching a process through user API
  2015-11-03 12:13 [PATCH] cxl: Fix struct pid leak when attaching a process through user API Frederic Barrat
  2015-11-03 22:25 ` Ian Munsie
@ 2015-11-03 22:45 ` Andrew Donnellan
  2016-01-26  3:11 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Donnellan @ 2015-11-03 22:45 UTC (permalink / raw)
  To: Frederic Barrat, imunsie, linuxppc-dev; +Cc: stable

On 03/11/15 23:13, Frederic Barrat wrote:
> 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 kernel API, since it goes to
> different kernel versions.
>
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Cc: <stable@vger.kernel.org> # 3.18+

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cxl: Fix struct pid leak when attaching a process through user API
  2015-11-03 12:13 [PATCH] cxl: Fix struct pid leak when attaching a process through user API Frederic Barrat
  2015-11-03 22:25 ` Ian Munsie
  2015-11-03 22:45 ` Andrew Donnellan
@ 2016-01-26  3:11 ` Michael Ellerman
  2016-01-26  8:16   ` Frederic Barrat
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2016-01-26  3:11 UTC (permalink / raw)
  To: Frederic Barrat, imunsie, linuxppc-dev; +Cc: stable

On Tue, 2015-03-11 at 12:13:52 UTC, Frederic Barrat wrote:
> 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 kernel API, since it goes to
> different kernel versions.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Cc: <stable@vger.kernel.org> # 3.18+
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>
> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

This no longer applies, since we merged 7b8ad495d592 ("cxl: Fix DSI misses when
the context owning task exits").

Please resend if it's still applicable.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cxl: Fix struct pid leak when attaching a process through user API
  2016-01-26  3:11 ` Michael Ellerman
@ 2016-01-26  8:16   ` Frederic Barrat
  0 siblings, 0 replies; 5+ messages in thread
From: Frederic Barrat @ 2016-01-26  8:16 UTC (permalink / raw)
  To: Michael Ellerman, imunsie, linuxppc-dev; +Cc: stable



Le 26/01/2016 04:11, Michael Ellerman a écrit :
> This no longer applies, since we merged 7b8ad495d592 ("cxl: Fix DSI misses when
> the context owning task exits").

Yes, on 4.5, it has been superseded by 7b8ad495d592.
It may still be worth considering for stable releases though.

   Fred


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-26  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 12:13 [PATCH] cxl: Fix struct pid leak when attaching a process through user API Frederic Barrat
2015-11-03 22:25 ` Ian Munsie
2015-11-03 22:45 ` Andrew Donnellan
2016-01-26  3:11 ` Michael Ellerman
2016-01-26  8:16   ` Frederic Barrat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.