]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NET: ksz884x, fix lock imbalance
authorJiri Slaby <jslaby@suse.cz>
Tue, 16 Mar 2010 04:53:50 +0000 (04:53 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Mar 2010 21:15:41 +0000 (14:15 -0700)
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>
drivers/net/ksz884x.c

index 7264a3e5c2c0880316576a00680815634da25ad5..0f59099ee72f8d504d314ef41af592d377f58795 100644 (file)
@@ -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;
@@ -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;