<div dir="ltr">On Tue, Oct 26, 2021 at 5:45 AM Sam Ravnborg <<a href="mailto:sam@ravnborg.org">sam@ravnborg.org</a>> wrote:<br>><br>> Hi George,<br>><br>> On Mon, Oct 25, 2021 at 03:33:43PM -0400, George Kennedy wrote:<br>> ><br>> ><br>> > On 10/25/2021 3:07 PM, Greg KH wrote:<br>> > > On Mon, Oct 25, 2021 at 02:01:30PM -0500, George Kennedy wrote:<br>> > > > Do a sanity check on pixclock value before using it as a divisor.<br>> > > ><br>> > > > Syzkaller reported a divide error in cirrusfb_check_pixclock.<br>> > > ><br>> > > > divide error: 0000 [#1] SMP KASAN PTI<br>> > > > CPU: 0 PID: 14938 Comm: cirrusfb_test Not tainted 5.15.0-rc6 #1<br>> > > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2<br>> > > > RIP: 0010:cirrusfb_check_var+0x6f1/0x1260<br>> > > ><br>> > > > Call Trace:<br>> > > >   fb_set_var+0x398/0xf90<br>> > > >   do_fb_ioctl+0x4b8/0x6f0<br>> > > >   fb_ioctl+0xeb/0x130<br>> > > >   __x64_sys_ioctl+0x19d/0x220<br>> > > >   do_syscall_64+0x3a/0x80<br>> > > >   entry_SYSCALL_64_after_hwframe+0x44/0xae<br>> > > ><br>> > > > Signed-off-by: George Kennedy <<a href="mailto:george.kennedy@oracle.com">george.kennedy@oracle.com</a>><br>> > > > ---<br>> > > >   drivers/video/fbdev/cirrusfb.c | 3 +++<br>> > > >   1 file changed, 3 insertions(+)<br>> > > ><br>> > > > diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c<br>> > > > index 93802ab..099ddcb 100644<br>> > > > --- a/drivers/video/fbdev/cirrusfb.c<br>> > > > +++ b/drivers/video/fbdev/cirrusfb.c<br>> > > > @@ -477,6 +477,9 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,<br>> > > >           struct cirrusfb_info *cinfo = info->par;<br>> > > >           unsigned maxclockidx = var->bits_per_pixel >> 3;<br>> > > > + if (!var->pixclock)<br>> > > > +         return -EINVAL;<br>> > > Shouldn't you be checking further up the call chain where this got set<br>> > > to 0?<br>> ><br>> I recall we had a similar discussion when Zheyu Ma <<a href="mailto:zheyuma97@gmail.com">zheyuma97@gmail.com</a>><br>> added the same checks to at least 3 fbdev drivers.<br>> The conclusion was that the check belongs in the individual check<br>> functions - IIRC.<br>><br>> Maybe Zheyu or google can help find the original thread.<br><br>Related discussions are here:<br><a href="https://lore.kernel.org/all/1627179054-29903-1-git-send-email-zheyuma97@gmail.com/#t">https://lore.kernel.org/all/1627179054-29903-1-git-send-email-zheyuma97@gmail.com/</a><div><a href="https://lore.kernel.org/all/1626871424-27708-1-git-send-email-zheyuma97@gmail.com/">https://lore.kernel.org/all/1626871424-27708-1-git-send-email-zheyuma97@gmail.com/</a><br></div><div><a href="https://lore.kernel.org/all/1627293835-17441-1-git-send-email-zheyuma97@gmail.com/">https://lore.kernel.org/all/1627293835-17441-1-git-send-email-zheyuma97@gmail.com/</a><br></div><div><br></div><div>Regards,</div><div>Zheyu Ma</div><div><br></div></div>