1. 22 Oct, 2020 11 commits
    • Ke Li's avatar
      net: Properly typecast int values to set sk_max_pacing_rate · 700465fd
      Ke Li authored
      In setsockopt(SO_MAX_PACING_RATE) on 64bit systems, sk_max_pacing_rate,
      after extended from 'u32' to 'unsigned long', takes unintentionally
      hiked value whenever assigned from an 'int' value with MSB=1, due to
      binary sign extension in promoting s32 to u64, e.g. 0x80000000 becomes
      0xFFFFFFFF80000000.
      
      Thus inflated sk_max_pacing_rate causes subsequent getsockopt to return
      ~0U unexpectedly. It may also result in increased pacing rate.
      
      Fix by explicitly casting the 'int' value to 'unsigned int' before
      assigning it to sk_max_pacing_rate, for zero extension to happen.
      
      Fixes: 76a9ebe8 ("net: extend sk_pacing_rate to unsigned long")
      Signed-off-by: default avatarJi Li <jli@akamai.com>
      Signed-off-by: default avatarKe Li <keli@akamai.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20201022064146.79873-1-keli@akamai.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      700465fd
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · 594850ca
      Jakub Kicinski authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      1) Update debugging in IPVS tcp protocol handler to make it easier
         to understand, from longguang.yue
      
      2) Update TCP tracker to deal with keepalive packet after
         re-registration, from Franceso Ruggeri.
      
      3) Missing IP6SKB_FRAGMENTED from netfilter fragment reassembly,
         from Georg Kohmann.
      
      4) Fix bogus packet drop in ebtables nat extensions, from
         Thimothee Cocault.
      
      5) Fix typo in flowtable documentation.
      
      6) Reset skb timestamp in nft_fwd_netdev.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      594850ca
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · d2775984
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2020-10-22
      
      1) Fix enforcing NULL check in verifier for new helper return types of
         RET_PTR_TO_{BTF_ID,MEM_OR_BTF_ID}_OR_NULL, from Martin KaFai Lau.
      
      2) Fix bpf_redirect_neigh() helper API before it becomes frozen by adding
         nexthop information as argument, from Toke Høiland-Jørgensen.
      
      3) Guard & fix compilation of bpf_tail_call_static() when __bpf__ arch is
         not defined by compiler or clang too old, from Daniel Borkmann.
      
      4) Remove misplaced break after return in attach_type_to_prog_type(), from
         Tom Rix.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d2775984
    • Pablo Neira Ayuso's avatar
      netfilter: nf_fwd_netdev: clear timestamp in forwarding path · c77761c8
      Pablo Neira Ayuso authored
      Similar to 7980d2ea ("ipvs: clear skb->tstamp in forwarding path").
      fq qdisc requires tstamp to be cleared in forwarding path.
      
      Fixes: 8203e2d8 ("net: clear skb->tstamp in forwarding paths")
      Fixes: fb420d5d ("tcp/fq: move back to CLOCK_MONOTONIC")
      Fixes: 80b14dee ("net: Add a new socket option for a future transmit time.")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      c77761c8
    • Lijun Pan's avatar
      ibmvnic: save changed mac address to adapter->mac_addr · d9b0e599
      Lijun Pan authored
      After mac address change request completes successfully, the new mac
      address need to be saved to adapter->mac_addr as well as
      netdev->dev_addr. Otherwise, adapter->mac_addr still holds old
      data.
      
      Fixes: 62740e97 ("net/ibmvnic: Update MAC address settings after adapter reset")
      Signed-off-by: default avatarLijun Pan <ljp@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201020223919.46106-1-ljp@linux.ibm.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d9b0e599
    • Matthieu Baerts's avatar
      selftests: mptcp: depends on built-in IPv6 · 287d3540
      Matthieu Baerts authored
      Recently, CONFIG_MPTCP_IPV6 no longer selects CONFIG_IPV6. As a
      consequence, if CONFIG_MPTCP_IPV6=y is added to the kconfig, it will no
      longer ensure CONFIG_IPV6=y. If it is not enabled, CONFIG_MPTCP_IPV6
      will stay disabled and selftests will fail.
      
      We also need CONFIG_IPV6 to be built-in. For more details, please see
      commit 0ed37ac5 ("mptcp: depends on IPV6 but not as a module").
      
      Note that 'make kselftest-merge' will take all 'config' files found in
      'tools/testsing/selftests'. Because some of them already set
      CONFIG_IPV6=y, MPTCP selftests were still passing. But they will fail if
      MPTCP selftests are launched manually after having executed this command
      to prepare the kernel config:
      
        ./scripts/kconfig/merge_config.sh -m .config \
            ./tools/testing/selftests/net/mptcp/config
      
      Fixes: 010b430d ("mptcp: MPTCP_IPV6 should depend on IPV6 instead of selecting it")
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Link: https://lore.kernel.org/r/20201021155549.933731-1-matthieu.baerts@tessares.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      287d3540
    • Michael S. Tsirkin's avatar
      Revert "virtio-net: ethtool configurable RXCSUM" · cf8691cb
      Michael S. Tsirkin authored
      This reverts commit 3618ad2a.
      
      When control vq is not negotiated, that commit causes a crash:
      
      [   72.229171] kernel BUG at drivers/net/virtio_net.c:1667!
      [   72.230266] invalid opcode: 0000 [#1] PREEMPT SMP
      [   72.231172] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc8-02934-g3618ad2a #1
      [   72.231172] EIP: virtnet_send_command+0x120/0x140
      [   72.231172] Code: 00 0f 94 c0 8b 7d f0 65 33 3d 14 00 00 00 75 1c 8d 65 f4 5b 5e 5f 5d c3 66 90 be 01 00 00 00 e9 6e ff ff ff 8d b6 00
      +00 00 00 <0f> 0b e8 d9 bb 82 00 eb 17 8d b4 26 00 00 00 00 8d b4 26 00 00 00
      [   72.231172] EAX: 0000000d EBX: f72895c0 ECX: 00000017 EDX: 00000011
      [   72.231172] ESI: f7197800 EDI: ed69bd00 EBP: ed69bcf4 ESP: ed69bc98
      [   72.231172] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010246
      [   72.231172] CR0: 80050033 CR2: 00000000 CR3: 02c84000 CR4: 000406f0
      [   72.231172] Call Trace:
      [   72.231172]  ? __virt_addr_valid+0x45/0x60
      [   72.231172]  ? ___cache_free+0x51f/0x760
      [   72.231172]  ? kobject_uevent_env+0xf4/0x560
      [   72.231172]  virtnet_set_guest_offloads+0x4d/0x80
      [   72.231172]  virtnet_set_features+0x85/0x120
      [   72.231172]  ? virtnet_set_guest_offloads+0x80/0x80
      [   72.231172]  __netdev_update_features+0x27a/0x8e0
      [   72.231172]  ? kobject_uevent+0xa/0x20
      [   72.231172]  ? netdev_register_kobject+0x12c/0x160
      [   72.231172]  register_netdevice+0x4fe/0x740
      [   72.231172]  register_netdev+0x1c/0x40
      [   72.231172]  virtnet_probe+0x728/0xb60
      [   72.231172]  ? _raw_spin_unlock+0x1d/0x40
      [   72.231172]  ? virtio_vdpa_get_status+0x1c/0x20
      [   72.231172]  virtio_dev_probe+0x1c6/0x271
      [   72.231172]  really_probe+0x195/0x2e0
      [   72.231172]  driver_probe_device+0x26/0x60
      [   72.231172]  device_driver_attach+0x49/0x60
      [   72.231172]  __driver_attach+0x46/0xc0
      [   72.231172]  ? device_driver_attach+0x60/0x60
      [   72.231172]  bus_add_driver+0x197/0x1c0
      [   72.231172]  driver_register+0x66/0xc0
      [   72.231172]  register_virtio_driver+0x1b/0x40
      [   72.231172]  virtio_net_driver_init+0x61/0x86
      [   72.231172]  ? veth_init+0x14/0x14
      [   72.231172]  do_one_initcall+0x76/0x2e4
      [   72.231172]  ? rdinit_setup+0x2a/0x2a
      [   72.231172]  do_initcalls+0xb2/0xd5
      [   72.231172]  kernel_init_freeable+0x14f/0x179
      [   72.231172]  ? rest_init+0x100/0x100
      [   72.231172]  kernel_init+0xd/0xe0
      [   72.231172]  ret_from_fork+0x1c/0x30
      [   72.231172] Modules linked in:
      [   72.269563] ---[ end trace a6ebc4afea0e6cb1 ]---
      
      The reason is that virtnet_set_features now calls virtnet_set_guest_offloads
      unconditionally, it used to only call it when there is something
      to configure.
      
      If device does not have a control vq, everything breaks.
      
      Revert the original commit for now.
      
      Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>
      Fixes: 3618ad2a ("virtio-net: ethtool configurable RXCSUM")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Link: https://lore.kernel.org/r/20201021142944.13615-1-mst@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cf8691cb
    • Di Zhu's avatar
      rtnetlink: fix data overflow in rtnl_calcit() · ebfe3c51
      Di Zhu authored
      "ip addr show" command execute error when we have a physical
      network card with a large number of VFs
      
      The return value of if_nlmsg_size() in rtnl_calcit() will exceed
      range of u16 data type when any network cards has a larger number of
      VFs. rtnl_vfinfo_size() will significant increase needed dump size when
      the value of num_vfs is larger.
      
      Eventually we get a wrong value of min_ifinfo_dump_size because of overflow
      which decides the memory size needed by netlink dump and netlink_dump()
      will return -EMSGSIZE because of not enough memory was allocated.
      
      So fix it by promoting  min_dump_alloc data type to u32 to
      avoid whole netlink message size overflow and it's also align
      with the data type of struct netlink_callback{}.min_dump_alloc
      which is assigned by return value of rtnl_calcit()
      Signed-off-by: default avatarDi Zhu <zhudi21@huawei.com>
      Link: https://lore.kernel.org/r/20201021020053.1401-1-zhudi21@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ebfe3c51
    • Bartosz Golaszewski's avatar
      net: ethernet: mtk-star-emac: select REGMAP_MMIO · 5403caf2
      Bartosz Golaszewski authored
      The driver depends on mmio regmap API but doesn't select the appropriate
      Kconfig option. This fixes it.
      
      Fixes: 8c7bd5a4 ("net: ethernet: mtk-star-emac: new driver")
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Link: https://lore.kernel.org/r/20201020073515.22769-1-brgl@bgdev.plSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5403caf2
    • Xie He's avatar
      net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup · 5fce1e43
      Xie He authored
      This driver calls ether_setup to set up the network device.
      The ether_setup function would add the IFF_TX_SKB_SHARING flag to the
      device. This flag indicates that it is safe to transmit shared skbs to
      the device.
      
      However, this is not true. This driver may pad the frame (in eth_tx)
      before transmission, so the skb may be modified.
      
      Fixes: 550fd08c ("net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared")
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Krzysztof Halasa <khc@pm.waw.pl>
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Link: https://lore.kernel.org/r/20201020063420.187497-1-xie.he.0141@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5fce1e43
    • Xie He's avatar
      net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device · 01c4ceae
      Xie He authored
      The hdlc_rcv function is used as hdlc_packet_type.func to process any
      skb received in the kernel with skb->protocol == htons(ETH_P_HDLC).
      The purpose of this function is to provide second-stage processing for
      skbs not assigned a "real" L3 skb->protocol value in the first stage.
      
      This function assumes the device from which the skb is received is an
      HDLC device (a device created by this module). It assumes that
      netdev_priv(dev) returns a pointer to "struct hdlc_device".
      
      However, it is possible that some driver in the kernel (not necessarily
      in our control) submits a received skb with skb->protocol ==
      htons(ETH_P_HDLC), from a non-HDLC device. In this case, the skb would
      still be received by hdlc_rcv. This will cause problems.
      
      hdlc_rcv should be able to recognize and drop invalid skbs. It should
      first make sure "dev" is actually an HDLC device, before starting its
      processing. This patch adds this check to hdlc_rcv.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: Krzysztof Halasa <khc@pm.waw.pl>
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Link: https://lore.kernel.org/r/20201020013152.89259-1-xie.he.0141@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      01c4ceae
  2. 21 Oct, 2020 19 commits
  3. 20 Oct, 2020 10 commits