netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com, jamal <hadi@cyberus.ca>
Subject: [PATCH 2.6]: Fix device leaks in mirred action
Date: Thu, 04 Nov 2004 07:30:02 +0100	[thread overview]
Message-ID: <4189CC6A.9040007@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

When a mirred action is created it takes two references to the
device (dev_get_by_index + dev_hold), but only drops one when
it gets destroyed. It also leaks a reference when a mirred action
is replaced.



[-- Attachment #2: x --]
[-- Type: text/plain, Size: 793 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/04 07:28:30+01:00 kaber@coreworks.de 
#   [PKT_SCHED]: Fix device leaks in mirred action
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/sched/mirred.c
#   2004/11/04 07:28:24+01:00 kaber@coreworks.de +2 -1
#   [PKT_SCHED]: Fix device leaks in mirred action
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/sched/mirred.c b/net/sched/mirred.c
--- a/net/sched/mirred.c	2004-11-04 07:28:59 +01:00
+++ b/net/sched/mirred.c	2004-11-04 07:28:59 +01:00
@@ -138,8 +138,9 @@
 		p->eaction = parm->eaction;
 		if (parm->ifindex) {
 			p->ifindex = parm->ifindex;
+			if (ovr)
+				dev_put(p->dev);
 			p->dev = dev;
-			dev_hold(p->dev); 
 		}
 		spin_unlock(&p->lock);
 	}

             reply	other threads:[~2004-11-04  6:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-04  6:30 Patrick McHardy [this message]
2004-11-04 13:53 ` [PATCH 2.6]: Fix device leaks in mirred action jamal
2004-11-04 14:58   ` Patrick McHardy
2004-11-04 15:23     ` jamal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4189CC6A.9040007@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.com \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).