* [PATCH] net: allwinner: emac: Add missing free_irq
@ 2013-12-07 11:31 Maxime Ripard
[not found] ` <1386415902-32697-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2013-12-07 11:31 UTC (permalink / raw)
To: David S. Miller
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, netdev-u79uwXL29TY76Z2rM5mHXA,
Maxime Ripard
The sun4i-emac driver uses devm_request_irq at .ndo_open time, but relies on
the managed device mechanism to actually free it. This causes an issue whenever
someone wants to restart the interface, the interrupt still being held, and not
yet released.
Fall back to using the regular request_irq at .ndo_open time, and introduce a
free_irq during .ndo_stop.
Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
Hi David,
It would be great if this patch would be applied to 3.13.
Thanks,
Maxime
drivers/net/ethernet/allwinner/sun4i-emac.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 50b853a..38aba50 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -717,8 +717,8 @@ static int emac_open(struct net_device *dev)
if (netif_msg_ifup(db))
dev_dbg(db->dev, "enabling %s\n", dev->name);
- if (devm_request_irq(db->dev, dev->irq, &emac_interrupt,
- 0, dev->name, dev))
+ if (request_irq(dev->irq, &emac_interrupt,
+ 0, dev->name, dev))
return -EAGAIN;
/* Initialize EMAC board */
@@ -774,6 +774,8 @@ static int emac_stop(struct net_device *ndev)
emac_shutdown(ndev);
+ free_irq(ndev->irq, ndev);
+
return 0;
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: allwinner: emac: Add missing free_irq
[not found] ` <1386415902-32697-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
@ 2013-12-07 16:57 ` Sergei Shtylyov
[not found] ` <52A35361.8090608-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2013-12-07 16:57 UTC (permalink / raw)
To: Maxime Ripard, David S. Miller
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, netdev-u79uwXL29TY76Z2rM5mHXA
Hello.
On 07-12-2013 15:31, Maxime Ripard wrote:
> The sun4i-emac driver uses devm_request_irq at .ndo_open time, but relies on
> the managed device mechanism to actually free it. This causes an issue whenever
> someone wants to restart the interface, the interrupt still being held, and not
> yet released.
> Fall back to using the regular request_irq at .ndo_open time, and introduce a
> free_irq during .ndo_stop.
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
> Hi David,
> It would be great if this patch would be applied to 3.13.
> Thanks,
> Maxime
> drivers/net/ethernet/allwinner/sun4i-emac.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
> index 50b853a..38aba50 100644
> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> @@ -717,8 +717,8 @@ static int emac_open(struct net_device *dev)
> if (netif_msg_ifup(db))
> dev_dbg(db->dev, "enabling %s\n", dev->name);
>
> - if (devm_request_irq(db->dev, dev->irq, &emac_interrupt,
> - 0, dev->name, dev))
> + if (request_irq(dev->irq, &emac_interrupt,
> + 0, dev->name, dev))
Doesn't it fit into single line?
WBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: allwinner: emac: Add missing free_irq
[not found] ` <52A35361.8090608-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
@ 2013-12-10 17:52 ` Maxime Ripard
0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2013-12-10 17:52 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: David S. Miller,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, netdev-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]
Hi,
On Sat, Dec 07, 2013 at 08:57:05PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 07-12-2013 15:31, Maxime Ripard wrote:
>
> >The sun4i-emac driver uses devm_request_irq at .ndo_open time, but relies on
> >the managed device mechanism to actually free it. This causes an issue whenever
> >someone wants to restart the interface, the interrupt still being held, and not
> >yet released.
>
> >Fall back to using the regular request_irq at .ndo_open time, and introduce a
> >free_irq during .ndo_stop.
>
> >Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> >---
> >Hi David,
>
> >It would be great if this patch would be applied to 3.13.
>
> >Thanks,
> >Maxime
>
>
> > drivers/net/ethernet/allwinner/sun4i-emac.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
>
> >diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
> >index 50b853a..38aba50 100644
> >--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> >+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> >@@ -717,8 +717,8 @@ static int emac_open(struct net_device *dev)
> > if (netif_msg_ifup(db))
> > dev_dbg(db->dev, "enabling %s\n", dev->name);
> >
> >- if (devm_request_irq(db->dev, dev->irq, &emac_interrupt,
> >- 0, dev->name, dev))
> >+ if (request_irq(dev->irq, &emac_interrupt,
> >+ 0, dev->name, dev))
>
> Doesn't it fit into single line?
Hmmm, yes, probably.
I'll send a v2.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: allwinner: emac: Add missing free_irq
@ 2014-06-23 20:49 Maxime Ripard
2014-06-25 23:32 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2014-06-23 20:49 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, linux-arm-kernel, linux-kernel, Maxime Ripard, stable
If the mdio probe function fails in emac_open, the interrupt we just requested
isn't freed. If emac_open is called again, for example because we try to set up
the interface again, the kernel will oops because the interrupt wasn't properly
released.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: <stable@vger.kernel.org> # 3.11+
---
drivers/net/ethernet/allwinner/sun4i-emac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 28460676b8ca..d81e7167a8b5 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -736,6 +736,7 @@ static int emac_open(struct net_device *dev)
ret = emac_mdio_probe(dev);
if (ret < 0) {
+ free_irq(dev->irq, dev);
netdev_err(dev, "cannot probe MDIO bus\n");
return ret;
}
--
2.0.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: allwinner: emac: Add missing free_irq
2014-06-23 20:49 Maxime Ripard
@ 2014-06-25 23:32 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-06-25 23:32 UTC (permalink / raw)
To: maxime.ripard; +Cc: netdev, linux-arm-kernel, linux-kernel, stable
From: Maxime Ripard <maxime.ripard@free-electrons.com>
Date: Mon, 23 Jun 2014 22:49:40 +0200
> If the mdio probe function fails in emac_open, the interrupt we just requested
> isn't freed. If emac_open is called again, for example because we try to set up
> the interface again, the kernel will oops because the interrupt wasn't properly
> released.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: <stable@vger.kernel.org> # 3.11+
Applied, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-25 23:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 11:31 [PATCH] net: allwinner: emac: Add missing free_irq Maxime Ripard
[not found] ` <1386415902-32697-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-12-07 16:57 ` Sergei Shtylyov
[not found] ` <52A35361.8090608-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2013-12-10 17:52 ` Maxime Ripard
-- strict thread matches above, loose matches on Subject: below --
2014-06-23 20:49 Maxime Ripard
2014-06-25 23: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;
as well as URLs for NNTP newsgroup(s).