[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <123a52d8-baf0-e32b-3262-1e8619b1c3ad@gmx.de>
Date: Wed, 8 Mar 2023 23:05:54 +0100
From: Helge Deller <deller@....de>
To: harperchen <harperchen1110@...il.com>
Cc: javierm@...hat.com, tzimmermann@...e.de,
wsa+renesas@...g-engineering.com, linux-fbdev@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fbdev: tgafb: Fix potential divide by zero
On 3/7/23 14:08, harperchen wrote:
> fb_set_var would by called when user invokes ioctl with cmd
> FBIOPUT_VSCREENINFO. User-provided data would finally reach
> tgafb_check_var. In case var->pixclock is assigned to zero,
> divide by zero would occur when checking whether reciprocal
> of var->pixclock is too high.
>
> Similar crashes have happened in other fbdev drivers. There
> is no check and modification on var->pixclock along the call
> chain to tgafb_check_var. We believe it could also be triggered
> in driver tgafb from user site.
>
> Signed-off-by: harperchen <harperchen1110@...il.com>
Could you provide a real name?
Otherwise applied to fbdev git tree.
Thanks!
Helge
> ---
> drivers/video/fbdev/tgafb.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/video/fbdev/tgafb.c b/drivers/video/fbdev/tgafb.c
> index 14d37c49633c..b44004880f0d 100644
> --- a/drivers/video/fbdev/tgafb.c
> +++ b/drivers/video/fbdev/tgafb.c
> @@ -173,6 +173,9 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
> {
> struct tga_par *par = (struct tga_par *)info->par;
>
> + if (!var->pixclock)
> + return -EINVAL;
> +
> if (par->tga_type == TGA_TYPE_8PLANE) {
> if (var->bits_per_pixel != 8)
> return -EINVAL;
Powered by blists - more mailing lists