1. 17 Feb, 2020 24 commits
    • Jason A. Donenfeld's avatar
      wireguard: socket: remove extra call to synchronize_net · 1fbc33b0
      Jason A. Donenfeld authored
      synchronize_net() is a wrapper around synchronize_rcu(), so there's no
      point in having synchronize_net and synchronize_rcu back to back,
      despite the documentation comment suggesting maybe it's somewhat useful,
      "Wait for packets currently being received to be done." This commit
      removes the extra call.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Suggested-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1fbc33b0
    • Jason A. Donenfeld's avatar
      wireguard: send: account for mtu=0 devices · 175f1ca9
      Jason A. Donenfeld authored
      It turns out there's an easy way to get packets queued up while still
      having an MTU of zero, and that's via persistent keep alive. This commit
      makes sure that in whatever condition, we don't wind up dividing by
      zero. Note that an MTU of zero for a wireguard interface is something
      quasi-valid, so I don't think the correct fix is to limit it via
      min_mtu. This can be reproduced easily with:
      
      ip link add wg0 type wireguard
      ip link add wg1 type wireguard
      ip link set wg0 up mtu 0
      ip link set wg1 up
      wg set wg0 private-key <(wg genkey)
      wg set wg1 listen-port 1 private-key <(wg genkey) peer $(wg show wg0 public-key)
      wg set wg0 peer $(wg show wg1 public-key) persistent-keepalive 1 endpoint 127.0.0.1:1
      
      However, while min_mtu=0 seems fine, it makes sense to restrict the
      max_mtu. This commit also restricts the maximum MTU to the greatest
      number for which rounding up to the padding multiple won't overflow a
      signed integer. Packets this large were always rejected anyway
      eventually, due to checks deeper in, but it seems more sound not to even
      let the administrator configure something that won't work anyway.
      
      We use this opportunity to clean up this function a bit so that it's
      clear which paths we're expecting.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      175f1ca9
    • Jason A. Donenfeld's avatar
      wireguard: receive: reset last_under_load to zero · 2a8a4df3
      Jason A. Donenfeld authored
      This is a small optimization that prevents more expensive comparisons
      from happening when they are no longer necessary, by clearing the
      last_under_load variable whenever we wind up in a state where we were
      under load but we no longer are.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Suggested-by: default avatarMatt Dunwoodie <ncon@noconroy.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a8a4df3
    • Jason A. Donenfeld's avatar
      wireguard: selftests: reduce complexity and fix make races · 04ddf120
      Jason A. Donenfeld authored
      This gives us fewer dependencies and shortens build time, fixes up some
      hash checking race conditions, and also fixes missing directory creation
      that caused issues on massively parallel builds.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04ddf120
    • Mat Martineau's avatar
      mptcp: Protect subflow socket options before connection completes · b6e4a1ae
      Mat Martineau authored
      Userspace should not be able to directly manipulate subflow socket
      options before a connection is established since it is not yet known if
      it will be an MPTCP subflow or a TCP fallback subflow. TCP fallback
      subflows can be more directly controlled by userspace because they are
      regular TCP connections, while MPTCP subflow sockets need to be
      configured for the specific needs of MPTCP. Use the same logic as
      sendmsg/recvmsg to ensure that socket option calls are only passed
      through to known TCP fallback subflows.
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6e4a1ae
    • Arun Parameswaran's avatar
      net: phy: restore mdio regs in the iproc mdio driver · 6f08e98d
      Arun Parameswaran authored
      The mii management register in iproc mdio block
      does not have a retention register so it is lost on suspend.
      Save and restore value of register while resuming from suspend.
      
      Fixes: bb1a6197 ("net: phy: Initialize mdio clock at probe function")
      Signed-off-by: default avatarArun Parameswaran <arun.parameswaran@broadcom.com>
      Signed-off-by: default avatarScott Branden <scott.branden@broadcom.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f08e98d
    • Eric Dumazet's avatar
      net: add strict checks in netdev_name_node_alt_destroy() · e08ad805
      Eric Dumazet authored
      netdev_name_node_alt_destroy() does a lookup over all
      device names of a namespace.
      
      We need to make sure the name belongs to the device
      of interest, and that we do not destroy its primary
      name, since we rely on it being not deleted :
      dev->name_node would indeed point to freed memory.
      
      syzbot report was the following :
      
      BUG: KASAN: use-after-free in dev_net include/linux/netdevice.h:2206 [inline]
      BUG: KASAN: use-after-free in mld_force_mld_version net/ipv6/mcast.c:1172 [inline]
      BUG: KASAN: use-after-free in mld_in_v2_mode_only net/ipv6/mcast.c:1180 [inline]
      BUG: KASAN: use-after-free in mld_in_v1_mode+0x203/0x230 net/ipv6/mcast.c:1190
      Read of size 8 at addr ffff88809886c588 by task swapper/1/0
      
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.6.0-rc1-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __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/0x32 mm/kasan/report.c:506
       kasan_report+0x12/0x20 mm/kasan/common.c:641
       __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
       dev_net include/linux/netdevice.h:2206 [inline]
       mld_force_mld_version net/ipv6/mcast.c:1172 [inline]
       mld_in_v2_mode_only net/ipv6/mcast.c:1180 [inline]
       mld_in_v1_mode+0x203/0x230 net/ipv6/mcast.c:1190
       mld_send_initial_cr net/ipv6/mcast.c:2083 [inline]
       mld_dad_timer_expire+0x24/0x230 net/ipv6/mcast.c:2118
       call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404
       expire_timers kernel/time/timer.c:1449 [inline]
       __run_timers kernel/time/timer.c:1773 [inline]
       __run_timers kernel/time/timer.c:1740 [inline]
       run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786
       __do_softirq+0x262/0x98c kernel/softirq.c:292
       invoke_softirq kernel/softirq.c:373 [inline]
       irq_exit+0x19b/0x1e0 kernel/softirq.c:413
       exiting_irq arch/x86/include/asm/apic.h:546 [inline]
       smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1146
       apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829
       </IRQ>
      RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
      Code: 68 73 c5 f9 eb 8a cc cc cc cc cc cc e9 07 00 00 00 0f 00 2d 94 be 59 00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 84 be 59 00 fb f4 <c3> cc 55 48 89 e5 41 57 41 56 41 55 41 54 53 e8 de 2a 74 f9 e8 09
      RSP: 0018:ffffc90000d3fd68 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
      RAX: 1ffffffff136761a RBX: ffff8880a99fc340 RCX: 0000000000000000
      RDX: dffffc0000000000 RSI: 0000000000000006 RDI: ffff8880a99fcbd4
      RBP: ffffc90000d3fd98 R08: ffff8880a99fc340 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: dffffc0000000000
      R13: ffffffff8aa5a1c0 R14: 0000000000000000 R15: 0000000000000001
       arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:686
       default_idle_call+0x84/0xb0 kernel/sched/idle.c:94
       cpuidle_idle_call kernel/sched/idle.c:154 [inline]
       do_idle+0x3c8/0x6e0 kernel/sched/idle.c:269
       cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:361
       start_secondary+0x2f4/0x410 arch/x86/kernel/smpboot.c:264
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:242
      
      Allocated by task 10229:
       save_stack+0x23/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       __kasan_kmalloc mm/kasan/common.c:515 [inline]
       __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:488
       kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529
       __do_kmalloc_node mm/slab.c:3616 [inline]
       __kmalloc_node+0x4e/0x70 mm/slab.c:3623
       kmalloc_node include/linux/slab.h:578 [inline]
       kvmalloc_node+0x68/0x100 mm/util.c:574
       kvmalloc include/linux/mm.h:645 [inline]
       kvzalloc include/linux/mm.h:653 [inline]
       alloc_netdev_mqs+0x98/0xe40 net/core/dev.c:9797
       rtnl_create_link+0x22d/0xaf0 net/core/rtnetlink.c:3047
       __rtnl_newlink+0xf9f/0x1790 net/core/rtnetlink.c:3309
       rtnl_newlink+0x69/0xa0 net/core/rtnetlink.c:3377
       rtnetlink_rcv_msg+0x45e/0xaf0 net/core/rtnetlink.c:5438
       netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477
       rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5456
       netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
       netlink_unicast+0x59e/0x7e0 net/netlink/af_netlink.c:1328
       netlink_sendmsg+0x91c/0xea0 net/netlink/af_netlink.c:1917
       sock_sendmsg_nosec net/socket.c:652 [inline]
       sock_sendmsg+0xd7/0x130 net/socket.c:672
       __sys_sendto+0x262/0x380 net/socket.c:1998
       __do_compat_sys_socketcall net/compat.c:771 [inline]
       __se_compat_sys_socketcall net/compat.c:719 [inline]
       __ia32_compat_sys_socketcall+0x530/0x710 net/compat.c:719
       do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
       do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408
       entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
      
      Freed by task 10229:
       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:337 [inline]
       __kasan_slab_free+0x102/0x150 mm/kasan/common.c:476
       kasan_slab_free+0xe/0x10 mm/kasan/common.c:485
       __cache_free mm/slab.c:3426 [inline]
       kfree+0x10a/0x2c0 mm/slab.c:3757
       __netdev_name_node_alt_destroy+0x1ff/0x2a0 net/core/dev.c:322
       netdev_name_node_alt_destroy+0x57/0x80 net/core/dev.c:334
       rtnl_alt_ifname net/core/rtnetlink.c:3518 [inline]
       rtnl_linkprop.isra.0+0x575/0x6f0 net/core/rtnetlink.c:3567
       rtnl_dellinkprop+0x46/0x60 net/core/rtnetlink.c:3588
       rtnetlink_rcv_msg+0x45e/0xaf0 net/core/rtnetlink.c:5438
       netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477
       rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5456
       netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
       netlink_unicast+0x59e/0x7e0 net/netlink/af_netlink.c:1328
       netlink_sendmsg+0x91c/0xea0 net/netlink/af_netlink.c:1917
       sock_sendmsg_nosec net/socket.c:652 [inline]
       sock_sendmsg+0xd7/0x130 net/socket.c:672
       ____sys_sendmsg+0x753/0x880 net/socket.c:2343
       ___sys_sendmsg+0x100/0x170 net/socket.c:2397
       __sys_sendmsg+0x105/0x1d0 net/socket.c:2430
       __compat_sys_sendmsg net/compat.c:642 [inline]
       __do_compat_sys_sendmsg net/compat.c:649 [inline]
       __se_compat_sys_sendmsg net/compat.c:646 [inline]
       __ia32_compat_sys_sendmsg+0x7a/0xb0 net/compat.c:646
       do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
       do_fast_syscall_32+0x27b/0xe16 arch/x86/entry/common.c:408
       entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
      
      The buggy address belongs to the object at ffff88809886c000
       which belongs to the cache kmalloc-4k of size 4096
      The buggy address is located 1416 bytes inside of
       4096-byte region [ffff88809886c000, ffff88809886d000)
      The buggy address belongs to the page:
      page:ffffea0002621b00 refcount:1 mapcount:0 mapping:ffff8880aa402000 index:0x0 compound_mapcount: 0
      flags: 0xfffe0000010200(slab|head)
      raw: 00fffe0000010200 ffffea0002610d08 ffffea0002607608 ffff8880aa402000
      raw: 0000000000000000 ffff88809886c000 0000000100000001 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff88809886c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff88809886c500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      >ffff88809886c580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
       ffff88809886c600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff88809886c680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      Fixes: 36fbf1e5 ("net: rtnetlink: add linkprop commands to add and delete alternative ifnames")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e08ad805
    • David S. Miller's avatar
      Merge branch 'atlantic-fixes' · 0b634c0e
      David S. Miller authored
      Igor Russkikh says:
      
      ====================
      Marvell atlantic 2020/02 updates
      
      Hi David, here is another set of bugfixes on AQC family found on
      last integration phase.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b634c0e
    • Dmitry Bogdanov's avatar
      net: atlantic: fix out of range usage of active_vlans array · 5a292c89
      Dmitry Bogdanov authored
      fix static checker warning:
       drivers/net/ethernet/aquantia/atlantic/aq_filters.c:166 aq_check_approve_fvlan()
       error: passing untrusted data to 'test_bit()'
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Fixes: 7975d2af: ("net: aquantia: add support of rx-vlan-filter offload")
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a292c89
    • Pavel Belous's avatar
      net: atlantic: possible fault in transition to hibernation · 52a22f4d
      Pavel Belous authored
      during hibernation freeze, aq_nic_stop could be invoked
      on a stopped device. That may cause panic on access to
      not yet allocated vector/ring structures.
      
      Add a check to stop device if it is not yet stopped.
      
      Similiarly after freeze in hibernation thaw, aq_nic_start
      could be invoked on a not initialized net device.
      Result will be the same.
      
      Add a check to start device if it is initialized.
      In our case, this is the same as started.
      
      Fixes: 8aaa112a ("net: atlantic: refactoring pm logic")
      Signed-off-by: default avatarPavel Belous <pbelous@marvell.com>
      Signed-off-by: default avatarNikita Danilov <ndanilov@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52a22f4d
    • Pavel Belous's avatar
      net: atlantic: fix potential error handling · 380ec5b9
      Pavel Belous authored
      Code inspection found that in case of mapping error we do return current
      'ret' value. But beside error, it is used to count number of descriptors
      allocated for the packet. In that case map_skb function could return '1'.
      
      Changing it to return zero (number of mapped descriptors for skb)
      
      Fixes: 018423e9 ("net: ethernet: aquantia: Add ring support code")
      Signed-off-by: default avatarPavel Belous <pbelous@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      380ec5b9
    • Pavel Belous's avatar
      net: atlantic: fix use after free kasan warn · a4980919
      Pavel Belous authored
      skb->len is used to calculate statistics after xmit invocation.
      
      Under a stress load it may happen that skb will be xmited,
      rx interrupt will come and skb will be freed, all before xmit function
      is even returned.
      
      Eventually, skb->len will access unallocated area.
      
      Moving stats calculation into tx_clean routine.
      
      Fixes: 018423e9 ("net: ethernet: aquantia: Add ring support code")
      Reported-by: default avatarChristophe Vu-Brugier <cvubrugier@fastmail.fm>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarPavel Belous <pbelous@marvell.com>
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4980919
    • Nikita Danilov's avatar
      net: atlantic: better loopback mode handling · b42726fc
      Nikita Danilov authored
      Add checks to not enable multiple loopback modes simultaneously,
      It was also discovered that for dma loopback to function correctly
      promisc mode should be enabled on device.
      
      Fixes: ea4b4d7f ("net: atlantic: loopback tests via private flags")
      Signed-off-by: default avatarNikita Danilov <ndanilov@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b42726fc
    • Egor Pomozov's avatar
      net: atlantic: ptp gpio adjustments · f08a464c
      Egor Pomozov authored
      Clock adjustment data should be passed to FW as well, otherwise in some
      cases a drift was observed when using GPIO features.
      Signed-off-by: default avatarEgor Pomozov <epomozov@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f08a464c
    • Igor Russkikh's avatar
      net: atlantic: check rpc result and wait for rpc address · e7b5f97e
      Igor Russkikh authored
      Artificial HW reliability tests revealed a possible hangup in
      the driver. Normally, when device disappears from bus, all
      register reads returns 0xFFFFFFFF.
      
      At remote procedure invocation towards FW there is a logic
      where result is compared with -1 in a loop.
      That caused an infinite loop if hardware due to some issues
      disappears from bus.
      
      Add extra result checks to prevent this.
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e7b5f97e
    • Dmitry Bezrukov's avatar
      net: atlantic: checksum compat issue · 15beab0a
      Dmitry Bezrukov authored
      Yet another checksum offload compatibility issue was found.
      
      The known issue is that AQC HW marks tcp packets with 0xFFFF checksum
      as invalid (1). This is workarounded in driver, passing all the suspicious
      packets up to the stack for further csum validation.
      
      Another HW problem (2) is that it hides invalid csum of LRO aggregated
      packets inside of the individual descriptors. That was workarounded
      by forced scan of all LRO descriptors for checksum errors.
      
      However the scan logic was joint for both LRO and multi-descriptor
      packets (jumbos). And this causes the issue.
      
      We have to drop LRO packets with the detected bad checksum
      because of (2), but we have to pass jumbo packets to stack because of (1).
      
      When using windows tcp partner with jumbo frames but with LSO disabled
      driver discards such frames as bad checksummed. But only LRO frames
      should be dropped, not jumbos.
      
      On such a configurations tcp stream have a chance of drops and stucks.
      
      (1) 76f254d4 ("net: aquantia: tcp checksum 0xffff being handled incorrectly")
      (2) d08b9a0a ("net: aquantia: do not pass lro session with invalid tcp checksum")
      
      Fixes: d08b9a0a ("net: aquantia: do not pass lro session with invalid tcp checksum")
      Signed-off-by: default avatarDmitry Bezrukov <dbezrukov@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDmitry Bogdanov <dbogdanov@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      15beab0a
    • Hangbin Liu's avatar
      selftests: forwarding: vxlan_bridge_1d: fix tos value · 4e867c9a
      Hangbin Liu authored
      After commit 71130f29 ("vxlan: fix tos value before xmit") we start
      strict vxlan xmit tos value by RT_TOS(), which limits the tos value less
      than 0x1E. With current value 0x40 the test will failed with "v1: Expected
      to capture 10 packets, got 0". So let's choose a smaller tos value for
      testing.
      
      Fixes: d417ecf5 ("selftests: forwarding: vxlan_bridge_1d: Add a TOS test")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e867c9a
    • Eric Dumazet's avatar
      net: rtnetlink: fix bugs in rtnl_alt_ifname() · 44bfa9c5
      Eric Dumazet authored
      Since IFLA_ALT_IFNAME is an NLA_STRING, we have no
      guarantee it is nul terminated.
      
      We should use nla_strdup() instead of kstrdup(), since this
      helper will make sure not accessing out-of-bounds data.
      
      BUG: KMSAN: uninit-value in strlen+0x5e/0xa0 lib/string.c:535
      CPU: 1 PID: 19157 Comm: syz-executor.5 Not tainted 5.5.0-rc5-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+0x1c9/0x220 lib/dump_stack.c:118
       kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:118
       __msan_warning+0x58/0xa0 mm/kmsan/kmsan_instr.c:215
       strlen+0x5e/0xa0 lib/string.c:535
       kstrdup+0x7f/0x1a0 mm/util.c:59
       rtnl_alt_ifname net/core/rtnetlink.c:3495 [inline]
       rtnl_linkprop+0x85d/0xc00 net/core/rtnetlink.c:3553
       rtnl_newlinkprop+0x9d/0xb0 net/core/rtnetlink.c:3568
       rtnetlink_rcv_msg+0x1153/0x1570 net/core/rtnetlink.c:5424
       netlink_rcv_skb+0x451/0x650 net/netlink/af_netlink.c:2477
       rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:5442
       netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
       netlink_unicast+0xf9e/0x1100 net/netlink/af_netlink.c:1328
       netlink_sendmsg+0x1248/0x14d0 net/netlink/af_netlink.c:1917
       sock_sendmsg_nosec net/socket.c:639 [inline]
       sock_sendmsg net/socket.c:659 [inline]
       ____sys_sendmsg+0x12b6/0x1350 net/socket.c:2330
       ___sys_sendmsg net/socket.c:2384 [inline]
       __sys_sendmsg+0x451/0x5f0 net/socket.c:2417
       __do_sys_sendmsg net/socket.c:2426 [inline]
       __se_sys_sendmsg+0x97/0xb0 net/socket.c:2424
       __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2424
       do_syscall_64+0xb8/0x160 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x45b3b9
      Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007ff1c7b1ac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007ff1c7b1b6d4 RCX: 000000000045b3b9
      RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000003
      RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
      R13: 00000000000009cb R14: 00000000004cb3dd R15: 000000000075bf2c
      
      Uninit was created at:
       kmsan_save_stack_with_flags mm/kmsan/kmsan.c:144 [inline]
       kmsan_internal_poison_shadow+0x66/0xd0 mm/kmsan/kmsan.c:127
       kmsan_slab_alloc+0x8a/0xe0 mm/kmsan/kmsan_hooks.c:82
       slab_alloc_node mm/slub.c:2774 [inline]
       __kmalloc_node_track_caller+0xb40/0x1200 mm/slub.c:4382
       __kmalloc_reserve net/core/skbuff.c:141 [inline]
       __alloc_skb+0x2fd/0xac0 net/core/skbuff.c:209
       alloc_skb include/linux/skbuff.h:1049 [inline]
       netlink_alloc_large_skb net/netlink/af_netlink.c:1174 [inline]
       netlink_sendmsg+0x7d3/0x14d0 net/netlink/af_netlink.c:1892
       sock_sendmsg_nosec net/socket.c:639 [inline]
       sock_sendmsg net/socket.c:659 [inline]
       ____sys_sendmsg+0x12b6/0x1350 net/socket.c:2330
       ___sys_sendmsg net/socket.c:2384 [inline]
       __sys_sendmsg+0x451/0x5f0 net/socket.c:2417
       __do_sys_sendmsg net/socket.c:2426 [inline]
       __se_sys_sendmsg+0x97/0xb0 net/socket.c:2424
       __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2424
       do_syscall_64+0xb8/0x160 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: 36fbf1e5 ("net: rtnetlink: add linkprop commands to add and delete alternative ifnames")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44bfa9c5
    • Alexandre Belloni's avatar
      net: macb: ensure interface is not suspended on at91rm9200 · e6a41c23
      Alexandre Belloni authored
      Because of autosuspend, at91ether_start is called with clocks disabled.
      Ensure that pm_runtime doesn't suspend the interface as soon as it is
      opened as there is no pm_runtime support is the other relevant parts of the
      platform support for at91rm9200.
      
      Fixes: d54f89af ("net: macb: Add pm runtime support")
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e6a41c23
    • Jethro Beekman's avatar
      net: fib_rules: Correctly set table field when table number exceeds 8 bits · 540e585a
      Jethro Beekman authored
      In 709772e6, RT_TABLE_COMPAT was added to
      allow legacy software to deal with routing table numbers >= 256, but the
      same change to FIB rule queries was overlooked.
      Signed-off-by: default avatarJethro Beekman <jethro@fortanix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      540e585a
    • Leon Romanovsky's avatar
      net/rds: Track user mapped pages through special API · 0d4597c8
      Leon Romanovsky authored
      Convert net/rds to use the newly introduces pin_user_pages() API,
      which properly sets FOLL_PIN. Setting FOLL_PIN is now required for
      code that requires tracking of pinned pages.
      
      Note that this effectively changes the code's behavior: it now
      ultimately calls set_page_dirty_lock(), instead of set_page_dirty().
      This is probably more accurate.
      
      As Christoph Hellwig put it, "set_page_dirty() is only safe if we are
      dealing with a file backed page where we have reference on the inode it
      hangs off." [1]
      
      [1] https://lore.kernel.org/r/20190723153640.GB720@lst.de
      
      Cc: Hans Westgaard Ry <hans.westgaard.ry@oracle.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0d4597c8
    • Benjamin Poirier's avatar
      ipv6: Fix nlmsg_flags when splitting a multipath route · afecdb37
      Benjamin Poirier authored
      When splitting an RTA_MULTIPATH request into multiple routes and adding the
      second and later components, we must not simply remove NLM_F_REPLACE but
      instead replace it by NLM_F_CREATE. Otherwise, it may look like the netlink
      message was malformed.
      
      For example,
      	ip route add 2001:db8::1/128 dev dummy0
      	ip route change 2001:db8::1/128 nexthop via fe80::30:1 dev dummy0 \
      		nexthop via fe80::30:2 dev dummy0
      results in the following warnings:
      [ 1035.057019] IPv6: RTM_NEWROUTE with no NLM_F_CREATE or NLM_F_REPLACE
      [ 1035.057517] IPv6: NLM_F_CREATE should be set when creating new route
      
      This patch makes the nlmsg sequence look equivalent for __ip6_ins_rt() to
      what it would get if the multipath route had been added in multiple netlink
      operations:
      	ip route add 2001:db8::1/128 dev dummy0
      	ip route change 2001:db8::1/128 nexthop via fe80::30:1 dev dummy0
      	ip route append 2001:db8::1/128 nexthop via fe80::30:2 dev dummy0
      
      Fixes: 27596472 ("ipv6: fix ECMP route replacement")
      Signed-off-by: default avatarBenjamin Poirier <bpoirier@cumulusnetworks.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      afecdb37
    • Benjamin Poirier's avatar
      ipv6: Fix route replacement with dev-only route · e404b8c7
      Benjamin Poirier authored
      After commit 27596472 ("ipv6: fix ECMP route replacement") it is no
      longer possible to replace an ECMP-able route by a non ECMP-able route.
      For example,
      	ip route add 2001:db8::1/128 via fe80::1 dev dummy0
      	ip route replace 2001:db8::1/128 dev dummy0
      does not work as expected.
      
      Tweak the replacement logic so that point 3 in the log of the above commit
      becomes:
      3. If the new route is not ECMP-able, and no matching non-ECMP-able route
      exists, replace matching ECMP-able route (if any) or add the new route.
      
      We can now summarize the entire replace semantics to:
      When doing a replace, prefer replacing a matching route of the same
      "ECMP-able-ness" as the replace argument. If there is no such candidate,
      fallback to the first route found.
      
      Fixes: 27596472 ("ipv6: fix ECMP route replacement")
      Signed-off-by: default avatarBenjamin Poirier <bpoirier@cumulusnetworks.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e404b8c7
    • Hangbin Liu's avatar
      selftests: forwarding: use proto icmp for {gretap, ip6gretap}_mac testing · e8023b03
      Hangbin Liu authored
      For tc ip_proto filter, when we extract the flow via __skb_flow_dissect()
      without flag FLOW_DISSECTOR_F_STOP_AT_ENCAP, we will continue extract to
      the inner proto.
      
      So for GRE + ICMP messages, we should not track GRE proto, but inner ICMP
      proto.
      
      For test mirror_gre.sh, it may make user confused if we capture ICMP
      message on $h3(since the flow is GRE message). So I move the capture
      dev to h3-gt{4,6}, and only capture ICMP message.
      
      Before the fix:
      ]# ./mirror_gre.sh
      TEST: ingress mirror to gretap (skip_hw)                            [ OK ]
      TEST: egress mirror to gretap (skip_hw)                             [ OK ]
      TEST: ingress mirror to ip6gretap (skip_hw)                         [ OK ]
      TEST: egress mirror to ip6gretap (skip_hw)                          [ OK ]
      TEST: ingress mirror to gretap: envelope MAC (skip_hw)              [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: egress mirror to gretap: envelope MAC (skip_hw)               [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: ingress mirror to ip6gretap: envelope MAC (skip_hw)           [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: egress mirror to ip6gretap: envelope MAC (skip_hw)            [FAIL]
       Expected to capture 10 packets, got 0.
      TEST: two simultaneously configured mirrors (skip_hw)               [ OK ]
      WARN: Could not test offloaded functionality
      
      After fix:
      ]# ./mirror_gre.sh
      TEST: ingress mirror to gretap (skip_hw)                            [ OK ]
      TEST: egress mirror to gretap (skip_hw)                             [ OK ]
      TEST: ingress mirror to ip6gretap (skip_hw)                         [ OK ]
      TEST: egress mirror to ip6gretap (skip_hw)                          [ OK ]
      TEST: ingress mirror to gretap: envelope MAC (skip_hw)              [ OK ]
      TEST: egress mirror to gretap: envelope MAC (skip_hw)               [ OK ]
      TEST: ingress mirror to ip6gretap: envelope MAC (skip_hw)           [ OK ]
      TEST: egress mirror to ip6gretap: envelope MAC (skip_hw)            [ OK ]
      TEST: two simultaneously configured mirrors (skip_hw)               [ OK ]
      WARN: Could not test offloaded functionality
      
      Fixes: ba8d3987 ("selftests: forwarding: Add test for mirror to gretap")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarPetr Machata <pmachata@gmail.com>
      Tested-by: default avatarPetr Machata <pmachata@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e8023b03
  2. 14 Feb, 2020 16 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 2019fc96
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix interrupt name truncation in mv88e6xxx dsa driver, from Andrew
          Lunn.
      
       2) Process generic XDP even if SKB is cloned, from Toke Høiland-Jørgensen.
      
       3) Fix leak of kernel memory to userspace in smc, from Eric Dumazet.
      
       4) Add some missing netlink attribute validation to matchall and
          flower, from Davide Caratti.
      
       5) Send icmp responses properly when NAT has been applied to the frame
          before we get to the tunnel emitting the icmp, from Jason Donenfeld.
      
       6) Make sure there is enough SKB headroom when adding dsa tags for qca
          and ar9331. From Per Forlin.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (62 commits)
        netdevice.h: fix all kernel-doc and Sphinx warnings
        net: dsa: tag_ar9331: Make sure there is headroom for tag
        net: dsa: tag_qca: Make sure there is headroom for tag
        net, ip6_tunnel: enhance tunnel locate with link check
        net/smc: no peer ID in CLC decline for SMCD
        net/smc: transfer fasync_list in case of fallback
        net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples()
        net: hns3: fix VF bandwidth does not take effect in some case
        net: hns3: add management table after IMP reset
        mac80211: fix wrong 160/80+80 MHz setting
        cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE
        xfrm: interface: use icmp_ndo_send helper
        wireguard: device: use icmp_ndo_send helper
        sunvnet: use icmp_ndo_send helper
        gtp: use icmp_ndo_send helper
        icmp: introduce helper for nat'd source address in network device context
        net/sched: flower: add missing validation of TCA_FLOWER_FLAGS
        net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS
        net/flow_dissector: remove unexist field description
        page_pool: refill page when alloc.count of pool is zero
        ...
      2019fc96
    • Linus Torvalds's avatar
      Merge tag 'pm-5.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 4e03e4e6
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "Fix three issues related to the handling of wakeup events signaled
        through the ACPI SCI while suspended to idle (Rafael Wysocki) and
        unexport an internal cpufreq variable (Yangtao Li)"
      
      * tag 'pm-5.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system
        ACPICA: Introduce acpi_any_gpe_status_set()
        ACPI: PM: s2idle: Avoid possible race related to the EC GPE
        ACPI: EC: Fix flushing of pending work
        cpufreq: Make cpufreq_global_kobject static
      4e03e4e6
    • Linus Torvalds's avatar
      Merge tag 'sound-5.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 81f3011c
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "The only common change is the regression fix of the previous PCM fix
        patch for managed buffers while the rest are usual suspects, USB-audio
        and HD-audio device-specific quirks.
      
        The change for UAC2 clock validation workaround became a bit big, but
        the changes are fairly straightforward"
      
      * tag 'sound-5.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: pcm: Fix double hw_free calls
        ALSA: usb-audio: Add clock validity quirk for Denon MC7000/MCX8000
        ALSA: hda/realtek - Fix silent output on MSI-GL73
        ALSA: hda/realtek - Add more codec supported Headset Button
        ALSA: usb-audio: Apply sample rate quirk for Audioengine D1
        ALSA: usb-audio: Fix UAC2/3 effect unit parsing
        ALSA: usb-audio: Apply 48kHz fixed rate playback for Jabra Evolve 65 headset
      81f3011c
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-02-14' of git://anongit.freedesktop.org/drm/drm · 3f0d3293
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "The core has a build fix for edid code on certain compilers/arches/,
        one MST fix and one vgem fix. Regular amdgpu fixes, and a couple of
        small driver fixes.
      
        The i915 fixes are bit larger than normal for this stage, but they
        were having CI issues last week, and they hadn't sent any fixes last
        week due to this.
      
        core:
         - edid build fix
      
        mst:
         - fix NULL ptr deref
      
        vgem:
         - fix close after free
      
        msm:
         - better dma-api usage
      
        sun4i:
         - disable allow_fb_modifiers
      
        amdgpu:
         - Additional OD fixes for navi
         - Misc display fixes
         - VCN 2.5 DPG fix
         - Prevent build errors on PowerPC on some configs
         - GDS EDC fix
      
        i915:
         - dsi/acpi fixes
         - gvt locking and allocation fixes
         - gem/gt fixes
         - bios timing parameters fix"
      
      * tag 'drm-fixes-2020-02-14' of git://anongit.freedesktop.org/drm/drm: (50 commits)
        drm/i915: Mark the removal of the i915_request from the sched.link
        drm/i915/execlists: Reclaim the hanging virtual request
        drm/i915/execlists: Take a reference while capturing the guilty request
        drm/i915/execlists: Offline error capture
        drm/i915/gt: Allow temporary suspension of inflight requests
        drm/i915: Keep track of request among the scheduling lists
        drm/i915/gem: Tighten checks and acquiring the mmap object
        drm/i915: Fix preallocated barrier list append
        drm/i915/gt: Acquire ce->active before ce->pin_count/ce->pin_mutex
        drm/i915: Tighten atomicity of i915_active_acquire vs i915_active_release
        drm/i915: Stub out i915_gpu_coredump_put
        drm/amdgpu:/navi10: use the ODCAP enum to index the caps array
        drm/amdgpu: update smu_v11_0_pptable.h
        drm/amdgpu: correct comment to clear up the confusion
        drm/amd/display: DCN2.x Do not program DPPCLK if same value
        drm/amd/display: Don't map ATOM_ENABLE to ATOM_INIT
        drm/amdgpu/vcn2.5: fix warning
        drm/amdgpu: limit GDS clearing workaround in cold boot sequence
        drm/amdgpu: fix amdgpu pmu to use hwc->config instead of hwc->conf
        amdgpu: Prevent build errors regarding soft/hard-float FP ABI tags
        ...
      3f0d3293
    • Randy Dunlap's avatar
      netdevice.h: fix all kernel-doc and Sphinx warnings · a1fa83bd
      Randy Dunlap authored
      Eliminate all kernel-doc and Sphinx warnings in
      <linux/netdevice.h>.  Fixes these warnings:
      
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'gso_partial_features' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'l3mdev_ops' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'xfrmdev_ops' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'tlsdev_ops' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'name_assign_type' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'ieee802154_ptr' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'mpls_ptr' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'xdp_prog' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'gro_flush_timeout' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'xdp_bulkq' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'xps_cpus_map' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'xps_rxqs_map' not described in 'net_device'
      ../include/linux/netdevice.h:2100: warning: Function parameter or member 'qdisc_hash' not described in 'net_device'
      ../include/linux/netdevice.h:3552: WARNING: Inline emphasis start-string without end-string.
      ../include/linux/netdevice.h:3552: WARNING: Inline emphasis start-string without end-string.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1fa83bd
    • David S. Miller's avatar
      Merge branch 'dsa-headroom' · 3ea89fa7
      David S. Miller authored
      Per Forlin says:
      
      ====================
      net: dsa: Make sure there is headroom for tag
      
      Sorry for re-posting yet another time....
      I manage to include multiple email-senders and forgot to include cover-letter.
      Let's hope everyhthing is in order this time.
      
      Fix two tag drivers to make sure there is headroom for the tag data.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ea89fa7
    • Per Forlin's avatar
      net: dsa: tag_ar9331: Make sure there is headroom for tag · ddc9abaf
      Per Forlin authored
      Passing tag size to skb_cow_head will make sure
      there is enough headroom for the tag data.
      This change does not introduce any overhead in case there
      is already available headroom for tag.
      Signed-off-by: default avatarPer Forlin <perfn@axis.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ddc9abaf
    • Per Forlin's avatar
      net: dsa: tag_qca: Make sure there is headroom for tag · 04fb9124
      Per Forlin authored
      Passing tag size to skb_cow_head will make sure
      there is enough headroom for the tag data.
      This change does not introduce any overhead in case there
      is already available headroom for tag.
      Signed-off-by: default avatarPer Forlin <perfn@axis.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04fb9124
    • William Dauchy's avatar
      net, ip6_tunnel: enhance tunnel locate with link check · 5fdcce21
      William Dauchy authored
      With ipip, it is possible to create an extra interface explicitly
      attached to a given physical interface:
      
        # ip link show tunl0
        4: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
          link/ipip 0.0.0.0 brd 0.0.0.0
        # ip link add tunl1 type ipip dev eth0
        # ip link show tunl1
        6: tunl1@eth0: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
          link/ipip 0.0.0.0 brd 0.0.0.0
      
      But it is not possible with ip6tnl:
      
        # ip link show ip6tnl0
        5: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/tunnel6 :: brd ::
        # ip link add ip6tnl1 type ip6tnl dev eth0
        RTNETLINK answers: File exists
      
      This patch aims to make it possible by adding link comparaison in both
      tunnel locate and lookup functions; we also modify mtu calculation when
      attached to an interface with a lower mtu.
      
      This permits to make use of x-netns communication by moving the newly
      created tunnel in a given netns.
      Signed-off-by: default avatarWilliam Dauchy <w.dauchy@criteo.com>
      Reviewed-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5fdcce21
    • David S. Miller's avatar
      Merge tag 'mac80211-for-net-2020-02-14' of... · b32cb6fc
      David S. Miller authored
      Merge tag 'mac80211-for-net-2020-02-14' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
      
      Johannes Berg says:
      
      ====================
      Just a few fixes:
       * avoid running out of tracking space for frames that need
         to be reported to userspace by using more bits
       * fix beacon handling suppression by adding some relevant
         elements to the CRC calculation
       * fix quiet mode in action frames
       * fix crash in ethtool for virt_wifi and similar
       * add a missing policy entry
       * fix 160 & 80+80 bandwidth to take local capabilities into
         account
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b32cb6fc
    • David S. Miller's avatar
      Merge branch 'smc-fixes' · 907e51e4
      David S. Miller authored
      Karsten Graul says:
      
      ====================
      net/smc: fixes for -net
      
      Fix a syzbot finding and a problem with the CLC handshake content.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      907e51e4
    • Ursula Braun's avatar
      net/smc: no peer ID in CLC decline for SMCD · 369537c9
      Ursula Braun authored
      Just SMCR requires a CLC Peer ID, but not SMCD. The field should be
      zero for SMCD.
      
      Fixes: c758dfdd ("net/smc: add SMC-D support in CLC messages")
      Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      369537c9
    • Ursula Braun's avatar
      net/smc: transfer fasync_list in case of fallback · 67f562e3
      Ursula Braun authored
      SMC does not work together with FASTOPEN. If sendmsg() is called with
      flag MSG_FASTOPEN in SMC_INIT state, the SMC-socket switches to
      fallback mode. To handle the previous ioctl FIOASYNC call correctly
      in this case, it is necessary to transfer the socket wait queue
      fasync_list to the internal TCP socket.
      
      Reported-by: syzbot+4b1fe8105f8044a26162@syzkaller.appspotmail.com
      Fixes: ee9dfbef ("net/smc: handle sockopts forcing fallback")
      Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67f562e3
    • David S. Miller's avatar
      Merge branch 'hns3-fixes' · dc221a28
      David S. Miller authored
      Huazhong Tan says:
      
      ====================
      net: hns3: fixes for -net
      
      This series includes three bugfixes for the HNS3 ethernet driver.
      
      [patch 1] fixes a management table lost issue after IMP reset.
      [patch 2] fixes a VF bandwidth configuration not work problem.
      [patch 3] fixes a problem related to IPv6 address copying.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dc221a28
    • Guangbin Huang's avatar
      net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples() · 47327c93
      Guangbin Huang authored
      The IPv6 address defined in struct in6_addr is specified as
      big endian, but there is no specified endian in struct
      hclge_fd_rule_tuples, so it  will cause a problem if directly
      use memcpy() to copy ipv6 address between these two structures
      since this field in struct hclge_fd_rule_tuples is little endian.
      
      This patch fixes this problem by using be32_to_cpu() to convert
      endian of IPv6 address of struct in6_addr before copying.
      
      Fixes: d93ed94f ("net: hns3: add aRFS support for PF")
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47327c93
    • Yonglong Liu's avatar
      net: hns3: fix VF bandwidth does not take effect in some case · 19eb1123
      Yonglong Liu authored
      When enabling 4 TC after setting the bandwidth of VF, the bandwidth
      of VF will resume to default value, because of the qset resources
      changed in this case.
      
      This patch fixes it by using a fixed VF's qset resources according to
      HNAE3_MAX_TC macro.
      
      Fixes: ee9e4424 ("net: hns3: add support for configuring bandwidth of VF on the host")
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19eb1123