staging: sm750fb: add missing FBINFO_STATE_RUNNING checks in copyarea and imageblit
PATCH 1/1 staging: sm750fb: add missing FBINFO_STATE_RUNNING checks in copyarea and imageblit
lynxfb_ops_fillrect() correctly checks info->state before accessing the hardware 2D accelerator, returning early if the framebuffer is not in FBINFO_STATE_RUNNING state. However, lynxfb_ops_copyarea() and lynxfb_ops_imageblit() omit this guard despite using the same hardware accelerator through identical code paths.
Without this check, the 2D engine could be accessed while the device is suspended (state set to FBINFO_STATE_SUSPENDED via fb_set_suspend()), potentially causing bus errors or system hangs.
Add the missing state checks to both functions, matching the existing pattern in lynxfb_ops_fillrect().
--- drivers/staging/sm750fb/sm750.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/sm750fb/sm750.c +6 -0
@@ -204,6 +204,9 @@ static void lynxfb_ops_copyarea(struct fb_info *info,struct sm750_dev *sm750_dev;unsigned int base, pitch, bpp; +if (info->state !=FBINFO_STATE_RUNNING ) +return ; + par = info->par; sm750_dev = par->dev;
@@ -239,6 +242,9 @@ static void lynxfb_ops_imageblit(struct fb_info *info,struct lynxfb_par *par;struct sm750_dev *sm750_dev; +if (info->state !=FBINFO_STATE_RUNNING ) +return ; + par = info->par; sm750_dev = par->dev;/*
Signature · 1 line
2.54.0
Quoted 8 lines · Chhabilal Dangal
lynxfb_ops_fillrect()correctly checksinfo->statebefore accessing the hardware 2D accelerator, returning early if the framebuffer is not inFBINFO_STATE_RUNNINGstate. However,lynxfb_ops_copyarea()andlynxfb_ops_imageblit()omit this guard despite using the same hardware accelerator through identical code paths.Without this check, the 2D engine could be accessed while the device is suspended (state set to
FBINFO_STATE_SUSPENDEDviafb_set_suspend()), potentially causing bus errors or system hangs.Add the missing state checks to both functions, matching the existing pattern in
lynxfb_ops_fillrect().Signed-off-by Chhabilal Dangal <[email protected]>---
1) Run your patches though checkpatch.
2) Add a fixes tag.
3) Put a note in the commit message that you are using AI and have not tested your patch.
Smatch says that the state is always FBINFO_STATE_RUNNING so this patch is unnecessary but I haven't looked at the code. Please check again and resend if Smatch is wrong.
regards,
dan carpenter