Skip to content

Commit

Permalink
sched: qdisc_reset_all_tx is calling qdisc_reset without qdisc_lock
Browse files Browse the repository at this point in the history
When calling qdisc_reset() the qdisc lock needs to be held.  In
this case there is at least one driver i4l which is using this
without holding the lock.  Add the locking here.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
John Fastabend authored and David S. Miller committed Jul 3, 2010
1 parent 7ae80ab commit 4ef6acf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,16 @@ extern void tcf_destroy_chain(struct tcf_proto **fl);
static inline void qdisc_reset_all_tx(struct net_device *dev)
{
unsigned int i;
for (i = 0; i < dev->num_tx_queues; i++)
qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc);
struct Qdisc *qdisc;

for (i = 0; i < dev->num_tx_queues; i++) {
qdisc = netdev_get_tx_queue(dev, i)->qdisc;
if (qdisc) {
spin_lock_bh(qdisc_lock(qdisc));
qdisc_reset(qdisc);
spin_unlock_bh(qdisc_lock(qdisc));
}
}
}

/* Are all TX queues of the device empty? */
Expand Down

0 comments on commit 4ef6acf

Please sign in to comment.