All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: netdev@vger.kernel.org
Cc: Jeff Garzik <jgarzik@pobox.com>, Jay Vosburgh <fubar@us.ibm.com>
Subject: [PATCH 2/4] bonding: fix error unwind in bonding_store_bonds
Date: Fri,  2 May 2008 17:49:38 -0700	[thread overview]
Message-ID: <12097757832778-git-send-email-fubar@us.ibm.com> (raw)
In-Reply-To: <12097757822222-git-send-email-fubar@us.ibm.com>

	Fixed an error unwind in bonding_store_bonds that didn't release
the locks it held, and consolidated unwinds into a common block at the
end of the function.  Bug reported by Pavel Emelyanov <xemul@openvz.org>,
who provided a different fix.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
 drivers/net/bonding/bond_sysfs.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 979c2d0..68c41a0 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -146,29 +146,29 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
 						": Unable remove bond %s due to open references.\n",
 						ifname);
 					res = -EPERM;
-					goto out;
+					goto out_unlock;
 				}
 				printk(KERN_INFO DRV_NAME
 					": %s is being deleted...\n",
 					bond->dev->name);
 				bond_destroy(bond);
-				up_write(&bonding_rwsem);
-				rtnl_unlock();
-				goto out;
+				goto out_unlock;
 			}
 
 		printk(KERN_ERR DRV_NAME
 			": unable to delete non-existent bond %s\n", ifname);
 		res = -ENODEV;
-		up_write(&bonding_rwsem);
-		rtnl_unlock();
-		goto out;
+		goto out_unlock;
 	}
 
 err_no_cmd:
 	printk(KERN_ERR DRV_NAME
 		": no command found in bonding_masters. Use +ifname or -ifname.\n");
-	res = -EPERM;
+	return -EPERM;
+
+out_unlock:
+	up_write(&bonding_rwsem);
+	rtnl_unlock();
 
 	/* Always return either count or an error.  If you return 0, you'll
 	 * get called forever, which is bad.
-- 
1.5.2.4


  reply	other threads:[~2008-05-03  0:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-03  0:49 [PATCH 0/4] bonding: bug fixes for 2.6.26 Jay Vosburgh
2008-05-03  0:49 ` [PATCH 1/4] bonding: Do not call free_netdev for already registered device Jay Vosburgh
2008-05-03  0:49   ` Jay Vosburgh [this message]
2008-05-03  0:49     ` [PATCH 3/4] bonding: Deadlock between bonding_store_bonds and bond_destroy_sysfs Jay Vosburgh
2008-05-03  0:49       ` [PATCH 4/4] bonding: fix enslavement error unwinds Jay Vosburgh
2008-05-03  0:52         ` David Miller
2008-05-03  1:06           ` [PATCH REPOST " Jay Vosburgh
2008-05-03  1:07             ` David Miller
2008-05-03  0:51       ` [PATCH 3/4] bonding: Deadlock between bonding_store_bonds and bond_destroy_sysfs David Miller
2008-05-03  0:51     ` [PATCH 2/4] bonding: fix error unwind in bonding_store_bonds David Miller
2008-05-03  0:51   ` [PATCH 1/4] bonding: Do not call free_netdev for already registered device David Miller
2008-05-06 16:17   ` Jeff Garzik

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=12097757832778-git-send-email-fubar@us.ibm.com \
    --to=fubar@us.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.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 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.