netdev
[Top] [All Lists]

Re: "deadlock" between smc91x driver and link_watch

To: Ian Campbell <icampbell@xxxxxxxxx>
Subject: Re: "deadlock" between smc91x driver and link_watch
From: Andrew Morton <akpm@xxxxxxxx>
Date: Wed, 24 Nov 2004 01:46:50 -0800
Cc: nico@xxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <1101289309.10841.9.camel@icampbell-debian>
References: <1101230194.14370.12.camel@icampbell-debian> <20041123153158.6f20a7d7.akpm@xxxxxxxx> <1101289309.10841.9.camel@icampbell-debian>
Sender: netdev-bounce@xxxxxxxxxxx
Ian Campbell <icampbell@xxxxxxxxx> wrote:
>
>  On Tue, 2004-11-23 at 15:31 -0800, Andrew Morton wrote:
>  > One possible fix would be to remove that flush_scheduled_work() and to do
>  > refcounting around smc_phy_configure(): dev_hold() when scheduling the work
>  > (if schedule_work() returned true), dev_put() in the handler.
> 
>  Something like the following?

I think so.

>  +static void smc_phy_configure_wq(void *data)
>  +{
>  +    struct net_device *dev = data;
>  +    dev_put(dev);
>  +    smc_phy_configure(data);
>  +}

You'd want to do the dev_put() after the smc_phy_configure() though.  It
may still be a tiny bit racy against module unload.

<Prev in Thread] Current Thread [Next in Thread>