1. 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
  2. 29 Jul, 2022 1 commit
  3. 26 Jul, 2022 6 commits
  4. 18 Jul, 2022 15 commits
  5. 17 Jul, 2022 15 commits
  6. 16 Jul, 2022 1 commit
    • Linus Torvalds's avatar
      Merge tag 'for-5.19-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 972a278f
      Linus Torvalds authored
      Pull btrfs reverts from David Sterba:
       "Due to a recent report [1] we need to revert the radix tree to xarray
        conversion patches.
      
        There's a problem with sleeping under spinlock, when xa_insert could
        allocate memory under pressure. We use GFP_NOFS so this is a real
        problem that we unfortunately did not discover during review.
      
        I'm sorry to do such change at rc6 time but the revert is IMO the
        safer option, there are patches to use mutex instead of the spin locks
        but that would need more testing. The revert branch has been tested on
        a few setups, all seem ok.
      
        The conversion to xarray will be revisited in the future"
      
      Link: https://lore.kernel.org/linux-btrfs/cover.1657097693.git.fdmanana@suse.com/ [1]
      
      * tag 'for-5.19-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        Revert "btrfs: turn delayed_nodes_tree into an XArray"
        Revert "btrfs: turn name_cache radix tree into XArray in send_ctx"
        Revert "btrfs: turn fs_info member buffer_radix into XArray"
        Revert "btrfs: turn fs_roots_radix in btrfs_fs_info into an XArray"
      972a278f