]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.13.6/net-qcom-emac-specify-the-correct-size-when-mapping-a-dma-buffer.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / net-qcom-emac-specify-the-correct-size-when-mapping-a-dma-buffer.patch
1 From foo@baz Mon Oct 9 09:32:35 CEST 2017
2 From: Timur Tabi <timur@codeaurora.org>
3 Date: Fri, 22 Sep 2017 15:32:44 -0500
4 Subject: net: qcom/emac: specify the correct size when mapping a DMA buffer
5
6 From: Timur Tabi <timur@codeaurora.org>
7
8
9 [ Upstream commit a93ad944f4ff9a797abff17c73fc4b1e4a1d9141 ]
10
11 When mapping the RX DMA buffers, the driver was accidentally specifying
12 zero for the buffer length. Under normal circumstances, SWIOTLB does not
13 need to allocate a bounce buffer, so the address is just mapped without
14 checking the size field. This is why the error was not detected earlier.
15
16 Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver")
17 Cc: stable@vger.kernel.org
18 Signed-off-by: Timur Tabi <timur@codeaurora.org>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 ---
22 drivers/net/ethernet/qualcomm/emac/emac-mac.c | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25 --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
26 +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
27 @@ -876,7 +876,8 @@ static void emac_mac_rx_descs_refill(str
28
29 curr_rxbuf->dma_addr =
30 dma_map_single(adpt->netdev->dev.parent, skb->data,
31 - curr_rxbuf->length, DMA_FROM_DEVICE);
32 + adpt->rxbuf_size, DMA_FROM_DEVICE);
33 +
34 ret = dma_mapping_error(adpt->netdev->dev.parent,
35 curr_rxbuf->dma_addr);
36 if (ret) {