CWE-764

Multiple Locks of a Critical Resource

Medium

Description

The product locks a critical resource more times than intended, leading to an unexpected state in the system.

Potential Impact

How to Fix

Implementation

When locking and unlocking a resource, try to be sure that all control paths through the code in which the resource is locked one or more times correspond to exactly as many unlocks. If the software acquires a lock and then determines it is not able to perform its intended behavior, be sure to release the lock(s) before waiting for conditions to improve. Reacquire the lock(s) before trying again.

Detection Methods

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

Our security experts can help you identify and remediate CWE-764 vulnerabilities in your codebase.

Get Security Assessment