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 | |
parent | 1d3653a79c4eedf5d6eaaa7328b1d134012b2509 (diff) | |
download | op-kernel-dev-88b428d6e191affae79b5c1f4764dfdebab9fae6.zip op-kernel-dev-88b428d6e191affae79b5c1f4764dfdebab9fae6.tar.gz |
switch infinibarf users of fget() to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-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 055ed59..6b2ae72 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, struct ucma_context *ctx; struct file *filp; struct ucma_file *cur_file; - int ret = 0; + int ret = 0, fput_needed; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; /* Get current fd to protect against it being closed */ - filp = fget(cmd.fd); + filp = fget_light(cmd.fd, &fput_needed); if (!filp) return -ENOENT; @@ -1231,7 +1231,7 @@ response: ucma_put_ctx(ctx); file_put: - fput(filp); + fput_light(filp, fput_needed); return ret; } diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index f9d0d7c..402679b 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, struct ib_xrcd *xrcd = NULL; struct file *f = NULL; struct inode *inode = NULL; - int ret = 0; + int ret = 0, fput_needed; int new_xrcd = 0; if (out_len < sizeof resp) @@ -724,18 +724,13 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, if (cmd.fd != -1) { /* search for file descriptor */ - f = fget(cmd.fd); + f = fget_light(cmd.fd, &fput_needed); if (!f) { ret = -EBADF; goto err_tree_mutex_unlock; } inode = f->f_dentry->d_inode; - if (!inode) { - ret = -EBADF; - goto err_tree_mutex_unlock; - } - xrcd = find_xrcd(file->device, inode); if (!xrcd && !(cmd.oflags & O_CREAT)) { /* no file descriptor. Need CREATE flag */ @@ -801,7 +796,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file, } if (f) - fput(f); + fput_light(f, fput_needed); mutex_lock(&file->mutex); list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list); @@ -831,7 +826,7 @@ err: err_tree_mutex_unlock: if (f) - fput(f); + fput_light(f, fput_needed); mutex_unlock(&file->device->xrcd_tree_mutex); diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 604556d..acf75c2 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) { struct ib_uverbs_event_file *ev_file = NULL; struct file *filp; + int fput_needed; - filp = fget(fd); + filp = fget_light(fd, &fput_needed); if (!filp) return NULL; @@ -559,7 +560,7 @@ struct ib_uverbs_event_file *ib_uverbs_lookup_comp_file(int fd) kref_get(&ev_file->ref); out: - fput(filp); + fput_light(filp, fput_needed); return ev_file; } |