All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pkt_sched: Fix qdisc_create on stab error handling
@ 2009-09-15 18:46 Jarek Poplawski
  2009-09-16  6:42 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jarek Poplawski @ 2009-09-15 18:46 UTC (permalink / raw)
  To: David Miller; +Cc: Patrick McHardy, netdev

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>
---

 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 692d9a4..329be0c 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -804,7 +804,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
 			stab = qdisc_get_stab(tca[TCA_STAB]);
 			if (IS_ERR(stab)) {
 				err = PTR_ERR(stab);
-				goto err_out3;
+				goto err_out4;
 			}
 			sch->stab = stab;
 		}
@@ -833,7 +833,6 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
 		return sch;
 	}
 err_out3:
-	qdisc_put_stab(sch->stab);
 	dev_put(dev);
 	kfree((char *) sch - sch->padded);
 err_out2:
@@ -847,6 +846,7 @@ err_out4:
 	 * Any broken qdiscs that would require a ops->reset() here?
 	 * The qdisc was never in action so it shouldn't be necessary.
 	 */
+	qdisc_put_stab(sch->stab);
 	if (ops->destroy)
 		ops->destroy(sch);
 	goto err_out3;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pkt_sched: Fix qdisc_create on stab error handling
  2009-09-15 18:46 [PATCH] pkt_sched: Fix qdisc_create on stab error handling Jarek Poplawski
@ 2009-09-16  6:42 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-09-16  6:42 UTC (permalink / raw)
  To: jarkao2; +Cc: kaber, netdev

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Tue, 15 Sep 2009 20:46:51 +0200

> 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>

Applied, thanks a lot!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-16  6:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-15 18:46 [PATCH] pkt_sched: Fix qdisc_create on stab error handling Jarek Poplawski
2009-09-16  6:42 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.