Skip to content

Commit

Permalink
net: qcom/emac: specify the correct size when mapping a DMA buffer
Browse files Browse the repository at this point in the history
[ Upstream commit a93ad94 ]

When mapping the RX DMA buffers, the driver was accidentally specifying
zero for the buffer length.  Under normal circumstances, SWIOTLB does not
need to allocate a bounce buffer, so the address is just mapped without
checking the size field.  This is why the error was not detected earlier.

Fixes: b9b17de ("net: emac: emac gigabit ethernet controller driver")
Cc: [email protected]
Signed-off-by: Timur Tabi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Timur Tabi authored and gregkh committed Oct 12, 2017
1 parent 5600c75 commit 852bdea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/qualcomm/emac/emac-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,8 @@ static void emac_mac_rx_descs_refill(struct emac_adapter *adpt,

curr_rxbuf->dma_addr =
dma_map_single(adpt->netdev->dev.parent, skb->data,
curr_rxbuf->length, DMA_FROM_DEVICE);
adpt->rxbuf_size, DMA_FROM_DEVICE);

ret = dma_mapping_error(adpt->netdev->dev.parent,
curr_rxbuf->dma_addr);
if (ret) {
Expand Down

0 comments on commit 852bdea

Please sign in to comment.