提交 8f07278d 编写于 作者: B Biao Huang 提交者: Zheng Zengkai

net: ethernet: mtk-star-emac: fix wrong unmap in RX handling

stable inclusion
from stable-5.10.24
commit fa0bc09db49bf4875d9a8c88813fe2b87c1059bb
bugzilla: 51348

--------------------------------

commit 95b39f07 upstream.

mtk_star_dma_unmap_rx() should unmap the dma_addr of old skb rather than
that of new skb.
Assign new_dma_addr to desc_data.dma_addr after all handling of old skb
ends to avoid unexpected receive side error.

Fixes: f96e9641 ("net: ethernet: mtk-star-emac: fix error path in RX handling")
Signed-off-by: NBiao Huang <biao.huang@mediatek.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 684db2b4
...@@ -1225,8 +1225,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv) ...@@ -1225,8 +1225,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
goto push_new_skb; goto push_new_skb;
} }
desc_data.dma_addr = new_dma_addr;
/* We can't fail anymore at this point: it's safe to unmap the skb. */ /* We can't fail anymore at this point: it's safe to unmap the skb. */
mtk_star_dma_unmap_rx(priv, &desc_data); mtk_star_dma_unmap_rx(priv, &desc_data);
...@@ -1236,6 +1234,9 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv) ...@@ -1236,6 +1234,9 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
desc_data.skb->dev = ndev; desc_data.skb->dev = ndev;
netif_receive_skb(desc_data.skb); netif_receive_skb(desc_data.skb);
/* update dma_addr for new skb */
desc_data.dma_addr = new_dma_addr;
push_new_skb: push_new_skb:
desc_data.len = skb_tailroom(new_skb); desc_data.len = skb_tailroom(new_skb);
desc_data.skb = new_skb; desc_data.skb = new_skb;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册