]> git.baikalelectronics.ru Git - kernel.git/commit
phylib: fix premature freeing of struct mii_bus
authorLennert Buytenhek <buytenh@wantstofly.org>
Sun, 9 Nov 2008 04:34:47 +0000 (05:34 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 14 Nov 2008 23:19:40 +0000 (18:19 -0500)
commit58d1abc3d1562049e4934e37d01ee3172ea0623b
treeddfe46aefebff4ce75b3b9c53fce8dfd2ada3d32
parent10f7cda02690d7aea7fa60f67dd4026e3396ffa8
phylib: fix premature freeing of struct mii_bus

Commit f20c0459fac08b2960cbb0e1b29cb15bbbeeebb4 ("phylib: give mdio
buses a device tree presence") added a call to device_unregister() in
a situation where the caller did not intend for the device to be
freed yet, but apart from just unregistering the device from the
system, device_unregister() does an additional put_device() that is
intended to free it.

The right function to use in this situation is device_del(), which
unregisters the device from the system like device_unregister() does,
but without dropping the reference count an additional time.

Bug report from Bryan Wu <cooloney@kernel.org>.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Tested-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/phy/mdio_bus.c