mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] sparc/kernel/vio.c: add put_device() after device_find_child()
@ 2013-04-15 14:42 Federico Vaga
  2013-05-05  1:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Federico Vaga @ 2013-04-15 14:42 UTC (permalink / raw)
  To: David S. Miller, sparclinux, linux-kernel; +Cc: Federico Vaga

The vio_remove() function uses device_find_child() but it does not drop
the reference of the retrieved child.

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
---

I do not have a SPARC system (and I do not know it), so I cannot test this
patch. Please test it.
If I'm right, the device_unregister() does not work properly because,
device_find_child() did get_device() on dev. In essence, the release method
associated to the device will never be invoked because there is a reference
to the device that is not dropped.

 arch/sparc/kernel/vio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 3e244f3..8647fcc 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -342,6 +342,7 @@ static void vio_remove(struct mdesc_handle *hp, u64 node)
 		printk(KERN_INFO "VIO: Removing device %s\n", dev_name(dev));
 
 		device_unregister(dev);
+		put_device(dev);
 	}
 }
 
-- 
1.8.1.4


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

* Re: [RFC PATCH] sparc/kernel/vio.c: add put_device() after device_find_child()
  2013-04-15 14:42 [RFC PATCH] sparc/kernel/vio.c: add put_device() after device_find_child() Federico Vaga
@ 2013-05-05  1:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-05-05  1:32 UTC (permalink / raw)
  To: federico.vaga; +Cc: sparclinux, linux-kernel

From: Federico Vaga <federico.vaga@gmail.com>
Date: Mon, 15 Apr 2013 16:42:52 +0200

> The vio_remove() function uses device_find_child() but it does not drop
> the reference of the retrieved child.
> 
> Signed-off-by: Federico Vaga <federico.vaga@gmail.com>

Applied.

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

end of thread, other threads:[~2013-05-05  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-15 14:42 [RFC PATCH] sparc/kernel/vio.c: add put_device() after device_find_child() Federico Vaga
2013-05-05  1:32 ` David Miller

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

all inboxes | Powered by JetHome®