Skip to content

Commit 9d3b2d3

Browse files
LorenzoBianconidavem330
authored andcommitted
net: mvneta: fix possible use-after-free in mvneta_xdp_put_buff
Release first buffer as last one since it contains references to subsequent fragments. This code will be optimized introducing multi-buffer bit in xdp_buff structure. Fixes: ca0e014 ("net: mvneta: move skb build after descriptors processing") Signed-off-by: Lorenzo Bianconi <[email protected]> Acked-by: Jesper Dangaard Brouer <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5bf490e commit 9d3b2d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,11 +2029,11 @@ mvneta_xdp_put_buff(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
20292029
struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
20302030
int i;
20312031

2032-
page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
2033-
sync_len, napi);
20342032
for (i = 0; i < sinfo->nr_frags; i++)
20352033
page_pool_put_full_page(rxq->page_pool,
20362034
skb_frag_page(&sinfo->frags[i]), napi);
2035+
page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
2036+
sync_len, napi);
20372037
}
20382038

20392039
static int

0 commit comments

Comments
 (0)