Commit 4d8863a2 authored by David S. Miller's avatar David S. Miller

pkt_sched: Don't hold qdisc lock over qdisc_destroy().

Based upon reports by Denys Fedoryshchenko, and feedback
and help from Jarek Poplawski and Herbert Xu.

We always either:

1) Never made an external reference to this qdisc.

or

2) Did a dev_deactivate() which purged all asynchronous
   references.

So do not lock the qdisc when we call qdisc_destroy(),
it's illegal anyways as when we drop the lock this is
free'd memory.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25bfcd5a
...@@ -638,11 +638,8 @@ static void notify_and_destroy(struct sk_buff *skb, struct nlmsghdr *n, u32 clid ...@@ -638,11 +638,8 @@ static void notify_and_destroy(struct sk_buff *skb, struct nlmsghdr *n, u32 clid
if (new || old) if (new || old)
qdisc_notify(skb, n, clid, old, new); qdisc_notify(skb, n, clid, old, new);
if (old) { if (old)
sch_tree_lock(old);
qdisc_destroy(old); qdisc_destroy(old);
sch_tree_unlock(old);
}
} }
/* Graft qdisc "new" to class "classid" of qdisc "parent" or /* Graft qdisc "new" to class "classid" of qdisc "parent" or
...@@ -1092,16 +1089,10 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) ...@@ -1092,16 +1089,10 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
graft: graft:
if (1) { if (1) {
spinlock_t *root_lock;
err = qdisc_graft(dev, p, skb, n, clid, q, NULL); err = qdisc_graft(dev, p, skb, n, clid, q, NULL);
if (err) { if (err) {
if (q) { if (q)
root_lock = qdisc_root_lock(q);
spin_lock_bh(root_lock);
qdisc_destroy(q); qdisc_destroy(q);
spin_unlock_bh(root_lock);
}
return err; return err;
} }
} }
......
...@@ -518,8 +518,6 @@ void qdisc_reset(struct Qdisc *qdisc) ...@@ -518,8 +518,6 @@ void qdisc_reset(struct Qdisc *qdisc)
} }
EXPORT_SYMBOL(qdisc_reset); EXPORT_SYMBOL(qdisc_reset);
/* Under qdisc_lock(qdisc) and BH! */
void qdisc_destroy(struct Qdisc *qdisc) void qdisc_destroy(struct Qdisc *qdisc)
{ {
const struct Qdisc_ops *ops = qdisc->ops; const struct Qdisc_ops *ops = qdisc->ops;
...@@ -712,14 +710,10 @@ static void shutdown_scheduler_queue(struct net_device *dev, ...@@ -712,14 +710,10 @@ static void shutdown_scheduler_queue(struct net_device *dev,
struct Qdisc *qdisc_default = _qdisc_default; struct Qdisc *qdisc_default = _qdisc_default;
if (qdisc) { if (qdisc) {
spinlock_t *root_lock = qdisc_lock(qdisc);
dev_queue->qdisc = qdisc_default; dev_queue->qdisc = qdisc_default;
dev_queue->qdisc_sleeping = qdisc_default; dev_queue->qdisc_sleeping = qdisc_default;
spin_lock_bh(root_lock);
qdisc_destroy(qdisc); qdisc_destroy(qdisc);
spin_unlock_bh(root_lock);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment