Skip to content

Commit edee393

Browse files
Jiri Slabydavem330
authored andcommitted
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: Jiri Slaby <[email protected]> Cc: Tristram Ha <[email protected]> Cc: David S. Miller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6ad3414 commit edee393

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ksz884x.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4899,8 +4899,10 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev)
48994899
struct sk_buff *org_skb = skb;
49004900

49014901
skb = dev_alloc_skb(org_skb->len);
4902-
if (!skb)
4903-
return NETDEV_TX_BUSY;
4902+
if (!skb) {
4903+
rc = NETDEV_TX_BUSY;
4904+
goto unlock;
4905+
}
49044906
skb_copy_and_csum_dev(org_skb, skb->data);
49054907
org_skb->ip_summed = 0;
49064908
skb->len = org_skb->len;
@@ -4914,7 +4916,7 @@ static int netdev_tx(struct sk_buff *skb, struct net_device *dev)
49144916
netif_stop_queue(dev);
49154917
rc = NETDEV_TX_BUSY;
49164918
}
4917-
4919+
unlock:
49184920
spin_unlock_irq(&hw_priv->hwlock);
49194921

49204922
return rc;

0 commit comments

Comments
 (0)