sh_eth: Fix padding of short frames on TX
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Thu, 22 Jan 2015 12:40:13 +0000 (12:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Jan 2015 00:13:15 +0000 (16:13 -0800)
commiteebfb643c0799ecb98ba77d4a0dd0e56f6a17553
treedb5ef7b64f42667f721a7932d4641d55f5bad9b7
parent02a54164c52ed6eca3089a0d402170fbf34d6cf5
sh_eth: Fix padding of short frames on TX

If an skb to be transmitted is shorter than the minimum Ethernet frame
length, we currently set the DMA descriptor length to the minimum but
do not add zero-padding.  This could result in leaking sensitive
data.  We also pass different lengths to dma_map_single() and
dma_unmap_single().

Use skb_padto() to pad properly, before calling dma_map_single().

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c