1. 22 May, 2021 37 commits
    • Greg Kroah-Hartman's avatar
    • Andy Shevchenko's avatar
      scripts: switch explicitly to Python 3 · b63a8e5b
      Andy Shevchenko authored
      commit 51839e29
      
       upstream.
      
      Some distributions are about to switch to Python 3 support only.
      This means that /usr/bin/python, which is Python 2, is not available
      anymore. Hence, switch scripts to use Python 3 explicitly.
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b63a8e5b
    • Finn Behrens's avatar
      tweewide: Fix most Shebang lines · 2cbb4847
      Finn Behrens authored
      commit c25ce589
      
       upstream.
      
      Change every shebang which does not need an argument to use /usr/bin/env.
      This is needed as not every distro has everything under /usr/bin,
      sometimes not even bash.
      Signed-off-by: default avatarFinn Behrens <me@kloenk.de>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2cbb4847
    • Alexandru Elisei's avatar
      KVM: arm64: Initialize VCPU mdcr_el2 before loading it · 25249580
      Alexandru Elisei authored
      commit 263d6287 upstream.
      
      When a VCPU is created, the kvm_vcpu struct is initialized to zero in
      kvm_vm_ioctl_create_vcpu(). On VHE systems, the first time
      vcpu.arch.mdcr_el2 is loaded on hardware is in vcpu_load(), before it is
      set to a sensible value in kvm_arm_setup_debug() later in the run loop. The
      result is that KVM executes for a short time with MDCR_EL2 set to zero.
      
      This has several unintended consequences:
      
      * Setting MDCR_EL2.HPMN to 0 is constrained unpredictable according to ARM
        DDI 0487G.a, page D13-3820. The behavior specified by the architecture
        in this case is for the PE to behave as if MDCR_EL2.HPMN is set to a
        value less than or equal to PMCR_EL0.N, which means that an unknown
        number of counters are now disabled by MDCR_EL2.HPME, which is zero.
      
      * The host configuration for the other debug features controlled by
        MDCR_EL2 is temporarily lost. This has been harmless so far, as Linux
        doesn't use the other fields, but that might change in the future.
      
      Let's avoid both issues by initializing the VCPU's mdcr_el2 field in
      kvm_vcpu_vcpu_first_run_init(), thus making sure that the MDCR_EL2 register
      has a consistent value after each vcpu_load().
      
      Fixes: d5a21bcc
      
       ("KVM: arm64: Move common VHE/non-VHE trap config in separate functions")
      Signed-off-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20210407144857.199746-3-alexandru.elisei@arm.com
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25249580
    • Eric Dumazet's avatar
      ipv6: remove extra dev_hold() for fallback tunnels · 50e5c93c
      Eric Dumazet authored
      commit 0d7a7b20 upstream.
      
      My previous commits added a dev_hold() in tunnels ndo_init(),
      but forgot to remove it from special functions setting up fallback tunnels.
      
      Fallback tunnels do call their respective ndo_init()
      
      This leads to various reports like :
      
      unregister_netdevice: waiting for ip6gre0 to become free. Usage count = 2
      
      Fixes: 48bb5697 ("ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods")
      Fixes: 6289a98f ("sit: proper dev_{hold|put} in ndo_[un]init methods")
      Fixes: 40cb881b ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods")
      Fixes: 7f700334
      
       ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      50e5c93c
    • Eric Dumazet's avatar
      ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods · b811a8a7
      Eric Dumazet authored
      commit 48bb5697 upstream.
      
      Same reasons than for the previous commits :
      6289a98f ("sit: proper dev_{hold|put} in ndo_[un]init methods")
      40cb881b ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods")
      7f700334 ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods")
      
      After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
      a warning [1]
      
      Issue here is that:
      
      - all dev_put() should be paired with a corresponding prior dev_hold().
      
      - A driver doing a dev_put() in its ndo_uninit() MUST also
        do a dev_hold() in its ndo_init(), only when ndo_init()
        is returning 0.
      
      Otherwise, register_netdevice() would call ndo_uninit()
      in its error path and release a refcount too soon.
      
      [1]
      WARNING: CPU: 1 PID: 21059 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
      Modules linked in:
      CPU: 1 PID: 21059 Comm: syz-executor.4 Not tainted 5.12.0-rc4-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
      Code: 1d 6a 5a e8 09 31 ff 89 de e8 8d 1a ab fd 84 db 75 e0 e8 d4 13 ab fd 48 c7 c7 a0 e1 c1 89 c6 05 4a 5a e8 09 01 e8 2e 36 fb 04 <0f> 0b eb c4 e8 b8 13 ab fd 0f b6 1d 39 5a e8 09 31 ff 89 de e8 58
      RSP: 0018:ffffc900025aefe8 EFLAGS: 00010282
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: 0000000000040000 RSI: ffffffff815c51f5 RDI: fffff520004b5def
      RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff815bdf8e R11: 0000000000000000 R12: ffff888023488568
      R13: ffff8880254e9000 R14: 00000000dfd82cfd R15: ffff88802ee2d7c0
      FS:  00007f13bc590700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f0943e74000 CR3: 0000000025273000 CR4: 00000000001506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       __refcount_dec include/linux/refcount.h:344 [inline]
       refcount_dec include/linux/refcount.h:359 [inline]
       dev_put include/linux/netdevice.h:4135 [inline]
       ip6_tnl_dev_uninit+0x370/0x3d0 net/ipv6/ip6_tunnel.c:387
       register_netdevice+0xadf/0x1500 net/core/dev.c:10308
       ip6_tnl_create2+0x1b5/0x400 net/ipv6/ip6_tunnel.c:263
       ip6_tnl_newlink+0x312/0x580 net/ipv6/ip6_tunnel.c:2052
       __rtnl_newlink+0x1062/0x1710 net/core/rtnetlink.c:3443
       rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491
       rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
       netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
       netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
       netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
       sock_sendmsg_nosec net/socket.c:654 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:674
       ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Fixes: 919067cc
      
       ("net: add CONFIG_PCPU_DEV_REFCNT")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b811a8a7
    • Eric Dumazet's avatar
      sit: proper dev_{hold|put} in ndo_[un]init methods · f5ddecb6
      Eric Dumazet authored
      commit 6289a98f upstream.
      
      After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
      a warning [1]
      
      Issue here is that:
      
      - all dev_put() should be paired with a corresponding prior dev_hold().
      
      - A driver doing a dev_put() in its ndo_uninit() MUST also
        do a dev_hold() in its ndo_init(), only when ndo_init()
        is returning 0.
      
      Otherwise, register_netdevice() would call ndo_uninit()
      in its error path and release a refcount too soon.
      
      Fixes: 919067cc
      
       ("net: add CONFIG_PCPU_DEV_REFCNT")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5ddecb6
    • Eric Dumazet's avatar
      ip6_gre: proper dev_{hold|put} in ndo_[un]init methods · cca2a2b3
      Eric Dumazet authored
      commit 7f700334 upstream.
      
      After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
      a warning [1]
      
      Issue here is that:
      
      - all dev_put() should be paired with a corresponding dev_hold(),
        and vice versa.
      
      - A driver doing a dev_put() in its ndo_uninit() MUST also
        do a dev_hold() in its ndo_init(), only when ndo_init()
        is returning 0.
      
      Otherwise, register_netdevice() would call ndo_uninit()
      in its error path and release a refcount too soon.
      
      ip6_gre for example (among others problematic drivers)
      has to use dev_hold() in ip6gre_tunnel_init_common()
      instead of from ip6gre_newlink_common(), covering
      both ip6gre_tunnel_init() and ip6gre_tap_init()/
      
      Note that ip6gre_tunnel_init_common() is not called from
      ip6erspan_tap_init() thus we also need to add a dev_hold() there,
      as ip6erspan_tunnel_uninit() does call dev_put()
      
      [1]
      refcount_t: decrement hit 0; leaking memory.
      WARNING: CPU: 0 PID: 8422 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
      Modules linked in:
      CPU: 1 PID: 8422 Comm: syz-executor854 Not tainted 5.12.0-rc4-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31
      Code: 1d 6a 5a e8 09 31 ff 89 de e8 8d 1a ab fd 84 db 75 e0 e8 d4 13 ab fd 48 c7 c7 a0 e1 c1 89 c6 05 4a 5a e8 09 01 e8 2e 36 fb 04 <0f> 0b eb c4 e8 b8 13 ab fd 0f b6 1d 39 5a e8 09 31 ff 89 de e8 58
      RSP: 0018:ffffc900018befd0 EFLAGS: 00010282
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: ffff88801ef19c40 RSI: ffffffff815c51f5 RDI: fffff52000317dec
      RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffff815bdf8e R11: 0000000000000000 R12: ffff888018cf4568
      R13: ffff888018cf4c00 R14: ffff8880228f2000 R15: ffffffff8d659b80
      FS:  00000000014eb300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000055d7bf2b3138 CR3: 0000000014933000 CR4: 00000000001506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       __refcount_dec include/linux/refcount.h:344 [inline]
       refcount_dec include/linux/refcount.h:359 [inline]
       dev_put include/linux/netdevice.h:4135 [inline]
       ip6gre_tunnel_uninit+0x3d7/0x440 net/ipv6/ip6_gre.c:420
       register_netdevice+0xadf/0x1500 net/core/dev.c:10308
       ip6gre_newlink_common.constprop.0+0x158/0x410 net/ipv6/ip6_gre.c:1984
       ip6gre_newlink+0x275/0x7a0 net/ipv6/ip6_gre.c:2017
       __rtnl_newlink+0x1062/0x1710 net/core/rtnetlink.c:3443
       rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491
       rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
       netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
       netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
       netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
       sock_sendmsg_nosec net/socket.c:654 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:674
       ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
      
      Fixes: 919067cc
      
       ("net: add CONFIG_PCPU_DEV_REFCNT")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cca2a2b3
    • Yannick Vignon's avatar
      net: stmmac: Do not enable RX FIFO overflow interrupts · 084a1858
      Yannick Vignon authored
      [ Upstream commit 8a7cb245
      
       ]
      
      The RX FIFO overflows when the system is not able to process all received
      packets and they start accumulating (first in the DMA queue in memory,
      then in the FIFO). An interrupt is then raised for each overflowing packet
      and handled in stmmac_interrupt(). This is counter-productive, since it
      brings the system (or more likely, one CPU core) to its knees to process
      the FIFO overflow interrupts.
      
      stmmac_interrupt() handles overflow interrupts by writing the rx tail ptr
      into the corresponding hardware register (according to the MAC spec, this
      has the effect of restarting the MAC DMA). However, without freeing any rx
      descriptors, the DMA stops right away, and another overflow interrupt is
      raised as the FIFO overflows again. Since the DMA is already restarted at
      the end of stmmac_rx_refill() after freeing descriptors, disabling FIFO
      overflow interrupts and the corresponding handling code has no side effect,
      and eliminates the interrupt storm when the RX FIFO overflows.
      Signed-off-by: default avatarYannick Vignon <yannick.vignon@nxp.com>
      Link: https://lore.kernel.org/r/20210506143312.20784-1-yannick.vignon@oss.nxp.com
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      084a1858
    • Zqiang's avatar
      lib: stackdepot: turn depot_lock spinlock to raw_spinlock · 94600a83
      Zqiang authored
      [ Upstream commit 78564b94 ]
      
      In RT system, the spin_lock will be replaced by sleepable rt_mutex lock,
      in __call_rcu(), disable interrupts before calling
      kasan_record_aux_stack(), will trigger this calltrace:
      
        BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:951
        in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 19, name: pgdatinit0
        Call Trace:
          ___might_sleep.cold+0x1b2/0x1f1
          rt_spin_lock+0x3b/0xb0
          stack_depot_save+0x1b9/0x440
          kasan_save_stack+0x32/0x40
          kasan_record_aux_stack+0xa5/0xb0
          __call_rcu+0x117/0x880
          __exit_signal+0xafb/0x1180
          release_task+0x1d6/0x480
          exit_notify+0x303/0x750
          do_exit+0x678/0xcf0
          kthread+0x364/0x4f0
          ret_from_fork+0x22/0x30
      
      Replace spinlock with raw_spinlock.
      
      Link: https://lkml.kernel.org/r/20210329084009.27013-1-qiang.zhang@windriver.com
      
      Signed-off-by: default avatarZqiang <qiang.zhang@windriver.com>
      Reported-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Vijayanand Jitta <vjitta@codeaurora.org>
      Cc: Vinayak Menon <vinmenon@codeaurora.org>
      Cc: Yogesh Lal <ylal@codeaurora.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      94600a83
    • yangerkun's avatar
      block: reexpand iov_iter after read/write · 5233f446
      yangerkun authored
      [ Upstream commit cf7b39a0
      
       ]
      
      We get a bug:
      
      BUG: KASAN: slab-out-of-bounds in iov_iter_revert+0x11c/0x404
      lib/iov_iter.c:1139
      Read of size 8 at addr ffff0000d3fb11f8 by task
      
      CPU: 0 PID: 12582 Comm: syz-executor.2 Not tainted
      5.10.0-00843-g352c8610ccd2 #2
      Hardware name: linux,dummy-virt (DT)
      Call trace:
       dump_backtrace+0x0/0x2d0 arch/arm64/kernel/stacktrace.c:132
       show_stack+0x28/0x34 arch/arm64/kernel/stacktrace.c:196
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x110/0x164 lib/dump_stack.c:118
       print_address_description+0x78/0x5c8 mm/kasan/report.c:385
       __kasan_report mm/kasan/report.c:545 [inline]
       kasan_report+0x148/0x1e4 mm/kasan/report.c:562
       check_memory_region_inline mm/kasan/generic.c:183 [inline]
       __asan_load8+0xb4/0xbc mm/kasan/generic.c:252
       iov_iter_revert+0x11c/0x404 lib/iov_iter.c:1139
       io_read fs/io_uring.c:3421 [inline]
       io_issue_sqe+0x2344/0x2d64 fs/io_uring.c:5943
       __io_queue_sqe+0x19c/0x520 fs/io_uring.c:6260
       io_queue_sqe+0x2a4/0x590 fs/io_uring.c:6326
       io_submit_sqe fs/io_uring.c:6395 [inline]
       io_submit_sqes+0x4c0/0xa04 fs/io_uring.c:6624
       __do_sys_io_uring_enter fs/io_uring.c:9013 [inline]
       __se_sys_io_uring_enter fs/io_uring.c:8960 [inline]
       __arm64_sys_io_uring_enter+0x190/0x708 fs/io_uring.c:8960
       __invoke_syscall arch/arm64/kernel/syscall.c:36 [inline]
       invoke_syscall arch/arm64/kernel/syscall.c:48 [inline]
       el0_svc_common arch/arm64/kernel/syscall.c:158 [inline]
       do_el0_svc+0x120/0x290 arch/arm64/kernel/syscall.c:227
       el0_svc+0x1c/0x28 arch/arm64/kernel/entry-common.c:367
       el0_sync_handler+0x98/0x170 arch/arm64/kernel/entry-common.c:383
       el0_sync+0x140/0x180 arch/arm64/kernel/entry.S:670
      
      Allocated by task 12570:
       stack_trace_save+0x80/0xb8 kernel/stacktrace.c:121
       kasan_save_stack mm/kasan/common.c:48 [inline]
       kasan_set_track mm/kasan/common.c:56 [inline]
       __kasan_kmalloc+0xdc/0x120 mm/kasan/common.c:461
       kasan_kmalloc+0xc/0x14 mm/kasan/common.c:475
       __kmalloc+0x23c/0x334 mm/slub.c:3970
       kmalloc include/linux/slab.h:557 [inline]
       __io_alloc_async_data+0x68/0x9c fs/io_uring.c:3210
       io_setup_async_rw fs/io_uring.c:3229 [inline]
       io_read fs/io_uring.c:3436 [inline]
       io_issue_sqe+0x2954/0x2d64 fs/io_uring.c:5943
       __io_queue_sqe+0x19c/0x520 fs/io_uring.c:6260
       io_queue_sqe+0x2a4/0x590 fs/io_uring.c:6326
       io_submit_sqe fs/io_uring.c:6395 [inline]
       io_submit_sqes+0x4c0/0xa04 fs/io_uring.c:6624
       __do_sys_io_uring_enter fs/io_uring.c:9013 [inline]
       __se_sys_io_uring_enter fs/io_uring.c:8960 [inline]
       __arm64_sys_io_uring_enter+0x190/0x708 fs/io_uring.c:8960
       __invoke_syscall arch/arm64/kernel/syscall.c:36 [inline]
       invoke_syscall arch/arm64/kernel/syscall.c:48 [inline]
       el0_svc_common arch/arm64/kernel/syscall.c:158 [inline]
       do_el0_svc+0x120/0x290 arch/arm64/kernel/syscall.c:227
       el0_svc+0x1c/0x28 arch/arm64/kernel/entry-common.c:367
       el0_sync_handler+0x98/0x170 arch/arm64/kernel/entry-common.c:383
       el0_sync+0x140/0x180 arch/arm64/kernel/entry.S:670
      
      Freed by task 12570:
       stack_trace_save+0x80/0xb8 kernel/stacktrace.c:121
       kasan_save_stack mm/kasan/common.c:48 [inline]
       kasan_set_track+0x38/0x6c mm/kasan/common.c:56
       kasan_set_free_info+0x20/0x40 mm/kasan/generic.c:355
       __kasan_slab_free+0x124/0x150 mm/kasan/common.c:422
       kasan_slab_free+0x10/0x1c mm/kasan/common.c:431
       slab_free_hook mm/slub.c:1544 [inline]
       slab_free_freelist_hook mm/slub.c:1577 [inline]
       slab_free mm/slub.c:3142 [inline]
       kfree+0x104/0x38c mm/slub.c:4124
       io_dismantle_req fs/io_uring.c:1855 [inline]
       __io_free_req+0x70/0x254 fs/io_uring.c:1867
       io_put_req_find_next fs/io_uring.c:2173 [inline]
       __io_queue_sqe+0x1fc/0x520 fs/io_uring.c:6279
       __io_req_task_submit+0x154/0x21c fs/io_uring.c:2051
       io_req_task_submit+0x2c/0x44 fs/io_uring.c:2063
       task_work_run+0xdc/0x128 kernel/task_work.c:151
       get_signal+0x6f8/0x980 kernel/signal.c:2562
       do_signal+0x108/0x3a4 arch/arm64/kernel/signal.c:658
       do_notify_resume+0xbc/0x25c arch/arm64/kernel/signal.c:722
       work_pending+0xc/0x180
      
      blkdev_read_iter can truncate iov_iter's count since the count + pos may
      exceed the size of the blkdev. This will confuse io_read that we have
      consume the iovec. And once we do the iov_iter_revert in io_read, we
      will trigger the slab-out-of-bounds. Fix it by reexpand the count with
      size has been truncated.
      
      blkdev_write_iter can trigger the problem too.
      Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
      Acked-by: default avatarPavel Begunkov <asml.silencec@gmail.com>
      Link: https://lore.kernel.org/r/20210401071807.3328235-1-yangerkun@huawei.com
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5233f446
    • Hui Wang's avatar
      ALSA: hda: generic: change the DAC ctl name for LO+SPK or LO+HP · 48744773
      Hui Wang authored
      [ Upstream commit f48652bb ]
      
      Without this change, the DAC ctl's name could be changed only when
      the machine has both Speaker and Headphone, but we met some machines
      which only has Lineout and Headhpone, and the Lineout and Headphone
      share the Audio Mixer0 and DAC0, the ctl's name is set to "Front".
      
      On most of machines, the "Front" is used for Speaker only or Lineout
      only, but on this machine it is shared by Lineout and Headphone,
      This introduces an issue in the pipewire and pulseaudio, suppose users
      want the Headphone to be on and the Speaker/Lineout to be off, they
      could turn off the "Front", this works on most of the machines, but on
      this machine, the "Front" couldn't be turned off otherwise the
      headphone will be off too. Here we do some change to let the ctl's
      name change to "Headphone+LO" on this machine, and pipewire and
      pulseaudio already could handle "Headphone+LO" and "Speaker+LO".
      (https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/747)
      
      BugLink: http://bugs.launchpad.net/bugs/804178
      
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Link: https://lore.kernel.org/r/20210504073917.22406-1-hui.wang@canonical.com
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      48744773
    • Hans de Goede's avatar
      gpiolib: acpi: Add quirk to ignore EC wakeups on Dell Venue 10 Pro 5055 · 0ce1a72a
      Hans de Goede authored
      [ Upstream commit da91ece2
      
       ]
      
      Like some other Bay and Cherry Trail SoC based devices the Dell Venue
      10 Pro 5055 has an embedded-controller which uses ACPI GPIO events to
      report events instead of using the standard ACPI EC interface for this.
      
      The EC interrupt is only used to report battery-level changes and
      it keeps doing this while the system is suspended, causing the system
      to not stay suspended.
      
      Add an ignore-wake quirk for the GPIO pin used by the EC to fix the
      spurious wakeups from suspend.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0ce1a72a
    • Rodrigo Siqueira's avatar
      drm/amd/display: Fix two cursor duplication when using overlay · b3252a87
      Rodrigo Siqueira authored
      [ Upstream commit 16e9b3e5
      
       ]
      
      Our driver supports overlay planes, and as expected, some userspace
      compositor takes advantage of these features. If the userspace is not
      enabling the cursor, they can use multiple planes as they please.
      Nevertheless, we start to have constraints when userspace tries to
      enable hardware cursor with various planes. Basically, we cannot draw
      the cursor at the same size and position on two separated pipes since it
      uses extra bandwidth and DML only run with one cursor.
      
      For those reasons, when we enable hardware cursor and multiple planes,
      our driver should accept variations like the ones described below:
      
        +-------------+   +--------------+
        | +---------+ |   |              |
        | |Primary  | |   | Primary      |
        | |         | |   | Overlay      |
        | +---------+ |   |              |
        |Overlay      |   |              |
        +-------------+   +--------------+
      
      In this scenario, we can have the desktop UI in the overlay and some
      other framebuffer attached to the primary plane (e.g., video). However,
      userspace needs to obey some rules and avoid scenarios like the ones
      described below (when enabling hw cursor):
      
                                            +--------+
                                            |Overlay |
       +-------------+    +-----+-------+ +-|        |--+
       | +--------+  | +--------+       | | +--------+  |
       | |Overlay |  | |Overlay |       | |             |
       | |        |  | |        |       | |             |
       | +--------+  | +--------+       | |             |
       | Primary     |    | Primary     | | Primary     |
       +-------------+    +-------------+ +-------------+
      
       +-------------+   +-------------+
       |     +--------+  |  Primary    |
       |     |Overlay |  |             |
       |     |        |  |             |
       |     +--------+  | +--------+  |
       | Primary     |   | |Overlay |  |
       +-------------+   +-|        |--+
                           +--------+
      
      If the userspace violates some of the above scenarios, our driver needs
      to reject the commit; otherwise, we can have unexpected behavior. Since
      we don't have a proper driver validation for the above case, we can see
      some problems like a duplicate cursor in applications that use multiple
      planes. This commit fixes the cursor issue and others by adding adequate
      verification for multiple planes.
      
      Change since V1 (Harry and Sean):
      - Remove cursor verification from the equation.
      
      Cc: Louis Li <Ching-shih.Li@amd.com>
      Cc: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
      Cc: Harry Wentland <Harry.Wentland@amd.com>
      Cc: Hersen Wu <hersenxs.wu@amd.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3252a87
    • Zhang Zhengming's avatar
      bridge: Fix possible races between assigning rx_handler_data and setting IFF_BRIDGE_PORT bit · 6cc777c6
      Zhang Zhengming authored
      [ Upstream commit 59259ff7
      
       ]
      
      There is a crash in the function br_get_link_af_size_filtered,
      as the port_exists(dev) is true and the rx_handler_data of dev is NULL.
      But the rx_handler_data of dev is correct saved in vmcore.
      
      The oops looks something like:
       ...
       pc : br_get_link_af_size_filtered+0x28/0x1c8 [bridge]
       ...
       Call trace:
        br_get_link_af_size_filtered+0x28/0x1c8 [bridge]
        if_nlmsg_size+0x180/0x1b0
        rtnl_calcit.isra.12+0xf8/0x148
        rtnetlink_rcv_msg+0x334/0x370
        netlink_rcv_skb+0x64/0x130
        rtnetlink_rcv+0x28/0x38
        netlink_unicast+0x1f0/0x250
        netlink_sendmsg+0x310/0x378
        sock_sendmsg+0x4c/0x70
        __sys_sendto+0x120/0x150
        __arm64_sys_sendto+0x30/0x40
        el0_svc_common+0x78/0x130
        el0_svc_handler+0x38/0x78
        el0_svc+0x8/0xc
      
      In br_add_if(), we found there is no guarantee that
      assigning rx_handler_data to dev->rx_handler_data
      will before setting the IFF_BRIDGE_PORT bit of priv_flags.
      So there is a possible data competition:
      
      CPU 0:                                                        CPU 1:
      (RCU read lock)                                               (RTNL lock)
      rtnl_calcit()                                                 br_add_slave()
        if_nlmsg_size()                                               br_add_if()
          br_get_link_af_size_filtered()                              -> netdev_rx_handler_register
                                                                          ...
                                                                          // The order is not guaranteed
            ...                                                           -> dev->priv_flags |= IFF_BRIDGE_PORT;
            // The IFF_BRIDGE_PORT bit of priv_flags has been set
            -> if (br_port_exists(dev)) {
              // The dev->rx_handler_data has NOT been assigned
              -> p = br_port_get_rcu(dev);
              ....
                                                                          -> rcu_assign_pointer(dev->rx_handler_data, rx_handler_data);
                                                                           ...
      
      Fix it in br_get_link_af_size_filtered, using br_port_get_check_rcu() and checking the return value.
      Signed-off-by: default avatarZhang Zhengming <zhangzhengming@huawei.com>
      Reviewed-by: default avatarZhao Lei <zhaolei69@huawei.com>
      Reviewed-by: default avatarWang Xiaogang <wangxiaogang3@huawei.com>
      Suggested-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6cc777c6
    • Bodo Stroesser's avatar
      scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found · c5946eb5
      Bodo Stroesser authored
      [ Upstream commit 9814b55c ]
      
      If tcmu_handle_completions() finds an invalid cmd_id while looping over cmd
      responses from userspace it sets TCMU_DEV_BIT_BROKEN and breaks the
      loop. This means that it does further handling for the tcmu device.
      
      Skip that handling by replacing 'break' with 'return'.
      
      Additionally change tcmu_handle_completions() from unsigned int to bool,
      since the value used in return already is bool.
      
      Link: https://lore.kernel.org/r/20210423150123.24468-1-bostroesser@gmail.com
      
      Signed-off-by: default avatarBodo Stroesser <bostroesser@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5946eb5
    • Jeff Layton's avatar
      ceph: fix fscache invalidation · e39a105a
      Jeff Layton authored
      [ Upstream commit 10a7052c
      
       ]
      
      Ensure that we invalidate the fscache whenever we invalidate the
      pagecache.
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e39a105a
    • James Smart's avatar
      scsi: lpfc: Fix illegal memory access on Abort IOCBs · 13bc6bda
      James Smart authored
      [ Upstream commit e1364711 ]
      
      In devloss timer handler and in backend calls to terminate remote port I/O,
      there is logic to walk through all active IOCBs and validate them to
      potentially trigger an abort request. This logic is causing illegal memory
      accesses which leads to a crash. Abort IOCBs, which may be on the list, do
      not have an associated lpfc_io_buf struct. The driver is trying to map an
      lpfc_io_buf struct on the IOCB and which results in a bogus address thus
      the issue.
      
      Fix by skipping over ABORT IOCBs (CLOSE IOCBs are ABORTS that don't send
      ABTS) in the IOCB scan logic.
      
      Link: https://lore.kernel.org/r/20210421234433.102079-1-jsmart2021@gmail.com
      
      Co-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
      Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
      Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      13bc6bda
    • Nathan Chancellor's avatar
      riscv: Workaround mcount name prior to clang-13 · e69c7c14
      Nathan Chancellor authored
      [ Upstream commit 7ce04771 ]
      
      Prior to clang 13.0.0, the RISC-V name for the mcount symbol was
      "mcount", which differs from the GCC version of "_mcount", which results
      in the following errors:
      
      riscv64-linux-gnu-ld: init/main.o: in function `__traceiter_initcall_level':
      main.c:(.text+0xe): undefined reference to `mcount'
      riscv64-linux-gnu-ld: init/main.o: in function `__traceiter_initcall_start':
      main.c:(.text+0x4e): undefined reference to `mcount'
      riscv64-linux-gnu-ld: init/main.o: in function `__traceiter_initcall_finish':
      main.c:(.text+0x92): undefined reference to `mcount'
      riscv64-linux-gnu-ld: init/main.o: in function `.LBB32_28':
      main.c:(.text+0x30c): undefined reference to `mcount'
      riscv64-linux-gnu-ld: init/main.o: in function `free_initmem':
      main.c:(.text+0x54c): undefined reference to `mcount'
      
      This has been corrected in https://reviews.llvm.org/D98881 but the
      minimum supported clang version is 10.0.1. To avoid build errors and to
      gain a working function tracer, adjust the name of the mcount symbol for
      older versions of clang in mount.S and recordmcount.pl.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1331
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e69c7c14
    • Nathan Chancellor's avatar
      scripts/recordmcount.pl: Fix RISC-V regex for clang · cd3ab0ac
      Nathan Chancellor authored
      [ Upstream commit 2f095504 ]
      
      Clang can generate R_RISCV_CALL_PLT relocations to _mcount:
      
      $ llvm-objdump -dr build/riscv/init/main.o | rg mcount
                      000000000000000e:  R_RISCV_CALL_PLT     _mcount
                      000000000000004e:  R_RISCV_CALL_PLT     _mcount
      
      After this, the __start_mcount_loc section is properly generated and
      function tracing still works.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1331
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarFangrui Song <maskray@google.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cd3ab0ac
    • Manivannan Sadhasivam's avatar
      ARM: 9075/1: kernel: Fix interrupted SMC calls · cfa65174
      Manivannan Sadhasivam authored
      [ Upstream commit 57ac5166 ]
      
      On Qualcomm ARM32 platforms, the SMC call can return before it has
      completed. If this occurs, the call can be restarted, but it requires
      using the returned session ID value from the interrupted SMC call.
      
      The ARM32 SMCC code already has the provision to add platform specific
      quirks for things like this. So let's make use of it and add the
      Qualcomm specific quirk (ARM_SMCCC_QUIRK_QCOM_A6) used by the QCOM_SCM
      driver.
      
      This change is similar to the below one added for ARM64 a while ago:
      commit 82bcd087
      
       ("firmware: qcom: scm: Fix interrupted SCM calls")
      
      Without this change, the Qualcomm ARM32 platforms like SDX55 will return
      -EINVAL for SMC calls used for modem firmware loading and validation.
      Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cfa65174
    • Johannes Berg's avatar
      um: Disable CONFIG_GCOV with MODULES · a5923afb
      Johannes Berg authored
      [ Upstream commit ad3d1991 ]
      
      CONFIG_GCOV doesn't work with modules, and for various reasons
      it cannot work, see also
      https://lore.kernel.org/r/d36ea54d8c0a8dd706826ba844a6f27691f45d55.camel@sipsolutions.net
      
      
      
      Make CONFIG_GCOV depend on !MODULES to avoid anyone
      running into issues there. This also means we need
      not export the gcov symbols.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a5923afb
    • Johannes Berg's avatar
      um: Mark all kernel symbols as local · 2fe3fbcc
      Johannes Berg authored
      [ Upstream commit d5027ca6 ]
      
      Ritesh reported a bug [1] against UML, noting that it crashed on
      startup. The backtrace shows the following (heavily redacted):
      
      (gdb) bt
      ...
       #26 0x0000000060015b5d in sem_init () at ipc/sem.c:268
       #27 0x00007f89906d92f7 in ?? () from /lib/x86_64-linux-gnu/libcom_err.so.2
       #28 0x00007f8990ab8fb2 in call_init (...) at dl-init.c:72
      ...
       #40 0x00007f89909bf3a6 in nss_load_library (...) at nsswitch.c:359
      ...
       #44 0x00007f8990895e35 in _nss_compat_getgrnam_r (...) at nss_compat/compat-grp.c:486
       #45 0x00007f8990968b85 in __getgrnam_r [...]
       #46 0x00007f89909d6b77 in grantpt [...]
       #47 0x00007f8990a9394e in __GI_openpty [...]
       #48 0x00000000604a1f65 in openpty_cb (...) at arch/um/os-Linux/sigio.c:407
       #49 0x00000000604a58d0 in start_idle_thread (...) at arch/um/os-Linux/skas/process.c:598
       #50 0x0000000060004a3d in start_uml () at arch/um/kernel/skas/process.c:45
       #51 0x00000000600047b2 in linux_main (...) at arch/um/kernel/um_arch.c:334
       #52 0x000000006000574f in main (...) at arch/um/os-Linux/main.c:144
      
      indicating that the UML function openpty_cb() calls openpty(),
      which internally calls __getgrnam_r(), which causes the nsswitch
      machinery to get started.
      
      This loads, through lots of indirection that I snipped, the
      libcom_err.so.2 library, which (in an unknown function, "??")
      calls sem_init().
      
      Now, of course it wants to get libpthread's sem_init(), since
      it's linked against libpthread. However, the dynamic linker
      looks up that symbol against the binary first, and gets the
      kernel's sem_init().
      
      Hajime Tazaki noted that "objcopy -L" can localize a symbol,
      so the dynamic linker wouldn't do the lookup this way. I tried,
      but for some reason that didn't seem to work.
      
      Doing the same thing in the linker script instead does seem to
      work, though I cannot entirely explain - it *also* works if I
      just add "VERSION { { global: *; }; }" instead, indicating that
      something else is happening that I don't really understand. It
      may be that explicitly doing that marks them with some kind of
      empty version, and that's different from the default.
      
      Explicitly marking them with a version breaks kallsyms, so that
      doesn't seem to be possible.
      
      Marking all the symbols as local seems correct, and does seem
      to address the issue, so do that. Also do it for static link,
      nsswitch libraries could still be loaded there.
      
      [1] https://bugs.debian.org/983379
      
      Reported-by: default avatarRitesh Raj Sarraf <rrs@debian.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Acked-By: default avatarAnton Ivanov <anton.ivanov@cambridgegreys.com>
      Tested-By: default avatarRitesh Raj Sarraf <rrs@debian.org>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2fe3fbcc
    • Hans de Goede's avatar
      Input: silead - add workaround for x86 BIOS-es which bring the chip up in a stuck state · cec4c381
      Hans de Goede authored
      [ Upstream commit e4791877
      
       ]
      
      Some buggy BIOS-es bring up the touchscreen-controller in a stuck
      state where it blocks the I2C bus. Specifically this happens on
      the Jumper EZpad 7 tablet model.
      
      After much poking at this problem I have found that the following steps
      are necessary to unstuck the chip / bus:
      
      1. Turn off the Silead chip.
      2. Try to do an I2C transfer with the chip, this will fail in response to
         which the I2C-bus-driver will call: i2c_recover_bus() which will unstuck
         the I2C-bus. Note the unstuck-ing of the I2C bus only works if we first
         drop the chip of the bus by turning it off.
      3. Turn the chip back on.
      
      On the x86/ACPI systems were this problem is seen, step 1. and 3. require
      making ACPI calls and dealing with ACPI Power Resources. This commit adds
      a workaround which runtime-suspends the chip to turn it off, leaving it up
      to the ACPI subsystem to deal with all the ACPI specific details.
      
      There is no good way to detect this bug, so the workaround gets activated
      by a new "silead,stuck-controller-bug" boolean device-property. Since this
      is only used on x86/ACPI, this will be set by model specific device-props
      set by drivers/platform/x86/touchscreen_dmi.c. Therefor this new
      device-property is not documented in the DT-bindings.
      
      Dmesg will contain the following messages on systems where the workaround
      is activated:
      
      [   54.309029] silead_ts i2c-MSSL1680:00: [Firmware Bug]: Stuck I2C bus: please ignore the next 'controller timed out' error
      [   55.373593] i2c_designware 808622C1:04: controller timed out
      [   55.582186] silead_ts i2c-MSSL1680:00: Silead chip ID: 0x80360000
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210405202745.16777-1-hdegoede@redhat.com
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cec4c381
    • Hans de Goede's avatar
      Input: elants_i2c - do not bind to i2c-hid compatible ACPI instantiated devices · 29da2bab
      Hans de Goede authored
      [ Upstream commit 65299e8b ]
      
      Several users have been reporting that elants_i2c gives several errors
      during probe and that their touchscreen does not work on their Lenovo AMD
      based laptops with a touchscreen with a ELAN0001 ACPI hardware-id:
      
      [    0.550596] elants_i2c i2c-ELAN0001:00: i2c-ELAN0001:00 supply vcc33 not found, using dummy regulator
      [    0.551836] elants_i2c i2c-ELAN0001:00: i2c-ELAN0001:00 supply vccio not found, using dummy regulator
      [    0.560932] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121
      [    0.562427] elants_i2c i2c-ELAN0001:00: software reset failed: -121
      [    0.595925] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121
      [    0.597974] elants_i2c i2c-ELAN0001:00: software reset failed: -121
      [    0.621893] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (77 77 77 77): -121
      [    0.622504] elants_i2c i2c-ELAN0001:00: software reset failed: -121
      [    0.632650] elants_i2c i2c-ELAN0001:00: elants_i2c_send failed (4d 61 69 6e): -121
      [    0.634256] elants_i2c i2c-ELAN0001:00: boot failed: -121
      [    0.699212] elants_i2c i2c-ELAN0001:00: invalid 'hello' packet: 00 00 ff ff
      [    1.630506] elants_i2c i2c-ELAN0001:00: Failed to read fw id: -121
      [    1.645508] elants_i2c i2c-ELAN0001:00: unknown packet 00 00 ff ff
      
      Despite these errors, the elants_i2c driver stays bound to the device
      (it returns 0 from its probe method despite the errors), blocking the
      i2c-hid driver from binding.
      
      Manually unbinding the elants_i2c driver and binding the i2c-hid driver
      makes the touchscreen work.
      
      Check if the ACPI-fwnode for the touchscreen contains one of the i2c-hid
      compatiblity-id strings and if it has the I2C-HID spec's DSM to get the
      HID descriptor address, If it has both then make elants_i2c not bind,
      so that the i2c-hid driver can bind.
      
      This assumes that non of the (older) elan touchscreens which actually
      need the elants_i2c driver falsely advertise an i2c-hid compatiblity-id
      + DSM in their ACPI-fwnodes. If some of them actually do have this
      false advertising, then this change may lead to regressions.
      
      While at it also drop the unnecessary DEVICE_NAME prefixing of the
      "I2C check functionality error", dev_err already outputs the driver-name.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207759
      
      Acked-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210405202756.16830-1-hdegoede@redhat.com
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      29da2bab
    • Feilong Lin's avatar
      ACPI / hotplug / PCI: Fix reference count leak in enable_slot() · bbd7ba95
      Feilong Lin authored
      [ Upstream commit 3bbfd319 ]
      
      In enable_slot(), if pci_get_slot() returns NULL, we clear the SLOT_ENABLED
      flag. When pci_get_slot() finds a device, it increments the device's
      reference count.  In this case, we did not call pci_dev_put() to decrement
      the reference count, so the memory of the device (struct pci_dev type) will
      eventually leak.
      
      Call pci_dev_put() to decrement its reference count when pci_get_slot()
      returns a PCI device.
      
      Link: https://lore.kernel.org/r/b411af88-5049-a1c6-83ac-d104a1f429be@huawei.com
      
      Signed-off-by: default avatarFeilong Lin <linfeilong@huawei.com>
      Signed-off-by: default avatarZhiqiang Liu <liuzhiqiang26@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bbd7ba95
    • louis.wang's avatar
      ARM: 9066/1: ftrace: pause/unpause function graph tracer in cpu_suspend() · 64f8e952
      louis.wang authored
      [ Upstream commit 8252ca87 ]
      
      Enabling function_graph tracer on ARM causes kernel panic, because the
      function graph tracer updates the "return address" of a function in order
      to insert a trace callback on function exit, it saves the function's
      original return address in a return trace stack, but cpu_suspend() may not
      return through the normal return path.
      
      cpu_suspend() will resume directly via the cpu_resume path, but the return
      trace stack has been set-up by the subfunctions of cpu_suspend(), which
      makes the "return address" inconsistent with cpu_suspend().
      
      This patch refers to Commit de818bd4
      
      
      ("arm64: kernel: pause/unpause function graph tracer in cpu_suspend()"),
      
      fixes the issue by pausing/resuming the function graph tracer on the thread
      executing cpu_suspend(), so that the function graph tracer state is kept
      consistent across functions that enter power down states and never return
      by effectively disabling graph tracer while they are executing.
      Signed-off-by: default avatarlouis.wang <liang26812@gmail.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      64f8e952
    • Gustavo Pimentel's avatar
      dmaengine: dw-edma: Fix crash on loading/unloading driver · 41dd2ede
      Gustavo Pimentel authored
      [ Upstream commit e970dcc4
      
       ]
      
      When the driver is compiled as a module and loaded if we try to unload
      it, the Kernel shows a crash log. This Kernel crash is due to the
      dma_async_device_unregister() call done after deleting the channels,
      this patch fixes this issue.
      Signed-off-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Link: https://lore.kernel.org/r/4aa850c035cf7ee488f1d3fb6dee0e37be0dce0a.1613674948.git.gustavo.pimentel@synopsys.com
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      41dd2ede
    • Arnd Bergmann's avatar
      PCI: thunder: Fix compile testing · b003a492
      Arnd Bergmann authored
      [ Upstream commit 16f7ae59 ]
      
      Compile-testing these drivers is currently broken. Enabling it causes a
      couple of build failures though:
      
        drivers/pci/controller/pci-thunder-ecam.c:119:30: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
        drivers/pci/controller/pci-thunder-pem.c:54:2: error: implicit declaration of function 'writeq' [-Werror,-Wimplicit-function-declaration]
        drivers/pci/controller/pci-thunder-pem.c:392:8: error: implicit declaration of function 'acpi_get_rc_resources' [-Werror,-Wimplicit-function-declaration]
      
      Fix them with the obvious one-line changes.
      
      Link: https://lore.kernel.org/r/20210308152501.2135937-2-arnd@kernel.org
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
      Reviewed-by: default avatarRobert Richter <rric@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b003a492
    • Eric Dumazet's avatar
      virtio_net: Do not pull payload in skb->head · a05fb4ac
      Eric Dumazet authored
      [ Upstream commit 0f6925b3 ]
      
      Xuan Zhuo reported that commit 3226b158 ("net: avoid 32 x truesize
      under-estimation for tiny skbs") brought  a ~10% performance drop.
      
      The reason for the performance drop was that GRO was forced
      to chain sk_buff (using skb_shinfo(skb)->frag_list), which
      uses more memory but also cause packet consumers to go over
      a lot of overhead handling all the tiny skbs.
      
      It turns out that virtio_net page_to_skb() has a wrong strategy :
      It allocates skbs with GOOD_COPY_LEN (128) bytes in skb->head, then
      copies 128 bytes from the page, before feeding the packet to GRO stack.
      
      This was suboptimal before commit 3226b158 ("net: avoid 32 x truesize
      under-estimation for tiny skbs") because GRO was using 2 frags per MSS,
      meaning we were not packing MSS with 100% efficiency.
      
      Fix is to pull only the ethernet header in page_to_skb()
      
      Then, we change virtio_net_hdr_to_skb() to pull the missing
      headers, instead of assuming they were already pulled by callers.
      
      This fixes the performance regression, but could also allow virtio_net
      to accept packets with more than 128bytes of headers.
      
      Many thanks to Xuan Zhuo for his report, and his tests/help.
      
      Fixes: 3226b158
      
       ("net: avoid 32 x truesize under-estimation for tiny skbs")
      Reported-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
      Link: https://www.spinics.net/lists/netdev/msg731397.html
      
      Co-Developed-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
      Signed-off-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: virtualization@lists.linux-foundation.org
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a05fb4ac
    • Magnus Karlsson's avatar
      xsk: Simplify detection of empty and full rings · 0d08bbce
      Magnus Karlsson authored
      [ Upstream commit 11cc2d21
      
       ]
      
      In order to set the correct return flags for poll, the xsk code has to
      check if the Rx queue is empty and if the Tx queue is full. This code
      was unnecessarily large and complex as it used the functions that are
      used to update the local state from the global state (xskq_nb_free and
      xskq_nb_avail). Since we are not doing this nor updating any data
      dependent on this state, we can simplify the functions. Another
      benefit from this is that we can also simplify the xskq_nb_free and
      xskq_nb_avail functions in a later commit.
      Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/1576759171-28550-3-git-send-email-magnus.karlsson@intel.com
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0d08bbce
    • Josh Poimboeuf's avatar
      pinctrl: ingenic: Improve unreachable code generation · 323deeba
      Josh Poimboeuf authored
      [ Upstream commit d6d43a92
      
       ]
      
      In the second loop of ingenic_pinconf_set(), it annotates the switch
      default case as unreachable().  The annotation is technically correct,
      because that same case would have resulted in an early function return
      in the previous loop.
      
      However, the compiled code is suboptimal.  GCC seems to work extra hard
      to ensure that the unreachable code path triggers undefined behavior.
      The function would fall through to start executing whatever function
      happens to be next in the compilation unit.
      
      This is problematic because:
      
        a) it adds unnecessary 'ensure undefined behavior' logic, and
           corresponding i-cache footprint; and
      
        b) it's less robust -- if a bug were to be introduced, falling through
           to the next function would be catastrophic.
      
      Yet another issue is that, while objtool normally understands
      unreachable() annotations, there's one special case where it doesn't:
      when the annotation occurs immediately after a 'ret' instruction.  That
      happens to be the case here because unreachable() is immediately before
      the return.
      
      Remove the unreachable() annotation and replace it with a comment.  This
      simplifies the code generation and changes the unreachable error path to
      just silently return instead of corrupting execution.
      
      This fixes the following objtool warning:
      
        drivers/pinctrl/pinctrl-ingenic.o: warning: objtool: ingenic_pinconf_set() falls through to next function ingenic_pinconf_group_set()
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Link: https://lore.kernel.org/r/bc20fdbcb826512cf76b7dfd0972740875931b19.1582212881.git.jpoimboe@redhat.com
      
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      323deeba
    • Arnd Bergmann's avatar
      isdn: capi: fix mismatched prototypes · e57e2dd9
      Arnd Bergmann authored
      commit 5ee7d4c7
      
       upstream.
      
      gcc-11 complains about a prototype declaration that is different
      from the function definition:
      
      drivers/isdn/capi/kcapi.c:724:44: error: argument 2 of type ‘u8 *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=array-parameter=]
        724 | u16 capi20_get_manufacturer(u32 contr, u8 *buf)
            |                                        ~~~~^~~
      In file included from drivers/isdn/capi/kcapi.c:13:
      drivers/isdn/capi/kcapi.h:62:43: note: previously declared as an array ‘u8[64]’ {aka ‘unsigned char[64]’}
         62 | u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
            |                                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/isdn/capi/kcapi.c:790:38: error: argument 2 of type ‘u8 *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=array-parameter=]
        790 | u16 capi20_get_serial(u32 contr, u8 *serial)
            |                                  ~~~~^~~~~~
      In file included from drivers/isdn/capi/kcapi.c:13:
      drivers/isdn/capi/kcapi.h:64:37: note: previously declared as an array ‘u8[8]’ {aka ‘unsigned char[8]’}
         64 | u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
            |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~
      
      Change the definition to make them match.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e57e2dd9
    • Kaixu Xia's avatar
      cxgb4: Fix the -Wmisleading-indentation warning · 7958cdd6
      Kaixu Xia authored
      commit ea8146c6
      
       upstream.
      
      Fix the gcc warning:
      
      drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c:2673:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
       2673 |         for (i = 0; i < n; ++i) \
      Reported-by: default avatarTosk Robot <tencent_os_robot@tencent.com>
      Signed-off-by: default avatarKaixu Xia <kaixuxia@tencent.com>
      Link: https://lore.kernel.org/r/1604467444-23043-1-git-send-email-kaixuxia@tencent.com
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7958cdd6
    • Arnd Bergmann's avatar
      usb: sl811-hcd: improve misleading indentation · acb4faa5
      Arnd Bergmann authored
      commit 8460f600
      
       upstream.
      
      gcc-11 now warns about a confusingly indented code block:
      
      drivers/usb/host/sl811-hcd.c: In function ‘sl811h_hub_control’:
      drivers/usb/host/sl811-hcd.c:1291:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
       1291 |         if (*(u16*)(buf+2))     /* only if wPortChange is interesting */
            |         ^~
      drivers/usb/host/sl811-hcd.c:1295:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
       1295 |                 break;
      
      Rewrite this to use a single if() block with the __is_defined() macro.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20210322164244.827589-1-arnd@kernel.org
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      acb4faa5
    • Arnd Bergmann's avatar
      kgdb: fix gcc-11 warning on indentation · eabb93e3
      Arnd Bergmann authored
      commit 40cc3a80 upstream.
      
      gcc-11 starts warning about misleading indentation inside of macros:
      
      drivers/misc/kgdbts.c: In function ‘kgdbts_break_test’:
      drivers/misc/kgdbts.c:103:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
        103 |         if (verbose > 1) \
            |         ^~
      drivers/misc/kgdbts.c:200:9: note: in expansion of macro ‘v2printk’
        200 |         v2printk("kgdbts: breakpoint complete\n");
            |         ^~~~~~~~
      drivers/misc/kgdbts.c:105:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
        105 |                 touch_nmi_watchdog();   \
            |                 ^~~~~~~~~~~~~~~~~~
      
      The code looks correct to me, so just reindent it for readability.
      
      Fixes: e8d31c20
      
       ("kgdb: add kgdb internal test suite")
      Acked-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20210322164308.827846-1-arnd@kernel.org
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eabb93e3
    • Arnd Bergmann's avatar
      x86/msr: Fix wr/rdmsr_safe_regs_on_cpu() prototypes · b806b41b
      Arnd Bergmann authored
      commit 396a66aa
      
       upstream.
      
      gcc-11 warns about mismatched prototypes here:
      
        arch/x86/lib/msr-smp.c:255:51: error: argument 2 of type ‘u32 *’ {aka ‘unsigned int *’} declared as a pointer [-Werror=array-parameter=]
          255 | int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
              |                                              ~~~~~^~~~
        arch/x86/include/asm/msr.h:347:50: note: previously declared as an array ‘u32[8]’ {aka ‘unsigned int[8]’}
      
      GCC is right here - fix up the types.
      
      [ mingo: Twiddled the changelog. ]
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20210322164541.912261-1-arnd@kernel.org
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b806b41b
  2. 19 May, 2021 3 commits