Add missing locking. Found by Coverity while scanning the usrsctp
library. MFC after: 1 week
This commit is contained in:
parent
afb908dada
commit
d28a3a393b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323904
@ -699,6 +699,14 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb)
|
||||
*/
|
||||
struct sctpasochead *head;
|
||||
|
||||
if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) ||
|
||||
(SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) {
|
||||
atomic_add_int(&stcb->asoc.refcnt, 1);
|
||||
SCTP_TCB_UNLOCK(stcb);
|
||||
SCTP_INP_INFO_WLOCK();
|
||||
SCTP_TCB_LOCK(stcb);
|
||||
atomic_subtract_int(&stcb->asoc.refcnt, 1);
|
||||
}
|
||||
if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) {
|
||||
/* generate a new vtag and send init */
|
||||
LIST_REMOVE(stcb, sctp_asocs);
|
||||
@ -710,6 +718,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb)
|
||||
*/
|
||||
LIST_INSERT_HEAD(head, stcb, sctp_asocs);
|
||||
sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED);
|
||||
SCTP_INP_INFO_WUNLOCK();
|
||||
return (1);
|
||||
}
|
||||
if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED) {
|
||||
@ -731,6 +740,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb)
|
||||
*/
|
||||
LIST_INSERT_HEAD(head, stcb, sctp_asocs);
|
||||
sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED);
|
||||
SCTP_INP_INFO_WUNLOCK();
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user