]> git.baikalelectronics.ru Git - kernel.git/commit
hv_netvsc: Fix offset usage in netvsc_send_table()
authorHaiyang Zhang <haiyangz@microsoft.com>
Thu, 21 Nov 2019 21:33:40 +0000 (13:33 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Nov 2019 03:32:23 +0000 (19:32 -0800)
commit3e44a7b7d04c94ff87bf8416d7cd6a1b7ac40c17
tree030210d478d7460d9edc2b854c7428cc63951092
parentb4fc2ce9337b052750fdb86848b3f9d7f3d94f9a
hv_netvsc: Fix offset usage in netvsc_send_table()

To reach the data region, the existing code adds offset in struct
nvsp_5_send_indirect_table on the beginning of this struct. But the
offset should be based on the beginning of its container,
struct nvsp_message. This bug causes the first table entry missing,
and adds an extra zero from the zero pad after the data region.
This can put extra burden on the channel 0.

So, correct the offset usage. Also add a boundary check to ensure
not reading beyond data region.

Fixes: 4e1a3fac8d06 ("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>
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc.c