]> git.baikalelectronics.ru Git - kernel.git/commit
fbdev: fix fb_compat_ioctl() deadlocks
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Thu, 6 Nov 2008 20:53:37 +0000 (12:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Nov 2008 23:41:19 +0000 (15:41 -0800)
commita80e17e8f6f8dc94c007e9a49b48909eae803a0c
tree25f1225b14a1e4f5abca7565203e6410e0de34cc
parentf8f8058f54fb1c0b862b7050cf35d46f91b29d6a
fbdev: fix fb_compat_ioctl() deadlocks

commit 75ff9d73b579483b50d2d6c0b632b9370c015d0d ("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 d6db713338ce097a59f54ebbe972a4e077825cf9 ("framebuffer compat_ioctl
deadlock") fixed one of the deadlocks.

This patch fixes the remaining deadlocks:
  - Revert commit d6db713338ce097a59f54ebbe972a4e077825cf9,
  - 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: Geert 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/fbmem.c