Skip to content

Commit 1a3bd6e

Browse files
fengidridavem330
authored andcommitted
virtio_net: free xdp shinfo frags when build_skb_from_xdp_buff() fails
build_skb_from_xdp_buff() may return NULL, in this case we need to free the frags of xdp shinfo. Fixes: fab89ba ("virtio-net: support multi-buffer xdp") Signed-off-by: Xuan Zhuo <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Yunsheng Lin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fa0f1ba commit 1a3bd6e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/virtio_net.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,12 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
12731273

12741274
switch (act) {
12751275
case XDP_PASS:
1276+
head_skb = build_skb_from_xdp_buff(dev, vi, &xdp, xdp_frags_truesz);
1277+
if (unlikely(!head_skb))
1278+
goto err_xdp_frags;
1279+
12761280
if (unlikely(xdp_page != page))
12771281
put_page(page);
1278-
head_skb = build_skb_from_xdp_buff(dev, vi, &xdp, xdp_frags_truesz);
12791282
rcu_read_unlock();
12801283
return head_skb;
12811284
case XDP_TX:

0 commit comments

Comments
 (0)