]> 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)
committerWei Liu <wei.liu@kernel.org>
Mon, 21 Nov 2022 10:57:41 +0000 (10:57 +0000)
commit885f4a86354c9afaceaf5ee98dd2a61fcec55bdf
treea1ae08f87f16b436c0a745b80d5da701d3bad520
parentebf146c4bc35887f30aefcd1c43f139b165c6f8e
Drivers: hv: vmbus: fix double free in the error path of vmbus_add_channel_work()

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>
drivers/hv/channel_mgmt.c