diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-27 12:47:29 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 21:10:10 -0400 |
commit | 88b428d6e191affae79b5c1f4764dfdebab9fae6 (patch) | |
tree | a59aef2791615ce3093cd200b3fd2c803ff2f441 /drivers/infiniband | |
parent | 1d3653a79c4eedf5d6eaaa7328b1d134012b2509 (diff) |
switch infinibarf users of fget() to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/ucma.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 13 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 5 |
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 055ed59838dc..6b2ae729de92 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -1186,13 +1186,13 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file, | |||
1186 | struct ucma_context *ctx; | 1186 | struct ucma_context *ctx; |
1187 | struct file *filp; | 1187 | struct file *filp; |
1188 | struct ucma_file *cur_file; | 1188 | struct ucma_file *cur_file; |
1189 | int ret = 0; | 1189 | int ret = 0, fput_needed; |
1190 | 1190 | ||
1191 | if (copy_from_user(&cmd, inbuf, sizeof(cmd))) | 1191 | if (copy_from_user(&cmd, inbuf, sizeof(cmd))) |
1192 | return -EFAULT; | 1192 | return -EFAULT; |
1193 | 1193 | ||
1194 | /* Get current fd to protect against it being closed */ | 1194 | /* Get current fd to protect against it being closed */ |
1195 | filp = fget(cmd.fd); | 1195 | filp = fget_light(cmd.fd, &fput_needed); |
1196 | if (!filp) | 1196 | if (!filp) |
1197 | return -ENOENT; | 1197 | return -ENOENT; |
1198 | 1198 | ||
@@ -1231,7 +1231,7 @@ response: | |||
1231 | 1231 | ||
1232 | ucma_put_ctx(ctx); | 1232 | ucma_put_ctx(ctx); |
1233 | file_put: | 1233 | file_put: |
1234 | fput(filp); | 1234 | fput_light(filp, fput_needed); |
1235 | return ret; | 1235 | return ret; |
1236 | } | 1236 | } |
1237 | 1237 | ||
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index f9d0d7c413a2..402679bd30a3 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -707,7 +707,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, | |||
707 | struct ib_xrcd *xrcd = NULL; | 707 | struct ib_xrcd *xrcd = NULL; |
708 | struct file *f = NULL; | 708 | struct file *f = NULL; |
709 | struct inode *inode = NULL; | 709 | struct inode *inode = NULL; |
710 | int ret = 0; | 710 | int ret = 0, fput_needed; |
711 | int new_xrcd = 0; | 711 | int new_xrcd = 0; |
712 | 712 | ||
713 | if (out_len < sizeof resp) | 713 | if (out_len < sizeof resp) |
@@ -724,18 +724,13 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, | |||
724 | 724 | ||
725 | if (cmd.fd != -1) { | 725 | if (cmd.fd != -1) { |
726 | /* search for file descriptor */ | 726 | /* search for file descriptor */ |
727 | f = fget(cmd.fd); | 727 | f = fget_light(cmd.fd, &fput_needed); |
728 | if (!f) { | 728 | if (!f) { |
729 | ret = -EBADF; | 729 | ret = -EBADF; |
730 | goto err_tree_mutex_unlock; | 730 | goto err_tree_mutex_unlock; |
731 | } | 731 | } |
732 | 732 | ||
733 | inode = f->f_dentry->d_inode; | 733 | inode = f->f_dentry->d_inode; |
734 | if (!inode) { | ||
735 | ret = -EBADF; | ||
736 | goto err_tree_mutex_unlock; | ||
737 | } | ||
738 | |||
739 | xrcd = find_xrcd(file->device, inode); | 734 | xrcd = find_xrcd(file->device, inode); |
740 | if (!xrcd && !(cmd.oflags & O_CREAT)) { | 735 | if (!xrcd && !(cmd.oflags & O_CREAT)) { |
741 | /* no file descriptor. Need CREATE flag */ | 736 | /* no file descriptor. Need CREATE flag */ |
@@ -801,7 +796,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, | |||
801 | } | 796 | } |
802 | 797 | ||
803 | if (f) | 798 | if (f) |
804 | fput(f); | 799 | fput_light(f, fput_needed); |
805 | 800 | ||
806 | mutex_lock(&file->mutex); | 801 | mutex_lock(&file->mutex); |
807 | list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list); | 802 | list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list); |
@@ -831,7 +826,7 @@ err: | |||
831 | 826 | ||
832 | err_tree_mutex_unlock: | 827 | err_tree_mutex_unlock: |
833 | if (f) | 828 | if (f) |
834 | fput(f); | 829 | fput_light(f, fput_needed); |
835 | 830 | ||
836 | mutex_unlock(&file->device->xrcd_tree_mutex); | 831 | mutex_unlock(&file->device->xrcd_tree_mutex); |
837 | 832 | ||
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 604556d73d25..acf75c2cf7ef 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -542,8 +542,9 @@ struct 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 file *filp; |
545 | int fput_needed; | ||
545 | 546 | ||
546 | filp = fget(fd); | 547 | filp = fget_light(fd, &fput_needed); |
547 | if (!filp) | 548 | if (!filp) |
548 | return NULL; | 549 | return NULL; |
549 | 550 | ||
@@ -559,7 +560,7 @@ struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd) | |||
559 | kref_get(&ev_file->ref); | 560 | kref_get(&ev_file->ref); |
560 | 561 | ||
561 | out: | 562 | out: |
562 | fput(filp); | 563 | fput_light(filp, fput_needed); |
563 | return ev_file; | 564 | return ev_file; |
564 | } | 565 | } |
565 | 566 | ||