mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
um: virtio: free vu_dev only with the contained struct device
[ Upstream commitf4172b0843
] Since struct device is refcounted, we shouldn't free the vu_dev immediately when it's removed from the platform device, but only when the references actually all go away. Move the freeing to the release to accomplish that. Fixes:5d38f32499
("um: drivers: Add virtio vhost-user driver") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
02531b5549
commit
98650c3d0e
1 changed files with 2 additions and 1 deletions
|
@ -959,6 +959,7 @@ static void virtio_uml_release_dev(struct device *d)
|
|||
}
|
||||
|
||||
os_close_file(vu_dev->sock);
|
||||
kfree(vu_dev);
|
||||
}
|
||||
|
||||
/* Platform device */
|
||||
|
@ -977,7 +978,7 @@ static int virtio_uml_probe(struct platform_device *pdev)
|
|||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
vu_dev = devm_kzalloc(&pdev->dev, sizeof(*vu_dev), GFP_KERNEL);
|
||||
vu_dev = kzalloc(sizeof(*vu_dev), GFP_KERNEL);
|
||||
if (!vu_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
Loading…
Reference in a new issue