mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Handle a race condition on >2 core machines in tcp_timer() when
a timer issues a shutdown and a simultaneous close on the socket happens. This race condition is inherent in the current socket/ inpcb life cycle system but can be handled well. Reported by: kris Tested by: kris (on 8-core machine)
This commit is contained in:
parent
2bf083e4c9
commit
f58747375d
1 changed files with 8 additions and 2 deletions
|
|
@ -386,8 +386,14 @@ shutdown:
|
|||
INP_INFO_WLOCK(&tcbinfo);
|
||||
INP_LOCK(inp);
|
||||
|
||||
/* When tp is gone we've lost the race. */
|
||||
if (inp->inp_ppcb == NULL) {
|
||||
/*
|
||||
* XXX: When our tcpcb went into TIMEWAIT, is gone or no
|
||||
* longer the one we used to work with we've lost the race.
|
||||
* This race is inherent in the current socket/inpcb life
|
||||
* cycle system.
|
||||
*/
|
||||
if ((inp->inp_vflag & INP_TIMEWAIT) || inp->inp_ppcb == NULL ||
|
||||
inp->inp_ppcb != tp) {
|
||||
CTR3(KTR_NET, "%p %s inp %p lost shutdown race",
|
||||
tp, __func__, inp);
|
||||
tcp_timer_race++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue