]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
cxl: Fix leaking interrupts if attach process fails
authorIan Munsie <imunsie@au1.ibm.com>
Mon, 8 Dec 2014 08:17:57 +0000 (19:17 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 29 Dec 2014 04:45:43 +0000 (15:45 +1100)
In this particular error path we have already allocated the AFU
interrupts, but have not yet set the status to STARTED. The detach
context code will only attempt to release the interrupts if the context
is in state STARTED, so in this case the interrupts would remain
allocated.

This patch releases the AFU interrupts immediately if the attach call
fails to prevent them leaking.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/misc/cxl/file.c

index e9f2f10dbb3734f3de4df60cdaed583415cfd831..b09be4462294e0f85f65fb0d8230ec98622f9be9 100644 (file)
@@ -185,8 +185,10 @@ static long afu_ioctl_start_work(struct cxl_context *ctx,
        ctx->pid = get_pid(get_task_pid(current, PIDTYPE_PID));
 
        if ((rc = cxl_attach_process(ctx, false, work.work_element_descriptor,
-                                    amr)))
+                                    amr))) {
+               afu_release_irqs(ctx);
                goto out;
+       }
 
        ctx->status = STARTED;
        rc = 0;