diff options
author | Patrick McHardy <kaber@trash.net> | 2009-06-11 23:17:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-13 04:18:34 -0400 |
commit | 4bd73ae2682d9069746bb049a416d9ab90c6684b (patch) | |
tree | 06c1fa545e0fe2ee1e610db19fde49114b47f152 /drivers/net/irda | |
parent | 3790c8cdb99f23824b23cb16df608281b335ee91 (diff) |
net: fix network drivers ndo_start_xmit() return values (part 2)
Fix up IRDA drivers that return an errno value to qdisc_restart(), causing
qdisc_restart() to print a warning an requeue/retransmit the skb.
- donauboe: intention appears to be to have the skb retransmitted without
error message
- irda-usb: intention is to drop silently according to comment
- kingsub-sir: skb is freed: use after free
- ks959-sir: skb is freed: use after free
- ksdazzle-sir: skb is freed: use after free
- mcs7880: skb is freed: use after free
All but donauboe compile tested.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r-- | drivers/net/irda/donauboe.c | 8 | ||||
-rw-r--r-- | drivers/net/irda/irda-usb.c | 4 | ||||
-rw-r--r-- | drivers/net/irda/kingsun-sir.c | 5 | ||||
-rw-r--r-- | drivers/net/irda/ks959-sir.c | 5 | ||||
-rw-r--r-- | drivers/net/irda/ksdazzle-sir.c | 5 | ||||
-rw-r--r-- | drivers/net/irda/mcs7780.c | 6 |
6 files changed, 9 insertions, 24 deletions
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 6b6548b9fda0..9a0346e751ac 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -994,11 +994,11 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev) | |||
994 | 994 | ||
995 | /* change speed pending, wait for its execution */ | 995 | /* change speed pending, wait for its execution */ |
996 | if (self->new_speed) | 996 | if (self->new_speed) |
997 | return -EBUSY; | 997 | return NETDEV_TX_BUSY; |
998 | 998 | ||
999 | /* device stopped (apm) wait for restart */ | 999 | /* device stopped (apm) wait for restart */ |
1000 | if (self->stopped) | 1000 | if (self->stopped) |
1001 | return -EBUSY; | 1001 | return NETDEV_TX_BUSY; |
1002 | 1002 | ||
1003 | toshoboe_checkstuck (self); | 1003 | toshoboe_checkstuck (self); |
1004 | 1004 | ||
@@ -1049,7 +1049,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1049 | if (self->txpending) | 1049 | if (self->txpending) |
1050 | { | 1050 | { |
1051 | spin_unlock_irqrestore(&self->spinlock, flags); | 1051 | spin_unlock_irqrestore(&self->spinlock, flags); |
1052 | return -EBUSY; | 1052 | return NETDEV_TX_BUSY; |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | /* If in SIR mode we need to generate a string of XBOFs */ | 1055 | /* If in SIR mode we need to generate a string of XBOFs */ |
@@ -1105,7 +1105,7 @@ dumpbufs(skb->data,skb->len,'>'); | |||
1105 | ,skb->len, self->ring->tx[self->txs].control, self->txpending); | 1105 | ,skb->len, self->ring->tx[self->txs].control, self->txpending); |
1106 | toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX); | 1106 | toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX); |
1107 | spin_unlock_irqrestore(&self->spinlock, flags); | 1107 | spin_unlock_irqrestore(&self->spinlock, flags); |
1108 | return -EBUSY; | 1108 | return NETDEV_TX_BUSY; |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | if (INB (OBOE_ENABLEH) & OBOE_ENABLEH_SIRON) | 1111 | if (INB (OBOE_ENABLEH) & OBOE_ENABLEH_SIRON) |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 394b2b17075e..0c0831c03f64 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -389,7 +389,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
389 | s32 speed; | 389 | s32 speed; |
390 | s16 xbofs; | 390 | s16 xbofs; |
391 | int res, mtt; | 391 | int res, mtt; |
392 | int err = 1; /* Failed */ | ||
393 | 392 | ||
394 | IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name); | 393 | IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name); |
395 | 394 | ||
@@ -430,7 +429,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
430 | irda_usb_change_speed_xbofs(self); | 429 | irda_usb_change_speed_xbofs(self); |
431 | netdev->trans_start = jiffies; | 430 | netdev->trans_start = jiffies; |
432 | /* Will netif_wake_queue() in callback */ | 431 | /* Will netif_wake_queue() in callback */ |
433 | err = 0; /* No error */ | ||
434 | goto drop; | 432 | goto drop; |
435 | } | 433 | } |
436 | } | 434 | } |
@@ -542,7 +540,7 @@ drop: | |||
542 | /* Drop silently the skb and exit */ | 540 | /* Drop silently the skb and exit */ |
543 | dev_kfree_skb(skb); | 541 | dev_kfree_skb(skb); |
544 | spin_unlock_irqrestore(&self->lock, flags); | 542 | spin_unlock_irqrestore(&self->lock, flags); |
545 | return err; /* Usually 1 */ | 543 | return NETDEV_TX_OK; |
546 | } | 544 | } |
547 | 545 | ||
548 | /*------------------------------------------------------------------*/ | 546 | /*------------------------------------------------------------------*/ |
diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c index 9d813bc4502e..c3e4e2c435ba 100644 --- a/drivers/net/irda/kingsun-sir.c +++ b/drivers/net/irda/kingsun-sir.c | |||
@@ -156,9 +156,6 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
156 | int wraplen; | 156 | int wraplen; |
157 | int ret = 0; | 157 | int ret = 0; |
158 | 158 | ||
159 | if (skb == NULL || netdev == NULL) | ||
160 | return -EINVAL; | ||
161 | |||
162 | netif_stop_queue(netdev); | 159 | netif_stop_queue(netdev); |
163 | 160 | ||
164 | /* the IRDA wrapping routines don't deal with non linear skb */ | 161 | /* the IRDA wrapping routines don't deal with non linear skb */ |
@@ -197,7 +194,7 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
197 | dev_kfree_skb(skb); | 194 | dev_kfree_skb(skb); |
198 | spin_unlock(&kingsun->lock); | 195 | spin_unlock(&kingsun->lock); |
199 | 196 | ||
200 | return ret; | 197 | return NETDEV_TX_OK; |
201 | } | 198 | } |
202 | 199 | ||
203 | /* Receive callback function */ | 200 | /* Receive callback function */ |
diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c index b6ffe9715b61..d73b8b64fcb9 100644 --- a/drivers/net/irda/ks959-sir.c +++ b/drivers/net/irda/ks959-sir.c | |||
@@ -391,9 +391,6 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
391 | unsigned int wraplen; | 391 | unsigned int wraplen; |
392 | int ret = 0; | 392 | int ret = 0; |
393 | 393 | ||
394 | if (skb == NULL || netdev == NULL) | ||
395 | return -EINVAL; | ||
396 | |||
397 | netif_stop_queue(netdev); | 394 | netif_stop_queue(netdev); |
398 | 395 | ||
399 | /* the IRDA wrapping routines don't deal with non linear skb */ | 396 | /* the IRDA wrapping routines don't deal with non linear skb */ |
@@ -428,7 +425,7 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
428 | dev_kfree_skb(skb); | 425 | dev_kfree_skb(skb); |
429 | spin_unlock(&kingsun->lock); | 426 | spin_unlock(&kingsun->lock); |
430 | 427 | ||
431 | return ret; | 428 | return NETDEV_TX_OK; |
432 | } | 429 | } |
433 | 430 | ||
434 | /* Receive callback function */ | 431 | /* Receive callback function */ |
diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c index 64df27f2bfd4..1ef45ec74422 100644 --- a/drivers/net/irda/ksdazzle-sir.c +++ b/drivers/net/irda/ksdazzle-sir.c | |||
@@ -304,9 +304,6 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
304 | unsigned int wraplen; | 304 | unsigned int wraplen; |
305 | int ret = 0; | 305 | int ret = 0; |
306 | 306 | ||
307 | if (skb == NULL || netdev == NULL) | ||
308 | return -EINVAL; | ||
309 | |||
310 | netif_stop_queue(netdev); | 307 | netif_stop_queue(netdev); |
311 | 308 | ||
312 | /* the IRDA wrapping routines don't deal with non linear skb */ | 309 | /* the IRDA wrapping routines don't deal with non linear skb */ |
@@ -341,7 +338,7 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
341 | dev_kfree_skb(skb); | 338 | dev_kfree_skb(skb); |
342 | spin_unlock(&kingsun->lock); | 339 | spin_unlock(&kingsun->lock); |
343 | 340 | ||
344 | return ret; | 341 | return NETDEV_TX_OK; |
345 | } | 342 | } |
346 | 343 | ||
347 | /* Receive callback function */ | 344 | /* Receive callback function */ |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index fac504d0cfd8..f4df1001983c 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -824,10 +824,6 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
824 | int wraplen; | 824 | int wraplen; |
825 | int ret = 0; | 825 | int ret = 0; |
826 | 826 | ||
827 | |||
828 | if (skb == NULL || ndev == NULL) | ||
829 | return -EINVAL; | ||
830 | |||
831 | netif_stop_queue(ndev); | 827 | netif_stop_queue(ndev); |
832 | mcs = netdev_priv(ndev); | 828 | mcs = netdev_priv(ndev); |
833 | 829 | ||
@@ -870,7 +866,7 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
870 | 866 | ||
871 | dev_kfree_skb(skb); | 867 | dev_kfree_skb(skb); |
872 | spin_unlock_irqrestore(&mcs->lock, flags); | 868 | spin_unlock_irqrestore(&mcs->lock, flags); |
873 | return ret; | 869 | return NETDEV_TX_OK; |
874 | } | 870 | } |
875 | 871 | ||
876 | static const struct net_device_ops mcs_netdev_ops = { | 872 | static const struct net_device_ops mcs_netdev_ops = { |