aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-08-30 15:47:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-09-03 23:04:45 -0400
commitcffe78d92c217a57f57ec6743f71adfe39ea543e (patch)
tree7bb8c4865382cf758aff0882b017a952bf4d3332 /virt
parent70abadedab73066fae584488640056f83bce5f95 (diff)
kvm eventfd: switch to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/eventfd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 1550637d1b10..abe4d6043b36 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -291,7 +291,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
291{ 291{
292 struct kvm_irq_routing_table *irq_rt; 292 struct kvm_irq_routing_table *irq_rt;
293 struct _irqfd *irqfd, *tmp; 293 struct _irqfd *irqfd, *tmp;
294 struct file *file = NULL; 294 struct fd f;
295 struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL; 295 struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL;
296 int ret; 296 int ret;
297 unsigned int events; 297 unsigned int events;
@@ -306,13 +306,13 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
306 INIT_WORK(&irqfd->inject, irqfd_inject); 306 INIT_WORK(&irqfd->inject, irqfd_inject);
307 INIT_WORK(&irqfd->shutdown, irqfd_shutdown); 307 INIT_WORK(&irqfd->shutdown, irqfd_shutdown);
308 308
309 file = eventfd_fget(args->fd); 309 f = fdget(args->fd);
310 if (IS_ERR(file)) { 310 if (!f.file) {
311 ret = PTR_ERR(file); 311 ret = -EBADF;
312 goto fail; 312 goto out;
313 } 313 }
314 314
315 eventfd = eventfd_ctx_fileget(file); 315 eventfd = eventfd_ctx_fileget(f.file);
316 if (IS_ERR(eventfd)) { 316 if (IS_ERR(eventfd)) {
317 ret = PTR_ERR(eventfd); 317 ret = PTR_ERR(eventfd);
318 goto fail; 318 goto fail;
@@ -391,7 +391,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
391 lockdep_is_held(&kvm->irqfds.lock)); 391 lockdep_is_held(&kvm->irqfds.lock));
392 irqfd_update(kvm, irqfd, irq_rt); 392 irqfd_update(kvm, irqfd, irq_rt);
393 393
394 events = file->f_op->poll(file, &irqfd->pt); 394 events = f.file->f_op->poll(f.file, &irqfd->pt);
395 395
396 list_add_tail(&irqfd->list, &kvm->irqfds.items); 396 list_add_tail(&irqfd->list, &kvm->irqfds.items);
397 397
@@ -408,7 +408,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
408 * do not drop the file until the irqfd is fully initialized, otherwise 408 * do not drop the file until the irqfd is fully initialized, otherwise
409 * we might race against the POLLHUP 409 * we might race against the POLLHUP
410 */ 410 */
411 fput(file); 411 fdput(f);
412 412
413 return 0; 413 return 0;
414 414
@@ -422,9 +422,9 @@ fail:
422 if (eventfd && !IS_ERR(eventfd)) 422 if (eventfd && !IS_ERR(eventfd))
423 eventfd_ctx_put(eventfd); 423 eventfd_ctx_put(eventfd);
424 424
425 if (!IS_ERR(file)) 425 fdput(f);
426 fput(file);
427 426
427out:
428 kfree(irqfd); 428 kfree(irqfd);
429 return ret; 429 return ret;
430} 430}