diff options
author | Patrick McHardy <kaber@trash.net> | 2009-06-11 23:00:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-13 04:18:32 -0400 |
commit | 3790c8cdb99f23824b23cb16df608281b335ee91 (patch) | |
tree | c437f801a709cefcf1210eb1e9f8306e52f42ca6 /drivers | |
parent | da6782927de809d9d427bd4bd6a4024243e41f13 (diff) |
net: fix network driver ndo_start_xmit() return values (part 1)
Fix up drivers that return an errno value to qdisc_restart(), causing
qdisc_restart() to print a warning and requeue/retransmit the skb.
- xpnet: memory allocation error, intention is to drop
- ethoc: oversized packet, packet must be dropped
- ibmlana: skb freed: use after free
- rrunner: skb freed: use after free
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/sgi-xp/xpnet.c | 3 | ||||
-rw-r--r-- | drivers/net/ethoc.c | 6 | ||||
-rw-r--r-- | drivers/net/ibmlana.c | 5 | ||||
-rw-r--r-- | drivers/net/rrunner.c | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index 6faefcffcb53..8d1c60a3f0df 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
@@ -450,7 +450,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
450 | "packet\n", sizeof(struct xpnet_pending_msg)); | 450 | "packet\n", sizeof(struct xpnet_pending_msg)); |
451 | 451 | ||
452 | dev->stats.tx_errors++; | 452 | dev->stats.tx_errors++; |
453 | return -ENOMEM; | 453 | dev_kfree_skb(skb); |
454 | return NETDEV_TX_OK; | ||
454 | } | 455 | } |
455 | 456 | ||
456 | /* get the beginning of the first cacheline and end of last */ | 457 | /* get the beginning of the first cacheline and end of last */ |
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index 91a9b1a33764..ceb6a9c357ad 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c | |||
@@ -811,7 +811,7 @@ static int ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
811 | 811 | ||
812 | if (unlikely(skb->len > ETHOC_BUFSIZ)) { | 812 | if (unlikely(skb->len > ETHOC_BUFSIZ)) { |
813 | priv->stats.tx_errors++; | 813 | priv->stats.tx_errors++; |
814 | return -EMSGSIZE; | 814 | goto out; |
815 | } | 815 | } |
816 | 816 | ||
817 | entry = priv->cur_tx % priv->num_tx; | 817 | entry = priv->cur_tx % priv->num_tx; |
@@ -840,9 +840,9 @@ static int ethoc_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
840 | } | 840 | } |
841 | 841 | ||
842 | dev->trans_start = jiffies; | 842 | dev->trans_start = jiffies; |
843 | dev_kfree_skb(skb); | ||
844 | |||
845 | spin_unlock_irq(&priv->lock); | 843 | spin_unlock_irq(&priv->lock); |
844 | out: | ||
845 | dev_kfree_skb(skb); | ||
846 | return NETDEV_TX_OK; | 846 | return NETDEV_TX_OK; |
847 | } | 847 | } |
848 | 848 | ||
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index c25bc0bc0b25..448098d3b39b 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -815,7 +815,7 @@ static int ibmlana_close(struct net_device *dev) | |||
815 | static int ibmlana_tx(struct sk_buff *skb, struct net_device *dev) | 815 | static int ibmlana_tx(struct sk_buff *skb, struct net_device *dev) |
816 | { | 816 | { |
817 | ibmlana_priv *priv = netdev_priv(dev); | 817 | ibmlana_priv *priv = netdev_priv(dev); |
818 | int retval = 0, tmplen, addr; | 818 | int tmplen, addr; |
819 | unsigned long flags; | 819 | unsigned long flags; |
820 | tda_t tda; | 820 | tda_t tda; |
821 | int baddr; | 821 | int baddr; |
@@ -824,7 +824,6 @@ static int ibmlana_tx(struct sk_buff *skb, struct net_device *dev) | |||
824 | the upper layer is in deep desperation and we simply ignore the frame. */ | 824 | the upper layer is in deep desperation and we simply ignore the frame. */ |
825 | 825 | ||
826 | if (priv->txusedcnt >= TXBUFCNT) { | 826 | if (priv->txusedcnt >= TXBUFCNT) { |
827 | retval = -EIO; | ||
828 | dev->stats.tx_dropped++; | 827 | dev->stats.tx_dropped++; |
829 | goto tx_done; | 828 | goto tx_done; |
830 | } | 829 | } |
@@ -874,7 +873,7 @@ static int ibmlana_tx(struct sk_buff *skb, struct net_device *dev) | |||
874 | spin_unlock_irqrestore(&priv->lock, flags); | 873 | spin_unlock_irqrestore(&priv->lock, flags); |
875 | tx_done: | 874 | tx_done: |
876 | dev_kfree_skb(skb); | 875 | dev_kfree_skb(skb); |
877 | return retval; | 876 | return NETDEV_TX_OK; |
878 | } | 877 | } |
879 | 878 | ||
880 | /* switch receiver mode. */ | 879 | /* switch receiver mode. */ |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index d890829a9acc..81dbcbb910f4 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -1425,7 +1425,7 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1425 | if (!(new_skb = dev_alloc_skb(len + 8))) { | 1425 | if (!(new_skb = dev_alloc_skb(len + 8))) { |
1426 | dev_kfree_skb(skb); | 1426 | dev_kfree_skb(skb); |
1427 | netif_wake_queue(dev); | 1427 | netif_wake_queue(dev); |
1428 | return -EBUSY; | 1428 | return NETDEV_TX_OK; |
1429 | } | 1429 | } |
1430 | skb_reserve(new_skb, 8); | 1430 | skb_reserve(new_skb, 8); |
1431 | skb_put(new_skb, len); | 1431 | skb_put(new_skb, len); |