]> git.baikalelectronics.ru Git - kernel.git/commit
fbdev: Make fb_release() return -ENODEV if fbdev was unregistered
authorJavier Martinez Canillas <javierm@redhat.com>
Mon, 2 May 2022 13:50:14 +0000 (15:50 +0200)
committerJavier Martinez Canillas <javierm@redhat.com>
Tue, 3 May 2022 15:24:51 +0000 (17:24 +0200)
commit5b9c96b3635ea9ce91aa789b059a903b68fdd0ec
tree2cf957067e2cbbe8907bd20f642ce43e19d1e6af
parent753679608e8d9d4b802b9309e21ba1d400401bfa
fbdev: Make fb_release() return -ENODEV if fbdev was unregistered

A reference to the framebuffer device struct fb_info is stored in the file
private data, but this reference could no longer be valid and must not be
accessed directly. Instead, the file_fb_info() accessor function must be
used since it does sanity checking to make sure that the fb_info is valid.

This can happen for example if the registered framebuffer device is for a
driver that just uses a framebuffer provided by the system firmware. In
that case, the fbdev core would unregister the framebuffer device when a
real video driver is probed and ask to remove conflicting framebuffers.

The bug has been present for a long time but commit cac67a0611f9 ("fbdev:
Hot-unplug firmware fb devices on forced removal") unmasked it since the
fbdev core started unregistering the framebuffers' devices associated.

Fixes: cac67a0611f9 ("fbdev: Hot-unplug firmware fb devices on forced removal")
Reported-by: Maxime Ripard <maxime@cerno.tech>
Reported-by: Junxiao Chang <junxiao.chang@intel.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220502135014.377945-1-javierm@redhat.com
drivers/video/fbdev/core/fbmem.c