Skip to content

Commit 20e7c4e

Browse files
edumazetdavem330
authored andcommitted
6lowpan: fix lockdep splats
When a device ndo_start_xmit() calls again dev_queue_xmit(), lockdep can complain because dev_queue_xmit() is re-entered and the spinlocks protecting tx queues share a common lockdep class. Same issue was fixed for bonding/l2tp/ppp in commits 0daa230 ("[PATCH] bonding: lockdep annotation") 49ee492 ("bonding: set qdisc_tx_busylock to avoid LOCKDEP splat") 23d3b8b ("net: qdisc busylock needs lockdep annotations ") 303c07d ("ppp: set qdisc_tx_busylock to avoid LOCKDEP splat ") Reported-by: Alexander Aring <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Tested-by: Alexander Aring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3e5ccc2 commit 20e7c4e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

net/ieee802154/6lowpan.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,27 @@ static struct header_ops lowpan_header_ops = {
530530
.create = lowpan_header_create,
531531
};
532532

533+
static struct lock_class_key lowpan_tx_busylock;
534+
static struct lock_class_key lowpan_netdev_xmit_lock_key;
535+
536+
static void lowpan_set_lockdep_class_one(struct net_device *dev,
537+
struct netdev_queue *txq,
538+
void *_unused)
539+
{
540+
lockdep_set_class(&txq->_xmit_lock,
541+
&lowpan_netdev_xmit_lock_key);
542+
}
543+
544+
545+
static int lowpan_dev_init(struct net_device *dev)
546+
{
547+
netdev_for_each_tx_queue(dev, lowpan_set_lockdep_class_one, NULL);
548+
dev->qdisc_tx_busylock = &lowpan_tx_busylock;
549+
return 0;
550+
}
551+
533552
static const struct net_device_ops lowpan_netdev_ops = {
553+
.ndo_init = lowpan_dev_init,
534554
.ndo_start_xmit = lowpan_xmit,
535555
.ndo_set_mac_address = lowpan_set_address,
536556
};

0 commit comments

Comments
 (0)