Re: [v2 4/5] vfio: implement APIs to set/put kvm to/from vfio group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 29/10/2016 22:05, Jike Song wrote:
> +	mutex_lock(&group->udata.lock);
> +
> +	if (!group->udata.kvm)
> +		goto out;
> +
> +	kvm_get_kvm(group->udata.kvm);
> +	mutex_unlock(&group->udata.lock);
> +	return group->udata.kvm;

There is still a very small race window, so you need to assign
group->udata.kvm to a local variable inside the mutex, and then return.

Paolo

> +out:
> +	mutex_unlock(&group->udata.lock);
> +	return NULL;
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux