提交 7e2eb99c 编写于 作者: T Thadeu Lima de Souza Cascardo 提交者: David S. Miller

mlx4: fix DMA mapping leak when allocation fails

mlx4_en_prepare_rx_desc does not correctly clean up after it finds an
allocation failure. It should unmap a page before calling put_page, but
it only calls the later.

This bug would prevent a device removal using hotplug after setting the
device MTU to 9000 and opening the network interface. After the fix, we
still see the allocation failure with MTU 9000, but we are able to
remove the device.
Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 68355f71
......@@ -168,8 +168,12 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv,
return 0;
err:
while (i--)
while (i--) {
dma_addr_t dma = be64_to_cpu(rx_desc->data[i].addr);
pci_unmap_single(priv->mdev->pdev, dma, skb_frags[i].size,
PCI_DMA_FROMDEVICE);
put_page(skb_frags[i].page);
}
return -ENOMEM;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册