Skip to content
  1. Jun 21, 2024
    • YonglongLi's avatar
      mptcp: pm: inc RmAddr MIB counter once per RM_ADDR ID · 2912b878
      YonglongLi authored
      commit 6a09788c upstream.
      
      The RmAddr MIB counter is supposed to be incremented once when a valid
      RM_ADDR has been received. Before this patch, it could have been
      incremented as many times as the number of subflows connected to the
      linked address ID, so it could have been 0, 1 or more than 1.
      
      The "RmSubflow" is incremented after a local operation. In this case,
      it is normal to tied it with the number of subflows that have been
      actually removed.
      
      The "remove invalid addresses" MP Join subtest has been modified to
      validate this case. A broadcast IP address is now used instead: the
      client will not be able to create a subflow to this address. The
      consequence is that when receiving the RM_ADDR with the ID attached to
      this broadcast IP address, no subflow linked to this ID will be found.
      
      Fixes: 7a7e52e3
      
       ("mptcp: add RM_ADDR related mibs")
      Cc: stable@vger.kernel.org
      Co-developed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarYonglongLi <liyonglong@chinatelecom.cn>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-2-1ab9ddfa3d00@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2912b878
    • Paolo Abeni's avatar
      mptcp: ensure snd_una is properly initialized on connect · ef473bf1
      Paolo Abeni authored
      commit 8031b58c upstream.
      
      This is strictly related to commit fb7a0d33
      
       ("mptcp: ensure snd_nxt
      is properly initialized on connect"). It turns out that syzkaller can
      trigger the retransmit after fallback and before processing any other
      incoming packet - so that snd_una is still left uninitialized.
      
      Address the issue explicitly initializing snd_una together with snd_nxt
      and write_seq.
      
      Suggested-by: default avatarMat Martineau <martineau@kernel.org>
      Fixes: 8fd73804
      
       ("mptcp: fallback in case of simultaneous connect")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarChristoph Paasch <cpaasch@apple.com>
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/485
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-1-1ab9ddfa3d00@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef473bf1
    • Marek Szyprowski's avatar
      drm/exynos: hdmi: report safe 640x480 mode as a fallback when no EDID found · 510a6c0d
      Marek Szyprowski authored
      commit 799d4b39 upstream.
      
      When reading EDID fails and driver reports no modes available, the DRM
      core adds an artificial 1024x786 mode to the connector. Unfortunately
      some variants of the Exynos HDMI (like the one in Exynos4 SoCs) are not
      able to drive such mode, so report a safe 640x480 mode instead of nothing
      in case of the EDID reading failure.
      
      This fixes the following issue observed on Trats2 board since commit
      13d5b040 ("drm/exynos: do not return negative values from .get_modes()"):
      
      [drm] Exynos DRM: using 11c00000.fimd device for DMA mapping operations
      exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops)
      exynos-drm exynos-drm: bound 12c10000.mixer (ops mixer_component_ops)
      exynos-dsi 11c80000.dsi: [drm:samsung_dsim_host_attach] Attached s6e8aa0 device (lanes:4 bpp:24 mode-flags:0x10b)
      exynos-drm exynos-drm: bound 11c80000.dsi (ops exynos_dsi_component_ops)
      exynos-drm exynos-drm: bound 12d00000.hdmi (ops hdmi_component_ops)
      [drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 1
      exynos-hdmi 12d00000.hdmi: [drm:hdmiphy_enable.part.0] *ERROR* PLL could not reach steady state
      panel-samsung-s6e8aa0 11c80000.dsi.0: ID: 0xa2, 0x20, 0x8c
      exynos-mixer 12c10000.mixer: timeout waiting for VSYNC
      ------------[ cut here ]------------
      WARNING: CPU: 1 PID: 11 at drivers/gpu/drm/drm_atomic_helper.c:1682 drm_atomic_helper_wait_for_vblanks.part.0+0x2b0/0x2b8
      [CRTC:70:crtc-1] vblank wait timed out
      Modules linked in:
      CPU: 1 PID: 11 Comm: kworker/u16:0 Not tainted 6.9.0-rc5-next-20240424 #14913
      Hardware name: Samsung Exynos (Flattened Device Tree)
      Workqueue: events_unbound deferred_probe_work_func
      Call trace:
       unwind_backtrace from show_stack+0x10/0x14
       show_stack from dump_stack_lvl+0x68/0x88
       dump_stack_lvl from __warn+0x7c/0x1c4
       __warn from warn_slowpath_fmt+0x11c/0x1a8
       warn_slowpath_fmt from drm_atomic_helper_wait_for_vblanks.part.0+0x2b0/0x2b8
       drm_atomic_helper_wait_for_vblanks.part.0 from drm_atomic_helper_commit_tail_rpm+0x7c/0x8c
       drm_atomic_helper_commit_tail_rpm from commit_tail+0x9c/0x184
       commit_tail from drm_atomic_helper_commit+0x168/0x190
       drm_atomic_helper_commit from drm_atomic_commit+0xb4/0xe0
       drm_atomic_commit from drm_client_modeset_commit_atomic+0x23c/0x27c
       drm_client_modeset_commit_atomic from drm_client_modeset_commit_locked+0x60/0x1cc
       drm_client_modeset_commit_locked from drm_client_modeset_commit+0x24/0x40
       drm_client_modeset_commit from __drm_fb_helper_restore_fbdev_mode_unlocked+0x9c/0xc4
       __drm_fb_helper_restore_fbdev_mode_unlocked from drm_fb_helper_set_par+0x2c/0x3c
       drm_fb_helper_set_par from fbcon_init+0x3d8/0x550
       fbcon_init from visual_init+0xc0/0x108
       visual_init from do_bind_con_driver+0x1b8/0x3a4
       do_bind_con_driver from do_take_over_console+0x140/0x1ec
       do_take_over_console from do_fbcon_takeover+0x70/0xd0
       do_fbcon_takeover from fbcon_fb_registered+0x19c/0x1ac
       fbcon_fb_registered from register_framebuffer+0x190/0x21c
       register_framebuffer from __drm_fb_helper_initial_config_and_unlock+0x350/0x574
       __drm_fb_helper_initial_config_and_unlock from exynos_drm_fbdev_client_hotplug+0x6c/0xb0
       exynos_drm_fbdev_client_hotplug from drm_client_register+0x58/0x94
       drm_client_register from exynos_drm_bind+0x160/0x190
       exynos_drm_bind from try_to_bring_up_aggregate_device+0x200/0x2d8
       try_to_bring_up_aggregate_device from __component_add+0xb0/0x170
       __component_add from mixer_probe+0x74/0xcc
       mixer_probe from platform_probe+0x5c/0xb8
       platform_probe from really_probe+0xe0/0x3d8
       really_probe from __driver_probe_device+0x9c/0x1e4
       __driver_probe_device from driver_probe_device+0x30/0xc0
       driver_probe_device from __device_attach_driver+0xa8/0x120
       __device_attach_driver from bus_for_each_drv+0x80/0xcc
       bus_for_each_drv from __device_attach+0xac/0x1fc
       __device_attach from bus_probe_device+0x8c/0x90
       bus_probe_device from deferred_probe_work_func+0x98/0xe0
       deferred_probe_work_func from process_one_work+0x240/0x6d0
       process_one_work from worker_thread+0x1a0/0x3f4
       worker_thread from kthread+0x104/0x138
       kthread from ret_from_fork+0x14/0x28
      Exception stack(0xf0895fb0 to 0xf0895ff8)
      ...
      irq event stamp: 82357
      hardirqs last  enabled at (82363): [<c01a96e8>] vprintk_emit+0x308/0x33c
      hardirqs last disabled at (82368): [<c01a969c>] vprintk_emit+0x2bc/0x33c
      softirqs last  enabled at (81614): [<c0101644>] __do_softirq+0x320/0x500
      softirqs last disabled at (81609): [<c012dfe0>] __irq_exit_rcu+0x130/0x184
      ---[ end trace 0000000000000000 ]---
      exynos-drm exynos-drm: [drm] *ERROR* flip_done timed out
      exynos-drm exynos-drm: [drm] *ERROR* [CRTC:70:crtc-1] commit wait timed out
      exynos-drm exynos-drm: [drm] *ERROR* flip_done timed out
      exynos-drm exynos-drm: [drm] *ERROR* [CONNECTOR:74:HDMI-A-1] commit wait timed out
      exynos-drm exynos-drm: [drm] *ERROR* flip_done timed out
      exynos-drm exynos-drm: [drm] *ERROR* [PLANE:56:plane-5] commit wait timed out
      exynos-mixer 12c10000.mixer: timeout waiting for VSYNC
      
      Cc: stable@vger.kernel.org
      Fixes: 13d5b040
      
       ("drm/exynos: do not return negative values from .get_modes()")
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      510a6c0d
    • Jani Nikula's avatar
      drm/exynos/vidi: fix memory leak in .get_modes() · cb3ac233
      Jani Nikula authored
      commit 38e38256
      
       upstream.
      
      The duplicated EDID is never freed. Fix it.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cb3ac233
    • Jan Beulich's avatar
      memblock: make memblock_set_node() also warn about use of MAX_NUMNODES · 22f742b8
      Jan Beulich authored
      commit e0eec24e upstream.
      
      On an (old) x86 system with SRAT just covering space above 4Gb:
      
          ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0xfffffffff] hotplug
      
      the commit referenced below leads to this NUMA configuration no longer
      being refused by a CONFIG_NUMA=y kernel (previously
      
          NUMA: nodes only cover 6144MB of your 8185MB e820 RAM. Not used.
          No NUMA configuration found
          Faking a node at [mem 0x0000000000000000-0x000000027fffffff]
      
      was seen in the log directly after the message quoted above), because of
      memblock_validate_numa_coverage() checking for NUMA_NO_NODE (only). This
      in turn led to memblock_alloc_range_nid()'s warning about MAX_NUMNODES
      triggering, followed by a NULL deref in memmap_init() when trying to
      access node 64's (NODE_SHIFT=6) node data.
      
      To compensate said change, make memblock_set_node() warn on and adjust
      a passed in value of MAX_NUMNODES, just like various other functions
      already do.
      
      Fixes: ff6c3d81
      
       ("NUMA: optimize detection of memory with no node id assigned by firmware")
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/1c8a058c-5365-4f27-a9f1-3aeb7fb3e7b2@suse.com
      Signed-off-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22f742b8
    • Jan Beulich's avatar
      x86/mm/numa: Use NUMA_NO_NODE when calling memblock_set_node() · 10fc691c
      Jan Beulich authored
      commit 3ac36aa7 upstream.
      
      memblock_set_node() warns about using MAX_NUMNODES, see
      
        e0eec24e
      
       ("memblock: make memblock_set_node() also warn about use of MAX_NUMNODES")
      
      for details.
      
      Reported-by: default avatarNarasimhan V <Narasimhan.V@amd.com>
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      [bp: commit message]
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reviewed-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Tested-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Link: https://lore.kernel.org/r/20240603141005.23261-1-bp@kernel.org
      Link: https://lore.kernel.org/r/abadb736-a239-49e4-ab42-ace7acdd4278@suse.com
      Signed-off-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10fc691c
    • Rafael J. Wysocki's avatar
      thermal: ACPI: Invalidate trip points with temperature of 0 or below · be4b29d9
      Rafael J. Wysocki authored
      commit 7f18bd49 upstream.
      
      It is reported that commit 95021088 ("thermal: core: Drop
      trips_disabled bitmask") causes the maximum frequency of CPUs to drop
      further down with every system sleep-wake cycle on Intel Core i7-4710HQ.
      
      This turns out to be due to a trip point whose temperature is equal to 0
      degrees Celsius which is acted on every time the system wakes from sleep.
      
      Before commit 95021088 this trip point would be disabled wia the
      trips_disabled bitmask, but now it is treated as a valid one.
      
      Since ACPI thermal control is generally about protection against
      overheating, trip points with temperature of 0 centigrade or below are
      not particularly useful there, so initialize them all as invalid which
      fixes the problem at hand.
      
      Fixes: 95021088
      
       ("thermal: core: Drop trips_disabled bitmask")
      Closes: https://lore.kernel.org/linux-pm/3f71747b-f852-4ee0-b384-cf46b2aefa3f@gmx.com
      Reported-by: default avatarTibor Billes <tbilles@gmx.com>
      Tested-by: default avatarTibor Billes <tbilles@gmx.com>
      Cc: 6.7+ <stable@vger.kernel.org> # 6.7+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be4b29d9
    • Mario Limonciello's avatar
      ACPI: x86: Force StorageD3Enable on more products · 6dccf6c0
      Mario Limonciello authored
      commit e79a1065
      
       upstream.
      
      A Rembrandt-based HP thin client is reported to have problems where
      the NVME disk isn't present after resume from s2idle.
      
      This is because the NVME disk wasn't put into D3 at suspend, and
      that happened because the StorageD3Enable _DSD was missing in the BIOS.
      
      As AMD's architecture requires that the NVME is in D3 for s2idle, adjust
      the criteria for force_storage_d3 to match *all* Zen SoCs when the FADT
      advertises low power idle support.
      
      This will ensure that any future products with this BIOS deficiency don't
      need to be added to the allow list of overrides.
      
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6dccf6c0
    • Yazen Ghannam's avatar
      RAS/AMD/ATL: Use system settings for MI300 DRAM to normalized address translation · 3036abc3
      Yazen Ghannam authored
      commit ba437905 upstream.
      
      The currently used normalized address format is not applicable to all
      MI300 systems. This leads to incorrect results during address
      translation.
      
      Drop the fixed layout and construct the normalized address from system
      settings.
      
      Fixes: 87a61237
      
       ("RAS/AMD/ATL: Add MI300 DRAM to normalized address translation support")
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240607-mi300-dram-xl-fix-v1-2-2f11547a178c@amd.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3036abc3
    • Yazen Ghannam's avatar
      RAS/AMD/ATL: Fix MI300 bank hash · d2618b6c
      Yazen Ghannam authored
      commit fe8a0897 upstream.
      
      Apply the SID bits to the correct offset in the Bank value. Do this in
      the temporary value so they don't need to be masked off later.
      
      Fixes: 87a61237
      
       ("RAS/AMD/ATL: Add MI300 DRAM to normalized address translation support")
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Cc: <stable@kernel.org>
      Link: https://lore.kernel.org/r/20240607-mi300-dram-xl-fix-v1-1-2f11547a178c@amd.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2618b6c
    • John David Anglin's avatar
      parisc: Try to fix random segmentation faults in package builds · d66f2607
      John David Anglin authored
      commit 72d95924
      
       upstream.
      
      PA-RISC systems with PA8800 and PA8900 processors have had problems
      with random segmentation faults for many years.  Systems with earlier
      processors are much more stable.
      
      Systems with PA8800 and PA8900 processors have a large L2 cache which
      needs per page flushing for decent performance when a large range is
      flushed. The combined cache in these systems is also more sensitive to
      non-equivalent aliases than the caches in earlier systems.
      
      The majority of random segmentation faults that I have looked at
      appear to be memory corruption in memory allocated using mmap and
      malloc.
      
      My first attempt at fixing the random faults didn't work. On
      reviewing the cache code, I realized that there were two issues
      which the existing code didn't handle correctly. Both relate
      to cache move-in. Another issue is that the present bit in PTEs
      is racy.
      
      1) PA-RISC caches have a mind of their own and they can speculatively
      load data and instructions for a page as long as there is a entry in
      the TLB for the page which allows move-in. TLBs are local to each
      CPU. Thus, the TLB entry for a page must be purged before flushing
      the page. This is particularly important on SMP systems.
      
      In some of the flush routines, the flush routine would be called
      and then the TLB entry would be purged. This was because the flush
      routine needed the TLB entry to do the flush.
      
      2) My initial approach to trying the fix the random faults was to
      try and use flush_cache_page_if_present for all flush operations.
      This actually made things worse and led to a couple of hardware
      lockups. It finally dawned on me that some lines weren't being
      flushed because the pte check code was racy. This resulted in
      random inequivalent mappings to physical pages.
      
      The __flush_cache_page tmpalias flush sets up its own TLB entry
      and it doesn't need the existing TLB entry. As long as we can find
      the pte pointer for the vm page, we can get the pfn and physical
      address of the page. We can also purge the TLB entry for the page
      before doing the flush. Further, __flush_cache_page uses a special
      TLB entry that inhibits cache move-in.
      
      When switching page mappings, we need to ensure that lines are
      removed from the cache.  It is not sufficient to just flush the
      lines to memory as they may come back.
      
      This made it clear that we needed to implement all the required
      flush operations using tmpalias routines. This includes flushes
      for user and kernel pages.
      
      After modifying the code to use tmpalias flushes, it became clear
      that the random segmentation faults were not fully resolved. The
      frequency of faults was worse on systems with a 64 MB L2 (PA8900)
      and systems with more CPUs (rp4440).
      
      The warning that I added to flush_cache_page_if_present to detect
      pages that couldn't be flushed triggered frequently on some systems.
      
      Helge and I looked at the pages that couldn't be flushed and found
      that the PTE was either cleared or for a swap page. Ignoring pages
      that were swapped out seemed okay but pages with cleared PTEs seemed
      problematic.
      
      I looked at routines related to pte_clear and noticed ptep_clear_flush.
      The default implementation just flushes the TLB entry. However, it was
      obvious that on parisc we need to flush the cache page as well. If
      we don't flush the cache page, stale lines will be left in the cache
      and cause random corruption. Once a PTE is cleared, there is no way
      to find the physical address associated with the PTE and flush the
      associated page at a later time.
      
      I implemented an updated change with a parisc specific version of
      ptep_clear_flush. It fixed the random data corruption on Helge's rp4440
      and rp3440, as well as on my c8000.
      
      At this point, I realized that I could restore the code where we only
      flush in flush_cache_page_if_present if the page has been accessed.
      However, for this, we also need to flush the cache when the accessed
      bit is cleared in ptep_clear_flush_young to keep things synchronized.
      The default implementation only flushes the TLB entry.
      
      Other changes in this version are:
      
      1) Implement parisc specific version of ptep_get. It's identical to
      default but needed in arch/parisc/include/asm/pgtable.h.
      2) Revise parisc implementation of ptep_test_and_clear_young to use
      ptep_get (READ_ONCE).
      3) Drop parisc implementation of ptep_get_and_clear. We can use default.
      4) Revise flush_kernel_vmap_range and invalidate_kernel_vmap_range to
      use full data cache flush.
      5) Move flush_cache_vmap and flush_cache_vunmap to cache.c. Handle
      VM_IOREMAP case in flush_cache_vmap.
      
      At this time, I don't know whether it is better to always flush when
      the PTE present bit is set or when both the accessed and present bits
      are set. The later saves flushing pages that haven't been accessed,
      but we need to flush in ptep_clear_flush_young. It also needs a page
      table lookup to find the PTE pointer. The lpa instruction only needs
      a page table lookup when the PTE entry isn't in the TLB.
      
      We don't atomically handle setting and clearing the _PAGE_ACCESSED bit.
      If we miss an update, we may miss a flush and the cache may get corrupted.
      Whether the current code is effectively atomic depends on process control.
      
      When CONFIG_FLUSH_PAGE_ACCESSED is set to zero, the page will eventually
      be flushed when the PTE is cleared or in flush_cache_page_if_present. The
      _PAGE_ACCESSED bit is not used, so the problem is avoided.
      
      The flush method can be selected using the CONFIG_FLUSH_PAGE_ACCESSED
      define in cache.c. The default is 0. I didn't see a large difference
      in performance.
      
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: <stable@vger.kernel.org> # v6.6+
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d66f2607
    • Dirk Behme's avatar
      drivers: core: synchronize really_probe() and dev_uevent() · 95d03d36
      Dirk Behme authored
      commit c0a40097 upstream.
      
      Synchronize the dev->driver usage in really_probe() and dev_uevent().
      These can run in different threads, what can result in the following
      race condition for dev->driver uninitialization:
      
      Thread #1:
      ==========
      
      really_probe() {
      ...
      probe_failed:
      ...
      device_unbind_cleanup(dev) {
          ...
          dev->driver = NULL;   // <= Failed probe sets dev->driver to NULL
          ...
          }
      ...
      }
      
      Thread #2:
      ==========
      
      dev_uevent() {
      ...
      if (dev->driver)
            // If dev->driver is NULLed from really_probe() from here on,
            // after above check, the system crashes
            add_uevent_var(env, "DRIVER=%s", dev->driver->name);
      ...
      }
      
      really_probe() holds the lock, already. So nothing needs to be done
      there. dev_uevent() is called with lock held, often, too. But not
      always. What implies that we can't add any locking in dev_uevent()
      itself. So fix this race by adding the lock to the non-protected
      path. This is the path where above race is observed:
      
       dev_uevent+0x235/0x380
       uevent_show+0x10c/0x1f0  <= Add lock here
       dev_attr_show+0x3a/0xa0
       sysfs_kf_seq_show+0x17c/0x250
       kernfs_seq_show+0x7c/0x90
       seq_read_iter+0x2d7/0x940
       kernfs_fop_read_iter+0xc6/0x310
       vfs_read+0x5bc/0x6b0
       ksys_read+0xeb/0x1b0
       __x64_sys_read+0x42/0x50
       x64_sys_call+0x27ad/0x2d30
       do_syscall_64+0xcd/0x1d0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      
      Similar cases are reported by syzkaller in
      
      https://syzkaller.appspot.com/bug?extid=ffa8143439596313a85a
      
      But these are regarding the *initialization* of dev->driver
      
      dev->driver = drv;
      
      As this switches dev->driver to non-NULL these reports can be considered
      to be false-positives (which should be "fixed" by this commit, as well,
      though).
      
      The same issue was reported and tried to be fixed back in 2015 in
      
      https://lore.kernel.org/lkml/1421259054-2574-1-git-send-email-a.sangwan@samsung.com/
      
      already.
      
      Fixes: 239378f1
      
       ("Driver core: add uevent vars for devices of a class")
      Cc: stable <stable@kernel.org>
      Cc: syzbot+ffa8143439596313a85a@syzkaller.appspotmail.com
      Cc: Ashish Sangwan <a.sangwan@samsung.com>
      Cc: Namjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarDirk Behme <dirk.behme@de.bosch.com>
      Link: https://lore.kernel.org/r/20240513050634.3964461-1-dirk.behme@de.bosch.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95d03d36
    • Jean-Baptiste Maneyrol's avatar
      iio: imu: inv_icm42600: delete unneeded update watermark call · 5faae25e
      Jean-Baptiste Maneyrol authored
      commit 245f3b14 upstream.
      
      Update watermark will be done inside the hwfifo_set_watermark callback
      just after the update_scan_mode. It is useless to do it here.
      
      Fixes: 7f85e42a
      
       ("iio: imu: inv_icm42600: add buffer support in iio devices")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
      Link: https://lore.kernel.org/r/20240527210008.612932-1-inv.git-commit@tdk.com
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5faae25e
    • Harshit Mogalapalli's avatar
      iio: temperature: mlx90635: Fix ERR_PTR dereference in mlx90635_probe() · 5a5595ae
      Harshit Mogalapalli authored
      commit a23c14b0 upstream.
      
      When devm_regmap_init_i2c() fails, regmap_ee could be error pointer,
      instead of checking for IS_ERR(regmap_ee), regmap is checked which looks
      like a copy paste error.
      
      Fixes: a1d1ba5e
      
       ("iio: temperature: mlx90635 MLX90635 IR Temperature sensor")
      Reviewed-by: default avatarCrt <Mori&lt;cmo@melexis.com>
      Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
      Link: https://lore.kernel.org/r/20240513203427.3208696-1-harshit.m.mogalapalli@oracle.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a5595ae
    • Adam Rizkalla's avatar
      iio: pressure: bmp280: Fix BMP580 temperature reading · 42748745
      Adam Rizkalla authored
      commit 0f0f6306
      
       upstream.
      
      Fix overflow issue when storing BMP580 temperature reading and
      properly preserve sign of 24-bit data.
      
      Signed-off-by: default avatarAdam Rizkalla <ajarizzo@gmail.com>
      Tested-By: default avatarVasileios Amoiridis <vassilisamir@gmail.com>
      Acked-by: default avatarAngel Iglesias <ang.iglesiasg@gmail.com>
      Link: https://lore.kernel.org/r/Zin2udkXRD0+GrML@adam-asahi.lan
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42748745
    • Jean-Baptiste Maneyrol's avatar
      iio: invensense: fix odr switching to same value · aff1a9b3
      Jean-Baptiste Maneyrol authored
      commit 95444b9e upstream.
      
      ODR switching happens in 2 steps, update to store the new value and then
      apply when the ODR change flag is received in the data. When switching to
      the same ODR value, the ODR change flag is never happening, and frequency
      switching is blocked waiting for the never coming apply.
      
      Fix the issue by preventing update to happen when switching to same ODR
      value.
      
      Fixes: 0ecc363c
      
       ("iio: make invensense timestamp module generic")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
      Link: https://lore.kernel.org/r/20240524124851.567485-1-inv.git-commit@tdk.com
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aff1a9b3
    • Vasileios Amoiridis's avatar
      iio: imu: bmi323: Fix trigger notification in case of error · 67f34cc7
      Vasileios Amoiridis authored
      commit bedb2ccb upstream.
      
      In case of error in the bmi323_trigger_handler() function, the
      function exits without calling the iio_trigger_notify_done()
      which is responsible for informing the attached trigger that
      the process is done and in case there is a .reenable(), to
      call it.
      
      Fixes: 8a636db3
      
       ("iio: imu: Add driver for BMI323 IMU")
      Signed-off-by: default avatarVasileios Amoiridis <vassilisamir@gmail.com>
      Link: https://lore.kernel.org/r/20240508155407.139805-1-vassilisamir@gmail.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67f34cc7
    • Marc Ferland's avatar
      iio: dac: ad5592r: fix temperature channel scaling value · 049655ba
      Marc Ferland authored
      commit 279428df upstream.
      
      The scale value for the temperature channel is (assuming Vref=2.5 and
      the datasheet):
      
          376.7897513
      
      When calculating both val and val2 for the temperature scale we
      use (3767897513/25) and multiply it by Vref (here I assume 2500mV) to
      obtain:
      
        2500 * (3767897513/25) ==> 376789751300
      
      Finally we divide with remainder by 10^9 to get:
      
          val = 376
          val2 = 789751300
      
      However, we return IIO_VAL_INT_PLUS_MICRO (should have been NANO) as
      the scale type. So when converting the raw temperature value to the
      'processed' temperature value we will get (assuming raw=810,
      offset=-753):
      
          processed = (raw + offset) * scale_val
                    = (810 + -753) * 376
      	      = 21432
      
          processed += div((raw + offset) * scale_val2, 10^6)
                    += div((810 + -753) * 789751300, 10^6)
      	      += 45015
          ==> 66447
          ==> 66.4 Celcius
      
      instead of the expected 21.5 Celsius.
      
      Fix this issue by changing IIO_VAL_INT_PLUS_MICRO to
      IIO_VAL_INT_PLUS_NANO.
      
      Fixes: 56ca9db8
      
       ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs")
      Signed-off-by: default avatarMarc Ferland <marc.ferland@sonatest.com>
      Link: https://lore.kernel.org/r/20240501150554.1871390-1-marc.ferland@sonatest.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      049655ba
    • David Lechner's avatar
      iio: adc: ad9467: fix scan type sign · 16701ad0
      David Lechner authored
      commit 8a01ef74 upstream.
      
      According to the IIO documentation, the sign in the scan type should be
      lower case. The ad9467 driver was incorrectly using upper case.
      
      Fix by changing to lower case.
      
      Fixes: 4606d0f4 ("iio: adc: ad9467: add support for AD9434 high-speed ADC")
      Fixes: ad679712
      
       ("iio: adc: ad9467: add support AD9467 ADC")
      Signed-off-by: default avatarDavid Lechner <dlechner@baylibre.com>
      Link: https://lore.kernel.org/r/20240503-ad9467-fix-scan-type-sign-v1-1-c7a1a066ebb9@baylibre.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      16701ad0
    • Benjamin Segall's avatar
      x86/boot: Don't add the EFI stub to targets, again · a139e834
      Benjamin Segall authored
      commit b2747f10 upstream.
      
      This is a re-commit of
      
        da05b143 ("x86/boot: Don't add the EFI stub to targets")
      
      after the tagged patch incorrectly reverted it.
      
      vmlinux-objs-y is added to targets, with an assumption that they are all
      relative to $(obj); adding a $(objtree)/drivers/...  path causes the
      build to incorrectly create a useless
      arch/x86/boot/compressed/drivers/...  directory tree.
      
      Fix this just by using a different make variable for the EFI stub.
      
      Fixes: cb8bda8a
      
       ("x86/boot/compressed: Rename efi_thunk_64.S to efi-mixed.S")
      Signed-off-by: default avatarBen Segall <bsegall@google.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Cc: stable@vger.kernel.org # v6.1+
      Link: https://lore.kernel.org/r/xm267ceukksz.fsf@bsegall.svl.corp.google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a139e834
    • Hans de Goede's avatar
      leds: class: Revert: "If no default trigger is given, make hw_control trigger the default trigger" · 3a678276
      Hans de Goede authored
      commit fcf2a997 upstream.
      
      Commit 66601a29 ("leds: class: If no default trigger is given, make
      hw_control trigger the default trigger") causes ledtrig-netdev to get
      set as default trigger on various network LEDs.
      
      This causes users to hit a pre-existing AB-BA deadlock issue in
      ledtrig-netdev between the LED-trigger locks and the rtnl mutex,
      resulting in hung tasks in kernels >= 6.9.
      
      Solving the deadlock is non trivial, so for now revert the change to
      set the hw_control trigger as default trigger, so that ledtrig-netdev
      no longer gets activated automatically for various network LEDs.
      
      The netdev trigger is not needed because the network LEDs are usually under
      hw-control and the netdev trigger tries to leave things that way so setting
      it as the active trigger for the LED class device is a no-op.
      
      Fixes: 66601a29
      
       ("leds: class: If no default trigger is given, make hw_control trigger the default trigger")
      Reported-by: default avatarGenes Lists <lists@sapience.com>
      Closes: https://lore.kernel.org/all/9d189ec329cfe68ed68699f314e191a10d4b5eda.camel@sapience.com/
      Reported-by: default avatarJohannes Wüller <johanneswueller@gmail.com>
      Closes: https://lore.kernel.org/lkml/e441605c-eaf2-4c2d-872b-d8e541f4cf60@gmail.com/
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Acked-by: default avatarLee Jones <lee@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a678276
    • Oleg Nesterov's avatar
      tick/nohz_full: Don't abuse smp_call_function_single() in tick_setup_device() · e7c263fc
      Oleg Nesterov authored
      commit 07c54cc5 upstream.
      
      After the recent commit 5097cbcb ("sched/isolation: Prevent boot crash
      when the boot CPU is nohz_full") the kernel no longer crashes, but there is
      another problem.
      
      In this case tick_setup_device() calls tick_take_do_timer_from_boot() to
      update tick_do_timer_cpu and this triggers the WARN_ON_ONCE(irqs_disabled)
      in smp_call_function_single().
      
      Kill tick_take_do_timer_from_boot() and just use WRITE_ONCE(), the new
      comment explains why this is safe (thanks Thomas!).
      
      Fixes: 08ae95f4
      
       ("nohz_full: Allow the boot CPU to be nohz_full")
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240528122019.GA28794@redhat.com
      Link: https://lore.kernel.org/all/20240522151742.GA10400@redhat.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7c263fc
    • Namjae Jeon's avatar
      ksmbd: fix missing use of get_write in in smb2_set_ea() · 3f8f567b
      Namjae Jeon authored
      commit 2bfc4214 upstream.
      
      Fix an issue where get_write is not used in smb2_set_ea().
      
      Fixes: 6fc0a265
      
       ("ksmbd: fix potential circular locking issue in smb2_set_ea()")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarWang Zhaolong <wangzhaolong1@huawei.com>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f8f567b
    • Namjae Jeon's avatar
      ksmbd: move leading slash check to smb2_get_name() · 83343130
      Namjae Jeon authored
      commit 1cdeca6a
      
       upstream.
      
      If the directory name in the root of the share starts with
      character like 镜(0x955c) or Ṝ(0x1e5c), it (and anything inside)
      cannot be accessed. The leading slash check must be checked after
      converting unicode to nls string.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83343130
    • Yongzhi Liu's avatar
      misc: microchip: pci1xxxx: fix double free in the error handling of gp_aux_bus_probe() · 1efe5519
      Yongzhi Liu authored
      commit 086c6cbc upstream.
      
      When auxiliary_device_add() returns error and then calls
      auxiliary_device_uninit(), callback function
      gp_auxiliary_device_release() calls ida_free() and
      kfree(aux_device_wrapper) to free memory. We should't
      call them again in the error handling path.
      
      Fix this by skipping the redundant cleanup functions.
      
      Fixes: 393fc2f5
      
       ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
      Signed-off-by: default avatarYongzhi Liu <hyperlyzcs@gmail.com>
      Link: https://lore.kernel.org/r/20240523121434.21855-3-hyperlyzcs@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1efe5519
    • Aleksandr Mishin's avatar
      bnxt_en: Adjust logging of firmware messages in case of released token in __hwrm_send() · 8b65eaea
      Aleksandr Mishin authored
      [ Upstream commit a9b97418 ]
      
      In case of token is released due to token->state == BNXT_HWRM_DEFERRED,
      released token (set to NULL) is used in log messages. This issue is
      expected to be prevented by HWRM_ERR_CODE_PF_UNAVAILABLE error code. But
      this error code is returned by recent firmware. So some firmware may not
      return it. This may lead to NULL pointer dereference.
      Adjust this issue by adding token pointer check.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: 8fa4219d
      
       ("bnxt_en: add dynamic debug support for HWRM messages")
      Suggested-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarAleksandr Mishin <amishin@t-argos.ru>
      Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
      Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20240611082547.12178-1-amishin@t-argos.ru
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8b65eaea
    • Rao Shoaib's avatar
      af_unix: Read with MSG_PEEK loops if the first unread byte is OOB · ad540204
      Rao Shoaib authored
      [ Upstream commit a6736a0a ]
      
      Read with MSG_PEEK flag loops if the first byte to read is an OOB byte.
      commit 22dd70eb ("af_unix: Don't peek OOB data without MSG_OOB.")
      addresses the loop issue but does not address the issue that no data
      beyond OOB byte can be read.
      
      >>> from socket import *
      >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
      >>> c1.send(b'a', MSG_OOB)
      1
      >>> c1.send(b'b')
      1
      >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
      b'b'
      
      >>> from socket import *
      >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
      >>> c2.setsockopt(SOL_SOCKET, SO_OOBINLINE, 1)
      >>> c1.send(b'a', MSG_OOB)
      1
      >>> c1.send(b'b')
      1
      >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
      b'a'
      >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
      b'a'
      >>> c2.recv(1, MSG_DONTWAIT)
      b'a'
      >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
      b'b'
      >>>
      
      Fixes: 314001f0
      
       ("af_unix: Add OOB support")
      Signed-off-by: default avatarRao Shoaib <Rao.Shoaib@oracle.com>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20240611084639.2248934-1-Rao.Shoaib@oracle.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ad540204
    • Michael Chan's avatar
      bnxt_en: Cap the size of HWRM_PORT_PHY_QCFG forwarded response · 6982f3de
      Michael Chan authored
      [ Upstream commit 7d9df38c ]
      
      Firmware interface 1.10.2.118 has increased the size of
      HWRM_PORT_PHY_QCFG response beyond the maximum size that can be
      forwarded.  When the VF's link state is not the default auto state,
      the PF will need to forward the response back to the VF to indicate
      the forced state.  This regression may cause the VF to fail to
      initialize.
      
      Fix it by capping the HWRM_PORT_PHY_QCFG response to the maximum
      96 bytes.  The SPEEDS2_SUPPORTED flag needs to be cleared because the
      new speeds2 fields are beyond the legacy structure.  Also modify
      bnxt_hwrm_fwd_resp() to print a warning if the message size exceeds 96
      bytes to make this failure more obvious.
      
      Fixes: 84a911db
      
       ("bnxt_en: Update firmware interface to 1.10.2.118")
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20240612231736.57823-1-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6982f3de
    • Taehee Yoo's avatar
      ionic: fix use after netif_napi_del() · a87d72b3
      Taehee Yoo authored
      [ Upstream commit 79f18a41 ]
      
      When queues are started, netif_napi_add() and napi_enable() are called.
      If there are 4 queues and only 3 queues are used for the current
      configuration, only 3 queues' napi should be registered and enabled.
      The ionic_qcq_enable() checks whether the .poll pointer is not NULL for
      enabling only the using queue' napi. Unused queues' napi will not be
      registered by netif_napi_add(), so the .poll pointer indicates NULL.
      But it couldn't distinguish whether the napi was unregistered or not
      because netif_napi_del() doesn't reset the .poll pointer to NULL.
      So, ionic_qcq_enable() calls napi_enable() for the queue, which was
      unregistered by netif_napi_del().
      
      Reproducer:
         ethtool -L <interface name> rx 1 tx 1 combined 0
         ethtool -L <interface name> rx 0 tx 0 combined 1
         ethtool -L <interface name> rx 0 tx 0 combined 4
      
      Splat looks like:
      kernel BUG at net/core/dev.c:6666!
      Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
      CPU: 3 PID: 1057 Comm: kworker/3:3 Not tainted 6.10.0-rc2+ #16
      Workqueue: events ionic_lif_deferred_work [ionic]
      RIP: 0010:napi_enable+0x3b/0x40
      Code: 48 89 c2 48 83 e2 f6 80 b9 61 09 00 00 00 74 0d 48 83 bf 60 01 00 00 00 74 03 80 ce 01 f0 4f
      RSP: 0018:ffffb6ed83227d48 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffff97560cda0828 RCX: 0000000000000029
      RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff97560cda0a28
      RBP: ffffb6ed83227d50 R08: 0000000000000400 R09: 0000000000000001
      R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
      R13: ffff97560ce3c1a0 R14: 0000000000000000 R15: ffff975613ba0a20
      FS:  0000000000000000(0000) GS:ffff975d5f780000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f8f734ee200 CR3: 0000000103e50000 CR4: 00000000007506f0
      PKRU: 55555554
      Call Trace:
       <TASK>
       ? die+0x33/0x90
       ? do_trap+0xd9/0x100
       ? napi_enable+0x3b/0x40
       ? do_error_trap+0x83/0xb0
       ? napi_enable+0x3b/0x40
       ? napi_enable+0x3b/0x40
       ? exc_invalid_op+0x4e/0x70
       ? napi_enable+0x3b/0x40
       ? asm_exc_invalid_op+0x16/0x20
       ? napi_enable+0x3b/0x40
       ionic_qcq_enable+0xb7/0x180 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8]
       ionic_start_queues+0xc4/0x290 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8]
       ionic_link_status_check+0x11c/0x170 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8]
       ionic_lif_deferred_work+0x129/0x280 [ionic 59bdfc8a035436e1c4224ff7d10789e3f14643f8]
       process_one_work+0x145/0x360
       worker_thread+0x2bb/0x3d0
       ? __pfx_worker_thread+0x10/0x10
       kthread+0xcc/0x100
       ? __pfx_kthread+0x10/0x10
       ret_from_fork+0x2d/0x50
       ? __pfx_kthread+0x10/0x10
       ret_from_fork_asm+0x1a/0x30
      
      Fixes: 0f3154e6
      
       ("ionic: Add Tx and Rx handling")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Reviewed-by: default avatarBrett Creeley <brett.creeley@amd.com>
      Reviewed-by: default avatarShannon Nelson <shannon.nelson@amd.com>
      Link: https://lore.kernel.org/r/20240612060446.1754392-1-ap420073@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a87d72b3
    • Riana Tauro's avatar
      drm/xe: move disable_c6 call · f4a7584e
      Riana Tauro authored
      [ Upstream commit 2470b141 ]
      
      disable c6 called in guc_pc_fini_hw is unreachable.
      
      GuC PC init returns earlier if skip_guc_pc is true and never
      registers the finish call thus making disable_c6 unreachable.
      
      move this call to gt idle.
      
      v2: rebase
      v3: add fixes tag (Himal)
      
      Fixes: 975e4a37
      
       ("drm/xe: Manually setup C6 when skip_guc_pc is set")
      Signed-off-by: default avatarRiana Tauro <riana.tauro@intel.com>
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240606100842.956072-3-riana.tauro@intel.com
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      (cherry picked from commit 6800e63c
      
      )
      Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f4a7584e
    • Rodrigo Vivi's avatar
      drm/xe: Remove mem_access from guc_pc calls · 6503743b
      Rodrigo Vivi authored
      [ Upstream commit 1e941c98
      
       ]
      
      We are now protected by init, sysfs, or removal and don't
      need these mem_access protections around GuC_PC anymore.
      
      Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240222163937.138342-6-rodrigo.vivi@intel.com
      Stable-dep-of: 2470b141
      
       ("drm/xe: move disable_c6 call")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6503743b
    • Andrzej Hajda's avatar
      drm/xe: flush engine buffers before signalling user fence on all engines · 794556bd
      Andrzej Hajda authored
      [ Upstream commit b5e3a9b8 ]
      
      Tests show that user fence signalling requires kind of write barrier,
      otherwise not all writes performed by the workload will be available
      to userspace. It is already done for render and compute, we need it
      also for the rest: video, gsc, copy.
      
      Fixes: dd08ebf6
      
       ("drm/xe: Introduce a new DRM driver for Intel GPUs")
      Signed-off-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
      Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
      Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240605-fix_user_fence_posted-v3-2-06e7932f784a@intel.com
      (cherry picked from commit 3ad7d18c
      
      )
      Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      794556bd
    • Riana Tauro's avatar
      drm/xe/xe_gt_idle: use GT forcewake domain assertion · b7a0cfab
      Riana Tauro authored
      [ Upstream commit 7c877115 ]
      
      The rc6 registers used in disable_c6 function belong
      to the GT forcewake domain. Hence change the forcewake
      assertion to check GT forcewake domain.
      
      v2: add fixes tag (Himal)
      
      Fixes: 975e4a37
      
       ("drm/xe: Manually setup C6 when skip_guc_pc is set")
      Signed-off-by: default avatarRiana Tauro <riana.tauro@intel.com>
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Reviewed-by: default avatarHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240606100842.956072-2-riana.tauro@intel.com
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      (cherry picked from commit 21b70855
      
      )
      Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b7a0cfab
    • Nikolay Aleksandrov's avatar
      net: bridge: mst: fix suspicious rcu usage in br_mst_set_state · 406bfc04
      Nikolay Aleksandrov authored
      [ Upstream commit 546ceb1d ]
      
      I converted br_mst_set_state to RCU to avoid a vlan use-after-free
      but forgot to change the vlan group dereference helper. Switch to vlan
      group RCU deref helper to fix the suspicious rcu usage warning.
      
      Fixes: 3a7c1661
      
       ("net: bridge: mst: fix vlan use-after-free")
      Reported-by: default avatar <syzbot+9bbe2de1bc9d470eb5fe@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=9bbe2de1bc9d470eb5fe
      Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/20240609103654.914987-3-razor@blackwall.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      406bfc04
    • Nikolay Aleksandrov's avatar
      net: bridge: mst: pass vlan group directly to br_mst_vlan_set_state · d2dc0277
      Nikolay Aleksandrov authored
      [ Upstream commit 36c92936 ]
      
      Pass the already obtained vlan group pointer to br_mst_vlan_set_state()
      instead of dereferencing it again. Each caller has already correctly
      dereferenced it for their context. This change is required for the
      following suspicious RCU dereference fix. No functional changes
      intended.
      
      Fixes: 3a7c1661
      
       ("net: bridge: mst: fix vlan use-after-free")
      Reported-by: default avatar <syzbot+9bbe2de1bc9d470eb5fe@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=9bbe2de1bc9d470eb5fe
      Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/20240609103654.914987-2-razor@blackwall.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d2dc0277
    • Petr Pavlu's avatar
      net/ipv6: Fix the RT cache flush via sysctl using a previous delay · 20cf8021
      Petr Pavlu authored
      [ Upstream commit 14a20e5b ]
      
      The net.ipv6.route.flush system parameter takes a value which specifies
      a delay used during the flush operation for aging exception routes. The
      written value is however not used in the currently requested flush and
      instead utilized only in the next one.
      
      A problem is that ipv6_sysctl_rtcache_flush() first reads the old value
      of net->ipv6.sysctl.flush_delay into a local delay variable and then
      calls proc_dointvec() which actually updates the sysctl based on the
      provided input.
      
      Fix the problem by switching the order of the two operations.
      
      Fixes: 4990509f
      
       ("[NETNS][IPV6]: Make sysctls route per namespace.")
      Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20240607112828.30285-1-petr.pavlu@suse.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      20cf8021
    • Daniel Wagner's avatar
      nvmet-passthru: propagate status from id override functions · c524166e
      Daniel Wagner authored
      [ Upstream commit d76584e5 ]
      
      The id override functions return a status which is not propagated to the
      caller.
      
      Fixes: c1fef73f
      
       ("nvmet: add passthru code to process commands")
      Signed-off-by: default avatarDaniel Wagner <dwagner@suse.de>
      Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c524166e
    • Chengming Zhou's avatar
      block: fix request.queuelist usage in flush · 87907bd6
      Chengming Zhou authored
      [ Upstream commit d0321c81 ]
      
      Friedrich Weber reported a kernel crash problem and bisected to commit
      81ada09c ("blk-flush: reuse rq queuelist in flush state machine").
      
      The root cause is that we use "list_move_tail(&rq->queuelist, pending)"
      in the PREFLUSH/POSTFLUSH sequences. But rq->queuelist.next == xxx since
      it's popped out from plug->cached_rq in __blk_mq_alloc_requests_batch().
      We don't initialize its queuelist just for this first request, although
      the queuelist of all later popped requests will be initialized.
      
      Fix it by changing to use "list_add_tail(&rq->queuelist, pending)" so
      rq->queuelist doesn't need to be initialized. It should be ok since rq
      can't be on any list when PREFLUSH or POSTFLUSH, has no move actually.
      
      Please note the commit 81ada09c
      
       ("blk-flush: reuse rq queuelist in
      flush state machine") also has another requirement that no drivers would
      touch rq->queuelist after blk_mq_end_request() since we will reuse it to
      add rq to the post-flush pending list in POSTFLUSH. If this is not true,
      we will have to revert that commit IMHO.
      
      This updated version adds "list_del_init(&rq->queuelist)" in flush rq
      callback since the dm layer may submit request of a weird invalid format
      (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH), which causes double list_add
      if without this "list_del_init(&rq->queuelist)". The weird invalid format
      problem should be fixed in dm layer.
      
      Reported-by: default avatarFriedrich Weber <f.weber@proxmox.com>
      Closes: https://lore.kernel.org/lkml/14b89dfb-505c-49f7-aebb-01c54451db40@proxmox.com/
      Closes: https://lore.kernel.org/lkml/c9d03ff7-27c5-4ebd-b3f6-5a90d96f35ba@proxmox.com/
      Fixes: 81ada09c
      
       ("blk-flush: reuse rq queuelist in flush state machine")
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: ming.lei@redhat.com
      Cc: bvanassche@acm.org
      Tested-by: default avatarFriedrich Weber <f.weber@proxmox.com>
      Signed-off-by: default avatarChengming Zhou <chengming.zhou@linux.dev>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20240608143115.972486-1-chengming.zhou@linux.dev
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87907bd6
    • Su Hui's avatar
      block: sed-opal: avoid possible wrong address reference in read_sed_opal_key() · a6075ad4
      Su Hui authored
      [ Upstream commit 9b1ebce6 ]
      
      Clang static checker (scan-build) warning:
      block/sed-opal.c:line 317, column 3
      Value stored to 'ret' is never read.
      
      Fix this problem by returning the error code when keyring_search() failed.
      Otherwise, 'key' will have a wrong value when 'kerf' stores the error code.
      
      Fixes: 3bfeb612
      
       ("block: sed-opal: keyring support for SED keys")
      Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
      Link: https://lore.kernel.org/r/20240611073659.429582-1-suhui@nfschina.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a6075ad4
    • Xiaolei Wang's avatar
      net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters · d1ce0826
      Xiaolei Wang authored
      [ Upstream commit be27b896 ]
      
      The current cbs parameter depends on speed after uplinking,
      which is not needed and will report a configuration error
      if the port is not initially connected. The UAPI exposed by
      tc-cbs requires userspace to recalculate the send slope anyway,
      because the formula depends on port_transmit_rate (see man tc-cbs),
      which is not an invariant from tc's perspective. Therefore, we
      use offload->sendslope and offload->idleslope to derive the
      original port_transmit_rate from the CBS formula.
      
      Fixes: 1f705bc6
      
       ("net: stmmac: Add support for CBS QDISC")
      Signed-off-by: default avatarXiaolei Wang <xiaolei.wang@windriver.com>
      Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Link: https://lore.kernel.org/r/20240608143524.2065736-1-xiaolei.wang@windriver.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1ce0826