diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-15 21:06:33 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 21:08:55 -0400 |
commit | f869e8a7f753e3fd43d6483e796774776f645edb (patch) | |
tree | 3b215f30a040812eb7488bd4596a5c3ae0b50e51 /drivers | |
parent | 56007cae94f349387c088e738c7dcb6bc513063b (diff) |
expose a low-level variant of fd_install() for binder
Similar situation to that of __alloc_fd(); do not use unless you
really have to. You should not touch any descriptor table other
than your own; it's a sure sign of a really bad API design.
As with __alloc_fd(), you *must* use a first-class reference to
struct files_struct; something obtained by get_files_struct(some task)
(let alone direct task->files) will not do. It must be either
current->files, or obtained by get_files_struct(current) by the
owner of that sucker and given to you.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/android/binder.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 4946d282a35..9e1a98a360d 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c | |||
@@ -386,17 +386,8 @@ int task_get_unused_fd_flags(struct binder_proc *proc, int flags) | |||
386 | static void task_fd_install( | 386 | static void task_fd_install( |
387 | struct binder_proc *proc, unsigned int fd, struct file *file) | 387 | struct binder_proc *proc, unsigned int fd, struct file *file) |
388 | { | 388 | { |
389 | struct files_struct *files = proc->files; | 389 | if (proc->files) |
390 | struct fdtable *fdt; | 390 | __fd_install(proc->files, fd, file); |
391 | |||
392 | if (files == NULL) | ||
393 | return; | ||
394 | |||
395 | spin_lock(&files->file_lock); | ||
396 | fdt = files_fdtable(files); | ||
397 | BUG_ON(fdt->fd[fd] != NULL); | ||
398 | rcu_assign_pointer(fdt->fd[fd], file); | ||
399 | spin_unlock(&files->file_lock); | ||
400 | } | 391 | } |
401 | 392 | ||
402 | /* | 393 | /* |