[PATCH] net/9p/trans_virtio.c: decrease the refcount of 9p virtio device when removing it
From: piaojun
Date: Wed Aug 08 2018 - 04:14:56 EST
I found that 9pnet_virtio.ko could not be removed by rmmod command, and I
could still found it by lsmod. The reason is that we forgot decrease the
refcount of 9p virtio device by kobject_put. So we should put refcount in
p9_virtio_remove.
Signed-off-by: Jun Piao <piaojun@xxxxxxxxxx>
---
net/9p/trans_virtio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 46a5ab2..a00e992 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -710,7 +710,8 @@ static void p9_virtio_remove(struct virtio_device *vdev)
vdev->config->del_vqs(vdev);
sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
- kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE);
+ kobject_uevent(&(vdev->dev.kobj), KOBJ_REMOVE);
+ kobject_put(&(vdev->dev.kobj));
kfree(chan->tag);
kfree(chan->vc_wq);
kfree(chan);
--