Netdev List
 help / color / mirror / Atom feed
From: Radheka Godse <radheka.godse@intel.com>
To: fubar@us.ibm.com, bonding-devel@lists.sourceforge.net
Cc: netdev@oss.sgi.com
Subject: [PATCH 2.6.13-rc1 6/17] bonding: ALB init kmalloc inside spinlock bugfix
Date: Fri, 1 Jul 2005 13:45:56 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0507011343260.17459@localhost.localdomain> (raw)

This patch corrects bug in ALB init where kmalloc called inside a held
lock causes stacdump in debug mode

Signed-off-by: Radheka Godse <radheka.godse@intel.com>
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>

diff -urN -X dontdiff linux-2.6.12post/drivers/net/bonding/bond_alb.c linux-2.6.12post-sysfs/drivers/net/bonding/bond_alb.c
--- linux-2.6.12post/drivers/net/bonding/bond_alb.c	2005-06-17 12:48:29.000000000 -0700
+++ linux-2.6.12post-sysfs/drivers/net/bonding/bond_alb.c	2005-06-28 18:21:35.000000000 -0700
@@ -198,20 +198,21 @@
  {
  	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
  	int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info);
+	struct tlb_client_info *new_hashtbl;
  	int i;

  	spin_lock_init(&(bond_info->tx_hashtbl_lock));

-	_lock_tx_hashtbl(bond);
-
-	bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL);
-	if (!bond_info->tx_hashtbl) {
+	new_hashtbl = kmalloc(size, GFP_KERNEL);
+	if (!new_hashtbl) {
  		printk(KERN_ERR DRV_NAME
  		       ": Error: %s: Failed to allocate TLB hash table\n",
  		       bond->dev->name);
-		_unlock_tx_hashtbl(bond);
  		return -1;
  	}
+	_lock_tx_hashtbl(bond);
+
+	bond_info->tx_hashtbl = new_hashtbl;

  	memset(bond_info->tx_hashtbl, 0, size);

@@ -798,21 +801,22 @@
  {
  	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
  	struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type);
+	struct rlb_client_info	*new_hashtbl;
  	int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info);
  	int i;

  	spin_lock_init(&(bond_info->rx_hashtbl_lock));

-	_lock_rx_hashtbl(bond);
-
-	bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL);
-	if (!bond_info->rx_hashtbl) {
+	new_hashtbl = kmalloc(size, GFP_KERNEL);
+	if (!new_hashtbl) {
  		printk(KERN_ERR DRV_NAME
  		       ": Error: %s: Failed to allocate RLB hash table\n",
  		       bond->dev->name);
-		_unlock_rx_hashtbl(bond);
  		return -1;
  	}
+	_lock_rx_hashtbl(bond);
+
+	bond_info->rx_hashtbl = new_hashtbl;

  	bond_info->rx_hashtbl_head = RLB_NULL_INDEX;

                 reply	other threads:[~2005-07-01 20:45 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=Pine.LNX.4.61.0507011343260.17459@localhost.localdomain \
    --to=radheka.godse@intel.com \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=fubar@us.ibm.com \
    --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