From: Roland Dreier <roland@topspin.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH][10/11] IB/ipoib: don't call ipoib_put_ah with lock held
Date: Wed, 2 Mar 2005 21:31:22 -0800 [thread overview]
Message-ID: <2005322131.HYDDjSPPN3QdHwmF@topspin.com> (raw)
In-Reply-To: <2005322131.kDy0lnKe0rjDV0tv@topspin.com>
From: Shirley Ma <xma@us.ibm.com>
ipoib_put_ah() may call ipoib_free_ah(), which might take the device's
lock. Therefore we need to make sure we don't call ipoib_put_ah()
when holding the lock already.
Signed-off-by: Shirley Ma <xma@us.ibm.com>
Signed-off-by: Roland Dreier <roland@topspin.com>
--- linux-export.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c 2005-03-02 20:26:13.653524436 -0800
+++ linux-export/drivers/infiniband/ulp/ipoib/ipoib_main.c 2005-03-02 20:26:13.977454122 -0800
@@ -661,6 +661,7 @@
struct ipoib_neigh *neigh = *to_ipoib_neigh(n);
struct ipoib_dev_priv *priv = netdev_priv(n->dev);
unsigned long flags;
+ struct ipoib_ah *ah = NULL;
ipoib_dbg(priv,
"neigh_destructor for %06x " IPOIB_GID_FMT "\n",
@@ -671,13 +672,16 @@
if (neigh) {
if (neigh->ah)
- ipoib_put_ah(neigh->ah);
+ ah = neigh->ah;
list_del(&neigh->list);
*to_ipoib_neigh(n) = NULL;
kfree(neigh);
}
spin_unlock_irqrestore(&priv->lock, flags);
+
+ if (ah)
+ ipoib_put_ah(ah);
}
static int ipoib_neigh_setup(struct neighbour *neigh)
--- linux-export.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2005-03-02 20:26:12.799709771 -0800
+++ linux-export/drivers/infiniband/ulp/ipoib/ipoib_multicast.c 2005-03-02 20:26:13.977454122 -0800
@@ -93,6 +93,8 @@
struct ipoib_dev_priv *priv = netdev_priv(dev);
struct ipoib_neigh *neigh, *tmp;
unsigned long flags;
+ LIST_HEAD(ah_list);
+ struct ipoib_ah *ah, *tah;
ipoib_dbg_mcast(netdev_priv(dev),
"deleting multicast group " IPOIB_GID_FMT "\n",
@@ -101,7 +103,8 @@
spin_lock_irqsave(&priv->lock, flags);
list_for_each_entry_safe(neigh, tmp, &mcast->neigh_list, list) {
- ipoib_put_ah(neigh->ah);
+ if (neigh->ah)
+ list_add_tail(&neigh->ah->list, &ah_list);
*to_ipoib_neigh(neigh->neighbour) = NULL;
neigh->neighbour->ops->destructor = NULL;
kfree(neigh);
@@ -109,6 +112,9 @@
spin_unlock_irqrestore(&priv->lock, flags);
+ list_for_each_entry_safe(ah, tah, &ah_list, list)
+ ipoib_put_ah(ah);
+
if (mcast->ah)
ipoib_put_ah(mcast->ah);
next prev parent reply other threads:[~2005-03-03 6:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-03 5:31 [PATCH][0/11] InfiniBand fixes Roland Dreier
2005-03-03 5:31 ` [PATCH][1/11] IB: simplify MAD code Roland Dreier
2005-03-03 5:31 ` [PATCH][2/11] IB: fix vendor MAD deregistration Roland Dreier
2005-03-03 5:31 ` [PATCH][3/11] IB: sparse fixes Roland Dreier
2005-03-03 5:31 ` [PATCH][4/11] IB/mthca: add missing break Roland Dreier
2005-03-03 5:31 ` [PATCH][5/11] IB/mthca: fix reset value endianness Roland Dreier
2005-03-03 5:31 ` [PATCH][6/11] IB/ipoib: fix rx memory leak Roland Dreier
2005-03-03 5:31 ` [PATCH][7/11] IB/ipoib: use list_for_each_entry_safe when required Roland Dreier
2005-03-03 5:31 ` [PATCH][8/11] IB/ipoib: rename global symbols Roland Dreier
2005-03-03 5:31 ` [PATCH][9/11] IB/ipoib: small fixes Roland Dreier
2005-03-03 5:31 ` Roland Dreier [this message]
2005-03-03 5:31 ` [PATCH][11/11] IB/ipoib: fix locking on path deletion Roland Dreier
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=2005322131.HYDDjSPPN3QdHwmF@topspin.com \
--to=roland@topspin.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.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
all inboxes | Powered by JetHome®