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;
ucma_put_ctx(ctx);
file_put:
- fput(filp);
+ fput_light(filp, fput_needed);
return ret;
}
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)
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 */
}
if (f)
- fput(f);
+ fput_light(f, fput_needed);
mutex_lock(&file->mutex);
list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list);
err_tree_mutex_unlock:
if (f)
- fput(f);
+ fput_light(f, fput_needed);
mutex_unlock(&file->device->xrcd_tree_mutex);
{
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;
kref_get(&ev_file->ref);
out:
- fput(filp);
+ fput_light(filp, fput_needed);
return ev_file;
}