hv_netvsc: Fix send_table offset in case of a host bug
authorHaiyang Zhang <haiyangz@microsoft.com>
Thu, 21 Nov 2019 21:33:41 +0000 (13:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:51:20 +0000 (14:51 +0100)
commit2d916a17fbb6bbd50cc113ff43f3af9ed28e03e5
treef7bf1135691ea97f80577530e6182a7f243f3c88
parent4544f000c83323f3183eec44691a64e251eaefc6
hv_netvsc: Fix send_table offset in case of a host bug

[ Upstream commit 171c1fd98df3d5948d9a9eb755274850fa5e59c6 ]

If negotiated NVSP version <= NVSP_PROTOCOL_VERSION_6, the offset may
be wrong (too small) due to a host bug. This can cause missing the
end of the send indirection table, and add multiple zero entries from
leading zeros before the data region. This bug adds extra burden on
channel 0.

So fix the offset by computing it from the data structure sizes. This
will ensure netvsc driver runs normally on unfixed hosts, and future
fixed hosts.

Fixes: 5b54dac856cb ("hyperv: Add support for virtual Receive Side Scaling (vRSS)")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/hyperv/netvsc.c