]> git.baikalelectronics.ru Git - kernel.git/commit
hv_netvsc: Fix XDP refcnt for synthetic and VF NICs
authorHaiyang Zhang <haiyangz@microsoft.com>
Thu, 6 Feb 2020 22:01:05 +0000 (14:01 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Feb 2020 10:33:01 +0000 (11:33 +0100)
commitb2ce78b75e283023c689c4409a8cc7edc6bc7b2c
treec2d9b5c2ef577f04482af7065944b71f5ddc0fe0
parent38b12f03fe9ab2bdca85f9dc50e0a1547b93f4f3
hv_netvsc: Fix XDP refcnt for synthetic and VF NICs

The caller of XDP_SETUP_PROG has already incremented refcnt in
__bpf_prog_get(), so drivers should only increment refcnt by
num_queues - 1.

To fix the issue, update netvsc_xdp_set() to add the correct number
to refcnt.

Hold a refcnt in netvsc_xdp_set()’s other caller, netvsc_attach().

And, do the same in netvsc_vf_setxdp(). Otherwise, every time when VF is
removed and added from the host side, the refcnt will be decreased by one,
which may cause page fault when unloading xdp program.

Fixes: 7fdc5bbf0f0a ("hv_netvsc: Add XDP support")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_bpf.c
drivers/net/hyperv/netvsc_drv.c