Repository navigation
call_center: check the online agents list under the lock in cc_timer_agents - #4536
Open
patrickcmartins wants to merge 1 commit into
Open
patrickcmartins wants to merge 1 commit into
patrickcmartins wants to merge 1 commit into
Conversation
…agents The empty-list check ran before lock_get(). If the last online agent logged out in between, the do/while loop dereferenced a NULL agent (SIGSEGV at agent->state). Fixes OpenSIPS#4523
|
Thanks for picking this up. I reviewed the change against the core dump behind #4523 and it addresses the race we found:
A note for the maintainers: we run the 3.6 packages from apt.opensips.org, so a backport to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4523
cc_timer_agents()checkeddata->agents[CC_AG_ONLINE]for NULL beforelock_get(data->lock). If another process logged out the last online agent between the check and the lock, thedo { } whileloop dereferenced a NULLagent(agent->state, the SIGSEGV in the issue's backtrace).This moves the empty-list check under the lock and releases the lock before returning. The
data == NULLcheck stays before the lock.This is the fix suggested in the issue. It's a small change, but I couldn't reproduce the race locally (it's timing-dependent).