1. 23 Mar, 2023 26 commits
  2. 22 Mar, 2023 12 commits
  3. 21 Mar, 2023 2 commits
    • Nathan Chancellor's avatar
      net: pasemi: Fix return type of pasemi_mac_start_tx() · c8384d4a
      Nathan Chancellor authored
      With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
      indirect call targets are validated against the expected function
      pointer prototype to make sure the call target is valid to help mitigate
      ROP attacks. If they are not identical, there is a failure at run time,
      which manifests as either a kernel panic or thread getting killed. A
      warning in clang aims to catch these at compile time, which reveals:
      
        drivers/net/ethernet/pasemi/pasemi_mac.c:1665:21: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
                .ndo_start_xmit         = pasemi_mac_start_tx,
                                          ^~~~~~~~~~~~~~~~~~~
        1 error generated.
      
      ->ndo_start_xmit() in 'struct net_device_ops' expects a return type of
      'netdev_tx_t', not 'int'. Adjust the return type of
      pasemi_mac_start_tx() to match the prototype's to resolve the warning.
      While PowerPC does not currently implement support for kCFI, it could in
      the future, which means this warning becomes a fatal CFI failure at run
      time.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/1750Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20230319-pasemi-incompatible-pointer-types-strict-v1-1-1b9459d8aef0@kernel.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c8384d4a
    • Josef Miegl's avatar
      net: geneve: accept every ethertype · 251d5a28
      Josef Miegl authored
      The Geneve encapsulation, as defined in RFC 8926, has a Protocol Type
      field, which states the Ethertype of the payload appearing after the
      Geneve header.
      
      Commit 435fe1c0 ("net: geneve: support IPv4/IPv6 as inner protocol")
      introduced a new IFLA_GENEVE_INNER_PROTO_INHERIT flag that allowed the
      use of other Ethertypes than Ethernet. However, it did not get rid of a
      restriction that prohibits receiving payloads other than Ethernet,
      instead the commit white-listed additional Ethertypes, IPv4 and IPv6.
      
      This patch removes this restriction, making it possible to receive any
      Ethertype as a payload, if the IFLA_GENEVE_INNER_PROTO_INHERIT flag is
      set.
      
      The restriction was set in place back in commit 0b5e8b8e
      ("net: Add Geneve tunneling protocol driver"), which implemented a
      protocol layer driver for Geneve to be used with Open vSwitch. The
      relevant discussion about introducing the Ethertype white-list can be
      found here:
      https://lore.kernel.org/netdev/CAEP_g=_1q3ACX5NTHxLDnysL+dTMUVzdLpgw1apLKEdDSWPztw@mail.gmail.com/
      
      <quote>
      >> +       if (unlikely(geneveh->proto_type != htons(ETH_P_TEB)))
      >
      > Why? I thought the point of geneve carrying protocol field was to
      > allow protocols other than Ethernet... is this temporary maybe?
      
      Yes, it is temporary. Currently OVS only handles Ethernet packets but
      this restriction can be lifted once we have a consumer that is capable
      of handling other protocols.
      </quote>
      
      This white-list was then ported to a generic Geneve netdevice in commit
      371bd106 ("geneve: Consolidate Geneve functionality in single
      module."). Preserving the Ethertype white-list at this point made sense,
      as the Geneve device could send out only Ethernet payloads anyways.
      
      However, now that the Geneve netdevice supports encapsulating other
      payloads with IFLA_GENEVE_INNER_PROTO_INHERIT and we have a consumer
      capable of other protocols, it seems appropriate to lift the restriction
      and allow any Geneve payload to be received.
      Signed-off-by: default avatarJosef Miegl <josef@miegl.cz>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarEyal Birger <eyal.birger@gmail.com>
      Link: https://lore.kernel.org/r/20230319220954.21834-1-josef@miegl.czSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      251d5a28