diff mbox

[v5,1/1,net] net: fec: fix kernel oops when plug/unplug cable many times

Message ID CAOMZO5AUk0GHKj857a0=Q-dxhpO2s7uatXurNVZV_UmEmtGsqQ@mail.gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Fabio Estevam May 14, 2013, 7:27 p.m. UTC
On Mon, May 13, 2013 at 1:57 AM, Shawn Guo <shawn.guo@linaro.org> wrote:

> The patch has landed on 3.10-rc1.  Seems that it introduces a lock
> warning as below.  Turn on CONFIG_PROVE_LOCKING and you will be able
> to see it.

This makes the warning goes away on mx28:

,but not sure if it looks OK.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Dumazet May 14, 2013, 7:30 p.m. UTC | #1
On Tue, 2013-05-14 at 16:27 -0300, Fabio Estevam wrote:
> On Mon, May 13, 2013 at 1:57 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> 
> > The patch has landed on 3.10-rc1.  Seems that it introduces a lock
> > warning as below.  Turn on CONFIG_PROVE_LOCKING and you will be able
> > to see it.
> 
> This makes the warning goes away on mx28:
> 
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -451,7 +451,6 @@ fec_restart(struct net_device *ndev, int duplex)
>                 netif_device_detach(ndev);
>                 napi_disable(&fep->napi);
>                 netif_stop_queue(ndev);
> -               netif_tx_lock(ndev);
>         }
> 
>         /* Whack a reset.  We should wait for this. */
> @@ -619,7 +618,6 @@ fec_restart(struct net_device *ndev, int duplex)
>                 netif_device_attach(ndev);
>                 napi_enable(&fep->napi);
>                 netif_wake_queue(ndev);
> -               netif_tx_unlock(ndev);
>         }
>  }
> 
> ,but not sure if it looks OK.
> --

Thats because netif_tx_lock_bh() should be used.

And btw, the order of the unlocks should probably be reversed :

              netif_tx_unlock_bh(ndev);
              netif_wake_queue(ndev);
              napi_enable(&fep->napi);
              netif_device_attach(ndev);



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -451,7 +451,6 @@  fec_restart(struct net_device *ndev, int duplex)
                netif_device_detach(ndev);
                napi_disable(&fep->napi);
                netif_stop_queue(ndev);
-               netif_tx_lock(ndev);
        }

        /* Whack a reset.  We should wait for this. */
@@ -619,7 +618,6 @@  fec_restart(struct net_device *ndev, int duplex)
                netif_device_attach(ndev);
                napi_enable(&fep->napi);
                netif_wake_queue(ndev);
-               netif_tx_unlock(ndev);
        }
 }