stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6.12 000/114] 6.12.8-rc1 review
@ 2024-12-30 15:41 Greg Kroah-Hartman
  2024-12-30 15:41 ` [PATCH 6.12 001/114] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
                   ` (124 more replies)
  0 siblings, 125 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:41 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, linux-kernel, torvalds, akpm, linux,
	shuah, patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

This is the start of the stable review cycle for the 6.12.8 release.
There are 114 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
or in the git tree and branch at:
	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 6.12.8-rc1

Takashi Iwai <tiwai@suse.de>
    ALSA: sh: Fix wrong argument order for copy_from_iter()

Takashi Iwai <tiwai@suse.de>
    ALSA: ump: Shut up truncated string warning

Chris Lu <chris.lu@mediatek.com>
    Bluetooth: btusb: mediatek: change the conditions for ISO interface

Chris Lu <chris.lu@mediatek.com>
    Bluetooth: btusb: mediatek: add intf release flow when usb disconnect

Chris Lu <chris.lu@mediatek.com>
    Bluetooth: btusb: mediatek: add callback function in btusb_disconnect

Chris Lu <chris.lu@mediatek.com>
    Bluetooth: btusb: mediatek: move Bluetooth power off command position

Boris Burkov <boris@bur.io>
    btrfs: check folio mapping after unlock in relocate_one_folio()

Boris Burkov <boris@bur.io>
    btrfs: check folio mapping after unlock in put_file_data()

Filipe Manana <fdmanana@suse.com>
    btrfs: fix use-after-free when COWing tree bock and tracing is enabled

Qu Wenruo <wqu@suse.com>
    btrfs: sysfs: fix direct super block member reads

Julian Sun <sunjunchao2870@gmail.com>
    btrfs: fix transaction atomicity bug when enabling simple quotas

Filipe Manana <fdmanana@suse.com>
    btrfs: fix swap file activation failure due to extents that used to be shared

Filipe Manana <fdmanana@suse.com>
    btrfs: avoid monopolizing a core when activating a swap file

Filipe Manana <fdmanana@suse.com>
    btrfs: fix race with memory mapped writes when activating swap file

Dimitri Fedrau <dimitri.fedrau@liebherr.com>
    power: supply: gpio-charger: Fix set charge current limits

Thomas Weißschuh <linux@weissschuh.net>
    power: supply: cros_charge-control: hide start threshold on v2 cmd

Thomas Weißschuh <linux@weissschuh.net>
    power: supply: cros_charge-control: allow start_threshold == end_threshold

Thomas Weißschuh <linux@weissschuh.net>
    power: supply: cros_charge-control: add mutex for driver data

Kan Liang <kan.liang@linux.intel.com>
    perf/x86/intel/ds: Add PEBS format 6

Conor Dooley <conor.dooley@microchip.com>
    i2c: microchip-core: fix "ghost" detections

Carlos Song <carlos.song@nxp.com>
    i2c: imx: add imx7d compatible string for applying erratum ERR007805

Kan Liang <kan.liang@linux.intel.com>
    perf/x86/intel: Fix bitmask of OCR and FRONTEND events for LNC

Thomas Gleixner <tglx@linutronix.de>
    PCI/MSI: Handle lack of irqdomain gracefully

Li RongQing <lirongqing@baidu.com>
    virt: tdx-guest: Just leak decrypted memory on unrecoverable errors

Xin Li (Intel) <xin@zytor.com>
    x86/fred: Clear WFE in missing-ENDBRANCH #CPs

Conor Dooley <conor.dooley@microchip.com>
    i2c: microchip-core: actually use repeated sends

Pavel Begunkov <asml.silence@gmail.com>
    io_uring/sqpoll: fix sqpoll error handling races

Tomas Glozar <tglozar@redhat.com>
    rtla/timerlat: Fix histogram ALL for zero samples

Lizhi Xu <lizhi.xu@windriver.com>
    tracing: Prevent bad count for tracing_cpumask_write

Christian Göttsche <cgzones@googlemail.com>
    tracing: Constify string literal data member in struct trace_event_call

Kan Liang <kan.liang@linux.intel.com>
    perf/x86/intel/uncore: Add Clearwater Forest support

Binbin Zhou <zhoubinbin@loongson.cn>
    dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL

Chen Ridong <chenridong@huawei.com>
    freezer, sched: Report frozen tasks as 'D' instead of 'R'

chenchangcheng <ccc194101@163.com>
    objtool: Add bch2_trans_unlocked_error() to bcachefs noreturns

John Harrison <John.C.Harrison@Intel.com>
    drm/xe: Move the coredump registration to the worker thread

Matthew Brost <matthew.brost@intel.com>
    drm/xe: Take PM ref in delayed snapshot capture worker

Ming Lei <ming.lei@redhat.com>
    ublk: detach gendisk from ublk device if add_disk() fails

Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    wifi: iwlwifi: be less noisy if the NIC is dead in S3

Ming Lei <ming.lei@redhat.com>
    blk-mq: register cpuhp callback after hctx is added to xarray table

Ming Lei <ming.lei@redhat.com>
    virtio-blk: don't keep queue frozen during system suspend

Imre Deak <imre.deak@intel.com>
    drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req()

Purushothama Siddaiah <psiddaiah@mvista.com>
    spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()

Qinxin Xia <xiaqinxin@huawei.com>
    ACPI/IORT: Add PMCG platform information for HiSilicon HIP09A

Cathy Avery <cavery@redhat.com>
    scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error

Ranjan Kumar <ranjan.kumar@broadcom.com>
    scsi: mpi3mr: Handling of fault code for insufficient power

Ranjan Kumar <ranjan.kumar@broadcom.com>
    scsi: mpi3mr: Start controller indexing from 0

Ranjan Kumar <ranjan.kumar@broadcom.com>
    scsi: mpi3mr: Fix corrupt config pages PHY state is switched in sysfs

Ranjan Kumar <ranjan.kumar@broadcom.com>
    scsi: mpi3mr: Synchronize access to ioctl data buffer

Ranjan Kumar <ranjan.kumar@broadcom.com>
    scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time

Aapo Vienamo <aapo.vienamo@iki.fi>
    spi: intel: Add Panther Lake SPI controller support

Kumar Kartikeya Dwivedi <memxor@gmail.com>
    bpf: Zero index arg error string for dynptr and iter

Armin Wolf <W_Armin@gmx.de>
    platform/x86: asus-nb-wmi: Ignore unknown event 0xCF

Tiezhu Yang <yangtiezhu@loongson.cn>
    LoongArch: BPF: Adjust the parameter of emit_jirl()

Huacai Chen <chenhuacai@kernel.org>
    LoongArch: Fix reserving screen info memory for above-4G firmware

Mark Brown <broonie@kernel.org>
    regmap: Use correct format specifier for logging range errors

Brahmajit Das <brahmajit.xyz@gmail.com>
    smb: server: Fix building with GCC 15

Takashi Iwai <tiwai@suse.de>
    ALSA: sh: Use standard helper for buffer accesses

bo liu <bo.liu@senarytech.com>
    ALSA: hda/conexant: fix Z60MR100 startup pop issue

Takashi Iwai <tiwai@suse.de>
    ALSA: ump: Update legacy substream names upon FB info update

Takashi Iwai <tiwai@suse.de>
    ALSA: ump: Indicate the inactive group in legacy substream names

Takashi Iwai <tiwai@suse.de>
    ALSA: ump: Don't open legacy substream for an inactive group

Jan Kara <jack@suse.cz>
    udf: Verify inode link counts before performing rename

Jan Kara <jack@suse.cz>
    udf: Skip parent dir link count update if corrupted

Tomas Henzl <thenzl@redhat.com>
    scsi: megaraid_sas: Fix for a potential deadlock

Magnus Lindholm <linmag7@gmail.com>
    scsi: qla1280: Fix hw revision numbering for ISP1020/1040

Yassine Oudjana <y.oudjana@protonmail.com>
    watchdog: mediatek: Add support for MT6735 TOPRGU/WDT

Peter Griffin <peter.griffin@linaro.org>
    Revert "watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs"

Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
    watchdog: rzg2l_wdt: Power on the watchdog domain in the restart handler

James Hilliard <james.hilliard1@gmail.com>
    watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04

Masami Hiramatsu (Google) <mhiramat@kernel.org>
    tracing/kprobe: Make trace_kprobe's module callback called after jump_label update

Alexander Lobakin <aleksander.lobakin@intel.com>
    stddef: make __struct_group() UAPI C++-friendly

Hans de Goede <hdegoede@redhat.com>
    power: supply: bq24190: Fix BQ24296 Vbus regulator support

Haren Myneni <haren@linux.ibm.com>
    powerpc/pseries/vas: Add close() callback in vas_vm_ops struct

Richard Fitzgerald <rf@opensource.cirrus.com>
    ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21Q6 and 21Q7

Chen-Yu Tsai <wenst@chromium.org>
    ASoC: dt-bindings: realtek,rt5645: Fix CPVDD voltage comment

Richard Fitzgerald <rf@opensource.cirrus.com>
    ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21QA and 21QB

Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
    ASoC: amd: ps: Fix for enabling DMIC on acp63 platform via _DSD entry

Dan Carpenter <dan.carpenter@linaro.org>
    mtd: rawnand: fix double free in atmel_pmecc_create_user()

Dustin L. Howett <dustin@howett.net>
    platform/chrome: cros_ec_lpc: fix product identity for early Framework Laptops

Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
    ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP

Chen Ridong <chenridong@huawei.com>
    dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset

Sasha Finkelstein <fnkl.kernel@gmail.com>
    dmaengine: apple-admac: Avoid accessing registers in probe

Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
    dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd()

Lizhi Hou <lizhi.hou@amd.com>
    dmaengine: amd: qdma: Remove using the private get and set dma_ops APIs

Akhil R <akhilrajeev@nvidia.com>
    dmaengine: tegra: Return correct DMA status when paused

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    dmaengine: dw: Select only supported masters for ACPI devices

Javier Carrasco <javier.carrasco.cruz@gmail.com>
    dmaengine: mv_xor: fix child node refcount handling in early exit

Fedor Pchelkin <pchelkin@ispras.ru>
    ALSA: memalloc: prefer dma_mapping_error() over explicit address checking

Chukun Pan <amadeus@jmu.edu.cn>
    phy: rockchip: naneng-combphy: fix phy reset

Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
    phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM

Justin Chen <justin.chen@broadcom.com>
    phy: usb: Toggle the PHY power during init

Zijun Hu <quic_zijuhu@quicinc.com>
    phy: core: Fix that API devm_phy_destroy() fails to destroy the phy

Zijun Hu <quic_zijuhu@quicinc.com>
    phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider

Zijun Hu <quic_zijuhu@quicinc.com>
    phy: core: Fix that API devm_phy_put() fails to release the phy

Zijun Hu <quic_zijuhu@quicinc.com>
    phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()

Zijun Hu <quic_zijuhu@quicinc.com>
    phy: core: Fix an OF node refcount leakage in _of_phy_get()

Krishna Kurapati <quic_kriskura@quicinc.com>
    phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP

Maciej Andrzejewski <maciej.andrzejewski@m-works.net>
    mtd: rawnand: arasan: Fix missing de-registration of NAND

Maciej Andrzejewski <maciej.andrzejewski@m-works.net>
    mtd: rawnand: arasan: Fix double assertion of chip-select

Zichen Xie <zichenxie0106@gmail.com>
    mtd: diskonchip: Cast an operand to prevent potential overflow

NeilBrown <neilb@suse.de>
    nfsd: restore callback functionality for NFSv4.0

Yang Erkun <yangerkun@huawei.com>
    nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work"

Cong Wang <cong.wang@bytedance.com>
    bpf: Check negative offsets in __bpf_skb_min_len()

Zijian Zhang <zijianzhang@bytedance.com>
    tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection

Cong Wang <cong.wang@bytedance.com>
    tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()

Bharath SM <bharathsm.hsk@gmail.com>
    smb: fix bytes written value in /proc/fs/cifs/Stats

Dragan Simic <dsimic@manjaro.org>
    smb: client: Deduplicate "select NETFS_SUPPORT" in Kconfig

Jerome Marchand <jmarchan@redhat.com>
    selftests/bpf: Fix compilation error in get_uprobe_offset()

Bart Van Assche <bvanassche@acm.org>
    mm/vmstat: fix a W=1 clang compiler warning

Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
    fork: avoid inappropriate uprobe access to invalid mm

Andrea Righi <arighi@nvidia.com>
    bpf: Fix bpf_get_smp_processor_id() on !CONFIG_SMP

Willow Cunningham <willow.e.cunningham@gmail.com>
    arm64: dts: broadcom: Fix L2 linesize for Raspberry Pi 5

Ilya Dryomov <idryomov@gmail.com>
    ceph: allocate sparse_ext map only for sparse reads

Nikita Zhandarovich <n.zhandarovich@fintech.ru>
    media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg


-------------

Diffstat:

 Documentation/arch/arm64/silicon-errata.rst        |   5 +-
 .../devicetree/bindings/sound/realtek,rt5645.yaml  |   2 +-
 Makefile                                           |   4 +-
 arch/arm64/boot/dts/broadcom/bcm2712.dtsi          |   8 +-
 arch/loongarch/include/asm/inst.h                  |  12 +-
 arch/loongarch/kernel/efi.c                        |   2 +-
 arch/loongarch/kernel/inst.c                       |   2 +-
 arch/loongarch/net/bpf_jit.c                       |   6 +-
 arch/powerpc/platforms/book3s/vas-api.c            |  36 +++++
 arch/x86/events/intel/core.c                       |  12 +-
 arch/x86/events/intel/ds.c                         |   1 +
 arch/x86/events/intel/uncore.c                     |   1 +
 arch/x86/kernel/cet.c                              |  30 ++++
 block/blk-mq.c                                     |  15 +-
 drivers/acpi/arm64/iort.c                          |   2 +
 drivers/base/regmap/regmap.c                       |   4 +-
 drivers/block/ublk_drv.c                           |  26 +--
 drivers/block/virtio_blk.c                         |   7 +-
 drivers/bluetooth/btusb.c                          |  41 +++--
 drivers/dma/amd/qdma/qdma.c                        |  28 ++--
 drivers/dma/apple-admac.c                          |   7 +-
 drivers/dma/at_xdmac.c                             |   2 +
 drivers/dma/dw/acpi.c                              |   6 +-
 drivers/dma/dw/internal.h                          |   8 +
 drivers/dma/dw/pci.c                               |   4 +-
 drivers/dma/fsl-edma-common.h                      |   1 +
 drivers/dma/fsl-edma-main.c                        |  41 ++++-
 drivers/dma/ls2x-apb-dma.c                         |   2 +-
 drivers/dma/mv_xor.c                               |   2 +
 drivers/dma/tegra186-gpc-dma.c                     |  10 ++
 drivers/gpu/drm/display/drm_dp_mst_topology.c      |  24 ++-
 drivers/gpu/drm/xe/xe_devcoredump.c                |  69 ++++----
 drivers/i2c/busses/i2c-imx.c                       |   1 +
 drivers/i2c/busses/i2c-microchip-corei2c.c         | 126 +++++++++++----
 drivers/media/dvb-frontends/dib3000mb.c            |   2 +-
 drivers/mtd/nand/raw/arasan-nand-controller.c      |  11 +-
 drivers/mtd/nand/raw/atmel/pmecc.c                 |   4 +-
 drivers/mtd/nand/raw/diskonchip.c                  |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h     |  13 +-
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c        |  28 +++-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c    |   2 +
 drivers/pci/msi/irqdomain.c                        |   7 +-
 drivers/pci/msi/msi.c                              |   4 +
 drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c  |   6 +
 drivers/phy/phy-core.c                             |  21 ++-
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c            |   2 +-
 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c |   2 +-
 drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c  |   3 +-
 drivers/platform/chrome/cros_ec_lpc.c              |   4 +-
 drivers/platform/x86/asus-nb-wmi.c                 |   1 +
 drivers/power/supply/bq24190_charger.c             |  12 +-
 drivers/power/supply/cros_charge-control.c         |  36 +++--
 drivers/power/supply/gpio-charger.c                |   8 +
 drivers/scsi/megaraid/megaraid_sas_base.c          |   5 +-
 drivers/scsi/mpi3mr/mpi3mr.h                       |   9 --
 drivers/scsi/mpi3mr/mpi3mr_app.c                   |  36 +++--
 drivers/scsi/mpi3mr/mpi3mr_fw.c                    | 121 ++++++--------
 drivers/scsi/mpi3mr/mpi3mr_os.c                    |   2 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c                |   7 +-
 drivers/scsi/qla1280.h                             |  12 +-
 drivers/scsi/storvsc_drv.c                         |   7 +-
 drivers/spi/spi-intel-pci.c                        |   2 +
 drivers/spi/spi-omap2-mcspi.c                      |   6 +-
 drivers/virt/coco/tdx-guest/tdx-guest.c            |   4 +-
 drivers/watchdog/Kconfig                           |   1 +
 drivers/watchdog/it87_wdt.c                        |  39 +++++
 drivers/watchdog/mtk_wdt.c                         |   6 +
 drivers/watchdog/rzg2l_wdt.c                       |  20 ++-
 drivers/watchdog/s3c2410_wdt.c                     |   8 +-
 fs/btrfs/ctree.c                                   |  11 +-
 fs/btrfs/inode.c                                   | 129 +++++++++++----
 fs/btrfs/qgroup.c                                  |   3 +-
 fs/btrfs/relocation.c                              |   6 +
 fs/btrfs/send.c                                    |   6 +
 fs/btrfs/sysfs.c                                   |   6 +-
 fs/ceph/file.c                                     |   2 +-
 fs/nfsd/export.c                                   |  31 +---
 fs/nfsd/export.h                                   |   4 +-
 fs/nfsd/nfs4callback.c                             |   4 +-
 fs/smb/client/Kconfig                              |   1 -
 fs/smb/client/smb2pdu.c                            |   3 +
 fs/smb/server/smb_common.c                         |   4 +-
 fs/udf/namei.c                                     |  16 +-
 include/linux/platform_data/amd_qdma.h             |   2 +
 include/linux/sched.h                              |   3 +-
 include/linux/skmsg.h                              |  11 +-
 include/linux/trace_events.h                       |   2 +-
 include/linux/vmstat.h                             |   2 +-
 include/net/sock.h                                 |  10 +-
 include/uapi/linux/stddef.h                        |  13 +-
 io_uring/sqpoll.c                                  |   6 +
 kernel/bpf/verifier.c                              |  18 ++-
 kernel/fork.c                                      |  13 +-
 kernel/trace/trace.c                               |   3 +
 kernel/trace/trace_kprobe.c                        |   2 +-
 net/ceph/osd_client.c                              |   2 +
 net/core/filter.c                                  |  21 ++-
 net/core/skmsg.c                                   |   6 +-
 net/ipv4/tcp_bpf.c                                 |   6 +-
 sound/core/memalloc.c                              |   2 +-
 sound/core/ump.c                                   |  26 ++-
 sound/pci/hda/patch_conexant.c                     |  28 ++++
 sound/sh/sh_dac_audio.c                            |   5 +-
 sound/soc/amd/ps/pci-ps.c                          |  17 +-
 sound/soc/intel/boards/sof_sdw.c                   |  23 ++-
 sound/soc/sof/intel/hda-dai.c                      |  25 ++-
 sound/soc/sof/intel/hda.h                          |   2 -
 tools/include/uapi/linux/stddef.h                  |  15 +-
 tools/objtool/noreturns.h                          |   1 +
 tools/testing/selftests/bpf/progs/dynptr_fail.c    |  22 +--
 .../selftests/bpf/progs/iters_state_safety.c       |  14 +-
 .../selftests/bpf/progs/iters_testmod_seq.c        |   4 +-
 .../selftests/bpf/progs/test_kfunc_dynptr_param.c  |   2 +-
 .../selftests/bpf/progs/verifier_bits_iter.c       |   4 +-
 tools/testing/selftests/bpf/trace_helpers.c        |   4 +
 tools/tracing/rtla/src/timerlat_hist.c             | 177 +++++++++++----------
 116 files changed, 1169 insertions(+), 548 deletions(-)



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 001/114] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
@ 2024-12-30 15:41 ` Greg Kroah-Hartman
  2024-12-30 15:41 ` [PATCH 6.12 002/114] ceph: allocate sparse_ext map only for sparse reads Greg Kroah-Hartman
                   ` (123 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:41 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, syzbot+c88fc0ebe0d5935c70da,
	Nikita Zhandarovich, Mauro Carvalho Chehab, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>

[ Upstream commit 2dd59fe0e19e1ab955259978082b62e5751924c7 ]

Syzbot reports [1] an uninitialized value issue found by KMSAN in
dib3000_read_reg().

Local u8 rb[2] is used in i2c_transfer() as a read buffer; in case
that call fails, the buffer may end up with some undefined values.

Since no elaborate error handling is expected in dib3000_write_reg(),
simply zero out rb buffer to mitigate the problem.

[1] Syzkaller report
dvb-usb: bulk message failed: -22 (6/0)
=====================================================
BUG: KMSAN: uninit-value in dib3000mb_attach+0x2d8/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
 dib3000mb_attach+0x2d8/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
 dibusb_dib3000mb_frontend_attach+0x155/0x2f0 drivers/media/usb/dvb-usb/dibusb-mb.c:31
 dvb_usb_adapter_frontend_init+0xed/0x9a0 drivers/media/usb/dvb-usb/dvb-usb-dvb.c:290
 dvb_usb_adapter_init drivers/media/usb/dvb-usb/dvb-usb-init.c:90 [inline]
 dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:186 [inline]
 dvb_usb_device_init+0x25a8/0x3760 drivers/media/usb/dvb-usb/dvb-usb-init.c:310
 dibusb_probe+0x46/0x250 drivers/media/usb/dvb-usb/dibusb-mb.c:110
...
Local variable rb created at:
 dib3000_read_reg+0x86/0x4e0 drivers/media/dvb-frontends/dib3000mb.c:54
 dib3000mb_attach+0x123/0x3c0 drivers/media/dvb-frontends/dib3000mb.c:758
...

Fixes: 74340b0a8bc6 ("V4L/DVB (4457): Remove dib3000-common-module")
Reported-by: syzbot+c88fc0ebe0d5935c70da@syzkaller.appspotmail.com
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://lore.kernel.org/r/20240517155800.9881-1-n.zhandarovich@fintech.ru
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/dvb-frontends/dib3000mb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/dib3000mb.c b/drivers/media/dvb-frontends/dib3000mb.c
index c598b2a63325..7c452ddd9e40 100644
--- a/drivers/media/dvb-frontends/dib3000mb.c
+++ b/drivers/media/dvb-frontends/dib3000mb.c
@@ -51,7 +51,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-a
 static int dib3000_read_reg(struct dib3000_state *state, u16 reg)
 {
 	u8 wb[] = { ((reg >> 8) | 0x80) & 0xff, reg & 0xff };
-	u8 rb[2];
+	u8 rb[2] = {};
 	struct i2c_msg msg[] = {
 		{ .addr = state->config.demod_address, .flags = 0,        .buf = wb, .len = 2 },
 		{ .addr = state->config.demod_address, .flags = I2C_M_RD, .buf = rb, .len = 2 },
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 002/114] ceph: allocate sparse_ext map only for sparse reads
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
  2024-12-30 15:41 ` [PATCH 6.12 001/114] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
@ 2024-12-30 15:41 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 003/114] arm64: dts: broadcom: Fix L2 linesize for Raspberry Pi 5 Greg Kroah-Hartman
                   ` (122 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:41 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Ilya Dryomov, Alex Markuze,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ilya Dryomov <idryomov@gmail.com>

[ Upstream commit 18d44c5d062b97b97bb0162d9742440518958dc1 ]

If mounted with sparseread option, ceph_direct_read_write() ends up
making an unnecessarily allocation for O_DIRECT writes.

Fixes: 03bc06c7b0bd ("ceph: add new mount option to enable sparse reads")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ceph/file.c        | 2 +-
 net/ceph/osd_client.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 67468d88f139..851d70200c6b 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1552,7 +1552,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 		}
 
 		op = &req->r_ops[0];
-		if (sparse) {
+		if (!write && sparse) {
 			extent_cnt = __ceph_sparse_read_ext_count(inode, size);
 			ret = ceph_alloc_sparse_ext_map(op, extent_cnt);
 			if (ret) {
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 9d078b37fe0b..abac770bc0b4 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1173,6 +1173,8 @@ EXPORT_SYMBOL(ceph_osdc_new_request);
 
 int __ceph_alloc_sparse_ext_map(struct ceph_osd_req_op *op, int cnt)
 {
+	WARN_ON(op->op != CEPH_OSD_OP_SPARSE_READ);
+
 	op->extent.sparse_ext_cnt = cnt;
 	op->extent.sparse_ext = kmalloc_array(cnt,
 					      sizeof(*op->extent.sparse_ext),
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 003/114] arm64: dts: broadcom: Fix L2 linesize for Raspberry Pi 5
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
  2024-12-30 15:41 ` [PATCH 6.12 001/114] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
  2024-12-30 15:41 ` [PATCH 6.12 002/114] ceph: allocate sparse_ext map only for sparse reads Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 004/114] bpf: Fix bpf_get_smp_processor_id() on !CONFIG_SMP Greg Kroah-Hartman
                   ` (121 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Willow Cunningham, Florian Fainelli,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Willow Cunningham <willow.e.cunningham@gmail.com>

[ Upstream commit 058387d9c6b70e225da82492e1e193635c3fac3f ]

Set the cache-line-size parameter of the L2 cache for each core to the
correct value of 64 bytes.

Previously, the L2 cache line size was incorrectly set to 128 bytes
for the Broadcom BCM2712. This causes validation tests for the
Performance Application Programming Interface (PAPI) tool to fail as
they depend on sysfs accurately reporting cache line sizes.

The correct value of 64 bytes is stated in the official documentation of
the ARM Cortex A-72, which is linked in the comments of
arm64/boot/dts/broadcom/bcm2712.dtsi as the source for cache-line-size.

Fixes: faa3381267d0 ("arm64: dts: broadcom: Add minimal support for Raspberry Pi 5")
Signed-off-by: Willow Cunningham <willow.e.cunningham@maine.edu>
Link: https://lore.kernel.org/r/20241007212954.214724-1-willow.e.cunningham@maine.edu
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
index 6e5a984c1d4e..26a29e5e5078 100644
--- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
+++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi
@@ -67,7 +67,7 @@
 			l2_cache_l0: l2-cache-l0 {
 				compatible = "cache";
 				cache-size = <0x80000>;
-				cache-line-size = <128>;
+				cache-line-size = <64>;
 				cache-sets = <1024>; //512KiB(size)/64(line-size)=8192ways/8-way set
 				cache-level = <2>;
 				cache-unified;
@@ -91,7 +91,7 @@
 			l2_cache_l1: l2-cache-l1 {
 				compatible = "cache";
 				cache-size = <0x80000>;
-				cache-line-size = <128>;
+				cache-line-size = <64>;
 				cache-sets = <1024>; //512KiB(size)/64(line-size)=8192ways/8-way set
 				cache-level = <2>;
 				cache-unified;
@@ -115,7 +115,7 @@
 			l2_cache_l2: l2-cache-l2 {
 				compatible = "cache";
 				cache-size = <0x80000>;
-				cache-line-size = <128>;
+				cache-line-size = <64>;
 				cache-sets = <1024>; //512KiB(size)/64(line-size)=8192ways/8-way set
 				cache-level = <2>;
 				cache-unified;
@@ -139,7 +139,7 @@
 			l2_cache_l3: l2-cache-l3 {
 				compatible = "cache";
 				cache-size = <0x80000>;
-				cache-line-size = <128>;
+				cache-line-size = <64>;
 				cache-sets = <1024>; //512KiB(size)/64(line-size)=8192ways/8-way set
 				cache-level = <2>;
 				cache-unified;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 004/114] bpf: Fix bpf_get_smp_processor_id() on !CONFIG_SMP
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 003/114] arm64: dts: broadcom: Fix L2 linesize for Raspberry Pi 5 Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 005/114] fork: avoid inappropriate uprobe access to invalid mm Greg Kroah-Hartman
                   ` (120 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Andrea Righi, Andrii Nakryiko,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrea Righi <arighi@nvidia.com>

[ Upstream commit 23579010cf0a12476e96a5f1acdf78a9c5843657 ]

On x86-64 calling bpf_get_smp_processor_id() in a kernel with CONFIG_SMP
disabled can trigger the following bug, as pcpu_hot is unavailable:

 [    8.471774] BUG: unable to handle page fault for address: 00000000936a290c
 [    8.471849] #PF: supervisor read access in kernel mode
 [    8.471881] #PF: error_code(0x0000) - not-present page

Fix by inlining a return 0 in the !CONFIG_SMP case.

Fixes: 1ae6921009e5 ("bpf: inline bpf_get_smp_processor_id() helper")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241217195813.622568-1-arighi@nvidia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/bpf/verifier.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 4c486a0bfcc4..84d958f2c031 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -21085,11 +21085,15 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
 			 * changed in some incompatible and hard to support
 			 * way, it's fine to back out this inlining logic
 			 */
+#ifdef CONFIG_SMP
 			insn_buf[0] = BPF_MOV32_IMM(BPF_REG_0, (u32)(unsigned long)&pcpu_hot.cpu_number);
 			insn_buf[1] = BPF_MOV64_PERCPU_REG(BPF_REG_0, BPF_REG_0);
 			insn_buf[2] = BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_0, 0);
 			cnt = 3;
-
+#else
+			insn_buf[0] = BPF_ALU32_REG(BPF_XOR, BPF_REG_0, BPF_REG_0);
+			cnt = 1;
+#endif
 			new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
 			if (!new_prog)
 				return -ENOMEM;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 005/114] fork: avoid inappropriate uprobe access to invalid mm
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 004/114] bpf: Fix bpf_get_smp_processor_id() on !CONFIG_SMP Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 006/114] mm/vmstat: fix a W=1 clang compiler warning Greg Kroah-Hartman
                   ` (119 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Lorenzo Stoakes,
	syzbot+2d788f4f7cb660dac4b7, Adrian Hunter, Alexander Shishkin,
	Arnaldo Carvalho de Melo, Ian Rogers, Ingo Molnar, Jann Horn,
	Jiri Olsa, Kan Liang, Liam R. Howlett, Mark Rutland,
	Masami Hiramatsu, Namhyung Kim, Oleg Nesterov, Peng Zhang,
	Peter Zijlstra, Vlastimil Babka, David Hildenbrand, Andrew Morton,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

[ Upstream commit 8ac662f5da19f5873fdd94c48a5cdb45b2e1b58f ]

If dup_mmap() encounters an issue, currently uprobe is able to access the
relevant mm via the reverse mapping (in build_map_info()), and if we are
very unlucky with a race window, observe invalid XA_ZERO_ENTRY state which
we establish as part of the fork error path.

This occurs because uprobe_write_opcode() invokes anon_vma_prepare() which
in turn invokes find_mergeable_anon_vma() that uses a VMA iterator,
invoking vma_iter_load() which uses the advanced maple tree API and thus
is able to observe XA_ZERO_ENTRY entries added to dup_mmap() in commit
d24062914837 ("fork: use __mt_dup() to duplicate maple tree in
dup_mmap()").

This change was made on the assumption that only process tear-down code
would actually observe (and make use of) these values.  However this very
unlikely but still possible edge case with uprobes exists and
unfortunately does make these observable.

The uprobe operation prevents races against the dup_mmap() operation via
the dup_mmap_sem semaphore, which is acquired via uprobe_start_dup_mmap()
and dropped via uprobe_end_dup_mmap(), and held across
register_for_each_vma() prior to invoking build_map_info() which does the
reverse mapping lookup.

Currently these are acquired and dropped within dup_mmap(), which exposes
the race window prior to error handling in the invoking dup_mm() which
tears down the mm.

We can avoid all this by just moving the invocation of
uprobe_start_dup_mmap() and uprobe_end_dup_mmap() up a level to dup_mm()
and only release this lock once the dup_mmap() operation succeeds or clean
up is done.

This means that the uprobe code can never observe an incompletely
constructed mm and resolves the issue in this case.

Link: https://lkml.kernel.org/r/20241210172412.52995-1-lorenzo.stoakes@oracle.com
Fixes: d24062914837 ("fork: use __mt_dup() to duplicate maple tree in dup_mmap()")
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reported-by: syzbot+2d788f4f7cb660dac4b7@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6756d273.050a0220.2477f.003d.GAE@google.com/
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/fork.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index ce8be55e5e04..e192bdbc9ade 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -640,11 +640,8 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 	LIST_HEAD(uf);
 	VMA_ITERATOR(vmi, mm, 0);
 
-	uprobe_start_dup_mmap();
-	if (mmap_write_lock_killable(oldmm)) {
-		retval = -EINTR;
-		goto fail_uprobe_end;
-	}
+	if (mmap_write_lock_killable(oldmm))
+		return -EINTR;
 	flush_cache_dup_mm(oldmm);
 	uprobe_dup_mmap(oldmm, mm);
 	/*
@@ -783,8 +780,6 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 		dup_userfaultfd_complete(&uf);
 	else
 		dup_userfaultfd_fail(&uf);
-fail_uprobe_end:
-	uprobe_end_dup_mmap();
 	return retval;
 
 fail_nomem_anon_vma_fork:
@@ -1692,9 +1687,11 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
 	if (!mm_init(mm, tsk, mm->user_ns))
 		goto fail_nomem;
 
+	uprobe_start_dup_mmap();
 	err = dup_mmap(mm, oldmm);
 	if (err)
 		goto free_pt;
+	uprobe_end_dup_mmap();
 
 	mm->hiwater_rss = get_mm_rss(mm);
 	mm->hiwater_vm = mm->total_vm;
@@ -1709,6 +1706,8 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
 	mm->binfmt = NULL;
 	mm_init_owner(mm, NULL);
 	mmput(mm);
+	if (err)
+		uprobe_end_dup_mmap();
 
 fail_nomem:
 	return NULL;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 006/114] mm/vmstat: fix a W=1 clang compiler warning
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 005/114] fork: avoid inappropriate uprobe access to invalid mm Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 007/114] selftests/bpf: Fix compilation error in get_uprobe_offset() Greg Kroah-Hartman
                   ` (118 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Bart Van Assche,
	Konstantin Khlebnikov, Nathan Chancellor, Andrew Morton,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bvanassche@acm.org>

[ Upstream commit 30c2de0a267c04046d89e678cc0067a9cfb455df ]

Fix the following clang compiler warning that is reported if the kernel is
built with W=1:

./include/linux/vmstat.h:518:36: error: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Werror,-Wenum-enum-conversion]
  518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
      |                               ~~~~~~~~~~~ ^ ~~~

Link: https://lkml.kernel.org/r/20241212213126.1269116-1-bvanassche@acm.org
Fixes: 9d7ea9a297e6 ("mm/vmstat: add helpers to get vmstat item names for each enum type")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/vmstat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index d2761bf8ff32..9f3a04345b86 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -515,7 +515,7 @@ static inline const char *node_stat_name(enum node_stat_item item)
 
 static inline const char *lru_list_name(enum lru_list lru)
 {
-	return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
+	return node_stat_name(NR_LRU_BASE + (enum node_stat_item)lru) + 3; // skip "nr_"
 }
 
 #if defined(CONFIG_VM_EVENT_COUNTERS) || defined(CONFIG_MEMCG)
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 007/114] selftests/bpf: Fix compilation error in get_uprobe_offset()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 006/114] mm/vmstat: fix a W=1 clang compiler warning Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 008/114] smb: client: Deduplicate "select NETFS_SUPPORT" in Kconfig Greg Kroah-Hartman
                   ` (117 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Jerome Marchand, Daniel Borkmann,
	Yonghong Song, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jerome Marchand <jmarchan@redhat.com>

[ Upstream commit 716f2bca1ce93bb95364f1fc0555c1650507b588 ]

In get_uprobe_offset(), the call to procmap_query() use the constant
PROCMAP_QUERY_VMA_EXECUTABLE, even if PROCMAP_QUERY is not defined.

Define PROCMAP_QUERY_VMA_EXECUTABLE when PROCMAP_QUERY isn't.

Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available")
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20241218175724.578884-1-jmarchan@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/testing/selftests/bpf/trace_helpers.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index 2d742fdac6b9..81943c6254e6 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -293,6 +293,10 @@ static int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *st
 	return 0;
 }
 #else
+# ifndef PROCMAP_QUERY_VMA_EXECUTABLE
+#  define PROCMAP_QUERY_VMA_EXECUTABLE 0x04
+# endif
+
 static int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
 {
 	return -EOPNOTSUPP;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 008/114] smb: client: Deduplicate "select NETFS_SUPPORT" in Kconfig
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 007/114] selftests/bpf: Fix compilation error in get_uprobe_offset() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 009/114] smb: fix bytes written value in /proc/fs/cifs/Stats Greg Kroah-Hartman
                   ` (116 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Dragan Simic, Steve French,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dragan Simic <dsimic@manjaro.org>

[ Upstream commit ee1c8e6b2931811a906b8c78006bfe0a3386fa60 ]

Repeating automatically selected options in Kconfig files is redundant, so
let's delete repeated "select NETFS_SUPPORT" that was added accidentally.

Fixes: 69c3c023af25 ("cifs: Implement netfslib hooks")
Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/smb/client/Kconfig b/fs/smb/client/Kconfig
index 2aff6d1395ce..9f05f94e265a 100644
--- a/fs/smb/client/Kconfig
+++ b/fs/smb/client/Kconfig
@@ -2,7 +2,6 @@
 config CIFS
 	tristate "SMB3 and CIFS support (advanced network filesystem)"
 	depends on INET
-	select NETFS_SUPPORT
 	select NLS
 	select NLS_UCS2_UTILS
 	select CRYPTO
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 009/114] smb: fix bytes written value in /proc/fs/cifs/Stats
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 008/114] smb: client: Deduplicate "select NETFS_SUPPORT" in Kconfig Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 010/114] tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress() Greg Kroah-Hartman
                   ` (115 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Bharath SM, Steve French,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bharath SM <bharathsm.hsk@gmail.com>

[ Upstream commit 92941c7f2c9529fac1b2670482d0ced3b46eac70 ]

With recent netfs apis changes, the bytes written
value was not getting updated in /proc/fs/cifs/Stats.
Fix this by updating tcon->bytes in write operations.

Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
Signed-off-by: Bharath SM <bharathsm@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/client/smb2pdu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index d1bd69cbfe09..4750505465ae 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -4855,6 +4855,8 @@ smb2_writev_callback(struct mid_q_entry *mid)
 		if (written > wdata->subreq.len)
 			written &= 0xFFFF;
 
+		cifs_stats_bytes_written(tcon, written);
+
 		if (written < wdata->subreq.len)
 			wdata->result = -ENOSPC;
 		else
@@ -5171,6 +5173,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
 		cifs_dbg(VFS, "Send error in write = %d\n", rc);
 	} else {
 		*nbytes = le32_to_cpu(rsp->DataLength);
+		cifs_stats_bytes_written(io_parms->tcon, *nbytes);
 		trace_smb3_write_done(0, 0, xid,
 				      req->PersistentFileId,
 				      io_parms->tcon->tid,
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 010/114] tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 009/114] smb: fix bytes written value in /proc/fs/cifs/Stats Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 011/114] tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection Greg Kroah-Hartman
                   ` (114 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Cong Wang, Daniel Borkmann,
	John Fastabend, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Cong Wang <cong.wang@bytedance.com>

[ Upstream commit 54f89b3178d5448dd4457afbb98fc1ab99090a65 ]

When bpf_tcp_ingress() is called, the skmsg is being redirected to the
ingress of the destination socket. Therefore, we should charge its
receive socket buffer, instead of sending socket buffer.

Because sk_rmem_schedule() tests pfmemalloc of skb, we need to
introduce a wrapper and call it for skmsg.

Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20241210012039.1669389-2-zijianzhang@bytedance.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/sock.h | 10 ++++++++--
 net/ipv4/tcp_bpf.c |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index f29c14448938..fa055cf1785e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1521,7 +1521,7 @@ static inline bool sk_wmem_schedule(struct sock *sk, int size)
 }
 
 static inline bool
-sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)
+__sk_rmem_schedule(struct sock *sk, int size, bool pfmemalloc)
 {
 	int delta;
 
@@ -1529,7 +1529,13 @@ sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)
 		return true;
 	delta = size - sk->sk_forward_alloc;
 	return delta <= 0 || __sk_mem_schedule(sk, delta, SK_MEM_RECV) ||
-		skb_pfmemalloc(skb);
+	       pfmemalloc;
+}
+
+static inline bool
+sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)
+{
+	return __sk_rmem_schedule(sk, size, skb_pfmemalloc(skb));
 }
 
 static inline int sk_unused_reserved_mem(const struct sock *sk)
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index 99cef92e6290..b21ea634909c 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -49,7 +49,7 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock,
 		sge = sk_msg_elem(msg, i);
 		size = (apply && apply_bytes < sge->length) ?
 			apply_bytes : sge->length;
-		if (!sk_wmem_schedule(sk, size)) {
+		if (!__sk_rmem_schedule(sk, size, false)) {
 			if (!copied)
 				ret = -ENOMEM;
 			break;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 011/114] tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 010/114] tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 012/114] bpf: Check negative offsets in __bpf_skb_min_len() Greg Kroah-Hartman
                   ` (113 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Zijian Zhang, Daniel Borkmann,
	John Fastabend, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zijian Zhang <zijianzhang@bytedance.com>

[ Upstream commit d888b7af7c149c115dd6ac772cc11c375da3e17c ]

When we do sk_psock_verdict_apply->sk_psock_skb_ingress, an sk_msg will
be created out of the skb, and the rmem accounting of the sk_msg will be
handled by the skb.

For skmsgs in __SK_REDIRECT case of tcp_bpf_send_verdict, when redirecting
to the ingress of a socket, although we sk_rmem_schedule and add sk_msg to
the ingress_msg of sk_redir, we do not update sk_rmem_alloc. As a result,
except for the global memory limit, the rmem of sk_redir is nearly
unlimited. Thus, add sk_rmem_alloc related logic to limit the recv buffer.

Since the function sk_msg_recvmsg and __sk_psock_purge_ingress_msg are
used in these two paths. We use "msg->skb" to test whether the sk_msg is
skb backed up. If it's not, we shall do the memory accounting explicitly.

Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Zijian Zhang <zijianzhang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20241210012039.1669389-3-zijianzhang@bytedance.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/skmsg.h | 11 ++++++++---
 net/core/skmsg.c      |  6 +++++-
 net/ipv4/tcp_bpf.c    |  4 +++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
index d9b03e0746e7..2cbe0c22a32f 100644
--- a/include/linux/skmsg.h
+++ b/include/linux/skmsg.h
@@ -317,17 +317,22 @@ static inline void sock_drop(struct sock *sk, struct sk_buff *skb)
 	kfree_skb(skb);
 }
 
-static inline void sk_psock_queue_msg(struct sk_psock *psock,
+static inline bool sk_psock_queue_msg(struct sk_psock *psock,
 				      struct sk_msg *msg)
 {
+	bool ret;
+
 	spin_lock_bh(&psock->ingress_lock);
-	if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED))
+	if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) {
 		list_add_tail(&msg->list, &psock->ingress_msg);
-	else {
+		ret = true;
+	} else {
 		sk_msg_free(psock->sk, msg);
 		kfree(msg);
+		ret = false;
 	}
 	spin_unlock_bh(&psock->ingress_lock);
+	return ret;
 }
 
 static inline struct sk_msg *sk_psock_dequeue_msg(struct sk_psock *psock)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index e90fbab703b2..8ad7e6755fd6 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -445,8 +445,10 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,
 			if (likely(!peek)) {
 				sge->offset += copy;
 				sge->length -= copy;
-				if (!msg_rx->skb)
+				if (!msg_rx->skb) {
 					sk_mem_uncharge(sk, copy);
+					atomic_sub(copy, &sk->sk_rmem_alloc);
+				}
 				msg_rx->sg.size -= copy;
 
 				if (!sge->length) {
@@ -772,6 +774,8 @@ static void __sk_psock_purge_ingress_msg(struct sk_psock *psock)
 
 	list_for_each_entry_safe(msg, tmp, &psock->ingress_msg, list) {
 		list_del(&msg->list);
+		if (!msg->skb)
+			atomic_sub(msg->sg.size, &psock->sk->sk_rmem_alloc);
 		sk_msg_free(psock->sk, msg);
 		kfree(msg);
 	}
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index b21ea634909c..392678ae80f4 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -56,6 +56,7 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock,
 		}
 
 		sk_mem_charge(sk, size);
+		atomic_add(size, &sk->sk_rmem_alloc);
 		sk_msg_xfer(tmp, msg, i, size);
 		copied += size;
 		if (sge->length)
@@ -74,7 +75,8 @@ static int bpf_tcp_ingress(struct sock *sk, struct sk_psock *psock,
 
 	if (!ret) {
 		msg->sg.start = i;
-		sk_psock_queue_msg(psock, tmp);
+		if (!sk_psock_queue_msg(psock, tmp))
+			atomic_sub(copied, &sk->sk_rmem_alloc);
 		sk_psock_data_ready(sk, psock);
 	} else {
 		sk_msg_free(sk, tmp);
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 012/114] bpf: Check negative offsets in __bpf_skb_min_len()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 011/114] tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 013/114] nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work" Greg Kroah-Hartman
                   ` (112 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Cong Wang, Daniel Borkmann,
	John Fastabend, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Cong Wang <cong.wang@bytedance.com>

[ Upstream commit 9ecc4d858b92c1bb0673ad9c327298e600c55659 ]

skb_network_offset() and skb_transport_offset() can be negative when
they are called after we pull the transport header, for example, when
we use eBPF sockmap at the point of ->sk_data_ready().

__bpf_skb_min_len() uses an unsigned int to get these offsets, this
leads to a very large number which then causes bpf_skb_change_tail()
failed unexpectedly.

Fix this by using a signed int to get these offsets and ensure the
minimum is at least zero.

Fixes: 5293efe62df8 ("bpf: add bpf_skb_change_tail helper")
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20241213034057.246437-2-xiyou.wangcong@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/core/filter.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 9a459213d283..55495063621d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3751,13 +3751,22 @@ static const struct bpf_func_proto bpf_skb_adjust_room_proto = {
 
 static u32 __bpf_skb_min_len(const struct sk_buff *skb)
 {
-	u32 min_len = skb_network_offset(skb);
+	int offset = skb_network_offset(skb);
+	u32 min_len = 0;
 
-	if (skb_transport_header_was_set(skb))
-		min_len = skb_transport_offset(skb);
-	if (skb->ip_summed == CHECKSUM_PARTIAL)
-		min_len = skb_checksum_start_offset(skb) +
-			  skb->csum_offset + sizeof(__sum16);
+	if (offset > 0)
+		min_len = offset;
+	if (skb_transport_header_was_set(skb)) {
+		offset = skb_transport_offset(skb);
+		if (offset > 0)
+			min_len = offset;
+	}
+	if (skb->ip_summed == CHECKSUM_PARTIAL) {
+		offset = skb_checksum_start_offset(skb) +
+			 skb->csum_offset + sizeof(__sum16);
+		if (offset > 0)
+			min_len = offset;
+	}
 	return min_len;
 }
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 013/114] nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work"
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 012/114] bpf: Check negative offsets in __bpf_skb_min_len() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 014/114] nfsd: restore callback functionality for NFSv4.0 Greg Kroah-Hartman
                   ` (111 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Yang Erkun, Chuck Lever, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yang Erkun <yangerkun@huawei.com>

[ Upstream commit 69d803c40edeaf94089fbc8751c9b746cdc35044 ]

This reverts commit f8c989a0c89a75d30f899a7cabdc14d72522bb8d.

Before this commit, svc_export_put or expkey_put will call path_put with
sync mode. After this commit, path_put will be called with async mode.
And this can lead the unexpected results show as follow.

mkfs.xfs -f /dev/sda
echo "/ *(rw,no_root_squash,fsid=0)" > /etc/exports
echo "/mnt *(rw,no_root_squash,fsid=1)" >> /etc/exports
exportfs -ra
service nfs-server start
mount -t nfs -o vers=4.0 127.0.0.1:/mnt /mnt1
mount /dev/sda /mnt/sda
touch /mnt1/sda/file
exportfs -r
umount /mnt/sda # failed unexcepted

The touch will finally call nfsd_cross_mnt, add refcount to mount, and
then add cache_head. Before this commit, exportfs -r will call
cache_flush to cleanup all cache_head, and path_put in
svc_export_put/expkey_put will be finished with sync mode. So, the
latter umount will always success. However, after this commit, path_put
will be called with async mode, the latter umount may failed, and if
we add some delay, umount will success too. Personally I think this bug
and should be fixed. We first revert before bugfix patch, and then fix
the original bug with a different way.

Fixes: f8c989a0c89a ("nfsd: release svc_expkey/svc_export with rcu_work")
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfsd/export.c | 31 ++++++-------------------------
 fs/nfsd/export.h |  4 ++--
 2 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 6d0455973d64..49aede376d86 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -40,24 +40,15 @@
 #define	EXPKEY_HASHMAX		(1 << EXPKEY_HASHBITS)
 #define	EXPKEY_HASHMASK		(EXPKEY_HASHMAX -1)
 
-static void expkey_put_work(struct work_struct *work)
+static void expkey_put(struct kref *ref)
 {
-	struct svc_expkey *key =
-		container_of(to_rcu_work(work), struct svc_expkey, ek_rcu_work);
+	struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
 
 	if (test_bit(CACHE_VALID, &key->h.flags) &&
 	    !test_bit(CACHE_NEGATIVE, &key->h.flags))
 		path_put(&key->ek_path);
 	auth_domain_put(key->ek_client);
-	kfree(key);
-}
-
-static void expkey_put(struct kref *ref)
-{
-	struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
-
-	INIT_RCU_WORK(&key->ek_rcu_work, expkey_put_work);
-	queue_rcu_work(system_wq, &key->ek_rcu_work);
+	kfree_rcu(key, ek_rcu);
 }
 
 static int expkey_upcall(struct cache_detail *cd, struct cache_head *h)
@@ -364,26 +355,16 @@ static void export_stats_destroy(struct export_stats *stats)
 					    EXP_STATS_COUNTERS_NUM);
 }
 
-static void svc_export_put_work(struct work_struct *work)
+static void svc_export_put(struct kref *ref)
 {
-	struct svc_export *exp =
-		container_of(to_rcu_work(work), struct svc_export, ex_rcu_work);
-
+	struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
 	path_put(&exp->ex_path);
 	auth_domain_put(exp->ex_client);
 	nfsd4_fslocs_free(&exp->ex_fslocs);
 	export_stats_destroy(exp->ex_stats);
 	kfree(exp->ex_stats);
 	kfree(exp->ex_uuid);
-	kfree(exp);
-}
-
-static void svc_export_put(struct kref *ref)
-{
-	struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
-
-	INIT_RCU_WORK(&exp->ex_rcu_work, svc_export_put_work);
-	queue_rcu_work(system_wq, &exp->ex_rcu_work);
+	kfree_rcu(exp, ex_rcu);
 }
 
 static int svc_export_upcall(struct cache_detail *cd, struct cache_head *h)
diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h
index 081afb68681e..3794ae253a70 100644
--- a/fs/nfsd/export.h
+++ b/fs/nfsd/export.h
@@ -75,7 +75,7 @@ struct svc_export {
 	u32			ex_layout_types;
 	struct nfsd4_deviceid_map *ex_devid_map;
 	struct cache_detail	*cd;
-	struct rcu_work		ex_rcu_work;
+	struct rcu_head		ex_rcu;
 	unsigned long		ex_xprtsec_modes;
 	struct export_stats	*ex_stats;
 };
@@ -92,7 +92,7 @@ struct svc_expkey {
 	u32			ek_fsid[6];
 
 	struct path		ek_path;
-	struct rcu_work		ek_rcu_work;
+	struct rcu_head		ek_rcu;
 };
 
 #define EX_ISSYNC(exp)		(!((exp)->ex_flags & NFSEXP_ASYNC))
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 014/114] nfsd: restore callback functionality for NFSv4.0
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 013/114] nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work" Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 015/114] mtd: diskonchip: Cast an operand to prevent potential overflow Greg Kroah-Hartman
                   ` (110 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, NeilBrown, Jeff Layton, Chuck Lever,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: NeilBrown <neilb@suse.de>

[ Upstream commit 7917f01a286ce01e9c085e24468421f596ee1a0c ]

A recent patch inadvertently broke callbacks for NFSv4.0.

In the 4.0 case we do not expect a session to be found but still need to
call setup_callback_client() which will not try to dereference it.

This patch moves the check for failure to find a session into the 4.1+
branch of setup_callback_client()

Fixes: 1e02c641c3a4 ("NFSD: Prevent NULL dereference in nfsd4_process_cb_update()")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfsd/nfs4callback.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index b8cbb1556004..de0763652549 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -1058,7 +1058,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
 		args.authflavor = clp->cl_cred.cr_flavor;
 		clp->cl_cb_ident = conn->cb_ident;
 	} else {
-		if (!conn->cb_xprt)
+		if (!conn->cb_xprt || !ses)
 			return -EINVAL;
 		clp->cl_cb_session = ses;
 		args.bc_xprt = conn->cb_xprt;
@@ -1461,8 +1461,6 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
 		ses = c->cn_session;
 	}
 	spin_unlock(&clp->cl_lock);
-	if (!c)
-		return;
 
 	err = setup_callback_client(clp, &conn, ses);
 	if (err) {
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 015/114] mtd: diskonchip: Cast an operand to prevent potential overflow
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 014/114] nfsd: restore callback functionality for NFSv4.0 Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 016/114] mtd: rawnand: arasan: Fix double assertion of chip-select Greg Kroah-Hartman
                   ` (109 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Zichen Xie, Miquel Raynal

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zichen Xie <zichenxie0106@gmail.com>

commit 9b458e8be0d13e81ed03fffa23f8f9b528bbd786 upstream.

There may be a potential integer overflow issue in inftl_partscan().
parts[0].size is defined as "uint64_t"  while mtd->erasesize and
ip->firstUnit are defined as 32-bit unsigned integer. The result of
the calculation will be limited to 32 bits without correct casting.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mtd/nand/raw/diskonchip.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mtd/nand/raw/diskonchip.c
+++ b/drivers/mtd/nand/raw/diskonchip.c
@@ -1098,7 +1098,7 @@ static inline int __init inftl_partscan(
 		    (i == 0) && (ip->firstUnit > 0)) {
 			parts[0].name = " DiskOnChip IPL / Media Header partition";
 			parts[0].offset = 0;
-			parts[0].size = mtd->erasesize * ip->firstUnit;
+			parts[0].size = (uint64_t)mtd->erasesize * ip->firstUnit;
 			numparts = 1;
 		}
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 016/114] mtd: rawnand: arasan: Fix double assertion of chip-select
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 015/114] mtd: diskonchip: Cast an operand to prevent potential overflow Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 017/114] mtd: rawnand: arasan: Fix missing de-registration of NAND Greg Kroah-Hartman
                   ` (108 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Maciej Andrzejewski, Miquel Raynal

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maciej Andrzejewski <maciej.andrzejewski@m-works.net>

commit b086a46dae48829e11c0c02580e30d920b76743c upstream.

When two chip-selects are configured in the device tree, and the second is
a non-native GPIO, both the GPIO-based chip-select and the first native
chip-select may be asserted simultaneously. This double assertion causes
incorrect read and write operations.

The issue occurs because when nfc->ncs <= 2, nfc->spare_cs is always
initialized to 0 due to static initialization. Consequently, when the
second chip-select (GPIO-based) is selected in anfc_assert_cs(), it is
detected by anfc_is_gpio_cs(), and nfc->native_cs is assigned the value 0.
This results in both the GPIO-based chip-select being asserted and the
NAND controller register receiving 0, erroneously selecting the native
chip-select.

This patch resolves the issue, as confirmed by oscilloscope testing with
configurations involving two or more chip-selects in the device tree.

Fixes: acbd3d0945f9 ("mtd: rawnand: arasan: Leverage additional GPIO CS")
Cc: stable@vger.kernel.org
Signed-off-by: Maciej Andrzejewski <maciej.andrzejewski@m-works.net>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mtd/nand/raw/arasan-nand-controller.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/mtd/nand/raw/arasan-nand-controller.c
+++ b/drivers/mtd/nand/raw/arasan-nand-controller.c
@@ -1409,8 +1409,8 @@ static int anfc_parse_cs(struct arasan_n
 	 * case, the "not" chosen CS is assigned to nfc->spare_cs and selected
 	 * whenever a GPIO CS must be asserted.
 	 */
-	if (nfc->cs_array && nfc->ncs > 2) {
-		if (!nfc->cs_array[0] && !nfc->cs_array[1]) {
+	if (nfc->cs_array) {
+		if (nfc->ncs > 2 && !nfc->cs_array[0] && !nfc->cs_array[1]) {
 			dev_err(nfc->dev,
 				"Assign a single native CS when using GPIOs\n");
 			return -EINVAL;



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 017/114] mtd: rawnand: arasan: Fix missing de-registration of NAND
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 016/114] mtd: rawnand: arasan: Fix double assertion of chip-select Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 018/114] phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP Greg Kroah-Hartman
                   ` (107 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Maciej Andrzejewski ICEYE,
	Miquel Raynal

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maciej Andrzejewski <maciej.andrzejewski@m-works.net>

commit 11e6831fd81468cf48155b9b3c11295c391da723 upstream.

The NAND chip-selects are registered for the Arasan driver during
initialization but are not de-registered when the driver is unloaded. As a
result, if the driver is loaded again, the chip-selects remain registered
and busy, making them unavailable for use.

Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller")
Cc: stable@vger.kernel.org
Signed-off-by: Maciej Andrzejewski ICEYE <maciej.andrzejewski@m-works.net>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mtd/nand/raw/arasan-nand-controller.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/mtd/nand/raw/arasan-nand-controller.c
+++ b/drivers/mtd/nand/raw/arasan-nand-controller.c
@@ -1478,8 +1478,15 @@ static int anfc_probe(struct platform_de
 
 static void anfc_remove(struct platform_device *pdev)
 {
+	int i;
 	struct arasan_nfc *nfc = platform_get_drvdata(pdev);
 
+	for (i = 0; i < nfc->ncs; i++) {
+		if (nfc->cs_array[i]) {
+			gpiod_put(nfc->cs_array[i]);
+		}
+	}
+
 	anfc_chips_cleanup(nfc);
 }
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 018/114] phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 017/114] mtd: rawnand: arasan: Fix missing de-registration of NAND Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 019/114] phy: core: Fix an OF node refcount leakage in _of_phy_get() Greg Kroah-Hartman
                   ` (106 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Krishna Kurapati, Konrad Dybcio,
	Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Krishna Kurapati <quic_kriskura@quicinc.com>

commit 8886fb3240931a0afce82dea87edfe46bcb0a586 upstream.

In RX Lane configuration sequence of SC8280XP, the register
V5_RX_UCDR_FO_GAIN is incorrectly spelled as RX_UCDR_SO_GAIN and
hence the programming sequence is wrong. Fix the register sequence
accordingly to avoid any compliance failures. This has been tested
on SA8775P by checking device mode enumeration in SuperSpeed.

Cc: stable@vger.kernel.org
Fixes: c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy")
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20241112092831.4110942-1-quic_kriskura@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp-usb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c
@@ -1008,7 +1008,7 @@ static const struct qmp_phy_init_tbl sc8
 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f),
 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff),
 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f),
-	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_GAIN, 0x0a),
+	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FO_GAIN, 0x0a),
 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL1, 0x54),
 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x0f),
 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f),



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 019/114] phy: core: Fix an OF node refcount leakage in _of_phy_get()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 018/114] phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 020/114] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup() Greg Kroah-Hartman
                   ` (105 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold, Zijun Hu, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zijun Hu <quic_zijuhu@quicinc.com>

commit 5ebdc6be16c2000e37fcb8b4072d442d268ad492 upstream.

_of_phy_get() will directly return when suffers of_device_is_compatible()
error, but it forgets to decrease refcount of OF node @args.np before error
return, the refcount was increased by previous of_parse_phandle_with_args()
so causes the OF node's refcount leakage.

Fix by decreasing the refcount via of_node_put() before the error return.

Fixes: b7563e2796f8 ("phy: work around 'phys' references to usb-nop-xceiv devices")
Cc: stable@vger.kernel.org
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-4-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/phy-core.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -629,8 +629,10 @@ static struct phy *_of_phy_get(struct de
 		return ERR_PTR(-ENODEV);
 
 	/* This phy type handled by the usb-phy subsystem for now */
-	if (of_device_is_compatible(args.np, "usb-nop-xceiv"))
-		return ERR_PTR(-ENODEV);
+	if (of_device_is_compatible(args.np, "usb-nop-xceiv")) {
+		phy = ERR_PTR(-ENODEV);
+		goto out_put_node;
+	}
 
 	mutex_lock(&phy_provider_mutex);
 	phy_provider = of_phy_provider_lookup(args.np);
@@ -652,6 +654,7 @@ out_put_module:
 
 out_unlock:
 	mutex_unlock(&phy_provider_mutex);
+out_put_node:
 	of_node_put(args.np);
 
 	return phy;



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 020/114] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 019/114] phy: core: Fix an OF node refcount leakage in _of_phy_get() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 021/114] phy: core: Fix that API devm_phy_put() fails to release the phy Greg Kroah-Hartman
                   ` (104 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold, Zijun Hu, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zijun Hu <quic_zijuhu@quicinc.com>

commit a2d633cb1421e679b56f1a9fe1f42f089706f1ed upstream.

For macro for_each_child_of_node(parent, child), refcount of @child has
been increased before entering its loop body, so normally needs to call
of_node_put(@child) before returning from the loop body to avoid refcount
leakage.

of_phy_provider_lookup() has such usage but does not call of_node_put()
before returning, so cause leakage of the OF node refcount.

Fix by simply calling of_node_put() before returning from the loop body.

The APIs affected by this issue are shown below since they indirectly
invoke problematic of_phy_provider_lookup().
phy_get()
of_phy_get()
devm_phy_get()
devm_of_phy_get()
devm_of_phy_get_by_index()

Fixes: 2a4c37016ca9 ("phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node")
Cc: stable@vger.kernel.org
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-5-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/phy-core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -145,8 +145,10 @@ static struct phy_provider *of_phy_provi
 			return phy_provider;
 
 		for_each_child_of_node(phy_provider->children, child)
-			if (child == node)
+			if (child == node) {
+				of_node_put(child);
 				return phy_provider;
+			}
 	}
 
 	return ERR_PTR(-EPROBE_DEFER);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 021/114] phy: core: Fix that API devm_phy_put() fails to release the phy
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 020/114] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 022/114] phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider Greg Kroah-Hartman
                   ` (103 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Bjorn Helgaas, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Johan Hovold, Zijun Hu,
	Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zijun Hu <quic_zijuhu@quicinc.com>

commit fe4bfa9b6d7bd752bfe4700c937f235aa8ce997b upstream.

For devm_phy_put(), its comment says it needs to invoke phy_put() to
release the phy, but it will not actually invoke the function since
devres_destroy() does not call devm_phy_release(), and the missing
phy_put() call will cause:

- The phy fails to be released.
- devm_phy_put() can not fully undo what API devm_phy_get() does.
- Leak refcount of both the module and device for below typical usage:

  devm_phy_get(); // or its variant
  ...
  err = do_something();
  if (err)
      goto err_out;
  ...
  err_out:
  devm_phy_put(); // leak refcount here

  The file(s) affected by this issue are shown below since they have such
  typical usage.
  drivers/pci/controller/cadence/pcie-cadence.c
  drivers/net/ethernet/ti/am65-cpsw-nuss.c

Fix by using devres_release() instead of devres_destroy() within the API.

Fixes: ff764963479a ("drivers: phy: add generic PHY framework")
Cc: stable@vger.kernel.org
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Krzysztof Wilczyński <kw@linux.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-1-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/phy-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -742,7 +742,7 @@ void devm_phy_put(struct device *dev, st
 	if (!phy)
 		return;
 
-	r = devres_destroy(dev, devm_phy_release, devm_phy_match, phy);
+	r = devres_release(dev, devm_phy_release, devm_phy_match, phy);
 	dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n");
 }
 EXPORT_SYMBOL_GPL(devm_phy_put);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 022/114] phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 021/114] phy: core: Fix that API devm_phy_put() fails to release the phy Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 023/114] phy: core: Fix that API devm_phy_destroy() fails to destroy the phy Greg Kroah-Hartman
                   ` (102 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold, Zijun Hu, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zijun Hu <quic_zijuhu@quicinc.com>

commit c0b82ab95b4f1fbc3e3aeab9d829d012669524b6 upstream.

For devm_of_phy_provider_unregister(), its comment says it needs to invoke
of_phy_provider_unregister() to unregister the phy provider, but it will
not actually invoke the function since devres_destroy() does not call
devm_phy_provider_release(), and the missing of_phy_provider_unregister()
call will cause:

- The phy provider fails to be unregistered.
- Leak both memory and the OF node refcount.

Fortunately, the faulty API has not been used by current kernel tree.
Fix by using devres_release() instead of devres_destroy() within the API.

Fixes: ff764963479a ("drivers: phy: add generic PHY framework")
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/stable/20241213-phy_core_fix-v6-2-40ae28f5015a%40quicinc.com
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-2-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/phy-core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -1264,12 +1264,12 @@ EXPORT_SYMBOL_GPL(of_phy_provider_unregi
  * of_phy_provider_unregister to unregister the phy provider.
  */
 void devm_of_phy_provider_unregister(struct device *dev,
-	struct phy_provider *phy_provider)
+				     struct phy_provider *phy_provider)
 {
 	int r;
 
-	r = devres_destroy(dev, devm_phy_provider_release, devm_phy_match,
-		phy_provider);
+	r = devres_release(dev, devm_phy_provider_release, devm_phy_match,
+			   phy_provider);
 	dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n");
 }
 EXPORT_SYMBOL_GPL(devm_of_phy_provider_unregister);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 023/114] phy: core: Fix that API devm_phy_destroy() fails to destroy the phy
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 022/114] phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 024/114] phy: usb: Toggle the PHY power during init Greg Kroah-Hartman
                   ` (101 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Johan Hovold, Zijun Hu, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zijun Hu <quic_zijuhu@quicinc.com>

commit 4dc48c88fcf82b89fdebd83a906aaa64f40fb8a9 upstream.

For devm_phy_destroy(), its comment says it needs to invoke phy_destroy()
to destroy the phy, but it will not actually invoke the function since
devres_destroy() does not call devm_phy_consume(), and the missing
phy_destroy() call will cause that the phy fails to be destroyed.

Fortunately, the faulty API has not been used by current kernel tree.
Fix by using devres_release() instead of devres_destroy() within the API.

Fixes: ff764963479a ("drivers: phy: add generic PHY framework")
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-3-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/phy-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -1126,7 +1126,7 @@ void devm_phy_destroy(struct device *dev
 {
 	int r;
 
-	r = devres_destroy(dev, devm_phy_consume, devm_phy_match, phy);
+	r = devres_release(dev, devm_phy_consume, devm_phy_match, phy);
 	dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n");
 }
 EXPORT_SYMBOL_GPL(devm_phy_destroy);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 024/114] phy: usb: Toggle the PHY power during init
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 023/114] phy: core: Fix that API devm_phy_destroy() fails to destroy the phy Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 025/114] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM Greg Kroah-Hartman
                   ` (100 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Justin Chen, Florian Fainelli,
	Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Justin Chen <justin.chen@broadcom.com>

commit 0a92ea87bdd6f77ca4e17fe19649882cf5209edd upstream.

When bringing up the PHY, it might be in a bad state if left powered.
One case is we lose the PLL lock if the PLL is gated while the PHY
is powered. Toggle the PHY power so we can start from a known state.

Fixes: 4e5b9c9a73b3 ("phy: usb: Add support for new Synopsys USB controller on the 7216")
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20241024213540.1059412-1-justin.chen@broadcom.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
@@ -325,6 +325,12 @@ static void usb_init_common_7216(struct
 	void __iomem *ctrl = params->regs[BRCM_REGS_CTRL];
 
 	USB_CTRL_UNSET(ctrl, USB_PM, XHC_S2_CLK_SWITCH_EN);
+
+	/*
+	 * The PHY might be in a bad state if it is already powered
+	 * up. Toggle the power just in case.
+	 */
+	USB_CTRL_SET(ctrl, USB_PM, USB_PWRDN);
 	USB_CTRL_UNSET(ctrl, USB_PM, USB_PWRDN);
 
 	/* 1 millisecond - for USB clocks to settle down */



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 025/114] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 024/114] phy: usb: Toggle the PHY power during init Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset Greg Kroah-Hartman
                   ` (99 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Dmitry Osipenko, Cristian Ciocaltea,
	Heiko Stuebner, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

commit 9d23e48654620fdccfcc74cc2cef04eaf7353d07 upstream.

In some cases, rk_hdptx_phy_runtime_resume() may be invoked before
platform_set_drvdata() is executed in ->probe(), leading to a NULL
pointer dereference when using the return of dev_get_drvdata().

Ensure platform_set_drvdata() is called before devm_pm_runtime_enable().

Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Fixes: 553be2830c5f ("phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20241023-phy-sam-hdptx-rpm-fix-v1-1-87f4c994e346@collabora.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
+++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
@@ -1116,6 +1116,8 @@ static int rk_hdptx_phy_probe(struct pla
 		return dev_err_probe(dev, PTR_ERR(hdptx->grf),
 				     "Could not get GRF syscon\n");
 
+	platform_set_drvdata(pdev, hdptx);
+
 	ret = devm_pm_runtime_enable(dev);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
@@ -1125,7 +1127,6 @@ static int rk_hdptx_phy_probe(struct pla
 		return dev_err_probe(dev, PTR_ERR(hdptx->phy),
 				     "Failed to create HDMI PHY\n");
 
-	platform_set_drvdata(pdev, hdptx);
 	phy_set_drvdata(hdptx->phy, hdptx);
 	phy_set_bus_width(hdptx->phy, 8);
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 025/114] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2025-02-09 13:28   ` Aurelien Jarno
  2024-12-30 15:42 ` [PATCH 6.12 027/114] ALSA: memalloc: prefer dma_mapping_error() over explicit address checking Greg Kroah-Hartman
                   ` (98 subsequent siblings)
  124 siblings, 1 reply; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, FUKAUMI Naoki, Michael Zimmermann,
	Chukun Pan, Heiko Stuebner, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chukun Pan <amadeus@jmu.edu.cn>

commit fbcbffbac994aca1264e3c14da96ac9bfd90466e upstream.

Currently, the USB port via combophy on the RK3528/RK3588 SoC is broken.

  usb usb8-port1: Cannot enable. Maybe the USB cable is bad?

This is due to the combphy of RK3528/RK3588 SoC has multiple resets, but
only "phy resets" need assert and deassert, "apb resets" don't need.
So change the driver to only match the phy resets, which is also what
the vendor kernel does.

Fixes: 7160820d742a ("phy: rockchip: add naneng combo phy for RK3568")
Cc: FUKAUMI Naoki <naoki@radxa.com>
Cc: Michael Zimmermann <sigmaepsilon92@gmail.com>
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: FUKAUMI Naoki <naoki@radxa.com>
Link: https://lore.kernel.org/r/20241122073006.99309-2-amadeus@jmu.edu.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
@@ -309,7 +309,7 @@ static int rockchip_combphy_parse_dt(str
 
 	priv->ext_refclk = device_property_present(dev, "rockchip,ext-refclk");
 
-	priv->phy_rst = devm_reset_control_array_get_exclusive(dev);
+	priv->phy_rst = devm_reset_control_get(dev, "phy");
 	if (IS_ERR(priv->phy_rst))
 		return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phy reset\n");
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 027/114] ALSA: memalloc: prefer dma_mapping_error() over explicit address checking
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 028/114] dmaengine: mv_xor: fix child node refcount handling in early exit Greg Kroah-Hartman
                   ` (97 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Mikhail Gavrilov, Fedor Pchelkin,
	Takashi Iwai

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Fedor Pchelkin <pchelkin@ispras.ru>

commit fa0308134d26dbbeb209a1581eea46df663866b6 upstream.

With CONFIG_DMA_API_DEBUG enabled, the following warning is observed:

DMA-API: snd_hda_intel 0000:03:00.1: device driver failed to check map error[device address=0x00000000ffff0000] [size=20480 bytes] [mapped as single]
WARNING: CPU: 28 PID: 2255 at kernel/dma/debug.c:1036 check_unmap+0x1408/0x2430
CPU: 28 UID: 42 PID: 2255 Comm: wireplumber Tainted: G  W L  6.12.0-10-133577cad6bf48e5a7848c4338124081393bfe8a+ #759
debug_dma_unmap_page+0xe9/0xf0
snd_dma_wc_free+0x85/0x130 [snd_pcm]
snd_pcm_lib_free_pages+0x1e3/0x440 [snd_pcm]
snd_pcm_common_ioctl+0x1c9a/0x2960 [snd_pcm]
snd_pcm_ioctl+0x6a/0xc0 [snd_pcm]
...

Check for returned DMA addresses using specialized dma_mapping_error()
helper which is generally recommended for this purpose by
Documentation/core-api/dma-api.rst.

Fixes: c880a5146642 ("ALSA: memalloc: Use proper DMA mapping API for x86 WC buffer allocations")
Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Closes: https://lore.kernel.org/r/CABXGCsNB3RsMGvCucOy3byTEOxoc-Ys+zB_HQ=Opb_GhX1ioDA@mail.gmail.com/
Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Link: https://patch.msgid.link/20241219203345.195898-1-pchelkin@ispras.ru
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/core/memalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 13b71069ae18..b3853583d2ae 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -505,7 +505,7 @@ static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size)
 	if (!p)
 		return NULL;
 	dmab->addr = dma_map_single(dmab->dev.dev, p, size, DMA_BIDIRECTIONAL);
-	if (dmab->addr == DMA_MAPPING_ERROR) {
+	if (dma_mapping_error(dmab->dev.dev, dmab->addr)) {
 		do_free_pages(dmab->area, size, true);
 		return NULL;
 	}
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 028/114] dmaengine: mv_xor: fix child node refcount handling in early exit
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 027/114] ALSA: memalloc: prefer dma_mapping_error() over explicit address checking Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 029/114] dmaengine: dw: Select only supported masters for ACPI devices Greg Kroah-Hartman
                   ` (96 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Javier Carrasco, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Javier Carrasco <javier.carrasco.cruz@gmail.com>

commit 362f1bf98a3ecb5a2a4fcbdaa9718c8403beceb2 upstream.

The for_each_child_of_node() loop requires explicit calls to
of_node_put() to decrement the child's refcount upon early exits (break,
goto, return).

Add the missing calls in the two early exits before the goto
instructions.

Cc: stable@vger.kernel.org
Fixes: f7d12ef53ddf ("dma: mv_xor: add Device Tree binding")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241011-dma_mv_xor_of_node_put-v1-1-3c2de819f463@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/mv_xor.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1388,6 +1388,7 @@ static int mv_xor_probe(struct platform_
 			irq = irq_of_parse_and_map(np, 0);
 			if (!irq) {
 				ret = -ENODEV;
+				of_node_put(np);
 				goto err_channel_add;
 			}
 
@@ -1396,6 +1397,7 @@ static int mv_xor_probe(struct platform_
 			if (IS_ERR(chan)) {
 				ret = PTR_ERR(chan);
 				irq_dispose_mapping(irq);
+				of_node_put(np);
 				goto err_channel_add;
 			}
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 029/114] dmaengine: dw: Select only supported masters for ACPI devices
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 028/114] dmaengine: mv_xor: fix child node refcount handling in early exit Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 030/114] dmaengine: tegra: Return correct DMA status when paused Greg Kroah-Hartman
                   ` (95 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Ferry Toth, Andy Shevchenko,
	Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

commit f0e870a0e9c5521f2952ea9f3ea9d3d122631a89 upstream.

The recently submitted fix-commit revealed a problem in the iDMA 32-bit
platform code. Even though the controller supported only a single master
the dw_dma_acpi_filter() method hard-coded two master interfaces with IDs
0 and 1. As a result the sanity check implemented in the commit
b336268dde75 ("dmaengine: dw: Add peripheral bus width verification")
got incorrect interface data width and thus prevented the client drivers
from configuring the DMA-channel with the EINVAL error returned. E.g.,
the next error was printed for the PXA2xx SPI controller driver trying
to configure the requested channels:

> [  164.525604] pxa2xx_spi_pci 0000:00:07.1: DMA slave config failed
> [  164.536105] pxa2xx_spi_pci 0000:00:07.1: failed to get DMA TX descriptor
> [  164.543213] spidev spi-SPT0001:00: SPI transfer failed: -16

The problem would have been spotted much earlier if the iDMA 32-bit
controller supported more than one master interfaces. But since it
supports just a single master and the iDMA 32-bit specific code just
ignores the master IDs in the CTLLO preparation method, the issue has
been gone unnoticed so far.

Fix the problem by specifying the default master ID for both memory
and peripheral devices in the driver data. Thus the issue noticed for
the iDMA 32-bit controllers will be eliminated and the ACPI-probed
DW DMA controllers will be configured with the correct master ID by
default.

Cc: stable@vger.kernel.org
Fixes: b336268dde75 ("dmaengine: dw: Add peripheral bus width verification")
Fixes: 199244d69458 ("dmaengine: dw: add support of iDMA 32-bit hardware")
Reported-by: Ferry Toth <fntoth@gmail.com>
Closes: https://lore.kernel.org/dmaengine/ZuXbCKUs1iOqFu51@black.fi.intel.com/
Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Closes: https://lore.kernel.org/dmaengine/ZuXgI-VcHpMgbZ91@black.fi.intel.com/
Tested-by: Ferry Toth <fntoth@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20241104095142.157925-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/dw/acpi.c     |    6 ++++--
 drivers/dma/dw/internal.h |    8 ++++++++
 drivers/dma/dw/pci.c      |    4 ++--
 3 files changed, 14 insertions(+), 4 deletions(-)

--- a/drivers/dma/dw/acpi.c
+++ b/drivers/dma/dw/acpi.c
@@ -8,13 +8,15 @@
 
 static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
 {
+	struct dw_dma *dw = to_dw_dma(chan->device);
+	struct dw_dma_chip_pdata *data = dev_get_drvdata(dw->dma.dev);
 	struct acpi_dma_spec *dma_spec = param;
 	struct dw_dma_slave slave = {
 		.dma_dev = dma_spec->dev,
 		.src_id = dma_spec->slave_id,
 		.dst_id = dma_spec->slave_id,
-		.m_master = 0,
-		.p_master = 1,
+		.m_master = data->m_master,
+		.p_master = data->p_master,
 	};
 
 	return dw_dma_filter(chan, &slave);
--- a/drivers/dma/dw/internal.h
+++ b/drivers/dma/dw/internal.h
@@ -51,11 +51,15 @@ struct dw_dma_chip_pdata {
 	int (*probe)(struct dw_dma_chip *chip);
 	int (*remove)(struct dw_dma_chip *chip);
 	struct dw_dma_chip *chip;
+	u8 m_master;
+	u8 p_master;
 };
 
 static __maybe_unused const struct dw_dma_chip_pdata dw_dma_chip_pdata = {
 	.probe = dw_dma_probe,
 	.remove = dw_dma_remove,
+	.m_master = 0,
+	.p_master = 1,
 };
 
 static const struct dw_dma_platform_data idma32_pdata = {
@@ -72,6 +76,8 @@ static __maybe_unused const struct dw_dm
 	.pdata = &idma32_pdata,
 	.probe = idma32_dma_probe,
 	.remove = idma32_dma_remove,
+	.m_master = 0,
+	.p_master = 0,
 };
 
 static const struct dw_dma_platform_data xbar_pdata = {
@@ -88,6 +94,8 @@ static __maybe_unused const struct dw_dm
 	.pdata = &xbar_pdata,
 	.probe = idma32_dma_probe,
 	.remove = idma32_dma_remove,
+	.m_master = 0,
+	.p_master = 0,
 };
 
 #endif /* _DMA_DW_INTERNAL_H */
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -56,10 +56,10 @@ static int dw_pci_probe(struct pci_dev *
 	if (ret)
 		return ret;
 
-	dw_dma_acpi_controller_register(chip->dw);
-
 	pci_set_drvdata(pdev, data);
 
+	dw_dma_acpi_controller_register(chip->dw);
+
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 030/114] dmaengine: tegra: Return correct DMA status when paused
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 029/114] dmaengine: dw: Select only supported masters for ACPI devices Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 031/114] dmaengine: amd: qdma: Remove using the private get and set dma_ops APIs Greg Kroah-Hartman
                   ` (94 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Akhil R, Kartik Rajput, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Akhil R <akhilrajeev@nvidia.com>

commit ebc008699fd95701c9af5ebaeb0793eef81a71d5 upstream.

Currently, the driver does not return the correct DMA status when a DMA
pause is issued by the client drivers. This causes GPCDMA users to
assume that DMA is still running, while in reality, the DMA is paused.

Return DMA_PAUSED for tx_status() if the channel is paused in the middle
of a transfer.

Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
Cc: stable@vger.kernel.org
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
Link: https://lore.kernel.org/r/20241212124412.5650-1-kkartik@nvidia.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/tegra186-gpc-dma.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -231,6 +231,7 @@ struct tegra_dma_channel {
 	bool config_init;
 	char name[30];
 	enum dma_transfer_direction sid_dir;
+	enum dma_status status;
 	int id;
 	int irq;
 	int slave_id;
@@ -393,6 +394,8 @@ static int tegra_dma_pause(struct tegra_
 		tegra_dma_dump_chan_regs(tdc);
 	}
 
+	tdc->status = DMA_PAUSED;
+
 	return ret;
 }
 
@@ -419,6 +422,8 @@ static void tegra_dma_resume(struct tegr
 	val = tdc_read(tdc, TEGRA_GPCDMA_CHAN_CSRE);
 	val &= ~TEGRA_GPCDMA_CHAN_CSRE_PAUSE;
 	tdc_write(tdc, TEGRA_GPCDMA_CHAN_CSRE, val);
+
+	tdc->status = DMA_IN_PROGRESS;
 }
 
 static int tegra_dma_device_resume(struct dma_chan *dc)
@@ -544,6 +549,7 @@ static void tegra_dma_xfer_complete(stru
 
 	tegra_dma_sid_free(tdc);
 	tdc->dma_desc = NULL;
+	tdc->status = DMA_COMPLETE;
 }
 
 static void tegra_dma_chan_decode_error(struct tegra_dma_channel *tdc,
@@ -716,6 +722,7 @@ static int tegra_dma_terminate_all(struc
 		tdc->dma_desc = NULL;
 	}
 
+	tdc->status = DMA_COMPLETE;
 	tegra_dma_sid_free(tdc);
 	vchan_get_all_descriptors(&tdc->vc, &head);
 	spin_unlock_irqrestore(&tdc->vc.lock, flags);
@@ -769,6 +776,9 @@ static enum dma_status tegra_dma_tx_stat
 	if (ret == DMA_COMPLETE)
 		return ret;
 
+	if (tdc->status == DMA_PAUSED)
+		ret = DMA_PAUSED;
+
 	spin_lock_irqsave(&tdc->vc.lock, flags);
 	vd = vchan_find_desc(&tdc->vc, cookie);
 	if (vd) {



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 031/114] dmaengine: amd: qdma: Remove using the private get and set dma_ops APIs
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 030/114] dmaengine: tegra: Return correct DMA status when paused Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 032/114] dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd() Greg Kroah-Hartman
                   ` (93 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Lizhi Hou, Christoph Hellwig,
	Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lizhi Hou <lizhi.hou@amd.com>

commit dcbef0798eb825cd584f7a93f62bed63f7fbbfc9 upstream.

The get_dma_ops and set_dma_ops APIs were never for driver to use. Remove
these calls from QDMA driver. Instead, pass the DMA device pointer from the
qdma_platdata structure.

Fixes: 73d5fc92a11c ("dmaengine: amd: qdma: Add AMD QDMA driver")
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240918181022.2155715-1-lizhi.hou@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/amd/qdma/qdma.c            | 28 +++++++++++---------------
 include/linux/platform_data/amd_qdma.h |  2 ++
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/dma/amd/qdma/qdma.c b/drivers/dma/amd/qdma/qdma.c
index 6d9079458fe9..66f00ad67351 100644
--- a/drivers/dma/amd/qdma/qdma.c
+++ b/drivers/dma/amd/qdma/qdma.c
@@ -7,9 +7,9 @@
 #include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
-#include <linux/dma-map-ops.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/amd_qdma.h>
 #include <linux/regmap.h>
@@ -492,18 +492,9 @@ static int qdma_device_verify(struct qdma_device *qdev)
 
 static int qdma_device_setup(struct qdma_device *qdev)
 {
-	struct device *dev = &qdev->pdev->dev;
 	u32 ring_sz = QDMA_DEFAULT_RING_SIZE;
 	int ret = 0;
 
-	while (dev && get_dma_ops(dev))
-		dev = dev->parent;
-	if (!dev) {
-		qdma_err(qdev, "dma device not found");
-		return -EINVAL;
-	}
-	set_dma_ops(&qdev->pdev->dev, get_dma_ops(dev));
-
 	ret = qdma_setup_fmap_context(qdev);
 	if (ret) {
 		qdma_err(qdev, "Failed setup fmap context");
@@ -548,11 +539,12 @@ static void qdma_free_queue_resources(struct dma_chan *chan)
 {
 	struct qdma_queue *queue = to_qdma_queue(chan);
 	struct qdma_device *qdev = queue->qdev;
-	struct device *dev = qdev->dma_dev.dev;
+	struct qdma_platdata *pdata;
 
 	qdma_clear_queue_context(queue);
 	vchan_free_chan_resources(&queue->vchan);
-	dma_free_coherent(dev, queue->ring_size * QDMA_MM_DESC_SIZE,
+	pdata = dev_get_platdata(&qdev->pdev->dev);
+	dma_free_coherent(pdata->dma_dev, queue->ring_size * QDMA_MM_DESC_SIZE,
 			  queue->desc_base, queue->dma_desc_base);
 }
 
@@ -565,6 +557,7 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
 	struct qdma_queue *queue = to_qdma_queue(chan);
 	struct qdma_device *qdev = queue->qdev;
 	struct qdma_ctxt_sw_desc desc;
+	struct qdma_platdata *pdata;
 	size_t size;
 	int ret;
 
@@ -572,8 +565,9 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
 	if (ret)
 		return ret;
 
+	pdata = dev_get_platdata(&qdev->pdev->dev);
 	size = queue->ring_size * QDMA_MM_DESC_SIZE;
-	queue->desc_base = dma_alloc_coherent(qdev->dma_dev.dev, size,
+	queue->desc_base = dma_alloc_coherent(pdata->dma_dev, size,
 					      &queue->dma_desc_base,
 					      GFP_KERNEL);
 	if (!queue->desc_base) {
@@ -588,7 +582,7 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
 	if (ret) {
 		qdma_err(qdev, "Failed to setup SW desc ctxt for %s",
 			 chan->name);
-		dma_free_coherent(qdev->dma_dev.dev, size, queue->desc_base,
+		dma_free_coherent(pdata->dma_dev, size, queue->desc_base,
 				  queue->dma_desc_base);
 		return ret;
 	}
@@ -948,8 +942,9 @@ static int qdma_init_error_irq(struct qdma_device *qdev)
 
 static int qdmam_alloc_qintr_rings(struct qdma_device *qdev)
 {
-	u32 ctxt[QDMA_CTXT_REGMAP_LEN];
+	struct qdma_platdata *pdata = dev_get_platdata(&qdev->pdev->dev);
 	struct device *dev = &qdev->pdev->dev;
+	u32 ctxt[QDMA_CTXT_REGMAP_LEN];
 	struct qdma_intr_ring *ring;
 	struct qdma_ctxt_intr intr_ctxt;
 	u32 vector;
@@ -969,7 +964,8 @@ static int qdmam_alloc_qintr_rings(struct qdma_device *qdev)
 		ring->msix_id = qdev->err_irq_idx + i + 1;
 		ring->ridx = i;
 		ring->color = 1;
-		ring->base = dmam_alloc_coherent(dev, QDMA_INTR_RING_SIZE,
+		ring->base = dmam_alloc_coherent(pdata->dma_dev,
+						 QDMA_INTR_RING_SIZE,
 						 &ring->dev_base, GFP_KERNEL);
 		if (!ring->base) {
 			qdma_err(qdev, "Failed to alloc intr ring %d", i);
diff --git a/include/linux/platform_data/amd_qdma.h b/include/linux/platform_data/amd_qdma.h
index 576d952f97ed..967a6ef31cf9 100644
--- a/include/linux/platform_data/amd_qdma.h
+++ b/include/linux/platform_data/amd_qdma.h
@@ -26,11 +26,13 @@ struct dma_slave_map;
  * @max_mm_channels: Maximum number of MM DMA channels in each direction
  * @device_map: DMA slave map
  * @irq_index: The index of first IRQ
+ * @dma_dev: The device pointer for dma operations
  */
 struct qdma_platdata {
 	u32			max_mm_channels;
 	u32			irq_index;
 	struct dma_slave_map	*device_map;
+	struct device		*dma_dev;
 };
 
 #endif /* _PLATDATA_AMD_QDMA_H */
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 032/114] dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 031/114] dmaengine: amd: qdma: Remove using the private get and set dma_ops APIs Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 033/114] dmaengine: apple-admac: Avoid accessing registers in probe Greg Kroah-Hartman
                   ` (92 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Joe Hattori, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>

commit ccfa3131d4a0347988e73638edea5c8281b6d2c7 upstream.

Current implementation of fsl_edma3_attach_pd() does not provide a
cleanup path, resulting in a memory leak. For example,
dev_pm_domain_detach() is not called after dev_pm_domain_attach_by_id(),
and the device link created with the DL_FLAG_STATELESS is not released
explicitly.

Therefore, provide a cleanup function fsl_edma3_detach_pd() and call it
upon failure. Also add a devm_add_action_or_reset() call with this
function after a successful fsl_edma3_attach_pd().

Fixes: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20241221075712.3297200-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/fsl-edma-common.h |    1 +
 drivers/dma/fsl-edma-main.c   |   41 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 37 insertions(+), 5 deletions(-)

--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -166,6 +166,7 @@ struct fsl_edma_chan {
 	struct work_struct		issue_worker;
 	struct platform_device		*pdev;
 	struct device			*pd_dev;
+	struct device_link		*pd_dev_link;
 	u32				srcid;
 	struct clk			*clk;
 	int                             priority;
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -417,10 +417,33 @@ static const struct of_device_id fsl_edm
 };
 MODULE_DEVICE_TABLE(of, fsl_edma_dt_ids);
 
+static void fsl_edma3_detach_pd(struct fsl_edma_engine *fsl_edma)
+{
+	struct fsl_edma_chan *fsl_chan;
+	int i;
+
+	for (i = 0; i < fsl_edma->n_chans; i++) {
+		if (fsl_edma->chan_masked & BIT(i))
+			continue;
+		fsl_chan = &fsl_edma->chans[i];
+		if (fsl_chan->pd_dev_link)
+			device_link_del(fsl_chan->pd_dev_link);
+		if (fsl_chan->pd_dev) {
+			dev_pm_domain_detach(fsl_chan->pd_dev, false);
+			pm_runtime_dont_use_autosuspend(fsl_chan->pd_dev);
+			pm_runtime_set_suspended(fsl_chan->pd_dev);
+		}
+	}
+}
+
+static void devm_fsl_edma3_detach_pd(void *data)
+{
+	fsl_edma3_detach_pd(data);
+}
+
 static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma)
 {
 	struct fsl_edma_chan *fsl_chan;
-	struct device_link *link;
 	struct device *pd_chan;
 	struct device *dev;
 	int i;
@@ -436,15 +459,16 @@ static int fsl_edma3_attach_pd(struct pl
 		pd_chan = dev_pm_domain_attach_by_id(dev, i);
 		if (IS_ERR_OR_NULL(pd_chan)) {
 			dev_err(dev, "Failed attach pd %d\n", i);
-			return -EINVAL;
+			goto detach;
 		}
 
-		link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS |
+		fsl_chan->pd_dev_link = device_link_add(dev, pd_chan, DL_FLAG_STATELESS |
 					     DL_FLAG_PM_RUNTIME |
 					     DL_FLAG_RPM_ACTIVE);
-		if (!link) {
+		if (!fsl_chan->pd_dev_link) {
 			dev_err(dev, "Failed to add device_link to %d\n", i);
-			return -EINVAL;
+			dev_pm_domain_detach(pd_chan, false);
+			goto detach;
 		}
 
 		fsl_chan->pd_dev = pd_chan;
@@ -455,6 +479,10 @@ static int fsl_edma3_attach_pd(struct pl
 	}
 
 	return 0;
+
+detach:
+	fsl_edma3_detach_pd(fsl_edma);
+	return -EINVAL;
 }
 
 static int fsl_edma_probe(struct platform_device *pdev)
@@ -544,6 +572,9 @@ static int fsl_edma_probe(struct platfor
 		ret = fsl_edma3_attach_pd(pdev, fsl_edma);
 		if (ret)
 			return ret;
+		ret = devm_add_action_or_reset(&pdev->dev, devm_fsl_edma3_detach_pd, fsl_edma);
+		if (ret)
+			return ret;
 	}
 
 	if (drvdata->flags & FSL_EDMA_DRV_TCD64)



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 033/114] dmaengine: apple-admac: Avoid accessing registers in probe
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 032/114] dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 034/114] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset Greg Kroah-Hartman
                   ` (91 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Sasha Finkelstein, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sasha Finkelstein <fnkl.kernel@gmail.com>

commit 8d55e8a16f019211163f1180fd9f9fbe05901900 upstream.

The ADMAC attached to the AOP has complex power sequencing, and is
power gated when the probe callback runs. Move the register reads
to other functions, where we can guarantee that the hardware is
switched on.

Fixes: 568aa6dd641f ("dmaengine: apple-admac: Allocate cache SRAM to channels")
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
Link: https://lore.kernel.org/r/20241124-admac-power-v1-1-58f2165a4d55@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/apple-admac.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

--- a/drivers/dma/apple-admac.c
+++ b/drivers/dma/apple-admac.c
@@ -153,6 +153,8 @@ static int admac_alloc_sram_carveout(str
 {
 	struct admac_sram *sram;
 	int i, ret = 0, nblocks;
+	ad->txcache.size = readl_relaxed(ad->base + REG_TX_SRAM_SIZE);
+	ad->rxcache.size = readl_relaxed(ad->base + REG_RX_SRAM_SIZE);
 
 	if (dir == DMA_MEM_TO_DEV)
 		sram = &ad->txcache;
@@ -912,12 +914,7 @@ static int admac_probe(struct platform_d
 		goto free_irq;
 	}
 
-	ad->txcache.size = readl_relaxed(ad->base + REG_TX_SRAM_SIZE);
-	ad->rxcache.size = readl_relaxed(ad->base + REG_RX_SRAM_SIZE);
-
 	dev_info(&pdev->dev, "Audio DMA Controller\n");
-	dev_info(&pdev->dev, "imprint %x TX cache %u RX cache %u\n",
-		 readl_relaxed(ad->base + REG_IMPRINT), ad->txcache.size, ad->rxcache.size);
 
 	return 0;
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 034/114] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 033/114] dmaengine: apple-admac: Avoid accessing registers in probe Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 035/114] ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP Greg Kroah-Hartman
                   ` (90 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Chen Ridong, Vinod Koul

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chen Ridong <chenridong@huawei.com>

commit c43ec96e8d34399bd9dab2f2dc316b904892133f upstream.

The at_xdmac_memset_create_desc may return NULL, which will lead to a
null pointer dereference. For example, the len input is error, or the
atchan->free_descs_list is empty and memory is exhausted. Therefore, add
check to avoid this.

Fixes: b206d9a23ac7 ("dmaengine: xdmac: Add memset support")
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Link: https://lore.kernel.org/r/20241029082845.1185380-1-chenridong@huaweicloud.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/dma/at_xdmac.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1363,6 +1363,8 @@ at_xdmac_prep_dma_memset(struct dma_chan
 		return NULL;
 
 	desc = at_xdmac_memset_create_desc(chan, atchan, dest, len, value);
+	if (!desc)
+		return NULL;
 	list_add_tail(&desc->desc_node, &desc->descs_list);
 
 	desc->tx_dma_desc.cookie = -EBUSY;



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 035/114] ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 034/114] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 036/114] platform/chrome: cros_ec_lpc: fix product identity for early Framework Laptops Greg Kroah-Hartman
                   ` (89 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Peter Ujfalusi, Ranjani Sridharan,
	Liam Girdwood, Bard Liao, Mark Brown

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

commit e8d0ba147d901022bcb69da8d8fd817f84e9f3ca upstream.

The linkDMA should not be released on stop trigger since a stream re-start
might happen without closing of the stream. This leaves a short time for
other streams to 'steal' the linkDMA since it has been released.

This issue is not easy to reproduce under normal conditions as usually
after stop the stream is closed, or the same stream is restarted, but if
another stream got in between the stop and start, like this:
aplay -Dhw:0,3 -c2 -r48000 -fS32_LE /dev/zero -d 120
CTRL+z
aplay -Dhw:0,0 -c2 -r48000 -fS32_LE /dev/zero -d 120

then the link DMA channels will be mixed up, resulting firmware error or
crash.

Fixes: ab5593793e90 ("ASoC: SOF: Intel: hda: Always clean up link DMA during stop")
Cc: stable@vger.kernel.org
Closes: https://github.com/thesofproject/sof/issues/9695
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20241217091019.31798-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/soc/sof/intel/hda-dai.c |   25 +++++++++++++++++++------
 sound/soc/sof/intel/hda.h     |    2 --
 2 files changed, 19 insertions(+), 8 deletions(-)

--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -103,8 +103,10 @@ hda_dai_get_ops(struct snd_pcm_substream
 	return sdai->platform_private;
 }
 
-int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
-			 struct snd_soc_dai *cpu_dai)
+static int
+hda_link_dma_cleanup(struct snd_pcm_substream *substream,
+		     struct hdac_ext_stream *hext_stream,
+		     struct snd_soc_dai *cpu_dai, bool release)
 {
 	const struct hda_dai_widget_dma_ops *ops = hda_dai_get_ops(substream, cpu_dai);
 	struct sof_intel_hda_stream *hda_stream;
@@ -128,6 +130,17 @@ int hda_link_dma_cleanup(struct snd_pcm_
 		snd_hdac_ext_bus_link_clear_stream_id(hlink, stream_tag);
 	}
 
+	if (!release) {
+		/*
+		 * Force stream reconfiguration without releasing the channel on
+		 * subsequent stream restart (without free), including LinkDMA
+		 * reset.
+		 * The stream is released via hda_dai_hw_free()
+		 */
+		hext_stream->link_prepared = 0;
+		return 0;
+	}
+
 	if (ops->release_hext_stream)
 		ops->release_hext_stream(sdev, cpu_dai, substream);
 
@@ -211,7 +224,7 @@ static int __maybe_unused hda_dai_hw_fre
 	if (!hext_stream)
 		return 0;
 
-	return hda_link_dma_cleanup(substream, hext_stream, cpu_dai);
+	return hda_link_dma_cleanup(substream, hext_stream, cpu_dai, true);
 }
 
 static int __maybe_unused hda_dai_hw_params_data(struct snd_pcm_substream *substream,
@@ -304,7 +317,8 @@ static int __maybe_unused hda_dai_trigge
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
-		ret = hda_link_dma_cleanup(substream, hext_stream, dai);
+		ret = hda_link_dma_cleanup(substream, hext_stream, dai,
+					   cmd == SNDRV_PCM_TRIGGER_STOP ? false : true);
 		if (ret < 0) {
 			dev_err(sdev->dev, "%s: failed to clean up link DMA\n", __func__);
 			return ret;
@@ -656,8 +670,7 @@ static int hda_dai_suspend(struct hdac_b
 			}
 
 			ret = hda_link_dma_cleanup(hext_stream->link_substream,
-						   hext_stream,
-						   cpu_dai);
+						   hext_stream, cpu_dai, true);
 			if (ret < 0)
 				return ret;
 		}
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -1028,8 +1028,6 @@ const struct hda_dai_widget_dma_ops *
 hda_select_dai_widget_ops(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
 int hda_dai_config(struct snd_soc_dapm_widget *w, unsigned int flags,
 		   struct snd_sof_dai_config_data *data);
-int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
-			 struct snd_soc_dai *cpu_dai);
 
 static inline struct snd_sof_dev *widget_to_sdev(struct snd_soc_dapm_widget *w)
 {



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 036/114] platform/chrome: cros_ec_lpc: fix product identity for early Framework Laptops
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 035/114] ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 037/114] mtd: rawnand: fix double free in atmel_pmecc_create_user() Greg Kroah-Hartman
                   ` (88 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Dustin L. Howett,
	Thomas Weißschuh, Tzung-Bi Shih

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dustin L. Howett <dustin@howett.net>

commit dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a upstream.

The product names for the Framework Laptop (12th and 13th Generation
Intel Core) are incorrect as of 62be134abf42.

Fixes: 62be134abf42 ("platform/chrome: cros_ec_lpc: switch primary DMI data for Framework Laptop")
Cc: stable@vger.kernel.org # 6.12.x
Signed-off-by: Dustin L. Howett <dustin@howett.net>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241224-platform-chrome-cros_ec_lpc-fix-product-identity-for-early-framework-laptops-v1-1-0d31d6e1d22c@howett.net
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/platform/chrome/cros_ec_lpc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 924bf4d3cc77..8470b7f2b135 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -707,7 +707,7 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
 		/* Framework Laptop (12th Gen Intel Core) */
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
-			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "12th Gen Intel Core"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Laptop (12th Gen Intel Core)"),
 		},
 		.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
 	},
@@ -715,7 +715,7 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
 		/* Framework Laptop (13th Gen Intel Core) */
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
-			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "13th Gen Intel Core"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Laptop (13th Gen Intel Core)"),
 		},
 		.driver_data = (void *)&framework_laptop_mec_lpc_driver_data,
 	},
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 037/114] mtd: rawnand: fix double free in atmel_pmecc_create_user()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 036/114] platform/chrome: cros_ec_lpc: fix product identity for early Framework Laptops Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 038/114] ASoC: amd: ps: Fix for enabling DMIC on acp63 platform via _DSD entry Greg Kroah-Hartman
                   ` (87 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Dan Carpenter, Miquel Raynal

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@linaro.org>

commit d8e4771f99c0400a1873235704b28bb803c83d17 upstream.

The "user" pointer was converted from being allocated with kzalloc() to
being allocated by devm_kzalloc().  Calling kfree(user) will lead to a
double free.

Fixes: 6d734f1bfc33 ("mtd: rawnand: atmel: Fix possible memory leak")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/mtd/nand/raw/atmel/pmecc.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/mtd/nand/raw/atmel/pmecc.c
+++ b/drivers/mtd/nand/raw/atmel/pmecc.c
@@ -380,10 +380,8 @@ atmel_pmecc_create_user(struct atmel_pme
 	user->delta = user->dmu + req->ecc.strength + 1;
 
 	gf_tables = atmel_pmecc_get_gf_tables(req);
-	if (IS_ERR(gf_tables)) {
-		kfree(user);
+	if (IS_ERR(gf_tables))
 		return ERR_CAST(gf_tables);
-	}
 
 	user->gf_tables = gf_tables;
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 038/114] ASoC: amd: ps: Fix for enabling DMIC on acp63 platform via _DSD entry
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 037/114] mtd: rawnand: fix double free in atmel_pmecc_create_user() Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 039/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21QA and 21QB Greg Kroah-Hartman
                   ` (86 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Venkata Prasad Potturu, Mark Brown

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>

commit 88438444fdddd0244c8b2697713adcca3e71599e upstream.

Add condition check to register ACP PDM sound card by reading
_WOV acpi entry.

Fixes: 0386d765f27a ("ASoC: amd: ps: refactor acp device configuration read logic")

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://patch.msgid.link/20241213061147.1060451-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/soc/amd/ps/pci-ps.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

--- a/sound/soc/amd/ps/pci-ps.c
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -375,11 +375,18 @@ static int get_acp63_device_config(struc
 {
 	struct acpi_device *pdm_dev;
 	const union acpi_object *obj;
+	acpi_handle handle;
+	acpi_integer dmic_status;
 	u32 config;
 	bool is_dmic_dev = false;
 	bool is_sdw_dev = false;
+	bool wov_en, dmic_en;
 	int ret;
 
+	/* IF WOV entry not found, enable dmic based on acp-audio-device-type entry*/
+	wov_en = true;
+	dmic_en = false;
+
 	config = readl(acp_data->acp63_base + ACP_PIN_CONFIG);
 	switch (config) {
 	case ACP_CONFIG_4:
@@ -412,10 +419,18 @@ static int get_acp63_device_config(struc
 			if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
 						   ACPI_TYPE_INTEGER, &obj) &&
 						   obj->integer.value == ACP_DMIC_DEV)
-				is_dmic_dev = true;
+				dmic_en = true;
 		}
+
+		handle = ACPI_HANDLE(&pci->dev);
+		ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
+		if (!ACPI_FAILURE(ret))
+			wov_en = dmic_status;
 	}
 
+	if (dmic_en && wov_en)
+		is_dmic_dev = true;
+
 	if (acp_data->is_sdw_config) {
 		ret = acp_scan_sdw_devices(&pci->dev, ACP63_SDW_ADDR);
 		if (!ret && acp_data->info.link_mask)



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 039/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21QA and 21QB
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 038/114] ASoC: amd: ps: Fix for enabling DMIC on acp63 platform via _DSD entry Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 040/114] ASoC: dt-bindings: realtek,rt5645: Fix CPVDD voltage comment Greg Kroah-Hartman
                   ` (85 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Bard Liao,
	Mark Brown

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Fitzgerald <rf@opensource.cirrus.com>

commit ba7d47a54bf23a7201bdd2978e16b04fc1cb1f6e upstream.

Update the DMI match for a Lenovo laptop to the new DMI identifier.

This laptop ships with a different DMI identifier to what was expected,
and now has two identifiers.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: ea657f6b24e1 ("ASoC: Intel: sof_sdw: Add quirk for cs42l43 system using host DMICs")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20241216140821.153670-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/soc/intel/boards/sof_sdw.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -608,7 +608,16 @@ static const struct dmi_system_id sof_sd
 		.callback = sof_sdw_quirk_cb,
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "233C")
+			DMI_MATCH(DMI_PRODUCT_NAME, "21QB")
+		},
+		/* Note this quirk excludes the CODEC mic */
+		.driver_data = (void *)(SOC_SDW_CODEC_MIC),
+	},
+	{
+		.callback = sof_sdw_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "21QA")
 		},
 		/* Note this quirk excludes the CODEC mic */
 		.driver_data = (void *)(SOC_SDW_CODEC_MIC),



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 040/114] ASoC: dt-bindings: realtek,rt5645: Fix CPVDD voltage comment
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 039/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21QA and 21QB Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 041/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21Q6 and 21Q7 Greg Kroah-Hartman
                   ` (84 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Matthias Brugger, Chen-Yu Tsai,
	Krzysztof Kozlowski, Mark Brown

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chen-Yu Tsai <wenst@chromium.org>

commit 6f4a0fd03ce856c6d9811429b9969b4f27e2eaee upstream.

Both the ALC5645 and ALC5650 datasheets specify a recommended voltage of
1.8V for CPVDD, not 3.5V.

Fix the comment.

Cc: Matthias Brugger <matthias.bgg@gmail.com>
Fixes: 26aa19174f0d ("ASoC: dt-bindings: rt5645: add suppliers")
Fixes: 83d43ab0a1cb ("ASoC: dt-bindings: realtek,rt5645: Convert to dtschema")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20241211035403.4157760-1-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Documentation/devicetree/bindings/sound/realtek,rt5645.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/realtek,rt5645.yaml b/Documentation/devicetree/bindings/sound/realtek,rt5645.yaml
index 13f09f1bc800..0a698798c22b 100644
--- a/Documentation/devicetree/bindings/sound/realtek,rt5645.yaml
+++ b/Documentation/devicetree/bindings/sound/realtek,rt5645.yaml
@@ -51,7 +51,7 @@ properties:
     description: Power supply for AVDD, providing 1.8V.
 
   cpvdd-supply:
-    description: Power supply for CPVDD, providing 3.5V.
+    description: Power supply for CPVDD, providing 1.8V.
 
   hp-detect-gpios:
     description: 
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 041/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21Q6 and 21Q7
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 040/114] ASoC: dt-bindings: realtek,rt5645: Fix CPVDD voltage comment Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 042/114] powerpc/pseries/vas: Add close() callback in vas_vm_ops struct Greg Kroah-Hartman
                   ` (83 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Bard Liao,
	Mark Brown

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Fitzgerald <rf@opensource.cirrus.com>

commit 7c449ef0fdce540bfb235a2d93e7184864c3388b upstream.

Update the DMI match for a Lenovo laptop to the new DMI identifier.

This laptop ships with a different DMI identifier to what was expected,
and now has two identifiers.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 83c062ae81e8 ("ASoC: Intel: sof_sdw: Add quirks for some new Lenovo laptops")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20241216140821.153670-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/soc/intel/boards/sof_sdw.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -626,9 +626,17 @@ static const struct dmi_system_id sof_sd
 		.callback = sof_sdw_quirk_cb,
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "233B")
+			DMI_MATCH(DMI_PRODUCT_NAME, "21Q6")
 		},
-		.driver_data = (void *)(SOC_SDW_SIDECAR_AMPS),
+		.driver_data = (void *)(SOC_SDW_SIDECAR_AMPS | SOC_SDW_CODEC_MIC),
+	},
+	{
+		.callback = sof_sdw_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "21Q7")
+		},
+		.driver_data = (void *)(SOC_SDW_SIDECAR_AMPS | SOC_SDW_CODEC_MIC),
 	},
 
 	/* ArrowLake devices */



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 042/114] powerpc/pseries/vas: Add close() callback in vas_vm_ops struct
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 041/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21Q6 and 21Q7 Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 043/114] power: supply: bq24190: Fix BQ24296 Vbus regulator support Greg Kroah-Hartman
                   ` (82 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Haren Myneni, Madhavan Srinivasan,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Haren Myneni <haren@linux.ibm.com>

[ Upstream commit 05aa156e156ef3168e7ab8a68721945196495c17 ]

The mapping VMA address is saved in VAS window struct when the
paste address is mapped. This VMA address is used during migration
to unmap the paste address if the window is active. The paste
address mapping will be removed when the window is closed or with
the munmap(). But the VMA address in the VAS window is not updated
with munmap() which is causing invalid access during migration.

The KASAN report shows:
[16386.254991] BUG: KASAN: slab-use-after-free in reconfig_close_windows+0x1a0/0x4e8
[16386.255043] Read of size 8 at addr c00000014a819670 by task drmgr/696928

[16386.255096] CPU: 29 UID: 0 PID: 696928 Comm: drmgr Kdump: loaded Tainted: G    B              6.11.0-rc5-nxgzip #2
[16386.255128] Tainted: [B]=BAD_PAGE
[16386.255148] Hardware name: IBM,9080-HEX Power11 (architected) 0x820200 0xf000007 of:IBM,FW1110.00 (NH1110_016) hv:phyp pSeries
[16386.255181] Call Trace:
[16386.255202] [c00000016b297660] [c0000000018ad0ac] dump_stack_lvl+0x84/0xe8 (unreliable)
[16386.255246] [c00000016b297690] [c0000000006e8a90] print_report+0x19c/0x764
[16386.255285] [c00000016b297760] [c0000000006e9490] kasan_report+0x128/0x1f8
[16386.255309] [c00000016b297880] [c0000000006eb5c8] __asan_load8+0xac/0xe0
[16386.255326] [c00000016b2978a0] [c00000000013f898] reconfig_close_windows+0x1a0/0x4e8
[16386.255343] [c00000016b297990] [c000000000140e58] vas_migration_handler+0x3a4/0x3fc
[16386.255368] [c00000016b297a90] [c000000000128848] pseries_migrate_partition+0x4c/0x4c4
...

[16386.256136] Allocated by task 696554 on cpu 31 at 16377.277618s:
[16386.256149]  kasan_save_stack+0x34/0x68
[16386.256163]  kasan_save_track+0x34/0x80
[16386.256175]  kasan_save_alloc_info+0x58/0x74
[16386.256196]  __kasan_slab_alloc+0xb8/0xdc
[16386.256209]  kmem_cache_alloc_noprof+0x200/0x3d0
[16386.256225]  vm_area_alloc+0x44/0x150
[16386.256245]  mmap_region+0x214/0x10c4
[16386.256265]  do_mmap+0x5fc/0x750
[16386.256277]  vm_mmap_pgoff+0x14c/0x24c
[16386.256292]  ksys_mmap_pgoff+0x20c/0x348
[16386.256303]  sys_mmap+0xd0/0x160
...

[16386.256350] Freed by task 0 on cpu 31 at 16386.204848s:
[16386.256363]  kasan_save_stack+0x34/0x68
[16386.256374]  kasan_save_track+0x34/0x80
[16386.256384]  kasan_save_free_info+0x64/0x10c
[16386.256396]  __kasan_slab_free+0x120/0x204
[16386.256415]  kmem_cache_free+0x128/0x450
[16386.256428]  vm_area_free_rcu_cb+0xa8/0xd8
[16386.256441]  rcu_do_batch+0x2c8/0xcf0
[16386.256458]  rcu_core+0x378/0x3c4
[16386.256473]  handle_softirqs+0x20c/0x60c
[16386.256495]  do_softirq_own_stack+0x6c/0x88
[16386.256509]  do_softirq_own_stack+0x58/0x88
[16386.256521]  __irq_exit_rcu+0x1a4/0x20c
[16386.256533]  irq_exit+0x20/0x38
[16386.256544]  interrupt_async_exit_prepare.constprop.0+0x18/0x2c
...

[16386.256717] Last potentially related work creation:
[16386.256729]  kasan_save_stack+0x34/0x68
[16386.256741]  __kasan_record_aux_stack+0xcc/0x12c
[16386.256753]  __call_rcu_common.constprop.0+0x94/0xd04
[16386.256766]  vm_area_free+0x28/0x3c
[16386.256778]  remove_vma+0xf4/0x114
[16386.256797]  do_vmi_align_munmap.constprop.0+0x684/0x870
[16386.256811]  __vm_munmap+0xe0/0x1f8
[16386.256821]  sys_munmap+0x54/0x6c
[16386.256830]  system_call_exception+0x1a0/0x4a0
[16386.256841]  system_call_vectored_common+0x15c/0x2ec

[16386.256868] The buggy address belongs to the object at c00000014a819670
                which belongs to the cache vm_area_struct of size 168
[16386.256887] The buggy address is located 0 bytes inside of
                freed 168-byte region [c00000014a819670, c00000014a819718)

[16386.256915] The buggy address belongs to the physical page:
[16386.256928] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14a81
[16386.256950] memcg:c0000000ba430001
[16386.256961] anon flags: 0x43ffff800000000(node=4|zone=0|lastcpupid=0x7ffff)
[16386.256975] page_type: 0xfdffffff(slab)
[16386.256990] raw: 043ffff800000000 c00000000501c080 0000000000000000 5deadbee00000001
[16386.257003] raw: 0000000000000000 00000000011a011a 00000001fdffffff c0000000ba430001
[16386.257018] page dumped because: kasan: bad access detected

This patch adds close() callback in vas_vm_ops vm_operations_struct
which will be executed during munmap() before freeing VMA. The VMA
address in the VAS window is set to NULL after holding the window
mmap_mutex.

Fixes: 37e6764895ef ("powerpc/pseries/vas: Add VAS migration handler")
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241214051758.997759-1-haren@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/book3s/vas-api.c | 36 +++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c
index f381b177ea06..0b6365d85d11 100644
--- a/arch/powerpc/platforms/book3s/vas-api.c
+++ b/arch/powerpc/platforms/book3s/vas-api.c
@@ -464,7 +464,43 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
 	return VM_FAULT_SIGBUS;
 }
 
+/*
+ * During mmap() paste address, mapping VMA is saved in VAS window
+ * struct which is used to unmap during migration if the window is
+ * still open. But the user space can remove this mapping with
+ * munmap() before closing the window and the VMA address will
+ * be invalid. Set VAS window VMA to NULL in this function which
+ * is called before VMA free.
+ */
+static void vas_mmap_close(struct vm_area_struct *vma)
+{
+	struct file *fp = vma->vm_file;
+	struct coproc_instance *cp_inst = fp->private_data;
+	struct vas_window *txwin;
+
+	/* Should not happen */
+	if (!cp_inst || !cp_inst->txwin) {
+		pr_err("No attached VAS window for the paste address mmap\n");
+		return;
+	}
+
+	txwin = cp_inst->txwin;
+	/*
+	 * task_ref.vma is set in coproc_mmap() during mmap paste
+	 * address. So it has to be the same VMA that is getting freed.
+	 */
+	if (WARN_ON(txwin->task_ref.vma != vma)) {
+		pr_err("Invalid paste address mmaping\n");
+		return;
+	}
+
+	mutex_lock(&txwin->task_ref.mmap_mutex);
+	txwin->task_ref.vma = NULL;
+	mutex_unlock(&txwin->task_ref.mmap_mutex);
+}
+
 static const struct vm_operations_struct vas_vm_ops = {
+	.close = vas_mmap_close,
 	.fault = vas_mmap_fault,
 };
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 043/114] power: supply: bq24190: Fix BQ24296 Vbus regulator support
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 042/114] powerpc/pseries/vas: Add close() callback in vas_vm_ops struct Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 044/114] stddef: make __struct_group() UAPI C++-friendly Greg Kroah-Hartman
                   ` (81 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Hans de Goede, Sebastian Reichel,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans de Goede <hdegoede@redhat.com>

[ Upstream commit b3ded6072c5600704cfa3ce3a8dc8718d34bda66 ]

There are 2 issues with bq24296_set_otg_vbus():

1. When writing the OTG_CONFIG bit it uses POC_CHG_CONFIG_SHIFT which
   should be POC_OTG_CONFIG_SHIFT.

2. When turning the regulator off it never turns charging back on. Note
   this must be done through bq24190_charger_set_charge_type(), to ensure
   that the charge_type property value of none/trickle/fast is honored.

Resolve both issues to fix BQ24296 Vbus regulator support not working.

Fixes: b150a703b56f ("power: supply: bq24190_charger: Add support for BQ24296")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20241116203648.169100-2-hdegoede@redhat.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/supply/bq24190_charger.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
index 2b393eb5c282..c47f32f152e6 100644
--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -567,6 +567,7 @@ static int bq24190_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
 
 static int bq24296_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
 {
+	union power_supply_propval val = { .intval = bdi->charge_type };
 	int ret;
 
 	ret = pm_runtime_resume_and_get(bdi->dev);
@@ -587,13 +588,18 @@ static int bq24296_set_otg_vbus(struct bq24190_dev_info *bdi, bool enable)
 
 		ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
 					 BQ24296_REG_POC_OTG_CONFIG_MASK,
-					 BQ24296_REG_POC_CHG_CONFIG_SHIFT,
+					 BQ24296_REG_POC_OTG_CONFIG_SHIFT,
 					 BQ24296_REG_POC_OTG_CONFIG_OTG);
-	} else
+	} else {
 		ret = bq24190_write_mask(bdi, BQ24190_REG_POC,
 					 BQ24296_REG_POC_OTG_CONFIG_MASK,
-					 BQ24296_REG_POC_CHG_CONFIG_SHIFT,
+					 BQ24296_REG_POC_OTG_CONFIG_SHIFT,
 					 BQ24296_REG_POC_OTG_CONFIG_DISABLE);
+		if (ret < 0)
+			goto out;
+
+		ret = bq24190_charger_set_charge_type(bdi, &val);
+	}
 
 out:
 	pm_runtime_mark_last_busy(bdi->dev);
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 044/114] stddef: make __struct_group() UAPI C++-friendly
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 043/114] power: supply: bq24190: Fix BQ24296 Vbus regulator support Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 045/114] tracing/kprobe: Make trace_kprobes module callback called after jump_label update Greg Kroah-Hartman
                   ` (80 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Christopher Ferris,
	Alexander Lobakin, Gustavo A. R. Silva, Kees Cook, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Lobakin <aleksander.lobakin@intel.com>

[ Upstream commit 724c6ce38bbaeb4b3f109b0e066d6c0ecd15446c ]

For the most part of the C++ history, it couldn't have type
declarations inside anonymous unions for different reasons. At the
same time, __struct_group() relies on the latters, so when the @TAG
argument is not empty, C++ code doesn't want to build (even under
`extern "C"`):

../linux/include/uapi/linux/pkt_cls.h:25:24: error:
'struct tc_u32_sel::<unnamed union>::tc_u32_sel_hdr,' invalid;
an anonymous union may only have public non-static data members
[-fpermissive]

The safest way to fix this without trying to switch standards (which
is impossible in UAPI anyway) etc., is to disable tag declaration
for that language. This won't break anything since for now it's not
buildable at all.
Use a separate definition for __struct_group() when __cplusplus is
defined to mitigate the error, including the version from tools/.

Fixes: 50d7bd38c3aa ("stddef: Introduce struct_group() helper macro")
Reported-by: Christopher Ferris <cferris@google.com>
Closes: https://lore.kernel.org/linux-hardening/Z1HZpe3WE5As8UAz@google.com
Suggested-by: Kees Cook <kees@kernel.org> # __struct_group_tag()
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20241219135734.2130002-1-aleksander.lobakin@intel.com
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/uapi/linux/stddef.h       | 13 ++++++++++---
 tools/include/uapi/linux/stddef.h | 15 +++++++++++----
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index 58154117d9b0..a6fce46aeb37 100644
--- a/include/uapi/linux/stddef.h
+++ b/include/uapi/linux/stddef.h
@@ -8,6 +8,13 @@
 #define __always_inline inline
 #endif
 
+/* Not all C++ standards support type declarations inside an anonymous union */
+#ifndef __cplusplus
+#define __struct_group_tag(TAG)		TAG
+#else
+#define __struct_group_tag(TAG)
+#endif
+
 /**
  * __struct_group() - Create a mirrored named and anonyomous struct
  *
@@ -20,13 +27,13 @@
  * and size: one anonymous and one named. The former's members can be used
  * normally without sub-struct naming, and the latter can be used to
  * reason about the start, end, and size of the group of struct members.
- * The named struct can also be explicitly tagged for layer reuse, as well
- * as both having struct attributes appended.
+ * The named struct can also be explicitly tagged for layer reuse (C only),
+ * as well as both having struct attributes appended.
  */
 #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
 	union { \
 		struct { MEMBERS } ATTRS; \
-		struct TAG { MEMBERS } ATTRS NAME; \
+		struct __struct_group_tag(TAG) { MEMBERS } ATTRS NAME; \
 	} ATTRS
 
 #ifdef __cplusplus
diff --git a/tools/include/uapi/linux/stddef.h b/tools/include/uapi/linux/stddef.h
index bb6ea517efb5..c53cde425406 100644
--- a/tools/include/uapi/linux/stddef.h
+++ b/tools/include/uapi/linux/stddef.h
@@ -8,6 +8,13 @@
 #define __always_inline __inline__
 #endif
 
+/* Not all C++ standards support type declarations inside an anonymous union */
+#ifndef __cplusplus
+#define __struct_group_tag(TAG)		TAG
+#else
+#define __struct_group_tag(TAG)
+#endif
+
 /**
  * __struct_group() - Create a mirrored named and anonyomous struct
  *
@@ -20,14 +27,14 @@
  * and size: one anonymous and one named. The former's members can be used
  * normally without sub-struct naming, and the latter can be used to
  * reason about the start, end, and size of the group of struct members.
- * The named struct can also be explicitly tagged for layer reuse, as well
- * as both having struct attributes appended.
+ * The named struct can also be explicitly tagged for layer reuse (C only),
+ * as well as both having struct attributes appended.
  */
 #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
 	union { \
 		struct { MEMBERS } ATTRS; \
-		struct TAG { MEMBERS } ATTRS NAME; \
-	}
+		struct __struct_group_tag(TAG) { MEMBERS } ATTRS NAME; \
+	} ATTRS
 
 /**
  * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 045/114] tracing/kprobe: Make trace_kprobes module callback called after jump_label update
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 044/114] stddef: make __struct_group() UAPI C++-friendly Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 046/114] watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04 Greg Kroah-Hartman
                   ` (79 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

[ Upstream commit d685d55dfc86b1a4bdcec77c3c1f8a83f181264e ]

Make sure the trace_kprobe's module notifer callback function is called
after jump_label's callback is called. Since the trace_kprobe's callback
eventually checks jump_label address during registering new kprobe on
the loading module, jump_label must be updated before this registration
happens.

Link: https://lore.kernel.org/all/173387585556.995044.3157941002975446119.stgit@devnote2/

Fixes: 614243181050 ("tracing/kprobes: Support module init function probing")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/trace/trace_kprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 263fac44d3ca..935a886af40c 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -725,7 +725,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
 
 static struct notifier_block trace_kprobe_module_nb = {
 	.notifier_call = trace_kprobe_module_callback,
-	.priority = 1	/* Invoked after kprobe module callback */
+	.priority = 2	/* Invoked after kprobe and jump_label module callback */
 };
 static int trace_kprobe_register_module_notifier(void)
 {
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 046/114] watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 045/114] tracing/kprobe: Make trace_kprobes module callback called after jump_label update Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 047/114] watchdog: rzg2l_wdt: Power on the watchdog domain in the restart handler Greg Kroah-Hartman
                   ` (78 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, James Hilliard, Guenter Roeck,
	Wim Van Sebroeck, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: James Hilliard <james.hilliard1@gmail.com>

[ Upstream commit 43439076383a7611300334d1357c0f8883f40816 ]

For the watchdog timer to work properly on the QCML04 board we need to
set PWRGD enable in the Environment Controller Configuration Registers
Special Configuration Register 1 when it is not already set, this may
be the case when the watchdog is not enabled from within the BIOS.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20241025063441.3494837-1-james.hilliard1@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/it87_wdt.c | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
index 3e8c15138edd..1a5a0a2c3f2e 100644
--- a/drivers/watchdog/it87_wdt.c
+++ b/drivers/watchdog/it87_wdt.c
@@ -20,6 +20,8 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/bits.h>
+#include <linux/dmi.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -40,6 +42,7 @@
 #define VAL		0x2f
 
 /* Logical device Numbers LDN */
+#define EC		0x04
 #define GPIO		0x07
 
 /* Configuration Registers and Functions */
@@ -73,6 +76,12 @@
 #define IT8784_ID	0x8784
 #define IT8786_ID	0x8786
 
+/* Environment Controller Configuration Registers LDN=0x04 */
+#define SCR1		0xfa
+
+/* Environment Controller Bits SCR1 */
+#define WDT_PWRGD	0x20
+
 /* GPIO Configuration Registers LDN=0x07 */
 #define WDTCTRL		0x71
 #define WDTCFG		0x72
@@ -240,6 +249,21 @@ static int wdt_set_timeout(struct watchdog_device *wdd, unsigned int t)
 	return ret;
 }
 
+enum {
+	IT87_WDT_OUTPUT_THROUGH_PWRGD	= BIT(0),
+};
+
+static const struct dmi_system_id it87_quirks[] = {
+	{
+		/* Qotom Q30900P (IT8786) */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "QCML04"),
+		},
+		.driver_data = (void *)IT87_WDT_OUTPUT_THROUGH_PWRGD,
+	},
+	{}
+};
+
 static const struct watchdog_info ident = {
 	.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
 	.firmware_version = 1,
@@ -261,8 +285,10 @@ static struct watchdog_device wdt_dev = {
 
 static int __init it87_wdt_init(void)
 {
+	const struct dmi_system_id *dmi_id;
 	u8  chip_rev;
 	u8 ctrl;
+	int quirks = 0;
 	int rc;
 
 	rc = superio_enter();
@@ -273,6 +299,10 @@ static int __init it87_wdt_init(void)
 	chip_rev  = superio_inb(CHIPREV) & 0x0f;
 	superio_exit();
 
+	dmi_id = dmi_first_match(it87_quirks);
+	if (dmi_id)
+		quirks = (long)dmi_id->driver_data;
+
 	switch (chip_type) {
 	case IT8702_ID:
 		max_units = 255;
@@ -333,6 +363,15 @@ static int __init it87_wdt_init(void)
 		superio_outb(0x00, WDTCTRL);
 	}
 
+	if (quirks & IT87_WDT_OUTPUT_THROUGH_PWRGD) {
+		superio_select(EC);
+		ctrl = superio_inb(SCR1);
+		if (!(ctrl & WDT_PWRGD)) {
+			ctrl |= WDT_PWRGD;
+			superio_outb(ctrl, SCR1);
+		}
+	}
+
 	superio_exit();
 
 	if (timeout < 1 || timeout > max_units * 60) {
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 047/114] watchdog: rzg2l_wdt: Power on the watchdog domain in the restart handler
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 046/114] watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04 Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 048/114] Revert "watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs" Greg Kroah-Hartman
                   ` (77 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Claudiu Beznea, Ulf Hansson,
	Geert Uytterhoeven, Guenter Roeck, Wim Van Sebroeck, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

[ Upstream commit bad201b2ac4e238c6d4b6966a220240e3861640c ]

On RZ/G3S the watchdog can be part of a software-controlled PM domain. In
this case, the watchdog device need to be powered on in
struct watchdog_ops::restart API. This can be done though
pm_runtime_resume_and_get() API if the watchdog PM domain and watchdog
device are marked as IRQ safe. We mark the watchdog PM domain as IRQ safe
with GENPD_FLAG_IRQ_SAFE when the watchdog PM domain is registered and the
watchdog device though pm_runtime_irq_safe().

Before commit e4cf89596c1f ("watchdog: rzg2l_wdt: Fix 'BUG: Invalid wait
context'") pm_runtime_get_sync() was used in watchdog restart handler
(which is similar to pm_runtime_resume_and_get() except the later one
handles the runtime resume errors).

Commit e4cf89596c1f ("watchdog: rzg2l_wdt: Fix 'BUG: Invalid wait
context'") dropped the pm_runtime_get_sync() and replaced it with
clk_prepare_enable() to avoid invalid wait context due to genpd_lock()
in genpd_runtime_resume() being called from atomic context. But
clk_prepare_enable() doesn't fit for this either (as reported by
Ulf Hansson) as clk_prepare() can also sleep (it just not throw invalid
wait context warning as it is not written for this).

Because the watchdog device is marked now as IRQ safe (though this patch)
the irq_safe_dev_in_sleep_domain() call from genpd_runtime_resume() returns
1 for devices not registering an IRQ safe PM domain for watchdog (as the
watchdog device is IRQ safe, PM domain is not and watchdog PM domain is
always-on), this being the case for RZ/G3S with old device trees and
the rest of the SoCs that use this driver, we can now drop also the
clk_prepare_enable() calls in restart handler and rely on
pm_runtime_resume_and_get().

Thus, drop clk_prepare_enable() and use pm_runtime_resume_and_get() in
watchdog restart handler.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20241015164732.4085249-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/rzg2l_wdt.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
index 2a35f890a288..11bbe48160ec 100644
--- a/drivers/watchdog/rzg2l_wdt.c
+++ b/drivers/watchdog/rzg2l_wdt.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/units.h>
@@ -166,8 +167,22 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev,
 	struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
 	int ret;
 
-	clk_prepare_enable(priv->pclk);
-	clk_prepare_enable(priv->osc_clk);
+	/*
+	 * In case of RZ/G3S the watchdog device may be part of an IRQ safe power
+	 * domain that is currently powered off. In this case we need to power
+	 * it on before accessing registers. Along with this the clocks will be
+	 * enabled. We don't undo the pm_runtime_resume_and_get() as the device
+	 * need to be on for the reboot to happen.
+	 *
+	 * For the rest of SoCs not registering a watchdog IRQ safe power
+	 * domain it is safe to call pm_runtime_resume_and_get() as the
+	 * irq_safe_dev_in_sleep_domain() call in genpd_runtime_resume()
+	 * returns non zero value and the genpd_lock() is avoided, thus, there
+	 * will be no invalid wait context reported by lockdep.
+	 */
+	ret = pm_runtime_resume_and_get(wdev->parent);
+	if (ret)
+		return ret;
 
 	if (priv->devtype == WDT_RZG2L) {
 		ret = reset_control_deassert(priv->rstc);
@@ -275,6 +290,7 @@ static int rzg2l_wdt_probe(struct platform_device *pdev)
 
 	priv->devtype = (uintptr_t)of_device_get_match_data(dev);
 
+	pm_runtime_irq_safe(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 
 	priv->wdev.info = &rzg2l_wdt_ident;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 048/114] Revert "watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs"
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 047/114] watchdog: rzg2l_wdt: Power on the watchdog domain in the restart handler Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 049/114] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Greg Kroah-Hartman
                   ` (76 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Peter Griffin, Sam Protsenko,
	Guenter Roeck, Wim Van Sebroeck, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Griffin <peter.griffin@linaro.org>

[ Upstream commit ccfb765944bb66813398958983cb8141e2624a6b ]

This reverts commit 746f0770f916e6c48e422d6a34e67eae16707f0e.

Now that we can register a SoC specific regmap with syscon using
of_syscon_register_regmap() api we can switch back to using
syscon_regmap_lookup_by_phandle() in the client drivers.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20241029191131.2329414-1-peter.griffin@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/Kconfig       | 1 +
 drivers/watchdog/s3c2410_wdt.c | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 94c96bcfefe3..0b59c669c26d 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -549,6 +549,7 @@ config S3C2410_WATCHDOG
 	tristate "S3C6410/S5Pv210/Exynos Watchdog"
 	depends on ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
 	select WATCHDOG_CORE
+	select MFD_SYSCON if ARCH_EXYNOS
 	help
 	  Watchdog timer block in the Samsung S3C64xx, S5Pv210 and Exynos
 	  SoCs. This will reboot the system when the timer expires with
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 686cf544d0ae..349d30462c8c 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -24,9 +24,9 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 #include <linux/delay.h>
-#include <linux/soc/samsung/exynos-pmu.h>
 
 #define S3C2410_WTCON		0x00
 #define S3C2410_WTDAT		0x04
@@ -699,11 +699,11 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
 		return ret;
 
 	if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) {
-		wdt->pmureg = exynos_get_pmu_regmap_by_phandle(dev->of_node,
-						 "samsung,syscon-phandle");
+		wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
+						"samsung,syscon-phandle");
 		if (IS_ERR(wdt->pmureg))
 			return dev_err_probe(dev, PTR_ERR(wdt->pmureg),
-					     "PMU regmap lookup failed.\n");
+					     "syscon regmap lookup failed.\n");
 	}
 
 	wdt_irq = platform_get_irq(pdev, 0);
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 049/114] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 048/114] Revert "watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs" Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 050/114] scsi: qla1280: Fix hw revision numbering for ISP1020/1040 Greg Kroah-Hartman
                   ` (75 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Yassine Oudjana,
	AngeloGioacchino Del Regno, Guenter Roeck, Wim Van Sebroeck,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yassine Oudjana <y.oudjana@protonmail.com>

[ Upstream commit 15ddf704f56f8c95ff74dfd1157ed8646b322fa1 ]

Add support for the Top Reset Generation Unit/Watchdog Timer found on
MT6735.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20241106104738.195968-3-y.oudjana@protonmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/mtk_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index e2d7a57d6ea2..91d110646e16 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -10,6 +10,7 @@
  */
 
 #include <dt-bindings/reset/mt2712-resets.h>
+#include <dt-bindings/reset/mediatek,mt6735-wdt.h>
 #include <dt-bindings/reset/mediatek,mt6795-resets.h>
 #include <dt-bindings/reset/mt7986-resets.h>
 #include <dt-bindings/reset/mt8183-resets.h>
@@ -87,6 +88,10 @@ static const struct mtk_wdt_data mt2712_data = {
 	.toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM,
 };
 
+static const struct mtk_wdt_data mt6735_data = {
+	.toprgu_sw_rst_num = MT6735_TOPRGU_RST_NUM,
+};
+
 static const struct mtk_wdt_data mt6795_data = {
 	.toprgu_sw_rst_num = MT6795_TOPRGU_SW_RST_NUM,
 };
@@ -489,6 +494,7 @@ static int mtk_wdt_resume(struct device *dev)
 static const struct of_device_id mtk_wdt_dt_ids[] = {
 	{ .compatible = "mediatek,mt2712-wdt", .data = &mt2712_data },
 	{ .compatible = "mediatek,mt6589-wdt" },
+	{ .compatible = "mediatek,mt6735-wdt", .data = &mt6735_data },
 	{ .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data },
 	{ .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
 	{ .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data },
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 050/114] scsi: qla1280: Fix hw revision numbering for ISP1020/1040
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 049/114] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 051/114] scsi: megaraid_sas: Fix for a potential deadlock Greg Kroah-Hartman
                   ` (74 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Magnus Lindholm, Christoph Hellwig,
	Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Magnus Lindholm <linmag7@gmail.com>

[ Upstream commit c064de86d2a3909222d5996c5047f64c7a8f791b ]

Fix the hardware revision numbering for Qlogic ISP1020/1040 boards.  HWMASK
suggests that the revision number only needs four bits, this is consistent
with how NetBSD does things in their ISP driver. Verified on a IPS1040B
which is seen as rev 5 not as BIT_4.

Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Link: https://lore.kernel.org/r/20241113225636.2276-1-linmag7@gmail.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/qla1280.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
index d309e2ca14de..dea2290b37d4 100644
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -116,12 +116,12 @@ struct device_reg {
 	uint16_t id_h;		/* ID high */
 	uint16_t cfg_0;		/* Configuration 0 */
 #define ISP_CFG0_HWMSK   0x000f	/* Hardware revision mask */
-#define ISP_CFG0_1020    BIT_0	/* ISP1020 */
-#define ISP_CFG0_1020A	 BIT_1	/* ISP1020A */
-#define ISP_CFG0_1040	 BIT_2	/* ISP1040 */
-#define ISP_CFG0_1040A	 BIT_3	/* ISP1040A */
-#define ISP_CFG0_1040B	 BIT_4	/* ISP1040B */
-#define ISP_CFG0_1040C	 BIT_5	/* ISP1040C */
+#define ISP_CFG0_1020	 1	/* ISP1020 */
+#define ISP_CFG0_1020A	 2	/* ISP1020A */
+#define ISP_CFG0_1040	 3	/* ISP1040 */
+#define ISP_CFG0_1040A	 4	/* ISP1040A */
+#define ISP_CFG0_1040B	 5	/* ISP1040B */
+#define ISP_CFG0_1040C	 6	/* ISP1040C */
 	uint16_t cfg_1;		/* Configuration 1 */
 #define ISP_CFG1_F128    BIT_6  /* 128-byte FIFO threshold */
 #define ISP_CFG1_F64     BIT_4|BIT_5 /* 128-byte FIFO threshold */
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 051/114] scsi: megaraid_sas: Fix for a potential deadlock
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 050/114] scsi: qla1280: Fix hw revision numbering for ISP1020/1040 Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 052/114] udf: Skip parent dir link count update if corrupted Greg Kroah-Hartman
                   ` (73 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Tomas Henzl, Chandrakanth Patil,
	Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tomas Henzl <thenzl@redhat.com>

[ Upstream commit 50740f4dc78b41dec7c8e39772619d5ba841ddd7 ]

This fixes a 'possible circular locking dependency detected' warning
      CPU0                    CPU1
      ----                    ----
 lock(&instance->reset_mutex);
                              lock(&shost->scan_mutex);
                              lock(&instance->reset_mutex);
 lock(&shost->scan_mutex);

Fix this by temporarily releasing the reset_mutex.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Link: https://lore.kernel.org/r/20240923174833.45345-1-thenzl@redhat.com
Acked-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 8e75e2e279a4..50f1dcb6d584 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -8907,8 +8907,11 @@ megasas_aen_polling(struct work_struct *work)
 						   (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL),
 						   (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL),
 						   0);
-			if (sdev1)
+			if (sdev1) {
+				mutex_unlock(&instance->reset_mutex);
 				megasas_remove_scsi_device(sdev1);
+				mutex_lock(&instance->reset_mutex);
+			}
 
 			event_type = SCAN_VD_CHANNEL;
 			break;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 052/114] udf: Skip parent dir link count update if corrupted
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 051/114] scsi: megaraid_sas: Fix for a potential deadlock Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 053/114] udf: Verify inode link counts before performing rename Greg Kroah-Hartman
                   ` (72 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Kara, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

[ Upstream commit c5566903af56dd1abb092f18dcb0c770d6cd8dcb ]

If the parent directory link count is too low (likely directory inode
corruption), just skip updating its link count as if it goes to 0 too
early it can cause unexpected issues.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/udf/namei.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 78a603129dd5..2be775d30ac1 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -517,7 +517,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
 			 inode->i_nlink);
 	clear_nlink(inode);
 	inode->i_size = 0;
-	inode_dec_link_count(dir);
+	if (dir->i_nlink >= 3)
+		inode_dec_link_count(dir);
+	else
+		udf_warn(inode->i_sb, "parent dir link count too low (%u)\n",
+			 dir->i_nlink);
 	udf_add_fid_counter(dir->i_sb, true, -1);
 	inode_set_mtime_to_ts(dir,
 			      inode_set_ctime_to_ts(dir, inode_set_ctime_current(inode)));
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 053/114] udf: Verify inode link counts before performing rename
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 052/114] udf: Skip parent dir link count update if corrupted Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 054/114] ALSA: ump: Dont open legacy substream for an inactive group Greg Kroah-Hartman
                   ` (71 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, syzbot+3ff7365dc04a6bcafa66,
	Jan Kara, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jan Kara <jack@suse.cz>

[ Upstream commit 6756af923e06aa33ad8894aaecbf9060953ba00f ]

During rename, we are updating link counts of various inodes either when
rename deletes target or when moving directory across directories.
Verify involved link counts are sane so that we don't trip warnings in
VFS.

Reported-by: syzbot+3ff7365dc04a6bcafa66@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/udf/namei.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 2be775d30ac1..2cb49b6b0716 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -791,8 +791,18 @@ static int udf_rename(struct mnt_idmap *idmap, struct inode *old_dir,
 			retval = -ENOTEMPTY;
 			if (!empty_dir(new_inode))
 				goto out_oiter;
+			retval = -EFSCORRUPTED;
+			if (new_inode->i_nlink != 2)
+				goto out_oiter;
 		}
+		retval = -EFSCORRUPTED;
+		if (old_dir->i_nlink < 3)
+			goto out_oiter;
 		is_dir = true;
+	} else if (new_inode) {
+		retval = -EFSCORRUPTED;
+		if (new_inode->i_nlink < 1)
+			goto out_oiter;
 	}
 	if (is_dir && old_dir != new_dir) {
 		retval = udf_fiiter_find_entry(old_inode, &dotdot_name,
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 054/114] ALSA: ump: Dont open legacy substream for an inactive group
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 053/114] udf: Verify inode link counts before performing rename Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 055/114] ALSA: ump: Indicate the inactive group in legacy substream names Greg Kroah-Hartman
                   ` (70 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 3978d53df7236f0a517c2abeb43ddf6ac162cdd8 ]

When a UMP Group is inactive, we shouldn't allow users to access it
via the legacy MIDI access.  Add the group active flag check and
return -ENODEV if it's inactive.

Link: https://patch.msgid.link/20241129094546.32119-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/core/ump.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/ump.c b/sound/core/ump.c
index 8d37f237f83b..0ade67d6b089 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -1087,6 +1087,8 @@ static int snd_ump_legacy_open(struct snd_rawmidi_substream *substream)
 	guard(mutex)(&ump->open_mutex);
 	if (ump->legacy_substreams[dir][group])
 		return -EBUSY;
+	if (!ump->groups[group].active)
+		return -ENODEV;
 	if (dir == SNDRV_RAWMIDI_STREAM_OUTPUT) {
 		if (!ump->legacy_out_opens) {
 			err = snd_rawmidi_kernel_open(&ump->core, 0,
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 055/114] ALSA: ump: Indicate the inactive group in legacy substream names
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 054/114] ALSA: ump: Dont open legacy substream for an inactive group Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 056/114] ALSA: ump: Update legacy substream names upon FB info update Greg Kroah-Hartman
                   ` (69 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit e29e504e7890b9ee438ca6370d0180d607c473f9 ]

Since the legacy rawmidi has no proper way to know the inactive group,
indicate it in the rawmidi substream names with "[Inactive]" suffix
when the corresponding UMP group is inactive.

Link: https://patch.msgid.link/20241129094546.32119-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/core/ump.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/core/ump.c b/sound/core/ump.c
index 0ade67d6b089..55d5d8af5e44 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -1256,8 +1256,9 @@ static void fill_substream_names(struct snd_ump_endpoint *ump,
 		name = ump->groups[idx].name;
 		if (!*name)
 			name = ump->info.name;
-		snprintf(s->name, sizeof(s->name), "Group %d (%.16s)",
-			 idx + 1, name);
+		snprintf(s->name, sizeof(s->name), "Group %d (%.16s)%s",
+			 idx + 1, name,
+			 ump->groups[idx].active ? "" : " [Inactive]");
 	}
 }
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 056/114] ALSA: ump: Update legacy substream names upon FB info update
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 055/114] ALSA: ump: Indicate the inactive group in legacy substream names Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 057/114] ALSA: hda/conexant: fix Z60MR100 startup pop issue Greg Kroah-Hartman
                   ` (68 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit edad3f9519fcacb926d0e3f3217aecaf628a593f ]

The legacy rawmidi substreams should be updated when UMP FB Info or
UMP FB Name are received, too.

Link: https://patch.msgid.link/20241129094546.32119-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/core/ump.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/sound/core/ump.c b/sound/core/ump.c
index 55d5d8af5e44..24f7d65ce49c 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -37,6 +37,7 @@ static int process_legacy_output(struct snd_ump_endpoint *ump,
 				 u32 *buffer, int count);
 static void process_legacy_input(struct snd_ump_endpoint *ump, const u32 *src,
 				 int words);
+static void update_legacy_names(struct snd_ump_endpoint *ump);
 #else
 static inline int process_legacy_output(struct snd_ump_endpoint *ump,
 					u32 *buffer, int count)
@@ -47,6 +48,9 @@ static inline void process_legacy_input(struct snd_ump_endpoint *ump,
 					const u32 *src, int words)
 {
 }
+static inline void update_legacy_names(struct snd_ump_endpoint *ump)
+{
+}
 #endif
 
 static const struct snd_rawmidi_global_ops snd_ump_rawmidi_ops = {
@@ -861,6 +865,7 @@ static int ump_handle_fb_info_msg(struct snd_ump_endpoint *ump,
 		fill_fb_info(ump, &fb->info, buf);
 		if (ump->parsed) {
 			snd_ump_update_group_attrs(ump);
+			update_legacy_names(ump);
 			seq_notify_fb_change(ump, fb);
 		}
 	}
@@ -893,6 +898,7 @@ static int ump_handle_fb_name_msg(struct snd_ump_endpoint *ump,
 	/* notify the FB name update to sequencer, too */
 	if (ret > 0 && ump->parsed) {
 		snd_ump_update_group_attrs(ump);
+		update_legacy_names(ump);
 		seq_notify_fb_change(ump, fb);
 	}
 	return ret;
@@ -1262,6 +1268,14 @@ static void fill_substream_names(struct snd_ump_endpoint *ump,
 	}
 }
 
+static void update_legacy_names(struct snd_ump_endpoint *ump)
+{
+	struct snd_rawmidi *rmidi = ump->legacy_rmidi;
+
+	fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_INPUT);
+	fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT);
+}
+
 int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
 				  char *id, int device)
 {
@@ -1298,10 +1312,7 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
 	rmidi->ops = &snd_ump_legacy_ops;
 	rmidi->private_data = ump;
 	ump->legacy_rmidi = rmidi;
-	if (input)
-		fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_INPUT);
-	if (output)
-		fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT);
+	update_legacy_names(ump);
 
 	ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
 	return 0;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 057/114] ALSA: hda/conexant: fix Z60MR100 startup pop issue
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 056/114] ALSA: ump: Update legacy substream names upon FB info update Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 058/114] ALSA: sh: Use standard helper for buffer accesses Greg Kroah-Hartman
                   ` (67 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, bo liu, Takashi Iwai, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: bo liu <bo.liu@senarytech.com>

[ Upstream commit 947c4012f8f03a8bb946beb6e5294d5e32817d67 ]

When Z60MR100 startup, speaker will output a pop. To fix this issue,
we mute codec by init verbs in bios when system startup, and set GPIO
to low to unmute codec in codec driver when it loaded .

[ white space fixes and compile warning fix by tiwai ]

Signed-off-by: bo liu <bo.liu@senarytech.com>
Link: https://patch.msgid.link/20241129014441.437205-1-bo.liu@senarytech.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/pci/hda/patch_conexant.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 2e9f817b948e..538c37a78a56 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -307,6 +307,7 @@ enum {
 	CXT_FIXUP_HP_MIC_NO_PRESENCE,
 	CXT_PINCFG_SWS_JS201D,
 	CXT_PINCFG_TOP_SPEAKER,
+	CXT_FIXUP_HP_A_U,
 };
 
 /* for hda_fixup_thinkpad_acpi() */
@@ -774,6 +775,18 @@ static void cxt_setup_mute_led(struct hda_codec *codec,
 	}
 }
 
+static void cxt_setup_gpio_unmute(struct hda_codec *codec,
+				  unsigned int gpio_mute_mask)
+{
+	if (gpio_mute_mask) {
+		// set gpio data to 0.
+		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
+		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, gpio_mute_mask);
+		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, gpio_mute_mask);
+		snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_STICKY_MASK, 0);
+	}
+}
+
 static void cxt_fixup_mute_led_gpio(struct hda_codec *codec,
 				const struct hda_fixup *fix, int action)
 {
@@ -788,6 +801,15 @@ static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec,
 		cxt_setup_mute_led(codec, 0x10, 0x20);
 }
 
+static void cxt_fixup_hp_a_u(struct hda_codec *codec,
+			     const struct hda_fixup *fix, int action)
+{
+	// Init vers in BIOS mute the spk/hp by set gpio high to avoid pop noise,
+	// so need to unmute once by clearing the gpio data when runs into the system.
+	if (action == HDA_FIXUP_ACT_INIT)
+		cxt_setup_gpio_unmute(codec, 0x2);
+}
+
 /* ThinkPad X200 & co with cxt5051 */
 static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
 	{ 0x16, 0x042140ff }, /* HP (seq# overridden) */
@@ -998,6 +1020,10 @@ static const struct hda_fixup cxt_fixups[] = {
 			{ }
 		},
 	},
+	[CXT_FIXUP_HP_A_U] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = cxt_fixup_hp_a_u,
+	},
 };
 
 static const struct hda_quirk cxt5045_fixups[] = {
@@ -1072,6 +1098,7 @@ static const struct hda_quirk cxt5066_fixups[] = {
 	SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x103c, 0x8458, "HP Z2 G4 mini premium", CXT_FIXUP_HP_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
+	SND_PCI_QUIRK(0x14f1, 0x0252, "MBX-Z60MR100", CXT_FIXUP_HP_A_U),
 	SND_PCI_QUIRK(0x14f1, 0x0265, "SWS JS201D", CXT_PINCFG_SWS_JS201D),
 	SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
@@ -1117,6 +1144,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = {
 	{ .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" },
 	{ .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" },
 	{ .id = CXT_PINCFG_TOP_SPEAKER, .name = "sirius-top-speaker" },
+	{ .id = CXT_FIXUP_HP_A_U, .name = "HP-U-support" },
 	{}
 };
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 058/114] ALSA: sh: Use standard helper for buffer accesses
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 057/114] ALSA: hda/conexant: fix Z60MR100 startup pop issue Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 059/114] smb: server: Fix building with GCC 15 Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, kernel test robot, Takashi Iwai,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 9b5f8ee43e48c25fbe1a10163ec04343d750acd0 ]

The SH DAC audio driver uses the kmalloc'ed buffer as the main PCM
buffer, and the data is transferred via hrtimer callbacks manually
from there to the hardware.  Meanwhile, some of its code are written
as if the buffer is on iomem and use the special helpers for the iomem
(e.g. copy_from_iter_toio() or memset_io()).  Those are rather useless
and the standard helpers should be used.

Similarly, the PCM mmap callback is set to a special one with
snd_pcm_lib_mmap_iomem, but this is also nonsense, because SH
architecture doesn't support this function, hence it leads just to
NULL -- the fallback to the standard helper.

This patch replaces those special setups with the standard ones.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411281337.I4M07b7i-lkp@intel.com/
Link: https://patch.msgid.link/20241128104939.13755-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/sh/sh_dac_audio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index e7b6ce7bd086..5a9f77908a3d 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -163,7 +163,7 @@ static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream,
 	/* channel is not used (interleaved data) */
 	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
 
-	if (copy_from_iter_toio(chip->data_buffer + pos, src, count))
+	if (copy_from_iter(chip->data_buffer + pos, src, count) != count)
 		return -EFAULT;
 	chip->buffer_end = chip->data_buffer + pos + count;
 
@@ -182,7 +182,7 @@ static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream,
 	/* channel is not used (interleaved data) */
 	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
 
-	memset_io(chip->data_buffer + pos, 0, count);
+	memset(chip->data_buffer + pos, 0, count);
 	chip->buffer_end = chip->data_buffer + pos + count;
 
 	if (chip->empty) {
@@ -211,7 +211,6 @@ static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
 	.pointer	= snd_sh_dac_pcm_pointer,
 	.copy		= snd_sh_dac_pcm_copy,
 	.fill_silence	= snd_sh_dac_pcm_silence,
-	.mmap		= snd_pcm_lib_mmap_iomem,
 };
 
 static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 059/114] smb: server: Fix building with GCC 15
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 058/114] ALSA: sh: Use standard helper for buffer accesses Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 060/114] regmap: Use correct format specifier for logging range errors Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Brahmajit Das, Namjae Jeon,
	Steve French, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Brahmajit Das <brahmajit.xyz@gmail.com>

[ Upstream commit e18655cf35a5958fbf4ae9ca3ebf28871a3a1801 ]

GCC 15 introduces -Werror=unterminated-string-initialization by default,
this results in the following build error

fs/smb/server/smb_common.c:21:35: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-ini
tialization]
   21 | static const char basechars[43] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

To this we are replacing char basechars[43] with a character pointer
and then using strlen to get the length.

Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/smb/server/smb_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c
index 75b4eb856d32..af8e24163bf2 100644
--- a/fs/smb/server/smb_common.c
+++ b/fs/smb/server/smb_common.c
@@ -18,8 +18,8 @@
 #include "mgmt/share_config.h"
 
 /*for shortname implementation */
-static const char basechars[43] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
-#define MANGLE_BASE (sizeof(basechars) / sizeof(char) - 1)
+static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
+#define MANGLE_BASE (strlen(basechars) - 1)
 #define MAGIC_CHAR '~'
 #define PERIOD '.'
 #define mangle(V) ((char)(basechars[(V) % MANGLE_BASE]))
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 060/114] regmap: Use correct format specifier for logging range errors
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 059/114] smb: server: Fix building with GCC 15 Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 061/114] LoongArch: Fix reserving screen info memory for above-4G firmware Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Mark Brown, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Brown <broonie@kernel.org>

[ Upstream commit 3f1aa0c533d9dd8a835caf9a6824449c463ee7e2 ]

The register addresses are unsigned ints so we should use %u not %d to
log them.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20241127-regmap-test-high-addr-v1-1-74a48a9e0dc5@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/regmap/regmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e3e2afc2c83c..5962ea1230a1 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1063,13 +1063,13 @@ struct regmap *__regmap_init(struct device *dev,
 
 		/* Sanity check */
 		if (range_cfg->range_max < range_cfg->range_min) {
-			dev_err(map->dev, "Invalid range %d: %d < %d\n", i,
+			dev_err(map->dev, "Invalid range %d: %u < %u\n", i,
 				range_cfg->range_max, range_cfg->range_min);
 			goto err_range;
 		}
 
 		if (range_cfg->range_max > map->max_register) {
-			dev_err(map->dev, "Invalid range %d: %d > %d\n", i,
+			dev_err(map->dev, "Invalid range %d: %u > %u\n", i,
 				range_cfg->range_max, map->max_register);
 			goto err_range;
 		}
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 061/114] LoongArch: Fix reserving screen info memory for above-4G firmware
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 060/114] regmap: Use correct format specifier for logging range errors Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:42 ` [PATCH 6.12 062/114] LoongArch: BPF: Adjust the parameter of emit_jirl() Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Xuefeng Zhao, Jianmin Lv,
	Tianyang Zhang, Huacai Chen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Huacai Chen <chenhuacai@loongson.cn>

[ Upstream commit 55dc2f8f263448f1e6c7ef135d08e640d5a4826e ]

Since screen_info.lfb_base is a __u32 type, an above-4G address need an
ext_lfb_base to present its higher 32bits. In init_screen_info() we can
use __screen_info_lfb_base() to handle this case for reserving screen
info memory.

Signed-off-by: Xuefeng Zhao <zhaoxuefeng@loongson.cn>
Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn>
Signed-off-by: Tianyang Zhang <zhangtianyang@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/loongarch/kernel/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 2bf86aeda874..de21e72759ee 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -95,7 +95,7 @@ static void __init init_screen_info(void)
 	memset(si, 0, sizeof(*si));
 	early_memunmap(si, sizeof(*si));
 
-	memblock_reserve(screen_info.lfb_base, screen_info.lfb_size);
+	memblock_reserve(__screen_info_lfb_base(&screen_info), screen_info.lfb_size);
 }
 
 void __init efi_init(void)
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 062/114] LoongArch: BPF: Adjust the parameter of emit_jirl()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 061/114] LoongArch: Fix reserving screen info memory for above-4G firmware Greg Kroah-Hartman
@ 2024-12-30 15:42 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 063/114] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:42 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Huacai Chen, Tiezhu Yang,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tiezhu Yang <yangtiezhu@loongson.cn>

[ Upstream commit c1474bb0b7cff4e8481095bd0618b8f6c2f0aeb4 ]

The branch instructions beq, bne, blt, bge, bltu, bgeu and jirl belong
to the format reg2i16, but the sequence of oprand is different for the
instruction jirl. So adjust the parameter order of emit_jirl() to make
it more readable correspond with the Instruction Set Architecture manual.

Here are the instruction formats:

  beq     rj, rd, offs16
  bne     rj, rd, offs16
  blt     rj, rd, offs16
  bge     rj, rd, offs16
  bltu    rj, rd, offs16
  bgeu    rj, rd, offs16
  jirl    rd, rj, offs16

Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#branch-instructions
Suggested-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/loongarch/include/asm/inst.h | 12 +++++++++++-
 arch/loongarch/kernel/inst.c      |  2 +-
 arch/loongarch/net/bpf_jit.c      |  6 +++---
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/loongarch/include/asm/inst.h b/arch/loongarch/include/asm/inst.h
index 944482063f14..3089785ca97e 100644
--- a/arch/loongarch/include/asm/inst.h
+++ b/arch/loongarch/include/asm/inst.h
@@ -683,7 +683,17 @@ DEF_EMIT_REG2I16_FORMAT(blt, blt_op)
 DEF_EMIT_REG2I16_FORMAT(bge, bge_op)
 DEF_EMIT_REG2I16_FORMAT(bltu, bltu_op)
 DEF_EMIT_REG2I16_FORMAT(bgeu, bgeu_op)
-DEF_EMIT_REG2I16_FORMAT(jirl, jirl_op)
+
+static inline void emit_jirl(union loongarch_instruction *insn,
+			     enum loongarch_gpr rd,
+			     enum loongarch_gpr rj,
+			     int offset)
+{
+	insn->reg2i16_format.opcode = jirl_op;
+	insn->reg2i16_format.immediate = offset;
+	insn->reg2i16_format.rd = rd;
+	insn->reg2i16_format.rj = rj;
+}
 
 #define DEF_EMIT_REG2BSTRD_FORMAT(NAME, OP)				\
 static inline void emit_##NAME(union loongarch_instruction *insn,	\
diff --git a/arch/loongarch/kernel/inst.c b/arch/loongarch/kernel/inst.c
index 3050329556d1..14d7d700bcb9 100644
--- a/arch/loongarch/kernel/inst.c
+++ b/arch/loongarch/kernel/inst.c
@@ -332,7 +332,7 @@ u32 larch_insn_gen_jirl(enum loongarch_gpr rd, enum loongarch_gpr rj, int imm)
 		return INSN_BREAK;
 	}
 
-	emit_jirl(&insn, rj, rd, imm >> 2);
+	emit_jirl(&insn, rd, rj, imm >> 2);
 
 	return insn.word;
 }
diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
index dd350cba1252..ea357a3edc09 100644
--- a/arch/loongarch/net/bpf_jit.c
+++ b/arch/loongarch/net/bpf_jit.c
@@ -181,13 +181,13 @@ static void __build_epilogue(struct jit_ctx *ctx, bool is_tail_call)
 		/* Set return value */
 		emit_insn(ctx, addiw, LOONGARCH_GPR_A0, regmap[BPF_REG_0], 0);
 		/* Return to the caller */
-		emit_insn(ctx, jirl, LOONGARCH_GPR_RA, LOONGARCH_GPR_ZERO, 0);
+		emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_RA, 0);
 	} else {
 		/*
 		 * Call the next bpf prog and skip the first instruction
 		 * of TCC initialization.
 		 */
-		emit_insn(ctx, jirl, LOONGARCH_GPR_T3, LOONGARCH_GPR_ZERO, 1);
+		emit_insn(ctx, jirl, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_T3, 1);
 	}
 }
 
@@ -904,7 +904,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
 			return ret;
 
 		move_addr(ctx, t1, func_addr);
-		emit_insn(ctx, jirl, t1, LOONGARCH_GPR_RA, 0);
+		emit_insn(ctx, jirl, LOONGARCH_GPR_RA, t1, 0);
 		move_reg(ctx, regmap[BPF_REG_0], LOONGARCH_GPR_A0);
 		break;
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 063/114] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2024-12-30 15:42 ` [PATCH 6.12 062/114] LoongArch: BPF: Adjust the parameter of emit_jirl() Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 064/114] bpf: Zero index arg error string for dynptr and iter Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Pau Espin Pedrol, Armin Wolf,
	Hans de Goede, Ilpo Järvinen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Armin Wolf <W_Armin@gmx.de>

[ Upstream commit e9fba20c29e27dc99e55e1c550573a114561bf8c ]

On the Asus X541UAK an unknown event 0xCF is emited when the charger
is plugged in. This is caused by the following AML code:

    If (ACPS ())
    {
        ACPF = One
        Local0 = 0x58
        If (ATKP)
        {
            ^^^^ATKD.IANE (0xCF)
        }
    }
    Else
    {
        ACPF = Zero
        Local0 = 0x57
    }

    Notify (AC0, 0x80) // Status Change
    If (ATKP)
    {
        ^^^^ATKD.IANE (Local0)
    }

    Sleep (0x64)
    PNOT ()
    Sleep (0x0A)
    NBAT (0x80)

Ignore the 0xCF event to silence the unknown event warning.

Reported-by: Pau Espin Pedrol <pespin@espeweb.net>
Closes: https://lore.kernel.org/platform-driver-x86/54d4860b-ec9c-4992-acf6-db3f90388293@espeweb.net
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20241123224700.18530-1-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/platform/x86/asus-nb-wmi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index ef04d396f61c..a5933980ade3 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -623,6 +623,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
 	{ KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
 	{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
 	{ KE_IGNORE, 0xC6, },  /* Ambient Light Sensor notification */
+	{ KE_IGNORE, 0xCF, },	/* AC mode */
 	{ KE_KEY, 0xFA, { KEY_PROG2 } },           /* Lid flip action */
 	{ KE_KEY, 0xBD, { KEY_PROG2 } },           /* Lid flip action on ROG xflow laptops */
 	{ KE_END, 0},
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 064/114] bpf: Zero index arg error string for dynptr and iter
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 063/114] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 065/114] spi: intel: Add Panther Lake SPI controller support Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Andrii Nakryiko,
	Kumar Kartikeya Dwivedi, Alexei Starovoitov, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kumar Kartikeya Dwivedi <memxor@gmail.com>

[ Upstream commit bd74e238ae6944b462f57ce8752440a011ba4530 ]

Andrii spotted that process_dynptr_func's rejection of incorrect
argument register type will print an error string where argument numbers
are not zero-indexed, unlike elsewhere in the verifier.  Fix this by
subtracting 1 from regno. The same scenario exists for iterator
messages. Fix selftest error strings that match on the exact argument
number while we're at it to ensure clean bisection.

Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20241203002235.3776418-1-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/bpf/verifier.c                         | 12 +++++-----
 .../testing/selftests/bpf/progs/dynptr_fail.c | 22 +++++++++----------
 .../selftests/bpf/progs/iters_state_safety.c  | 14 ++++++------
 .../selftests/bpf/progs/iters_testmod_seq.c   |  4 ++--
 .../bpf/progs/test_kfunc_dynptr_param.c       |  2 +-
 .../selftests/bpf/progs/verifier_bits_iter.c  |  4 ++--
 6 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 84d958f2c031..767f1cb8c27e 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -7868,7 +7868,7 @@ static int process_dynptr_func(struct bpf_verifier_env *env, int regno, int insn
 	if (reg->type != PTR_TO_STACK && reg->type != CONST_PTR_TO_DYNPTR) {
 		verbose(env,
 			"arg#%d expected pointer to stack or const struct bpf_dynptr\n",
-			regno);
+			regno - 1);
 		return -EINVAL;
 	}
 
@@ -7922,7 +7922,7 @@ static int process_dynptr_func(struct bpf_verifier_env *env, int regno, int insn
 		if (!is_dynptr_reg_valid_init(env, reg)) {
 			verbose(env,
 				"Expected an initialized dynptr as arg #%d\n",
-				regno);
+				regno - 1);
 			return -EINVAL;
 		}
 
@@ -7930,7 +7930,7 @@ static int process_dynptr_func(struct bpf_verifier_env *env, int regno, int insn
 		if (!is_dynptr_type_expected(env, reg, arg_type & ~MEM_RDONLY)) {
 			verbose(env,
 				"Expected a dynptr of type %s as arg #%d\n",
-				dynptr_type_str(arg_to_dynptr_type(arg_type)), regno);
+				dynptr_type_str(arg_to_dynptr_type(arg_type)), regno - 1);
 			return -EINVAL;
 		}
 
@@ -7999,7 +7999,7 @@ static int process_iter_arg(struct bpf_verifier_env *env, int regno, int insn_id
 	 */
 	btf_id = btf_check_iter_arg(meta->btf, meta->func_proto, regno - 1);
 	if (btf_id < 0) {
-		verbose(env, "expected valid iter pointer as arg #%d\n", regno);
+		verbose(env, "expected valid iter pointer as arg #%d\n", regno - 1);
 		return -EINVAL;
 	}
 	t = btf_type_by_id(meta->btf, btf_id);
@@ -8009,7 +8009,7 @@ static int process_iter_arg(struct bpf_verifier_env *env, int regno, int insn_id
 		/* bpf_iter_<type>_new() expects pointer to uninit iter state */
 		if (!is_iter_reg_valid_uninit(env, reg, nr_slots)) {
 			verbose(env, "expected uninitialized iter_%s as arg #%d\n",
-				iter_type_str(meta->btf, btf_id), regno);
+				iter_type_str(meta->btf, btf_id), regno - 1);
 			return -EINVAL;
 		}
 
@@ -8033,7 +8033,7 @@ static int process_iter_arg(struct bpf_verifier_env *env, int regno, int insn_id
 			break;
 		case -EINVAL:
 			verbose(env, "expected an initialized iter_%s as arg #%d\n",
-				iter_type_str(meta->btf, btf_id), regno);
+				iter_type_str(meta->btf, btf_id), regno - 1);
 			return err;
 		case -EPROTO:
 			verbose(env, "expected an RCU CS when using %s\n", meta->func_name);
diff --git a/tools/testing/selftests/bpf/progs/dynptr_fail.c b/tools/testing/selftests/bpf/progs/dynptr_fail.c
index 8f36c9de7591..dfd817d0348c 100644
--- a/tools/testing/selftests/bpf/progs/dynptr_fail.c
+++ b/tools/testing/selftests/bpf/progs/dynptr_fail.c
@@ -149,7 +149,7 @@ int ringbuf_release_uninit_dynptr(void *ctx)
 
 /* A dynptr can't be used after it has been invalidated */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #3")
+__failure __msg("Expected an initialized dynptr as arg #2")
 int use_after_invalid(void *ctx)
 {
 	struct bpf_dynptr ptr;
@@ -428,7 +428,7 @@ int invalid_helper2(void *ctx)
 
 /* A bpf_dynptr is invalidated if it's been written into */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #1")
+__failure __msg("Expected an initialized dynptr as arg #0")
 int invalid_write1(void *ctx)
 {
 	struct bpf_dynptr ptr;
@@ -1407,7 +1407,7 @@ int invalid_slice_rdwr_rdonly(struct __sk_buff *skb)
 
 /* bpf_dynptr_adjust can only be called on initialized dynptrs */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #1")
+__failure __msg("Expected an initialized dynptr as arg #0")
 int dynptr_adjust_invalid(void *ctx)
 {
 	struct bpf_dynptr ptr = {};
@@ -1420,7 +1420,7 @@ int dynptr_adjust_invalid(void *ctx)
 
 /* bpf_dynptr_is_null can only be called on initialized dynptrs */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #1")
+__failure __msg("Expected an initialized dynptr as arg #0")
 int dynptr_is_null_invalid(void *ctx)
 {
 	struct bpf_dynptr ptr = {};
@@ -1433,7 +1433,7 @@ int dynptr_is_null_invalid(void *ctx)
 
 /* bpf_dynptr_is_rdonly can only be called on initialized dynptrs */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #1")
+__failure __msg("Expected an initialized dynptr as arg #0")
 int dynptr_is_rdonly_invalid(void *ctx)
 {
 	struct bpf_dynptr ptr = {};
@@ -1446,7 +1446,7 @@ int dynptr_is_rdonly_invalid(void *ctx)
 
 /* bpf_dynptr_size can only be called on initialized dynptrs */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #1")
+__failure __msg("Expected an initialized dynptr as arg #0")
 int dynptr_size_invalid(void *ctx)
 {
 	struct bpf_dynptr ptr = {};
@@ -1459,7 +1459,7 @@ int dynptr_size_invalid(void *ctx)
 
 /* Only initialized dynptrs can be cloned */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #1")
+__failure __msg("Expected an initialized dynptr as arg #0")
 int clone_invalid1(void *ctx)
 {
 	struct bpf_dynptr ptr1 = {};
@@ -1493,7 +1493,7 @@ int clone_invalid2(struct xdp_md *xdp)
 
 /* Invalidating a dynptr should invalidate its clones */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #3")
+__failure __msg("Expected an initialized dynptr as arg #2")
 int clone_invalidate1(void *ctx)
 {
 	struct bpf_dynptr clone;
@@ -1514,7 +1514,7 @@ int clone_invalidate1(void *ctx)
 
 /* Invalidating a dynptr should invalidate its parent */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #3")
+__failure __msg("Expected an initialized dynptr as arg #2")
 int clone_invalidate2(void *ctx)
 {
 	struct bpf_dynptr ptr;
@@ -1535,7 +1535,7 @@ int clone_invalidate2(void *ctx)
 
 /* Invalidating a dynptr should invalidate its siblings */
 SEC("?raw_tp")
-__failure __msg("Expected an initialized dynptr as arg #3")
+__failure __msg("Expected an initialized dynptr as arg #2")
 int clone_invalidate3(void *ctx)
 {
 	struct bpf_dynptr ptr;
@@ -1723,7 +1723,7 @@ __noinline long global_call_bpf_dynptr(const struct bpf_dynptr *dynptr)
 }
 
 SEC("?raw_tp")
-__failure __msg("arg#1 expected pointer to stack or const struct bpf_dynptr")
+__failure __msg("arg#0 expected pointer to stack or const struct bpf_dynptr")
 int test_dynptr_reg_type(void *ctx)
 {
 	struct task_struct *current = NULL;
diff --git a/tools/testing/selftests/bpf/progs/iters_state_safety.c b/tools/testing/selftests/bpf/progs/iters_state_safety.c
index d47e59aba6de..f41257eadbb2 100644
--- a/tools/testing/selftests/bpf/progs/iters_state_safety.c
+++ b/tools/testing/selftests/bpf/progs/iters_state_safety.c
@@ -73,7 +73,7 @@ int create_and_forget_to_destroy_fail(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected an initialized iter_num as arg #1")
+__failure __msg("expected an initialized iter_num as arg #0")
 int destroy_without_creating_fail(void *ctx)
 {
 	/* init with zeros to stop verifier complaining about uninit stack */
@@ -91,7 +91,7 @@ int destroy_without_creating_fail(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected an initialized iter_num as arg #1")
+__failure __msg("expected an initialized iter_num as arg #0")
 int compromise_iter_w_direct_write_fail(void *ctx)
 {
 	struct bpf_iter_num iter;
@@ -143,7 +143,7 @@ int compromise_iter_w_direct_write_and_skip_destroy_fail(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected an initialized iter_num as arg #1")
+__failure __msg("expected an initialized iter_num as arg #0")
 int compromise_iter_w_helper_write_fail(void *ctx)
 {
 	struct bpf_iter_num iter;
@@ -230,7 +230,7 @@ int valid_stack_reuse(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected uninitialized iter_num as arg #1")
+__failure __msg("expected uninitialized iter_num as arg #0")
 int double_create_fail(void *ctx)
 {
 	struct bpf_iter_num iter;
@@ -258,7 +258,7 @@ int double_create_fail(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected an initialized iter_num as arg #1")
+__failure __msg("expected an initialized iter_num as arg #0")
 int double_destroy_fail(void *ctx)
 {
 	struct bpf_iter_num iter;
@@ -284,7 +284,7 @@ int double_destroy_fail(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected an initialized iter_num as arg #1")
+__failure __msg("expected an initialized iter_num as arg #0")
 int next_without_new_fail(void *ctx)
 {
 	struct bpf_iter_num iter;
@@ -305,7 +305,7 @@ int next_without_new_fail(void *ctx)
 }
 
 SEC("?raw_tp")
-__failure __msg("expected an initialized iter_num as arg #1")
+__failure __msg("expected an initialized iter_num as arg #0")
 int next_after_destroy_fail(void *ctx)
 {
 	struct bpf_iter_num iter;
diff --git a/tools/testing/selftests/bpf/progs/iters_testmod_seq.c b/tools/testing/selftests/bpf/progs/iters_testmod_seq.c
index 4a176e6aede8..6543d5b6e0a9 100644
--- a/tools/testing/selftests/bpf/progs/iters_testmod_seq.c
+++ b/tools/testing/selftests/bpf/progs/iters_testmod_seq.c
@@ -79,7 +79,7 @@ int testmod_seq_truncated(const void *ctx)
 
 SEC("?raw_tp")
 __failure
-__msg("expected an initialized iter_testmod_seq as arg #2")
+__msg("expected an initialized iter_testmod_seq as arg #1")
 int testmod_seq_getter_before_bad(const void *ctx)
 {
 	struct bpf_iter_testmod_seq it;
@@ -89,7 +89,7 @@ int testmod_seq_getter_before_bad(const void *ctx)
 
 SEC("?raw_tp")
 __failure
-__msg("expected an initialized iter_testmod_seq as arg #2")
+__msg("expected an initialized iter_testmod_seq as arg #1")
 int testmod_seq_getter_after_bad(const void *ctx)
 {
 	struct bpf_iter_testmod_seq it;
diff --git a/tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param.c b/tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param.c
index e68667aec6a6..cd4d752bd089 100644
--- a/tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param.c
+++ b/tools/testing/selftests/bpf/progs/test_kfunc_dynptr_param.c
@@ -45,7 +45,7 @@ int BPF_PROG(not_valid_dynptr, int cmd, union bpf_attr *attr, unsigned int size)
 }
 
 SEC("?lsm.s/bpf")
-__failure __msg("arg#1 expected pointer to stack or const struct bpf_dynptr")
+__failure __msg("arg#0 expected pointer to stack or const struct bpf_dynptr")
 int BPF_PROG(not_ptr_to_stack, int cmd, union bpf_attr *attr, unsigned int size)
 {
 	unsigned long val = 0;
diff --git a/tools/testing/selftests/bpf/progs/verifier_bits_iter.c b/tools/testing/selftests/bpf/progs/verifier_bits_iter.c
index a7a6ae6c162f..8bcddadfc4da 100644
--- a/tools/testing/selftests/bpf/progs/verifier_bits_iter.c
+++ b/tools/testing/selftests/bpf/progs/verifier_bits_iter.c
@@ -32,7 +32,7 @@ int BPF_PROG(no_destroy, struct bpf_iter_meta *meta, struct cgroup *cgrp)
 
 SEC("iter/cgroup")
 __description("uninitialized iter in ->next()")
-__failure __msg("expected an initialized iter_bits as arg #1")
+__failure __msg("expected an initialized iter_bits as arg #0")
 int BPF_PROG(next_uninit, struct bpf_iter_meta *meta, struct cgroup *cgrp)
 {
 	struct bpf_iter_bits it = {};
@@ -43,7 +43,7 @@ int BPF_PROG(next_uninit, struct bpf_iter_meta *meta, struct cgroup *cgrp)
 
 SEC("iter/cgroup")
 __description("uninitialized iter in ->destroy()")
-__failure __msg("expected an initialized iter_bits as arg #1")
+__failure __msg("expected an initialized iter_bits as arg #0")
 int BPF_PROG(destroy_uninit, struct bpf_iter_meta *meta, struct cgroup *cgrp)
 {
 	struct bpf_iter_bits it = {};
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 065/114] spi: intel: Add Panther Lake SPI controller support
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 064/114] bpf: Zero index arg error string for dynptr and iter Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 066/114] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Aapo Vienamo, Mika Westerberg,
	Mark Brown, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Aapo Vienamo <aapo.vienamo@iki.fi>

[ Upstream commit ceb259e43bf572ba7d766e1679ba73861d16203a ]

The Panther Lake SPI controllers are compatible with the Cannon Lake
controllers. Add support for following SPI controller device IDs:
 - H-series: 0xe323
 - P-series: 0xe423
 - U-series: 0xe423

Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://patch.msgid.link/20241204080208.1036537-1-mika.westerberg@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-intel-pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-intel-pci.c b/drivers/spi/spi-intel-pci.c
index 4337ca51d7aa..5c0dec90eec1 100644
--- a/drivers/spi/spi-intel-pci.c
+++ b/drivers/spi/spi-intel-pci.c
@@ -86,6 +86,8 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
 	{ PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info },
 	{ PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info },
 	{ PCI_VDEVICE(INTEL, 0xa823), (unsigned long)&cnl_info },
+	{ PCI_VDEVICE(INTEL, 0xe323), (unsigned long)&cnl_info },
+	{ PCI_VDEVICE(INTEL, 0xe423), (unsigned long)&cnl_info },
 	{ },
 };
 MODULE_DEVICE_TABLE(pci, intel_spi_pci_ids);
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 066/114] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 065/114] spi: intel: Add Panther Lake SPI controller support Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 067/114] scsi: mpi3mr: Synchronize access to ioctl data buffer Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Ranjan Kumar, Martin K. Petersen,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ranjan Kumar <ranjan.kumar@broadcom.com>

[ Upstream commit 3f5eb062e8aa335643181c480e6c590c6cedfd22 ]

Issue a Diag-Reset when the "Doorbell-In-Use" bit is set during the
driver load/initialization.

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20241110173341.11595-2-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index ed5046593fda..16ac2267c71e 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -7041,11 +7041,12 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
 	int i;
 	u8 failed;
 	__le32 *mfp;
+	int ret_val;
 
 	/* make sure doorbell is not in use */
 	if ((ioc->base_readl_ext_retry(&ioc->chip->Doorbell) & MPI2_DOORBELL_USED)) {
 		ioc_err(ioc, "doorbell is in use (line=%d)\n", __LINE__);
-		return -EFAULT;
+		goto doorbell_diag_reset;
 	}
 
 	/* clear pending doorbell interrupts from previous state changes */
@@ -7135,6 +7136,10 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,
 			    le32_to_cpu(mfp[i]));
 	}
 	return 0;
+
+doorbell_diag_reset:
+	ret_val = _base_diag_reset(ioc);
+	return ret_val;
 }
 
 /**
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 067/114] scsi: mpi3mr: Synchronize access to ioctl data buffer
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 066/114] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 068/114] scsi: mpi3mr: Fix corrupt config pages PHY state is switched in sysfs Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Sumit Saxena, Ranjan Kumar,
	Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ranjan Kumar <ranjan.kumar@broadcom.com>

[ Upstream commit 367ac16e5ff2dcd6b7f00a8f94e6ba98875cb397 ]

The driver serializes ioctls through a mutex lock but access to the
ioctl data buffer is not guarded by the mutex. This results in multiple
user threads being able to write to the driver's ioctl buffer
simultaneously.

Protect the ioctl buffer with the ioctl mutex.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20241110194405.10108-2-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/mpi3mr/mpi3mr_app.c | 36 ++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c
index 01f035f9330e..10b8e4dc64f8 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_app.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_app.c
@@ -2329,6 +2329,15 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 	if (!mrioc)
 		return -ENODEV;
 
+	if (mutex_lock_interruptible(&mrioc->bsg_cmds.mutex))
+		return -ERESTARTSYS;
+
+	if (mrioc->bsg_cmds.state & MPI3MR_CMD_PENDING) {
+		dprint_bsg_err(mrioc, "%s: command is in use\n", __func__);
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
+		return -EAGAIN;
+	}
+
 	if (!mrioc->ioctl_sges_allocated) {
 		dprint_bsg_err(mrioc, "%s: DMA memory was not allocated\n",
 			       __func__);
@@ -2339,13 +2348,16 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		karg->timeout = MPI3MR_APP_DEFAULT_TIMEOUT;
 
 	mpi_req = kzalloc(MPI3MR_ADMIN_REQ_FRAME_SZ, GFP_KERNEL);
-	if (!mpi_req)
+	if (!mpi_req) {
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		return -ENOMEM;
+	}
 	mpi_header = (struct mpi3_request_header *)mpi_req;
 
 	bufcnt = karg->buf_entry_list.num_of_entries;
 	drv_bufs = kzalloc((sizeof(*drv_bufs) * bufcnt), GFP_KERNEL);
 	if (!drv_bufs) {
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		rval = -ENOMEM;
 		goto out;
 	}
@@ -2353,6 +2365,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 	dout_buf = kzalloc(job->request_payload.payload_len,
 				      GFP_KERNEL);
 	if (!dout_buf) {
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		rval = -ENOMEM;
 		goto out;
 	}
@@ -2360,6 +2373,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 	din_buf = kzalloc(job->reply_payload.payload_len,
 				     GFP_KERNEL);
 	if (!din_buf) {
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		rval = -ENOMEM;
 		goto out;
 	}
@@ -2435,6 +2449,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 					(mpi_msg_size > MPI3MR_ADMIN_REQ_FRAME_SZ)) {
 				dprint_bsg_err(mrioc, "%s: invalid MPI message size\n",
 					__func__);
+				mutex_unlock(&mrioc->bsg_cmds.mutex);
 				rval = -EINVAL;
 				goto out;
 			}
@@ -2447,6 +2462,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		if (invalid_be) {
 			dprint_bsg_err(mrioc, "%s: invalid buffer entries passed\n",
 				__func__);
+			mutex_unlock(&mrioc->bsg_cmds.mutex);
 			rval = -EINVAL;
 			goto out;
 		}
@@ -2454,12 +2470,14 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		if (sgl_dout_iter > (dout_buf + job->request_payload.payload_len)) {
 			dprint_bsg_err(mrioc, "%s: data_out buffer length mismatch\n",
 				       __func__);
+			mutex_unlock(&mrioc->bsg_cmds.mutex);
 			rval = -EINVAL;
 			goto out;
 		}
 		if (sgl_din_iter > (din_buf + job->reply_payload.payload_len)) {
 			dprint_bsg_err(mrioc, "%s: data_in buffer length mismatch\n",
 				       __func__);
+			mutex_unlock(&mrioc->bsg_cmds.mutex);
 			rval = -EINVAL;
 			goto out;
 		}
@@ -2472,6 +2490,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		dprint_bsg_err(mrioc, "%s:%d: invalid data transfer size passed for function 0x%x din_size = %d, dout_size = %d\n",
 			       __func__, __LINE__, mpi_header->function, din_size,
 			       dout_size);
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		rval = -EINVAL;
 		goto out;
 	}
@@ -2480,6 +2499,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		dprint_bsg_err(mrioc,
 		    "%s:%d: invalid data transfer size passed for function 0x%x din_size=%d\n",
 		    __func__, __LINE__, mpi_header->function, din_size);
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		rval = -EINVAL;
 		goto out;
 	}
@@ -2487,6 +2507,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		dprint_bsg_err(mrioc,
 		    "%s:%d: invalid data transfer size passed for function 0x%x dout_size = %d\n",
 		    __func__, __LINE__, mpi_header->function, dout_size);
+		mutex_unlock(&mrioc->bsg_cmds.mutex);
 		rval = -EINVAL;
 		goto out;
 	}
@@ -2497,6 +2518,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 			dprint_bsg_err(mrioc, "%s:%d: invalid message size passed:%d:%d:%d:%d\n",
 				       __func__, __LINE__, din_cnt, dout_cnt, din_size,
 			    dout_size);
+			mutex_unlock(&mrioc->bsg_cmds.mutex);
 			rval = -EINVAL;
 			goto out;
 		}
@@ -2544,6 +2566,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 				continue;
 			if (mpi3mr_map_data_buffer_dma(mrioc, drv_buf_iter, desc_count)) {
 				rval = -ENOMEM;
+				mutex_unlock(&mrioc->bsg_cmds.mutex);
 				dprint_bsg_err(mrioc, "%s:%d: mapping data buffers failed\n",
 					       __func__, __LINE__);
 			goto out;
@@ -2556,20 +2579,11 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 		sense_buff_k = kzalloc(erbsz, GFP_KERNEL);
 		if (!sense_buff_k) {
 			rval = -ENOMEM;
+			mutex_unlock(&mrioc->bsg_cmds.mutex);
 			goto out;
 		}
 	}
 
-	if (mutex_lock_interruptible(&mrioc->bsg_cmds.mutex)) {
-		rval = -ERESTARTSYS;
-		goto out;
-	}
-	if (mrioc->bsg_cmds.state & MPI3MR_CMD_PENDING) {
-		rval = -EAGAIN;
-		dprint_bsg_err(mrioc, "%s: command is in use\n", __func__);
-		mutex_unlock(&mrioc->bsg_cmds.mutex);
-		goto out;
-	}
 	if (mrioc->unrecoverable) {
 		dprint_bsg_err(mrioc, "%s: unrecoverable controller\n",
 		    __func__);
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 068/114] scsi: mpi3mr: Fix corrupt config pages PHY state is switched in sysfs
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (66 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 067/114] scsi: mpi3mr: Synchronize access to ioctl data buffer Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 069/114] scsi: mpi3mr: Start controller indexing from 0 Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Prayas Patel, Ranjan Kumar,
	Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ranjan Kumar <ranjan.kumar@broadcom.com>

[ Upstream commit 711201a8b8334a397440ac0b859df0054e174bc9 ]

The driver, through the SAS transport, exposes a sysfs interface to
enable/disable PHYs in a controller/expander setup.  When multiple PHYs
are disabled and enabled in rapid succession, the persistent and current
config pages related to SAS IO unit/SAS Expander pages could get
corrupted.

Use separate memory for each config request.

Signed-off-by: Prayas Patel <prayas.patel@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20241110194405.10108-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/mpi3mr/mpi3mr.h    |  9 ----
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 81 ++++++---------------------------
 2 files changed, 13 insertions(+), 77 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h
index 81bb408ce56d..1e715fd65a7d 100644
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -134,8 +134,6 @@ extern atomic64_t event_counter;
 
 #define MPI3MR_WATCHDOG_INTERVAL		1000 /* in milli seconds */
 
-#define MPI3MR_DEFAULT_CFG_PAGE_SZ		1024 /* in bytes */
-
 #define MPI3MR_RESET_TOPOLOGY_SETTLE_TIME	10
 
 #define MPI3MR_SCMD_TIMEOUT    (60 * HZ)
@@ -1133,9 +1131,6 @@ struct scmd_priv {
  * @io_throttle_low: I/O size to stop throttle in 512b blocks
  * @num_io_throttle_group: Maximum number of throttle groups
  * @throttle_groups: Pointer to throttle group info structures
- * @cfg_page: Default memory for configuration pages
- * @cfg_page_dma: Configuration page DMA address
- * @cfg_page_sz: Default configuration page memory size
  * @sas_transport_enabled: SAS transport enabled or not
  * @scsi_device_channel: Channel ID for SCSI devices
  * @transport_cmds: Command tracker for SAS transport commands
@@ -1332,10 +1327,6 @@ struct mpi3mr_ioc {
 	u16 num_io_throttle_group;
 	struct mpi3mr_throttle_group_info *throttle_groups;
 
-	void *cfg_page;
-	dma_addr_t cfg_page_dma;
-	u16 cfg_page_sz;
-
 	u8 sas_transport_enabled;
 	u8 scsi_device_channel;
 	struct mpi3mr_drv_cmd transport_cmds;
diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index f1ab76351bd8..2e6245bd4282 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -4186,17 +4186,6 @@ int mpi3mr_init_ioc(struct mpi3mr_ioc *mrioc)
 	mpi3mr_read_tsu_interval(mrioc);
 	mpi3mr_print_ioc_info(mrioc);
 
-	if (!mrioc->cfg_page) {
-		dprint_init(mrioc, "allocating config page buffers\n");
-		mrioc->cfg_page_sz = MPI3MR_DEFAULT_CFG_PAGE_SZ;
-		mrioc->cfg_page = dma_alloc_coherent(&mrioc->pdev->dev,
-		    mrioc->cfg_page_sz, &mrioc->cfg_page_dma, GFP_KERNEL);
-		if (!mrioc->cfg_page) {
-			retval = -1;
-			goto out_failed_noretry;
-		}
-	}
-
 	dprint_init(mrioc, "allocating host diag buffers\n");
 	mpi3mr_alloc_diag_bufs(mrioc);
 
@@ -4768,11 +4757,7 @@ void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc)
 		    mrioc->admin_req_base, mrioc->admin_req_dma);
 		mrioc->admin_req_base = NULL;
 	}
-	if (mrioc->cfg_page) {
-		dma_free_coherent(&mrioc->pdev->dev, mrioc->cfg_page_sz,
-		    mrioc->cfg_page, mrioc->cfg_page_dma);
-		mrioc->cfg_page = NULL;
-	}
+
 	if (mrioc->pel_seqnum_virt) {
 		dma_free_coherent(&mrioc->pdev->dev, mrioc->pel_seqnum_sz,
 		    mrioc->pel_seqnum_virt, mrioc->pel_seqnum_dma);
@@ -5392,55 +5377,6 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,
 	return retval;
 }
 
-
-/**
- * mpi3mr_free_config_dma_memory - free memory for config page
- * @mrioc: Adapter instance reference
- * @mem_desc: memory descriptor structure
- *
- * Check whether the size of the buffer specified by the memory
- * descriptor is greater than the default page size if so then
- * free the memory pointed by the descriptor.
- *
- * Return: Nothing.
- */
-static void mpi3mr_free_config_dma_memory(struct mpi3mr_ioc *mrioc,
-	struct dma_memory_desc *mem_desc)
-{
-	if ((mem_desc->size > mrioc->cfg_page_sz) && mem_desc->addr) {
-		dma_free_coherent(&mrioc->pdev->dev, mem_desc->size,
-		    mem_desc->addr, mem_desc->dma_addr);
-		mem_desc->addr = NULL;
-	}
-}
-
-/**
- * mpi3mr_alloc_config_dma_memory - Alloc memory for config page
- * @mrioc: Adapter instance reference
- * @mem_desc: Memory descriptor to hold dma memory info
- *
- * This function allocates new dmaable memory or provides the
- * default config page dmaable memory based on the memory size
- * described by the descriptor.
- *
- * Return: 0 on success, non-zero on failure.
- */
-static int mpi3mr_alloc_config_dma_memory(struct mpi3mr_ioc *mrioc,
-	struct dma_memory_desc *mem_desc)
-{
-	if (mem_desc->size > mrioc->cfg_page_sz) {
-		mem_desc->addr = dma_alloc_coherent(&mrioc->pdev->dev,
-		    mem_desc->size, &mem_desc->dma_addr, GFP_KERNEL);
-		if (!mem_desc->addr)
-			return -ENOMEM;
-	} else {
-		mem_desc->addr = mrioc->cfg_page;
-		mem_desc->dma_addr = mrioc->cfg_page_dma;
-		memset(mem_desc->addr, 0, mrioc->cfg_page_sz);
-	}
-	return 0;
-}
-
 /**
  * mpi3mr_post_cfg_req - Issue config requests and wait
  * @mrioc: Adapter instance reference
@@ -5596,8 +5532,12 @@ static int mpi3mr_process_cfg_req(struct mpi3mr_ioc *mrioc,
 		cfg_req->page_length = cfg_hdr->page_length;
 		cfg_req->page_version = cfg_hdr->page_version;
 	}
-	if (mpi3mr_alloc_config_dma_memory(mrioc, &mem_desc))
-		goto out;
+
+	mem_desc.addr = dma_alloc_coherent(&mrioc->pdev->dev,
+		mem_desc.size, &mem_desc.dma_addr, GFP_KERNEL);
+
+	if (!mem_desc.addr)
+		return retval;
 
 	mpi3mr_add_sg_single(&cfg_req->sgl, sgl_flags, mem_desc.size,
 	    mem_desc.dma_addr);
@@ -5626,7 +5566,12 @@ static int mpi3mr_process_cfg_req(struct mpi3mr_ioc *mrioc,
 	}
 
 out:
-	mpi3mr_free_config_dma_memory(mrioc, &mem_desc);
+	if (mem_desc.addr) {
+		dma_free_coherent(&mrioc->pdev->dev, mem_desc.size,
+			mem_desc.addr, mem_desc.dma_addr);
+		mem_desc.addr = NULL;
+	}
+
 	return retval;
 }
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 069/114] scsi: mpi3mr: Start controller indexing from 0
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (67 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 068/114] scsi: mpi3mr: Fix corrupt config pages PHY state is switched in sysfs Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 070/114] scsi: mpi3mr: Handling of fault code for insufficient power Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Sumit Saxena, Ranjan Kumar,
	Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ranjan Kumar <ranjan.kumar@broadcom.com>

[ Upstream commit 0d32014f1e3e7a7adf1583c45387f26b9bb3a49d ]

Instead of displaying the controller index starting from '1' make the
driver display the controller index starting from '0'.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20241110194405.10108-4-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 5f2f67acf8bf..1bef88130d0c 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -5215,7 +5215,7 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 
 	mrioc = shost_priv(shost);
-	retval = ida_alloc_range(&mrioc_ida, 1, U8_MAX, GFP_KERNEL);
+	retval = ida_alloc_range(&mrioc_ida, 0, U8_MAX, GFP_KERNEL);
 	if (retval < 0)
 		goto id_alloc_failed;
 	mrioc->id = (u8)retval;
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 070/114] scsi: mpi3mr: Handling of fault code for insufficient power
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (68 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 069/114] scsi: mpi3mr: Start controller indexing from 0 Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 071/114] scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Prayas Patel, Ranjan Kumar,
	Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ranjan Kumar <ranjan.kumar@broadcom.com>

[ Upstream commit fb6eb98f3965e2ee92cbcb466051d2f2acf552d1 ]

Before retrying initialization, check and abort if the fault code
indicates insufficient power. Also mark the controller as unrecoverable
instead of issuing reset in the watch dog timer if the fault code
indicates insufficient power.

Signed-off-by: Prayas Patel <prayas.patel@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20241110194405.10108-5-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 40 +++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 2e6245bd4282..5ed31fe57474 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -1035,6 +1035,36 @@ static const char *mpi3mr_reset_type_name(u16 reset_type)
 	return name;
 }
 
+/**
+ * mpi3mr_is_fault_recoverable - Read fault code and decide
+ * whether the controller can be recoverable
+ * @mrioc: Adapter instance reference
+ * Return: true if fault is recoverable, false otherwise.
+ */
+static inline bool mpi3mr_is_fault_recoverable(struct mpi3mr_ioc *mrioc)
+{
+	u32 fault;
+
+	fault = (readl(&mrioc->sysif_regs->fault) &
+		      MPI3_SYSIF_FAULT_CODE_MASK);
+
+	switch (fault) {
+	case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED:
+	case MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED:
+		ioc_warn(mrioc,
+		    "controller requires system power cycle, marking controller as unrecoverable\n");
+		return false;
+	case MPI3_SYSIF_FAULT_CODE_INSUFFICIENT_PCI_SLOT_POWER:
+		ioc_warn(mrioc,
+		    "controller faulted due to insufficient power,\n"
+		    " try by connecting it to a different slot\n");
+		return false;
+	default:
+		break;
+	}
+	return true;
+}
+
 /**
  * mpi3mr_print_fault_info - Display fault information
  * @mrioc: Adapter instance reference
@@ -1373,6 +1403,11 @@ static int mpi3mr_bring_ioc_ready(struct mpi3mr_ioc *mrioc)
 	ioc_info(mrioc, "ioc_status(0x%08x), ioc_config(0x%08x), ioc_info(0x%016llx) at the bringup\n",
 	    ioc_status, ioc_config, base_info);
 
+	if (!mpi3mr_is_fault_recoverable(mrioc)) {
+		mrioc->unrecoverable = 1;
+		goto out_device_not_present;
+	}
+
 	/*The timeout value is in 2sec unit, changing it to seconds*/
 	mrioc->ready_timeout =
 	    ((base_info & MPI3_SYSIF_IOC_INFO_LOW_TIMEOUT_MASK) >>
@@ -2734,6 +2769,11 @@ static void mpi3mr_watchdog_work(struct work_struct *work)
 	mpi3mr_print_fault_info(mrioc);
 	mrioc->diagsave_timeout = 0;
 
+	if (!mpi3mr_is_fault_recoverable(mrioc)) {
+		mrioc->unrecoverable = 1;
+		goto schedule_work;
+	}
+
 	switch (trigger_data.fault) {
 	case MPI3_SYSIF_FAULT_CODE_COMPLETE_RESET_NEEDED:
 	case MPI3_SYSIF_FAULT_CODE_POWER_CYCLE_REQUIRED:
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 071/114] scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (69 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 070/114] scsi: mpi3mr: Handling of fault code for insufficient power Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 072/114] ACPI/IORT: Add PMCG platform information for HiSilicon HIP09A Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Michael Kelley, Cathy Avery,
	Ewan D. Milne, Martin K. Petersen, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Cathy Avery <cavery@redhat.com>

[ Upstream commit b1aee7f034615b6824d2c70ddb37ef9fc23493b7 ]

This partially reverts commit 812fe6420a6e ("scsi: storvsc: Handle
additional SRB status values").

HyperV does not support MAINTENANCE_IN resulting in FC passthrough
returning the SRB_STATUS_DATA_OVERRUN value. Now that
SRB_STATUS_DATA_OVERRUN is treated as an error, multipath ALUA paths go
into a faulty state as multipath ALUA submits RTPG commands via
MAINTENANCE_IN.

[    3.215560] hv_storvsc 1d69d403-9692-4460-89f9-a8cbcc0f94f3:
tag#230 cmd 0xa3 status: scsi 0x0 srb 0x12 hv 0xc0000001
[    3.215572] scsi 1:0:0:32: alua: rtpg failed, result 458752

Make MAINTENANCE_IN return success to avoid the error path as is
currently done with INQUIRY and MODE_SENSE.

Suggested-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Cathy Avery <cavery@redhat.com>
Link: https://lore.kernel.org/r/20241127181324.3318443-1-cavery@redhat.com
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/storvsc_drv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 7ceb982040a5..d0b55c1fa908 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -149,6 +149,8 @@ struct hv_fc_wwn_packet {
 */
 static int vmstor_proto_version;
 
+static bool hv_dev_is_fc(struct hv_device *hv_dev);
+
 #define STORVSC_LOGGING_NONE	0
 #define STORVSC_LOGGING_ERROR	1
 #define STORVSC_LOGGING_WARN	2
@@ -1138,6 +1140,7 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,
 	 * not correctly handle:
 	 * INQUIRY command with page code parameter set to 0x80
 	 * MODE_SENSE command with cmd[2] == 0x1c
+	 * MAINTENANCE_IN is not supported by HyperV FC passthrough
 	 *
 	 * Setup srb and scsi status so this won't be fatal.
 	 * We do this so we can distinguish truly fatal failues
@@ -1145,7 +1148,9 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,
 	 */
 
 	if ((stor_pkt->vm_srb.cdb[0] == INQUIRY) ||
-	   (stor_pkt->vm_srb.cdb[0] == MODE_SENSE)) {
+	   (stor_pkt->vm_srb.cdb[0] == MODE_SENSE) ||
+	   (stor_pkt->vm_srb.cdb[0] == MAINTENANCE_IN &&
+	   hv_dev_is_fc(device))) {
 		vstor_packet->vm_srb.scsi_status = 0;
 		vstor_packet->vm_srb.srb_status = SRB_STATUS_SUCCESS;
 	}
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 072/114] ACPI/IORT: Add PMCG platform information for HiSilicon HIP09A
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (70 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 071/114] scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 073/114] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled() Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Yicong Yang, Hanjun Guo, Qinxin Xia,
	Catalin Marinas, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Qinxin Xia <xiaqinxin@huawei.com>

[ Upstream commit c2b46ae022704a2d845e59461fa24431ad627022 ]

HiSilicon HIP09A platforms using the same SMMU PMCG with HIP09
and thus suffers the same erratum. List them in the PMCG platform
information list without introducing a new SMMU PMCG Model.

Update the silicon-errata.rst as well.

Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>
Acked-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com>
Link: https://lore.kernel.org/r/20241205013331.1484017-1-xiaqinxin@huawei.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 Documentation/arch/arm64/silicon-errata.rst | 5 +++--
 drivers/acpi/arm64/iort.c                   | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst
index 77db10e944f0..b42fea07c5ce 100644
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -255,8 +255,9 @@ stable kernels.
 +----------------+-----------------+-----------------+-----------------------------+
 | Hisilicon      | Hip08 SMMU PMCG | #162001800      | N/A                         |
 +----------------+-----------------+-----------------+-----------------------------+
-| Hisilicon      | Hip{08,09,10,10C| #162001900      | N/A                         |
-|                | ,11} SMMU PMCG  |                 |                             |
+| Hisilicon      | Hip{08,09,09A,10| #162001900      | N/A                         |
+|                | ,10C,11}        |                 |                             |
+|                | SMMU PMCG       |                 |                             |
 +----------------+-----------------+-----------------+-----------------------------+
 | Hisilicon      | Hip09           | #162100801      | HISILICON_ERRATUM_162100801 |
 +----------------+-----------------+-----------------+-----------------------------+
diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index 4c745a26226b..bf3be532e089 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1703,6 +1703,8 @@ static struct acpi_platform_list pmcg_plat_info[] __initdata = {
 	/* HiSilicon Hip09 Platform */
 	{"HISI  ", "HIP09   ", 0, ACPI_SIG_IORT, greater_than_or_equal,
 	 "Erratum #162001900", IORT_SMMU_V3_PMCG_HISI_HIP09},
+	{"HISI  ", "HIP09A  ", 0, ACPI_SIG_IORT, greater_than_or_equal,
+	 "Erratum #162001900", IORT_SMMU_V3_PMCG_HISI_HIP09},
 	/* HiSilicon Hip10/11 Platform uses the same SMMU IP with Hip09 */
 	{"HISI  ", "HIP10   ", 0, ACPI_SIG_IORT, greater_than_or_equal,
 	 "Erratum #162001900", IORT_SMMU_V3_PMCG_HISI_HIP09},
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 073/114] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (71 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 072/114] ACPI/IORT: Add PMCG platform information for HiSilicon HIP09A Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 074/114] drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req() Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Purushothama Siddaiah, Corey Minyard,
	Mark Brown, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Purushothama Siddaiah <psiddaiah@mvista.com>

[ Upstream commit 4c6ac5446d060f0bf435ccc8bc3aa7b7b5f718ad ]

The devm_clk_get_optional_enabled() function returns error
pointers(PTR_ERR()). So use IS_ERR() to check it.

Verified on K3-J7200 EVM board, without clock node mentioned
in the device tree.

Signed-off-by: Purushothama Siddaiah <psiddaiah@mvista.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Link: https://patch.msgid.link/20241205070426.1861048-1-psiddaiah@mvista.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-omap2-mcspi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 2c043817c66a..4a2f84c4d22e 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1561,10 +1561,10 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
 	}
 
 	mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
-	if (mcspi->ref_clk)
-		mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
-	else
+	if (IS_ERR(mcspi->ref_clk))
 		mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ;
+	else
+		mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk);
 	ctlr->max_speed_hz = mcspi->ref_clk_hz;
 	ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15;
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 074/114] drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (72 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 073/114] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled() Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 075/114] virtio-blk: dont keep queue frozen during system suspend Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Lyude Paul, Imre Deak, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Imre Deak <imre.deak@intel.com>

[ Upstream commit e54b00086f7473dbda1a7d6fc47720ced157c6a8 ]

While receiving an MST up request message from one thread in
drm_dp_mst_handle_up_req(), the MST topology could be removed from
another thread via drm_dp_mst_topology_mgr_set_mst(false), freeing
mst_primary and setting drm_dp_mst_topology_mgr::mst_primary to NULL.
This could lead to a NULL deref/use-after-free of mst_primary in
drm_dp_mst_handle_up_req().

Avoid the above by holding a reference for mst_primary in
drm_dp_mst_handle_up_req() while it's used.

v2: Fix kfreeing the request if getting an mst_primary reference fails.

Cc: Lyude Paul <lyude@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com> (v1)
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241204132007.3132494-1-imre.deak@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/display/drm_dp_mst_topology.c | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
index bcf3a33123be..f0c6d50d8c33 100644
--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
@@ -4108,9 +4108,10 @@ static void drm_dp_mst_up_req_work(struct work_struct *work)
 static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 {
 	struct drm_dp_pending_up_req *up_req;
+	struct drm_dp_mst_branch *mst_primary;
 
 	if (!drm_dp_get_one_sb_msg(mgr, true, NULL))
-		goto out;
+		goto out_clear_reply;
 
 	if (!mgr->up_req_recv.have_eomt)
 		return 0;
@@ -4128,10 +4129,19 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 		drm_dbg_kms(mgr->dev, "Received unknown up req type, ignoring: %x\n",
 			    up_req->msg.req_type);
 		kfree(up_req);
-		goto out;
+		goto out_clear_reply;
+	}
+
+	mutex_lock(&mgr->lock);
+	mst_primary = mgr->mst_primary;
+	if (!mst_primary || !drm_dp_mst_topology_try_get_mstb(mst_primary)) {
+		mutex_unlock(&mgr->lock);
+		kfree(up_req);
+		goto out_clear_reply;
 	}
+	mutex_unlock(&mgr->lock);
 
-	drm_dp_send_up_ack_reply(mgr, mgr->mst_primary, up_req->msg.req_type,
+	drm_dp_send_up_ack_reply(mgr, mst_primary, up_req->msg.req_type,
 				 false);
 
 	if (up_req->msg.req_type == DP_CONNECTION_STATUS_NOTIFY) {
@@ -4148,13 +4158,13 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 			    conn_stat->peer_device_type);
 
 		mutex_lock(&mgr->probe_lock);
-		handle_csn = mgr->mst_primary->link_address_sent;
+		handle_csn = mst_primary->link_address_sent;
 		mutex_unlock(&mgr->probe_lock);
 
 		if (!handle_csn) {
 			drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it.");
 			kfree(up_req);
-			goto out;
+			goto out_put_primary;
 		}
 	} else if (up_req->msg.req_type == DP_RESOURCE_STATUS_NOTIFY) {
 		const struct drm_dp_resource_status_notify *res_stat =
@@ -4171,7 +4181,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
 	mutex_unlock(&mgr->up_req_lock);
 	queue_work(system_long_wq, &mgr->up_req_work);
 
-out:
+out_put_primary:
+	drm_dp_mst_topology_put_mstb(mst_primary);
+out_clear_reply:
 	memset(&mgr->up_req_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
 	return 0;
 }
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 075/114] virtio-blk: dont keep queue frozen during system suspend
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (73 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 074/114] drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req() Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 076/114] blk-mq: register cpuhp callback after hctx is added to xarray table Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Yi Sun, Michael S. Tsirkin,
	Jason Wang, Stefan Hajnoczi, virtualization, Marek Szyprowski,
	Ming Lei, Jens Axboe, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ming Lei <ming.lei@redhat.com>

[ Upstream commit 7678abee0867e6b7fb89aa40f6e9f575f755fb37 ]

Commit 4ce6e2db00de ("virtio-blk: Ensure no requests in virtqueues before
deleting vqs.") replaces queue quiesce with queue freeze in virtio-blk's
PM callbacks. And the motivation is to drain inflight IOs before suspending.

block layer's queue freeze looks very handy, but it is also easy to cause
deadlock, such as, any attempt to call into bio_queue_enter() may run into
deadlock if the queue is frozen in current context. There are all kinds
of ->suspend() called in suspend context, so keeping queue frozen in the
whole suspend context isn't one good idea. And Marek reported lockdep
warning[1] caused by virtio-blk's freeze queue in virtblk_freeze().

[1] https://lore.kernel.org/linux-block/ca16370e-d646-4eee-b9cc-87277c89c43c@samsung.com/

Given the motivation is to drain in-flight IOs, it can be done by calling
freeze & unfreeze, meantime restore to previous behavior by keeping queue
quiesced during suspend.

Cc: Yi Sun <yi.sun@unisoc.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: virtualization@lists.linux.dev
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Link: https://lore.kernel.org/r/20241112125821.1475793-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/virtio_blk.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 43c96b73a711..0e50b65e1dbf 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1587,9 +1587,12 @@ static void virtblk_remove(struct virtio_device *vdev)
 static int virtblk_freeze(struct virtio_device *vdev)
 {
 	struct virtio_blk *vblk = vdev->priv;
+	struct request_queue *q = vblk->disk->queue;
 
 	/* Ensure no requests in virtqueues before deleting vqs. */
-	blk_mq_freeze_queue(vblk->disk->queue);
+	blk_mq_freeze_queue(q);
+	blk_mq_quiesce_queue_nowait(q);
+	blk_mq_unfreeze_queue(q);
 
 	/* Ensure we don't receive any more interrupts */
 	virtio_reset_device(vdev);
@@ -1613,8 +1616,8 @@ static int virtblk_restore(struct virtio_device *vdev)
 		return ret;
 
 	virtio_device_ready(vdev);
+	blk_mq_unquiesce_queue(vblk->disk->queue);
 
-	blk_mq_unfreeze_queue(vblk->disk->queue);
 	return 0;
 }
 #endif
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 076/114] blk-mq: register cpuhp callback after hctx is added to xarray table
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (74 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 075/114] virtio-blk: dont keep queue frozen during system suspend Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 077/114] wifi: iwlwifi: be less noisy if the NIC is dead in S3 Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Reinette Chatre, Fenghua Yu,
	Peter Newman, Babu Moger, Luck Tony, Ming Lei, Jens Axboe,
	Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ming Lei <ming.lei@redhat.com>

[ Upstream commit 4bf485a7db5d82ddd0f3ad2b299893199090375e ]

We need to retrieve 'hctx' from xarray table in the cpuhp callback, so the
callback should be registered after this 'hctx' is added to xarray table.

Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Newman <peternewman@google.com>
Cc: Babu Moger <babu.moger@amd.com>
Cc: Luck Tony <tony.luck@intel.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20241206111611.978870-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 block/blk-mq.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index d5995021815d..4e76651e786d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3903,16 +3903,11 @@ static int blk_mq_init_hctx(struct request_queue *q,
 {
 	hctx->queue_num = hctx_idx;
 
-	if (!(hctx->flags & BLK_MQ_F_STACKING))
-		cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE,
-				&hctx->cpuhp_online);
-	cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead);
-
 	hctx->tags = set->tags[hctx_idx];
 
 	if (set->ops->init_hctx &&
 	    set->ops->init_hctx(hctx, set->driver_data, hctx_idx))
-		goto unregister_cpu_notifier;
+		goto fail;
 
 	if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx,
 				hctx->numa_node))
@@ -3921,6 +3916,11 @@ static int blk_mq_init_hctx(struct request_queue *q,
 	if (xa_insert(&q->hctx_table, hctx_idx, hctx, GFP_KERNEL))
 		goto exit_flush_rq;
 
+	if (!(hctx->flags & BLK_MQ_F_STACKING))
+		cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE,
+				&hctx->cpuhp_online);
+	cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead);
+
 	return 0;
 
  exit_flush_rq:
@@ -3929,8 +3929,7 @@ static int blk_mq_init_hctx(struct request_queue *q,
  exit_hctx:
 	if (set->ops->exit_hctx)
 		set->ops->exit_hctx(hctx, hctx_idx);
- unregister_cpu_notifier:
-	blk_mq_remove_cpuhp(hctx);
+ fail:
 	return -1;
 }
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 077/114] wifi: iwlwifi: be less noisy if the NIC is dead in S3
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (75 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 076/114] blk-mq: register cpuhp callback after hctx is added to xarray table Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 078/114] ublk: detach gendisk from ublk device if add_disk() fails Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Emmanuel Grumbach, Miri Korenblit,
	Johannes Berg, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

commit 0572b7715ffd2cac20aac00333706f3094028180 upstream

If the NIC is dead upon resume, try to catch the error earlier and exit
earlier. We'll print less error messages and get to the same recovery
path as before: reload the firmware.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.3a18682261e5.I18f336a4537378a4c1a8537d7246cee1fc82b42c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219597
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../net/wireless/intel/iwlwifi/iwl-trans.h    | 13 +++++----
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c   | 28 ++++++++++++++-----
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |  2 ++
 3 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index e95ffe303547..c70da7281551 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -1074,12 +1074,13 @@ int iwl_trans_read_config32(struct iwl_trans *trans, u32 ofs,
 void iwl_trans_debugfs_cleanup(struct iwl_trans *trans);
 #endif
 
-#define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize)		      \
-	do {								      \
-		if (__builtin_constant_p(bufsize))			      \
-			BUILD_BUG_ON((bufsize) % sizeof(u32));		      \
-		iwl_trans_read_mem(trans, addr, buf, (bufsize) / sizeof(u32));\
-	} while (0)
+#define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize)	\
+	({							\
+		if (__builtin_constant_p(bufsize))		\
+			BUILD_BUG_ON((bufsize) % sizeof(u32));	\
+		iwl_trans_read_mem(trans, addr, buf,		\
+				   (bufsize) / sizeof(u32));	\
+	})
 
 int iwl_trans_write_imr_mem(struct iwl_trans *trans, u32 dst_addr,
 			    u64 src_addr, u32 byte_cnt);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 244ca8cab9d1..1a814eb6743e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -3032,13 +3032,18 @@ static bool iwl_mvm_rt_status(struct iwl_trans *trans, u32 base, u32 *err_id)
 		/* cf. struct iwl_error_event_table */
 		u32 valid;
 		__le32 err_id;
-	} err_info;
+	} err_info = {};
+	int ret;
 
 	if (!base)
 		return false;
 
-	iwl_trans_read_mem_bytes(trans, base,
-				 &err_info, sizeof(err_info));
+	ret = iwl_trans_read_mem_bytes(trans, base,
+				       &err_info, sizeof(err_info));
+
+	if (ret)
+		return true;
+
 	if (err_info.valid && err_id)
 		*err_id = le32_to_cpu(err_info.err_id);
 
@@ -3635,22 +3640,31 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm)
 	iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt);
 
 	if (iwl_mvm_check_rt_status(mvm, NULL)) {
+		IWL_ERR(mvm,
+			"iwl_mvm_check_rt_status failed, device is gone during suspend\n");
 		set_bit(STATUS_FW_ERROR, &mvm->trans->status);
 		iwl_mvm_dump_nic_error_log(mvm);
 		iwl_dbg_tlv_time_point(&mvm->fwrt,
 				       IWL_FW_INI_TIME_POINT_FW_ASSERT, NULL);
 		iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert,
 					false, 0);
-		return -ENODEV;
+		mvm->trans->state = IWL_TRANS_NO_FW;
+		ret = -ENODEV;
+
+		goto out;
 	}
 	ret = iwl_mvm_d3_notif_wait(mvm, &d3_data);
+
+	if (ret) {
+		IWL_ERR(mvm, "Couldn't get the d3 notif %d\n", ret);
+		mvm->trans->state = IWL_TRANS_NO_FW;
+	}
+
+out:
 	clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status);
 	mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED;
 	mvm->fast_resume = false;
 
-	if (ret)
-		IWL_ERR(mvm, "Couldn't get the d3 notif %d\n", ret);
-
 	return ret;
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 3b9943eb6934..d19b3bd0866b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1643,6 +1643,8 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
 out:
 	if (*status == IWL_D3_STATUS_ALIVE)
 		ret = iwl_pcie_d3_handshake(trans, false);
+	else
+		trans->state = IWL_TRANS_NO_FW;
 
 	return ret;
 }
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 078/114] ublk: detach gendisk from ublk device if add_disk() fails
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (76 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 077/114] wifi: iwlwifi: be less noisy if the NIC is dead in S3 Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 079/114] drm/xe: Take PM ref in delayed snapshot capture worker Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Ming Lei, Jens Axboe, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ming Lei <ming.lei@redhat.com>

[ Upstream commit 75cd4005da5492129917a4a4ee45e81660556104 ]

Inside ublk_abort_requests(), gendisk is grabbed for aborting all
inflight requests. And ublk_abort_requests() is called when exiting
the uring context or handling timeout.

If add_disk() fails, the gendisk may have been freed when calling
ublk_abort_requests(), so use-after-free can be caused when getting
disk's reference in ublk_abort_requests().

Fixes the bug by detaching gendisk from ublk device if add_disk() fails.

Fixes: bd23f6c2c2d0 ("ublk: quiesce request queue when aborting queue")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20241225110640.351531-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/ublk_drv.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 90bc605ff6c2..458ac54e7b20 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1599,6 +1599,21 @@ static void ublk_unquiesce_dev(struct ublk_device *ub)
 	blk_mq_kick_requeue_list(ub->ub_disk->queue);
 }
 
+static struct gendisk *ublk_detach_disk(struct ublk_device *ub)
+{
+	struct gendisk *disk;
+
+	/* Sync with ublk_abort_queue() by holding the lock */
+	spin_lock(&ub->lock);
+	disk = ub->ub_disk;
+	ub->dev_info.state = UBLK_S_DEV_DEAD;
+	ub->dev_info.ublksrv_pid = -1;
+	ub->ub_disk = NULL;
+	spin_unlock(&ub->lock);
+
+	return disk;
+}
+
 static void ublk_stop_dev(struct ublk_device *ub)
 {
 	struct gendisk *disk;
@@ -1612,14 +1627,7 @@ static void ublk_stop_dev(struct ublk_device *ub)
 		ublk_unquiesce_dev(ub);
 	}
 	del_gendisk(ub->ub_disk);
-
-	/* Sync with ublk_abort_queue() by holding the lock */
-	spin_lock(&ub->lock);
-	disk = ub->ub_disk;
-	ub->dev_info.state = UBLK_S_DEV_DEAD;
-	ub->dev_info.ublksrv_pid = -1;
-	ub->ub_disk = NULL;
-	spin_unlock(&ub->lock);
+	disk = ublk_detach_disk(ub);
 	put_disk(disk);
  unlock:
 	mutex_unlock(&ub->mutex);
@@ -2295,7 +2303,7 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
 
 out_put_cdev:
 	if (ret) {
-		ub->dev_info.state = UBLK_S_DEV_DEAD;
+		ublk_detach_disk(ub);
 		ublk_put_device(ub);
 	}
 	if (ret)
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 079/114] drm/xe: Take PM ref in delayed snapshot capture worker
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (77 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 078/114] ublk: detach gendisk from ublk device if add_disk() fails Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 080/114] drm/xe: Move the coredump registration to the worker thread Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Rodrigo Vivi, Maarten Lankhorst,
	Matthew Brost, Matthew Auld, Thomas Hellström, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Matthew Brost <matthew.brost@intel.com>

[ Upstream commit aef0b4a07277f715bfc2a0d76a16da2bc4e89205 ]

The delayed snapshot capture worker can access the GPU or VRAM both of
which require a PM reference. Take a reference in this worker.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: 4f04d07c0a94 ("drm/xe: Faster devcoredump")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241126174615.2665852-5-matthew.brost@intel.com
(cherry picked from commit 1c6878af115a4586a40d6c14d530fa9f93e0bd83)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Stable-dep-of: 5dce85fecb87 ("drm/xe: Move the coredump registration to the worker thread")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/xe/xe_devcoredump.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
index 5221ee3f1214..c40c91e27f71 100644
--- a/drivers/gpu/drm/xe/xe_devcoredump.c
+++ b/drivers/gpu/drm/xe/xe_devcoredump.c
@@ -20,6 +20,7 @@
 #include "xe_guc_ct.h"
 #include "xe_guc_submit.h"
 #include "xe_hw_engine.h"
+#include "xe_pm.h"
 #include "xe_sched_job.h"
 #include "xe_vm.h"
 
@@ -147,8 +148,11 @@ static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
 {
 	struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
 	struct xe_devcoredump *coredump = container_of(ss, typeof(*coredump), snapshot);
+	struct xe_device *xe = coredump_to_xe(coredump);
 	unsigned int fw_ref;
 
+	xe_pm_runtime_get(xe);
+
 	/* keep going if fw fails as we still want to save the memory and SW data */
 	fw_ref = xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
 	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
@@ -157,6 +161,8 @@ static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
 	xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
 	xe_force_wake_put(gt_to_fw(ss->gt), fw_ref);
 
+	xe_pm_runtime_put(xe);
+
 	/* Calculate devcoredump size */
 	ss->read.size = __xe_devcoredump_read(NULL, INT_MAX, coredump);
 
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 080/114] drm/xe: Move the coredump registration to the worker thread
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (78 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 079/114] drm/xe: Take PM ref in delayed snapshot capture worker Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 081/114] objtool: Add bch2_trans_unlocked_error() to bcachefs noreturns Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Thomas Hellström, Matthew Brost,
	Jani Nikula, Daniel Vetter, Francois Dugast, Rodrigo Vivi,
	Lucas De Marchi, Sumit Semwal, Christian König, intel-xe,
	linux-media, dri-devel, linaro-mm-sig, John Harrison, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: John Harrison <John.C.Harrison@Intel.com>

[ Upstream commit 5dce85fecb87751ec94526e1ac516dd7871e2e0c ]

Adding lockdep checking to the coredump code showed that there was an
existing violation. The dev_coredumpm_timeout() call is used to
register the dump with the base coredump subsystem. However, that
makes multiple memory allocations, only some of which use the GFP_
flags passed in. So that also needs to be deferred to the worker
function where it is safe to allocate with arbitrary flags.

In order to not add protoypes for the callback functions, moving the
_timeout call also means moving the worker thread function to later in
the file.

v2: Rebased after other changes to the worker function.

Fixes: e799485044cb ("drm/xe: Introduce the dev_coredump infrastructure.")
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: intel-xe@lists.freedesktop.org
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: <stable@vger.kernel.org> # v6.8+
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241128210824.3302147-3-John.C.Harrison@Intel.com
(cherry picked from commit 90f51a7f4ec1004fc4ddfbc6d1f1068d85ef4771)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/xe/xe_devcoredump.c | 73 +++++++++++++++--------------
 1 file changed, 39 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
index c40c91e27f71..c18e463092af 100644
--- a/drivers/gpu/drm/xe/xe_devcoredump.c
+++ b/drivers/gpu/drm/xe/xe_devcoredump.c
@@ -144,36 +144,6 @@ static void xe_devcoredump_snapshot_free(struct xe_devcoredump_snapshot *ss)
 	ss->vm = NULL;
 }
 
-static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
-{
-	struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
-	struct xe_devcoredump *coredump = container_of(ss, typeof(*coredump), snapshot);
-	struct xe_device *xe = coredump_to_xe(coredump);
-	unsigned int fw_ref;
-
-	xe_pm_runtime_get(xe);
-
-	/* keep going if fw fails as we still want to save the memory and SW data */
-	fw_ref = xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
-	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
-		xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
-	xe_vm_snapshot_capture_delayed(ss->vm);
-	xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
-	xe_force_wake_put(gt_to_fw(ss->gt), fw_ref);
-
-	xe_pm_runtime_put(xe);
-
-	/* Calculate devcoredump size */
-	ss->read.size = __xe_devcoredump_read(NULL, INT_MAX, coredump);
-
-	ss->read.buffer = kvmalloc(ss->read.size, GFP_USER);
-	if (!ss->read.buffer)
-		return;
-
-	__xe_devcoredump_read(ss->read.buffer, ss->read.size, coredump);
-	xe_devcoredump_snapshot_free(ss);
-}
-
 static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
 				   size_t count, void *data, size_t datalen)
 {
@@ -222,6 +192,45 @@ static void xe_devcoredump_free(void *data)
 		 "Xe device coredump has been deleted.\n");
 }
 
+static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
+{
+	struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
+	struct xe_devcoredump *coredump = container_of(ss, typeof(*coredump), snapshot);
+	struct xe_device *xe = coredump_to_xe(coredump);
+	unsigned int fw_ref;
+
+	/*
+	 * NB: Despite passing a GFP_ flags parameter here, more allocations are done
+	 * internally using GFP_KERNEL expliictly. Hence this call must be in the worker
+	 * thread and not in the initial capture call.
+	 */
+	dev_coredumpm_timeout(gt_to_xe(ss->gt)->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL,
+			      xe_devcoredump_read, xe_devcoredump_free,
+			      XE_COREDUMP_TIMEOUT_JIFFIES);
+
+	xe_pm_runtime_get(xe);
+
+	/* keep going if fw fails as we still want to save the memory and SW data */
+	fw_ref = xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
+	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
+		xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
+	xe_vm_snapshot_capture_delayed(ss->vm);
+	xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
+	xe_force_wake_put(gt_to_fw(ss->gt), fw_ref);
+
+	xe_pm_runtime_put(xe);
+
+	/* Calculate devcoredump size */
+	ss->read.size = __xe_devcoredump_read(NULL, INT_MAX, coredump);
+
+	ss->read.buffer = kvmalloc(ss->read.size, GFP_USER);
+	if (!ss->read.buffer)
+		return;
+
+	__xe_devcoredump_read(ss->read.buffer, ss->read.size, coredump);
+	xe_devcoredump_snapshot_free(ss);
+}
+
 static void devcoredump_snapshot(struct xe_devcoredump *coredump,
 				 struct xe_sched_job *job)
 {
@@ -305,10 +314,6 @@ void xe_devcoredump(struct xe_sched_job *job)
 	drm_info(&xe->drm, "Xe device coredump has been created\n");
 	drm_info(&xe->drm, "Check your /sys/class/drm/card%d/device/devcoredump/data\n",
 		 xe->drm.primary->index);
-
-	dev_coredumpm_timeout(xe->drm.dev, THIS_MODULE, coredump, 0, GFP_KERNEL,
-			      xe_devcoredump_read, xe_devcoredump_free,
-			      XE_COREDUMP_TIMEOUT_JIFFIES);
 }
 
 static void xe_driver_devcoredump_fini(void *arg)
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 081/114] objtool: Add bch2_trans_unlocked_error() to bcachefs noreturns
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (79 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 080/114] drm/xe: Move the coredump registration to the worker thread Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 082/114] freezer, sched: Report frozen tasks as D instead of R Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, chenchangcheng,
	Peter Zijlstra (Intel), Ingo Molnar, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: chenchangcheng <ccc194101@163.com>

[ Upstream commit 31ad36a271290648e7c2288a03d7b933d20254d6 ]

Fix the following objtool warning during build time:

    fs/bcachefs/btree_trans_commit.o: warning: objtool: bch2_trans_commit_write_locked.isra.0() falls through to next function do_bch2_trans_commit.isra.0()
    fs/bcachefs/btree_trans_commit.o: warning: objtool: .text: unexpected end of section
......
    fs/bcachefs/btree_update.o: warning: objtool: bch2_trans_update_get_key_cache() falls through to next function flush_new_cached_update()
    fs/bcachefs/btree_update.o: warning: objtool: flush_new_cached_update() falls through to next function bch2_trans_update_by_path()

bch2_trans_unlocked_error() is an Obviously Correct (tm) panic() wrapper,
add it to the list of known noreturns.

[ mingo: Improved the changelog ]

Fixes: fd104e2967b7 ("bcachefs: bch2_trans_verify_not_unlocked()")
Signed-off-by: chenchangcheng <chenchangcheng@kylinos.cn>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20241220074847.3418134-1-ccc194101@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/objtool/noreturns.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/noreturns.h b/tools/objtool/noreturns.h
index e7da92489167..f98dc0e1c99c 100644
--- a/tools/objtool/noreturns.h
+++ b/tools/objtool/noreturns.h
@@ -20,6 +20,7 @@ NORETURN(__x64_sys_exit_group)
 NORETURN(arch_cpu_idle_dead)
 NORETURN(bch2_trans_in_restart_error)
 NORETURN(bch2_trans_restart_error)
+NORETURN(bch2_trans_unlocked_error)
 NORETURN(cpu_bringup_and_idle)
 NORETURN(cpu_startup_entry)
 NORETURN(do_exit)
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 082/114] freezer, sched: Report frozen tasks as D instead of R
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (80 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 081/114] objtool: Add bch2_trans_unlocked_error() to bcachefs noreturns Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 083/114] dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Chen Ridong, Peter Zijlstra (Intel),
	Ingo Molnar, Tejun Heo, Michal Koutný, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chen Ridong <chenridong@huawei.com>

[ Upstream commit f718faf3940e95d5d34af9041f279f598396ab7d ]

Before commit:

  f5d39b020809 ("freezer,sched: Rewrite core freezer logic")

the frozen task stat was reported as 'D' in cgroup v1.

However, after rewriting the core freezer logic, the frozen task stat is
reported as 'R'. This is confusing, especially when a task with stat of
'S' is frozen.

This bug can be reproduced with these steps:

	$ cd /sys/fs/cgroup/freezer/
	$ mkdir test
	$ sleep 1000 &
	[1] 739         // task whose stat is 'S'
	$ echo 739 > test/cgroup.procs
	$ echo FROZEN > test/freezer.state
	$ ps -aux | grep 739
	root     739  0.1  0.0   8376  1812 pts/0    R    10:56   0:00 sleep 1000

As shown above, a task whose stat is 'S' was changed to 'R' when it was
frozen.

To solve this regression, simply maintain the same reported state as
before the rewrite.

[ mingo: Enhanced the changelog and comments ]

Fixes: f5d39b020809 ("freezer,sched: Rewrite core freezer logic")
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Michal Koutný <mkoutny@suse.com>
Link: https://lore.kernel.org/r/20241217004818.3200515-1-chenridong@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/sched.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index c14446c6164d..02eaf84c8626 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1633,8 +1633,9 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
 	 * We're lying here, but rather than expose a completely new task state
 	 * to userspace, we can make this appear as if the task has gone through
 	 * a regular rt_mutex_lock() call.
+	 * Report frozen tasks as uninterruptible.
 	 */
-	if (tsk_state & TASK_RTLOCK_WAIT)
+	if ((tsk_state & TASK_RTLOCK_WAIT) || (tsk_state & TASK_FROZEN))
 		state = TASK_UNINTERRUPTIBLE;
 
 	return fls(state);
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 083/114] dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (81 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 082/114] freezer, sched: Report frozen tasks as D instead of R Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 084/114] perf/x86/intel/uncore: Add Clearwater Forest support Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Dan Carpenter, Binbin Zhou,
	Vinod Koul, Sasha Levin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Binbin Zhou <zhoubinbin@loongson.cn>

[ Upstream commit 4b65d5322e1d8994acfdb9b867aa00bdb30d177b ]

Fix the following smatch static checker warning:

drivers/dma/loongson2-apb-dma.c:189 ls2x_dma_write_cmd()
warn: was expecting a 64 bit value instead of '~(((0)) + (((~((0))) - (((1)) << (0)) + 1) & (~((0)) >> ((8 * 4) - 1 - (4)))))'

The GENMASK macro used "unsigned long", which caused build issues when
using a 32-bit toolchain because it would try to access bits > 31. This
patch switches GENMASK to GENMASK_ULL, which uses "unsigned long long".

Fixes: 71e7d3cb6e55 ("dmaengine: ls2x-apb: New driver for the Loongson LS2X APB DMA controller")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/87cdc025-7246-4548-85ca-3d36fdc2be2d@stanley.mountain/
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/20241028093413.1145820-1-zhoubinbin@loongson.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/ls2x-apb-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ls2x-apb-dma.c b/drivers/dma/ls2x-apb-dma.c
index 9652e8666722..b4f18be62945 100644
--- a/drivers/dma/ls2x-apb-dma.c
+++ b/drivers/dma/ls2x-apb-dma.c
@@ -31,7 +31,7 @@
 #define LDMA_ASK_VALID		BIT(2)
 #define LDMA_START		BIT(3) /* DMA start operation */
 #define LDMA_STOP		BIT(4) /* DMA stop operation */
-#define LDMA_CONFIG_MASK	GENMASK(4, 0) /* DMA controller config bits mask */
+#define LDMA_CONFIG_MASK	GENMASK_ULL(4, 0) /* DMA controller config bits mask */
 
 /* Bitfields in ndesc_addr field of HW descriptor */
 #define LDMA_DESC_EN		BIT(0) /*1: The next descriptor is valid */
-- 
2.39.5




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 084/114] perf/x86/intel/uncore: Add Clearwater Forest support
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (82 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 083/114] dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 085/114] tracing: Constify string literal data member in struct trace_event_call Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Kan Liang, Peter Zijlstra (Intel)

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kan Liang <kan.liang@linux.intel.com>

commit b6ccddd6fe1fd49c7a82b6fbed01cccad21a29c7 upstream.

>From the perspective of the uncore PMU, the Clearwater Forest is the
same as the previous Sierra Forest. The only difference is the event
list, which will be supported in the perf tool later.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20241211161146.235253-1-kan.liang@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/events/intel/uncore.c |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1910,6 +1910,7 @@ static const struct x86_cpu_id intel_unc
 	X86_MATCH_VFM(INTEL_ATOM_GRACEMONT,	&adl_uncore_init),
 	X86_MATCH_VFM(INTEL_ATOM_CRESTMONT_X,	&gnr_uncore_init),
 	X86_MATCH_VFM(INTEL_ATOM_CRESTMONT,	&gnr_uncore_init),
+	X86_MATCH_VFM(INTEL_ATOM_DARKMONT_X,	&gnr_uncore_init),
 	{},
 };
 MODULE_DEVICE_TABLE(x86cpu, intel_uncore_match);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 085/114] tracing: Constify string literal data member in struct trace_event_call
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (83 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 084/114] perf/x86/intel/uncore: Add Clearwater Forest support Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 086/114] tracing: Prevent bad count for tracing_cpumask_write Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu, Mathieu Desnoyers,
	Mickaël Salaün, Günther Noack, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	Christian Göttsche, Steven Rostedt (Google)

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christian Göttsche <cgzones@googlemail.com>

commit 452f4b31e3f70a52b97890888eeb9eaa9a87139a upstream.

The name member of the struct trace_event_call is assigned with
generated string literals; declare them pointer to read-only.

Reported by clang:

    security/landlock/syscalls.c:179:1: warning: initializing 'char *' with an expression of type 'const char[34]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
      179 | SYSCALL_DEFINE3(landlock_create_ruleset,
          | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      180 |                 const struct landlock_ruleset_attr __user *const, attr,
          |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      181 |                 const size_t, size, const __u32, flags)
          |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ./include/linux/syscalls.h:226:36: note: expanded from macro 'SYSCALL_DEFINE3'
      226 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
          |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ./include/linux/syscalls.h:234:2: note: expanded from macro 'SYSCALL_DEFINEx'
      234 |         SYSCALL_METADATA(sname, x, __VA_ARGS__)                 \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ./include/linux/syscalls.h:184:2: note: expanded from macro 'SYSCALL_METADATA'
      184 |         SYSCALL_TRACE_ENTER_EVENT(sname);                       \
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ./include/linux/syscalls.h:151:30: note: expanded from macro 'SYSCALL_TRACE_ENTER_EVENT'
      151 |                         .name                   = "sys_enter"#sname,    \
          |                                                   ^~~~~~~~~~~~~~~~~

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Mickaël Salaün <mic@digikod.net>
Cc: Günther Noack <gnoack@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/20241125105028.42807-1-cgoettsche@seltendoof.de
Fixes: b77e38aa240c3 ("tracing: add event trace infrastructure")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/trace_events.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -379,7 +379,7 @@ struct trace_event_call {
 	struct list_head	list;
 	struct trace_event_class *class;
 	union {
-		char			*name;
+		const char		*name;
 		/* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */
 		struct tracepoint	*tp;
 	};



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 086/114] tracing: Prevent bad count for tracing_cpumask_write
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (84 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 085/114] tracing: Constify string literal data member in struct trace_event_call Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 087/114] rtla/timerlat: Fix histogram ALL for zero samples Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, syzbot+0aecfd34fb878546f3fd,
	Lizhi Xu, Steven Rostedt (Google)

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Lizhi Xu <lizhi.xu@windriver.com>

commit 98feccbf32cfdde8c722bc4587aaa60ee5ac33f0 upstream.

If a large count is provided, it will trigger a warning in bitmap_parse_user.
Also check zero for it.

Cc: stable@vger.kernel.org
Fixes: 9e01c1b74c953 ("cpumask: convert kernel trace functions")
Link: https://lore.kernel.org/20241216073238.2573704-1-lizhi.xu@windriver.com
Reported-by: syzbot+0aecfd34fb878546f3fd@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0aecfd34fb878546f3fd
Tested-by: syzbot+0aecfd34fb878546f3fd@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/trace/trace.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5111,6 +5111,9 @@ tracing_cpumask_write(struct file *filp,
 	cpumask_var_t tracing_cpumask_new;
 	int err;
 
+	if (count == 0 || count > KMALLOC_MAX_SIZE)
+		return -EINVAL;
+
 	if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
 		return -ENOMEM;
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 087/114] rtla/timerlat: Fix histogram ALL for zero samples
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (85 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 086/114] tracing: Prevent bad count for tracing_cpumask_write Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 088/114] io_uring/sqpoll: fix sqpoll error handling races Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Tomas Glozar,
	Steven Rostedt (Google)

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tomas Glozar <tglozar@redhat.com>

commit 6cc45f8c1f898570916044f606be9890d295e129 upstream.

rtla timerlat hist currently computers the minimum, maximum and average
latency even in cases when there are zero samples. This leads to
nonsensical values being calculated for maximum and minimum, and to
divide by zero for average.

A similar bug is fixed by 01b05fc0e5f3 ("rtla/timerlat: Fix histogram
report when a cpu count is 0") but the bug still remains for printing
the sum over all CPUs in timerlat_print_stats_all.

The issue can be reproduced with this command:

$ rtla timerlat hist -U -d 1s
Index
over:
count:
min:
avg:
max:
Floating point exception (core dumped)

(There are always no samples with -U unless the user workload is
created.)

Fix the bug by omitting max/min/avg when sample count is zero,
displaying a dash instead, just like we already do for the individual
CPUs. The logic is moved into a new function called
format_summary_value, which is used for both the individual CPUs
and for the overall summary.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/20241127134130.51171-1-tglozar@redhat.com
Fixes: 1462501c7a8 ("rtla/timerlat: Add a summary for hist mode")
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/tracing/rtla/src/timerlat_hist.c |  189 +++++++++++++++++----------------
 1 file changed, 102 insertions(+), 87 deletions(-)

--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -281,6 +281,21 @@ static void timerlat_hist_header(struct
 }
 
 /*
+ * format_summary_value - format a line of summary value (min, max or avg)
+ * of hist data
+ */
+static void format_summary_value(struct trace_seq *seq,
+				 int count,
+				 unsigned long long val,
+				 bool avg)
+{
+	if (count)
+		trace_seq_printf(seq, "%9llu ", avg ? val / count : val);
+	else
+		trace_seq_printf(seq, "%9c ", '-');
+}
+
+/*
  * timerlat_print_summary - print the summary of the hist data to the output
  */
 static void
@@ -327,29 +342,23 @@ timerlat_print_summary(struct timerlat_h
 		if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
 			continue;
 
-		if (!params->no_irq) {
-			if (data->hist[cpu].irq_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						data->hist[cpu].min_irq);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
-
-		if (!params->no_thread) {
-			if (data->hist[cpu].thread_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						data->hist[cpu].min_thread);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
-
-		if (params->user_hist) {
-			if (data->hist[cpu].user_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						data->hist[cpu].min_user);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
+		if (!params->no_irq)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].irq_count,
+					     data->hist[cpu].min_irq,
+					     false);
+
+		if (!params->no_thread)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].thread_count,
+					     data->hist[cpu].min_thread,
+					     false);
+
+		if (params->user_hist)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].user_count,
+					     data->hist[cpu].min_user,
+					     false);
 	}
 	trace_seq_printf(trace->seq, "\n");
 
@@ -363,29 +372,23 @@ timerlat_print_summary(struct timerlat_h
 		if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
 			continue;
 
-		if (!params->no_irq) {
-			if (data->hist[cpu].irq_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						 data->hist[cpu].sum_irq / data->hist[cpu].irq_count);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
-
-		if (!params->no_thread) {
-			if (data->hist[cpu].thread_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						 data->hist[cpu].sum_thread / data->hist[cpu].thread_count);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
-
-		if (params->user_hist) {
-			if (data->hist[cpu].user_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						 data->hist[cpu].sum_user / data->hist[cpu].user_count);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
+		if (!params->no_irq)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].irq_count,
+					     data->hist[cpu].sum_irq,
+					     true);
+
+		if (!params->no_thread)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].thread_count,
+					     data->hist[cpu].sum_thread,
+					     true);
+
+		if (params->user_hist)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].user_count,
+					     data->hist[cpu].sum_user,
+					     true);
 	}
 	trace_seq_printf(trace->seq, "\n");
 
@@ -399,29 +402,23 @@ timerlat_print_summary(struct timerlat_h
 		if (!data->hist[cpu].irq_count && !data->hist[cpu].thread_count)
 			continue;
 
-		if (!params->no_irq) {
-			if (data->hist[cpu].irq_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						 data->hist[cpu].max_irq);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
-
-		if (!params->no_thread) {
-			if (data->hist[cpu].thread_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						data->hist[cpu].max_thread);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
-
-		if (params->user_hist) {
-			if (data->hist[cpu].user_count)
-				trace_seq_printf(trace->seq, "%9llu ",
-						data->hist[cpu].max_user);
-			else
-				trace_seq_printf(trace->seq, "        - ");
-		}
+		if (!params->no_irq)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].irq_count,
+					     data->hist[cpu].max_irq,
+					     false);
+
+		if (!params->no_thread)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].thread_count,
+					     data->hist[cpu].max_thread,
+					     false);
+
+		if (params->user_hist)
+			format_summary_value(trace->seq,
+					     data->hist[cpu].user_count,
+					     data->hist[cpu].max_user,
+					     false);
 	}
 	trace_seq_printf(trace->seq, "\n");
 	trace_seq_do_printf(trace->seq);
@@ -505,16 +502,22 @@ timerlat_print_stats_all(struct timerlat
 		trace_seq_printf(trace->seq, "min:  ");
 
 	if (!params->no_irq)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.min_irq);
+		format_summary_value(trace->seq,
+				     sum.irq_count,
+				     sum.min_irq,
+				     false);
 
 	if (!params->no_thread)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.min_thread);
+		format_summary_value(trace->seq,
+				     sum.thread_count,
+				     sum.min_thread,
+				     false);
 
 	if (params->user_hist)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.min_user);
+		format_summary_value(trace->seq,
+				     sum.user_count,
+				     sum.min_user,
+				     false);
 
 	trace_seq_printf(trace->seq, "\n");
 
@@ -522,16 +525,22 @@ timerlat_print_stats_all(struct timerlat
 		trace_seq_printf(trace->seq, "avg:  ");
 
 	if (!params->no_irq)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.sum_irq / sum.irq_count);
+		format_summary_value(trace->seq,
+				     sum.irq_count,
+				     sum.sum_irq,
+				     true);
 
 	if (!params->no_thread)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.sum_thread / sum.thread_count);
+		format_summary_value(trace->seq,
+				     sum.thread_count,
+				     sum.sum_thread,
+				     true);
 
 	if (params->user_hist)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.sum_user / sum.user_count);
+		format_summary_value(trace->seq,
+				     sum.user_count,
+				     sum.sum_user,
+				     true);
 
 	trace_seq_printf(trace->seq, "\n");
 
@@ -539,16 +548,22 @@ timerlat_print_stats_all(struct timerlat
 		trace_seq_printf(trace->seq, "max:  ");
 
 	if (!params->no_irq)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.max_irq);
+		format_summary_value(trace->seq,
+				     sum.irq_count,
+				     sum.max_irq,
+				     false);
 
 	if (!params->no_thread)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.max_thread);
+		format_summary_value(trace->seq,
+				     sum.thread_count,
+				     sum.max_thread,
+				     false);
 
 	if (params->user_hist)
-		trace_seq_printf(trace->seq, "%9llu ",
-				 sum.max_user);
+		format_summary_value(trace->seq,
+				     sum.user_count,
+				     sum.max_user,
+				     false);
 
 	trace_seq_printf(trace->seq, "\n");
 	trace_seq_do_printf(trace->seq);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 088/114] io_uring/sqpoll: fix sqpoll error handling races
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (86 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 087/114] rtla/timerlat: Fix histogram ALL for zero samples Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 089/114] i2c: microchip-core: actually use repeated sends Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Kun Hu, Pavel Begunkov, Jens Axboe

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Pavel Begunkov <asml.silence@gmail.com>

commit e33ac68e5e21ec1292490dfe061e75c0dbdd3bd4 upstream.

BUG: KASAN: slab-use-after-free in __lock_acquire+0x370b/0x4a10 kernel/locking/lockdep.c:5089
Call Trace:
<TASK>
...
_raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:551 [inline]
try_to_wake_up+0xb5/0x23c0 kernel/sched/core.c:4205
io_sq_thread_park+0xac/0xe0 io_uring/sqpoll.c:55
io_sq_thread_finish+0x6b/0x310 io_uring/sqpoll.c:96
io_sq_offload_create+0x162/0x11d0 io_uring/sqpoll.c:497
io_uring_create io_uring/io_uring.c:3724 [inline]
io_uring_setup+0x1728/0x3230 io_uring/io_uring.c:3806
...

Kun Hu reports that the SQPOLL creating error path has UAF, which
happens if io_uring_alloc_task_context() fails and then io_sq_thread()
manages to run and complete before the rest of error handling code,
which means io_sq_thread_finish() is looking at already killed task.

Note that this is mostly theoretical, requiring fault injection on
the allocation side to trigger in practice.

Cc: stable@vger.kernel.org
Reported-by: Kun Hu <huk23@m.fudan.edu.cn>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0f2f1aa5729332612bd01fe0f2f385fd1f06ce7c.1735231717.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 io_uring/sqpoll.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/io_uring/sqpoll.c
+++ b/io_uring/sqpoll.c
@@ -412,6 +412,7 @@ void io_sqpoll_wait_sq(struct io_ring_ct
 __cold int io_sq_offload_create(struct io_ring_ctx *ctx,
 				struct io_uring_params *p)
 {
+	struct task_struct *task_to_put = NULL;
 	int ret;
 
 	/* Retain compatibility with failing for an invalid attach attempt */
@@ -492,6 +493,7 @@ __cold int io_sq_offload_create(struct i
 		}
 
 		sqd->thread = tsk;
+		task_to_put = get_task_struct(tsk);
 		ret = io_uring_alloc_task_context(tsk, ctx);
 		wake_up_new_task(tsk);
 		if (ret)
@@ -502,11 +504,15 @@ __cold int io_sq_offload_create(struct i
 		goto err;
 	}
 
+	if (task_to_put)
+		put_task_struct(task_to_put);
 	return 0;
 err_sqpoll:
 	complete(&ctx->sq_data->exited);
 err:
 	io_sq_thread_finish(ctx);
+	if (task_to_put)
+		put_task_struct(task_to_put);
 	return ret;
 }
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 089/114] i2c: microchip-core: actually use repeated sends
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (87 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 088/114] io_uring/sqpoll: fix sqpoll error handling races Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 090/114] x86/fred: Clear WFE in missing-ENDBRANCH #CPs Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Conor Dooley, Andi Shyti

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Conor Dooley <conor.dooley@microchip.com>

commit 9a8f9320d67b27ddd7f1ee88d91820197a0e908f upstream.

At present, where repeated sends are intended to be used, the
i2c-microchip-core driver sends a stop followed by a start. Lots of i2c
devices must not malfunction in the face of this behaviour, because the
driver has operated like this for years! Try to keep track of whether or
not a repeated send is required, and suppress sending a stop in these
cases.

CC: stable@vger.kernel.org
Fixes: 64a6f1c4987e ("i2c: add support for microchip fpga i2c controllers")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20241218-football-composure-e56df2461461@spud
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/i2c/busses/i2c-microchip-corei2c.c |  120 ++++++++++++++++++++++-------
 1 file changed, 94 insertions(+), 26 deletions(-)

--- a/drivers/i2c/busses/i2c-microchip-corei2c.c
+++ b/drivers/i2c/busses/i2c-microchip-corei2c.c
@@ -93,27 +93,35 @@
  * @base:		pointer to register struct
  * @dev:		device reference
  * @i2c_clk:		clock reference for i2c input clock
+ * @msg_queue:		pointer to the messages requiring sending
  * @buf:		pointer to msg buffer for easier use
  * @msg_complete:	xfer completion object
  * @adapter:		core i2c abstraction
  * @msg_err:		error code for completed message
  * @bus_clk_rate:	current i2c bus clock rate
  * @isr_status:		cached copy of local ISR status
+ * @total_num:		total number of messages to be sent/received
+ * @current_num:	index of the current message being sent/received
  * @msg_len:		number of bytes transferred in msg
  * @addr:		address of the current slave
+ * @restart_needed:	whether or not a repeated start is required after current message
  */
 struct mchp_corei2c_dev {
 	void __iomem *base;
 	struct device *dev;
 	struct clk *i2c_clk;
+	struct i2c_msg *msg_queue;
 	u8 *buf;
 	struct completion msg_complete;
 	struct i2c_adapter adapter;
 	int msg_err;
+	int total_num;
+	int current_num;
 	u32 bus_clk_rate;
 	u32 isr_status;
 	u16 msg_len;
 	u8 addr;
+	bool restart_needed;
 };
 
 static void mchp_corei2c_core_disable(struct mchp_corei2c_dev *idev)
@@ -222,6 +230,47 @@ static int mchp_corei2c_fill_tx(struct m
 	return 0;
 }
 
+static void mchp_corei2c_next_msg(struct mchp_corei2c_dev *idev)
+{
+	struct i2c_msg *this_msg;
+	u8 ctrl;
+
+	if (idev->current_num >= idev->total_num) {
+		complete(&idev->msg_complete);
+		return;
+	}
+
+	/*
+	 * If there's been an error, the isr needs to return control
+	 * to the "main" part of the driver, so as not to keep sending
+	 * messages once it completes and clears the SI bit.
+	 */
+	if (idev->msg_err) {
+		complete(&idev->msg_complete);
+		return;
+	}
+
+	this_msg = idev->msg_queue++;
+
+	if (idev->current_num < (idev->total_num - 1)) {
+		struct i2c_msg *next_msg = idev->msg_queue;
+
+		idev->restart_needed = next_msg->flags & I2C_M_RD;
+	} else {
+		idev->restart_needed = false;
+	}
+
+	idev->addr = i2c_8bit_addr_from_msg(this_msg);
+	idev->msg_len = this_msg->len;
+	idev->buf = this_msg->buf;
+
+	ctrl = readb(idev->base + CORE_I2C_CTRL);
+	ctrl |= CTRL_STA;
+	writeb(ctrl, idev->base + CORE_I2C_CTRL);
+
+	idev->current_num++;
+}
+
 static irqreturn_t mchp_corei2c_handle_isr(struct mchp_corei2c_dev *idev)
 {
 	u32 status = idev->isr_status;
@@ -247,10 +296,14 @@ static irqreturn_t mchp_corei2c_handle_i
 		break;
 	case STATUS_M_SLAW_ACK:
 	case STATUS_M_TX_DATA_ACK:
-		if (idev->msg_len > 0)
+		if (idev->msg_len > 0) {
 			mchp_corei2c_fill_tx(idev);
-		else
-			last_byte = true;
+		} else {
+			if (idev->restart_needed)
+				finished = true;
+			else
+				last_byte = true;
+		}
 		break;
 	case STATUS_M_TX_DATA_NACK:
 	case STATUS_M_SLAR_NACK:
@@ -287,7 +340,7 @@ static irqreturn_t mchp_corei2c_handle_i
 		mchp_corei2c_stop(idev);
 
 	if (last_byte || finished)
-		complete(&idev->msg_complete);
+		mchp_corei2c_next_msg(idev);
 
 	return IRQ_HANDLED;
 }
@@ -311,21 +364,48 @@ static irqreturn_t mchp_corei2c_isr(int
 	return ret;
 }
 
-static int mchp_corei2c_xfer_msg(struct mchp_corei2c_dev *idev,
-				 struct i2c_msg *msg)
+static int mchp_corei2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
+			     int num)
 {
-	u8 ctrl;
+	struct mchp_corei2c_dev *idev = i2c_get_adapdata(adap);
+	struct i2c_msg *this_msg = msgs;
 	unsigned long time_left;
+	u8 ctrl;
 
-	idev->addr = i2c_8bit_addr_from_msg(msg);
-	idev->msg_len = msg->len;
-	idev->buf = msg->buf;
+	mchp_corei2c_core_enable(idev);
+
+	/*
+	 * The isr controls the flow of a transfer, this info needs to be saved
+	 * to a location that it can access the queue information from.
+	 */
+	idev->restart_needed = false;
+	idev->msg_queue = msgs;
+	idev->total_num = num;
+	idev->current_num = 0;
+
+	/*
+	 * But the first entry to the isr is triggered by the start in this
+	 * function, so the first message needs to be "dequeued".
+	 */
+	idev->addr = i2c_8bit_addr_from_msg(this_msg);
+	idev->msg_len = this_msg->len;
+	idev->buf = this_msg->buf;
 	idev->msg_err = 0;
 
-	reinit_completion(&idev->msg_complete);
+	if (idev->total_num > 1) {
+		struct i2c_msg *next_msg = msgs + 1;
 
-	mchp_corei2c_core_enable(idev);
+		idev->restart_needed = next_msg->flags & I2C_M_RD;
+	}
 
+	idev->current_num++;
+	idev->msg_queue++;
+
+	reinit_completion(&idev->msg_complete);
+
+	/*
+	 * Send the first start to pass control to the isr
+	 */
 	ctrl = readb(idev->base + CORE_I2C_CTRL);
 	ctrl |= CTRL_STA;
 	writeb(ctrl, idev->base + CORE_I2C_CTRL);
@@ -335,20 +415,8 @@ static int mchp_corei2c_xfer_msg(struct
 	if (!time_left)
 		return -ETIMEDOUT;
 
-	return idev->msg_err;
-}
-
-static int mchp_corei2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
-			     int num)
-{
-	struct mchp_corei2c_dev *idev = i2c_get_adapdata(adap);
-	int i, ret;
-
-	for (i = 0; i < num; i++) {
-		ret = mchp_corei2c_xfer_msg(idev, msgs++);
-		if (ret)
-			return ret;
-	}
+	if (idev->msg_err)
+		return idev->msg_err;
 
 	return num;
 }



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 090/114] x86/fred: Clear WFE in missing-ENDBRANCH #CPs
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (88 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 089/114] i2c: microchip-core: actually use repeated sends Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 091/114] virt: tdx-guest: Just leak decrypted memory on unrecoverable errors Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Xin Li (Intel), Dave Hansen,
	Ingo Molnar

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Xin Li (Intel) <xin@zytor.com>

commit dc81e556f2a017d681251ace21bf06c126d5a192 upstream.

An indirect branch instruction sets the CPU indirect branch tracker
(IBT) into WAIT_FOR_ENDBRANCH (WFE) state and WFE stays asserted
across the instruction boundary.  When the decoder finds an
inappropriate instruction while WFE is set ENDBR, the CPU raises a #CP
fault.

For the "kernel IBT no ENDBR" selftest where #CPs are deliberately
triggered, the WFE state of the interrupted context needs to be
cleared to let execution continue.  Otherwise when the CPU resumes
from the instruction that just caused the previous #CP, another
missing-ENDBRANCH #CP is raised and the CPU enters a dead loop.

This is not a problem with IDT because it doesn't preserve WFE and
IRET doesn't set WFE.  But FRED provides space on the entry stack
(in an expanded CS area) to save and restore the WFE state, thus the
WFE state is no longer clobbered, so software must clear it.

Clear WFE to avoid dead looping in ibt_clear_fred_wfe() and the
!ibt_fatal code path when execution is allowed to continue.

Clobbering WFE in any other circumstance is a security-relevant bug.

[ dhansen: changelog rewording ]

Fixes: a5f6c2ace997 ("x86/shstk: Add user control-protection fault handler")
Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20241113175934.3897541-1-xin%40zytor.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/kernel/cet.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

--- a/arch/x86/kernel/cet.c
+++ b/arch/x86/kernel/cet.c
@@ -81,6 +81,34 @@ static void do_user_cp_fault(struct pt_r
 
 static __ro_after_init bool ibt_fatal = true;
 
+/*
+ * By definition, all missing-ENDBRANCH #CPs are a result of WFE && !ENDBR.
+ *
+ * For the kernel IBT no ENDBR selftest where #CPs are deliberately triggered,
+ * the WFE state of the interrupted context needs to be cleared to let execution
+ * continue.  Otherwise when the CPU resumes from the instruction that just
+ * caused the previous #CP, another missing-ENDBRANCH #CP is raised and the CPU
+ * enters a dead loop.
+ *
+ * This is not a problem with IDT because it doesn't preserve WFE and IRET doesn't
+ * set WFE.  But FRED provides space on the entry stack (in an expanded CS area)
+ * to save and restore the WFE state, thus the WFE state is no longer clobbered,
+ * so software must clear it.
+ */
+static void ibt_clear_fred_wfe(struct pt_regs *regs)
+{
+	/*
+	 * No need to do any FRED checks.
+	 *
+	 * For IDT event delivery, the high-order 48 bits of CS are pushed
+	 * as 0s into the stack, and later IRET ignores these bits.
+	 *
+	 * For FRED, a test to check if fred_cs.wfe is set would be dropped
+	 * by compilers.
+	 */
+	regs->fred_cs.wfe = 0;
+}
+
 static void do_kernel_cp_fault(struct pt_regs *regs, unsigned long error_code)
 {
 	if ((error_code & CP_EC) != CP_ENDBR) {
@@ -90,6 +118,7 @@ static void do_kernel_cp_fault(struct pt
 
 	if (unlikely(regs->ip == (unsigned long)&ibt_selftest_noendbr)) {
 		regs->ax = 0;
+		ibt_clear_fred_wfe(regs);
 		return;
 	}
 
@@ -97,6 +126,7 @@ static void do_kernel_cp_fault(struct pt
 	if (!ibt_fatal) {
 		printk(KERN_DEFAULT CUT_HERE);
 		__warn(__FILE__, __LINE__, (void *)regs->ip, TAINT_WARN, regs, NULL);
+		ibt_clear_fred_wfe(regs);
 		return;
 	}
 	BUG();



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 091/114] virt: tdx-guest: Just leak decrypted memory on unrecoverable errors
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (89 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 090/114] x86/fred: Clear WFE in missing-ENDBRANCH #CPs Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 092/114] PCI/MSI: Handle lack of irqdomain gracefully Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Li RongQing, Dave Hansen,
	Ingo Molnar, Rick Edgecombe, Kirill A. Shutemov

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Li RongQing <lirongqing@baidu.com>

commit 27834971f616c5e154423c578fa95e0444444ce1 upstream.

In CoCo VMs it is possible for the untrusted host to cause
set_memory_decrypted() to fail such that an error is returned
and the resulting memory is shared. Callers need to take care
to handle these errors to avoid returning decrypted (shared)
memory to the page allocator, which could lead to functional
or security issues.

Leak the decrypted memory when set_memory_decrypted() fails,
and don't need to print an error since set_memory_decrypted()
will call WARN_ONCE().

Fixes: f4738f56d1dc ("virt: tdx-guest: Add Quote generation support using TSM_REPORTS")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240619111801.25630-1-lirongqing%40baidu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/virt/coco/tdx-guest/tdx-guest.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/virt/coco/tdx-guest/tdx-guest.c
+++ b/drivers/virt/coco/tdx-guest/tdx-guest.c
@@ -124,10 +124,8 @@ static void *alloc_quote_buf(void)
 	if (!addr)
 		return NULL;
 
-	if (set_memory_decrypted((unsigned long)addr, count)) {
-		free_pages_exact(addr, len);
+	if (set_memory_decrypted((unsigned long)addr, count))
 		return NULL;
-	}
 
 	return addr;
 }



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 092/114] PCI/MSI: Handle lack of irqdomain gracefully
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (90 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 091/114] virt: tdx-guest: Just leak decrypted memory on unrecoverable errors Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 093/114] perf/x86/intel: Fix bitmask of OCR and FRONTEND events for LNC Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Alexandre Ghiti, Thomas Gleixner

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit a60b990798eb17433d0283788280422b1bd94b18 upstream.

Alexandre observed a warning emitted from pci_msi_setup_msi_irqs() on a
RISCV platform which does not provide PCI/MSI support:

 WARNING: CPU: 1 PID: 1 at drivers/pci/msi/msi.h:121 pci_msi_setup_msi_irqs+0x2c/0x32
 __pci_enable_msix_range+0x30c/0x596
 pci_msi_setup_msi_irqs+0x2c/0x32
 pci_alloc_irq_vectors_affinity+0xb8/0xe2

RISCV uses hierarchical interrupt domains and correctly does not implement
the legacy fallback. The warning triggers from the legacy fallback stub.

That warning is bogus as the PCI/MSI layer knows whether a PCI/MSI parent
domain is associated with the device or not. There is a check for MSI-X,
which has a legacy assumption. But that legacy fallback assumption is only
valid when legacy support is enabled, but otherwise the check should simply
return -ENOTSUPP.

Loongarch tripped over the same problem and blindly enabled legacy support
without implementing the legacy fallbacks. There are weak implementations
which return an error, so the problem was papered over.

Correct pci_msi_domain_supports() to evaluate the legacy mode and add
the missing supported check into the MSI enable path to complete it.

Fixes: d2a463b29741 ("PCI/MSI: Reject multi-MSI early")
Reported-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/87ed2a8ow5.ffs@tglx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/msi/irqdomain.c |    7 +++++--
 drivers/pci/msi/msi.c       |    4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)

--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -350,8 +350,11 @@ bool pci_msi_domain_supports(struct pci_
 
 	domain = dev_get_msi_domain(&pdev->dev);
 
-	if (!domain || !irq_domain_is_hierarchy(domain))
-		return mode == ALLOW_LEGACY;
+	if (!domain || !irq_domain_is_hierarchy(domain)) {
+		if (IS_ENABLED(CONFIG_PCI_MSI_ARCH_FALLBACKS))
+			return mode == ALLOW_LEGACY;
+		return false;
+	}
 
 	if (!irq_domain_is_msi_parent(domain)) {
 		/*
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -433,6 +433,10 @@ int __pci_enable_msi_range(struct pci_de
 	if (WARN_ON_ONCE(dev->msi_enabled))
 		return -EINVAL;
 
+	/* Test for the availability of MSI support */
+	if (!pci_msi_domain_supports(dev, 0, ALLOW_LEGACY))
+		return -ENOTSUPP;
+
 	nvec = pci_msi_vec_count(dev);
 	if (nvec < 0)
 		return nvec;



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 093/114] perf/x86/intel: Fix bitmask of OCR and FRONTEND events for LNC
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (91 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 092/114] PCI/MSI: Handle lack of irqdomain gracefully Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 094/114] i2c: imx: add imx7d compatible string for applying erratum ERR007805 Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Andi Kleen, Kan Liang,
	Peter Zijlstra (Intel)

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kan Liang <kan.liang@linux.intel.com>

commit aa5d2ca7c179c40669edb5e96d931bf9828dea3d upstream.

The released OCR and FRONTEND events utilized more bits on Lunar Lake
p-core. The corresponding mask in the extra_regs has to be extended to
unblock the extra bits.

Add a dedicated intel_lnc_extra_regs.

Fixes: a932aa0e868f ("perf/x86: Add Lunar Lake and Arrow Lake support")
Reported-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20241216160252.430858-1-kan.liang@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/events/intel/core.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -429,6 +429,16 @@ static struct event_constraint intel_lnc
 	EVENT_CONSTRAINT_END
 };
 
+static struct extra_reg intel_lnc_extra_regs[] __read_mostly = {
+	INTEL_UEVENT_EXTRA_REG(0x012a, MSR_OFFCORE_RSP_0, 0xfffffffffffull, RSP_0),
+	INTEL_UEVENT_EXTRA_REG(0x012b, MSR_OFFCORE_RSP_1, 0xfffffffffffull, RSP_1),
+	INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
+	INTEL_UEVENT_EXTRA_REG(0x02c6, MSR_PEBS_FRONTEND, 0x9, FE),
+	INTEL_UEVENT_EXTRA_REG(0x03c6, MSR_PEBS_FRONTEND, 0x7fff1f, FE),
+	INTEL_UEVENT_EXTRA_REG(0x40ad, MSR_PEBS_FRONTEND, 0xf, FE),
+	INTEL_UEVENT_EXTRA_REG(0x04c2, MSR_PEBS_FRONTEND, 0x8, FE),
+	EVENT_EXTRA_END
+};
 
 EVENT_ATTR_STR(mem-loads,	mem_ld_nhm,	"event=0x0b,umask=0x10,ldlat=3");
 EVENT_ATTR_STR(mem-loads,	mem_ld_snb,	"event=0xcd,umask=0x1,ldlat=3");
@@ -6344,7 +6354,7 @@ static __always_inline void intel_pmu_in
 	intel_pmu_init_glc(pmu);
 	hybrid(pmu, event_constraints) = intel_lnc_event_constraints;
 	hybrid(pmu, pebs_constraints) = intel_lnc_pebs_event_constraints;
-	hybrid(pmu, extra_regs) = intel_rwc_extra_regs;
+	hybrid(pmu, extra_regs) = intel_lnc_extra_regs;
 }
 
 static __always_inline void intel_pmu_init_skt(struct pmu *pmu)



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 094/114] i2c: imx: add imx7d compatible string for applying erratum ERR007805
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (92 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 093/114] perf/x86/intel: Fix bitmask of OCR and FRONTEND events for LNC Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 095/114] i2c: microchip-core: fix "ghost" detections Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Carlos Song, Haibo Chen, Frank Li,
	Oleksij Rempel, Andi Shyti

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Carlos Song <carlos.song@nxp.com>

commit e0cec363197e41af870613e8e17b30bf0e3d41b5 upstream.

Compatible string "fsl,imx7d-i2c" is not exited at i2c-imx driver
compatible string table, at the result, "fsl,imx21-i2c" will be
matched, but it will cause erratum ERR007805 not be applied in fact.

So Add "fsl,imx7d-i2c" compatible string in i2c-imx driver to apply
the erratum ERR007805(https://www.nxp.com/docs/en/errata/IMX7DS_3N09P.pdf).

"
ERR007805 I2C: When the I2C clock speed is configured for 400 kHz,
the SCL low period violates the I2C spec of 1.3 uS min

Description: When the I2C module is programmed to operate at the
maximum clock speed of 400 kHz (as defined by the I2C spec), the SCL
clock low period violates the I2C spec of 1.3 uS min. The user must
reduce the clock speed to obtain the SCL low time to meet the 1.3us
I2C minimum required. This behavior means the SoC is not compliant
to the I2C spec at 400kHz.

Workaround: To meet the clock low period requirement in fast speed
mode, SCL must be configured to 384KHz or less.
"

"fsl,imx7d-i2c" already is documented in binding doc. This erratum
fix has been included in imx6_i2c_hwdata and it is the same in all
I.MX6/7/8, so just reuse it.

Fixes: 39c025721d70 ("i2c: imx: Implement errata ERR007805 or e7805 bus frequency limit")
Cc: stable@vger.kernel.org # v5.18+
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Fixes: 39c025721d70 ("i2c: imx: Implement errata ERR007805 or e7805 bus frequency limit")
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20241218044238.143414-1-carlos.song@nxp.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/i2c/busses/i2c-imx.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -282,6 +282,7 @@ static const struct of_device_id i2c_imx
 	{ .compatible = "fsl,imx6sll-i2c", .data = &imx6_i2c_hwdata, },
 	{ .compatible = "fsl,imx6sx-i2c", .data = &imx6_i2c_hwdata, },
 	{ .compatible = "fsl,imx6ul-i2c", .data = &imx6_i2c_hwdata, },
+	{ .compatible = "fsl,imx7d-i2c", .data = &imx6_i2c_hwdata, },
 	{ .compatible = "fsl,imx7s-i2c", .data = &imx6_i2c_hwdata, },
 	{ .compatible = "fsl,imx8mm-i2c", .data = &imx6_i2c_hwdata, },
 	{ .compatible = "fsl,imx8mn-i2c", .data = &imx6_i2c_hwdata, },



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 095/114] i2c: microchip-core: fix "ghost" detections
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (93 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 094/114] i2c: imx: add imx7d compatible string for applying erratum ERR007805 Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 096/114] perf/x86/intel/ds: Add PEBS format 6 Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Conor Dooley, Andi Shyti

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Conor Dooley <conor.dooley@microchip.com>

commit 49e1f0fd0d4cb03a16b8526c4e683e1958f71490 upstream.

Running i2c-detect currently produces an output akin to:
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         08 -- 0a -- 0c -- 0e --
10: 10 -- 12 -- 14 -- 16 -- UU 19 -- 1b -- 1d -- 1f
20: -- 21 -- 23 -- 25 -- 27 -- 29 -- 2b -- 2d -- 2f
30: -- -- -- -- -- -- -- -- 38 -- 3a -- 3c -- 3e --
40: 40 -- 42 -- 44 -- 46 -- 48 -- 4a -- 4c -- 4e --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- 62 -- 64 -- 66 -- 68 -- 6a -- 6c -- 6e --
70: 70 -- 72 -- 74 -- 76 --

This happens because for an i2c_msg with a len of 0 the driver will
mark the transmission of the message as a success once the START has
been sent, without waiting for the devices on the bus to respond with an
ACK/NAK. Since i2cdetect seems to run in a tight loop over all addresses
the NAK is treated as part of the next test for the next address.

Delete the fast path that marks a message as complete when idev->msg_len
is zero after sending a START/RESTART since this isn't a valid scenario.

CC: stable@vger.kernel.org
Fixes: 64a6f1c4987e ("i2c: add support for microchip fpga i2c controllers")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20241218-outbid-encounter-b2e78b1cc707@spud
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/i2c/busses/i2c-microchip-corei2c.c |    2 --
 1 file changed, 2 deletions(-)

--- a/drivers/i2c/busses/i2c-microchip-corei2c.c
+++ b/drivers/i2c/busses/i2c-microchip-corei2c.c
@@ -287,8 +287,6 @@ static irqreturn_t mchp_corei2c_handle_i
 		ctrl &= ~CTRL_STA;
 		writeb(idev->addr, idev->base + CORE_I2C_DATA);
 		writeb(ctrl, idev->base + CORE_I2C_CTRL);
-		if (idev->msg_len == 0)
-			finished = true;
 		break;
 	case STATUS_M_ARB_LOST:
 		idev->msg_err = -EAGAIN;



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 096/114] perf/x86/intel/ds: Add PEBS format 6
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (94 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 095/114] i2c: microchip-core: fix "ghost" detections Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 097/114] power: supply: cros_charge-control: add mutex for driver data Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Kan Liang, Peter Zijlstra (Intel)

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kan Liang <kan.liang@linux.intel.com>

commit b8c3a2502a205321fe66c356f4b70cabd8e1a5fc upstream.

The only difference between 5 and 6 is the new counters snapshotting
group, without the following counters snapshotting enabling patches,
it's impossible to utilize the feature in a PEBS record. It's safe to
share the same code path with format 5.

Add format 6, so the end user can at least utilize the legacy PEBS
features.

Fixes: a932aa0e868f ("perf/x86: Add Lunar Lake and Arrow Lake support")
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20241216204505.748363-1-kan.liang@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/events/intel/ds.c |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -2496,6 +2496,7 @@ void __init intel_ds_init(void)
 			x86_pmu.large_pebs_flags |= PERF_SAMPLE_TIME;
 			break;
 
+		case 6:
 		case 5:
 			x86_pmu.pebs_ept = 1;
 			fallthrough;



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 097/114] power: supply: cros_charge-control: add mutex for driver data
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (95 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 096/114] perf/x86/intel/ds: Add PEBS format 6 Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 098/114] power: supply: cros_charge-control: allow start_threshold == end_threshold Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Thomas Weißschuh,
	Sebastian Reichel

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Weißschuh <linux@weissschuh.net>

commit e5f84d1cf562f7b45e28d6e5f6490626f870f81c upstream.

Concurrent accesses through sysfs may lead to inconsistent state in the
priv data. Introduce a mutex to avoid this.

Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241208-cros_charge-control-v2-v1-1-8d168d0f08a3@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/power/supply/cros_charge-control.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/cros_charge-control.c b/drivers/power/supply/cros_charge-control.c
index 17c53591ce19..58ca6d9ed613 100644
--- a/drivers/power/supply/cros_charge-control.c
+++ b/drivers/power/supply/cros_charge-control.c
@@ -7,8 +7,10 @@
 #include <acpi/battery.h>
 #include <linux/container_of.h>
 #include <linux/dmi.h>
+#include <linux/lockdep.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/platform_data/cros_ec_commands.h>
 #include <linux/platform_data/cros_ec_proto.h>
 #include <linux/platform_device.h>
@@ -49,6 +51,7 @@ struct cros_chctl_priv {
 	struct attribute *attributes[_CROS_CHCTL_ATTR_COUNT];
 	struct attribute_group group;
 
+	struct mutex lock; /* protects fields below and cros_ec */
 	enum power_supply_charge_behaviour current_behaviour;
 	u8 current_start_threshold, current_end_threshold;
 };
@@ -85,6 +88,8 @@ static int cros_chctl_configure_ec(struct cros_chctl_priv *priv)
 {
 	struct ec_params_charge_control req = {};
 
+	lockdep_assert_held(&priv->lock);
+
 	req.cmd = EC_CHARGE_CONTROL_CMD_SET;
 
 	switch (priv->current_behaviour) {
@@ -159,6 +164,7 @@ static ssize_t charge_control_start_threshold_show(struct device *dev,
 	struct cros_chctl_priv *priv = cros_chctl_attr_to_priv(&attr->attr,
 							       CROS_CHCTL_ATTR_START_THRESHOLD);
 
+	guard(mutex)(&priv->lock);
 	return sysfs_emit(buf, "%u\n", (unsigned int)priv->current_start_threshold);
 }
 
@@ -169,6 +175,7 @@ static ssize_t charge_control_start_threshold_store(struct device *dev,
 	struct cros_chctl_priv *priv = cros_chctl_attr_to_priv(&attr->attr,
 							       CROS_CHCTL_ATTR_START_THRESHOLD);
 
+	guard(mutex)(&priv->lock);
 	return cros_chctl_store_threshold(dev, priv, 0, buf, count);
 }
 
@@ -178,6 +185,7 @@ static ssize_t charge_control_end_threshold_show(struct device *dev, struct devi
 	struct cros_chctl_priv *priv = cros_chctl_attr_to_priv(&attr->attr,
 							       CROS_CHCTL_ATTR_END_THRESHOLD);
 
+	guard(mutex)(&priv->lock);
 	return sysfs_emit(buf, "%u\n", (unsigned int)priv->current_end_threshold);
 }
 
@@ -187,6 +195,7 @@ static ssize_t charge_control_end_threshold_store(struct device *dev, struct dev
 	struct cros_chctl_priv *priv = cros_chctl_attr_to_priv(&attr->attr,
 							       CROS_CHCTL_ATTR_END_THRESHOLD);
 
+	guard(mutex)(&priv->lock);
 	return cros_chctl_store_threshold(dev, priv, 1, buf, count);
 }
 
@@ -195,6 +204,7 @@ static ssize_t charge_behaviour_show(struct device *dev, struct device_attribute
 	struct cros_chctl_priv *priv = cros_chctl_attr_to_priv(&attr->attr,
 							       CROS_CHCTL_ATTR_CHARGE_BEHAVIOUR);
 
+	guard(mutex)(&priv->lock);
 	return power_supply_charge_behaviour_show(dev, EC_CHARGE_CONTROL_BEHAVIOURS,
 						  priv->current_behaviour, buf);
 }
@@ -210,6 +220,7 @@ static ssize_t charge_behaviour_store(struct device *dev, struct device_attribut
 	if (ret < 0)
 		return ret;
 
+	guard(mutex)(&priv->lock);
 	priv->current_behaviour = ret;
 
 	ret = cros_chctl_configure_ec(priv);
@@ -290,6 +301,10 @@ static int cros_chctl_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	ret = devm_mutex_init(dev, &priv->lock);
+	if (ret)
+		return ret;
+
 	ret = cros_ec_get_cmd_versions(cros_ec, EC_CMD_CHARGE_CONTROL);
 	if (ret < 0)
 		return ret;
@@ -327,7 +342,8 @@ static int cros_chctl_probe(struct platform_device *pdev)
 	priv->current_end_threshold = 100;
 
 	/* Bring EC into well-known state */
-	ret = cros_chctl_configure_ec(priv);
+	scoped_guard(mutex, &priv->lock)
+		ret = cros_chctl_configure_ec(priv);
 	if (ret < 0)
 		return ret;
 
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 098/114] power: supply: cros_charge-control: allow start_threshold == end_threshold
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (96 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 097/114] power: supply: cros_charge-control: add mutex for driver data Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 099/114] power: supply: cros_charge-control: hide start threshold on v2 cmd Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Thomas Koch, Thomas Weißschuh,
	Sebastian Reichel

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Weißschuh <linux@weissschuh.net>

commit e65a1b7fad0e112573eea7d64d4ab4fc513b8695 upstream.

Allow setting the start and stop thresholds to the same value.
There is no reason to disallow it.

Suggested-by: Thomas Koch <linrunner@gmx.net>
Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241208-cros_charge-control-v2-v1-2-8d168d0f08a3@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/power/supply/cros_charge-control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/cros_charge-control.c b/drivers/power/supply/cros_charge-control.c
index 58ca6d9ed613..108b121db442 100644
--- a/drivers/power/supply/cros_charge-control.c
+++ b/drivers/power/supply/cros_charge-control.c
@@ -139,11 +139,11 @@ static ssize_t cros_chctl_store_threshold(struct device *dev, struct cros_chctl_
 		return -EINVAL;
 
 	if (is_end_threshold) {
-		if (val <= priv->current_start_threshold)
+		if (val < priv->current_start_threshold)
 			return -EINVAL;
 		priv->current_end_threshold = val;
 	} else {
-		if (val >= priv->current_end_threshold)
+		if (val > priv->current_end_threshold)
 			return -EINVAL;
 		priv->current_start_threshold = val;
 	}
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 099/114] power: supply: cros_charge-control: hide start threshold on v2 cmd
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (97 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 098/114] power: supply: cros_charge-control: allow start_threshold == end_threshold Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 100/114] power: supply: gpio-charger: Fix set charge current limits Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Thomas Koch, Thomas Weißschuh,
	Sebastian Reichel

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Weißschuh <linux@weissschuh.net>

commit c28dc9fc24f5fa802d44ef7620a511035bdd803e upstream.

ECs implementing the v2 command will not stop charging when the end
threshold is reached. Instead they will begin discharging until the
start threshold is reached, leading to permanent charge and discharge
cycles. This defeats the point of the charge control mechanism.

Avoid the issue by hiding the start threshold on v2 systems.
Instead on those systems program the EC with start == end which forces
the EC to reach and stay at that level.

v1 does not support thresholds and v3 works correctly,
at least judging from the code.

Reported-by: Thomas Koch <linrunner@gmx.net>
Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241208-cros_charge-control-v2-v1-3-8d168d0f08a3@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/power/supply/cros_charge-control.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/power/supply/cros_charge-control.c b/drivers/power/supply/cros_charge-control.c
index 108b121db442..9b0a7500296b 100644
--- a/drivers/power/supply/cros_charge-control.c
+++ b/drivers/power/supply/cros_charge-control.c
@@ -139,6 +139,10 @@ static ssize_t cros_chctl_store_threshold(struct device *dev, struct cros_chctl_
 		return -EINVAL;
 
 	if (is_end_threshold) {
+		/* Start threshold is not exposed, use fixed value */
+		if (priv->cmd_version == 2)
+			priv->current_start_threshold = val == 100 ? 0 : val;
+
 		if (val < priv->current_start_threshold)
 			return -EINVAL;
 		priv->current_end_threshold = val;
@@ -234,12 +238,10 @@ static umode_t cros_chtl_attr_is_visible(struct kobject *kobj, struct attribute
 {
 	struct cros_chctl_priv *priv = cros_chctl_attr_to_priv(attr, n);
 
-	if (priv->cmd_version < 2) {
-		if (n == CROS_CHCTL_ATTR_START_THRESHOLD)
-			return 0;
-		if (n == CROS_CHCTL_ATTR_END_THRESHOLD)
-			return 0;
-	}
+	if (n == CROS_CHCTL_ATTR_START_THRESHOLD && priv->cmd_version < 3)
+		return 0;
+	else if (n == CROS_CHCTL_ATTR_END_THRESHOLD && priv->cmd_version < 2)
+		return 0;
 
 	return attr->mode;
 }
-- 
2.47.1




^ permalink raw reply related	[flat|nested] 136+ messages in thread

* [PATCH 6.12 100/114] power: supply: gpio-charger: Fix set charge current limits
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (98 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 099/114] power: supply: cros_charge-control: hide start threshold on v2 cmd Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 101/114] btrfs: fix race with memory mapped writes when activating swap file Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Dimitri Fedrau, Sebastian Reichel

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>

commit afc6e39e824ad0e44b2af50a97885caec8d213d1 upstream.

Fix set charge current limits for devices which allow to set the lowest
charge current limit to be greater zero. If requested charge current limit
is below lowest limit, the index equals current_limit_map_size which leads
to accessing memory beyond allocated memory.

Fixes: be2919d8355e ("power: supply: gpio-charger: add charge-current-limit feature")
Cc: stable@vger.kernel.org
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Link: https://lore.kernel.org/r/20241209-fix-charge-current-limit-v1-1-760d9b8f2af3@liebherr.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/power/supply/gpio-charger.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/power/supply/gpio-charger.c
+++ b/drivers/power/supply/gpio-charger.c
@@ -67,6 +67,14 @@ static int set_charge_current_limit(stru
 		if (gpio_charger->current_limit_map[i].limit_ua <= val)
 			break;
 	}
+
+	/*
+	 * If a valid charge current limit isn't found, default to smallest
+	 * current limitation for safety reasons.
+	 */
+	if (i >= gpio_charger->current_limit_map_size)
+		i = gpio_charger->current_limit_map_size - 1;
+
 	mapping = gpio_charger->current_limit_map[i];
 
 	for (i = 0; i < ndescs; i++) {



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 101/114] btrfs: fix race with memory mapped writes when activating swap file
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (99 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 100/114] power: supply: gpio-charger: Fix set charge current limits Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a " Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
	David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Filipe Manana <fdmanana@suse.com>

commit 0525064bb82e50d59543b62b9d41a606198a4a44 upstream.

When activating the swap file we flush all delalloc and wait for ordered
extent completion, so that we don't miss any delalloc and extents before
we check that the file's extent layout is usable for a swap file and
activate the swap file. We are called with the inode's VFS lock acquired,
so we won't race with buffered and direct IO writes, however we can still
race with memory mapped writes since they don't acquire the inode's VFS
lock. The race window is between flushing all delalloc and locking the
whole file's extent range, since memory mapped writes lock an extent range
with the length of a page.

Fix this by acquiring the inode's mmap lock before we flush delalloc.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/inode.c |   31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9791,28 +9791,40 @@ static int btrfs_swap_activate(struct sw
 	u64 start;
 
 	/*
+	 * Acquire the inode's mmap lock to prevent races with memory mapped
+	 * writes, as they could happen after we flush delalloc below and before
+	 * we lock the extent range further below. The inode was already locked
+	 * up in the call chain.
+	 */
+	btrfs_assert_inode_locked(BTRFS_I(inode));
+	down_write(&BTRFS_I(inode)->i_mmap_lock);
+
+	/*
 	 * If the swap file was just created, make sure delalloc is done. If the
 	 * file changes again after this, the user is doing something stupid and
 	 * we don't really care.
 	 */
 	ret = btrfs_wait_ordered_range(BTRFS_I(inode), 0, (u64)-1);
 	if (ret)
-		return ret;
+		goto out_unlock_mmap;
 
 	/*
 	 * The inode is locked, so these flags won't change after we check them.
 	 */
 	if (BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS) {
 		btrfs_warn(fs_info, "swapfile must not be compressed");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out_unlock_mmap;
 	}
 	if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW)) {
 		btrfs_warn(fs_info, "swapfile must not be copy-on-write");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out_unlock_mmap;
 	}
 	if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) {
 		btrfs_warn(fs_info, "swapfile must not be checksummed");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out_unlock_mmap;
 	}
 
 	/*
@@ -9827,7 +9839,8 @@ static int btrfs_swap_activate(struct sw
 	if (!btrfs_exclop_start(fs_info, BTRFS_EXCLOP_SWAP_ACTIVATE)) {
 		btrfs_warn(fs_info,
 	   "cannot activate swapfile while exclusive operation is running");
-		return -EBUSY;
+		ret = -EBUSY;
+		goto out_unlock_mmap;
 	}
 
 	/*
@@ -9841,7 +9854,8 @@ static int btrfs_swap_activate(struct sw
 		btrfs_exclop_finish(fs_info);
 		btrfs_warn(fs_info,
 	   "cannot activate swapfile because snapshot creation is in progress");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out_unlock_mmap;
 	}
 	/*
 	 * Snapshots can create extents which require COW even if NODATACOW is
@@ -9862,7 +9876,8 @@ static int btrfs_swap_activate(struct sw
 		btrfs_warn(fs_info,
 		"cannot activate swapfile because subvolume %llu is being deleted",
 			btrfs_root_id(root));
-		return -EPERM;
+		ret = -EPERM;
+		goto out_unlock_mmap;
 	}
 	atomic_inc(&root->nr_swapfiles);
 	spin_unlock(&root->root_item_lock);
@@ -10017,6 +10032,8 @@ out:
 
 	btrfs_exclop_finish(fs_info);
 
+out_unlock_mmap:
+	up_write(&BTRFS_I(inode)->i_mmap_lock);
 	if (ret)
 		return ret;
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a swap file
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (100 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 101/114] btrfs: fix race with memory mapped writes when activating swap file Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2025-02-06 11:41   ` Koichiro Den
  2024-12-30 15:43 ` [PATCH 6.12 103/114] btrfs: fix swap file activation failure due to extents that used to be shared Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  124 siblings, 1 reply; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
	David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Filipe Manana <fdmanana@suse.com>

commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.

During swap activation we iterate over the extents of a file and we can
have many thousands of them, so we can end up in a busy loop monopolizing
a core. Avoid this by doing a voluntary reschedule after processing each
extent.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/inode.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct ino
 			ret = -EAGAIN;
 			goto out;
 		}
+
+		cond_resched();
 	}
 
 	if (file_extent)



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 103/114] btrfs: fix swap file activation failure due to extents that used to be shared
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (101 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a " Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 104/114] btrfs: fix transaction atomicity bug when enabling simple quotas Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
	David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Filipe Manana <fdmanana@suse.com>

commit 03018e5d8508254534511d40fb57bc150e6a87f2 upstream.

When activating a swap file, to determine if an extent is shared we use
can_nocow_extent(), which ends up at btrfs_cross_ref_exist(). That helper
is meant to be quick because it's used in the NOCOW write path, when
flushing delalloc and when doing a direct IO write, however it does return
some false positives, meaning it may indicate that an extent is shared
even if it's no longer the case. For the write path this is fine, we just
do a unnecessary COW operation instead of doing a more rigorous check
which would be too heavy (calling btrfs_is_data_extent_shared()).

However when activating a swap file, the false positives simply result
in a failure, which is confusing for users/applications. One particular
case where this happens is when a data extent only has 1 reference but
that reference is not inlined in the extent item located in the extent
tree - this happens when we create more than 33 references for an extent
and then delete those 33 references plus every other non-inline reference
except one. The function check_committed_ref() assumes that if the size
of an extent item doesn't match the size of struct btrfs_extent_item
plus the size of an inline reference (plus an owner reference in case
simple quotas are enabled), then the extent is shared - that is not the
case however, we can have a single reference but it's not inlined - the
reason we do this is to be fast and avoid inspecting non-inline references
which may be located in another leaf of the extent tree, slowing down
write paths.

The following test script reproduces the bug:

   $ cat test.sh
   #!/bin/bash

   DEV=/dev/sdi
   MNT=/mnt/sdi
   NUM_CLONES=50

   umount $DEV &> /dev/null

   run_test()
   {
        local sync_after_add_reflinks=$1
        local sync_after_remove_reflinks=$2

        mkfs.btrfs -f $DEV > /dev/null
        #mkfs.xfs -f $DEV > /dev/null
        mount $DEV $MNT

        touch $MNT/foo
        chmod 0600 $MNT/foo
   	# On btrfs the file must be NOCOW.
        chattr +C $MNT/foo &> /dev/null
        xfs_io -s -c "pwrite -b 1M 0 1M" $MNT/foo
        mkswap $MNT/foo

        for ((i = 1; i <= $NUM_CLONES; i++)); do
            touch $MNT/foo_clone_$i
            chmod 0600 $MNT/foo_clone_$i
            # On btrfs the file must be NOCOW.
            chattr +C $MNT/foo_clone_$i &> /dev/null
            cp --reflink=always $MNT/foo $MNT/foo_clone_$i
        done

        if [ $sync_after_add_reflinks -ne 0 ]; then
            # Flush delayed refs and commit current transaction.
            sync -f $MNT
        fi

        # Remove the original file and all clones except the last.
        rm -f $MNT/foo
        for ((i = 1; i < $NUM_CLONES; i++)); do
            rm -f $MNT/foo_clone_$i
        done

        if [ $sync_after_remove_reflinks -ne 0 ]; then
            # Flush delayed refs and commit current transaction.
            sync -f $MNT
        fi

        # Now use the last clone as a swap file. It should work since
        # its extent are not shared anymore.
        swapon $MNT/foo_clone_${NUM_CLONES}
        swapoff $MNT/foo_clone_${NUM_CLONES}

        umount $MNT
   }

   echo -e "\nTest without sync after creating and removing clones"
   run_test 0 0

   echo -e "\nTest with sync after creating clones"
   run_test 1 0

   echo -e "\nTest with sync after removing clones"
   run_test 0 1

   echo -e "\nTest with sync after creating and removing clones"
   run_test 1 1

Running the test:

   $ ./test.sh
   Test without sync after creating and removing clones
   wrote 1048576/1048576 bytes at offset 0
   1 MiB, 1 ops; 0.0017 sec (556.793 MiB/sec and 556.7929 ops/sec)
   Setting up swapspace version 1, size = 1020 KiB (1044480 bytes)
   no label, UUID=a6b9c29e-5ef4-4689-a8ac-bc199c750f02
   swapon: /mnt/sdi/foo_clone_50: swapon failed: Invalid argument
   swapoff: /mnt/sdi/foo_clone_50: swapoff failed: Invalid argument

   Test with sync after creating clones
   wrote 1048576/1048576 bytes at offset 0
   1 MiB, 1 ops; 0.0036 sec (271.739 MiB/sec and 271.7391 ops/sec)
   Setting up swapspace version 1, size = 1020 KiB (1044480 bytes)
   no label, UUID=5e9008d6-1f7a-4948-a1b4-3f30aba20a33
   swapon: /mnt/sdi/foo_clone_50: swapon failed: Invalid argument
   swapoff: /mnt/sdi/foo_clone_50: swapoff failed: Invalid argument

   Test with sync after removing clones
   wrote 1048576/1048576 bytes at offset 0
   1 MiB, 1 ops; 0.0103 sec (96.665 MiB/sec and 96.6651 ops/sec)
   Setting up swapspace version 1, size = 1020 KiB (1044480 bytes)
   no label, UUID=916c2740-fa9f-4385-9f06-29c3f89e4764

   Test with sync after creating and removing clones
   wrote 1048576/1048576 bytes at offset 0
   1 MiB, 1 ops; 0.0031 sec (314.268 MiB/sec and 314.2678 ops/sec)
   Setting up swapspace version 1, size = 1020 KiB (1044480 bytes)
   no label, UUID=06aab1dd-4d90-49c0-bd9f-3a8db4e2f912
   swapon: /mnt/sdi/foo_clone_50: swapon failed: Invalid argument
   swapoff: /mnt/sdi/foo_clone_50: swapoff failed: Invalid argument

Fix this by reworking btrfs_swap_activate() to instead of using extent
maps and checking for shared extents with can_nocow_extent(), iterate
over the inode's file extent items and use the accurate
btrfs_is_data_extent_shared().

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/inode.c |  102 ++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 72 insertions(+), 30 deletions(-)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9782,15 +9782,16 @@ static int btrfs_swap_activate(struct sw
 	struct btrfs_fs_info *fs_info = root->fs_info;
 	struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
 	struct extent_state *cached_state = NULL;
-	struct extent_map *em = NULL;
 	struct btrfs_chunk_map *map = NULL;
 	struct btrfs_device *device = NULL;
 	struct btrfs_swap_info bsi = {
 		.lowest_ppage = (sector_t)-1ULL,
 	};
+	struct btrfs_backref_share_check_ctx *backref_ctx = NULL;
+	struct btrfs_path *path = NULL;
 	int ret = 0;
 	u64 isize;
-	u64 start;
+	u64 prev_extent_end = 0;
 
 	/*
 	 * Acquire the inode's mmap lock to prevent races with memory mapped
@@ -9829,6 +9830,13 @@ static int btrfs_swap_activate(struct sw
 		goto out_unlock_mmap;
 	}
 
+	path = btrfs_alloc_path();
+	backref_ctx = btrfs_alloc_backref_share_check_ctx();
+	if (!path || !backref_ctx) {
+		ret = -ENOMEM;
+		goto out_unlock_mmap;
+	}
+
 	/*
 	 * Balance or device remove/replace/resize can move stuff around from
 	 * under us. The exclop protection makes sure they aren't running/won't
@@ -9887,24 +9895,39 @@ static int btrfs_swap_activate(struct sw
 	isize = ALIGN_DOWN(inode->i_size, fs_info->sectorsize);
 
 	lock_extent(io_tree, 0, isize - 1, &cached_state);
-	start = 0;
-	while (start < isize) {
-		u64 logical_block_start, physical_block_start;
+	while (prev_extent_end < isize) {
+		struct btrfs_key key;
+		struct extent_buffer *leaf;
+		struct btrfs_file_extent_item *ei;
 		struct btrfs_block_group *bg;
-		u64 len = isize - start;
-
-		em = btrfs_get_extent(BTRFS_I(inode), NULL, start, len);
-		if (IS_ERR(em)) {
-			ret = PTR_ERR(em);
-			goto out;
-		}
-
-		if (em->disk_bytenr == EXTENT_MAP_HOLE) {
+		u64 logical_block_start;
+		u64 physical_block_start;
+		u64 extent_gen;
+		u64 disk_bytenr;
+		u64 len;
+
+		key.objectid = btrfs_ino(BTRFS_I(inode));
+		key.type = BTRFS_EXTENT_DATA_KEY;
+		key.offset = prev_extent_end;
+
+		ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
+		if (ret < 0)
+			goto out;
+
+		/*
+		 * If key not found it means we have an implicit hole (NO_HOLES
+		 * is enabled).
+		 */
+		if (ret > 0) {
 			btrfs_warn(fs_info, "swapfile must not have holes");
 			ret = -EINVAL;
 			goto out;
 		}
-		if (em->disk_bytenr == EXTENT_MAP_INLINE) {
+
+		leaf = path->nodes[0];
+		ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
+
+		if (btrfs_file_extent_type(leaf, ei) == BTRFS_FILE_EXTENT_INLINE) {
 			/*
 			 * It's unlikely we'll ever actually find ourselves
 			 * here, as a file small enough to fit inline won't be
@@ -9916,23 +9939,45 @@ static int btrfs_swap_activate(struct sw
 			ret = -EINVAL;
 			goto out;
 		}
-		if (extent_map_is_compressed(em)) {
+
+		if (btrfs_file_extent_compression(leaf, ei) != BTRFS_COMPRESS_NONE) {
 			btrfs_warn(fs_info, "swapfile must not be compressed");
 			ret = -EINVAL;
 			goto out;
 		}
 
-		logical_block_start = extent_map_block_start(em) + (start - em->start);
-		len = min(len, em->len - (start - em->start));
-		free_extent_map(em);
-		em = NULL;
+		disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, ei);
+		if (disk_bytenr == 0) {
+			btrfs_warn(fs_info, "swapfile must not have holes");
+			ret = -EINVAL;
+			goto out;
+		}
+
+		logical_block_start = disk_bytenr + btrfs_file_extent_offset(leaf, ei);
+		extent_gen = btrfs_file_extent_generation(leaf, ei);
+		prev_extent_end = btrfs_file_extent_end(path);
+
+		if (prev_extent_end > isize)
+			len = isize - key.offset;
+		else
+			len = btrfs_file_extent_num_bytes(leaf, ei);
+
+		backref_ctx->curr_leaf_bytenr = leaf->start;
+
+		/*
+		 * Don't need the path anymore, release to avoid deadlocks when
+		 * calling btrfs_is_data_extent_shared() because when joining a
+		 * transaction it can block waiting for the current one's commit
+		 * which in turn may be trying to lock the same leaf to flush
+		 * delayed items for example.
+		 */
+		btrfs_release_path(path);
 
-		ret = can_nocow_extent(inode, start, &len, NULL, false, true);
+		ret = btrfs_is_data_extent_shared(BTRFS_I(inode), disk_bytenr,
+						  extent_gen, backref_ctx);
 		if (ret < 0) {
 			goto out;
-		} else if (ret) {
-			ret = 0;
-		} else {
+		} else if (ret > 0) {
 			btrfs_warn(fs_info,
 				   "swapfile must not be copy-on-write");
 			ret = -EINVAL;
@@ -9967,7 +10012,6 @@ static int btrfs_swap_activate(struct sw
 
 		physical_block_start = (map->stripes[0].physical +
 					(logical_block_start - map->start));
-		len = min(len, map->chunk_len - (logical_block_start - map->start));
 		btrfs_free_chunk_map(map);
 		map = NULL;
 
@@ -10008,20 +10052,16 @@ static int btrfs_swap_activate(struct sw
 				if (ret)
 					goto out;
 			}
-			bsi.start = start;
+			bsi.start = key.offset;
 			bsi.block_start = physical_block_start;
 			bsi.block_len = len;
 		}
-
-		start += len;
 	}
 
 	if (bsi.block_len)
 		ret = btrfs_add_swap_extent(sis, &bsi);
 
 out:
-	if (!IS_ERR_OR_NULL(em))
-		free_extent_map(em);
 	if (!IS_ERR_OR_NULL(map))
 		btrfs_free_chunk_map(map);
 
@@ -10036,6 +10076,8 @@ out:
 
 out_unlock_mmap:
 	up_write(&BTRFS_I(inode)->i_mmap_lock);
+	btrfs_free_backref_share_ctx(backref_ctx);
+	btrfs_free_path(path);
 	if (ret)
 		return ret;
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 104/114] btrfs: fix transaction atomicity bug when enabling simple quotas
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (102 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 103/114] btrfs: fix swap file activation failure due to extents that used to be shared Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 105/114] btrfs: sysfs: fix direct super block member reads Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Filipe Manana, Julian Sun,
	David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Julian Sun <sunjunchao2870@gmail.com>

commit f2363e6fcc7938c5f0f6ac066fad0dd247598b51 upstream.

Set squota incompat bit before committing the transaction that enables
the feature.

With the config CONFIG_BTRFS_ASSERT enabled, an assertion
failure occurs regarding the simple quota feature.

  [5.596534] assertion failed: btrfs_fs_incompat(fs_info, SIMPLE_QUOTA), in fs/btrfs/qgroup.c:365
  [5.597098] ------------[ cut here ]------------
  [5.597371] kernel BUG at fs/btrfs/qgroup.c:365!
  [5.597946] CPU: 1 UID: 0 PID: 268 Comm: mount Not tainted 6.13.0-rc2-00031-gf92f4749861b #146
  [5.598450] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
  [5.599008] RIP: 0010:btrfs_read_qgroup_config+0x74d/0x7a0
  [5.604303]  <TASK>
  [5.605230]  ? btrfs_read_qgroup_config+0x74d/0x7a0
  [5.605538]  ? exc_invalid_op+0x56/0x70
  [5.605775]  ? btrfs_read_qgroup_config+0x74d/0x7a0
  [5.606066]  ? asm_exc_invalid_op+0x1f/0x30
  [5.606441]  ? btrfs_read_qgroup_config+0x74d/0x7a0
  [5.606741]  ? btrfs_read_qgroup_config+0x74d/0x7a0
  [5.607038]  ? try_to_wake_up+0x317/0x760
  [5.607286]  open_ctree+0xd9c/0x1710
  [5.607509]  btrfs_get_tree+0x58a/0x7e0
  [5.608002]  vfs_get_tree+0x2e/0x100
  [5.608224]  fc_mount+0x16/0x60
  [5.608420]  btrfs_get_tree+0x2f8/0x7e0
  [5.608897]  vfs_get_tree+0x2e/0x100
  [5.609121]  path_mount+0x4c8/0xbc0
  [5.609538]  __x64_sys_mount+0x10d/0x150

The issue can be easily reproduced using the following reproducer:

  root@q:linux# cat repro.sh
  set -e

  mkfs.btrfs -q -f /dev/sdb
  mount /dev/sdb /mnt/btrfs
  btrfs quota enable -s /mnt/btrfs
  umount /mnt/btrfs
  mount /dev/sdb /mnt/btrfs

The issue is that when enabling quotas, at btrfs_quota_enable(), we set
BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE at fs_info->qgroup_flags and persist
it in the quota root in the item with the key BTRFS_QGROUP_STATUS_KEY, but
we only set the incompat bit BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA after we
commit the transaction used to enable simple quotas.

This means that if after that transaction commit we unmount the filesystem
without starting and committing any other transaction, or we have a power
failure, the next time we mount the filesystem we will find the flag
BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE set in the item with the key
BTRFS_QGROUP_STATUS_KEY but we will not find the incompat bit
BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA set in the superblock, triggering an
assertion failure at:

  btrfs_read_qgroup_config() -> qgroup_read_enable_gen()

To fix this issue, set the BTRFS_FEATURE_INCOMPAT_SIMPLE_QUOTA flag
immediately after setting the BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE.
This ensures that both flags are flushed to disk within the same
transaction.

Fixes: 182940f4f4db ("btrfs: qgroup: add new quota mode for simple quotas")
CC: stable@vger.kernel.org # 6.6+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Julian Sun <sunjunchao2870@gmail.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/qgroup.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1122,6 +1122,7 @@ int btrfs_quota_enable(struct btrfs_fs_i
 	fs_info->qgroup_flags = BTRFS_QGROUP_STATUS_FLAG_ON;
 	if (simple) {
 		fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE;
+		btrfs_set_fs_incompat(fs_info, SIMPLE_QUOTA);
 		btrfs_set_qgroup_status_enable_gen(leaf, ptr, trans->transid);
 	} else {
 		fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
@@ -1255,8 +1256,6 @@ out_add_root:
 	spin_lock(&fs_info->qgroup_lock);
 	fs_info->quota_root = quota_root;
 	set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
-	if (simple)
-		btrfs_set_fs_incompat(fs_info, SIMPLE_QUOTA);
 	spin_unlock(&fs_info->qgroup_lock);
 
 	/* Skip rescan for simple qgroups. */



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 105/114] btrfs: sysfs: fix direct super block member reads
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (103 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 104/114] btrfs: fix transaction atomicity bug when enabling simple quotas Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 106/114] btrfs: fix use-after-free when COWing tree bock and tracing is enabled Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Naohiro Aota, Johannes Thumshirn,
	Qu Wenruo, David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Qu Wenruo <wqu@suse.com>

commit fca432e73db2bec0fdbfbf6d98d3ebcd5388a977 upstream.

The following sysfs entries are reading super block member directly,
which can have a different endian and cause wrong values:

- sys/fs/btrfs/<uuid>/nodesize
- sys/fs/btrfs/<uuid>/sectorsize
- sys/fs/btrfs/<uuid>/clone_alignment

Thankfully those values (nodesize and sectorsize) are always aligned
inside the btrfs_super_block, so it won't trigger unaligned read errors,
just endian problems.

Fix them by using the native cached members instead.

Fixes: df93589a1737 ("btrfs: export more from FS_INFO to sysfs")
CC: stable@vger.kernel.org
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/sysfs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1118,7 +1118,7 @@ static ssize_t btrfs_nodesize_show(struc
 {
 	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
 
-	return sysfs_emit(buf, "%u\n", fs_info->super_copy->nodesize);
+	return sysfs_emit(buf, "%u\n", fs_info->nodesize);
 }
 
 BTRFS_ATTR(, nodesize, btrfs_nodesize_show);
@@ -1128,7 +1128,7 @@ static ssize_t btrfs_sectorsize_show(str
 {
 	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
 
-	return sysfs_emit(buf, "%u\n", fs_info->super_copy->sectorsize);
+	return sysfs_emit(buf, "%u\n", fs_info->sectorsize);
 }
 
 BTRFS_ATTR(, sectorsize, btrfs_sectorsize_show);
@@ -1180,7 +1180,7 @@ static ssize_t btrfs_clone_alignment_sho
 {
 	struct btrfs_fs_info *fs_info = to_fs_info(kobj);
 
-	return sysfs_emit(buf, "%u\n", fs_info->super_copy->sectorsize);
+	return sysfs_emit(buf, "%u\n", fs_info->sectorsize);
 }
 
 BTRFS_ATTR(, clone_alignment, btrfs_clone_alignment_show);



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 106/114] btrfs: fix use-after-free when COWing tree bock and tracing is enabled
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (104 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 105/114] btrfs: sysfs: fix direct super block member reads Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 107/114] btrfs: check folio mapping after unlock in put_file_data() Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, syzbot+8517da8635307182c8a5,
	Qu Wenruo, Filipe Manana, David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Filipe Manana <fdmanana@suse.com>

commit 44f52bbe96dfdbe4aca3818a2534520082a07040 upstream.

When a COWing a tree block, at btrfs_cow_block(), and we have the
tracepoint trace_btrfs_cow_block() enabled and preemption is also enabled
(CONFIG_PREEMPT=y), we can trigger a use-after-free in the COWed extent
buffer while inside the tracepoint code. This is because in some paths
that call btrfs_cow_block(), such as btrfs_search_slot(), we are holding
the last reference on the extent buffer @buf so btrfs_force_cow_block()
drops the last reference on the @buf extent buffer when it calls
free_extent_buffer_stale(buf), which schedules the release of the extent
buffer with RCU. This means that if we are on a kernel with preemption,
the current task may be preempted before calling trace_btrfs_cow_block()
and the extent buffer already released by the time trace_btrfs_cow_block()
is called, resulting in a use-after-free.

Fix this by moving the trace_btrfs_cow_block() from btrfs_cow_block() to
btrfs_force_cow_block() before the COWed extent buffer is freed.
This also has a side effect of invoking the tracepoint in the tree defrag
code, at defrag.c:btrfs_realloc_node(), since btrfs_force_cow_block() is
called there, but this is fine and it was actually missing there.

Reported-by: syzbot+8517da8635307182c8a5@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-btrfs/6759a9b9.050a0220.1ac542.000d.GAE@google.com/
CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/ctree.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -654,6 +654,8 @@ int btrfs_force_cow_block(struct btrfs_t
 			goto error_unlock_cow;
 		}
 	}
+
+	trace_btrfs_cow_block(root, buf, cow);
 	if (unlock_orig)
 		btrfs_tree_unlock(buf);
 	free_extent_buffer_stale(buf);
@@ -710,7 +712,6 @@ int btrfs_cow_block(struct btrfs_trans_h
 {
 	struct btrfs_fs_info *fs_info = root->fs_info;
 	u64 search_start;
-	int ret;
 
 	if (unlikely(test_bit(BTRFS_ROOT_DELETING, &root->state))) {
 		btrfs_abort_transaction(trans, -EUCLEAN);
@@ -751,12 +752,8 @@ int btrfs_cow_block(struct btrfs_trans_h
 	 * Also We don't care about the error, as it's handled internally.
 	 */
 	btrfs_qgroup_trace_subtree_after_cow(trans, root, buf);
-	ret = btrfs_force_cow_block(trans, root, buf, parent, parent_slot,
-				    cow_ret, search_start, 0, nest);
-
-	trace_btrfs_cow_block(root, buf, *cow_ret);
-
-	return ret;
+	return btrfs_force_cow_block(trans, root, buf, parent, parent_slot,
+				     cow_ret, search_start, 0, nest);
 }
 ALLOW_ERROR_INJECTION(btrfs_cow_block, ERRNO);
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 107/114] btrfs: check folio mapping after unlock in put_file_data()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (105 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 106/114] btrfs: fix use-after-free when COWing tree bock and tracing is enabled Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 108/114] btrfs: check folio mapping after unlock in relocate_one_folio() Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Boris Burkov,
	David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Boris Burkov <boris@bur.io>

commit 0fba7be1ca6df2881e68386e5575fe096f33c4ca upstream.

When we call btrfs_read_folio() we get an unlocked folio, so it is possible
for a different thread to concurrently modify folio->mapping. We must
check that this hasn't happened once we do have the lock.

CC: stable@vger.kernel.org # 6.12+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/send.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5291,6 +5291,7 @@ static int put_file_data(struct send_ctx
 		unsigned cur_len = min_t(unsigned, len,
 					 PAGE_SIZE - pg_offset);
 
+again:
 		folio = filemap_lock_folio(mapping, index);
 		if (IS_ERR(folio)) {
 			page_cache_sync_readahead(mapping,
@@ -5323,6 +5324,11 @@ static int put_file_data(struct send_ctx
 				ret = -EIO;
 				break;
 			}
+			if (folio->mapping != mapping) {
+				folio_unlock(folio);
+				folio_put(folio);
+				goto again;
+			}
 		}
 
 		memcpy_from_folio(sctx->send_buf + sctx->send_size, folio,



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 108/114] btrfs: check folio mapping after unlock in relocate_one_folio()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (106 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 107/114] btrfs: check folio mapping after unlock in put_file_data() Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 109/114] Bluetooth: btusb: mediatek: move Bluetooth power off command position Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Boris Burkov,
	David Sterba

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Boris Burkov <boris@bur.io>

commit 3e74859ee35edc33a022c3f3971df066ea0ca6b9 upstream.

When we call btrfs_read_folio() to bring a folio uptodate, we unlock the
folio. The result of that is that a different thread can modify the
mapping (like remove it with invalidate) before we call folio_lock().
This results in an invalid page and we need to try again.

In particular, if we are relocating concurrently with aborting a
transaction, this can result in a crash like the following:

  BUG: kernel NULL pointer dereference, address: 0000000000000000
  PGD 0 P4D 0
  Oops: 0000 [#1] SMP
  CPU: 76 PID: 1411631 Comm: kworker/u322:5
  Workqueue: events_unbound btrfs_reclaim_bgs_work
  RIP: 0010:set_page_extent_mapped+0x20/0xb0
  RSP: 0018:ffffc900516a7be8 EFLAGS: 00010246
  RAX: ffffea009e851d08 RBX: ffffea009e0b1880 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: ffffc900516a7b90 RDI: ffffea009e0b1880
  RBP: 0000000003573000 R08: 0000000000000001 R09: ffff88c07fd2f3f0
  R10: 0000000000000000 R11: 0000194754b575be R12: 0000000003572000
  R13: 0000000003572fff R14: 0000000000100cca R15: 0000000005582fff
  FS:  0000000000000000(0000) GS:ffff88c07fd00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000000 CR3: 000000407d00f002 CR4: 00000000007706f0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  PKRU: 55555554
  Call Trace:
  <TASK>
  ? __die+0x78/0xc0
  ? page_fault_oops+0x2a8/0x3a0
  ? __switch_to+0x133/0x530
  ? wq_worker_running+0xa/0x40
  ? exc_page_fault+0x63/0x130
  ? asm_exc_page_fault+0x22/0x30
  ? set_page_extent_mapped+0x20/0xb0
  relocate_file_extent_cluster+0x1a7/0x940
  relocate_data_extent+0xaf/0x120
  relocate_block_group+0x20f/0x480
  btrfs_relocate_block_group+0x152/0x320
  btrfs_relocate_chunk+0x3d/0x120
  btrfs_reclaim_bgs_work+0x2ae/0x4e0
  process_scheduled_works+0x184/0x370
  worker_thread+0xc6/0x3e0
  ? blk_add_timer+0xb0/0xb0
  kthread+0xae/0xe0
  ? flush_tlb_kernel_range+0x90/0x90
  ret_from_fork+0x2f/0x40
  ? flush_tlb_kernel_range+0x90/0x90
  ret_from_fork_asm+0x11/0x20
  </TASK>

This occurs because cleanup_one_transaction() calls
destroy_delalloc_inodes() which calls invalidate_inode_pages2() which
takes the folio_lock before setting mapping to NULL. We fail to check
this, and subsequently call set_extent_mapping(), which assumes that
mapping != NULL (in fact it asserts that in debug mode)

Note that the "fixes" patch here is not the one that introduced the
race (the very first iteration of this code from 2009) but a more recent
change that made this particular crash happen in practice.

Fixes: e7f1326cc24e ("btrfs: set page extent mapped after read_folio in relocate_one_page")
CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/btrfs/relocation.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2902,6 +2902,7 @@ static int relocate_one_folio(struct rel
 	const bool use_rst = btrfs_need_stripe_tree_update(fs_info, rc->block_group->flags);
 
 	ASSERT(index <= last_index);
+again:
 	folio = filemap_lock_folio(inode->i_mapping, index);
 	if (IS_ERR(folio)) {
 
@@ -2937,6 +2938,11 @@ static int relocate_one_folio(struct rel
 			ret = -EIO;
 			goto release_folio;
 		}
+		if (folio->mapping != inode->i_mapping) {
+			folio_unlock(folio);
+			folio_put(folio);
+			goto again;
+		}
 	}
 
 	/*



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 109/114] Bluetooth: btusb: mediatek: move Bluetooth power off command position
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (107 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 108/114] btrfs: check folio mapping after unlock in relocate_one_folio() Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 110/114] Bluetooth: btusb: mediatek: add callback function in btusb_disconnect Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Chris Lu, Luiz Augusto von Dentz,
	Fedor Pchelkin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Lu <chris.lu@mediatek.com>

commit ad0c6f603bb0b07846fda484c59a176a8cd02838 upstream.

Move MediaTek Bluetooth power off command before releasing
usb ISO interface.

Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Cc: Fedor Pchelkin <boddah8794@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/bluetooth/btusb.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2734,11 +2734,14 @@ static int btusb_mtk_shutdown(struct hci
 {
 	struct btusb_data *data = hci_get_drvdata(hdev);
 	struct btmtk_data *btmtk_data = hci_get_priv(hdev);
+	int ret;
+
+	ret = btmtk_usb_shutdown(hdev);
 
 	if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
 		btusb_mtk_release_iso_intf(data);
 
-	return btmtk_usb_shutdown(hdev);
+	return ret;
 }
 
 #ifdef CONFIG_PM



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 110/114] Bluetooth: btusb: mediatek: add callback function in btusb_disconnect
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (108 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 109/114] Bluetooth: btusb: mediatek: move Bluetooth power off command position Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 111/114] Bluetooth: btusb: mediatek: add intf release flow when usb disconnect Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Chris Lu, Luiz Augusto von Dentz,
	Fedor Pchelkin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Lu <chris.lu@mediatek.com>

commit cea1805f165cdd783dd21f26df957118cb8641b4 upstream.

Add disconnect callback function in btusb_disconnect which is reserved
for vendor specific usage before deregister hci in btusb_disconnect.

Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Cc: Fedor Pchelkin <boddah8794@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/bluetooth/btusb.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -870,6 +870,7 @@ struct btusb_data {
 
 	int (*suspend)(struct hci_dev *hdev);
 	int (*resume)(struct hci_dev *hdev);
+	int (*disconnect)(struct hci_dev *hdev);
 
 	int oob_wake_irq;   /* irq for out-of-band wake-on-bt */
 	unsigned cmd_timeout_cnt;
@@ -4043,6 +4044,9 @@ static void btusb_disconnect(struct usb_
 	if (data->diag)
 		usb_set_intfdata(data->diag, NULL);
 
+	if (data->disconnect)
+		data->disconnect(hdev);
+
 	hci_unregister_dev(hdev);
 
 	if (intf == data->intf) {



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 111/114] Bluetooth: btusb: mediatek: add intf release flow when usb disconnect
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (109 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 110/114] Bluetooth: btusb: mediatek: add callback function in btusb_disconnect Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 112/114] Bluetooth: btusb: mediatek: change the conditions for ISO interface Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Chris Lu, Luiz Augusto von Dentz,
	Fedor Pchelkin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Lu <chris.lu@mediatek.com>

commit 489304e67087abddc2666c5af0159cb95afdcf59 upstream.

MediaTek claim an special usb intr interface for ISO data transmission.
The interface need to be released before unregistering hci device when
usb disconnect. Removing BT usb dongle without properly releasing the
interface may cause Kernel panic while unregister hci device.

Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Cc: Fedor Pchelkin <boddah8794@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/bluetooth/btusb.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2644,9 +2644,9 @@ static void btusb_mtk_claim_iso_intf(str
 	init_usb_anchor(&btmtk_data->isopkt_anchor);
 }
 
-static void btusb_mtk_release_iso_intf(struct btusb_data *data)
+static void btusb_mtk_release_iso_intf(struct hci_dev *hdev)
 {
-	struct btmtk_data *btmtk_data = hci_get_priv(data->hdev);
+	struct btmtk_data *btmtk_data = hci_get_priv(hdev);
 
 	if (btmtk_data->isopkt_intf) {
 		usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
@@ -2662,6 +2662,16 @@ static void btusb_mtk_release_iso_intf(s
 	clear_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags);
 }
 
+static int btusb_mtk_disconnect(struct hci_dev *hdev)
+{
+	/* This function describes the specific additional steps taken by MediaTek
+	 * when Bluetooth usb driver's resume function is called.
+	 */
+	btusb_mtk_release_iso_intf(hdev);
+
+	return 0;
+}
+
 static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
 {
 	struct btusb_data *data = hci_get_drvdata(hdev);
@@ -2679,7 +2689,7 @@ static int btusb_mtk_reset(struct hci_de
 		return err;
 
 	if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
-		btusb_mtk_release_iso_intf(data);
+		btusb_mtk_release_iso_intf(hdev);
 
 	btusb_stop_traffic(data);
 	usb_kill_anchored_urbs(&data->tx_anchor);
@@ -2733,14 +2743,13 @@ static int btusb_mtk_setup(struct hci_de
 
 static int btusb_mtk_shutdown(struct hci_dev *hdev)
 {
-	struct btusb_data *data = hci_get_drvdata(hdev);
 	struct btmtk_data *btmtk_data = hci_get_priv(hdev);
 	int ret;
 
 	ret = btmtk_usb_shutdown(hdev);
 
 	if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
-		btusb_mtk_release_iso_intf(data);
+		btusb_mtk_release_iso_intf(hdev);
 
 	return ret;
 }
@@ -3854,6 +3863,7 @@ static int btusb_probe(struct usb_interf
 		data->recv_acl = btmtk_usb_recv_acl;
 		data->suspend = btmtk_usb_suspend;
 		data->resume = btmtk_usb_resume;
+		data->disconnect = btusb_mtk_disconnect;
 	}
 
 	if (id->driver_info & BTUSB_SWAVE) {



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 112/114] Bluetooth: btusb: mediatek: change the conditions for ISO interface
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (110 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 111/114] Bluetooth: btusb: mediatek: add intf release flow when usb disconnect Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 113/114] ALSA: ump: Shut up truncated string warning Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Chris Lu, Luiz Augusto von Dentz,
	Fedor Pchelkin

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Lu <chris.lu@mediatek.com>

commit defc33b5541e0a7e45cc2d99d72fbe80a597afc5 upstream.

Change conditions for Bluetooth driver claiming and releasing usb
ISO interface for MediaTek ISO data transmission.

Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Cc: Fedor Pchelkin <boddah8794@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/bluetooth/btusb.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2648,7 +2648,7 @@ static void btusb_mtk_release_iso_intf(s
 {
 	struct btmtk_data *btmtk_data = hci_get_priv(hdev);
 
-	if (btmtk_data->isopkt_intf) {
+	if (test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) {
 		usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
 		clear_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags);
 
@@ -2688,8 +2688,8 @@ static int btusb_mtk_reset(struct hci_de
 	if (err < 0)
 		return err;
 
-	if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
-		btusb_mtk_release_iso_intf(hdev);
+	/* Release MediaTek ISO data interface */
+	btusb_mtk_release_iso_intf(hdev);
 
 	btusb_stop_traffic(data);
 	usb_kill_anchored_urbs(&data->tx_anchor);
@@ -2734,22 +2734,22 @@ static int btusb_mtk_setup(struct hci_de
 	btmtk_data->reset_sync = btusb_mtk_reset;
 
 	/* Claim ISO data interface and endpoint */
-	btmtk_data->isopkt_intf = usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM);
-	if (btmtk_data->isopkt_intf)
+	if (!test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) {
+		btmtk_data->isopkt_intf = usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM);
 		btusb_mtk_claim_iso_intf(data);
+	}
 
 	return btmtk_usb_setup(hdev);
 }
 
 static int btusb_mtk_shutdown(struct hci_dev *hdev)
 {
-	struct btmtk_data *btmtk_data = hci_get_priv(hdev);
 	int ret;
 
 	ret = btmtk_usb_shutdown(hdev);
 
-	if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
-		btusb_mtk_release_iso_intf(hdev);
+	/* Release MediaTek iso interface after shutdown */
+	btusb_mtk_release_iso_intf(hdev);
 
 	return ret;
 }



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 113/114] ALSA: ump: Shut up truncated string warning
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (111 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 112/114] Bluetooth: btusb: mediatek: change the conditions for ISO interface Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 15:43 ` [PATCH 6.12 114/114] ALSA: sh: Fix wrong argument order for copy_from_iter() Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, kernel test robot, Takashi Iwai

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit ed990c07af70d286f5736021c6e25d8df6f2f7b0 upstream.

The recent change for the legacy substream name update brought a
compile warning for some compilers due to the nature of snprintf().
Use scnprintf() to shut up the warning since the truncation is
intentional.

Fixes: e29e504e7890 ("ALSA: ump: Indicate the inactive group in legacy substream names")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411300103.FrGuTAYp-lkp@intel.com/
Link: https://patch.msgid.link/20241130090009.19849-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/core/ump.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -1262,9 +1262,9 @@ static void fill_substream_names(struct
 		name = ump->groups[idx].name;
 		if (!*name)
 			name = ump->info.name;
-		snprintf(s->name, sizeof(s->name), "Group %d (%.16s)%s",
-			 idx + 1, name,
-			 ump->groups[idx].active ? "" : " [Inactive]");
+		scnprintf(s->name, sizeof(s->name), "Group %d (%.16s)%s",
+			  idx + 1, name,
+			  ump->groups[idx].active ? "" : " [Inactive]");
 	}
 }
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* [PATCH 6.12 114/114] ALSA: sh: Fix wrong argument order for copy_from_iter()
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (112 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 113/114] ALSA: ump: Shut up truncated string warning Greg Kroah-Hartman
@ 2024-12-30 15:43 ` Greg Kroah-Hartman
  2024-12-30 18:10 ` [PATCH 6.12 000/114] 6.12.8-rc1 review Florian Fainelli
                   ` (10 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-30 15:43 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, patches, kernel test robot, Takashi Iwai

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 66a0a2b0473c39ae85c44628d14e4366fdc0aa0d upstream.

Fix a brown paper bag bug I introduced at converting to the standard
iter helper; the arguments were wrongly passed and have to be
swapped.

Fixes: 9b5f8ee43e48 ("ALSA: sh: Use standard helper for buffer accesses")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202412140019.jat5Dofr-lkp@intel.com/
Link: https://patch.msgid.link/20241220114417.5898-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/sh/sh_dac_audio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -163,7 +163,7 @@ static int snd_sh_dac_pcm_copy(struct sn
 	/* channel is not used (interleaved data) */
 	struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
 
-	if (copy_from_iter(chip->data_buffer + pos, src, count) != count)
+	if (copy_from_iter(chip->data_buffer + pos, count, src) != count)
 		return -EFAULT;
 	chip->buffer_end = chip->data_buffer + pos + count;
 



^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (113 preceding siblings ...)
  2024-12-30 15:43 ` [PATCH 6.12 114/114] ALSA: sh: Fix wrong argument order for copy_from_iter() Greg Kroah-Hartman
@ 2024-12-30 18:10 ` Florian Fainelli
  2024-12-30 19:29 ` Pavel Machek
                   ` (9 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Florian Fainelli @ 2024-12-30 18:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable
  Cc: patches, linux-kernel, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, sudipm.mukherjee, srw, rwarsow,
	conor, hargar, broonie

On 12/30/24 07:41, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h

On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on 
BMIPS_GENERIC:

Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (114 preceding siblings ...)
  2024-12-30 18:10 ` [PATCH 6.12 000/114] 6.12.8-rc1 review Florian Fainelli
@ 2024-12-30 19:29 ` Pavel Machek
  2024-12-30 20:58 ` Shuah Khan
                   ` (8 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Pavel Machek @ 2024-12-30 19:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, linux-kernel, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

Hi!

> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.

CIP testing did not find any problems here (obsvx2 target is down, as
is one of bb targets):

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.12.y

6.6 passes our testing, too:

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.6.y

Tested-by: Pavel Machek (CIP) <pavel@denx.de>

Best regards,
                                                                Pavel

-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (115 preceding siblings ...)
  2024-12-30 19:29 ` Pavel Machek
@ 2024-12-30 20:58 ` Shuah Khan
  2024-12-30 23:57 ` Takeshi Ogasawara
                   ` (7 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Shuah Khan @ 2024-12-30 20:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable
  Cc: patches, linux-kernel, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, sudipm.mukherjee, srw,
	rwarsow, conor, hargar, broonie, Shuah Khan

On 12/30/24 08:41, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

Tested-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (116 preceding siblings ...)
  2024-12-30 20:58 ` Shuah Khan
@ 2024-12-30 23:57 ` Takeshi Ogasawara
  2024-12-31  8:01 ` Muhammad Usama Anjum
                   ` (6 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Takeshi Ogasawara @ 2024-12-30 23:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, linux-kernel, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

Hi Greg

On Tue, Dec 31, 2024 at 12:54 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
>         https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
>         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

6.12.8-rc1 tested.

Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.

Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)

[    0.000000] Linux version 6.12.8-rc1rv
(takeshi@ThinkPadX1Gen10J0764) (gcc (GCC) 14.2.1 20240910, GNU ld (GNU
Binutils) 2.43.0) #1 SMP PREEMPT_DYNAMIC Tue Dec 31 08:05:25 JST 2024

Thanks

Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (117 preceding siblings ...)
  2024-12-30 23:57 ` Takeshi Ogasawara
@ 2024-12-31  8:01 ` Muhammad Usama Anjum
  2025-01-16 12:09   ` Pavel Machek
  2024-12-31  9:00 ` Naresh Kamboju
                   ` (5 subsequent siblings)
  124 siblings, 1 reply; 136+ messages in thread
From: Muhammad Usama Anjum @ 2024-12-31  8:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable
  Cc: Usama.Anjum, patches, linux-kernel, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

On 12/30/24 8:41 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 
> -------------
OVERVIEW

        Builds: 41 passed, 0 failed

    Boot tests: 580 passed, 1 failed

    CI systems: broonie, maestro

REVISION

    Commit
        name: v6.12.7-115-ged0d55fbe89cd
        hash: ed0d55fbe89cd97180e55170f9f3907b2aa5f91d
    Checked out from
        https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y


BUILDS

    No build failures found

BOOT TESTS

    Failures

      arm64:(defconfig)
      -mt8186-corsola-steelix-sku131072
	[    6.051924] Device 'adsp_top' does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.
	[    6.064309] WARNING: CPU: 6 PID: 74 at drivers/base/core.c:2569 device_release+0x170/0x1e8
	https://kcidb.kernelci.org/d/test/test?var-datasource=edquppk2ghfcwc&var-origin=maestro&var-build_architecture=$__all&var-build_config_name=$__all&var-id=maestro:67731b7b423acf18d2654a3c&from=now-100y&to=now&timezone=browser&var-test_path=&var-issue_presence=$__all
      CI system: maestro

See complete and up-to-date report at:

    https://kcidb.kernelci.org/d/revision/revision?orgId=1&var-git_commit_hash=ed0d55fbe89cd97180e55170f9f3907b2aa5f91d&var-patchset_hash=


Tested-by: kernelci.org bot <bot@kernelci.org>

Thanks,
KernelCI team

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (118 preceding siblings ...)
  2024-12-31  8:01 ` Muhammad Usama Anjum
@ 2024-12-31  9:00 ` Naresh Kamboju
  2024-12-31  9:42 ` Markus Reichelt
                   ` (4 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Naresh Kamboju @ 2024-12-31  9:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, linux-kernel, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

On Mon, 30 Dec 2024 at 21:24, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
>         https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
>         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h


Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>

## Build
* kernel: 6.12.8-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: ed0d55fbe89cd97180e55170f9f3907b2aa5f91d
* git describe: v6.12.7-115-ged0d55fbe89c
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.12.y/build/v6.12.7-115-ged0d55fbe89c

## Test Regressions (compared to v6.12.6-161-gc157915828d8)

## Metric Regressions (compared to v6.12.6-161-gc157915828d8)

## Test Fixes (compared to v6.12.6-161-gc157915828d8)

## Metric Fixes (compared to v6.12.6-161-gc157915828d8)

## Test result summary
total: 106218, pass: 84898, fail: 4380, skip: 16940, xfail: 0

## Build Summary
* arc: 6 total, 5 passed, 1 failed
* arm: 143 total, 137 passed, 6 failed
* arm64: 58 total, 56 passed, 2 failed
* i386: 22 total, 19 passed, 3 failed
* mips: 38 total, 33 passed, 5 failed
* parisc: 5 total, 3 passed, 2 failed
* powerpc: 44 total, 40 passed, 4 failed
* riscv: 27 total, 24 passed, 3 failed
* s390: 26 total, 22 passed, 4 failed
* sh: 6 total, 5 passed, 1 failed
* sparc: 5 total, 3 passed, 2 failed
* x86_64: 50 total, 49 passed, 1 failed

## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-rust
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture

--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (119 preceding siblings ...)
  2024-12-31  9:00 ` Naresh Kamboju
@ 2024-12-31  9:42 ` Markus Reichelt
  2024-12-31 19:10   ` Markus Reichelt
  2024-12-31 13:02 ` Harshit Mogalapalli
                   ` (3 subsequent siblings)
  124 siblings, 1 reply; 136+ messages in thread
From: Markus Reichelt @ 2024-12-31  9:42 UTC (permalink / raw)
  To: stable, linux-kernel

* Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.

Hi Greg

6.12.8-rc1 compiles, boots and runs here on x86_64
(AMD Ryzen 5 PRO 4650G, Slackware64-15.0)

Tested-by: Markus Reichelt <lkt+2023@mareichelt.com>

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (120 preceding siblings ...)
  2024-12-31  9:42 ` Markus Reichelt
@ 2024-12-31 13:02 ` Harshit Mogalapalli
  2024-12-31 22:47 ` Ron Economos
                   ` (2 subsequent siblings)
  124 siblings, 0 replies; 136+ messages in thread
From: Harshit Mogalapalli @ 2024-12-31 13:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable
  Cc: patches, linux-kernel, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, sudipm.mukherjee, srw,
	rwarsow, conor, hargar, broonie, Vegard Nossum

Hi Greg,

On 30/12/24 21:11, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.

No problems seen on x86_64 and aarch64 with our testing.

Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>

Thanks,
Harshit

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-31  9:42 ` Markus Reichelt
@ 2024-12-31 19:10   ` Markus Reichelt
  0 siblings, 0 replies; 136+ messages in thread
From: Markus Reichelt @ 2024-12-31 19:10 UTC (permalink / raw)
  To: stable, linux-kernel

* Markus Reichelt <lkt+2023@mareichelt.com> wrote:

> * Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
> > This is the start of the stable review cycle for the 6.12.8 release.
> > There are 114 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> > Anything received after that time might be too late.
> 
> Hi Greg
> 
> 6.12.8-rc1 compiles, boots and runs here on x86_64
> (AMD Ryzen 5 PRO 4650G, Slackware64-15.0)

heads up, there seems to be something wrong with -rc1

on the lappy (Vivobook Go E1504FA) I got this:

[Tue Dec 31 19:47:55 2024] ------------[ cut here ]------------
[Tue Dec 31 19:47:55 2024] workqueue: WQ_MEM_RECLAIM sdma0:drm_sched_run_job_work [gpu_sched] is flushing !WQ_MEM_RECLAIM events:amdgpu_device_delay_enable_gfx_off [amdgpu]
[Tue Dec 31 19:47:55 2024] WARNING: CPU: 5 PID: 1734 at kernel/workqueue.c:3704 check_flush_dependency+0xfa/0x110
[Tue Dec 31 19:47:55 2024] Modules linked in: 8021q garp mrp stp llc qrtr algif_hash algif_skcipher af_alg cmac bnep ipv6 zram uvcvideo uvc videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 btusb videobuf2_common btrtl btintel btbcm videodev btmtk bluetooth mc usbhid joydev intel_rapl_msr snd_soc_acp6x_mach snd_soc_dmic snd_acp6x_pdm_dma snd_ctl_led amdgpu snd_sof_amd_renoir snd_sof_amd_acp snd_sof_pci snd_hda_codec_realtek snd_sof_xtensa_dsp snd_hda_codec_generic snd_hda_scodec_component snd_sof snd_sof_utils snd_hda_codec_hdmi hid_multitouch hid_generic snd_soc_core amdxcp amd_atl drm_exec rtw88_8821ce snd_compress snd_hda_intel gpu_sched rtw88_8821c intel_rapl_common snd_pcm_dmaengine drm_buddy snd_intel_dspcfg rtw88_pci drm_suballoc_helper snd_intel_sdw_acpi snd_hda_codec drm_ttm_helper asus_nb_wmi edac_mce_amd ac97_bus snd_hda_core ttm rtw88_core asus_wmi crct10dif_pclmul crc32_pclmul sparse_keymap evdev wmi_bmof platform_profile mac80211 drm_display_helper snd_hwdep snd_pci_acp6x i2c_hid_acpi ghash_clmulni_intel sha512_ssse3
[Tue Dec 31 19:47:55 2024]  i2c_hid snd_pcm sha256_ssse3 drm_kms_helper hid sha1_ssse3 cfg80211 snd_timer snd_pci_acp5x xhci_pci snd_rn_pci_acp3x drm rapl serio_raw agpgart snd snd_acp_config i2c_algo_bit rfkill snd_soc_acpi xhci_hcd mfd_core snd_pci_acp3x soundcore i2c_piix4 k10temp i2c_smbus i2c_designware_platform tpm_crb tiny_power_button tpm_tis video ccp tpm_tis_core button i2c_designware_core i2c_core amd_pmc wmi loop(O) efivarfs
[Tue Dec 31 19:47:55 2024] CPU: 5 UID: 0 PID: 1734 Comm: kworker/u32:6 Tainted: G           O       6.12.8-rc1-jg71 #1
[Tue Dec 31 19:47:55 2024] Tainted: [O]=OOT_MODULE
[Tue Dec 31 19:47:55 2024] Hardware name: ASUSTeK COMPUTER INC. Vivobook Go E1504FA_E1504FA/E1504FA, BIOS E1504FA.309 12/26/2023
[Tue Dec 31 19:47:55 2024] Workqueue: sdma0 drm_sched_run_job_work [gpu_sched]
[Tue Dec 31 19:47:55 2024] RIP: 0010:check_flush_dependency+0xfa/0x110
[Tue Dec 31 19:47:55 2024] Code: ff ff 49 8b 55 18 48 8d 8b c0 00 00 00 49 89 e8 48 81 c6 c0 00 00 00 48 c7 c7 50 96 e9 92 c6 05 90 35 3d 02 01 e8 66 ab fd ff <0f> 0b e9 21 ff ff ff 80 3d 7e 35 3d 02 00 75 96 e9 4d ff ff ff 90
[Tue Dec 31 19:47:55 2024] RSP: 0018:ffffbf038050bc88 EFLAGS: 00010086
[Tue Dec 31 19:47:55 2024] RAX: 0000000000000000 RBX: ffff9d9040050c00 RCX: 0000000000000000
[Tue Dec 31 19:47:55 2024] RDX: 0000000000000003 RSI: ffffffff92ea9253 RDI: 00000000ffffffff
[Tue Dec 31 19:47:55 2024] RBP: ffffffffc0e8cb00 R08: 0000000000000000 R09: ffffbf038050bb20
[Tue Dec 31 19:47:55 2024] R10: ffffbf038050bb18 R11: ffff9d934e3fffe8 R12: ffff9d9048ef4ec0
[Tue Dec 31 19:47:55 2024] R13: ffff9d9043e0d3c0 R14: 0000000000000001 R15: ffff9d934e733ac0
[Tue Dec 31 19:47:55 2024] FS:  0000000000000000(0000) GS:ffff9d934e880000(0000) knlGS:0000000000000000
[Tue Dec 31 19:47:55 2024] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[Tue Dec 31 19:47:55 2024] CR2: 00007f0e70000020 CR3: 00000003ff244000 CR4: 0000000000350ef0
[Tue Dec 31 19:47:55 2024] Call Trace:
[Tue Dec 31 19:47:55 2024]  <TASK>
[Tue Dec 31 19:47:55 2024]  ? __warn+0x84/0x130
[Tue Dec 31 19:47:55 2024]  ? check_flush_dependency+0xfa/0x110
[Tue Dec 31 19:47:55 2024]  ? report_bug+0x1c3/0x1d0
[Tue Dec 31 19:47:55 2024]  ? srso_return_thunk+0x5/0x5f
[Tue Dec 31 19:47:55 2024]  ? prb_read_valid+0x17/0x20
[Tue Dec 31 19:47:55 2024]  ? handle_bug+0x53/0x90
[Tue Dec 31 19:47:55 2024]  ? exc_invalid_op+0x14/0x70
[Tue Dec 31 19:47:55 2024]  ? asm_exc_invalid_op+0x16/0x20
[Tue Dec 31 19:47:55 2024]  ? __pfx_amdgpu_device_delay_enable_gfx_off+0x10/0x10 [amdgpu]
[Tue Dec 31 19:47:55 2024]  ? check_flush_dependency+0xfa/0x110
[Tue Dec 31 19:47:55 2024]  ? check_flush_dependency+0xfa/0x110
[Tue Dec 31 19:47:55 2024]  __flush_work+0x20a/0x2a0
[Tue Dec 31 19:47:55 2024]  ? srso_return_thunk+0x5/0x5f
[Tue Dec 31 19:47:55 2024]  ? try_to_grab_pending+0xb0/0x1b0
[Tue Dec 31 19:47:55 2024]  ? srso_return_thunk+0x5/0x5f
[Tue Dec 31 19:47:55 2024]  ? __cancel_work+0x39/0x110
[Tue Dec 31 19:47:55 2024]  ? __remove_hrtimer+0x39/0x90
[Tue Dec 31 19:47:55 2024]  cancel_delayed_work_sync+0x62/0x80
[Tue Dec 31 19:47:55 2024]  amdgpu_gfx_off_ctrl+0xa9/0x120 [amdgpu]
[Tue Dec 31 19:47:55 2024]  amdgpu_ring_alloc+0x44/0x60 [amdgpu]
[Tue Dec 31 19:47:55 2024]  amdgpu_ib_schedule+0xe3/0x7b0 [amdgpu]
[Tue Dec 31 19:47:55 2024]  amdgpu_job_run+0x93/0x1f0 [amdgpu]
[Tue Dec 31 19:47:55 2024]  drm_sched_run_job_work+0x23a/0x3c0 [gpu_sched]
[Tue Dec 31 19:47:55 2024]  process_one_work+0x170/0x380
[Tue Dec 31 19:47:55 2024]  worker_thread+0x294/0x3b0
[Tue Dec 31 19:47:55 2024]  ? __pfx_worker_thread+0x10/0x10
[Tue Dec 31 19:47:55 2024]  kthread+0xdd/0x110
[Tue Dec 31 19:47:55 2024]  ? __pfx_kthread+0x10/0x10
[Tue Dec 31 19:47:55 2024]  ret_from_fork+0x30/0x50
[Tue Dec 31 19:47:55 2024]  ? __pfx_kthread+0x10/0x10
[Tue Dec 31 19:47:55 2024]  ret_from_fork_asm+0x1a/0x30
[Tue Dec 31 19:47:55 2024]  </TASK>
[Tue Dec 31 19:47:55 2024] ---[ end trace 0000000000000000 ]---

This doesn't happen with 6.12.7 - I tried reproducing it w/o the OOT module (loop) by booting once without it, to no avail.
hm. Can't do so today, but will check this in more detail eventually.

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (121 preceding siblings ...)
  2024-12-31 13:02 ` Harshit Mogalapalli
@ 2024-12-31 22:47 ` Ron Economos
  2025-01-01  0:34 ` [PATCH 6.12] " Hardik Garg
  2025-01-01 15:33 ` [PATCH 6.12 000/114] " Justin Forbes
  124 siblings, 0 replies; 136+ messages in thread
From: Ron Economos @ 2024-12-31 22:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable
  Cc: patches, linux-kernel, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, f.fainelli, sudipm.mukherjee, srw,
	rwarsow, conor, hargar, broonie

On 12/30/24 07:41, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Built and booted successfully on RISC-V RV64 (HiFive Unmatched).

Tested-by: Ron Economos <re@w6rz.net>


^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (122 preceding siblings ...)
  2024-12-31 22:47 ` Ron Economos
@ 2025-01-01  0:34 ` Hardik Garg
  2025-01-01 15:33 ` [PATCH 6.12 000/114] " Justin Forbes
  124 siblings, 0 replies; 136+ messages in thread
From: Hardik Garg @ 2025-01-01  0:34 UTC (permalink / raw)
  To: gregkh
  Cc: akpm, broonie, conor, f.fainelli, hargar, jonathanh, linux-kernel,
	linux, lkft-triage, patches, patches, pavel, rwarsow, shuah, srw,
	stable, sudipm.mukherjee, torvalds

The kernel builds fine for v6.12.8-rc1 on x86 and arm64 Azure VM.

Tested-by: Hardik Garg <hargar@linux.microsoft.com>




Thanks,
Hardik

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
                   ` (123 preceding siblings ...)
  2025-01-01  0:34 ` [PATCH 6.12] " Hardik Garg
@ 2025-01-01 15:33 ` Justin Forbes
  124 siblings, 0 replies; 136+ messages in thread
From: Justin Forbes @ 2025-01-01 15:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, linux-kernel, torvalds, akpm, linux, shuah,
	patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

On Mon, Dec 30, 2024 at 04:41:57PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 6.12.8 release.
> There are 114 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> or in the git tree and branch at:
> 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h

Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x,
x86_64), and boot tested x86_64. No regressions noted.

Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 000/114] 6.12.8-rc1 review
  2024-12-31  8:01 ` Muhammad Usama Anjum
@ 2025-01-16 12:09   ` Pavel Machek
  0 siblings, 0 replies; 136+ messages in thread
From: Pavel Machek @ 2025-01-16 12:09 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Greg Kroah-Hartman, stable, patches, linux-kernel, torvalds, akpm,
	linux, shuah, patches, lkft-triage, pavel, jonathanh, f.fainelli,
	sudipm.mukherjee, srw, rwarsow, conor, hargar, broonie

[-- Attachment #1: Type: text/plain, Size: 1557 bytes --]

Hi!

> > This is the start of the stable review cycle for the 6.12.8 release.
> > There are 114 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Wed, 01 Jan 2025 15:41:48 +0000.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > 	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.8-rc1.gz
> > or in the git tree and branch at:
> > 	git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
> > and the diffstat can be found below.

> BOOT TESTS
> 
>     Failures
> 
>       arm64:(defconfig)
>       -mt8186-corsola-steelix-sku131072
> 	[    6.051924] Device 'adsp_top' does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.
> 	[    6.064309] WARNING: CPU: 6 PID: 74 at drivers/base/core.c:2569 device_release+0x170/0x1e8
... 
> See complete and up-to-date report at:
> 
>     https://kcidb.kernelci.org/d/revision/revision?orgId=1&var-git_commit_hash=ed0d55fbe89cd97180e55170f9f3907b2aa5f91d&var-patchset_hash=
> 
> Tested-by: kernelci.org bot <bot@kernelci.org>

I believe we usualy don't add "tested-by" tag when we detect failure.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a swap file
  2024-12-30 15:43 ` [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a " Greg Kroah-Hartman
@ 2025-02-06 11:41   ` Koichiro Den
  2025-02-06 14:31     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 136+ messages in thread
From: Koichiro Den @ 2025-02-06 11:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, Qu Wenruo, Filipe Manana, David Sterba

On Mon, Dec 30, 2024 at 04:43:39PM GMT, Greg Kroah-Hartman wrote:
> 6.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Filipe Manana <fdmanana@suse.com>
> 
> commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
> 
> During swap activation we iterate over the extents of a file and we can
> have many thousands of them, so we can end up in a busy loop monopolizing
> a core. Avoid this by doing a voluntary reschedule after processing each
> extent.
> 
> CC: stable@vger.kernel.org # 5.4+
> Reviewed-by: Qu Wenruo <wqu@suse.com>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  fs/btrfs/inode.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct ino
>  			ret = -EAGAIN;
>  			goto out;
>  		}
> +
> +		cond_resched();
>  	}
>  
>  	if (file_extent)
> 
> 

Hi, please let me confirm; is this backport really ok? I mean, should the
cond_resched() be added to btrfs_swap_activate() loop? I was able to
reproduce the same situation:

    $ git rev-parse HEAD
    319addc2ad901dac4d6cc931d77ef35073e0942f
    $ b4 mbox --single-message  c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com
    1 messages in the thread
    Saved ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
    $ patch -p1 < ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
    patching file fs/btrfs/inode.c
    Hunk #1 succeeded at 7117 with fuzz 1 (offset -2961 lines).
    $ git diff
    diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
    index 58ffe78132d9..6fe2ac620464 100644
    --- a/fs/btrfs/inode.c
    +++ b/fs/btrfs/inode.c
    @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
                            ret = -EAGAIN;
                            goto out;
                    }
    +
    +               cond_resched();
            }
    
            if (file_extent)

The same goes for all the other stable branches applied. Sorry if I'm
missing something.

Thanks,

-Koichiro

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a swap file
  2025-02-06 11:41   ` Koichiro Den
@ 2025-02-06 14:31     ` Greg Kroah-Hartman
  2025-02-06 15:21       ` Koichiro Den
  2025-02-06 17:45       ` David Sterba
  0 siblings, 2 replies; 136+ messages in thread
From: Greg Kroah-Hartman @ 2025-02-06 14:31 UTC (permalink / raw)
  To: Koichiro Den; +Cc: stable, patches, Qu Wenruo, Filipe Manana, David Sterba

On Thu, Feb 06, 2025 at 08:41:33PM +0900, Koichiro Den wrote:
> On Mon, Dec 30, 2024 at 04:43:39PM GMT, Greg Kroah-Hartman wrote:
> > 6.12-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Filipe Manana <fdmanana@suse.com>
> > 
> > commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
> > 
> > During swap activation we iterate over the extents of a file and we can
> > have many thousands of them, so we can end up in a busy loop monopolizing
> > a core. Avoid this by doing a voluntary reschedule after processing each
> > extent.
> > 
> > CC: stable@vger.kernel.org # 5.4+
> > Reviewed-by: Qu Wenruo <wqu@suse.com>
> > Signed-off-by: Filipe Manana <fdmanana@suse.com>
> > Signed-off-by: David Sterba <dsterba@suse.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  fs/btrfs/inode.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > --- a/fs/btrfs/inode.c
> > +++ b/fs/btrfs/inode.c
> > @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct ino
> >  			ret = -EAGAIN;
> >  			goto out;
> >  		}
> > +
> > +		cond_resched();
> >  	}
> >  
> >  	if (file_extent)
> > 
> > 
> 
> Hi, please let me confirm; is this backport really ok? I mean, should the
> cond_resched() be added to btrfs_swap_activate() loop? I was able to
> reproduce the same situation:
> 
>     $ git rev-parse HEAD
>     319addc2ad901dac4d6cc931d77ef35073e0942f
>     $ b4 mbox --single-message  c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com
>     1 messages in the thread
>     Saved ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
>     $ patch -p1 < ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
>     patching file fs/btrfs/inode.c
>     Hunk #1 succeeded at 7117 with fuzz 1 (offset -2961 lines).
>     $ git diff
>     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
>     index 58ffe78132d9..6fe2ac620464 100644
>     --- a/fs/btrfs/inode.c
>     +++ b/fs/btrfs/inode.c
>     @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
>                             ret = -EAGAIN;
>                             goto out;
>                     }
>     +
>     +               cond_resched();
>             }
>     
>             if (file_extent)
> 
> The same goes for all the other stable branches applied. Sorry if I'm
> missing something.

Hm, looks like patch messed this up :(

Can you send a revert for the branches that this was wrong on, and then
the correct fix, and I'll be glad to queue them all up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a swap file
  2025-02-06 14:31     ` Greg Kroah-Hartman
@ 2025-02-06 15:21       ` Koichiro Den
  2025-02-06 17:45       ` David Sterba
  1 sibling, 0 replies; 136+ messages in thread
From: Koichiro Den @ 2025-02-06 15:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, Qu Wenruo, Filipe Manana, David Sterba

On Thu, Feb 06, 2025 at 03:31:02PM GMT, Greg Kroah-Hartman wrote:
> On Thu, Feb 06, 2025 at 08:41:33PM +0900, Koichiro Den wrote:
> > On Mon, Dec 30, 2024 at 04:43:39PM GMT, Greg Kroah-Hartman wrote:
> > > 6.12-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Filipe Manana <fdmanana@suse.com>
> > > 
> > > commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
> > > 
> > > During swap activation we iterate over the extents of a file and we can
> > > have many thousands of them, so we can end up in a busy loop monopolizing
> > > a core. Avoid this by doing a voluntary reschedule after processing each
> > > extent.
> > > 
> > > CC: stable@vger.kernel.org # 5.4+
> > > Reviewed-by: Qu Wenruo <wqu@suse.com>
> > > Signed-off-by: Filipe Manana <fdmanana@suse.com>
> > > Signed-off-by: David Sterba <dsterba@suse.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > >  fs/btrfs/inode.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > --- a/fs/btrfs/inode.c
> > > +++ b/fs/btrfs/inode.c
> > > @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct ino
> > >  			ret = -EAGAIN;
> > >  			goto out;
> > >  		}
> > > +
> > > +		cond_resched();
> > >  	}
> > >  
> > >  	if (file_extent)
> > > 
> > > 
> > 
> > Hi, please let me confirm; is this backport really ok? I mean, should the
> > cond_resched() be added to btrfs_swap_activate() loop? I was able to
> > reproduce the same situation:
> > 
> >     $ git rev-parse HEAD
> >     319addc2ad901dac4d6cc931d77ef35073e0942f
> >     $ b4 mbox --single-message  c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com
> >     1 messages in the thread
> >     Saved ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
> >     $ patch -p1 < ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
> >     patching file fs/btrfs/inode.c
> >     Hunk #1 succeeded at 7117 with fuzz 1 (offset -2961 lines).
> >     $ git diff
> >     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> >     index 58ffe78132d9..6fe2ac620464 100644
> >     --- a/fs/btrfs/inode.c
> >     +++ b/fs/btrfs/inode.c
> >     @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
> >                             ret = -EAGAIN;
> >                             goto out;
> >                     }
> >     +
> >     +               cond_resched();
> >             }
> >     
> >             if (file_extent)
> > 
> > The same goes for all the other stable branches applied. Sorry if I'm
> > missing something.
> 
> Hm, looks like patch messed this up :(
> 
> Can you send a revert for the branches that this was wrong on, and then
> the correct fix, and I'll be glad to queue them all up.

Sure, I'll send them later.
Thanks for the quick response!

-Koichiro

> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a swap file
  2025-02-06 14:31     ` Greg Kroah-Hartman
  2025-02-06 15:21       ` Koichiro Den
@ 2025-02-06 17:45       ` David Sterba
  2025-02-07 17:06         ` Koichiro Den
  1 sibling, 1 reply; 136+ messages in thread
From: David Sterba @ 2025-02-06 17:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Koichiro Den, stable, patches, Qu Wenruo, Filipe Manana,
	David Sterba

On Thu, Feb 06, 2025 at 03:31:02PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Feb 06, 2025 at 08:41:33PM +0900, Koichiro Den wrote:
> > On Mon, Dec 30, 2024 at 04:43:39PM GMT, Greg Kroah-Hartman wrote:
> > > 
> > 
> > Hi, please let me confirm; is this backport really ok? I mean, should the
> > cond_resched() be added to btrfs_swap_activate() loop? I was able to
> > reproduce the same situation:
> > 
> >     $ git rev-parse HEAD
> >     319addc2ad901dac4d6cc931d77ef35073e0942f
> >     $ b4 mbox --single-message  c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com
> >     1 messages in the thread
> >     Saved ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
> >     $ patch -p1 < ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
> >     patching file fs/btrfs/inode.c
> >     Hunk #1 succeeded at 7117 with fuzz 1 (offset -2961 lines).
> >     $ git diff
> >     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> >     index 58ffe78132d9..6fe2ac620464 100644
> >     --- a/fs/btrfs/inode.c
> >     +++ b/fs/btrfs/inode.c
> >     @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
> >                             ret = -EAGAIN;
> >                             goto out;
> >                     }
> >     +
> >     +               cond_resched();
> >             }
> >     
> >             if (file_extent)
> > 
> > The same goes for all the other stable branches applied. Sorry if I'm
> > missing something.
> 
> Hm, looks like patch messed this up :(

The fix is part of 4 patch series. The stable tree 6.12 has only 3 and
in different order, so this one fails to apply due to missing context
and got applied to the wrong function.

Applying all 4 in order to 6.12.y (same base commit f6279a98db132da0cff)
works without conflicts.

$ git cherry-pick 0525064bb82e50d59543b62b9d41a606198a4a44
Auto-merging fs/btrfs/inode.c
[detached HEAD 0466e0dbbb99] btrfs: fix race with memory mapped writes when activating swap file
 Author: Filipe Manana <fdmanana@suse.com>
 Date: Fri Nov 29 12:25:30 2024 +0000
 1 file changed, 24 insertions(+), 7 deletions(-)

$ git cherry-pick 03018e5d8508254534511d40fb57bc150e6a87f2
Auto-merging fs/btrfs/inode.c
[detached HEAD 1715e6abcf46] btrfs: fix swap file activation failure due to extents that used to be shared
 Author: Filipe Manana <fdmanana@suse.com>
 Date: Mon Dec 9 12:54:14 2024 +0000
 1 file changed, 69 insertions(+), 27 deletions(-)

$ git cherry-pick 9a45022a0efadd99bcc58f7f1cc2b6fb3b808c40
Auto-merging fs/btrfs/inode.c
[detached HEAD 78d50f8c8827] btrfs: allow swap activation to be interruptible
 Author: Filipe Manana <fdmanana@suse.com>
 Date: Mon Dec 9 16:31:41 2024 +0000
 1 file changed, 5 insertions(+)

$ git cherry-pick 2c8507c63f5498d4ee4af404a8e44ceae4345056
Auto-merging fs/btrfs/inode.c
[detached HEAD a162d2371965] btrfs: avoid monopolizing a core when activating a swap file
 Author: Filipe Manana <fdmanana@suse.com>
 Date: Mon Dec 9 16:43:44 2024 +0000
 1 file changed, 2 insertions(+)

I have more trust in git patch logic than 'patch', this can happen in the
future again.

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a swap file
  2025-02-06 17:45       ` David Sterba
@ 2025-02-07 17:06         ` Koichiro Den
  0 siblings, 0 replies; 136+ messages in thread
From: Koichiro Den @ 2025-02-07 17:06 UTC (permalink / raw)
  To: David Sterba
  Cc: Greg Kroah-Hartman, stable, patches, Qu Wenruo, Filipe Manana,
	David Sterba

On Thu, Feb 06, 2025 at 06:45:42PM GMT, David Sterba wrote:
> On Thu, Feb 06, 2025 at 03:31:02PM +0100, Greg Kroah-Hartman wrote:
> > On Thu, Feb 06, 2025 at 08:41:33PM +0900, Koichiro Den wrote:
> > > On Mon, Dec 30, 2024 at 04:43:39PM GMT, Greg Kroah-Hartman wrote:
> > > > 
> > > 
> > > Hi, please let me confirm; is this backport really ok? I mean, should the
> > > cond_resched() be added to btrfs_swap_activate() loop? I was able to
> > > reproduce the same situation:
> > > 
> > >     $ git rev-parse HEAD
> > >     319addc2ad901dac4d6cc931d77ef35073e0942f
> > >     $ b4 mbox --single-message  c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com
> > >     1 messages in the thread
> > >     Saved ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
> > >     $ patch -p1 < ./c37ea7a8de12e996091ba295b2f201fbe680c96c.1733929328.git.fdmanana@suse.com.mbx
> > >     patching file fs/btrfs/inode.c
> > >     Hunk #1 succeeded at 7117 with fuzz 1 (offset -2961 lines).
> > >     $ git diff
> > >     diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> > >     index 58ffe78132d9..6fe2ac620464 100644
> > >     --- a/fs/btrfs/inode.c
> > >     +++ b/fs/btrfs/inode.c
> > >     @@ -7117,6 +7117,8 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
> > >                             ret = -EAGAIN;
> > >                             goto out;
> > >                     }
> > >     +
> > >     +               cond_resched();
> > >             }
> > >     
> > >             if (file_extent)
> > > 
> > > The same goes for all the other stable branches applied. Sorry if I'm
> > > missing something.
> > 
> > Hm, looks like patch messed this up :(
> 
> The fix is part of 4 patch series. The stable tree 6.12 has only 3 and
> in different order, so this one fails to apply due to missing context
> and got applied to the wrong function.
> 
> Applying all 4 in order to 6.12.y (same base commit f6279a98db132da0cff)
> works without conflicts.
> 
> $ git cherry-pick 0525064bb82e50d59543b62b9d41a606198a4a44
> Auto-merging fs/btrfs/inode.c
> [detached HEAD 0466e0dbbb99] btrfs: fix race with memory mapped writes when activating swap file
>  Author: Filipe Manana <fdmanana@suse.com>
>  Date: Fri Nov 29 12:25:30 2024 +0000
>  1 file changed, 24 insertions(+), 7 deletions(-)
> 
> $ git cherry-pick 03018e5d8508254534511d40fb57bc150e6a87f2
> Auto-merging fs/btrfs/inode.c
> [detached HEAD 1715e6abcf46] btrfs: fix swap file activation failure due to extents that used to be shared
>  Author: Filipe Manana <fdmanana@suse.com>
>  Date: Mon Dec 9 12:54:14 2024 +0000
>  1 file changed, 69 insertions(+), 27 deletions(-)
> 
> $ git cherry-pick 9a45022a0efadd99bcc58f7f1cc2b6fb3b808c40
> Auto-merging fs/btrfs/inode.c
> [detached HEAD 78d50f8c8827] btrfs: allow swap activation to be interruptible
>  Author: Filipe Manana <fdmanana@suse.com>
>  Date: Mon Dec 9 16:31:41 2024 +0000
>  1 file changed, 5 insertions(+)
> 
> $ git cherry-pick 2c8507c63f5498d4ee4af404a8e44ceae4345056
> Auto-merging fs/btrfs/inode.c
> [detached HEAD a162d2371965] btrfs: avoid monopolizing a core when activating a swap file
>  Author: Filipe Manana <fdmanana@suse.com>
>  Date: Mon Dec 9 16:43:44 2024 +0000
>  1 file changed, 2 insertions(+)
> 
> I have more trust in git patch logic than 'patch', this can happen in the
> future again.

As a side node, I just recently observed a quite similar pattern elsewhere.
Unfortunately, by the time I discovered it, the 6.11.y had already reached
EOL, so I didn't have an opportunity to report it for fixing.

The following upstream commits landed in the stable queue and were applied to 6.11.y
in reverse order (i.e. applied as #2 then #1):
#1. f3fe8c52c580 ("iio: adc: ti-lmp92064: add missing select REGMAP_SPI in Kconfig")
#2. a985576af824 ("iio: adc: ti-lmp92064: add missing select IIO_(TRIGGERED_)BUFFER in Kconfig")

that appears to have resulted in the backport for #2 being broken.
(see https://lore.kernel.org/stable/20241021102302.767569469@linuxfoundation.org/)
Since there seems no "FAILED to apply" announcement, I assume this was
handled by normal patch(1) usage. Just as an extra side note, #2 seems to
have been applied twice on the branch.

So, even though the patch reordering and patch application strategy are
essentially seperate issues, I tend to agree that when the latter causes
problems, it sometimes indicates that an issue with the former is lurking.

Thanks,
Koichiro

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset
  2024-12-30 15:42 ` [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset Greg Kroah-Hartman
@ 2025-02-09 13:28   ` Aurelien Jarno
  2025-02-11 10:29     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 136+ messages in thread
From: Aurelien Jarno @ 2025-02-09 13:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, FUKAUMI Naoki, Michael Zimmermann, Chukun Pan,
	Heiko Stuebner, Vinod Koul

On 2024-12-30 16:42, Greg Kroah-Hartman wrote:
> 6.12-stable review patch.  If anyone has any objections, please let me know.

It probably comes a bit late, but this patch broke usb and pcie on
rk356x. The other commit from the same series, commit 8b9c12757f91
("arm64: dts: rockchip: add reset-names for combphy on rk3568"), also
needs to be backported.

Regards
Aurelien

> ------------------
> 
> From: Chukun Pan <amadeus@jmu.edu.cn>
> 
> commit fbcbffbac994aca1264e3c14da96ac9bfd90466e upstream.
> 
> Currently, the USB port via combophy on the RK3528/RK3588 SoC is broken.
> 
>   usb usb8-port1: Cannot enable. Maybe the USB cable is bad?
> 
> This is due to the combphy of RK3528/RK3588 SoC has multiple resets, but
> only "phy resets" need assert and deassert, "apb resets" don't need.
> So change the driver to only match the phy resets, which is also what
> the vendor kernel does.
> 
> Fixes: 7160820d742a ("phy: rockchip: add naneng combo phy for RK3568")
> Cc: FUKAUMI Naoki <naoki@radxa.com>
> Cc: Michael Zimmermann <sigmaepsilon92@gmail.com>
> Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> Tested-by: FUKAUMI Naoki <naoki@radxa.com>
> Link: https://lore.kernel.org/r/20241122073006.99309-2-amadeus@jmu.edu.cn
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/phy/rockchip/phy-rockchip-naneng-combphy.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
> +++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
> @@ -309,7 +309,7 @@ static int rockchip_combphy_parse_dt(str
>  
>  	priv->ext_refclk = device_property_present(dev, "rockchip,ext-refclk");
>  
> -	priv->phy_rst = devm_reset_control_array_get_exclusive(dev);
> +	priv->phy_rst = devm_reset_control_get(dev, "phy");
>  	if (IS_ERR(priv->phy_rst))
>  		return dev_err_probe(dev, PTR_ERR(priv->phy_rst), "failed to get phy reset\n");
>  
> 
> 

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset
  2025-02-09 13:28   ` Aurelien Jarno
@ 2025-02-11 10:29     ` Greg Kroah-Hartman
  2025-02-11 22:18       ` Aurelien Jarno
  0 siblings, 1 reply; 136+ messages in thread
From: Greg Kroah-Hartman @ 2025-02-11 10:29 UTC (permalink / raw)
  To: Aurelien Jarno
  Cc: stable, patches, FUKAUMI Naoki, Michael Zimmermann, Chukun Pan,
	Heiko Stuebner, Vinod Koul

On Sun, Feb 09, 2025 at 02:28:34PM +0100, Aurelien Jarno wrote:
> On 2024-12-30 16:42, Greg Kroah-Hartman wrote:
> > 6.12-stable review patch.  If anyone has any objections, please let me know.
> 
> It probably comes a bit late, but this patch broke usb and pcie on
> rk356x. The other commit from the same series, commit 8b9c12757f91
> ("arm64: dts: rockchip: add reset-names for combphy on rk3568"), also
> needs to be backported.

That commit does not apply, can you please provide a working backport
for us to queue up?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 136+ messages in thread

* Re: [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset
  2025-02-11 10:29     ` Greg Kroah-Hartman
@ 2025-02-11 22:18       ` Aurelien Jarno
  0 siblings, 0 replies; 136+ messages in thread
From: Aurelien Jarno @ 2025-02-11 22:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, FUKAUMI Naoki, Michael Zimmermann, Chukun Pan,
	Heiko Stuebner, Vinod Koul

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

Hi Greg,

On 2025-02-11 11:29, Greg Kroah-Hartman wrote:
> On Sun, Feb 09, 2025 at 02:28:34PM +0100, Aurelien Jarno wrote:
> > On 2024-12-30 16:42, Greg Kroah-Hartman wrote:
> > > 6.12-stable review patch.  If anyone has any objections, please let me know.
> > 
> > It probably comes a bit late, but this patch broke usb and pcie on
> > rk356x. The other commit from the same series, commit 8b9c12757f91
> > ("arm64: dts: rockchip: add reset-names for combphy on rk3568"), also
> > needs to be backported.
> 
> That commit does not apply, can you please provide a working backport
> for us to queue up?

That sounds strange, it applies fine against v6.12.13 here, and I do not
see any changes to the two files it modifies in queue-6.12.

Anyway please find a backport attached, i can also send it directly to
the list if you prefer.

Thanks
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

[-- Attachment #2: 0001-arm64-dts-rockchip-add-reset-names-for-combphy-on-rk.patch --]
[-- Type: text/x-diff, Size: 2182 bytes --]

From e04594d6a86171593ede97987c9f99bfe51a74de Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Fri, 22 Nov 2024 15:30:05 +0800
Subject: [PATCH] arm64: dts: rockchip: add reset-names for combphy on rk3568

commit 8b9c12757f919157752646faf3821abf2b7d2a64 upstream.

The reset-names of combphy are missing, add it.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Fixes: fd3ac6e80497 ("dt-bindings: phy: rockchip: rk3588 has two reset lines")
Link: https://lore.kernel.org/r/20241122073006.99309-1-amadeus@jmu.edu.cn
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 arch/arm64/boot/dts/rockchip/rk3568.dtsi | 1 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3568.dtsi b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
index 0946310e8c124..6fd67ae271174 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi
@@ -262,6 +262,7 @@ combphy0: phy@fe820000 {
 		assigned-clocks = <&pmucru CLK_PCIEPHY0_REF>;
 		assigned-clock-rates = <100000000>;
 		resets = <&cru SRST_PIPEPHY0>;
+		reset-names = "phy";
 		rockchip,pipe-grf = <&pipegrf>;
 		rockchip,pipe-phy-grf = <&pipe_phy_grf0>;
 		#phy-cells = <1>;
diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
index 0ee0ada6f0ab0..bc0f57a26c2ff 100644
--- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
@@ -1762,6 +1762,7 @@ combphy1: phy@fe830000 {
 		assigned-clocks = <&pmucru CLK_PCIEPHY1_REF>;
 		assigned-clock-rates = <100000000>;
 		resets = <&cru SRST_PIPEPHY1>;
+		reset-names = "phy";
 		rockchip,pipe-grf = <&pipegrf>;
 		rockchip,pipe-phy-grf = <&pipe_phy_grf1>;
 		#phy-cells = <1>;
@@ -1778,6 +1779,7 @@ combphy2: phy@fe840000 {
 		assigned-clocks = <&pmucru CLK_PCIEPHY2_REF>;
 		assigned-clock-rates = <100000000>;
 		resets = <&cru SRST_PIPEPHY2>;
+		reset-names = "phy";
 		rockchip,pipe-grf = <&pipegrf>;
 		rockchip,pipe-phy-grf = <&pipe_phy_grf2>;
 		#phy-cells = <1>;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 136+ messages in thread

end of thread, other threads:[~2025-02-11 22:18 UTC | newest]

Thread overview: 136+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 15:41 [PATCH 6.12 000/114] 6.12.8-rc1 review Greg Kroah-Hartman
2024-12-30 15:41 ` [PATCH 6.12 001/114] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
2024-12-30 15:41 ` [PATCH 6.12 002/114] ceph: allocate sparse_ext map only for sparse reads Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 003/114] arm64: dts: broadcom: Fix L2 linesize for Raspberry Pi 5 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 004/114] bpf: Fix bpf_get_smp_processor_id() on !CONFIG_SMP Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 005/114] fork: avoid inappropriate uprobe access to invalid mm Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 006/114] mm/vmstat: fix a W=1 clang compiler warning Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 007/114] selftests/bpf: Fix compilation error in get_uprobe_offset() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 008/114] smb: client: Deduplicate "select NETFS_SUPPORT" in Kconfig Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 009/114] smb: fix bytes written value in /proc/fs/cifs/Stats Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 010/114] tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 011/114] tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 012/114] bpf: Check negative offsets in __bpf_skb_min_len() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 013/114] nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work" Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 014/114] nfsd: restore callback functionality for NFSv4.0 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 015/114] mtd: diskonchip: Cast an operand to prevent potential overflow Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 016/114] mtd: rawnand: arasan: Fix double assertion of chip-select Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 017/114] mtd: rawnand: arasan: Fix missing de-registration of NAND Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 018/114] phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 019/114] phy: core: Fix an OF node refcount leakage in _of_phy_get() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 020/114] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 021/114] phy: core: Fix that API devm_phy_put() fails to release the phy Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 022/114] phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 023/114] phy: core: Fix that API devm_phy_destroy() fails to destroy the phy Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 024/114] phy: usb: Toggle the PHY power during init Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 025/114] phy: rockchip: samsung-hdptx: Set drvdata before enabling runtime PM Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 026/114] phy: rockchip: naneng-combphy: fix phy reset Greg Kroah-Hartman
2025-02-09 13:28   ` Aurelien Jarno
2025-02-11 10:29     ` Greg Kroah-Hartman
2025-02-11 22:18       ` Aurelien Jarno
2024-12-30 15:42 ` [PATCH 6.12 027/114] ALSA: memalloc: prefer dma_mapping_error() over explicit address checking Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 028/114] dmaengine: mv_xor: fix child node refcount handling in early exit Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 029/114] dmaengine: dw: Select only supported masters for ACPI devices Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 030/114] dmaengine: tegra: Return correct DMA status when paused Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 031/114] dmaengine: amd: qdma: Remove using the private get and set dma_ops APIs Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 032/114] dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 033/114] dmaengine: apple-admac: Avoid accessing registers in probe Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 034/114] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 035/114] ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 036/114] platform/chrome: cros_ec_lpc: fix product identity for early Framework Laptops Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 037/114] mtd: rawnand: fix double free in atmel_pmecc_create_user() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 038/114] ASoC: amd: ps: Fix for enabling DMIC on acp63 platform via _DSD entry Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 039/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21QA and 21QB Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 040/114] ASoC: dt-bindings: realtek,rt5645: Fix CPVDD voltage comment Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 041/114] ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21Q6 and 21Q7 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 042/114] powerpc/pseries/vas: Add close() callback in vas_vm_ops struct Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 043/114] power: supply: bq24190: Fix BQ24296 Vbus regulator support Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 044/114] stddef: make __struct_group() UAPI C++-friendly Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 045/114] tracing/kprobe: Make trace_kprobes module callback called after jump_label update Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 046/114] watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 047/114] watchdog: rzg2l_wdt: Power on the watchdog domain in the restart handler Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 048/114] Revert "watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs" Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 049/114] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 050/114] scsi: qla1280: Fix hw revision numbering for ISP1020/1040 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 051/114] scsi: megaraid_sas: Fix for a potential deadlock Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 052/114] udf: Skip parent dir link count update if corrupted Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 053/114] udf: Verify inode link counts before performing rename Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 054/114] ALSA: ump: Dont open legacy substream for an inactive group Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 055/114] ALSA: ump: Indicate the inactive group in legacy substream names Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 056/114] ALSA: ump: Update legacy substream names upon FB info update Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 057/114] ALSA: hda/conexant: fix Z60MR100 startup pop issue Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 058/114] ALSA: sh: Use standard helper for buffer accesses Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 059/114] smb: server: Fix building with GCC 15 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 060/114] regmap: Use correct format specifier for logging range errors Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 061/114] LoongArch: Fix reserving screen info memory for above-4G firmware Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.12 062/114] LoongArch: BPF: Adjust the parameter of emit_jirl() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 063/114] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 064/114] bpf: Zero index arg error string for dynptr and iter Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 065/114] spi: intel: Add Panther Lake SPI controller support Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 066/114] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 067/114] scsi: mpi3mr: Synchronize access to ioctl data buffer Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 068/114] scsi: mpi3mr: Fix corrupt config pages PHY state is switched in sysfs Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 069/114] scsi: mpi3mr: Start controller indexing from 0 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 070/114] scsi: mpi3mr: Handling of fault code for insufficient power Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 071/114] scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 072/114] ACPI/IORT: Add PMCG platform information for HiSilicon HIP09A Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 073/114] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 074/114] drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 075/114] virtio-blk: dont keep queue frozen during system suspend Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 076/114] blk-mq: register cpuhp callback after hctx is added to xarray table Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 077/114] wifi: iwlwifi: be less noisy if the NIC is dead in S3 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 078/114] ublk: detach gendisk from ublk device if add_disk() fails Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 079/114] drm/xe: Take PM ref in delayed snapshot capture worker Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 080/114] drm/xe: Move the coredump registration to the worker thread Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 081/114] objtool: Add bch2_trans_unlocked_error() to bcachefs noreturns Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 082/114] freezer, sched: Report frozen tasks as D instead of R Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 083/114] dmaengine: loongson2-apb: Change GENMASK to GENMASK_ULL Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 084/114] perf/x86/intel/uncore: Add Clearwater Forest support Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 085/114] tracing: Constify string literal data member in struct trace_event_call Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 086/114] tracing: Prevent bad count for tracing_cpumask_write Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 087/114] rtla/timerlat: Fix histogram ALL for zero samples Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 088/114] io_uring/sqpoll: fix sqpoll error handling races Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 089/114] i2c: microchip-core: actually use repeated sends Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 090/114] x86/fred: Clear WFE in missing-ENDBRANCH #CPs Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 091/114] virt: tdx-guest: Just leak decrypted memory on unrecoverable errors Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 092/114] PCI/MSI: Handle lack of irqdomain gracefully Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 093/114] perf/x86/intel: Fix bitmask of OCR and FRONTEND events for LNC Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 094/114] i2c: imx: add imx7d compatible string for applying erratum ERR007805 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 095/114] i2c: microchip-core: fix "ghost" detections Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 096/114] perf/x86/intel/ds: Add PEBS format 6 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 097/114] power: supply: cros_charge-control: add mutex for driver data Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 098/114] power: supply: cros_charge-control: allow start_threshold == end_threshold Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 099/114] power: supply: cros_charge-control: hide start threshold on v2 cmd Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 100/114] power: supply: gpio-charger: Fix set charge current limits Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 101/114] btrfs: fix race with memory mapped writes when activating swap file Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 102/114] btrfs: avoid monopolizing a core when activating a " Greg Kroah-Hartman
2025-02-06 11:41   ` Koichiro Den
2025-02-06 14:31     ` Greg Kroah-Hartman
2025-02-06 15:21       ` Koichiro Den
2025-02-06 17:45       ` David Sterba
2025-02-07 17:06         ` Koichiro Den
2024-12-30 15:43 ` [PATCH 6.12 103/114] btrfs: fix swap file activation failure due to extents that used to be shared Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 104/114] btrfs: fix transaction atomicity bug when enabling simple quotas Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 105/114] btrfs: sysfs: fix direct super block member reads Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 106/114] btrfs: fix use-after-free when COWing tree bock and tracing is enabled Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 107/114] btrfs: check folio mapping after unlock in put_file_data() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 108/114] btrfs: check folio mapping after unlock in relocate_one_folio() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 109/114] Bluetooth: btusb: mediatek: move Bluetooth power off command position Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 110/114] Bluetooth: btusb: mediatek: add callback function in btusb_disconnect Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 111/114] Bluetooth: btusb: mediatek: add intf release flow when usb disconnect Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 112/114] Bluetooth: btusb: mediatek: change the conditions for ISO interface Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 113/114] ALSA: ump: Shut up truncated string warning Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.12 114/114] ALSA: sh: Fix wrong argument order for copy_from_iter() Greg Kroah-Hartman
2024-12-30 18:10 ` [PATCH 6.12 000/114] 6.12.8-rc1 review Florian Fainelli
2024-12-30 19:29 ` Pavel Machek
2024-12-30 20:58 ` Shuah Khan
2024-12-30 23:57 ` Takeshi Ogasawara
2024-12-31  8:01 ` Muhammad Usama Anjum
2025-01-16 12:09   ` Pavel Machek
2024-12-31  9:00 ` Naresh Kamboju
2024-12-31  9:42 ` Markus Reichelt
2024-12-31 19:10   ` Markus Reichelt
2024-12-31 13:02 ` Harshit Mogalapalli
2024-12-31 22:47 ` Ron Economos
2025-01-01  0:34 ` [PATCH 6.12] " Hardik Garg
2025-01-01 15:33 ` [PATCH 6.12 000/114] " Justin Forbes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).