Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: Disable sysfb device registration when removing conflicting FBs

The platform devices registered by sysfb match with firmware-based DRM or
fbdev drivers, that are used to have early graphics using a framebuffer
provided by the system firmware.

DRM or fbdev drivers later are probed and remove conflicting framebuffers,
leading to these platform devices for generic drivers to be unregistered.

But the current solution has a race, since the sysfb_init() function could
be called after a DRM or fbdev driver is probed and request to unregister
the devices for drivers with conflicting framebuffes.

To prevent this, disable any future sysfb platform device registration by
calling sysfb_disable(), if a driver requests to remove the conflicting
framebuffers.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220607182338.344270-4-javierm@redhat.com

+12
+12
drivers/video/fbdev/core/fbmem.c
··· 19 19 #include <linux/kernel.h> 20 20 #include <linux/major.h> 21 21 #include <linux/slab.h> 22 + #include <linux/sysfb.h> 22 23 #include <linux/mm.h> 23 24 #include <linux/mman.h> 24 25 #include <linux/vt.h> ··· 1764 1763 a->ranges[0].size = ~0; 1765 1764 do_free = true; 1766 1765 } 1766 + 1767 + /* 1768 + * If a driver asked to unregister a platform device registered by 1769 + * sysfb, then can be assumed that this is a driver for a display 1770 + * that is set up by the system firmware and has a generic driver. 1771 + * 1772 + * Drivers for devices that don't have a generic driver will never 1773 + * ask for this, so let's assume that a real driver for the display 1774 + * was already probed and prevent sysfb to register devices later. 1775 + */ 1776 + sysfb_disable(); 1767 1777 1768 1778 mutex_lock(&registration_lock); 1769 1779 do_remove_conflicting_framebuffers(a, name, primary);