[PATCH v3 3/3] fbcon: Retry rotated font allocation after failure

From: Yao Yiqi

Date: Fri Oct 16 2026 - 03:32:06 EST


From: Yao Yiqi <yaoyiqi3@xxxxxxxxxx>

fbcon_rotate_font() records the font, its geometry and the rotation it
is about to handle in par->rotated before calling font_data_rotate().
If the allocation fails, the error path clears par->rotated.buf, but
the recorded font, geometry and rotation already look up to date, so
the next call takes the early-out and never retries. The rotated
putcs/cursor ops keep returning early on the NULL buffer and the
console stays blank until a font or rotation with a different key is
installed, even once memory is available again.

Also test par->rotated.buf in the early-out, so a failed allocation is
retried the next time fbcon_rotate_font() runs: at the next
fbcon_switch(), fbcon_modechanged() or font change.

Fixes: e4ef723d8975 ("fbcon: Avoid OOB font access if console rotation fails")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yao Yiqi <yaoyiqi3@xxxxxxxxxx>
---
Changes in v2:

- The early-out now also compares the font geometry (previous patch in
this series); the retry covers the combined key.
---
drivers/video/fbdev/core/fbcon_rotate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon_rotate.c b/drivers/video/fbdev/core/fbcon_rotate.c
index 660a3fa81bae..7afd63dcee7b 100644
--- a/drivers/video/fbdev/core/fbcon_rotate.c
+++ b/drivers/video/fbdev/core/fbcon_rotate.c
@@ -25,7 +25,8 @@ int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc)
par->rotate == par->rotated.buf_rotate &&
vc->vc_font.width == par->rotated.buf_width &&
vc->vc_font.height == par->rotated.buf_height &&
- vc->vc_font.charcount == par->rotated.buf_charcount)
+ vc->vc_font.charcount == par->rotated.buf_charcount &&
+ par->rotated.buf)
return 0;

par->rotated.fontdata = par->p->fontdata;
--
2.56.0