From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB746FA1 for ; Mon, 3 Apr 2023 14:38:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC2A8C433D2; Mon, 3 Apr 2023 14:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680532717; bh=OzFtwA7If/Wya3jhnsAa+8xL/Wy2+Y3Rx8WMX1aLFYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fByY9BH/2U5pgHWlp0Z4rMYxdKwp1hS26QUehhnEzS6xouWHPh6vrRzR5dTPA8mL/ ay9OEqijofWpxemkuZzeO/bthcHSw4feicVyWeCTIeoFQzMpKfTDZ43ibiDYg9kHrX j7Nnq1XdFogS+su4Cct4csB6YO8mxNeCz8t63e2I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wei Chen , Helge Deller , Sasha Levin Subject: [PATCH 6.1 059/181] fbdev: lxfb: Fix potential divide by zero Date: Mon, 3 Apr 2023 16:08:14 +0200 Message-Id: <20230403140417.061958756@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403140415.090615502@linuxfoundation.org> References: <20230403140415.090615502@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Wei Chen [ Upstream commit 61ac4b86a4c047c20d5cb423ddd87496f14d9868 ] var->pixclock can be assigned to zero by user. Without proper check, divide by zero would occur in lx_set_clock. Error out if var->pixclock is zero. Signed-off-by: Wei Chen Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/geode/lxfb_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/geode/lxfb_core.c b/drivers/video/fbdev/geode/lxfb_core.c index 9d26592dbfce9..41fda498406c1 100644 --- a/drivers/video/fbdev/geode/lxfb_core.c +++ b/drivers/video/fbdev/geode/lxfb_core.c @@ -235,6 +235,9 @@ static void get_modedb(struct fb_videomode **modedb, unsigned int *size) static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { + if (!var->pixclock) + return -EINVAL; + if (var->xres > 1920 || var->yres > 1440) return -EINVAL; -- 2.39.2