[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081109015950.GX32552@xi.wantstofly.org>
Date: Sun, 9 Nov 2008 02:59:50 +0100
From: Lennert Buytenhek <buytenh@...tstofly.org>
To: jeff@...zik.org, Bryan Wu <cooloney@...nel.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] phylib: fix premature freeing of struct mii_bus
On Fri, Nov 07, 2008 at 10:06:17PM +0100, Lennert Buytenhek wrote:
> From: Lennert Buytenhek <buytenh@...tstofly.org>
>
> Commit 46abc02175b3c246dd5141d878f565a8725060c9 ("phylib: give mdio
> buses a device tree presence") added a call to device_unregister() in
> a situation where the caller did not expect the reference count on
> the embedded kobject to be dropped, but device_unregister() does drop
> that reference count. 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.
Wait a minute -- the original code _is_ correct. mdiobus_register()
bumps the refcount to two (once because of device_initialize(), once
because of device_add()), mdiobus_unregister() drops it back to one,
and mdiobus_free() drops it to zero.
Trying to figure out what's going on... please don't apply this for now.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists