diff options
author | Jason Wang <jasowang@redhat.com> | 2021-09-17 11:34:06 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-30 11:12:57 +0300 |
commit | f020bb63b5d2e5576acadd10e158fe3b04af67ba (patch) | |
tree | 479b7490e5aa29ec8c62ec252d370a3a8d23c5fd /drivers/net/virtio_net.c | |
parent | 9a5ba85e8dce59bd7d4dcd62b4ae096c650ceac6 (diff) | |
download | linux-f020bb63b5d2e5576acadd10e158fe3b04af67ba.tar.xz |
virtio-net: fix pages leaking when building skb in big mode
[ Upstream commit afd92d82c9d715fb97565408755acad81573591a ]
We try to use build_skb() if we had sufficient tailroom. But we forget
to release the unused pages chained via private in big mode which will
leak pages. Fixing this by release the pages after building the skb in
big mode.
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Fixes: fb32856b16ad ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index eee493685aad..fb96658bb91f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -435,6 +435,10 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, skb_reserve(skb, p - buf); skb_put(skb, len); + + page = (struct page *)page->private; + if (page) + give_pages(rq, page); goto ok; } |