mirror of
https://github.com/opnsense/src.git
synced 2026-02-22 09:21:31 -05:00
Handle cas failure when the compare succeeds
When locking a priority inherit mutex we perform a compare and swap operation to try and acquire the mutex. This may fail even when the compare succeeds. Check and handle this case. PR: 263825 Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35150
This commit is contained in:
parent
190abf86bb
commit
11a6ecd425
1 changed files with 11 additions and 0 deletions
|
|
@ -2262,6 +2262,17 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags,
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Nobody owns it, but the acquire failed. This can happen
|
||||
* with ll/sc atomics.
|
||||
*/
|
||||
if (owner == UMUTEX_UNOWNED) {
|
||||
error = thread_check_susp(td, true);
|
||||
if (error != 0)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid overwriting a possible error from sleep due
|
||||
* to the pending signal with suspension check result.
|
||||
|
|
|
|||
Loading…
Reference in a new issue