Skip to content
  1. May 01, 2020
    • Parav Pandit's avatar
      net/mlx5: E-switch, Fix mutex init order · f8d1edda
      Parav Pandit authored
      In cited patch mutex is initialized after its used.
      Below call trace is observed.
      Fix the order to initialize the mutex early enough.
      Similarly follow mirror sequence during cleanup.
      
      kernel: DEBUG_LOCKS_WARN_ON(lock->magic != lock)
      kernel: WARNING: CPU: 5 PID: 45916 at kernel/locking/mutex.c:938
      __mutex_lock+0x7d6/0x8a0
      kernel: Call Trace:
      kernel: ? esw_vport_tbl_get+0x3b/0x250 [mlx5_core]
      kernel: ? mark_held_locks+0x55/0x70
      kernel: ? __slab_free+0x274/0x400
      kernel: ? lockdep_hardirqs_on+0x140/0x1d0
      kernel: esw_vport_tbl_get+0x3b/0x250 [mlx5_core]
      kernel: ? mlx5_esw_chains_create_fdb_prio+0xa57/0xc20 [mlx5_core]
      kernel: mlx5_esw_vport_tbl_get+0x88/0xf0 [mlx5_core]
      kernel: mlx5_esw_chains_create+0x2f3/0x3e0 [mlx5_core]
      kernel: esw_create_offloads_fdb_tables+0x11d/0x580 [mlx5_core]
      kernel: esw_offloads_enable+0x26d/0x540 [mlx5_core]
      kernel: mlx5_eswitch_enable_locked+0x155/0x860 [mlx5_core]
      kernel: mlx5_devlink_eswitch_mode_set+0x1af/0x320 [mlx5_core]
      kernel: devlink_nl_cmd_eswitch_set_doit+0x41/0xb0
      
      Fixes: 96e32687
      
       ("net/mlx5e: Eswitch, Use per vport tables for mirroring")
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Reviewed-by: default avatarEli Cohen <eli@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      f8d1edda
    • Parav Pandit's avatar
      net/mlx5: E-switch, Fix printing wrong error value · e9864539
      Parav Pandit authored
      When mlx5_modify_header_alloc() fails, instead of printing the error
      value returned, current error log prints 0.
      
      Fix by printing correct error value returned by
      mlx5_modify_header_alloc().
      
      Fixes: 6724e66b
      
       ("net/mlx5: E-Switch, Get reg_c1 value on miss")
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      e9864539
    • Parav Pandit's avatar
      net/mlx5: E-switch, Fix error unwinding flow for steering init failure · 79949985
      Parav Pandit authored
      Error unwinding is done incorrectly in the cited commit.
      When steering init fails, there is no need to perform steering cleanup.
      When vport error exists, error cleanup should be mirror of the setup
      routine, i.e. to perform steering cleanup before metadata cleanup.
      
      This avoids the call trace in accessing uninitialized objects which are
      skipped during steering_init() due to failure in steering_init().
      
      Call trace:
      mlx5_cmd_modify_header_alloc:805:(pid 21128): too many modify header
      actions 1, max supported 0
      E-Switch: Failed to create restore mod header
      
      BUG: kernel NULL pointer dereference, address: 00000000000000d0
      [  677.263079]  mlx5_destroy_flow_group+0x13/0x80 [mlx5_core]
      [  677.268921]  esw_offloads_steering_cleanup+0x51/0xf0 [mlx5_core]
      [  677.275281]  esw_offloads_enable+0x1a5/0x800 [mlx5_core]
      [  677.280949]  mlx5_eswitch_enable_locked+0x155/0x860 [mlx5_core]
      [  677.287227]  mlx5_devlink_eswitch_mode_set+0x1af/0x320
      [  677.293741]  devlink_nl_cmd_eswitch_set_doit+0x41/0xb0
      [  677.299217]  genl_rcv_msg+0x1eb/0x430
      
      Fixes: 7983a675
      
       ("net/mlx5: E-Switch, Enable chains only if regs loopback is enabled")
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      79949985
  2. Apr 30, 2020
    • David S. Miller's avatar
      Merge branch 'wireguard-fixes' · 30724ccb
      David S. Miller authored
      
      
      Jason A. Donenfeld says:
      
      ====================
      wireguard fixes for 5.7-rc4
      
      This series contains two fixes and a cleanup for wireguard:
      
      1) Removal of a spurious newline, from Sultan Alsawaf.
      
      2) Fix for a memory leak in an error path, in which memory allocated
         prior to the error wasn't freed, reported by Sultan Alsawaf.
      
      3) Fix to ECN support to use RFC6040 properly like all the other tunnel
         drivers, from Toke Høiland-Jørgensen.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      30724ccb
    • Toke Høiland-Jørgensen's avatar
      wireguard: receive: use tunnel helpers for decapsulating ECN markings · eebabcb2
      Toke Høiland-Jørgensen authored
      WireGuard currently only propagates ECN markings on tunnel decap according
      to the old RFC3168 specification. However, the spec has since been updated
      in RFC6040 to recommend slightly different decapsulation semantics. This
      was implemented in the kernel as a set of common helpers for ECN
      decapsulation, so let's just switch over WireGuard to using those, so it
      can benefit from this enhancement and any future tweaks. We do not drop
      packets with invalid ECN marking combinations, because WireGuard is
      frequently used to work around broken ISPs, which could be doing that.
      
      Fixes: e7096c13
      
       ("net: WireGuard secure network tunnel")
      Reported-by: default avatarOlivier Tilmans <olivier.tilmans@nokia-bell-labs.com>
      Cc: Dave Taht <dave.taht@gmail.com>
      Cc: Rodney W. Grimes <ietf@gndrsh.dnsmgr.net>
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eebabcb2
    • Jason A. Donenfeld's avatar
      wireguard: queueing: cleanup ptr_ring in error path of packet_queue_init · 130c5860
      Jason A. Donenfeld authored
      
      
      Prior, if the alloc_percpu of packet_percpu_multicore_worker_alloc
      failed, the previously allocated ptr_ring wouldn't be freed. This commit
      adds the missing call to ptr_ring_cleanup in the error case.
      
      Reported-by: default avatarSultan Alsawaf <sultan@kerneltoast.com>
      Fixes: e7096c13
      
       ("net: WireGuard secure network tunnel")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      130c5860
    • Sultan Alsawaf's avatar
      wireguard: send: remove errant newline from packet_encrypt_worker · d6833e42
      Sultan Alsawaf authored
      
      
      This commit removes a useless newline at the end of a scope, which
      doesn't add anything in the way of organization or readability.
      
      Signed-off-by: default avatarSultan Alsawaf <sultan@kerneltoast.com>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6833e42
    • Florian Westphal's avatar
      mptcp: replace mptcp_disconnect with a stub · 42c556fe
      Florian Westphal authored
      
      
      Paolo points out that mptcp_disconnect is bogus:
      "lock_sock(sk);
      looks suspicious (lock should be already held by the caller)
      And call to: tcp_disconnect(sk, flags); too, sk is not a tcp
      socket".
      
      ->disconnect() gets called from e.g. inet_stream_connect when
      one tries to disassociate a connected socket again (to re-connect
      without closing the socket first).
      MPTCP however uses mptcp_stream_connect, not inet_stream_connect,
      for the mptcp-socket connect call.
      
      inet_stream_connect only gets called indirectly, for the tcp socket,
      so any ->disconnect() calls end up calling tcp_disconnect for that
      tcp subflow sk.
      
      This also explains why syzkaller has not yet reported a problem
      here.  So for now replace this with a stub that doesn't do anything.
      
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/14
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      42c556fe
    • Jason Yan's avatar
      net: dsa: mv88e6xxx: remove duplicate assignment of struct members · 98123074
      Jason Yan authored
      These struct members named 'phylink_validate' was assigned twice:
      
      static const struct mv88e6xxx_ops mv88e6190_ops = {
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      };
      
      static const struct mv88e6xxx_ops mv88e6190x_ops = {
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      	......
      	.phylink_validate = mv88e6390x_phylink_validate,
      };
      
      static const struct mv88e6xxx_ops mv88e6191_ops = {
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      };
      
      static const struct mv88e6xxx_ops mv88e6290_ops = {
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      	......
      	.phylink_validate = mv88e6390_phylink_validate,
      };
      
      Remove all the first one and leave the second one which are been used in
      fact. Be aware that for 'mv88e6190x_ops' the assignment functions is
      different while the others are all the same. This fixes the following
      coccicheck warning:
      
      drivers/net/dsa/mv88e6xxx/chip.c:3911:48-49: phylink_validate: first
      occurrence line 3965, second occurrence line 3967
      drivers/net/dsa/mv88e6xxx/chip.c:3970:49-50: phylink_validate: first
      occurrence line 4024, second occurrence line 4026
      drivers/net/dsa/mv88e6xxx/chip.c:4029:48-49: phylink_validate: first
      occurrence line 4082, second occurrence line 4085
      drivers/net/dsa/mv88e6xxx/chip.c:4184:48-49: phylink_validate: first
      occurrence line 4238, second occurrence line 4242
      
      Fixes: 4262c38d
      
       ("net: dsa: mv88e6xxx: Add SERDES stats counters to all 6390 family members")
      Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>
      Reviewed-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      98123074
  3. Apr 29, 2020
    • YueHaibing's avatar
      net/x25: Fix null-ptr-deref in x25_disconnect · 8999dc89
      YueHaibing authored
      
      
      We should check null before do x25_neigh_put in x25_disconnect,
      otherwise may cause null-ptr-deref like this:
      
       #include <sys/socket.h>
       #include <linux/x25.h>
      
       int main() {
          int sck_x25;
          sck_x25 = socket(AF_X25, SOCK_SEQPACKET, 0);
          close(sck_x25);
          return 0;
       }
      
      BUG: kernel NULL pointer dereference, address: 00000000000000d8
      CPU: 0 PID: 4817 Comm: t2 Not tainted 5.7.0-rc3+ #159
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-
      RIP: 0010:x25_disconnect+0x91/0xe0
      Call Trace:
       x25_release+0x18a/0x1b0
       __sock_release+0x3d/0xc0
       sock_close+0x13/0x20
       __fput+0x107/0x270
       ____fput+0x9/0x10
       task_work_run+0x6d/0xb0
       exit_to_usermode_loop+0x102/0x110
       do_syscall_64+0x23c/0x260
       entry_SYSCALL_64_after_hwframe+0x49/0xb3
      
      Reported-by: default avatar <syzbot+6db548b615e5aeefdce2@syzkaller.appspotmail.com>
      Fixes: 4becb7ee
      
       ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8999dc89
    • Gavin Shan's avatar
      net/ena: Fix build warning in ena_xdp_set() · caec6619
      Gavin Shan authored
      
      
      This fixes the following build warning in ena_xdp_set(), which is
      observed on aarch64 with 64KB page size.
      
         In file included from ./include/net/inet_sock.h:19,
            from ./include/net/ip.h:27,
            from drivers/net/ethernet/amazon/ena/ena_netdev.c:46:
         drivers/net/ethernet/amazon/ena/ena_netdev.c: In function         \
         ‘ena_xdp_set’:                                                    \
         drivers/net/ethernet/amazon/ena/ena_netdev.c:557:6: warning:      \
         format ‘%lu’                                                      \
         expects argument of type ‘long unsigned int’, but argument 4      \
         has type ‘int’                                                    \
         [-Wformat=] "Failed to set xdp program, the current MTU (%d) is   \
         larger than the maximum allowed MTU (%lu) while xdp is on",
      
      Signed-off-by: default avatarGavin Shan <gshan@redhat.com>
      Acked-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      caec6619
  4. Apr 28, 2020
  5. Apr 26, 2020
  6. Apr 25, 2020
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · ab51cac0
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix memory leak in netfilter flowtable, from Roi Dayan.
      
       2) Ref-count leaks in netrom and tipc, from Xiyu Yang.
      
       3) Fix warning when mptcp socket is never accepted before close, from
          Florian Westphal.
      
       4) Missed locking in ovs_ct_exit(), from Tonghao Zhang.
      
       5) Fix large delays during PTP synchornization in cxgb4, from Rahul
          Lakkireddy.
      
       6) team_mode_get() can hang, from Taehee Yoo.
      
       7) Need to use kvzalloc() when allocating fw tracer in mlx5 driver,
          from Niklas Schnelle.
      
       8) Fix handling of bpf XADD on BTF memory, from Jann Horn.
      
       9) Fix BPF_STX/BPF_B encoding in x86 bpf jit, from Luke Nelson.
      
      10) Missing queue memory release in iwlwifi pcie code, from Johannes
          Berg.
      
      11) Fix NULL deref in macvlan device event, from Taehee Yoo.
      
      12) Initialize lan87xx phy correctly, from Yuiko Oshino.
      
      13) Fix looping between VRF and XFRM lookups, from David Ahern.
      
      14) etf packet scheduler assumes all sockets are full sockets, which is
          not necessarily true. From Eric Dumazet.
      
      15) Fix mptcp data_fin handling in RX path, from Paolo Abeni.
      
      16) fib_select_default() needs to handle nexthop objects, from David
          Ahern.
      
      17) Use GFP_ATOMIC under spinlock in mac80211_hwsim, from Wei Yongjun.
      
      18) vxlan and geneve use wrong nlattr array, from Sabrina Dubroca.
      
      19) Correct rx/tx stats in bcmgenet driver, from Doug Berger.
      
      20) BPF_LDX zero-extension is encoded improperly in x86_32 bpf jit, fix
          from Luke Nelson.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (100 commits)
        selftests/bpf: Fix a couple of broken test_btf cases
        tools/runqslower: Ensure own vmlinux.h is picked up first
        bpf: Make bpf_link_fops static
        bpftool: Respect the -d option in struct_ops cmd
        selftests/bpf: Add test for freplace program with expected_attach_type
        bpf: Propagate expected_attach_type when verifying freplace programs
        bpf: Fix leak in LINK_UPDATE and enforce empty old_prog_fd
        bpf, x86_32: Fix logic error in BPF_LDX zero-extension
        bpf, x86_32: Fix clobbering of dst for BPF_JSET
        bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension
        bpf: Fix reStructuredText markup
        net: systemport: suppress warnings on failed Rx SKB allocations
        net: bcmgenet: suppress warnings on failed Rx SKB allocations
        macsec: avoid to set wrong mtu
        mac80211: sta_info: Add lockdep condition for RCU list usage
        mac80211: populate debugfs only after cfg80211 init
        net: bcmgenet: correct per TX/RX ring statistics
        net: meth: remove spurious copyright text
        net: phy: bcm84881: clear settings on link down
        chcr: Fix CPU hard lockup
        ...
      ab51cac0
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 167ff131
      David S. Miller authored
      
      
      Alexei Starovoitov says:
      
      ====================
      pull-request: bpf 2020-04-24
      
      The following pull-request contains BPF updates for your *net* tree.
      
      We've added 17 non-merge commits during the last 5 day(s) which contain
      a total of 19 files changed, 203 insertions(+), 85 deletions(-).
      
      The main changes are:
      
      1) link_update fix, from Andrii.
      
      2) libbpf get_xdp_id fix, from David.
      
      3) xadd verifier fix, from Jann.
      
      4) x86-32 JIT fixes, from Luke and Wang.
      
      5) test_btf fix, from Stanislav.
      
      6) freplace verifier fix, from Toke.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      167ff131