fbcon_rotate_font() records the font and rotation it is about to handle in
par->rotated.fontdata and par->rotated.buf_rotate before calling
font_data_rotate(). If that allocation fails it clears par->rotated.buf,
but the cached font/rotation state 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 until
the font or the rotation is changed, 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.

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon_rotate.c 
b/drivers/video/fbdev/core/fbcon_rotate.c
index 6cdbc96eeca6..6b148e0e81e6 100644
--- a/drivers/video/fbdev/core/fbcon_rotate.c
+++ b/drivers/video/fbdev/core/fbcon_rotate.c
@@ -21,7 +21,9 @@ int fbcon_rotate_font(struct fb_info *info, struct vc_data 
*vc)
        unsigned char *buf;
        int ret;
 
-       if (par->p->fontdata == par->rotated.fontdata && par->rotate == 
par->rotated.buf_rotate)
+       if (par->p->fontdata == par->rotated.fontdata &&
+           par->rotate == par->rotated.buf_rotate &&
+           par->rotated.buf)
                return 0;
 
        par->rotated.fontdata = par->p->fontdata;
-- 
2.34.1

Reply via email to