From: Yao Yiqi <[email protected]>

fbcon_rotate_font() records the font, its geometry and the rotation in
par->rotated before calling font_data_rotate(). If the allocation
fails, the error path clears par->rotated.buf, but the recorded key
already looks 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 even after memory is
available again.

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

Fixes: e4ef723d8975 ("fbcon: Avoid OOB font access if console rotation fails")
Cc: [email protected]
Signed-off-by: Yao Yiqi <[email protected]>
---
 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

Reply via email to