diff options
author | Johannes Berg <johannes.berg@intel.com> | 2021-01-07 22:15:21 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-02-10 09:25:27 +0100 |
commit | 98650c3d0e33726292dc8fb3b23e129c68c88108 (patch) | |
tree | 419903d58f9e375387a01942445163b889c0f8fd /arch/um | |
parent | 02531b5549ebf39d6f3c0602f083901211149355 (diff) | |
download | linux-stable-98650c3d0e33726292dc8fb3b23e129c68c88108.tar.gz linux-stable-98650c3d0e33726292dc8fb3b23e129c68c88108.tar.bz2 linux-stable-98650c3d0e33726292dc8fb3b23e129c68c88108.zip |
um: virtio: free vu_dev only with the contained struct device
[ Upstream commit f4172b084342fd3f9e38c10650ffe19eac30d8ce ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
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 179b41ad63ba..18618af3835f 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -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; |