summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2005-11-30 19:01:13 +0100
committerRoland Dreier <rolandd@cisco.com>2005-11-30 19:01:13 +0100
commitde1bb1a64c29bae4f5330c70bd1dc6a62954c9f4 (patch)
tree5586b640073f5e344482246cbc4f3fa8d5662f55 /drivers/infiniband
parentIB/cm: correct reported reject code (diff)
downloadlinux-de1bb1a64c29bae4f5330c70bd1dc6a62954c9f4.tar.xz
linux-de1bb1a64c29bae4f5330c70bd1dc6a62954c9f4.zip
IB/cm: avoid reusing local ID
Use an increasing local ID to avoid re-using identifiers while messages may still be outstanding on the old ID. Without this, a quick connect-disconnect-connect sequence can fail by matching messages for the new connection with the old connection. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 1fe21865d1f2..3a611fe5497e 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -308,10 +308,11 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv)
{
unsigned long flags;
int ret;
+ static int next_id;
do {
spin_lock_irqsave(&cm.lock, flags);
- ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, 1,
+ ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, next_id++,
(__force int *) &cm_id_priv->id.local_id);
spin_unlock_irqrestore(&cm.lock, flags);
} while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) );