X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fsctp%2Fsm_make_chunk.c;h=c2ca732595fa025d5f723ad79ff0e4ba15578d7b;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=b80ea903b610ec4ebc128cd0bb3c25a0f7d1d566;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index b80ea903b..c2ca73259 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1834,23 +1834,27 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, /* Allocate storage for the negotiated streams if it is not a temporary * association. */ if (!asoc->temp) { - sctp_assoc_t assoc_id; + int assoc_id; + int error; asoc->ssnmap = sctp_ssnmap_new(asoc->c.sinit_max_instreams, asoc->c.sinit_num_ostreams, gfp); if (!asoc->ssnmap) goto clean_up; - do { - if (unlikely(!idr_pre_get(&sctp_assocs_id, gfp))) - goto clean_up; - spin_lock_bh(&sctp_assocs_id_lock); - assoc_id = (sctp_assoc_t)idr_get_new(&sctp_assocs_id, - (void *)asoc); - spin_unlock_bh(&sctp_assocs_id_lock); - } while (unlikely((int)assoc_id == -1)); + retry: + if (unlikely(!idr_pre_get(&sctp_assocs_id, gfp))) + goto clean_up; + spin_lock_bh(&sctp_assocs_id_lock); + error = idr_get_new_above(&sctp_assocs_id, (void *)asoc, 1, + &assoc_id); + spin_unlock_bh(&sctp_assocs_id_lock); + if (error == -EAGAIN) + goto retry; + else if (error) + goto clean_up; - asoc->assoc_id = assoc_id; + asoc->assoc_id = (sctp_assoc_t) assoc_id; } /* ADDIP Section 4.1 ASCONF Chunk Procedures