Skip to content
  1. May 30, 2020
  2. May 29, 2020
  3. May 28, 2020
    • Jens Axboe's avatar
      Merge branch 'nvme-5.7' of git://git.infradead.org/nvme into block-5.7 · 15fede12
      Jens Axboe authored
      Pull NVMe poll fix from Christoph.
      
      * 'nvme-5.7' of git://git.infradead.org/nvme:
        nvme-pci: avoid race between nvme_reap_pending_cqes() and nvme_poll()
      15fede12
    • Nobuhiro Iwamatsu's avatar
      arm64/kernel: Fix return value when cpu_online() fails in __cpu_up() · ba051f09
      Nobuhiro Iwamatsu authored
      If boot_secondary() was successful, and cpu_online() was an error in
      __cpu_up(), -EIO was returned, but 0 is returned by commit d22b115c
      ("arm64/kernel: Simplify __cpu_up() by bailing out early").
      Therefore, bringup_wait_for_ap() causes the primary core to wait for a
      long time, which may cause boot failure.
      This commit sets -EIO to return code under the same conditions.
      
      Fixes: d22b115c
      
       ("arm64/kernel: Simplify __cpu_up() by bailing out early")
      Signed-off-by: default avatarNobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
      Tested-by: default avatarYuji Ishikawa <yuji2.ishikawa@toshiba.co.jp>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Cc: Gavin Shan <gshan@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Link: https://lore.kernel.org/r/20200527233457.2531118-1-nobuhiro1.iwamatsu@toshiba.co.jp
      
      
      [catalin.marinas@arm.com: return -EIO at the end of the function]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      ba051f09
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-5.7-2020-05-27' of... · ed52a9b5
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-5.7-2020-05-27' of git://people.freedesktop.org/~agd5f/linux
      
       into drm-fixes
      
      amd-drm-fixes-5.7-2020-05-27:
      
      amdgpu:
      - Display atomic test fix
      - Fix soft hang in display vupdate code
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexdeucher@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200527222700.4378-1-alexander.deucher@amd.com
      ed52a9b5
    • Guo Ren's avatar
      csky: Fixup CONFIG_DEBUG_RSEQ · f36e0aab
      Guo Ren authored
      
      
      Put the rseq_syscall check point at the prologue of the syscall
      will break the a0 ... a7. This will casue system call bug when
      DEBUG_RSEQ is enabled.
      
      So move it to the epilogue of syscall, but before syscall_trace.
      
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      f36e0aab
    • Guo Ren's avatar
      csky: Coding convention in entry.S · 20f69538
      Guo Ren authored
      
      
      There is no fixup or feature in the patch, we only cleanup with:
      
       - Remove unnecessary reg used (r11, r12), just use r9 & r10 &
         syscallid regs as temp useage.
       - Add _TIF_SYSCALL_WORK and _TIF_WORK_MASK to gather macros.
      
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      20f69538
    • Guo Ren's avatar
      csky: Fixup abiv2 syscall_trace break a4 & a5 · e0bbb538
      Guo Ren authored
      
      
      Current implementation could destory a4 & a5 when strace, so we need to get them
      from pt_regs by SAVE_ALL.
      
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      e0bbb538
    • Guo Ren's avatar
      csky: Fixup CONFIG_PREEMPT panic · 90089759
      Guo Ren authored
      
      
      log:
      [    0.13373200] Calibrating delay loop...
      [    0.14077600] ------------[ cut here ]------------
      [    0.14116700] WARNING: CPU: 0 PID: 0 at kernel/sched/core.c:3790 preempt_count_add+0xc8/0x11c
      [    0.14348000] DEBUG_LOCKS_WARN_ON((preempt_count() < 0))Modules linked in:
      [    0.14395100] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0 #7
      [    0.14410800]
      [    0.14427400] Call Trace:
      [    0.14450700] [<807cd226>] dump_stack+0x8a/0xe4
      [    0.14473500] [<80072792>] __warn+0x10e/0x15c
      [    0.14495900] [<80072852>] warn_slowpath_fmt+0x72/0xc0
      [    0.14518600] [<800a5240>] preempt_count_add+0xc8/0x11c
      [    0.14544900] [<807ef918>] _raw_spin_lock+0x28/0x68
      [    0.14572600] [<800e0eb8>] vprintk_emit+0x84/0x2d8
      [    0.14599000] [<800e113a>] vprintk_default+0x2e/0x44
      [    0.14625100] [<800e2042>] vprintk_func+0x12a/0x1d0
      [    0.14651300] [<800e1804>] printk+0x30/0x48
      [    0.14677600] [<80008052>] lockdep_init+0x12/0xb0
      [    0.14703800] [<80002080>] start_kernel+0x558/0x7f8
      [    0.14730000] [<800052bc>] csky_start+0x58/0x94
      [    0.14756600] irq event stamp: 34
      [    0.14775100] hardirqs last  enabled at (33): [<80067370>] ret_from_exception+0x2c/0x72
      [    0.14793700] hardirqs last disabled at (34): [<800e0eae>] vprintk_emit+0x7a/0x2d8
      [    0.14812300] softirqs last  enabled at (32): [<800655b0>] __do_softirq+0x578/0x6d8
      [    0.14830800] softirqs last disabled at (25): [<8007b3b8>] irq_exit+0xec/0x128
      
      The preempt_count of reg could be destroyed after csky_do_IRQ without reload
      from memory.
      
      After reference to other architectures (arm64, riscv), we move preempt entry
      into ret_from_exception and disable irq at the beginning of
      ret_from_exception instead of RESTORE_ALL.
      
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      Reported-by: default avatarLu Baoquan <lu.baoquan@intellif.com>
      90089759
    • Valentine Fatiev's avatar
      IB/ipoib: Fix double free of skb in case of multicast traffic in CM mode · 1acba6a8
      Valentine Fatiev authored
      When connected mode is set, and we have connected and datagram traffic in
      parallel, ipoib might crash with double free of datagram skb.
      
      The current mechanism assumes that the order in the completion queue is
      the same as the order of sent packets for all QPs. Order is kept only for
      specific QP, in case of mixed UD and CM traffic we have few QPs (one UD and
      few CM's) in parallel.
      
      The problem:
      ----------------------------------------------------------
      
      Transmit queue:
      -----------------
      UD skb pointer kept in queue itself, CM skb kept in spearate queue and
      uses transmit queue as a placeholder to count the number of total
      transmitted packets.
      
      0   1   2   3   4  5  6  7  8   9  10  11 12 13 .........127
      ------------------------------------------------------------
      NL ud1 UD2 CM1 ud3 cm2 cm3 ud4 cm4 ud5 NL NL NL ...........
      ------------------------------------------------------------
          ^                                  ^
         tail                               head
      
      Completion queue (problematic scenario) - the order not the same as in
      the transmit queue:
      
        1  2  3  4  5  6  7  8  9
      ------------------------------------
       ud1 CM1 UD2 ud3 cm2 cm3 ud4 cm4 ud5
      ------------------------------------
      
      1. CM1 'wc' processing
         - skb freed in cm separate ring.
         - tx_tail of transmit queue increased although UD2 is not freed.
           Now driver assumes UD2 index is already freed and it could be used for
           new transmitted skb.
      
      0   1   2   3   4  5  6  7  8   9  10  11 12 13 .........127
      ------------------------------------------------------------
      NL NL  UD2 CM1 ud3 cm2 cm3 ud4 cm4 ud5 NL NL NL ...........
      ------------------------------------------------------------
              ^   ^                       ^
            (Bad)tail                    head
      (Bad - Could be used for new SKB)
      
      In this case (due to heavy load) UD2 skb pointer could be replaced by new
      transmitted packet UD_NEW, as the driver assumes its free.  At this point
      we will have to process two 'wc' with same index but we have only one
      pointer to free.
      
      During second attempt to free the same skb we will have NULL pointer
      exception.
      
      2. UD2 'wc' processing
         - skb freed according the index we got from 'wc', but it was already
           overwritten by mistake. So actually the skb that was released is the
           skb of the new transmitted packet and not the original one.
      
      3. UD_NEW 'wc' processing
         - attempt to free already freed skb. NUll pointer exception.
      
      The fix:
      -----------------------------------------------------------------------
      
      The fix is to stop using the UD ring as a placeholder for CM packets, the
      cyclic ring variables tx_head and tx_tail will manage the UD tx_ring, a
      new cyclic variables global_tx_head and global_tx_tail are introduced for
      managing and counting the overall outstanding sent packets, then the send
      queue will be stopped and waken based on these variables only.
      
      Note that no locking is needed since global_tx_head is updated in the xmit
      flow and global_tx_tail is updated in the NAPI flow only.  A previous
      attempt tried to use one variable to count the outstanding sent packets,
      but it did not work since xmit and NAPI flows can run at the same time and
      the counter will be updated wrongly. Thus, we use the same simple cyclic
      head and tail scheme that we have today for the UD tx_ring.
      
      Fixes: 2c104ea6 ("IB/ipoib: Get rid of the tx_outstanding variable in all modes")
      Link: https://lore.kernel.org/r/20200527134705.480068-1-leon@kernel.org
      
      
      Signed-off-by: default avatarValentine Fatiev <valentinef@mellanox.com>
      Signed-off-by: default avatarAlaa Hleihel <alaa@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Acked-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      1acba6a8
    • Aric Cyr's avatar
      drm/amd/display: Fix potential integer wraparound resulting in a hang · 4e518320
      Aric Cyr authored
      
      
      [Why]
      If VUPDATE_END is before VUPDATE_START the delay calculated can become
      very large, causing a soft hang.
      
      [How]
      Take the absolute value of the difference between START and END.
      
      Signed-off-by: default avatarAric Cyr <aric.cyr@amd.com>
      Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
      Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      4e518320
    • Simon Ser's avatar
      drm/amd/display: drop cursor position check in atomic test · f7d5991b
      Simon Ser authored
      
      
      get_cursor_position already handles the case where the cursor has
      negative off-screen coordinates by not setting
      dc_cursor_position.enabled.
      
      Signed-off-by: default avatarSimon Ser <contact@emersion.fr>
      Fixes: 626bf90f
      
       ("drm/amd/display: add basic atomic check for cursor plane")
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      f7d5991b
    • Dongli Zhang's avatar
      nvme-pci: avoid race between nvme_reap_pending_cqes() and nvme_poll() · 9210c075
      Dongli Zhang authored
      There may be a race between nvme_reap_pending_cqes() and nvme_poll(), e.g.,
      when doing live reset while polling the nvme device.
      
            CPU X                        CPU Y
                                     nvme_poll()
      nvme_dev_disable()
      -> nvme_stop_queues()
      -> nvme_suspend_io_queues()
      -> nvme_suspend_queue()
                                     -> spin_lock(&nvmeq->cq_poll_lock);
      -> nvme_reap_pending_cqes()
         -> nvme_process_cq()        -> nvme_process_cq()
      
      In the above scenario, the nvme_process_cq() for the same queue may be
      running on both CPU X and CPU Y concurrently.
      
      It is much more easier to reproduce the issue when CONFIG_PREEMPT is
      enabled in kernel. When CONFIG_PREEMPT is disabled, it would take longer
      time for nvme_stop_queues()-->blk_mq_quiesce_queue() to wait for grace
      period.
      
      This patch protects nvme_process_cq() with nvmeq->cq_poll_lock in
      nvme_reap_pending_cqes().
      
      Fixes: fa46c6fb
      
       ("nvme/pci: move cqe check after device shutdown")
      Signed-off-by: default avatarDongli Zhang <dongli.zhang@oracle.com>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      9210c075
    • Linus Torvalds's avatar
      Merge tag 'fsnotify_for_v5.7-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · b0c3ba31
      Linus Torvalds authored
      Pull fanotify FAN_DIR_MODIFY disabling from Jan Kara:
       "A single patch that disables FAN_DIR_MODIFY support that was merged in
        this merge window.
      
        When discussing further functionality we realized it may be more
        logical to guard it with a feature flag or to call things slightly
        differently (or maybe not) so let's not set the API in stone for now."
      
      * tag 'fsnotify_for_v5.7-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        fanotify: turn off support for FAN_DIR_MODIFY
      b0c3ba31
    • Linus Torvalds's avatar
      Merge branch 'for-5.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · 3301f6ae
      Linus Torvalds authored
      Pull cgroup fixes from Tejun Heo:
      
       - Reverted stricter synchronization for cgroup recursive stats which
         was prepping it for event counter usage which never got merged. The
         change was causing performation regressions in some cases.
      
       - Restore bpf-based device-cgroup operation even when cgroup1 device
         cgroup is disabled.
      
       - An out-param init fix.
      
      * 'for-5.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        device_cgroup: Cleanup cgroup eBPF device filter code
        xattr: fix uninitialized out-param
        Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window"
      3301f6ae
    • Jason Gunthorpe's avatar
      RDMA/core: Fix double destruction of uobject · c85f4abe
      Jason Gunthorpe authored
      Fix use after free when user user space request uobject concurrently for
      the same object, within the RCU grace period.
      
      In that case, remove_handle_idr_uobject() is called twice and we will have
      an extra put on the uobject which cause use after free.  Fix it by leaving
      the uobject write locked after it was removed from the idr.
      
      Call to rdma_lookup_put_uobject with UVERBS_LOOKUP_DESTROY instead of
      UVERBS_LOOKUP_WRITE will do the work.
      
        refcount_t: underflow; use-after-free.
        WARNING: CPU: 0 PID: 1381 at lib/refcount.c:28 refcount_warn_saturate+0xfe/0x1a0
        Kernel panic - not syncing: panic_on_warn set ...
        CPU: 0 PID: 1381 Comm: syz-executor.0 Not tainted 5.5.0-rc3 #8
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x94/0xce
         panic+0x234/0x56f
         __warn+0x1cc/0x1e1
         report_bug+0x200/0x310
         fixup_bug.part.11+0x32/0x80
         do_error_trap+0xd3/0x100
         do_invalid_op+0x31/0x40
         invalid_op+0x1e/0x30
        RIP: 0010:refcount_warn_saturate+0xfe/0x1a0
        Code: 0f 0b eb 9b e8 23 f6 6d ff 80 3d 6c d4 19 03 00 75 8d e8 15 f6 6d ff 48 c7 c7 c0 02 55 bd c6 05 57 d4 19 03 01 e8 a2 58 49 ff <0f> 0b e9 6e ff ff ff e8 f6 f5 6d ff 80 3d 42 d4 19 03 00 0f 85 5c
        RSP: 0018:ffffc90002df7b98 EFLAGS: 00010282
        RAX: 0000000000000000 RBX: ffff88810f6a193c RCX: ffffffffba649009
        RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88811b0283cc
        RBP: 0000000000000003 R08: ffffed10236060e3 R09: ffffed10236060e3
        R10: 0000000000000001 R11: ffffed10236060e2 R12: ffff88810f6a193c
        R13: ffffc90002df7d60 R14: 0000000000000000 R15: ffff888116ae6a08
         uverbs_uobject_put+0xfd/0x140
         __uobj_perform_destroy+0x3d/0x60
         ib_uverbs_close_xrcd+0x148/0x170
         ib_uverbs_write+0xaa5/0xdf0
         __vfs_write+0x7c/0x100
         vfs_write+0x168/0x4a0
         ksys_write+0xc8/0x200
         do_syscall_64+0x9c/0x390
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x465b49
        Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
        RSP: 002b:00007f759d122c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
        RAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 0000000000465b49
        RDX: 000000000000000c RSI: 0000000020000080 RDI: 0000000000000003
        RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000246 R12: 00007f759d1236bc
        R13: 00000000004ca27c R14: 000000000070de40 R15: 00000000ffffffff
        Dumping ftrace buffer:
           (ftrace buffer empty)
        Kernel Offset: 0x39400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
      
      Fixes: 7452a3c7 ("IB/uverbs: Allow RDMA_REMOVE_DESTROY to work concurrently with disassociate")
      Link: https://lore.kernel.org/r/20200527135534.482279-1-leon@kernel.org
      
      
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      c85f4abe
    • Amir Goldstein's avatar
      fanotify: turn off support for FAN_DIR_MODIFY · f1793699
      Amir Goldstein authored
      FAN_DIR_MODIFY has been enabled by commit 44d705b0
      
       ("fanotify:
      report name info for FAN_DIR_MODIFY event") in 5.7-rc1. Now we are
      planning further extensions to the fanotify API and during that we
      realized that FAN_DIR_MODIFY may behave slightly differently to be more
      consistent with extensions we plan. So until we finalize these
      extensions, let's not bind our hands with exposing FAN_DIR_MODIFY to
      userland.
      
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      f1793699