public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: fix division by zero in ps_to_hz()
@ 2026-03-23  7:31 Junrui Luo
  2026-03-23  8:32 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Junrui Luo @ 2026-03-23  7:31 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Yuhao Jiang, stable,
	Junrui Luo

ps_to_hz() is called from hw_sm750_crtc_set_mode() without validating
that pixclock is non-zero. A zero pixclock passed via FBIOPUT_VSCREENINFO
causes a division by zero.

Fix by rejecting zero pixclock in lynxfb_ops_check_var(), consistent
with other framebuffer drivers.

Fixes: 81dee67e215b ("staging: sm750fb: add sm750 to staging")
Reported-by: Yuhao Jiang <danisjiang@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
---
 drivers/staging/sm750fb/sm750.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 62f6e0cdff4d..18433aebb4dc 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -490,6 +490,9 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
 		 var->yres,
 		 var->bits_per_pixel);
 
+	if (!var->pixclock)
+		return -EINVAL;
+
 	ret = lynxfb_set_color_offsets(info);
 
 	if (ret) {

---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260323-fixes-317d7d967fa2

Best regards,
-- 
Junrui Luo <moonafterrain@outlook.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-24  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23  7:31 [PATCH] staging: sm750fb: fix division by zero in ps_to_hz() Junrui Luo
2026-03-23  8:32 ` Dan Carpenter
2026-03-24  6:41   ` Junrui Luo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox