Skip to content
  • Geert Uytterhoeven's avatar
    fbdev: fix fb_compat_ioctl() deadlocks · a684e7d3
    Geert Uytterhoeven authored
    commit 3e680aae ("fb: convert
    lock/unlock_kernel() into local fb mutex") introduced several deadlocks
    in the fb_compat_ioctl() path, as mutex_lock() doesn't allow recursion,
    unlike lock_kernel().  This broke frame buffer applications on 64-bit
    systems with a 32-bit userland.
    
    commit 120a3747 ("framebuffer compat_ioctl
    deadlock") fixed one of the deadlocks.
    
    This patch fixes the remaining deadlocks:
      - Revert commit 120a3747
    
    ,
      - Extract the core logic of fb_ioctl() into a new function do_fb_ioctl(),
      - Change all callsites of fb_ioctl() where info->lock is already held to
        call do_fb_ioctl() instead,
      - Add sparse annotations to all routines that take info->lock.
    
    Signed-off-by: default avatarGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
    Cc: Mikulas Patocka <mpatocka@redhat.com>
    Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    a684e7d3