Commit 887d200
committed
dialog: re-read state under lock before bye_on_timeout (GH-3835)
Fix A (timer removal under lock) and Fix B (cached state read at top of
dlg_ontimeout) from commit 196b51f are insufficient for a third race
path:
1. Timer fires, dlg_ontimeout reads dlg_state=CONFIRMED under lock
2. BYE arrives on another worker, next_state_dlg transitions to DELETED
(timer removal inside lock returns >0: already dequeued)
3. Timer handler still sees cached dlg_state==CONFIRMED
4. Timer enters bye_on_timeout: dlg_end_dlg() + unref_dlg(1)
5. BYE worker completes its unref chain, destroys dialog
6. Timer callbacks access freed memory -> bogus ref -1
Fix: re-read dlg->state under the hash lock immediately before each
critical decision point (rt_on_timeout route and bye_on_timeout path).
Ref: #38351 parent 196b51f commit 887d200
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2487 | 2487 | | |
2488 | 2488 | | |
2489 | 2489 | | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
2490 | 2499 | | |
2491 | 2500 | | |
2492 | 2501 | | |
| |||
2515 | 2524 | | |
2516 | 2525 | | |
2517 | 2526 | | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
2518 | 2538 | | |
2519 | 2539 | | |
2520 | 2540 | | |
| |||
0 commit comments