* [PATCH] net: macb: NULL out phydev after removing mdio bus
@ 2016-10-07 15:13 Xander Huff
2016-10-07 15:20 ` Moritz Fischer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Xander Huff @ 2016-10-07 15:13 UTC (permalink / raw)
To: nicolas.ferre
Cc: netdev, Nathan Sullivan, linux-kernel, xander.huff, Brad Mouring
From: Nathan Sullivan <nathan.sullivan@ni.com>
To ensure the dev->phydev pointer is not used after becoming invalid in
mdiobus_unregister, set it to NULL. This happens when removing the macb
driver without first taking its interface down, since unregister_netdev
will end up calling macb_close.
Signed-off-by: Xander Huff <xander.huff@ni.com>
Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Brad Mouring <brad.mouring@ni.com>
---
drivers/net/ethernet/cadence/macb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 63144bb..b32444a 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -3117,6 +3117,7 @@ static int macb_remove(struct platform_device *pdev)
if (dev->phydev)
phy_disconnect(dev->phydev);
mdiobus_unregister(bp->mii_bus);
+ dev->phydev = NULL;
mdiobus_free(bp->mii_bus);
/* Shutdown the PHY if there is a GPIO reset */
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: macb: NULL out phydev after removing mdio bus
2016-10-07 15:13 [PATCH] net: macb: NULL out phydev after removing mdio bus Xander Huff
@ 2016-10-07 15:20 ` Moritz Fischer
2016-10-07 16:22 ` Nicolas Ferre
2016-10-08 3:57 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2016-10-07 15:20 UTC (permalink / raw)
To: Xander Huff
Cc: Nicolas Ferre, netdev, Nathan Sullivan,
Linux Kernel Mailing List, Brad Mouring
On Fri, Oct 7, 2016 at 8:13 AM, Xander Huff <xander.huff@ni.com> wrote:
> From: Nathan Sullivan <nathan.sullivan@ni.com>
>
> To ensure the dev->phydev pointer is not used after becoming invalid in
> mdiobus_unregister, set it to NULL. This happens when removing the macb
> driver without first taking its interface down, since unregister_netdev
> will end up calling macb_close.
>
> Signed-off-by: Xander Huff <xander.huff@ni.com>
> Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
> Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: macb: NULL out phydev after removing mdio bus
2016-10-07 15:13 [PATCH] net: macb: NULL out phydev after removing mdio bus Xander Huff
2016-10-07 15:20 ` Moritz Fischer
@ 2016-10-07 16:22 ` Nicolas Ferre
2016-10-08 3:57 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Ferre @ 2016-10-07 16:22 UTC (permalink / raw)
To: Xander Huff; +Cc: netdev, Nathan Sullivan, linux-kernel, Brad Mouring
Le 07/10/2016 à 17:13, Xander Huff a écrit :
> From: Nathan Sullivan <nathan.sullivan@ni.com>
>
> To ensure the dev->phydev pointer is not used after becoming invalid in
> mdiobus_unregister, set it to NULL. This happens when removing the macb
> driver without first taking its interface down, since unregister_netdev
> will end up calling macb_close.
>
> Signed-off-by: Xander Huff <xander.huff@ni.com>
> Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
> Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/net/ethernet/cadence/macb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index 63144bb..b32444a 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -3117,6 +3117,7 @@ static int macb_remove(struct platform_device *pdev)
> if (dev->phydev)
> phy_disconnect(dev->phydev);
> mdiobus_unregister(bp->mii_bus);
> + dev->phydev = NULL;
> mdiobus_free(bp->mii_bus);
>
> /* Shutdown the PHY if there is a GPIO reset */
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: macb: NULL out phydev after removing mdio bus
2016-10-07 15:13 [PATCH] net: macb: NULL out phydev after removing mdio bus Xander Huff
2016-10-07 15:20 ` Moritz Fischer
2016-10-07 16:22 ` Nicolas Ferre
@ 2016-10-08 3:57 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-10-08 3:57 UTC (permalink / raw)
To: xander.huff
Cc: nicolas.ferre, netdev, nathan.sullivan, linux-kernel, brad.mouring
From: Xander Huff <xander.huff@ni.com>
Date: Fri, 7 Oct 2016 10:13:22 -0500
> From: Nathan Sullivan <nathan.sullivan@ni.com>
>
> To ensure the dev->phydev pointer is not used after becoming invalid in
> mdiobus_unregister, set it to NULL. This happens when removing the macb
> driver without first taking its interface down, since unregister_netdev
> will end up calling macb_close.
>
> Signed-off-by: Xander Huff <xander.huff@ni.com>
> Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
> Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-08 3:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 15:13 [PATCH] net: macb: NULL out phydev after removing mdio bus Xander Huff
2016-10-07 15:20 ` Moritz Fischer
2016-10-07 16:22 ` Nicolas Ferre
2016-10-08 3:57 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.