]> xenbits.xensource.com Git - libvirt.git/commit
virStoragePoolObjListForEach: Grab a reference for pool object
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 24 May 2019 14:35:38 +0000 (16:35 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Aug 2019 15:09:05 +0000 (17:09 +0200)
commite1cb98b4e999e099e35a532512d886b3778f23af
treec5cde96950084fe9b5d4d9308ac3b7dad9988a21
parentc63315789f91bede6abca133dc2e67d730bc0698
virStoragePoolObjListForEach: Grab a reference for pool object

Turns out there's one callback that might remove a storage pool
during its run: storagePoolUpdateAllState() call
storagePoolUpdateStateCallback() which may call
virStoragePoolUpdateInactive() which in turn may call
virStoragePoolObjRemove(). Problem is that the
UpdateStateCallback() sees a storage pool object with just two
references: one for each hash table holding the object. If the
function ends up calling ObjRemove() then upon removing the
object from hash tables those references are gone and thus any
subsequent call touching the object is invalid.

The solution to this problem is to grab reference for the object
we are running iterator with.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/virstorageobj.c