Commit 4bd73ae2 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

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: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3790c8cd
...@@ -994,11 +994,11 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -994,11 +994,11 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
/* change speed pending, wait for its execution */ /* change speed pending, wait for its execution */
if (self->new_speed) if (self->new_speed)
return -EBUSY; return NETDEV_TX_BUSY;
/* device stopped (apm) wait for restart */ /* device stopped (apm) wait for restart */
if (self->stopped) if (self->stopped)
return -EBUSY; return NETDEV_TX_BUSY;
toshoboe_checkstuck (self); toshoboe_checkstuck (self);
...@@ -1049,7 +1049,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -1049,7 +1049,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
if (self->txpending) if (self->txpending)
{ {
spin_unlock_irqrestore(&self->spinlock, flags); spin_unlock_irqrestore(&self->spinlock, flags);
return -EBUSY; return NETDEV_TX_BUSY;
} }
/* If in SIR mode we need to generate a string of XBOFs */ /* If in SIR mode we need to generate a string of XBOFs */
...@@ -1105,7 +1105,7 @@ dumpbufs(skb->data,skb->len,'>'); ...@@ -1105,7 +1105,7 @@ dumpbufs(skb->data,skb->len,'>');
,skb->len, self->ring->tx[self->txs].control, self->txpending); ,skb->len, self->ring->tx[self->txs].control, self->txpending);
toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX); toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX);
spin_unlock_irqrestore(&self->spinlock, flags); spin_unlock_irqrestore(&self->spinlock, flags);
return -EBUSY; return NETDEV_TX_BUSY;
} }
if (INB (OBOE_ENABLEH) & OBOE_ENABLEH_SIRON) if (INB (OBOE_ENABLEH) & OBOE_ENABLEH_SIRON)
......
...@@ -389,7 +389,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -389,7 +389,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
s32 speed; s32 speed;
s16 xbofs; s16 xbofs;
int res, mtt; int res, mtt;
int err = 1; /* Failed */
IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name); IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name);
...@@ -430,7 +429,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -430,7 +429,6 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
irda_usb_change_speed_xbofs(self); irda_usb_change_speed_xbofs(self);
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
/* Will netif_wake_queue() in callback */ /* Will netif_wake_queue() in callback */
err = 0; /* No error */
goto drop; goto drop;
} }
} }
...@@ -542,7 +540,7 @@ drop: ...@@ -542,7 +540,7 @@ drop:
/* Drop silently the skb and exit */ /* Drop silently the skb and exit */
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_unlock_irqrestore(&self->lock, flags); spin_unlock_irqrestore(&self->lock, flags);
return err; /* Usually 1 */ return NETDEV_TX_OK;
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
......
...@@ -156,9 +156,6 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -156,9 +156,6 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
int wraplen; int wraplen;
int ret = 0; int ret = 0;
if (skb == NULL || netdev == NULL)
return -EINVAL;
netif_stop_queue(netdev); netif_stop_queue(netdev);
/* the IRDA wrapping routines don't deal with non linear skb */ /* 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,7 +194,7 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_unlock(&kingsun->lock); spin_unlock(&kingsun->lock);
return ret; return NETDEV_TX_OK;
} }
/* Receive callback function */ /* Receive callback function */
......
...@@ -391,9 +391,6 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -391,9 +391,6 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
unsigned int wraplen; unsigned int wraplen;
int ret = 0; int ret = 0;
if (skb == NULL || netdev == NULL)
return -EINVAL;
netif_stop_queue(netdev); netif_stop_queue(netdev);
/* the IRDA wrapping routines don't deal with non linear skb */ /* 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,7 +425,7 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_unlock(&kingsun->lock); spin_unlock(&kingsun->lock);
return ret; return NETDEV_TX_OK;
} }
/* Receive callback function */ /* Receive callback function */
......
...@@ -304,9 +304,6 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev) ...@@ -304,9 +304,6 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
unsigned int wraplen; unsigned int wraplen;
int ret = 0; int ret = 0;
if (skb == NULL || netdev == NULL)
return -EINVAL;
netif_stop_queue(netdev); netif_stop_queue(netdev);
/* the IRDA wrapping routines don't deal with non linear skb */ /* 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,7 +338,7 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_unlock(&kingsun->lock); spin_unlock(&kingsun->lock);
return ret; return NETDEV_TX_OK;
} }
/* Receive callback function */ /* Receive callback function */
......
...@@ -824,10 +824,6 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -824,10 +824,6 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
int wraplen; int wraplen;
int ret = 0; int ret = 0;
if (skb == NULL || ndev == NULL)
return -EINVAL;
netif_stop_queue(ndev); netif_stop_queue(ndev);
mcs = netdev_priv(ndev); mcs = netdev_priv(ndev);
...@@ -870,7 +866,7 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -870,7 +866,7 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
dev_kfree_skb(skb); dev_kfree_skb(skb);
spin_unlock_irqrestore(&mcs->lock, flags); spin_unlock_irqrestore(&mcs->lock, flags);
return ret; return NETDEV_TX_OK;
} }
static const struct net_device_ops mcs_netdev_ops = { static const struct net_device_ops mcs_netdev_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment