Ethernet Bridge development
 help / color / mirror / Atom feed
From: "Volodymyr G. Lukiianyk" <volodymyrgl@gmail.com>
To: bridge@lists.linux-foundation.org,
	Stephen Hemminger <shemminger@linux-foundation.org>
Subject: [Bridge] [PATCH] bridge: fix error handling in br_add_if()
Date: Tue, 18 Mar 2008 21:39:07 +0200	[thread overview]
Message-ID: <47E01A5B.1070109@gmail.com> (raw)

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

When device is added to bridge its refcnt is incremented (in new_nbp()), but if
error occurs during further br_add_if() operations this counter is not
decremented back. Fix it by adding dev_put() call in the error path.

Signed-off-by: Volodymyr G Lukiianyk <volodymyrgl@gmail.com>


[-- Attachment #2: br_add_if_put_dev.diff --]
[-- Type: text/x-patch, Size: 339 bytes --]

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 298e0f4..77a981a 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -411,9 +411,12 @@ err2:
 	br_fdb_delete_by_port(br, p, 1);
 err1:
 	kobject_del(&p->kobj);
-	return err;
+	goto put_back;
 err0:
 	kobject_put(&p->kobj);
+
+put_back:
+	dev_put(dev);
 	return err;
 }
 


                 reply	other threads:[~2008-03-18 19:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47E01A5B.1070109@gmail.com \
    --to=volodymyrgl@gmail.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=shemminger@linux-foundation.org \
    /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