提交 787082ab 编写于 作者: I Ilya Lipnitskiy 提交者: David S. Miller

net: ethernet: mtk_eth_soc: fix build_skb cleanup

In case build_skb fails, call skb_free_frag on the correct pointer. Also
update the DMA structures with the new mapping before exiting, because
the mapping was successful
Suggested-by: NFelix Fietkau <nbd@nbd.name>
Signed-off-by: NIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5196c417
......@@ -1304,9 +1304,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
/* receive data */
skb = build_skb(data, ring->frag_size);
if (unlikely(!skb)) {
skb_free_frag(new_data);
skb_free_frag(data);
netdev->stats.rx_dropped++;
goto release_desc;
goto skip_rx;
}
skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
......@@ -1326,6 +1326,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
skb_record_rx_queue(skb, 0);
napi_gro_receive(napi, skb);
skip_rx:
ring->data[idx] = new_data;
rxd->rxd1 = (unsigned int)dma_addr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册