]> git.baikalelectronics.ru Git - kernel.git/commit
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>
Thu, 8 Dec 2022 10:22:58 +0000 (11:22 +0100)
commitc7caf991a7339e225c9d35c99315e666eca4bbfc
tree6ec53d3e456e1e38bc9d2684ab12836f6163bce9
parentaeae5045dcd4b58895f31fb4a4fdab4063c72066
Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()

[ Upstream commit 885f4a86354c9afaceaf5ee98dd2a61fcec55bdf ]

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: 03d76a8b8a52 ("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