Commit 8dde152e authored by Andrew Donnellan's avatar Andrew Donnellan Committed by Michael Ellerman

cxl: fix leak of IRQ names in cxl_free_afu_irqs()

cxl_free_afu_irqs() doesn't free IRQ names when it releases an AFU's IRQ
ranges. The userspace API equivalent in afu_release_irqs() calls
afu_irq_name_free() to release the IRQ names.

Call afu_irq_name_free() in cxl_free_afu_irqs() to release the IRQ names.
Make afu_irq_name_free() non-static to allow this.
Reported-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Fixes: 6f7f0b3d ("cxl: Add AFU virtual PHB and kernel API")
Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
Reviewed-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 4fa9a3f6
...@@ -105,6 +105,7 @@ EXPORT_SYMBOL_GPL(cxl_allocate_afu_irqs); ...@@ -105,6 +105,7 @@ EXPORT_SYMBOL_GPL(cxl_allocate_afu_irqs);
void cxl_free_afu_irqs(struct cxl_context *ctx) void cxl_free_afu_irqs(struct cxl_context *ctx)
{ {
afu_irq_name_free(ctx);
cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter); cxl_release_irq_ranges(&ctx->irqs, ctx->afu->adapter);
} }
EXPORT_SYMBOL_GPL(cxl_free_afu_irqs); EXPORT_SYMBOL_GPL(cxl_free_afu_irqs);
......
...@@ -677,6 +677,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu); ...@@ -677,6 +677,7 @@ int cxl_register_serr_irq(struct cxl_afu *afu);
void cxl_release_serr_irq(struct cxl_afu *afu); void cxl_release_serr_irq(struct cxl_afu *afu);
int afu_register_irqs(struct cxl_context *ctx, u32 count); int afu_register_irqs(struct cxl_context *ctx, u32 count);
void afu_release_irqs(struct cxl_context *ctx, void *cookie); void afu_release_irqs(struct cxl_context *ctx, void *cookie);
void afu_irq_name_free(struct cxl_context *ctx);
irqreturn_t cxl_slice_irq_err(int irq, void *data); irqreturn_t cxl_slice_irq_err(int irq, void *data);
int cxl_debugfs_init(void); int cxl_debugfs_init(void);
......
...@@ -414,7 +414,7 @@ void cxl_release_psl_irq(struct cxl_afu *afu) ...@@ -414,7 +414,7 @@ void cxl_release_psl_irq(struct cxl_afu *afu)
kfree(afu->psl_irq_name); kfree(afu->psl_irq_name);
} }
static void afu_irq_name_free(struct cxl_context *ctx) void afu_irq_name_free(struct cxl_context *ctx)
{ {
struct cxl_irq_name *irq_name, *tmp; struct cxl_irq_name *irq_name, *tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment