]> git.baikalelectronics.ru Git - kernel.git/commit
phy: Don't increment MDIO bus refcount unless it's a different owner
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 7 Dec 2016 04:54:43 +0000 (20:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Dec 2016 18:27:14 +0000 (13:27 -0500)
commit17f7da5204e4bb75b06fba45e2677fce9ef55d6a
treeabd95e56d38d8c2e4ab6c83b3391896291365bf5
parent3cf752f72ff619c62e9f75ded434b38fa3eb80d7
phy: Don't increment MDIO bus refcount unless it's a different owner

Commit dd74244d18f4 ("phy: fix mdiobus module safety") fixed the way we
dealt with MDIO bus module reference count, but sort of introduced a
regression in that, if an Ethernet driver registers its own MDIO bus
driver, as is common, we will end up with the Ethernet driver's
module->refnct set to 1, thus preventing this driver from any removal.

Fix this by comparing the network device's device driver owner against
the MDIO bus driver owner, and only if they are different, increment the
MDIO bus module refcount.

Fixes: dd74244d18f4 ("phy: fix mdiobus module safety")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c