1. 21 Sep, 2020 6 commits
  2. 20 Sep, 2020 3 commits
  3. 19 Sep, 2020 2 commits
  4. 18 Sep, 2020 15 commits
  5. 17 Sep, 2020 11 commits
    • David S. Miller's avatar
      Merge branch 'net-phy-Unbind-fixes' · 0dfdbc74
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: phy: Unbind fixes
      
      This patch series fixes a couple of issues with the unbinding of the PHY
      drivers and then bringing down a network interface. The first is a NULL
      pointer de-reference and the second was an incorrect warning being
      triggered.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0dfdbc74
    • Florian Fainelli's avatar
      net: phy: Do not warn in phy_stop() on PHY_DOWN · 5116a8ad
      Florian Fainelli authored
      When phy_is_started() was added to catch incorrect PHY states,
      phy_stop() would not be qualified against PHY_DOWN. It is possible to
      reach that state when the PHY driver has been unbound and the network
      device is then brought down.
      
      Fixes: 2b3e88ea ("net: phy: improve phy state checking")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5116a8ad
    • Florian Fainelli's avatar
      net: phy: Avoid NPD upon phy_detach() when driver is unbound · c2b727df
      Florian Fainelli authored
      If we have unbound the PHY driver prior to calling phy_detach() (often
      via phy_disconnect()) then we can cause a NULL pointer de-reference
      accessing the driver owner member. The steps to reproduce are:
      
      echo unimac-mdio-0:01 > /sys/class/net/eth0/phydev/driver/unbind
      ip link set eth0 down
      
      Fixes: cafe8df8 ("net: phy: Fix lack of reference count on PHY driver")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c2b727df
    • Michal Kubecek's avatar
      ethtool: add and use message type for tunnel info reply · 19a83d36
      Michal Kubecek authored
      Tunnel offload info code uses ETHTOOL_MSG_TUNNEL_INFO_GET message type (cmd
      field in genetlink header) for replies to tunnel info netlink request, i.e.
      the same value as the request have. This is a problem because we are using
      two separate enums for userspace to kernel and kernel to userspace message
      types so that this ETHTOOL_MSG_TUNNEL_INFO_GET (28) collides with
      ETHTOOL_MSG_CABLE_TEST_TDR_NTF which is what message type 28 means for
      kernel to userspace messages.
      
      As the tunnel info request reached mainline in 5.9 merge window, we should
      still be able to fix the reply message type without breaking backward
      compatibility.
      
      Fixes: c7d759eb ("ethtool: add tunnel info interface")
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19a83d36
    • Xie He's avatar
      drivers/net/wan/hdlc: Set skb->protocol before transmitting · 9fb030a7
      Xie He authored
      This patch sets skb->protocol before transmitting frames on the HDLC
      device, so that a user listening on the HDLC device with an AF_PACKET
      socket will see outgoing frames' sll_protocol field correctly set and
      consistent with that of incoming frames.
      
      1. Control frames in hdlc_cisco and hdlc_ppp
      
      When these drivers send control frames, skb->protocol is not set.
      
      This value should be set to htons(ETH_P_HDLC), because when receiving
      control frames, their skb->protocol is set to htons(ETH_P_HDLC).
      
      When receiving, hdlc_type_trans in hdlc.h is called, which then calls
      cisco_type_trans or ppp_type_trans. The skb->protocol of control frames
      is set to htons(ETH_P_HDLC) so that the control frames can be received
      by hdlc_rcv in hdlc.c, which calls cisco_rx or ppp_rx to process the
      control frames.
      
      2. hdlc_fr
      
      When this driver sends control frames, skb->protocol is set to internal
      values used in this driver.
      
      When this driver sends data frames (from upper stacked PVC devices),
      skb->protocol is the same as that of the user data packet being sent on
      the upper PVC device (for normal PVC devices), or is htons(ETH_P_802_3)
      (for Ethernet-emulating PVC devices).
      
      However, skb->protocol for both control frames and data frames should be
      set to htons(ETH_P_HDLC), because when receiving, all frames received on
      the HDLC device will have their skb->protocol set to htons(ETH_P_HDLC).
      
      When receiving, hdlc_type_trans in hdlc.h is called, and because this
      driver doesn't provide a type_trans function in struct hdlc_proto,
      all frames will have their skb->protocol set to htons(ETH_P_HDLC).
      The frames are then received by hdlc_rcv in hdlc.c, which calls fr_rx
      to process the frames (control frames are consumed and data frames
      are re-received on upper PVC devices).
      
      Cc: Krzysztof Halasa <khc@pm.waw.pl>
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9fb030a7
    • Xie He's avatar
      drivers/net/wan/lapbether: Make skb->protocol consistent with the header · 83f9a9c8
      Xie He authored
      This driver is a virtual driver stacked on top of Ethernet interfaces.
      
      When this driver transmits data on the Ethernet device, the skb->protocol
      setting is inconsistent with the Ethernet header prepended to the skb.
      
      This causes a user listening on the Ethernet interface with an AF_PACKET
      socket, to see different sll_protocol values for incoming and outgoing
      frames, because incoming frames would have this value set by parsing the
      Ethernet header.
      
      This patch changes the skb->protocol value for outgoing Ethernet frames,
      making it consistent with the Ethernet header prepended. This makes a
      user listening on the Ethernet device with an AF_PACKET socket, to see
      the same sll_protocol value for incoming and outgoing frames.
      
      Cc: Martin Schiller <ms@dev.tdt.de>
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      83f9a9c8
    • Raju Rangoju's avatar
      cxgb4: fix memory leak during module unload · f4a26a9b
      Raju Rangoju authored
      Fix the memory leak in mps during module unload
      path by freeing mps reference entries if the list
      adpter->mps_ref is not already empty
      
      Fixes: 28b38705 ("cxgb4: Re-work the logic for mps refcounting")
      Signed-off-by: default avatarRaju Rangoju <rajur@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f4a26a9b
    • Andres Beltran's avatar
      hv_netvsc: Add validation for untrusted Hyper-V values · 44144185
      Andres Beltran authored
      For additional robustness in the face of Hyper-V errors or malicious
      behavior, validate all values that originate from packets that Hyper-V
      has sent to the guest in the host-to-guest ring buffer. Ensure that
      invalid values cannot cause indexing off the end of an array, or
      subvert an existing validation via integer overflow. Ensure that
      outgoing packets do not have any leftover guest memory that has not
      been zeroed out.
      Signed-off-by: default avatarAndres Beltran <lkmlabelt@gmail.com>
      Co-developed-by: default avatarAndrea Parri (Microsoft) <parri.andrea@gmail.com>
      Signed-off-by: default avatarAndrea Parri (Microsoft) <parri.andrea@gmail.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: netdev@vger.kernel.org
      Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44144185
    • Matthias Schiffer's avatar
      net: dsa: microchip: ksz8795: really set the correct number of ports · fd944dc2
      Matthias Schiffer authored
      The KSZ9477 and KSZ8795 use the port_cnt field differently: For the
      KSZ9477, it includes the CPU port(s), while for the KSZ8795, it doesn't.
      
      It would be a good cleanup to make the handling of both drivers match,
      but as a first step, fix the recently broken assignment of num_ports in
      the KSZ8795 driver (which completely broke probing, as the CPU port
      index was always failing the num_ports check).
      
      Fixes: af199a1a ("net: dsa: microchip: set the correct number of ports")
      Signed-off-by: default avatarMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
      Reviewed-by: default avatarCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd944dc2
    • Mark Gray's avatar
      geneve: add transport ports in route lookup for geneve · 34beb215
      Mark Gray authored
      This patch adds transport ports information for route lookup so that
      IPsec can select Geneve tunnel traffic to do encryption. This is
      needed for OVS/OVN IPsec with encrypted Geneve tunnels.
      
      This can be tested by configuring a host-host VPN using an IKE
      daemon and specifying port numbers. For example, for an
      Openswan-type configuration, the following parameters should be
      configured on both hosts and IPsec set up as-per normal:
      
      $ cat /etc/ipsec.conf
      
      conn in
      ...
      left=$IP1
      right=$IP2
      ...
      leftprotoport=udp/6081
      rightprotoport=udp
      ...
      conn out
      ...
      left=$IP1
      right=$IP2
      ...
      leftprotoport=udp
      rightprotoport=udp/6081
      ...
      
      The tunnel can then be setup using "ip" on both hosts (but
      changing the relevant IP addresses):
      
      $ ip link add tun type geneve id 1000 remote $IP2
      $ ip addr add 192.168.0.1/24 dev tun
      $ ip link set tun up
      
      This can then be tested by pinging from $IP1:
      
      $ ping 192.168.0.2
      
      Without this patch the traffic is unencrypted on the wire.
      
      Fixes: 2d07dc79 ("geneve: add initial netdev driver for GENEVE tunnels")
      Signed-off-by: default avatarQiuyu Xiao <qiuyu.xiao.qyx@gmail.com>
      Signed-off-by: default avatarMark Gray <mark.d.gray@redhat.com>
      Reviewed-by: default avatarGreg Rose <gvrose8192@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34beb215
    • Lu Wei's avatar
      net: hns: kerneldoc fixes · 5f1ab0f4
      Lu Wei authored
      Fix some parameter description or spelling mistakes.
      Signed-off-by: default avatarLu Wei <luwei32@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5f1ab0f4
  6. 16 Sep, 2020 3 commits
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · d5d325ea
      David S. Miller authored
      Alexei Starovoitov says:
      
      ====================
      pull-request: bpf 2020-09-15
      
      The following pull-request contains BPF updates for your *net* tree.
      
      We've added 12 non-merge commits during the last 19 day(s) which contain
      a total of 10 files changed, 47 insertions(+), 38 deletions(-).
      
      The main changes are:
      
      1) docs/bpf fixes, from Andrii.
      
      2) ld_abs fix, from Daniel.
      
      3) socket casting helpers fix, from Martin.
      
      4) hash iterator fixes, from Yonghong.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5d325ea
    • Yonghong Song's avatar
      bpf: Fix a rcu warning for bpffs map pretty-print · ce880cb8
      Yonghong Song authored
      Running selftest
        ./btf_btf -p
      the kernel had the following warning:
        [   51.528185] WARNING: CPU: 3 PID: 1756 at kernel/bpf/hashtab.c:717 htab_map_get_next_key+0x2eb/0x300
        [   51.529217] Modules linked in:
        [   51.529583] CPU: 3 PID: 1756 Comm: test_btf Not tainted 5.9.0-rc1+ #878
        [   51.530346] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.el7.centos 04/01/2014
        [   51.531410] RIP: 0010:htab_map_get_next_key+0x2eb/0x300
        ...
        [   51.542826] Call Trace:
        [   51.543119]  map_seq_next+0x53/0x80
        [   51.543528]  seq_read+0x263/0x400
        [   51.543932]  vfs_read+0xad/0x1c0
        [   51.544311]  ksys_read+0x5f/0xe0
        [   51.544689]  do_syscall_64+0x33/0x40
        [   51.545116]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      The related source code in kernel/bpf/hashtab.c:
        709 static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
        710 {
        711         struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
        712         struct hlist_nulls_head *head;
        713         struct htab_elem *l, *next_l;
        714         u32 hash, key_size;
        715         int i = 0;
        716
        717         WARN_ON_ONCE(!rcu_read_lock_held());
      
      In kernel/bpf/inode.c, bpffs map pretty print calls map->ops->map_get_next_key()
      without holding a rcu_read_lock(), hence causing the above warning.
      To fix the issue, just surrounding map->ops->map_get_next_key() with rcu read lock.
      
      Fixes: a26ca7c9 ("bpf: btf: Add pretty print support to the basic arraymap")
      Reported-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/20200916004401.146277-1-yhs@fb.com
      ce880cb8
    • Martin KaFai Lau's avatar
      bpf: Bpf_skc_to_* casting helpers require a NULL check on sk · 8c33dadc
      Martin KaFai Lau authored
      The bpf_skc_to_* type casting helpers are available to
      BPF_PROG_TYPE_TRACING.  The traced PTR_TO_BTF_ID may be NULL.
      For example, the skb->sk may be NULL.  Thus, these casting helpers
      need to check "!sk" also and this patch fixes them.
      
      Fixes: 0d4fad3e ("bpf: Add bpf_skc_to_udp6_sock() helper")
      Fixes: 478cfbdf ("bpf: Add bpf_skc_to_{tcp, tcp_timewait, tcp_request}_sock() helpers")
      Fixes: af7ec138 ("bpf: Add bpf_skc_to_tcp6_sock() helper")
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Acked-by: default avatarSong Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/bpf/20200915182959.241101-1-kafai@fb.com
      8c33dadc