From: Michal Privoznik Date: Tue, 1 Feb 2022 14:40:23 +0000 (+0100) Subject: virnodedeviceobj: Don't unlock virNodeDeviceObj in virNodeDeviceObjListRemove() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=39ac285c6b8f69e1503adfdce5cc1ef66181f9ed;p=libvirt.git virnodedeviceobj: Don't unlock virNodeDeviceObj in virNodeDeviceObjListRemove() When virNodeDeviceObjListRemove() is called, the passed virNodeDeviceObj is removed from internal list of node devices and then unrefed and unlocked. While the former is warranted (the object was refed at the beginning of the function) the unlock is not. In fact, it's wrong from conceptual POV. We still want threads working on the object tu mutually exclude each other. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 2e4ef2df3c..7a560349d4 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -524,7 +524,7 @@ virNodeDeviceObjListRemove(virNodeDeviceObjList *devs, virObjectRWLockWrite(devs); virObjectLock(obj); virNodeDeviceObjListRemoveLocked(devs, obj); - virNodeDeviceObjEndAPI(&obj); + virObjectUnref(obj); virObjectRWUnlock(devs); } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 9e1fc65972..f900123941 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6810,7 +6810,7 @@ testDestroyVport(testDriver *privconn, 0); virNodeDeviceObjListRemove(privconn->devs, obj); - virObjectUnref(obj); + virNodeDeviceObjEndAPI(&obj); virObjectEventStateQueue(privconn->eventState, event); return 0; @@ -7797,8 +7797,6 @@ testNodeDeviceDestroy(virNodeDevicePtr dev) virObjectLock(obj); virNodeDeviceObjListRemove(driver->devs, obj); - virObjectUnref(obj); - obj = NULL; cleanup: virNodeDeviceObjEndAPI(&obj);