Repository navigation
KVM: Fix storage pool refcount leak on creation failure - #14694
dheeraj12347 wants to merge 1 commit into
Conversation
|
Thanks for picking this up. The fix itself looks right to me: decrementing in a One problem: this depends on #14189 but targets 4.22 without it. On top of #14189, the main change applies cleanly but the test file conflicts with the tests #14189 adds there. Two ways to go: rebase this onto 4.22 once #14189 merges, which is the simplest; or make it standalone now by testing through the public |
Thanks for pointing that out, @bhouse-nexthop! I’ll wait for #14189 to get merged and then update my PR on top of it. Appreciate you taking a look! |
Description
This PR fixes a storage pool reference-count leak in
createStoragePoolLocked().When the reference count is incremented for a secondary storage pool, subsequent failures in
checkNetfsStoragePoolMounted()orgetStoragePool()can leave the reference count incremented because the existing exception handling only catchesLibvirtException.Solution
finallyblock to decrement the reference count if the operation fails after the increment.LibvirtExceptionhandling.Types of changes
Bug Severity
How Has This Been Tested?
Added
testCreateStoragePoolDecrementsRefCountWhenGetStoragePoolFails()to verify that the reference count is decremented whengetStoragePool()throws aCloudRuntimeException.git diff --check: Passed.Related: #14189