aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2018-02-20 14:32:15 +0100
committerDavid S. Miller <davem@davemloft.net>2018-02-21 15:09:29 -0500
commit11b7d897ccc1fb5a3d3f9eb1e6b4574671e5dd7d (patch)
tree6827c4f93fc4deecb7bdeee6837a7e58b0bb5050 /tools
parentvirtio_net: fix XDP code path in receive_small() (diff)
downloadlinux-dev-11b7d897ccc1fb5a3d3f9eb1e6b4574671e5dd7d.tar.xz
linux-dev-11b7d897ccc1fb5a3d3f9eb1e6b4574671e5dd7d.zip
virtio_net: fix memory leak in XDP_REDIRECT
XDP_REDIRECT calling xdp_do_redirect() can fail for multiple reasons (which can be inspected by tracepoints). The current semantics is that on failure the driver calling xdp_do_redirect() must handle freeing or recycling the page associated with this frame. This can be seen as an optimization, as drivers usually have an optimized XDP_DROP code path for frame recycling in place already. The virtio_net driver didn't handle when xdp_do_redirect() failed. This caused a memory leak as the page refcnt wasn't decremented on failures. The function __virtnet_xdp_xmit() did handle one type of failure, when the xmit queue virtqueue_add_outbuf() is full, which "hides" releasing a refcnt on the page. Instead the function __virtnet_xdp_xmit() must follow API of xdp_do_redirect(), which on errors leave it up to the caller to free the page, of the failed send operation. Fixes: 186b3c998c50 ("virtio-net: support XDP_REDIRECT") Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions