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 <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Michal Privoznik 2022-02-01 15:40:23 +01:00
parent 41e878859a
commit 39ac285c6b
2 changed files with 2 additions and 4 deletions

View File

@ -524,7 +524,7 @@ virNodeDeviceObjListRemove(virNodeDeviceObjList *devs,
virObjectRWLockWrite(devs);
virObjectLock(obj);
virNodeDeviceObjListRemoveLocked(devs, obj);
virNodeDeviceObjEndAPI(&obj);
virObjectUnref(obj);
virObjectRWUnlock(devs);
}

View File

@ -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);