mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Fix a locking issue found by stress testing with tsctp.
The inp read lock neeeds to be held when considering control->do_not_ref_stcb. MFC after: 3 days
This commit is contained in:
parent
bfa4e93d35
commit
9c5ca6f247
1 changed files with 12 additions and 8 deletions
|
|
@ -5497,20 +5497,16 @@ restart_nosblocks:
|
|||
}
|
||||
/* Clear the held length since there is something to read */
|
||||
control->held_length = 0;
|
||||
if (hold_rlock) {
|
||||
SCTP_INP_READ_UNLOCK(inp);
|
||||
hold_rlock = 0;
|
||||
}
|
||||
found_one:
|
||||
/*
|
||||
* If we reach here, control has a some data for us to read off.
|
||||
* Note that stcb COULD be NULL.
|
||||
*/
|
||||
control->some_taken++;
|
||||
if (hold_sblock) {
|
||||
SOCKBUF_UNLOCK(&so->so_rcv);
|
||||
hold_sblock = 0;
|
||||
if (hold_rlock == 0) {
|
||||
hold_rlock = 1;
|
||||
SCTP_INP_READ_LOCK(inp);
|
||||
}
|
||||
control->some_taken++;
|
||||
stcb = control->stcb;
|
||||
if (stcb) {
|
||||
if ((control->do_not_ref_stcb == 0) &&
|
||||
|
|
@ -5684,6 +5680,14 @@ found_one:
|
|||
}
|
||||
#endif
|
||||
}
|
||||
if (hold_rlock) {
|
||||
SCTP_INP_READ_UNLOCK(inp);
|
||||
hold_rlock = 0;
|
||||
}
|
||||
if (hold_sblock) {
|
||||
SOCKBUF_UNLOCK(&so->so_rcv);
|
||||
hold_sblock = 0;
|
||||
}
|
||||
/* now copy out what data we can */
|
||||
if (mp == NULL) {
|
||||
/* copy out each mbuf in the chain up to length */
|
||||
|
|
|
|||
Loading…
Reference in a new issue