sh_eth: fix napi_{en|dis}able() calls racing against interrupts
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Tue, 3 Sep 2013 22:41:27 +0000 (02:41 +0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Sep 2013 18:55:34 +0000 (14:55 -0400)
commitd2779e99468fd83ef1493c34f3803fec9aad8345
tree4b240a6296af57e1340a68c37df65fd43ee861dc
parent3a1c756590633c0e86df606e5c618c190926a0df
sh_eth: fix napi_{en|dis}able() calls racing against interrupts

While implementing NAPI for the driver, I overlooked the race conditions where
interrupt  handler might have called napi_schedule_prep() before napi_enable()
was called or after napi_disable() was called. If RX interrupt happens, this
would cause the endless interrupts and messages like:

sh-eth eth0: ignoring interrupt, status 0x00040000, mask 0x01ff009f.

The interrupt wouldn't even be masked by the kernel eventually since the handler
would return IRQ_HANDLED all the time.

As a fix, move napi_enable() call before request_irq() call and napi_disable()
call after free_irq() call.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c