Skip to content

Commit

Permalink
net: mvneta: fix possible use-after-free in mvneta_xdp_put_buff
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
LorenzoBianconi authored and davem330 committed Sep 10, 2020
1 parent 5bf490e commit 9d3b2d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/marvell/mvneta.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,11 +2029,11 @@ mvneta_xdp_put_buff(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
int i;

page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
sync_len, napi);
for (i = 0; i < sinfo->nr_frags; i++)
page_pool_put_full_page(rxq->page_pool,
skb_frag_page(&sinfo->frags[i]), napi);
page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
sync_len, napi);
}

static int
Expand Down

0 comments on commit 9d3b2d3

Please sign in to comment.