diff options
-rw-r--r-- | net/sctp/associola.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 6e96f83570c9..df5abbff63e2 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -63,6 +63,12 @@ | |||
63 | static void sctp_assoc_bh_rcv(struct work_struct *work); | 63 | static void sctp_assoc_bh_rcv(struct work_struct *work); |
64 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); | 64 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); |
65 | 65 | ||
66 | /* Keep track of the new idr low so that we don't re-use association id | ||
67 | * numbers too fast. It is protected by they idr spin lock is in the | ||
68 | * range of 1 - INT_MAX. | ||
69 | */ | ||
70 | static u32 idr_low = 1; | ||
71 | |||
66 | 72 | ||
67 | /* 1st Level Abstractions. */ | 73 | /* 1st Level Abstractions. */ |
68 | 74 | ||
@@ -1553,7 +1559,12 @@ retry: | |||
1553 | 1559 | ||
1554 | spin_lock_bh(&sctp_assocs_id_lock); | 1560 | spin_lock_bh(&sctp_assocs_id_lock); |
1555 | error = idr_get_new_above(&sctp_assocs_id, (void *)asoc, | 1561 | error = idr_get_new_above(&sctp_assocs_id, (void *)asoc, |
1556 | 1, &assoc_id); | 1562 | idr_low, &assoc_id); |
1563 | if (!error) { | ||
1564 | idr_low = assoc_id + 1; | ||
1565 | if (idr_low == INT_MAX) | ||
1566 | idr_low = 1; | ||
1567 | } | ||
1557 | spin_unlock_bh(&sctp_assocs_id_lock); | 1568 | spin_unlock_bh(&sctp_assocs_id_lock); |
1558 | if (error == -EAGAIN) | 1569 | if (error == -EAGAIN) |
1559 | goto retry; | 1570 | goto retry; |