@@ -389,7 +389,7 @@ static int task_get_unused_fd_flags(struct binder_proc *proc, int flags)
rlim_cur = task_rlimit(proc->tsk, RLIMIT_NOFILE);
unlock_task_sighand(proc->tsk, &irqs);
- return __alloc_fd(files, 0, rlim_cur, flags);
+ return __alloc_fd(files, 0, rlim_cur, flags, NULL);
}
/*
@@ -443,7 +443,8 @@ struct files_struct init_files = {
* allocate a file descriptor, mark it busy.
*/
int __alloc_fd(struct files_struct *files,
- unsigned start, unsigned end, unsigned flags)
+ unsigned start, unsigned end, unsigned flags,
+ struct file *newfile)
{
unsigned int fd;
int error;
@@ -491,9 +492,9 @@ repeat:
/* Sanity check */
if (rcu_access_pointer(fdt->fd[fd]) != NULL) {
printk(KERN_WARNING "alloc_fd: slot %d not NULL!\n", fd);
- rcu_assign_pointer(fdt->fd[fd], NULL);
}
#endif
+ rcu_assign_pointer(fdt->fd[fd], newfile);
out:
spin_unlock(&files->file_lock);
@@ -502,12 +503,13 @@ out:
static int alloc_fd(unsigned start, unsigned flags)
{
- return __alloc_fd(current->files, start, rlimit(RLIMIT_NOFILE), flags);
+ return __alloc_fd(current->files, start, rlimit(RLIMIT_NOFILE), flags,
+ NULL);
}
int get_unused_fd_flags(unsigned flags)
{
- return __alloc_fd(current->files, 0, rlimit(RLIMIT_NOFILE), flags);
+ return __alloc_fd(current->files, 0, rlimit(RLIMIT_NOFILE), flags, NULL);
}
EXPORT_SYMBOL(get_unused_fd_flags);
@@ -107,7 +107,8 @@ int iterate_fd(struct files_struct *, unsigned,
const void *);
extern int __alloc_fd(struct files_struct *files,
- unsigned start, unsigned end, unsigned flags);
+ unsigned start, unsigned end, unsigned flags,
+ struct file *newfile);
extern void __fd_install(struct files_struct *files,
unsigned int fd, struct file *file);
extern int __close_fd(struct files_struct *files,