From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: <netdev@vger.kernel.org>
Cc: David Miller <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Gregory Clement <gregory.clement@free-electrons.com>,
Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Subject: [PATCH 0/2] net: phy: Prevent an MDIO bus from being unloaded while in use
Date: Tue, 22 Jul 2014 21:16:08 -0300 [thread overview]
Message-ID: <1406074570-13246-1-git-send-email-ezequiel.garcia@free-electrons.com> (raw)
The motivation of this small series is to fix the current lack of relationship
between an ethernet driver and the MDIO bus behind the PHY device. In such
cases, we would find no visible link between the drivers:
$ lsmod
Module Size Used by Not tainted
mvmdio 2941 0
mvneta 22069 0
Which means nothing prevents the MDIO driver from being removed:
$ modprobe -r mvmdio
# Unable to handle kernel NULL pointer dereference at virtual address 00000060
pgd = c0004000
[00000060] *pgd=00000000
Internal error: Oops: 17 [#1] SMP ARM
Modules linked in: mvneta [last unloaded: mvmdio]
CPU: 0 PID: 22 Comm: kworker/0:1 Not tainted 3.16.0-rc5-01127-g62c0816-dirty #608
Workqueue: events_power_efficient phy_state_machine
task: df5ec840 ti: df67a000 task.ti: df67a000
PC is at phy_state_machine+0x1c/0x468
LR is at phy_state_machine+0x18/0x468
[snip]
This patchset fixes this problem by adding a pair of module_{get,put},
so the module reference count is increased when the PHY device is attached
and is decreased when the PHY is detached.
Tested with mvneta and mv643xx_eth drivers, which depend on the mvmdio
driver to handle MDIO. This series applies on both net and net-next branches.
Ezequiel Garcia (2):
net: phy: Set the driver when registering an MDIO bus device
net: phy: Ensure the MDIO bus module is held
drivers/net/phy/mdio_bus.c | 1 +
drivers/net/phy/phy_device.c | 23 ++++++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
--
2.0.1
next reply other threads:[~2014-07-23 0:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 0:16 Ezequiel Garcia [this message]
2014-07-23 0:16 ` [PATCH 1/2] net: phy: Set the driver when registering an MDIO bus device Ezequiel Garcia
2014-07-23 18:26 ` Florian Fainelli
2014-07-23 0:16 ` [PATCH 2/2] net: phy: Ensure the MDIO bus module is held Ezequiel Garcia
2014-07-23 18:22 ` Florian Fainelli
2014-07-23 18:40 ` Ezequiel Garcia
2014-07-23 18:46 ` Florian Fainelli
2014-07-23 18:54 ` Ezequiel Garcia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406074570-13246-1-git-send-email-ezequiel.garcia@free-electrons.com \
--to=ezequiel.garcia@free-electrons.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=gregory.clement@free-electrons.com \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox