Skip to content
  • Todd Kjos's avatar
    d87f1bc7
    binder: fix proc->files use-after-free · d87f1bc7
    Todd Kjos authored
    
    
    commit 7f3dc008 upstream.
    
    proc->files cleanup is initiated by binder_vma_close. Therefore
    a reference on the binder_proc is not enough to prevent the
    files_struct from being released while the binder_proc still has
    a reference. This can lead to an attempt to dereference the
    stale pointer obtained from proc->files prior to proc->files
    cleanup. This has been seen once in task_get_unused_fd_flags()
    when __alloc_fd() is called with a stale "files".
    
    The fix is to protect proc->files with a mutex to prevent cleanup
    while in use.
    
    Signed-off-by: default avatarTodd Kjos <tkjos@google.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    d87f1bc7
    binder: fix proc->files use-after-free
    Todd Kjos authored
    
    
    commit 7f3dc008 upstream.
    
    proc->files cleanup is initiated by binder_vma_close. Therefore
    a reference on the binder_proc is not enough to prevent the
    files_struct from being released while the binder_proc still has
    a reference. This can lead to an attempt to dereference the
    stale pointer obtained from proc->files prior to proc->files
    cleanup. This has been seen once in task_get_unused_fd_flags()
    when __alloc_fd() is called with a stale "files".
    
    The fix is to protect proc->files with a mutex to prevent cleanup
    while in use.
    
    Signed-off-by: default avatarTodd Kjos <tkjos@google.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading