Skip to content
  1. Feb 23, 2024
    • Oscar Salvador's avatar
      fs,hugetlb: fix NULL pointer dereference in hugetlbs_fill_super · ec784188
      Oscar Salvador authored
      commit 79d72c68 upstream.
      
      When configuring a hugetlb filesystem via the fsconfig() syscall, there is
      a possible NULL dereference in hugetlbfs_fill_super() caused by assigning
      NULL to ctx->hstate in hugetlbfs_parse_param() when the requested pagesize
      is non valid.
      
      E.g: Taking the following steps:
      
           fd = fsopen("hugetlbfs", FSOPEN_CLOEXEC);
           fsconfig(fd, FSCONFIG_SET_STRING, "pagesize", "1024", 0);
           fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0);
      
      Given that the requested "pagesize" is invalid, ctxt->hstate will be replaced
      with NULL, losing its previous value, and we will print an error:
      
       ...
       ...
       case Opt_pagesize:
       ps = memparse(param->string, &rest);
       ctx->hstate = h;
       if (!ctx->hstate) {
               pr_err("Unsupported page size %lu MB\n", ps / SZ_1M);
               return -EINVAL;
       }
       return 0;
       ...
       ...
      
      This is a problem because later on, we will dereference ctxt->hstate in
      hugetlbfs_fill_super()
      
       ...
       ...
       sb->s_blocksize = huge_page_size(ctx->hstate);
       ...
       ...
      
      Causing below Oops.
      
      Fix this by replacing cxt->hstate value only when then pagesize is known
      to be valid.
      
       kernel: hugetlbfs: Unsupported page size 0 MB
       kernel: BUG: kernel NULL pointer dereference, address: 0000000000000028
       kernel: #PF: supervisor read access in kernel mode
       kernel: #PF: error_code(0x0000) - not-present page
       kernel: PGD 800000010f66c067 P4D 800000010f66c067 PUD 1b22f8067 PMD 0
       kernel: Oops: 0000 [#1] PREEMPT SMP PTI
       kernel: CPU: 4 PID: 5659 Comm: syscall Tainted: G            E      6.8.0-rc2-default+ #22 5a47c3fef76212addcc6eb71344aabc35190ae8f
       kernel: Hardware name: Intel Corp. GROVEPORT/GROVEPORT, BIOS GVPRCRB1.86B.0016.D04.1705030402 05/03/2017
       kernel: RIP: 0010:hugetlbfs_fill_super+0xb4/0x1a0
       kernel: Code: 48 8b 3b e8 3e c6 ed ff 48 85 c0 48 89 45 20 0f 84 d6 00 00 00 48 b8 ff ff ff ff ff ff ff 7f 4c 89 e7 49 89 44 24 20 48 8b 03 <8b> 48 28 b8 00 10 00 00 48 d3 e0 49 89 44 24 18 48 8b 03 8b 40 28
       kernel: RSP: 0018:ffffbe9960fcbd48 EFLAGS: 00010246
       kernel: RAX: 0000000000000000 RBX: ffff9af5272ae780 RCX: 0000000000372004
       kernel: RDX: ffffffffffffffff RSI: ffffffffffffffff RDI: ffff9af555e9b000
       kernel: RBP: ffff9af52ee66b00 R08: 0000000000000040 R09: 0000000000370004
       kernel: R10: ffffbe9960fcbd48 R11: 0000000000000040 R12: ffff9af555e9b000
       kernel: R13: ffffffffa66b86c0 R14: ffff9af507d2f400 R15: ffff9af507d2f400
       kernel: FS:  00007ffbc0ba4740(0000) GS:ffff9b0bd7000000(0000) knlGS:0000000000000000
       kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       kernel: CR2: 0000000000000028 CR3: 00000001b1ee0000 CR4: 00000000001506f0
       kernel: Call Trace:
       kernel:  <TASK>
       kernel:  ? __die_body+0x1a/0x60
       kernel:  ? page_fault_oops+0x16f/0x4a0
       kernel:  ? search_bpf_extables+0x65/0x70
       kernel:  ? fixup_exception+0x22/0x310
       kernel:  ? exc_page_fault+0x69/0x150
       kernel:  ? asm_exc_page_fault+0x22/0x30
       kernel:  ? __pfx_hugetlbfs_fill_super+0x10/0x10
       kernel:  ? hugetlbfs_fill_super+0xb4/0x1a0
       kernel:  ? hugetlbfs_fill_super+0x28/0x1a0
       kernel:  ? __pfx_hugetlbfs_fill_super+0x10/0x10
       kernel:  vfs_get_super+0x40/0xa0
       kernel:  ? __pfx_bpf_lsm_capable+0x10/0x10
       kernel:  vfs_get_tree+0x25/0xd0
       kernel:  vfs_cmd_create+0x64/0xe0
       kernel:  __x64_sys_fsconfig+0x395/0x410
       kernel:  do_syscall_64+0x80/0x160
       kernel:  ? syscall_exit_to_user_mode+0x82/0x240
       kernel:  ? do_syscall_64+0x8d/0x160
       kernel:  ? syscall_exit_to_user_mode+0x82/0x240
       kernel:  ? do_syscall_64+0x8d/0x160
       kernel:  ? exc_page_fault+0x69/0x150
       kernel:  entry_SYSCALL_64_after_hwframe+0x6e/0x76
       kernel: RIP: 0033:0x7ffbc0cb87c9
       kernel: Code: 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 97 96 0d 00 f7 d8 64 89 01 48
       kernel: RSP: 002b:00007ffc29d2f388 EFLAGS: 00000206 ORIG_RAX: 00000000000001af
       kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffbc0cb87c9
       kernel: RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000003
       kernel: RBP: 00007ffc29d2f3b0 R08: 0000000000000000 R09: 0000000000000000
       kernel: R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
       kernel: R13: 00007ffc29d2f4c0 R14: 0000000000000000 R15: 0000000000000000
       kernel:  </TASK>
       kernel: Modules linked in: rpcsec_gss_krb5(E) auth_rpcgss(E) nfsv4(E) dns_resolver(E) nfs(E) lockd(E) grace(E) sunrpc(E) netfs(E) af_packet(E) bridge(E) stp(E) llc(E) iscsi_ibft(E) iscsi_boot_sysfs(E) intel_rapl_msr(E) intel_rapl_common(E) iTCO_wdt(E) intel_pmc_bxt(E) sb_edac(E) iTCO_vendor_support(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) coretemp(E) kvm_intel(E) rfkill(E) ipmi_ssif(E) kvm(E) acpi_ipmi(E) irqbypass(E) pcspkr(E) igb(E) ipmi_si(E) mei_me(E) i2c_i801(E) joydev(E) intel_pch_thermal(E) i2c_smbus(E) dca(E) lpc_ich(E) mei(E) ipmi_devintf(E) ipmi_msghandler(E) acpi_pad(E) tiny_power_button(E) button(E) fuse(E) efi_pstore(E) configfs(E) ip_tables(E) x_tables(E) ext4(E) mbcache(E) jbd2(E) hid_generic(E) usbhid(E) sd_mod(E) t10_pi(E) crct10dif_pclmul(E) crc32_pclmul(E) crc32c_intel(E) polyval_clmulni(E) ahci(E) xhci_pci(E) polyval_generic(E) gf128mul(E) ghash_clmulni_intel(E) sha512_ssse3(E) sha256_ssse3(E) xhci_pci_renesas(E) libahci(E) ehci_pci(E) sha1_ssse3(E) xhci_hcd(E) ehci_hcd(E) libata(E)
       kernel:  mgag200(E) i2c_algo_bit(E) usbcore(E) wmi(E) sg(E) dm_multipath(E) dm_mod(E) scsi_dh_rdac(E) scsi_dh_emc(E) scsi_dh_alua(E) scsi_mod(E) scsi_common(E) aesni_intel(E) crypto_simd(E) cryptd(E)
       kernel: Unloaded tainted modules: acpi_cpufreq(E):1 fjes(E):1
       kernel: CR2: 0000000000000028
       kernel: ---[ end trace 0000000000000000 ]---
       kernel: RIP: 0010:hugetlbfs_fill_super+0xb4/0x1a0
       kernel: Code: 48 8b 3b e8 3e c6 ed ff 48 85 c0 48 89 45 20 0f 84 d6 00 00 00 48 b8 ff ff ff ff ff ff ff 7f 4c 89 e7 49 89 44 24 20 48 8b 03 <8b> 48 28 b8 00 10 00 00 48 d3 e0 49 89 44 24 18 48 8b 03 8b 40 28
       kernel: RSP: 0018:ffffbe9960fcbd48 EFLAGS: 00010246
       kernel: RAX: 0000000000000000 RBX: ffff9af5272ae780 RCX: 0000000000372004
       kernel: RDX: ffffffffffffffff RSI: ffffffffffffffff RDI: ffff9af555e9b000
       kernel: RBP: ffff9af52ee66b00 R08: 0000000000000040 R09: 0000000000370004
       kernel: R10: ffffbe9960fcbd48 R11: 0000000000000040 R12: ffff9af555e9b000
       kernel: R13: ffffffffa66b86c0 R14: ffff9af507d2f400 R15: ffff9af507d2f400
       kernel: FS:  00007ffbc0ba4740(0000) GS:ffff9b0bd7000000(0000) knlGS:0000000000000000
       kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       kernel: CR2: 0000000000000028 CR3: 00000001b1ee0000 CR4: 00000000001506f0
      
      Link: https://lkml.kernel.org/r/20240130210418.3771-1-osalvador@suse.de
      Fixes: 32021982
      
       ("hugetlbfs: Convert to fs_context")
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarOscar Salvador <osalvador@suse.de>
      Acked-by: default avatarMuchun Song <muchun.song@linux.dev>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec784188
    • Dave Airlie's avatar
      nouveau/gsp: use correct size for registry rpc. · 18db77b6
      Dave Airlie authored
      commit 61712c94 upstream.
      
      Timur pointed this out before, and it just slipped my mind,
      but this might help some things work better, around pcie power
      management.
      
      Cc: <stable@vger.kernel.org> # v6.7
      Fixes: 8d55b0a9
      
       ("nouveau/gsp: add some basic registry entries.")
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240130032643.2498315-1-airlied@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18db77b6
    • Rishabh Dave's avatar
      ceph: prevent use-after-free in encode_cap_msg() · 7958c1bf
      Rishabh Dave authored
      commit cda4672d
      
       upstream.
      
      In fs/ceph/caps.c, in encode_cap_msg(), "use after free" error was
      caught by KASAN at this line - 'ceph_buffer_get(arg->xattr_buf);'. This
      implies before the refcount could be increment here, it was freed.
      
      In same file, in "handle_cap_grant()" refcount is decremented by this
      line - 'ceph_buffer_put(ci->i_xattrs.blob);'. It appears that a race
      occurred and resource was freed by the latter line before the former
      line could increment it.
      
      encode_cap_msg() is called by __send_cap() and __send_cap() is called by
      ceph_check_caps() after calling __prep_cap(). __prep_cap() is where
      arg->xattr_buf is assigned to ci->i_xattrs.blob. This is the spot where
      the refcount must be increased to prevent "use after free" error.
      
      Cc: stable@vger.kernel.org
      Link: https://tracker.ceph.com/issues/59259
      Signed-off-by: default avatarRishabh Dave <ridave@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7958c1bf
    • Shradha Gupta's avatar
      hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed · 4d29a58d
      Shradha Gupta authored
      commit 9cae43da upstream.
      
      If hv_netvsc driver is unloaded and reloaded, the NET_DEVICE_REGISTER
      handler cannot perform VF register successfully as the register call
      is received before netvsc_probe is finished. This is because we
      register register_netdevice_notifier() very early( even before
      vmbus_driver_register()).
      To fix this, we try to register each such matching VF( if it is visible
      as a netdevice) at the end of netvsc_probe.
      
      Cc: stable@vger.kernel.org
      Fixes: 85520856
      
       ("hv_netvsc: Fix race of register_netdevice_notifier and VF register")
      Suggested-by: default avatarDexuan Cui <decui@microsoft.com>
      Signed-off-by: default avatarShradha Gupta <shradhagupta@linux.microsoft.com>
      Reviewed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Reviewed-by: default avatarDexuan Cui <decui@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d29a58d
    • Petr Tesarik's avatar
      net: stmmac: protect updates of 64-bit statistics counters · e6af0f08
      Petr Tesarik authored
      commit 38cc3c6d upstream.
      
      As explained by a comment in <linux/u64_stats_sync.h>, write side of struct
      u64_stats_sync must ensure mutual exclusion, or one seqcount update could
      be lost on 32-bit platforms, thus blocking readers forever. Such lockups
      have been observed in real world after stmmac_xmit() on one CPU raced with
      stmmac_napi_poll_tx() on another CPU.
      
      To fix the issue without introducing a new lock, split the statics into
      three parts:
      
      1. fields updated only under the tx queue lock,
      2. fields updated only during NAPI poll,
      3. fields updated only from interrupt context,
      
      Updates to fields in the first two groups are already serialized through
      other locks. It is sufficient to split the existing struct u64_stats_sync
      so that each group has its own.
      
      Note that tx_set_ic_bit is updated from both contexts. Split this counter
      so that each context gets its own, and calculate their sum to get the total
      value in stmmac_get_ethtool_stats().
      
      For the third group, multiple interrupts may be processed by different CPUs
      at the same time, but interrupts on the same CPU will not nest. Move fields
      from this group to a newly created per-cpu struct stmmac_pcpu_stats.
      
      Fixes: 133466c3
      
       ("net: stmmac: use per-queue 64 bit statistics where necessary")
      Link: https://lore.kernel.org/netdev/Za173PhviYg-1qIn@torres.zugschlus.de/t/
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPetr Tesarik <petr@tesarici.cz>
      Reviewed-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6af0f08
    • Jan Kiszka's avatar
      riscv/efistub: Ensure GP-relative addressing is not used · 8bfc9c2b
      Jan Kiszka authored
      commit afb2a4fb
      
       upstream.
      
      The cflags for the RISC-V efistub were missing -mno-relax, thus were
      under the risk that the compiler could use GP-relative addressing. That
      happened for _edata with binutils-2.41 and kernel 6.1, causing the
      relocation to fail due to an invalid kernel_size in handle_kernel_image.
      It was not yet observed with newer versions, but that may just be luck.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8bfc9c2b
    • Geert Uytterhoeven's avatar
      pmdomain: renesas: r8a77980-sysc: CR7 must be always on · 22b7dca2
      Geert Uytterhoeven authored
      commit f0e4a135 upstream.
      
      The power domain containing the Cortex-R7 CPU core on the R-Car V3H SoC
      must always be in power-on state, unlike on other SoCs in the R-Car Gen3
      family.  See Table 9.4 "Power domains" in the R-Car Series, 3rd
      Generation Hardware User’s Manual Rev.1.00 and later.
      
      Fix this by marking the domain as a CPU domain without control
      registers, so the driver will not touch it.
      
      Fixes: 41d6d8bd
      
       ("soc: renesas: rcar-sysc: add R8A77980 support")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/fdad9a86132d53ecddf72b734dac406915c4edc0.1705076735.git.geert+renesas@glider.be
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22b7dca2
    • Sinthu Raja's avatar
      net: ethernet: ti: cpsw_new: enable mac_managed_pm to fix mdio · c9dca88c
      Sinthu Raja authored
      commit 9def04e7 upstream.
      
      The below commit  introduced a WARN when phy state is not in the states:
      PHY_HALTED, PHY_READY and PHY_UP.
      commit 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      
      When cpsw_new resumes, there have port in PHY_NOLINK state, so the below
      warning comes out. Set mac_managed_pm be true to tell mdio that the phy
      resume/suspend is managed by the mac, to fix the following warning:
      
      WARNING: CPU: 0 PID: 965 at drivers/net/phy/phy_device.c:326 mdio_bus_phy_resume+0x140/0x144
      CPU: 0 PID: 965 Comm: sh Tainted: G           O       6.1.46-g247b2535b2 #1
      Hardware name: Generic AM33XX (Flattened Device Tree)
       unwind_backtrace from show_stack+0x18/0x1c
       show_stack from dump_stack_lvl+0x24/0x2c
       dump_stack_lvl from __warn+0x84/0x15c
       __warn from warn_slowpath_fmt+0x1a8/0x1c8
       warn_slowpath_fmt from mdio_bus_phy_resume+0x140/0x144
       mdio_bus_phy_resume from dpm_run_callback+0x3c/0x140
       dpm_run_callback from device_resume+0xb8/0x2b8
       device_resume from dpm_resume+0x144/0x314
       dpm_resume from dpm_resume_end+0x14/0x20
       dpm_resume_end from suspend_devices_and_enter+0xd0/0x924
       suspend_devices_and_enter from pm_suspend+0x2e0/0x33c
       pm_suspend from state_store+0x74/0xd0
       state_store from kernfs_fop_write_iter+0x104/0x1ec
       kernfs_fop_write_iter from vfs_write+0x1b8/0x358
       vfs_write from ksys_write+0x78/0xf8
       ksys_write from ret_fast_syscall+0x0/0x54
      Exception stack(0xe094dfa8 to 0xe094dff0)
      dfa0:                   00000004 005c3fb8 00000001 005c3fb8 00000004 00000001
      dfc0: 00000004 005c3fb8 b6f6bba0 00000004 00000004 0059edb8 00000000 00000000
      dfe0: 00000004 bed918f0 b6f09bd3 b6e89a66
      
      Cc: <stable@vger.kernel.org> # v6.0+
      Fixes: 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      Fixes: fba863b8
      
       ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
      Signed-off-by: default avatarSinthu Raja <sinthu.raja@ti.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c9dca88c
    • SeongJae Park's avatar
      mm/damon/sysfs-schemes: fix wrong DAMOS tried regions update timeout setup · cd9ff8dd
      SeongJae Park authored
      commit b9e4bc10 upstream.
      
      DAMON sysfs interface's update_schemes_tried_regions command has a timeout
      of two apply intervals of the DAMOS scheme.  Having zero value DAMOS
      scheme apply interval means it will use the aggregation interval as the
      value.  However, the timeout setup logic is mistakenly using the sampling
      interval insted of the aggregartion interval for the case.  This could
      cause earlier-than-expected timeout of the command.  Fix it.
      
      Link: https://lkml.kernel.org/r/20240202191956.88791-1-sj@kernel.org
      Fixes: 7d6fa31a
      
       ("mm/damon/sysfs-schemes: add timeout for update_schemes_tried_regions")
      Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: <stable@vger.kernel.org> # 6.7.x
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd9ff8dd
    • Alexandra Winter's avatar
      s390/qeth: Fix potential loss of L3-IP@ in case of network issues · 065207a7
      Alexandra Winter authored
      commit 2fe8a236 upstream.
      
      Symptom:
      In case of a bad cable connection (e.g. dirty optics) a fast sequence of
      network DOWN-UP-DOWN-UP could happen. UP triggers recovery of the qeth
      interface. In case of a second DOWN while recovery is still ongoing, it
      can happen that the IP@ of a Layer3 qeth interface is lost and will not
      be recovered by the second UP.
      
      Problem:
      When registration of IP addresses with Layer 3 qeth devices fails, (e.g.
      because of bad address format) the respective IP address is deleted from
      its hash-table in the driver. If registration fails because of a ENETDOWN
      condition, the address should stay in the hashtable, so a subsequent
      recovery can restore it.
      
      3caa4af8 ("qeth: keep ip-address after LAN_OFFLINE failure")
      fixes this for registration failures during normal operation, but not
      during recovery.
      
      Solution:
      Keep L3-IP address in case of ENETDOWN in qeth_l3_recover_ip(). For
      consistency with qeth_l3_add_ip() we also keep it in case of EADDRINUSE,
      i.e. for some reason the card already/still has this address registered.
      
      Fixes: 4a71df50
      
       ("qeth: new qeth device driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240206085849.2902775-1-wintera@linux.ibm.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      065207a7
    • Sinthu Raja's avatar
      net: ethernet: ti: cpsw: enable mac_managed_pm to fix mdio · ba040e18
      Sinthu Raja authored
      commit bc4ce46b upstream.
      
      The below commit  introduced a WARN when phy state is not in the states:
      PHY_HALTED, PHY_READY and PHY_UP.
      commit 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      
      When cpsw resumes, there have port in PHY_NOLINK state, so the below
      warning comes out. Set mac_managed_pm be true to tell mdio that the phy
      resume/suspend is managed by the mac, to fix the following warning:
      
      WARNING: CPU: 0 PID: 965 at drivers/net/phy/phy_device.c:326 mdio_bus_phy_resume+0x140/0x144
      CPU: 0 PID: 965 Comm: sh Tainted: G           O       6.1.46-g247b2535b2 #1
      Hardware name: Generic AM33XX (Flattened Device Tree)
       unwind_backtrace from show_stack+0x18/0x1c
       show_stack from dump_stack_lvl+0x24/0x2c
       dump_stack_lvl from __warn+0x84/0x15c
       __warn from warn_slowpath_fmt+0x1a8/0x1c8
       warn_slowpath_fmt from mdio_bus_phy_resume+0x140/0x144
       mdio_bus_phy_resume from dpm_run_callback+0x3c/0x140
       dpm_run_callback from device_resume+0xb8/0x2b8
       device_resume from dpm_resume+0x144/0x314
       dpm_resume from dpm_resume_end+0x14/0x20
       dpm_resume_end from suspend_devices_and_enter+0xd0/0x924
       suspend_devices_and_enter from pm_suspend+0x2e0/0x33c
       pm_suspend from state_store+0x74/0xd0
       state_store from kernfs_fop_write_iter+0x104/0x1ec
       kernfs_fop_write_iter from vfs_write+0x1b8/0x358
       vfs_write from ksys_write+0x78/0xf8
       ksys_write from ret_fast_syscall+0x0/0x54
      Exception stack(0xe094dfa8 to 0xe094dff0)
      dfa0:                   00000004 005c3fb8 00000001 005c3fb8 00000004 00000001
      dfc0: 00000004 005c3fb8 b6f6bba0 00000004 00000004 0059edb8 00000000 00000000
      dfe0: 00000004 bed918f0 b6f09bd3 b6e89a66
      
      Cc: <stable@vger.kernel.org> # v6.0+
      Fixes: 744d23c7 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
      Fixes: fba863b8
      
       ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
      Signed-off-by: default avatarSinthu Raja <sinthu.raja@ti.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba040e18
    • Christian Brauner's avatar
      fs: relax mount_setattr() permission checks · 2a7a31e1
      Christian Brauner authored
      commit 46f5ab76
      
       upstream.
      
      When we added mount_setattr() I added additional checks compared to the
      legacy do_reconfigure_mnt() and do_change_type() helpers used by regular
      mount(2). If that mount had a parent then verify that the caller and the
      mount namespace the mount is attached to match and if not make sure that
      it's an anonymous mount.
      
      The real rootfs falls into neither category. It is neither an anoymous
      mount because it is obviously attached to the initial mount namespace
      but it also obviously doesn't have a parent mount. So that means legacy
      mount(2) allows changing mount properties on the real rootfs but
      mount_setattr(2) blocks this. I never thought much about this but of
      course someone on this planet of earth changes properties on the real
      rootfs as can be seen in [1].
      
      Since util-linux finally switched to the new mount api in 2.39 not so
      long ago it also relies on mount_setattr() and that surfaced this issue
      when Fedora 39 finally switched to it. Fix this.
      
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=2256843
      Link: https://lore.kernel.org/r/20240206-vfs-mount-rootfs-v1-1-19b335eee133@kernel.org
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Reported-by: default avatarKarel Zak <kzak@redhat.com>
      Cc: stable@vger.kernel.org # v5.12+
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a7a31e1
    • Daniel Bristot de Oliveira's avatar
      tools/rtla: Fix Makefile compiler options for clang · 0b5885f5
      Daniel Bristot de Oliveira authored
      commit bc4cbc9d upstream.
      
      The following errors are showing up when compiling rtla with clang:
      
       $ make HOSTCC=clang CC=clang LLVM_IAS=1
       [...]
      
        clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects
      	-fexceptions -fstack-protector-strong
      	-fasynchronous-unwind-tables -fstack-clash-protection  -Wall
      	-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
      	-Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
      	$(pkg-config --cflags libtracefs)    -c -o src/utils.o src/utils.c
      
        clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
        warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
        1 warning generated.
      
        clang -o rtla -ggdb  src/osnoise.o src/osnoise_hist.o src/osnoise_top.o
        src/rtla.o src/timerlat_aa.o src/timerlat.o src/timerlat_hist.o
        src/timerlat_top.o src/timerlat_u.o src/trace.o src/utils.o $(pkg-config --libs libtracefs)
      
        src/osnoise.o: file not recognized: file format not recognized
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        make: *** [Makefile:110: rtla] Error 1
      
      Solve these issues by:
        - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang
        - informing the linker about -flto=auto
      
      Link: https://lore.kernel.org/linux-trace-kernel/567ac1b94effc228ce9a0225b9df7232a9b35b55.1707217097.git.bristot@kernel.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: Justin Stitt <justinstitt@google.com>
      Fixes: 1a7b22ab
      
       ("tools/rtla: Build with EXTRA_{C,LD}FLAGS")
      Suggested-by: default avatarDonald Zickus <dzickus@redhat.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b5885f5
    • Daniel Bristot de Oliveira's avatar
      tools/rtla: Fix uninitialized bucket/data->bucket_size warning · f2ebb842
      Daniel Bristot de Oliveira authored
      commit 64dc40f7 upstream.
      
      When compiling rtla with clang, I am getting the following warnings:
      
      $ make HOSTCC=clang CC=clang LLVM_IAS=1
      
      [..]
      clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions
      	-fstack-protector-strong -fasynchronous-unwind-tables
      	-fstack-clash-protection  -Wall -Werror=format-security
      	-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
      	$(pkg-config --cflags libtracefs)
      	-c -o src/osnoise_hist.o src/osnoise_hist.c
      src/osnoise_hist.c:138:6: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        138 |         if (data->bucket_size)
            |             ^~~~~~~~~~~~~~~~~
      src/osnoise_hist.c:149:6: note: uninitialized use occurs here
        149 |         if (bucket < entries)
            |             ^~~~~~
      src/osnoise_hist.c:138:2: note: remove the 'if' if its condition is always true
        138 |         if (data->bucket_size)
            |         ^~~~~~~~~~~~~~~~~~~~~~
        139 |                 bucket = duration / data->bucket_size;
      src/osnoise_hist.c:132:12: note: initialize the variable 'bucket' to silence this warning
        132 |         int bucket;
            |                   ^
            |                    = 0
      1 warning generated.
      
      [...]
      
      clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions
      	-fstack-protector-strong -fasynchronous-unwind-tables
      	-fstack-clash-protection  -Wall -Werror=format-security
      	-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
      	$(pkg-config --cflags libtracefs)
      	-c -o src/timerlat_hist.o src/timerlat_hist.c
      src/timerlat_hist.c:181:6: warning: variable 'bucket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        181 |         if (data->bucket_size)
            |             ^~~~~~~~~~~~~~~~~
      src/timerlat_hist.c:204:6: note: uninitialized use occurs here
        204 |         if (bucket < entries)
            |             ^~~~~~
      src/timerlat_hist.c:181:2: note: remove the 'if' if its condition is always true
        181 |         if (data->bucket_size)
            |         ^~~~~~~~~~~~~~~~~~~~~~
        182 |                 bucket = latency / data->bucket_size;
      src/timerlat_hist.c:175:12: note: initialize the variable 'bucket' to silence this warning
        175 |         int bucket;
            |                   ^
            |                    = 0
      1 warning generated.
      
      This is a legit warning, but data->bucket_size is always > 0 (see
      timerlat_hist_parse_args()), so the if is not necessary.
      
      Remove the unneeded if (data->bucket_size) to avoid the warning.
      
      Link: https://lkml.kernel.org/r/6e1b1665cd99042ae705b3e0fc410858c4c42346.1707217097.git.bristot@kernel.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: Justin Stitt <justinstitt@google.com>
      Cc: Donald Zickus <dzickus@redhat.com>
      Fixes: 1eeb6328 ("rtla/timerlat: Add timerlat hist mode")
      Fixes: 829a6c0b
      
       ("rtla/osnoise: Add the hist mode")
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f2ebb842
    • John Kacur's avatar
      tools/rtla: Exit with EXIT_SUCCESS when help is invoked · 1c1218ef
      John Kacur authored
      commit b5f31936 upstream.
      
      Fix rtla so that the following commands exit with 0 when help is invoked
      
      rtla osnoise top -h
      rtla osnoise hist -h
      rtla timerlat top -h
      rtla timerlat hist -h
      
      Link: https://lore.kernel.org/linux-trace-devel/20240203001607.69703-1-jkacur@redhat.com
      
      Cc: stable@vger.kernel.org
      Fixes: 1eeb6328
      
       ("rtla/timerlat: Add timerlat hist mode")
      Signed-off-by: default avatarJohn Kacur <jkacur@redhat.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c1218ef
    • Daniel Bristot de Oliveira's avatar
      tools/rtla: Fix clang warning about mount_point var size · 6bdd43f6
      Daniel Bristot de Oliveira authored
      commit 30369084 upstream.
      
      clang is reporting this warning:
      
      $ make HOSTCC=clang CC=clang LLVM_IAS=1
      [...]
      clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions
      	-fstack-protector-strong -fasynchronous-unwind-tables
      	-fstack-clash-protection  -Wall -Werror=format-security
      	-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
      	$(pkg-config --cflags libtracefs)    -c -o src/utils.o src/utils.c
      
      src/utils.c:548:66: warning: 'fscanf' may overflow; destination buffer in argument 3 has size 1024, but the corresponding specifier may require size 1025 [-Wfortify-source]
        548 |         while (fscanf(fp, "%*s %" STR(MAX_PATH) "s %99s %*s %*d %*d\n", mount_point, type) == 2) {
            |                                                                         ^
      
      Increase mount_point variable size to MAX_PATH+1 to avoid the overflow.
      
      Link: https://lkml.kernel.org/r/1b46712e93a2f4153909514a36016959dcc4021c.1707217097.git.bristot@kernel.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: Justin Stitt <justinstitt@google.com>
      Cc: Donald Zickus <dzickus@redhat.com>
      Fixes: a957cbc0
      
       ("rtla: Add -C cgroup support")
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6bdd43f6
    • limingming3's avatar
      tools/rtla: Replace setting prio with nice for SCHED_OTHER · 939054e1
      limingming3 authored
      commit 14f08c97 upstream.
      
      Since the sched_priority for SCHED_OTHER is always 0, it makes no
      sence to set it.
      Setting nice for SCHED_OTHER seems more meaningful.
      
      Link: https://lkml.kernel.org/r/20240207065142.1753909-1-limingming3@lixiang.com
      
      Cc: stable@vger.kernel.org
      Fixes: b1696371
      
       ("rtla: Helper functions for rtla")
      Signed-off-by: default avatarlimingming3 <limingming3@lixiang.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      939054e1
    • Daniel Bristot de Oliveira's avatar
      tools/rtla: Remove unused sched_getattr() function · d0bc5dfe
      Daniel Bristot de Oliveira authored
      commit 084ce16d upstream.
      
      Clang is reporting:
      
      $ make HOSTCC=clang CC=clang LLVM_IAS=1
      [...]
      clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection  -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS $(pkg-config --cflags libtracefs)    -c -o src/utils.o src/utils.c
      src/utils.c:241:19: warning: unused function 'sched_getattr' [-Wunused-function]
        241 | static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
            |                   ^~~~~~~~~~~~~
      1 warning generated.
      
      Which is correct, so remove the unused function.
      
      Link: https://lkml.kernel.org/r/eaed7ba122c4ae88ce71277c824ef41cbf789385.1707217097.git.bristot@kernel.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: Justin Stitt <justinstitt@google.com>
      Cc: Donald Zickus <dzickus@redhat.com>
      Fixes: b1696371
      
       ("rtla: Helper functions for rtla")
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0bc5dfe
    • Daniel Bristot de Oliveira's avatar
      tools/rv: Fix Makefile compiler options for clang · 7c61d7a2
      Daniel Bristot de Oliveira authored
      commit f9b2c871 upstream.
      
      The following errors are showing up when compiling rv with clang:
      
       $ make HOSTCC=clang CC=clang LLVM_IAS=1
       [...]
        clang -O -g -DVERSION=\"6.8.0-rc1\" -flto=auto -ffat-lto-objects
        -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables
        -fstack-clash-protection  -Wall -Werror=format-security
        -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
        -Wno-maybe-uninitialized $(pkg-config --cflags libtracefs)
        -I include   -c -o src/utils.o src/utils.c
        clang: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
        warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
        1 warning generated.
      
        clang -o rv -ggdb  src/in_kernel.o src/rv.o src/trace.o src/utils.o $(pkg-config --libs libtracefs)
        src/in_kernel.o: file not recognized: file format not recognized
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        make: *** [Makefile:110: rv] Error 1
      
      Solve these issues by:
        - removing -ffat-lto-objects and -Wno-maybe-uninitialized if using clang
        - informing the linker about -flto=auto
      
      Link: https://lkml.kernel.org/r/ed94a8ddc2ca8c8ef663cfb7ae9dd196c4a66b33.1707217097.git.bristot@kernel.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: Justin Stitt <justinstitt@google.com>
      Fixes: 4bc4b131
      
       ("rv: Add rv tool")
      Suggested-by: default avatarDonald Zickus <dzickus@redhat.com>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c61d7a2
    • Daniel Bristot de Oliveira's avatar
      tools/rv: Fix curr_reactor uninitialized variable · 66f427b1
      Daniel Bristot de Oliveira authored
      commit 61ec586b upstream.
      
      clang is reporting:
      
      $ make HOSTCC=clang CC=clang LLVM_IAS=1
      
      clang -O -g -DVERSION=\"6.8.0-rc3\" -flto=auto -fexceptions
      	-fstack-protector-strong -fasynchronous-unwind-tables
      	-fstack-clash-protection  -Wall -Werror=format-security
      	-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
      	$(pkg-config --cflags libtracefs)  -I include
      	-c -o src/in_kernel.o src/in_kernel.c
      [...]
      
      src/in_kernel.c:227:6: warning: variable 'curr_reactor' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        227 |         if (!end)
            |             ^~~~
      src/in_kernel.c:242:9: note: uninitialized use occurs here
        242 |         return curr_reactor;
            |                ^~~~~~~~~~~~
      src/in_kernel.c:227:2: note: remove the 'if' if its condition is always false
        227 |         if (!end)
            |         ^~~~~~~~~
        228 |                 goto out_free;
            |                 ~~~~~~~~~~~~~
      src/in_kernel.c:221:6: warning: variable 'curr_reactor' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        221 |         if (!start)
            |             ^~~~~~
      src/in_kernel.c:242:9: note: uninitialized use occurs here
        242 |         return curr_reactor;
            |                ^~~~~~~~~~~~
      src/in_kernel.c:221:2: note: remove the 'if' if its condition is always false
        221 |         if (!start)
            |         ^~~~~~~~~~~
        222 |                 goto out_free;
            |                 ~~~~~~~~~~~~~
      src/in_kernel.c:215:20: note: initialize the variable 'curr_reactor' to silence this warning
        215 |         char *curr_reactor;
            |                           ^
            |                            = NULL
      2 warnings generated.
      
      Which is correct. Setting curr_reactor to NULL avoids the problem.
      
      Link: https://lkml.kernel.org/r/3a35551149e5ee0cb0950035afcb8082c3b5d05b.1707217097.git.bristot@kernel.org
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: Justin Stitt <justinstitt@google.com>
      Cc: Donald Zickus <dzickus@redhat.com>
      Fixes: 6d60f896
      
       ("tools/rv: Add in-kernel monitor interface")
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      66f427b1
    • Mario Limonciello's avatar
      ASoC: amd: yc: Add DMI quirk for Lenovo Ideapad Pro 5 16ARP8 · a3e469db
      Mario Limonciello authored
      commit 61001073
      
       upstream.
      
      The laptop requires a quirk ID to enable its internal microphone. Add
      it to the DMI quirk table.
      
      Reported-by: default avatarStanislav Petrov <stanislav.i.petrov@gmail.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=216925
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Link: https://lore.kernel.org/r/20240205214853.2689-1-mario.limonciello@amd.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3e469db
    • Gergo Koteles's avatar
      ASoC: tas2781: add module parameter to tascodec_init() · b1d8ea36
      Gergo Koteles authored
      commit 34a10669 upstream.
      
      The tascodec_init() of the snd-soc-tas2781-comlib module is called from
      snd-soc-tas2781-i2c and snd-hda-scodec-tas2781-i2c modules. It calls
      request_firmware_nowait() with parameter THIS_MODULE and a cont/callback
      from the latter modules.
      
      The latter modules can be removed while their callbacks are running,
      resulting in a general protection failure.
      
      Add module parameter to tascodec_init() so request_firmware_nowait() can
      be called with the module of the callback.
      
      Fixes: ef3bcde7
      
       ("ASoC: tas2781: Add tas2781 driver")
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Link: https://lore.kernel.org/r/118dad922cef50525e5aab09badef2fa0eb796e5.1707076603.git.soyer@irl.hu
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1d8ea36
    • Curtis Malainey's avatar
      ASoC: SOF: IPC3: fix message bounds on ipc ops · 10bf47bd
      Curtis Malainey authored
      commit fcbe4873 upstream.
      
      commit 74ad8ed6 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
      introduced a new allocation before the upper bounds check in
      do_rx_work. As a result A DSP can cause bad allocations if spewing
      garbage.
      
      Fixes: 74ad8ed6
      
       ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
      Reported-by: default avatarTim Van Patten <timvp@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarCurtis Malainey <cujomalainey@chromium.org>
      Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
      Reviewed-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
      Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
      Link: https://msgid.link/r/20240213123834.4827-1-peter.ujfalusi@linux.intel.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10bf47bd
    • Easwar Hariharan's avatar
      arm64: Subscribe Microsoft Azure Cobalt 100 to ARM Neoverse N2 errata · be31c245
      Easwar Hariharan authored
      commit fb091ff3
      
       upstream.
      
      Add the MIDR value of Microsoft Azure Cobalt 100, which is a Microsoft
      implemented CPU based on r0p0 of the ARM Neoverse N2 CPU, and therefore
      suffers from all the same errata.
      
      CC: stable@vger.kernel.org # 5.15+
      Signed-off-by: default avatarEaswar Hariharan <eahariha@linux.microsoft.com>
      Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Link: https://lore.kernel.org/r/20240214175522.2457857-1-eahariha@linux.microsoft.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be31c245
    • Mark Brown's avatar
      arm64/signal: Don't assume that TIF_SVE means we saved SVE state · edd23108
      Mark Brown authored
      commit 61da7c8e upstream.
      
      When we are in a syscall we will only save the FPSIMD subset even though
      the task still has access to the full register set, and on context switch
      we will only remove TIF_SVE when loading the register state. This means
      that the signal handling code should not assume that TIF_SVE means that
      the register state is stored in SVE format, it should instead check the
      format that was recorded during save.
      
      Fixes: 8c845e27
      
       ("arm64/sve: Leave SVE enabled on syscall if we don't context switch")
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240130-arm64-sve-signal-regs-v2-1-9fc6f9502782@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      edd23108
    • Fred Ai's avatar
      mmc: sdhci-pci-o2micro: Fix a warm reboot issue that disk can't be detected by BIOS · 0624cb1a
      Fred Ai authored
      commit 58aeb562
      
       upstream.
      
      Driver shall switch clock source from DLL clock to
      OPE clock when power off card to ensure that card
      can be identified with OPE clock by BIOS.
      
      Signed-off-by: default avatarFred Ai <fred.ai@bayhubtech.com>
      Fixes:4be33cf1
      
       ("mmc: sdhci-pci-o2micro: Improve card input timing at SDR104/HS200 mode")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240203102908.4683-1-fredaibayhubtech@126.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0624cb1a
    • Damien Le Moal's avatar
      zonefs: Improve error handling · 9fd47ed0
      Damien Le Moal authored
      commit 14db5f64
      
       upstream.
      
      Write error handling is racy and can sometime lead to the error recovery
      path wrongly changing the inode size of a sequential zone file to an
      incorrect value  which results in garbage data being readable at the end
      of a file. There are 2 problems:
      
      1) zonefs_file_dio_write() updates a zone file write pointer offset
         after issuing a direct IO with iomap_dio_rw(). This update is done
         only if the IO succeed for synchronous direct writes. However, for
         asynchronous direct writes, the update is done without waiting for
         the IO completion so that the next asynchronous IO can be
         immediately issued. However, if an asynchronous IO completes with a
         failure right before the i_truncate_mutex lock protecting the update,
         the update may change the value of the inode write pointer offset
         that was corrected by the error path (zonefs_io_error() function).
      
      2) zonefs_io_error() is called when a read or write error occurs. This
         function executes a report zone operation using the callback function
         zonefs_io_error_cb(), which does all the error recovery handling
         based on the current zone condition, write pointer position and
         according to the mount options being used. However, depending on the
         zoned device being used, a report zone callback may be executed in a
         context that is different from the context of __zonefs_io_error(). As
         a result, zonefs_io_error_cb() may be executed without the inode
         truncate mutex lock held, which can lead to invalid error processing.
      
      Fix both problems as follows:
      - Problem 1: Perform the inode write pointer offset update before a
        direct write is issued with iomap_dio_rw(). This is safe to do as
        partial direct writes are not supported (IOMAP_DIO_PARTIAL is not
        set) and any failed IO will trigger the execution of zonefs_io_error()
        which will correct the inode write pointer offset to reflect the
        current state of the one on the device.
      - Problem 2: Change zonefs_io_error_cb() into zonefs_handle_io_error()
        and call this function directly from __zonefs_io_error() after
        obtaining the zone information using blkdev_report_zones() with a
        simple callback function that copies to a local stack variable the
        struct blk_zone obtained from the device. This ensures that error
        handling is performed holding the inode truncate mutex.
        This change also simplifies error handling for conventional zone files
        by bypassing the execution of report zones entirely. This is safe to
        do because the condition of conventional zones cannot be read-only or
        offline and conventional zone files are always fully mapped with a
        constant file size.
      
      Reported-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Fixes: 8dcc1a9d
      
       ("fs: New zonefs file system")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Tested-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fd47ed0
    • Sebastian Ene's avatar
      KVM: arm64: Fix circular locking dependency · 3ab1c40a
      Sebastian Ene authored
      commit 10c02aad
      
       upstream.
      
      The rule inside kvm enforces that the vcpu->mutex is taken *inside*
      kvm->lock. The rule is violated by the pkvm_create_hyp_vm() which acquires
      the kvm->lock while already holding the vcpu->mutex lock from
      kvm_vcpu_ioctl(). Avoid the circular locking dependency altogether by
      protecting the hyp vm handle with the config_lock, much like we already
      do for other forms of VM-scoped data.
      
      Signed-off-by: default avatarSebastian Ene <sebastianene@google.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20240124091027.1477174-2-sebastianene@google.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ab1c40a
    • Christian Borntraeger's avatar
      KVM: s390: vsie: fix race during shadow creation · 28bb2782
      Christian Borntraeger authored
      commit fe752331
      
       upstream.
      
      Right now it is possible to see gmap->private being zero in
      kvm_s390_vsie_gmap_notifier resulting in a crash.  This is due to the
      fact that we add gmap->private == kvm after creation:
      
      static int acquire_gmap_shadow(struct kvm_vcpu *vcpu,
                                     struct vsie_page *vsie_page)
      {
      [...]
              gmap = gmap_shadow(vcpu->arch.gmap, asce, edat);
              if (IS_ERR(gmap))
                      return PTR_ERR(gmap);
              gmap->private = vcpu->kvm;
      
      Let children inherit the private field of the parent.
      
      Reported-by: default avatarMarc Hartmayer <mhartmay@linux.ibm.com>
      Fixes: a3508fbe
      
       ("KVM: s390: vsie: initial support for nested virtualization")
      Cc: <stable@vger.kernel.org>
      Cc: David Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarJanosch Frank <frankja@linux.ibm.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarClaudio Imbrenda <imbrenda@linux.ibm.com>
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@linux.ibm.com>
      Link: https://lore.kernel.org/r/20231220125317.4258-1-borntraeger@linux.ibm.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28bb2782
    • Steve French's avatar
      smb: Fix regression in writes when non-standard maximum write size negotiated · 63c35afd
      Steve French authored
      commit 4860abb9
      
       upstream.
      
      The conversion to netfs in the 6.3 kernel caused a regression when
      maximum write size is set by the server to an unexpected value which is
      not a multiple of 4096 (similarly if the user overrides the maximum
      write size by setting mount parm "wsize", but sets it to a value that
      is not a multiple of 4096).  When negotiated write size is not a
      multiple of 4096 the netfs code can skip the end of the final
      page when doing large sequential writes, causing data corruption.
      
      This section of code is being rewritten/removed due to a large
      netfs change, but until that point (ie for the 6.3 kernel until now)
      we can not support non-standard maximum write sizes.
      
      Add a warning if a user specifies a wsize on mount that is not
      a multiple of 4096 (and round down), also add a change where we
      round down the maximum write size if the server negotiates a value
      that is not a multiple of 4096 (we also have to check to make sure that
      we do not round it down to zero).
      
      Reported-by: default avatar"R. Diez" <rdiez-2006@rd10.de>
      Fixes: d08089f6
      
       ("cifs: Change the I/O paths to use an iterator rather than a page list")
      Suggested-by: default avatarRonnie Sahlberg <ronniesahlberg@gmail.com>
      Acked-by: default avatarRonnie Sahlberg <ronniesahlberg@gmail.com>
      Tested-by: default avatarMatthew Ruffell <matthew.ruffell@canonical.com>
      Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Cc: stable@vger.kernel.org # v6.3+
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63c35afd
    • Paulo Alcantara's avatar
      smb: client: set correct id, uid and cruid for multiuser automounts · 7590ba90
      Paulo Alcantara authored
      commit 4508ec17 upstream.
      
      When uid, gid and cruid are not specified, we need to dynamically
      set them into the filesystem context used for automounting otherwise
      they'll end up reusing the values from the parent mount.
      
      Fixes: 9fd29a5b
      
       ("cifs: use fs_context for automounts")
      Reported-by: default avatarShane Nehring <snehring@iastate.edu>
      Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2259257
      Cc: stable@vger.kernel.org # 6.2+
      Signed-off-by: default avatarPaulo Alcantara (Red Hat) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7590ba90
    • Mohammad Rahimi's avatar
      thunderbolt: Fix setting the CNS bit in ROUTER_CS_5 · 1fd4b2af
      Mohammad Rahimi authored
      commit ec4d82f8 upstream.
      
      The bit 23, CM TBT3 Not Supported (CNS), in ROUTER_CS_5 indicates
      whether a USB4 Connection Manager is TBT3-Compatible and should be:
          0b for TBT3-Compatible
          1b for Not TBT3-Compatible
      
      Fixes: b0407983
      
       ("thunderbolt: Add initial support for USB4")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMohammad Rahimi <rahimi.mhmmd@gmail.com>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1fd4b2af
    • Marc Zyngier's avatar
      irqchip/gic-v3-its: Fix GICv4.1 VPE affinity update · ec02586a
      Marc Zyngier authored
      commit af9acbfc upstream.
      
      When updating the affinity of a VPE, the VMOVP command is currently skipped
      if the two CPUs are part of the same VPE affinity.
      
      But this is wrong, as the doorbell corresponding to this VPE is still
      delivered on the 'old' CPU, which screws up the balancing.  Furthermore,
      offlining that 'old' CPU results in doorbell interrupts generated for this
      VPE being discarded.
      
      The harsh reality is that VMOVP cannot be elided when a set_affinity()
      request occurs. It needs to be obeyed, and if an optimisation is to be
      made, it is at the point where the affinity change request is made (such as
      in KVM).
      
      Drop the VMOVP elision altogether, and only use the vpe_table_mask
      to try and stay within the same ITS affinity group if at all possible.
      
      Fixes: dd3f050a
      
       (irqchip/gic-v4.1: Implement the v4.1 flavour of VMOVP)
      Reported-by: default avatarKunkun Jiang <jiangkunkun@huawei.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240213101206.2137483-4-maz@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec02586a
    • Marc Zyngier's avatar
      irqchip/gic-v3-its: Restore quirk probing for ACPI-based systems · 4c60c611
      Marc Zyngier authored
      commit 8b02da04 upstream.
      
      While refactoring the way the ITSs are probed, the handling of quirks
      applicable to ACPI-based platforms was lost. As a result, systems such as
      HIP07 lose their GICv4 functionnality, and some other may even fail to
      boot, unless they are configured to boot with DT.
      
      Move the enabling of quirks into its_probe_one(), making it common to all
      firmware implementations.
      
      Fixes: 9585a495
      
       ("irqchip/gic-v3-its: Split allocation from initialisation of its_node")
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
      Reviewed-by: default avatarZenghui Yu <yuzenghui@huawei.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240213101206.2137483-3-maz@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c60c611
    • Doug Berger's avatar
      irqchip/irq-brcmstb-l2: Add write memory barrier before exit · 58a71710
      Doug Berger authored
      commit b0344d68 upstream.
      
      It was observed on Broadcom devices that use GIC v3 architecture L1
      interrupt controllers as the parent of brcmstb-l2 interrupt controllers
      that the deactivation of the parent interrupt could happen before the
      brcmstb-l2 deasserted its output. This would lead the GIC to reactivate the
      interrupt only to find that no L2 interrupt was pending. The result was a
      spurious interrupt invoking handle_bad_irq() with its associated
      messaging. While this did not create a functional problem it is a waste of
      cycles.
      
      The hazard exists because the memory mapped bus writes to the brcmstb-l2
      registers are buffered and the GIC v3 architecture uses a very efficient
      system register write to deactivate the interrupt.
      
      Add a write memory barrier prior to invoking chained_irq_exit() to
      introduce a dsb(st) on those systems to ensure the system register write
      cannot be executed until the memory mapped writes are visible to the
      system.
      
      [ florian: Added Fixes tag ]
      
      Fixes: 7f646e92
      
       ("irqchip: brcmstb-l2: Add Broadcom Set Top Box  Level-2 interrupt controller")
      Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
      Signed-off-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240210012449.3009125-1-florian.fainelli@broadcom.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58a71710
    • Dan Carpenter's avatar
      PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq() · 30e04e84
      Dan Carpenter authored
      commit b5d1b4b4 upstream.
      
      The "msg_addr" variable is u64.  However, the "aligned_offset" is an
      unsigned int.  This means that when the code does:
      
        msg_addr &= ~aligned_offset;
      
      it will unintentionally zero out the high 32 bits.  Use ALIGN_DOWN() to do
      the alignment instead.
      
      Fixes: 2217fffc
      
       ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support")
      Link: https://lore.kernel.org/r/af59c7ad-ab93-40f7-ad4a-7ac0b14d37f5@moroto.mountain
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
      Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      30e04e84
    • Emmanuel Grumbach's avatar
      wifi: iwlwifi: mvm: fix a crash when we run out of stations · c12f0f4d
      Emmanuel Grumbach authored
      commit b7198383 upstream.
      
      A DoS tool that injects loads of authentication frames made our AP
      crash. The iwl_mvm_is_dup() function couldn't find the per-queue
      dup_data which was not allocated.
      
      The root cause for that is that we ran out of stations in the firmware
      and we didn't really add the station to the firmware, yet we didn't
      return an error to mac80211.
      Mac80211 was thinking that we have the station and because of that,
      sta_info::uploaded was set to 1. This allowed
      ieee80211_find_sta_by_ifaddr() to return a valid station object, but
      that ieee80211_sta didn't have any iwl_mvm_sta object initialized and
      that caused the crash mentioned earlier when we got Rx on that station.
      
      Cc: stable@vger.kernel.org
      Fixes: 57974a55
      
       ("wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()")
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
      Link: https://msgid.link/20240206175739.1f76c44b2486.I6a00955e2842f15f0a089db2f834adb9d10fbe35@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c12f0f4d
    • Johannes Berg's avatar
      wifi: mac80211: reload info pointer in ieee80211_tx_dequeue() · cd1f56ce
      Johannes Berg authored
      commit c98d8836 upstream.
      
      This pointer can change here since the SKB can change, so we
      actually later open-coded IEEE80211_SKB_CB() again. Reload
      the pointer where needed, so the monitor-mode case using it
      gets fixed, and then use info-> later as well.
      
      Cc: stable@vger.kernel.org
      Fixes: 53168215
      
       ("mac80211: fix VLAN handling with TXQs")
      Link: https://msgid.link/20240131164910.b54c28d583bc.I29450cec84ea6773cff5d9c16ff92b836c331471@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd1f56ce
    • Johannes Berg's avatar
      wifi: cfg80211: fix wiphy delayed work queueing · f1ff55b4
      Johannes Berg authored
      commit b743287d
      
       upstream.
      
      When a wiphy work is queued with timer, and then again
      without a delay, it's started immediately but *also*
      started again after the timer expires. This can lead,
      for example, to warnings in mac80211's offchannel code
      as reported by Jouni. Running the same work twice isn't
      expected, of course. Fix this by deleting the timer at
      this point, when queuing immediately due to delay=0.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarJouni Malinen <j@w1.fi>
      Fixes: a3ee4dc8
      
       ("wifi: cfg80211: add a work abstraction with special semantics")
      Link: https://msgid.link/20240125095108.2feb0eaaa446.I4617f3210ed0e7f252290d5970dac6a876aa595b@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f1ff55b4
    • Johannes Berg's avatar
      wifi: iwlwifi: fix double-free bug · d24eb9a2
      Johannes Berg authored
      commit 353d321f upstream.
      
      The storage for the TLV PC register data wasn't done like all
      the other storage in the drv->fw area, which is cleared at the
      end of deallocation. Therefore, the freeing must also be done
      differently, explicitly NULL'ing it out after the free, since
      otherwise there's a nasty double-free bug here if a file fails
      to load after this has been parsed, and we get another free
      later (e.g. because no other file exists.) Fix that by adding
      the missing NULL assignment.
      
      Cc: stable@vger.kernel.org
      Fixes: 5e31b3df
      
       ("wifi: iwlwifi: dbg: print pc register data once fw dump occurred")
      Reported-by: default avatarGuy Kaplan <guy.kaplan@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Reviewed-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
      Link: https://msgid.link/20240123200528.675f3c24ec0d.I6ab4015cd78d82dd95471f840629972ef0331de3@changeid
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d24eb9a2