[PATCH 2/2] fbdev: fbmem: don't fail registration when fbcon cannot take over
From: YuanZhe Liu
Date: Fri Dec 04 2026 - 04:05:30 EST
do_register_framebuffer() installs the framebuffer in registered_fb[],
sets its reference count and registers it with fbcon. It then returns
the result of fbcon_fb_registered() to the caller, so a failed console
takeover is reported as a registration failure even though the
framebuffer itself is fully registered.
A driver can reject fbcon's internal fb_open() call, which makes the
takeover fail. The driver then frees the fb_info because it was told
that registration failed, leaving a dangling entry in registered_fb[]
and triggering the reference-count warning in framebuffer_release().
Console takeover is auxiliary. Report success once the framebuffer is
registered and leave the console unbound if the takeover failed.
Fixes: 97b67986f145 ("fbcon: call fbcon_fb_(un)registered directly")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: YuanZhe Liu <25031212351@xxxxxxxxxxxxxxxxx>
---
drivers/video/fbdev/core/fbmem.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index c8aa163b0ecf..2f6d6be673b4 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -535,7 +535,13 @@ static int do_register_framebuffer(struct fb_info *fb_info)
}
#endif
- return fbcon_fb_registered(fb_info);
+ /*
+ * The framebuffer is registered now. A failed console takeover
+ * is not a registration failure; reporting it would make drivers
+ * free a live fb_info and leave registered_fb[] dangling.
+ */
+ fbcon_fb_registered(fb_info);
+ return 0;
}
static void unbind_console(struct fb_info *fb_info)
--
2.34.1