diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-11-19 16:11:35 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-02 17:41:05 +0100 |
commit | 448b6273706ca9009f465a53d12303474f92088a (patch) | |
tree | 5bf579403477c61581efa33bf375e173783e2938 /net | |
parent | 082c31cb99d8aa1199de5a2b15e42d456056a504 (diff) |
Drivers: hv: vmbus: fix possible memory leak in vmbus_device_register()
[ Upstream commit 25c94b051592c010abe92c85b0485f1faedc83f3 ]
If device_register() returns error in vmbus_device_register(),
the name allocated by dev_set_name() must be freed. As comment
of device_register() says, it should use put_device() to give
up the reference in the error path. So fix this by calling
put_device(), then the name can be freed in kobject_cleanup().
Fixes: 09d50ff8a233 ("Staging: hv: make the Hyper-V virtual bus code build")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20221119081135.1564691-3-yangyingliang@huawei.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions