1. 08 Jun, 2024 4 commits
  2. 07 Jun, 2024 13 commits
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · e60721bf
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - interrupt handling and Kconfig fixes for gpio-tqmx86
      
       - add a buffer for storing output values in gpio-tqmx86 as reading back
         the registers always returns the input values
      
       - add missing MODULE_DESCRIPTION()s to several GPIO drivers
      
      * tag 'gpio-fixes-for-v6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: add missing MODULE_DESCRIPTION() macros
        gpio: tqmx86: fix broken IRQ_TYPE_EDGE_BOTH interrupt type
        gpio: tqmx86: store IRQ trigger type and unmask status separately
        gpio: tqmx86: introduce shadow register for GPIO output value
        gpio: tqmx86: fix typo in Kconfig label
      e60721bf
    • Linus Torvalds's avatar
      Merge tag 'block-6.10-20240607' of git://git.kernel.dk/linux · 602079a0
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - Fix for null_blk block size validation (Andreas)
      
       - NVMe pull request via Keith:
            - Use reserved tags for special fabrics operations (Chunguang)
            - Persistent Reservation status masking fix (Weiwen)
      
      * tag 'block-6.10-20240607' of git://git.kernel.dk/linux:
        null_blk: fix validation of block size
        nvme: fix nvme_pr_* status code parsing
        nvme-fabrics: use reserved tag for reg read/write command
      602079a0
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.10-20240607' of git://git.kernel.dk/linux · e3391589
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
      
       - Fix a locking order issue with setting max async thread workers
         (Hagar)
      
       - Fix for a NULL pointer dereference for failed async flagged requests
         using ring provided buffers. This doesn't affect the current kernel,
         but it does affect older kernels, and is being queued up for 6.10
         just to make the stable process easier (me)
      
       - Fix for NAPI timeout calculations for how long to busy poll, and
         subsequently how much to sleep post that if a wait timeout is passed
         in (me)
      
       - Fix for a regression in this release cycle, where we could end up
         using a partially unitialized match value for io-wq (Su)
      
      * tag 'io_uring-6.10-20240607' of git://git.kernel.dk/linux:
        io_uring: fix possible deadlock in io_register_iowq_max_workers()
        io_uring/io-wq: avoid garbage value of 'match' in io_wq_enqueue()
        io_uring/napi: fix timeout calculation
        io_uring: check for non-NULL file pointer in io_file_can_poll()
      e3391589
    • Linus Torvalds's avatar
      Merge tag 'for-6.10-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 07978330
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - fix handling of folio private changes.
      
         The private value holds pointer to our extent buffer structure
         representing a metadata range. Release and create of the range was
         not properly synchronized when updating the private bit which ended
         up in double folio_put, leading to all sorts of breakage
      
       - fix a crash, reported as duplicate key in metadata, but caused by a
         race of fsync and size extending write. Requires prealloc target
         range + fsync and other conditions (log tree state, timing)
      
       - fix leak of qgroup extent records after transaction abort
      
      * tag 'for-6.10-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: protect folio::private when attaching extent buffer folios
        btrfs: fix leak of qgroup extent records after transaction abort
        btrfs: fix crash on racing fsync and size-extending write into prealloc
      07978330
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · eecba7c0
      Linus Torvalds authored
      Pull nfsd fix from Chuck Lever:
      
       - Fix an occasional memory overwrite caused by a fix added in 6.10
      
      * tag 'nfsd-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
        SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
      eecba7c0
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 0a02756d
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - Another fix to avoid allocating pages that overlap with ERR_PTR,
         which manifests on rv32
      
       - A revert for the badaccess patch I incorrectly picked up an early
         version of
      
      * tag 'riscv-for-linus-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        Revert "riscv: mm: accelerate pagefault when badaccess"
        riscv: fix overlap of allocated page and PTR_ERR
      0a02756d
    • Linus Torvalds's avatar
      Merge tag 's390-6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 8d6b029e
      Linus Torvalds authored
      Pull s390 fixes from Alexander Gordeev:
      
       - Do not create PT_LOAD program header for the kenel image when the
         virtual memory informaton in OS_INFO data is not available. That
         fixes stand-alone dump failures against kernels that do not provide
         the virtual memory informaton
      
       - Add KVM s390 shared zeropage selftest
      
      * tag 's390-6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        KVM: s390x: selftests: Add shared zeropage test
        s390/crash: Do not use VM info if os_info does not have it
      8d6b029e
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 8d437867
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
      
       - Fix spurious CPU hotplug warning message from SETEND emulation code
      
       - Fix the build when GCC wasn't inlining our I/O accessor internals
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64/io: add constant-argument check
        arm64: armv8_deprecated: Fix warning in isndep cpuhp starting process
      8d437867
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.10-3' of... · 96e09b8f
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
      
       -  Default silead touchscreen driver to 10 fingers and drop 10 finger
          setting from all DMI quirks. More of a cleanup then a pure fix, but
          since the DMI quirks always get updated through the fixes branch
          this avoids conflicts.
      
       -  Kconfig fix for randconfig builds
      
       -  dell-smbios: Fix wrong token data in sysfs
      
       -  amd-hsmp: Fix driver poking unsupported hw when loaded manually
      
      * tag 'platform-drivers-x86-v6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86/amd/hsmp: Check HSMP support on AMD family of processors
        platform/x86: dell-smbios: Simplify error handling
        platform/x86: dell-smbios: Fix wrong token data in sysfs
        platform/x86: yt2-1380: add CONFIG_EXTCON dependency
        platform/x86: touchscreen_dmi: Use 2-argument strscpy()
        platform/x86: touchscreen_dmi: Drop "silead,max-fingers" property
        Input: silead - Always support 10 fingers
      96e09b8f
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · f24b46ea
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
       "Core:
      
         - Make iommu-dma code recognize 'force_aperture' again
      
         - Fix for potential NULL-ptr dereference from iommu_sva_bind_device()
           return value
      
        AMD IOMMU fixes:
      
         - Fix lockdep splat for invalid wait context
      
         - Add feature bit check before enabling PPR
      
         - Make workqueue name fit into buffer
      
         - Fix memory leak in sysfs code"
      
      * tag 'iommu-fixes-v6.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/amd: Fix Invalid wait context issue
        iommu/amd: Check EFR[EPHSup] bit before enabling PPR
        iommu/amd: Fix workqueue name
        iommu: Return right value in iommu_sva_bind_device()
        iommu/dma: Fix domain init
        iommu/amd: Fix sysfs leak in iommu init
      f24b46ea
    • Linus Torvalds's avatar
      Merge tag 'ata-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux · e693c502
      Linus Torvalds authored
      Pull ata fix from Niklas Cassel:
      
       - Fix a regression for the PATA MacIO driver were it would fail to
         probe because of the recent changes of initializing the limits in
         SCSI core
      
      * tag 'ata-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux:
        ata: pata_macio: Fix max_segment_size with PAGE_SIZE == 64K
      e693c502
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2024-06-07' of https://gitlab.freedesktop.org/drm/kernel · 2e32d580
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Weekly fixes: vmwgfx leads the way this week, with minor changes in xe
        and amdgpu and a couple of other small fixes.
      
        Seems quiet enough.
      
        xe:
         - Update the LMTT when freeing VF GT config
      
        amdgpu:
         - Fix shutdown issues on some SMU 13.x platforms
         - Silence some UBSAN flexible array warnings
      
        panel:
         - sitronix-st7789v: handle of_drm_get_panel_orientation failing
           error
      
        vmwgfx:
         - filter modes greater than available graphics memory
         - fix 3D vs STDU enable
         - remove STDU logic from mode valid
         - logging fix
         - memcmp pointers fix
         - remove unused struct
         - screen target lifetime fix
      
        komeda:
         - unused struct removal"
      
      * tag 'drm-fixes-2024-06-07' of https://gitlab.freedesktop.org/drm/kernel:
        drm/vmwgfx: Don't memcmp equivalent pointers
        drm/vmwgfx: remove unused struct 'vmw_stdu_dma'
        drm/vmwgfx: Don't destroy Screen Target when CRTC is enabled but inactive
        drm/vmwgfx: Standardize use of kibibytes when logging
        drm/vmwgfx: Remove STDU logic from generic mode_valid function
        drm/vmwgfx: 3D disabled should not effect STDU memory limits
        drm/vmwgfx: Filter modes which exceed graphics memory
        drm/amdgpu/pptable: Fix UBSAN array-index-out-of-bounds
        drm/amd: Fix shutdown (again) on some SMU v13.0.4/11 platforms
        drm/xe/pf: Update the LMTT when freeing VF GT config
        drm/panel: sitronix-st7789v: Add check for of_drm_get_panel_orientation
        drm/komeda: remove unused struct 'gamma_curve_segment'
      2e32d580
    • Jeff Johnson's avatar
      gpio: add missing MODULE_DESCRIPTION() macros · 64054eb7
      Jeff Johnson authored
      On x86, make allmodconfig && make W=1 C=1 reports:
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpio/gpio-gw-pld.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpio/gpio-mc33880.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/gpio/gpio-pcf857x.o
      
      Add the missing invocations of the MODULE_DESCRIPTION() macro,
      including the one missing in gpio-pl061.c, which is not built for x86.
      Signed-off-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
      Link: https://lore.kernel.org/r/20240606-md-drivers-gpio-v1-1-cb42d240ca5c@quicinc.comSigned-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
      64054eb7
  3. 06 Jun, 2024 23 commits
    • Dave Airlie's avatar
      Merge tag 'drm-misc-next-fixes-2024-06-07' of... · eb55943a
      Dave Airlie authored
      Merge tag 'drm-misc-next-fixes-2024-06-07' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
      
      drm-misc-next-fixes for v6.10-rc3:
      - Single unused struct removal that should have been in -fixes.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/0251b6ae-bffa-44b2-b698-955712c25a27@linux.intel.com
      eb55943a
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2024-06-07' of... · 26033424
      Dave Airlie authored
      Merge tag 'drm-misc-fixes-2024-06-07' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
      
      drm-misc-fixes for v6.10-rc3:
      - Robustness fixes for vmwgfx.
      - Error check for of_drm_get_panel_orientation failing in
        sitronix-st7789v.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/d5645d00-a8cf-47d9-a2a0-4ff55842fc7d@linux.intel.com
      26033424
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-6.10-2024-06-06' of... · 2d421831
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-6.10-2024-06-06' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-6.10-2024-06-06:
      
      amdgpu:
      - Fix shutdown issues on some SMU 13.x platforms
      - Silence some UBSAN flexible array warnings
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240606192348.3620805-1-alexander.deucher@amd.com
      2d421831
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 8a929806
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "The core change is to detect unusually large number of VPD pages
        (caused by device manufacturers having an endiannes issue) and reject
        them rather than trying to parse a huge non-existent array.
      
        The remaining fixes are in drivers the most user visible of which is
        the ALUA state transition recognition (leads to intermittent I/O
        errors in some situations otherwise)"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ufs: mcq: Fix error output and clean up ufshcd_mcq_abort()
        scsi: core: Handle devices which return an unusually large VPD page count
        scsi: mpt3sas: Add missing kerneldoc parameter descriptions
        scsi: qedf: Set qed_slowpath_params to zero before use
        scsi: qedf: Wait for stag work during unload
        scsi: qedf: Don't process stag work during unload and recovery
        scsi: sr: Fix unintentional arithmetic wraparound
        scsi: core: alua: I/O errors for ALUA state transitions
        scsi: mpi3mr: Use proper format specifier in mpi3mr_sas_port_add()
      8a929806
    • Linus Torvalds's avatar
      Merge tag 'pci-v6.10-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci · d91e6562
      Linus Torvalds authored
      Pull pci fix from Bjorn Helgaas:
      
       - Revert lockdep checking on locking that protects device resets from
         user-space config accesses; it exposed issues for which fixes are in
         the works but are too risky for this cycle (Dan Williams)
      
      * tag 'pci-v6.10-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
        PCI: Revert the cfg_access_lock lockdep mechanism
      d91e6562
    • Qu Wenruo's avatar
      btrfs: protect folio::private when attaching extent buffer folios · f3a5367c
      Qu Wenruo authored
      [BUG]
      Since v6.8 there are rare kernel crashes reported by various people,
      the common factor is bad page status error messages like this:
      
        BUG: Bad page state in process kswapd0  pfn:d6e840
        page: refcount:0 mapcount:0 mapping:000000007512f4f2 index:0x2796c2c7c
        pfn:0xd6e840
        aops:btree_aops ino:1
        flags: 0x17ffffe0000008(uptodate|node=0|zone=2|lastcpupid=0x3fffff)
        page_type: 0xffffffff()
        raw: 0017ffffe0000008 dead000000000100 dead000000000122 ffff88826d0be4c0
        raw: 00000002796c2c7c 0000000000000000 00000000ffffffff 0000000000000000
        page dumped because: non-NULL mapping
      
      [CAUSE]
      Commit 09e6cef1 ("btrfs: refactor alloc_extent_buffer() to
      allocate-then-attach method") changes the sequence when allocating a new
      extent buffer.
      
      Previously we always called grab_extent_buffer() under
      mapping->i_private_lock, to ensure the safety on modification on
      folio::private (which is a pointer to extent buffer for regular
      sectorsize).
      
      This can lead to the following race:
      
      Thread A is trying to allocate an extent buffer at bytenr X, with 4
      4K pages, meanwhile thread B is trying to release the page at X + 4K
      (the second page of the extent buffer at X).
      
                 Thread A                |                 Thread B
      -----------------------------------+-------------------------------------
                                         | btree_release_folio()
      				   | | This is for the page at X + 4K,
      				   | | Not page X.
      				   | |
      alloc_extent_buffer()              | |- release_extent_buffer()
      |- filemap_add_folio() for the     | |  |- atomic_dec_and_test(eb->refs)
      |  page at bytenr X (the first     | |  |
      |  page).                          | |  |
      |  Which returned -EEXIST.         | |  |
      |                                  | |  |
      |- filemap_lock_folio()            | |  |
      |  Returned the first page locked. | |  |
      |                                  | |  |
      |- grab_extent_buffer()            | |  |
      |  |- atomic_inc_not_zero()        | |  |
      |  |  Returned false               | |  |
      |  |- folio_detach_private()       | |  |- folio_detach_private() for X
      |     |- folio_test_private()      | |     |- folio_test_private()
            |  Returned true             | |     |  Returned true
            |- folio_put()               |       |- folio_put()
      
      Now there are two puts on the same folio at folio X, leading to refcount
      underflow of the folio X, and eventually causing the BUG_ON() on the
      page->mapping.
      
      The condition is not that easy to hit:
      
      - The release must be triggered for the middle page of an eb
        If the release is on the same first page of an eb, page lock would kick
        in and prevent the race.
      
      - folio_detach_private() has a very small race window
        It's only between folio_test_private() and folio_clear_private().
      
      That's exactly when mapping->i_private_lock is used to prevent such race,
      and commit 09e6cef1 ("btrfs: refactor alloc_extent_buffer() to
      allocate-then-attach method") screwed that up.
      
      At that time, I thought the page lock would kick in as
      filemap_release_folio() also requires the page to be locked, but forgot
      the filemap_release_folio() only locks one page, not all pages of an
      extent buffer.
      
      [FIX]
      Move all the code requiring i_private_lock into
      attach_eb_folio_to_filemap(), so that everything is done with proper
      lock protection.
      
      Furthermore to prevent future problems, add an extra
      lockdep_assert_locked() to ensure we're holding the proper lock.
      
      To reproducer that is able to hit the race (takes a few minutes with
      instrumented code inserting delays to alloc_extent_buffer()):
      
        #!/bin/sh
        drop_caches () {
      	  while(true); do
      		  echo 3 > /proc/sys/vm/drop_caches
      		  echo 1 > /proc/sys/vm/compact_memory
      	  done
        }
      
        run_tar () {
      	  while(true); do
      		  for x in `seq 1 80` ; do
      			  tar cf /dev/zero /mnt > /dev/null &
      		  done
      		  wait
      	  done
        }
      
        mkfs.btrfs -f -d single -m single /dev/vda
        mount -o noatime /dev/vda /mnt
        # create 200,000 files, 1K each
        ./simoop -n 200000 -E -f 1k /mnt
        drop_caches &
        (run_tar)
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Link: https://lore.kernel.org/linux-btrfs/CAHk-=wgt362nGfScVOOii8cgKn2LVVHeOvOA7OBwg1OwbuJQcw@mail.gmail.com/Reported-by: default avatarMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
      Link: https://lore.kernel.org/lkml/CABXGCsPktcHQOvKTbPaTwegMExije=Gpgci5NW=hqORo-s7diA@mail.gmail.com/Reported-by: default avatarToralf Förster <toralf.foerster@gmx.de>
      Link: https://lore.kernel.org/linux-btrfs/e8b3311c-9a75-4903-907f-fc0f7a3fe423@gmx.de/
      Reported-by: syzbot+f80b066392366b4af85e@syzkaller.appspotmail.com
      Fixes: 09e6cef1 ("btrfs: refactor alloc_extent_buffer() to allocate-then-attach method")
      CC: stable@vger.kernel.org # 6.8+
      CC: Chris Mason <clm@fb.com>
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      f3a5367c
    • Linus Torvalds's avatar
      Merge tag 'net-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · d30d0e49
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from BPF and big collection of fixes for WiFi core and
        drivers.
      
        Current release - regressions:
      
         - vxlan: fix regression when dropping packets due to invalid src
           addresses
      
         - bpf: fix a potential use-after-free in bpf_link_free()
      
         - xdp: revert support for redirect to any xsk socket bound to the
           same UMEM as it can result in a corruption
      
         - virtio_net:
            - add missing lock protection when reading return code from
              control_buf
            - fix false-positive lockdep splat in DIM
            - Revert "wifi: wilc1000: convert list management to RCU"
      
         - wifi: ath11k: fix error path in ath11k_pcic_ext_irq_config
      
        Previous releases - regressions:
      
         - rtnetlink: make the "split" NLM_DONE handling generic, restore the
           old behavior for two cases where we started coalescing those
           messages with normal messages, breaking sloppily-coded userspace
      
         - wifi:
            - cfg80211: validate HE operation element parsing
            - cfg80211: fix 6 GHz scan request building
            - mt76: mt7615: add missing chanctx ops
            - ath11k: move power type check to ASSOC stage, fix connecting to
              6 GHz AP
            - ath11k: fix WCN6750 firmware crash caused by 17 num_vdevs
            - rtlwifi: ignore IEEE80211_CONF_CHANGE_RETRY_LIMITS
            - iwlwifi: mvm: fix a crash on 7265
      
        Previous releases - always broken:
      
         - ncsi: prevent multi-threaded channel probing, a spec violation
      
         - vmxnet3: disable rx data ring on dma allocation failure
      
         - ethtool: init tsinfo stats if requested, prevent unintentionally
           reporting all-zero stats on devices which don't implement any
      
         - dst_cache: fix possible races in less common IPv6 features
      
         - tcp: auth: don't consider TCP_CLOSE to be in TCP_AO_ESTABLISHED
      
         - ax25: fix two refcounting bugs
      
         - eth: ionic: fix kernel panic in XDP_TX action
      
        Misc:
      
         - tcp: count CLOSE-WAIT sockets for TCP_MIB_CURRESTAB"
      
      * tag 'net-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (107 commits)
        selftests: net: lib: set 'i' as local
        selftests: net: lib: avoid error removing empty netns name
        selftests: net: lib: support errexit with busywait
        net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
        ipv6: fix possible race in __fib6_drop_pcpu_from()
        af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill().
        af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen().
        af_unix: Use skb_queue_empty_lockless() in unix_release_sock().
        af_unix: Use unix_recvq_full_lockless() in unix_stream_connect().
        af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen.
        af_unix: Annotate data-races around sk->sk_sndbuf.
        af_unix: Annotate data-races around sk->sk_state in UNIX_DIAG.
        af_unix: Annotate data-race of sk->sk_state in unix_stream_read_skb().
        af_unix: Annotate data-races around sk->sk_state in sendmsg() and recvmsg().
        af_unix: Annotate data-race of sk->sk_state in unix_accept().
        af_unix: Annotate data-race of sk->sk_state in unix_stream_connect().
        af_unix: Annotate data-races around sk->sk_state in unix_write_space() and poll().
        af_unix: Annotate data-race of sk->sk_state in unix_inq_len().
        af_unix: Annodate data-races around sk->sk_state for writers.
        af_unix: Set sk->sk_state under unix_state_lock() for truly disconencted peer.
        ...
      d30d0e49
    • Linus Torvalds's avatar
      Merge tag 'tomoyo-pr-20240606' of git://git.code.sf.net/p/tomoyo/tomoyo · 2faf6332
      Linus Torvalds authored
      Pull tomoyo fixlet from Tetsuo Handa:
       "Single patch to update project links, no behavior changes"
      
      * tag 'tomoyo-pr-20240606' of git://git.code.sf.net/p/tomoyo/tomoyo:
        tomoyo: update project links
      2faf6332
    • Linus Torvalds's avatar
      Merge tag 'efi-fixes-for-v6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi · a34adf60
      Linus Torvalds authored
      Pull EFI fixes from Ard Biesheuvel:
      
       - Ensure that .discard sections are really discarded in the EFI zboot
         image build
      
       - Return proper error numbers from efi-pstore
      
       - Add __nocfi annotations to EFI runtime wrappers
      
      * tag 'efi-fixes-for-v6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
        efi: Add missing __nocfi annotations to runtime wrappers
        efi: pstore: Return proper errors on UEFI failures
        efi/libstub: zboot.lds: Discard .discard sections
      a34adf60
    • Jakub Kicinski's avatar
      Merge branch 'selftests-net-lib-small-fixes' · 27bc8654
      Jakub Kicinski authored
      Matthieu Baerts says:
      
      ====================
      selftests: net: lib: small fixes
      
      While looking at using 'lib.sh' for the MPTCP selftests [1], we found
      some small issues with 'lib.sh'. Here they are:
      
      - Patch 1: fix 'errexit' (set -e) support with busywait. 'errexit' is
        supported in some functions, not all. A fix for v6.8+.
      
      - Patch 2: avoid confusing error messages linked to the cleaning part
        when the netns setup fails. A fix for v6.8+.
      
      - Patch 3: set a variable as local to avoid accidentally changing the
        value of a another one with the same name on the caller side. A fix
        for v6.10-rc1+.
      
      Link: https://lore.kernel.org/mptcp/5f4615c3-0621-43c5-ad25-55747a4350ce@kernel.org/T/ [1]
      ====================
      
      Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      27bc8654
    • Matthieu Baerts (NGI0)'s avatar
      selftests: net: lib: set 'i' as local · 84a8bc3e
      Matthieu Baerts (NGI0) authored
      Without this, the 'i' variable declared before could be overridden by
      accident, e.g.
      
        for i in "${@}"; do
            __ksft_status_merge "${i}"  ## 'i' has been modified
            foo "${i}"                  ## using 'i' with an unexpected value
        done
      
      After a quick look, it looks like 'i' is currently not used after having
      been modified in __ksft_status_merge(), but still, better be safe than
      sorry. I saw this while modifying the same file, not because I suspected
      an issue somewhere.
      
      Fixes: 596c8819 ("selftests: forwarding: Have RET track kselftest framework constants")
      Acked-by: default avatarGeliang Tang <geliang@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-3-b3afadd368c9@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      84a8bc3e
    • Matthieu Baerts (NGI0)'s avatar
      selftests: net: lib: avoid error removing empty netns name · 79322174
      Matthieu Baerts (NGI0) authored
      If there is an error to create the first netns with 'setup_ns()',
      'cleanup_ns()' will be called with an empty string as first parameter.
      
      The consequences is that 'cleanup_ns()' will try to delete an invalid
      netns, and wait 20 seconds if the netns list is empty.
      
      Instead of just checking if the name is not empty, convert the string
      separated by spaces to an array. Manipulating the array is cleaner, and
      calling 'cleanup_ns()' with an empty array will be a no-op.
      
      Fixes: 25ae948b ("selftests/net: add lib.sh")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarGeliang Tang <geliang@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-2-b3afadd368c9@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      79322174
    • Matthieu Baerts (NGI0)'s avatar
      selftests: net: lib: support errexit with busywait · 41b02ea4
      Matthieu Baerts (NGI0) authored
      If errexit is enabled ('set -e'), loopy_wait -- or busywait and others
      using it -- will stop after the first failure.
      
      Note that if the returned status of loopy_wait is checked, and even if
      errexit is enabled, Bash will not stop at the first error.
      
      Fixes: 25ae948b ("selftests/net: add lib.sh")
      Cc: stable@vger.kernel.org
      Acked-by: default avatarGeliang Tang <geliang@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-1-b3afadd368c9@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      41b02ea4
    • Michael Ellerman's avatar
      ata: pata_macio: Fix max_segment_size with PAGE_SIZE == 64K · 09fe2bfa
      Michael Ellerman authored
      The pata_macio driver advertises a max_segment_size of 0xff00, because
      the hardware doesn't cope with requests >= 64K.
      
      However the SCSI core requires max_segment_size to be at least
      PAGE_SIZE, which is a problem for pata_macio when the kernel is built
      with 64K pages.
      
      In older kernels the SCSI core would just increase the segment size to
      be equal to PAGE_SIZE, however since the commit tagged below it causes a
      warning and the device fails to probe:
      
        WARNING: CPU: 0 PID: 26 at block/blk-settings.c:202 .blk_validate_limits+0x2f8/0x35c
        CPU: 0 PID: 26 Comm: kworker/u4:1 Not tainted 6.10.0-rc1 #1
        Hardware name: PowerMac7,2 PPC970 0x390202 PowerMac
        ...
        NIP .blk_validate_limits+0x2f8/0x35c
        LR  .blk_alloc_queue+0xc0/0x2f8
        Call Trace:
          .blk_alloc_queue+0xc0/0x2f8
          .blk_mq_alloc_queue+0x60/0xf8
          .scsi_alloc_sdev+0x208/0x3c0
          .scsi_probe_and_add_lun+0x314/0x52c
          .__scsi_add_device+0x170/0x1a4
          .ata_scsi_scan_host+0x2bc/0x3e4
          .async_port_probe+0x6c/0xa0
          .async_run_entry_fn+0x60/0x1bc
          .process_one_work+0x228/0x510
          .worker_thread+0x360/0x530
          .kthread+0x134/0x13c
          .start_kernel_thread+0x10/0x14
        ...
        scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
      
      Although the hardware can't cope with a 64K segment, the driver
      already deals with that internally by splitting large requests in
      pata_macio_qc_prep(). That is how the driver has managed to function
      until now on 64K kernels.
      
      So fix the driver to advertise a max_segment_size of 64K, which avoids
      the warning and keeps the SCSI core happy.
      
      Fixes: afd53a3d ("scsi: core: Initialize scsi midlayer limits before allocating the queue")
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Closes: https://lore.kernel.org/all/ce2bf6af-4382-4fe1-b392-cc6829f5ceb2@roeck-us.net/Reported-by: default avatarDoru Iorgulescu <doru.iorgulescu1@gmail.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218858Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
      09fe2bfa
    • Su Hui's avatar
      net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() · 0dcc53ab
      Su Hui authored
      Clang static checker (scan-build) warning:
      net/ethtool/ioctl.c:line 2233, column 2
      Called function pointer is null (null dereference).
      
      Return '-EOPNOTSUPP' when 'ops->get_ethtool_phy_stats' is NULL to fix
      this typo error.
      
      Fixes: 201ed315 ("net/ethtool/ioctl: split ethtool_get_phy_stats into multiple helpers")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Reviewed-by: default avatarHariprasad Kelam <hkelam@marvell.com>
      Link: https://lore.kernel.org/r/20240605034742.921751-1-suhui@nfschina.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      0dcc53ab
    • Eric Dumazet's avatar
      ipv6: fix possible race in __fib6_drop_pcpu_from() · b01e1c03
      Eric Dumazet authored
      syzbot found a race in __fib6_drop_pcpu_from() [1]
      
      If compiler reads more than once (*ppcpu_rt),
      second read could read NULL, if another cpu clears
      the value in rt6_get_pcpu_route().
      
      Add a READ_ONCE() to prevent this race.
      
      Also add rcu_read_lock()/rcu_read_unlock() because
      we rely on RCU protection while dereferencing pcpu_rt.
      
      [1]
      
      Oops: general protection fault, probably for non-canonical address 0xdffffc0000000012: 0000 [#1] PREEMPT SMP KASAN PTI
      KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
      CPU: 0 PID: 7543 Comm: kworker/u8:17 Not tainted 6.10.0-rc1-syzkaller-00013-g2bfcfd58 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
      Workqueue: netns cleanup_net
       RIP: 0010:__fib6_drop_pcpu_from.part.0+0x10a/0x370 net/ipv6/ip6_fib.c:984
      Code: f8 48 c1 e8 03 80 3c 28 00 0f 85 16 02 00 00 4d 8b 3f 4d 85 ff 74 31 e8 74 a7 fa f7 49 8d bf 90 00 00 00 48 89 f8 48 c1 e8 03 <80> 3c 28 00 0f 85 1e 02 00 00 49 8b 87 90 00 00 00 48 8b 0c 24 48
      RSP: 0018:ffffc900040df070 EFLAGS: 00010206
      RAX: 0000000000000012 RBX: 0000000000000001 RCX: ffffffff89932e16
      RDX: ffff888049dd1e00 RSI: ffffffff89932d7c RDI: 0000000000000091
      RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000007
      R10: 0000000000000001 R11: 0000000000000006 R12: ffff88807fa080b8
      R13: fffffbfff1a9a07d R14: ffffed100ff41022 R15: 0000000000000001
      FS:  0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b32c26000 CR3: 000000005d56e000 CR4: 00000000003526f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
        __fib6_drop_pcpu_from net/ipv6/ip6_fib.c:966 [inline]
        fib6_drop_pcpu_from net/ipv6/ip6_fib.c:1027 [inline]
        fib6_purge_rt+0x7f2/0x9f0 net/ipv6/ip6_fib.c:1038
        fib6_del_route net/ipv6/ip6_fib.c:1998 [inline]
        fib6_del+0xa70/0x17b0 net/ipv6/ip6_fib.c:2043
        fib6_clean_node+0x426/0x5b0 net/ipv6/ip6_fib.c:2205
        fib6_walk_continue+0x44f/0x8d0 net/ipv6/ip6_fib.c:2127
        fib6_walk+0x182/0x370 net/ipv6/ip6_fib.c:2175
        fib6_clean_tree+0xd7/0x120 net/ipv6/ip6_fib.c:2255
        __fib6_clean_all+0x100/0x2d0 net/ipv6/ip6_fib.c:2271
        rt6_sync_down_dev net/ipv6/route.c:4906 [inline]
        rt6_disable_ip+0x7ed/0xa00 net/ipv6/route.c:4911
        addrconf_ifdown.isra.0+0x117/0x1b40 net/ipv6/addrconf.c:3855
        addrconf_notify+0x223/0x19e0 net/ipv6/addrconf.c:3778
        notifier_call_chain+0xb9/0x410 kernel/notifier.c:93
        call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:1992
        call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
        call_netdevice_notifiers net/core/dev.c:2044 [inline]
        dev_close_many+0x333/0x6a0 net/core/dev.c:1585
        unregister_netdevice_many_notify+0x46d/0x19f0 net/core/dev.c:11193
        unregister_netdevice_many net/core/dev.c:11276 [inline]
        default_device_exit_batch+0x85b/0xae0 net/core/dev.c:11759
        ops_exit_list+0x128/0x180 net/core/net_namespace.c:178
        cleanup_net+0x5b7/0xbf0 net/core/net_namespace.c:640
        process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
        process_scheduled_works kernel/workqueue.c:3312 [inline]
        worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
        kthread+0x2c1/0x3a0 kernel/kthread.c:389
        ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
        ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
      
      Fixes: d52d3997 ("ipv6: Create percpu rt6_info")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/r/20240604193549.981839-1-edumazet@google.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b01e1c03
    • Paolo Abeni's avatar
      Merge branch 'af_unix-fix-lockless-access-of-sk-sk_state-and-others-fields' · 411c0ea6
      Paolo Abeni authored
      Kuniyuki Iwashima says:
      
      ====================
      af_unix: Fix lockless access of sk->sk_state and others fields.
      
      The patch 1 fixes a bug where SOCK_DGRAM's sk->sk_state is changed
      to TCP_CLOSE even if the socket is connect()ed to another socket.
      
      The rest of this series annotates lockless accesses to the following
      fields.
      
        * sk->sk_state
        * sk->sk_sndbuf
        * net->unx.sysctl_max_dgram_qlen
        * sk->sk_receive_queue.qlen
        * sk->sk_shutdown
      
      Note that with this series there is skb_queue_empty() left in
      unix_dgram_disconnected() that needs to be changed to lockless
      version, and unix_peer(other) access there should be protected
      by unix_state_lock().
      
      This will require some refactoring, so another series will follow.
      
      Changes:
        v2:
          * Patch 1: Fix wrong double lock
      
        v1: https://lore.kernel.org/netdev/20240603143231.62085-1-kuniyu@amazon.com/
      ====================
      
      Link: https://lore.kernel.org/r/20240604165241.44758-1-kuniyu@amazon.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      411c0ea6
    • Kuniyuki Iwashima's avatar
      af_unix: Annotate data-race of sk->sk_shutdown in sk_diag_fill(). · efaf24e3
      Kuniyuki Iwashima authored
      While dumping sockets via UNIX_DIAG, we do not hold unix_state_lock().
      
      Let's use READ_ONCE() to read sk->sk_shutdown.
      
      Fixes: e4e541a8 ("sock-diag: Report shutdown for inet and unix sockets (v2)")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      efaf24e3
    • Kuniyuki Iwashima's avatar
      af_unix: Use skb_queue_len_lockless() in sk_diag_show_rqlen(). · 5d915e58
      Kuniyuki Iwashima authored
      We can dump the socket queue length via UNIX_DIAG by specifying
      UDIAG_SHOW_RQLEN.
      
      If sk->sk_state is TCP_LISTEN, we return the recv queue length,
      but here we do not hold recvq lock.
      
      Let's use skb_queue_len_lockless() in sk_diag_show_rqlen().
      
      Fixes: c9da99e6 ("unix_diag: Fixup RQLEN extension report")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      5d915e58
    • Kuniyuki Iwashima's avatar
      af_unix: Use skb_queue_empty_lockless() in unix_release_sock(). · 83690b82
      Kuniyuki Iwashima authored
      If the socket type is SOCK_STREAM or SOCK_SEQPACKET, unix_release_sock()
      checks the length of the peer socket's recvq under unix_state_lock().
      
      However, unix_stream_read_generic() calls skb_unlink() after releasing
      the lock.  Also, for SOCK_SEQPACKET, __skb_try_recv_datagram() unlinks
      skb without unix_state_lock().
      
      Thues, unix_state_lock() does not protect qlen.
      
      Let's use skb_queue_empty_lockless() in unix_release_sock().
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      83690b82
    • Kuniyuki Iwashima's avatar
      af_unix: Use unix_recvq_full_lockless() in unix_stream_connect(). · 45d872f0
      Kuniyuki Iwashima authored
      Once sk->sk_state is changed to TCP_LISTEN, it never changes.
      
      unix_accept() takes advantage of this characteristics; it does not
      hold the listener's unix_state_lock() and only acquires recvq lock
      to pop one skb.
      
      It means unix_state_lock() does not prevent the queue length from
      changing in unix_stream_connect().
      
      Thus, we need to use unix_recvq_full_lockless() to avoid data-race.
      
      Now we remove unix_recvq_full() as no one uses it.
      
      Note that we can remove READ_ONCE() for sk->sk_max_ack_backlog in
      unix_recvq_full_lockless() because of the following reasons:
      
        (1) For SOCK_DGRAM, it is a written-once field in unix_create1()
      
        (2) For SOCK_STREAM and SOCK_SEQPACKET, it is changed under the
            listener's unix_state_lock() in unix_listen(), and we hold
            the lock in unix_stream_connect()
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      45d872f0
    • Kuniyuki Iwashima's avatar
      af_unix: Annotate data-race of net->unx.sysctl_max_dgram_qlen. · bd9f2d05
      Kuniyuki Iwashima authored
      net->unx.sysctl_max_dgram_qlen is exposed as a sysctl knob and can be
      changed concurrently.
      
      Let's use READ_ONCE() in unix_create1().
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      bd9f2d05
    • Kuniyuki Iwashima's avatar
      af_unix: Annotate data-races around sk->sk_sndbuf. · b0632e53
      Kuniyuki Iwashima authored
      sk_setsockopt() changes sk->sk_sndbuf under lock_sock(), but it's
      not used in af_unix.c.
      
      Let's use READ_ONCE() to read sk->sk_sndbuf in unix_writable(),
      unix_dgram_sendmsg(), and unix_stream_sendmsg().
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b0632e53