1. 03 Jul, 2024 1 commit
    • Florian Westphal's avatar
      netfilter: nf_tables: unconditionally flush pending work before notifier · 9f6958ba
      Florian Westphal authored
      syzbot reports:
      
      KASAN: slab-uaf in nft_ctx_update include/net/netfilter/nf_tables.h:1831
      KASAN: slab-uaf in nft_commit_release net/netfilter/nf_tables_api.c:9530
      KASAN: slab-uaf int nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597
      Read of size 2 at addr ffff88802b0051c4 by task kworker/1:1/45
      [..]
      Workqueue: events nf_tables_trans_destroy_work
      Call Trace:
       nft_ctx_update include/net/netfilter/nf_tables.h:1831 [inline]
       nft_commit_release net/netfilter/nf_tables_api.c:9530 [inline]
       nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597
      
      Problem is that the notifier does a conditional flush, but its possible
      that the table-to-be-removed is still referenced by transactions being
      processed by the worker, so we need to flush unconditionally.
      
      We could make the flush_work depend on whether we found a table to delete
      in nf-next to avoid the flush for most cases.
      
      AFAICS this problem is only exposed in nf-next, with
      commit e169285f ("netfilter: nf_tables: do not store nft_ctx in transaction objects"),
      with this commit applied there is an unconditional fetch of
      table->family which is whats triggering the above splat.
      
      Fixes: 2c9f0293 ("netfilter: nf_tables: flush pending destroy work before netlink notifier")
      Reported-and-tested-by: syzbot+4fd66a69358fc15ae2ad@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=4fd66a69358fc15ae2adSigned-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      9f6958ba
  2. 02 Jul, 2024 9 commits
  3. 01 Jul, 2024 3 commits
  4. 29 Jun, 2024 1 commit
    • Ghadi Elie Rahme's avatar
      bnx2x: Fix multiple UBSAN array-index-out-of-bounds · 13406116
      Ghadi Elie Rahme authored
      Fix UBSAN warnings that occur when using a system with 32 physical
      cpu cores or more, or when the user defines a number of Ethernet
      queues greater than or equal to FP_SB_MAX_E1x using the num_queues
      module parameter.
      
      Currently there is a read/write out of bounds that occurs on the array
      "struct stats_query_entry query" present inside the "bnx2x_fw_stats_req"
      struct in "drivers/net/ethernet/broadcom/bnx2x/bnx2x.h".
      Looking at the definition of the "struct stats_query_entry query" array:
      
      struct stats_query_entry query[FP_SB_MAX_E1x+
               BNX2X_FIRST_QUEUE_QUERY_IDX];
      
      FP_SB_MAX_E1x is defined as the maximum number of fast path interrupts and
      has a value of 16, while BNX2X_FIRST_QUEUE_QUERY_IDX has a value of 3
      meaning the array has a total size of 19.
      Since accesses to "struct stats_query_entry query" are offset-ted by
      BNX2X_FIRST_QUEUE_QUERY_IDX, that means that the total number of Ethernet
      queues should not exceed FP_SB_MAX_E1x (16). However one of these queues
      is reserved for FCOE and thus the number of Ethernet queues should be set
      to [FP_SB_MAX_E1x -1] (15) if FCOE is enabled or [FP_SB_MAX_E1x] (16) if
      it is not.
      
      This is also described in a comment in the source code in
      drivers/net/ethernet/broadcom/bnx2x/bnx2x.h just above the Macro definition
      of FP_SB_MAX_E1x. Below is the part of this explanation that it important
      for this patch
      
      /*
        * The total number of L2 queues, MSIX vectors and HW contexts (CIDs) is
        * control by the number of fast-path status blocks supported by the
        * device (HW/FW). Each fast-path status block (FP-SB) aka non-default
        * status block represents an independent interrupts context that can
        * serve a regular L2 networking queue. However special L2 queues such
        * as the FCoE queue do not require a FP-SB and other components like
        * the CNIC may consume FP-SB reducing the number of possible L2 queues
        *
        * If the maximum number of FP-SB available is X then:
        * a. If CNIC is supported it consumes 1 FP-SB thus the max number of
        *    regular L2 queues is Y=X-1
        * b. In MF mode the actual number of L2 queues is Y= (X-1/MF_factor)
        * c. If the FCoE L2 queue is supported the actual number of L2 queues
        *    is Y+1
        * d. The number of irqs (MSIX vectors) is either Y+1 (one extra for
        *    slow-path interrupts) or Y+2 if CNIC is supported (one additional
        *    FP interrupt context for the CNIC).
        * e. The number of HW context (CID count) is always X or X+1 if FCoE
        *    L2 queue is supported. The cid for the FCoE L2 queue is always X.
        */
      
      However this driver also supports NICs that use the E2 controller which can
      handle more queues due to having more FP-SB represented by FP_SB_MAX_E2.
      Looking at the commits when the E2 support was added, it was originally
      using the E1x parameters: commit f2e0899f ("bnx2x: Add 57712 support").
      Back then FP_SB_MAX_E2 was set to 16 the same as E1x. However the driver
      was later updated to take full advantage of the E2 instead of having it be
      limited to the capabilities of the E1x. But as far as we can tell, the
      array "stats_query_entry query" was still limited to using the FP-SB
      available to the E1x cards as part of an oversignt when the driver was
      updated to take full advantage of the E2, and now with the driver being
      aware of the greater queue size supported by E2 NICs, it causes the UBSAN
      warnings seen in the stack traces below.
      
      This patch increases the size of the "stats_query_entry query" array by
      replacing FP_SB_MAX_E1x with FP_SB_MAX_E2 to be large enough to handle
      both types of NICs.
      
      Stack traces:
      
      UBSAN: array-index-out-of-bounds in
             drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c:1529:11
      index 20 is out of range for type 'stats_query_entry [19]'
      CPU: 12 PID: 858 Comm: systemd-network Not tainted 6.9.0-060900rc7-generic
      	     #202405052133
      Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9,
      	       BIOS P89 10/21/2019
      Call Trace:
       <TASK>
       dump_stack_lvl+0x76/0xa0
       dump_stack+0x10/0x20
       __ubsan_handle_out_of_bounds+0xcb/0x110
       bnx2x_prep_fw_stats_req+0x2e1/0x310 [bnx2x]
       bnx2x_stats_init+0x156/0x320 [bnx2x]
       bnx2x_post_irq_nic_init+0x81/0x1a0 [bnx2x]
       bnx2x_nic_load+0x8e8/0x19e0 [bnx2x]
       bnx2x_open+0x16b/0x290 [bnx2x]
       __dev_open+0x10e/0x1d0
      RIP: 0033:0x736223927a0a
      Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca
            64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00
            f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
      RSP: 002b:00007ffc0bb2ada8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000583df50f9c78 RCX: 0000736223927a0a
      RDX: 0000000000000020 RSI: 0000583df50ee510 RDI: 0000000000000003
      RBP: 0000583df50d4940 R08: 00007ffc0bb2adb0 R09: 0000000000000080
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000583df5103ae0
      R13: 000000000000035a R14: 0000583df50f9c30 R15: 0000583ddddddf00
      </TASK>
      ---[ end trace ]---
      ------------[ cut here ]------------
      UBSAN: array-index-out-of-bounds in
             drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c:1546:11
      index 28 is out of range for type 'stats_query_entry [19]'
      CPU: 12 PID: 858 Comm: systemd-network Not tainted 6.9.0-060900rc7-generic
      	     #202405052133
      Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9,
      	       BIOS P89 10/21/2019
      Call Trace:
      <TASK>
      dump_stack_lvl+0x76/0xa0
      dump_stack+0x10/0x20
      __ubsan_handle_out_of_bounds+0xcb/0x110
      bnx2x_prep_fw_stats_req+0x2fd/0x310 [bnx2x]
      bnx2x_stats_init+0x156/0x320 [bnx2x]
      bnx2x_post_irq_nic_init+0x81/0x1a0 [bnx2x]
      bnx2x_nic_load+0x8e8/0x19e0 [bnx2x]
      bnx2x_open+0x16b/0x290 [bnx2x]
      __dev_open+0x10e/0x1d0
      RIP: 0033:0x736223927a0a
      Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca
            64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00
            f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
      RSP: 002b:00007ffc0bb2ada8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000583df50f9c78 RCX: 0000736223927a0a
      RDX: 0000000000000020 RSI: 0000583df50ee510 RDI: 0000000000000003
      RBP: 0000583df50d4940 R08: 00007ffc0bb2adb0 R09: 0000000000000080
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000583df5103ae0
      R13: 000000000000035a R14: 0000583df50f9c30 R15: 0000583ddddddf00
       </TASK>
      ---[ end trace ]---
      ------------[ cut here ]------------
      UBSAN: array-index-out-of-bounds in
             drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:1895:8
      index 29 is out of range for type 'stats_query_entry [19]'
      CPU: 13 PID: 163 Comm: kworker/u96:1 Not tainted 6.9.0-060900rc7-generic
      	     #202405052133
      Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9,
      	       BIOS P89 10/21/2019
      Workqueue: bnx2x bnx2x_sp_task [bnx2x]
      Call Trace:
       <TASK>
       dump_stack_lvl+0x76/0xa0
       dump_stack+0x10/0x20
       __ubsan_handle_out_of_bounds+0xcb/0x110
       bnx2x_iov_adjust_stats_req+0x3c4/0x3d0 [bnx2x]
       bnx2x_storm_stats_post.part.0+0x4a/0x330 [bnx2x]
       ? bnx2x_hw_stats_post+0x231/0x250 [bnx2x]
       bnx2x_stats_start+0x44/0x70 [bnx2x]
       bnx2x_stats_handle+0x149/0x350 [bnx2x]
       bnx2x_attn_int_asserted+0x998/0x9b0 [bnx2x]
       bnx2x_sp_task+0x491/0x5c0 [bnx2x]
       process_one_work+0x18d/0x3f0
       </TASK>
      ---[ end trace ]---
      
      Fixes: 50f0a562 ("bnx2x: add fcoe statistics")
      Signed-off-by: default avatarGhadi Elie Rahme <ghadi.rahme@canonical.com>
      Cc: stable@vger.kernel.org
      Link: https://patch.msgid.link/20240627111405.1037812-1-ghadi.rahme@canonical.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      13406116
  5. 28 Jun, 2024 22 commits
  6. 27 Jun, 2024 4 commits
    • Marek Vasut's avatar
      net: phy: phy_device: Fix PHY LED blinking code comment · d3dcb084
      Marek Vasut authored
      Fix copy-paste error in the code comment. The code refers to
      LED blinking configuration, not brightness configuration. It
      was likely copied from comment above this one which does
      refer to brightness configuration.
      
      Fixes: 4e901018 ("net: phy: phy_device: Call into the PHY driver to set LED blinking")
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://patch.msgid.link/20240626030638.512069-1-marex@denx.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d3dcb084
    • Jakub Kicinski's avatar
      Merge tag 'wireless-2024-06-27' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · ffb7aa9f
      Jakub Kicinski authored
      Johannes Berg says:
      
      ====================
      Just a few changes:
       - maintainers: Larry Finger sadly passed away
       - maintainers: ath trees are in their group now
       - TXQ FQ quantum configuration fix
       - TI wl driver: work around stuck FW in AP mode
       - mac80211: disable softirqs in some new code
         needing that
      
      * tag 'wireless-2024-06-27' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        MAINTAINERS: wifi: update ath.git location
        MAINTAINERS: Remembering Larry Finger
        wifi: mac80211: disable softirqs for queued frame handling
        wifi: cfg80211: restrict NL80211_ATTR_TXQ_QUANTUM values
        wifi: wlcore: fix wlcore AP mode
      ====================
      
      Link: https://patch.msgid.link/20240627083627.15312-3-johannes@sipsolutions.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ffb7aa9f
    • Linus Torvalds's avatar
      Merge tag 'net-6.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · fd19d4a4
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from can, bpf and netfilter.
      
        There are a bunch of regressions addressed here, but hopefully nothing
        spectacular. We are still waiting the driver fix from Intel, mentioned
        by Jakub in the previous networking pull.
      
        Current release - regressions:
      
         - core: add softirq safety to netdev_rename_lock
      
         - tcp: fix tcp_rcv_fastopen_synack() to enter TCP_CA_Loss for failed
           TFO
      
         - batman-adv: fix RCU race at module unload time
      
        Previous releases - regressions:
      
         - openvswitch: get related ct labels from its master if it is not
           confirmed
      
         - eth: bonding: fix incorrect software timestamping report
      
         - eth: mlxsw: fix memory corruptions on spectrum-4 systems
      
         - eth: ionic: use dev_consume_skb_any outside of napi
      
        Previous releases - always broken:
      
         - netfilter: fully validate NFT_DATA_VALUE on store to data registers
      
         - unix: several fixes for OoB data
      
         - tcp: fix race for duplicate reqsk on identical SYN
      
         - bpf:
             - fix may_goto with negative offset
             - fix the corner case with may_goto and jump to the 1st insn
             - fix overrunning reservations in ringbuf
      
         - can:
             - j1939: recover socket queue on CAN bus error during BAM
               transmission
             - mcp251xfd: fix infinite loop when xmit fails
      
         - dsa: microchip: monitor potential faults in half-duplex mode
      
         - eth: vxlan: pull inner IP header in vxlan_xmit_one()
      
         - eth: ionic: fix kernel panic due to multi-buffer handling
      
        Misc:
      
         - selftest: unix tests refactor and a lot of new cases added"
      
      * tag 'net-6.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (61 commits)
        net: mana: Fix possible double free in error handling path
        selftest: af_unix: Check SIOCATMARK after every send()/recv() in msg_oob.c.
        af_unix: Fix wrong ioctl(SIOCATMARK) when consumed OOB skb is at the head.
        selftest: af_unix: Check EPOLLPRI after every send()/recv() in msg_oob.c
        selftest: af_unix: Check SIGURG after every send() in msg_oob.c
        selftest: af_unix: Add SO_OOBINLINE test cases in msg_oob.c
        af_unix: Don't stop recv() at consumed ex-OOB skb.
        selftest: af_unix: Add non-TCP-compliant test cases in msg_oob.c.
        af_unix: Don't stop recv(MSG_DONTWAIT) if consumed OOB skb is at the head.
        af_unix: Stop recv(MSG_PEEK) at consumed OOB skb.
        selftest: af_unix: Add msg_oob.c.
        selftest: af_unix: Remove test_unix_oob.c.
        tracing/net_sched: NULL pointer dereference in perf_trace_qdisc_reset()
        netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers
        net: usb: qmi_wwan: add Telit FN912 compositions
        tcp: fix tcp_rcv_fastopen_synack() to enter TCP_CA_Loss for failed TFO
        ionic: use dev_consume_skb_any outside of napi
        net: dsa: microchip: fix wrong register write when masking interrupt
        Fix race for duplicate reqsk on identical SYN
        ibmvnic: Add tx check to prevent skb leak
        ...
      fd19d4a4
    • Linus Torvalds's avatar
      Merge tag 'sound-6.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 3c1d29e5
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "This became bigger than usual, as it receives a pile of pending ASoC
        fixes. Most of changes are for device-specific issues while there are
        a few core fixes that are all rather trivial:
      
         - DMA-engine sync fixes
      
         - Continued MIDI2 conversion fixes
      
         - Various ASoC Intel SOF fixes
      
         - A series of ASoC topology fixes for memory handling
      
         - AMD ACP fix, curing a recent regression, too
      
         - Platform / codec-specific fixes for mediatek, atmel, realtek, etc"
      
      * tag 'sound-6.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (40 commits)
        ASoC: rt5645: fix issue of random interrupt from push-button
        ALSA: seq: Fix missing MSB in MIDI2 SPP conversion
        ASoC: amd: yc: Fix non-functional mic on ASUS M5602RA
        ALSA: hda/realtek: fix mute/micmute LEDs don't work for EliteBook 645/665 G11.
        ALSA: hda/realtek: Fix conflicting quirk for PCI SSID 17aa:3820
        ALSA: dmaengine_pcm: terminate dmaengine before synchronize
        ALSA: hda/relatek: Enable Mute LED on HP Laptop 15-gw0xxx
        ALSA: PCM: Allow resume only for suspended streams
        ALSA: seq: Fix missing channel at encoding RPN/NRPN MIDI2 messages
        ASoC: mediatek: mt8195: Add platform entry for ETDM1_OUT_BE dai link
        ASoC: fsl-asoc-card: set priv->pdev before using it
        ASoC: amd: acp: move chip->flag variable assignment
        ASoC: amd: acp: remove i2s configuration check in acp_i2s_probe()
        ASoC: amd: acp: add a null check for chip_pdev structure
        ASoC: Intel: soc-acpi: mtl: fix speaker no sound on Dell SKU 0C64
        ASoC: q6apm-lpass-dai: close graph on prepare errors
        ASoC: cs35l56: Disconnect ASP1 TX sources when ASP1 DAI is hooked up
        ASoC: topology: Fix route memory corruption
        ASoC: rt722-sdca-sdw: add debounce time for type detection
        ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error rollback
        ...
      3c1d29e5