shunt-manager: Fix potential race between install and uninstall
If the installation fails while a shunt is concurrently uninstalled, the entry could already be destroyed when trying to remove and destroy it after acquiring the lock again in `install()`. This change handles the conflict the same way trap-manager does since69cbe2ca3f("trap-manager: Wait for install to finish before uninstalling"). Fixes:616ff9a236("shunt-manager: Remove stored entries if installation fails")
This commit is contained in:
@@ -377,6 +377,10 @@ METHOD(shunt_manager_t, uninstall, bool,
|
|||||||
entry_t *entry, *found = NULL;
|
entry_t *entry, *found = NULL;
|
||||||
|
|
||||||
this->lock->write_lock(this->lock);
|
this->lock->write_lock(this->lock);
|
||||||
|
while (this->installing)
|
||||||
|
{
|
||||||
|
this->condvar->wait(this->condvar, this->lock);
|
||||||
|
}
|
||||||
enumerator = this->shunts->create_enumerator(this->shunts);
|
enumerator = this->shunts->create_enumerator(this->shunts);
|
||||||
while (enumerator->enumerate(enumerator, &entry))
|
while (enumerator->enumerate(enumerator, &entry))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user