]> git.hungrycats.org Git - linux/commit
fbdev: Fix invalid page access after closing deferred I/O devices
authorTakashi Iwai <tiwai@suse.de>
Sun, 29 Jan 2023 08:28:56 +0000 (09:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:55:13 +0000 (08:55 +0100)
commit87b9802ca824fcee7915e717e9a60471af62e8e9
tree5815b7cc450f4c8b4d706bc4ecf17bfa629fb36b
parent9a95fc04261f8328912896972b9291792edafdf0
fbdev: Fix invalid page access after closing deferred I/O devices

[ Upstream commit 3efc61d95259956db25347e2a9562c3e54546e20 ]

When a fbdev with deferred I/O is once opened and closed, the dirty
pages still remain queued in the pageref list, and eventually later
those may be processed in the delayed work.  This may lead to a
corruption of pages, hitting an Oops.

This patch makes sure to cancel the delayed work and clean up the
pageref list at closing the device for addressing the bug.  A part of
the cleanup code is factored out as a new helper function that is
called from the common fb_release().

Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Miko Larsson <mikoxyzzz@gmail.com>
Fixes: 56c134f7f1b5 ("fbdev: Track deferred-I/O pages in pageref struct")
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230129082856.22113-1-tiwai@suse.de
Stable-dep-of: 33cd6ea9c067 ("fbdev: flush deferred IO before closing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/video/fbdev/core/fb_defio.c
drivers/video/fbdev/core/fbmem.c
include/linux/fb.h