]> git.baikalelectronics.ru Git - kernel.git/commit
virtio_net: fix memory leak inside XPD_TX with mergeable
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Thu, 4 Aug 2022 06:32:48 +0000 (14:32 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Aug 2022 08:43:55 +0000 (09:43 +0100)
commit291b92d58c07b85798c2ff7236977b264942cf74
treeb3d733773dfec1008381c01806ff91c8ff04eb48
parentd2eb22103c0625ce02d0f20e2bb23b839a15f78b
virtio_net: fix memory leak inside XPD_TX with mergeable

When we call xdp_convert_buff_to_frame() to get xdpf, if it returns
NULL, we should check if xdp_page was allocated by xdp_linearize_page().
If it is newly allocated, it should be freed here alone. Just like any
other "goto err_xdp".

Fixes: 42440ded4588 ("xdp: transition into using xdp_frame for ndo_xdp_xmit")
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c