All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lpc_eth: add missing ndo_change_mtu()
@ 2012-06-11  9:24 Eric Dumazet
  2012-06-11  9:36 ` Roland Stigge
  2012-06-11 20:13 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2012-06-11  9:24 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, stigge, kevin.wells, aletes.xgr, srinivas.bakki

From: Eric Dumazet <edumazet@google.com>

lpc_eth does a copy of transmitted skbs to DMA area, without checking
skb lengths, so can trigger buffer overflows :

memcpy(pldat->tx_buff_v + txidx * ENET_MAXF_SIZE, skb->data, len);

One way to get bigger skbs is to allow MTU changes above the 1500 limit.

Calling eth_change_mtu() in ndo_change_mtu() makes sure this cannot
happen.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Roland Stigge <stigge@antcom.de>
Cc: Kevin Wells <kevin.wells@nxp.com>
---
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 8d2666f..10febdc 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1320,6 +1320,7 @@ static const struct net_device_ops lpc_netdev_ops = {
 	.ndo_set_rx_mode	= lpc_eth_set_multicast_list,
 	.ndo_do_ioctl		= lpc_eth_ioctl,
 	.ndo_set_mac_address	= lpc_set_mac_address,
+	.ndo_change_mtu		= eth_change_mtu,
 };
 
 static int lpc_eth_drv_probe(struct platform_device *pdev)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lpc_eth: add missing ndo_change_mtu()
  2012-06-11  9:24 [PATCH] lpc_eth: add missing ndo_change_mtu() Eric Dumazet
@ 2012-06-11  9:36 ` Roland Stigge
  2012-06-11 20:13 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Stigge @ 2012-06-11  9:36 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev, kevin.wells, aletes.xgr, srinivas.bakki

On 06/11/2012 11:24 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> lpc_eth does a copy of transmitted skbs to DMA area, without checking
> skb lengths, so can trigger buffer overflows :
> 
> memcpy(pldat->tx_buff_v + txidx * ENET_MAXF_SIZE, skb->data, len);
> 
> One way to get bigger skbs is to allow MTU changes above the 1500 limit.
> 
> Calling eth_change_mtu() in ndo_change_mtu() makes sure this cannot
> happen.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Acked-by: Roland Stigge <stigge@antcom.de>

> Cc: Roland Stigge <stigge@antcom.de>
> Cc: Kevin Wells <kevin.wells@nxp.com>
> ---
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index 8d2666f..10febdc 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1320,6 +1320,7 @@ static const struct net_device_ops lpc_netdev_ops = {
>  	.ndo_set_rx_mode	= lpc_eth_set_multicast_list,
>  	.ndo_do_ioctl		= lpc_eth_ioctl,
>  	.ndo_set_mac_address	= lpc_set_mac_address,
> +	.ndo_change_mtu		= eth_change_mtu,
>  };
>  
>  static int lpc_eth_drv_probe(struct platform_device *pdev)
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lpc_eth: add missing ndo_change_mtu()
  2012-06-11  9:24 [PATCH] lpc_eth: add missing ndo_change_mtu() Eric Dumazet
  2012-06-11  9:36 ` Roland Stigge
@ 2012-06-11 20:13 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-06-11 20:13 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, stigge, kevin.wells, aletes.xgr, srinivas.bakki

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 11 Jun 2012 11:24:00 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> lpc_eth does a copy of transmitted skbs to DMA area, without checking
> skb lengths, so can trigger buffer overflows :
> 
> memcpy(pldat->tx_buff_v + txidx * ENET_MAXF_SIZE, skb->data, len);
> 
> One way to get bigger skbs is to allow MTU changes above the 1500 limit.
> 
> Calling eth_change_mtu() in ndo_change_mtu() makes sure this cannot
> happen.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-11 20:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11  9:24 [PATCH] lpc_eth: add missing ndo_change_mtu() Eric Dumazet
2012-06-11  9:36 ` Roland Stigge
2012-06-11 20:13 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.