[Coverity][UR] Potential double-unlock of a mutex in the L0 adapter
- Dominant language
- LLVM
- Stars
- 1.5k
- Forks
- 854
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 137
Description
Reported by Coverity as CID `520793`, you can access Coverity results here: https://scan.coverity.com/projects/intel-llvm?tab=overview
The following piece of code:
https://github.com/intel/llvm/blob/faa61805224a993f8f9de6214ba0678afc9e53e4/unified-runtime/source/adapters/level_zero/event.cpp#L1585-L1588
Is located within a loop:
https://github.com/intel/llvm/blob/faa61805224a993f8f9de6214ba0678afc9e53e4/unified-runtime/source/adapters/level_zero/event.cpp#L1552-L1553
Meaning, that we may call `CurQueue->Mutex.unlock();` multiple times. That mutex is a [`std::shared_mutex`](https://en.cppreference.com/w/cpp/thread/shared_mutex.html) whose [`unlock`](https://en.cppreference.com/w/cpp/thread/shared_mutex/unlock.html) method behavior is undefined if a mutex is already unlocked.
Contributor guide
Assessment
This issue has not been assessed yet.