Subject: Re: [PATCH] sky2: Fix a race between sky2_down and sky2_poll

From: Stephen Hemminger <[email-masked]>
Date: Fri, 12 Jun 2009 07:16:14 -0700

On Fri, 12 Jun 2009 22:16:42 +0900
Mike McCormack <[email-masked]> wrote:

> 2009/6/12 Stephen Hemminger <[email-masked]>
> 
> > Does the following fix the problem?
> 
> I tried your patch out, but it still got a crash.
> 
> The patch below does fix the problem. Does this look better?
> 
> thanks,
> 
> Mike
> 
> -----------------------------
> 
> Subject: [PATCH] sky2: Shutdown receive path cleanly in sky2_down
> 
> If sky2_down was called while receiving a packet, receive interrupts
> would still occur after the receive buffer was free'd causing a crash in
> sky2_status_intr.
> 
> To avoid further receive interrupts after sky2_down:
> 
> * make sure NAPI and interrupts are fully disabled during shutdown
> * call sky2_rx_stop after shutting down the receiver
> * clear received packets after shutdown
> 
> Signed-off-by: Mike McCormack <[email-masked]>
> ---
>  drivers/net/sky2.c |   21 +++++++++++++++------
>  1 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index a2ff9cb..136b362 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -1805,10 +1805,13 @@ static int sky2_down(struct net_device *dev)
>  	/* Disable port IRQ */
>  	imask = sky2_read32(hw, B0_IMSK);
>  	imask &= ~portirq_msk[port];
> -	sky2_write32(hw, B0_IMSK, imask);
> +	sky2_write32(hw, B0_IMSK, 0);
> 

This breaks on 2 port boards. On dual port boards, both ports share
the same IRQ. 

--