1. 20 Oct, 2018 19 commits
    • Paolo Abeni's avatar
      ip6_tunnel: be careful when accessing the inner header · 20f16d1a
      Paolo Abeni authored
      [ Upstream commit 76c0ddd8 ]
      
      the ip6 tunnel xmit ndo assumes that the processed skb always
      contains an ip[v6] header, but syzbot has found a way to send
      frames that fall short of this assumption, leading to the following splat:
      
      BUG: KMSAN: uninit-value in ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1307
      [inline]
      BUG: KMSAN: uninit-value in ip6_tnl_start_xmit+0x7d2/0x1ef0
      net/ipv6/ip6_tunnel.c:1390
      CPU: 0 PID: 4504 Comm: syz-executor558 Not tainted 4.16.0+ #87
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Call Trace:
        __dump_stack lib/dump_stack.c:17 [inline]
        dump_stack+0x185/0x1d0 lib/dump_stack.c:53
        kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
        __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683
        ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1307 [inline]
        ip6_tnl_start_xmit+0x7d2/0x1ef0 net/ipv6/ip6_tunnel.c:1390
        __netdev_start_xmit include/linux/netdevice.h:4066 [inline]
        netdev_start_xmit include/linux/netdevice.h:4075 [inline]
        xmit_one net/core/dev.c:3026 [inline]
        dev_hard_start_xmit+0x5f1/0xc70 net/core/dev.c:3042
        __dev_queue_xmit+0x27ee/0x3520 net/core/dev.c:3557
        dev_queue_xmit+0x4b/0x60 net/core/dev.c:3590
        packet_snd net/packet/af_packet.c:2944 [inline]
        packet_sendmsg+0x7c70/0x8a30 net/packet/af_packet.c:2969
        sock_sendmsg_nosec net/socket.c:630 [inline]
        sock_sendmsg net/socket.c:640 [inline]
        ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046
        __sys_sendmmsg+0x42d/0x800 net/socket.c:2136
        SYSC_sendmmsg+0xc4/0x110 net/socket.c:2167
        SyS_sendmmsg+0x63/0x90 net/socket.c:2162
        do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
        entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      RIP: 0033:0x441819
      RSP: 002b:00007ffe58ee8268 EFLAGS: 00000213 ORIG_RAX: 0000000000000133
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000441819
      RDX: 0000000000000002 RSI: 0000000020000100 RDI: 0000000000000003
      RBP: 00000000006cd018 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000213 R12: 0000000000402510
      R13: 00000000004025a0 R14: 0000000000000000 R15: 0000000000000000
      
      Uninit was created at:
        kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
        kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188
        kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314
        kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321
        slab_post_alloc_hook mm/slab.h:445 [inline]
        slab_alloc_node mm/slub.c:2737 [inline]
        __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369
        __kmalloc_reserve net/core/skbuff.c:138 [inline]
        __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206
        alloc_skb include/linux/skbuff.h:984 [inline]
        alloc_skb_with_frags+0x1d4/0xb20 net/core/skbuff.c:5234
        sock_alloc_send_pskb+0xb56/0x1190 net/core/sock.c:2085
        packet_alloc_skb net/packet/af_packet.c:2803 [inline]
        packet_snd net/packet/af_packet.c:2894 [inline]
        packet_sendmsg+0x6454/0x8a30 net/packet/af_packet.c:2969
        sock_sendmsg_nosec net/socket.c:630 [inline]
        sock_sendmsg net/socket.c:640 [inline]
        ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046
        __sys_sendmmsg+0x42d/0x800 net/socket.c:2136
        SYSC_sendmmsg+0xc4/0x110 net/socket.c:2167
        SyS_sendmmsg+0x63/0x90 net/socket.c:2162
        do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
        entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      
      This change addresses the issue adding the needed check before
      accessing the inner header.
      
      The ipv4 side of the issue is apparently there since the ipv4 over ipv6
      initial support, and the ipv6 side predates git history.
      
      Fixes: c4d3efaf ("[IPV6] IP6TUNNEL: Add support to IPv4 over IPv6 tunnel.")
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Reported-by: syzbot+3fde91d4d394747d6db4@syzkaller.appspotmail.com
      Tested-by: default avatarAlexander Potapenko <glider@google.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      20f16d1a
    • Mahesh Bandewar's avatar
      bonding: avoid possible dead-lock · 2691921c
      Mahesh Bandewar authored
      [ Upstream commit d4859d74 ]
      
      Syzkaller reported this on a slightly older kernel but it's still
      applicable to the current kernel -
      
      ======================================================
      WARNING: possible circular locking dependency detected
      4.18.0-next-20180823+ #46 Not tainted
      ------------------------------------------------------
      syz-executor4/26841 is trying to acquire lock:
      00000000dd41ef48 ((wq_completion)bond_dev->name){+.+.}, at: flush_workqueue+0x2db/0x1e10 kernel/workqueue.c:2652
      
      but task is already holding lock:
      00000000768ab431 (rtnl_mutex){+.+.}, at: rtnl_lock net/core/rtnetlink.c:77 [inline]
      00000000768ab431 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x412/0xc30 net/core/rtnetlink.c:4708
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #2 (rtnl_mutex){+.+.}:
             __mutex_lock_common kernel/locking/mutex.c:925 [inline]
             __mutex_lock+0x171/0x1700 kernel/locking/mutex.c:1073
             mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088
             rtnl_lock+0x17/0x20 net/core/rtnetlink.c:77
             bond_netdev_notify drivers/net/bonding/bond_main.c:1310 [inline]
             bond_netdev_notify_work+0x44/0xd0 drivers/net/bonding/bond_main.c:1320
             process_one_work+0xc73/0x1aa0 kernel/workqueue.c:2153
             worker_thread+0x189/0x13c0 kernel/workqueue.c:2296
             kthread+0x35a/0x420 kernel/kthread.c:246
             ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:415
      
      -> #1 ((work_completion)(&(&nnw->work)->work)){+.+.}:
             process_one_work+0xc0b/0x1aa0 kernel/workqueue.c:2129
             worker_thread+0x189/0x13c0 kernel/workqueue.c:2296
             kthread+0x35a/0x420 kernel/kthread.c:246
             ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:415
      
      -> #0 ((wq_completion)bond_dev->name){+.+.}:
             lock_acquire+0x1e4/0x4f0 kernel/locking/lockdep.c:3901
             flush_workqueue+0x30a/0x1e10 kernel/workqueue.c:2655
             drain_workqueue+0x2a9/0x640 kernel/workqueue.c:2820
             destroy_workqueue+0xc6/0x9d0 kernel/workqueue.c:4155
             __alloc_workqueue_key+0xef9/0x1190 kernel/workqueue.c:4138
             bond_init+0x269/0x940 drivers/net/bonding/bond_main.c:4734
             register_netdevice+0x337/0x1100 net/core/dev.c:8410
             bond_newlink+0x49/0xa0 drivers/net/bonding/bond_netlink.c:453
             rtnl_newlink+0xef4/0x1d50 net/core/rtnetlink.c:3099
             rtnetlink_rcv_msg+0x46e/0xc30 net/core/rtnetlink.c:4711
             netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2454
             rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4729
             netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
             netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1343
             netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1908
             sock_sendmsg_nosec net/socket.c:622 [inline]
             sock_sendmsg+0xd5/0x120 net/socket.c:632
             ___sys_sendmsg+0x7fd/0x930 net/socket.c:2115
             __sys_sendmsg+0x11d/0x290 net/socket.c:2153
             __do_sys_sendmsg net/socket.c:2162 [inline]
             __se_sys_sendmsg net/socket.c:2160 [inline]
             __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
             do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
             entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      other info that might help us debug this:
      
      Chain exists of:
        (wq_completion)bond_dev->name --> (work_completion)(&(&nnw->work)->work) --> rtnl_mutex
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(rtnl_mutex);
                                     lock((work_completion)(&(&nnw->work)->work));
                                     lock(rtnl_mutex);
        lock((wq_completion)bond_dev->name);
      
       *** DEADLOCK ***
      
      1 lock held by syz-executor4/26841:
      
      stack backtrace:
      CPU: 1 PID: 26841 Comm: syz-executor4 Not tainted 4.18.0-next-20180823+ #46
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
       print_circular_bug.isra.34.cold.55+0x1bd/0x27d kernel/locking/lockdep.c:1222
       check_prev_add kernel/locking/lockdep.c:1862 [inline]
       check_prevs_add kernel/locking/lockdep.c:1975 [inline]
       validate_chain kernel/locking/lockdep.c:2416 [inline]
       __lock_acquire+0x3449/0x5020 kernel/locking/lockdep.c:3412
       lock_acquire+0x1e4/0x4f0 kernel/locking/lockdep.c:3901
       flush_workqueue+0x30a/0x1e10 kernel/workqueue.c:2655
       drain_workqueue+0x2a9/0x640 kernel/workqueue.c:2820
       destroy_workqueue+0xc6/0x9d0 kernel/workqueue.c:4155
       __alloc_workqueue_key+0xef9/0x1190 kernel/workqueue.c:4138
       bond_init+0x269/0x940 drivers/net/bonding/bond_main.c:4734
       register_netdevice+0x337/0x1100 net/core/dev.c:8410
       bond_newlink+0x49/0xa0 drivers/net/bonding/bond_netlink.c:453
       rtnl_newlink+0xef4/0x1d50 net/core/rtnetlink.c:3099
       rtnetlink_rcv_msg+0x46e/0xc30 net/core/rtnetlink.c:4711
       netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2454
       rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4729
       netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
       netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1343
       netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1908
       sock_sendmsg_nosec net/socket.c:622 [inline]
       sock_sendmsg+0xd5/0x120 net/socket.c:632
       ___sys_sendmsg+0x7fd/0x930 net/socket.c:2115
       __sys_sendmsg+0x11d/0x290 net/socket.c:2153
       __do_sys_sendmsg net/socket.c:2162 [inline]
       __se_sys_sendmsg net/socket.c:2160 [inline]
       __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
       do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x457089
      Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f2df20a5c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007f2df20a66d4 RCX: 0000000000457089
      RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
      RBP: 0000000000930140 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
      R13: 00000000004d40b8 R14: 00000000004c8ad8 R15: 0000000000000001
      Signed-off-by: default avatarMahesh Bandewar <maheshb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2691921c
    • Michael Chan's avatar
      bnxt_en: Fix TX timeout during netpoll. · 4348b966
      Michael Chan authored
      [ Upstream commit 73f21c65 ]
      
      The current netpoll implementation in the bnxt_en driver has problems
      that may miss TX completion events.  bnxt_poll_work() in effect is
      only handling at most 1 TX packet before exiting.  In addition,
      there may be in flight TX completions that ->poll() may miss even
      after we fix bnxt_poll_work() to handle all visible TX completions.
      netpoll may not call ->poll() again and HW may not generate IRQ
      because the driver does not ARM the IRQ when the budget (0 for netpoll)
      is reached.
      
      We fix it by handling all TX completions and to always ARM the IRQ
      when we exit ->poll() with 0 budget.
      
      Also, the logic to ACK the completion ring in case it is almost filled
      with TX completions need to be adjusted to take care of the 0 budget
      case, as discussed with Eric Dumazet <edumazet@google.com>
      Reported-by: default avatarSong Liu <songliubraving@fb.com>
      Reviewed-by: default avatarSong Liu <songliubraving@fb.com>
      Tested-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4348b966
    • Hou Tao's avatar
      jffs2: return -ERANGE when xattr buffer is too small · 5ac147eb
      Hou Tao authored
      When a file have multiple xattrs and the passed buffer is
      smaller than the required size, jffs2_listxattr() should
      return -ERANGE instead of continue, else Oops may occur
      due to memory corruption.
      
      Also remove the unnecessary check ("rc < 0"), because
      xhandle->list(...) will not return an error number.
      
      Spotted by generic/377 in xfstests-dev.
      
      NB: The problem had been fixed by commit 764a5c6b ("xattr
      handlers: Simplify list operation") in v4.5-rc1, but the
      modification in that commit may be too much because it modifies
      all file-systems which implement xattr, so I create a single
      patch for jffs2 to fix the problem.
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ac147eb
    • Mathias Nyman's avatar
      xhci: Don't print a warning when setting link state for disabled ports · f37a3ff6
      Mathias Nyman authored
      commit 1208d8a8 upstream.
      
      When disabling a USB3 port the hub driver will set the port link state to
      U3 to prevent "ejected" or "safely removed" devices that are still
      physically connected from immediately re-enumerating.
      
      If the device was really unplugged, then error messages were printed
      as the hub tries to set the U3 link state for a port that is no longer
      enabled.
      
      xhci-hcd ee000000.usb: Cannot set link state.
      usb usb8-port1: cannot disable (err = -32)
      
      Don't print error message in xhci-hub if hub tries to set port link state
      for a disabled port. Return -ENODEV instead which also silences hub driver.
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Tested-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarRoss Zwisler <zwisler@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f37a3ff6
    • Edgar Cherkasov's avatar
      i2c: i2c-scmi: fix for i2c_smbus_write_block_data · 86333409
      Edgar Cherkasov authored
      commit 08d9db00 upstream.
      
      The i2c-scmi driver crashes when the SMBus Write Block transaction is
      executed:
      
      WARNING: CPU: 9 PID: 2194 at mm/page_alloc.c:3931 __alloc_pages_slowpath+0x9db/0xec0
       Call Trace:
        ? get_page_from_freelist+0x49d/0x11f0
        ? alloc_pages_current+0x6a/0xe0
        ? new_slab+0x499/0x690
        __alloc_pages_nodemask+0x265/0x280
        alloc_pages_current+0x6a/0xe0
        kmalloc_order+0x18/0x40
        kmalloc_order_trace+0x24/0xb0
        ? acpi_ut_allocate_object_desc_dbg+0x62/0x10c
        __kmalloc+0x203/0x220
        acpi_os_allocate_zeroed+0x34/0x36
        acpi_ut_copy_eobject_to_iobject+0x266/0x31e
        acpi_evaluate_object+0x166/0x3b2
        acpi_smbus_cmi_access+0x144/0x530 [i2c_scmi]
        i2c_smbus_xfer+0xda/0x370
        i2cdev_ioctl_smbus+0x1bd/0x270
        i2cdev_ioctl+0xaa/0x250
        do_vfs_ioctl+0xa4/0x600
        SyS_ioctl+0x79/0x90
        do_syscall_64+0x73/0x130
        entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      ACPI Error: Evaluating _SBW: 4 (20170831/smbus_cmi-185)
      
      This problem occurs because the length of ACPI Buffer object is not
      defined/initialized in the code before a corresponding ACPI method is
      called. The obvious patch below fixes this issue.
      Signed-off-by: default avatarEdgar Cherkasov <echerkasov@dev.rtsoft.ru>
      Acked-by: default avatarViktor Krasnov <vkrasnov@dev.rtsoft.ru>
      Acked-by: default avatarMichael Brunner <Michael.Brunner@kontron.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86333409
    • Adrian Hunter's avatar
      perf script python: Fix export-to-postgresql.py occasional failure · 49f80e6e
      Adrian Hunter authored
      commit 25e11700 upstream.
      
      Occasional export failures were found to be caused by truncating 64-bit
      pointers to 32-bits. Fix by explicitly setting types for all ctype
      arguments and results.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180911114504.28516-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      49f80e6e
    • Mikulas Patocka's avatar
      mach64: detect the dot clock divider correctly on sparc · 2f41f387
      Mikulas Patocka authored
      commit 76ebebd2 upstream.
      
      On Sun Ultra 5, it happens that the dot clock is not set up properly for
      some videomodes. For example, if we set the videomode "r1024x768x60" in
      the firmware, Linux would incorrectly set a videomode with refresh rate
      180Hz when booting (suprisingly, my LCD monitor can display it, although
      display quality is very low).
      
      The reason is this: Older mach64 cards set the divider in the register
      VCLK_POST_DIV. The register has four 2-bit fields (the field that is
      actually used is specified in the lowest two bits of the register
      CLOCK_CNTL). The 2 bits select divider "1, 2, 4, 8". On newer mach64 cards,
      there's another bit added - the top four bits of PLL_EXT_CNTL extend the
      divider selection, so we have possible dividers "1, 2, 4, 8, 3, 5, 6, 12".
      The Linux driver clears the top four bits of PLL_EXT_CNTL and never sets
      them, so it can work regardless if the card supports them. However, the
      sparc64 firmware may set these extended dividers during boot - and the
      mach64 driver detects incorrect dot clock in this case.
      
      This patch makes the driver read the additional divider bit from
      PLL_EXT_CNTL and calculate the initial refresh rate properly.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Reviewed-by: default avatarVille Syrjälä <syrjala@sci.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2f41f387
    • Jann Horn's avatar
      mm/vmstat.c: fix outdated vmstat_text · 0f0ad8d5
      Jann Horn authored
      commit 28e2c4bb upstream.
      
      7a9cdebd ("mm: get rid of vmacache_flush_all() entirely") removed the
      VMACACHE_FULL_FLUSHES statistics, but didn't remove the corresponding
      entry in vmstat_text.  This causes an out-of-bounds access in
      vmstat_show().
      
      Luckily this only affects kernels with CONFIG_DEBUG_VM_VMACACHE=y, which
      is probably very rare.
      
      Link: http://lkml.kernel.org/r/20181001143138.95119-1-jannh@google.com
      Fixes: 7a9cdebd ("mm: get rid of vmacache_flush_all() entirely")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Christoph Lameter <clameter@sgi.com>
      Cc: Kemi Wang <kemi.wang@intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f0ad8d5
    • Theodore Ts'o's avatar
      ext4: add corruption check in ext4_xattr_set_entry() · 7a3d844f
      Theodore Ts'o authored
      commit 5369a762 upstream.
      
      In theory this should have been caught earlier when the xattr list was
      verified, but in case it got missed, it's simple enough to add check
      to make sure we don't overrun the xattr buffer.
      
      This addresses CVE-2018-10879.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=200001Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
      [bwh: Backported to 3.16:
       - Add inode parameter to ext4_xattr_set_entry() and update callers
       - Adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      [adjusted for 4.4 context]
      Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7a3d844f
    • Amber Lin's avatar
      drm/amdgpu: Fix SDMA HQD destroy error on gfx_v7 · d6a6d4e4
      Amber Lin authored
      [ Upstream commit caaa4c8a ]
      
      A wrong register bit was examinated for checking SDMA status so it reports
      false failures. This typo only appears on gfx_v7. gfx_v8 checks the correct
      bit.
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAmber Lin <Amber.Lin@amd.com>
      Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
      Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6a6d4e4
    • Nicolas Ferre's avatar
      ARM: dts: at91: add new compatibility string for macb on sama5d3 · 51b6ff44
      Nicolas Ferre authored
      [ Upstream commit 321cc359 ]
      
      We need this new compatibility string as we experienced different behavior
      for this 10/100Mbits/s macb interface on this particular SoC.
      Backward compatibility is preserved as we keep the alternative strings.
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      51b6ff44
    • Nicolas Ferre's avatar
      net: macb: disable scatter-gather for macb on sama5d3 · f74eda8e
      Nicolas Ferre authored
      [ Upstream commit eb4ed8e2 ]
      
      Create a new configuration for the sama5d3-macb new compatibility string.
      This configuration disables scatter-gather because we experienced lock down
      of the macb interface of this particular SoC under very high load.
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f74eda8e
    • Jongsung Kim's avatar
      stmmac: fix valid numbers of unicast filter entries · bd66767a
      Jongsung Kim authored
      [ Upstream commit edf2ef72 ]
      
      Synopsys DWC Ethernet MAC can be configured to have 1..32, 64, or
      128 unicast filter entries. (Table 7-8 MAC Address Registers from
      databook) Fix dwmac1000_validate_ucast_entries() to accept values
      between 1 and 32 in addition.
      Signed-off-by: default avatarJongsung Kim <neidhard.kim@lge.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd66767a
    • Yu Zhao's avatar
      sound: enable interrupt after dma buffer initialization · ba996b37
      Yu Zhao authored
      [ Upstream commit b61749a8 ]
      
      In snd_hdac_bus_init_chip(), we enable interrupt before
      snd_hdac_bus_init_cmd_io() initializing dma buffers. If irq has
      been acquired and irq handler uses the dma buffer, kernel may crash
      when interrupt comes in.
      
      Fix the problem by postponing enabling irq after dma buffer
      initialization. And warn once on null dma buffer pointer during the
      initialization.
      Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarYu Zhao <yuzhao@google.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba996b37
    • Tony Lindgren's avatar
      mfd: omap-usb-host: Fix dts probe of children · 8c207721
      Tony Lindgren authored
      [ Upstream commit 10492ee8 ]
      
      It currently only works if the parent bus uses "simple-bus". We
      currently try to probe children with non-existing compatible values.
      And we're missing .probe.
      
      I noticed this while testing devices configured to probe using ti-sysc
      interconnect target module driver. For that we also may want to rebind
      the driver, so let's remove __init and __exit.
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Acked-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c207721
    • Lei Yang's avatar
      selftests/efivarfs: add required kernel configs · ac386452
      Lei Yang authored
      [ Upstream commit 53cf59d6 ]
      
      add config file
      Signed-off-by: default avatarLei Yang <Lei.Yang@windriver.com>
      Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac386452
    • Danny Smith's avatar
      ASoC: sigmadsp: safeload should not have lower byte limit · a5aa8bd8
      Danny Smith authored
      [ Upstream commit 5ea752c6 ]
      
      Fixed range in safeload conditional to allow safeload to up to 20 bytes,
      without a lower limit.
      Signed-off-by: default avatarDanny Smith <dannys@axis.com>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a5aa8bd8
    • Pierre-Louis Bossart's avatar
      ASoC: wm8804: Add ACPI support · 1e3a440c
      Pierre-Louis Bossart authored
      [ Upstream commit 960cdd50 ]
      
      HID made of either Wolfson/CirrusLogic PCI ID + 8804 identifier.
      
      This helps enumerate the HifiBerry Digi+ HAT boards on the Up2 platform.
      
      The scripts at https://github.com/thesofproject/acpi-scripts can be
      used to add the ACPI initrd overlays.
      Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e3a440c
  2. 13 Oct, 2018 21 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.4.161 · b001adea
      Greg Kroah-Hartman authored
      b001adea
    • Gao Feng's avatar
      ebtables: arpreply: Add the standard target sanity check · 3a07d58f
      Gao Feng authored
      commit c953d635 upstream.
      
      The info->target comes from userspace and it would be used directly.
      So we need to add the sanity check to make sure it is a valid standard
      target, although the ebtables tool has already checked it. Kernel needs
      to validate anything coming from userspace.
      
      If the target is set as an evil value, it would break the ebtables
      and cause a panic. Because the non-standard target is treated as one
      offset.
      
      Now add one helper function ebt_invalid_target, and we would replace
      the macro INVALID_TARGET later.
      Signed-off-by: default avatarGao Feng <gfree.wind@vip.163.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Cc: Loic <hackurx@opensec.fr>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a07d58f
    • Zhi Chen's avatar
      ath10k: fix scan crash due to incorrect length calculation · 367222df
      Zhi Chen authored
      commit c8291988 upstream.
      
      Length of WMI scan message was not calculated correctly. The allocated
      buffer was smaller than what we expected. So WMI message corrupted
      skb_info, which is at the end of skb->data. This fix takes TLV header
      into account even if the element is zero-length.
      
      Crash log:
        [49.629986] Unhandled kernel unaligned access[#1]:
        [49.634932] CPU: 0 PID: 1176 Comm: logd Not tainted 4.4.60 #180
        [49.641040] task: 83051460 ti: 8329c000 task.ti: 8329c000
        [49.646608] $ 0   : 00000000 00000001 80984a80 00000000
        [49.652038] $ 4   : 45259e89 8046d484 8046df30 8024ba70
        [49.657468] $ 8   : 00000000 804cc4c0 00000001 20306320
        [49.662898] $12   : 33322037 000110f2 00000000 31203930
        [49.668327] $16   : 82792b40 80984a80 00000001 804207fc
        [49.673757] $20   : 00000000 0000012c 00000040 80470000
        [49.679186] $24   : 00000000 8024af7c
        [49.684617] $28   : 8329c000 8329db88 00000001 802c58d0
        [49.690046] Hi    : 00000000
        [49.693022] Lo    : 453c0000
        [49.696013] epc   : 800efae4 put_page+0x0/0x58
        [49.700615] ra    : 802c58d0 skb_release_data+0x148/0x1d4
        [49.706184] Status: 1000fc03 KERNEL EXL IE
        [49.710531] Cause : 00800010 (ExcCode 04)
        [49.714669] BadVA : 45259e89
        [49.717644] PrId  : 00019374 (MIPS 24Kc)
      Signed-off-by: default avatarZhi Chen <zhichen@codeaurora.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Cc: Brian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      367222df
    • Eric Dumazet's avatar
      tcp: add tcp_ooo_try_coalesce() helper · eee1af4e
      Eric Dumazet authored
      [ Upstream commit 58152ecb ]
      
      In case skb in out_or_order_queue is the result of
      multiple skbs coalescing, we would like to get a proper gso_segs
      counter tracking, so that future tcp_drop() can report an accurate
      number.
      
      I chose to not implement this tracking for skbs in receive queue,
      since they are not dropped, unless socket is disconnected.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eee1af4e
    • Eric Dumazet's avatar
      tcp: call tcp_drop() from tcp_data_queue_ofo() · be288481
      Eric Dumazet authored
      [ Upstream commit 8541b21e ]
      
      In order to be able to give better diagnostics and detect
      malicious traffic, we need to have better sk->sk_drops tracking.
      
      Fixes: 9f5afeae ("tcp: use an RB tree for ooo receive queue")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be288481
    • Eric Dumazet's avatar
      tcp: free batches of packets in tcp_prune_ofo_queue() · 352b6693
      Eric Dumazet authored
      [ Upstream commit 72cd43ba ]
      
      Juha-Matti Tilli reported that malicious peers could inject tiny
      packets in out_of_order_queue, forcing very expensive calls
      to tcp_collapse_ofo_queue() and tcp_prune_ofo_queue() for
      every incoming packet. out_of_order_queue rb-tree can contain
      thousands of nodes, iterating over all of them is not nice.
      
      Before linux-4.9, we would have pruned all packets in ofo_queue
      in one go, every XXXX packets. XXXX depends on sk_rcvbuf and skbs
      truesize, but is about 7000 packets with tcp_rmem[2] default of 6 MB.
      
      Since we plan to increase tcp_rmem[2] in the future to cope with
      modern BDP, can not revert to the old behavior, without great pain.
      
      Strategy taken in this patch is to purge ~12.5 % of the queue capacity.
      
      Fixes: 36a6503f ("tcp: refine tcp_prune_ofo_queue() to not drop all packets")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarJuha-Matti Tilli <juha-matti.tilli@iki.fi>
      Acked-by: default avatarYuchung Cheng <ycheng@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      352b6693
    • Eric Dumazet's avatar
      tcp: fix a stale ooo_last_skb after a replace · e7477751
      Eric Dumazet authored
      [ Upstream commit 76f0dcbb ]
      
      When skb replaces another one in ooo queue, I forgot to also
      update tp->ooo_last_skb as well, if the replaced skb was the last one
      in the queue.
      
      To fix this, we simply can re-use the code that runs after an insertion,
      trying to merge skbs at the right of current skb.
      
      This not only fixes the bug, but also remove all small skbs that might
      be a subset of the new one.
      
      Example:
      
      We receive segments 2001:3001,  4001:5001
      
      Then we receive 2001:8001 : We should replace 2001:3001 with the big
      skb, but also remove 4001:50001 from the queue to save space.
      
      packetdrill test demonstrating the bug
      
      0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
      +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
      +0 bind(3, ..., ...) = 0
      +0 listen(3, 1) = 0
      
      +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
      +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
      +0.100 < . 1:1(0) ack 1 win 1024
      +0 accept(3, ..., ...) = 4
      
      +0.01 < . 1001:2001(1000) ack 1 win 1024
      +0    > . 1:1(0) ack 1 <nop,nop, sack 1001:2001>
      
      +0.01 < . 1001:3001(2000) ack 1 win 1024
      +0    > . 1:1(0) ack 1 <nop,nop, sack 1001:2001 1001:3001>
      
      Fixes: 9f5afeae ("tcp: use an RB tree for ooo receive queue")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarYuchung Cheng <ycheng@google.com>
      Cc: Yaogong Wang <wygivan@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7477751
    • Yaogong Wang's avatar
      tcp: use an RB tree for ooo receive queue · 4666b6e2
      Yaogong Wang authored
      [ Upstream commit 9f5afeae ]
      
      Over the years, TCP BDP has increased by several orders of magnitude,
      and some people are considering to reach the 2 Gbytes limit.
      
      Even with current window scale limit of 14, ~1 Gbytes maps to ~740,000
      MSS.
      
      In presence of packet losses (or reorders), TCP stores incoming packets
      into an out of order queue, and number of skbs sitting there waiting for
      the missing packets to be received can be in the 10^5 range.
      
      Most packets are appended to the tail of this queue, and when
      packets can finally be transferred to receive queue, we scan the queue
      from its head.
      
      However, in presence of heavy losses, we might have to find an arbitrary
      point in this queue, involving a linear scan for every incoming packet,
      throwing away cpu caches.
      
      This patch converts it to a RB tree, to get bounded latencies.
      
      Yaogong wrote a preliminary patch about 2 years ago.
      Eric did the rebase, added ofo_last_skb cache, polishing and tests.
      
      Tested with network dropping between 1 and 10 % packets, with good
      success (about 30 % increase of throughput in stress tests)
      
      Next step would be to also use an RB tree for the write queue at sender
      side ;)
      Signed-off-by: default avatarYaogong Wang <wygivan@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Yuchung Cheng <ycheng@google.com>
      Cc: Neal Cardwell <ncardwell@google.com>
      Cc: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
      Acked-By: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4666b6e2
    • Eric Dumazet's avatar
      tcp: increment sk_drops for dropped rx packets · ec7055c6
      Eric Dumazet authored
      [ Upstream commit 532182cd ]
      
      Now ss can report sk_drops, we can instruct TCP to increment
      this per socket counter when it drops an incoming frame, to refine
      monitoring and debugging.
      
      Following patch takes care of listeners drops.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec7055c6
    • Richard Weinberger's avatar
      ubifs: Check for name being NULL while mounting · c4c84454
      Richard Weinberger authored
      commit 37f31b6c upstream.
      
      The requested device name can be NULL or an empty string.
      Check for that and refuse to continue. UBIFS has to do this manually
      since we cannot use mount_bdev(), which checks for this condition.
      
      Fixes: 1e51764a ("UBIFS: add new flash file system")
      Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c4c84454
    • Cong Wang's avatar
      ucma: fix a use-after-free in ucma_resolve_ip() · 38ea605f
      Cong Wang authored
      commit 5fe23f26 upstream.
      
      There is a race condition between ucma_close() and ucma_resolve_ip():
      
      CPU0				CPU1
      ucma_resolve_ip():		ucma_close():
      
      ctx = ucma_get_ctx(file, cmd.id);
      
              list_for_each_entry_safe(ctx, tmp, &file->ctx_list, list) {
                      mutex_lock(&mut);
                      idr_remove(&ctx_idr, ctx->id);
                      mutex_unlock(&mut);
      		...
                      mutex_lock(&mut);
                      if (!ctx->closing) {
                              mutex_unlock(&mut);
                              rdma_destroy_id(ctx->cm_id);
      		...
                      ucma_free_ctx(ctx);
      
      ret = rdma_resolve_addr();
      ucma_put_ctx(ctx);
      
      Before idr_remove(), ucma_get_ctx() could still find the ctx
      and after rdma_destroy_id(), rdma_resolve_addr() may still
      access id_priv pointer. Also, ucma_put_ctx() may use ctx after
      ucma_free_ctx() too.
      
      ucma_close() should call ucma_put_ctx() too which tests the
      refcnt and waits for the last one releasing it. The similar
      pattern is already used by ucma_destroy_id().
      
      Reported-and-tested-by: syzbot+da2591e115d57a9cbb8b@syzkaller.appspotmail.com
      Reported-by: syzbot+cfe3c1e8ef634ba8964b@syzkaller.appspotmail.com
      Cc: Jason Gunthorpe <jgg@mellanox.com>
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: Leon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38ea605f
    • Vineet Gupta's avatar
      ARC: clone syscall to setp r25 as thread pointer · b4dd80c3
      Vineet Gupta authored
      commit c58a584f upstream.
      
      Per ARC TLS ABI, r25 is designated TP (thread pointer register).
      However so far kernel didn't do any special treatment, like setting up
      usermode r25, even for CLONE_SETTLS. We instead relied on libc runtime
      to do this, in say clone libc wrapper [1]. This was deliberate to keep
      kernel ABI agnostic (userspace could potentially change TP, specially
      for different ARC ISA say ARCompact vs. ARCv2 with different spare
      registers etc)
      
      However userspace setting up r25, after clone syscall opens a race, if
      child is not scheduled and gets a signal instead. It starts off in
      userspace not in clone but in a signal handler and anything TP sepcific
      there such as pthread_self() fails which showed up with uClibc
      testsuite nptl/tst-kill6 [2]
      
      Fix this by having kernel populate r25 to TP value. So this locks in
      ABI, but it was not going to change anyways, and fwiw is same for both
      ARCompact (arc700 core) and ARCvs (HS3x cores)
      
      [1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/clone.S
      [2] https://github.com/wbx-github/uclibc-ng-test/blob/master/test/nptl/tst-kill6.c
      
      Fixes: ARC STAR 9001378481
      Cc: stable@vger.kernel.org
      Reported-by: default avatarNikita Sobolev <sobolev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4dd80c3
    • Michal Suchanek's avatar
      powerpc/fadump: Return error when fadump registration fails · 0cbf366a
      Michal Suchanek authored
      commit 98b8cd7f upstream.
      
       - log an error message when registration fails and no error code listed
         in the switch is returned
       - translate the hv error code to posix error code and return it from
         fw_register
       - return the posix error code from fw_register to the process writing
         to sysfs
       - return EEXIST on re-registration
       - return success on deregistration when fadump is not registered
       - return ENODEV when no memory is reserved for fadump
      Signed-off-by: default avatarMichal Suchanek <msuchanek@suse.de>
      Tested-by: default avatarHari Bathini <hbathini@linux.vnet.ibm.com>
      [mpe: Use pr_err() to shrink the error print]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Cc: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0cbf366a
    • Carl Huang's avatar
      ath10k: fix use-after-free in ath10k_wmi_cmd_send_nowait · 023fdb64
      Carl Huang authored
      commit 9ef0f58e upstream.
      
      The skb may be freed in tx completion context before
      trace_ath10k_wmi_cmd is called. This can be easily captured when
      KASAN(Kernel Address Sanitizer) is enabled. The fix is to move
      trace_ath10k_wmi_cmd before the send operation. As the ret has no
      meaning in trace_ath10k_wmi_cmd then, so remove this parameter too.
      Signed-off-by: default avatarCarl Huang <cjhuang@codeaurora.org>
      Tested-by: default avatarBrian Norris <briannorris@chromium.org>
      Reviewed-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      023fdb64
    • Prateek Sood's avatar
      cgroup: Fix deadlock in cpu hotplug path · 75fe5488
      Prateek Sood authored
      commit 116d2f74 upstream.
      
      Deadlock during cgroup migration from cpu hotplug path when a task T is
      being moved from source to destination cgroup.
      
      kworker/0:0
      cpuset_hotplug_workfn()
         cpuset_hotplug_update_tasks()
            hotplug_update_tasks_legacy()
              remove_tasks_in_empty_cpuset()
                cgroup_transfer_tasks() // stuck in iterator loop
                  cgroup_migrate()
                    cgroup_migrate_add_task()
      
      In cgroup_migrate_add_task() it checks for PF_EXITING flag of task T.
      Task T will not migrate to destination cgroup. css_task_iter_start()
      will keep pointing to task T in loop waiting for task T cg_list node
      to be removed.
      
      Task T
      do_exit()
        exit_signals() // sets PF_EXITING
        exit_task_namespaces()
          switch_task_namespaces()
            free_nsproxy()
              put_mnt_ns()
                drop_collected_mounts()
                  namespace_unlock()
                    synchronize_rcu()
                      _synchronize_rcu_expedited()
                        schedule_work() // on cpu0 low priority worker pool
                        wait_event() // waiting for work item to execute
      
      Task T inserted a work item in the worklist of cpu0 low priority
      worker pool. It is waiting for expedited grace period work item
      to execute. This work item will only be executed once kworker/0:0
      complete execution of cpuset_hotplug_workfn().
      
      kworker/0:0 ==> Task T ==>kworker/0:0
      
      In case of PF_EXITING task being migrated from source to destination
      cgroup, migrate next available task in source cgroup.
      Signed-off-by: default avatarPrateek Sood <prsood@codeaurora.org>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      [AmitP: Upstream commit cherry-pick failed, so I picked the
              backported changes from CAF/msm-4.9 tree instead:
              https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=49b74f1696417b270c89cd893ca9f37088928078]
      Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75fe5488
    • Theodore Ts'o's avatar
      ext4: always verify the magic number in xattr blocks · fb751efb
      Theodore Ts'o authored
      commit 513f86d7 upstream.
      
      If there an inode points to a block which is also some other type of
      metadata block (such as a block allocation bitmap), the
      buffer_verified flag can be set when it was validated as that other
      metadata block type; however, it would make a really terrible external
      attribute block.  The reason why we use the verified flag is to avoid
      constantly reverifying the block.  However, it doesn't take much
      overhead to make sure the magic number of the xattr block is correct,
      and this will avoid potential crashes.
      
      This addresses CVE-2018-10879.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=200001Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
      [Backported to 4.4: adjust context]
      Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb751efb
    • Guenter Roeck's avatar
      of: unittest: Disable interrupt node tests for old world MAC systems · 26f9ef6c
      Guenter Roeck authored
      commit 88948914 upstream.
      
      On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the
      devicetree interrupt parsing code is different, causing unit tests of
      devicetree interrupt nodes to fail. Due to a bug in unittest code, which
      tries to dereference an uninitialized pointer, this results in a crash.
      
      OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property
      Unable to handle kernel paging request for data at address 0x00bc616e
      Faulting instruction address: 0xc08e9468
      Oops: Kernel access of bad area, sig: 11 [#1]
      BE PREEMPT PowerMac
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1
      task: cf8e0000 task.stack: cf8da000
      NIP:  c08e9468 LR: c08ea5bc CTR: c08ea5ac
      REGS: cf8dbb50 TRAP: 0300   Not tainted  (4.14.72-rc1-yocto-standard+)
      MSR:  00001032 <ME,IR,DR,RI>  CR: 82004044  XER: 00000000
      DAR: 00bc616e DSISR: 40000000
      GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002
      GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000
      GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8
      GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517
      
      NIP [c08e9468] device_node_gen_full_name+0x30/0x15c
      LR [c08ea5bc] device_node_string+0x190/0x3c8
      Call Trace:
      [cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable)
      [cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8
      [cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0
      [cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec
      [cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48
      [cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c
      [cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130
      [cf8dbdd0] [c008ff54] printk+0x5c/0x6c
      [cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8
      [cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184
      [cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8
      [cf8dbf30] [c0004814] kernel_init+0x24/0x118
      [cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64
      
      The problem was observed when running a qemu test for the g3beige machine
      with devicetree unittests enabled.
      
      Disable interrupt node tests on affected systems to avoid both false
      unittest failures and the crash.
      
      With this patch in place, unittest on the affected system passes with
      the following message.
      
      	dt-test ### end of unittest - 144 passed, 0 failed
      
      Fixes: 53a42093 ("of: Add device tree selftests")
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: default avatarFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26f9ef6c
    • Johan Hovold's avatar
      USB: serial: simple: add Motorola Tetra MTP6550 id · d70a6783
      Johan Hovold authored
      commit f5fad711 upstream.
      
      Add device-id for the Motorola Tetra radio MTP6550.
      
      Bus 001 Device 004: ID 0cad:9012 Motorola CGISS
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            0 (Defined at Interface level)
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x0cad Motorola CGISS
        idProduct          0x9012
        bcdDevice           24.16
        iManufacturer           1 Motorola Solutions, Inc.
        iProduct                2 TETRA PEI interface
        iSerial                 0
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength           55
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          3 Generic Serial config
          bmAttributes         0x80
            (Bus Powered)
          MaxPower              500mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x01  EP 1 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass       255 Vendor Specific Class
            bInterfaceSubClass      0
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x82  EP 2 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0200  1x 512 bytes
              bInterval               0
      Device Qualifier (for other device speed):
        bLength                10
        bDescriptorType         6
        bcdUSB               2.00
        bDeviceClass            0 (Defined at Interface level)
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        bNumConfigurations      1
      Device Status:     0x0000
        (Bus Powered)
      Reported-by: default avatarHans Hult <hanshult35@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d70a6783
    • Mathias Nyman's avatar
      xhci: Add missing CAS workaround for Intel Sunrise Point xHCI · ed8649a4
      Mathias Nyman authored
      commit ffe84e01 upstream.
      
      The workaround for missing CAS bit is also needed for xHC on Intel
      sunrisepoint PCH. For more details see:
      
      Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed8649a4
    • Mike Snitzer's avatar
      dm cache: fix resize crash if user doesn't reload cache table · dce70880
      Mike Snitzer authored
      commit 5d07384a upstream.
      
      A reload of the cache's DM table is needed during resize because
      otherwise a crash will occur when attempting to access smq policy
      entries associated with the portion of the cache that was recently
      extended.
      
      The reason is cache-size based data structures in the policy will not be
      resized, the only way to safely extend the cache is to allow for a
      proper cache policy initialization that occurs when the cache table is
      loaded.  For example the smq policy's space_init(), init_allocator(),
      calc_hotspot_params() must be sized based on the extended cache size.
      
      The fix for this is to disallow cache resizes of this pattern:
      1) suspend "cache" target's device
      2) resize the fast device used for the cache
      3) resume "cache" target's device
      
      Instead, the last step must be a full reload of the cache's DM table.
      
      Fixes: 66a63635 ("dm cache: add stochastic-multi-queue (smq) policy")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dce70880
    • Rafael J. Wysocki's avatar
      PM / core: Clear the direct_complete flag on errors · 1516d9fa
      Rafael J. Wysocki authored
      commit 69e445ab upstream.
      
      If __device_suspend() runs asynchronously (in which case the device
      passed to it is in dpm_suspended_list at that point) and it returns
      early on an error or pending wakeup, and the power.direct_complete
      flag has been set for the device already, the subsequent
      device_resume() will be confused by that and it will call
      pm_runtime_enable() incorrectly, as runtime PM has not been
      disabled for the device by __device_suspend().
      
      To avoid that, clear power.direct_complete if __device_suspend()
      is not going to disable runtime PM for the device before returning.
      
      Fixes: aae4518b (PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily)
      Reported-by: default avatarAl Cooper <alcooperx@gmail.com>
      Tested-by: default avatarAl Cooper <alcooperx@gmail.com>
      Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Cc: 3.16+ <stable@vger.kernel.org> # 3.16+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1516d9fa