Skip to content

Commit

Permalink
sch_mqprio: Always set num_tc to 0 in mqprio_destroy()
Browse files Browse the repository at this point in the history
All the cleanup code in mqprio_destroy() is currently conditional on
priv->qdiscs being non-null, but that condition should only apply to
the per-queue qdisc cleanup.  We should always set the number of
traffic classes back to 0 here.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
  • Loading branch information
Ben Hutchings committed Feb 14, 2011
1 parent 263fb5b commit ac7100b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions net/sched/sch_mqprio.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ static void mqprio_destroy(struct Qdisc *sch)
struct mqprio_sched *priv = qdisc_priv(sch);
unsigned int ntx;

if (!priv->qdiscs)
return;

for (ntx = 0; ntx < dev->num_tx_queues && priv->qdiscs[ntx]; ntx++)
qdisc_destroy(priv->qdiscs[ntx]);
if (priv->qdiscs) {
for (ntx = 0;
ntx < dev->num_tx_queues && priv->qdiscs[ntx];
ntx++)
qdisc_destroy(priv->qdiscs[ntx]);
kfree(priv->qdiscs);
}

if (priv->hw_owned && dev->netdev_ops->ndo_setup_tc)
dev->netdev_ops->ndo_setup_tc(dev, 0);
else
netdev_set_num_tc(dev, 0);

kfree(priv->qdiscs);
}

static int mqprio_parse_opt(struct net_device *dev, struct tc_mqprio_qopt *qopt)
Expand Down

0 comments on commit ac7100b

Please sign in to comment.