Commit 7c64b9f3 authored by Jarek Poplawski's avatar Jarek Poplawski Committed by David S. Miller
Browse files

pkt_sched: Fix qdisc_create on stab error handling



If qdisc_get_stab returns error in qdisc_create there is skipped qdisc
ops->destroy, which is necessary because it's after ops->init at the
moment, so memory leaks are quite probable.

Signed-off-by: default avatarJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 926e61b7
...@@ -809,7 +809,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, ...@@ -809,7 +809,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
stab = qdisc_get_stab(tca[TCA_STAB]); stab = qdisc_get_stab(tca[TCA_STAB]);
if (IS_ERR(stab)) { if (IS_ERR(stab)) {
err = PTR_ERR(stab); err = PTR_ERR(stab);
goto err_out3; goto err_out4;
} }
sch->stab = stab; sch->stab = stab;
} }
...@@ -838,7 +838,6 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, ...@@ -838,7 +838,6 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
return sch; return sch;
} }
err_out3: err_out3:
qdisc_put_stab(sch->stab);
dev_put(dev); dev_put(dev);
kfree((char *) sch - sch->padded); kfree((char *) sch - sch->padded);
err_out2: err_out2:
...@@ -852,6 +851,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, ...@@ -852,6 +851,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
* Any broken qdiscs that would require a ops->reset() here? * Any broken qdiscs that would require a ops->reset() here?
* The qdisc was never in action so it shouldn't be necessary. * The qdisc was never in action so it shouldn't be necessary.
*/ */
qdisc_put_stab(sch->stab);
if (ops->destroy) if (ops->destroy)
ops->destroy(sch); ops->destroy(sch);
goto err_out3; goto err_out3;
......
Supports Markdown
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