diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2009-09-16 02:42:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-16 02:42:05 -0400 |
commit | 7c64b9f3f584008000cf3b960f25cd6a68fce191 (patch) | |
tree | 2c19bff73b434b12f50304c97758a01751df9aaa /net/sched | |
parent | 926e61b7c44db83013159ac2f74bccd451607b5a (diff) |
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: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_api.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 1367aa21fad5..903e4188b6ca 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -809,7 +809,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
809 | stab = qdisc_get_stab(tca[TCA_STAB]); | 809 | stab = qdisc_get_stab(tca[TCA_STAB]); |
810 | if (IS_ERR(stab)) { | 810 | if (IS_ERR(stab)) { |
811 | err = PTR_ERR(stab); | 811 | err = PTR_ERR(stab); |
812 | goto err_out3; | 812 | goto err_out4; |
813 | } | 813 | } |
814 | sch->stab = stab; | 814 | sch->stab = stab; |
815 | } | 815 | } |
@@ -838,7 +838,6 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
838 | return sch; | 838 | return sch; |
839 | } | 839 | } |
840 | err_out3: | 840 | err_out3: |
841 | qdisc_put_stab(sch->stab); | ||
842 | dev_put(dev); | 841 | dev_put(dev); |
843 | kfree((char *) sch - sch->padded); | 842 | kfree((char *) sch - sch->padded); |
844 | err_out2: | 843 | err_out2: |
@@ -852,6 +851,7 @@ err_out4: | |||
852 | * Any broken qdiscs that would require a ops->reset() here? | 851 | * Any broken qdiscs that would require a ops->reset() here? |
853 | * The qdisc was never in action so it shouldn't be necessary. | 852 | * The qdisc was never in action so it shouldn't be necessary. |
854 | */ | 853 | */ |
854 | qdisc_put_stab(sch->stab); | ||
855 | if (ops->destroy) | 855 | if (ops->destroy) |
856 | ops->destroy(sch); | 856 | ops->destroy(sch); |
857 | goto err_out3; | 857 | goto err_out3; |