|
@@ -390,43 +390,17 @@ static void task_fd_install(
|
|
__fd_install(proc->files, fd, file);
|
|
__fd_install(proc->files, fd, file);
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * copied from __put_unused_fd in open.c
|
|
|
|
- */
|
|
|
|
-static void __put_unused_fd(struct files_struct *files, unsigned int fd)
|
|
|
|
-{
|
|
|
|
- struct fdtable *fdt = files_fdtable(files);
|
|
|
|
- __clear_open_fd(fd, fdt);
|
|
|
|
- if (fd < files->next_fd)
|
|
|
|
- files->next_fd = fd;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* copied from sys_close
|
|
* copied from sys_close
|
|
*/
|
|
*/
|
|
static long task_close_fd(struct binder_proc *proc, unsigned int fd)
|
|
static long task_close_fd(struct binder_proc *proc, unsigned int fd)
|
|
{
|
|
{
|
|
- struct file *filp;
|
|
|
|
- struct files_struct *files = proc->files;
|
|
|
|
- struct fdtable *fdt;
|
|
|
|
int retval;
|
|
int retval;
|
|
|
|
|
|
- if (files == NULL)
|
|
|
|
|
|
+ if (proc->files == NULL)
|
|
return -ESRCH;
|
|
return -ESRCH;
|
|
|
|
|
|
- spin_lock(&files->file_lock);
|
|
|
|
- fdt = files_fdtable(files);
|
|
|
|
- if (fd >= fdt->max_fds)
|
|
|
|
- goto out_unlock;
|
|
|
|
- filp = fdt->fd[fd];
|
|
|
|
- if (!filp)
|
|
|
|
- goto out_unlock;
|
|
|
|
- rcu_assign_pointer(fdt->fd[fd], NULL);
|
|
|
|
- __clear_close_on_exec(fd, fdt);
|
|
|
|
- __put_unused_fd(files, fd);
|
|
|
|
- spin_unlock(&files->file_lock);
|
|
|
|
- retval = filp_close(filp, files);
|
|
|
|
-
|
|
|
|
|
|
+ retval = __close_fd(proc->files, fd);
|
|
/* can't restart close syscall because file table entry was cleared */
|
|
/* can't restart close syscall because file table entry was cleared */
|
|
if (unlikely(retval == -ERESTARTSYS ||
|
|
if (unlikely(retval == -ERESTARTSYS ||
|
|
retval == -ERESTARTNOINTR ||
|
|
retval == -ERESTARTNOINTR ||
|
|
@@ -435,10 +409,6 @@ static long task_close_fd(struct binder_proc *proc, unsigned int fd)
|
|
retval = -EINTR;
|
|
retval = -EINTR;
|
|
|
|
|
|
return retval;
|
|
return retval;
|
|
-
|
|
|
|
-out_unlock:
|
|
|
|
- spin_unlock(&files->file_lock);
|
|
|
|
- return -EBADF;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static void binder_set_nice(long nice)
|
|
static void binder_set_nice(long nice)
|