android: binder: fix dangling pointer comparison
[cascardo/linux.git] / drivers / android / binder.c
index 16288e7..09fdb42 100644 (file)
@@ -2962,6 +2962,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
                return -ENOMEM;
        get_task_struct(current);
        proc->tsk = current;
+       atomic_inc(&current->mm->mm_count);
        proc->vma_vm_mm = current->mm;
        INIT_LIST_HEAD(&proc->todo);
        init_waitqueue_head(&proc->wait);
@@ -3167,6 +3168,7 @@ static void binder_deferred_release(struct binder_proc *proc)
                vfree(proc->buffer);
        }
 
+       mmdrop(proc->vma_vm_mm);
        put_task_struct(proc->tsk);
 
        binder_debug(BINDER_DEBUG_OPEN_CLOSE,