Skip to content
Commit 29e515b9 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Greg Kroah-Hartman
Browse files

fbdev: Make fb_release() return -ENODEV if fbdev was unregistered

[ Upstream commit aafa025c ]

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 27599aac ("fbdev:
Hot-unplug firmware fb devices on forced removal") unmasked it since the
fbdev core started unregistering the framebuffers' devices associated.

Fixes: 27599aac

 ("fbdev: Hot-unplug firmware fb devices on forced removal")
Reported-by: default avatarMaxime Ripard <maxime@cerno.tech>
Reported-by: default avatarJunxiao Chang <junxiao.chang@intel.com>
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20220502135014.377945-1-javierm@redhat.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9133dd01
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment