From: Stephen Hemminger Date: Mon, 14 May 2018 22:32:13 +0000 (-0700) Subject: hv_netvsc: fix race in napi poll when rescheduling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0ac663c5674a8ed1b986e3de82d6b5427536b5ad;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git hv_netvsc: fix race in napi poll when rescheduling [ Commit d64e38ae690e3337db0d38d9b149a193a1646c4b upstream. ] There is a race between napi_reschedule and re-enabling interrupts which could lead to missed host interrrupts. This occurs when interrupts are re-enabled (hv_end_read) and vmbus irq callback (netvsc_channel_cb) has already scheduled NAPI. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index b7720b65f5d6..7e0eb99571af 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1205,9 +1205,10 @@ int netvsc_poll(struct napi_struct *napi, int budget) if (send_recv_completions(ndev, net_device, nvchan) == 0 && work_done < budget && napi_complete_done(napi, work_done) && - hv_end_read(&channel->inbound)) { + hv_end_read(&channel->inbound) && + napi_schedule_prep(napi)) { hv_begin_read(&channel->inbound); - napi_reschedule(napi); + __napi_schedule(napi); } /* Driver may overshoot since multiple packets per descriptor */