]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: hv_netvsc: fix loss of early receive events from host during channel open.
authorDipayaan Roy <dipayanroy@linux.microsoft.com>
Mon, 25 Aug 2025 11:56:27 +0000 (04:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 13:31:51 +0000 (15:31 +0200)
commite98884092a53c1812016716a5226482f810e52c2
treed300fa9bb2f591f365e7db5a16f3c6a7a498c562
parent22b6f4571967298cb6def36d9befe3b5b9ed949d
net: hv_netvsc: fix loss of early receive events from host during channel open.

[ Upstream commit 9448ccd853368582efa9db05db344f8bb9dffe0f ]

The hv_netvsc driver currently enables NAPI after opening the primary and
subchannels. This ordering creates a race: if the Hyper-V host places data
in the host -> guest ring buffer and signals the channel before
napi_enable() has been called, the channel callback will run but
napi_schedule_prep() will return false. As a result, the NAPI poller never
gets scheduled, the data in the ring buffer is not consumed, and the
receive queue may remain permanently stuck until another interrupt happens
to arrive.

Fix this by enabling NAPI and registering it with the RX/TX queues before
vmbus channel is opened. This guarantees that any early host signal after
open will correctly trigger NAPI scheduling and the ring buffer will be
drained.

Fixes: 76bb5db5c749d ("netvsc: fix use after free on module removal")
Signed-off-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
Link: https://patch.msgid.link/20250825115627.GA32189@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/hyperv/netvsc.c
drivers/net/hyperv/rndis_filter.c