1. 29 Jul, 2023 2 commits
    • Linus Torvalds's avatar
      Merge tag 'pm-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 3632f421
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "Fix the arming of wakeup IRQs in the generic wakeup IRQ code
        (wakeirq), drop unused functions from it and fix up a driver using it
        and trying to work around the IRQ arming issue in a questionable way
        (Johan Hovold)"
      
      * tag 'pm-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        serial: qcom-geni: drop bogus runtime pm state update
        PM: sleep: wakeirq: drop unused enable helpers
        PM: sleep: wakeirq: fix wake irq arming
      3632f421
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v6.5-rc4' of... · 2f4effd8
      Linus Torvalds authored
      Merge tag 'hwmon-for-v6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
      
       - k10temp: Display negative temperatures for industrial processors
      
       - pmbus core: Fix deadlock, NULL pointer dereference, and chip enable
         detection
      
       - nct7802: Do not display PECI1 temperature if disabled
      
       - nct6775: Fix IN scaling factors and feature detection for
         NCT6798/6799
      
       - oxp-sensors: Fix race condition during device attribute creation
      
       - aquacomputer_d5next: Fix incorrect PWM value readout
      
      * tag 'hwmon-for-v6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (k10temp) Enable AMD3255 Proc to show negative temperature
        hwmon: (pmbus_core) Fix Deadlock in pmbus_regulator_get_status
        hwmon: (pmbus_core) Fix NULL pointer dereference
        hwmon: (pmbus_core) Fix pmbus_is_enabled()
        hwmon: (nct7802) Fix for temp6 (PECI1) processed even if PECI1 disabled
        hwmon: (nct6775) Fix IN scaling factors for 6798/6799
        hwmon: (oxp-sensors) Move tt_toggle attribute to dev_groups
        hwmon: (aquacomputer_d5next) Fix incorrect PWM value readout
        hwmon: (nct6775) Fix register for nct6799
      2f4effd8
  2. 28 Jul, 2023 23 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · c06f9091
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Several smaller driver fixes and a core RDMA CM regression fix:
      
         - Fix improperly accepting flags from userspace in mlx4
      
         - Add missing DMA barriers for irdma
      
         - Fix two kcsan warnings in irdma
      
         - Report the correct CQ op code to userspace in irdma
      
         - Report the correct MW bind error code for irdma
      
         - Load the destination address in RDMA CM to resolve a recent
           regression
      
         - Fix a QP regression in mthca
      
         - Remove a race processing completions in bnxt_re resulting in a
           crash
      
         - Fix driver unloading races with interrupts and tasklets in bnxt_re
      
         - Fix missing error unwind in rxe"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/irdma: Report correct WC error
        RDMA/irdma: Fix op_type reporting in CQEs
        RDMA/rxe: Fix an error handling path in rxe_bind_mw()
        RDMA/bnxt_re: Fix hang during driver unload
        RDMA/bnxt_re: Prevent handling any completions after qp destroy
        RDMA/mthca: Fix crash when polling CQ for shared QPs
        RDMA/core: Update CMA destination address on rdma_resolve_addr
        RDMA/irdma: Fix data race on CQP request done
        RDMA/irdma: Fix data race on CQP completion stats
        RDMA/irdma: Add missing read barriers
        RDMA/mlx4: Make check for invalid flags stricter
      c06f9091
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-v6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd · 2b17e90d
      Linus Torvalds authored
      Pull tpm fixes from Jarkko Sakkinen:
       "I picked up three small scale updates that I think would improve the
        quality of the release"
      
      * tag 'tpmdd-v6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
        tpm_tis: Explicitly check for error code
        tpm: Switch i2c drivers back to use .probe()
        security: keys: perform capable check only on privileged operations
      2b17e90d
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · f837f0a3
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
      
       - A couple of SME updates for recent fixes (one of which went to
         stable): reverting the flushing of the SME hardware state along with
         the thread flushing and making sure we have the correct vector length
         before reallocating.
      
       - An ACPI/IORT fix to avoid skipping ID mappings whose "number of IDs"
         is 0 (the spec reports the number of IDs in the mapping range minus
         1).
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        ACPI/IORT: Remove erroneous id_count check in iort_node_get_rmr_info()
        arm64/sme: Set new vector length before reallocating
        arm64/fpsimd: Don't flush SME register hardware state along with thread
      f837f0a3
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.5a-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 81eef890
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - A fix for a performance problem in QubesOS, adding a way to drain the
         queue of grants experiencing delayed unmaps faster
      
       - A patch enabling the use of static event channels from user mode,
         which was omitted when introducing supporting static event channels
      
       - A fix for a problem where Xen related code didn't check properly for
         running in a Xen environment, resulting in a WARN splat
      
      * tag 'for-linus-6.5a-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen: speed up grant-table reclaim
        xen/evtchn: Introduce new IOCTL to bind static evtchn
        xenbus: check xen_domain in xenbus_probe_initcall
      81eef890
    • Alexander Steffen's avatar
      tpm_tis: Explicitly check for error code · 513253f8
      Alexander Steffen authored
      recv_data either returns the number of received bytes, or a negative value
      representing an error code. Adding the return value directly to the total
      number of received bytes therefore looks a little weird, since it might add
      a negative error code to a sum of bytes.
      
      The following check for size < expected usually makes the function return
      ETIME in that case, so it does not cause too many problems in practice. But
      to make the code look cleaner and because the caller might still be
      interested in the original error code, explicitly check for the presence of
      an error code and pass that through.
      
      Cc: stable@vger.kernel.org
      Fixes: cb535425 ("[PATCH] tpm: spacing cleanups 2")
      Signed-off-by: default avatarAlexander Steffen <Alexander.Steffen@infineon.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      513253f8
    • Uwe Kleine-König's avatar
      tpm: Switch i2c drivers back to use .probe() · be6f48a7
      Uwe Kleine-König authored
      After commit b8a1a4cd ("i2c: Provide a temporary .probe_new()
      call-back type"), all drivers being converted to .probe_new() and then
      03c835f4 ("i2c: Switch .probe() to not take an id parameter")
      convert back to (the new) .probe() to be able to eventually drop
      .probe_new() from struct i2c_driver.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      be6f48a7
    • Christian Göttsche's avatar
      security: keys: perform capable check only on privileged operations · 2d7f105e
      Christian Göttsche authored
      If the current task fails the check for the queried capability via
      `capable(CAP_SYS_ADMIN)` LSMs like SELinux generate a denial message.
      Issuing such denial messages unnecessarily can lead to a policy author
      granting more privileges to a subject than needed to silence them.
      
      Reorder CAP_SYS_ADMIN checks after the check whether the operation is
      actually privileged.
      Signed-off-by: default avatarChristian Göttsche <cgzones@googlemail.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      2d7f105e
    • Linus Torvalds's avatar
      Merge tag 'ceph-for-6.5-rc4' of https://github.com/ceph/ceph-client · e62e26d3
      Linus Torvalds authored
      Pull ceph fixes from Ilya Dryomov:
       "A patch to reduce the potential for erroneous RBD exclusive lock
        blocklisting (fencing) with a couple of prerequisites and a fixup to
        prevent metrics from being sent to the MDS even just once after that
        has been disabled by the user. All marked for stable"
      
      * tag 'ceph-for-6.5-rc4' of https://github.com/ceph/ceph-client:
        rbd: retrieve and check lock owner twice before blocklisting
        rbd: harden get_lock_owner_info() a bit
        rbd: make get_lock_owner_info() return a single locker or NULL
        ceph: never send metrics if disable_send_metrics is set
      e62e26d3
    • Linus Torvalds's avatar
      Merge tag '9p-fixes-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs · 28d79b74
      Linus Torvalds authored
      Pull 9p fixes from Eric Van Hensbergen:
       "Misc set of fixes for 9p.
      
        Most of these clean up warnings we've gotten out of compilation tools,
        but several of them were from inspection while hunting down a couple
        of regressions.
      
        The most important one is 75b39682 ("fs/9p: remove unnecessary and
        overrestrictive check") which caused a regression for some folks by
        restricting mmap in any case where writeback caches weren't enabled.
      
        Most of the other bugs caught via inspection were type mismatches"
      
      * tag '9p-fixes-6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
        fs/9p: Remove unused extern declaration
        9p: remove dead stores (variable set again without being read)
        9p: virtio: skip incrementing unused variable
        9p: virtio: make sure 'offs' is initialized in zc_request
        9p: virtio: fix unlikely null pointer deref in handle_rerror
        9p: fix ignored return value in v9fs_dir_release
        fs/9p: remove unnecessary invalidate_inode_pages2
        fs/9p: fix type mismatch in file cache mode helper
        fs/9p: fix typo in comparison logic for cache mode
        fs/9p: remove unnecessary and overrestrictive check
        fs/9p: Fix a datatype used with V9FS_DIRECT_IO
      28d79b74
    • Linus Torvalds's avatar
      Merge tag 'block-6.5-2023-07-28' of git://git.kernel.dk/linux · 818680d1
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A few fixes that should go into the current kernel release, mainly:
      
         - Set of fixes for dasd (Stefan)
      
         - Handle interruptible waits returning because of a signal for ublk
           (Ming)"
      
      * tag 'block-6.5-2023-07-28' of git://git.kernel.dk/linux:
        ublk: return -EINTR if breaking from waiting for existed users in DEL_DEV
        ublk: fail to recover device if queue setup is interrupted
        ublk: fail to start device if queue setup is interrupted
        block: Fix a source code comment in include/uapi/linux/blkzoned.h
        s390/dasd: print copy pair message only for the correct error
        s390/dasd: fix hanging device after request requeue
        s390/dasd: use correct number of retries for ERP requests
        s390/dasd: fix hanging device after quiesce/resume
      818680d1
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.5-2023-07-28' of git://git.kernel.dk/linux · 9c655058
      Linus Torvalds authored
      Pull io_uring fix from Jens Axboe:
       "Just a single tweak to a patch from last week, to avoid having idle
        cqring waits be attributed as iowait"
      
      * tag 'io_uring-6.5-2023-07-28' of git://git.kernel.dk/linux:
        io_uring: gate iowait schedule on having pending requests
      9c655058
    • Linus Torvalds's avatar
      Merge tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd · 0299a13a
      Linus Torvalds authored
      Pull iommufd fixes from Jason Gunthorpe:
       "Two user triggerable problems:
      
         - Syzkaller found a way to trigger a WARN_ON and leak memory by
           racing destroy with other actions
      
         - There is still a bug in the "batch carry" stuff that gets invoked
           for complex cases with accesses and unmapping of huge pages. The
           test suite found this (triggers rarely)"
      
      * tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd:
        iommufd: Set end correctly when doing batch carry
        iommufd: IOMMUFD_DESTROY should not increase the refcount
      0299a13a
    • Linus Torvalds's avatar
      Merge tag 'for-6.5/dm-fixes' of... · c75981a1
      Linus Torvalds authored
      Merge tag 'for-6.5/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper fixes from Mike Snitzer:
      
       - Fix double free on memory allocation failure in DM integrity target's
         integrity_recalc()
      
       - Fix locking in DM raid target's raid_ctr() and around call to
         md_stop()
      
       - Fix DM cache target's cleaner policy to always allow work to be
         queued for writeback; even if cache isn't idle.
      
      * tag 'for-6.5/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm cache policy smq: ensure IO doesn't prevent cleaner policy progress
        dm raid: protect md_stop() with 'reconfig_mutex'
        dm raid: clean up four equivalent goto tags in raid_ctr()
        dm raid: fix missing reconfig_mutex unlock in raid_ctr() error paths
        dm integrity: fix double free on memory allocation failure
      c75981a1
    • Linus Torvalds's avatar
      Merge tag 'sound-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 6fb9f7f8
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A collection of device-specific small fixes such as ASoC Realtek codec
        fixes for PM issues, ASoC nau8821 quirk additions, and usual HD- and
        USB-audio quirks"
      
      * tag 'sound-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda/realtek: Support ASUS G713PV laptop
        ALSA: usb-audio: Update for native DSD support quirks
        ALSA: usb-audio: Add quirk for Microsoft Modern Wireless Headset
        ALSA: hda/relatek: Enable Mute LED on HP 250 G8
        ASoC: atmel: Fix the 8K sample parameter in I2SC master
        ASoC: rt711-sdca: fix for JD event handling in ClockStop Mode0
        ASoC: rt711: fix for JD event handling in ClockStop Mode0
        ASoC: rt722-sdca: fix for JD event handling in ClockStop Mode0
        ASoC: rt712-sdca: fix for JD event handling in ClockStop Mode0
        ASoc: codecs: ES8316: Fix DMIC config
        ASoC: rt5682-sdw: fix for JD event handling in ClockStop Mode0
        ASoC: wm8904: Fill the cache for WM8904_ADC_TEST_0 register
        ASoC: nau8821: Add DMI quirk mechanism for active-high jack-detect
        ASoC: da7219: Check for failure reading AAD IRQ events
        ASoC: da7219: Flush pending AAD IRQ when suspending
        ALSA: seq: remove redundant unsigned comparison to zero
        ASoC: fsl_spdif: Silence output on stop
      6fb9f7f8
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2023-07-28' of git://anongit.freedesktop.org/drm/drm · 17bf3df9
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Regular scheduled fixes, msm and amdgpu leading the way, with some
        i915 and a single misc fbdev, all seems fine.
      
        fbdev:
         - remove unused function
      
        amdgpu:
         - gfxhub partition fix
         - Fix error handling in psp_sw_init()
         - SMU13 fix
         - DCN 3.1 fix
         - DCN 3.2 fix
         - Fix for display PHY programming sequence
         - DP MST error handling fix
         - GFX 9.4.3 fix
      
        amdkfd:
         - GFX11 trap handling fix
      
        i915:
         - Use shmem for dpt objects
         - Fix an error handling path in igt_write_huge()
      
        msm:
         - display:
            - Fix to correct the UBWC programming for decoder version 4.3 seen
              on SM8550
            - Add the missing flush and fetch bits for DMA4 and DMA5 SSPPs.
            - Fix to drop the unused dpu_core_perf_data_bus_id enum from the
              code
            - Drop the unused dsi_phy_14nm_17mA_regulators from QCM 2290 DSI
              cfg.
         - gpu:
            - Fix warn splat for newer devices without revn
            - Remove name/revn for a690.. we shouldn't be populating these for
              newer devices, for consistency, but it slipped through review
            - Fix a6xx gpu snapshot BINDLESS_DATA size (was listed in bytes
              instead of dwords, causing AHB faults on a6xx gen4/a660-family)
            - Disallow submit with fence id 0"
      
      * tag 'drm-fixes-2023-07-28' of git://anongit.freedesktop.org/drm/drm: (22 commits)
        drm/msm: Disallow submit with fence id 0
        drm/amdgpu: Restore HQD persistent state register
        drm/amd/display: Unlock on error path in dm_handle_mst_sideband_msg_ready_event()
        drm/amd/display: Exit idle optimizations before attempt to access PHY
        drm/amd/display: Don't apply FIFO resync W/A if rdivider = 0
        drm/amd/display: Guard DCN31 PHYD32CLK logic against chip family
        drm/amd/smu: use AverageGfxclkFrequency* to replace previous GFX Curr Clock
        drm/amd: Fix an error handling mistake in psp_sw_init()
        drm/amdgpu: Fix infinite loop in gfxhub_v1_2_xcc_gart_enable (v2)
        drm/amdkfd: fix trap handling work around for debugging
        drm/fb-helper: Remove unused inline function drm_fb_helper_defio_init()
        drm/i915: Fix an error handling path in igt_write_huge()
        drm/i915/dpt: Use shmem for dpt objects
        drm/msm: Fix hw_fence error path cleanup
        drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()
        drm/msm/adreno: Fix snapshot BINDLESS_DATA size
        drm/msm/a690: Remove revn and name
        drm/msm/adreno: Fix warn splat for devices without revn
        drm/msm/dsi: Drop unused regulators from QCM2290 14nm DSI PHY config
        drm/msm/dpu: drop enum dpu_core_perf_data_bus_id
        ...
      17bf3df9
    • Linus Torvalds's avatar
      Merge tag 'cxl-fixes-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl · f24767ca
      Linus Torvalds authored
      Pull cxl fixes from Vishal Verma:
      
       - Update MAINTAINERS for cxl
      
       - A few static analysis fixes
      
       - Fix a Kconfig dependency for CONFIG_FW_LOADER
      
      * tag 'cxl-fixes-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
        tools/testing/cxl: Remove unused SZ_512G macro
        cxl/acpi: Return 'rc' instead of '0' in cxl_parse_cfmws()
        cxl/acpi: Fix a use-after-free in cxl_parse_cfmws()
        cxl: Update MAINTAINERS
        cxl/mem: Fix a double shift bug
        cxl: fix CONFIG_FW_LOADER dependency
      f24767ca
    • Mike Rapoport (IBM)'s avatar
      Revert "mm,memblock: reset memblock.reserved to system init state to prevent UAF" · c442a957
      Mike Rapoport (IBM) authored
      This reverts commit 9e46e4dc.
      
      kbuild reports a warning in memblock_remove_region() because of a false
      positive caused by partial reset of the memblock state.
      
      Doing the full reset will remove the false positives, but will allow
      late use of memblock_free() to go unnoticed, so it is better to revert
      the offending commit.
      
         WARNING: CPU: 0 PID: 1 at mm/memblock.c:352 memblock_remove_region (kbuild/src/x86_64/mm/memblock.c:352 (discriminator 1))
         Modules linked in:
         CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.5.0-rc3-00001-g9e46e4dc #2
         RIP: 0010:memblock_remove_region (kbuild/src/x86_64/mm/memblock.c:352 (discriminator 1))
         Call Trace:
           memblock_discard (kbuild/src/x86_64/mm/memblock.c:383)
           page_alloc_init_late (kbuild/src/x86_64/include/linux/find.h:208 kbuild/src/x86_64/include/linux/nodemask.h:266 kbuild/src/x86_64/mm/mm_init.c:2405)
           kernel_init_freeable (kbuild/src/x86_64/init/main.c:1325 kbuild/src/x86_64/init/main.c:1546)
           kernel_init (kbuild/src/x86_64/init/main.c:1439)
           ret_from_fork (kbuild/src/x86_64/arch/x86/kernel/process.c:145)
           ret_from_fork_asm (kbuild/src/x86_64/arch/x86/entry/entry_64.S:298)
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Closes: https://lore.kernel.org/oe-lkp/202307271656.447aa17e-oliver.sang@intel.comSigned-off-by: default avatar"Mike Rapoport (IBM)" <rppt@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c442a957
    • Jann Horn's avatar
      mm/mempolicy: Take VMA lock before replacing policy · 6c21e066
      Jann Horn authored
      mbind() calls down into vma_replace_policy() without taking the per-VMA
      locks, replaces the VMA's vma->vm_policy pointer, and frees the old
      policy.  That's bad; a concurrent page fault might still be using the
      old policy (in vma_alloc_folio()), resulting in use-after-free.
      
      Normally this will manifest as a use-after-free read first, but it can
      result in memory corruption, including because vma_alloc_folio() can
      call mpol_cond_put() on the freed policy, which conditionally changes
      the policy's refcount member.
      
      This bug is specific to CONFIG_NUMA, but it does also affect non-NUMA
      systems as long as the kernel was built with CONFIG_NUMA.
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Fixes: 5e31275c ("mm: add per-VMA lock and helper functions to control it")
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6c21e066
    • Guanghui Feng's avatar
      ACPI/IORT: Remove erroneous id_count check in iort_node_get_rmr_info() · 003e6b56
      Guanghui Feng authored
      According to the ARM IORT specifications DEN 0049 issue E,
      the "Number of IDs" field in the ID mapping format reports
      the number of IDs in the mapping range minus one.
      
      In iort_node_get_rmr_info(), we erroneously skip ID mappings
      whose "Number of IDs" equal to 0, resulting in valid mapping
      nodes with a single ID to map being skipped, which is wrong.
      
      Fix iort_node_get_rmr_info() by removing the bogus id_count
      check.
      
      Fixes: 491cf4a6 ("ACPI/IORT: Add support to retrieve IORT RMR reserved regions")
      Signed-off-by: default avatarGuanghui Feng <guanghuifeng@linux.alibaba.com>
      Cc: <stable@vger.kernel.org> # 6.0.x
      Acked-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
      Tested-by: default avatarHanjun Guo <guohanjun@huawei.com>
      Link: https://lore.kernel.org/r/1689593625-45213-1-git-send-email-guanghuifeng@linux.alibaba.comSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      003e6b56
    • Dave Airlie's avatar
      Merge tag 'drm-msm-fixes-2023-07-27' of https://gitlab.freedesktop.org/drm/msm into drm-fixes · 9a767faa
      Dave Airlie authored
      Fixes for v6.5-rc4
      
      Display:
      + Fix to correct the UBWC programming for decoder version 4.3 seen
        on SM8550
      + Add the missing flush and fetch bits for DMA4 and DMA5 SSPPs.
      + Fix to drop the unused dpu_core_perf_data_bus_id enum from the code
      + Drop the unused dsi_phy_14nm_17mA_regulators from QCM 2290 DSI cfg.
      
      GPU:
      + Fix warn splat for newer devices without revn
      + Remove name/revn for a690.. we shouldn't be populating these for
        newer devices, for consistency, but it slipped through review
      + Fix a6xx gpu snapshot BINDLESS_DATA size (was listed in bytes
        instead of dwords, causing AHB faults on a6xx gen4/a660-family)
      + Disallow submit with fence id 0
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Rob Clark <robdclark@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGs9MwCSfiyv8i7yWAsJKYEzCDyzaTx=ujX80Y23rZd9RA@mail.gmail.com
      9a767faa
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-6.5-2023-07-26' of... · 0dd9c514
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-6.5-2023-07-26' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-6.5-2023-07-26:
      
      amdgpu:
      - gfxhub partition fix
      - Fix error handling in psp_sw_init()
      - SMU13 fix
      - DCN 3.1 fix
      - DCN 3.2 fix
      - Fix for display PHY programming sequence
      - DP MST error handling fix
      - GFX 9.4.3 fix
      
      amdkfd:
      - GFX11 trap handling fix
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230726184936.7812-1-alexander.deucher@amd.com
      0dd9c514
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2023-07-27' of... · 75da46c1
      Dave Airlie authored
      Merge tag 'drm-intel-fixes-2023-07-27' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      - Use shmem for dpt objects [dpt] (Radhakrishna Sripada)
      - Fix an error handling path in igt_write_huge() (Christophe JAILLET)
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/ZMI4Mtom7pDhLB7M@tursulin-desk
      75da46c1
    • Dave Airlie's avatar
  3. 27 Jul, 2023 15 commits
    • Linus Torvalds's avatar
      Merge tag 'net-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 57012c57
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from can, netfilter.
      
        Current release - regressions:
      
         - core: fix splice_to_socket() for O_NONBLOCK socket
      
         - af_unix: fix fortify_panic() in unix_bind_bsd().
      
         - can: raw: fix lockdep issue in raw_release()
      
        Previous releases - regressions:
      
         - tcp: reduce chance of collisions in inet6_hashfn().
      
         - netfilter: skip immediate deactivate in _PREPARE_ERROR
      
         - tipc: stop tipc crypto on failure in tipc_node_create
      
         - eth: igc: fix kernel panic during ndo_tx_timeout callback
      
         - eth: iavf: fix potential deadlock on allocation failure
      
        Previous releases - always broken:
      
         - ipv6: fix bug where deleting a mngtmpaddr can create a new
           temporary address
      
         - eth: ice: fix memory management in ice_ethtool_fdir.c
      
         - eth: hns3: fix the imp capability bit cannot exceed 32 bits issue
      
         - eth: vxlan: calculate correct header length for GPE
      
         - eth: stmmac: apply redundant write work around on 4.xx too"
      
      * tag 'net-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (49 commits)
        tipc: stop tipc crypto on failure in tipc_node_create
        af_unix: Terminate sun_path when bind()ing pathname socket.
        tipc: check return value of pskb_trim()
        benet: fix return value check in be_lancer_xmit_workarounds()
        virtio-net: fix race between set queues and probe
        net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64
        splice, net: Fix splice_to_socket() for O_NONBLOCK socket
        net: fec: tx processing does not call XDP APIs if budget is 0
        mptcp: more accurate NL event generation
        selftests: mptcp: join: only check for ip6tables if needed
        tools: ynl-gen: fix parse multi-attr enum attribute
        tools: ynl-gen: fix enum index in _decode_enum(..)
        netfilter: nf_tables: disallow rule addition to bound chain via NFTA_RULE_CHAIN_ID
        netfilter: nf_tables: skip immediate deactivate in _PREPARE_ERROR
        netfilter: nft_set_rbtree: fix overlap expiration walk
        igc: Fix Kernel Panic during ndo_tx_timeout callback
        net: dsa: qca8k: fix mdb add/del case with 0 VID
        net: dsa: qca8k: fix broken search_and_del
        net: dsa: qca8k: fix search_and_insert wrong handling of new rule
        net: dsa: qca8k: enable use_single_write for qca8xxx
        ...
      57012c57
    • Linus Torvalds's avatar
      Merge tag 'soundwire-6.5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire · bc168790
      Linus Torvalds authored
      Pull soundwire fixes from Vinod Koul:
      
       - Core fix for enumeration completion
      
       - Qualcomm driver fix to update status
      
       - AMD driver fix for probe error check
      
      * tag 'soundwire-6.5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
        soundwire: amd: Fix a check for errors in probe()
        soundwire: qcom: update status correctly with mask
        soundwire: fix enumeration completion
      bc168790
    • Linus Torvalds's avatar
      Merge tag 'phy-fixes-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy · 53c8621b
      Linus Torvalds authored
      Pull phy fixes from Vinod Koul:
      
       - Out of bound fix for hisilicon phy
      
       - Qualcomm synopsis femto phy for keeping clock enabled during suspend
         and enabling ref clocks
      
       - Mediatek driver fixes for upper limit test and error code
      
      * tag 'phy-fixes-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy:
        phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe()
        phy: qcom-snps-femto-v2: use qcom_snps_hsphy_suspend/resume error code
        phy: qcom-snps-femto-v2: properly enable ref clock
        phy: qcom-snps-femto-v2: keep cfg_ahb_clk enabled during runtime suspend
        phy: mediatek: hdmi: mt8195: fix prediv bad upper limit test
        phy: phy-mtk-dp: Fix an error code in probe()
      53c8621b
    • Linus Torvalds's avatar
      Merge tag 'for-6.5-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 64de76ce
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - fix accounting of global block reserve size when block group tree is
         enabled
      
       - the async discard has been enabled in 6.2 unconditionally, but for
         zoned mode it does not make that much sense to do it asynchronously
         as the zones are reset as needed
      
       - error handling and proper error value propagation fixes
      
      * tag 'for-6.5-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: check for commit error at btrfs_attach_transaction_barrier()
        btrfs: check if the transaction was aborted at btrfs_wait_for_commit()
        btrfs: remove BUG_ON()'s in add_new_free_space()
        btrfs: account block group tree when calculating global reserve size
        btrfs: zoned: do not enable async discard
      64de76ce
    • Linus Torvalds's avatar
      Merge tag 'fixes-2023-07-27' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock · 379e6671
      Linus Torvalds authored
      Pull memblock fix from Mike Rapoport:
       "A call to memblock_free() or memblock_phys_free() issued after
        memblock data is discarded will result in use after free in
        memblock_isolate_range().
      
        Avoid those issues by making sure that memblock_discard points
        memblock.reserved.regions back at the static buffer"
      
      * tag 'fixes-2023-07-27' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
        mm,memblock: reset memblock.reserved to system init state to prevent UAF
      379e6671
    • Jann Horn's avatar
      mm: lock_vma_under_rcu() must check vma->anon_vma under vma lock · 657b5146
      Jann Horn authored
      lock_vma_under_rcu() tries to guarantee that __anon_vma_prepare() can't
      be called in the VMA-locked page fault path by ensuring that
      vma->anon_vma is set.
      
      However, this check happens before the VMA is locked, which means a
      concurrent move_vma() can concurrently call unlink_anon_vmas(), which
      disassociates the VMA's anon_vma.
      
      This means we can get UAF in the following scenario:
      
        THREAD 1                   THREAD 2
        ========                   ========
        <page fault>
          lock_vma_under_rcu()
            rcu_read_lock()
            mas_walk()
            check vma->anon_vma
      
                                   mremap() syscall
                                     move_vma()
                                      vma_start_write()
                                       unlink_anon_vmas()
                                   <syscall end>
      
          handle_mm_fault()
            __handle_mm_fault()
              handle_pte_fault()
                do_pte_missing()
                  do_anonymous_page()
                    anon_vma_prepare()
                      __anon_vma_prepare()
                        find_mergeable_anon_vma()
                          mas_walk() [looks up VMA X]
      
                                   munmap() syscall (deletes VMA X)
      
                          reusable_anon_vma() [called on freed VMA X]
      
      This is a security bug if you can hit it, although an attacker would
      have to win two races at once where the first race window is only a few
      instructions wide.
      
      This patch is based on some previous discussion with Linus Torvalds on
      the security list.
      
      Cc: stable@vger.kernel.org
      Fixes: 5e31275c ("mm: add per-VMA lock and helper functions to control it")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      657b5146
    • Baskaran Kannan's avatar
      hwmon: (k10temp) Enable AMD3255 Proc to show negative temperature · e146503a
      Baskaran Kannan authored
      Industrial processor i3255 supports temperatures -40 deg celcius
      to 105 deg Celcius. The current implementation of k10temp_read_temp
      rounds off any negative temperatures to '0'. To fix this,
      the following changes have been made.
      
      A flag 'disp_negative' is added to struct k10temp_data to support
      AMD i3255 processors. Flag 'disp_negative' is set if 3255 processor
      is found during k10temp_probe.  Flag 'disp_negative' is used to
      determine whether to round off negative temperatures to '0' in
      k10temp_read_temp.
      Signed-off-by: default avatarBaskaran Kannan <Baski.Kannan@amd.com>
      Link: https://lore.kernel.org/r/20230727162159.1056136-1-Baski.Kannan@amd.com
      Fixes: aef17ca1 ("hwmon: (k10temp) Only apply temperature offset if result is positive")
      Cc: stable@vger.kernel.org
      [groeck: Fixed multi-line comment]
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      e146503a
    • Jason Gunthorpe's avatar
      iommufd: Set end correctly when doing batch carry · b7c822fa
      Jason Gunthorpe authored
      Even though the test suite covers this it somehow became obscured that
      this wasn't working.
      
      The test iommufd_ioas.mock_domain.access_domain_destory would blow up
      rarely.
      
      end should be set to 1 because this just pushed an item, the carry, to the
      pfns list.
      
      Sometimes the test would blow up with:
      
        BUG: kernel NULL pointer dereference, address: 0000000000000000
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        PGD 0 P4D 0
        Oops: 0000 [#1] SMP
        CPU: 5 PID: 584 Comm: iommufd Not tainted 6.5.0-rc1-dirty #1236
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        RIP: 0010:batch_unpin+0xa2/0x100 [iommufd]
        Code: 17 48 81 fe ff ff 07 00 77 70 48 8b 15 b7 be 97 e2 48 85 d2 74 14 48 8b 14 fa 48 85 d2 74 0b 40 0f b6 f6 48 c1 e6 04 48 01 f2 <48> 8b 3a 48 c1 e0 06 89 ca 48 89 de 48 83 e7 f0 48 01 c7 e8 96 dc
        RSP: 0018:ffffc90001677a58 EFLAGS: 00010246
        RAX: 00007f7e2646f000 RBX: 0000000000000000 RCX: 0000000000000001
        RDX: 0000000000000000 RSI: 00000000fefc4c8d RDI: 0000000000fefc4c
        RBP: ffffc90001677a80 R08: 0000000000000048 R09: 0000000000000200
        R10: 0000000000030b98 R11: ffffffff81f3bb40 R12: 0000000000000001
        R13: ffff888101f75800 R14: ffffc90001677ad0 R15: 00000000000001fe
        FS:  00007f9323679740(0000) GS:ffff8881ba540000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000000000000000 CR3: 0000000105ede003 CR4: 00000000003706a0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         <TASK>
         ? show_regs+0x5c/0x70
         ? __die+0x1f/0x60
         ? page_fault_oops+0x15d/0x440
         ? lock_release+0xbc/0x240
         ? exc_page_fault+0x4a4/0x970
         ? asm_exc_page_fault+0x27/0x30
         ? batch_unpin+0xa2/0x100 [iommufd]
         ? batch_unpin+0xba/0x100 [iommufd]
         __iopt_area_unfill_domain+0x198/0x430 [iommufd]
         ? __mutex_lock+0x8c/0xb80
         ? __mutex_lock+0x6aa/0xb80
         ? xa_erase+0x28/0x30
         ? iopt_table_remove_domain+0x162/0x320 [iommufd]
         ? lock_release+0xbc/0x240
         iopt_area_unfill_domain+0xd/0x10 [iommufd]
         iopt_table_remove_domain+0x195/0x320 [iommufd]
         iommufd_hw_pagetable_destroy+0xb3/0x110 [iommufd]
         iommufd_object_destroy_user+0x8e/0xf0 [iommufd]
         iommufd_device_detach+0xc5/0x140 [iommufd]
         iommufd_selftest_destroy+0x1f/0x70 [iommufd]
         iommufd_object_destroy_user+0x8e/0xf0 [iommufd]
         iommufd_destroy+0x3a/0x50 [iommufd]
         iommufd_fops_ioctl+0xfb/0x170 [iommufd]
         __x64_sys_ioctl+0x40d/0x9a0
         do_syscall_64+0x3c/0x80
         entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Link: https://lore.kernel.org/r/3-v1-85aacb2af554+bc-iommufd_syz3_jgg@nvidia.com
      Cc: <stable@vger.kernel.org>
      Fixes: f394576e ("iommufd: PFN handling for iopt_pages")
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Tested-by: default avatarNicolin Chen <nicolinc@nvidia.com>
      Reported-by: default avatarNicolin Chen <nicolinc@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      b7c822fa
    • Jason Gunthorpe's avatar
      iommufd: IOMMUFD_DESTROY should not increase the refcount · 99f98a7c
      Jason Gunthorpe authored
      syzkaller found a race where IOMMUFD_DESTROY increments the refcount:
      
             obj = iommufd_get_object(ucmd->ictx, cmd->id, IOMMUFD_OBJ_ANY);
             if (IS_ERR(obj))
                     return PTR_ERR(obj);
             iommufd_ref_to_users(obj);
             /* See iommufd_ref_to_users() */
             if (!iommufd_object_destroy_user(ucmd->ictx, obj))
      
      As part of the sequence to join the two existing primitives together.
      
      Allowing the refcount the be elevated without holding the destroy_rwsem
      violates the assumption that all temporary refcount elevations are
      protected by destroy_rwsem. Racing IOMMUFD_DESTROY with
      iommufd_object_destroy_user() will cause spurious failures:
      
        WARNING: CPU: 0 PID: 3076 at drivers/iommu/iommufd/device.c:477 iommufd_access_destroy+0x18/0x20 drivers/iommu/iommufd/device.c:478
        Modules linked in:
        CPU: 0 PID: 3076 Comm: syz-executor.0 Not tainted 6.3.0-rc1-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
        RIP: 0010:iommufd_access_destroy+0x18/0x20 drivers/iommu/iommufd/device.c:477
        Code: e8 3d 4e 00 00 84 c0 74 01 c3 0f 0b c3 0f 1f 44 00 00 f3 0f 1e fa 48 89 fe 48 8b bf a8 00 00 00 e8 1d 4e 00 00 84 c0 74 01 c3 <0f> 0b c3 0f 1f 44 00 00 41 57 41 56 41 55 4c 8d ae d0 00 00 00 41
        RSP: 0018:ffffc90003067e08 EFLAGS: 00010246
        RAX: 0000000000000000 RBX: ffff888109ea0300 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00000000ffffffff
        RBP: 0000000000000004 R08: 0000000000000000 R09: ffff88810bbb3500
        R10: ffff88810bbb3e48 R11: 0000000000000000 R12: ffffc90003067e88
        R13: ffffc90003067ea8 R14: ffff888101249800 R15: 00000000fffffffe
        FS:  00007ff7254fe6c0(0000) GS:ffff888237c00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000555557262da8 CR3: 000000010a6fd000 CR4: 0000000000350ef0
        Call Trace:
         <TASK>
         iommufd_test_create_access drivers/iommu/iommufd/selftest.c:596 [inline]
         iommufd_test+0x71c/0xcf0 drivers/iommu/iommufd/selftest.c:813
         iommufd_fops_ioctl+0x10f/0x1b0 drivers/iommu/iommufd/main.c:337
         vfs_ioctl fs/ioctl.c:51 [inline]
         __do_sys_ioctl fs/ioctl.c:870 [inline]
         __se_sys_ioctl fs/ioctl.c:856 [inline]
         __x64_sys_ioctl+0x84/0xc0 fs/ioctl.c:856
         do_syscall_x64 arch/x86/entry/common.c:50 [inline]
         do_syscall_64+0x38/0x80 arch/x86/entry/common.c:80
         entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The solution is to not increment the refcount on the IOMMUFD_DESTROY path
      at all. Instead use the xa_lock to serialize everything. The refcount
      check == 1 and xa_erase can be done under a single critical region. This
      avoids the need for any refcount incrementing.
      
      It has the downside that if userspace races destroy with other operations
      it will get an EBUSY instead of waiting, but this is kind of racing is
      already dangerous.
      
      Fixes: 2ff4bed7 ("iommufd: File descriptor, context, kconfig and makefiles")
      Link: https://lore.kernel.org/r/2-v1-85aacb2af554+bc-iommufd_syz3_jgg@nvidia.comReviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Reported-by: syzbot+7574ebfe589049630608@syzkaller.appspotmail.com
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      99f98a7c
    • Ming Lei's avatar
      ublk: return -EINTR if breaking from waiting for existed users in DEL_DEV · 3e9dce80
      Ming Lei authored
      If user interrupts wait_event_interruptible() in ublk_ctrl_del_dev(),
      return -EINTR and let user know what happens.
      
      Fixes: 0abe39de ("block: ublk: improve handling device deletion")
      Reported-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Link: https://lore.kernel.org/r/20230726144502.566785-4-ming.lei@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      3e9dce80
    • Ming Lei's avatar
      ublk: fail to recover device if queue setup is interrupted · 0c0cbd4e
      Ming Lei authored
      In ublk_ctrl_end_recovery(), if wait_for_completion_interruptible() is
      interrupted by signal, queues aren't setup successfully yet, so we
      have to fail UBLK_CMD_END_USER_RECOVERY, otherwise kernel oops can be
      triggered.
      
      Fixes: c732a852 ("ublk_drv: add START_USER_RECOVERY and END_USER_RECOVERY support")
      Reported-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Link: https://lore.kernel.org/r/20230726144502.566785-3-ming.lei@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      0c0cbd4e
    • Ming Lei's avatar
      ublk: fail to start device if queue setup is interrupted · 53e7d08f
      Ming Lei authored
      In ublk_ctrl_start_dev(), if wait_for_completion_interruptible() is
      interrupted by signal, queues aren't setup successfully yet, so we
      have to fail UBLK_CMD_START_DEV, otherwise kernel oops can be triggered.
      
      Reported by German when working on qemu-storage-deamon which requires
      single thread ublk daemon.
      
      Fixes: 71f28f31 ("ublk_drv: add io_uring based userspace block driver")
      Reported-by: default avatarGerman Maglione <gmaglione@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20230726144502.566785-2-ming.lei@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      53e7d08f
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v6.5-rc3' of... · 3b9adfbb
      Takashi Iwai authored
      Merge tag 'asoc-fix-v6.5-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v6.5
      
      A collection of device specific fixes, none particularly remarkable.
      There's a set of repetitive fixes for the RealTek drivers fixing an
      issue with suspend that was replicated in multiple drivers.
      3b9adfbb
    • Fedor Pchelkin's avatar
      tipc: stop tipc crypto on failure in tipc_node_create · de52e173
      Fedor Pchelkin authored
      If tipc_link_bc_create() fails inside tipc_node_create() for a newly
      allocated tipc node then we should stop its tipc crypto and free the
      resources allocated with a call to tipc_crypto_start().
      
      As the node ref is initialized to one to that point, just put the ref on
      tipc_link_bc_create() error case that would lead to tipc_node_free() be
      eventually executed and properly clean the node and its crypto resources.
      
      Found by Linux Verification Center (linuxtesting.org).
      
      Fixes: cb8092d7 ("tipc: move bc link creation back to tipc_node_create")
      Suggested-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
      Link: https://lore.kernel.org/r/20230725214628.25246-1-pchelkin@ispras.ruSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      de52e173
    • Kuniyuki Iwashima's avatar
      af_unix: Terminate sun_path when bind()ing pathname socket. · ecb4534b
      Kuniyuki Iwashima authored
      kernel test robot reported slab-out-of-bounds access in strlen(). [0]
      
      Commit 06d4c8a8 ("af_unix: Fix fortify_panic() in unix_bind_bsd().")
      removed unix_mkname_bsd() call in unix_bind_bsd().
      
      If sunaddr->sun_path is not terminated by user and we don't enable
      CONFIG_INIT_STACK_ALL_ZERO=y, strlen() will do the out-of-bounds access
      during file creation.
      
      Let's go back to strlen()-with-sockaddr_storage way and pack all 108
      trickiness into unix_mkname_bsd() with bold comments.
      
      [0]:
      BUG: KASAN: slab-out-of-bounds in strlen (lib/string.c:?)
      Read of size 1 at addr ffff000015492777 by task fortify_strlen_/168
      
      CPU: 0 PID: 168 Comm: fortify_strlen_ Not tainted 6.5.0-rc1-00333-g3329b603ebba #16
      Hardware name: linux,dummy-virt (DT)
      Call trace:
       dump_backtrace (arch/arm64/kernel/stacktrace.c:235)
       show_stack (arch/arm64/kernel/stacktrace.c:242)
       dump_stack_lvl (lib/dump_stack.c:107)
       print_report (mm/kasan/report.c:365 mm/kasan/report.c:475)
       kasan_report (mm/kasan/report.c:590)
       __asan_report_load1_noabort (mm/kasan/report_generic.c:378)
       strlen (lib/string.c:?)
       getname_kernel (./include/linux/fortify-string.h:? fs/namei.c:226)
       kern_path_create (fs/namei.c:3926)
       unix_bind (net/unix/af_unix.c:1221 net/unix/af_unix.c:1324)
       __sys_bind (net/socket.c:1792)
       __arm64_sys_bind (net/socket.c:1801)
       invoke_syscall (arch/arm64/kernel/syscall.c:? arch/arm64/kernel/syscall.c:52)
       el0_svc_common (./include/linux/thread_info.h:127 arch/arm64/kernel/syscall.c:147)
       do_el0_svc (arch/arm64/kernel/syscall.c:189)
       el0_svc (./arch/arm64/include/asm/daifflags.h:28 arch/arm64/kernel/entry-common.c:133 arch/arm64/kernel/entry-common.c:144 arch/arm64/kernel/entry-common.c:648)
       el0t_64_sync_handler (arch/arm64/kernel/entry-common.c:?)
       el0t_64_sync (arch/arm64/kernel/entry.S:591)
      
      Allocated by task 168:
       kasan_set_track (mm/kasan/common.c:45 mm/kasan/common.c:52)
       kasan_save_alloc_info (mm/kasan/generic.c:512)
       __kasan_kmalloc (mm/kasan/common.c:383)
       __kmalloc (mm/slab_common.c:? mm/slab_common.c:998)
       unix_bind (net/unix/af_unix.c:257 net/unix/af_unix.c:1213 net/unix/af_unix.c:1324)
       __sys_bind (net/socket.c:1792)
       __arm64_sys_bind (net/socket.c:1801)
       invoke_syscall (arch/arm64/kernel/syscall.c:? arch/arm64/kernel/syscall.c:52)
       el0_svc_common (./include/linux/thread_info.h:127 arch/arm64/kernel/syscall.c:147)
       do_el0_svc (arch/arm64/kernel/syscall.c:189)
       el0_svc (./arch/arm64/include/asm/daifflags.h:28 arch/arm64/kernel/entry-common.c:133 arch/arm64/kernel/entry-common.c:144 arch/arm64/kernel/entry-common.c:648)
       el0t_64_sync_handler (arch/arm64/kernel/entry-common.c:?)
       el0t_64_sync (arch/arm64/kernel/entry.S:591)
      
      The buggy address belongs to the object at ffff000015492700
       which belongs to the cache kmalloc-128 of size 128
      The buggy address is located 0 bytes to the right of
       allocated 119-byte region [ffff000015492700, ffff000015492777)
      
      The buggy address belongs to the physical page:
      page:00000000aeab52ba refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x55492
      anon flags: 0x3fffc0000000200(slab|node=0|zone=0|lastcpupid=0xffff)
      page_type: 0xffffffff()
      raw: 03fffc0000000200 ffff0000084018c0 fffffc00003d0e00 0000000000000005
      raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff000015492600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff000015492680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      >ffff000015492700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 fc
                                                                   ^
       ffff000015492780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       ffff000015492800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      Fixes: 06d4c8a8 ("af_unix: Fix fortify_panic() in unix_bind_bsd().")
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Closes: https://lore.kernel.org/netdev/202307262110.659e5e8-oliver.sang@intel.com/Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/20230726190828.47874-1-kuniyu@amazon.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ecb4534b