net: bcmgenet: correctly pad short packets
authorFlorian Fainelli <f.fainelli@gmail.com>
Tue, 22 Jul 2014 18:01:52 +0000 (11:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jul 2014 02:59:19 +0000 (19:59 -0700)
Packets shorter than ETH_ZLEN were not padded with zeroes, hence leaking
potentially sensitive information. This bug has been present since the
driver got accepted in commit 1c1008c793fa46703a2fee469f4235e1c7984333
("net: bcmgenet: add main driver file").

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c

index 16281ad2da12c04ee8324ec85835b541479788c5..4e615debe4729e2b103575fff027a2a491c661dd 100644 (file)
@@ -1149,6 +1149,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
                goto out;
        }
 
+       if (skb_padto(skb, ETH_ZLEN)) {
+               ret = NETDEV_TX_OK;
+               goto out;
+       }
+
        /* set the SKB transmit checksum */
        if (priv->desc_64b_en) {
                ret = bcmgenet_put_tx_csum(dev, skb);