public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/9p/trans_virtio.c: decrease the refcount of 9p virtio device when removing it
@ 2018-08-08  8:14 piaojun
  2018-08-08  8:36 ` Dominique Martinet
  0 siblings, 1 reply; 6+ messages in thread
From: piaojun @ 2018-08-08  8:14 UTC (permalink / raw)
  To: Dominique Martinet
  Cc: akpm@linux-foundation.org, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Greg Kurz, Linux Kernel Mailing List,
	v9fs-developer

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@huawei.com>
---
 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);
-- 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-09  1:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-08  8:14 [PATCH] net/9p/trans_virtio.c: decrease the refcount of 9p virtio device when removing it piaojun
2018-08-08  8:36 ` Dominique Martinet
2018-08-08  8:57   ` piaojun
2018-08-08  9:40     ` Dominique Martinet
2018-08-09  0:45       ` piaojun
2018-08-09  1:18         ` Dominique Martinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox