Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 19 Nov 2022 08:11:34 +0000 (16:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:05 +0000 (17:41 +0100)
commit082c31cb99d8aa1199de5a2b15e42d456056a504
tree9a30f322e2f0a1151c42a5aa13c476a68a95c396
parent7fdd9daa5b1257bbe0e549878423687df1abbeb9
Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()

[ Upstream commit f92a4b50f0bd7fd52391dc4bb9a309085d278f91 ]

In the error path of vmbus_device_register(), device_unregister()
is called, which calls vmbus_device_release().  The latter frees
the struct hv_device that was passed in to vmbus_device_register().
So remove the kfree() in vmbus_add_channel_work() to avoid a double
free.

Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info")
Suggested-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20221119081135.1564691-2-yangyingliang@huawei.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hv/channel_mgmt.c