[libvirt] [PATCH] Release VM lock before acquiring virDomainObjListPtr lock

Eric Blake eblake at redhat.com
Tue Apr 9 03:15:28 UTC 2013


On 02/11/2013 09:46 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> When removing a VM from the virDomainObjListPtr, we must not
> be holding the VM lock while acquiring the list lock. Re-order
> code to ensure that we can release the VM lock early.
> ---
>  src/conf/domain_conf.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 5e16ddf..d92e54a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2115,11 +2115,10 @@ void virDomainObjListRemove(virDomainObjListPtr doms,
>  {
>      char uuidstr[VIR_UUID_STRING_BUFLEN];
>  
> -    virObjectLock(doms);
>      virUUIDFormat(dom->def->uuid, uuidstr);
> -
>      virObjectUnlock(dom);
>  
> +    virObjectLock(doms);

This patch seems to be implicated in Peter's latest proof of a
use-after-free data race:
https://www.redhat.com/archives/libvir-list/2013-April/msg00674.html

I'm trying to understand what the behavior was before this patch went in.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130408/b7e30dce/attachment-0001.sig>


More information about the libvir-list mailing list