Commit edee3932 authored by Jiri Slaby's avatar Jiri Slaby Committed by David S. Miller

NET: ksz884x, fix lock imbalance

Stanse found that one error path (when alloc_skb fails) in netdev_tx
omits to unlock hw_priv->hwlock. Fix that.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Tristram Ha <Tristram.Ha@micrel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ad34145
...@@ -4899,8 +4899,10 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -4899,8 +4899,10 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *org_skb = skb; struct sk_buff *org_skb = skb;
skb = dev_alloc_skb(org_skb->len); skb = dev_alloc_skb(org_skb->len);
if (!skb) if (!skb) {
return NETDEV_TX_BUSY; rc = NETDEV_TX_BUSY;
goto unlock;
}
skb_copy_and_csum_dev(org_skb, skb->data); skb_copy_and_csum_dev(org_skb, skb->data);
org_skb->ip_summed = 0; org_skb->ip_summed = 0;
skb->len = org_skb->len; skb->len = org_skb->len;
...@@ -4914,7 +4916,7 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -4914,7 +4916,7 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
rc = NETDEV_TX_BUSY; rc = NETDEV_TX_BUSY;
} }
unlock:
spin_unlock_irq(&hw_priv->hwlock); spin_unlock_irq(&hw_priv->hwlock);
return rc; return rc;
......
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