[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221119085923.114889-3-xiujianfeng@huawei.com>
Date: Sat, 19 Nov 2022 16:59:23 +0800
From: Xiu Jianfeng <xiujianfeng@...wei.com>
To: <jgross@...e.com>, <boris.ostrovsky@...cle.com>,
<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
<dave.hansen@...ux.intel.com>, <hpa@...or.com>, <jeremy@...p.org>
CC: <x86@...nel.org>, <xen-devel@...ts.xenproject.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] x86/xen: Fix memory leak in xen_init_lock_cpu()
In xen_init_lock_cpu(), the @name has allocated new string by kasprintf(),
if bind_ipi_to_irqhandler() fails, it should be freed, otherwise may lead
to a memory leak issue, fix it.
Fixes: 2d9e1e2f58b5 ("xen: implement Xen-specific spinlocks")
Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.com>
---
arch/x86/xen/spinlock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 043c73dfd2c9..156d3e04c9ef 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -86,7 +86,8 @@ void xen_init_lock_cpu(int cpu)
disable_irq(irq); /* make sure it's never delivered */
per_cpu(lock_kicker_irq, cpu) = irq;
per_cpu(irq_name, cpu) = name;
- }
+ } else
+ kfree(name);
printk("cpu %d spinlock event irq %d\n", cpu, irq);
}
--
2.17.1
Powered by blists - more mailing lists