Skip to content

Commit

Permalink
NET: ksz884x, fix lock imbalance
Browse files Browse the repository at this point in the history
Stanse found that one error path (when alloc_skb fails) in netdev_tx
omits to unlock hw_priv->hwlock. Fix that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tristram Ha <Tristram.Ha@micrel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Slaby authored and David S. Miller committed Mar 16, 2010
1 parent 6ad3414 commit edee393
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ksz884x.c
Original file line number Diff line number Diff line change
Expand Up @@ -4899,8 +4899,10 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *org_skb = skb;

skb = dev_alloc_skb(org_skb->len);
if (!skb)
return NETDEV_TX_BUSY;
if (!skb) {
rc = NETDEV_TX_BUSY;
goto unlock;
}
skb_copy_and_csum_dev(org_skb, skb->data);
org_skb->ip_summed = 0;
skb->len = org_skb->len;
Expand All @@ -4914,7 +4916,7 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev);
rc = NETDEV_TX_BUSY;
}

unlock:
spin_unlock_irq(&hw_priv->hwlock);

return rc;
Expand Down

0 comments on commit edee393

Please sign in to comment.