]> git.baikalelectronics.ru Git - kernel.git/commit
hv_netvsc: Fix missed pagebuf entries in netvsc_dma_map/unmap()
authorMichael Kelley <mikelley@microsoft.com>
Tue, 31 Jan 2023 03:33:06 +0000 (19:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:15 +0000 (11:28 +0100)
commit4640ede876f5c5aaea6496b3b0767cd0be036648
tree72adbff73cb8fe67ff9fa03888b6312bb77ca5c5
parent0cffd3eb1642e5c865e4ad735f16428713c8556a
hv_netvsc: Fix missed pagebuf entries in netvsc_dma_map/unmap()

commit f6d3ae030484e2c2471de7b502d25bd8c5ef5563 upstream.

netvsc_dma_map() and netvsc_dma_unmap() currently check the cp_partial
flag and adjust the page_count so that pagebuf entries for the RNDIS
portion of the message are skipped when it has already been copied into
a send buffer. But this adjustment has already been made by code in
netvsc_send(). The duplicate adjustment causes some pagebuf entries to
not be mapped. In a normal VM, this doesn't break anything because the
mapping doesn’t change the PFN. But in a Confidential VM,
dma_map_single() does bounce buffering and provides a different PFN.
Failing to do the mapping causes the wrong PFN to be passed to Hyper-V,
and various errors ensue.

Fix this by removing the duplicate adjustment in netvsc_dma_map() and
netvsc_dma_unmap().

Fixes: 62a80770846d ("net: netvsc: Add Isolation VM support for netvsc driver")
Cc: stable@vger.kernel.org
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Link: https://lore.kernel.org/r/1675135986-254490-1-git-send-email-mikelley@microsoft.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/hyperv/netvsc.c