fbdev: Don't cancel deferred work if pagelist empty

Since [1], the fbdev deferred IO framework is careful to cancel
pending updates on close to prevent dirty pages being accessed after
they may have been reused. However, this is not necessary in the case
that the pagelist is empty, and drivers that don't make use of the
pagelist may have wanted updates cancelled for no good reason.

Avoid penalising fbdev drivers that don't make use of the pagelist by
making the cancelling of deferred IO on close conditional on there
being a non-empty pagelist.

See: https://github.com/raspberrypi/linux/issues/5398

Signed-off-by: Phil Elwell <phil@raspberrypi.com>

[1] 3efc61d952 ("fbdev: Fix invalid page access after closing deferred I/O devices")
This commit is contained in:
Phil Elwell
2023-03-29 09:49:36 +01:00
committed by Dom Cobley
parent f14e86d41d
commit cae07e09de

View File

@@ -315,7 +315,8 @@ static void fb_deferred_io_lastclose(struct fb_info *info)
struct page *page; struct page *page;
int i; int i;
flush_delayed_work(&info->deferred_work); if (!list_empty(&info->fbdefio->pagereflist))
flush_delayed_work(&info->deferred_work);
/* clear out the mapping that we setup */ /* clear out the mapping that we setup */
for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {