Skip to content
  1. Apr 02, 2024
  2. Mar 30, 2024
  3. Mar 29, 2024
    • David Thompson's avatar
      mlxbf_gige: stop interface during shutdown · 09ba28e1
      David Thompson authored
      The mlxbf_gige driver intermittantly encounters a NULL pointer
      exception while the system is shutting down via "reboot" command.
      The mlxbf_driver will experience an exception right after executing
      its shutdown() method.  One example of this exception is:
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070
      Mem abort info:
        ESR = 0x0000000096000004
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        FSC = 0x04: level 0 translation fault
      Data abort info:
        ISV = 0, ISS = 0x00000004
        CM = 0, WnR = 0
      user pgtable: 4k pages, 48-bit VAs, pgdp=000000011d373000
      [0000000000000070] pgd=0000000000000000, p4d=0000000000000000
      Internal error: Oops: 96000004 [#1] SMP
      CPU: 0 PID: 13 Comm: ksoftirqd/0 Tainted: G S         OE     5.15.0-bf.6.gef6992a #1
      Hardware name: https://www.mellanox.com BlueField SoC/BlueField SoC, BIOS 4.0.2.12669 Apr 21 2023
      pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige]
      lr : mlxbf_gige_poll+0x54/0x160 [mlxbf_gige]
      sp : ffff8000080d3c10
      x29: ffff8000080d3c10 x28: ffffcce72cbb7000 x27: ffff8000080d3d58
      x26: ffff0000814e7340 x25: ffff331cd1a05000 x24: ffffcce72c4ea008
      x23: ffff0000814e4b40 x22: ffff0000814e4d10 x21: ffff0000814e4128
      x20: 0000000000000000 x19: ffff0000814e4a80 x18: ffffffffffffffff
      x17: 000000000000001c x16: ffffcce72b4553f4 x15: ffff80008805b8a7
      x14: 0000000000000000 x13: 0000000000000030 x12: 0101010101010101
      x11: 7f7f7f7f7f7f7f7f x10: c2ac898b17576267 x9 : ffffcce720fa5404
      x8 : ffff000080812138 x7 : 0000000000002e9a x6 : 0000000000000080
      x5 : ffff00008de3b000 x4 : 0000000000000000 x3 : 0000000000000001
      x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
      Call trace:
       mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige]
       mlxbf_gige_poll+0x54/0x160 [mlxbf_gige]
       __napi_poll+0x40/0x1c8
       net_rx_action+0x314/0x3a0
       __do_softirq+0x128/0x334
       run_ksoftirqd+0x54/0x6c
       smpboot_thread_fn+0x14c/0x190
       kthread+0x10c/0x110
       ret_from_fork+0x10/0x20
      Code: 8b070000 f9000ea0 f95056c0 f86178a1 (b9407002)
      ---[ end trace 7cc3941aa0d8e6a4 ]---
      Kernel panic - not syncing: Oops: Fatal exception in interrupt
      Kernel Offset: 0x4ce722520000 from 0xffff800008000000
      PHYS_OFFSET: 0x80000000
      CPU features: 0x000005c1,a3330e5a
      Memory Limit: none
      ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---
      
      During system shutdown, the mlxbf_gige driver's shutdown() is always executed.
      However, the driver's stop() method will only execute if networking interface
      configuration logic within the Linux distribution has been setup to do so.
      
      If shutdown() executes but stop() does not execute, NAPI remains enabled
      and this can lead to an exception if NAPI is scheduled while the hardware
      interface has only been partially deinitialized.
      
      The networking interface managed by the mlxbf_gige driver must be properly
      stopped during system shutdown so that IFF_UP is cleared, the hardware
      interface is put into a clean state, and NAPI is fully deinitialized.
      
      Fixes: f92e1869
      
       ("Add Mellanox BlueField Gigabit Ethernet driver")
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Link: https://lore.kernel.org/r/20240325210929.25362-1-davthompson@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      09ba28e1
    • Bastien Nocera's avatar
      Bluetooth: Fix TOCTOU in HCI debugfs implementation · 7835fcfd
      Bastien Nocera authored
      struct hci_dev members conn_info_max_age, conn_info_min_age,
      le_conn_max_interval, le_conn_min_interval, le_adv_max_interval,
      and le_adv_min_interval can be modified from the HCI core code, as well
      through debugfs.
      
      The debugfs implementation, that's only available to privileged users,
      will check for boundaries, making sure that the minimum value being set
      is strictly above the maximum value that already exists, and vice-versa.
      
      However, as both minimum and maximum values can be changed concurrently
      to us modifying them, we need to make sure that the value we check is
      the value we end up using.
      
      For example, with ->conn_info_max_age set to 10, conn_info_min_age_set()
      gets called from vfs handlers to set conn_info_min_age to 8.
      
      In conn_info_min_age_set(), this goes through:
      	if (val == 0 || val > hdev->conn_info_max_age)
      		return -EINVAL;
      
      Concurrently, conn_info_max_age_set() gets called to set to set the
      conn_info_max_age to 7:
      	if (val == 0 || val > hdev->conn_info_max_age)
      		return -EINVAL;
      That check will also pass because we used the old value (10) for
      conn_info_max_age.
      
      After those checks that both passed, the struct hci_dev access
      is mutex-locked, disabling concurrent access, but that does not matter
      because the invalid value checks both passed, and we'll end up with
      conn_info_min_age = 8 and conn_info_max_age = 7
      
      To fix this problem, we need to lock the structure access before so the
      check and assignment are not interrupted.
      
      This fix was originally devised by the BassCheck[1] team, and
      considered the problem to be an atomicity one. This isn't the case as
      there aren't any concerns about the variable changing while we check it,
      but rather after we check it parallel to another change.
      
      This patch fixes CVE-2024-24858 and CVE-2024-24857.
      
      [1] https://sites.google.com/view/basscheck/
      
      
      
      Co-developed-by: default avatarGui-Dong Han <2045gemini@gmail.com>
      Signed-off-by: default avatarGui-Dong Han <2045gemini@gmail.com>
      Link: https://lore.kernel.org/linux-bluetooth/20231222161317.6255-1-2045gemini@gmail.com/
      Link: https://nvd.nist.gov/vuln/detail/CVE-2024-24858
      Link: https://lore.kernel.org/linux-bluetooth/20231222162931.6553-1-2045gemini@gmail.com/
      Link: https://lore.kernel.org/linux-bluetooth/20231222162310.6461-1-2045gemini@gmail.com/
      Link: https://nvd.nist.gov/vuln/detail/CVE-2024-24857
      Fixes: 31ad1691 ("Bluetooth: Add conn info lifetime parameters to debugfs")
      Fixes: 729a1051 ("Bluetooth: Expose default LE advertising interval via debugfs")
      Fixes: 71c3b60e
      
       ("Bluetooth: Move BR/EDR debugfs file creation into hci_debugfs.c")
      Signed-off-by: default avatarBastien Nocera <hadess@hadess.net>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7835fcfd
    • Hui Wang's avatar
      Bluetooth: hci_event: set the conn encrypted before conn establishes · c569242c
      Hui Wang authored
      We have a BT headset (Lenovo Thinkplus XT99), the pairing and
      connecting has no problem, once this headset is paired, bluez will
      remember this device and will auto re-connect it whenever the device
      is powered on. The auto re-connecting works well with Windows and
      Android, but with Linux, it always fails. Through debugging, we found
      at the rfcomm connection stage, the bluetooth stack reports
      "Connection refused - security block (0x0003)".
      
      For this device, the re-connecting negotiation process is different
      from other BT headsets, it sends the Link_KEY_REQUEST command before
      the CONNECT_REQUEST completes, and it doesn't send ENCRYPT_CHANGE
      command during the negotiation. When the device sends the "connect
      complete" to hci, the ev->encr_mode is 1.
      
      So here in the conn_complete_evt(), if ev->encr_mode is 1, link type
      is ACL and HCI_CONN_ENCRYPT is not set, we set HCI_CONN_ENCRYPT to
      this conn, and update conn->enc_key_size accordingly.
      
      After this change, this BT headset could re-connect with Linux
      successfully. This is the btmon log after applying the patch, after
      receiving the "Connect Complete" with "Encryption: Enabled", will send
      the command to read encryption key size:
      > HCI Event: Connect Request (0x04) plen 10
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
              Class: 0x240404
                Major class: Audio/Video (headset, speaker, stereo, video, vcr)
                Minor class: Wearable Headset Device
                Rendering (Printing, Speaker)
                Audio (Speaker, Microphone, Headset)
              Link type: ACL (0x01)
      ...
      > HCI Event: Link Key Request (0x17) plen 6
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
      < HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
              Link key: ${32-hex-digits-key}
      ...
      > HCI Event: Connect Complete (0x03) plen 11
              Status: Success (0x00)
              Handle: 256
              Address: 8C:3C:AA:D8:11:67 (OUI 8C-3C-AA)
              Link type: ACL (0x01)
              Encryption: Enabled (0x01)
      < HCI Command: Read Encryption Key... (0x05|0x0008) plen 2
              Handle: 256
      < ACL Data TX: Handle 256 flags 0x00 dlen 10
            L2CAP: Information Request (0x0a) ident 1 len 2
              Type: Extended features supported (0x0002)
      > HCI Event: Command Complete (0x0e) plen 7
            Read Encryption Key Size (0x05|0x0008) ncmd 1
              Status: Success (0x00)
              Handle: 256
              Key size: 16
      
      Cc: stable@vger.kernel.org
      Link: https://github.com/bluez/bluez/issues/704
      
      
      Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
      Reviewed-by: default avatarLuiz Augusto von Dentz <luiz.dentz@gmail.com>
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      c569242c
    • Luiz Augusto von Dentz's avatar
      Bluetooth: hci_sync: Fix not checking error on hci_cmd_sync_cancel_sync · 6946b9c9
      Luiz Augusto von Dentz authored
      hci_cmd_sync_cancel_sync shall check the error passed to it since it
      will be propagated using req_result which is __u32 it needs to be
      properly set to a positive value if it was passed as negative othertise
      IS_ERR will not trigger as -(errno) would be converted to a positive
      value.
      
      Fixes: 63298d6e
      
       ("Bluetooth: hci_core: Cancel request on command timeout")
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Reported-and-tested-by: default avatarThorsten Leemhuis <linux@leemhuis.info>
      Closes: https://lore.kernel.org/all/08275279-7462-4f4a-a0ee-8aa015f829bc@leemhuis.info/
      6946b9c9
    • Johan Hovold's avatar
      Bluetooth: qca: fix device-address endianness · 77f45cca
      Johan Hovold authored
      The WCN6855 firmware on the Lenovo ThinkPad X13s expects the Bluetooth
      device address in big-endian order when setting it using the
      EDL_WRITE_BD_ADDR_OPCODE command.
      
      Presumably, this is the case for all non-ROME devices which all use the
      EDL_WRITE_BD_ADDR_OPCODE command for this (unlike the ROME devices which
      use a different command and expect the address in little-endian order).
      
      Reverse the little-endian address before setting it to make sure that
      the address can be configured using tools like btmgmt or using the
      'local-bd-address' devicetree property.
      
      Note that this can potentially break systems with boot firmware which
      has started relying on the broken behaviour and is incorrectly passing
      the address via devicetree in big-endian order.
      
      The only device affected by this should be the WCN3991 used in some
      Chromebooks. As ChromeOS updates the kernel and devicetree in lockstep,
      the new 'qcom,local-bd-address-broken' property can be used to determine
      if the firmware is buggy so that the underlying driver bug can be fixed
      without breaking backwards compatibility.
      
      Set the HCI_QUIRK_BDADDR_PROPERTY_BROKEN quirk for such platforms so
      that the address is reversed when parsing the address property.
      
      Fixes: 5c0a1001
      
       ("Bluetooth: hci_qca: Add helper to set device address")
      Cc: stable@vger.kernel.org      # 5.1
      Cc: Balakrishna Godavarthi <quic_bgodavar@quicinc.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Tested-by: Nikita Travkin <nikita@trvn.ru> # sc7180
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      77f45cca
    • Johan Hovold's avatar
      Bluetooth: add quirk for broken address properties · 39646f29
      Johan Hovold authored
      Some Bluetooth controllers lack persistent storage for the device
      address and instead one can be provided by the boot firmware using the
      'local-bd-address' devicetree property.
      
      The Bluetooth devicetree bindings clearly states that the address should
      be specified in little-endian order, but due to a long-standing bug in
      the Qualcomm driver which reversed the address some boot firmware has
      been providing the address in big-endian order instead.
      
      Add a new quirk that can be set on platforms with broken firmware and
      use it to reverse the address when parsing the property so that the
      underlying driver bug can be fixed.
      
      Fixes: 5c0a1001
      
       ("Bluetooth: hci_qca: Add helper to set device address")
      Cc: stable@vger.kernel.org      # 5.1
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      39646f29
    • Johan Hovold's avatar
      arm64: dts: qcom: sc7180-trogdor: mark bluetooth address as broken · e12e2800
      Johan Hovold authored
      Several Qualcomm Bluetooth controllers lack persistent storage for the
      device address and instead one can be provided by the boot firmware
      using the 'local-bd-address' devicetree property.
      
      The Bluetooth bindings clearly states that the address should be
      specified in little-endian order, but due to a long-standing bug in the
      Qualcomm driver which reversed the address some boot firmware has been
      providing the address in big-endian order instead.
      
      The boot firmware in SC7180 Trogdor Chromebooks is known to be affected
      so mark the 'local-bd-address' property as broken to maintain backwards
      compatibility with older firmware when fixing the underlying driver bug.
      
      Note that ChromeOS always updates the kernel and devicetree in lockstep
      so that there is no need to handle backwards compatibility with older
      devicetrees.
      
      Fixes: 7ec3e673
      
       ("arm64: dts: qcom: sc7180-trogdor: add initial trogdor and lazor dt")
      Cc: stable@vger.kernel.org      # 5.10
      Cc: Rob Clark <robdclark@chromium.org>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Acked-by: default avatarBjorn Andersson <andersson@kernel.org>
      Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      e12e2800
    • Johan Hovold's avatar
      dt-bindings: bluetooth: add 'qcom,local-bd-address-broken' · 7003de8a
      Johan Hovold authored
      
      
      Several Qualcomm Bluetooth controllers lack persistent storage for the
      device address and instead one can be provided by the boot firmware
      using the 'local-bd-address' devicetree property.
      
      The Bluetooth bindings clearly states that the address should be
      specified in little-endian order, but due to a long-standing bug in the
      Qualcomm driver which reversed the address some boot firmware has been
      providing the address in big-endian order instead.
      
      The only device out there that should be affected by this is the WCN3991
      used in some Chromebooks.
      
      Add a 'qcom,local-bd-address-broken' property which can be set on these
      platforms to indicate that the boot firmware is using the wrong byte
      order.
      
      Note that ChromeOS always updates the kernel and devicetree in lockstep
      so that there is no need to handle backwards compatibility with older
      devicetrees.
      
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      7003de8a
    • Johan Hovold's avatar
      Revert "Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT" · 4790a73a
      Johan Hovold authored
      This reverts commit 7dcd3e01.
      
      Qualcomm Bluetooth controllers like WCN6855 do not have persistent
      storage for the Bluetooth address and must therefore start as
      unconfigured to allow the user to set a valid address unless one has
      been provided by the boot firmware in the devicetree.
      
      A recent change snuck into v6.8-rc7 and incorrectly started marking the
      default (non-unique) address as valid. This specifically also breaks the
      Bluetooth setup for some user of the Lenovo ThinkPad X13s.
      
      Note that this is the second time Qualcomm breaks the driver this way
      and that this was fixed last year by commit 6945795b ("Bluetooth:
      fix use-bdaddr-property quirk"), which also has some further details.
      
      Fixes: 7dcd3e01
      
       ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
      Cc: stable@vger.kernel.org      # 6.8
      Cc: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reported-by: default avatarClayton Craft <clayton@craftyguy.net>
      Tested-by: default avatarClayton Craft <clayton@craftyguy.net>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      4790a73a
    • Hariprasad Kelam's avatar
      octeontx2-af: Fix issue with loading coalesced KPU profiles · 0ba80d96
      Hariprasad Kelam authored
      The current implementation for loading coalesced KPU profiles has
      a limitation.  The "offset" field, which is used to locate profiles
      within the profile is restricted to a u16.
      
      This restricts the number of profiles that can be loaded. This patch
      addresses this limitation by increasing the size of the "offset" field.
      
      Fixes: 11c730bf
      
       ("octeontx2-af: support for coalescing KPU profiles")
      Signed-off-by: default avatarHariprasad Kelam <hkelam@marvell.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ba80d96
    • David S. Miller's avatar
      Merge branch 'gro-fixes' · ad69a730
      David S. Miller authored
      
      
      Antoine Tenart says:
      
      ====================
      gro: various fixes related to UDP tunnels
      
      We found issues when a UDP tunnel endpoint is in a different netns than
      where UDP GRO happens. This kind of setup is actually quite diverse,
      from having one leg of the tunnel on a remove host, to having a tunnel
      between netns (eg. being bridged in another one or on the host). In our
      case that UDP tunnel was geneve.
      
      UDP tunnel packets should not be GROed at the UDP level. The fundamental
      issue here is such packet can't be detected in a foolproof way: we can't
      know by looking at a packet alone and the current logic of looking up
      UDP sockets is fragile (socket could be in another netns, packet could
      be modified in between, etc). Because there is no way to make the GRO
      code to correctly handle those packets in all cases, this series aims at
      two things: making the net stack to correctly behave (as in, no crash
      and no invalid packet) when such thing happens, and in some cases to
      prevent this "early GRO" from happening.
      
      First three patches fix issues when an "UDP tunneled" packet is being
      GROed too early by rx-udp-gro-forwarding or rx-gro-list.
      
      Last patch is preventing locally generated UDP tunnel packets from being
      GROed. This turns out to be more complex than this patch alone as it
      relies on skb->encapsulation which is currently untrusty in some cases
      (see iptunnel_handle_offloads); but that should fix things in practice
      and is acceptable for a fix. Future work is required to improve things
      (prevent all locally generated UDP tunnel packets from being GROed),
      such as fixing the misuse of skb->encapsulation in drivers; but that
      would be net-next material.
      
      Thanks!
      Antoine
      
      Since v3:
        - Fixed the udpgro_fwd selftest in patch 5 (Jakub Kicinski feedback).
        - Improved commit message on patch 3 (Willem de Bruijn feeback).
      
      Since v2:
        - Fixed a build issue with IPv6=m in patch 1 (Jakub Kicinski
          feedback).
        - Fixed typo in patch 1 (Nikolay Aleksandrov feedback).
        - Added Reviewed-by tag on patch 2 (Willem de Bruijn feeback).
        - Added back conversion to CHECKSUM_UNNECESSARY but only from non
          CHECKSUM_PARTIAL in patch 3 (Paolo Abeni & Willem de Bruijn
          feeback).
        - Reworded patch 3 commit msg.
      
      Since v1:
        - Fixed a build issue with IPv6 disabled in patch 1.
        - Reworked commit log in patch 2 (Willem de Bruijn feedback).
        - Added Reviewed-by tags on patches 1 & 4 (Willem de Bruijn feeback).
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad69a730
    • Antoine Tenart's avatar
      selftests: net: gro fwd: update vxlan GRO test expectations · 0fb101be
      Antoine Tenart authored
      UDP tunnel packets can't be GRO in-between their endpoints as this
      causes different issues. The UDP GRO fwd vxlan tests were relying on
      this and their expectations have to be fixed.
      
      We keep both vxlan tests and expected no GRO from happening. The vxlan
      UDP GRO bench test was removed as it's not providing any valuable
      information now.
      
      Fixes: a062260a
      
       ("selftests: net: add UDP GRO forwarding self-tests")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0fb101be
    • Antoine Tenart's avatar
      udp: prevent local UDP tunnel packets from being GROed · 64235eab
      Antoine Tenart authored
      GRO has a fundamental issue with UDP tunnel packets as it can't detect
      those in a foolproof way and GRO could happen before they reach the
      tunnel endpoint. Previous commits have fixed issues when UDP tunnel
      packets come from a remote host, but if those packets are issued locally
      they could run into checksum issues.
      
      If the inner packet has a partial checksum the information will be lost
      in the GRO logic, either in udp4/6_gro_complete or in
      udp_gro_complete_segment and packets will have an invalid checksum when
      leaving the host.
      
      Prevent local UDP tunnel packets from ever being GROed at the outer UDP
      level.
      
      Due to skb->encapsulation being wrongly used in some drivers this is
      actually only preventing UDP tunnel packets with a partial checksum to
      be GROed (see iptunnel_handle_offloads) but those were also the packets
      triggering issues so in practice this should be sufficient.
      
      Fixes: 9fd1ff5d ("udp: Support UDP fraglist GRO/GSO.")
      Fixes: 36707061
      
       ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets")
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      64235eab
    • Antoine Tenart's avatar
      udp: do not transition UDP GRO fraglist partial checksums to unnecessary · f0b8c303
      Antoine Tenart authored
      UDP GRO validates checksums and in udp4/6_gro_complete fraglist packets
      are converted to CHECKSUM_UNNECESSARY to avoid later checks. However
      this is an issue for CHECKSUM_PARTIAL packets as they can be looped in
      an egress path and then their partial checksums are not fixed.
      
      Different issues can be observed, from invalid checksum on packets to
      traces like:
      
        gen01: hw csum failure
        skb len=3008 headroom=160 headlen=1376 tailroom=0
        mac=(106,14) net=(120,40) trans=160
        shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0))
        csum(0xffff232e ip_summed=2 complete_sw=0 valid=0 level=0)
        hash(0x77e3d716 sw=1 l4=1) proto=0x86dd pkttype=0 iif=12
        ...
      
      Fix this by only converting CHECKSUM_NONE packets to
      CHECKSUM_UNNECESSARY by reusing __skb_incr_checksum_unnecessary. All
      other checksum types are kept as-is, including CHECKSUM_COMPLETE as
      fraglist packets being segmented back would have their skb->csum valid.
      
      Fixes: 9fd1ff5d
      
       ("udp: Support UDP fraglist GRO/GSO.")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f0b8c303
    • Antoine Tenart's avatar
      gro: fix ownership transfer · ed4cccef
      Antoine Tenart authored
      If packets are GROed with fraglist they might be segmented later on and
      continue their journey in the stack. In skb_segment_list those skbs can
      be reused as-is. This is an issue as their destructor was removed in
      skb_gro_receive_list but not the reference to their socket, and then
      they can't be orphaned. Fix this by also removing the reference to the
      socket.
      
      For example this could be observed,
      
        kernel BUG at include/linux/skbuff.h:3131!  (skb_orphan)
        RIP: 0010:ip6_rcv_core+0x11bc/0x19a0
        Call Trace:
         ipv6_list_rcv+0x250/0x3f0
         __netif_receive_skb_list_core+0x49d/0x8f0
         netif_receive_skb_list_internal+0x634/0xd40
         napi_complete_done+0x1d2/0x7d0
         gro_cell_poll+0x118/0x1f0
      
      A similar construction is found in skb_gro_receive, apply the same
      change there.
      
      Fixes: 5e10da53
      
       ("skbuff: allow 'slow_gro' for skb carring sock reference")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed4cccef
    • Antoine Tenart's avatar
      udp: do not accept non-tunnel GSO skbs landing in a tunnel · 3d010c80
      Antoine Tenart authored
      When rx-udp-gro-forwarding is enabled UDP packets might be GROed when
      being forwarded. If such packets might land in a tunnel this can cause
      various issues and udp_gro_receive makes sure this isn't the case by
      looking for a matching socket. This is performed in
      udp4/6_gro_lookup_skb but only in the current netns. This is an issue
      with tunneled packets when the endpoint is in another netns. In such
      cases the packets will be GROed at the UDP level, which leads to various
      issues later on. The same thing can happen with rx-gro-list.
      
      We saw this with geneve packets being GROed at the UDP level. In such
      case gso_size is set; later the packet goes through the geneve rx path,
      the geneve header is pulled, the offset are adjusted and frag_list skbs
      are not adjusted with regard to geneve. When those skbs hit
      skb_fragment, it will misbehave. Different outcomes are possible
      depending on what the GROed skbs look like; from corrupted packets to
      kernel crashes.
      
      One example is a BUG_ON[1] triggered in skb_segment while processing the
      frag_list. Because gso_size is wrong (geneve header was pulled)
      skb_segment thinks there is "geneve header size" of data in frag_list,
      although it's in fact the next packet. The BUG_ON itself has nothing to
      do with the issue. This is only one of the potential issues.
      
      Looking up for a matching socket in udp_gro_receive is fragile: the
      lookup could be extended to all netns (not speaking about performances)
      but nothing prevents those packets from being modified in between and we
      could still not find a matching socket. It's OK to keep the current
      logic there as it should cover most cases but we also need to make sure
      we handle tunnel packets being GROed too early.
      
      This is done by extending the checks in udp_unexpected_gso: GSO packets
      lacking the SKB_GSO_UDP_TUNNEL/_CSUM bits and landing in a tunnel must
      be segmented.
      
      [1] kernel BUG at net/core/skbuff.c:4408!
          RIP: 0010:skb_segment+0xd2a/0xf70
          __udp_gso_segment+0xaa/0x560
      
      Fixes: 9fd1ff5d ("udp: Support UDP fraglist GRO/GSO.")
      Fixes: 36707061
      
       ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets")
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d010c80
    • Lukasz Majewski's avatar
      net: hsr: Use full string description when opening HSR network device · 10e52ad5
      Lukasz Majewski authored
      
      
      Up till now only single character ('A' or 'B') was used to provide
      information of HSR slave network device status.
      
      As it is also possible and valid, that Interlink network device may
      be supported as well, the description must be more verbose. As a result
      the full string description is now used.
      
      Signed-off-by: default avatarLukasz Majewski <lukma@denx.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      10e52ad5
    • Jakub Kicinski's avatar
      Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 1ae289b0
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2024-03-27 (e1000e)
      
      This series contains updates to e1000e driver only.
      
      Vitaly adds retry mechanism for some PHY operations to workaround MDI
      error and moves SMBus configuration to avoid possible PHY loss.
      
      * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
        e1000e: move force SMBUS from enable ulp function to avoid PHY loss issue
        e1000e: Workaround for sporadic MDI error on Meteor Lake systems
      ====================
      
      Link: https://lore.kernel.org/r/20240327185517.2587564-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1ae289b0