Skip to content
  1. Jan 21, 2023
    • Paolo Abeni's avatar
      net: fix UaF in netns ops registration error path · 71ab9c3e
      Paolo Abeni authored
      
      
      If net_assign_generic() fails, the current error path in ops_init() tries
      to clear the gen pointer slot. Anyway, in such error path, the gen pointer
      itself has not been modified yet, and the existing and accessed one is
      smaller than the accessed index, causing an out-of-bounds error:
      
       BUG: KASAN: slab-out-of-bounds in ops_init+0x2de/0x320
       Write of size 8 at addr ffff888109124978 by task modprobe/1018
      
       CPU: 2 PID: 1018 Comm: modprobe Not tainted 6.2.0-rc2.mptcp_ae5ac65fbed5+ #1641
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.1-2.fc37 04/01/2014
       Call Trace:
        <TASK>
        dump_stack_lvl+0x6a/0x9f
        print_address_description.constprop.0+0x86/0x2b5
        print_report+0x11b/0x1fb
        kasan_report+0x87/0xc0
        ops_init+0x2de/0x320
        register_pernet_operations+0x2e4/0x750
        register_pernet_subsys+0x24/0x40
        tcf_register_action+0x9f/0x560
        do_one_initcall+0xf9/0x570
        do_init_module+0x190/0x650
        load_module+0x1fa5/0x23c0
        __do_sys_finit_module+0x10d/0x1b0
        do_syscall_64+0x58/0x80
        entry_SYSCALL_64_after_hwframe+0x72/0xdc
       RIP: 0033:0x7f42518f778d
       Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48
             89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
             ff 73 01 c3 48 8b 0d cb 56 2c 00 f7 d8 64 89 01 48
       RSP: 002b:00007fff96869688 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
       RAX: ffffffffffffffda RBX: 00005568ef7f7c90 RCX: 00007f42518f778d
       RDX: 0000000000000000 RSI: 00005568ef41d796 RDI: 0000000000000003
       RBP: 00005568ef41d796 R08: 0000000000000000 R09: 0000000000000000
       R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
       R13: 00005568ef7f7d30 R14: 0000000000040000 R15: 0000000000000000
        </TASK>
      
      This change addresses the issue by skipping the gen pointer
      de-reference in the mentioned error-path.
      
      Found by code inspection and verified with explicit error injection
      on a kasan-enabled kernel.
      
      Fixes: d266935a ("net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/cec4e0f3bb2c77ac03a6154a8508d3930beb5f0f.1674154348.git.pabeni@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      71ab9c3e
    • Yoshihiro Shimoda's avatar
      net: ethernet: renesas: rswitch: Fix ethernet-ports handling · fd941bd6
      Yoshihiro Shimoda authored
      
      
      If one of ports in the ethernet-ports was disabled, this driver
      failed to probe all ports. So, fix it.
      
      Fixes: 3590918b ("net: ethernet: renesas: Add support for "Ethernet Switch"")
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Link: https://lore.kernel.org/r/20230120001959.1059850-1-yoshihiro.shimoda.uh@renesas.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fd941bd6
    • Haiyang Zhang's avatar
      net: mana: Fix IRQ name - add PCI and queue number · 20e3028c
      Haiyang Zhang authored
      
      
      The PCI and queue number info is missing in IRQ names.
      
      Add PCI and queue number to IRQ names, to allow CPU affinity
      tuning scripts to work.
      
      Cc: stable@vger.kernel.org
      Fixes: ca9c54d2 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
      Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Link: https://lore.kernel.org/r/1674161950-19708-1-git-send-email-haiyangz@microsoft.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      20e3028c
    • Eric Dumazet's avatar
      netlink: prevent potential spectre v1 gadgets · f0950402
      Eric Dumazet authored
      
      
      Most netlink attributes are parsed and validated from
      __nla_validate_parse() or validate_nla()
      
          u16 type = nla_type(nla);
      
          if (type == 0 || type > maxtype) {
              /* error or continue */
          }
      
      @type is then used as an array index and can be used
      as a Spectre v1 gadget.
      
      array_index_nospec() can be used to prevent leaking
      content of kernel memory to malicious users.
      
      This should take care of vast majority of netlink uses,
      but an audit is needed to take care of others where
      validation is not yet centralized in core netlink functions.
      
      Fixes: bfa83a9e ("[NETLINK]: Type-safe netlink messages/attributes interface")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20230119110150.2678537-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f0950402
    • Linus Torvalds's avatar
      Merge tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 5deaa985
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from wireless, bluetooth, bpf and netfilter.
      
        Current release - regressions:
      
         - Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6
           addrconf", fix nsna_ping mode of team
      
         - wifi: mt76: fix bugs in Rx queue handling and DMA mapping
      
         - eth: mlx5:
            - add missing mutex_unlock in error reporter
            - protect global IPsec ASO with a lock
      
        Current release - new code bugs:
      
         - rxrpc: fix wrong error return in rxrpc_connect_call()
      
        Previous releases - regressions:
      
         - bluetooth: hci_sync: fix use of HCI_OP_LE_READ_BUFFER_SIZE_V2
      
         - wifi:
            - mac80211: fix crashes on Rx due to incorrect initialization of
              rx->link and rx->link_sta
            - mac80211: fix bugs in iTXQ conversion - Tx stalls, incorrect
              aggregation handling, crashes
            - brcmfmac: fix regression for Broadcom PCIe wifi devices
            - rndis_wlan: prevent buffer overflow in rndis_query_oid
      
         - netfilter: conntrack: handle tcp challenge acks during connection
           reuse
      
         - sched: avoid grafting on htb_destroy_class_offload when destroying
      
         - virtio-net: correctly enable callback during start_xmit, fix stalls
      
         - tcp: avoid the lookup process failing to get sk in ehash table
      
         - ipa: disable ipa interrupt during suspend
      
         - eth: stmmac: enable all safety features by default
      
        Previous releases - always broken:
      
         - bpf:
            - fix pointer-leak due to insufficient speculative store bypass
              mitigation (Spectre v4)
            - skip task with pid=1 in send_signal_common() to avoid a splat
            - fix BPF program ID information in BPF_AUDIT_UNLOAD as well as
              PERF_BPF_EVENT_PROG_UNLOAD events
            - fix potential deadlock in htab_lock_bucket from same bucket
              index but different map_locked index
      
         - bluetooth:
            - fix a buffer overflow in mgmt_mesh_add()
            - hci_qca: fix driver shutdown on closed serdev
            - ISO: fix possible circular locking dependency
            - CIS: hci_event: fix invalid wait context
      
         - wifi: brcmfmac: fixes for survey dump handling
      
         - mptcp: explicitly specify sock family at subflow creation time
      
         - netfilter: nft_payload: incorrect arithmetics when fetching VLAN
           header bits
      
         - tcp: fix rate_app_limited to default to 1
      
         - l2tp: close all race conditions in l2tp_tunnel_register()
      
         - eth: mlx5: fixes for QoS config and eswitch configuration
      
         - eth: enetc: avoid deadlock in enetc_tx_onestep_tstamp()
      
         - eth: stmmac: fix invalid call to mdiobus_get_phy()
      
        Misc:
      
         - ethtool: add netlink attr in rss get reply only if the value is not
           empty"
      
      * tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (88 commits)
        Revert "Merge branch 'octeontx2-af-CPT'"
        tcp: fix rate_app_limited to default to 1
        bnxt: Do not read past the end of test names
        net: stmmac: enable all safety features by default
        octeontx2-af: add mbox to return CPT_AF_FLT_INT info
        octeontx2-af: update cpt lf alloc mailbox
        octeontx2-af: restore rxc conf after teardown sequence
        octeontx2-af: optimize cpt pf identification
        octeontx2-af: modify FLR sequence for CPT
        octeontx2-af: add mbox for CPT LF reset
        octeontx2-af: recover CPT engine when it gets fault
        net: dsa: microchip: ksz9477: port map correction in ALU table entry register
        selftests/net: toeplitz: fix race on tpacket_v3 block close
        net/ulp: use consistent error code when blocking ULP
        octeontx2-pf: Fix the use of GFP_KERNEL in atomic context on rt
        tcp: avoid the lookup process failing to get sk in ehash table
        Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf"
        MAINTAINERS: add networking entries for Willem
        net: sched: gred: prevent races when adding offloads to stats
        l2tp: prevent lockdep issue in l2tp_tunnel_register()
        ...
      5deaa985
    • Jakub Kicinski's avatar
      Revert "Merge branch 'octeontx2-af-CPT'" · 45a919bb
      Jakub Kicinski authored
      
      
      This reverts commit b4fbf0b2, reversing
      changes made to 6c977c5c.
      
      This seems like net-next material.
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      45a919bb
  2. Jan 20, 2023
  3. Jan 19, 2023
  4. Jan 18, 2023