1. 28 Jul, 2022 14 commits
    • Vlad Buslov's avatar
      net/mlx5e: Modify slow path rules to go to slow fdb · c0063a43
      Vlad Buslov authored
      While extending available range of supported chains/prios referenced commit
      also modified slow path rules to go to FT chain instead of actual slow FDB.
      However neither of existing users of the MLX5_ATTR_FLAG_SLOW_PATH
      flag (tunnel encap entries with invalid encap and flows with trap action)
      need to match on FT chain. After bridge offload was implemented packets of
      such flows can also be matched by bridge priority tables which is
      undesirable. Restore slow path flows implementation to redirect packets to
      slow_fdb.
      
      Fixes: 278d51f2 ("net/mlx5: E-Switch, Increase number of chains and priorities")
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarPaul Blakey <paulb@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      c0063a43
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Fix calculations related to max MPWQE size · 677e78c8
      Maxim Mikityanskiy authored
      Before commit 76c31e5f ("net/mlx5e: Use FW limitation for max MPW
      WQEBBs"), the maximum size of MPWQE in WQEBBs was hardcoded as a driver
      constant. That commit started using the firmware capability that can
      further limit the size, however, it unintentionally changed a few
      things:
      
      1. The calculation of MLX5E_MAX_KLM_PER_WQE used the size in DS, which
      was replaced by the size in WQEBBs, making the resulting value 4 times
      smaller.
      
      2. MLX5E_TX_MPW_MAX_WQEBBS used to be aligned to the cache line size
      (either 64 or 128 bytes, i.e. 1 or 2 WQEBBs), but it's no longer the
      case if the firmware capability is smaller than the driver maximum.
      
      Fix both issues by using the correct units for MLX5E_MAX_KLM_PER_WQE and
      by aligning mlx5e_get_sw_max_sq_mpw_wqebbs after taking the minimum.
      
      Besides fixing the arithmetics in calculation of MLX5E_MAX_KLM_PER_WQE,
      also use appropriate constants: `size of BSF * num of DS per WQEBB *
      number of WQEBBs` (the calculation before the blamed commit) doesn't
      make much sense to calculate the WQE size in bytes, so just use `size of
      WQEBB * number of WQEBBs`.
      
      While at it, replace the types that hold the number of WQEBBs by u8.
      These values don't exceed 16, and it allows to fill holes in two
      structs.
      
      Fixes: 76c31e5f ("net/mlx5e: Use FW limitation for max MPW WQEBBs")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      677e78c8
    • Maxim Mikityanskiy's avatar
      net/mlx5e: xsk: Account for XSK RQ UMRs when calculating ICOSQ size · 52586d2f
      Maxim Mikityanskiy authored
      ICOSQ is used to post UMR WQEs for both regular RQ and XSK RQ. However,
      space in ICOSQ is reserved only for the regular RQ, which may cause
      ICOSQ overflows when using XSK (the most risk is on activating
      channels).
      
      This commit fixes the issue by reserving space for XSK UMR WQEs as well.
      As XSK may be enabled without restarting the channel and recreating the
      ICOSQ, this space is reserved unconditionally.
      
      Fixes: db05815b ("net/mlx5e: Add XSK zero-copy support")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      52586d2f
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Fix the value of MLX5E_MAX_RQ_NUM_MTTS · 562696c3
      Maxim Mikityanskiy authored
      MLX5E_MAX_RQ_NUM_MTTS should be the maximum value, so that
      MLX5_MTT_OCTW(MLX5E_MAX_RQ_NUM_MTTS) fits into u16. The current value of
      1 << 17 results in MLX5_MTT_OCTW(1 << 17) = 1 << 16, which doesn't fit
      into u16. This commit replaces it with the maximum value that still
      fits u16.
      
      Fixes: 73281b78 ("net/mlx5e: Derive Striding RQ size from MTU")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      562696c3
    • Maor Dickman's avatar
      net/mlx5e: TC, Fix post_act to not match on in_port metadata · 903f2194
      Maor Dickman authored
      The cited commit changed CT to use multi table actions post act infrastructure instead
      of using it own post act infrastructure, this broke decap during VF tunnel offload
      (Stack devices) with CT due to wrong match on in_port metadata in the post act table.
      This changed only broke VF tunnel offload because it modify the packet in_port metadata
      to be VF metadata and it isn't propagate the post act creation.
      
      Fixed by modify post act rules to match only on fte_id and not match on in_port metadata
      which isn't needed.
      
      Fixes: a8128326 ("net/mlx5e: Use multi table support for CT and sample actions")
      Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
      Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      903f2194
    • Gal Pressman's avatar
      net/mlx5e: Remove WARN_ON when trying to offload an unsupported TLS cipher/version · 115d9f95
      Gal Pressman authored
      The driver reports whether TX/RX TLS device offloads are supported, but
      not which ciphers/versions, these should be handled by returning
      -EOPNOTSUPP when .tls_dev_add() is called.
      
      Remove the WARN_ON kernel trace when the driver gets a request to
      offload a cipher/version that is not supported as it is expected.
      
      Fixes: d2ead1f3 ("net/mlx5e: Add kTLS TX HW offload support")
      Signed-off-by: default avatarGal Pressman <gal@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      115d9f95
    • Dan Carpenter's avatar
      stmmac: dwmac-mediatek: fix resource leak in probe · 4d3d3a1b
      Dan Carpenter authored
      If mediatek_dwmac_clks_config() fails, then call stmmac_remove_config_dt()
      before returning.  Otherwise it is a resource leak.
      
      Fixes: fa4b3ca6 ("stmmac: dwmac-mediatek: fix clock issue")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/YuJ4aZyMUlG6yGGa@kiliSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4d3d3a1b
    • Ziyang Xuan's avatar
      ipv6/addrconf: fix a null-ptr-deref bug for ip6_ptr · 85f0173d
      Ziyang Xuan authored
      Change net device's MTU to smaller than IPV6_MIN_MTU or unregister
      device while matching route. That may trigger null-ptr-deref bug
      for ip6_ptr probability as following.
      
      =========================================================
      BUG: KASAN: null-ptr-deref in find_match.part.0+0x70/0x134
      Read of size 4 at addr 0000000000000308 by task ping6/263
      
      CPU: 2 PID: 263 Comm: ping6 Not tainted 5.19.0-rc7+ #14
      Call trace:
       dump_backtrace+0x1a8/0x230
       show_stack+0x20/0x70
       dump_stack_lvl+0x68/0x84
       print_report+0xc4/0x120
       kasan_report+0x84/0x120
       __asan_load4+0x94/0xd0
       find_match.part.0+0x70/0x134
       __find_rr_leaf+0x408/0x470
       fib6_table_lookup+0x264/0x540
       ip6_pol_route+0xf4/0x260
       ip6_pol_route_output+0x58/0x70
       fib6_rule_lookup+0x1a8/0x330
       ip6_route_output_flags_noref+0xd8/0x1a0
       ip6_route_output_flags+0x58/0x160
       ip6_dst_lookup_tail+0x5b4/0x85c
       ip6_dst_lookup_flow+0x98/0x120
       rawv6_sendmsg+0x49c/0xc70
       inet_sendmsg+0x68/0x94
      
      Reproducer as following:
      Firstly, prepare conditions:
      $ip netns add ns1
      $ip netns add ns2
      $ip link add veth1 type veth peer name veth2
      $ip link set veth1 netns ns1
      $ip link set veth2 netns ns2
      $ip netns exec ns1 ip -6 addr add 2001:0db8:0:f101::1/64 dev veth1
      $ip netns exec ns2 ip -6 addr add 2001:0db8:0:f101::2/64 dev veth2
      $ip netns exec ns1 ifconfig veth1 up
      $ip netns exec ns2 ifconfig veth2 up
      $ip netns exec ns1 ip -6 route add 2000::/64 dev veth1 metric 1
      $ip netns exec ns2 ip -6 route add 2001::/64 dev veth2 metric 1
      
      Secondly, execute the following two commands in two ssh windows
      respectively:
      $ip netns exec ns1 sh
      $while true; do ip -6 addr add 2001:0db8:0:f101::1/64 dev veth1; ip -6 route add 2000::/64 dev veth1 metric 1; ping6 2000::2; done
      
      $ip netns exec ns1 sh
      $while true; do ip link set veth1 mtu 1000; ip link set veth1 mtu 1500; sleep 5; done
      
      It is because ip6_ptr has been assigned to NULL in addrconf_ifdown() firstly,
      then ip6_ignore_linkdown() accesses ip6_ptr directly without NULL check.
      
      	cpu0			cpu1
      fib6_table_lookup
      __find_rr_leaf
      			addrconf_notify [ NETDEV_CHANGEMTU ]
      			addrconf_ifdown
      			RCU_INIT_POINTER(dev->ip6_ptr, NULL)
      find_match
      ip6_ignore_linkdown
      
      So we can add NULL check for ip6_ptr before using in ip6_ignore_linkdown() to
      fix the null-ptr-deref bug.
      
      Fixes: dcd1f572 ("net/ipv6: Remove fib6_idev")
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220728013307.656257-1-william.xuanziyang@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      85f0173d
    • Kuniyuki Iwashima's avatar
      net: ping6: Fix memleak in ipv6_renew_options(). · e2732600
      Kuniyuki Iwashima authored
      When we close ping6 sockets, some resources are left unfreed because
      pingv6_prot is missing sk->sk_prot->destroy().  As reported by
      syzbot [0], just three syscalls leak 96 bytes and easily cause OOM.
      
          struct ipv6_sr_hdr *hdr;
          char data[24] = {0};
          int fd;
      
          hdr = (struct ipv6_sr_hdr *)data;
          hdr->hdrlen = 2;
          hdr->type = IPV6_SRCRT_TYPE_4;
      
          fd = socket(AF_INET6, SOCK_DGRAM, NEXTHDR_ICMP);
          setsockopt(fd, IPPROTO_IPV6, IPV6_RTHDR, data, 24);
          close(fd);
      
      To fix memory leaks, let's add a destroy function.
      
      Note the socket() syscall checks if the GID is within the range of
      net.ipv4.ping_group_range.  The default value is [1, 0] so that no
      GID meets the condition (1 <= GID <= 0).  Thus, the local DoS does
      not succeed until we change the default value.  However, at least
      Ubuntu/Fedora/RHEL loosen it.
      
          $ cat /usr/lib/sysctl.d/50-default.conf
          ...
          -net.ipv4.ping_group_range = 0 2147483647
      
      Also, there could be another path reported with these options, and
      some of them require CAP_NET_RAW.
      
        setsockopt
            IPV6_ADDRFORM (inet6_sk(sk)->pktoptions)
            IPV6_RECVPATHMTU (inet6_sk(sk)->rxpmtu)
            IPV6_HOPOPTS (inet6_sk(sk)->opt)
            IPV6_RTHDRDSTOPTS (inet6_sk(sk)->opt)
            IPV6_RTHDR (inet6_sk(sk)->opt)
            IPV6_DSTOPTS (inet6_sk(sk)->opt)
            IPV6_2292PKTOPTIONS (inet6_sk(sk)->opt)
      
        getsockopt
            IPV6_FLOWLABEL_MGR (inet6_sk(sk)->ipv6_fl_list)
      
      For the record, I left a different splat with syzbot's one.
      
        unreferenced object 0xffff888006270c60 (size 96):
          comm "repro2", pid 231, jiffies 4294696626 (age 13.118s)
          hex dump (first 32 bytes):
            01 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00  ....D...........
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          backtrace:
            [<00000000f6bc7ea9>] sock_kmalloc (net/core/sock.c:2564 net/core/sock.c:2554)
            [<000000006d699550>] do_ipv6_setsockopt.constprop.0 (net/ipv6/ipv6_sockglue.c:715)
            [<00000000c3c3b1f5>] ipv6_setsockopt (net/ipv6/ipv6_sockglue.c:1024)
            [<000000007096a025>] __sys_setsockopt (net/socket.c:2254)
            [<000000003a8ff47b>] __x64_sys_setsockopt (net/socket.c:2265 net/socket.c:2262 net/socket.c:2262)
            [<000000007c409dcb>] do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
            [<00000000e939c4a9>] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
      
      [0]: https://syzkaller.appspot.com/bug?extid=a8430774139ec3ab7176
      
      Fixes: 6d0bfe22 ("net: ipv6: Add IPv6 support to the ping socket.")
      Reported-by: syzbot+a8430774139ec3ab7176@syzkaller.appspotmail.com
      Reported-by: default avatarAyushman Dutta <ayudutta@amazon.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20220728012220.46918-1-kuniyu@amazon.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e2732600
    • Dimitris Michailidis's avatar
      net/funeth: Fix fun_xdp_tx() and XDP packet reclaim · 51a83391
      Dimitris Michailidis authored
      The current implementation of fun_xdp_tx(), used for XPD_TX, is
      incorrect in that it takes an address/length pair and later releases it
      with page_frag_free(). It is OK for XDP_TX but the same code is used by
      ndo_xdp_xmit. In that case it loses the XDP memory type and releases the
      packet incorrectly for some of the types. Assorted breakage follows.
      
      Change fun_xdp_tx() to take xdp_frame and rely on xdp_return_frame() in
      reclaim.
      
      Fixes: db37bc17 ("net/funeth: add the data path")
      Signed-off-by: default avatarDimitris Michailidis <dmichail@fungible.com>
      Link: https://lore.kernel.org/r/20220726215923.7887-1-dmichail@fungible.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      51a83391
    • Jakub Kicinski's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · bf84719d
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2022-07-26
      
      This series contains updates to ice driver only.
      
      Przemyslaw corrects accounting for VF VLANs to allow for correct number
      of VLANs for untrusted VF. He also correct issue with checksum offload
      on VXLAN tunnels.
      
      Ani allows for two VSIs to share the same MAC address.
      
      Maciej corrects checked bits for descriptor completion of loopback
      
      * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
        ice: do not setup vlan for loopback VSI
        ice: check (DD | EOF) bits on Rx descriptor rather than (EOP | RS)
        ice: Fix VSIs unable to share unicast MAC
        ice: Fix tunnel checksum offload with fragmented traffic
        ice: Fix max VLANs available for VF
      ====================
      
      Link: https://lore.kernel.org/r/20220726204646.2171589-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bf84719d
    • Xin Long's avatar
      sctp: leave the err path free in sctp_stream_init to sctp_stream_free · 181d8d20
      Xin Long authored
      A NULL pointer dereference was reported by Wei Chen:
      
        BUG: kernel NULL pointer dereference, address: 0000000000000000
        RIP: 0010:__list_del_entry_valid+0x26/0x80
        Call Trace:
         <TASK>
         sctp_sched_dequeue_common+0x1c/0x90
         sctp_sched_prio_dequeue+0x67/0x80
         __sctp_outq_teardown+0x299/0x380
         sctp_outq_free+0x15/0x20
         sctp_association_free+0xc3/0x440
         sctp_do_sm+0x1ca7/0x2210
         sctp_assoc_bh_rcv+0x1f6/0x340
      
      This happens when calling sctp_sendmsg without connecting to server first.
      In this case, a data chunk already queues up in send queue of client side
      when processing the INIT_ACK from server in sctp_process_init() where it
      calls sctp_stream_init() to alloc stream_in. If it fails to alloc stream_in
      all stream_out will be freed in sctp_stream_init's err path. Then in the
      asoc freeing it will crash when dequeuing this data chunk as stream_out
      is missing.
      
      As we can't free stream out before dequeuing all data from send queue, and
      this patch is to fix it by moving the err path stream_out/in freeing in
      sctp_stream_init() to sctp_stream_free() which is eventually called when
      freeing the asoc in sctp_association_free(). This fix also makes the code
      in sctp_process_init() more clear.
      
      Note that in sctp_association_init() when it fails in sctp_stream_init(),
      sctp_association_free() will not be called, and in that case it should
      go to 'stream_free' err path to free stream instead of 'fail_init'.
      
      Fixes: 5bbbbe32 ("sctp: introduce stream scheduler foundations")
      Reported-by: default avatarWei Chen <harperchen1110@gmail.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://lore.kernel.org/r/831a3dc100c4908ff76e5bcc363be97f2778bc0b.1658787066.git.lucien.xin@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      181d8d20
    • Alejandro Lucero's avatar
      sfc: disable softirqs for ptp TX · 67c3b611
      Alejandro Lucero authored
      Sending a PTP packet can imply to use the normal TX driver datapath but
      invoked from the driver's ptp worker. The kernel generic TX code
      disables softirqs and preemption before calling specific driver TX code,
      but the ptp worker does not. Although current ptp driver functionality
      does not require it, there are several reasons for doing so:
      
         1) The invoked code is always executed with softirqs disabled for non
            PTP packets.
         2) Better if a ptp packet transmission is not interrupted by softirq
            handling which could lead to high latencies.
         3) netdev_xmit_more used by the TX code requires preemption to be
            disabled.
      
      Indeed a solution for dealing with kernel preemption state based on static
      kernel configuration is not possible since the introduction of dynamic
      preemption level configuration at boot time using the static calls
      functionality.
      
      Fixes: f79c957a ("drivers: net: sfc: use netdev_xmit_more helper")
      Signed-off-by: default avatarAlejandro Lucero <alejandro.lucero-palau@amd.com>
      Link: https://lore.kernel.org/r/20220726064504.49613-1-alejandro.lucero-palau@amd.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      67c3b611
    • Jonathan Lemon's avatar
      ptp: ocp: Select CRC16 in the Kconfig. · 0c104556
      Jonathan Lemon authored
      The crc16() function is used to check the firmware validity, but
      the library was not explicitly selected.
      
      Fixes: 3c3673bd ("ptp: ocp: Add firmware header checks")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Acked-by: default avatarVadim Fedorenko <vadfed@fb.com>
      Link: https://lore.kernel.org/r/20220726220604.1339972-1-jonathan.lemon@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0c104556
  2. 27 Jul, 2022 5 commits
  3. 26 Jul, 2022 19 commits
  4. 25 Jul, 2022 2 commits