* [PATCH 2.6 1/7]: Fix module leak in tc_ctl_tfilter error path
@ 2004-10-03 21:12 Patrick McHardy
0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2004-10-03 21:12 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 54 bytes --]
When tp_ops->init fails we leak a module reference.
[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 968 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/03 20:25:10+02:00 kaber@coreworks.de
# [NET_SCHED]: Fix module leak in tc_ctl_tfilter error path
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/sched/cls_api.c
# 2004/10/03 20:24:47+02:00 kaber@coreworks.de +6 -2
# [NET_SCHED]: Fix module leak in tc_ctl_tfilter error path
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/net/sched/cls_api.c b/net/sched/cls_api.c
--- a/net/sched/cls_api.c 2004-10-03 22:18:04 +02:00
+++ b/net/sched/cls_api.c 2004-10-03 22:18:04 +02:00
@@ -231,8 +231,12 @@
tp->classify = tp_ops->classify;
tp->classid = parent;
err = -EBUSY;
- if (!try_module_get(tp_ops->owner) ||
- (err = tp_ops->init(tp)) != 0) {
+ if (!try_module_get(tp_ops->owner)) {
+ kfree(tp);
+ goto errout;
+ }
+ if ((err = tp_ops->init(tp)) != 0) {
+ module_put(tp_ops->owner);
kfree(tp);
goto errout;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-10-03 21:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-03 21:12 [PATCH 2.6 1/7]: Fix module leak in tc_ctl_tfilter error path Patrick McHardy
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.