mirror-linux/drivers/video/fbdev/core
Takashi Iwai 1ea3e18e53 fbdev: Fix incorrect page mapping clearance at fb_deferred_io_release()
commit fe9ae05cfb upstream.

The recent fix for the deferred I/O by the commit
  3efc61d952 ("fbdev: Fix invalid page access after closing deferred I/O devices")
caused a regression when the same fb device is opened/closed while
it's being used.  It resulted in a frozen screen even if something
is redrawn there after the close.  The breakage is because the patch
was made under a wrong assumption of a single open; in the current
code, fb_deferred_io_release() cleans up the page mapping of the
pageref list and it calls cancel_delayed_work_sync() unconditionally,
where both are no correct behavior for multiple opens.

This patch adds a refcount for the opens of the device, and applies
the cleanup only when all files get closed.

As both fb_deferred_io_open() and _close() are called always in the
fb_info lock (mutex), it's safe to use the normal int for the
refcounting.

Also, a useless BUG_ON() is dropped.

Fixes: 3efc61d952 ("fbdev: Fix invalid page access after closing deferred I/O devices")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230308105012.1845-1-tiwai@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-22 13:34:04 +01:00
..
Makefile
bitblit.c
cfbcopyarea.c
cfbfillrect.c
cfbimgblt.c
fb_cmdline.c
fb_ddc.c
fb_defio.c fbdev: Fix incorrect page mapping clearance at fb_deferred_io_release() 2023-03-22 13:34:04 +01:00
fb_draw.h
fb_notify.c
fb_sys_fops.c
fbcmap.c
fbcon.c Revert "fbcon: don't lose the console font across generic->chip driver switch" 2023-03-10 09:33:56 +01:00
fbcon.h
fbcon_ccw.c
fbcon_cw.c
fbcon_rotate.c
fbcon_rotate.h
fbcon_ud.c
fbcvt.c
fbmem.c fbdev: Fix invalid page access after closing deferred I/O devices 2023-02-22 12:59:46 +01:00
fbmon.c
fbsysfs.c
modedb.c
softcursor.c
svgalib.c
syscopyarea.c
sysfillrect.c
sysimgblt.c
tileblit.c