diff options
author | Johannes Berg <johannes.berg@intel.com> | 2021-01-07 22:15:21 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2021-01-26 22:11:38 +0100 |
commit | f4172b084342fd3f9e38c10650ffe19eac30d8ce (patch) | |
tree | 0ff37342dec431c0ad75dbf4405e1d6fc8943b41 /arch/um | |
parent | um: kmsg_dumper: always dump when not tty console (diff) | |
download | linux-f4172b084342fd3f9e38c10650ffe19eac30d8ce.tar.xz linux-f4172b084342fd3f9e38c10650ffe19eac30d8ce.zip |
um: virtio: free vu_dev only with the contained struct device
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: 5d38f324993f ("um: drivers: Add virtio vhost-user driver")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/virtio_uml.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index 27e92d3881ff..5d957b7e7fd5 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -1084,6 +1084,7 @@ static void virtio_uml_release_dev(struct device *d) } os_close_file(vu_dev->sock); + kfree(vu_dev); } /* Platform device */ @@ -1097,7 +1098,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; |