1. 10 Jul, 2022 1 commit
    • Linus Torvalds's avatar
      ida: don't use BUG_ON() for debugging · fc82bbf4
      Linus Torvalds authored
      This is another old BUG_ON() that just shouldn't exist (see also commit
      a382f8fe: "signal handling: don't use BUG_ON() for debugging").
      
      In fact, as Matthew Wilcox points out, this condition shouldn't really
      even result in a warning, since a negative id allocation result is just
      a normal allocation failure:
      
        "I wonder if we should even warn here -- sure, the caller is trying to
         free something that wasn't allocated, but we don't warn for
         kfree(NULL)"
      
      and goes on to point out how that current error check is only causing
      people to unnecessarily do their own index range checking before freeing
      it.
      
      This was noted by Itay Iellin, because the bluetooth HCI socket cookie
      code does *not* do that range checking, and ends up just freeing the
      error case too, triggering the BUG_ON().
      
      The HCI code requires CAP_NET_RAW, and seems to just result in an ugly
      splat, but there really is no reason to BUG_ON() here, and we have
      generally striven for allocation models where it's always ok to just do
      
          free(alloc());
      
      even if the allocation were to fail for some random reason (usually
      obviously that "random" reason being some resource limit).
      
      Fixes: 88eca020 ("ida: simplified functions for id allocation")
      Reported-by: default avatarItay Iellin <ieitayie@gmail.com>
      Suggested-by: default avatarMatthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fc82bbf4
  2. 09 Jul, 2022 3 commits
    • Thomas Zimmermann's avatar
      drm/aperture: Run fbdev removal before internal helpers · 84499c5d
      Thomas Zimmermann authored
      Always run fbdev removal first to remove simpledrm via sysfb_disable().
      This clears the internal state.
      
      The later call to drm_aperture_detach_drivers() then does nothing.
      Otherwise, with drm_aperture_detach_drivers() running first, the call to
      sysfb_disable() uses inconsistent state.
      
      Example backtrace show below:
      
        BUG: KASAN: use-after-free in device_del+0x79/0x5f0
        Read of size 8 at addr ffff888108185050 by task systemd-udevd/311
        CPU: 0 PID: 311 Comm: systemd-udevd Tainted: G            E     5.19.0-rc2-1-default+ #1689
        Hardware name: HP ProLiant DL120 G7, BIOS J01 04/21/2011
        Call Trace:
          device_del+0x79/0x5f0
          platform_device_del.part.0+0x19/0xe0
          platform_device_unregister+0x1c/0x30
          sysfb_disable+0x2d/0x70
          remove_conflicting_framebuffers+0x1c/0xf0
          remove_conflicting_pci_framebuffers+0x130/0x1a0
          drm_aperture_remove_conflicting_pci_framebuffers+0x86/0xb0
          mgag200_pci_probe+0x2d/0x140 [mgag200]
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: 873eb3b1 ("fbdev: Disable sysfb device registration when removing conflicting FBs")
      Cc: Javier Martinez Canillas <javierm@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Zhen Lei <thunder.leizhen@huawei.com>
      Cc: Changcheng Deng <deng.changcheng@zte.com.cn>
      Reviewed-by: default avatarZack Rusin <zackr@vmware.com>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      84499c5d
    • Sven Schnelle's avatar
      ptrace: fix clearing of JOBCTL_TRACED in ptrace_unfreeze_traced() · de2a3477
      Sven Schnelle authored
      CI reported the following splat while running the strace testsuite:
      
        WARNING: CPU: 1 PID: 3570031 at kernel/ptrace.c:272 ptrace_check_attach+0x12e/0x178
        CPU: 1 PID: 3570031 Comm: strace Tainted: G           OE     5.19.0-20220624.rc3.git0.ee819a77d4e7.300.fc36.s390x #1
        Hardware name: IBM 3906 M04 704 (z/VM 7.1.0)
        Call Trace:
         [<00000000ab4b645a>] ptrace_check_attach+0x132/0x178
        ([<00000000ab4b6450>] ptrace_check_attach+0x128/0x178)
         [<00000000ab4b6cde>] __s390x_sys_ptrace+0x86/0x160
         [<00000000ac03fcec>] __do_syscall+0x1d4/0x200
         [<00000000ac04e312>] system_call+0x82/0xb0
        Last Breaking-Event-Address:
         [<00000000ab4ea3c8>] wait_task_inactive+0x98/0x190
      
      This is because JOBCTL_TRACED is set, but the task is not in TASK_TRACED
      state. Caused by ptrace_unfreeze_traced() which does:
      
      	task->jobctl &= ~TASK_TRACED
      
      but it should be:
      
      	task->jobctl &= ~JOBCTL_TRACED
      
      Fixes: 31cae1ea ("sched,signal,ptrace: Rework TASK_TRACED, TASK_STOPPED state")
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Tested-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      de2a3477
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.19-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · d9cdc3b1
      Linus Torvalds authored
      Pull powerpc fix from Michael Ellerman:
      
       - On Power8 bare metal, fix creation of RNG platform devices, which are
         needed for the /dev/hwrng driver to probe correctly.
      
      Thanks to Jason A. Donenfeld, and Sachin Sant.
      
      * tag 'powerpc-5.19-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/powernv: delay rng platform device creation until later in boot
      d9cdc3b1
  3. 08 Jul, 2022 11 commits
  4. 07 Jul, 2022 25 commits