OSDN Git Service

Revert "Revert "CHROMIUM: android: binder: Fix potential scheduling-while-atomic""
authorTodd Kjos <tkjos@google.com>
Mon, 10 Apr 2017 18:35:25 +0000 (18:35 +0000)
committerTodd Kjos <tkjos@google.com>
Mon, 10 Apr 2017 18:36:59 +0000 (18:36 +0000)
This reverts commit 13c17d0179f9a055062f37e91a6f6cf00a249ebd.

Change-Id: I8c3a7eefb72b85c0dd05996c2705636fcbc871f7

drivers/android/binder.c

index 9cf4f9b..22025bc 100644 (file)
@@ -417,6 +417,7 @@ static int task_get_unused_fd_flags(struct binder_proc *proc, int flags)
        struct files_struct *files = proc->files;
        unsigned long rlim_cur;
        unsigned long irqs;
+       int ret;
 
        if (files == NULL)
                return -ESRCH;
@@ -427,7 +428,11 @@ 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);
+       preempt_enable_no_resched();
+       ret = __alloc_fd(files, 0, rlim_cur, flags);
+       preempt_disable();
+
+       return ret;
 }
 
 /*
@@ -436,8 +441,11 @@ static int task_get_unused_fd_flags(struct binder_proc *proc, int flags)
 static void task_fd_install(
        struct binder_proc *proc, unsigned int fd, struct file *file)
 {
-       if (proc->files)
+       if (proc->files) {
+               preempt_enable_no_resched();
                __fd_install(proc->files, fd, file);
+               preempt_disable();
+       }
 }
 
 /*