1. 12 Jan, 2020 40 commits
    • Petr Machata's avatar
      net: sch_prio: When ungrafting, replace with FIFO · f863b71a
      Petr Machata authored
      [ Upstream commit 240ce7f6 ]
      
      When a child Qdisc is removed from one of the PRIO Qdisc's bands, it is
      replaced unconditionally by a NOOP qdisc. As a result, any traffic hitting
      that band gets dropped. That is incorrect--no Qdisc was explicitly added
      when PRIO was created, and after removal, none should have to be added
      either.
      
      Fix PRIO by first attempting to create a default Qdisc and only falling
      back to noop when that fails. This pattern of attempting to create an
      invisible FIFO, using NOOP only as a fallback, is also seen in other
      Qdiscs.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f863b71a
    • Eric Dumazet's avatar
      vlan: vlan_changelink() should propagate errors · 8ed5bb1b
      Eric Dumazet authored
      [ Upstream commit eb8ef2a3 ]
      
      Both vlan_dev_change_flags() and vlan_dev_set_egress_priority()
      can return an error. vlan_changelink() should not ignore them.
      
      Fixes: 07b5b17e ("[VLAN]: Use rtnl_link API")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ed5bb1b
    • Hangbin Liu's avatar
      vxlan: fix tos value before xmit · 57574c58
      Hangbin Liu authored
      [ Upstream commit 71130f29 ]
      
      Before ip_tunnel_ecn_encap() and udp_tunnel_xmit_skb() we should filter
      tos value by RT_TOS() instead of using config tos directly.
      
      vxlan_get_route() would filter the tos to fl4.flowi4_tos but we didn't
      return it back, as geneve_get_v4_rt() did. So we have to use RT_TOS()
      directly in function ip_tunnel_ecn_encap().
      
      Fixes: 206aaafc ("VXLAN: Use IP Tunnels tunnel ENC encap API")
      Fixes: 1400615d ("vxlan: allow setting ipv6 traffic class")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      57574c58
    • Pengcheng Yang's avatar
      tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK · ea3cc787
      Pengcheng Yang authored
      [ Upstream commit c9655008 ]
      
      When we receive a D-SACK, where the sequence number satisfies:
      	undo_marker <= start_seq < end_seq <= prior_snd_una
      we consider this is a valid D-SACK and tcp_is_sackblock_valid()
      returns true, then this D-SACK is discarded as "old stuff",
      but the variable first_sack_index is not marked as negative
      in tcp_sacktag_write_queue().
      
      If this D-SACK also carries a SACK that needs to be processed
      (for example, the previous SACK segment was lost), this SACK
      will be treated as a D-SACK in the following processing of
      tcp_sacktag_write_queue(), which will eventually lead to
      incorrect updates of undo_retrans and reordering.
      
      Fixes: fd6dad61 ("[TCP]: Earlier SACK block verification & simplify access to them")
      Signed-off-by: default avatarPengcheng Yang <yangpc@wangsu.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ea3cc787
    • Xin Long's avatar
      sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY · 86c2a390
      Xin Long authored
      [ Upstream commit be7a7729 ]
      
      This patch is to fix a memleak caused by no place to free cmd->obj.chunk
      for the unprocessed SCTP_CMD_REPLY. This issue occurs when failing to
      process a cmd while there're still SCTP_CMD_REPLY cmds on the cmd seq
      with an allocated chunk in cmd->obj.chunk.
      
      So fix it by freeing cmd->obj.chunk for each SCTP_CMD_REPLY cmd left on
      the cmd seq when any cmd returns error. While at it, also remove 'nomem'
      label.
      
      Reported-by: syzbot+107c4aff5f392bf1517f@syzkaller.appspotmail.com
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86c2a390
    • Eric Dumazet's avatar
      pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM · 9e9dcbc9
      Eric Dumazet authored
      [ Upstream commit d9e15a27 ]
      
      As diagnosed by Florian :
      
      If TCA_FQ_QUANTUM is set to 0x80000000, fq_deueue()
      can loop forever in :
      
      if (f->credit <= 0) {
        f->credit += q->quantum;
        goto begin;
      }
      
      ... because f->credit is either 0 or -2147483648.
      
      Let's limit TCA_FQ_QUANTUM to no more than 1 << 20 :
      This max value should limit risks of breaking user setups
      while fixing this bug.
      
      Fixes: afe4fd06 ("pkt_sched: fq: Fair Queue packet scheduler")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Diagnosed-by: default avatarFlorian Westphal <fw@strlen.de>
      Reported-by: syzbot+dc9071cc5a85950bdfce@syzkaller.appspotmail.com
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9e9dcbc9
    • Eric Dumazet's avatar
      net: usb: lan78xx: fix possible skb leak · eca9a2f2
      Eric Dumazet authored
      [ Upstream commit 47240ba0 ]
      
      If skb_linearize() fails, we need to free the skb.
      
      TSO makes skb bigger, and this bug might be the reason
      Raspberry Pi 3B+ users had to disable TSO.
      
      Fixes: 55d7de9d ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarRENARD Pierre-Francois <pfrenard@gmail.com>
      Cc: Stefan Wahren <stefan.wahren@i2se.com>
      Cc: Woojung Huh <woojung.huh@microchip.com>
      Cc: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eca9a2f2
    • Chen-Yu Tsai's avatar
      net: stmmac: dwmac-sunxi: Allow all RGMII modes · 052d2a8e
      Chen-Yu Tsai authored
      [ Upstream commit 52cc73e5 ]
      
      Allow all the RGMII modes to be used. This would allow us to represent
      the hardware better in the device tree with RGMII_ID where in most
      cases the PHY's internal delay for both RX and TX are used.
      
      Fixes: af0bd4e9 ("net: stmmac: sunxi platform extensions for GMAC in Allwinner A20 SoC's")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      052d2a8e
    • Eric Dumazet's avatar
      macvlan: do not assume mac_header is set in macvlan_broadcast() · 9b266c6c
      Eric Dumazet authored
      [ Upstream commit 96cc4b69 ]
      
      Use of eth_hdr() in tx path is error prone.
      
      Many drivers call skb_reset_mac_header() before using it,
      but others do not.
      
      Commit 6d1ccff6 ("net: reset mac header in dev_start_xmit()")
      attempted to fix this generically, but commit d346a3fa
      ("packet: introduce PACKET_QDISC_BYPASS socket option") brought
      back the macvlan bug.
      
      Lets add a new helper, so that tx paths no longer have
      to call skb_reset_mac_header() only to get a pointer
      to skb->data.
      
      Hopefully we will be able to revert 6d1ccff6
      ("net: reset mac header in dev_start_xmit()") and save few cycles
      in transmit fast path.
      
      BUG: KASAN: use-after-free in __get_unaligned_cpu32 include/linux/unaligned/packed_struct.h:19 [inline]
      BUG: KASAN: use-after-free in mc_hash drivers/net/macvlan.c:251 [inline]
      BUG: KASAN: use-after-free in macvlan_broadcast+0x547/0x620 drivers/net/macvlan.c:277
      Read of size 4 at addr ffff8880a4932401 by task syz-executor947/9579
      
      CPU: 0 PID: 9579 Comm: syz-executor947 Not tainted 5.5.0-rc4-syzkaller #0
      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+0x197/0x210 lib/dump_stack.c:118
       print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
       __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
       kasan_report+0x12/0x20 mm/kasan/common.c:639
       __asan_report_load_n_noabort+0xf/0x20 mm/kasan/generic_report.c:145
       __get_unaligned_cpu32 include/linux/unaligned/packed_struct.h:19 [inline]
       mc_hash drivers/net/macvlan.c:251 [inline]
       macvlan_broadcast+0x547/0x620 drivers/net/macvlan.c:277
       macvlan_queue_xmit drivers/net/macvlan.c:520 [inline]
       macvlan_start_xmit+0x402/0x77f drivers/net/macvlan.c:559
       __netdev_start_xmit include/linux/netdevice.h:4447 [inline]
       netdev_start_xmit include/linux/netdevice.h:4461 [inline]
       dev_direct_xmit+0x419/0x630 net/core/dev.c:4079
       packet_direct_xmit+0x1a9/0x250 net/packet/af_packet.c:240
       packet_snd net/packet/af_packet.c:2966 [inline]
       packet_sendmsg+0x260d/0x6220 net/packet/af_packet.c:2991
       sock_sendmsg_nosec net/socket.c:639 [inline]
       sock_sendmsg+0xd7/0x130 net/socket.c:659
       __sys_sendto+0x262/0x380 net/socket.c:1985
       __do_sys_sendto net/socket.c:1997 [inline]
       __se_sys_sendto net/socket.c:1993 [inline]
       __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1993
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x442639
      Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 5b 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007ffc13549e08 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000442639
      RDX: 000000000000000e RSI: 0000000020000080 RDI: 0000000000000003
      RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 0000000000403bb0 R14: 0000000000000000 R15: 0000000000000000
      
      Allocated by task 9389:
       save_stack+0x23/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       __kasan_kmalloc mm/kasan/common.c:513 [inline]
       __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
       kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
       __do_kmalloc mm/slab.c:3656 [inline]
       __kmalloc+0x163/0x770 mm/slab.c:3665
       kmalloc include/linux/slab.h:561 [inline]
       tomoyo_realpath_from_path+0xc5/0x660 security/tomoyo/realpath.c:252
       tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
       tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
       tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129
       security_inode_getattr+0xf2/0x150 security/security.c:1222
       vfs_getattr+0x25/0x70 fs/stat.c:115
       vfs_statx_fd+0x71/0xc0 fs/stat.c:145
       vfs_fstat include/linux/fs.h:3265 [inline]
       __do_sys_newfstat+0x9b/0x120 fs/stat.c:378
       __se_sys_newfstat fs/stat.c:375 [inline]
       __x64_sys_newfstat+0x54/0x80 fs/stat.c:375
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Freed by task 9389:
       save_stack+0x23/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       kasan_set_free_info mm/kasan/common.c:335 [inline]
       __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
       kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
       __cache_free mm/slab.c:3426 [inline]
       kfree+0x10a/0x2c0 mm/slab.c:3757
       tomoyo_realpath_from_path+0x1a7/0x660 security/tomoyo/realpath.c:289
       tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
       tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
       tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129
       security_inode_getattr+0xf2/0x150 security/security.c:1222
       vfs_getattr+0x25/0x70 fs/stat.c:115
       vfs_statx_fd+0x71/0xc0 fs/stat.c:145
       vfs_fstat include/linux/fs.h:3265 [inline]
       __do_sys_newfstat+0x9b/0x120 fs/stat.c:378
       __se_sys_newfstat fs/stat.c:375 [inline]
       __x64_sys_newfstat+0x54/0x80 fs/stat.c:375
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      The buggy address belongs to the object at ffff8880a4932000
       which belongs to the cache kmalloc-4k of size 4096
      The buggy address is located 1025 bytes inside of
       4096-byte region [ffff8880a4932000, ffff8880a4933000)
      The buggy address belongs to the page:
      page:ffffea0002924c80 refcount:1 mapcount:0 mapping:ffff8880aa402000 index:0x0 compound_mapcount: 0
      raw: 00fffe0000010200 ffffea0002846208 ffffea00028f3888 ffff8880aa402000
      raw: 0000000000000000 ffff8880a4932000 0000000100000001 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8880a4932300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff8880a4932380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      >ffff8880a4932400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
       ffff8880a4932480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff8880a4932500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      Fixes: b863ceb7 ("[NET]: Add macvlan driver")
      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>
      9b266c6c
    • Chan Shu Tak, Alex's avatar
      llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c) · 04631ca0
      Chan Shu Tak, Alex authored
      [ Upstream commit af1c0e4e ]
      
      When a frame with NULL DSAP is received, llc_station_rcv is called.
      In turn, llc_stat_ev_rx_null_dsap_xid_c is called to check if it is a NULL
      XID frame. The return statement of llc_stat_ev_rx_null_dsap_xid_c returns 1
      when the incoming frame is not a NULL XID frame and 0 otherwise. Hence, a
      NULL XID response is returned unexpectedly, e.g. when the incoming frame is
      a NULL TEST command.
      
      To fix the error, simply remove the conditional operator.
      
      A similar error in llc_stat_ev_rx_null_dsap_test_c is also fixed.
      Signed-off-by: default avatarChan Shu Tak, Alex <alexchan@task.com.hk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04631ca0
    • Helge Deller's avatar
      parisc: Fix compiler warnings in debug_core.c · 018cb555
      Helge Deller authored
      [ Upstream commit 75cf9797 ]
      
      Fix this compiler warning:
      kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’:
      arch/parisc/include/asm/cmpxchg.h:48:3: warning: value computed is not used [-Wunused-value]
         48 |  ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
      arch/parisc/include/asm/atomic.h:78:30: note: in expansion of macro ‘xchg’
         78 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
            |                              ^~~~
      kernel/debug/debug_core.c:596:4: note: in expansion of macro ‘atomic_xchg’
        596 |    atomic_xchg(&kgdb_active, cpu);
            |    ^~~~~~~~~~~
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      018cb555
    • Yang Yingliang's avatar
      block: fix memleak when __blk_rq_map_user_iov() is failed · b45244f4
      Yang Yingliang authored
      [ Upstream commit 3b7995a9 ]
      
      When I doing fuzzy test, get the memleak report:
      
      BUG: memory leak
      unreferenced object 0xffff88837af80000 (size 4096):
        comm "memleak", pid 3557, jiffies 4294817681 (age 112.499s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          20 00 00 00 10 01 00 00 00 00 00 00 01 00 00 00   ...............
        backtrace:
          [<000000001c894df8>] bio_alloc_bioset+0x393/0x590
          [<000000008b139a3c>] bio_copy_user_iov+0x300/0xcd0
          [<00000000a998bd8c>] blk_rq_map_user_iov+0x2f1/0x5f0
          [<000000005ceb7f05>] blk_rq_map_user+0xf2/0x160
          [<000000006454da92>] sg_common_write.isra.21+0x1094/0x1870
          [<00000000064bb208>] sg_write.part.25+0x5d9/0x950
          [<000000004fc670f6>] sg_write+0x5f/0x8c
          [<00000000b0d05c7b>] __vfs_write+0x7c/0x100
          [<000000008e177714>] vfs_write+0x1c3/0x500
          [<0000000087d23f34>] ksys_write+0xf9/0x200
          [<000000002c8dbc9d>] do_syscall_64+0x9f/0x4f0
          [<00000000678d8e9a>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      If __blk_rq_map_user_iov() is failed in blk_rq_map_user_iov(),
      the bio(s) which is allocated before this failing will leak. The
      refcount of the bio(s) is init to 1 and increased to 2 by calling
      bio_get(), but __blk_rq_unmap_user() only decrease it to 1, so
      the bio cannot be freed. Fix it by calling blk_rq_unmap_user().
      Reviewed-by: default avatarBob Liu <bob.liu@oracle.com>
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b45244f4
    • Jose Abreu's avatar
      net: stmmac: RX buffer size must be 16 byte aligned · 2fbdfb72
      Jose Abreu authored
      [ Upstream commit 8d558f02 ]
      
      We need to align the RX buffer size to at least 16 byte so that IP
      doesn't mis-behave. This is required by HW.
      
      Changes from v2:
      - Align UP and not DOWN (David)
      
      Fixes: 7ac6653a ("stmmac: Move the STMicroelectronics driver")
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2fbdfb72
    • Alexander Shishkin's avatar
      perf/x86/intel: Fix PT PMI handling · 7bd52502
      Alexander Shishkin authored
      [ Upstream commit 92ca7da4 ]
      
      Commit:
      
        ccbebba4 ("perf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")
      
      skips the PT/LBR exclusivity check on CPUs where PT and LBRs coexist, but
      also inadvertently skips the active_events bump for PT in that case, which
      is a bug. If there aren't any hardware events at the same time as PT, the
      PMI handler will ignore PT PMIs, as active_events reads zero in that case,
      resulting in the "Uhhuh" spurious NMI warning and PT data loss.
      
      Fix this by always increasing active_events for PT events.
      
      Fixes: ccbebba4 ("perf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")
      Reported-by: default avatarVitaly Slobodskoy <vitaly.slobodskoy@intel.com>
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://lkml.kernel.org/r/20191210105101.77210-1-alexander.shishkin@linux.intel.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      7bd52502
    • Thomas Hebb's avatar
      kconfig: don't crash on NULL expressions in expr_eq() · 0ae16c27
      Thomas Hebb authored
      [ Upstream commit 272a7210 ]
      
      NULL expressions are taken to always be true, as implemented by the
      expr_is_yes() macro and by several other functions in expr.c. As such,
      they ought to be valid inputs to expr_eq(), which compares two
      expressions.
      Signed-off-by: default avatarThomas Hebb <tommyhebb@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0ae16c27
    • Andreas Kemnade's avatar
      regulator: rn5t618: fix module aliases · 4c24585a
      Andreas Kemnade authored
      [ Upstream commit 62a1923c ]
      
      platform device aliases were missing, preventing
      autoloading of module.
      
      Fixes: 811b7006 ("regulator: rn5t618: add driver for Ricoh RN5T618 regulators")
      Signed-off-by: default avatarAndreas Kemnade <andreas@kemnade.info>
      Link: https://lore.kernel.org/r/20191211221600.29438-1-andreas@kemnade.infoSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4c24585a
    • Shengjiu Wang's avatar
      ASoC: wm8962: fix lambda value · 19501490
      Shengjiu Wang authored
      [ Upstream commit 556672d7 ]
      
      According to user manual, it is required that FLL_LAMBDA > 0
      in all cases (Integer and Franctional modes).
      
      Fixes: 9a76f1ff ("ASoC: Add initial WM8962 CODEC driver")
      Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@nxp.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/1576065442-19763-1-git-send-email-shengjiu.wang@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      19501490
    • Aditya Pakki's avatar
      rfkill: Fix incorrect check to avoid NULL pointer dereference · 1e1672c5
      Aditya Pakki authored
      [ Upstream commit 6fc232db ]
      
      In rfkill_register, the struct rfkill pointer is first derefernced
      and then checked for NULL. This patch removes the BUG_ON and returns
      an error to the caller in case rfkill is NULL.
      Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
      Link: https://lore.kernel.org/r/20191215153409.21696-1-pakki001@umn.eduSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1e1672c5
    • Cristian Birsan's avatar
      net: usb: lan78xx: Fix error message format specifier · 9c155484
      Cristian Birsan authored
      [ Upstream commit 858ce8ca ]
      
      Display the return code as decimal integer.
      
      Fixes: 55d7de9d ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9c155484
    • Manish Chopra's avatar
      bnx2x: Fix logic to get total no. of PFs per engine · 81bf8fe7
      Manish Chopra authored
      [ Upstream commit ee699f89 ]
      
      Driver doesn't calculate total number of PFs configured on a
      given engine correctly which messed up resources in the PFs
      loaded on that engine, leading driver to exceed configuration
      of resources (like vlan filters etc.) beyond the limit per
      engine, which ended up with asserts from the firmware.
      Signed-off-by: default avatarManish Chopra <manishc@marvell.com>
      Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      81bf8fe7
    • Manish Chopra's avatar
      bnx2x: Do not handle requests from VFs after parity · 9fb4970b
      Manish Chopra authored
      [ Upstream commit 7113f796 ]
      
      Parity error from the hardware will cause PF to lose the state
      of their VFs due to PF's internal reload and hardware reset following
      the parity error. Restrict any configuration request from the VFs after
      the parity as it could cause unexpected hardware behavior, only way
      for VFs to recover would be to trigger FLR on VFs and reload them.
      Signed-off-by: default avatarManish Chopra <manishc@marvell.com>
      Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9fb4970b
    • Mike Rapoport's avatar
      powerpc: Ensure that swiotlb buffer is allocated from low memory · 497e53c3
      Mike Rapoport authored
      [ Upstream commit 8fabc623 ]
      
      Some powerpc platforms (e.g. 85xx) limit DMA-able memory way below 4G.
      If a system has more physical memory than this limit, the swiotlb
      buffer is not addressable because it is allocated from memblock using
      top-down mode.
      
      Force memblock to bottom-up mode before calling swiotlb_init() to
      ensure that the swiotlb buffer is DMA-able.
      Reported-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20191204123524.22919-1-rppt@kernel.orgSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      497e53c3
    • Daniel T. Lee's avatar
      samples: bpf: Replace symbol compare of trace_event · 666ce175
      Daniel T. Lee authored
      [ Upstream commit bba1b2a8 ]
      
      Previously, when this sample is added, commit 1c47910e
      ("samples/bpf: add perf_event+bpf example"), a symbol 'sys_read' and
      'sys_write' has been used without no prefixes. But currently there are
      no exact symbols with these under kallsyms and this leads to failure.
      
      This commit changes exact compare to substring compare to keep compatible
      with exact symbol or prefixed symbol.
      
      Fixes: 1c47910e ("samples/bpf: add perf_event+bpf example")
      Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20191205080114.19766-2-danieltimlee@gmail.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      666ce175
    • Tomi Valkeinen's avatar
      ARM: dts: am437x-gp/epos-evm: fix panel compatible · 172de097
      Tomi Valkeinen authored
      [ Upstream commit c6b16761 ]
      
      The LCD panel on AM4 GP EVMs and ePOS boards seems to be
      osd070t1718-19ts. The current dts files say osd057T0559-34ts. Possibly
      the panel has changed since the early EVMs, or there has been a mistake
      with the panel type.
      
      Update the DT files accordingly.
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      172de097
    • Chuhong Yuan's avatar
      spi: spi-cavium-thunderx: Add missing pci_release_regions() · e5ef6e02
      Chuhong Yuan authored
      [ Upstream commit a841e285 ]
      
      The driver forgets to call pci_release_regions() in probe failure
      and remove.
      Add the missed calls to fix it.
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191206075500.18525-1-hslester96@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5ef6e02
    • Phil Sutter's avatar
      netfilter: uapi: Avoid undefined left-shift in xt_sctp.h · 714b9856
      Phil Sutter authored
      [ Upstream commit 16416655 ]
      
      With 'bytes(__u32)' being 32, a left-shift of 31 may happen which is
      undefined for the signed 32-bit value 1. Avoid this by declaring 1 as
      unsigned.
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      714b9856
    • Sudeep Holla's avatar
      ARM: vexpress: Set-up shared OPP table instead of individual for each CPU · b8c68da6
      Sudeep Holla authored
      [ Upstream commit 2a76352a ]
      
      Currently we add individual copy of same OPP table for each CPU within
      the cluster. This is redundant and doesn't reflect the reality.
      
      We can't use core cpumask to set policy->cpus in ve_spc_cpufreq_init()
      anymore as it gets called via cpuhp_cpufreq_online()->cpufreq_online()
      ->cpufreq_driver->init() and the cpumask gets updated upon CPU hotplug
      operations. It also may cause issues when the vexpress_spc_cpufreq
      driver is built as a module.
      
      Since ve_spc_clk_init is built-in device initcall, we should be able to
      use the same topology_core_cpumask to set the opp sharing cpumask via
      dev_pm_opp_set_sharing_cpus and use the same later in the driver via
      dev_pm_opp_get_sharing_cpus.
      
      Cc: Liviu Dudau <liviu.dudau@arm.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b8c68da6
    • Arvind Sankar's avatar
      efi/gop: Fix memory leak in __gop_query32/64() · 159c83a0
      Arvind Sankar authored
      [ Upstream commit ff397be6 ]
      
      efi_graphics_output_protocol::query_mode() returns info in
      callee-allocated memory which must be freed by the caller, which
      we aren't doing.
      
      We don't actually need to call query_mode() in order to obtain the
      info for the current graphics mode, which is already there in
      gop->mode->info, so just access it directly in the setup_gop32/64()
      functions.
      
      Also nothing uses the size of the info structure, so don't update the
      passed-in size (which is the size of the gop_handle table in bytes)
      unnecessarily.
      Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Bhupesh Sharma <bhsharma@redhat.com>
      Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
      Cc: linux-efi@vger.kernel.org
      Link: https://lkml.kernel.org/r/20191206165542.31469-5-ardb@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      159c83a0
    • Arvind Sankar's avatar
      efi/gop: Return EFI_SUCCESS if a usable GOP was found · d9145ec6
      Arvind Sankar authored
      [ Upstream commit dbd89c30 ]
      
      If we've found a usable instance of the Graphics Output Protocol
      (GOP) with a framebuffer, it is possible that one of the later EFI
      calls fails while checking if any support console output. In this
      case status may be an EFI error code even though we found a usable
      GOP.
      
      Fix this by explicitly return EFI_SUCCESS if a usable GOP has been
      located.
      Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Bhupesh Sharma <bhsharma@redhat.com>
      Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
      Cc: linux-efi@vger.kernel.org
      Link: https://lkml.kernel.org/r/20191206165542.31469-4-ardb@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9145ec6
    • Arvind Sankar's avatar
      efi/gop: Return EFI_NOT_FOUND if there are no usable GOPs · f2947e95
      Arvind Sankar authored
      [ Upstream commit 6fc3cec3 ]
      
      If we don't find a usable instance of the Graphics Output Protocol
      (GOP) because none of them have a framebuffer (i.e. they were all
      PIXEL_BLT_ONLY), but all the EFI calls succeeded, we will return
      EFI_SUCCESS even though we didn't find a usable GOP.
      
      Fix this by explicitly returning EFI_NOT_FOUND if no usable GOPs are
      found, allowing the caller to probe for UGA instead.
      Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Bhupesh Sharma <bhsharma@redhat.com>
      Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
      Cc: linux-efi@vger.kernel.org
      Link: https://lkml.kernel.org/r/20191206165542.31469-3-ardb@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f2947e95
    • Florian Westphal's avatar
      netfilter: ctnetlink: netns exit must wait for callbacks · bd85b179
      Florian Westphal authored
      [ Upstream commit 18a110b0 ]
      
      Curtis Taylor and Jon Maxwell reported and debugged a crash on 3.10
      based kernel.
      
      Crash occurs in ctnetlink_conntrack_events because net->nfnl socket is
      NULL.  The nfnl socket was set to NULL by netns destruction running on
      another cpu.
      
      The exiting network namespace calls the relevant destructors in the
      following order:
      
      1. ctnetlink_net_exit_batch
      
      This nulls out the event callback pointer in struct netns.
      
      2. nfnetlink_net_exit_batch
      
      This nulls net->nfnl socket and frees it.
      
      3. nf_conntrack_cleanup_net_list
      
      This removes all remaining conntrack entries.
      
      This is order is correct. The only explanation for the crash so ar is:
      
      cpu1: conntrack is dying, eviction occurs:
       -> nf_ct_delete()
         -> nf_conntrack_event_report \
           -> nf_conntrack_eventmask_report
             -> notify->fcn() (== ctnetlink_conntrack_events).
      
      cpu1: a. fetches rcu protected pointer to obtain ctnetlink event callback.
            b. gets interrupted.
       cpu2: runs netns exit handlers:
           a runs ctnetlink destructor, event cb pointer set to NULL.
           b runs nfnetlink destructor, nfnl socket is closed and set to NULL.
      cpu1: c. resumes and trips over NULL net->nfnl.
      
      Problem appears to be that ctnetlink_net_exit_batch only prevents future
      callers of nf_conntrack_eventmask_report() from obtaining the callback.
      It doesn't wait of other cpus that might have already obtained the
      callbacks address.
      
      I don't see anything in upstream kernels that would prevent similar
      crash: We need to wait for all cpus to have exited the event callback.
      
      Fixes: 9592a5c0 ("netfilter: ctnetlink: netns support")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bd85b179
    • Marco Elver's avatar
      locking/spinlock/debug: Fix various data races · c0911024
      Marco Elver authored
      [ Upstream commit 1a365e82 ]
      
      This fixes various data races in spinlock_debug. By testing with KCSAN,
      it is observable that the console gets spammed with data races reports,
      suggesting these are extremely frequent.
      
      Example data race report:
      
        read to 0xffff8ab24f403c48 of 4 bytes by task 221 on cpu 2:
         debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline]
         do_raw_spin_lock+0x9b/0x210 kernel/locking/spinlock_debug.c:112
         __raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline]
         _raw_spin_lock+0x39/0x40 kernel/locking/spinlock.c:151
         spin_lock include/linux/spinlock.h:338 [inline]
         get_partial_node.isra.0.part.0+0x32/0x2f0 mm/slub.c:1873
         get_partial_node mm/slub.c:1870 [inline]
        <snip>
      
        write to 0xffff8ab24f403c48 of 4 bytes by task 167 on cpu 3:
         debug_spin_unlock kernel/locking/spinlock_debug.c:103 [inline]
         do_raw_spin_unlock+0xc9/0x1a0 kernel/locking/spinlock_debug.c:138
         __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:159 [inline]
         _raw_spin_unlock_irqrestore+0x2d/0x50 kernel/locking/spinlock.c:191
         spin_unlock_irqrestore include/linux/spinlock.h:393 [inline]
         free_debug_processing+0x1b3/0x210 mm/slub.c:1214
         __slab_free+0x292/0x400 mm/slub.c:2864
        <snip>
      
      As a side-effect, with KCSAN, this eventually locks up the console, most
      likely due to deadlock, e.g. .. -> printk lock -> spinlock_debug ->
      KCSAN detects data race -> kcsan_print_report() -> printk lock ->
      deadlock.
      
      This fix will 1) avoid the data races, and 2) allow using lock debugging
      together with KCSAN.
      Reported-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: https://lkml.kernel.org/r/20191120155715.28089-1-elver@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0911024
    • Aleksandr Yashkin's avatar
      pstore/ram: Write new dumps to start of recycled zones · b42bb8c1
      Aleksandr Yashkin authored
      [ Upstream commit 9e5f1c19 ]
      
      The ram_core.c routines treat przs as circular buffers. When writing a
      new crash dump, the old buffer needs to be cleared so that the new dump
      doesn't end up in the wrong place (i.e. at the end).
      
      The solution to this problem is to reset the circular buffer state before
      writing a new Oops dump.
      Signed-off-by: default avatarAleksandr Yashkin <a.yashkin@inango-systems.com>
      Signed-off-by: default avatarNikolay Merinov <n.merinov@inango-systems.com>
      Signed-off-by: default avatarAriel Gilman <a.gilman@inango-systems.com>
      Link: https://lore.kernel.org/r/20191223133816.28155-1-n.merinov@inango-systems.com
      Fixes: 896fc1f0 ("pstore/ram: Switch to persistent_ram routines")
      [kees: backport to v4.9]
      Link: https://lore.kernel.org/stable/157831399811194@kroah.comSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b42bb8c1
    • Dmitry Vyukov's avatar
      locking/x86: Remove the unused atomic_inc_short() methd · 131ba514
      Dmitry Vyukov authored
      commit 31b35f6b upstream.
      
      It is completely unused and implemented only on x86.
      Remove it.
      Suggested-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20170526172900.91058-1-dvyukov@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      131ba514
    • SeongJae Park's avatar
      xen/blkback: Avoid unmapping unmapped grant pages · 396d26b5
      SeongJae Park authored
      [ Upstream commit f9bd84a8 ]
      
      For each I/O request, blkback first maps the foreign pages for the
      request to its local pages.  If an allocation of a local page for the
      mapping fails, it should unmap every mapping already made for the
      request.
      
      However, blkback's handling mechanism for the allocation failure does
      not mark the remaining foreign pages as unmapped.  Therefore, the unmap
      function merely tries to unmap every valid grant page for the request,
      including the pages not mapped due to the allocation failure.  On a
      system that fails the allocation frequently, this problem leads to
      following kernel crash.
      
        [  372.012538] BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
        [  372.012546] IP: [<ffffffff814071ac>] gnttab_unmap_refs.part.7+0x1c/0x40
        [  372.012557] PGD 16f3e9067 PUD 16426e067 PMD 0
        [  372.012562] Oops: 0002 [#1] SMP
        [  372.012566] Modules linked in: act_police sch_ingress cls_u32
        ...
        [  372.012746] Call Trace:
        [  372.012752]  [<ffffffff81407204>] gnttab_unmap_refs+0x34/0x40
        [  372.012759]  [<ffffffffa0335ae3>] xen_blkbk_unmap+0x83/0x150 [xen_blkback]
        ...
        [  372.012802]  [<ffffffffa0336c50>] dispatch_rw_block_io+0x970/0x980 [xen_blkback]
        ...
        Decompressing Linux... Parsing ELF... done.
        Booting the kernel.
        [    0.000000] Initializing cgroup subsys cpuset
      
      This commit fixes this problem by marking the grant pages of the given
      request that didn't mapped due to the allocation failure as invalid.
      
      Fixes: c6cc142d ("xen-blkback: use balloon pages for all mappings")
      Reviewed-by: default avatarDavid Woodhouse <dwmw@amazon.de>
      Reviewed-by: default avatarMaximilian Heyne <mheyne@amazon.de>
      Reviewed-by: default avatarPaul Durrant <pdurrant@amazon.co.uk>
      Reviewed-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
      Signed-off-by: default avatarSeongJae Park <sjpark@amazon.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      396d26b5
    • Heiko Carstens's avatar
      s390/smp: fix physical to logical CPU map for SMT · 464f18e5
      Heiko Carstens authored
      [ Upstream commit 72a81ad9 ]
      
      If an SMT capable system is not IPL'ed from the first CPU the setup of
      the physical to logical CPU mapping is broken: the IPL core gets CPU
      number 0, but then the next core gets CPU number 1. Correct would be
      that all SMT threads of CPU 0 get the subsequent logical CPU numbers.
      
      This is important since a lot of code (like e.g. the CPU topology
      code) assumes that CPU maps are setup like this. If the mapping is
      broken the system will not IPL due to broken topology masks:
      
      [    1.716341] BUG: arch topology broken
      [    1.716342]      the SMT domain not a subset of the MC domain
      [    1.716343] BUG: arch topology broken
      [    1.716344]      the MC domain not a subset of the BOOK domain
      
      This scenario can usually not happen since LPARs are always IPL'ed
      from CPU 0 and also re-IPL is intiated from CPU 0. However older
      kernels did initiate re-IPL on an arbitrary CPU. If therefore a re-IPL
      from an old kernel into a new kernel is initiated this may lead to
      crash.
      
      Fix this by setting up the physical to logical CPU mapping correctly.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      464f18e5
    • Eric Dumazet's avatar
      net: add annotations on hh->hh_len lockless accesses · 36d6d826
      Eric Dumazet authored
      [ Upstream commit c305c6ae ]
      
      KCSAN reported a data-race [1]
      
      While we can use READ_ONCE() on the read sides,
      we need to make sure hh->hh_len is written last.
      
      [1]
      
      BUG: KCSAN: data-race in eth_header_cache / neigh_resolve_output
      
      write to 0xffff8880b9dedcb8 of 4 bytes by task 29760 on cpu 0:
       eth_header_cache+0xa9/0xd0 net/ethernet/eth.c:247
       neigh_hh_init net/core/neighbour.c:1463 [inline]
       neigh_resolve_output net/core/neighbour.c:1480 [inline]
       neigh_resolve_output+0x415/0x470 net/core/neighbour.c:1470
       neigh_output include/net/neighbour.h:511 [inline]
       ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116
       __ip6_finish_output net/ipv6/ip6_output.c:142 [inline]
       __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127
       ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152
       NF_HOOK_COND include/linux/netfilter.h:294 [inline]
       ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175
       dst_output include/net/dst.h:436 [inline]
       NF_HOOK include/linux/netfilter.h:305 [inline]
       ndisc_send_skb+0x459/0x5f0 net/ipv6/ndisc.c:505
       ndisc_send_ns+0x207/0x430 net/ipv6/ndisc.c:647
       rt6_probe_deferred+0x98/0xf0 net/ipv6/route.c:615
       process_one_work+0x3d4/0x890 kernel/workqueue.c:2269
       worker_thread+0xa0/0x800 kernel/workqueue.c:2415
       kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
      
      read to 0xffff8880b9dedcb8 of 4 bytes by task 29572 on cpu 1:
       neigh_resolve_output net/core/neighbour.c:1479 [inline]
       neigh_resolve_output+0x113/0x470 net/core/neighbour.c:1470
       neigh_output include/net/neighbour.h:511 [inline]
       ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116
       __ip6_finish_output net/ipv6/ip6_output.c:142 [inline]
       __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127
       ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152
       NF_HOOK_COND include/linux/netfilter.h:294 [inline]
       ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175
       dst_output include/net/dst.h:436 [inline]
       NF_HOOK include/linux/netfilter.h:305 [inline]
       ndisc_send_skb+0x459/0x5f0 net/ipv6/ndisc.c:505
       ndisc_send_ns+0x207/0x430 net/ipv6/ndisc.c:647
       rt6_probe_deferred+0x98/0xf0 net/ipv6/route.c:615
       process_one_work+0x3d4/0x890 kernel/workqueue.c:2269
       worker_thread+0xa0/0x800 kernel/workqueue.c:2415
       kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 29572 Comm: kworker/1:4 Not tainted 5.4.0-rc6+ #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: events rt6_probe_deferred
      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 avatarSasha Levin <sashal@kernel.org>
      36d6d826
    • Masashi Honma's avatar
      ath9k_htc: Discard undersized packets · 214910fc
      Masashi Honma authored
      [ Upstream commit cd486e62 ]
      
      Sometimes the hardware will push small packets that trigger a WARN_ON
      in mac80211. Discard them early to avoid this issue.
      
      This patch ports 2 patches from ath9k to ath9k_htc.
      commit 3c0efb74 "ath9k: discard
      undersized packets".
      commit df5c4150 "ath9k: correctly
      handle short radar pulses".
      
      [  112.835889] ------------[ cut here ]------------
      [  112.835971] WARNING: CPU: 5 PID: 0 at net/mac80211/rx.c:804 ieee80211_rx_napi+0xaac/0xb40 [mac80211]
      [  112.835973] Modules linked in: ath9k_htc ath9k_common ath9k_hw ath mac80211 cfg80211 libarc4 nouveau snd_hda_codec_hdmi intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_hda_codec video snd_hda_core ttm snd_hwdep drm_kms_helper snd_pcm crct10dif_pclmul snd_seq_midi drm snd_seq_midi_event crc32_pclmul snd_rawmidi ghash_clmulni_intel snd_seq aesni_intel aes_x86_64 crypto_simd cryptd snd_seq_device glue_helper snd_timer sch_fq_codel i2c_algo_bit fb_sys_fops snd input_leds syscopyarea sysfillrect sysimgblt intel_cstate mei_me intel_rapl_perf soundcore mxm_wmi lpc_ich mei kvm_intel kvm mac_hid irqbypass parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_generic usbhid hid raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear e1000e ahci libahci wmi
      [  112.836022] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.3.0-wt #1
      [  112.836023] Hardware name: MouseComputer Co.,Ltd. X99-S01/X99-S01, BIOS 1.0C-W7 04/01/2015
      [  112.836056] RIP: 0010:ieee80211_rx_napi+0xaac/0xb40 [mac80211]
      [  112.836059] Code: 00 00 66 41 89 86 b0 00 00 00 e9 c8 fa ff ff 4c 89 b5 40 ff ff ff 49 89 c6 e9 c9 fa ff ff 48 c7 c7 e0 a2 a5 c0 e8 47 41 b0 e9 <0f> 0b 48 89 df e8 5a 94 2d ea e9 02 f9 ff ff 41 39 c1 44 89 85 60
      [  112.836060] RSP: 0018:ffffaa6180220da8 EFLAGS: 00010286
      [  112.836062] RAX: 0000000000000024 RBX: ffff909a20eeda00 RCX: 0000000000000000
      [  112.836064] RDX: 0000000000000000 RSI: ffff909a2f957448 RDI: ffff909a2f957448
      [  112.836065] RBP: ffffaa6180220e78 R08: 00000000000006e9 R09: 0000000000000004
      [  112.836066] R10: 000000000000000a R11: 0000000000000001 R12: 0000000000000000
      [  112.836068] R13: ffff909a261a47a0 R14: 0000000000000000 R15: 0000000000000004
      [  112.836070] FS:  0000000000000000(0000) GS:ffff909a2f940000(0000) knlGS:0000000000000000
      [  112.836071] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  112.836073] CR2: 00007f4e3ffffa08 CR3: 00000001afc0a006 CR4: 00000000001606e0
      [  112.836074] Call Trace:
      [  112.836076]  <IRQ>
      [  112.836083]  ? finish_td+0xb3/0xf0
      [  112.836092]  ? ath9k_rx_prepare.isra.11+0x22f/0x2a0 [ath9k_htc]
      [  112.836099]  ath9k_rx_tasklet+0x10b/0x1d0 [ath9k_htc]
      [  112.836105]  tasklet_action_common.isra.22+0x63/0x110
      [  112.836108]  tasklet_action+0x22/0x30
      [  112.836115]  __do_softirq+0xe4/0x2da
      [  112.836118]  irq_exit+0xae/0xb0
      [  112.836121]  do_IRQ+0x86/0xe0
      [  112.836125]  common_interrupt+0xf/0xf
      [  112.836126]  </IRQ>
      [  112.836130] RIP: 0010:cpuidle_enter_state+0xa9/0x440
      [  112.836133] Code: 3d bc 20 38 55 e8 f7 1d 84 ff 49 89 c7 0f 1f 44 00 00 31 ff e8 28 29 84 ff 80 7d d3 00 0f 85 e6 01 00 00 fb 66 0f 1f 44 00 00 <45> 85 ed 0f 89 ff 01 00 00 41 c7 44 24 10 00 00 00 00 48 83 c4 18
      [  112.836134] RSP: 0018:ffffaa61800e3e48 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde
      [  112.836136] RAX: ffff909a2f96b340 RBX: ffffffffabb58200 RCX: 000000000000001f
      [  112.836137] RDX: 0000001a458adc5d RSI: 0000000026c9b581 RDI: 0000000000000000
      [  112.836139] RBP: ffffaa61800e3e88 R08: 0000000000000002 R09: 000000000002abc0
      [  112.836140] R10: ffffaa61800e3e18 R11: 000000000000002d R12: ffffca617fb40b00
      [  112.836141] R13: 0000000000000002 R14: ffffffffabb582d8 R15: 0000001a458adc5d
      [  112.836145]  ? cpuidle_enter_state+0x98/0x440
      [  112.836149]  ? menu_select+0x370/0x600
      [  112.836151]  cpuidle_enter+0x2e/0x40
      [  112.836154]  call_cpuidle+0x23/0x40
      [  112.836156]  do_idle+0x204/0x280
      [  112.836159]  cpu_startup_entry+0x1d/0x20
      [  112.836164]  start_secondary+0x167/0x1c0
      [  112.836169]  secondary_startup_64+0xa4/0xb0
      [  112.836173] ---[ end trace 9f4cd18479cc5ae5 ]---
      Signed-off-by: default avatarMasashi Honma <masashi.honma@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      214910fc
    • Masashi Honma's avatar
      ath9k_htc: Modify byte order for an error message · cd5efb08
      Masashi Honma authored
      [ Upstream commit e01fddc1 ]
      
      rs_datalen is be16 so we need to convert it before printing.
      Signed-off-by: default avatarMasashi Honma <masashi.honma@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cd5efb08
    • David Howells's avatar
      rxrpc: Fix possible NULL pointer access in ICMP handling · a4620d71
      David Howells authored
      [ Upstream commit f0308fb0 ]
      
      If an ICMP packet comes in on the UDP socket backing an AF_RXRPC socket as
      the UDP socket is being shut down, rxrpc_error_report() may get called to
      deal with it after sk_user_data on the UDP socket has been cleared, leading
      to a NULL pointer access when this local endpoint record gets accessed.
      
      Fix this by just returning immediately if sk_user_data was NULL.
      
      The oops looks like the following:
      
      #PF: supervisor read access in kernel mode
      #PF: error_code(0x0000) - not-present page
      ...
      RIP: 0010:rxrpc_error_report+0x1bd/0x6a9
      ...
      Call Trace:
       ? sock_queue_err_skb+0xbd/0xde
       ? __udp4_lib_err+0x313/0x34d
       __udp4_lib_err+0x313/0x34d
       icmp_unreach+0x1ee/0x207
       icmp_rcv+0x25b/0x28f
       ip_protocol_deliver_rcu+0x95/0x10e
       ip_local_deliver+0xe9/0x148
       __netif_receive_skb_one_core+0x52/0x6e
       process_backlog+0xdc/0x177
       net_rx_action+0xf9/0x270
       __do_softirq+0x1b6/0x39a
       ? smpboot_register_percpu_thread+0xce/0xce
       run_ksoftirqd+0x1d/0x42
       smpboot_thread_fn+0x19e/0x1b3
       kthread+0xf1/0xf6
       ? kthread_delayed_work_timer_fn+0x83/0x83
       ret_from_fork+0x24/0x30
      
      Fixes: 17926a79 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
      Reported-by: syzbot+611164843bd48cc2190c@syzkaller.appspotmail.com
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a4620d71