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