x86/xen: Fix memory leak in xen_init_lock_cpu()
authorXiu Jianfeng <xiujianfeng@huawei.com>
Wed, 23 Nov 2022 15:58:58 +0000 (23:58 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:04 +0000 (13:14 +0100)
commit70966d6b0f59f795b08a70adf5e4478348ecbfbb
tree91178d31f1b731a637aead46abc86d1a174df929
parent23aef94eea714b721546c0c49a324a8da8d00fb5
x86/xen: Fix memory leak in xen_init_lock_cpu()

[ Upstream commit ca84ce153d887b1dc8b118029976cc9faf2a9b40 ]

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@huawei.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20221123155858.11382-3-xiujianfeng@huawei.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/xen/spinlock.c