mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
e100: Fix possible use after free in e100_xmit_prepare
[ Upstream commit45605c75c5
] In e100_xmit_prepare(), if we can't map the skb, then return -ENOMEM, so e100_xmit_frame() will return NETDEV_TX_BUSY and the upper layer will resend the skb. But the skb is already freed, which will cause UAF bug when the upper layer resends the skb. Remove the harmful free. Fixes:5e5d49422d
("e100: Release skb when DMA mapping is failed in e100_xmit_prepare") Signed-off-by: Wang Hai <wanghai38@huawei.com> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
bd477b891a
commit
b46f6144ab
1 changed files with 1 additions and 4 deletions
|
@ -1741,11 +1741,8 @@ static int e100_xmit_prepare(struct nic *nic, struct cb *cb,
|
|||
dma_addr = dma_map_single(&nic->pdev->dev, skb->data, skb->len,
|
||||
DMA_TO_DEVICE);
|
||||
/* If we can't map the skb, have the upper layer try later */
|
||||
if (dma_mapping_error(&nic->pdev->dev, dma_addr)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
skb = NULL;
|
||||
if (dma_mapping_error(&nic->pdev->dev, dma_addr))
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the last 4 bytes of the SKB payload packet as the CRC, used for
|
||||
|
|
Loading…
Reference in a new issue