aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/uverbs_main.c')
-rw-r--r--drivers/infiniband/core/uverbs_main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 604556d73d25..6f2ce6fa98f8 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -541,16 +541,15 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
541struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd) 541struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd)
542{ 542{
543 struct ib_uverbs_event_file *ev_file = NULL; 543 struct ib_uverbs_event_file *ev_file = NULL;
544 struct file *filp; 544 struct fd f = fdget(fd);
545 545
546 filp = fget(fd); 546 if (!f.file)
547 if (!filp)
548 return NULL; 547 return NULL;
549 548
550 if (filp->f_op != &uverbs_event_fops) 549 if (f.file->f_op != &uverbs_event_fops)
551 goto out; 550 goto out;
552 551
553 ev_file = filp->private_data; 552 ev_file = f.file->private_data;
554 if (ev_file->is_async) { 553 if (ev_file->is_async) {
555 ev_file = NULL; 554 ev_file = NULL;
556 goto out; 555 goto out;
@@ -559,7 +558,7 @@ struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd)
559 kref_get(&ev_file->ref); 558 kref_get(&ev_file->ref);
560 559
561out: 560out:
562 fput(filp); 561 fdput(f);
563 return ev_file; 562 return ev_file;
564} 563}
565 564