powerpc kvm: use fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
173c84012a
commit
70abadedab
|
@ -823,39 +823,39 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_KVM_MPIC
|
#ifdef CONFIG_KVM_MPIC
|
||||||
case KVM_CAP_IRQ_MPIC: {
|
case KVM_CAP_IRQ_MPIC: {
|
||||||
struct file *filp;
|
struct fd f;
|
||||||
struct kvm_device *dev;
|
struct kvm_device *dev;
|
||||||
|
|
||||||
r = -EBADF;
|
r = -EBADF;
|
||||||
filp = fget(cap->args[0]);
|
f = fdget(cap->args[0]);
|
||||||
if (!filp)
|
if (!f.file)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
r = -EPERM;
|
r = -EPERM;
|
||||||
dev = kvm_device_from_filp(filp);
|
dev = kvm_device_from_filp(f.file);
|
||||||
if (dev)
|
if (dev)
|
||||||
r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]);
|
r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]);
|
||||||
|
|
||||||
fput(filp);
|
fdput(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_KVM_XICS
|
#ifdef CONFIG_KVM_XICS
|
||||||
case KVM_CAP_IRQ_XICS: {
|
case KVM_CAP_IRQ_XICS: {
|
||||||
struct file *filp;
|
struct fd f;
|
||||||
struct kvm_device *dev;
|
struct kvm_device *dev;
|
||||||
|
|
||||||
r = -EBADF;
|
r = -EBADF;
|
||||||
filp = fget(cap->args[0]);
|
f = fdget(cap->args[0]);
|
||||||
if (!filp)
|
if (!f.file)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
r = -EPERM;
|
r = -EPERM;
|
||||||
dev = kvm_device_from_filp(filp);
|
dev = kvm_device_from_filp(f.file);
|
||||||
if (dev)
|
if (dev)
|
||||||
r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]);
|
r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]);
|
||||||
|
|
||||||
fput(filp);
|
fdput(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_KVM_XICS */
|
#endif /* CONFIG_KVM_XICS */
|
||||||
|
|
Loading…
Reference in New Issue