1. 17 Oct, 2024 3 commits
    • Nilay Shroff's avatar
      nvme: make keep-alive synchronous operation · d0692367
      Nilay Shroff authored
      The nvme keep-alive operation, which executes at a periodic interval,
      could potentially sneak in while shutting down a fabric controller.
      This may lead to a race between the fabric controller admin queue
      destroy code path (invoked while shutting down controller) and hw/hctx
      queue dispatcher called from the nvme keep-alive async request queuing
      operation. This race could lead to the kernel crash shown below:
      
      Call Trace:
          autoremove_wake_function+0x0/0xbc (unreliable)
          __blk_mq_sched_dispatch_requests+0x114/0x24c
          blk_mq_sched_dispatch_requests+0x44/0x84
          blk_mq_run_hw_queue+0x140/0x220
          nvme_keep_alive_work+0xc8/0x19c [nvme_core]
          process_one_work+0x200/0x4e0
          worker_thread+0x340/0x504
          kthread+0x138/0x140
          start_kernel_thread+0x14/0x18
      
      While shutting down fabric controller, if nvme keep-alive request sneaks
      in then it would be flushed off. The nvme_keep_alive_end_io function is
      then invoked to handle the end of the keep-alive operation which
      decrements the admin->q_usage_counter and assuming this is the last/only
      request in the admin queue then the admin->q_usage_counter becomes zero.
      If that happens then blk-mq destroy queue operation (blk_mq_destroy_
      queue()) which could be potentially running simultaneously on another
      cpu (as this is the controller shutdown code path) would forward
      progress and deletes the admin queue. So, now from this point onward
      we are not supposed to access the admin queue resources. However the
      issue here's that the nvme keep-alive thread running hw/hctx queue
      dispatch operation hasn't yet finished its work and so it could still
      potentially access the admin queue resource while the admin queue had
      been already deleted and that causes the above crash.
      
      This fix helps avoid the observed crash by implementing keep-alive as a
      synchronous operation so that we decrement admin->q_usage_counter only
      after keep-alive command finished its execution and returns the command
      status back up to its caller (blk_execute_rq()). This would ensure that
      fabric shutdown code path doesn't destroy the fabric admin queue until
      keep-alive request finished execution and also keep-alive thread is not
      running hw/hctx queue dispatch operation.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNilay Shroff <nilay@linux.ibm.com>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      d0692367
    • Nilay Shroff's avatar
      nvme-loop: flush off pending I/O while shutting down loop controller · c199fac8
      Nilay Shroff authored
      While shutting down loop controller, we first quiesce the admin/IO queue,
      delete the admin/IO tag-set and then at last destroy the admin/IO queue.
      However it's quite possible that during the window between quiescing and
      destroying of the admin/IO queue, some admin/IO request might sneak in
      and if that happens then we could potentially encounter a hung task
      because shutdown operation can't forward progress until any pending I/O
      is flushed off.
      
      This commit helps ensure that before destroying the admin/IO queue, we
      unquiesce the admin/IO queue so that any outstanding requests, which are
      added after the admin/IO queue is quiesced, are now flushed to its
      completion.
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNilay Shroff <nilay@linux.ibm.com>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      c199fac8
    • Maurizio Lombardi's avatar
      nvme-pci: fix race condition between reset and nvme_dev_disable() · 26bc0a81
      Maurizio Lombardi authored
      nvme_dev_disable() modifies the dev->online_queues field, therefore
      nvme_pci_update_nr_queues() should avoid racing against it, otherwise
      we could end up passing invalid values to blk_mq_update_nr_hw_queues().
      
       WARNING: CPU: 39 PID: 61303 at drivers/pci/msi/api.c:347
                pci_irq_get_affinity+0x187/0x210
       Workqueue: nvme-reset-wq nvme_reset_work [nvme]
       RIP: 0010:pci_irq_get_affinity+0x187/0x210
       Call Trace:
        <TASK>
        ? blk_mq_pci_map_queues+0x87/0x3c0
        ? pci_irq_get_affinity+0x187/0x210
        blk_mq_pci_map_queues+0x87/0x3c0
        nvme_pci_map_queues+0x189/0x460 [nvme]
        blk_mq_update_nr_hw_queues+0x2a/0x40
        nvme_reset_work+0x1be/0x2a0 [nvme]
      
      Fix the bug by locking the shutdown_lock mutex before using
      dev->online_queues. Give up if nvme_dev_disable() is running or if
      it has been executed already.
      
      Fixes: 949928c1 ("NVMe: Fix possible queue use after freed")
      Tested-by: default avatarYi Zhang <yi.zhang@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      26bc0a81
  2. 15 Oct, 2024 1 commit
  3. 09 Oct, 2024 1 commit
  4. 08 Oct, 2024 2 commits
  5. 03 Oct, 2024 1 commit
    • Hannes Reinecke's avatar
      nvme: tcp: avoid race between queue_lock lock and destroy · 782373ba
      Hannes Reinecke authored
      Commit 76d54bf2 ("nvme-tcp: don't access released socket during
      error recovery") added a mutex_lock() call for the queue->queue_lock
      in nvme_tcp_get_address(). However, the mutex_lock() races with
      mutex_destroy() in nvme_tcp_free_queue(), and causes the WARN below.
      
      DEBUG_LOCKS_WARN_ON(lock->magic != lock)
      WARNING: CPU: 3 PID: 34077 at kernel/locking/mutex.c:587 __mutex_lock+0xcf0/0x1220
      Modules linked in: nvmet_tcp nvmet nvme_tcp nvme_fabrics iw_cm ib_cm ib_core pktcdvd nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables qrtr sunrpc ppdev 9pnet_virtio 9pnet pcspkr netfs parport_pc parport e1000 i2c_piix4 i2c_smbus loop fuse nfnetlink zram bochs drm_vram_helper drm_ttm_helper ttm drm_kms_helper xfs drm sym53c8xx floppy nvme scsi_transport_spi nvme_core nvme_auth serio_raw ata_generic pata_acpi dm_multipath qemu_fw_cfg [last unloaded: ib_uverbs]
      CPU: 3 UID: 0 PID: 34077 Comm: udisksd Not tainted 6.11.0-rc7 #319
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014
      RIP: 0010:__mutex_lock+0xcf0/0x1220
      Code: 08 84 d2 0f 85 c8 04 00 00 8b 15 ef b6 c8 01 85 d2 0f 85 78 f4 ff ff 48 c7 c6 20 93 ee af 48 c7 c7 60 91 ee af e8 f0 a7 6d fd <0f> 0b e9 5e f4 ff ff 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1
      RSP: 0018:ffff88811305f760 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: ffff88812c652058 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000001
      RBP: ffff88811305f8b0 R08: 0000000000000001 R09: ffffed1075c36341
      R10: ffff8883ae1b1a0b R11: 0000000000010498 R12: 0000000000000000
      R13: 0000000000000000 R14: dffffc0000000000 R15: ffff88812c652058
      FS:  00007f9713ae4980(0000) GS:ffff8883ae180000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fcd78483c7c CR3: 0000000122c38000 CR4: 00000000000006f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       ? __warn.cold+0x5b/0x1af
       ? __mutex_lock+0xcf0/0x1220
       ? report_bug+0x1ec/0x390
       ? handle_bug+0x3c/0x80
       ? exc_invalid_op+0x13/0x40
       ? asm_exc_invalid_op+0x16/0x20
       ? __mutex_lock+0xcf0/0x1220
       ? nvme_tcp_get_address+0xc2/0x1e0 [nvme_tcp]
       ? __pfx___mutex_lock+0x10/0x10
       ? __lock_acquire+0xd6a/0x59e0
       ? nvme_tcp_get_address+0xc2/0x1e0 [nvme_tcp]
       nvme_tcp_get_address+0xc2/0x1e0 [nvme_tcp]
       ? __pfx_nvme_tcp_get_address+0x10/0x10 [nvme_tcp]
       nvme_sysfs_show_address+0x81/0xc0 [nvme_core]
       dev_attr_show+0x42/0x80
       ? __asan_memset+0x1f/0x40
       sysfs_kf_seq_show+0x1f0/0x370
       seq_read_iter+0x2cb/0x1130
       ? rw_verify_area+0x3b1/0x590
       ? __mutex_lock+0x433/0x1220
       vfs_read+0x6a6/0xa20
       ? lockdep_hardirqs_on+0x78/0x100
       ? __pfx_vfs_read+0x10/0x10
       ksys_read+0xf7/0x1d0
       ? __pfx_ksys_read+0x10/0x10
       ? __x64_sys_openat+0x105/0x1d0
       do_syscall_64+0x93/0x180
       ? lockdep_hardirqs_on_prepare+0x16d/0x400
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on+0x78/0x100
       ? do_syscall_64+0x9f/0x180
       ? __pfx_ksys_read+0x10/0x10
       ? lockdep_hardirqs_on_prepare+0x16d/0x400
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on+0x78/0x100
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on_prepare+0x16d/0x400
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on+0x78/0x100
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on_prepare+0x16d/0x400
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on+0x78/0x100
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on_prepare+0x16d/0x400
       ? do_syscall_64+0x9f/0x180
       ? lockdep_hardirqs_on+0x78/0x100
       ? do_syscall_64+0x9f/0x180
       ? do_syscall_64+0x9f/0x180
       entry_SYSCALL_64_after_hwframe+0x76/0x7e
      RIP: 0033:0x7f9713f55cfa
      Code: 55 48 89 e5 48 83 ec 20 48 89 55 e8 48 89 75 f0 89 7d f8 e8 e8 74 f8 ff 48 8b 55 e8 48 8b 75 f0 41 89 c0 8b 7d f8 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 2e 44 89 c7 48 89 45 f8 e8 42 75 f8 ff 48 8b
      RSP: 002b:00007ffd7f512e70 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
      RAX: ffffffffffffffda RBX: 000055c38f316859 RCX: 00007f9713f55cfa
      RDX: 0000000000000fff RSI: 00007ffd7f512eb0 RDI: 0000000000000011
      RBP: 00007ffd7f512e90 R08: 0000000000000000 R09: 00000000ffffffff
      R10: 0000000000000000 R11: 0000000000000246 R12: 000055c38f317148
      R13: 0000000000000000 R14: 00007f96f4004f30 R15: 000055c3b6b623c0
       </TASK>
      
      The WARN is observed when the blktests test case nvme/014 is repeated
      with tcp transport. It is rare, and 200 times repeat is required to
      recreate in some test environments.
      
      To avoid the WARN, check the NVME_TCP_Q_LIVE flag before locking
      queue->queue_lock. The flag is cleared long time before the lock gets
      destroyed.
      Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      782373ba
  6. 01 Oct, 2024 1 commit
    • Nilay Shroff's avatar
      nvmet-passthru: clear EUID/NGUID/UUID while using loop target · e38dad43
      Nilay Shroff authored
      When nvme passthru is configured using loop target, the clear_ids
      attribute is, by default, set to true. This attribute would ensure that
      EUID/NGUID/UUID is cleared for the loop passthru target.
      
      The newer NVMe disk supporting the NVMe spec 1.3 or higher, typically,
      implements the support for "Namespace Identification Descriptor list"
      command. This command when issued from host returns EUID/NGUID/UUID
      assigned to the inquired namespace. Not clearing these values, while
      using nvme passthru using loop target, would result in NVMe host driver
      rejecting the namespace. This check was implemented in the commit
      2079f41e ("nvme: check that EUI/GUID/UUID are globally unique").
      
      The fix implemented in this commit ensure that when host issues ns-id
      descriptor list command, the EUID/NGUID/UUID are cleared by passthru
      target. In fact, the function nvmet_passthru_override_id_descs() which
      clears those unique ids already exits, so we just need to ensure that
      ns-id descriptor list command falls through the corretc code path. And
      while we're at it, we also combines the three passthru admin command
      cases together which shares the same code.
      Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNilay Shroff <nilay@linux.ibm.com>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      e38dad43
  7. 27 Sep, 2024 1 commit
  8. 26 Sep, 2024 30 commits
    • Linus Torvalds's avatar
      Merge tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 075dbe9f
      Linus Torvalds authored
      Pull SoC update from Arnd Bergmann:
       "Convert ep93xx to devicetree
      
        This concludes a long journey towards replacing the old board files
        with devictree description on the Cirrus Logic EP93xx platform.
      
        Nikita Shubin has been working on this for a long time, for details
        see the last post on
      
          https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/"
      
      * tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (47 commits)
        dt-bindings: gpio: ep9301: Add missing "#interrupt-cells" to examples
        MAINTAINERS: Update EP93XX ARM ARCHITECTURE maintainer
        soc: ep93xx: drop reference to removed EP93XX_SOC_COMMON config
        net: cirrus: use u8 for addr to calm down sparse
        dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0
        dmaengine: ep93xx: Fix a NULL vs IS_ERR() check in probe()
        pinctrl: ep93xx: Fix raster pins typo
        spi: ep93xx: update kerneldoc comments for ep93xx_spi
        clk: ep93xx: Fix off by one in ep93xx_div_recalc_rate()
        clk: ep93xx: add module license
        dmaengine: cirrus: remove platform code
        ASoC: cirrus: edb93xx: Delete driver
        ARM: ep93xx: soc: drop defines
        ARM: ep93xx: delete all boardfiles
        ata: pata_ep93xx: remove legacy pinctrl use
        pwm: ep93xx: drop legacy pinctrl
        ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms
        ARM: dts: ep93xx: Add EDB9302 DT
        ARM: dts: ep93xx: add ts7250 board
        ARM: dts: add Cirrus EP93XX SoC .dtsi
        ...
      075dbe9f
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic · 348325d6
      Linus Torvalds authored
      Pull asm-generic updates from Arnd Bergmann:
       "These are only two small patches, one cleanup for arch/alpha and a
        preparation patch cleaning up the handling of runtime constants in the
        linker scripts"
      
      * tag 'asm-generic-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        runtime constants: move list of constants to vmlinux.lds.h
        alpha: no need to include asm/xchg.h twice
      348325d6
    • Linus Torvalds's avatar
      Merge tag 'efi-next-for-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi · 1abcb8c9
      Linus Torvalds authored
      Pull EFI updates from Ard Biesheuvel:
       "Not a lot happening in EFI land this cycle.
      
         - Prevent kexec from crashing on a corrupted TPM log by using a
           memory type that is reserved by default
      
         - Log correctable errors reported via CPER
      
         - A couple of cosmetic fixes"
      
      * tag 'efi-next-for-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
        efi: Remove redundant null pointer checks in efi_debugfs_init()
        efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption
        efi/cper: Print correctable AER information
        efi: Remove unused declaration efi_initialize_iomem_resources()
      1abcb8c9
    • Linus Torvalds's avatar
      Revert "binfmt_elf, coredump: Log the reason of the failed core dumps" · a78282e2
      Linus Torvalds authored
      This reverts commit fb97d2eb.
      
      The logging was questionable to begin with, but it seems to actively
      deadlock on the task lock.
      
       "On second thought, let's not log core dump failures. 'Tis a silly place"
      
      because if you can't tell your core dump is truncated, maybe you should
      just fix your debugger instead of adding bugs to the kernel.
      Reported-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
      Link: https://lore.kernel.org/all/d122ece6-3606-49de-ae4d-8da88846bef2@oracle.com/Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a78282e2
    • Linus Torvalds's avatar
      Merge tag 'net-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 62a0e2fa
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from netfilter.
      
        It looks like that most people are still traveling: both the ML volume
        and the processing capacity are low.
      
        Previous releases - regressions:
      
          - netfilter:
              - nf_reject_ipv6: fix nf_reject_ip6_tcphdr_put()
              - nf_tables: keep deleted flowtable hooks until after RCU
      
          - tcp: check skb is non-NULL in tcp_rto_delta_us()
      
          - phy: aquantia: fix -ETIMEDOUT PHY probe failure when firmware not
            present
      
          - eth: virtio_net: fix mismatched buf address when unmapping for
            small packets
      
          - eth: stmmac: fix zero-division error when disabling tc cbs
      
          - eth: bonding: fix unnecessary warnings and logs from
            bond_xdp_get_xmit_slave()
      
        Previous releases - always broken:
      
          - netfilter:
              - fix clash resolution for bidirectional flows
              - fix allocation with no memcg accounting
      
          - eth: r8169: add tally counter fields added with RTL8125
      
          - eth: ravb: fix rx and tx frame size limit"
      
      * tag 'net-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (35 commits)
        selftests: netfilter: Avoid hanging ipvs.sh
        kselftest: add test for nfqueue induced conntrack race
        netfilter: nfnetlink_queue: remove old clash resolution logic
        netfilter: nf_tables: missing objects with no memcg accounting
        netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path
        netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS
        netfilter: nf_reject: Fix build warning when CONFIG_BRIDGE_NETFILTER=n
        netfilter: nf_tables: Keep deleted flowtable hooks until after RCU
        docs: tproxy: ignore non-transparent sockets in iptables
        netfilter: ctnetlink: Guard possible unused functions
        selftests: netfilter: nft_tproxy.sh: add tcp tests
        selftests: netfilter: add reverse-clash resolution test case
        netfilter: conntrack: add clash resolution for reverse collisions
        netfilter: nf_nat: don't try nat source port reallocation for reverse dir clash
        selftests/net: packetdrill: increase timing tolerance in debug mode
        usbnet: fix cyclical race on disconnect with work queue
        net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled
        virtio_net: Fix mismatched buf address when unmapping for small packets
        bonding: Fix unnecessary warnings and logs from bond_xdp_get_xmit_slave()
        r8169: add missing MODULE_FIRMWARE entry for RTL8126A rev.b
        ...
      62a0e2fa
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 5e546643
      Linus Torvalds authored
      Pull char / misc driver updates from Greg KH:
       "Here is the "big" set of char/misc and other driver subsystem changes
        for 6.12-rc1.
      
        Lots of changes in here, primarily dominated by the usual IIO driver
        updates and additions, but there are also small driver subsystem
        updates all over the place. Included in here are:
      
         - lots and lots of new IIO drivers and updates to existing ones
      
         - interconnect subsystem updates and new drivers
      
         - nvmem subsystem updates and new drivers
      
         - mhi driver updates
      
         - power supply subsystem updates
      
         - kobj_type const work for many different small subsystems
      
         - comedi driver fix
      
         - coresight subsystem and driver updates
      
         - fpga subsystem improvements
      
         - slimbus fixups
      
         - binder new feature addition for "frozen" notifications
      
         - lots and lots of other small driver updates and cleanups
      
        All of these have been in linux-next for a long time with no reported
        problems"
      
      * tag 'char-misc-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (354 commits)
        greybus: gb-beagleplay: Add firmware upload API
        arm64: dts: ti: k3-am625-beagleplay: Add bootloader-backdoor-gpios to cc1352p7
        dt-bindings: net: ti,cc1352p7: Add bootloader-backdoor-gpios
        MAINTAINERS: Update path for U-Boot environment variables YAML
        nvmem: layouts: add U-Boot env layout
        comedi: ni_routing: tools: Check when the file could not be opened
        ocxl: Remove the unused declarations in headr file
        hpet: Fix the wrong format specifier
        uio: Constify struct kobj_type
        cxl: Constify struct kobj_type
        binder: modify the comment for binder_proc_unlock
        iio: adc: axp20x_adc: add support for AXP717 ADC
        dt-bindings: iio: adc: Add AXP717 compatible
        iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_data
        w1: ds2482: Drop explicit initialization of struct i2c_device_id::driver_data to 0
        tools: iio: rm .*.cmd when make clean
        iio: adc: standardize on formatting for id match tables
        iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor
        bus: mhi: host: pci_generic: Enable EDL trigger for Foxconn modems
        bus: mhi: host: pci_generic: Update EDL firmware path for Foxconn modems
        ...
      5e546643
    • Linus Torvalds's avatar
      Merge tag 'staging-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · b707512b
      Linus Torvalds authored
      Pull staging driver updates from Greg KH:
       "Here is the big set of staging driver cleanups and removals for
        6.12-rc1.
      
        Nothing exciting here, just slow, constant, forward progress in
        removing code and cleaning up some old drivers, along with removing
        one of them that was not being used anymore at all. In discussions
        with some developers this past week, even more deletions will be
        happening for the next major merge window, as we seems to have code
        here that obviously no one is using anymore.
      
        Along with the normal cleanups is the good vme_user code forward
        progress, the one major bright spot in the staging subsystem for code
        that people rely on, and is getting good development behind it.
        Hopefully it can graduate out of staging "soon".
      
        All of these changes have been in linux-next for a long time with no
        reported problems"
      
      * tag 'staging-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (141 commits)
        staging: vt6655: Rename variable apTD1Rings
        staging: vt6655: Rename variable apTD0Rings
        staging: rtl8723bs: remove unused 'poll_cnt' from rtw_set_rpwm()
        staging: rtl8723bs: remove unused cnt from recv_func()
        staging: rtl8723bs: remove unused efuseValue from efuse_OneByteWrite()
        staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attrib
        staging: vt6655: mac.h: Fix possible precedence issue in macros
        staging: rtl8723bs: include: Remove spaces before tabs in rtw_security.h
        staging: rtl8723bs: include: Fix trailing */ position in rtw_security.h
        staging: rtl8723bs: include: Fix indent for else block struct in rtw_security.h
        staging: rtl8723bs: include: Fix indent for struct _byte_ in rtw_security.h
        staging: rtl8723bs: include: Fix use of tabs for indent in rtw_security.h
        staging: rtl8723bs: include: Fix indent for switch block in rtw_security.h
        staging: rtl8723bs: include: Fix indent for switch case in rtw_security.h
        staging: rtl8723bs: include: Fix open brace position in rtw_security.h
        staging: nvec: Use IRQF_NO_AUTOEN flag in request_irq()
        staging: rtl8723bs: Remove unused file rtw_rf.c
        staging: rtl8723bs: Remove unused function rtw_ch2freq
        staging: rtl8723bs: Remove unused files rtw_debug.c and rtw_debug.h
        staging: rtl8723bs: Remove unused function dump_4_regs
        ...
      b707512b
    • Linus Torvalds's avatar
      Merge tag 'tty-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 356a0319
      Linus Torvalds authored
      Pull tty / serial driver updates from Greg KH:
       "Here is the "big" set of tty/serial driver updates for 6.12-rc1.
      
        Nothing major in here, just nice forward progress in the slow cleanup
        of the serial apis, and lots of other driver updates and fixes.
      
        Included in here are:
      
         - serial api updates from Jiri to make things more uniform and sane
      
         - 8250_platform driver cleanups
      
         - samsung serial driver fixes and updates
      
         - qcom-geni serial driver fixes from Johan for the bizarre UART
           engine that that chip seems to have. Hopefully it's in a better
           state now, but hardware designers still seem to come up with more
           ways to make broken UARTS 40+ years after this all should have
           finished.
      
         - sc16is7xx driver updates
      
         - omap 8250 driver updates
      
         - 8250_bcm2835aux driver updates
      
         - a few new serial driver bindings added
      
         - other serial minor driver updates
      
        All of these have been in linux-next for a long time with no reported
        problems"
      
      * tag 'tty-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (65 commits)
        tty: serial: samsung: Fix serial rx on Apple A7-A9
        tty: serial: samsung: Fix A7-A11 serial earlycon SError
        tty: serial: samsung: Use bit manipulation macros for APPLE_S5L_*
        tty: rp2: Fix reset with non forgiving PCIe host bridges
        serial: 8250_aspeed_vuart: Enable module autoloading
        serial: qcom-geni: fix polled console corruption
        serial: qcom-geni: disable interrupts during console writes
        serial: qcom-geni: fix console corruption
        serial: qcom-geni: introduce qcom_geni_serial_poll_bitfield()
        serial: qcom-geni: fix arg types for qcom_geni_serial_poll_bit()
        soc: qcom: geni-se: add GP_LENGTH/IRQ_EN_SET/IRQ_EN_CLEAR registers
        serial: qcom-geni: fix false console tx restart
        serial: qcom-geni: fix fifo polling timeout
        tty: hvc: convert comma to semicolon
        mxser: convert comma to semicolon
        serial: 8250_bcm2835aux: Fix clock imbalance in PM resume
        serial: sc16is7xx: convert bitmask definitions to use BIT() macro
        serial: sc16is7xx: fix copy-paste errors in EFR_SWFLOWx_BIT constants
        serial: sc16is7xx: remove SC16IS7XX_MSR_DELTA_MASK
        serial: xilinx_uartps: Make cdns_rs485_supported static
        ...
      356a0319
    • Linus Torvalds's avatar
      Merge tag 'usb-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 4965ddb1
      Linus Torvalds authored
      Pull USB/Thunderbolt updates from Greg KH:
       "Here is the large set of USB and Thunderbolt changes for 6.12-rc1.
      
        Nothing "major" in here, except for a new 9p network gadget that has
        been worked on for a long time (all of the needed acks are here)
      
        Other than that, it's the usual set of:
      
         - Thunderbolt / USB4 driver updates and additions for new hardware
      
         - dwc3 driver updates and new features added
      
         - xhci driver updates
      
         - typec driver updates
      
         - USB gadget updates and api additions to make some gadgets more
           configurable by userspace
      
         - dwc2 driver updates
      
         - usb phy driver updates
      
         - usbip feature additions
      
         - other minor USB driver updates
      
        All of these have been in linux-next for a long time with no reported
        issues"
      
      * tag 'usb-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (145 commits)
        sub: cdns3: Use predefined PCI vendor ID constant
        sub: cdns2: Use predefined PCI vendor ID constant
        USB: misc: yurex: fix race between read and write
        USB: misc: cypress_cy7c63: check for short transfer
        USB: appledisplay: close race between probe and completion handler
        USB: class: CDC-ACM: fix race between get_serial and set_serial
        usb: r8a66597-hcd: make read-only const arrays static
        usb: typec: ucsi: Fix busy loop on ASUS VivoBooks
        usb: dwc3: rtk: Clean up error code in __get_dwc3_maximum_speed()
        usb: storage: ene_ub6250: Fix right shift warnings
        usb: roles: Improve the fix for a false positive recursive locking complaint
        locking/mutex: Introduce mutex_init_with_key()
        locking/mutex: Define mutex_init() once
        net/9p/usbg: fix CONFIG_USB_GADGET dependency
        usb: xhci: fix loss of data on Cadence xHC
        usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
        usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
        usb: dwc3: imx8mp: add 2 software managed quirk properties for host mode
        usb: host: xhci-plat: Parse xhci-missing_cas_quirk and apply quirk
        usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support
        ...
      4965ddb1
    • Linus Torvalds's avatar
      Merge tag 'hid-for-linus-2024092601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 13882369
      Linus Torvalds authored
      Pull HID fix from Jiri Kosina:
       "A revert of Device Tree binding for Goodix SPI HID driver (while
        keeping ACPI still available), as it conflicted with already existing
        binding and the original submitter didn't respond in time with a fix.
      
        We will be looking into ways how to reintroduce it properly (we have
        to agree on a way how to handle cases where vendor uses the very same
        product ID for I2C and SPI parts, leading to this kind conflict). But
        before that is settled, let's revert the to unbreak everybody else
        (Krzysztof Kozlowski)"
      
      * tag 'hid-for-linus-2024092601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        dt-bindings: input: Revert "dt-bindings: input: Goodix SPI HID Touchscreen"
        HID: hid-goodix: drop unsupported and undocumented DT part
      13882369
    • Linus Torvalds's avatar
      Merge tag 'v6.12-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6 · ac34bb40
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Most are from the recent SMB3.1.1 test event, and also an important
        netfs fix for a cifs mtime write regression
      
         - fix mode reported by stat of readonly directories and files
      
         - DFS (global namespace) related fixes
      
         - fixes for special file support via reparse points
      
         - mount improvement and reconnect fix
      
         - fix for noisy log message on umount
      
         - two netfs related fixes, one fixing a recent regression, and add
           new write tracepoint"
      
      * tag 'v6.12-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
        netfs, cifs: Fix mtime/ctime update for mmapped writes
        cifs: update internal version number
        smb: client: print failed session logoffs with FYI
        cifs: Fix reversion of the iter in cifs_readv_receive().
        smb3: fix incorrect mode displayed for read-only files
        smb: client: fix parsing of device numbers
        smb: client: set correct device number on nfs reparse points
        smb: client: propagate error from cifs_construct_tcon()
        smb: client: fix DFS failover in multiuser mounts
        cifs: Make the write_{enter,done,err} tracepoints display netfs info
        smb: client: fix DFS interlink failover
        smb: client: improve purging of cached referrals
        smb: client: avoid unnecessary reconnects when refreshing referrals
      ac34bb40
    • Linus Torvalds's avatar
      Merge tag 'probes-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 5159938e
      Linus Torvalds authored
      Pull probes updates from Masami Hiramatsu:
      
       - uprobes: make trace_uprobe->nhit counter a per-CPU one
      
         This makes uprobe event's hit counter per-CPU for improving
         scalability on multi-core environment
      
       - kprobes: Remove obsoleted declaration for init_test_probes
      
         Remove unused init_test_probes() from header
      
       - Raw tracepoint probe supports raw tracepoint events on modules:
           - add a function for iterating over all tracepoints in all modules
           - add a function for iterating over tracepoints in a module
           - support raw tracepoint events on modules
           - support raw tracepoints on future loaded modules
           - add a test for tracepoint events on modules"
      
      * tag 'probes-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        sefltests/tracing: Add a test for tracepoint events on modules
        tracing/fprobe: Support raw tracepoints on future loaded modules
        tracing/fprobe: Support raw tracepoint events on modules
        tracepoint: Support iterating tracepoints in a loading module
        tracepoint: Support iterating over tracepoints on modules
        kprobes: Remove obsoleted declaration for init_test_probes
        uprobes: turn trace_uprobe's nhit counter to be per-CPU one
      5159938e
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 0181f8c8
      Linus Torvalds authored
      Pull virtio updates from Michael Tsirkin:
       "Several new features here:
      
         - virtio-balloon supports new stats
      
         - vdpa supports setting mac address
      
         - vdpa/mlx5 suspend/resume as well as MKEY ops are now faster
      
         - virtio_fs supports new sysfs entries for queue info
      
         - virtio/vsock performance has been improved
      
        And fixes, cleanups all over the place"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (34 commits)
        vsock/virtio: avoid queuing packets when intermediate queue is empty
        vsock/virtio: refactor virtio_transport_send_pkt_work
        fw_cfg: Constify struct kobj_type
        vdpa/mlx5: Postpone MR deletion
        vdpa/mlx5: Introduce init/destroy for MR resources
        vdpa/mlx5: Rename mr_mtx -> lock
        vdpa/mlx5: Extract mr members in own resource struct
        vdpa/mlx5: Rename function
        vdpa/mlx5: Delete direct MKEYs in parallel
        vdpa/mlx5: Create direct MKEYs in parallel
        MAINTAINERS: add virtio-vsock driver in the VIRTIO CORE section
        virtio_fs: add sysfs entries for queue information
        virtio_fs: introduce virtio_fs_put_locked helper
        vdpa: Remove unused declarations
        vdpa/mlx5: Parallelize VQ suspend/resume for CVQ MQ command
        vdpa/mlx5: Small improvement for change_num_qps()
        vdpa/mlx5: Keep notifiers during suspend but ignore
        vdpa/mlx5: Parallelize device resume
        vdpa/mlx5: Parallelize device suspend
        vdpa/mlx5: Use async API for vq modify commands
        ...
      0181f8c8
    • Rob Herring's avatar
      dt-bindings: gpio: ep9301: Add missing "#interrupt-cells" to examples · e3eb39e6
      Rob Herring authored
      Enabling dtc interrupt_provider check reveals the examples are missing
      the "#interrupt-cells" property as it is a dependency of
      "interrupt-controller".
      
      Some of the indentation is off, so fix that too.
      Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
      Reviewed-by: default avatarNikita Shubin <nikita.shubin@maquefel.me>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      e3eb39e6
    • Paolo Abeni's avatar
      Merge tag 'nf-24-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · aef3a58b
      Paolo Abeni authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      v2: with kdoc fixes per Paolo Abeni.
      
      The following patchset contains Netfilter fixes for net:
      
      Patch #1 and #2 handle an esoteric scenario: Given two tasks sending UDP
      packets to one another, two packets of the same flow in each direction
      handled by different CPUs that result in two conntrack objects in NEW
      state, where reply packet loses race. Then, patch #3 adds a testcase for
      this scenario. Series from Florian Westphal.
      
      1) NAT engine can falsely detect a port collision if it happens to pick
         up a reply packet as NEW rather than ESTABLISHED. Add extra code to
         detect this and suppress port reallocation in this case.
      
      2) To complete the clash resolution in the reply direction, extend conntrack
         logic to detect clashing conntrack in the reply direction to existing entry.
      
      3) Adds a test case.
      
      Then, an assorted list of fixes follow:
      
      4) Add a selftest for tproxy, from Antonio Ojea.
      
      5) Guard ctnetlink_*_size() functions under
         #if defined(CONFIG_NETFILTER_NETLINK_GLUE_CT) || defined(CONFIG_NF_CONNTRACK_EVENTS)
         From Andy Shevchenko.
      
      6) Use -m socket --transparent in iptables tproxy documentation.
         From XIE Zhibang.
      
      7) Call kfree_rcu() when releasing flowtable hooks to address race with
         netlink dump path, from Phil Sutter.
      
      8) Fix compilation warning in nf_reject with CONFIG_BRIDGE_NETFILTER=n.
         From Simon Horman.
      
      9) Guard ctnetlink_label_size() under CONFIG_NF_CONNTRACK_EVENTS which
         is its only user, to address a compilation warning. From Simon Horman.
      
      10) Use rcu-protected list iteration over basechain hooks from netlink
          dump path.
      
      11) Fix memcg for nf_tables, use GFP_KERNEL_ACCOUNT is not complete.
      
      12) Remove old nfqueue conntrack clash resolution. Instead trying to
          use same destination address consistently which requires double DNAT,
          use the existing clash resolution which allows clashing packets
          go through with different destination. Antonio Ojea originally
          reported an issue from the postrouting chain, I proposed a fix:
          https://lore.kernel.org/netfilter-devel/ZuwSwAqKgCB2a51-@calendula/T/
          which he reported it did not work for him.
      
      13) Adds a selftest for patch 12.
      
      14) Fixes ipvs.sh selftest.
      
      netfilter pull request 24-09-26
      
      * tag 'nf-24-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        selftests: netfilter: Avoid hanging ipvs.sh
        kselftest: add test for nfqueue induced conntrack race
        netfilter: nfnetlink_queue: remove old clash resolution logic
        netfilter: nf_tables: missing objects with no memcg accounting
        netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path
        netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS
        netfilter: nf_reject: Fix build warning when CONFIG_BRIDGE_NETFILTER=n
        netfilter: nf_tables: Keep deleted flowtable hooks until after RCU
        docs: tproxy: ignore non-transparent sockets in iptables
        netfilter: ctnetlink: Guard possible unused functions
        selftests: netfilter: nft_tproxy.sh: add tcp tests
        selftests: netfilter: add reverse-clash resolution test case
        netfilter: conntrack: add clash resolution for reverse collisions
        netfilter: nf_nat: don't try nat source port reallocation for reverse dir clash
      ====================
      
      Link: https://patch.msgid.link/20240926110717.102194-1-pablo@netfilter.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      aef3a58b
    • Nikita Shubin's avatar
      MAINTAINERS: Update EP93XX ARM ARCHITECTURE maintainer · a481b9d2
      Nikita Shubin authored
      Add myself as maintainer of EP93XX ARCHITECTURE.
      
      CC: Alexander Sverdlin <alexander.sverdlin@gmail.com>
      CC: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarNikita Shubin <nikita.shubin@maquefel.me>
      Acked-by: default avatarAlexander Sverdlin <alexander.sverdlin@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      a481b9d2
    • Lukas Bulwahn's avatar
      soc: ep93xx: drop reference to removed EP93XX_SOC_COMMON config · 84db6f27
      Lukas Bulwahn authored
      Commit 6eab0ce6 ("soc: Add SoC driver for Cirrus ep93xx") adds the
      config EP93XX_SOC referring to the config EP93XX_SOC_COMMON.
      
      Within the same patch series of the commit above, the commit 046322f1
      ("ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms") then removes the
      config EP93XX_SOC_COMMON. With that the reference to this config is
      obsolete.
      
      Simplify the expression in the EP93XX_SOC config definition.
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@redhat.com>
      Reviewed-by: default avatarNikita Shubin <nikita.shubin@maquefel.me>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      84db6f27
    • Phil Sutter's avatar
      selftests: netfilter: Avoid hanging ipvs.sh · fc786304
      Phil Sutter authored
      If the client can't reach the server, the latter remains listening
      forever. Kill it after 5s of waiting.
      
      Fixes: 867d2190 ("selftests: netfilter: add ipvs test script")
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      fc786304
    • Florian Westphal's avatar
      kselftest: add test for nfqueue induced conntrack race · e306e373
      Florian Westphal authored
      The netfilter race happens when two packets with the same tuple are DNATed
      and enqueued with nfqueue in the postrouting hook.
      
      Once one of the packet is reinjected it may be DNATed again to a different
      destination, but the conntrack entry remains the same and the return packet
      was dropped.
      
      Based on earlier patch from Antonio Ojea.
      
      Link: https://bugzilla.netfilter.org/show_bug.cgi?id=1766Co-developed-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      e306e373
    • Florian Westphal's avatar
      netfilter: nfnetlink_queue: remove old clash resolution logic · 8af79d3e
      Florian Westphal authored
      For historical reasons there are two clash resolution spots in
      netfilter, one in nfnetlink_queue and one in conntrack core.
      
      nfnetlink_queue one was added first: If a colliding entry is found, NAT
      NAT transformation is reversed by calling nat engine again with altered
      tuple.
      
      See commit 368982cd ("netfilter: nfnetlink_queue: resolve clash for
      unconfirmed conntracks") for details.
      
      One problem is that nf_reroute() won't take an action if the queueing
      doesn't occur in the OUTPUT hook, i.e. when queueing in forward or
      postrouting, packet will be sent via the wrong path.
      
      Another problem is that the scenario addressed (2nd UDP packet sent with
      identical addresses while first packet is still being processed) can also
      occur without any nfqueue involvement due to threaded resolvers doing
      A and AAAA requests back-to-back.
      
      This lead us to add clash resolution logic to the conntrack core, see
      commit 6a757c07 ("netfilter: conntrack: allow insertion of clashing
      entries").  Instead of fixing the nfqueue based logic, lets remove it
      and let conntrack core handle this instead.
      
      Retain the ->update hook for sake of nfqueue based conntrack helpers.
      We could axe this hook completely but we'd have to split confirm and
      helper logic again, see commit ee04805f ("netfilter: conntrack: make
      conntrack userspace helpers work again").
      
      This SHOULD NOT be backported to kernels earlier than v5.6; they lack
      adequate clash resolution handling.
      
      Patch was originally written by Pablo Neira Ayuso.
      Reported-by: default avatarAntonio Ojea <aojea@google.com>
      Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1766Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Tested-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      8af79d3e
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: missing objects with no memcg accounting · 69e687ce
      Pablo Neira Ayuso authored
      Several ruleset objects are still not using GFP_KERNEL_ACCOUNT for
      memory accounting, update them. This includes:
      
      - catchall elements
      - compat match large info area
      - log prefix
      - meta secctx
      - numgen counters
      - pipapo set backend datastructure
      - tunnel private objects
      
      Fixes: 33758c89 ("memcg: enable accounting for nft objects")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      69e687ce
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: use rcu chain hook list iterator from netlink dump path · 4ffcf5ca
      Pablo Neira Ayuso authored
      Lockless iteration over hook list is possible from netlink dump path,
      use rcu variant to iterate over the hook list as is done with flowtable
      hooks.
      
      Fixes: b9703ed4 ("netfilter: nf_tables: support for adding new devices to an existing netdev chain")
      Reported-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      4ffcf5ca
    • Simon Horman's avatar
      netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS · e1f1ee0e
      Simon Horman authored
      Only provide ctnetlink_label_size when it is used,
      which is when CONFIG_NF_CONNTRACK_EVENTS is configured.
      
      Flagged by clang-18 W=1 builds as:
      
      .../nf_conntrack_netlink.c:385:19: warning: unused function 'ctnetlink_label_size' [-Wunused-function]
        385 | static inline int ctnetlink_label_size(const struct nf_conn *ct)
            |                   ^~~~~~~~~~~~~~~~~~~~
      
      The condition on CONFIG_NF_CONNTRACK_LABELS being removed by
      this patch guards compilation of non-trivial implementations
      of ctnetlink_dump_labels() and ctnetlink_label_size().
      
      However, this is not necessary as each of these functions
      will always return 0 if CONFIG_NF_CONNTRACK_LABELS is not defined
      as each function starts with the equivalent of:
      
      	struct nf_conn_labels *labels = nf_ct_labels_find(ct);
      
      	if (!labels)
      		return 0;
      
      And nf_ct_labels_find always returns NULL if CONFIG_NF_CONNTRACK_LABELS
      is not enabled.  So I believe that the compiler optimises the code away
      in such cases anyway.
      
      Found by inspection.
      Compile tested only.
      
      Originally splitted in two patches, Pablo Neira Ayuso collapsed them and
      added Fixes: tag.
      
      Fixes: 0ceabd83 ("netfilter: ctnetlink: deliver labels to userspace")
      Link: https://lore.kernel.org/netfilter-devel/20240909151712.GZ2097826@kernel.org/Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      e1f1ee0e
    • Simon Horman's avatar
      netfilter: nf_reject: Fix build warning when CONFIG_BRIDGE_NETFILTER=n · fc56878c
      Simon Horman authored
      If CONFIG_BRIDGE_NETFILTER is not enabled, which is the case for x86_64
      defconfig, then building nf_reject_ipv4.c and nf_reject_ipv6.c with W=1
      using gcc-14 results in the following warnings, which are treated as
      errors:
      
      net/ipv4/netfilter/nf_reject_ipv4.c: In function 'nf_send_reset':
      net/ipv4/netfilter/nf_reject_ipv4.c:243:23: error: variable 'niph' set but not used [-Werror=unused-but-set-variable]
        243 |         struct iphdr *niph;
            |                       ^~~~
      cc1: all warnings being treated as errors
      net/ipv6/netfilter/nf_reject_ipv6.c: In function 'nf_send_reset6':
      net/ipv6/netfilter/nf_reject_ipv6.c:286:25: error: variable 'ip6h' set but not used [-Werror=unused-but-set-variable]
        286 |         struct ipv6hdr *ip6h;
            |                         ^~~~
      cc1: all warnings being treated as errors
      
      Address this by reducing the scope of these local variables to where
      they are used, which is code only compiled when CONFIG_BRIDGE_NETFILTER
      enabled.
      
      Compile tested and run through netfilter selftests.
      Reported-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Closes: https://lore.kernel.org/netfilter-devel/20240906145513.567781-1-andriy.shevchenko@linux.intel.com/Signed-off-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      fc56878c
    • Phil Sutter's avatar
      netfilter: nf_tables: Keep deleted flowtable hooks until after RCU · 642c89c4
      Phil Sutter authored
      Documentation of list_del_rcu() warns callers to not immediately free
      the deleted list item. While it seems not necessary to use the
      RCU-variant of list_del() here in the first place, doing so seems to
      require calling kfree_rcu() on the deleted item as well.
      
      Fixes: 3f0465a9 ("netfilter: nf_tables: dynamically allocate hooks per net_device in flowtables")
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      642c89c4
    • 谢致邦 (XIE Zhibang)'s avatar
      docs: tproxy: ignore non-transparent sockets in iptables · aa758763
      谢致邦 (XIE Zhibang) authored
      The iptables example was added in commit d2f26037 (netfilter: Add
      documentation for tproxy, 2008-10-08), but xt_socket 'transparent'
      option was added in commit a31e1ffd (netfilter: xt_socket: added new
      revision of the 'socket' match supporting flags, 2009-06-09).
      
      Now add the 'transparent' option to the iptables example to ignore
      non-transparent sockets, which is also consistent with the nft example.
      Signed-off-by: default avatar谢致邦 (XIE Zhibang) <Yeking@Red54.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      aa758763
    • Andy Shevchenko's avatar
      netfilter: ctnetlink: Guard possible unused functions · 2cadd3b1
      Andy Shevchenko authored
      Some of the functions may be unused (CONFIG_NETFILTER_NETLINK_GLUE_CT=n
      and CONFIG_NF_CONNTRACK_EVENTS=n), it prevents kernel builds with clang,
      `make W=1` and CONFIG_WERROR=y:
      
      net/netfilter/nf_conntrack_netlink.c:657:22: error: unused function 'ctnetlink_acct_size' [-Werror,-Wunused-function]
        657 | static inline size_t ctnetlink_acct_size(const struct nf_conn *ct)
            |                      ^~~~~~~~~~~~~~~~~~~
      net/netfilter/nf_conntrack_netlink.c:667:19: error: unused function 'ctnetlink_secctx_size' [-Werror,-Wunused-function]
        667 | static inline int ctnetlink_secctx_size(const struct nf_conn *ct)
            |                   ^~~~~~~~~~~~~~~~~~~~~
      net/netfilter/nf_conntrack_netlink.c:683:22: error: unused function 'ctnetlink_timestamp_size' [-Werror,-Wunused-function]
        683 | static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct)
            |                      ^~~~~~~~~~~~~~~~~~~~~~~~
      
      Fix this by guarding possible unused functions with ifdeffery.
      
      See also commit 6863f564 ("kbuild: allow Clang to find unused static
      inline functions for W=1 build").
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      2cadd3b1
    • Antonio Ojea's avatar
      selftests: netfilter: nft_tproxy.sh: add tcp tests · 7e37e0ea
      Antonio Ojea authored
      The TPROXY functionality is widely used, however, there are only mptcp
      selftests covering this feature.
      
      The selftests represent the most common scenarios and can also be used
      as selfdocumentation of the feature.
      
      UDP and TCP testcases are split in different files because of the
      different nature of the protocols, specially due to the challenges that
      present to reliable test UDP due to the connectionless nature of the
      protocol. UDP only covers the scenarios involving the prerouting hook.
      
      The UDP tests are signfinicantly slower than the TCP ones, hence they
      use a larger timeout, it takes 20 seconds to run the full UDP suite
      on a 48 vCPU Intel(R) Xeon(R) CPU @2.60GHz.
      Signed-off-by: default avatarAntonio Ojea <aojea@google.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      7e37e0ea
    • Florian Westphal's avatar
      selftests: netfilter: add reverse-clash resolution test case · a57856c0
      Florian Westphal authored
      Add test program that is sending UDP packets in both directions
      and check that packets arrive without source port modification.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      a57856c0
    • Florian Westphal's avatar
      netfilter: conntrack: add clash resolution for reverse collisions · a4e6a103
      Florian Westphal authored
      Given existing entry:
      ORIGIN: a:b -> c:d
      REPLY:  c:d -> a:b
      
      And colliding entry:
      ORIGIN: c:d -> a:b
      REPLY:  a:b -> c:d
      
      The colliding ct (and the associated skb) get dropped on insert.
      Permit this by checking if the colliding entry matches the reply
      direction.
      
      Happens when both ends send packets at same time, both requests are picked
      up as NEW, rather than NEW for the 'first' and 'ESTABLISHED' for the
      second packet.
      
      This is an esoteric condition, as ruleset must permit NEW connections
      in either direction and both peers must already have a bidirectional
      traffic flow at the time conntrack gets enabled.
      
      Allow the 'reverse' skb to pass and assign the existing (clashing)
      entry.
      
      While at it, also drop the extra 'dying' check, this is already
      tested earlier by the calling function.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      a4e6a103