1. 05 Aug, 2022 1 commit
    • Zheyu Ma's avatar
      video: fbdev: vt8623fb: Check the size of screen before memset_io() · ec0754c6
      Zheyu Ma authored
      In the function vt8623fb_set_par(), the value of 'screen_size' is
      calculated by the user input. If the user provides the improper value,
      the value of 'screen_size' may larger than 'info->screen_size', which
      may cause the following bug:
      
      [  583.339036] BUG: unable to handle page fault for address: ffffc90005000000
      [  583.339049] #PF: supervisor write access in kernel mode
      [  583.339052] #PF: error_code(0x0002) - not-present page
      [  583.339074] RIP: 0010:memset_orig+0x33/0xb0
      [  583.339110] Call Trace:
      [  583.339118]  vt8623fb_set_par+0x11cd/0x21e0
      [  583.339146]  fb_set_var+0x604/0xeb0
      [  583.339181]  do_fb_ioctl+0x234/0x670
      [  583.339209]  fb_ioctl+0xdd/0x130
      
      Fix the this by checking the value of 'screen_size' before memset_io().
      
      Fixes: 558b7bd8 ("vt8623fb: new framebuffer driver for VIA VT8623")
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      ec0754c6
  2. 03 Aug, 2022 2 commits
    • Zheyu Ma's avatar
      video: fbdev: i740fb: Check the argument of i740_calc_vclk() · 40bf722f
      Zheyu Ma authored
      Since the user can control the arguments of the ioctl() from the user
      space, under special arguments that may result in a divide-by-zero bug.
      
      If the user provides an improper 'pixclock' value that makes the argumet
      of i740_calc_vclk() less than 'I740_RFREQ_FIX', it will cause a
      divide-by-zero bug in:
          drivers/video/fbdev/i740fb.c:353 p_best = min(15, ilog2(I740_MAX_VCO_FREQ / (freq / I740_RFREQ_FIX)));
      
      The following log can reveal it:
      
      divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      RIP: 0010:i740_calc_vclk drivers/video/fbdev/i740fb.c:353 [inline]
      RIP: 0010:i740fb_decode_var drivers/video/fbdev/i740fb.c:646 [inline]
      RIP: 0010:i740fb_set_par+0x163f/0x3b70 drivers/video/fbdev/i740fb.c:742
      Call Trace:
       fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034
       do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110
       fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
      
      Fix this by checking the argument of i740_calc_vclk() first.
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      40bf722f
    • Zheyu Ma's avatar
      video: fbdev: arkfb: Fix a divide-by-zero bug in ark_set_pixclock() · 2f1c4523
      Zheyu Ma authored
      Since the user can control the arguments of the ioctl() from the user
      space, under special arguments that may result in a divide-by-zero bug
      in:
        drivers/video/fbdev/arkfb.c:784: ark_set_pixclock(info, (hdiv * info->var.pixclock) / hmul);
      with hdiv=1, pixclock=1 and hmul=2 you end up with (1*1)/2 = (int) 0.
      and then in:
        drivers/video/fbdev/arkfb.c:504: rv = dac_set_freq(par->dac, 0, 1000000000 / pixclock);
      we'll get a division-by-zero.
      
      The following log can reveal it:
      
      divide error: 0000 [#1] PREEMPT SMP KASAN PTI
      RIP: 0010:ark_set_pixclock drivers/video/fbdev/arkfb.c:504 [inline]
      RIP: 0010:arkfb_set_par+0x10fc/0x24c0 drivers/video/fbdev/arkfb.c:784
      Call Trace:
       fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034
       do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110
       fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
      
      Fix this by checking the argument of ark_set_pixclock() first.
      
      Fixes: 681e1473 ("arkfb: new framebuffer driver for ARK Logic cards")
      Signed-off-by: default avatarZheyu Ma <zheyuma97@gmail.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      2f1c4523
  3. 29 Jul, 2022 1 commit
  4. 26 Jul, 2022 6 commits
  5. 18 Jul, 2022 15 commits
  6. 17 Jul, 2022 15 commits