lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 26 Oct 2020 10:00:11 -0700 From: Saeed Mirzamohammadi <saeed.mirzamohammadi@...cle.com> To: stable@...r.kernel.org Cc: Thomas Zimmermann <tzimmermann@...e.de>, linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org, b.zolnierkie@...sung.com, jani.nikula@...el.com, daniel.vetter@...ll.ch, gustavoars@...nel.org, dri-devel@...ts.freedesktop.org, akpm@...ux-foundation.org, rppt@...nel.org Subject: Re: [PATCH 1/1] video: fbdev: fix divide error in fbcon_switch Thanks, adding stable. Saeed > On Oct 22, 2020, at 12:34 AM, Thomas Zimmermann <tzimmermann@...e.de> wrote: > > Hi > > On 22.10.20 01:57, saeed.mirzamohammadi@...cle.com wrote: >> From: Saeed Mirzamohammadi <saeed.mirzamohammadi@...cle.com> >> >> This patch fixes the issue due to: >> >> [ 89.572883] divide_error: 0000 [#1] SMP KASAN PTI >> [ 89.572897] CPU: 3 PID: 16083 Comm: repro Not tainted 5.9.0-rc7.20200930.rc1.allarch-19-g3e32d0d.syzk #5 >> [ 89.572902] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011 >> [ 89.572934] RIP: 0010:cirrusfb_check_var+0x84/0x1260 > > BTW, if you run qemu with cirrus, there's also a DRM driver named > cirrus.ko. Might be a better choice than the old fbdev driver. If you > just care about qemu, but not the actual graphics device, take a look at > > https://urldefense.com/v3/__https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/__;!!GqivPVa7Brio!LmgeM-pVBVH80uVELF1P1nBGAbAlhvnxKKE_ZrEc9d76AznvAAgP1FAp3_zNa2frKaIUZteK$ > > Anyway, thanks for your patch. > > Best regards > Thomas > >> >> The error happens when the pixels value is calculated before performing the sanity checks on bits_per_pixel. >> A bits_per_pixel set to zero causes divide by zero error. >> >> This patch moves the calculation after the sanity check. >> >> Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@...cle.com> >> Tested-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@...cle.com> >> --- >> drivers/video/fbdev/cirrusfb.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c >> index 15a9ee7cd734..a7749101b094 100644 >> --- a/drivers/video/fbdev/cirrusfb.c >> +++ b/drivers/video/fbdev/cirrusfb.c >> @@ -531,7 +531,7 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, >> { >> int yres; >> /* memory size in pixels */ >> - unsigned pixels = info->screen_size * 8 / var->bits_per_pixel; >> + unsigned int pixels; >> struct cirrusfb_info *cinfo = info->par; >> >> switch (var->bits_per_pixel) { >> @@ -573,6 +573,7 @@ static int cirrusfb_check_var(struct fb_var_screeninfo *var, >> return -EINVAL; >> } >> >> + pixels = info->screen_size * 8 / var->bits_per_pixel; >> if (var->xres_virtual < var->xres) >> var->xres_virtual = var->xres; >> /* use highest possible virtual resolution */ >> > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 Nürnberg, Germany > (HRB 36809, AG Nürnberg) > Geschäftsführer: Felix Imendörffer
Powered by blists - more mailing lists