diff options
author | Eric Dumazet <edumazet@google.com> | 2017-09-18 13:03:43 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-18 20:57:00 -0700 |
commit | 129c6cda2de2a8ac44fab096152469999b727faf (patch) | |
tree | ee5c23d46331ab2fa2f9c10f0974872fe31a122e | |
parent | 4c7124413aa759b8ea0b90cd39177e525396e662 (diff) | |
download | linux-stable-129c6cda2de2a8ac44fab096152469999b727faf.tar.gz linux-stable-129c6cda2de2a8ac44fab096152469999b727faf.tar.bz2 linux-stable-129c6cda2de2a8ac44fab096152469999b727faf.zip |
8139too: revisit napi_complete_done() usage
It seems we have to be more careful in napi_complete_done()
use. This patch is not a revert, as it seems we can
avoid bug that Ville reported by moving the napi_complete_done()
test in the spinlock section.
Many thanks to Ville for detective work and all tests.
Fixes: 617f01211baf ("8139too: use napi_complete_done()")
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/realtek/8139too.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index ca22f2898664..d24b47b8e0b2 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -2135,11 +2135,12 @@ static int rtl8139_poll(struct napi_struct *napi, int budget) if (likely(RTL_R16(IntrStatus) & RxAckBits)) work_done += rtl8139_rx(dev, tp, budget); - if (work_done < budget && napi_complete_done(napi, work_done)) { + if (work_done < budget) { unsigned long flags; spin_lock_irqsave(&tp->lock, flags); - RTL_W16_F(IntrMask, rtl8139_intr_mask); + if (napi_complete_done(napi, work_done)) + RTL_W16_F(IntrMask, rtl8139_intr_mask); spin_unlock_irqrestore(&tp->lock, flags); } spin_unlock(&tp->rx_lock); |