6.12.30-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 6.12.30-rc1 review
This is the start of the stable review cycle for the 6.12.30 release. There are 143 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 Thu, 22 May 2025 12:57:37 +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.30-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 <[email protected]>
Linux 6.12.30-rc1
Alex Deucher <[email protected]>
drm/amdgpu: fix pm notifier handling
Dan Carpenter <[email protected]>
phy: tegra: xusb: remove a stray unlock
Andrei Kuchynski <[email protected]>
usb: typec: ucsi: displayport: Fix deadlock
Fabio Estevam <[email protected]>
drm/tiny: panel-mipi-dbi: Use drm_client_setup_with_fourcc()
Thomas Zimmermann <[email protected]>
drm/panel-mipi-dbi: Run DRM default client setup
Thomas Zimmermann <[email protected]>
drm/fbdev-dma: Support struct drm_driver.fbdev_probe
Neeraj Sanjay Kale <[email protected]>
Bluetooth: btnxpuart: Fix kernel panic during FW release
Luca Ceresoli <[email protected]>
iio: light: opt3001: fix deadlock due to concurrent flag access
Jacek Lawrynowicz <[email protected]>
accel/ivpu: Fix fw log printing
Jacek Lawrynowicz <[email protected]>
accel/ivpu: Refactor functions in ivpu_fw_log.c
Tomasz Rusinowicz <[email protected]>
accel/ivpu: Reset fw log on cold boot
Jacek Lawrynowicz <[email protected]>
accel/ivpu: Rename ivpu_log_level to fw_log_level
Kirill A. Shutemov <[email protected]>
mm/page_alloc: fix race condition in unaccepted memory handling
Daniele Ceraolo Spurio <[email protected]>
drm/xe/gsc: do not flush the GSC worker from the reset path
Ritvik Budhiraja <[email protected]>
CIFS: New mount option for cifs.upcall namespace resolution
Shuai Xue <[email protected]>
dmaengine: idxd: Refactor remove call with idxd_cleanup() helper
Shuai Xue <[email protected]>
dmaengine: idxd: fix memory leak in error handling path of idxd_pci_probe
Shuai Xue <[email protected]>
dmaengine: idxd: fix memory leak in error handling path of idxd_alloc
Shuai Xue <[email protected]>
dmaengine: idxd: Add missing idxd cleanup to fix memory leak in remove call
Shuai Xue <[email protected]>
dmaengine: idxd: Add missing cleanups in cleanup internals
Shuai Xue <[email protected]>
dmaengine: idxd: Add missing cleanup for early error out in idxd_setup_internals
Shuai Xue <[email protected]>
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_groups
Shuai Xue <[email protected]>
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_engines
Shuai Xue <[email protected]>
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs
Yemike Abhilash Chandra <[email protected]>
dmaengine: ti: k3-udma: Use cap_mask directly from dma_device structure instead of a local copy
Ronald Wahl <[email protected]>
dmaengine: ti: k3-udma: Add missing locking
Barry Song <[email protected]>
mm: userfaultfd: correct dirty flags set for both present and swap pte
Nathan Chancellor <[email protected]>
net: qede: Initialize qede_ll_ops with designated initializer
Steven Rostedt <[email protected]>
ring-buffer: Fix persistent buffer when commit page is the reader page
Fedor Pchelkin <[email protected]>
wifi: mt76: disable napi on driver removal
Jarkko Sakkinen <[email protected]>
tpm: Mask TPM RC in tpm2_start_auth_session()
Aaron Kling <[email protected]>
spi: tegra114: Use value to check for invalid delays
Jethro Donaldson <[email protected]>
smb: client: fix memory leak during error handling for POSIX mkdir
Steve Siwinski <[email protected]>
scsi: sd_zbc: block: Respect bio vector limits for REPORT ZONES buffer
Claudiu Beznea <[email protected]>
phy: renesas: rcar-gen3-usb2: Set timing registers only once
Claudiu Beznea <[email protected]>
phy: renesas: rcar-gen3-usb2: Fix role detection on unbind/bind
Ma Ke <[email protected]>
phy: Fix error handling in tegra_xusb_port_init
Wayne Chang <[email protected]>
phy: tegra: xusb: Use a bitmask for UTMI pad power state tracking
Steven Rostedt <[email protected]>
tracing: samples: Initialize trace_array_printk() with the correct function
pengdonglin <[email protected]>
ftrace: Fix preemption accounting for stacktrace filter command
pengdonglin <[email protected]>
ftrace: Fix preemption accounting for stacktrace trigger command
Nathan Chancellor <[email protected]>
kbuild: Disable -Wdefault-const-init-unsafe
Michael Kelley <[email protected]>
Drivers: hv: vmbus: Remove vmbus_sendpacket_pagebuffer()
Michael Kelley <[email protected]>
Drivers: hv: Allow vmbus_sendpacket_mpb_desc() to create multiple ranges
Dragan Simic <[email protected]>
arm64: dts: rockchip: Remove overdrive-mode OPPs from RK3588J SoC dtsi
Christian Hewitt <[email protected]>
arm64: dts: amlogic: dreambox: fix missing clkc_audio node
Michael Kelley <[email protected]>
hv_netvsc: Remove rmsg_pgcnt
Michael Kelley <[email protected]>
hv_netvsc: Preserve contiguous PFN grouping in the page buffer array
Michael Kelley <[email protected]>
hv_netvsc: Use vmbus_sendpacket_mpb_desc() to send VMBus messages
Hyejeong Choi <[email protected]>
dma-buf: insert memory barrier before updating num_fences
Nicolas Chauvet <[email protected]>
ALSA: usb-audio: Add sample rate quirk for Microdia JP001 USB Camera
Christian Heusel <[email protected]>
ALSA: usb-audio: Add sample rate quirk for Audioengine D1
Wentao Liang <[email protected]>
ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
Jeremy Linton <[email protected]>
ACPI: PPTT: Fix processor subtable walk
Emanuele Ghidoli <[email protected]>
gpio: pca953x: fix IRQ storm on system wake up
Alexey Makhalov <[email protected]>
MAINTAINERS: Update Alexey Makhalov's email address
Wayne Lin <[email protected]>
drm/amd/display: Avoid flooding unnecessary info messages
Wayne Lin <[email protected]>
drm/amd/display: Correct the reply value when AUX write incomplete
Philip Yang <[email protected]>
drm/amdgpu: csa unmap use uninterruptible lock
Tim Huang <[email protected]>
drm/amdgpu: fix incorrect MALL size for GFX1151
David (Ming Qiang) Wu <[email protected]>
drm/amdgpu: read back register after written for VCN v4.0.5
Melissa Wen <[email protected]>
Revert "drm/amd/display: Hardware cursor changes color when switched to software cursor"
Kyoji Ogasawara <[email protected]>
btrfs: add back warning for mount option commit values exceeding 300
Boris Burkov <[email protected]>
btrfs: fix folio leak in submit_one_async_extent()
Filipe Manana <[email protected]>
btrfs: fix discard worker infinite loop after disabling discard
Tiezhu Yang <[email protected]>
LoongArch: uprobes: Remove redundant code about resume_era
Tiezhu Yang <[email protected]>
LoongArch: uprobes: Remove user_{en,dis}able_single_step()
Huacai Chen <[email protected]>
LoongArch: Fix MAX_REG_OFFSET calculation
Huacai Chen <[email protected]>
LoongArch: Save and restore CSR.CNTC for hibernation
Huacai Chen <[email protected]>
LoongArch: Move __arch_cpu_idle() to .cpuidle.text section
Tianyang Zhang <[email protected]>
LoongArch: Prevent cond_resched() occurring within kernel-fpu
Rong Zhang <[email protected]>
HID: bpf: abort dispatch if device destroyed
Jan Kara <[email protected]>
udf: Make sure i_lenExtents is uptodate on inode eviction
Tejun Heo <[email protected]>
sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator
Nathan Lynch <[email protected]>
dmaengine: Revert "dmaengine: dmatest: Fix dmatest waiting less when interrupted"
Trond Myklebust <[email protected]>
NFSv4/pnfs: Reset the layout state after a layoutreturn
Gerhard Engleder <[email protected]>
tsnep: fix timestamping with a stacked DSA driver
Pengtao He <[email protected]>
net/tls: fix kernel panic when alloc_page failed
Ido Schimmel <[email protected]>
mlxsw: spectrum_router: Fix use-after-free when deleting GRE net devices
Kees Cook <[email protected]>
wifi: mac80211: Set n_channels after allocating struct cfg80211_scan_request
Subbaraya Sundeep <[email protected]>
octeontx2-pf: Do not reallocate all ntuple filters
Hariprasad Kelam <[email protected]>
octeontx2-af: Fix CGX Receive counters
Bo-Cun Chen <[email protected]>
net: ethernet: mtk_eth_soc: fix typo for declaration MT7988 ESW capability
Subbaraya Sundeep <[email protected]>
octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
Jakub Kicinski <[email protected]>
netlink: specs: tc: all actions are indexed arrays
Jakub Kicinski <[email protected]>
netlink: specs: tc: fix a couple of attribute names
Umesh Nerlige Ramappa <[email protected]>
drm/xe: Save CTX_TIMESTAMP mmio value instead of LRC value
Cosmin Tanislav <[email protected]>
regulator: max20086: fix invalid memory access
Abdun Nihaal <[email protected]>
qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd()
Carolina Jubran <[email protected]>
net/mlx5e: Disable MACsec offload for uplink representor profile
Konstantin Shkolnyy <[email protected]>
vsock/test: Fix occasional failure in SIOCOUTQ tests
Jonas Gorski <[email protected]>
net: dsa: b53: prevent standalone from trying to forward to other ports
Geert Uytterhoeven <[email protected]>
ALSA: sh: SND_AICA should depend on SH_DMA_API
Keith Busch <[email protected]>
nvme-pci: acquire cq_poll_lock in nvme_poll_irqdisable
Kees Cook <[email protected]>
nvme-pci: make nvme_pci_npages_prp() __always_inline
Vladimir Oltean <[email protected]>
net: dsa: sja1105: discard incoming frames in BR_STATE_LISTENING
Mathieu Othacehe <[email protected]>
net: cadence: macb: Fix a possible deadlock in macb_halt_tx.
Takashi Iwai <[email protected]>
ALSA: ump: Fix a typo of snd_ump_stream_msg_device_info
Takashi Iwai <[email protected]>
ALSA: seq: Fix delivery of UMP events to group ports
Andrew Jeffery <[email protected]>
net: mctp: Ensure keys maintain only one ref to corresponding dev
Cosmin Ratiu <[email protected]>
tests/ncdevmem: Fix double-free of queue array
Stanislav Fomichev <[email protected]>
selftests: ncdevmem: Switch to AF_INET6
Stanislav Fomichev <[email protected]>
selftests: ncdevmem: Make client_ip optional
Stanislav Fomichev <[email protected]>
selftests: ncdevmem: Unify error handling
Stanislav Fomichev <[email protected]>
selftests: ncdevmem: Separate out dmabuf provider
Stanislav Fomichev <[email protected]>
selftests: ncdevmem: Redirect all non-payload output to stderr
Matt Johnston <[email protected]>
net: mctp: Don't access ifa_index when missing
Eric Dumazet <[email protected]>
mctp: no longer rely on net->dev_index_head[]
Hangbin Liu <[email protected]>
tools/net/ynl: ethtool: fix crash when Hardware Clock info is missing
Cong Wang <[email protected]>
net_sched: Flush gso_skb list too during ->change()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: MGMT: Fix MGMT_OP_ADD_DEVICE invalid device flags
Zhu Yanjun <[email protected]>
RDMA/core: Fix "KASAN: slab-use-after-free Read in ib_register_device" problem
Geert Uytterhoeven <[email protected]>
spi: loopback-test: Do not split 1024-byte hexdumps
Li Lingfeng <[email protected]>
nfs: handle failure of nfs_get_lock_context in unlock path
Henry Martin <[email protected]>
HID: uclogic: Add NULL check in uclogic_input_configured()
Qasim Ijaz <[email protected]>
HID: thrustmaster: fix memory leak in thrustmaster_interrupts()
Zhu Yanjun <[email protected]>
RDMA/rxe: Fix slab-use-after-free Read in rxe_queue_cleanup bug
Koichiro Den <[email protected]>
virtio_net: ensure netdev_tx_reset_queue is called on bind xsk for tx
Koichiro Den <[email protected]>
virtio_ring: add a func argument 'recycle_done' to virtqueue_reset()
David Lechner <[email protected]>
iio: chemical: sps30: use aligned_s64 for timestamp
Jonathan Cameron <[email protected]>
iio: adc: ad7768-1: Fix insufficient alignment of timestamp.
Mathias Nyman <[email protected]>
xhci: dbc: Avoid event polling busyloop if pending rx transfers are inactive.
Mathias Nyman <[email protected]>
xhci: dbc: Improve performance by removing delay in transfer event polling.
Alex Deucher <[email protected]>
Revert "drm/amd: Stop evicting resources on APUs in suspend"
Mario Limonciello <[email protected]>
drm/amd: Add Suspend/Hibernate notification callback support
David Lechner <[email protected]>
iio: pressure: mprls0025pa: use aligned_s64 for timestamp
David Lechner <[email protected]>
iio: chemical: pms7003: use aligned_s64 for timestamp
Jonathan Cameron <[email protected]>
iio: adc: ad7266: Fix potential timestamp alignment issue.
Sean Christopherson <[email protected]>
KVM: x86/mmu: Prevent installing hugepages when mem attributes are changing
Isaku Yamahata <[email protected]>
KVM: Add member to struct kvm_gfn_range to indicate private/shared
Naman Jain <[email protected]>
uio_hv_generic: Fix sysfs creation path for ring buffer
Michal Suchanek <[email protected]>
tpm: tis: Double the timeout B to 4s
Masami Hiramatsu (Google) <[email protected]>
tracing: probes: Fix a possible race in trace_probe_log APIs
Waiman Long <[email protected]>
cgroup/cpuset: Extend kthread_is_per_cpu() check to all PF_NO_SETAFFINITY tasks
Himanshu Bhavani <[email protected]>
arm64: dts: imx8mp-var-som: Fix LDO5 shutdown causing SD card timeout
Hans de Goede <[email protected]>
platform/x86: asus-wmi: Fix wlan_ctrl_by_user detection
Runhua He <[email protected]>
platform/x86/amd/pmc: Declare quirk_spurious_8042 for MECHREVO Wujie 14XA (GX4HRXL)
Kees Cook <[email protected]>
binfmt_elf: Move brk for static PIE even if ASLR disabled
Ze Huang <[email protected]>
riscv: dts: sophgo: fix DMA data-width configuration for CV18xx
Mario Limonciello <[email protected]>
drivers/platform/x86/amd: pmf: Check for invalid Smart PC Policies
Mario Limonciello <[email protected]>
drivers/platform/x86/amd: pmf: Check for invalid sideloaded Smart PC Policies
Stephen Smalley <[email protected]>
fs/xattr.c: fix simple_xattr_list to always include security.* xattrs
Tom Vincent <[email protected]>
arm64: dts: rockchip: Assign RT5616 MCLK rate on rk3588-friendlyelec-cm3588
-------------
Diffstat:
Documentation/netlink/specs/tc.yaml | 10 +- MAINTAINERS | 6 +- Makefile | 4 +- .../boot/dts/amlogic/meson-g12b-dreambox.dtsi | 4 + arch/arm64/boot/dts/freescale/imx8mp-var-som.dtsi | 12 +- .../dts/rockchip/rk3588-friendlyelec-cm3588.dtsi | 4 + arch/arm64/boot/dts/rockchip/rk3588j.dtsi | 53 +-- arch/loongarch/include/asm/ptrace.h | 2 +- arch/loongarch/include/asm/uprobes.h | 1 - arch/loongarch/kernel/genex.S | 7 +- arch/loongarch/kernel/kfpu.c | 22 +- arch/loongarch/kernel/time.c | 2 +- arch/loongarch/kernel/uprobes.c | 11 +- arch/loongarch/power/hibernate.c | 3 + arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 2 +- arch/x86/kvm/mmu/mmu.c | 83 ++++- block/bio.c | 2 +- drivers/accel/ivpu/ivpu_debugfs.c | 2 +- drivers/accel/ivpu/ivpu_fw.c | 4 +- drivers/accel/ivpu/ivpu_fw_log.c | 119 +++--- drivers/accel/ivpu/ivpu_fw_log.h | 9 +- drivers/accel/ivpu/ivpu_pm.c | 1 + drivers/acpi/pptt.c | 11 +- drivers/bluetooth/btnxpuart.c | 6 +- drivers/char/tpm/tpm2-sessions.c | 20 +- drivers/char/tpm/tpm_tis_core.h | 2 +- drivers/dma-buf/dma-resv.c | 5 +- drivers/dma/dmatest.c | 6 +- drivers/dma/idxd/init.c | 159 +++++--- drivers/dma/ti/k3-udma.c | 10 +- drivers/gpio/gpio-pca953x.c | 6 + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 18 - drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 47 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 12 + drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 8 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 16 +- .../drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 5 +- drivers/gpu/drm/drm_fbdev_dma.c | 60 +-- drivers/gpu/drm/tiny/Kconfig | 1 + drivers/gpu/drm/tiny/panel-mipi-dbi.c | 7 +- drivers/gpu/drm/xe/instructions/xe_mi_commands.h | 4 + drivers/gpu/drm/xe/xe_gsc.c | 22 ++ drivers/gpu/drm/xe/xe_gsc.h | 1 + drivers/gpu/drm/xe/xe_gsc_proxy.c | 11 + drivers/gpu/drm/xe/xe_gsc_proxy.h | 1 + drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_lrc.c | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 7 +- drivers/gpu/drm/xe/xe_uc.c | 8 +- drivers/gpu/drm/xe/xe_uc.h | 1 + drivers/hid/bpf/hid_bpf_dispatch.c | 9 + drivers/hid/hid-thrustmaster.c | 1 + drivers/hid/hid-uclogic-core.c | 7 +- drivers/hv/channel.c | 65 +--- drivers/hv/hyperv_vmbus.h | 6 + drivers/hv/vmbus_drv.c | 100 ++++- drivers/iio/adc/ad7266.c | 2 +- drivers/iio/adc/ad7768-1.c | 2 +- drivers/iio/chemical/pms7003.c | 5 +- drivers/iio/chemical/sps30.c | 2 +- drivers/iio/light/opt3001.c | 5 +- drivers/iio/pressure/mprls0025pa.h | 17 +- drivers/infiniband/core/device.c | 6 +- drivers/infiniband/sw/rxe/rxe_cq.c | 5 +- drivers/net/dsa/b53/b53_common.c | 33 ++ drivers/net/dsa/b53/b53_regs.h | 14 + drivers/net/dsa/sja1105/sja1105_main.c | 6 +- drivers/net/ethernet/cadence/macb_main.c | 19 +- drivers/net/ethernet/engleder/tsnep_main.c | 30 +- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 5 + .../ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 3 +- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 1 + .../ethernet/marvell/octeontx2/nic/otx2_devlink.c | 1 + .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 3 +- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 + .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 + drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- .../ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 7 +- drivers/net/hyperv/hyperv_net.h | 13 +- drivers/net/hyperv/netvsc.c | 57 ++- drivers/net/hyperv/netvsc_drv.c | 62 +--- drivers/net/hyperv/rndis_filter.c | 24 +- drivers/net/virtio_net.c | 5 +- drivers/net/wireless/mediatek/mt76/dma.c | 1 + drivers/nvme/host/pci.c | 4 +- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 38 +- drivers/phy/tegra/xusb-tegra186.c | 46 ++- drivers/phy/tegra/xusb.c | 8 +- drivers/platform/x86/amd/pmc/pmc-quirks.c | 7 + drivers/platform/x86/amd/pmf/tee-if.c | 23 +- drivers/platform/x86/asus-wmi.c | 3 +- drivers/regulator/max20086-regulator.c | 7 +- drivers/scsi/sd_zbc.c | 6 +- drivers/scsi/storvsc_drv.c | 1 + drivers/spi/spi-loopback-test.c | 2 +- drivers/spi/spi-tegra114.c | 6 +- drivers/uio/uio_hv_generic.c | 39 +- drivers/usb/gadget/function/f_midi2.c | 2 +- drivers/usb/host/xhci-dbgcap.c | 21 +- drivers/usb/host/xhci-dbgcap.h | 3 + drivers/usb/typec/ucsi/displayport.c | 19 +- drivers/usb/typec/ucsi/ucsi.c | 34 ++ drivers/usb/typec/ucsi/ucsi.h | 2 + drivers/virtio/virtio_ring.c | 6 +- fs/binfmt_elf.c | 71 ++-- fs/btrfs/discard.c | 17 +- fs/btrfs/fs.h | 1 + fs/btrfs/inode.c | 7 + fs/btrfs/super.c | 4 + fs/nfs/nfs4proc.c | 9 +- fs/nfs/pnfs.c | 9 + fs/smb/client/cifs_spnego.c | 16 + fs/smb/client/cifsfs.c | 25 ++ fs/smb/client/cifsglob.h | 7 + fs/smb/client/connect.c | 20 + fs/smb/client/fs_context.c | 39 ++ fs/smb/client/fs_context.h | 10 + fs/smb/client/smb2pdu.c | 2 +- fs/udf/truncate.c | 2 +- fs/xattr.c | 24 ++ include/drm/drm_fbdev_dma.h | 12 + include/linux/bio.h | 1 + include/linux/hyperv.h | 13 +- include/linux/kvm_host.h | 6 + include/linux/tpm.h | 21 +- include/linux/virtio.h | 3 +- include/net/sch_generic.h | 15 + include/sound/ump_msg.h | 4 +- kernel/cgroup/cpuset.c | 6 +- kernel/sched/ext.c | 6 + kernel/trace/ring_buffer.c | 8 +- kernel/trace/trace_dynevent.c | 16 +- kernel/trace/trace_dynevent.h | 1 + kernel/trace/trace_events_trigger.c | 2 +- kernel/trace/trace_functions.c | 6 +- kernel/trace/trace_kprobe.c | 2 +- kernel/trace/trace_probe.c | 9 + kernel/trace/trace_uprobe.c | 2 +- mm/page_alloc.c | 23 -- mm/userfaultfd.c | 12 +- net/bluetooth/mgmt.c | 9 +- net/mac80211/main.c | 6 +- net/mctp/device.c | 65 ++-- net/mctp/route.c | 4 +- net/sched/sch_codel.c | 2 +- net/sched/sch_fq.c | 2 +- net/sched/sch_fq_codel.c | 2 +- net/sched/sch_fq_pie.c | 2 +- net/sched/sch_hhf.c | 2 +- net/sched/sch_pie.c | 2 +- net/tls/tls_strp.c | 3 +- samples/ftrace/sample-trace-array.c | 2 +- scripts/Makefile.extrawarn | 12 + sound/core/seq/seq_clientmgr.c | 52 ++- sound/core/seq/seq_ump_convert.c | 18 + sound/core/seq/seq_ump_convert.h | 1 + sound/pci/es1968.c | 6 +- sound/sh/Kconfig | 2 +- sound/usb/quirks.c | 4 + tools/net/ynl/ethtool.py | 22 +- tools/testing/selftests/net/ncdevmem.c | 404 ++++++++++++--------- tools/testing/vsock/vsock_test.c | 28 +- virt/kvm/guest_memfd.c | 2 + virt/kvm/kvm_main.c | 14 + 169 files changed, 1823 insertions(+), 918 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/143 arm64: dts: rockchip: Assign RT5616 MCLK rate on rk3588-friendlyelec-cm3588
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Vincent <[email protected]>
[ Upstream commit 5e6a4ee9799b202fefa8c6264647971f892f0264 ]
The Realtek RT5616 audio codec on the FriendlyElec CM3588 module fails to probe correctly due to the missing clock properties. This results in distorted analogue audio output.
Assign MCLK to 12.288 MHz, which allows the codec to advertise most of the standard sample rates per other RK3588 devices.
--- arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588.dtsi +4 -0
@@ -222,6 +222,10 @@ compatible = "realtek,rt5616"; reg = <0x1b>; #sound-dai-cells = <0>; + assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; + assigned-clock-rates = <12288000>; + clocks = <&cru I2S0_8CH_MCLKOUT>; + clock-names = "mclk"; }; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 2/143 fs/xattr.c: fix simple_xattr_list to always include security.* xattrs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Smalley <[email protected]>
[ Upstream commit 8b0ba61df5a1c44e2b3cf683831a4fc5e24ea99d ]
The vfs has long had a fallback to obtain the security.* xattrs from the LSM when the filesystem does not implement its own listxattr, but shmem/tmpfs and kernfs later gained their own xattr handlers to support other xattrs. Unfortunately, as a side effect, tmpfs and kernfs-based filesystems like sysfs no longer return the synthetic security.* xattr names via listxattr unless they are explicitly set by userspace or initially set upon inode creation after policy load. coreutils has recently switched from unconditionally invoking getxattr for security.* for ls -Z via libselinux to only doing so if listxattr returns the xattr name, breaking ls -Z of such inodes.
Before:
$ getfattr -m.* /run/initramfs <no output> $ getfattr -m.* /sys/kernel/fscaps <no output> $ setfattr -n user.foo /run/initramfs $ getfattr -m.* /run/initramfs user.foo
After:
$ getfattr -m.* /run/initramfs security.selinux $ getfattr -m.* /sys/kernel/fscaps security.selinux $ setfattr -n user.foo /run/initramfs $ getfattr -m.* /run/initramfs security.selinux user.foo
--- fs/xattr.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/xattr.c +24 -0
@@ -1290,6 +1290,15 @@ static bool xattr_is_trusted(const char *name)return !strncmp (name,XATTR_TRUSTED_PREFIX ,XATTR_TRUSTED_PREFIX_LEN ); } +static bool xattr_is_maclabel (const char *name) +{ +const char *suffix = name +XATTR_SECURITY_PREFIX_LEN ; + +return !strncmp (name,XATTR_SECURITY_PREFIX , +XATTR_SECURITY_PREFIX_LEN ) && +security_ismaclabel (suffix); +} +/** * simple_xattr_list - list all xattr objects * @inode: inode from which to get the xattrs
@@ -1322,6 +1331,17 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,if (err)return err; + err =security_inode_listsecurity (inode, buffer, remaining_size); +if (err <0 ) +return err; + +if (buffer) { +if (remaining_size < err) +return -ERANGE ; + buffer += err; + } + remaining_size -= err; +read_lock (&xattrs->lock);for (rbp =rb_first (&xattrs->rb_root); rbp; rbp =rb_next (rbp)) { xattr = rb_entry(rbp, struct simple_xattr, rb_node);
@@ -1330,6 +1350,10 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,if (!trusted &&xattr_is_trusted (xattr->name))continue ; +/* skip MAC labels; these are provided by LSM above */ +if (xattr_is_maclabel (xattr->name)) +continue ; + err =xattr_list_one (&buffer, &remaining_size, xattr->name);if (err)break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 3/143 drivers/platform/x86/amd: pmf: Check for invalid sideloaded Smart PC Policies
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 690d722e02819ef978f90cd7553973eba1007e6c ]
If a policy is passed into amd_pmf_get_pb_data() that causes the engine to fail to start there is a memory leak. Free the memory in this failure path.
--- drivers/platform/x86/amd/pmf/tee-if.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/pmf/tee-if.c +6 -1
@@ -364,9 +364,14 @@ static ssize_t amd_pmf_get_pb_data(struct file *filp, const char __user *buf,amd_pmf_hex_dump_pb (dev); ret =amd_pmf_start_policy_engine (dev);if (ret <0 ) -return ret; + goto cleanup;return length; + +cleanup: +kfree (dev->policy_buf); + dev->policy_buf =NULL ; +return ret; }static const struct file_operations pb_fops = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 4/143 drivers/platform/x86/amd: pmf: Check for invalid Smart PC Policies
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 8e81b9cd6e95188d12c9cc25d40b61dd5ea05ace ]
commit 376a8c2a14439 ("platform/x86/amd/pmf: Update PMF Driver for Compatibility with new PMF-TA") added support for platforms that support an updated TA, however it also exposed a number of platforms that although they have support for the updated TA don't actually populate a policy binary.
Add an explicit check that the policy binary isn't empty before initializing the TA.
--- drivers/platform/x86/amd/pmf/tee-if.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/platform/x86/amd/pmf/tee-if.c +16 -0
@@ -334,6 +334,11 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)return 0 ; } +static inline bool amd_pmf_pb_valid (struct amd_pmf_dev *dev) +{ +return memchr_inv (dev->policy_buf,0xff , dev->policy_sz); +} +#ifdef CONFIG_AMD_PMF_DEBUG static void amd_pmf_hex_dump_pb (struct amd_pmf_dev *dev) {
@@ -361,6 +366,11 @@ static ssize_t amd_pmf_get_pb_data(struct file *filp, const char __user *buf, dev->policy_buf = new_policy_buf; dev->policy_sz = length; +if (!amd_pmf_pb_valid (dev)) { + ret = -EINVAL ; + goto cleanup; + } +amd_pmf_hex_dump_pb (dev); ret =amd_pmf_start_policy_engine (dev);if (ret <0 )
@@ -533,6 +543,12 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)memcpy_fromio (dev->policy_buf, dev->policy_base, dev->policy_sz); +if (!amd_pmf_pb_valid (dev)) { +dev_info (dev->dev,"No Smart PC policy present\n" ); + ret = -EINVAL ; + goto err_free_policy; + } +amd_pmf_hex_dump_pb (dev); dev->prev_data =kzalloc (sizeof (*dev->prev_data),GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 5/143 riscv: dts: sophgo: fix DMA data-width configuration for CV18xx
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ze Huang <[email protected]>
[ Upstream commit 3e6244429ba38f8dee3336b8b805948276b281ab ]
The "snps,data-width" property[1] defines the AXI data width of the DMA controller as:
width = 8 × (2^n) bits
(0 = 8 bits, 1 = 16 bits, 2 = 32 bits, ..., 6 = 512 bits) where "n" is the value of "snps,data-width".
For the CV18xx DMA controller, the correct AXI data width is 32 bits, corresponding to "snps,data-width = 2".
Test results on Milkv Duo S can be found here [2].
--- arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +1 -1
@@ -309,7 +309,7 @@ 1024 1024 1024 1024>; snps,priority = <0 1 2 3 4 5 6 7>; snps,dma-masters = <2>; - snps,data-width = <4>; + snps,data-width = <2>; status = "disabled"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 6/143 binfmt_elf: Move brk for static PIE even if ASLR disabled
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 11854fe263eb1b9a8efa33b0c087add7719ea9b4 ]
In commit bbdc6076d2e5 ("binfmt_elf: move brk out of mmap when doing direct loader exec"), the brk was moved out of the mmap region when loading static PIE binaries (ET_DYN without INTERP). The common case for these binaries was testing new ELF loaders, so the brk needed to be away from mmap to avoid colliding with stack, future mmaps (of the loader-loaded binary), etc. But this was only done when ASLR was enabled, in an attempt to minimize changes to memory layouts.
After adding support to respect alignment requirements for static PIE binaries in commit 3545deff0ec7 ("binfmt_elf: Honor PT_LOAD alignment for static PIE"), it became possible to have a large gap after the final PT_LOAD segment and the top of the mmap region. This means that future mmap allocations might go after the last PT_LOAD segment (where brk might be if ASLR was disabled) instead of before them (where they traditionally ended up).
On arm64, running with ASLR disabled, Ubuntu 22.04's "ldconfig" binary, a static PIE, has alignment requirements that leaves a gap large enough after the last PT_LOAD segment to fit the vdso and vvar, but still leave enough space for the brk (which immediately follows the last PT_LOAD segment) to be allocated by the binary.
fffff7f20000-fffff7fde000 r-xp 00000000 fe:02 8110426 /sbin/ldconfig.real fffff7fee000-fffff7ff5000 rw-p 000be000 fe:02 8110426 /sbin/ldconfig.real fffff7ff5000-fffff7ffa000 rw-p 00000000 00:00 0
***[brk will go here at fffff7ffa000]***
fffff7ffc000-fffff7ffe000 r--p 00000000 00:00 0 [vvar] fffff7ffe000-fffff8000000 r-xp 00000000 00:00 0 [vdso] fffffffdf000-1000000000000 rw-p 00000000 00:00 0 [stack]
After commit 0b3bc3354eb9 ("arm64: vdso: Switch to generic storage implementation"), the arm64 vvar grew slightly, and suddenly the brk collided with the allocation.
fffff7f20000-fffff7fde000 r-xp 00000000 fe:02 8110426 /sbin/ldconfig.real fffff7fee000-fffff7ff5000 rw-p 000be000 fe:02 8110426 /sbin/ldconfig.real fffff7ff5000-fffff7ffa000 rw-p 00000000 00:00 0
***[oops, no room any more, vvar is at fffff7ffa000!]***
fffff7ffa000-fffff7ffe000 r--p 00000000 00:00 0 [vvar] fffff7ffe000-fffff8000000 r-xp 00000000 00:00 0 [vdso] fffffffdf000-1000000000000 rw-p 00000000 00:00 0 [stack]
The solution is to unconditionally move the brk out of the mmap region for static PIE binaries. Whether ASLR is enabled or not does not change if there may be future mmap allocation collisions with a growing brk region.
Update memory layout comments (with kernel-doc headings), consolidate the setting of mm->brk to later (it isn't needed early), move static PIE brk out of mmap unconditionally, and make sure brk(2) knows to base brk position off of mm->start_brk not mm->end_data no matter what the cause of moving it is (via current->brk_randomized).
For the CONFIG_COMPAT_BRK case, though, leave the logic unchanged, as we can never safely move the brk. These systems, however, are not using specially aligned static PIE binaries.
--- fs/binfmt_elf.c | 71 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 24 deletions(-)
fs/binfmt_elf.c +47 -24
@@ -825,6 +825,7 @@ static int load_elf_binary(struct linux_binprm *bprm)struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata =NULL ;struct elf_phdr *elf_property_phdata =NULL ;unsigned long elf_brk; +bool brk_moved = false;int retval, i;unsigned long elf_entry;unsigned long e_entry;
@@ -1092,15 +1093,19 @@ static int load_elf_binary(struct linux_binprm *bprm)/* Calculate any requested alignment. */ alignment =maximum_alignment (elf_phdata, elf_ex->e_phnum); -/* -* There are effectively two types of ET_DYN -* binaries: programs (i.e. PIE: ET_DYN with PT_INTERP) -* and loaders (ET_DYN without PT_INTERP, since they -* _are_ the ELF interpreter). The loaders must -* be loaded away from programs since the program -* may otherwise collide with the loader (especially -* for ET_EXEC which does not have a randomized -* position). For example to handle invocations of +/** +* DOC: PIE handling +* +* There are effectively two types of ET_DYN ELF +* binaries: programs (i.e. PIE: ET_DYN with +* PT_INTERP) and loaders (i.e. static PIE: ET_DYN +* without PT_INTERP, usually the ELF interpreter +* itself). Loaders must be loaded away from programs +* since the program may otherwise collide with the +* loader (especially for ET_EXEC which does not have +* a randomized position). +* +* For example, to handle invocations of * "./ld.so someprog" to test out a new version of * the loader, the subsequent program that the * loader loads must avoid the loader itself, so
@@ -1113,6 +1118,9 @@ static int load_elf_binary(struct linux_binprm *bprm)* ELF_ET_DYN_BASE and loaders are loaded into the * independently randomized mmap region (0 load_bias * without MAP_FIXED nor MAP_FIXED_NOREPLACE). +* +* See below for "brk" handling details, which is +* also affected by program vs loader and ASLR. */ if (interpreter) {/* On ET_DYN with PT_INTERP, we do the ASLR. */
@@ -1229,8 +1237,6 @@ static int load_elf_binary(struct linux_binprm *bprm) start_data += load_bias; end_data += load_bias; - current->mm->start_brk = current->mm->brk =ELF_PAGEALIGN (elf_brk); -if (interpreter) { elf_entry = load_elf_interp(interp_elf_ex, interpreter,
@@ -1286,27 +1292,44 @@ static int load_elf_binary(struct linux_binprm *bprm) mm->end_data = end_data; mm->start_stack = bprm->p; -if ((current->flags &PF_RANDOMIZE ) && (snapshot_randomize_va_space >1 )) { +/** +* DOC: "brk" handling +* +* For architectures with ELF randomization, when executing a +* loader directly (i.e. static PIE: ET_DYN without PT_INTERP), +* move the brk area out of the mmap region and into the unused +* ELF_ET_DYN_BASE region. Since "brk" grows up it may collide +* early with the stack growing down or other regions being put +* into the mmap region by the kernel (e.g. vdso). +* +* In the CONFIG_COMPAT_BRK case, though, everything is turned +* off because we're not allowed to move the brk at all. +*/ +if (!IS_ENABLED (CONFIG_COMPAT_BRK ) && +IS_ENABLED (CONFIG_ARCH_HAS_ELF_RANDOMIZE ) && + elf_ex->e_type ==ET_DYN && !interpreter) { + elf_brk =ELF_ET_DYN_BASE ; +/* This counts as moving the brk, so let brk(2) know. */ + brk_moved = true; + } + mm->start_brk = mm->brk =ELF_PAGEALIGN (elf_brk); + +if ((current->flags &PF_RANDOMIZE ) && snapshot_randomize_va_space >1 ) {/* -* For architectures with ELF randomization, when executing -* a loader directly (i.e. no interpreter listed in ELF -* headers), move the brk area out of the mmap region -* (since it grows up, and may collide early with the stack -* growing down), and into the unused ELF_ET_DYN_BASE region. +* If we didn't move the brk to ELF_ET_DYN_BASE (above), +* leave a gap between .bss and brk. */ -if (IS_ENABLED (CONFIG_ARCH_HAS_ELF_RANDOMIZE ) && - elf_ex->e_type ==ET_DYN && !interpreter) { - mm->brk = mm->start_brk =ELF_ET_DYN_BASE ; - }else { -/* Otherwise leave a gap between .bss and brk. */ +if (!brk_moved) mm->brk = mm->start_brk = mm->brk +PAGE_SIZE ; - } mm->brk = mm->start_brk =arch_randomize_brk (mm); + brk_moved = true; + } +#ifdef compat_brk_randomized +if (brk_moved) current->brk_randomized =1 ;#endif - }if (current->personality &MMAP_PAGE_ZERO ) {/* Why this, you ask??? Well SVr4 maps page 0 as read-only,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 7/143 platform/x86/amd/pmc: Declare quirk_spurious_8042 for MECHREVO Wujie 14XA (GX4HRXL)
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runhua He <[email protected]>
[ Upstream commit 0887817e4953885fbd6a5c1bec2fdd339261eb19 ]
MECHREVO Wujie 14XA (GX4HRXL) wakes up immediately after s2idle entry. This happens regardless of whether the laptop is plugged into AC power, or whether any peripheral is plugged into the laptop.
Similar to commit a55bdad5dfd1 ("platform/x86/amd/pmc: Disable keyboard wakeup on AMD Framework 13"), the MECHREVO Wujie 14XA wakes up almost instantly after s2idle suspend entry (IRQ1 is the keyboard):
2025-04-18 17:23:57,588 DEBUG: PM: Triggering wakeup from IRQ 9 2025-04-18 17:23:57,588 DEBUG: PM: Triggering wakeup from IRQ 1
Add this model to the spurious_8042 quirk to workaround this.
This patch does not affect the wake-up function of the built-in keyboard. Because the firmware of this machine adds an insurance for keyboard wake-up events, as it always triggers an additional IRQ 9 to wake up the system.
--- drivers/platform/x86/amd/pmc/pmc-quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/amd/pmc/pmc-quirks.c +7 -0
@@ -217,6 +217,13 @@ static const struct dmi_system_id fwbug_list[] = { DMI_MATCH(DMI_BIOS_VERSION, "03.05"), } }, + { + .ident = "MECHREVO Wujie 14X (GX4HRXL)", + .driver_data = &quirk_spurious_8042, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "WUJIE14-GX4HRXL"), + } + }, {} };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 8/143 platform/x86: asus-wmi: Fix wlan_ctrl_by_user detection
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit bfcfe6d335a967f8ea0c1980960e6f0205b5de6e ]
The wlan_ctrl_by_user detection was introduced by commit a50bd128f28c ("asus-wmi: record wlan status while controlled by userapp").
Quoting from that commit's commit message:
"""
When you call WMIMethod(DSTS, 0x00010011) to get WLAN status, it may return
(1) 0x00050001 (On)
(2) 0x00050000 (Off)
(3) 0x00030001 (On)
(4) 0x00030000 (Off)
(5) 0x00000002 (Unknown)
(1), (2) means that the model has hardware GPIO for WLAN, you can call WMIMethod(DEVS, 0x00010011, 1 or 0) to turn WLAN on/off.
(3), (4) means that the model doesn’t have hardware GPIO, you need to use API or driver library to turn WLAN on/off, and call WMIMethod(DEVS, 0x00010012, 1 or 0) to set WLAN LED status. After you set WLAN LED status, you can see the WLAN status is changed with WMIMethod(DSTS, 0x00010011). Because the status is recorded lastly (ex: Windows), you can use it for synchronization.
(5) means that the model doesn’t have WLAN device.
WLAN is the ONLY special case with upper rule.
"""
The wlan_ctrl_by_user flag should be set on 0x0003000? ((3), (4) above) return values, but the flag mistakenly also gets set on laptops with 0x0005000? ((1), (2)) return values. This is causing rfkill problems on laptops where 0x0005000? is returned.
Fix the check to only set the wlan_ctrl_by_user flag for 0x0003000? return values.
--- drivers/platform/x86/asus-wmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +2 -1
@@ -4795,7 +4795,8 @@ static int asus_wmi_add(struct platform_device *pdev) goto fail_leds;asus_wmi_get_devstate (asus,ASUS_WMI_DEVID_WLAN , &result); -if (result & (ASUS_WMI_DSTS_PRESENCE_BIT |ASUS_WMI_DSTS_USER_BIT )) +if ((result & (ASUS_WMI_DSTS_PRESENCE_BIT |ASUS_WMI_DSTS_USER_BIT )) == + (ASUS_WMI_DSTS_PRESENCE_BIT |ASUS_WMI_DSTS_USER_BIT )) asus->driver->wlan_ctrl_by_user =1 ;if (!(asus->driver->wlan_ctrl_by_user &&ashs_present ())) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 9/143 arm64: dts: imx8mp-var-som: Fix LDO5 shutdown causing SD card timeout
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Himanshu Bhavani <[email protected]>
[ Upstream commit c6888983134e2ccc2db8ffd2720b0d4826d952e4 ]
Fix SD card timeout issue caused by LDO5 regulator getting disabled after boot.
The kernel log shows LDO5 being disabled, which leads to a timeout on USDHC2:
[ 33.760561] LDO5: disabling [ 81.119861] mmc1: Timeout waiting for hardware interrupt.
To prevent this, set regulator-boot-on and regulator-always-on for LDO5. Also add the vqmmc regulator to properly support 1.8V/3.3V signaling for USDHC2 using a GPIO-controlled regulator.
--- arch/arm64/boot/dts/freescale/imx8mp-var-som.dtsi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-var-som.dtsi +11 -1
@@ -35,7 +35,6 @@ <0x1 0x00000000 0 0xc0000000>; }; - reg_usdhc2_vmmc: regulator-usdhc2-vmmc { compatible = "regulator-fixed"; regulator-name = "VSD_3V3";
@@ -46,6 +45,16 @@ startup-delay-us = <100>; off-on-delay-us = <12000>; }; + + reg_usdhc2_vqmmc: regulator-usdhc2-vqmmc { + compatible = "regulator-gpio"; + regulator-name = "VSD_VSEL"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>; + states = <3300000 0x0 1800000 0x1>; + vin-supply = <&ldo5>; + }; }; &A53_0 {
@@ -205,6 +214,7 @@ pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; cd-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; vmmc-supply = <®_usdhc2_vmmc>; + vqmmc-supply = <®_usdhc2_vqmmc>; bus-width = <4>; status = "okay"; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 10/143 cgroup/cpuset: Extend kthread_is_per_cpu() check to all PF_NO_SETAFFINITY tasks
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 39b5ef791d109dd54c7c2e6e87933edfcc0ad1ac ]
Commit ec5fbdfb99d1 ("cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset") enabled us to pull CPUs dedicated to child partitions from tasks in top_cpuset by ignoring per cpu kthreads. However, there can be other kthreads that are not per cpu but have PF_NO_SETAFFINITY flag set to indicate that we shouldn't mess with their CPU affinity. For other kthreads, their affinity will be changed to skip CPUs dedicated to child partitions whether it is an isolating or a scheduling one.
As all the per cpu kthreads have PF_NO_SETAFFINITY set, the PF_NO_SETAFFINITY tasks are essentially a superset of per cpu kthreads. Fix this issue by dropping the kthread_is_per_cpu() check and checking the PF_NO_SETAFFINITY flag instead.
--- kernel/cgroup/cpuset.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/cgroup/cpuset.c +4 -2
@@ -1100,9 +1100,11 @@ void cpuset_update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus)if (top_cs) {/* -* Percpu kthreads in top_cpuset are ignored +* PF_NO_SETAFFINITY tasks are ignored. +* All per cpu kthreads should have PF_NO_SETAFFINITY +* flag set, see kthread_set_per_cpu(). */ -if (kthread_is_per_cpu (task)) +if (task->flags &PF_NO_SETAFFINITY )continue ;cpumask_andnot (new_cpus, possible_mask, subpartitions_cpus); }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 11/143 tracing: probes: Fix a possible race in trace_probe_log APIs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit fd837de3c9cb1a162c69bc1fb1f438467fe7f2f5 ]
Since the shared trace_probe_log variable can be accessed and modified via probe event create operation of kprobe_events, uprobe_events, and dynamic_events, it should be protected. In the dynamic_events, all operations are serialized by dyn_event_ops_mutex. But kprobe_events and uprobe_events interfaces are not serialized.
To solve this issue, introduces dyn_event_create(), which runs create() operation under the mutex, for kprobe_events and uprobe_events. This also uses lockdep to check the mutex is held when using trace_probe_log* APIs.
--- kernel/trace/trace_dynevent.c | 16 +++++++++++++++- kernel/trace/trace_dynevent.h | 1 + kernel/trace/trace_kprobe.c | 2 +- kernel/trace/trace_probe.c | 9 +++++++++ kernel/trace/trace_uprobe.c | 2 +- 5 files changed, 27 insertions(+), 3 deletions(-)
kernel/trace/trace_dynevent.c +15 -1
@@ -16,7 +16,7 @@#include "trace_output.h" /* for trace_event_sem */ #include "trace_dynevent.h" -static DEFINE_MUTEX (dyn_event_ops_mutex); +DEFINE_MUTEX (dyn_event_ops_mutex);static LIST_HEAD (dyn_event_ops_list);bool trace_event_dyn_try_get_ref (struct trace_event_call *dyn_call)
@@ -125,6 +125,20 @@ int dyn_event_release(const char *raw_command, struct dyn_event_operations *typereturn ret; } +/* +* Locked version of event creation. The event creation must be protected by +* dyn_event_ops_mutex because of protecting trace_probe_log. +*/ +int dyn_event_create (const char *raw_command,struct dyn_event_operations *type) +{ +int ret; + +mutex_lock (&dyn_event_ops_mutex); + ret = type->create (raw_command); +mutex_unlock (&dyn_event_ops_mutex); +return ret; +} +static int create_dyn_event (const char *raw_command) {struct dyn_event_operations *ops;
kernel/trace/trace_dynevent.h +1 -0
@@ -100,6 +100,7 @@ void *dyn_event_seq_next(struct seq_file *m, void *v, loff_t *pos);void dyn_event_seq_stop (struct seq_file *m,void *v);int dyn_events_release_all (struct dyn_event_operations *type);int dyn_event_release (const char *raw_command,struct dyn_event_operations *type); +int dyn_event_create (const char *raw_command,struct dyn_event_operations *type);/* * for_each_dyn_event - iterate over the dyn_event list
kernel/trace/trace_kprobe.c +1 -1
@@ -1090,7 +1090,7 @@ static int create_or_delete_trace_kprobe(const char *raw_command)if (raw_command[0 ] =='-' )return dyn_event_release (raw_command, &trace_kprobe_ops); - ret =trace_kprobe_create (raw_command); + ret =dyn_event_create (raw_command, &trace_kprobe_ops);return ret == -ECANCELED ? -EINVAL : ret; }
kernel/trace/trace_probe.c +9 -0
@@ -154,9 +154,12 @@ static const struct fetch_type *find_fetch_type(const char *type, unsigned long }static struct trace_probe_log trace_probe_log; +extern struct mutex dyn_event_ops_mutex;void trace_probe_log_init (const char *subsystem,int argc,const char **argv) { +lockdep_assert_held (&dyn_event_ops_mutex); + trace_probe_log.subsystem = subsystem; trace_probe_log.argc = argc; trace_probe_log.argv = argv;
@@ -165,11 +168,15 @@ void trace_probe_log_init(const char *subsystem, int argc, const char **argv)void trace_probe_log_clear (void ) { +lockdep_assert_held (&dyn_event_ops_mutex); +memset (&trace_probe_log,0 ,sizeof (trace_probe_log)); }void trace_probe_log_set_index (int index) { +lockdep_assert_held (&dyn_event_ops_mutex); + trace_probe_log.index = index; }
@@ -178,6 +185,8 @@ void __trace_probe_log_err(int offset, int err_type)char *command, *p;int i, len =0 , pos =0 ; +lockdep_assert_held (&dyn_event_ops_mutex); +if (!trace_probe_log.argv)return ;
kernel/trace/trace_uprobe.c +1 -1
@@ -739,7 +739,7 @@ static int create_or_delete_trace_uprobe(const char *raw_command)if (raw_command[0 ] =='-' )return dyn_event_release (raw_command, &trace_uprobe_ops); - ret =trace_uprobe_create (raw_command); + ret =dyn_event_create (raw_command, &trace_uprobe_ops);return ret == -ECANCELED ? -EINVAL : ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 12/143 tpm: tis: Double the timeout B to 4s
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Suchanek <[email protected]>
[ Upstream commit 2f661f71fda1fc0c42b7746ca5b7da529eb6b5be ]
With some Infineon chips the timeouts in tpm_tis_send_data (both B and
C) can reach up to about 2250 ms.
Timeout C is retried since
commit de9e33df7762 ("tpm, tpm_tis: Workaround failed command reception on Infineon devices")
Timeout B still needs to be extended.
The problem is most commonly encountered with context related operation such as load context/save context. These are issued directly by the kernel, and there is no retry logic for them.
When a filesystem is set up to use the TPM for unlocking the boot fails, and restarting the userspace service is ineffective. This is likely because ignoring a load context/save context result puts the real TPM state and the TPM state expected by the kernel out of sync.
Chips known to be affected:tpm_tis IFX1522:00: 2.0 TPM (device-id 0x1D, rev-id 54)
Description: SLB9672
Firmware Revision: 15.22
tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1B, rev-id 22) Firmware Revision: 7.83
tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1A, rev-id 16) Firmware Revision: 5.63
--- drivers/char/tpm/tpm_tis_core.h | 2 +- include/linux/tpm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_core.h +1 -1
@@ -54,7 +54,7 @@ enum tis_int_flags {enum tis_defaults {TIS_MEM_LEN =0x5000 ,TIS_SHORT_TIMEOUT =750 ,/* ms */ -TIS_LONG_TIMEOUT =2000 ,/* 2 sec */ +TIS_LONG_TIMEOUT =4000 ,/* 4 secs */ TIS_TIMEOUT_MIN_ATML =14700 ,/* usecs */ TIS_TIMEOUT_MAX_ATML =15000 ,/* usecs */ };
include/linux/tpm.h +1 -1
@@ -224,7 +224,7 @@ enum tpm2_const {enum tpm2_timeouts {TPM2_TIMEOUT_A =750 , -TPM2_TIMEOUT_B =2000 , +TPM2_TIMEOUT_B =4000 ,TPM2_TIMEOUT_C =200 ,TPM2_TIMEOUT_D =30 ,TPM2_DURATION_SHORT =20 ,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 13/143 uio_hv_generic: Fix sysfs creation path for ring buffer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naman Jain <[email protected]>
[ Upstream commit f31fe8165d365379d858c53bef43254c7d6d1cfd ]
On regular bootup, devices get registered to VMBus first, so when uio_hv_generic driver for a particular device type is probed, the device is already initialized and added, so sysfs creation in hv_uio_probe() works fine. However, when the device is removed and brought back, the channel gets rescinded and the device again gets registered to VMBus. However this time, the uio_hv_generic driver is already registered to probe for that device and in this case sysfs creation is tried before the device's kobject gets initialized completely.
Fix this by moving the core logic of sysfs creation of ring buffer, from uio_hv_generic to HyperV's VMBus driver, where the rest of the sysfs attributes for the channels are defined. While doing that, make use of attribute groups and macros, instead of creating sysfs directly, to ensure better error handling and code flow.
Problematic path:vmbus_process_offer (A new offer comes for the VMBus device)
vmbus_add_channel_work
vmbus_device_register
|-> device_register
| |...
| |-> hv_uio_probe
| |...
| |-> sysfs_create_bin_file (leads to a warning as
| the primary channel's kobject, which is used to
| create the sysfs file, is not yet initialized)
|-> kset_create_and_add
|-> vmbus_add_channel_kobj (initialization of the primary
channel's kobject happens later)Above code flow is sequential and the warning is always reproducible in this path.
--- drivers/hv/hyperv_vmbus.h | 6 ++ drivers/hv/vmbus_drv.c | 100 ++++++++++++++++++++++++++++++++++++++++++- drivers/uio/uio_hv_generic.c | 39 +++++++--------- include/linux/hyperv.h | 6 ++ 4 files changed, 128 insertions(+), 23 deletions(-)
drivers/hv/hyperv_vmbus.h +6 -0
@@ -485,4 +485,10 @@ static inline int hv_debug_add_dev_dir(s#endif /* CONFIG_HYPERV_TESTING */ +/* Create and remove sysfs entry for memory mapped ring buffers for a channel */ +int hv_create_ring_sysfs (struct vmbus_channel *channel, +int (*hv_mmap_ring_buffer)(struct vmbus_channel *channel, +struct vm_area_struct *vma)); +int hv_remove_ring_sysfs (struct vmbus_channel *channel); +#endif /* _HYPERV_VMBUS_H */
drivers/hv/vmbus_drv.c +99 -1
126 lines not on this page · raw message
drivers/uio/uio_hv_generic.c +17 -22
@@ -131,15 +131,12 @@ static void hv_uio_rescind(struct vmbus_vmbus_device_unregister (channel->device_obj); } -/* Sysfs API to allow mmap of the ring buffers +/* Function used for mmap of ring buffer sysfs interface. * The ring buffer is allocated as contiguous memory by vmbus_open */ -static int hv_uio_ring_mmap (struct file *filp,struct kobject *kobj, -struct bin_attribute *attr, -struct vm_area_struct *vma) +static int +hv_uio_ring_mmap (struct vmbus_channel *channel,struct vm_area_struct *vma) { -struct vmbus_channel *channel - = container_of(kobj, struct vmbus_channel, kobj);void *ring_buffer =page_address (channel->ringbuffer_page);if (channel->state !=CHANNEL_OPENED_STATE )
@@ -149,15 +146,6 @@ static int hv_uio_ring_mmap(struct file channel->ringbuffer_pagecount << PAGE_SHIFT); } -static const struct bin_attribute ring_buffer_bin_attr = { - .attr = { - .name ="ring" , - .mode =0600 , - }, - .size =2 *SZ_2M , - .mmap = hv_uio_ring_mmap, -}; -/* Callback from VMBUS subsystem when new channel created. */ static void hv_uio_new_channel (struct vmbus_channel *new_sc)
@@ -178,8 +166,7 @@ hv_uio_new_channel(struct vmbus_channel/* Disable interrupts on sub channel */ new_sc->inbound.ring_buffer->interrupt_mask =1 ;set_channel_read_mode (new_sc,HV_CALL_ISR ); - - ret =sysfs_create_bin_file (&new_sc->kobj, &ring_buffer_bin_attr); + ret =hv_create_ring_sysfs (new_sc, hv_uio_ring_mmap);if (ret) {dev_err (device,"sysfs create ring bin file failed; %d\n" , ret);vmbus_close (new_sc);
@@ -350,10 +337,18 @@ hv_uio_probe(struct hv_device *dev, goto fail_close; } - ret =sysfs_create_bin_file (&channel->kobj, &ring_buffer_bin_attr); -if (ret) -dev_notice (&dev->device, -"sysfs create ring bin file failed; %d\n" , ret); +/* +* This internally calls sysfs_update_group, which returns a non-zero value if it executes +* before sysfs_create_group. This is expected as the 'ring' will be created later in +* vmbus_device_register() -> vmbus_add_channel_kobj(). Thus, no need to check the return +* value and print warning. +* +* Creating/exposing sysfs in driver probe is not encouraged as it can lead to race +* conditions with userspace. For backward compatibility, "ring" sysfs could not be removed +* or decoupled from uio_hv_generic probe. Userspace programs can make use of inotify +* APIs to make sure that ring is created. +*/ +hv_create_ring_sysfs (channel, hv_uio_ring_mmap);hv_set_drvdata (dev, pdata);
@@ -375,7 +370,7 @@ hv_uio_remove(struct hv_device *dev)if (!pdata)return ; -sysfs_remove_bin_file (&dev->channel->kobj, &ring_buffer_bin_attr); +hv_remove_ring_sysfs (dev->channel);uio_unregister_device (&pdata->info);hv_uio_cleanup (dev, pdata);
include/linux/hyperv.h +6 -0
@@ -1067,6 +1067,12 @@ struct vmbus_channel {/* The max size of a packet on this channel */ u32 max_pkt_size; + +/* function to mmap ring buffer memory to the channel's sysfs ring attribute */ +int (*mmap_ring_buffer)(struct vmbus_channel *channel,struct vm_area_struct *vma); + +/* boolean to control visibility of sysfs for ring buffer */ +bool ring_sysfs_visible; };#define lock_requestor (channel, flags) \
Greg Kroah-Hartman
maintainerPATCH 14/143 KVM: Add member to struct kvm_gfn_range to indicate private/shared
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Isaku Yamahata <[email protected]>
[ Upstream commit dca6c88532322830d5d92486467fcc91b67a9ad8 ]
Add new members to strut kvm_gfn_range to indicate which mapping (private-vs-shared) to operate on: enum kvm_gfn_range_filter attr_filter. Update the core zapping operations to set them appropriately.
TDX utilizes two GPA aliases for the same memslots, one for memory that is for private memory and one that is for shared. For private memory, KVM cannot always perform the same operations it does on memory for default VMs, such as zapping pages and having them be faulted back in, as this requires guest coordination. However, some operations such as guest driven conversion of memory between private and shared should zap private memory.
Internally to the MMU, private and shared mappings are tracked on separate roots. Mapping and zapping operations will operate on the respective GFN alias for each root (private or shared). So zapping operations will by default zap both aliases. Add fields in struct kvm_gfn_range to allow callers to specify which aliases so they can only target the aliases appropriate for their specific operation.
There was feedback that target aliases should be specified such that the default value (0) is to operate on both aliases. Several options were considered. Several variations of having separate bools defined such that the default behavior was to process both aliases. They either allowed nonsensical configurations, or were confusing for the caller. A simple enum was also explored and was close, but was hard to process in the caller. Instead, use an enum with the default value (0) reserved as a disallowed value. Catch ranges that didn't have the target aliases specified by looking for that specific value.
Set target alias with enum appropriately for these MMU operations:
- For KVM's mmu notifier callbacks, zap shared pages only because private pages won't have a userspace mapping
- For setting memory attributes, kvm_arch_pre_set_memory_attributes() chooses the aliases based on the attribute.
- For guest_memfd invalidations, zap private only.
Message-ID: <[email protected]>
Stable-dep-of: 9129633d568e ("KVM: x86/mmu: Prevent installing hugepages when mem attributes are changing")
--- arch/x86/kvm/mmu/mmu.c | 6 ++++++ include/linux/kvm_host.h | 6 ++++++ virt/kvm/guest_memfd.c | 2 ++ virt/kvm/kvm_main.c | 14 ++++++++++++++ 4 files changed, 28 insertions(+)
arch/x86/kvm/mmu/mmu.c +6 -0
@@ -7633,6 +7633,12 @@ bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,if (WARN_ON_ONCE (!kvm_arch_has_private_mem (kvm)))return false; +/* Unmap the old attribute page. */ +if (range->arg.attributes &KVM_MEMORY_ATTRIBUTE_PRIVATE ) + range->attr_filter =KVM_FILTER_SHARED ; +else + range->attr_filter =KVM_FILTER_PRIVATE ; +return kvm_unmap_gfn_range (kvm, range); }
include/linux/kvm_host.h +6 -0
@@ -260,11 +260,17 @@ union kvm_mmu_notifier_arg {unsigned long attributes; }; +enum kvm_gfn_range_filter { +KVM_FILTER_SHARED =BIT (0 ), +KVM_FILTER_PRIVATE =BIT (1 ), +}; +struct kvm_gfn_range {struct kvm_memory_slot *slot;gfn_t start;gfn_t end;union kvm_mmu_notifier_arg arg; +enum kvm_gfn_range_filter attr_filter;bool may_block; };bool kvm_unmap_gfn_range (struct kvm *kvm,struct kvm_gfn_range *range);
virt/kvm/guest_memfd.c +2 -0
@@ -118,6 +118,8 @@ static void kvm_gmem_invalidate_begin(struct kvm_gmem *gmem, pgoff_t start, .end = slot->base_gfn + min(pgoff + slot->npages, end) - pgoff, .slot = slot, .may_block = true, + /* guest memfd is relevant to only private mappings. */ + .attr_filter = KVM_FILTER_PRIVATE, };if (!found_memslot) {
virt/kvm/kvm_main.c +14 -0
@@ -632,6 +632,11 @@ static __always_inline kvm_mn_ret_t __kvm_handle_hva_range(struct kvm *kvm,*/ gfn_range.arg = range->arg; gfn_range.may_block = range->may_block; +/* +* HVA-based notifications aren't relevant to private +* mappings as they don't have a userspace mapping. +*/ + gfn_range.attr_filter =KVM_FILTER_SHARED ;/* * {gfn(page) | page intersects with [hva_start, hva_end)} =
@@ -2454,6 +2459,14 @@ static __always_inline void kvm_handle_gfn_range(struct kvm *kvm, gfn_range.arg = range->arg; gfn_range.may_block = range->may_block; +/* +* If/when KVM supports more attributes beyond private .vs shared, this +* _could_ set KVM_FILTER_{SHARED,PRIVATE} appropriately if the entire target +* range already has the desired private vs. shared state (it's unclear +* if that is a net win). For now, KVM reaches this point if and only +* if the private flag is being toggled, i.e. all mappings are in play. +*/ +for (i =0 ; i <kvm_arch_nr_memslot_as_ids (kvm); i++) { slots =__kvm_memslots (kvm, i);
@@ -2510,6 +2523,7 @@ static int kvm_vm_set_mem_attributes(struct kvm *kvm, gfn_t start, gfn_t end,struct kvm_mmu_notifier_range pre_set_range = { .start = start, .end = end, + .arg.attributes = attributes, .handler = kvm_pre_set_memory_attributes, .on_lock = kvm_mmu_invalidate_begin, .flush_on_ret = true,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 15/143 KVM: x86/mmu: Prevent installing hugepages when mem attributes are changing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
[ Upstream commit 9129633d568edd36aa22bf703b12835153cec985 ]
When changing memory attributes on a subset of a potential hugepage, add the hugepage to the invalidation range tracking to prevent installing a hugepage until the attributes are fully updated. Like the actual hugepage tracking updates in kvm_arch_post_set_memory_attributes(), process only the head and tail pages, as any potential hugepages that are entirely covered by the range will already be tracked.
Note, only hugepage chunks whose current attributes are NOT mixed need to be added to the invalidation set, as mixed attributes already prevent installing a hugepage, and it's perfectly safe to install a smaller mapping for a gfn whose attributes aren't changing.
--- arch/x86/kvm/mmu/mmu.c | 69 ++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 16 deletions(-)
arch/x86/kvm/mmu/mmu.c +53 -16
@@ -7616,9 +7616,30 @@ void kvm_mmu_pre_destroy_vm(struct kvm *kvm) }#ifdef CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES +static bool hugepage_test_mixed (struct kvm_memory_slot *slot,gfn_t gfn, +int level) +{ +return lpage_info_slot (gfn, slot, level)->disallow_lpage &KVM_LPAGE_MIXED_FLAG ; +} + +static void hugepage_clear_mixed (struct kvm_memory_slot *slot,gfn_t gfn, +int level) +{ +lpage_info_slot (gfn, slot, level)->disallow_lpage &= ~KVM_LPAGE_MIXED_FLAG ; +} + +static void hugepage_set_mixed (struct kvm_memory_slot *slot,gfn_t gfn, +int level) +{ +lpage_info_slot (gfn, slot, level)->disallow_lpage |=KVM_LPAGE_MIXED_FLAG ; +} +bool kvm_arch_pre_set_memory_attributes (struct kvm *kvm,struct kvm_gfn_range *range) { +struct kvm_memory_slot *slot = range->slot; +int level; +/* * Zap SPTEs even if the slot can't be mapped PRIVATE. KVM x86 only * supports KVM_MEMORY_ATTRIBUTE_PRIVATE, and so it *seems* like KVM
@@ -7633,6 +7654,38 @@ bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,if (WARN_ON_ONCE (!kvm_arch_has_private_mem (kvm)))return false; +if (WARN_ON_ONCE (range->end <= range->start)) +return false; + +/* +* If the head and tail pages of the range currently allow a hugepage, +* i.e. reside fully in the slot and don't have mixed attributes, then +* add each corresponding hugepage range to the ongoing invalidation, +* e.g. to prevent KVM from creating a hugepage in response to a fault +* for a gfn whose attributes aren't changing. Note, only the range +* of gfns whose attributes are being modified needs to be explicitly +* unmapped, as that will unmap any existing hugepages. +*/ +for (level =PG_LEVEL_2M ; level <=KVM_MAX_HUGEPAGE_LEVEL ; level++) { +gfn_t start =gfn_round_for_level (range->start, level); +gfn_t end =gfn_round_for_level (range->end -1 , level); +gfn_t nr_pages =KVM_PAGES_PER_HPAGE (level); + +if ((start != range->start || start + nr_pages > range->end) && + start >= slot->base_gfn && + start + nr_pages <= slot->base_gfn + slot->npages && + !hugepage_test_mixed (slot, start, level)) +kvm_mmu_invalidate_range_add (kvm, start, start + nr_pages); + +if (end == start) +continue ; + +if ((end + nr_pages) > range->end && + (end + nr_pages) <= (slot->base_gfn + slot->npages) && + !hugepage_test_mixed (slot, end, level)) +kvm_mmu_invalidate_range_add (kvm, end, end + nr_pages); + } +/* Unmap the old attribute page. */ if (range->arg.attributes &KVM_MEMORY_ATTRIBUTE_PRIVATE ) range->attr_filter =KVM_FILTER_SHARED ;
@@ -7642,23 +7695,7 @@ bool kvm_arch_pre_set_memory_attributes(struct kvm *kvm,return kvm_unmap_gfn_range (kvm, range); } -static bool hugepage_test_mixed (struct kvm_memory_slot *slot,gfn_t gfn, -int level) -{ -return lpage_info_slot (gfn, slot, level)->disallow_lpage &KVM_LPAGE_MIXED_FLAG ; -} - -static void hugepage_clear_mixed (struct kvm_memory_slot *slot,gfn_t gfn, -int level) -{ -lpage_info_slot (gfn, slot, level)->disallow_lpage &= ~KVM_LPAGE_MIXED_FLAG ; -} -static void hugepage_set_mixed (struct kvm_memory_slot *slot,gfn_t gfn, -int level) -{ -lpage_info_slot (gfn, slot, level)->disallow_lpage |=KVM_LPAGE_MIXED_FLAG ; -}static bool hugepage_has_attrs (struct kvm *kvm,struct kvm_memory_slot *slot,gfn_t gfn,int level,unsigned long attrs)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 16/143 iio: adc: ad7266: Fix potential timestamp alignment issue.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 52d349884738c346961e153f195f4c7fe186fcf4 ]
On architectures where an s64 is only 32-bit aligned insufficient padding would be left between the earlier elements and the timestamp. Use aligned_s64 to enforce the correct placement and ensure the storage is large enough.
--- drivers/iio/adc/ad7266.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7266.c +1 -1
@@ -45,7 +45,7 @@ struct ad7266_state {*/ struct {__be16 sample[2 ]; -s64 timestamp; +aligned_s64 timestamp; } data__aligned(IIO_DMA_MINALIGN) ; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 17/143 iio: chemical: pms7003: use aligned_s64 for timestamp
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
[ Upstream commit 6ffa698674053e82e811520642db2650d00d2c01 ]
Follow the pattern of other drivers and use aligned_s64 for the timestamp. This will ensure that the timestamp is correctly aligned on all architectures.
Also move the unaligned.h header while touching this since it was the only one not in alphabetical order.
--- drivers/iio/chemical/pms7003.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/chemical/pms7003.c +3 -2
@@ -5,7 +5,6 @@* Copyright (c) Tomasz Duszynski <[email protected]> */ -#include <linux/unaligned.h> #include <linux/completion.h> #include <linux/device.h> #include <linux/errno.h>
@@ -19,6 +18,8 @@#include <linux/module.h> #include <linux/mutex.h> #include <linux/serdev.h> +#include <linux/types.h> +#include <linux/unaligned.h> #define PMS7003_DRIVER_NAME "pms7003"
@@ -76,7 +77,7 @@ struct pms7003_state {/* Used to construct scan to push to the IIO buffer */ struct {u16 data[3 ];/* PM1, PM2P5, PM10 */ -s64 ts; +aligned_s64 ts; } scan; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 18/143 iio: pressure: mprls0025pa: use aligned_s64 for timestamp
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
[ Upstream commit ffcd19e9f4cca0c8f9e23e88f968711acefbb37b ]
Follow the pattern of other drivers and use aligned_s64 for the timestamp. This will ensure the struct itself it also 8-byte aligned.
While touching this, convert struct mpr_chan to an anonymous struct to consolidate the code a bit to make it easier for future readers.
--- drivers/iio/pressure/mprls0025pa.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/iio/pressure/mprls0025pa.h +6 -11
@@ -34,16 +34,6 @@ struct iio_dev;struct mpr_data ;struct mpr_ops ; -/** -* struct mpr_chan -* @pres: pressure value -* @ts: timestamp -*/ -struct mpr_chan { -s32 pres; -s64 ts; -}; -enum mpr_func_id {MPR_FUNCTION_A ,MPR_FUNCTION_B ,
@@ -69,6 +59,8 @@ enum mpr_func_id {* reading in a loop until data is ready * @completion: handshake from irq to read * @chan: channel values for buffered mode +* @chan.pres: pressure value +* @chan.ts: timestamp * @buffer: raw conversion data */ struct mpr_data {
@@ -87,7 +79,10 @@ struct mpr_data {struct gpio_desc *gpiod_reset;int irq;struct completion completion; -struct mpr_chan chan; +struct { +s32 pres; +aligned_s64 ts; + } chan;u8 buffer[MPR_MEASUREMENT_RD_SIZE ]__aligned(IIO_DMA_MINALIGN) ; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 19/143 drm/amd: Add Suspend/Hibernate notification callback support
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 2965e6355dcdf157b5fafa25a2715f00064da8bf ]
As part of the suspend sequence VRAM needs to be evicted on dGPUs. In order to make suspend/resume more reliable we moved this into the pmops prepare() callback so that the suspend sequence would fail but the system could remain operational under high memory usage suspend.
Another class of issues exist though where due to memory fragementation there isn't a large enough contiguous space and swap isn't accessible.
Add support for a suspend/hibernate notification callback that could evict VRAM before tasks are frozen. This should allow paging out to swap if necessary.
Stable-dep-of: d0ce1aaa8531 ("Revert "drm/amd: Stop evicting resources on APUs in suspend"")
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 46 +++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 - 3 files changed, 46 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -853,6 +853,7 @@ struct amdgpu_device {bool need_swiotlb;bool accel_working;struct notifier_block acpi_nb; +struct notifier_block pm_nb;struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS ];struct debugfs_blob_wrapper debugfs_vbios_blob;struct debugfs_blob_wrapper debugfs_discovery_blob;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +45 -1
76 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
@@ -2635,7 +2635,6 @@ static int amdgpu_pmops_freeze(struct device *dev)struct amdgpu_device *adev =drm_to_adev (drm_dev);int r; - adev->in_s4 = true; r =amdgpu_device_suspend (drm_dev, true);if (r)return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 20/143 Revert "drm/amd: Stop evicting resources on APUs in suspend"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit d0ce1aaa8531a4a4707711cab5721374751c51b0 ]
This reverts commit 3a9626c816db901def438dc2513622e281186d39.
This breaks S4 because we end up setting the s3/s0ix flags even when we are entering s4 since prepare is used by both flows. The causes both the S3/s0ix and s4 flags to be set which breaks several checks in the driver which assume they are mutually exclusive.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 18 ------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 ++--------- 3 files changed, 2 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
@@ -1571,11 +1571,9 @@ static inline void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_cap#if defined(CONFIG_ACPI ) && defined(CONFIG_SUSPEND )bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev);bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev); -void amdgpu_choose_low_power_state (struct amdgpu_device *adev);#else static inline bool amdgpu_acpi_is_s0ix_active (struct amdgpu_device *adev) {return false; }static inline bool amdgpu_acpi_is_s3_active (struct amdgpu_device *adev) {return false; } -static inline void amdgpu_choose_low_power_state (struct amdgpu_device *adev) { }#endif void amdgpu_register_gpu_instance (struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +0 -18
@@ -1533,22 +1533,4 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) #endif /* CONFIG_AMD_PMC */ } -/** -* amdgpu_choose_low_power_state -* -* @adev: amdgpu_device_pointer -* -* Choose the target low power state for the GPU -*/ -void amdgpu_choose_low_power_state (struct amdgpu_device *adev) -{ -if (adev->in_runpm) -return ; - -if (amdgpu_acpi_is_s0ix_active (adev)) - adev->in_s0ix = true; -else if (amdgpu_acpi_is_s3_active (adev)) - adev->in_s3 = true; -} -#endif /* CONFIG_SUSPEND */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -9
@@ -4770,15 +4770,13 @@ int amdgpu_device_prepare(struct drm_device *dev)struct amdgpu_device *adev =drm_to_adev (dev);int i, r; -amdgpu_choose_low_power_state (adev); -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;/* Evict the majority of BOs before starting suspend sequence */ r =amdgpu_device_evict_resources (adev);if (r) - goto unprepare; +return r;flush_delayed_work (&adev->gfx.gfx_off_delay_work);
@@ -4789,15 +4787,10 @@ int amdgpu_device_prepare(struct drm_device *dev)continue ; r = adev->ip_blocks[i].version->funcs->prepare_suspend ((void *)adev);if (r) - goto unprepare; +return r; }return 0 ; - -unprepare: - adev->in_s0ix = adev->in_s3 = adev->in_s4 = false; - -return r; }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 21/143 xhci: dbc: Improve performance by removing delay in transfer event polling.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit 03e3d9c2bd85cda941b3cf78e895c1498ac05c5f ]
Queue event polling work with 0 delay in case there are pending transfers queued up. This is part 2 of a 3 part series that roughly triples dbc performace when using adb push and pull over dbc.
Max/min push rate after patches is 210/118 MB/s, pull rate 171/133 MB/s, tested with large files (300MB-9GB) by Łukasz Bartosik
First performance improvement patch was commit 31128e7492dc ("xhci: dbc: add dbgtty request to end of list once it completes")
Stable-dep-of: cab63934c33b ("xhci: dbc: Avoid event polling busyloop if pending rx transfers are inactive.")
--- drivers/usb/host/xhci-dbgcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-dbgcap.c +1 -1
@@ -954,7 +954,7 @@ static void xhci_dbc_handle_events(struct work_struct *work)/* set fast poll rate if there are pending data transfers */ if (!list_empty (&dbc->eps[BULK_OUT ].list_pending) || !list_empty (&dbc->eps[BULK_IN ].list_pending)) - poll_interval =1 ; + poll_interval =0 ;break ;default :dev_info (dbc->dev,"stop handling dbc events\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 22/143 xhci: dbc: Avoid event polling busyloop if pending rx transfers are inactive.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit cab63934c33b12c0d1e9f4da7450928057f2c142 ]
Event polling delay is set to 0 if there are any pending requests in either rx or tx requests lists. Checking for pending requests does not work well for "IN" transfers as the tty driver always queues requests to the list and TRBs to the ring, preparing to receive data from the host.
This causes unnecessary busylooping and cpu hogging.
Only set the event polling delay to 0 if there are pending tx "write" transfers, or if it was less than 10ms since last active data transfer in any direction.
--- drivers/usb/host/xhci-dbgcap.c | 19 ++++++++++++++++--- drivers/usb/host/xhci-dbgcap.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-dbgcap.c +16 -3
@@ -822,6 +822,7 @@ static enum evtreturn xhci_dbc_do_handle_events(struct xhci_dbc *dbc) {dma_addr_t deq;union xhci_trb *evt; +enum evtreturn ret =EVT_DONE ;u32 ctrl, portsc;bool update_erdp = false;
@@ -906,6 +907,7 @@ static enum evtreturn xhci_dbc_do_handle_events(struct xhci_dbc *dbc)break ;case TRB_TYPE (TRB_TRANSFER ):dbc_handle_xfer_event (dbc, evt); + ret =EVT_XFER_DONE ;break ;default :break ;
@@ -924,7 +926,7 @@ static enum evtreturn xhci_dbc_do_handle_events(struct xhci_dbc *dbc)lo_hi_writeq (deq, &dbc->regs->erdp); } -return EVT_DONE ; +return ret; }static void xhci_dbc_handle_events (struct work_struct *work)
@@ -933,6 +935,7 @@ static void xhci_dbc_handle_events(struct work_struct *work)struct xhci_dbc *dbc;unsigned long flags;unsigned int poll_interval; +unsigned long busypoll_timelimit; dbc = container_of(to_delayed_work(work), struct xhci_dbc, event_work); poll_interval = dbc->poll_interval;
@@ -951,11 +954,21 @@ static void xhci_dbc_handle_events(struct work_struct *work) dbc->driver->disconnect (dbc);break ;case EVT_DONE : -/* set fast poll rate if there are pending data transfers */ +/* +* Set fast poll rate if there are pending out transfers, or +* a transfer was recently processed +*/ + busypoll_timelimit = dbc->xfer_timestamp + +msecs_to_jiffies (DBC_XFER_INACTIVITY_TIMEOUT ); +if (!list_empty (&dbc->eps[BULK_OUT ].list_pending) || - !list_empty (&dbc->eps[BULK_IN ].list_pending)) +time_is_after_jiffies (busypoll_timelimit)) poll_interval =0 ;break ; +case EVT_XFER_DONE : + dbc->xfer_timestamp = jiffies; + poll_interval =0 ; +break ;default :dev_info (dbc->dev,"stop handling dbc events\n" );return ;
drivers/usb/host/xhci-dbgcap.h +3 -0
@@ -96,6 +96,7 @@ struct dbc_ep {#define DBC_WRITE_BUF_SIZE 8192#define DBC_POLL_INTERVAL_DEFAULT 64/* milliseconds */ #define DBC_POLL_INTERVAL_MAX 5000/* milliseconds */ +#define DBC_XFER_INACTIVITY_TIMEOUT 10/* milliseconds */ /* * Private structure for DbC hardware state: */
@@ -142,6 +143,7 @@ struct xhci_dbc {enum dbc_state state;struct delayed_work event_work;unsigned int poll_interval;/* ms */ +unsigned long xfer_timestamp; unsigned resume_required:1;struct dbc_ep eps[2 ];
@@ -187,6 +189,7 @@ struct dbc_request {enum evtreturn {EVT_ERR =-1 ,EVT_DONE , +EVT_XFER_DONE ,EVT_GSER ,EVT_DISC , };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 23/143 iio: adc: ad7768-1: Fix insufficient alignment of timestamp.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit ffbc26bc91c1f1eb3dcf5d8776e74cbae21ee13a ]
On architectures where an s64 is not 64-bit aligned, this may result insufficient alignment of the timestamp and the structure being too small. Use aligned_s64 to force the alignment.
--- drivers/iio/adc/ad7768-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7768-1.c +1 -1
@@ -169,7 +169,7 @@ struct ad7768_state {union {struct {__be32 chan; -s64 timestamp; +aligned_s64 timestamp; } scan;__be32 d32;u8 d8[2 ];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 24/143 iio: chemical: sps30: use aligned_s64 for timestamp
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
[ Upstream commit bb49d940344bcb8e2b19e69d7ac86f567887ea9a ]
Follow the pattern of other drivers and use aligned_s64 for the timestamp. This will ensure that the timestamp is correctly aligned on all architectures.
--- drivers/iio/chemical/sps30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/sps30.c +1 -1
@@ -108,7 +108,7 @@ static irqreturn_t sps30_trigger_handler(int irq, void *p)int ret;struct {s32 data[4 ];/* PM1, PM2P5, PM4, PM10 */ -s64 ts; +aligned_s64 ts; } scan;mutex_lock (&state->lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 25/143 virtio_ring: add a func argument recycle_done to virtqueue_reset()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
[ Upstream commit 8d2da07c813ad333c20eb803e15f8c4541f25350 ]
When virtqueue_reset() has actually recycled all unused buffers, additional work may be required in some cases. Relying solely on its return status is fragile, so introduce a new function argument 'recycle_done', which is invoked when it really occurs.
Stable-dep-of: 76a771ec4c9a ("virtio_net: ensure netdev_tx_reset_queue is called on bind xsk for tx")
--- drivers/net/virtio_net.c | 4 ++-- drivers/virtio/virtio_ring.c | 6 +++++- include/linux/virtio.h | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/virtio_net.c +2 -2
@@ -5547,7 +5547,7 @@ static int virtnet_rq_bind_xsk_pool(struct virtnet_info *vi, struct receive_queuvirtnet_rx_pause (vi, rq); - err =virtqueue_reset (rq->vq, virtnet_rq_unmap_free_buf); + err =virtqueue_reset (rq->vq, virtnet_rq_unmap_free_buf,NULL );if (err) {netdev_err (vi->dev,"reset rx fail: rx queue index: %d err: %d\n" , qindex, err);
@@ -5576,7 +5576,7 @@ static int virtnet_sq_bind_xsk_pool(struct virtnet_info *vi,virtnet_tx_pause (vi, sq); - err =virtqueue_reset (sq->vq, virtnet_sq_free_unused_buf); + err =virtqueue_reset (sq->vq, virtnet_sq_free_unused_buf,NULL );if (err) {netdev_err (vi->dev,"reset tx fail: tx queue index: %d err: %d\n" , qindex, err); pool =NULL ;
drivers/virtio/virtio_ring.c +5 -1
@@ -2815,6 +2815,7 @@ EXPORT_SYMBOL_GPL(virtqueue_set_dma_premapped);* virtqueue_reset - detach and recycle all unused buffers * @_vq: the struct virtqueue we're talking about. * @recycle: callback to recycle unused buffers +* @recycle_done: callback to be invoked when recycle for all unused buffers done * * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted).
@@ -2826,7 +2827,8 @@ EXPORT_SYMBOL_GPL(virtqueue_set_dma_premapped);* -EPERM: Operation not permitted */ int virtqueue_reset (struct virtqueue *_vq, -void (*recycle)(struct virtqueue *vq,void *buf)) +void (*recycle)(struct virtqueue *vq,void *buf), +void (*recycle_done)(struct virtqueue *vq)) {struct vring_virtqueue *vq =to_vvq (_vq);int err;
@@ -2834,6 +2836,8 @@ int virtqueue_reset(struct virtqueue *_vq, err =virtqueue_disable_and_recycle (_vq, recycle);if (err)return err; +if (recycle_done) +recycle_done (_vq);if (vq->packed_ring)virtqueue_reinit_packed (vq);
include/linux/virtio.h +2 -1
@@ -103,7 +103,8 @@ int virtqueue_resize(struct virtqueue *vq, u32 num,void (*recycle)(struct virtqueue *vq,void *buf), void (*recycle_done)(struct virtqueue *vq));int virtqueue_reset (struct virtqueue *vq, -void (*recycle)(struct virtqueue *vq,void *buf)); +void (*recycle)(struct virtqueue *vq,void *buf), +void (*recycle_done)(struct virtqueue *vq));struct virtio_admin_cmd {__le16 opcode;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 26/143 virtio_net: ensure netdev_tx_reset_queue is called on bind xsk for tx
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
[ Upstream commit 76a771ec4c9adfd75fe53c8505cf656a075d7101 ]
virtnet_sq_bind_xsk_pool() flushes tx skbs and then resets tx queue, so DQL counters need to be reset when flushing has actually occurred, Add virtnet_sq_free_unused_buf_done() as a callback for virtqueue_resize() to handle this.
--- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +2 -1
@@ -5576,7 +5576,8 @@ static int virtnet_sq_bind_xsk_pool(struct virtnet_info *vi,virtnet_tx_pause (vi, sq); - err =virtqueue_reset (sq->vq, virtnet_sq_free_unused_buf,NULL ); + err =virtqueue_reset (sq->vq, virtnet_sq_free_unused_buf, + virtnet_sq_free_unused_buf_done);if (err) {netdev_err (vi->dev,"reset tx fail: tx queue index: %d err: %d\n" , qindex, err); pool =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 27/143 RDMA/rxe: Fix slab-use-after-free Read in rxe_queue_cleanup bug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit f81b33582f9339d2dc17c69b92040d3650bb4bae ]
Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x7d/0xa0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcf/0x610 mm/kasan/report.c:489 kasan_report+0xb5/0xe0 mm/kasan/report.c:602 rxe_queue_cleanup+0xd0/0xe0 drivers/infiniband/sw/rxe/rxe_queue.c:195 rxe_cq_cleanup+0x3f/0x50 drivers/infiniband/sw/rxe/rxe_cq.c:132 __rxe_cleanup+0x168/0x300 drivers/infiniband/sw/rxe/rxe_pool.c:232 rxe_create_cq+0x22e/0x3a0 drivers/infiniband/sw/rxe/rxe_verbs.c:1109 create_cq+0x658/0xb90 drivers/infiniband/core/uverbs_cmd.c:1052 ib_uverbs_create_cq+0xc7/0x120 drivers/infiniband/core/uverbs_cmd.c:1095 ib_uverbs_write+0x969/0xc90 drivers/infiniband/core/uverbs_main.c:679 vfs_write fs/read_write.c:677 [inline] vfs_write+0x26a/0xcc0 fs/read_write.c:659 ksys_write+0x1b8/0x200 fs/read_write.c:731 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xaa/0x1b0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
In the function rxe_create_cq, when rxe_cq_from_init fails, the function rxe_cleanup will be called to handle the allocated resources. In fact, some memory resources have already been freed in the function rxe_cq_from_init. Thus, this problem will occur.
The solution is to let rxe_cleanup do all the work.
--- drivers/infiniband/sw/rxe/rxe_cq.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_cq.c +1 -4
@@ -56,11 +56,8 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, err =do_mmap_info (rxe, uresp ? &uresp->mi :NULL , udata, cq->queue->buf, cq->queue->buf_size, &cq->queue->ip); -if (err) { -vfree (cq->queue->buf); -kfree (cq->queue); +if (err)return err; - } cq->is_user = uresp;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 28/143 HID: thrustmaster: fix memory leak in thrustmaster_interrupts()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
[ Upstream commit 09d546303b370113323bfff456c4e8cff8756005 ]
In thrustmaster_interrupts(), the allocated send_buf is not freed if the usb_check_int_endpoints() check fails, leading to a memory leak.
Fix this by ensuring send_buf is freed before returning in the error path.
--- drivers/hid/hid-thrustmaster.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-thrustmaster.c +1 -0
@@ -174,6 +174,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev)u8 ep_addr[2 ] = {b_ep,0 };if (!usb_check_int_endpoints (usbif, ep_addr)) { +kfree (send_buf);hid_err (hdev,"Unexpected non-int endpoint\n" );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 29/143 HID: uclogic: Add NULL check in uclogic_input_configured()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit bd07f751208ba190f9b0db5e5b7f35d5bb4a8a1e ]
devm_kasprintf() returns NULL when memory allocation fails. Currently, uclogic_input_configured() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
--- drivers/hid/hid-uclogic-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/hid/hid-uclogic-core.c +4 -3
@@ -142,11 +142,12 @@ static int uclogic_input_configured(struct hid_device *hdev, suffix ="System Control" ;break ; } - } - -if (suffix) + }else { hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL ,"%s %s" , hdev->name, suffix); +if (!hi->input->name) +return -ENOMEM ; + }return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 30/143 nfs: handle failure of nfs_get_lock_context in unlock path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit c457dc1ec770a22636b473ce5d35614adfe97636 ]
When memory is insufficient, the allocation of nfs_lock_context in nfs_get_lock_context() fails and returns -ENOMEM. If we mistakenly treat an nfs4_unlockdata structure (whose l_ctx member has been set to -ENOMEM) as valid and proceed to execute rpc_run_task(), this will trigger a NULL pointer dereference in nfs4_locku_prepare. For example:
BUG: kernel NULL pointer dereference, address: 000000000000000c PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP PTI CPU: 15 UID: 0 PID: 12 Comm: kworker/u64:0 Not tainted 6.15.0-rc2-dirty #60 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 Workqueue: rpciod rpc_async_schedule RIP: 0010:nfs4_locku_prepare+0x35/0xc2 Code: 89 f2 48 89 fd 48 c7 c7 68 69 ef b5 53 48 8b 8e 90 00 00 00 48 89 f3 RSP: 0018:ffffbbafc006bdb8 EFLAGS: 00010246 RAX: 000000000000004b RBX: ffff9b964fc1fa00 RCX: 0000000000000000 RDX: 0000000000000000 RSI: fffffffffffffff4 RDI: ffff9ba53fddbf40 RBP: ffff9ba539934000 R08: 0000000000000000 R09: ffffbbafc006bc38 R10: ffffffffb6b689c8 R11: 0000000000000003 R12: ffff9ba539934030 R13: 0000000000000001 R14: 0000000004248060 R15: ffffffffb56d1c30 FS: 0000000000000000(0000) GS:ffff9ba5881f0000(0000) knlGS:00000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000000000c CR3: 000000093f244000 CR4: 00000000000006f0 Call Trace: <TASK> __rpc_execute+0xbc/0x480 rpc_async_schedule+0x2f/0x40 process_one_work+0x232/0x5d0 worker_thread+0x1da/0x3d0 ? __pfx_worker_thread+0x10/0x10 kthread+0x10d/0x240 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Modules linked in: CR2: 000000000000000c ---[ end trace 0000000000000000 ]---
Free the allocated nfs4_unlockdata when nfs_get_lock_context() fails and return NULL to terminate subsequent rpc_run_task, preventing NULL pointer dereference.
--- fs/nfs/nfs4proc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +8 -1
@@ -7040,10 +7040,18 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,struct nfs4_unlockdata *p;struct nfs4_state *state = lsp->ls_state;struct inode *inode = state->inode; +struct nfs_lock_context *l_ctx; p =kzalloc (sizeof (*p),GFP_KERNEL );if (p ==NULL )return NULL ; + l_ctx =nfs_get_lock_context (ctx); +if (!IS_ERR (l_ctx)) { + p->l_ctx = l_ctx; + }else { +kfree (p); +return NULL ; + } p->arg.fh =NFS_FH (inode); p->arg.fl = &p->fl; p->arg.seqid = seqid;
@@ -7051,7 +7059,6 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl, p->lsp = lsp;/* Ensure we don't close file until we're done freeing locks! */ p->ctx =get_nfs_open_context (ctx); - p->l_ctx =nfs_get_lock_context (ctx);locks_init_lock (&p->fl);locks_copy_lock (&p->fl, fl); p->server =NFS_SERVER (inode);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 31/143 spi: loopback-test: Do not split 1024-byte hexdumps
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit a73fa3690a1f3014d6677e368dce4e70767a6ba2 ]
spi_test_print_hex_dump() prints buffers holding less than 1024 bytes in full. Larger buffers are truncated: only the first 512 and the last 512 bytes are printed, separated by a truncation message. The latter is confusing in case the buffer holds exactly 1024 bytes, as all data is printed anyway.
Fix this by printing buffers holding up to and including 1024 bytes in full.
--- drivers/spi/spi-loopback-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-loopback-test.c +1 -1
@@ -420,7 +420,7 @@ MODULE_LICENSE("GPL");static void spi_test_print_hex_dump (char *pre,const void *ptr,size_t len) {/* limit the hex_dump */ -if (len <1024 ) { +if (len <=1024 ) {print_hex_dump (KERN_INFO , pre,DUMP_PREFIX_OFFSET ,16 ,1 , ptr, len,0 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 32/143 RDMA/core: Fix "KASAN: slab-use-after-free Read in ib_register_device" problem
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit d0706bfd3ee40923c001c6827b786a309e2a8713 ]
Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xc3/0x670 mm/kasan/report.c:521 kasan_report+0xe0/0x110 mm/kasan/report.c:634 strlen+0x93/0xa0 lib/string.c:420 __fortify_strlen include/linux/fortify-string.h:268 [inline] get_kobj_path_length lib/kobject.c:118 [inline] kobject_get_path+0x3f/0x2a0 lib/kobject.c:158 kobject_uevent_env+0x289/0x1870 lib/kobject_uevent.c:545 ib_register_device drivers/infiniband/core/device.c:1472 [inline] ib_register_device+0x8cf/0xe00 drivers/infiniband/core/device.c:1393 rxe_register_device+0x275/0x320 drivers/infiniband/sw/rxe/rxe_verbs.c:1552 rxe_net_add+0x8e/0xe0 drivers/infiniband/sw/rxe/rxe_net.c:550 rxe_newlink+0x70/0x190 drivers/infiniband/sw/rxe/rxe.c:225 nldev_newlink+0x3a3/0x680 drivers/infiniband/core/nldev.c:1796 rdma_nl_rcv_msg+0x387/0x6e0 drivers/infiniband/core/netlink.c:195 rdma_nl_rcv_skb.constprop.0.isra.0+0x2e5/0x450 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x53a/0x7f0 net/netlink/af_netlink.c:1339 netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:712 [inline] __sock_sendmsg net/socket.c:727 [inline] ____sys_sendmsg+0xa95/0xc70 net/socket.c:2566 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2620 __sys_sendmsg+0x16d/0x220 net/socket.c:2652 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
This problem is similar to the problem that the
commit 1d6a9e7449e2 ("RDMA/core: Fix use-after-free when rename device name") fixes.
The root cause is: the function ib_device_rename() renames the name with lock. But in the function kobject_uevent(), this name is accessed without lock protection at the same time.
The solution is to add the lock protection when this name is accessed in the function kobject_uevent().
--- drivers/infiniband/core/device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +4 -2
@@ -1368,6 +1368,9 @@ static void ib_device_notify_register(struct ib_device *device)down_read (&devices_rwsem); +/* Mark for userspace that device is ready */ +kobject_uevent (&device->dev.kobj,KOBJ_ADD ); + ret =rdma_nl_notify_event (device,0 ,RDMA_REGISTER_EVENT );if (ret) goto out;
@@ -1484,10 +1487,9 @@ int ib_register_device(struct ib_device *device, const char *name,return ret; }dev_set_uevent_suppress (&device->dev, false); -/* Mark for userspace that device is ready */ -kobject_uevent (&device->dev.kobj,KOBJ_ADD );ib_device_notify_register (device); +ib_device_put (device);return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 33/143 Bluetooth: MGMT: Fix MGMT_OP_ADD_DEVICE invalid device flags
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 1e2e3044c1bc64a64aa0eaf7c17f7832c26c9775 ]
Device flags could be updated in the meantime while MGMT_OP_ADD_DEVICE is pending on hci_update_passive_scan_sync so instead of setting the current_flags as cmd->user_data just do a lookup using hci_conn_params_lookup and use the latest stored flags.
--- net/bluetooth/mgmt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/bluetooth/mgmt.c +6 -3
@@ -7612,11 +7612,16 @@ static void add_device_complete(struct hci_dev *hdev, void *data, int err)struct mgmt_cp_add_device *cp = cmd->param;if (!err) { +struct hci_conn_params *params; + + params =hci_conn_params_lookup (hdev, &cp->addr.bdaddr, +le_addr_type (cp->addr.type)); +device_added (cmd->sk, hdev, &cp->addr.bdaddr, cp->addr.type, cp->action);device_flags_changed (NULL , hdev, &cp->addr.bdaddr, cp->addr.type, hdev->conn_flags, -PTR_UINT (cmd->user_data)); + params ? params->flags :0 ); } mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_ADD_DEVICE,
@@ -7719,8 +7724,6 @@ static int add_device(struct sock *sk, struct hci_dev *hdev, goto unlock; } - cmd->user_data =UINT_PTR (current_flags); - err =hci_cmd_sync_queue (hdev, add_device_sync, cmd, add_device_complete);if (err <0 ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 34/143 net_sched: Flush gso_skb list too during ->change()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 2d3cbfd6d54a2c39ce3244f33f85c595844bd7b8 ]
Previously, when reducing a qdisc's limit via the ->change() operation, only the main skb queue was trimmed, potentially leaving packets in the gso_skb list. This could result in NULL pointer dereference when we only check sch->limit against sch->q.qlen.
This patch introduces a new helper, qdisc_dequeue_internal(), which ensures both the gso_skb list and the main queue are properly flushed when trimming excess packets. All relevant qdiscs (codel, fq, fq_codel, fq_pie, hhf, pie) are updated to use this helper in their ->change() routines.
--- include/net/sch_generic.h | 15 +++++++++++++++ net/sched/sch_codel.c | 2 +- net/sched/sch_fq.c | 2 +- net/sched/sch_fq_codel.c | 2 +- net/sched/sch_fq_pie.c | 2 +- net/sched/sch_hhf.c | 2 +- net/sched/sch_pie.c | 2 +- 7 files changed, 21 insertions(+), 6 deletions(-)
include/net/sch_generic.h +15 -0
@@ -1031,6 +1031,21 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct qdisc_skb_head *qh)return skb; } +static inline struct sk_buff *qdisc_dequeue_internal (struct Qdisc *sch,bool direct) +{ +struct sk_buff *skb; + + skb =__skb_dequeue (&sch->gso_skb); +if (skb) { + sch->q.qlen--; +return skb; + } +if (direct) +return __qdisc_dequeue_head (&sch->q); +else +return sch->dequeue (sch); +} +static inline struct sk_buff *qdisc_dequeue_head (struct Qdisc *sch) {struct sk_buff *skb =__qdisc_dequeue_head (&sch->q);
net/sched/sch_codel.c +1 -1
@@ -143,7 +143,7 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt, qlen = sch->q.qlen;while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =__qdisc_dequeue_head (&sch->q); +struct sk_buff *skb =qdisc_dequeue_internal (sch, true); dropped +=qdisc_pkt_len (skb);qdisc_qstats_backlog_dec (sch, skb);
net/sched/sch_fq.c +1 -1
@@ -1113,7 +1113,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch); }while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =fq_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false);if (!skb)break ;
net/sched/sch_fq_codel.c +1 -1
@@ -440,7 +440,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,while (sch->q.qlen > sch->limit || q->memory_usage > q->memory_limit) { -struct sk_buff *skb =fq_codel_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false); q->cstats.drop_len +=qdisc_pkt_len (skb);rtnl_kfree_skbs (skb, skb);
net/sched/sch_fq_pie.c +1 -1
@@ -364,7 +364,7 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,/* Drop excess packets if new limit is lower */ while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =fq_pie_qdisc_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false); len_dropped +=qdisc_pkt_len (skb); num_dropped +=1 ;
net/sched/sch_hhf.c +1 -1
@@ -564,7 +564,7 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt, qlen = sch->q.qlen; prev_backlog = sch->qstats.backlog;while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =hhf_dequeue (sch); +struct sk_buff *skb =qdisc_dequeue_internal (sch, false);rtnl_kfree_skbs (skb, skb); }
net/sched/sch_pie.c +1 -1
@@ -192,7 +192,7 @@ static int pie_change(struct Qdisc *sch, struct nlattr *opt,/* Drop excess packets if new limit is lower */ qlen = sch->q.qlen;while (sch->q.qlen > sch->limit) { -struct sk_buff *skb =__qdisc_dequeue_head (&sch->q); +struct sk_buff *skb =qdisc_dequeue_internal (sch, true); dropped +=qdisc_pkt_len (skb);qdisc_qstats_backlog_dec (sch, skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 35/143 tools/net/ynl: ethtool: fix crash when Hardware Clock info is missing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 45375814eb3f4245956c0c85092a4eee4441d167 ]
Fix a crash in the ethtool YNL implementation when Hardware Clock information is not present in the response. This ensures graceful handling of devices or drivers that do not provide this optional field. e.g.
Traceback (most recent call last):
File "/net/tools/net/ynl/pyynl/./ethtool.py", line 438, in <module>
main()
~~~~^^
File "/net/tools/net/ynl/pyynl/./ethtool.py", line 341, in main
print(f'PTP Hardware Clock: {tsinfo["phc-index"]}')
~~~~~~^^^^^^^^^^^^^KeyError: 'phc-index'
--- tools/net/ynl/ethtool.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
tools/net/ynl/ethtool.py +15 -7
@@ -337,16 +337,24 @@ def main(): print('Capabilities:') [print(f'\t{v}') for v in bits_to_dict(tsinfo['timestamping'])] - print(f'PTP Hardware Clock: {tsinfo["phc-index"]}') + print(f'PTP Hardware Clock: {tsinfo.get("phc-index", "none")}') - print('Hardware Transmit Timestamp Modes:') - [print(f'\t{v}') for v in bits_to_dict(tsinfo['tx-types'])] + if 'tx-types' in tsinfo: + print('Hardware Transmit Timestamp Modes:') + [print(f'\t{v}') for v in bits_to_dict(tsinfo['tx-types'])] + else: + print('Hardware Transmit Timestamp Modes: none') + + if 'rx-filters' in tsinfo: + print('Hardware Receive Filter Modes:') + [print(f'\t{v}') for v in bits_to_dict(tsinfo['rx-filters'])] + else: + print('Hardware Receive Filter Modes: none') - print('Hardware Receive Filter Modes:') - [print(f'\t{v}') for v in bits_to_dict(tsinfo['rx-filters'])] + if 'stats' in tsinfo and tsinfo['stats']: + print('Statistics:') + [print(f'\t{k}: {v}') for k, v in tsinfo['stats'].items()] - print('Statistics:') - [print(f'\t{k}: {v}') for k, v in tsinfo['stats'].items()] return print(f'Settings for {args.device}:')
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 36/143 mctp: no longer rely on net->dev_index_head[]
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2d20773aec14996b6cc4db92d885028319be683d ]
mctp_dump_addrinfo() is one of the last users of
net->dev_index_head[] in the control path.
Switch to for_each_netdev_dump() for better scalability.
Use C99 for mctp_device_rtnl_msg_handlers[] to prepare future RTNL removal from mctp_dump_addrinfo()
(mdev->addrs is not yet RCU protected)
Stable-dep-of: f11cf946c0a9 ("net: mctp: Don't access ifa_index when missing")
--- net/mctp/device.c | 50 ++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 31 deletions(-)
net/mctp/device.c +19 -31
@@ -20,8 +20,7 @@#include <net/sock.h> struct mctp_dump_cb { -int h; -int idx; +unsigned long ifindex;size_t a_idx; };
@@ -115,43 +114,29 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb) {struct mctp_dump_cb *mcb = (void *)cb->ctx;struct net *net =sock_net (skb->sk); -struct hlist_head *head;struct net_device *dev;struct ifaddrmsg *hdr;struct mctp_dev *mdev; -int ifindex; -int idx =0 , rc; +int ifindex, rc; hdr =nlmsg_data (cb->nlh);// filter by ifindex if requested ifindex = hdr->ifa_index;rcu_read_lock (); -for (; mcb->h <NETDEV_HASHENTRIES ; mcb->h++, mcb->idx =0 ) { - idx =0 ; - head = &net->dev_index_head[mcb->h]; -hlist_for_each_entry_rcu (dev, head, index_hlist) { -if (idx >= mcb->idx && - (ifindex ==0 || ifindex == dev->ifindex)) { - mdev =__mctp_dev_get (dev); -if (mdev) { - rc =mctp_dump_dev_addrinfo (mdev, - skb, cb); -mctp_dev_put (mdev); -// Error indicates full buffer, this -// callback will get retried. -if (rc <0 ) - goto out; - } - } - idx++; -// reset for next iteration - mcb->a_idx =0 ; - } +for_each_netdev_dump (net, dev, mcb->ifindex) { +if (ifindex && ifindex != dev->ifindex) +continue ; + mdev =__mctp_dev_get (dev); +if (!mdev) +continue ; + rc =mctp_dump_dev_addrinfo (mdev, skb, cb); +mctp_dev_put (mdev); +if (rc <0 ) +break ; + mcb->a_idx =0 ; } -out:rcu_read_unlock (); - mcb->idx = idx;return skb->len; }
@@ -525,9 +510,12 @@ static struct notifier_block mctp_dev_nb = { };static const struct rtnl_msg_handler mctp_device_rtnl_msg_handlers[] = { - {THIS_MODULE ,PF_MCTP ,RTM_NEWADDR , mctp_rtm_newaddr,NULL ,0 }, - {THIS_MODULE ,PF_MCTP ,RTM_DELADDR , mctp_rtm_deladdr,NULL ,0 }, - {THIS_MODULE ,PF_MCTP ,RTM_GETADDR ,NULL , mctp_dump_addrinfo,0 }, + {.owner =THIS_MODULE , .protocol =PF_MCTP , .msgtype =RTM_NEWADDR , + .doit = mctp_rtm_newaddr}, + {.owner =THIS_MODULE , .protocol =PF_MCTP , .msgtype =RTM_DELADDR , + .doit = mctp_rtm_deladdr}, + {.owner =THIS_MODULE , .protocol =PF_MCTP , .msgtype =RTM_GETADDR , + .dumpit = mctp_dump_addrinfo}, };int __init mctp_device_init (void )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 37/143 net: mctp: Dont access ifa_index when missing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Johnston <[email protected]>
[ Upstream commit f11cf946c0a92c560a890d68e4775723353599e1 ]
In mctp_dump_addrinfo, ifa_index can be used to filter interfaces, but only when the struct ifaddrmsg is provided. Otherwise it will be comparing to uninitialised memory - reproducible in the syzkaller case from dhcpd, or busybox "ip addr show".
The kernel MCTP implementation has always filtered by ifa_index, so existing userspace programs expecting to dump MCTP addresses must already be passing a valid ifa_index value (either 0 or a real index).
BUG: KMSAN: uninit-value in mctp_dump_addrinfo+0x208/0xac0 net/mctp/device.c:128 mctp_dump_addrinfo+0x208/0xac0 net/mctp/device.c:128 rtnl_dump_all+0x3ec/0x5b0 net/core/rtnetlink.c:4380 rtnl_dumpit+0xd5/0x2f0 net/core/rtnetlink.c:6824 netlink_dump+0x97b/0x1690 net/netlink/af_netlink.c:2309
--- net/mctp/device.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
net/mctp/device.c +12 -5
@@ -117,11 +117,18 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb)struct net_device *dev;struct ifaddrmsg *hdr;struct mctp_dev *mdev; -int ifindex, rc; - - hdr =nlmsg_data (cb->nlh); -// filter by ifindex if requested - ifindex = hdr->ifa_index; +int ifindex =0 , rc; + +/* Filter by ifindex if a header is provided */ +if (cb->nlh->nlmsg_len >=nlmsg_msg_size (sizeof (*hdr))) { + hdr =nlmsg_data (cb->nlh); + ifindex = hdr->ifa_index; + }else { +if (cb->strict_check) { +NL_SET_ERR_MSG (cb->extack,"mctp: Invalid header for addr dump request" ); +return -EINVAL ; + } + }rcu_read_lock ();for_each_netdev_dump (net, dev, mcb->ifindex) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 38/143 selftests: ncdevmem: Redirect all non-payload output to stderr
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 6891f0b523e1ef452523ba43d67ca2a654760e78 ]
That should make it possible to do expected payload validation on the caller side.
Stable-dep-of: 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array")
--- tools/testing/selftests/net/ncdevmem.c | 61 +++++++++++++------------- 1 file changed, 30 insertions(+), 31 deletions(-)
tools/testing/selftests/net/ncdevmem.c +30 -31
@@ -88,7 +88,6 @@ void print_nonzero_bytes(void *ptr, size_t size)for (i =0 ; i < size; i++)putchar (p[i]); -printf ("\n" ); }void validate_buffer (void *line,size_t size)
@@ -120,7 +119,7 @@ void validate_buffer(void *line, size_t size)char command[256 ]; \memset (command,0 ,sizeof (command)); \ snprintf(command, sizeof(command), cmd, ##__VA_ARGS__); \ -printf ("Running: %s\n" , command); \ +fprintf (stderr,"Running: %s\n" , command); \system (command); \ })
@@ -128,22 +127,22 @@ static int reset_flow_steering(void) {int ret =0 ; - ret =run_command ("sudo ethtool -K %s ntuple off" , ifname); + ret =run_command ("sudo ethtool -K %s ntuple off >&2" , ifname);if (ret)return ret; -return run_command ("sudo ethtool -K %s ntuple on" , ifname); +return run_command ("sudo ethtool -K %s ntuple on >&2" , ifname); }static int configure_headersplit (bool on) { -return run_command ("sudo ethtool -G %s tcp-data-split %s" , ifname, +return run_command ("sudo ethtool -G %s tcp-data-split %s >&2" , ifname, on ?"on" :"off" ); }static int configure_rss (void ) { -return run_command ("sudo ethtool -X %s equal %d" , ifname, start_queue); +return run_command ("sudo ethtool -X %s equal %d >&2" , ifname, start_queue); }static int configure_channels (unsigned int rx,unsigned int tx)
@@ -153,7 +152,7 @@ static int configure_channels(unsigned int rx, unsigned int tx)static int configure_flow_steering (void ) { -return run_command ("sudo ethtool -N %s flow-type tcp4 src-ip %s dst-ip %s src-port %s dst-port %s queue %d" , +return run_command ("sudo ethtool -N %s flow-type tcp4 src-ip %s dst-ip %s src-port %s dst-port %s queue %d >&2" , ifname, client_ip, server_ip, port, port, start_queue); }
@@ -187,7 +186,7 @@ static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd, goto err_close; } -printf ("got dmabuf id=%d\n" , rsp->id); +fprintf (stderr,"got dmabuf id=%d\n" , rsp->id); dmabuf_id = rsp->id;netdev_bind_rx_req_free (req);
@@ -314,8 +313,8 @@ int do_server(void)if (ret)error (errno, errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX ); -printf ("binding to address %s:%d\n" , server_ip, -ntohs (server_sin.sin_port)); +fprintf (stderr,"binding to address %s:%d\n" , server_ip, +ntohs (server_sin.sin_port)); ret =bind (socket_fd, &server_sin,sizeof (server_sin));if (ret)
@@ -329,14 +328,14 @@ int do_server(void)inet_ntop (server_sin.sin_family, &server_sin.sin_addr, buffer,sizeof (buffer)); -printf ("Waiting or connection on %s:%d\n" , buffer, -ntohs (server_sin.sin_port)); +fprintf (stderr,"Waiting or connection on %s:%d\n" , buffer, +ntohs (server_sin.sin_port)); client_fd =accept (socket_fd, &client_addr, &client_addr_len);inet_ntop (client_addr.sin_family, &client_addr.sin_addr, buffer,sizeof (buffer)); -printf ("Got connection from %s:%d\n" , buffer, -ntohs (client_addr.sin_port)); +fprintf (stderr,"Got connection from %s:%d\n" , buffer, +ntohs (client_addr.sin_port));while (1 ) {struct iovec iov = { .iov_base = iobuf,
@@ -349,14 +348,13 @@ int do_server(void)ssize_t ret; is_devmem = false; -printf ("\n\n" ); msg.msg_iov = &iov; msg.msg_iovlen =1 ; msg.msg_control = ctrl_data; msg.msg_controllen =sizeof (ctrl_data); ret =recvmsg (client_fd, &msg,MSG_SOCK_DEVMEM ); -printf ("recvmsg ret=%ld\n" , ret); +fprintf (stderr,"recvmsg ret=%ld\n" , ret);if (ret <0 && (errno ==EAGAIN || errno ==EWOULDBLOCK ))continue ;if (ret <0 ) {
@@ -364,7 +362,7 @@ int do_server(void)continue ; }if (ret ==0 ) { -printf ("client exited\n" ); +fprintf (stderr,"client exited\n" ); goto cleanup; }
@@ -373,7 +371,7 @@ int do_server(void)if (cm->cmsg_level !=SOL_SOCKET || (cm->cmsg_type !=SCM_DEVMEM_DMABUF && cm->cmsg_type !=SCM_DEVMEM_LINEAR )) { -fprintf (stdout,"skipping non-devmem cmsg\n" ); +fprintf (stderr,"skipping non-devmem cmsg\n" );continue ; }
@@ -384,7 +382,7 @@ int do_server(void)/* TODO: process data copied from skb's linear * buffer. */ -fprintf (stdout, +fprintf (stderr,"SCM_DEVMEM_LINEAR. dmabuf_cmsg->frag_size=%u\n" , dmabuf_cmsg->frag_size);
@@ -395,12 +393,13 @@ int do_server(void) token.token_count =1 ; total_received += dmabuf_cmsg->frag_size; -printf ("received frag_page=%llu, in_page_offset=%llu, frag_offset=%llu, frag_size=%u, token=%u, total_received=%lu, dmabuf_id=%u\n" , - dmabuf_cmsg->frag_offset >>PAGE_SHIFT , - dmabuf_cmsg->frag_offset %getpagesize (), - dmabuf_cmsg->frag_offset, dmabuf_cmsg->frag_size, - dmabuf_cmsg->frag_token, total_received, - dmabuf_cmsg->dmabuf_id); +fprintf (stderr, +"received frag_page=%llu, in_page_offset=%llu, frag_offset=%llu, frag_size=%u, token=%u, total_received=%lu, dmabuf_id=%u\n" , + dmabuf_cmsg->frag_offset >>PAGE_SHIFT , + dmabuf_cmsg->frag_offset %getpagesize (), + dmabuf_cmsg->frag_offset, + dmabuf_cmsg->frag_size, dmabuf_cmsg->frag_token, + total_received, dmabuf_cmsg->dmabuf_id);if (dmabuf_cmsg->dmabuf_id != dmabuf_id) error(1, 0,
@@ -438,15 +437,15 @@ int do_server(void)if (!is_devmem)error (1 ,0 ,"flow steering error\n" ); -printf ("total_received=%lu\n" , total_received); +fprintf (stderr,"total_received=%lu\n" , total_received); } -fprintf (stdout,"%s: ok\n" ,TEST_PREFIX ); +fprintf (stderr,"%s: ok\n" ,TEST_PREFIX ); -fprintf (stdout,"page_aligned_frags=%lu, non_page_aligned_frags=%lu\n" , +fprintf (stderr,"page_aligned_frags=%lu, non_page_aligned_frags=%lu\n" , page_aligned_frags, non_page_aligned_frags); -fprintf (stdout,"page_aligned_frags=%lu, non_page_aligned_frags=%lu\n" , +fprintf (stderr,"page_aligned_frags=%lu, non_page_aligned_frags=%lu\n" , page_aligned_frags, non_page_aligned_frags); cleanup:
@@ -551,7 +550,7 @@ int main(int argc, char *argv[]) ifname = optarg;break ;case '?' : -printf ("unknown option: %c\n" , optopt); +fprintf (stderr,"unknown option: %c\n" , optopt);break ; } }
@@ -559,7 +558,7 @@ int main(int argc, char *argv[]) ifindex =if_nametoindex (ifname);for (; optind < argc; optind++) -printf ("extra arguments: %s\n" , argv[optind]); +fprintf (stderr,"extra arguments: %s\n" , argv[optind]);run_devmem_tests ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 39/143 selftests: ncdevmem: Separate out dmabuf provider
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 8b9049af8066b4705d83bb7847ee3c960fc58d09 ]
So we can plug the other ones in the future if needed.
Stable-dep-of: 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array")
--- tools/testing/selftests/net/ncdevmem.c | 203 +++++++++++++++---------- 1 file changed, 119 insertions(+), 84 deletions(-)
tools/testing/selftests/net/ncdevmem.c +119 -84
@@ -71,17 +71,101 @@ static char *ifname = "eth1";static unsigned int ifindex;static unsigned int dmabuf_id; -void print_bytes (void *ptr,size_t size) +struct memory_buffer { +int fd; +size_t size; + +int devfd; +int memfd; +char *buf_mem; +}; + +struct memory_provider { +struct memory_buffer *(*alloc)(size_t size); +void (*free)(struct memory_buffer *ctx); +void (*memcpy_from_device)(void *dst,struct memory_buffer *src, +size_t off,int n); +}; + +static struct memory_buffer *udmabuf_alloc (size_t size) { -unsigned char *p = ptr; -int i; +struct udmabuf_create create; +struct memory_buffer *ctx; +int ret; -for (i =0 ; i < size; i++) -printf ("%02hhX " , p[i]); -printf ("\n" ); + ctx =malloc (sizeof (*ctx)); +if (!ctx) +error (1 ,ENOMEM ,"malloc failed" ); + + ctx->size = size; + + ctx->devfd =open ("/dev/udmabuf" ,O_RDWR ); +if (ctx->devfd <0 ) +error (1 , errno, +"%s: [skip,no-udmabuf: Unable to access DMA buffer device file]\n" , +TEST_PREFIX ); + + ctx->memfd =memfd_create ("udmabuf-test" ,MFD_ALLOW_SEALING ); +if (ctx->memfd <0 ) +error (1 , errno,"%s: [skip,no-memfd]\n" ,TEST_PREFIX ); + + ret =fcntl (ctx->memfd,F_ADD_SEALS ,F_SEAL_SHRINK ); +if (ret <0 ) +error (1 , errno,"%s: [skip,fcntl-add-seals]\n" ,TEST_PREFIX ); + + ret =ftruncate (ctx->memfd, size); +if (ret ==-1 ) +error (1 , errno,"%s: [FAIL,memfd-truncate]\n" ,TEST_PREFIX ); + +memset (&create,0 ,sizeof (create)); + + create.memfd = ctx->memfd; + create.offset =0 ; + create.size = size; + ctx->fd =ioctl (ctx->devfd,UDMABUF_CREATE , &create); +if (ctx->fd <0 ) +error (1 , errno,"%s: [FAIL, create udmabuf]\n" ,TEST_PREFIX ); + + ctx->buf_mem =mmap (NULL , size,PROT_READ |PROT_WRITE ,MAP_SHARED , + ctx->fd,0 ); +if (ctx->buf_mem ==MAP_FAILED ) +error (1 , errno,"%s: [FAIL, map udmabuf]\n" ,TEST_PREFIX ); + +return ctx; +} + +static void udmabuf_free (struct memory_buffer *ctx) +{ +munmap (ctx->buf_mem, ctx->size); +close (ctx->fd); +close (ctx->memfd); +close (ctx->devfd); +free (ctx); } -void print_nonzero_bytes (void *ptr,size_t size) +static void udmabuf_memcpy_from_device (void *dst,struct memory_buffer *src, +size_t off,int n) +{ +struct dma_buf_sync sync = {}; + + sync.flags =DMA_BUF_SYNC_START ; +ioctl (src->fd,DMA_BUF_IOCTL_SYNC , &sync); + +memcpy (dst, src->buf_mem + off, n); + + sync.flags =DMA_BUF_SYNC_END ; +ioctl (src->fd,DMA_BUF_IOCTL_SYNC , &sync); +} + +static struct memory_provider udmabuf_memory_provider = { + .alloc = udmabuf_alloc, + .free = udmabuf_free, + .memcpy_from_device = udmabuf_memcpy_from_device, +}; + +static struct memory_provider *provider = &udmabuf_memory_provider; + +static void print_nonzero_bytes (void *ptr,size_t size) {unsigned char *p = ptr;unsigned int i;
@@ -201,42 +285,7 @@ static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd,return -1 ; } -static void create_udmabuf (int *devfd,int *memfd,int *buf,size_t dmabuf_size) -{ -struct udmabuf_create create; -int ret; - - *devfd =open ("/dev/udmabuf" ,O_RDWR ); -if (*devfd <0 ) { -error (70 ,0 , -"%s: [skip,no-udmabuf: Unable to access DMA buffer device file]\n" , -TEST_PREFIX ); - } - - *memfd =memfd_create ("udmabuf-test" ,MFD_ALLOW_SEALING ); -if (*memfd <0 ) -error (70 ,0 ,"%s: [skip,no-memfd]\n" ,TEST_PREFIX ); - -/* Required for udmabuf */ - ret =fcntl (*memfd,F_ADD_SEALS ,F_SEAL_SHRINK ); -if (ret <0 ) -error (73 ,0 ,"%s: [skip,fcntl-add-seals]\n" ,TEST_PREFIX ); - - ret =ftruncate (*memfd, dmabuf_size); -if (ret ==-1 ) -error (74 ,0 ,"%s: [FAIL,memfd-truncate]\n" ,TEST_PREFIX ); - -memset (&create,0 ,sizeof (create)); - - create.memfd = *memfd; - create.offset =0 ; - create.size = dmabuf_size; - *buf =ioctl (*devfd,UDMABUF_CREATE , &create); -if (*buf <0 ) -error (75 ,0 ,"%s: [FAIL, create udmabuf]\n" ,TEST_PREFIX ); -} - -int do_server (void ) +int do_server (struct memory_buffer *mem) {char ctrl_data[sizeof (int ) *20000 ];struct netdev_queue_id *queues;
@@ -244,23 +293,18 @@ int do_server(void)struct sockaddr_in client_addr;struct sockaddr_in server_sin;size_t page_aligned_frags =0 ; -int devfd, memfd, buf, ret;size_t total_received =0 ;socklen_t client_addr_len;bool is_devmem = false; -char *buf_mem =NULL ; +char *tmp_mem =NULL ;struct ynl_sock *ys; -size_t dmabuf_size;char iobuf[819200 ];char buffer[256 ];int socket_fd;int client_fd;size_t i =0 ;int opt =1 ; - - dmabuf_size =getpagesize () *NUM_PAGES ; - -create_udmabuf (&devfd, &memfd, &buf, dmabuf_size); +int ret;if (reset_flow_steering ())error (1 ,0 ,"Failed to reset flow steering\n" );
@@ -284,13 +328,12 @@ int do_server(void) queues[i].id = start_queue + i; } -if (bind_rx_queue (ifindex, buf, queues, num_queues, &ys)) +if (bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys))error (1 ,0 ,"Failed to bind\n" ); - buf_mem =mmap (NULL , dmabuf_size,PROT_READ |PROT_WRITE ,MAP_SHARED , - buf,0 ); -if (buf_mem ==MAP_FAILED ) -error (1 ,0 ,"mmap()" ); + tmp_mem =malloc (mem->size); +if (!tmp_mem) +error (1 ,ENOMEM ,"malloc failed" ); server_sin.sin_family =AF_INET ; server_sin.sin_port =htons (atoi (port));
@@ -341,7 +384,6 @@ int do_server(void)struct iovec iov = { .iov_base = iobuf, .iov_len =sizeof (iobuf) };struct dmabuf_cmsg *dmabuf_cmsg =NULL ; -struct dma_buf_sync sync = {0 };struct cmsghdr *cm =NULL ;struct msghdr msg = {0 };struct dmabuf_token token;
@@ -410,22 +452,16 @@ int do_server(void)else page_aligned_frags++; - sync.flags =DMA_BUF_SYNC_READ |DMA_BUF_SYNC_START ; -ioctl (buf,DMA_BUF_IOCTL_SYNC , &sync); + provider->memcpy_from_device (tmp_mem, mem, + dmabuf_cmsg->frag_offset, + dmabuf_cmsg->frag_size);if (do_validation) -validate_buffer ( - ((unsigned char *)buf_mem) + - dmabuf_cmsg->frag_offset, - dmabuf_cmsg->frag_size); +validate_buffer (tmp_mem, + dmabuf_cmsg->frag_size);else -print_nonzero_bytes ( - ((unsigned char *)buf_mem) + - dmabuf_cmsg->frag_offset, - dmabuf_cmsg->frag_size); - - sync.flags =DMA_BUF_SYNC_READ |DMA_BUF_SYNC_END ; -ioctl (buf,DMA_BUF_IOCTL_SYNC , &sync); +print_nonzero_bytes (tmp_mem, + dmabuf_cmsg->frag_size); ret = setsockopt(client_fd, SOL_SOCKET, SO_DEVMEM_DONTNEED, &token,
@@ -450,12 +486,9 @@ int do_server(void) cleanup: -munmap (buf_mem, dmabuf_size); +free (tmp_mem);close (client_fd);close (socket_fd); -close (buf); -close (memfd); -close (devfd);ynl_sock_destroy (ys);return 0 ;
@@ -464,14 +497,11 @@ int do_server(void)void run_devmem_tests (void ) {struct netdev_queue_id *queues; -int devfd, memfd, buf; +struct memory_buffer *mem;struct ynl_sock *ys; -size_t dmabuf_size;size_t i =0 ; - dmabuf_size =getpagesize () *NUM_PAGES ; - -create_udmabuf (&devfd, &memfd, &buf, dmabuf_size); + mem = provider->alloc (getpagesize () *NUM_PAGES );/* Configure RSS to divert all traffic from our devmem queues */ if (configure_rss ())
@@ -482,7 +512,7 @@ void run_devmem_tests(void)if (configure_headersplit (1 ))error (1 ,0 ,"Failed to configure header split\n" ); -if (!bind_rx_queue (ifindex, buf, queues, num_queues, &ys)) +if (!bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys))error (1 ,0 ,"Binding empty queues array should have failed\n" );for (i =0 ; i < num_queues; i++) {
@@ -495,7 +525,7 @@ void run_devmem_tests(void)if (configure_headersplit (0 ))error (1 ,0 ,"Failed to configure header split\n" ); -if (!bind_rx_queue (ifindex, buf, queues, num_queues, &ys)) +if (!bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys))error (1 ,0 ,"Configure dmabuf with header split off should have failed\n" );if (configure_headersplit (1 ))
@@ -508,7 +538,7 @@ void run_devmem_tests(void) queues[i].id = start_queue + i; } -if (bind_rx_queue (ifindex, buf, queues, num_queues, &ys)) +if (bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys))error (1 ,0 ,"Failed to bind\n" );/* Deactivating a bound queue should not be legal */
@@ -517,11 +547,15 @@ void run_devmem_tests(void)/* Closing the netlink socket does an implicit unbind */ ynl_sock_destroy (ys); + + provider->free (mem); }int main (int argc,char *argv[]) { +struct memory_buffer *mem;int is_server =0 , opt; +int ret;while ((opt =getopt (argc, argv,"ls:c:p:v:q:t:f:" )) !=-1 ) {switch (opt) {
@@ -562,8 +596,9 @@ int main(int argc, char *argv[])run_devmem_tests (); -if (is_server) -return do_server (); + mem = provider->alloc (getpagesize () *NUM_PAGES ); + ret = is_server ?do_server (mem) :1 ; + provider->free (mem); -return 0 ; +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 40/143 selftests: ncdevmem: Unify error handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit bfccbaac1b45f9af7d76589d7e31ad921b50c0d7 ]
There is a bunch of places where error() calls look out of place. Use the same error(1, errno, ...) pattern everywhere.
Stable-dep-of: 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array")
--- tools/testing/selftests/net/ncdevmem.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/net/ncdevmem.c +8 -8
@@ -339,33 +339,33 @@ int do_server(struct memory_buffer *mem) server_sin.sin_port =htons (atoi (port)); ret =inet_pton (server_sin.sin_family, server_ip, &server_sin.sin_addr); -if (socket <0 ) -error (79 ,0 ,"%s: [FAIL, create socket]\n" ,TEST_PREFIX ); +if (ret <0 ) +error (1 , errno,"%s: [FAIL, create socket]\n" ,TEST_PREFIX ); socket_fd =socket (server_sin.sin_family,SOCK_STREAM ,0 ); -if (socket <0 ) -error (errno, errno,"%s: [FAIL, create socket]\n" ,TEST_PREFIX ); +if (socket_fd <0 ) +error (1 , errno,"%s: [FAIL, create socket]\n" ,TEST_PREFIX ); ret =setsockopt (socket_fd,SOL_SOCKET ,SO_REUSEPORT , &opt,sizeof (opt));if (ret) -error (errno, errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX ); +error (1 , errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX ); ret =setsockopt (socket_fd,SOL_SOCKET ,SO_REUSEADDR , &opt,sizeof (opt));if (ret) -error (errno, errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX ); +error (1 , errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX );fprintf (stderr,"binding to address %s:%d\n" , server_ip,ntohs (server_sin.sin_port)); ret =bind (socket_fd, &server_sin,sizeof (server_sin));if (ret) -error (errno, errno,"%s: [FAIL, bind]\n" ,TEST_PREFIX ); +error (1 , errno,"%s: [FAIL, bind]\n" ,TEST_PREFIX ); ret =listen (socket_fd,1 );if (ret) -error (errno, errno,"%s: [FAIL, listen]\n" ,TEST_PREFIX ); +error (1 , errno,"%s: [FAIL, listen]\n" ,TEST_PREFIX ); client_addr_len =sizeof (client_addr);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 41/143 selftests: ncdevmem: Make client_ip optional
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 0ebd75f5f2392c2ada04c6e11447415911fe1506 ]
Support 3-tuple filtering by making client_ip optional. When -c is not passed, don't specify src-ip/src-port in the filter.
Stable-dep-of: 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array")
--- tools/testing/selftests/net/ncdevmem.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
tools/testing/selftests/net/ncdevmem.c +9 -3
@@ -62,7 +62,7 @@*/ static char *server_ip ="192.168.1.4" ; -static char *client_ip ="192.168.1.2" ; +static char *client_ip;static char *port ="5201" ;static size_t do_validation;static int start_queue =8 ;
@@ -236,8 +236,14 @@ static int configure_channels(unsigned int rx, unsigned int tx)static int configure_flow_steering (void ) { -return run_command ("sudo ethtool -N %s flow-type tcp4 src-ip %s dst-ip %s src-port %s dst-port %s queue %d >&2" , - ifname, client_ip, server_ip, port, port, start_queue); +return run_command ("sudo ethtool -N %s flow-type tcp4 %s %s dst-ip %s %s %s dst-port %s queue %d >&2" , + ifname, + client_ip ?"src-ip" :"" , + client_ip ?:"" , + server_ip, + client_ip ?"src-port" :"" , + client_ip ? port :"" , + port, start_queue); } static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 42/143 selftests: ncdevmem: Switch to AF_INET6
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 933056357a8cf0c9b3fb2ecc4d2d8d142614f0a3 ]
Use dualstack socket to support both v4 and v6. v4-mapped-v6 address can be used to do v4.
Stable-dep-of: 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array")
--- tools/testing/selftests/net/ncdevmem.c | 97 ++++++++++++++++++-------- 1 file changed, 68 insertions(+), 29 deletions(-)
tools/testing/selftests/net/ncdevmem.c +68 -29
@@ -234,13 +234,26 @@ static int configure_channels(unsigned int rx, unsigned int tx)return run_command ("sudo ethtool -L %s rx %u tx %u" , ifname, rx, tx); } -static int configure_flow_steering (void ) +static int configure_flow_steering (struct sockaddr_in6 *server_sin) { -return run_command ("sudo ethtool -N %s flow-type tcp4 %s %s dst-ip %s %s %s dst-port %s queue %d >&2" , +const char *type ="tcp6" ; +const char *server_addr; +char buf[40 ]; + +inet_ntop (AF_INET6 , &server_sin->sin6_addr, buf,sizeof (buf)); + server_addr = buf; + +if (IN6_IS_ADDR_V4MAPPED (&server_sin->sin6_addr)) { + type ="tcp4" ; + server_addr =strrchr (server_addr,':' ) +1 ; + } + +return run_command ("sudo ethtool -N %s flow-type %s %s %s dst-ip %s %s %s dst-port %s queue %d >&2" , ifname, + type, client_ip ?"src-ip" :"" , client_ip ?:"" , - server_ip, + server_addr, client_ip ?"src-port" :"" , client_ip ? port :"" , port, start_queue);
@@ -291,13 +304,51 @@ static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd,return -1 ; } +static void enable_reuseaddr (int fd) +{ +int opt =1 ; +int ret; + + ret =setsockopt (fd,SOL_SOCKET ,SO_REUSEPORT , &opt,sizeof (opt)); +if (ret) +error (1 , errno,"%s: [FAIL, SO_REUSEPORT]\n" ,TEST_PREFIX ); + + ret =setsockopt (fd,SOL_SOCKET ,SO_REUSEADDR , &opt,sizeof (opt)); +if (ret) +error (1 , errno,"%s: [FAIL, SO_REUSEADDR]\n" ,TEST_PREFIX ); +} + +static int parse_address (const char *str,int port,struct sockaddr_in6 *sin6) +{ +int ret; + + sin6->sin6_family =AF_INET6 ; + sin6->sin6_port =htons (port); + + ret =inet_pton (sin6->sin6_family, str, &sin6->sin6_addr); +if (ret !=1 ) { +/* fallback to plain IPv4 */ + ret =inet_pton (AF_INET , str, &sin6->sin6_addr.s6_addr32[3 ]); +if (ret !=1 ) +return -1 ; + +/* add ::ffff prefix */ + sin6->sin6_addr.s6_addr32[0 ] =0 ; + sin6->sin6_addr.s6_addr32[1 ] =0 ; + sin6->sin6_addr.s6_addr16[4 ] =0 ; + sin6->sin6_addr.s6_addr16[5 ] =0xffff ; + } + +return 0 ; +} +int do_server (struct memory_buffer *mem) {char ctrl_data[sizeof (int ) *20000 ];struct netdev_queue_id *queues;size_t non_page_aligned_frags =0 ; -struct sockaddr_in client_addr; -struct sockaddr_in server_sin; +struct sockaddr_in6 client_addr; +struct sockaddr_in6 server_sin;size_t page_aligned_frags =0 ;size_t total_received =0 ;socklen_t client_addr_len;
@@ -309,9 +360,12 @@ int do_server(struct memory_buffer *mem)int socket_fd;int client_fd;size_t i =0 ; -int opt =1 ;int ret; + ret =parse_address (server_ip,atoi (port), &server_sin); +if (ret <0 ) +error (1 ,0 ,"parse server address" ); +if (reset_flow_steering ())error (1 ,0 ,"Failed to reset flow steering\n" );
@@ -320,7 +374,7 @@ int do_server(struct memory_buffer *mem)error (1 ,0 ,"Failed to configure rss\n" );/* Flow steer our devmem flows to start_queue */ -if (configure_flow_steering ()) +if (configure_flow_steering (&server_sin))error (1 ,0 ,"Failed to configure flow steering\n" );sleep (1 );
@@ -341,29 +395,14 @@ int do_server(struct memory_buffer *mem)if (!tmp_mem)error (1 ,ENOMEM ,"malloc failed" ); - server_sin.sin_family =AF_INET ; - server_sin.sin_port =htons (atoi (port)); - - ret =inet_pton (server_sin.sin_family, server_ip, &server_sin.sin_addr); -if (ret <0 ) -error (1 , errno,"%s: [FAIL, create socket]\n" ,TEST_PREFIX ); - - socket_fd =socket (server_sin.sin_family,SOCK_STREAM ,0 ); + socket_fd =socket (AF_INET6 ,SOCK_STREAM ,0 );if (socket_fd <0 )error (1 , errno,"%s: [FAIL, create socket]\n" ,TEST_PREFIX ); - ret =setsockopt (socket_fd,SOL_SOCKET ,SO_REUSEPORT , &opt, -sizeof (opt)); -if (ret) -error (1 , errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX ); - - ret =setsockopt (socket_fd,SOL_SOCKET ,SO_REUSEADDR , &opt, -sizeof (opt)); -if (ret) -error (1 , errno,"%s: [FAIL, set sock opt]\n" ,TEST_PREFIX ); +enable_reuseaddr (socket_fd);fprintf (stderr,"binding to address %s:%d\n" , server_ip, -ntohs (server_sin.sin_port)); +ntohs (server_sin.sin6_port)); ret =bind (socket_fd, &server_sin,sizeof (server_sin));if (ret)
@@ -375,16 +414,16 @@ int do_server(struct memory_buffer *mem) client_addr_len =sizeof (client_addr); -inet_ntop (server_sin.sin_family, &server_sin.sin_addr, buffer, +inet_ntop (AF_INET6 , &server_sin.sin6_addr, buffer,sizeof (buffer));fprintf (stderr,"Waiting or connection on %s:%d\n" , buffer, -ntohs (server_sin.sin_port)); +ntohs (server_sin.sin6_port)); client_fd =accept (socket_fd, &client_addr, &client_addr_len); -inet_ntop (client_addr.sin_family, &client_addr.sin_addr, buffer, +inet_ntop (AF_INET6 , &client_addr.sin6_addr, buffer,sizeof (buffer));fprintf (stderr,"Got connection from %s:%d\n" , buffer, -ntohs (client_addr.sin_port)); +ntohs (client_addr.sin6_port));while (1 ) {struct iovec iov = { .iov_base = iobuf,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 43/143 tests/ncdevmem: Fix double-free of queue array
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <[email protected]>
[ Upstream commit 97c4e094a4b2edbb4fffeda718f8e806f825a18f ]
netdev_bind_rx takes ownership of the queue array passed as parameter and frees it, so a queue array buffer cannot be reused across multiple netdev_bind_rx calls.
This commit fixes that by always passing in a newly created queue array to all netdev_bind_rx calls in ncdevmem.
--- tools/testing/selftests/net/ncdevmem.c | 55 +++++++++++--------------- 1 file changed, 22 insertions(+), 33 deletions(-)
tools/testing/selftests/net/ncdevmem.c +22 -33
@@ -342,6 +342,22 @@ static int parse_address(const char *str, int port, struct sockaddr_in6 *sin6)return 0 ; } +static struct netdev_queue_id *create_queues (void ) +{ +struct netdev_queue_id *queues; +size_t i =0 ; + + queues =calloc (num_queues,sizeof (*queues)); +for (i =0 ; i < num_queues; i++) { + queues[i]._present.type =1 ; + queues[i]._present.id =1 ; + queues[i].type =NETDEV_QUEUE_TYPE_RX ; + queues[i].id = start_queue + i; + } + +return queues; +} +int do_server (struct memory_buffer *mem) {char ctrl_data[sizeof (int ) *20000 ];
@@ -359,7 +375,6 @@ int do_server(struct memory_buffer *mem)char buffer[256 ];int socket_fd;int client_fd; -size_t i =0 ;int ret; ret =parse_address (server_ip,atoi (port), &server_sin);
@@ -379,16 +394,7 @@ int do_server(struct memory_buffer *mem)sleep (1 ); - queues =malloc (sizeof (*queues) * num_queues); - -for (i =0 ; i < num_queues; i++) { - queues[i]._present.type =1 ; - queues[i]._present.id =1 ; - queues[i].type =NETDEV_QUEUE_TYPE_RX ; - queues[i].id = start_queue + i; - } - -if (bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys)) +if (bind_rx_queue (ifindex, mem->fd,create_queues (), num_queues, &ys))error (1 ,0 ,"Failed to bind\n" ); tmp_mem =malloc (mem->size);
@@ -453,7 +459,6 @@ int do_server(struct memory_buffer *mem) goto cleanup; } - i++;for (cm =CMSG_FIRSTHDR (&msg); cm; cm =CMSG_NXTHDR (&msg, cm)) { if (cm->cmsg_level != SOL_SOCKET || (cm->cmsg_type != SCM_DEVMEM_DMABUF &&
@@ -541,10 +546,8 @@ int do_server(struct memory_buffer *mem)void run_devmem_tests (void ) { -struct netdev_queue_id *queues;struct memory_buffer *mem;struct ynl_sock *ys; -size_t i =0 ; mem = provider->alloc (getpagesize () *NUM_PAGES );
@@ -552,38 +555,24 @@ void run_devmem_tests(void)if (configure_rss ())error (1 ,0 ,"rss error\n" ); - queues =calloc (num_queues,sizeof (*queues)); -if (configure_headersplit (1 ))error (1 ,0 ,"Failed to configure header split\n" ); -if (!bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys)) +if (!bind_rx_queue (ifindex, mem->fd, +calloc (num_queues,sizeof (struct netdev_queue_id )), + num_queues, &ys))error (1 ,0 ,"Binding empty queues array should have failed\n" ); -for (i =0 ; i < num_queues; i++) { - queues[i]._present.type =1 ; - queues[i]._present.id =1 ; - queues[i].type =NETDEV_QUEUE_TYPE_RX ; - queues[i].id = start_queue + i; - } -if (configure_headersplit (0 ))error (1 ,0 ,"Failed to configure header split\n" ); -if (!bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys)) +if (!bind_rx_queue (ifindex, mem->fd,create_queues (), num_queues, &ys))error (1 ,0 ,"Configure dmabuf with header split off should have failed\n" );if (configure_headersplit (1 ))error (1 ,0 ,"Failed to configure header split\n" ); -for (i =0 ; i < num_queues; i++) { - queues[i]._present.type =1 ; - queues[i]._present.id =1 ; - queues[i].type =NETDEV_QUEUE_TYPE_RX ; - queues[i].id = start_queue + i; - } - -if (bind_rx_queue (ifindex, mem->fd, queues, num_queues, &ys)) +if (bind_rx_queue (ifindex, mem->fd,create_queues (), num_queues, &ys))error (1 ,0 ,"Failed to bind\n" );/* Deactivating a bound queue should not be legal */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 44/143 net: mctp: Ensure keys maintain only one ref to corresponding dev
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Jeffery <[email protected]>
[ Upstream commit e4f349bd6e58051df698b82f94721f18a02a293d ]
mctp_flow_prepare_output() is called in mctp_route_output(), which places outbound packets onto a given interface. The packet may represent a message fragment, in which case we provoke an unbalanced reference count to the underlying device. This causes trouble if we ever attempt to remove the interface:
[ 48.702195] usb 1-1: USB disconnect, device number 2
[ 58.883056] unregister_netdevice: waiting for mctpusb0 to become free. Usage count = 2
[ 69.022548] unregister_netdevice: waiting for mctpusb0 to become free. Usage count = 2
[ 79.172568] unregister_netdevice: waiting for mctpusb0 to become free. Usage count = 2
...Predicate the invocation of mctp_dev_set_key() in mctp_flow_prepare_output() on not already having associated the device with the key. It's not yet realistic to uphold the property that the key maintains only one device reference earlier in the transmission sequence as the route (and therefore the device) may not be known at the time the key is associated with the socket.
--- net/mctp/route.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mctp/route.c +3 -1
@@ -313,8 +313,10 @@ static void mctp_flow_prepare_output(struct sk_buff *skb, struct mctp_dev *dev) key = flow->key; -if (WARN_ON (key->dev && key->dev != dev)) +if (key->dev) { +WARN_ON (key->dev != dev);return ; + }mctp_dev_set_key (dev, key); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 45/143 ALSA: seq: Fix delivery of UMP events to group ports
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit ff7b190aef6cccdb6f14d20c5753081fe6420e0b ]
When an event with UMP message is sent to a UMP client, the EP port receives always no matter where the event is sent to, as it's a catch-all port. OTOH, if an event is sent to EP port, and if the event has a certain UMP Group, it should have been delivered to the associated UMP Group port, too, but this was ignored, so far.
This patch addresses the behavior. Now a UMP event sent to the Endpoint port will be delivered to the subscribers of the UMP group port the event is associated with.
The patch also does a bit of refactoring to simplify the code about __deliver_to_subscribers().
--- sound/core/seq/seq_clientmgr.c | 52 ++++++++++++++++++++------------ sound/core/seq/seq_ump_convert.c | 18 +++++++++++ sound/core/seq/seq_ump_convert.h | 1 + 3 files changed, 52 insertions(+), 19 deletions(-)
sound/core/seq/seq_clientmgr.c +33 -19
@@ -732,15 +732,21 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client,*/ static int __deliver_to_subscribers (struct snd_seq_client *client,struct snd_seq_event *event, -struct snd_seq_client_port *src_port, -int atomic,int hop) +int port,int atomic,int hop) { +struct snd_seq_client_port *src_port;struct snd_seq_subscribers *subs;int err, result =0 , num_ev =0 ;union __snd_seq_event event_saved;size_t saved_size;struct snd_seq_port_subs_info *grp; +if (port <0 ) +return 0 ; + src_port =snd_seq_port_use_ptr (client, port); +if (!src_port) +return 0 ; +/* save original event record */ saved_size =snd_seq_event_packet_size (event);memcpy (&event_saved, event, saved_size);
@@ -775,6 +781,7 @@ static int __deliver_to_subscribers(struct snd_seq_client *client,read_unlock (&grp->list_lock); else up_read(&grp->list_mutex); +snd_seq_port_unlock (src_port);memcpy (event, &event_saved, saved_size);return (result <0 ) ? result : num_ev; }
@@ -783,25 +790,32 @@ static int deliver_to_subscribers(struct snd_seq_client *client,struct snd_seq_event *event, int atomic, int hop) { - struct snd_seq_client_port *src_port; -int ret =0 , ret2; - - src_port =snd_seq_port_use_ptr (client, event->source.port); -if (src_port) { - ret =__deliver_to_subscribers (client, event, src_port, atomic, hop); -snd_seq_port_unlock (src_port); - } - -if (client->ump_endpoint_port <0 || - event->source.port == client->ump_endpoint_port) -return ret; + int ret; +#if IS_ENABLED (CONFIG_SND_SEQ_UMP ) +int ret2; +#endif - src_port =snd_seq_port_use_ptr (client, client->ump_endpoint_port); -if (!src_port) + ret =__deliver_to_subscribers (client, event, + event->source.port, atomic, hop); +#if IS_ENABLED (CONFIG_SND_SEQ_UMP ) +if (!snd_seq_client_is_ump (client) || client->ump_endpoint_port <0 )return ret; - ret2 =__deliver_to_subscribers (client, event, src_port, atomic, hop); -snd_seq_port_unlock (src_port); -return ret2 <0 ? ret2 : ret; +/* If it's an event from EP port (and with a UMP group), +* deliver to subscribers of the corresponding UMP group port, too. +* Or, if it's from non-EP port, deliver to subscribers of EP port, too. +*/ +if (event->source.port == client->ump_endpoint_port) + ret2 =__deliver_to_subscribers (client, event, +snd_seq_ump_group_port (event), + atomic, hop); +else + ret2 =__deliver_to_subscribers (client, event, + client->ump_endpoint_port, + atomic, hop); +if (ret2 <0 ) +return ret2; +#endif +return ret; }/* deliver an event to the destination port(s).
sound/core/seq/seq_ump_convert.c +18 -0
@@ -1285,3 +1285,21 @@ int snd_seq_deliver_to_ump(struct snd_seq_client *source,else return cvt_to_ump_midi1 (dest, dest_port, event, atomic, hop); } + +/* return the UMP group-port number of the event; +* return -1 if groupless or non-UMP event +*/ +int snd_seq_ump_group_port (const struct snd_seq_event *event) +{ +const struct snd_seq_ump_event *ump_ev = + (const struct snd_seq_ump_event *)event; +unsigned char type; + +if (!snd_seq_ev_is_ump (event)) +return -1 ; + type =ump_message_type (ump_ev->ump[0 ]); +if (ump_is_groupless_msg (type)) +return -1 ; +/* group-port number starts from 1 */ +return ump_message_group (ump_ev->ump[0 ]) +1 ; +}
sound/core/seq/seq_ump_convert.h +1 -0
@@ -18,5 +18,6 @@ int snd_seq_deliver_to_ump(struct snd_seq_client *source,struct snd_seq_client_port *dest_port, struct snd_seq_event *event, int atomic, int hop); +int snd_seq_ump_group_port (const struct snd_seq_event *event);#endif /* __SEQ_UMP_CONVERT_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 46/143 ALSA: ump: Fix a typo of snd_ump_stream_msg_device_info
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit dd33993a9721ab1dae38bd37c9f665987d554239 ]
s/devince/device/
It's used only internally, so no any behavior changes.
--- drivers/usb/gadget/function/f_midi2.c | 2 +- include/sound/ump_msg.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_midi2.c +1 -1
@@ -475,7 +475,7 @@ static void reply_ump_stream_ep_info(struct f_midi2_ep *ep)/* reply a UMP EP device info */ static void reply_ump_stream_ep_device (struct f_midi2_ep *ep) { -struct snd_ump_stream_msg_devince_info rep = { +struct snd_ump_stream_msg_device_info rep = { .type =UMP_MSG_TYPE_STREAM , .status =UMP_STREAM_MSG_STATUS_DEVICE_INFO , .manufacture_id = ep->info.manufacturer,
include/sound/ump_msg.h +2 -2
@@ -604,7 +604,7 @@ struct snd_ump_stream_msg_ep_info { } __packed;/* UMP Stream Message: Device Info Notification (128bit) */ -struct snd_ump_stream_msg_devince_info { +struct snd_ump_stream_msg_device_info {#ifdef __BIG_ENDIAN_BITFIELD/* 0 */ u32 type:4 ;
@@ -754,7 +754,7 @@ struct snd_ump_stream_msg_fb_name {union snd_ump_stream_msg {struct snd_ump_stream_msg_ep_discovery ep_discovery;struct snd_ump_stream_msg_ep_info ep_info; -struct snd_ump_stream_msg_devince_info device_info; +struct snd_ump_stream_msg_device_info device_info;struct snd_ump_stream_msg_stream_cfg stream_cfg;struct snd_ump_stream_msg_fb_discovery fb_discovery;struct snd_ump_stream_msg_fb_info fb_info;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 47/143 net: cadence: macb: Fix a possible deadlock in macb_halt_tx.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Othacehe <[email protected]>
[ Upstream commit c92d6089d8ad7d4d815ebcedee3f3907b539ff1f ]
There is a situation where after THALT is set high, TGO stays high as well. Because jiffies are never updated, as we are in a context with interrupts disabled, we never exit that loop and have a deadlock.
That deadlock was noticed on a sama5d4 device that stayed locked for days.
Use retries instead of jiffies so that the timeout really works and we do not have a deadlock anymore.
--- drivers/net/ethernet/cadence/macb_main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +6 -13
@@ -1016,22 +1016,15 @@ static void macb_update_stats(struct macb *bp)static int macb_halt_tx (struct macb *bp) { -unsigned long halt_time, timeout; -u32 status; +u32 status;macb_writel (bp,NCR ,macb_readl (bp,NCR ) |MACB_BIT (THALT )); - timeout = jiffies +usecs_to_jiffies (MACB_HALT_TIMEOUT ); -do { - halt_time = jiffies; - status =macb_readl (bp,TSR ); -if (!(status &MACB_BIT (TGO ))) -return 0 ; - -udelay (250 ); - }while (time_before (halt_time, timeout)); - -return -ETIMEDOUT ; +/* Poll TSR until TGO is cleared or timeout. */ +return read_poll_timeout_atomic (macb_readl, status, + !(status &MACB_BIT (TGO )), +250 ,MACB_HALT_TIMEOUT , false, + bp,TSR ); }static void macb_tx_unmap (struct macb *bp,struct macb_tx_skb *tx_skb,int budget)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 48/143 net: dsa: sja1105: discard incoming frames in BR_STATE_LISTENING
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 498625a8ab2c8e1c9ab5105744310e8d6952cc01 ]
It has been reported that when under a bridge with stp_state=1, the logs get spammed with this message:
[ 251.734607] fsl_dpaa2_eth dpni.5 eth0: Couldn't decode source port
Further debugging shows the following info associated with packets:
source_port=-1, switch_id=-1, vid=-1, vbid=1
In other words, they are data plane packets which are supposed to be decoded by dsa_tag_8021q_find_port_by_vbid(), but the latter (correctly) refuses to do so, because no switch port is currently in BR_STATE_LEARNING or BR_STATE_FORWARDING - so the packet is effectively unexpected.
The error goes away after the port progresses to BR_STATE_LEARNING in 15 seconds (the default forward_time of the bridge), because then, dsa_tag_8021q_find_port_by_vbid() can correctly associate the data plane packets with a plausible bridge port in a plausible STP state.
Re-reading IEEE 802.1D-1990, I see the following:
"4.4.2 Learning: (...) The Forwarding Process shall discard received frames."
IEEE 802.1D-2004 further clarifies:
"DISABLED, BLOCKING, LISTENING, and BROKEN all correspond to the DISCARDING port state. While those dot1dStpPortStates serve to distinguish reasons for discarding frames, the operation of the Forwarding and Learning processes is the same for all of them. (...) LISTENING represents a port that the spanning tree algorithm has selected to be part of the active topology (computing a Root Port or Designated Port role) but is temporarily discarding frames to guard against loops or incorrect learning."
Well, this is not what the driver does - instead it sets mac[port].ingress = true.
To get rid of the log spam, prevent unexpected data plane packets to be received by software by discarding them on ingress in the LISTENING state.
In terms of blame attribution: the prints only date back to commit d7f9787a763f ("net: dsa: tag_8021q: add support for imprecise RX based on the VBID"). However, the settings would permit a LISTENING port to forward to a FORWARDING port, and the standard suggests that's not OK.
--- drivers/net/dsa/sja1105/sja1105_main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/dsa/sja1105/sja1105_main.c +1 -5
@@ -2083,6 +2083,7 @@ static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port,switch (state) {case BR_STATE_DISABLED :case BR_STATE_BLOCKING : +case BR_STATE_LISTENING :/* From UM10944 description of DRPDTAG (why put this there?): * "Management traffic flows to the port regardless of the state * of the INGRESS flag". So BPDUs are still be allowed to pass.
@@ -2092,11 +2093,6 @@ static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port, mac[port].egress = false; mac[port].dyn_learn = false;break ; -case BR_STATE_LISTENING : - mac[port].ingress = true; - mac[port].egress = false; - mac[port].dyn_learn = false; -break ;case BR_STATE_LEARNING : mac[port].ingress = true; mac[port].egress = false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 49/143 nvme-pci: make nvme_pci_npages_prp() __always_inline
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 40696426b8c8c4f13cf6ac52f0470eed144be4b2 ]
The only reason nvme_pci_npages_prp() could be used as a compile-time known result in BUILD_BUG_ON() is because the compiler was always choosing to inline the function. Under special circumstances (sanitizer coverage functions disabled for __init functions on ARCH=um), the compiler decided to stop inlining it:
drivers/nvme/host/pci.c: In function 'nvme_init':
include/linux/compiler_types.h:557:45: error: call to '__compiletime_assert_678' declared with attribute error: BUILD_BUG_ON failed: nvme_pci_npages_prp() > NVME_MAX_NR_ALLOCATIONS
557 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:538:25: note: in definition of macro '__compiletime_assert'
538 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:557:9: note: in expansion of macro '_compiletime_assert'
557 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
drivers/nvme/host/pci.c:3804:9: note: in expansion of macro 'BUILD_BUG_ON'
3804 | BUILD_BUG_ON(nvme_pci_npages_prp() > NVME_MAX_NR_ALLOCATIONS);
| ^~~~~~~~~~~~Force it to be __always_inline to make sure it is always available for use with BUILD_BUG_ON().
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -390,7 +390,7 @@ static bool nvme_dbbuf_update_and_check_event(u16 value, __le32 *dbbuf_db,* as it only leads to a small amount of wasted memory for the lifetime of * the I/O. */ -static int nvme_pci_npages_prp (void ) +static __always_inline int nvme_pci_npages_prp(void) {unsigned max_bytes = (NVME_MAX_KB_SZ *1024 ) +NVME_CTRL_PAGE_SIZE ;unsigned nprps =DIV_ROUND_UP (max_bytes,NVME_CTRL_PAGE_SIZE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 50/143 nvme-pci: acquire cq_poll_lock in nvme_poll_irqdisable
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 3d8932133dcecbd9bef1559533c1089601006f45 ]
We need to lock this queue for that condition because the timeout work executes per-namespace and can poll the poll CQ.
--- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/host/pci.c +2 -0
@@ -1202,7 +1202,9 @@ static void nvme_poll_irqdisable(struct nvme_queue *nvmeq)WARN_ON_ONCE (test_bit (NVMEQ_POLLED , &nvmeq->flags));disable_irq (pci_irq_vector (pdev, nvmeq->cq_vector)); +spin_lock (&nvmeq->cq_poll_lock);nvme_poll_cq (nvmeq,NULL ); +spin_unlock (&nvmeq->cq_poll_lock);enable_irq (pci_irq_vector (pdev, nvmeq->cq_vector)); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 51/143 ALSA: sh: SND_AICA should depend on SH_DMA_API
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 66e48ef6ef506c89ec1b3851c6f9f5f80b5835ff ]
If CONFIG_SH_DMA_API=n:
WARNING: unmet direct dependencies detected for G2_DMA
Depends on [n]: SH_DREAMCAST [=y] && SH_DMA_API [=n]
Selected by [y]:
- SND_AICA [=y] && SOUND [=y] && SND [=y] && SND_SUPERH [=y] && SH_DREAMCAST [=y]
SND_AICA selects G2_DMA. As the latter depends on SH_DMA_API, the former should depend on SH_DMA_API, too.
--- sound/sh/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/sh/Kconfig +1 -1
@@ -14,7 +14,7 @@ if SND_SUPERH config SND_AICA tristate "Dreamcast Yamaha AICA sound" - depends on SH_DREAMCAST + depends on SH_DREAMCAST && SH_DMA_API select SND_PCM select G2_DMA help
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 52/143 net: dsa: b53: prevent standalone from trying to forward to other ports
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 4227ea91e2657f7965e34313448e9d0a2b67712e ]
When bridged ports and standalone ports share a VLAN, e.g. via VLAN uppers, or untagged traffic with a vlan unaware bridge, the ASIC will still try to forward traffic to known FDB entries on standalone ports. But since the port VLAN masks prevent forwarding to bridged ports, this traffic will be dropped.
This e.g. can be observed in the bridge_vlan_unaware ping tests, where this breaks pinging with learning on.
Work around this by enabling the simplified EAP mode on switches supporting it for standalone ports, which causes the ASIC to redirect traffic of unknown source MAC addresses to the CPU port.
Since standalone ports do not learn, there are no known source MAC addresses, so effectively this redirects all incoming traffic to the CPU port.
--- drivers/net/dsa/b53/b53_common.c | 33 ++++++++++++++++++++++++++++++++ drivers/net/dsa/b53/b53_regs.h | 14 ++++++++++++++ 2 files changed, 47 insertions(+)
drivers/net/dsa/b53/b53_common.c +33 -0
@@ -326,6 +326,26 @@ static void b53_get_vlan_entry(struct b53_device *dev, u16 vid, } } +static void b53_set_eap_mode (struct b53_device *dev,int port,int mode) +{ +u64 eap_conf; + +if (is5325 (dev) ||is5365 (dev) || dev->chip_id ==BCM5389_DEVICE_ID ) +return ; + +b53_read64 (dev,B53_EAP_PAGE ,B53_PORT_EAP_CONF (port), &eap_conf); + +if (is63xx (dev)) { + eap_conf &= ~EAP_MODE_MASK_63XX ; + eap_conf |= (u64 )mode <<EAP_MODE_SHIFT_63XX ; + }else { + eap_conf &= ~EAP_MODE_MASK ; + eap_conf |= (u64 )mode <<EAP_MODE_SHIFT ; + } + +b53_write64 (dev,B53_EAP_PAGE ,B53_PORT_EAP_CONF (port), eap_conf); +} +static void b53_set_forwarding (struct b53_device *dev,int enable) {u8 mgmt;
@@ -586,6 +606,13 @@ int b53_setup_port(struct dsa_switch *ds, int port)b53_port_set_mcast_flood (dev, port, true);b53_port_set_learning (dev, port, false); +/* Force all traffic to go to the CPU port to prevent the ASIC from +* trying to forward to bridged ports on matching FDB entries, then +* dropping frames because it isn't allowed to forward there. +*/ +if (dsa_is_user_port (ds, port)) +b53_set_eap_mode (dev, port,EAP_MODE_SIMPLIFIED ); +return 0 ; }EXPORT_SYMBOL (b53_setup_port);
@@ -2043,6 +2070,9 @@ int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge, pvlan |=BIT (i); } +/* Disable redirection of unknown SA to the CPU port */ +b53_set_eap_mode (dev, port,EAP_MODE_BASIC ); +/* Configure the local port VLAN control membership to include * remote ports and update the local port bitmask */
@@ -2078,6 +2108,9 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge) pvlan &= ~BIT (i); } +/* Enable redirection of unknown SA to the CPU port */ +b53_set_eap_mode (dev, port,EAP_MODE_SIMPLIFIED ); +b53_write16 (dev,B53_PVLAN_PAGE ,B53_PVLAN_PORT_MASK (port), pvlan); dev->ports[port].vlan_ctl_mask = pvlan;
drivers/net/dsa/b53/b53_regs.h +14 -0
@@ -50,6 +50,9 @@/* Jumbo Frame Registers */ #define B53_JUMBO_PAGE 0x40 +/* EAP Registers */ +#define B53_EAP_PAGE 0x42 +/* EEE Control Registers Page */ #define B53_EEE_PAGE 0x92
@@ -480,6 +483,17 @@#define JMS_MIN_SIZE 1518#define JMS_MAX_SIZE 9724 +/************************************************************************* +* EAP Page Registers +*************************************************************************/ +#define B53_PORT_EAP_CONF (i) (0x20 + 8 * (i)) +#define EAP_MODE_SHIFT 51 +#define EAP_MODE_SHIFT_63XX 50 +#define EAP_MODE_MASK (0x3ull << EAP_MODE_SHIFT) +#define EAP_MODE_MASK_63XX (0x3ull << EAP_MODE_SHIFT_63XX) +#define EAP_MODE_BASIC 0 +#define EAP_MODE_SIMPLIFIED 3 +/************************************************************************* * EEE Configuration Page Registers *************************************************************************/
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 53/143 vsock/test: Fix occasional failure in SIOCOUTQ tests
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Shkolnyy <[email protected]>
[ Upstream commit 7fd7ad6f36af36f30a06d165eff3780cb139fa79 ]
These tests:
"SOCK_STREAM ioctl(SIOCOUTQ) 0 unsent bytes" "SOCK_SEQPACKET ioctl(SIOCOUTQ) 0 unsent bytes"
output: "Unexpected 'SIOCOUTQ' value, expected 0, got 64 (CLIENT)".
They test that the SIOCOUTQ ioctl reports 0 unsent bytes after the data have been received by the other side. However, sometimes there is a delay in updating this "unsent bytes" counter, and the test fails even though the counter properly goes to 0 several milliseconds later.
The delay occurs in the kernel because the used buffer notification callback virtio_vsock_tx_done(), called upon receipt of the data by the other side, doesn't update the counter itself. It delegates that to a kernel thread (via vsock->tx_work). Sometimes that thread is delayed more than the test expects.
Change the test to poll SIOCOUTQ until it returns 0 or a timeout occurs.
--- tools/testing/vsock/vsock_test.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
tools/testing/vsock/vsock_test.c +16 -12
@@ -1283,21 +1283,25 @@ static void test_unsent_bytes_client(const struct test_opts *opts, int type)send_buf (fd, buf,sizeof (buf),0 ,sizeof (buf));control_expectln ("RECEIVED" ); - ret =ioctl (fd,SIOCOUTQ , &sock_bytes_unsent); -if (ret <0 ) { -if (errno ==EOPNOTSUPP ) { -fprintf (stderr,"Test skipped, SIOCOUTQ not supported.\n" ); - }else { +/* SIOCOUTQ isn't guaranteed to instantly track sent data. Even though +* the "RECEIVED" message means that the other side has received the +* data, there can be a delay in our kernel before updating the "unsent +* bytes" counter. Repeat SIOCOUTQ until it returns 0. +*/ +timeout_begin (TIMEOUT ); +do { + ret =ioctl (fd,SIOCOUTQ , &sock_bytes_unsent); +if (ret <0 ) { +if (errno ==EOPNOTSUPP ) { +fprintf (stderr,"Test skipped, SIOCOUTQ not supported.\n" ); +break ; + }perror ("ioctl" );exit (EXIT_FAILURE ); } - }else if (ret ==0 && sock_bytes_unsent !=0 ) { -fprintf (stderr, -"Unexpected 'SIOCOUTQ' value, expected 0, got %i\n" , - sock_bytes_unsent); -exit (EXIT_FAILURE ); - } - +timeout_check ("SIOCOUTQ" ); + }while (sock_bytes_unsent !=0 ); +timeout_end ();close (fd); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 54/143 net/mlx5e: Disable MACsec offload for uplink representor profile
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carolina Jubran <[email protected]>
[ Upstream commit 588431474eb7572e57a927fa8558c9ba2f8af143 ]
MACsec offload is not supported in switchdev mode for uplink representors. When switching to the uplink representor profile, the MACsec offload feature must be cleared from the netdevice's features.
If left enabled, attempts to add offloads result in a null pointer dereference, as the uplink representor does not support MACsec offload even though the feature bit remains set.
Clear NETIF_F_HW_MACSEC in mlx5e_fix_uplink_rep_features().
Kernel log:
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000f: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000078-0x000000000000007f] CPU: 29 UID: 0 PID: 4714 Comm: ip Not tainted 6.14.0-rc4_for_upstream_debug_2025_03_02_17_35 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:__mutex_lock+0x128/0x1dd0 Code: d0 7c 08 84 d2 0f 85 ad 15 00 00 8b 35 91 5c fe 03 85 f6 75 29 49 8d 7e 60 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 a6 15 00 00 4d 3b 76 60 0f 85 fd 0b 00 00 65 ff RSP: 0018:ffff888147a4f160 EFLAGS: 00010206 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000001 RDX: 000000000000000f RSI: 0000000000000000 RDI: 0000000000000078 RBP: ffff888147a4f2e0 R08: ffffffffa05d2c19 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 R13: dffffc0000000000 R14: 0000000000000018 R15: ffff888152de0000 FS: 00007f855e27d800(0000) GS:ffff88881ee80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004e5768 CR3: 000000013ae7c005 CR4: 0000000000372eb0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 Call Trace: <TASK> ? die_addr+0x3d/0xa0 ? exc_general_protection+0x144/0x220 ? asm_exc_general_protection+0x22/0x30 ? mlx5e_macsec_add_secy+0xf9/0x700 [mlx5_core] ? __mutex_lock+0x128/0x1dd0 ? lockdep_set_lock_cmp_fn+0x190/0x190 ? mlx5e_macsec_add_secy+0xf9/0x700 [mlx5_core] ? mutex_lock_io_nested+0x1ae0/0x1ae0 ? lock_acquire+0x1c2/0x530 ? macsec_upd_offload+0x145/0x380 ? lockdep_hardirqs_on_prepare+0x400/0x400 ? kasan_save_stack+0x30/0x40 ? kasan_save_stack+0x20/0x40 ? kasan_save_track+0x10/0x30 ? __kasan_kmalloc+0x77/0x90 ? __kmalloc_noprof+0x249/0x6b0 ? genl_family_rcv_msg_attrs_parse.constprop.0+0xb5/0x240 ? mlx5e_macsec_add_secy+0xf9/0x700 [mlx5_core] mlx5e_macsec_add_secy+0xf9/0x700 [mlx5_core] ? mlx5e_macsec_add_rxsa+0x11a0/0x11a0 [mlx5_core] macsec_update_offload+0x26c/0x820 ? macsec_set_mac_address+0x4b0/0x4b0 ? lockdep_hardirqs_on_prepare+0x284/0x400 ? _raw_spin_unlock_irqrestore+0x47/0x50 macsec_upd_offload+0x2c8/0x380 ? macsec_update_offload+0x820/0x820 ? __nla_parse+0x22/0x30 ? genl_family_rcv_msg_attrs_parse.constprop.0+0x15e/0x240 genl_family_rcv_msg_doit+0x1cc/0x2a0 ? genl_family_rcv_msg_attrs_parse.constprop.0+0x240/0x240 ? cap_capable+0xd4/0x330 genl_rcv_msg+0x3ea/0x670 ? genl_family_rcv_msg_dumpit+0x2a0/0x2a0 ? lockdep_set_lock_cmp_fn+0x190/0x190 ? macsec_update_offload+0x820/0x820 netlink_rcv_skb+0x12b/0x390 ? genl_family_rcv_msg_dumpit+0x2a0/0x2a0 ? netlink_ack+0xd80/0xd80 ? rwsem_down_read_slowpath+0xf90/0xf90 ? netlink_deliver_tap+0xcd/0xac0 ? netlink_deliver_tap+0x155/0xac0 ? _copy_from_iter+0x1bb/0x12c0 genl_rcv+0x24/0x40 netlink_unicast+0x440/0x700 ? netlink_attachskb+0x760/0x760 ? lock_acquire+0x1c2/0x530 ? __might_fault+0xbb/0x170 netlink_sendmsg+0x749/0xc10 ? netlink_unicast+0x700/0x700 ? __might_fault+0xbb/0x170 ? netlink_unicast+0x700/0x700 __sock_sendmsg+0xc5/0x190 ____sys_sendmsg+0x53f/0x760 ? import_iovec+0x7/0x10 ? kernel_sendmsg+0x30/0x30 ? __copy_msghdr+0x3c0/0x3c0 ? filter_irq_stacks+0x90/0x90 ? stack_depot_save_flags+0x28/0xa30 ___sys_sendmsg+0xeb/0x170 ? kasan_save_stack+0x30/0x40 ? copy_msghdr_from_user+0x110/0x110 ? do_syscall_64+0x6d/0x140 ? lock_acquire+0x1c2/0x530 ? __virt_addr_valid+0x116/0x3b0 ? __virt_addr_valid+0x1da/0x3b0 ? lock_downgrade+0x680/0x680 ? __delete_object+0x21/0x50 __sys_sendmsg+0xf7/0x180 ? __sys_sendmsg_sock+0x20/0x20 ? kmem_cache_free+0x14c/0x4e0 ? __x64_sys_close+0x78/0xd0 do_syscall_64+0x6d/0x140 entry_SYSCALL_64_after_hwframe+0x4b/0x53 RIP: 0033:0x7f855e113367 Code: 0e 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10 RSP: 002b:00007ffd15e90c88 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f855e113367 RDX: 0000000000000000 RSI: 00007ffd15e90cf0 RDI: 0000000000000004 RBP: 00007ffd15e90dbc R08: 0000000000000028 R09: 000000000045d100 R10: 00007f855e011dd8 R11: 0000000000000246 R12: 0000000000000019 R13: 0000000067c6b785 R14: 00000000004a1e80 R15: 0000000000000000 </TASK> Modules linked in: 8021q garp mrp sch_ingress openvswitch nsh mlx5_ib mlx5_fwctl mlx5_dpll mlx5_core rpcrdma rdma_ucm ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm ib_uverbs ib_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay zram zsmalloc fuse [last unloaded: mlx5_core] ---[ end trace 0000000000000000 ]---
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -0
@@ -4344,6 +4344,10 @@ static netdev_features_t mlx5e_fix_uplink_rep_features(struct net_device *netdevif (netdev->features &NETIF_F_HW_VLAN_CTAG_FILTER )netdev_warn (netdev,"Disabling HW_VLAN CTAG FILTERING, not supported in switchdev mode\n" ); + features &= ~NETIF_F_HW_MACSEC ; +if (netdev->features &NETIF_F_HW_MACSEC ) +netdev_warn (netdev,"Disabling HW MACsec offload, not supported in switchdev mode\n" ); +return features; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 55/143 qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit 9d8a99c5a7c7f4f7eca2c168a4ec254409670035 ]
In one of the error paths in qlcnic_sriov_channel_cfg_cmd(), the memory allocated in qlcnic_sriov_alloc_bc_mbx_args() for mailbox arguments is not freed. Fix that by jumping to the error path that frees them, by calling qlcnic_free_mbx_args(). This was found using static analysis.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +5 -2
@@ -1484,8 +1484,11 @@ static int qlcnic_sriov_channel_cfg_cmd(struct qlcnic_adapter *adapter, u8 cmd_o } cmd_op = (cmd.rsp.arg[0 ] &0xff ); -if (cmd.rsp.arg[0 ] >>25 ==2 ) -return 2 ; +if (cmd.rsp.arg[0 ] >>25 ==2 ) { + ret =2 ; + goto out; + } +if (cmd_op ==QLCNIC_BC_CMD_CHANNEL_INIT )set_bit (QLC_BC_VF_STATE , &vf->state);else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 56/143 regulator: max20086: fix invalid memory access
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
[ Upstream commit 6b0cd72757c69bc2d45da42b41023e288d02e772 ]
max20086_parse_regulators_dt() calls of_regulator_match() using an array of struct of_regulator_match allocated on the stack for the matches argument.
of_regulator_match() calls devm_of_regulator_put_matches(), which calls devres_alloc() to allocate a struct devm_of_regulator_matches which will be de-allocated using devm_of_regulator_put_matches().
struct devm_of_regulator_matches is populated with the stack allocated matches array.
If the device fails to probe, devm_of_regulator_put_matches() will be called and will try to call of_node_put() on that stack pointer, generating the following dmesg entries:
max20086 6-0028: Failed to read DEVICE_ID reg: -121
kobject: '\xc0$\xa5\x03' (000000002cebcb7a): is not initialized, yet kobject_put() is being called.
Followed by a stack trace matching the call flow described above.
Switch to allocating the matches array using devm_kcalloc() to avoid accessing the stack pointer long after it's out of scope.
This also has the advantage of allowing multiple max20086 to probe without overriding the data stored inside the global of_regulator_match.
--- drivers/regulator/max20086-regulator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/regulator/max20086-regulator.c +6 -1
@@ -132,7 +132,7 @@ static int max20086_regulators_register(struct max20086 *chip)static int max20086_parse_regulators_dt (struct max20086 *chip,bool *boot_on) { -struct of_regulator_match matches[MAX20086_MAX_REGULATORS ] = { }; +struct of_regulator_match *matches;struct device_node *node;unsigned int i;int ret;
@@ -143,6 +143,11 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)return -ENODEV ; } + matches =devm_kcalloc (chip->dev, chip->info->num_outputs, +sizeof (*matches),GFP_KERNEL ); +if (!matches) +return -ENOMEM ; +for (i =0 ; i < chip->info->num_outputs; ++i) matches[i].name = max20086_output_names[i];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 57/143 drm/xe: Save CTX_TIMESTAMP mmio value instead of LRC value
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Umesh Nerlige Ramappa <[email protected]>
[ Upstream commit 66c8f7b435bddb7d8577ac8a57e175a6cb147227 ]
For determining actual job execution time, save the current value of the CTX_TIMESTAMP register rather than the value saved in LRC since the current register value is the closest to the start time of the job.
v2: Define MI_STORE_REGISTER_MEM to fix compile error
v3: Place MI_STORE_REGISTER_MEM sorted by MI_INSTR (Lucas)
--- drivers/gpu/drm/xe/instructions/xe_mi_commands.h | 4 ++++ drivers/gpu/drm/xe/xe_lrc.c | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 7 ++----- 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/instructions/xe_mi_commands.h +4 -0
@@ -47,6 +47,10 @@#define MI_LRI_FORCE_POSTED REG_BIT(12)#define MI_LRI_LEN (x) (((x) & 0xff) + 1) +#define MI_STORE_REGISTER_MEM (__MI_INSTR(0x24) | XE_INSTR_NUM_DW(4)) +#define MI_SRM_USE_GGTT REG_BIT(22) +#define MI_SRM_ADD_CS_OFFSET REG_BIT(19) +#define MI_FLUSH_DW __MI_INSTR(0x26)#define MI_FLUSH_DW_STORE_INDEX REG_BIT(21)#define MI_INVALIDATE_TLB REG_BIT(18)
drivers/gpu/drm/xe/xe_lrc.c +1 -1
@@ -694,7 +694,7 @@ static inline u32 __xe_lrc_start_seqno_offset(struct xe_lrc *lrc)static u32 __xe_lrc_ctx_job_timestamp_offset (struct xe_lrc *lrc) { -/* The start seqno is stored in the driver-defined portion of PPHWSP */ +/* This is stored in the driver-defined portion of PPHWSP */ return xe_lrc_pphwsp_offset (lrc) +LRC_CTX_JOB_TIMESTAMP_OFFSET ; }
drivers/gpu/drm/xe/xe_ring_ops.c +2 -5
@@ -229,13 +229,10 @@ static u32 get_ppgtt_flag(struct xe_sched_job *job)static int emit_copy_timestamp (struct xe_lrc *lrc,u32 *dw,int i) { - dw[i++] =MI_COPY_MEM_MEM |MI_COPY_MEM_MEM_SRC_GGTT | -MI_COPY_MEM_MEM_DST_GGTT ; + dw[i++] =MI_STORE_REGISTER_MEM |MI_SRM_USE_GGTT |MI_SRM_ADD_CS_OFFSET ; + dw[i++] =RING_CTX_TIMESTAMP (0 ).addr; dw[i++] =xe_lrc_ctx_job_timestamp_ggtt_addr (lrc); dw[i++] =0 ; - dw[i++] =xe_lrc_ctx_timestamp_ggtt_addr (lrc); - dw[i++] =0 ; - dw[i++] =MI_NOOP ;return i; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 58/143 netlink: specs: tc: fix a couple of attribute names
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit a9fb87b8b86918e34ef6bf3316311f41bc1a5b1f ]
Fix up spelling of two attribute names. These are clearly typoes and will prevent C codegen from working. Let's treat this as a fix to get the correction into users' hands ASAP, and prevent anyone depending on the wrong names.
--- Documentation/netlink/specs/tc.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/netlink/specs/tc.yaml +2 -2
@@ -2745,7 +2745,7 @@ attribute-sets: type: u16 byte-order: big-endian - - name: key-l2-tpv3-sid + name: key-l2tpv3-sid type: u32 byte-order: big-endian -
@@ -3504,7 +3504,7 @@ attribute-sets: name: rate64 type: u64 - - name: prate4 + name: prate64 type: u64 - name: burst
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 59/143 netlink: specs: tc: all actions are indexed arrays
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit f3dd5fb2fa494dcbdb10f8d27f2deac8ef61a2fc ]
Some TC filters have actions listed as indexed arrays of nests and some as just nests. They are all indexed arrays, the handling is common across filters.
--- Documentation/netlink/specs/tc.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/netlink/specs/tc.yaml +4 -2
@@ -2017,7 +2017,8 @@ attribute-sets: attributes: - name: act - type: nest + type: indexed-array + sub-type: nest nested-attributes: tc-act-attrs - name: police
@@ -2250,7 +2251,8 @@ attribute-sets: attributes: - name: act - type: nest + type: indexed-array + sub-type: nest nested-attributes: tc-act-attrs - name: police
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 60/143 octeontx2-pf: macsec: Fix incorrect max transmit size in TX secy
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit 865ab2461375e3a5a2526f91f9a9f17b8931bc9e ]
MASCEC hardware block has a field called maximum transmit size for TX secy. Max packet size going out of MCS block has be programmed taking into account full packet size which has L2 header,SecTag and ICV. MACSEC offload driver is configuring max transmit size as macsec interface MTU which is incorrect. Say with 1500 MTU of real device, macsec interface created on top of real device will have MTU of 1468(1500 - (SecTag + ICV)). This is causing packets from macsec interface of size greater than or equal to 1468 are not getting transmitted out because driver programmed max transmit size as 1468 instead of 1514(1500 + ETH_HDR_LEN).
--- drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +2 -1
@@ -533,7 +533,8 @@ static int cn10k_mcs_write_tx_secy(struct otx2_nic *pfvf,if (sw_tx_sc->encrypt) sectag_tci |= (MCS_TCI_E |MCS_TCI_C ); - policy =FIELD_PREP (MCS_TX_SECY_PLCY_MTU , secy->netdev->mtu); + policy =FIELD_PREP (MCS_TX_SECY_PLCY_MTU , + pfvf->netdev->mtu +OTX2_ETH_HLEN );/* Write SecTag excluding AN bits(1..0) */ policy |=FIELD_PREP (MCS_TX_SECY_PLCY_ST_TCI , sectag_tci >>2 ); policy |=FIELD_PREP (MCS_TX_SECY_PLCY_ST_OFFSET , tag_offset);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 61/143 net: ethernet: mtk_eth_soc: fix typo for declaration MT7988 ESW capability
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bo-Cun Chen <[email protected]>
[ Upstream commit 1bdea6fad6fb985ff13828373c48e337c4e939f9 ]
Since MTK_ESW_BIT is a bit number rather than a bitmap, it causes MTK_HAS_CAPS to produce incorrect results. This leads to the ETH driver not declaring MAC capabilities correctly for the MT7988 ESW.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +1 -1
@@ -4685,7 +4685,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) }if (mtk_is_netsys_v3_or_greater (mac->hw) && -MTK_HAS_CAPS (mac->hw->soc->caps,MTK_ESW_BIT ) && +MTK_HAS_CAPS (mac->hw->soc->caps,MTK_ESW ) && id ==MTK_GMAC1_ID ) { mac->phylink_config.mac_capabilities =MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 62/143 octeontx2-af: Fix CGX Receive counters
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hariprasad Kelam <[email protected]>
[ Upstream commit bf449f35e77fd44017abf991fac1f9ab7705bbe0 ]
Each CGX block supports 4 logical MACs (LMACS). Receive counters CGX_CMR_RX_STAT0-8 are per LMAC and CGX_CMR_RX_STAT9-12 are per CGX.
Due a bug in previous patch, stale Per CGX counters values observed.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +5 -0
@@ -707,6 +707,11 @@ int cgx_get_rx_stats(void *cgxd, int lmac_id, int idx, u64 *rx_stat)if (!is_lmac_valid (cgx, lmac_id))return -ENODEV ; + +/* pass lmac as 0 for CGX_CMR_RX_STAT9-12 */ +if (idx >=CGX_RX_STAT_GLOBAL_INDEX ) + lmac_id =0 ; + *rx_stat =cgx_read (cgx, lmac_id,CGXX_CMRX_RX_STAT0 + (idx *8 ));return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 63/143 octeontx2-pf: Do not reallocate all ntuple filters
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit dcb479fde00be9a151c047d0a7c0626b64eb0019 ]
If ntuple filters count is modified followed by unicast filters count using devlink then the ntuple count set by user is ignored and all the ntuple filters are being reallocated. Fix this by storing the ntuple count set by user. Without this patch, say if user tries
to modify ntuple count as 8 followed by ucast filter count as 4 using devlink commands then ntuple count is being reverted to default value 16 i.e, not retaining user set value 8.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 1 + drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c | 1 + drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
@@ -364,6 +364,7 @@ struct otx2_flow_config {struct list_head flow_list_tc;u8 ucast_flt_cnt;bool ntuple; +u16 ntuple_cnt; };struct dev_hw_ops {
drivers/net/ethernet/marvell/octeontx2/nic/otx2_devlink.c +1 -0
@@ -41,6 +41,7 @@ static int otx2_dl_mcam_count_set(struct devlink *devlink, u32 id,if (!pfvf->flow_cfg)return 0 ; + pfvf->flow_cfg->ntuple_cnt = ctx->val.vu16;otx2_alloc_mcam_entries (pfvf, ctx->val.vu16);return 0 ;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +2 -1
@@ -252,7 +252,7 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf)mutex_unlock (&pfvf->mbox.lock);/* Allocate entries for Ntuple filters */ - count =otx2_alloc_mcam_entries (pfvf,OTX2_DEFAULT_FLOWCOUNT ); + count =otx2_alloc_mcam_entries (pfvf, flow_cfg->ntuple_cnt);if (count <=0 ) {otx2_clear_ntuple_flow_info (pfvf, flow_cfg);return 0 ;
@@ -312,6 +312,7 @@ int otx2_mcam_flow_init(struct otx2_nic *pf)INIT_LIST_HEAD (&pf->flow_cfg->flow_list_tc); pf->flow_cfg->ucast_flt_cnt =OTX2_DEFAULT_UNICAST_FLOWS ; + pf->flow_cfg->ntuple_cnt =OTX2_DEFAULT_FLOWCOUNT ;/* Allocate bare minimum number of MCAM entries needed for * unicast and ntuple filters.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 64/143 wifi: mac80211: Set n_channels after allocating struct cfg80211_scan_request
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 82bbe02b2500ef0a62053fe2eb84773fe31c5a0a ]
Make sure that n_channels is set after allocating the struct cfg80211_registered_device::int_scan_req member. Seen with syzkaller:
UBSAN: array-index-out-of-bounds in net/mac80211/scan.c:1208:5
index 0 is out of range for type 'struct ieee80211_channel *[] __counted_by(n_channels)' (aka 'struct ieee80211_channel *[]')
This was missed in the initial conversions because I failed to locate the allocation likely due to the "sizeof(void *)" not matching the "channels" array type.
--- net/mac80211/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/main.c +4 -2
@@ -1344,10 +1344,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) hw->wiphy->software_iftypes |=BIT (NL80211_IFTYPE_MONITOR ); - local->int_scan_req =kzalloc (sizeof (*local->int_scan_req) + -sizeof (void *) * channels,GFP_KERNEL ); + local->int_scan_req =kzalloc (struct_size (local->int_scan_req, + channels, channels), +GFP_KERNEL );if (!local->int_scan_req)return -ENOMEM ; + local->int_scan_req->n_channels = channels;eth_broadcast_addr (local->int_scan_req->bssid);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 65/143 mlxsw: spectrum_router: Fix use-after-free when deleting GRE net devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 92ec4855034b2c4d13f117558dc73d20581fa9ff ]
The driver only offloads neighbors that are constructed on top of net devices registered by it or their uppers (which are all Ethernet). The device supports GRE encapsulation and decapsulation of forwarded traffic, but the driver will not offload dummy neighbors constructed on top of GRE net devices as they are not uppers of its net devices:
# ip link add name gre1 up type gre tos inherit local 192.0.2.1 remote 198.51.100.1 # ip neigh add 0.0.0.0 lladdr 0.0.0.0 nud noarp dev gre1 $ ip neigh show dev gre1 nud noarp 0.0.0.0 lladdr 0.0.0.0 NOARP
(Note that the neighbor is not marked with 'offload')
When the driver is reloaded and the existing configuration is replayed, the driver does not perform the same check regarding existing neighbors and offloads the previously added one:
# devlink dev reload pci/0000:01:00.0 $ ip neigh show dev gre1 nud noarp 0.0.0.0 lladdr 0.0.0.0 offload NOARP
If the neighbor is later deleted, the driver will ignore the notification (given the GRE net device is not its upper) and will therefore keep referencing freed memory, resulting in a use-after-free
[1] when the net device is deleted:
# ip neigh del 0.0.0.0 lladdr 0.0.0.0 dev gre1 # ip link del dev gre1
Fix by skipping neighbor replay if the net device for which the replay is performed is not our upper.
[1]
BUG: KASAN: slab-use-after-free in mlxsw_sp_neigh_entry_update+0x1ea/0x200 Read of size 8 at addr ffff888155b0e420 by task ip/2282 [...] Call Trace: <TASK> dump_stack_lvl+0x6f/0xa0 print_address_description.constprop.0+0x6f/0x350 print_report+0x108/0x205 kasan_report+0xdf/0x110 mlxsw_sp_neigh_entry_update+0x1ea/0x200 mlxsw_sp_router_rif_gone_sync+0x2a8/0x440 mlxsw_sp_rif_destroy+0x1e9/0x750 mlxsw_sp_netdevice_ipip_ol_event+0x3c9/0xdc0 mlxsw_sp_router_netdevice_event+0x3ac/0x15e0 notifier_call_chain+0xca/0x150 call_netdevice_notifiers_info+0x7f/0x100 unregister_netdevice_many_notify+0xc8c/0x1d90 rtnl_dellink+0x34e/0xa50 rtnetlink_rcv_msg+0x6fb/0xb70 netlink_rcv_skb+0x131/0x360 netlink_unicast+0x426/0x710 netlink_sendmsg+0x75a/0xc20 __sock_sendmsg+0xc1/0x150 ____sys_sendmsg+0x5aa/0x7b0 ___sys_sendmsg+0xfc/0x180 __sys_sendmsg+0x121/0x1b0 do_syscall_64+0xbb/0x1d0 entry_SYSCALL_64_after_hwframe+0x4b/0x53
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +3 -0
@@ -3014,6 +3014,9 @@ static int mlxsw_sp_neigh_rif_made_sync(struct mlxsw_sp *mlxsw_sp, .rif = rif, }; +if (!mlxsw_sp_dev_lower_is_port (mlxsw_sp_rif_dev (rif))) +return 0 ; +neigh_for_each (&arp_tbl, mlxsw_sp_neigh_rif_made_sync_each, &rms);if (rms.err) goto err_arp;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 66/143 net/tls: fix kernel panic when alloc_page failed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengtao He <[email protected]>
[ Upstream commit 491deb9b8c4ad12fe51d554a69b8165b9ef9429f ]
We cannot set frag_list to NULL pointer when alloc_page failed. It will be used in tls_strp_check_queue_ok when the next time tls_strp_read_sock is called.
This is because we don't reset full_len in tls_strp_flush_anchor_copy() so the recv path will try to continue handling the partial record on the next call but we dettached the rcvq from the frag list. Alternative fix would be to reset full_len.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028 Call trace: tls_strp_check_rcv+0x128/0x27c tls_strp_data_ready+0x34/0x44 tls_data_ready+0x3c/0x1f0 tcp_data_ready+0x9c/0xe4 tcp_data_queue+0xf6c/0x12d0 tcp_rcv_established+0x52c/0x798
--- net/tls/tls_strp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tls/tls_strp.c +2 -1
@@ -396,7 +396,6 @@ static int tls_strp_read_copy(struct tls_strparser *strp, bool qshort)return 0 ; shinfo =skb_shinfo (strp->anchor); - shinfo->frag_list =NULL ;/* If we don't know the length go max plus page for cipher overhead */ need_spc = strp->stm.full_len ?:TLS_MAX_PAYLOAD_SIZE +PAGE_SIZE ;
@@ -412,6 +411,8 @@ static int tls_strp_read_copy(struct tls_strparser *strp, bool qshort) page, 0, 0); } + shinfo->frag_list =NULL ; + strp->copy_mode =1 ; strp->stm.offset =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 67/143 tsnep: fix timestamping with a stacked DSA driver
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerhard Engleder <[email protected]>
[ Upstream commit b3ca9eef6646576ad506a96d941d87a69f66732a ]
This driver is susceptible to a form of the bug explained in commit c26a2c2ddc01 ("gianfar: Fix TX timestamping with a stacked DSA driver") and in Documentation/networking/timestamping.rst section "Other caveats for MAC drivers", specifically it timestamps any skb which has SKBTX_HW_TSTAMP, and does not consider if timestamping has been enabled in adapter->hwtstamp_config.tx_type.
Evaluate the proper TX timestamping condition only once on the TX path (in tsnep_xmit_frame_ring()) and store the result in an additional TX entry flag. Evaluate the new TX entry flag in the TX confirmation path (in tsnep_tx_poll()).
This way SKBTX_IN_PROGRESS is set by the driver as required, but never evaluated. SKBTX_IN_PROGRESS shall not be evaluated as it can be set by a stacked DSA driver and evaluating it would lead to unwanted timestamps.
--- drivers/net/ethernet/engleder/tsnep_main.c | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/ethernet/engleder/tsnep_main.c +19 -11
@@ -67,6 +67,8 @@#define TSNEP_TX_TYPE_XDP_NDO_MAP_PAGE (TSNEP_TX_TYPE_XDP_NDO | TSNEP_TX_TYPE_MAP_PAGE)#define TSNEP_TX_TYPE_XDP (TSNEP_TX_TYPE_XDP_TX | TSNEP_TX_TYPE_XDP_NDO)#define TSNEP_TX_TYPE_XSK BIT(12) +#define TSNEP_TX_TYPE_TSTAMP BIT(13) +#define TSNEP_TX_TYPE_SKB_TSTAMP (TSNEP_TX_TYPE_SKB | TSNEP_TX_TYPE_TSTAMP)#define TSNEP_XDP_TX BIT(0)#define TSNEP_XDP_REDIRECT BIT(1)
@@ -387,8 +389,7 @@ static void tsnep_tx_activate(struct tsnep_tx *tx, int index, int length,if (entry->skb) { entry->properties = length &TSNEP_DESC_LENGTH_MASK ; entry->properties |=TSNEP_DESC_INTERRUPT_FLAG ; -if ((entry->type &TSNEP_TX_TYPE_SKB ) && - (skb_shinfo (entry->skb)->tx_flags &SKBTX_IN_PROGRESS )) +if ((entry->type &TSNEP_TX_TYPE_SKB_TSTAMP ) ==TSNEP_TX_TYPE_SKB_TSTAMP ) entry->properties |=TSNEP_DESC_EXTENDED_WRITEBACK_FLAG ;/* toggle user flag to prevent false acknowledge
@@ -480,7 +481,8 @@ static int tsnep_tx_map_frag(skb_frag_t *frag, struct tsnep_tx_entry *entry,return mapped; } -static int tsnep_tx_map (struct sk_buff *skb,struct tsnep_tx *tx,int count) +static int tsnep_tx_map (struct sk_buff *skb,struct tsnep_tx *tx,int count, +bool do_tstamp) {struct device *dmadev = tx->adapter->dmadev;struct tsnep_tx_entry *entry;
@@ -506,6 +508,9 @@ static int tsnep_tx_map(struct sk_buff *skb, struct tsnep_tx *tx, int count) entry->type =TSNEP_TX_TYPE_SKB_INLINE ; mapped =0 ; } + +if (do_tstamp) + entry->type |=TSNEP_TX_TYPE_TSTAMP ; }else {skb_frag_t *frag = &skb_shinfo (skb)->frags[i -1 ];
@@ -559,11 +564,12 @@ static int tsnep_tx_unmap(struct tsnep_tx *tx, int index, int count)static netdev_tx_t tsnep_xmit_frame_ring (struct sk_buff *skb,struct tsnep_tx *tx) { -int count =1 ;struct tsnep_tx_entry *entry; +bool do_tstamp = false; +int count =1 ;int length; -int i;int retval; +int i;if (skb_shinfo (skb)->nr_frags >0 ) count +=skb_shinfo (skb)->nr_frags;
@@ -580,7 +586,13 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb, entry = &tx->entry[tx->write]; entry->skb = skb; - retval =tsnep_tx_map (skb, tx, count); +if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) && + tx->adapter->hwtstamp_config.tx_type ==HWTSTAMP_TX_ON ) { +skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; + do_tstamp = true; + } + + retval =tsnep_tx_map (skb, tx, count, do_tstamp);if (retval <0 ) {tsnep_tx_unmap (tx, tx->write, count);dev_kfree_skb_any (entry->skb);
@@ -592,9 +604,6 @@ static netdev_tx_t tsnep_xmit_frame_ring(struct sk_buff *skb, } length = retval; -if (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) -skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; -for (i =0 ; i < count; i++)tsnep_tx_activate (tx, (tx->write + i) &TSNEP_RING_MASK , length, i == count -1 );
@@ -845,8 +854,7 @@ static bool tsnep_tx_poll(struct tsnep_tx *tx, int napi_budget) length =tsnep_tx_unmap (tx, tx->read, count); -if ((entry->type &TSNEP_TX_TYPE_SKB ) && - (skb_shinfo (entry->skb)->tx_flags &SKBTX_IN_PROGRESS ) && +if (((entry->type &TSNEP_TX_TYPE_SKB_TSTAMP ) ==TSNEP_TX_TYPE_SKB_TSTAMP ) && (__le32_to_cpu (entry->desc_wb->properties) &TSNEP_DESC_EXTENDED_WRITEBACK_FLAG )) {struct skb_shared_hwtstamps hwtstamps;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 68/143 NFSv4/pnfs: Reset the layout state after a layoutreturn
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 6d6d7f91cc8c111d40416ac9240a3bb9396c5235 ]
If there are still layout segments in the layout plh_return_lsegs list after a layout return, we should be resetting the state to ensure they eventually get returned as well.
--- fs/nfs/pnfs.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/nfs/pnfs.c +9 -0
@@ -745,6 +745,14 @@ pnfs_mark_matching_lsegs_invalid(structreturn remaining; } +static void pnfs_reset_return_info (struct pnfs_layout_hdr *lo) +{ +struct pnfs_layout_segment *lseg; + +list_for_each_entry (lseg, &lo->plh_return_segs, pls_list) +pnfs_set_plh_return_info (lo, lseg->pls_range.iomode,0 ); +} + static void pnfs_free_returned_lsegs(struct pnfs_layout_hdr *lo, struct list_head *free_me,
@@ -1292,6 +1300,7 @@ void pnfs_layoutreturn_free_lsegs(structpnfs_mark_matching_lsegs_invalid (lo, &freeme, range, seq);pnfs_free_returned_lsegs (lo, &freeme, range, seq);pnfs_set_layout_stateid (lo, stateid,NULL , true); +pnfs_reset_return_info (lo); }else pnfs_mark_layout_stateid_invalid (lo, &freeme); out_unlock:
Greg Kroah-Hartman
maintainerPATCH 69/143 dmaengine: Revert "dmaengine: dmatest: Fix dmatest waiting less when interrupted"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Lynch <[email protected]>
commit df180e65305f8c1e020d54bfc2132349fd693de1 upstream.
Several issues with this change:
* The analysis is flawed and it's unclear what problem is being fixed. There is no difference between wait_event_freezable_timeout() and wait_event_timeout() with respect to device interrupts. And of course "the interrupt notifying the finish of an operation happens during wait_event_freezable_timeout()" -- that's how it's supposed to work.
* The link at the "Closes:" tag appears to be an unrelated use-after-free in idxd.
* It introduces a regression: dmatest threads are meant to be freezable and this change breaks that.
See discussion here:
https://lore.kernel.org/dmaengine/[email protected]/
--- drivers/dma/dmatest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/dma/dmatest.c +3 -3
@@ -841,9 +841,9 @@ static int dmatest_func(void *data) }else {dma_async_issue_pending (chan); -wait_event_timeout (thread->done_wait, - done->done, -msecs_to_jiffies (params->timeout)); +wait_event_freezable_timeout (thread->done_wait, + done->done, +msecs_to_jiffies (params->timeout)); status =dma_async_is_tx_complete (chan, cookie,NULL ,NULL );
Greg Kroah-Hartman
maintainerPATCH 70/143 sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 428dc9fc0873989d73918d4a9cc22745b7bbc799 upstream.
BPF programs may call next() and destroy() on BPF iterators even after new() returns an error value (e.g. bpf_for_each() macro ignores error returns from new()). bpf_iter_scx_dsq_new() could leave the iterator in an uninitialized state after an error return causing bpf_iter_scx_dsq_next() to dereference garbage data. Make bpf_iter_scx_dsq_new() always clear $kit->dsq so that next() and destroy() become noops.
--- kernel/sched/ext.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/sched/ext.c +6 -0
@@ -6731,6 +6731,12 @@ __bpf_kfunc int bpf_iter_scx_dsq_new(strBUILD_BUG_ON (__alignof__(struct bpf_iter_scx_dsq_kern ) != __alignof__(struct bpf_iter_scx_dsq )); +/* +* next() and destroy() will be called regardless of the return value. +* Always clear $kit->dsq. +*/ + kit->dsq =NULL ; +if (flags & ~__SCX_DSQ_ITER_USER_FLAGS)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 71/143 udf: Make sure i_lenExtents is uptodate on inode eviction
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 55dd5b4db3bf04cf077a8d1712f6295d4517c337 upstream.
UDF maintains total length of all extents in i_lenExtents. Generally we keep extent lengths (and thus i_lenExtents) block aligned because it makes the file appending logic simpler. However the standard mandates that the inode size must match the length of all extents and thus we trim the last extent when closing the file. To catch possible bugs we also verify that i_lenExtents matches i_size when evicting inode from memory. Commit b405c1e58b73 ("udf: refactor udf_next_aext() to handle error") however broke the code updating i_lenExtents and thus udf_evict_inode() ended up spewing lots of errors about incorrectly sized extents although the extents were actually sized properly. Fix the updating of i_lenExtents to silence the errors.
--- fs/udf/truncate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/truncate.c +1 -1
@@ -115,7 +115,7 @@ void udf_truncate_tail_extent(struct ino }/* This inode entry is in-memory only and thus we don't have to mark * the inode dirty */ -if (ret ==0 ) +if (ret >=0 ) iinfo->i_lenExtents = inode->i_size;brelse (epos.bh); }
Greg Kroah-Hartman
maintainerPATCH 72/143 HID: bpf: abort dispatch if device destroyed
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rong Zhang <[email protected]>
commit 578e1b96fad7402ff7e9c7648c8f1ad0225147c8 upstream.
The current HID bpf implementation assumes no output report/request will go through it after hid_bpf_destroy_device() has been called. This leads to a bug that unplugging certain types of HID devices causes a cleaned- up SRCU to be accessed. The bug was previously a hidden failure until a recent x86 percpu change [1] made it access not-present pages.
The bug will be triggered if the conditions below are met:
A) a device under the driver has some LEDs on
B) hid_ll_driver->request() is uninplemented (e.g., logitech-djreceiver)
If condition A is met, hidinput_led_worker() is always scheduled *after* hid_bpf_destroy_device().
hid_destroy_device
` hid_bpf_destroy_device
` cleanup_srcu_struct(&hdev->bpf.srcu)
` hid_remove_device
` ...
` led_classdev_unregister
` led_trigger_set(led_cdev, NULL)
` led_set_brightness(led_cdev, LED_OFF)
` ...
` input_inject_event
` input_event_dispose
` hidinput_input_event
` schedule_work(&hid->led_work) [hidinput_led_worker]
This is fine when condition B is not met, where hidinput_led_worker() calls hid_ll_driver->request(). This is the case for most HID drivers, which implement it or use the generic one from usbhid. The driver itself or an underlying driver will then abort processing the request.
Otherwise, hidinput_led_worker() tries hid_hw_output_report() and leads to the bug.
hidinput_led_worker
` hid_hw_output_report
` dispatch_hid_bpf_output_report
` srcu_read_lock(&hdev->bpf.srcu)
` srcu_read_unlock(&hdev->bpf.srcu, idx)The bug has existed since the introduction [2] of dispatch_hid_bpf_output_report(). However, the same bug also exists in dispatch_hid_bpf_raw_requests(), and I've reproduced (no visible effect because of the lack of [1], but confirmed bpf.destroyed == 1) the bug against the commit (i.e., the Fixes:) introducing the function. This is because hidinput_led_worker() falls back to hid_hw_raw_request() when hid_ll_driver->output_report() is uninplemented (e.g., logitech- djreceiver).
hidinput_led_worker
` hid_hw_output_report: -ENOSYS
` hid_hw_raw_request
` dispatch_hid_bpf_raw_requests
` srcu_read_lock(&hdev->bpf.srcu)
` srcu_read_unlock(&hdev->bpf.srcu, idx)Fix the issue by returning early in the two mentioned functions if hid_bpf has been marked as destroyed. Though dispatch_hid_bpf_device_event() handles input events, and there is no evidence that it may be called after the destruction, the same check, as a safety net, is also added to it to maintain the consistency among all dispatch functions.
The impact of the bug on other architectures is unclear. Even if it acts as a hidden failure, this is still dangerous because it corrupts whatever is on the address calculated by SRCU. Thus, CC'ing the stable list.
[1]: commit 9d7de2aa8b41 ("x86/percpu/64: Use relative percpu offsets") [2]: commit 9286675a2aed ("HID: bpf: add HID-BPF hooks for hid_hw_output_report")
--- drivers/hid/bpf/hid_bpf_dispatch.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hid/bpf/hid_bpf_dispatch.c +9 -0
@@ -38,6 +38,9 @@ dispatch_hid_bpf_device_event(struct hidstruct hid_bpf_ops *e;int ret; +if (unlikely (hdev->bpf.destroyed)) +return ERR_PTR (-ENODEV ); +if (type >=HID_REPORT_TYPES )return ERR_PTR (-EINVAL );
@@ -93,6 +96,9 @@ int dispatch_hid_bpf_raw_requests(structstruct hid_bpf_ops *e;int ret, idx; +if (unlikely (hdev->bpf.destroyed)) +return -ENODEV ; +if (rtype >=HID_REPORT_TYPES )return -EINVAL ;
@@ -130,6 +136,9 @@ int dispatch_hid_bpf_output_report(strucstruct hid_bpf_ops *e;int ret, idx; +if (unlikely (hdev->bpf.destroyed)) +return -ENODEV ; + idx =srcu_read_lock (&hdev->bpf.srcu);list_for_each_entry_srcu (e, &hdev->bpf.prog_list, list,srcu_read_lock_held (&hdev->bpf.srcu)) {
Greg Kroah-Hartman
maintainerPATCH 73/143 LoongArch: Prevent cond_resched() occurring within kernel-fpu
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianyang Zhang <[email protected]>
commit 2468b0e3d5659dfde77f081f266e1111a981efb8 upstream.
When CONFIG_PREEMPT_COUNT is not configured (i.e. CONFIG_PREEMPT_NONE/ CONFIG_PREEMPT_VOLUNTARY), preempt_disable() / preempt_enable() merely acts as a barrier(). However, in these cases cond_resched() can still trigger a context switch and modify the CSR.EUEN, resulting in do_fpu() exception being activated within the kernel-fpu critical sections, as demonstrated in the following path:
dcn32_calculate_wm_and_dlg()
DC_FP_START()
dcn32_calculate_wm_and_dlg_fpu()
dcn32_find_dummy_latency_index_for_fw_based_mclk_switch()
dcn32_internal_validate_bw()
dcn32_enable_phantom_stream()
dc_create_stream_for_sink()
kzalloc(GFP_KERNEL)
__kmem_cache_alloc_node()
__cond_resched()
DC_FP_END()This patch is similar to commit d02198550423a0b (x86/fpu: Improve crypto performance by making kernel-mode FPU reliably usable in softirqs). It uses local_bh_disable() instead of preempt_disable() for non-RT kernels so it can avoid the cond_resched() issue, and also extend the kernel-fpu application scenarios to the softirq context.
--- arch/loongarch/kernel/kfpu.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
arch/loongarch/kernel/kfpu.c +20 -2
@@ -18,11 +18,28 @@ static unsigned int euen_mask = CSR_EUEN static DEFINE_PER_CPU(bool, in_kernel_fpu); static DEFINE_PER_CPU(unsigned int, euen_current); +static inline void fpregs_lock (void ) +{ +if (IS_ENABLED (CONFIG_PREEMPT_RT )) +preempt_disable (); +else +local_bh_disable (); +} + +static inline void fpregs_unlock (void ) +{ +if (IS_ENABLED (CONFIG_PREEMPT_RT )) +preempt_enable (); +else +local_bh_enable (); +} +void kernel_fpu_begin (void ) {unsigned int *euen_curr; -preempt_disable (); +if (!irqs_disabled ()) +fpregs_lock ();WARN_ON (this_cpu_read (in_kernel_fpu));
@@ -73,7 +90,8 @@ void kernel_fpu_end(void)this_cpu_write (in_kernel_fpu, false); -preempt_enable (); +if (!irqs_disabled ()) +fpregs_unlock (); }EXPORT_SYMBOL_GPL (kernel_fpu_end);
Greg Kroah-Hartman
maintainerPATCH 74/143 LoongArch: Move __arch_cpu_idle() to .cpuidle.text section
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 3e245b7b74c3a2ead5fa4bad27cc275284c75189 upstream.
Now arch_cpu_idle() is annotated with __cpuidle which means it is in the .cpuidle.text section, but __arch_cpu_idle() isn't. Thus, fix the missing .cpuidle.text section assignment for __arch_cpu_idle() in order to correct backtracing with nmi_backtrace().
The principle is similar to the commit 97c8580e85cf81c ("MIPS: Annotate cpu_wait implementations with __cpuidle")
--- arch/loongarch/kernel/genex.S | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/loongarch/kernel/genex.S +5 -2
@@ -16,6 +16,7 @@ #include <asm/stackframe.h> #include <asm/thread_info.h> + .section .cpuidle.text, "ax" .align 5 SYM_FUNC_START(__arch_cpu_idle) /* start of idle interrupt region */
@@ -31,14 +32,16 @@ SYM_FUNC_START(__arch_cpu_idle) */ idle 0 /* end of idle interrupt region */ -1: jr ra +idle_exit: + jr ra SYM_FUNC_END(__arch_cpu_idle) + .previous SYM_CODE_START(handle_vint) UNWIND_HINT_UNDEFINED BACKUP_T0T1 SAVE_ALL - la_abs t1, 1b + la_abs t1, idle_exit LONG_L t0, sp, PT_ERA /* 3 instructions idle interrupt region */ ori t0, t0, 0b1100
Greg Kroah-Hartman
maintainerPATCH 75/143 LoongArch: Save and restore CSR.CNTC for hibernation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit ceb9155d058a11242aa0572875c44e9713b1a2be upstream.
Save and restore CSR.CNTC for hibernation which is similar to suspend.
For host this is unnecessary because sched clock is ensured continuous, but for kvm guest sched clock isn't enough because rdtime.d should also be continuous.
Host::rdtime.d = Host::CSR.CNTC + counterGuest::rdtime.d = Host::CSR.CNTC + Host::CSR.GCNTC + Guest::CSR.CNTC + counter
so,
Guest::rdtime.d = Host::rdtime.d + Host::CSR.GCNTC + Guest::CSR.CNTC
To ensure Guest::rdtime.d continuous, Host::rdtime.d should be at first continuous, while Host::CSR.GCNTC / Guest::CSR.CNTC is maintained by KVM.
--- arch/loongarch/kernel/time.c | 2 +- arch/loongarch/power/hibernate.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/loongarch/kernel/time.c +1 -1
@@ -111,7 +111,7 @@ static unsigned long __init get_loops_pereturn lpj; } -static long init_offset __nosavedata; +static long init_offset;void save_counter (void ) {
arch/loongarch/power/hibernate.c +3 -0
@@ -2,6 +2,7 @@#include <asm/fpu.h> #include <asm/loongson.h> #include <asm/sections.h> +#include <asm/time.h> #include <asm/tlbflush.h> #include <linux/suspend.h>
@@ -14,6 +15,7 @@ struct pt_regs saved_regs;void save_processor_state (void ) { +save_counter (); saved_crmd =csr_read32 (LOONGARCH_CSR_CRMD ); saved_prmd =csr_read32 (LOONGARCH_CSR_PRMD ); saved_euen =csr_read32 (LOONGARCH_CSR_EUEN );
@@ -26,6 +28,7 @@ void save_processor_state(void)void restore_processor_state (void ) { +sync_counter ();csr_write32 (saved_crmd,LOONGARCH_CSR_CRMD );csr_write32 (saved_prmd,LOONGARCH_CSR_PRMD );csr_write32 (saved_euen,LOONGARCH_CSR_EUEN );
Greg Kroah-Hartman
maintainerPATCH 76/143 LoongArch: Fix MAX_REG_OFFSET calculation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 90436d234230e9a950ccd87831108b688b27a234 upstream.
Fix MAX_REG_OFFSET calculation, make it point to the last register in 'struct pt_regs' and not to the marker itself, which could allow regs_get_register() to return an invalid offset.
--- arch/loongarch/include/asm/ptrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/ptrace.h +1 -1
@@ -55,7 +55,7 @@ static inline void instruction_pointer_s/* Query offset/name of register from its name/offset */ extern int regs_query_register_offset (const char *name); -#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last)) +#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last) - sizeof(unsigned long))/** * regs_get_register() - get register value from its offset
Greg Kroah-Hartman
maintainerPATCH 77/143 LoongArch: uprobes: Remove user_{en,dis}able_single_step()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
commit 0b326b2371f94e798137cc1a3c5c2eef2bc69061 upstream.
When executing the "perf probe" and "perf stat" test cases about some cryptographic algorithm, the output shows that "Trace/breakpoint trap". This is because it uses the software singlestep breakpoint for uprobes on LoongArch, and no need to use the hardware singlestep. So just remove the related function call to user_{en,dis}able_single_step() for uprobes on LoongArch.
How to reproduce:
Please make sure CONFIG_UPROBE_EVENTS is set and openssl supports sm2 algorithm, then execute the following command.
cd tools/perf && make
./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery openssl speed sm2
--- arch/loongarch/kernel/uprobes.c | 4 ---- 1 file changed, 4 deletions(-)
arch/loongarch/kernel/uprobes.c +0 -4
@@ -42,7 +42,6 @@ int arch_uprobe_pre_xol(struct arch_upro utask->autask.saved_trap_nr = current->thread.trap_nr; current->thread.trap_nr =UPROBE_TRAP_NR ;instruction_pointer_set (regs, utask->xol_vaddr); -user_enable_single_step (current);return 0 ; }
@@ -59,8 +58,6 @@ int arch_uprobe_post_xol(struct arch_uprelse instruction_pointer_set (regs, utask->vaddr +LOONGARCH_INSN_SIZE ); -user_disable_single_step (current); -return 0 ; }
@@ -70,7 +67,6 @@ void arch_uprobe_abort_xol(struct arch_u current->thread.trap_nr = utask->autask.saved_trap_nr;instruction_pointer_set (regs, utask->vaddr); -user_disable_single_step (current); }bool arch_uprobe_xol_was_trapped (struct task_struct *t)
Greg Kroah-Hartman
maintainerPATCH 78/143 LoongArch: uprobes: Remove redundant code about resume_era
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
commit 12614f794274f63fbdfe76771b2b332077d63848 upstream.
arch_uprobe_skip_sstep() returns true if instruction was emulated, that is to say, there is no need to single step for the emulated instructions. regs->csr_era will point to the destination address directly after the exception, so the resume_era related code is redundant, just remove them.
--- arch/loongarch/include/asm/uprobes.h | 1 - arch/loongarch/kernel/uprobes.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-)
arch/loongarch/include/asm/uprobes.h +0 -1
@@ -15,7 +15,6 @@ typedef u32 uprobe_opcode_t;#define UPROBE_XOLBP_INSN __emit_break(BRK_UPROBE_XOLBP)struct arch_uprobe { -unsigned long resume_era;u32 insn[2 ];u32 ixol[2 ];bool simulate;
arch/loongarch/kernel/uprobes.c +1 -6
@@ -52,11 +52,7 @@ int arch_uprobe_post_xol(struct arch_uprWARN_ON_ONCE (current->thread.trap_nr !=UPROBE_TRAP_NR ); current->thread.trap_nr = utask->autask.saved_trap_nr; - -if (auprobe->simulate) -instruction_pointer_set (regs, auprobe->resume_era); -else -instruction_pointer_set (regs, utask->vaddr +LOONGARCH_INSN_SIZE ); +instruction_pointer_set (regs, utask->vaddr +LOONGARCH_INSN_SIZE );return 0 ; }
@@ -86,7 +82,6 @@ bool arch_uprobe_skip_sstep(struct arch_ insn.word = auprobe->insn[0 ];arch_simulate_insn (insn, regs); - auprobe->resume_era = regs->csr_era;return true; }
Greg Kroah-Hartman
maintainerPATCH 79/143 btrfs: fix discard worker infinite loop after disabling discard
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 54db6d1bdd71fa90172a2a6aca3308bbf7fa7eb5 upstream.
If the discard worker is running and there's currently only one block group, that block group is a data block group, it's in the unused block groups discard list and is being used (it got an extent allocated from it after becoming unused), the worker can end up in an infinite loop if a transaction abort happens or the async discard is disabled (during remount or unmount for example).
This happens like this:
1) Task A, the discard worker, is at peek_discard_list() and find_next_block_group() returns block group X;
2) Block group X is in the unused block groups discard list (its discard index is BTRFS_DISCARD_INDEX_UNUSED) since at some point in the past it become an unused block group and was added to that list, but then later it got an extent allocated from it, so its ->used counter is not zero anymore;
3) The current transaction is aborted by task B and we end up at __btrfs_handle_fs_error() in the transaction abort path, where we call btrfs_discard_stop(), which clears BTRFS_FS_DISCARD_RUNNING from fs_info, and then at __btrfs_handle_fs_error() we set the fs to RO mode (setting SB_RDONLY in the super block's s_flags field);
4) Task A calls __add_to_discard_list() with the goal of moving the block group from the unused block groups discard list into another discard list, but at __add_to_discard_list() we end up doing nothing because btrfs_run_discard_work() returns false, since the super block has SB_RDONLY set in its flags and BTRFS_FS_DISCARD_RUNNING is not set anymore in fs_info->flags. So block group X remains in the unused block groups discard list;
5) Task A then does a goto into the 'again' label, calls find_next_block_group() again we gets block group X again. Then it repeats the previous steps over and over since there are not other block groups in the discard lists and block group X is never moved out of the unused block groups discard list since btrfs_run_discard_work() keeps returning false and therefore __add_to_discard_list() doesn't move block group X out of that discard list.
When this happens we can get a soft lockup report like this:
[71.957] watchdog: BUG: soft lockup - CPU#0 stuck for 27s! [kworker/u4:3:97] [71.957] Modules linked in: xfs af_packet rfkill (...) [71.957] CPU: 0 UID: 0 PID: 97 Comm: kworker/u4:3 Tainted: G W 6.14.2-1-default #1 openSUSE Tumbleweed 968795ef2b1407352128b466fe887416c33af6fa [71.957] Tainted: [W]=WARN [71.957] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014 [71.957] Workqueue: btrfs_discard btrfs_discard_workfn [btrfs] [71.957] RIP: 0010:btrfs_discard_workfn+0xc4/0x400 [btrfs] [71.957] Code: c1 01 48 83 (...) [71.957] RSP: 0018:ffffafaec03efe08 EFLAGS: 00000246 [71.957] RAX: ffff897045500000 RBX: ffff8970413ed8d0 RCX: 0000000000000000 [71.957] RDX: 0000000000000001 RSI: ffff8970413ed8d0 RDI: 0000000a8f1272ad [71.957] RBP: 0000000a9d61c60e R08: ffff897045500140 R09: 8080808080808080 [71.957] R10: ffff897040276800 R11: fefefefefefefeff R12: ffff8970413ed860 [71.957] R13: ffff897045500000 R14: ffff8970413ed868 R15: 0000000000000000 [71.957] FS: 0000000000000000(0000) GS:ffff89707bc00000(0000) knlGS:0000000000000000 [71.957] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [71.957] CR2: 00005605bcc8d2f0 CR3: 000000010376a001 CR4: 0000000000770ef0 [71.957] PKRU: 55555554 [71.957] Call Trace: [71.957] <TASK> [71.957] process_one_work+0x17e/0x330 [71.957] worker_thread+0x2ce/0x3f0 [71.957] ? __pfx_worker_thread+0x10/0x10 [71.957] kthread+0xef/0x220 [71.957] ? __pfx_kthread+0x10/0x10 [71.957] ret_from_fork+0x34/0x50 [71.957] ? __pfx_kthread+0x10/0x10 [71.957] ret_from_fork_asm+0x1a/0x30 [71.957] </TASK> [71.957] Kernel panic - not syncing: softlockup: hung tasks [71.987] CPU: 0 UID: 0 PID: 97 Comm: kworker/u4:3 Tainted: G W L 6.14.2-1-default #1 openSUSE Tumbleweed 968795ef2b1407352128b466fe887416c33af6fa [71.989] Tainted: [W]=WARN, [L]=SOFTLOCKUP [71.989] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014 [71.991] Workqueue: btrfs_discard btrfs_discard_workfn [btrfs] [71.992] Call Trace: [71.993] <IRQ> [71.994] dump_stack_lvl+0x5a/0x80 [71.994] panic+0x10b/0x2da [71.995] watchdog_timer_fn.cold+0x9a/0xa1 [71.996] ? __pfx_watchdog_timer_fn+0x10/0x10 [71.997] __hrtimer_run_queues+0x132/0x2a0 [71.997] hrtimer_interrupt+0xff/0x230 [71.998] __sysvec_apic_timer_interrupt+0x55/0x100 [71.999] sysvec_apic_timer_interrupt+0x6c/0x90 [72.000] </IRQ> [72.000] <TASK> [72.001] asm_sysvec_apic_timer_interrupt+0x1a/0x20 [72.002] RIP: 0010:btrfs_discard_workfn+0xc4/0x400 [btrfs] [72.002] Code: c1 01 48 83 (...) [72.005] RSP: 0018:ffffafaec03efe08 EFLAGS: 00000246 [72.006] RAX: ffff897045500000 RBX: ffff8970413ed8d0 RCX: 0000000000000000 [72.006] RDX: 0000000000000001 RSI: ffff8970413ed8d0 RDI: 0000000a8f1272ad [72.007] RBP: 0000000a9d61c60e R08: ffff897045500140 R09: 8080808080808080 [72.008] R10: ffff897040276800 R11: fefefefefefefeff R12: ffff8970413ed860 [72.009] R13: ffff897045500000 R14: ffff8970413ed868 R15: 0000000000000000 [72.010] ? btrfs_discard_workfn+0x51/0x400 [btrfs 23b01089228eb964071fb7ca156eee8cd3bf996f] [72.011] process_one_work+0x17e/0x330 [72.012] worker_thread+0x2ce/0x3f0 [72.013] ? __pfx_worker_thread+0x10/0x10 [72.014] kthread+0xef/0x220 [72.014] ? __pfx_kthread+0x10/0x10 [72.015] ret_from_fork+0x34/0x50 [72.015] ? __pfx_kthread+0x10/0x10 [72.016] ret_from_fork_asm+0x1a/0x30 [72.017] </TASK> [72.017] Kernel Offset: 0x15000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) [72.019] Rebooting in 90 seconds..
So fix this by making sure we move a block group out of the unused block groups discard list when calling __add_to_discard_list().
--- fs/btrfs/discard.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
fs/btrfs/discard.c +15 -2
@@ -94,8 +94,6 @@ static void __add_to_discard_list(struct struct btrfs_block_group *block_group) {lockdep_assert_held (&discard_ctl->lock); -if (!btrfs_run_discard_work (discard_ctl)) -return ;if (list_empty (&block_group->discard_list) || block_group->discard_index ==BTRFS_DISCARD_INDEX_UNUSED ) {
@@ -118,6 +116,9 @@ static void add_to_discard_list(struct bif (!btrfs_is_block_group_data_only (block_group))return ; +if (!btrfs_run_discard_work (discard_ctl)) +return ; +spin_lock (&discard_ctl->lock);__add_to_discard_list (discard_ctl, block_group);spin_unlock (&discard_ctl->lock);
@@ -250,6 +251,18 @@ again: block_group->used != 0) {if (btrfs_is_block_group_data_only (block_group)) {__add_to_discard_list (discard_ctl, block_group); +/* +* The block group must have been moved to other +* discard list even if discard was disabled in +* the meantime or a transaction abort happened, +* otherwise we can end up in an infinite loop, +* always jumping into the 'again' label and +* keep getting this block group over and over +* in case there are no other block groups in +* the discard lists. +*/ +ASSERT (block_group->discard_index != +BTRFS_DISCARD_INDEX_UNUSED ); }else {list_del_init (&block_group->discard_list);btrfs_put_block_group (block_group);
Greg Kroah-Hartman
maintainerPATCH 80/143 btrfs: fix folio leak in submit_one_async_extent()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
commit a0fd1c6098633f9a95fc2f636383546c82b704c3 upstream.
If btrfs_reserve_extent() fails while submitting an async_extent for a compressed write, then we fail to call free_async_extent_pages() on the async_extent and leak its folios. A likely cause for such a failure would be btrfs_reserve_extent() failing to find a large enough contiguous free extent for the compressed extent.
I was able to reproduce this by:
1. mount with compress-force=zstd:3
2. fallocating most of a filesystem to a big file
3. fragmenting the remaining free space
4. trying to copy in a file which zstd would generate large compressed extents for (vmlinux worked well for this)
Step 4. hits the memory leak and can be repeated ad nauseam to eventually exhaust the system memory.
Fix this by detecting the case where we fallback to uncompressed submission for a compressed async_extent and ensuring that we call free_async_extent_pages().
--- fs/btrfs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/btrfs/inode.c +7 -0
@@ -1187,6 +1187,7 @@ static void submit_one_async_extent(strustruct extent_state *cached =NULL ;struct extent_map *em;int ret =0 ; +bool free_pages = false;u64 start = async_extent->start;u64 end = async_extent->start + async_extent->ram_size -1 ;
@@ -1207,7 +1208,10 @@ static void submit_one_async_extent(stru }if (async_extent->compress_type ==BTRFS_COMPRESS_NONE ) { +ASSERT (!async_extent->folios); +ASSERT (async_extent->nr_folios ==0 );submit_uncompressed_range (inode, async_extent, locked_folio); + free_pages = true; goto done; }
@@ -1223,6 +1227,7 @@ static void submit_one_async_extent(stru* fall back to uncompressed. */ submit_uncompressed_range (inode, async_extent, locked_folio); + free_pages = true; goto done; }
@@ -1264,6 +1269,8 @@ static void submit_one_async_extent(stru done:if (async_chunk->blkcg_css)kthread_associate_blkcg (NULL ); +if (free_pages) +free_async_extent_pages (async_extent);kfree (async_extent);return ;
Greg Kroah-Hartman
maintainerPATCH 81/143 btrfs: add back warning for mount option commit values exceeding 300
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyoji Ogasawara <[email protected]>
commit 4ce2affc6ef9f84b4aebbf18bd5c57397b6024eb upstream.
The Btrfs documentation states that if the commit value is greater than 300 a warning should be issued. The warning was accidentally lost in the new mount API update.
--- fs/btrfs/fs.h | 1 + fs/btrfs/super.c | 4 ++++ 2 files changed, 5 insertions(+)
fs/btrfs/fs.h +1 -0
@@ -285,6 +285,7 @@ enum {#define BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR 0ULL#define BTRFS_DEFAULT_COMMIT_INTERVAL (30) +#define BTRFS_WARNING_COMMIT_INTERVAL (300)#define BTRFS_DEFAULT_MAX_INLINE (2048)struct btrfs_dev_replace {
fs/btrfs/super.c +4 -0
@@ -570,6 +570,10 @@ static int btrfs_parse_param(struct fs_cbreak ;case Opt_commit_interval: ctx->commit_interval = result.uint_32; +if (ctx->commit_interval >BTRFS_WARNING_COMMIT_INTERVAL ) { +btrfs_warn (NULL ,"excessive commit interval %u, use with care" , + ctx->commit_interval); + }if (ctx->commit_interval ==0 ) ctx->commit_interval =BTRFS_DEFAULT_COMMIT_INTERVAL ;break ;
Greg Kroah-Hartman
maintainerPATCH 82/143 Revert "drm/amd/display: Hardware cursor changes color when switched to software cursor"
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <[email protected]>
commit fe14c0f096f58d2569e587e9f4b05d772272bbb4 upstream.
This reverts commit 272e6aab14bbf98d7a06b2b1cd6308a02d4a10a1.
Applying degamma curve to the cursor by default breaks Linux userspace expectation.
On Linux, AMD display manager enables cursor degamma ROM just for implict sRGB on HW versions where degamma is split into two blocks:
degamma ROM for pre-defined TFs and gamma correction for user/custom curves, and degamma ROM settings doesn't apply to cursor plane.
--- drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c +3 -2
@@ -120,10 +120,11 @@ void dpp401_set_cursor_attributes(enum dc_cursor_color_format color_format = cursor_attributes->color_format;int cur_rom_en =0 ; -// DCN4 should always do Cursor degamma for Cursor Color modes if (color_format ==CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA || color_format ==CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA ) { - cur_rom_en =1 ; +if (cursor_attributes->attribute_flags.bits.ENABLE_CURSOR_DEGAMMA) { + cur_rom_en =1 ; + } } REG_UPDATE_3(CURSOR0_CONTROL,
Signature · 1 line
2.49.0
Greg Kroah-Hartman
maintainerPATCH 83/143 drm/amdgpu: read back register after written for VCN v4.0.5
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David (Ming Qiang) Wu <[email protected]>
commit ee7360fc27d6045510f8fe459b5649b2af27811a upstream.
On VCN v4.0.5 there is a race condition where the WPTR is not updated after starting from idle when doorbell is used. Adding register read-back after written at function end is to ensure all register writes are done before they can be used.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +8 -0
@@ -985,6 +985,10 @@ static int vcn_v4_0_5_start_dpg_mode(str ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
@@ -1169,6 +1173,10 @@ static int vcn_v4_0_5_start(struct amdgp fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET |FW_QUEUE_DPG_HOLD_OFF ); } +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , i, regVCN_RB_ENABLE); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 84/143 drm/amdgpu: fix incorrect MALL size for GFX1151
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Huang <[email protected]>
commit 2d73b0845ab3963856e857b810600e5594bc29f4 upstream.
On GFX1151, the reported MALL cache size reflects only half of its actual size; this adjustment corrects the discrepancy.
--- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +12 -0
@@ -747,6 +747,18 @@ static int gmc_v11_0_sw_init(void *handl adev->gmc.vram_type = vram_type; adev->gmc.vram_vendor = vram_vendor; +/* The mall_size is already calculated as mall_size_per_umc * num_umc. +* However, for gfx1151, which features a 2-to-1 UMC mapping, +* the result must be multiplied by 2 to determine the actual mall size. +*/ +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) { +case IP_VERSION (11 ,5 ,1 ): + adev->gmc.mall_size *=2 ; +break ; +default : +break ; + } +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,1 ):
Greg Kroah-Hartman
maintainerPATCH 85/143 drm/amdgpu: csa unmap use uninterruptible lock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
commit a0fa7873f2f869087b1e7793f7fac3713a1e3afe upstream.
After process exit to unmap csa and free GPU vm, if signal is accepted and then waiting to take vm lock is interrupted and return, it causes memory leaking and below warning backtrace.
Change to use uninterruptible wait lock fix the issue.
WARNING: CPU: 69 PID: 167800 at amd/amdgpu/amdgpu_kms.c:1525 amdgpu_driver_postclose_kms+0x294/0x2a0 [amdgpu] Call Trace: <TASK> drm_file_free.part.0+0x1da/0x230 [drm] drm_close_helper.isra.0+0x65/0x70 [drm] drm_release+0x6a/0x120 [drm] amdgpu_drm_release+0x51/0x60 [amdgpu] __fput+0x9f/0x280 ____fput+0xe/0x20 task_work_run+0x67/0xa0 do_exit+0x217/0x3c0 do_group_exit+0x3b/0xb0 get_signal+0x14a/0x8d0 arch_do_signal_or_restart+0xde/0x100 exit_to_user_mode_loop+0xc1/0x1a0 exit_to_user_mode_prepare+0xf4/0x100 syscall_exit_to_user_mode+0x17/0x40 do_syscall_64+0x69/0xc0
--- drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +1 -1
@@ -109,7 +109,7 @@ int amdgpu_unmap_static_csa(struct amdgpstruct drm_exec exec;int r; -drm_exec_init (&exec,DRM_EXEC_INTERRUPTIBLE_WAIT ,0 ); +drm_exec_init (&exec,0 ,0 ); drm_exec_until_all_locked(&exec) { r =amdgpu_vm_lock_pd (vm, &exec,0 );if (likely (!r))
Greg Kroah-Hartman
maintainerPATCH 86/143 drm/amd/display: Correct the reply value when AUX write incomplete
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Lin <[email protected]>
commit d433981385c62c72080e26f1c00a961d18b233be upstream.
[Why]
Now forcing aux->transfer to return 0 when incomplete AUX write is inappropriate. It should return bytes have been transferred.
[How]aux->transfer is asked not to change original msg except reply field of drm_dp_aux_msg structure. Copy the msg->buffer when it's write request, and overwrite the first byte when sink reply 1 byte indicating partially written byte number. Then we can return the correct value without changing the original msg.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -12546,7 +12546,8 @@ int amdgpu_dm_process_dmub_aux_transfer_/* The reply is stored in the top nibble of the command. */ payload->reply[0 ] = (adev->dm.dmub_notify->aux_reply.command >>4 ) &0xF ; -if (!payload->write && p_notify->aux_reply.length) +/*write req may receive a byte indicating partially written number as well*/ +if (p_notify->aux_reply.length)memcpy (payload->data, p_notify->aux_reply.data, p_notify->aux_reply.length);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +8 -2
@@ -62,6 +62,7 @@ static ssize_t dm_dp_aux_transfer(structenum aux_return_code_type operation_result;struct amdgpu_device *adev;struct ddc_service *ddc; +uint8_t copy[16 ];if (WARN_ON (msg->size >16 ))return -E2BIG ;
@@ -77,6 +78,11 @@ static ssize_t dm_dp_aux_transfer(struct (msg->request &DP_AUX_I2C_WRITE_STATUS_UPDATE ) !=0 ; payload.defer_delay =0 ; +if (payload.write) { +memcpy (copy, msg->buffer, msg->size); + payload.data = copy; + } + result =dc_link_aux_transfer_raw (TO_DM_AUX (aux)->ddc_service, &payload, &operation_result);
@@ -100,9 +106,9 @@ static ssize_t dm_dp_aux_transfer(struct*/ if (payload.write && result >=0 ) {if (result) { -/*one byte indicating partially written bytes. Force 0 to retry*/ +/*one byte indicating partially written bytes*/ drm_info (adev_to_drm (adev),"amdgpu: AUX partially written\n" ); - result =0 ; + result = payload.data[0 ]; }else if (!payload.reply[0 ])/*I2C_ACK|AUX_ACK*/ result = msg->size;
Greg Kroah-Hartman
maintainerPATCH 87/143 drm/amd/display: Avoid flooding unnecessary info messages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Lin <[email protected]>
commit d33724ffb743d3d2698bd969e29253ae0cff9739 upstream.
It's expected that we'll encounter temporary exceptions during aux transactions. Adjust logging from drm_info to drm_dbg_dp to prevent flooding with unnecessary log messages.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -3
@@ -107,7 +107,7 @@ static ssize_t dm_dp_aux_transfer(structif (payload.write && result >=0 ) {if (result) {/*one byte indicating partially written bytes*/ -drm_info (adev_to_drm (adev),"amdgpu: AUX partially written\n" ); +drm_dbg_dp (adev_to_drm (adev),"amdgpu: AUX partially written\n" ); result = payload.data[0 ]; }else if (!payload.reply[0 ])/*I2C_ACK|AUX_ACK*/
@@ -133,11 +133,11 @@ static ssize_t dm_dp_aux_transfer(structbreak ; } -drm_info (adev_to_drm (adev),"amdgpu: DP AUX transfer fail:%d\n" , operation_result); +drm_dbg_dp (adev_to_drm (adev),"amdgpu: DP AUX transfer fail:%d\n" , operation_result); }if (payload.reply[0 ]) -drm_info (adev_to_drm (adev),"amdgpu: AUX reply command not ACK: 0x%02x." , +drm_dbg_dp (adev_to_drm (adev),"amdgpu: AUX reply command not ACK: 0x%02x." , payload.reply[0 ]);return result;
Greg Kroah-Hartman
maintainerPATCH 88/143 MAINTAINERS: Update Alexey Makhalovs email address
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Makhalov <[email protected]>
commit 386cd3dcfd63491619b4034b818737fc0219e128 upstream.
Fix a typo in an email address.
--- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
MAINTAINERS +3 -3
@@ -17503,7 +17503,7 @@ F: include/uapi/linux/ppdev.h PARAVIRT_OPS INTERFACE M: Juergen Gross <[email protected]> R: Ajay Kaher <[email protected]> -R: Alexey Makhalov <[email protected]> +R: Alexey Makhalov <[email protected]> R: Broadcom internal kernel review list <[email protected]> L: [email protected] L: [email protected]
@@ -24729,7 +24729,7 @@ F: drivers/misc/vmw_balloon.c VMWARE HYPERVISOR INTERFACE M: Ajay Kaher <[email protected]> -M: Alexey Makhalov <[email protected]> +M: Alexey Makhalov <[email protected]> R: Broadcom internal kernel review list <[email protected]> L: [email protected] L: [email protected]
@@ -24757,7 +24757,7 @@ F: drivers/scsi/vmw_pvscsi.h VMWARE VIRTUAL PTP CLOCK DRIVER M: Nick Shi <[email protected]> R: Ajay Kaher <[email protected]> -R: Alexey Makhalov <[email protected]> +R: Alexey Makhalov <[email protected]> R: Broadcom internal kernel review list <[email protected]> L: [email protected] S: Supported
Greg Kroah-Hartman
maintainerPATCH 89/143 gpio: pca953x: fix IRQ storm on system wake up
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emanuele Ghidoli <[email protected]>
commit 3e38f946062b4845961ab86b726651b4457b2af8 upstream.
If an input changes state during wake-up and is used as an interrupt source, the IRQ handler reads the volatile input register to clear the interrupt mask and deassert the IRQ line. However, the IRQ handler is triggered before access to the register is granted, causing the read operation to fail.
As a result, the IRQ handler enters a loop, repeatedly printing the "failed reading register" message, until pca953x_resume() is eventually called, which restores the driver context and enables access to registers.
Fix by disabling the IRQ line before entering suspend mode, and re-enabling it after the driver context is restored in pca953x_resume().
An IRQ can be disabled with disable_irq() and still wake the system as long as the IRQ has wake enabled, so the wake-up functionality is preserved.
--- drivers/gpio/gpio-pca953x.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpio/gpio-pca953x.c +6 -0
@@ -1203,6 +1203,8 @@ static int pca953x_restore_context(strucguard (mutex)(&chip->i2c_lock); +if (chip->client->irq >0 ) +enable_irq (chip->client->irq);regcache_cache_only (chip->regmap, false);regcache_mark_dirty (chip->regmap); ret =pca953x_regcache_sync (chip);
@@ -1215,6 +1217,10 @@ static int pca953x_restore_context(strucstatic void pca953x_save_context (struct pca953x_chip *chip) {guard (mutex)(&chip->i2c_lock); + +/* Disable IRQ to prevent early triggering while regmap "cache only" is on */ +if (chip->client->irq >0 ) +disable_irq (chip->client->irq);regcache_cache_only (chip->regmap, true); }
Greg Kroah-Hartman
maintainerPATCH 90/143 ACPI: PPTT: Fix processor subtable walk
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Linton <[email protected]>
commit adfab6b39202481bb43286fff94def4953793fdb upstream.
The original PPTT code had a bug where the processor subtable length was not correctly validated when encountering a truncated acpi_pptt_processor node.
Commit 7ab4f0e37a0f4 ("ACPI PPTT: Fix coding mistakes in a couple of sizeof() calls") attempted to fix this by validating the size is as large as the acpi_pptt_processor node structure. This introduced a regression where the last processor node in the PPTT table is ignored if it doesn't contain any private resources. That results errors like:
ACPI PPTT: PPTT table found, but unable to locate core XX (XX)
ACPI: SPE must be homogeneous
Furthermore, it fails in a common case where the node length isn't equal to the acpi_pptt_processor structure size, leaving the original bug in a modified form.
Correct the regression by adjusting the loop termination conditions as suggested by the bug reporters. An additional check performed after the subtable node type is detected, validates the acpi_pptt_processor node is fully contained in the PPTT table. Repeating the check in acpi_pptt_leaf_node() is largely redundant as the node is already known to be fully contained in the table.
The case where a final truncated node's parent property is accepted, but the node itself is rejected should not be considered a bug.
--- drivers/acpi/pptt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/acpi/pptt.c +8 -3
@@ -231,16 +231,18 @@ static int acpi_pptt_leaf_node(struct ac sizeof(struct acpi_table_pptt)); proc_sz =sizeof (struct acpi_pptt_processor ); -while ((unsigned long )entry + proc_sz < table_end) { +/* ignore subtable types that are smaller than a processor node */ +while ((unsigned long )entry + proc_sz <= table_end) { cpu_node = (struct acpi_pptt_processor *)entry; +if (entry->type ==ACPI_PPTT_TYPE_PROCESSOR && cpu_node->parent == node_entry)return 0 ;if (entry->length ==0 )return 0 ; + entry = ACPI_ADD_PTR(struct acpi_subtable_header, entry, entry->length); - }return 1 ; }
@@ -273,15 +275,18 @@ static struct acpi_pptt_processor *acpi_ proc_sz =sizeof (struct acpi_pptt_processor );/* find the processor structure associated with this cpuid */ -while ((unsigned long )entry + proc_sz < table_end) { +while ((unsigned long )entry + proc_sz <= table_end) { cpu_node = (struct acpi_pptt_processor *)entry;if (entry->length ==0 ) {pr_warn ("Invalid zero length subtable\n" );break ; } +/* entry->length may not equal proc_sz, revalidate the processor structure length */ if (entry->type ==ACPI_PPTT_TYPE_PROCESSOR && acpi_cpu_id == cpu_node->acpi_processor_id && + (unsigned long )entry + entry->length <= table_end && + entry->length == proc_sz + cpu_node->number_of_priv_resources *sizeof (u32) &&acpi_pptt_leaf_node (table_hdr, cpu_node)) {return (struct acpi_pptt_processor *)entry; }
Greg Kroah-Hartman
maintainerPATCH 91/143 ALSA: es1968: Add error handling for snd_pcm_hw_constraint_pow2()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 9e000f1b7f31684cc5927e034360b87ac7919593 upstream.
The function snd_es1968_capture_open() calls the function snd_pcm_hw_constraint_pow2(), but does not check its return value. A proper implementation can be found in snd_cx25821_pcm_open().
Add error handling for snd_pcm_hw_constraint_pow2() and propagate its error code.
--- sound/pci/es1968.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/pci/es1968.c +4 -2
@@ -1561,7 +1561,7 @@ static int snd_es1968_capture_open(strucstruct snd_pcm_runtime *runtime = substream->runtime;struct es1968 *chip =snd_pcm_substream_chip (substream);struct esschan *es; -int apu1, apu2; +int err, apu1, apu2; apu1 =snd_es1968_alloc_apu_pair (chip,ESM_APU_PCM_CAPTURE );if (apu1 <0 )
@@ -1605,7 +1605,9 @@ static int snd_es1968_capture_open(struc runtime->hw = snd_es1968_capture; runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =calc_available_memory_size (chip) -1024 ;/* keep MIXBUF size */ -snd_pcm_hw_constraint_pow2 (runtime,0 ,SNDRV_PCM_HW_PARAM_BUFFER_BYTES ); + err =snd_pcm_hw_constraint_pow2 (runtime,0 ,SNDRV_PCM_HW_PARAM_BUFFER_BYTES ); +if (err <0 ) +return err;spin_lock_irq (&chip->substream_lock);list_add (&es->list, &chip->substream_list);
Greg Kroah-Hartman
maintainerPATCH 92/143 ALSA: usb-audio: Add sample rate quirk for Audioengine D1
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Heusel <[email protected]>
commit 2b24eb060c2bb9ef79e1d3bcf633ba1bc95215d6 upstream.
A user reported on the Arch Linux Forums that their device is emitting the following message in the kernel journal, which is fixed by adding the quirk as submitted in this patch:
Quoted 1 line
kernel: usb 1-2: current rate 8436480 is different from the runtime rate 48000
There also is an entry for this product line added long time ago. Their specific device has the following ID:
$ lsusb | grep Audio
Bus 001 Device 002: ID 1101:0003 EasyPass Industrial Co., Ltd Audioengine D1--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2248,6 +2248,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_FIXED_RATE),DEVICE_FLG (0x0fd9 ,0x0008 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), +DEVICE_FLG (0x1101 ,0x0003 ,/* Audioengine D1 */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x1224 ,0x2a25 ,/* Jieli Technology USB PHY 2.0 */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ), DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
Greg Kroah-Hartman
maintainerPATCH 93/143 ALSA: usb-audio: Add sample rate quirk for Microdia JP001 USB Camera
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Chauvet <[email protected]>
commit 7b9938a14460e8ec7649ca2e80ac0aae9815bf02 upstream.
Microdia JP001 does not support reading the sample rate which leads to many lines of "cannot get freq at ep 0x84".
This patch adds the USB ID to quirks.c and avoids those error messages.
usb 7-4: New USB device found, idVendor=0c45, idProduct=636b, bcdDevice= 1.00 usb 7-4: New USB device strings: Mfr=2, Product=1, SerialNumber=3 usb 7-4: Product: JP001
usb 7-4: Manufacturer: JP001
usb 7-4: SerialNumber: JP001
usb 7-4: 3:1: cannot get freq at ep 0x84
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2240,6 +2240,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_CTL_MSG_DELAY_1M),DEVICE_FLG (0x0c45 ,0x6340 ,/* Sonix HD USB Camera */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x0c45 ,0x636b ,/* Microdia JP001 USB Camera */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x0d8c ,0x0014 ,/* USB Audio Device */ QUIRK_FLAG_CTL_MSG_DELAY_1M ), DEVICE_FLG(0x0ecb, 0x205c, /* JBL Quantum610 Wireless */
Greg Kroah-Hartman
maintainerPATCH 94/143 dma-buf: insert memory barrier before updating num_fences
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyejeong Choi <[email protected]>
commit 72c7d62583ebce7baeb61acce6057c361f73be4a upstream.
smp_store_mb() inserts memory barrier after storing operation. It is different with what the comment is originally aiming so Null pointer dereference can be happened if memory update is reordered.
--- drivers/dma-buf/dma-resv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/dma-buf/dma-resv.c +3 -2
@@ -320,8 +320,9 @@ void dma_resv_add_fence(struct dma_resv count++;dma_resv_list_set (fobj, i, fence, usage); -/* pointer update must be visible before we extend the num_fences */ -smp_store_mb (fobj->num_fences, count); +/* fence update must be visible before we extend the num_fences */ +smp_wmb (); + fobj->num_fences = count; }EXPORT_SYMBOL (dma_resv_add_fence);
Greg Kroah-Hartman
maintainerPATCH 95/143 hv_netvsc: Use vmbus_sendpacket_mpb_desc() to send VMBus messages
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 4f98616b855cb0e3b5917918bb07b44728eb96ea upstream.
netvsc currently uses vmbus_sendpacket_pagebuffer() to send VMBus messages. This function creates a series of GPA ranges, each of which contains a single PFN. However, if the rndis header in the VMBus message crosses a page boundary, the netvsc protocol with the host requires that both PFNs for the rndis header must be in a single "GPA range" data structure, which isn't possible with vmbus_sendpacket_pagebuffer(). As the first step in fixing this, add a new function netvsc_build_mpb_array() to build a VMBus message with multiple GPA ranges, each of which may contain multiple PFNs. Use vmbus_sendpacket_mpb_desc() to send this VMBus message to the host.
There's no functional change since higher levels of netvsc don't maintain or propagate knowledge of contiguous PFNs. Based on its input, netvsc_build_mpb_array() still produces a separate GPA range for each PFN and the behavior is the same as with vmbus_sendpacket_pagebuffer(). But the groundwork is laid for a subsequent patch to provide the necessary grouping.
--- drivers/net/hyperv/netvsc.c | 50 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-)
drivers/net/hyperv/netvsc.c +45 -5
@@ -1049,6 +1049,42 @@ static int netvsc_dma_map(struct hv_devireturn 0 ; } +/* Build an "array" of mpb entries describing the data to be transferred +* over VMBus. After the desc header fields, each "array" entry is variable +* size, and each entry starts after the end of the previous entry. The +* "offset" and "len" fields for each entry imply the size of the entry. +* +* The pfns are in HV_HYP_PAGE_SIZE, because all communication with Hyper-V +* uses that granularity, even if the system page size of the guest is larger. +* Each entry in the input "pb" array must describe a contiguous range of +* guest physical memory so that the pfns are sequential if the range crosses +* a page boundary. The offset field must be < HV_HYP_PAGE_SIZE. +*/ +static inline void netvsc_build_mpb_array (struct hv_page_buffer *pb, +u32 page_buffer_count, +struct vmbus_packet_mpb_array *desc, +u32 *desc_size) +{ +struct hv_mpb_array *mpb_entry = &desc->range; +int i, j; + +for (i =0 ; i < page_buffer_count; i++) { +u32 offset = pb[i].offset; +u32 len = pb[i].len; + + mpb_entry->offset = offset; + mpb_entry->len = len; + +for (j =0 ; j <HVPFN_UP (offset + len); j++) + mpb_entry->pfn_array[j] = pb[i].pfn + j; + + mpb_entry = (struct hv_mpb_array *)&mpb_entry->pfn_array[j]; + } + + desc->rangecount = page_buffer_count; + *desc_size = (char *)mpb_entry - (char *)desc; +} + static inline int netvsc_send_pkt( struct hv_device *device, struct hv_netvsc_packet *packet,
@@ -1091,6 +1127,9 @@ static inline int netvsc_send_pkt( packet->dma_range =NULL ;if (packet->page_buf_cnt) { +struct vmbus_channel_packet_page_buffer desc; +u32 desc_size; +if (packet->cp_partial) pb += packet->rmsg_pgcnt;
@@ -1100,11 +1139,12 @@ static inline int netvsc_send_pkt( goto exit; } - ret =vmbus_sendpacket_pagebuffer (out_channel, - pb, packet->page_buf_cnt, - &nvmsg,sizeof (nvmsg), - req_id); - +netvsc_build_mpb_array (pb, packet->page_buf_cnt, + (struct vmbus_packet_mpb_array *)&desc, + &desc_size); + ret =vmbus_sendpacket_mpb_desc (out_channel, + (struct vmbus_packet_mpb_array *)&desc, + desc_size, &nvmsg,sizeof (nvmsg), req_id);if (ret)netvsc_dma_unmap (ndev_ctx->device_ctx, packet); }else {
Greg Kroah-Hartman
maintainerPATCH 96/143 hv_netvsc: Preserve contiguous PFN grouping in the page buffer array
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 41a6328b2c55276f89ea3812069fd7521e348bbf upstream.
Starting with commit dca5161f9bd0 ("hv_netvsc: Check status in SEND_RNDIS_PKT completion message") in the 6.3 kernel, the Linux driver for Hyper-V synthetic networking (netvsc) occasionally reports "nvsp_rndis_pkt_complete error status: 2".[1] This error indicates that Hyper-V has rejected a network packet transmit request from the guest, and the outgoing network packet is dropped. Higher level network protocols presumably recover and resend the packet so there is no functional error, but performance is slightly impacted. Commit dca5161f9bd0 is not the cause of the error -- it only added reporting of an error that was already happening without any notice. The error has presumably been present since the netvsc driver was originally introduced into Linux.
The root cause of the problem is that the netvsc driver in Linux may send an incorrectly formatted VMBus message to Hyper-V when transmitting the network packet. The incorrect formatting occurs when the rndis header of the VMBus message crosses a page boundary due to how the Linux skb head memory is aligned. In such a case, two PFNs are required to describe the location of the rndis header, even though they are contiguous in guest physical address (GPA) space. Hyper-V requires that two rndis header PFNs be in a single "GPA range" data struture, but current netvsc code puts each PFN in its own GPA range, which Hyper-V rejects as an error.
The incorrect formatting occurs only for larger packets that netvsc must transmit via a VMBus "GPA Direct" message. There's no problem when netvsc transmits a smaller packet by copying it into a pre- allocated send buffer slot because the pre-allocated slots don't have page crossing issues.
After commit 14ad6ed30a10 ("net: allow small head cache usage with large MAX_SKB_FRAGS values") in the 6.14-rc4 kernel, the error occurs much more frequently in VMs with 16 or more vCPUs. It may occur every few seconds, or even more frequently, in an ssh session that outputs a lot of text. Commit 14ad6ed30a10 subtly changes how skb head memory is allocated, making it much more likely that the rndis header will cross a page boundary when the vCPU count is 16 or more. The changes in commit 14ad6ed30a10 are perfectly valid -- they just had the side effect of making the netvsc bug more prominent.
Current code in init_page_array() creates a separate page buffer array entry for each PFN required to identify the data to be transmitted. Contiguous PFNs get separate entries in the page buffer array, and any information about contiguity is lost.
Fix the core issue by having init_page_array() construct the page buffer array to represent contiguous ranges rather than individual pages. When these ranges are subsequently passed to netvsc_build_mpb_array(), it can build GPA ranges that contain multiple PFNs, as required to avoid the error "nvsp_rndis_pkt_complete error status: 2". If instead the network packet is sent by copying into a pre-allocated send buffer slot, the copy proceeds using the contiguous ranges rather than individual pages, but the result of the copying is the same. Also fix rndis_filter_send_request() to construct a contiguous range, since it has its own page buffer array.
This change has a side benefit in CoCo VMs in that netvsc_dma_map() calls dma_map_single() on each contiguous range instead of on each page. This results in fewer calls to dma_map_single() but on larger chunks of memory, which should reduce contention on the swiotlb.
Since the page buffer array now contains one entry for each contiguous range instead of for each individual page, the number of entries in the array can be reduced, saving 208 bytes of stack space in netvsc_xmit() when MAX_SKG_FRAGS has the default value of 17.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=217503
--- drivers/net/hyperv/hyperv_net.h | 12 +++++++ drivers/net/hyperv/netvsc_drv.c | 65 +++++++++----------------------------- drivers/net/hyperv/rndis_filter.c | 24 ++------------ 3 files changed, 33 insertions(+), 68 deletions(-)
drivers/net/hyperv/hyperv_net.h +12 -0
@@ -893,6 +893,18 @@ struct nvsp_message { sizeof(struct nvsp_message))#define NETVSC_MIN_IN_MSG_SIZE sizeof(struct vmpacket_descriptor) +/* Maximum # of contiguous data ranges that can make up a trasmitted packet. +* Typically it's the max SKB fragments plus 2 for the rndis packet and the +* linear portion of the SKB. But if MAX_SKB_FRAGS is large, the value may +* need to be limited to MAX_PAGE_BUFFER_COUNT, which is the max # of entries +* in a GPA direct packet sent to netvsp over VMBus. +*/ +#if MAX_SKB_FRAGS +2 <MAX_PAGE_BUFFER_COUNT +#define MAX_DATA_RANGES (MAX_SKB_FRAGS + 2) +#else +#define MAX_DATA_RANGES MAX_PAGE_BUFFER_COUNT +#endif +/* Estimated requestor size: * out_ring_size/min_out_msg_size + in_ring_size/min_in_msg_size */
drivers/net/hyperv/netvsc_drv.c +16 -49
94 lines not on this page · raw message
drivers/net/hyperv/rndis_filter.c +5 -19
@@ -225,8 +225,7 @@ static int rndis_filter_send_request(str struct rndis_request *req) {struct hv_netvsc_packet *packet; -struct hv_page_buffer page_buf[2 ]; -struct hv_page_buffer *pb = page_buf; +struct hv_page_buffer pb;int ret;/* Setup the packet to send it */
@@ -235,27 +234,14 @@ static int rndis_filter_send_request(str packet->total_data_buflen = req->request_msg.msg_len; packet->page_buf_cnt =1 ; - pb[0 ].pfn =virt_to_phys (&req->request_msg) >> -HV_HYP_PAGE_SHIFT ; - pb[0 ].len = req->request_msg.msg_len; - pb[0 ].offset =offset_in_hvpage (&req->request_msg); - -/* Add one page_buf when request_msg crossing page boundary */ -if (pb[0 ].offset + pb[0 ].len >HV_HYP_PAGE_SIZE ) { - packet->page_buf_cnt++; - pb[0 ].len =HV_HYP_PAGE_SIZE - - pb[0 ].offset; - pb[1 ].pfn =virt_to_phys ((void *)&req->request_msg - + pb[0 ].len) >>HV_HYP_PAGE_SHIFT ; - pb[1 ].offset =0 ; - pb[1 ].len = req->request_msg.msg_len - - pb[0 ].len; - } + pb.pfn =virt_to_phys (&req->request_msg) >>HV_HYP_PAGE_SHIFT ; + pb.len = req->request_msg.msg_len; + pb.offset =offset_in_hvpage (&req->request_msg);trace_rndis_send (dev->ndev,0 , &req->request_msg);rcu_read_lock_bh (); - ret =netvsc_send (dev->ndev, packet,NULL , pb,NULL , false); + ret =netvsc_send (dev->ndev, packet,NULL , &pb,NULL , false);rcu_read_unlock_bh ();return ret;
Greg Kroah-Hartman
maintainerPATCH 97/143 hv_netvsc: Remove rmsg_pgcnt
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 5bbc644bbf4e97a05bc0cb052189004588ff8a09 upstream.
init_page_array() now always creates a single page buffer array entry for the rndis message, even if the rndis message crosses a page boundary. As such, the number of page buffer array entries used for the rndis message must no longer be tracked -- it is always just 1. Remove the rmsg_pgcnt field and use "1" where the value is needed.
--- drivers/net/hyperv/hyperv_net.h | 1 - drivers/net/hyperv/netvsc.c | 7 +++---- drivers/net/hyperv/netvsc_drv.c | 1 - 3 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/hyperv/hyperv_net.h +0 -1
@@ -158,7 +158,6 @@ struct hv_netvsc_packet {u8 cp_partial;/* partial copy into send buffer */ u8 rmsg_size;/* RNDIS header and PPI size */ -u8 rmsg_pgcnt;/* page count of RNDIS header and PPI */ u8 page_buf_cnt;u16 q_idx;
drivers/net/hyperv/netvsc.c +3 -4
@@ -947,8 +947,7 @@ static void netvsc_copy_to_send_buf(stru + pend_size;int i;u32 padding =0 ; -u32 page_count = packet->cp_partial ? packet->rmsg_pgcnt : - packet->page_buf_cnt; +u32 page_count = packet->cp_partial ?1 : packet->page_buf_cnt;u32 remain;/* Add padding */
@@ -1131,7 +1130,7 @@ static inline int netvsc_send_pkt(u32 desc_size;if (packet->cp_partial) - pb += packet->rmsg_pgcnt; + pb++; ret =netvsc_dma_map (ndev_ctx->device_ctx, packet, pb);if (ret) {
@@ -1293,7 +1292,7 @@ int netvsc_send(struct net_device *ndev, packet->send_buf_index = section_index;if (packet->cp_partial) { - packet->page_buf_cnt -= packet->rmsg_pgcnt; + packet->page_buf_cnt--; packet->total_data_buflen = msd_len + packet->rmsg_size; }else { packet->page_buf_cnt =0 ;
drivers/net/hyperv/netvsc_drv.c +0 -1
@@ -342,7 +342,6 @@ static u32 init_page_array(void *hdr, u3 pb[0 ].len = len; pb[0 ].pfn =virt_to_hvpfn (hdr); packet->rmsg_size = len; - packet->rmsg_pgcnt =1 ; pb[1 ].offset =offset_in_hvpage (skb->data); pb[1 ].len =skb_headlen (skb);
Greg Kroah-Hartman
maintainerPATCH 98/143 arm64: dts: amlogic: dreambox: fix missing clkc_audio node
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Hewitt <[email protected]>
commit 0f67578587bb9e5a8eecfcdf6b8a501b5bd90526 upstream.
Add the clkc_audio node to fix audio support on Dreambox One/Two.
--- arch/arm64/boot/dts/amlogic/meson-g12b-dreambox.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-dreambox.dtsi +4 -0
@@ -116,6 +116,10 @@ status = "okay"; }; +&clkc_audio { + status = "okay"; +}; + &frddr_a { status = "okay"; };
Greg Kroah-Hartman
maintainerPATCH 99/143 arm64: dts: rockchip: Remove overdrive-mode OPPs from RK3588J SoC dtsi
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragan Simic <[email protected]>
commit e0bd7ecf6b2dc71215af699dffbf14bf0bc3d978 upstream.
The differences in the vendor-approved CPU and GPU OPPs for the standard Rockchip RK3588 variant [1] and the industrial Rockchip RK3588J variant [2] come from the latter, presumably, supporting an extended temperature range that's usually associated with industrial applications, despite the two SoC variant datasheets specifying the same upper limit for the allowed ambient temperature for both variants. However, the lower temperature limit is specified much lower for the RK3588J variant. [1][2]
To be on the safe side and to ensure maximum longevity of the RK3588J SoCs, only the CPU and GPU OPPs that are declared by the vendor to be always safe for this SoC variant may be provided. As explained by the vendor [3] and according to the RK3588J datasheet, [2] higher-frequency/higher-voltage CPU and GPU OPPs can be used as well, but at the risk of reducing the SoC lifetime expectancy. Presumably, using the higher OPPs may be safe only when not enjoying the assumed extended temperature range that the RK3588J, as an SoC variant targeted specifically at higher-temperature, industrial applications, is made (or binned) for.
Anyone able to keep their RK3588J-based board outside the above-presumed extended temperature range at all times, and willing to take the associated risk of possibly reducing the SoC lifetime expectancy, is free to apply a DT overlay that adds the higher CPU and GPU OPPs.
With all this and the downstream RK3588(J) DT definitions [4][5] in mind, let's delete the RK3588J CPU and GPU OPPs that are not considered belonging to the normal operation mode for this SoC variant. To quote the RK3588J datasheet [2], "normal mode means the chipset works under safety voltage and frequency; for the industrial environment, highly recommend to keep in normal mode, the lifetime is reasonably guaranteed", while "overdrive mode brings higher frequency, and the voltage will increase accordingly; under the overdrive mode for a long time, the chipset may shorten the lifetime, especially in high-temperature condition".
To sum the RK3588J datasheet [2] and the vendor-provided DTs up, [4][5] the maximum allowed CPU core, GPU and NPU frequencies are as follows:
IP core | Normal mode | Overdrive mode
------------+-------------+----------------
Cortex-A55 | 1,296 MHz | 1,704 MHz Cortex-A76 | 1,608 MHz | 2,016 MHz GPU | 700 MHz | 850 MHz NPU | 800 MHz | 950 MHz
Unfortunately, when it comes to the actual voltages for the RK3588J CPU and GPU OPPs, there's a discrepancy between the RK3588J datasheet [2] and the downstream kernel code. [4][5] The RK3588J datasheet states that "the max. working voltage of CPU/GPU/NPU is 0.75 V under the normal mode", while the downstream kernel code actually allows voltage ranges that go up to 0.95 V, which is still within the voltage range allowed by the datasheet. However, the RK3588J datasheet also tells us to "strictly refer to the software configuration of SDK and the hardware reference design", so let's embrace the voltage ranges provided by the downstream kernel code, which also prevents the undesirable theoretical outcome of ending up with no usable OPPs on a particular board, as a result of the board's voltage regulator(s) being unable to deliver the exact voltages, for whatever reason.
The above-described voltage ranges for the RK3588J CPU OPPs remain taken from the downstream kernel code [4][5] by picking the highest, worst-bin values, which ensure that all RK3588J bins will work reliably. Yes, with some power inevitably wasted as unnecessarily generated heat, but the reliability is paramount, together with the longevity. This deficiency may be revisited separately at some point in the future.
The provided RK3588J CPU OPPs follow the slightly debatable "provide only the highest-frequency OPP from the same-voltage group" approach that's been established earlier, [6] as a result of the "same-voltage, lower-frequency" OPPs being considered inefficient from the IPA governor's standpoint, which may also be revisited separately at some point in the future.
[1] https://wiki.friendlyelec.com/wiki/images/e/ee/Rockchip_RK3588_Datasheet_V1.6-20231016.pdf
[2] https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2403201054_Rockchip-RK3588J_C22364189.pdf
[3] https://lore.kernel.org/linux-rockchip/[email protected]/T/#u
[4] https://raw.githubusercontent.com/rockchip-linux/kernel/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
[5] https://raw.githubusercontent.com/rockchip-linux/kernel/604cec4004abe5a96c734f2fab7b74809d2d742f/arch/arm64/boot/dts/rockchip/rk3588j.dtsi
[6] https://lore.kernel.org/all/[email protected]/
--- arch/arm64/boot/dts/rockchip/rk3588j.dtsi | 53 +++++++++--------------------- 1 file changed, 17 insertions(+), 36 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588j.dtsi +17 -36
@@ -11,20 +11,15 @@ compatible = "operating-points-v2"; opp-shared; - opp-1416000000 { - opp-hz = /bits/ 64 <1416000000>; + opp-1200000000 { + opp-hz = /bits/ 64 <1200000000>; opp-microvolt = <750000 750000 950000>; clock-latency-ns = <40000>; opp-suspend; }; - opp-1608000000 { - opp-hz = /bits/ 64 <1608000000>; - opp-microvolt = <887500 887500 950000>; - clock-latency-ns = <40000>; - }; - opp-1704000000 { - opp-hz = /bits/ 64 <1704000000>; - opp-microvolt = <937500 937500 950000>; + opp-1296000000 { + opp-hz = /bits/ 64 <1296000000>; + opp-microvolt = <775000 775000 950000>; clock-latency-ns = <40000>; }; };
@@ -33,9 +28,14 @@ compatible = "operating-points-v2"; opp-shared; + opp-1200000000{ + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <750000 750000 950000>; + clock-latency-ns = <40000>; + }; opp-1416000000 { opp-hz = /bits/ 64 <1416000000>; - opp-microvolt = <750000 750000 950000>; + opp-microvolt = <762500 762500 950000>; clock-latency-ns = <40000>; }; opp-1608000000 {
@@ -43,25 +43,20 @@ opp-microvolt = <787500 787500 950000>; clock-latency-ns = <40000>; }; - opp-1800000000 { - opp-hz = /bits/ 64 <1800000000>; - opp-microvolt = <875000 875000 950000>; - clock-latency-ns = <40000>; - }; - opp-2016000000 { - opp-hz = /bits/ 64 <2016000000>; - opp-microvolt = <950000 950000 950000>; - clock-latency-ns = <40000>; - }; }; cluster2_opp_table: opp-table-cluster2 { compatible = "operating-points-v2"; opp-shared; + opp-1200000000{ + opp-hz = /bits/ 64 <1200000000>; + opp-microvolt = <750000 750000 950000>; + clock-latency-ns = <40000>; + }; opp-1416000000 { opp-hz = /bits/ 64 <1416000000>; - opp-microvolt = <750000 750000 950000>; + opp-microvolt = <762500 762500 950000>; clock-latency-ns = <40000>; }; opp-1608000000 {
@@ -69,16 +64,6 @@ opp-microvolt = <787500 787500 950000>; clock-latency-ns = <40000>; }; - opp-1800000000 { - opp-hz = /bits/ 64 <1800000000>; - opp-microvolt = <875000 875000 950000>; - clock-latency-ns = <40000>; - }; - opp-2016000000 { - opp-hz = /bits/ 64 <2016000000>; - opp-microvolt = <950000 950000 950000>; - clock-latency-ns = <40000>; - }; }; gpu_opp_table: opp-table {
@@ -104,10 +89,6 @@ opp-hz = /bits/ 64 <700000000>; opp-microvolt = <750000 750000 850000>; }; - opp-850000000 { - opp-hz = /bits/ 64 <800000000>; - opp-microvolt = <787500 787500 850000>; - }; }; };
Greg Kroah-Hartman
maintainerPATCH 100/143 Drivers: hv: Allow vmbus_sendpacket_mpb_desc() to create multiple ranges
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 380b75d3078626aadd0817de61f3143f5db6e393 upstream.
vmbus_sendpacket_mpb_desc() is currently used only by the storvsc driver and is hardcoded to create a single GPA range. To allow it to also be used by the netvsc driver to create multiple GPA ranges, no longer hardcode as having a single GPA range. Allow the calling driver to specify the rangecount in the supplied descriptor.
Update the storvsc driver to reflect this new approach.
--- drivers/hv/channel.c | 6 +++--- drivers/scsi/storvsc_drv.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/hv/channel.c +3 -3
@@ -1136,9 +1136,10 @@ int vmbus_sendpacket_pagebuffer(struct vEXPORT_SYMBOL_GPL (vmbus_sendpacket_pagebuffer);/* -* vmbus_sendpacket_multipagebuffer - Send a multi-page buffer packet +* vmbus_sendpacket_mpb_desc - Send one or more multi-page buffer packets * using a GPADL Direct packet type. -* The buffer includes the vmbus descriptor. +* The desc argument must include space for the VMBus descriptor. The +* rangecount field must already be set. */ int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel, struct vmbus_packet_mpb_array *desc,
@@ -1160,7 +1161,6 @@ int vmbus_sendpacket_mpb_desc(struct vmb desc->length8 = (u16)(packetlen_aligned >>3 ); desc->transactionid =VMBUS_RQST_ERROR ;/* will be updated in hv_ringbuffer_write() */ desc->reserved =0 ; - desc->rangecount =1 ; bufferlist[0 ].iov_base = desc; bufferlist[0 ].iov_len = desc_size;
drivers/scsi/storvsc_drv.c +1 -0
@@ -1819,6 +1819,7 @@ static int storvsc_queuecommand(struct Sreturn SCSI_MLQUEUE_DEVICE_BUSY ; } + payload->rangecount =1 ; payload->range.len = length; payload->range.offset = offset_in_hvpg;
Greg Kroah-Hartman
maintainerPATCH 101/143 Drivers: hv: vmbus: Remove vmbus_sendpacket_pagebuffer()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 45a442fe369e6c4e0b4aa9f63b31c3f2f9e2090e upstream.
With the netvsc driver changed to use vmbus_sendpacket_mpb_desc() instead of vmbus_sendpacket_pagebuffer(), the latter has no remaining callers. Remove it.
--- drivers/hv/channel.c | 59 ------------------------------------------------- include/linux/hyperv.h | 7 ----- 2 files changed, 66 deletions(-)
drivers/hv/channel.c +0 -59
@@ -1077,65 +1077,6 @@ int vmbus_sendpacket(struct vmbus_channeEXPORT_SYMBOL (vmbus_sendpacket);/* -* vmbus_sendpacket_pagebuffer - Send a range of single-page buffer -* packets using a GPADL Direct packet type. This interface allows you -* to control notifying the host. This will be useful for sending -* batched data. Also the sender can control the send flags -* explicitly. -*/ -int vmbus_sendpacket_pagebuffer (struct vmbus_channel *channel, -struct hv_page_buffer pagebuffers[], -u32 pagecount,void *buffer,u32 bufferlen, -u64 requestid) -{ -int i; -struct vmbus_channel_packet_page_buffer desc; -u32 descsize; -u32 packetlen; -u32 packetlen_aligned; -struct kvec bufferlist[3 ]; -u64 aligned_data =0 ; - -if (pagecount >MAX_PAGE_BUFFER_COUNT ) -return -EINVAL ; - -/* -* Adjust the size down since vmbus_channel_packet_page_buffer is the -* largest size we support -*/ - descsize =sizeof (struct vmbus_channel_packet_page_buffer ) - - ((MAX_PAGE_BUFFER_COUNT - pagecount) * -sizeof (struct hv_page_buffer )); - packetlen = descsize + bufferlen; - packetlen_aligned =ALIGN (packetlen,sizeof (u64)); - -/* Setup the descriptor */ - desc.type =VM_PKT_DATA_USING_GPA_DIRECT ; - desc.flags =VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED ; - desc.dataoffset8 = descsize >>3 ;/* in 8-bytes granularity */ - desc.length8 = (u16)(packetlen_aligned >>3 ); - desc.transactionid =VMBUS_RQST_ERROR ;/* will be updated in hv_ringbuffer_write() */ - desc.reserved =0 ; - desc.rangecount = pagecount; - -for (i =0 ; i < pagecount; i++) { - desc.range[i].len = pagebuffers[i].len; - desc.range[i].offset = pagebuffers[i].offset; - desc.range[i].pfn = pagebuffers[i].pfn; - } - - bufferlist[0 ].iov_base = &desc; - bufferlist[0 ].iov_len = descsize; - bufferlist[1 ].iov_base = buffer; - bufferlist[1 ].iov_len = bufferlen; - bufferlist[2 ].iov_base = &aligned_data; - bufferlist[2 ].iov_len = (packetlen_aligned - packetlen); - -return hv_ringbuffer_write (channel, bufferlist,3 , requestid,NULL ); -} -EXPORT_SYMBOL_GPL (vmbus_sendpacket_pagebuffer); - -/* * vmbus_sendpacket_mpb_desc - Send one or more multi-page buffer packets * using a GPADL Direct packet type. * The desc argument must include space for the VMBus descriptor. The
include/linux/hyperv.h +0 -7
@@ -1232,13 +1232,6 @@ extern int vmbus_sendpacket(struct vmbusenum vmbus_packet_type type, u32 flags); -extern int vmbus_sendpacket_pagebuffer (struct vmbus_channel *channel, -struct hv_page_buffer pagebuffers[], -u32 pagecount, -void *buffer, -u32 bufferlen, -u64 requestid); - extern int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel, struct vmbus_packet_mpb_array *mpb, u32 desc_size,
Greg Kroah-Hartman
maintainerPATCH 102/143 kbuild: Disable -Wdefault-const-init-unsafe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit d0afcfeb9e3810ec89d1ffde1a0e36621bb75dca upstream.
A new on by default warning in clang [1] aims to flags instances where const variables without static or thread local storage or const members in aggregate types are not initialized because it can lead to an indeterminate value. This is quite noisy for the kernel due to instances originating from header files such as:
drivers/gpu/drm/i915/gt/intel_ring.h:62:2: error: default initialization of an object of type 'typeof (ring->size)' (aka 'const unsigned int') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
62 | typecheck(typeof(ring->size), next);
| ^
include/linux/typecheck.h:10:9: note: expanded from macro 'typecheck'
10 | ({ type __dummy; \
| ^ include/net/ip.h:478:14: error: default initialization of an object of type 'typeof (rt->dst.expires)' (aka 'const unsigned long') leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe]
478 | if (mtu && time_before(jiffies, rt->dst.expires))
| ^
include/linux/jiffies.h:138:26: note: expanded from macro 'time_before'
138 | #define time_before(a,b) time_after(b,a)
| ^
include/linux/jiffies.h:128:3: note: expanded from macro 'time_after'
128 | (typecheck(unsigned long, a) && \
| ^
include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
11 | typeof(x) __dummy2; \
| ^ include/linux/list.h:409:27: warning: default initialization of an object of type 'union (unnamed union at include/linux/list.h:409:27)' with const member leaves the object uninitialized [-Wdefault-const-init-field-unsafe]
409 | struct list_head *next = smp_load_acquire(&head->next);
| ^
include/asm-generic/barrier.h:176:29: note: expanded from macro 'smp_load_acquire'
176 | #define smp_load_acquire(p) __smp_load_acquire(p)
| ^
arch/arm64/include/asm/barrier.h:164:59: note: expanded from macro '__smp_load_acquire'
164 | union { __unqual_scalar_typeof(*p) __val; char __c[1]; } __u; \
| ^ include/linux/list.h:409:27: note: member '__val' declared 'const' here
crypto/scatterwalk.c:66:22: error: default initialization of an object of type 'struct scatter_walk' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
66 | struct scatter_walk walk;
| ^
include/crypto/algapi.h:112:15: note: member 'addr' declared 'const' here
112 | void *const addr;
| ^ fs/hugetlbfs/inode.c:733:24: error: default initialization of an object of type 'struct vm_area_struct' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
733 | struct vm_area_struct pseudo_vma;
| ^
include/linux/mm_types.h:803:20: note: member 'vm_flags' declared 'const' here
803 | const vm_flags_t vm_flags;
| ^Silencing the instances from typecheck.h is difficult because '= {}' is not available in older but supported compilers and '= {0}' would cause warnings about a literal 0 being treated as NULL. While it might be possible to come up with a local hack to silence the warning for clang-21+, it may not be worth it since -Wuninitialized will still trigger if an uninitialized const variable is actually used.
In all audited cases of the "field" variant of the warning, the members are either not used in the particular call path, modified through other means such as memset() / memcpy() because the containing object is not const, or are within a union with other non-const members.
Since this warning does not appear to have a high signal to noise ratio, just disable it.
--- scripts/Makefile.extrawarn | 12 ++++++++++++ 1 file changed, 12 insertions(+)
scripts/Makefile.extrawarn +12 -0
@@ -36,6 +36,18 @@ KBUILD_CFLAGS += -Wno-gnu # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219 KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf) KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf) + +# Clang may emit a warning when a const variable, such as the dummy variables +# in typecheck(), or const member of an aggregate type are not initialized, +# which can result in unexpected behavior. However, in many audited cases of +# the "field" variant of the warning, this is intentional because the field is +# never used within a particular call path, the field is within a union with +# other non-const members, or the containing object is not const so the field +# can be modified via memcpy() / memset(). While the variable warning also gets +# disabled with this same switch, there should not be too much coverage lost +# because -Wuninitialized will still flag when an uninitialized const variable +# is used. +KBUILD_CFLAGS += $(call cc-disable-warning, default-const-init-unsafe) else # gcc inanely warns about local variables called 'main'
Greg Kroah-Hartman
maintainerPATCH 103/143 ftrace: Fix preemption accounting for stacktrace trigger command
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: pengdonglin <[email protected]>
commit e333332657f615ac2b55aa35565c4a882018bbe9 upstream.
When using the stacktrace trigger command to trace syscalls, the preemption count was consistently reported as 1 when the system call event itself had 0 (".").
For example:
root@ubuntu22-vm:/sys/kernel/tracing/events/syscalls/sys_enter_read
$ echo stacktrace > trigger $ echo 1 > enable
sshd-416 [002] ..... 232.864910: sys_read(fd: a, buf: 556b1f3221d0, count: 8000)
sshd-416 [002] ...1. 232.864913: <stack trace> => ftrace_syscall_enter
=> syscall_trace_enter
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
The root cause is that the trace framework disables preemption in __DO_TRACE before invoking the trigger callback.
Use the tracing_gen_ctx_dec() that will accommodate for the increase of the preemption count in __DO_TRACE when calling the callback. The result is the accurate reporting of:
sshd-410 [004] ..... 210.117660: sys_read(fd: 4, buf: 559b725ba130, count: 40000)
sshd-410 [004] ..... 210.117662: <stack trace> => ftrace_syscall_enter
=> syscall_trace_enter
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
--- kernel/trace/trace_events_trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_events_trigger.c +1 -1
@@ -1581,7 +1581,7 @@ stacktrace_trigger(struct event_trigger_struct trace_event_file *file = data->private_data;if (file) -__trace_stack (file->tr,tracing_gen_ctx (),STACK_SKIP ); +__trace_stack (file->tr,tracing_gen_ctx_dec (),STACK_SKIP );else trace_dump_stack (STACK_SKIP ); }
Greg Kroah-Hartman
maintainerPATCH 104/143 ftrace: Fix preemption accounting for stacktrace filter command
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: pengdonglin <[email protected]>
commit 11aff32439df6ca5b3b891b43032faf88f4a6a29 upstream.
The preemption count of the stacktrace filter command to trace ksys_read is consistently incorrect:
$ echo ksys_read:stacktrace > set_ftrace_filter
<...>-453 [004] ...1. 38.308956: <stack trace>
=> ksys_read
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
The root cause is that the trace framework disables preemption when invoking the filter command callback in function_trace_probe_call:
preempt_disable_notrace(); probe_ops->func(ip, parent_ip, probe_opsbe->tr, probe_ops, probe->data); preempt_enable_notrace();
Use tracing_gen_ctx_dec() to account for the preempt_disable_notrace(), which will output the correct preemption count:
$ echo ksys_read:stacktrace > set_ftrace_filter
<...>-410 [006] ..... 31.420396: <stack trace>
=> ksys_read
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
--- kernel/trace/trace_functions.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
kernel/trace/trace_functions.c +1 -5
@@ -574,11 +574,7 @@ ftrace_traceoff(unsigned long ip, unsign static __always_inline void trace_stack(struct trace_array *tr) { -unsigned int trace_ctx; - - trace_ctx =tracing_gen_ctx (); - -__trace_stack (tr, trace_ctx,FTRACE_STACK_SKIP ); +__trace_stack (tr,tracing_gen_ctx_dec (),FTRACE_STACK_SKIP ); } static void
Greg Kroah-Hartman
maintainerPATCH 105/143 tracing: samples: Initialize trace_array_printk() with the correct function
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 1b0c192c92ea1fe2dcb178f84adf15fe37c3e7c8 upstream.
When using trace_array_printk() on a created instance, the correct function to use to initialize it is:
trace_array_init_printk()
Not
trace_printk_init_buffer()
The former is a proper function to use, the latter is for initializing trace_printk() and causes the NOTICE banner to be displayed.
--- samples/ftrace/sample-trace-array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/ftrace/sample-trace-array.c +1 -1
@@ -112,7 +112,7 @@ static int __init sample_trace_array_ini/* * If context specific per-cpu buffers havent already been allocated. */ -trace_printk_init_buffers (); +trace_array_init_printk (tr); simple_tsk =kthread_run (simple_thread,NULL ,"sample-instance" );if (IS_ERR (simple_tsk)) {
Greg Kroah-Hartman
maintainerPATCH 106/143 phy: tegra: xusb: Use a bitmask for UTMI pad power state tracking
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wayne Chang <[email protected]>
commit b47158fb42959c417ff2662075c0d46fb783d5d1 upstream.
The current implementation uses bias_pad_enable as a reference count to manage the shared bias pad for all UTMI PHYs. However, during system suspension with connected USB devices, multiple power-down requests for the UTMI pad result in a mismatch in the reference count, which in turn produces warnings such as:
[ 237.762967] WARNING: CPU: 10 PID: 1618 at tegra186_utmi_pad_power_down+0x160/0x170 [ 237.763103] Call trace: [ 237.763104] tegra186_utmi_pad_power_down+0x160/0x170 [ 237.763107] tegra186_utmi_phy_power_off+0x10/0x30 [ 237.763110] phy_power_off+0x48/0x100 [ 237.763113] tegra_xusb_enter_elpg+0x204/0x500 [ 237.763119] tegra_xusb_suspend+0x48/0x140 [ 237.763122] platform_pm_suspend+0x2c/0xb0 [ 237.763125] dpm_run_callback.isra.0+0x20/0xa0 [ 237.763127] __device_suspend+0x118/0x330 [ 237.763129] dpm_suspend+0x10c/0x1f0 [ 237.763130] dpm_suspend_start+0x88/0xb0 [ 237.763132] suspend_devices_and_enter+0x120/0x500 [ 237.763135] pm_suspend+0x1ec/0x270
The root cause was traced back to the dynamic power-down changes introduced in commit a30951d31b25 ("xhci: tegra: USB2 pad power controls"), where the UTMI pad was being powered down without verifying its current state. This unbalanced behavior led to discrepancies in the reference count.
To rectify this issue, this patch replaces the single reference counter with a bitmask, renamed to utmi_pad_enabled. Each bit in the mask corresponds to one of the four USB2 PHYs, allowing us to track each pad's enablement status individually.
With this change:
- The bias pad is powered on only when the mask is clear.
- Each UTMI pad is powered on or down based on its corresponding bit in the mask, preventing redundant operations.
- The overall power state of the shared bias pad is maintained correctly during suspend/resume cycles.
The mutex used to prevent race conditions during UTMI pad enable/disable operations has been moved from the tegra186_utmi_bias_pad_power_on/off functions to the parent functions tegra186_utmi_pad_power_on/down. This change ensures that there are no race conditions when updating the bitmask.
--- drivers/phy/tegra/xusb-tegra186.c | 44 +++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 17 deletions(-)
drivers/phy/tegra/xusb-tegra186.c +27 -17
@@ -237,6 +237,8 @@#define DATA0_VAL_PD BIT(1)#define USE_XUSB_AO BIT(4) +#define TEGRA_UTMI_PAD_MAX 4 +#define TEGRA186_LANE (_name, _offset, _shift, _mask, _type) \ { \ .name = _name, \
@@ -269,7 +271,7 @@ struct tegra186_xusb_padctl {/* UTMI bias and tracking */ struct clk *usb2_trk_clk; -unsigned int bias_pad_enable; +DECLARE_BITMAP (utmi_pad_enabled,TEGRA_UTMI_PAD_MAX );/* padctl context */ struct tegra186_xusb_padctl_context context;
@@ -603,12 +605,8 @@ static void tegra186_utmi_bias_pad_poweru32 value;int err; -mutex_lock (&padctl->lock); - -if (priv->bias_pad_enable++ >0 ) { -mutex_unlock (&padctl->lock); +if (!bitmap_empty (priv->utmi_pad_enabled,TEGRA_UTMI_PAD_MAX ))return ; - } err =clk_prepare_enable (priv->usb2_trk_clk);if (err <0 )
@@ -667,17 +665,8 @@ static void tegra186_utmi_bias_pad_powerstruct tegra186_xusb_padctl *priv =to_tegra186_xusb_padctl (padctl);u32 value; -mutex_lock (&padctl->lock); - -if (WARN_ON (priv->bias_pad_enable ==0 )) { -mutex_unlock (&padctl->lock); -return ; - } - -if (--priv->bias_pad_enable >0 ) { -mutex_unlock (&padctl->lock); +if (!bitmap_empty (priv->utmi_pad_enabled,TEGRA_UTMI_PAD_MAX ))return ; - } value =padctl_readl (padctl,XUSB_PADCTL_USB2_BIAS_PAD_CTL1 ); value |=USB2_PD_TRK ;
@@ -690,13 +679,13 @@ static void tegra186_utmi_bias_pad_powerclk_disable_unprepare (priv->usb2_trk_clk); } -mutex_unlock (&padctl->lock); }static void tegra186_utmi_pad_power_on (struct phy *phy) {struct tegra_xusb_lane *lane =phy_get_drvdata (phy);struct tegra_xusb_padctl *padctl = lane->pad->padctl; +struct tegra186_xusb_padctl *priv =to_tegra186_xusb_padctl (padctl);struct tegra_xusb_usb2_port *port;struct device *dev = padctl->dev;unsigned int index = lane->index;
@@ -705,9 +694,16 @@ static void tegra186_utmi_pad_power_on(sif (!phy)return ; +mutex_lock (&padctl->lock); +if (test_bit (index, priv->utmi_pad_enabled)) { +mutex_unlock (&padctl->lock); +return ; + } + port =tegra_xusb_find_usb2_port (padctl, index);if (!port) {dev_err (dev,"no port found for USB2 lane %u\n" , index); +mutex_unlock (&padctl->lock);return ; }
@@ -724,18 +720,28 @@ static void tegra186_utmi_pad_power_on(s value =padctl_readl (padctl,XUSB_PADCTL_USB2_OTG_PADX_CTL1 (index)); value &= ~USB2_OTG_PD_DR ;padctl_writel (padctl, value,XUSB_PADCTL_USB2_OTG_PADX_CTL1 (index)); + +set_bit (index, priv->utmi_pad_enabled); +mutex_unlock (&padctl->lock); }static void tegra186_utmi_pad_power_down (struct phy *phy) {struct tegra_xusb_lane *lane =phy_get_drvdata (phy);struct tegra_xusb_padctl *padctl = lane->pad->padctl; +struct tegra186_xusb_padctl *priv =to_tegra186_xusb_padctl (padctl);unsigned int index = lane->index;u32 value;if (!phy)return ; +mutex_lock (&padctl->lock); +if (!test_bit (index, priv->utmi_pad_enabled)) { +mutex_unlock (&padctl->lock); +return ; + } +dev_dbg (padctl->dev,"power down UTMI pad %u\n" , index); value =padctl_readl (padctl,XUSB_PADCTL_USB2_OTG_PADX_CTL0 (index));
@@ -748,7 +754,11 @@ static void tegra186_utmi_pad_power_downudelay (2 ); +clear_bit (index, priv->utmi_pad_enabled); +tegra186_utmi_bias_pad_power_off (padctl); + +mutex_unlock (&padctl->lock); } static int tegra186_xusb_padctl_vbus_override(struct tegra_xusb_padctl *padctl,
Greg Kroah-Hartman
maintainerPATCH 107/143 phy: Fix error handling in tegra_xusb_port_init
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit b2ea5f49580c0762d17d80d8083cb89bc3acf74f upstream.
If device_add() fails, do not use device_unregister() for error handling. device_unregister() consists two functions: device_del() and put_device(). device_unregister() should only be called after device_add() succeeded because device_del() undoes what device_add() does if successful. Change device_unregister() to put_device() call before returning from the function.
As comment of device_add() says, 'if device_add() succeeds, you should call device_del() when you want to get rid of it. If device_add() has not succeeded, use only put_device() to drop the reference count'.
Found by code review.
--- drivers/phy/tegra/xusb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/tegra/xusb.c +4 -4
@@ -548,16 +548,16 @@ static int tegra_xusb_port_init(struct t err =dev_set_name (&port->dev,"%s-%u" , name, index);if (err <0 ) - goto unregister; + goto put_device; err =device_add (&port->dev);if (err <0 ) - goto unregister; + goto put_device;return 0 ; -unregister: -device_unregister (&port->dev); +put_device: +put_device (&port->dev);return err; }
Greg Kroah-Hartman
maintainerPATCH 108/143 phy: renesas: rcar-gen3-usb2: Fix role detection on unbind/bind
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 54c4c58713aaff76c2422ff5750e557ab3b100d7 upstream.
It has been observed on the Renesas RZ/G3S SoC that unbinding and binding the PHY driver leads to role autodetection failures. This issue occurs when PHY 3 is the first initialized PHY. PHY 3 does not have an interrupt associated with the USB2_INT_ENABLE register (as rcar_gen3_int_enable[3] = 0). As a result, rcar_gen3_init_otg() is called to initialize OTG without enabling PHY interrupts.
To resolve this, add rcar_gen3_is_any_otg_rphy_initialized() and call it in role_store(), role_show(), and rcar_gen3_init_otg(). At the same time, rcar_gen3_init_otg() is only called when initialization for a PHY with interrupt bits is in progress. As a result, the
struct rcar_gen3_phy::otg_initialized is no longer needed.
--- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 33 +++++++++++++------------------ 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/phy/renesas/phy-rcar-gen3-usb2.c +14 -19
@@ -107,7 +107,6 @@ struct rcar_gen3_phy {struct rcar_gen3_chan *ch;u32 int_enable_bits;bool initialized; -bool otg_initialized;bool powered; };
@@ -320,16 +319,15 @@ static bool rcar_gen3_is_any_rphy_initiareturn false; } -static bool rcar_gen3_needs_init_otg (struct rcar_gen3_chan *ch) +static bool rcar_gen3_is_any_otg_rphy_initialized (struct rcar_gen3_chan *ch) { -int i; - -for (i =0 ; i <NUM_OF_PHYS ; i++) { -if (ch->rphys[i].otg_initialized) -return false; +for (enum rcar_gen3_phy_index i =PHY_INDEX_BOTH_HC ; i <=PHY_INDEX_EHCI ; + i++) { +if (ch->rphys[i].initialized) +return true; } -return true; +return false; }static bool rcar_gen3_are_all_rphys_power_off (struct rcar_gen3_chan *ch)
@@ -351,7 +349,7 @@ static ssize_t role_store(struct devicebool is_b_device;enum phy_mode cur_mode, new_mode; -if (!ch->is_otg_channel || !rcar_gen3_is_any_rphy_initialized (ch)) +if (!ch->is_otg_channel || !rcar_gen3_is_any_otg_rphy_initialized (ch))return -EIO ;if (sysfs_streq (buf,"host" ))
@@ -389,7 +387,7 @@ static ssize_t role_show(struct device * {struct rcar_gen3_chan *ch =dev_get_drvdata (dev); -if (!ch->is_otg_channel || !rcar_gen3_is_any_rphy_initialized (ch)) +if (!ch->is_otg_channel || !rcar_gen3_is_any_otg_rphy_initialized (ch))return -EIO ; return sprintf(buf, "%s\n", rcar_gen3_is_host(ch) ? "host" :
@@ -402,6 +400,9 @@ static void rcar_gen3_init_otg(struct rcvoid __iomem *usb2_base = ch->base;u32 val; +if (!ch->is_otg_channel ||rcar_gen3_is_any_otg_rphy_initialized (ch)) +return ; +/* Should not use functions of read-modify-write a register */ val =readl (usb2_base +USB2_LINECTRL1 ); val = (val & ~USB2_LINECTRL1_DP_RPD) | USB2_LINECTRL1_DPRPD_EN |
@@ -465,12 +466,9 @@ static int rcar_gen3_phy_usb2_init(strucwritel (USB2_SPD_RSM_TIMSET_INIT , usb2_base +USB2_SPD_RSM_TIMSET );writel (USB2_OC_TIMSET_INIT , usb2_base +USB2_OC_TIMSET ); -/* Initialize otg part */ -if (channel->is_otg_channel) { -if (rcar_gen3_needs_init_otg (channel)) -rcar_gen3_init_otg (channel); - rphy->otg_initialized = true; - } +/* Initialize otg part (only if we initialize a PHY with IRQs). */ +if (rphy->int_enable_bits) +rcar_gen3_init_otg (channel); rphy->initialized = true;
@@ -486,9 +484,6 @@ static int rcar_gen3_phy_usb2_exit(struc rphy->initialized = false; -if (channel->is_otg_channel) - rphy->otg_initialized = false; - val =readl (usb2_base +USB2_INT_ENABLE ); val &= ~rphy->int_enable_bits;if (!rcar_gen3_is_any_rphy_initialized (channel))
Greg Kroah-Hartman
maintainerPATCH 109/143 phy: renesas: rcar-gen3-usb2: Set timing registers only once
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 86e70849f4b2b4597ac9f7c7931f2a363774be25 upstream.
phy-rcar-gen3-usb2 driver exports 4 PHYs. The timing registers are common to all PHYs. There is no need to set them every time a PHY is initialized. Set timing register only when the 1st PHY is initialized.
--- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/phy/renesas/phy-rcar-gen3-usb2.c +5 -2
@@ -463,8 +463,11 @@ static int rcar_gen3_phy_usb2_init(struc val =readl (usb2_base +USB2_INT_ENABLE ); val |=USB2_INT_ENABLE_UCOM_INTEN | rphy->int_enable_bits;writel (val, usb2_base +USB2_INT_ENABLE ); -writel (USB2_SPD_RSM_TIMSET_INIT , usb2_base +USB2_SPD_RSM_TIMSET ); -writel (USB2_OC_TIMSET_INIT , usb2_base +USB2_OC_TIMSET ); + +if (!rcar_gen3_is_any_rphy_initialized (channel)) { +writel (USB2_SPD_RSM_TIMSET_INIT , usb2_base +USB2_SPD_RSM_TIMSET ); +writel (USB2_OC_TIMSET_INIT , usb2_base +USB2_OC_TIMSET ); + }/* Initialize otg part (only if we initialize a PHY with IRQs). */ if (rphy->int_enable_bits)
Greg Kroah-Hartman
maintainerPATCH 110/143 scsi: sd_zbc: block: Respect bio vector limits for REPORT ZONES buffer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Siwinski <[email protected]>
commit e8007fad5457ea547ca63bb011fdb03213571c7e upstream.
The REPORT ZONES buffer size is currently limited by the HBA's maximum segment count to ensure the buffer can be mapped. However, the block layer further limits the number of iovec entries to 1024 when allocating a bio.
To avoid allocation of buffers too large to be mapped, further restrict the maximum buffer size to BIO_MAX_INLINE_VECS.
Replace the UIO_MAXIOV symbolic name with the more contextually appropriate BIO_MAX_INLINE_VECS.
--- block/bio.c | 2 +- drivers/scsi/sd_zbc.c | 6 +++++- include/linux/bio.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-)
block/bio.c +1 -1
@@ -611,7 +611,7 @@ struct bio *bio_kmalloc(unsigned short n {struct bio *bio; -if (nr_vecs >UIO_MAXIOV ) +if (nr_vecs >BIO_MAX_INLINE_VECS )return NULL ;return kmalloc (struct_size (bio, bi_inline_vecs, nr_vecs), gfp_mask); }
drivers/scsi/sd_zbc.c +5 -1
@@ -169,6 +169,7 @@ static void *sd_zbc_alloc_report_buffer( unsigned int nr_zones, size_t *buflen) { struct request_queue *q = sdkp->disk->queue; +unsigned int max_segments;size_t bufsize;void *buf;
@@ -180,12 +181,15 @@ static void *sd_zbc_alloc_report_buffer(* Furthermore, since the report zone command cannot be split, make * sure that the allocated buffer can always be mapped by limiting the * number of pages allocated to the HBA max segments limit. +* Since max segments can be larger than the max inline bio vectors, +* further limit the allocated buffer to BIO_MAX_INLINE_VECS. */ nr_zones =min (nr_zones, sdkp->zone_info.nr_zones); bufsize =roundup ((nr_zones +1 ) *64 ,SECTOR_SIZE ); bufsize =min_t (size_t, bufsize,queue_max_hw_sectors (q) <<SECTOR_SHIFT ); - bufsize =min_t (size_t, bufsize,queue_max_segments (q) <<PAGE_SHIFT ); + max_segments =min (BIO_MAX_INLINE_VECS ,queue_max_segments (q)); + bufsize =min_t (size_t, bufsize, max_segments <<PAGE_SHIFT );while (bufsize >=SECTOR_SIZE ) { buf =kvzalloc (bufsize,GFP_KERNEL | __GFP_NORETRY);
include/linux/bio.h +1 -0
@@ -11,6 +11,7 @@#include <linux/uio.h> #define BIO_MAX_VECS 256U +#define BIO_MAX_INLINE_VECS UIO_MAXIOVstruct queue_limits ;
Greg Kroah-Hartman
maintainerPATCH 111/143 smb: client: fix memory leak during error handling for POSIX mkdir
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jethro Donaldson <[email protected]>
commit 1fe4a44b7fa3955bcb7b4067c07b778fe90d8ee7 upstream.
The response buffer for the CREATE request handled by smb311_posix_mkdir() is leaked on the error path (goto err_free_rsp_buf) because the structure pointer *rsp passed to free_rsp_buf() is not assigned until *after* the error condition is checked.
As *rsp is initialised to NULL, free_rsp_buf() becomes a no-op and the leak is instead reported by __kmem_cache_shutdown() upon subsequent rmmod of cifs.ko if (and only if) the error path has been hit.
Pass rsp_iov.iov_base to free_rsp_buf() instead, similar to the code in other functions in smb2pdu.c for which *rsp is assigned late.
--- fs/smb/client/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/smb2pdu.c +1 -1
@@ -2985,7 +2985,7 @@ replay_again:/* Eventually save off posix specific response info and timestamps */ err_free_rsp_buf: -free_rsp_buf (resp_buftype, rsp); +free_rsp_buf (resp_buftype, rsp_iov.iov_base);kfree (pc_buf); err_free_req:cifs_small_buf_release (req);
Greg Kroah-Hartman
maintainerPATCH 112/143 spi: tegra114: Use value to check for invalid delays
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Kling <[email protected]>
commit e979a7c79fbc706f6dac913af379ef4caa04d3d5 upstream.
A delay unit of 0 is a valid entry, thus it is not valid to check for unused delays. Instead, check the value field; if that is zero, the given delay is unset.
--- drivers/spi/spi-tegra114.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-tegra114.c +3 -3
@@ -728,9 +728,9 @@ static int tegra_spi_set_hw_cs_timing(stu32 inactive_cycles;u8 cs_state; -if ((setup->unit && setup->unit !=SPI_DELAY_UNIT_SCK ) || - (hold->unit && hold->unit !=SPI_DELAY_UNIT_SCK ) || - (inactive->unit && inactive->unit !=SPI_DELAY_UNIT_SCK )) { +if ((setup->value && setup->unit !=SPI_DELAY_UNIT_SCK ) || + (hold->value && hold->unit !=SPI_DELAY_UNIT_SCK ) || + (inactive->value && inactive->unit !=SPI_DELAY_UNIT_SCK )) {dev_err (&spi->dev,"Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n" ,SPI_DELAY_UNIT_SCK );
Greg Kroah-Hartman
maintainerPATCH 113/143 tpm: Mask TPM RC in tpm2_start_auth_session()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit 539fbab37881e32ba6a708a100de6db19e1e7e7d upstream.
tpm2_start_auth_session() does not mask TPM RC correctly from the callers:
[ 28.766528] tpm tpm0: A TPM error (2307) occurred start auth session
Process TPM RCs inside tpm2_start_auth_session(), and map them to POSIX error codes.
--- drivers/char/tpm/tpm2-sessions.c | 20 ++++++-------------- include/linux/tpm.h | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-)
drivers/char/tpm/tpm2-sessions.c +6 -14
@@ -40,11 +40,6 @@* * These are the usage functions: * -* tpm2_start_auth_session() which allocates the opaque auth structure -* and gets a session from the TPM. This must be called before -* any of the following functions. The session is protected by a -* session_key which is derived from a random salt value -* encrypted to the NULL seed. * tpm2_end_auth_session() kills the session and frees the resources. * Under normal operation this function is done by * tpm_buf_check_hmac_response(), so this is only to be used on
@@ -963,16 +958,13 @@ static int tpm2_load_null(struct tpm_chip *chip, u32 *null_key) }/** -* tpm2_start_auth_session() - create a HMAC authentication session with the TPM -* @chip: the TPM chip structure to create the session with +* tpm2_start_auth_session() - Create an a HMAC authentication session +* @chip: A TPM chip * -* This function loads the NULL seed from its saved context and starts -* an authentication session on the null seed, fills in the -* @chip->auth structure to contain all the session details necessary -* for performing the HMAC, encrypt and decrypt operations and -* returns. The NULL seed is flushed before this function returns. +* Loads the ephemeral key (null seed), and starts an HMAC authenticated +* session. The null seed is flushed before the return. * -* Return: zero on success or actual error encountered. +* Returns zero on success, or a POSIX error code. */ int tpm2_start_auth_session (struct tpm_chip *chip) {
@@ -1024,7 +1016,7 @@ int tpm2_start_auth_session(struct tpm_chip *chip)/* hash algorithm for session */ tpm_buf_append_u16 (&buf,TPM_ALG_SHA256 ); - rc =tpm_transmit_cmd (chip, &buf,0 ,"start auth session" ); + rc =tpm_ret_to_err (tpm_transmit_cmd (chip, &buf,0 ,"StartAuthSession" ));tpm2_flush_context (chip, null_key);if (rc ==TPM2_RC_SUCCESS )
include/linux/tpm.h +19 -0
@@ -257,6 +257,7 @@ enum tpm2_return_codes {TPM2_RC_TESTING =0x090A ,/* RC_WARN */ TPM2_RC_REFERENCE_H0 =0x0910 ,TPM2_RC_RETRY =0x0922 , + TPM2_RC_SESSION_MEMORY = 0x0903, }; enum tpm2_command_codes {
@@ -437,6 +438,24 @@ static inline u32 tpm2_rc_value(u32 rc)return (rc &BIT (7 )) ? rc &0xbf : rc; } +/* +* Convert a return value from tpm_transmit_cmd() to POSIX error code. +*/ +static inline ssize_t tpm_ret_to_err (ssize_t ret) +{ +if (ret <0 ) +return ret; + +switch (tpm2_rc_value (ret)) { +case TPM2_RC_SUCCESS : +return 0 ; +case TPM2_RC_SESSION_MEMORY : +return -ENOMEM ; +default : +return -EFAULT ; + } +} +#if defined(CONFIG_TCG_TPM ) || defined(CONFIG_TCG_TPM_MODULE )extern int tpm_is_tpm2 (struct tpm_chip *chip);
Signature · 1 line
2.49.0
Greg Kroah-Hartman
maintainerPATCH 114/143 wifi: mt76: disable napi on driver removal
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 78ab4be549533432d97ea8989d2f00b508fa68d8 upstream.
A warning on driver removal started occurring after commit 9dd05df8403b ("net: warn if NAPI instance wasn't shut down"). Disable tx napi before deleting it in mt76_dma_cleanup().
WARNING: CPU: 4 PID: 18828 at net/core/dev.c:7288 __netif_napi_del_locked+0xf0/0x100 CPU: 4 UID: 0 PID: 18828 Comm: modprobe Not tainted 6.15.0-rc4 #4 PREEMPT(lazy) Hardware name: ASUS System Product Name/PRIME X670E-PRO WIFI, BIOS 3035 09/05/2024 RIP: 0010:__netif_napi_del_locked+0xf0/0x100 Call Trace: <TASK> mt76_dma_cleanup+0x54/0x2f0 [mt76] mt7921_pci_remove+0xd5/0x190 [mt7921e] pci_device_remove+0x47/0xc0 device_release_driver_internal+0x19e/0x200 driver_detach+0x48/0x90 bus_remove_driver+0x6d/0xf0 pci_unregister_driver+0x2e/0xb0 __do_sys_delete_module.isra.0+0x197/0x2e0 do_syscall_64+0x7b/0x160 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Tested with mt7921e but the same pattern can be actually applied to other mt76 drivers calling mt76_dma_cleanup() during removal. Tx napi is enabled in their *_dma_init() functions and only toggled off and on again inside their suspend/resume/reset paths. So it should be okay to disable tx napi in such a generic way.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/mediatek/mt76/dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/dma.c +1 -0
@@ -999,6 +999,7 @@ void mt76_dma_cleanup(struct mt76_dev *dint i;mt76_worker_disable (&dev->tx_worker); +napi_disable (&dev->tx_napi);netif_napi_del (&dev->tx_napi);for (i =0 ; i <ARRAY_SIZE (dev->phys); i++) {
Greg Kroah-Hartman
maintainerPATCH 115/143 ring-buffer: Fix persistent buffer when commit page is the reader page
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 1d6c39c89f617c9fec6bbae166e25b16a014f7c8 upstream.
The ring buffer is made up of sub buffers (sometimes called pages as they are by default PAGE_SIZE). It has the following "pages":
"tail page" - this is the page that the next write will write to "head page" - this is the page that the reader will swap the reader page with. "reader page" - This belongs to the reader, where it will swap the head
page from the ring buffer so that the reader does not race with the writer.
The writer may end up on the "reader page" if the ring buffer hasn't written more than one page, where the "tail page" and the "head page" are the same.
The persistent ring buffer has meta data that points to where these pages exist so on reboot it can re-create the pointers to the cpu_buffer descriptor. But when the commit page is on the reader page, the logic is incorrect.
The check to see if the commit page is on the reader page checked if the head page was the reader page, which would never happen, as the head page is always in the ring buffer. The correct check would be to test if the commit page is on the reader page. If that's the case, then it can exit out early as the commit page is only on the reader page when there's only one page of data in the buffer. There's no reason to iterate the ring buffer pages to find the "commit page" as it is already found.
To trigger this bug:
# echo 1 > /sys/kernel/tracing/instances/boot_mapped/events/syscalls/sys_enter_fchownat/enable # touch /tmp/x # chown sshd /tmp/x # reboot
On boot up, the dmesg will have:
Ring buffer meta [0] is from previous boot!
Ring buffer meta [1] is from previous boot!
Ring buffer meta [2] is from previous boot!
Ring buffer meta [3] is from previous boot!
Ring buffer meta [4] commit page not found
Ring buffer meta [5] is from previous boot!
Ring buffer meta [6] is from previous boot!
Ring buffer meta [7] is from previous boot!
Where the buffer on CPU 4 had a "commit page not found" error and that buffer is cleared and reset causing the output to be empty and the data lost.
When it works correctly, it has:
# cat /sys/kernel/tracing/instances/boot_mapped/trace_pipe
<...>-1137 [004] ..... 998.205323: sys_enter_fchownat: __syscall_nr=0x104 (260) dfd=0xffffff9c (4294967196) filename=(0xffffc90000a0002c) user=0x3e8 (1000) group=0xffffffff (4294967295) flag=0x0 (0--- kernel/trace/ring_buffer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/trace/ring_buffer.c +5 -3
@@ -1832,10 +1832,12 @@ static void rb_meta_validate_events(stru head_page = cpu_buffer->head_page; -/* If both the head and commit are on the reader_page then we are done. */ -if (head_page == cpu_buffer->reader_page && - head_page == cpu_buffer->commit_page) +/* If the commit_buffer is the reader page, update the commit page */ +if (meta->commit_buffer == (unsigned long )cpu_buffer->reader_page->page) { + cpu_buffer->commit_page = cpu_buffer->reader_page; +/* Nothing more to do, the only page is the reader page */ goto done; + }/* Iterate until finding the commit page */ for (i =0 ; i < meta->nr_subbufs +1 ; i++,rb_inc_page (&head_page)) {
Greg Kroah-Hartman
maintainerPATCH 116/143 net: qede: Initialize qede_ll_ops with designated initializer
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 6b3ab7f2cbfaeb6580709cd8ef4d72cfd01bfde4 upstream.
After a recent change [1] in clang's randstruct implementation to randomize structures that only contain function pointers, there is an error because qede_ll_ops get randomized but does not use a designated initializer for the first member:
drivers/net/ethernet/qlogic/qede/qede_main.c:206:2: error: a randomized struct can only be initialized with a designated initializer
206 | {
| ^Explicitly initialize the common member using a designated initializer to fix the build.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +1 -1
@@ -203,7 +203,7 @@ static struct pci_driver qede_pci_driver };static struct qed_eth_cb_ops qede_ll_ops = { - { + .common = { #ifdef CONFIG_RFS_ACCEL .arfs_filter_op = qede_arfs_filter_op, #endif
Greg Kroah-Hartman
maintainerPATCH 117/143 mm: userfaultfd: correct dirty flags set for both present and swap pte
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barry Song <[email protected]>
commit 75cb1cca2c880179a11c7dd9380b6f14e41a06a4 upstream.
As David pointed out, what truly matters for mremap and userfaultfd move operations is the soft dirty bit. The current comment and implementation—which always sets the dirty bit for present PTEs and fails to set the soft dirty bit for swap PTEs—are incorrect. This could break features like Checkpoint-Restore in Userspace (CRIU).
This patch updates the behavior to correctly set the soft dirty bit for both present and swap PTEs in accordance with mremap.
--- mm/userfaultfd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
mm/userfaultfd.c +10 -2
@@ -1059,8 +1059,13 @@ static int move_present_pte(struct mm_st src_folio->index =linear_page_index (dst_vma, dst_addr); orig_dst_pte =mk_pte (&src_folio->page, dst_vma->vm_page_prot); -/* Follow mremap() behavior and treat the entry dirty after the move */ - orig_dst_pte =pte_mkwrite (pte_mkdirty (orig_dst_pte), dst_vma); +/* Set soft dirty bit so userspace can notice the pte was moved */ +#ifdef CONFIG_MEM_SOFT_DIRTY + orig_dst_pte =pte_mksoft_dirty (orig_dst_pte); +#endif +if (pte_dirty (orig_src_pte)) + orig_dst_pte =pte_mkdirty (orig_dst_pte); + orig_dst_pte =pte_mkwrite (orig_dst_pte, dst_vma);set_pte_at (mm, dst_addr, dst_pte, orig_dst_pte); out:
@@ -1094,6 +1099,9 @@ static int move_swap_pte(struct mm_struc } orig_src_pte =ptep_get_and_clear (mm, src_addr, src_pte); +#ifdef CONFIG_MEM_SOFT_DIRTY + orig_src_pte =pte_swp_mksoft_dirty (orig_src_pte); +#endif set_pte_at (mm, dst_addr, dst_pte, orig_src_pte);double_pt_unlock (dst_ptl, src_ptl);
Greg Kroah-Hartman
maintainerPATCH 118/143 dmaengine: ti: k3-udma: Add missing locking
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronald Wahl <[email protected]>
commit fca280992af8c2fbd511bc43f65abb4a17363f2f upstream.
Recent kernels complain about a missing lock in k3-udma.c when the lock validator is enabled:
[ 4.128073] WARNING: CPU: 0 PID: 746 at drivers/dma/ti/../virt-dma.h:169 udma_start.isra.0+0x34/0x238 [ 4.137352] CPU: 0 UID: 0 PID: 746 Comm: kworker/0:3 Not tainted 6.12.9-arm64 #28 [ 4.144867] Hardware name: pp-v12 (DT) [ 4.148648] Workqueue: events udma_check_tx_completion [ 4.153841] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 4.160834] pc : udma_start.isra.0+0x34/0x238 [ 4.165227] lr : udma_start.isra.0+0x30/0x238 [ 4.169618] sp : ffffffc083cabcf0 [ 4.172963] x29: ffffffc083cabcf0 x28: 0000000000000000 x27: ffffff800001b005 [ 4.180167] x26: ffffffc0812f0000 x25: 0000000000000000 x24: 0000000000000000 [ 4.187370] x23: 0000000000000001 x22: 00000000e21eabe9 x21: ffffff8000fa0670 [ 4.194571] x20: ffffff8001b6bf00 x19: ffffff8000fa0430 x18: ffffffc083b95030 [ 4.201773] x17: 0000000000000000 x16: 00000000f0000000 x15: 0000000000000048 [ 4.208976] x14: 0000000000000048 x13: 0000000000000000 x12: 0000000000000001 [ 4.216179] x11: ffffffc08151a240 x10: 0000000000003ea1 x9 : ffffffc08046ab68 [ 4.223381] x8 : ffffffc083cabac0 x7 : ffffffc081df3718 x6 : 0000000000029fc8 [ 4.230583] x5 : ffffffc0817ee6d8 x4 : 0000000000000bc0 x3 : 0000000000000000 [ 4.237784] x2 : 0000000000000000 x1 : 00000000001fffff x0 : 0000000000000000 [ 4.244986] Call trace: [ 4.247463] udma_start.isra.0+0x34/0x238 [ 4.251509] udma_check_tx_completion+0xd0/0xdc [ 4.256076] process_one_work+0x244/0x3fc [ 4.260129] process_scheduled_works+0x6c/0x74 [ 4.264610] worker_thread+0x150/0x1dc [ 4.268398] kthread+0xd8/0xe8 [ 4.271492] ret_from_fork+0x10/0x20 [ 4.275107] irq event stamp: 220 [ 4.278363] hardirqs last enabled at (219): [<ffffffc080a27c7c>] _raw_spin_unlock_irq+0x38/0x50 [ 4.287183] hardirqs last disabled at (220): [<ffffffc080a1c154>] el1_dbg+0x24/0x50 [ 4.294879] softirqs last enabled at (182): [<ffffffc080037e68>] handle_softirqs+0x1c0/0x3cc [ 4.303437] softirqs last disabled at (177): [<ffffffc080010170>] __do_softirq+0x1c/0x28 [ 4.311559] ---[ end trace 0000000000000000 ]---
This commit adds the missing locking.
--- drivers/dma/ti/k3-udma.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/dma/ti/k3-udma.c +7 -0
@@ -1091,8 +1091,11 @@ static void udma_check_tx_completion(stru32 residue_diff;ktime_t time_diff;unsigned long delay; +unsigned long flags;while (1 ) { +spin_lock_irqsave (&uc->vc.lock, flags); +if (uc->desc) {/* Get previous residue and time stamp */ residue_diff = uc->tx_drain.residue;
@@ -1127,6 +1130,8 @@ static void udma_check_tx_completion(strbreak ; } +spin_unlock_irqrestore (&uc->vc.lock, flags); +usleep_range (ktime_to_us (delay),ktime_to_us (delay) +10 );continue ;
@@ -1143,6 +1148,8 @@ static void udma_check_tx_completion(strbreak ; } + +spin_unlock_irqrestore (&uc->vc.lock, flags); }static irqreturn_t udma_ring_irq_handler (int irq,void *data)
Greg Kroah-Hartman
maintainerPATCH 119/143 dmaengine: ti: k3-udma: Use cap_mask directly from dma_device structure instead of a local copy
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yemike Abhilash Chandra <[email protected]>
commit 8ca9590c39b69b55a8de63d2b21b0d44f523b43a upstream.
Currently, a local dma_cap_mask_t variable is used to store device cap_mask within udma_of_xlate(). However, the DMA_PRIVATE flag in the device cap_mask can get cleared when the last channel is released. This can happen right after storing the cap_mask locally in udma_of_xlate(), and subsequent dma_request_channel() can fail due to mismatch in the cap_mask. Fix this by removing the local dma_cap_mask_t variable and directly using the one from the dma_device structure.
--- drivers/dma/ti/k3-udma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma/ti/k3-udma.c +1 -2
@@ -4253,7 +4253,6 @@ static struct dma_chan *udma_of_xlate(st struct of_dma *ofdma) {struct udma_dev *ud = ofdma->of_dma_data; -dma_cap_mask_t mask = ud->ddev.cap_mask;struct udma_filter_param filter_param;struct dma_chan *chan;
@@ -4285,7 +4284,7 @@ static struct dma_chan *udma_of_xlate(st } } - chan =__dma_request_channel (&mask, udma_dma_filter_fn, &filter_param, + chan =__dma_request_channel (&ud->ddev.cap_mask, udma_dma_filter_fn, &filter_param, ofdma->of_node);if (!chan) {dev_err (ud->dev,"get channel fail in %s.\n" , __func__);
Greg Kroah-Hartman
maintainerPATCH 120/143 dmaengine: idxd: fix memory leak in error handling path of idxd_setup_wqs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit 3fd2f4bc010cdfbc07dd21018dc65bd9370eb7a4 upstream.
Memory allocated for wqs is not freed if an error occurs during idxd_setup_wqs(). To fix it, free the allocated memory in the reverse order of allocation before exiting the function in case of an error.
--- drivers/dma/idxd/init.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/dma/idxd/init.c +21 -9
@@ -167,8 +167,8 @@ static int idxd_setup_wqs(struct idxd_de idxd->wq_enable_map =bitmap_zalloc_node (idxd->max_wqs,GFP_KERNEL ,dev_to_node (dev));if (!idxd->wq_enable_map) { -kfree (idxd->wqs); -return -ENOMEM ; + rc = -ENOMEM ; + goto err_bitmap; }for (i =0 ; i < idxd->max_wqs; i++) {
@@ -187,10 +187,8 @@ static int idxd_setup_wqs(struct idxd_de conf_dev->bus = &dsa_bus_type; conf_dev->type = &idxd_wq_device_type; rc =dev_set_name (conf_dev,"wq%d.%d" , idxd->id, wq->id); -if (rc <0 ) { -put_device (conf_dev); +if (rc <0 ) goto err; - }mutex_init (&wq->wq_lock);init_waitqueue_head (&wq->err_queue);
@@ -201,7 +199,6 @@ static int idxd_setup_wqs(struct idxd_de wq->enqcmds_retries =IDXD_ENQCMDS_RETRIES ; wq->wqcfg =kzalloc_node (idxd->wqcfg_size,GFP_KERNEL ,dev_to_node (dev));if (!wq->wqcfg) { -put_device (conf_dev); rc = -ENOMEM ; goto err; }
@@ -209,9 +206,8 @@ static int idxd_setup_wqs(struct idxd_deif (idxd->hw.wq_cap.op_config) { wq->opcap_bmap =bitmap_zalloc (IDXD_MAX_OPCAP_BITS ,GFP_KERNEL );if (!wq->opcap_bmap) { -put_device (conf_dev); rc = -ENOMEM ; - goto err; + goto err_opcap_bmap; }bitmap_copy (wq->opcap_bmap, idxd->opcap_bmap,IDXD_MAX_OPCAP_BITS ); }
@@ -222,12 +218,28 @@ static int idxd_setup_wqs(struct idxd_dereturn 0 ; - err: +err_opcap_bmap: +kfree (wq->wqcfg); + +err: +put_device (conf_dev); +kfree (wq); +while (--i >=0 ) { wq = idxd->wqs[i]; +if (idxd->hw.wq_cap.op_config) +bitmap_free (wq->opcap_bmap); +kfree (wq->wqcfg); conf_dev =wq_confdev (wq);put_device (conf_dev); +kfree (wq); + } +bitmap_free (idxd->wq_enable_map); + +err_bitmap: +kfree (idxd->wqs); +return rc; }
Greg Kroah-Hartman
maintainerPATCH 121/143 dmaengine: idxd: fix memory leak in error handling path of idxd_setup_engines
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit 817bced19d1dbdd0b473580d026dc0983e30e17b upstream.
Memory allocated for engines is not freed if an error occurs during idxd_setup_engines(). To fix it, free the allocated memory in the reverse order of allocation before exiting the function in case of an error.
--- drivers/dma/idxd/init.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/idxd/init.c +4 -0
@@ -273,6 +273,7 @@ static int idxd_setup_engines(struct idx rc =dev_set_name (conf_dev,"engine%d.%d" , idxd->id, engine->id);if (rc <0 ) {put_device (conf_dev); +kfree (engine); goto err; }
@@ -286,7 +287,10 @@ static int idxd_setup_engines(struct idx engine = idxd->engines[i]; conf_dev =engine_confdev (engine);put_device (conf_dev); +kfree (engine); } +kfree (idxd->engines); +return rc; }
Greg Kroah-Hartman
maintainerPATCH 122/143 dmaengine: idxd: fix memory leak in error handling path of idxd_setup_groups
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit aa6f4f945b10eac57aed46154ae7d6fada7fccc7 upstream.
Memory allocated for groups is not freed if an error occurs during idxd_setup_groups(). To fix it, free the allocated memory in the reverse order of allocation before exiting the function in case of an error.
--- drivers/dma/idxd/init.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/idxd/init.c +4 -0
@@ -324,6 +324,7 @@ static int idxd_setup_groups(struct idxd rc =dev_set_name (conf_dev,"group%d.%d" , idxd->id, group->id);if (rc <0 ) {put_device (conf_dev); +kfree (group); goto err; }
@@ -348,7 +349,10 @@ static int idxd_setup_groups(struct idxdwhile (--i >=0 ) { group = idxd->groups[i];put_device (group_confdev (group)); +kfree (group); } +kfree (idxd->groups); +return rc; }
Greg Kroah-Hartman
maintainerPATCH 123/143 dmaengine: idxd: Add missing cleanup for early error out in idxd_setup_internals
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit 61259fb96e023f7299c442c48b13e72c441fc0f2 upstream.
The idxd_setup_internals() is missing some cleanup when things fail in the middle.
Add the appropriate cleanup routines:
- cleanup groups
- cleanup enginces
- cleanup wqs
to make sure it exits gracefully.
--- drivers/dma/idxd/init.c | 58 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 7 deletions(-)
drivers/dma/idxd/init.c +51 -7
@@ -153,6 +153,25 @@ static void idxd_cleanup_interrupts(strupci_free_irq_vectors (pdev); } +static void idxd_clean_wqs (struct idxd_device *idxd) +{ +struct idxd_wq *wq; +struct device *conf_dev; +int i; + +for (i =0 ; i < idxd->max_wqs; i++) { + wq = idxd->wqs[i]; +if (idxd->hw.wq_cap.op_config) +bitmap_free (wq->opcap_bmap); +kfree (wq->wqcfg); + conf_dev =wq_confdev (wq); +put_device (conf_dev); +kfree (wq); + } +bitmap_free (idxd->wq_enable_map); +kfree (idxd->wqs); +} +static int idxd_setup_wqs (struct idxd_device *idxd) {struct device *dev = &idxd->pdev->dev;
@@ -243,6 +262,21 @@ err_bitmap:return rc; } +static void idxd_clean_engines (struct idxd_device *idxd) +{ +struct idxd_engine *engine; +struct device *conf_dev; +int i; + +for (i =0 ; i < idxd->max_engines; i++) { + engine = idxd->engines[i]; + conf_dev =engine_confdev (engine); +put_device (conf_dev); +kfree (engine); + } +kfree (idxd->engines); +} +static int idxd_setup_engines (struct idxd_device *idxd) {struct idxd_engine *engine;
@@ -294,6 +328,19 @@ static int idxd_setup_engines(struct idxreturn rc; } +static void idxd_clean_groups (struct idxd_device *idxd) +{ +struct idxd_group *group; +int i; + +for (i =0 ; i < idxd->max_groups; i++) { + group = idxd->groups[i]; +put_device (group_confdev (group)); +kfree (group); + } +kfree (idxd->groups); +} +static int idxd_setup_groups (struct idxd_device *idxd) {struct device *dev = &idxd->pdev->dev;
@@ -408,7 +455,7 @@ static int idxd_init_evl(struct idxd_devstatic int idxd_setup_internals (struct idxd_device *idxd) {struct device *dev = &idxd->pdev->dev; -int rc, i; +int rc;init_waitqueue_head (&idxd->cmd_waitq);
@@ -439,14 +486,11 @@ static int idxd_setup_internals(struct i err_evl:destroy_workqueue (idxd->wq); err_wkq_create: -for (i =0 ; i < idxd->max_groups; i++) -put_device (group_confdev (idxd->groups[i])); +idxd_clean_groups (idxd); err_group: -for (i =0 ; i < idxd->max_engines; i++) -put_device (engine_confdev (idxd->engines[i])); +idxd_clean_engines (idxd); err_engine: -for (i =0 ; i < idxd->max_wqs; i++) -put_device (wq_confdev (idxd->wqs[i])); +idxd_clean_wqs (idxd); err_wqs:return rc; }
Greg Kroah-Hartman
maintainerPATCH 124/143 dmaengine: idxd: Add missing cleanups in cleanup internals
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit 61d651572b6c4fe50c7b39a390760f3a910c7ccf upstream.
The idxd_cleanup_internals() function only decreases the reference count of groups, engines, and wqs but is missing the step to release memory resources.
To fix this, use the cleanup helper to properly release the memory resources.
--- drivers/dma/idxd/init.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/dma/idxd/init.c +3 -8
@@ -405,14 +405,9 @@ static int idxd_setup_groups(struct idxdstatic void idxd_cleanup_internals (struct idxd_device *idxd) { -int i; - -for (i =0 ; i < idxd->max_groups; i++) -put_device (group_confdev (idxd->groups[i])); -for (i =0 ; i < idxd->max_engines; i++) -put_device (engine_confdev (idxd->engines[i])); -for (i =0 ; i < idxd->max_wqs; i++) -put_device (wq_confdev (idxd->wqs[i])); +idxd_clean_groups (idxd); +idxd_clean_engines (idxd); +idxd_clean_wqs (idxd);destroy_workqueue (idxd->wq); }
Greg Kroah-Hartman
maintainerPATCH 125/143 dmaengine: idxd: Add missing idxd cleanup to fix memory leak in remove call
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit d5449ff1b04dfe9ed8e455769aa01e4c2ccf6805 upstream.
The remove call stack is missing idxd cleanup to free bitmap, ida and the idxd_device. Call idxd_free() helper routines to make sure we exit gracefully.
--- drivers/dma/idxd/init.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/idxd/init.c +1 -0
@@ -915,6 +915,7 @@ static void idxd_remove(struct pci_dev *destroy_workqueue (idxd->wq);perfmon_pmu_remove (idxd);put_device (idxd_confdev (idxd)); +idxd_free (idxd); }static struct pci_driver idxd_pci_driver = {
Greg Kroah-Hartman
maintainerPATCH 126/143 dmaengine: idxd: fix memory leak in error handling path of idxd_alloc
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit 46a5cca76c76c86063000a12936f8e7875295838 upstream.
Memory allocated for idxd is not freed if an error occurs during idxd_alloc(). To fix it, free the allocated memory in the reverse order of allocation before exiting the function in case of an error.
--- drivers/dma/idxd/init.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/dma/idxd/init.c +15 -9
@@ -602,28 +602,34 @@ static struct idxd_device *idxd_alloc(stidxd_dev_set_type (&idxd->idxd_dev, idxd->data->type); idxd->id =ida_alloc (&idxd_ida,GFP_KERNEL );if (idxd->id <0 ) -return NULL ; + goto err_ida; idxd->opcap_bmap =bitmap_zalloc_node (IDXD_MAX_OPCAP_BITS ,GFP_KERNEL ,dev_to_node (dev)); -if (!idxd->opcap_bmap) { -ida_free (&idxd_ida, idxd->id); -return NULL ; - } +if (!idxd->opcap_bmap) + goto err_opcap;device_initialize (conf_dev); conf_dev->parent = dev; conf_dev->bus = &dsa_bus_type; conf_dev->type = idxd->data->dev_type; rc =dev_set_name (conf_dev,"%s%d" , idxd->data->name_prefix, idxd->id); -if (rc <0 ) { -put_device (conf_dev); -return NULL ; - } +if (rc <0 ) + goto err_name;spin_lock_init (&idxd->dev_lock);spin_lock_init (&idxd->cmd_lock);return idxd; + +err_name: +put_device (conf_dev); +bitmap_free (idxd->opcap_bmap); +err_opcap: +ida_free (&idxd_ida, idxd->id); +err_ida: +kfree (idxd); + +return NULL ; }static int idxd_enable_system_pasid (struct idxd_device *idxd)
Greg Kroah-Hartman
maintainerPATCH 127/143 dmaengine: idxd: fix memory leak in error handling path of idxd_pci_probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit 90022b3a6981ec234902be5dbf0f983a12c759fc upstream.
Memory allocated for idxd is not freed if an error occurs during idxd_pci_probe(). To fix it, free the allocated memory in the reverse order of allocation before exiting the function in case of an error.
--- drivers/dma/idxd/init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/dma/idxd/init.c +12 -1
@@ -585,6 +585,17 @@ static void idxd_read_caps(struct idxd_d idxd->hw.iaa_cap.bits =ioread64 (idxd->reg_base +IDXD_IAACAP_OFFSET ); } +static void idxd_free (struct idxd_device *idxd) +{ +if (!idxd) +return ; + +put_device (idxd_confdev (idxd)); +bitmap_free (idxd->opcap_bmap); +ida_free (&idxd_ida, idxd->id); +kfree (idxd); +} +static struct idxd_device *idxd_alloc (struct pci_dev *pdev,struct idxd_driver_data *data) {struct device *dev = &pdev->dev;
@@ -857,7 +868,7 @@ static int idxd_pci_probe(struct pci_dev err:pci_iounmap (pdev, idxd->reg_base); err_iomap: -put_device (idxd_confdev (idxd)); +idxd_free (idxd); err_idxd_alloc:pci_disable_device (pdev);return rc;
Greg Kroah-Hartman
maintainerPATCH 128/143 dmaengine: idxd: Refactor remove call with idxd_cleanup() helper
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Xue <[email protected]>
commit a409e919ca321cc0e28f8abf96fde299f0072a81 upstream.
The idxd_cleanup() helper cleans up perfmon, interrupts, internals and so on. Refactor remove call with the idxd_cleanup() helper to avoid code duplication. Note, this also fixes the missing put_device() for idxd groups, enginces and wqs.
--- drivers/dma/idxd/init.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/dma/idxd/init.c +2 -12
@@ -905,7 +905,6 @@ static void idxd_shutdown(struct pci_devstatic void idxd_remove (struct pci_dev *pdev) {struct idxd_device *idxd =pci_get_drvdata (pdev); -struct idxd_irq_entry *irq_entry;idxd_unregister_devices (idxd);/*
@@ -918,21 +917,12 @@ static void idxd_remove(struct pci_dev *get_device (idxd_confdev (idxd));device_unregister (idxd_confdev (idxd));idxd_shutdown (pdev); -if (device_pasid_enabled (idxd)) -idxd_disable_system_pasid (idxd);idxd_device_remove_debugfs (idxd); - - irq_entry =idxd_get_ie (idxd,0 ); -free_irq (irq_entry->vector, irq_entry); -pci_free_irq_vectors (pdev); +idxd_cleanup (idxd);pci_iounmap (pdev, idxd->reg_base); -if (device_user_pasid_enabled (idxd)) -idxd_disable_sva (pdev); -pci_disable_device (pdev); -destroy_workqueue (idxd->wq); -perfmon_pmu_remove (idxd);put_device (idxd_confdev (idxd));idxd_free (idxd); +pci_disable_device (pdev); }static struct pci_driver idxd_pci_driver = {
Greg Kroah-Hartman
maintainerPATCH 129/143 CIFS: New mount option for cifs.upcall namespace resolution
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ritvik Budhiraja <[email protected]>
commit db363b0a1d9e6b9dc556296f1b1007aeb496a8cf upstream.
In the current implementation, the SMB filesystem on a mount point can trigger upcalls from the kernel to the userspace to enable certain functionalities like spnego, dns_resolution, amongst others. These upcalls usually either happen in the context of the mount or in the context of an application/user. The upcall handler for cifs, cifs.upcall already has existing code which switches the namespaces to the caller's namespace before handling the upcall. This behaviour is expected for scenarios like multiuser mounts, but might not cover all single user scenario with services such as Kubernetes, where the mount can happen from different locations such as on the host, from an app container, or a driver pod which does the mount on behalf of a different pod.
This patch introduces a new mount option called upcall_target, to customise the upcall behaviour. upcall_target can take 'mount' and 'app' as possible values. This aids use cases like Kubernetes where the mount happens on behalf of the application in another container altogether. Having this new mount option allows the mount command to specify where the upcall should happen: 'mount' for resolving the upcall to the host namespace, and 'app' for resolving the upcall to the ns of the calling thread. This will enable both the scenarios where the Kerberos credentials can be found on the application namespace or the host namespace to which just the mount operation is "delegated".
--- fs/smb/client/cifs_spnego.c | 16 ++++++++++++++++ fs/smb/client/cifsfs.c | 25 +++++++++++++++++++++++++ fs/smb/client/cifsglob.h | 7 +++++++ fs/smb/client/connect.c | 20 ++++++++++++++++++++ fs/smb/client/fs_context.c | 39 +++++++++++++++++++++++++++++++++++++++ fs/smb/client/fs_context.h | 10 ++++++++++ 6 files changed, 117 insertions(+)
fs/smb/client/cifs_spnego.c +16 -0
@@ -82,6 +82,9 @@ struct key_type cifs_spnego_key_type = {/* strlen of ";pid=0x" */ #define PID_KEY_LEN 7 +/* strlen of ";upcall_target=" */ +#define UPCALL_TARGET_KEY_LEN 15 +/* get a key struct with a SPNEGO security blob, suitable for session setup */ struct key * cifs_get_spnego_key(struct cifs_ses *sesInfo,
@@ -108,6 +111,11 @@ cifs_get_spnego_key(struct cifs_ses *sesif (sesInfo->user_name) desc_len +=USER_KEY_LEN +strlen (sesInfo->user_name); +if (sesInfo->upcall_target ==UPTARGET_MOUNT ) + desc_len +=UPCALL_TARGET_KEY_LEN +5 ;// strlen("mount") +else + desc_len +=UPCALL_TARGET_KEY_LEN +3 ;// strlen("app") + spnego_key =ERR_PTR (-ENOMEM ); description =kzalloc (desc_len,GFP_KERNEL );if (description ==NULL )
@@ -158,6 +166,14 @@ cifs_get_spnego_key(struct cifs_ses *ses dp = description +strlen (description);sprintf (dp,";pid=0x%x" , current->pid); +if (sesInfo->upcall_target ==UPTARGET_MOUNT ) { + dp = description +strlen (description); +sprintf (dp,";upcall_target=mount" ); + }else { + dp = description +strlen (description); +sprintf (dp,";upcall_target=app" ); + } +cifs_dbg (FYI ,"key description = %s\n" , description); saved_cred =override_creds (spnego_cred); spnego_key =request_key (&cifs_spnego_key_type, description,"" );
fs/smb/client/cifsfs.c +25 -0
@@ -547,6 +547,30 @@ static int cifs_show_devname(struct seq_return 0 ; } +static void +cifs_show_upcall_target (struct seq_file *s,struct cifs_sb_info *cifs_sb) +{ +if (cifs_sb->ctx->upcall_target ==UPTARGET_UNSPECIFIED ) { +seq_puts (s,",upcall_target=app" ); +return ; + } + +seq_puts (s,",upcall_target=" ); + +switch (cifs_sb->ctx->upcall_target) { +case UPTARGET_APP : +seq_puts (s,"app" ); +break ; +case UPTARGET_MOUNT : +seq_puts (s,"mount" ); +break ; +default : +/* shouldn't ever happen */ +seq_puts (s,"unknown" ); +break ; + } +} +/* * cifs_show_options() is for displaying mount options in /proc/mounts. * Not all settable options are displayed but most of the important
@@ -563,6 +587,7 @@ cifs_show_options(struct seq_file *s, stseq_show_option (s,"vers" , tcon->ses->server->vals->version_string);cifs_show_security (s, tcon->ses);cifs_show_cache_flavor (s, cifs_sb); +cifs_show_upcall_target (s, cifs_sb);if (tcon->no_lease)seq_puts (s,",nolease" );
fs/smb/client/cifsglob.h +7 -0
@@ -154,6 +154,12 @@ enum securityEnum { IAKerb, /* Kerberos proxy */ }; +enum upcall_target_enum { +UPTARGET_UNSPECIFIED ,/* not specified, defaults to app */ +UPTARGET_MOUNT ,/* upcall to the mount namespace */ +UPTARGET_APP ,/* upcall to the application namespace which did the mount */ +}; +enum cifs_reparse_type {CIFS_REPARSE_TYPE_NFS ,CIFS_REPARSE_TYPE_WSL ,
@@ -1085,6 +1091,7 @@ struct cifs_ses {struct session_key auth_key;struct ntlmssp_auth *ntlmssp;/* ciphertext, flags, server challenge */ enum securityEnum sectype;/* what security flavor was specified? */ +enum upcall_target_enum upcall_target;/* what upcall target was specified? */ bool sign;/* is signing required? */ bool domainAuto:1;bool expired_pwd;/* track if access denied or expired pwd so can know if need to update */
fs/smb/client/connect.c +20 -0
@@ -2381,6 +2381,26 @@ retry_old_session: ses->sectype = ctx->sectype; ses->sign = ctx->sign; + +/* +*Explicitly marking upcall_target mount option for easier handling +* by cifs_spnego.c and eventually cifs.upcall.c +*/ + +switch (ctx->upcall_target) { +case UPTARGET_UNSPECIFIED :/* default to app */ +case UPTARGET_APP : + ses->upcall_target =UPTARGET_APP ; +break ; +case UPTARGET_MOUNT : + ses->upcall_target =UPTARGET_MOUNT ; +break ; +default : +// should never happen + ses->upcall_target =UPTARGET_APP ; +break ; + } + ses->local_nls =load_nls (ctx->local_nls->charset);/* add server as first channel */
fs/smb/client/fs_context.c +39 -0
@@ -67,6 +67,12 @@ static const match_table_t cifs_secflavo { Opt_sec_err, NULL } }; +static const match_table_t cifs_upcall_target = { + { Opt_upcall_target_mount,"mount" }, + { Opt_upcall_target_application,"app" }, + { Opt_upcall_target_err,NULL } +}; +const struct fs_parameter_spec smb3_fs_parameters[] = {/* Mount options that take no arguments */ fsparam_flag_no ("user_xattr" , Opt_user_xattr),
@@ -179,6 +185,7 @@ const struct fs_parameter_spec smb3_fs_pfsparam_string ("sec" , Opt_sec),fsparam_string ("cache" , Opt_cache),fsparam_string ("reparse" , Opt_reparse), +fsparam_string ("upcall_target" , Opt_upcalltarget),/* Arguments that should be ignored */ fsparam_flag("guest", Opt_ignore),
@@ -249,6 +256,29 @@ cifs_parse_security_flavors(struct fs_coreturn 0 ; } +static int +cifs_parse_upcall_target (struct fs_context *fc,char *value,struct smb3_fs_context *ctx) +{ +substring_t args[MAX_OPT_ARGS ]; + + ctx->upcall_target =UPTARGET_UNSPECIFIED ; + +switch (match_token (value, cifs_upcall_target, args)) { +case Opt_upcall_target_mount: + ctx->upcall_target =UPTARGET_MOUNT ; +break ; +case Opt_upcall_target_application: + ctx->upcall_target =UPTARGET_APP ; +break ; + +default : +cifs_errorf (fc,"bad upcall target: %s\n" , value); +return 1 ; + } + +return 0 ; +} +static const match_table_t cifs_cacheflavor_tokens = { { Opt_cache_loose,"loose" }, { Opt_cache_strict,"strict" },
@@ -1526,6 +1556,10 @@ static int smb3_fs_context_parse_param(sif (cifs_parse_security_flavors (fc, param->string, ctx) !=0 ) goto cifs_parse_mount_err;break ; +case Opt_upcalltarget: +if (cifs_parse_upcall_target (fc, param->string, ctx) !=0 ) + goto cifs_parse_mount_err; +break ;case Opt_cache:if (cifs_parse_cache_flavor (fc, param->string, ctx) !=0 ) goto cifs_parse_mount_err;
@@ -1703,6 +1737,11 @@ static int smb3_fs_context_parse_param(s }/* case Opt_ignore: - is ignored as expected ... */ +if (ctx->multiuser && ctx->upcall_target ==UPTARGET_MOUNT ) { +cifs_errorf (fc,"multiuser mount option not supported with upcalltarget set as 'mount'\n" ); + goto cifs_parse_mount_err; + } +return 0 ; cifs_parse_mount_err:
fs/smb/client/fs_context.h +10 -0
@@ -61,6 +61,12 @@ enum cifs_sec_param {Opt_sec_err }; +enum cifs_upcall_target_param { + Opt_upcall_target_mount, + Opt_upcall_target_application, + Opt_upcall_target_err +}; +enum cifs_param {/* Mount options that take no arguments */ Opt_user_xattr,
@@ -114,6 +120,8 @@ enum cifs_param { Opt_multichannel, Opt_compress, Opt_witness, + Opt_is_upcall_target_mount, + Opt_is_upcall_target_application,/* Mount options which take numeric value */ Opt_backupuid,
@@ -157,6 +165,7 @@ enum cifs_param { Opt_sec, Opt_cache, Opt_reparse, + Opt_upcalltarget,/* Mount options to be ignored */ Opt_ignore,
@@ -198,6 +207,7 @@ struct smb3_fs_context {umode_t file_mode;umode_t dir_mode;enum securityEnum sectype;/* sectype requested via mnt opts */ +enum upcall_target_enum upcall_target;/* where to upcall for mount */ bool sign;/* was signing requested via mnt opts? */ bool ignore_signature:1; bool retry:1;
Greg Kroah-Hartman
maintainerPATCH 130/143 drm/xe/gsc: do not flush the GSC worker from the reset path
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Ceraolo Spurio <[email protected]>
commit 03552d8ac0afcc080c339faa0b726e2c0e9361cb upstream.
The workqueue used for the reset worker is marked as WQ_MEM_RECLAIM, while the GSC one isn't (and can't be as we need to do memory allocations in the gsc worker). Therefore, we can't flush the latter from the former.
The reason why we had such a flush was to avoid interrupting either the GSC FW load or in progress GSC proxy operations. GSC proxy operations fall into 2 categories:
1) GSC proxy init: this only happens once immediately after GSC FW load and does not support being interrupted. The only way to recover from an interruption of the proxy init is to do an FLR and re-load the GSC.
2) GSC proxy request: this can happen in response to a request that the driver sends to the GSC. If this is interrupted, the GSC FW will timeout and the driver request will be failed, but overall the GSC will keep working fine.
Flushing the work allowed us to avoid interruption in both cases (unless the hang came from the GSC engine itself, in which case we're toast anyway). However, a failure on a proxy request is tolerable if we're in a scenario where we're triggering a GT reset (i.e., something is already gone pretty wrong), so what we really need to avoid is interrupting the init flow, which we can do by polling on the register that reports when the proxy init is complete (as that ensure us that all the load and init operations have been completed).
Note that during suspend we still want to do a flush of the worker to make sure it completes any operations involving the HW before the power is cut.
v2: fix spelling in commit msg, rename waiter function (Julia)
--- drivers/gpu/drm/xe/xe_gsc.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/xe/xe_gsc.h | 1 + drivers/gpu/drm/xe/xe_gsc_proxy.c | 11 +++++++++++ drivers/gpu/drm/xe/xe_gsc_proxy.h | 1 + drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_uc.c | 8 +++++++- drivers/gpu/drm/xe/xe_uc.h | 1 + 7 files changed, 44 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_gsc.c +22 -0
@@ -564,6 +564,28 @@ void xe_gsc_remove(struct xe_gsc *gsc)xe_gsc_proxy_remove (gsc); } +void xe_gsc_stop_prepare (struct xe_gsc *gsc) +{ +struct xe_gt *gt =gsc_to_gt (gsc); +int ret; + +if (!xe_uc_fw_is_loadable (&gsc->fw) ||xe_uc_fw_is_in_error_state (&gsc->fw)) +return ; + +xe_force_wake_assert_held (gt_to_fw (gt),XE_FW_GSC ); + +/* +* If the GSC FW load or the proxy init are interrupted, the only way +* to recover it is to do an FLR and reload the GSC from scratch. +* Therefore, let's wait for the init to complete before stopping +* operations. The proxy init is the last step, so we can just wait on +* that +*/ + ret =xe_gsc_wait_for_proxy_init_done (gsc); +if (ret) +xe_gt_err (gt,"failed to wait for GSC init completion before uc stop\n" ); +} +/* * wa_14015076503: if the GSC FW is loaded, we need to alert it before doing a * GSC engine reset by writing a notification bit in the GS1 register and then
drivers/gpu/drm/xe/xe_gsc.h +1 -0
@@ -16,6 +16,7 @@ struct xe_hw_engine;int xe_gsc_init (struct xe_gsc *gsc);int xe_gsc_init_post_hwconfig (struct xe_gsc *gsc);void xe_gsc_wait_for_worker_completion (struct xe_gsc *gsc); +void xe_gsc_stop_prepare (struct xe_gsc *gsc);void xe_gsc_load_start (struct xe_gsc *gsc);void xe_gsc_remove (struct xe_gsc *gsc);void xe_gsc_hwe_irq_handler (struct xe_hw_engine *hwe,u16 intr_vec);
drivers/gpu/drm/xe/xe_gsc_proxy.c +11 -0
@@ -71,6 +71,17 @@ bool xe_gsc_proxy_init_done(struct xe_gsHECI1_FWSTS1_PROXY_STATE_NORMAL ; } +int xe_gsc_wait_for_proxy_init_done (struct xe_gsc *gsc) +{ +struct xe_gt *gt =gsc_to_gt (gsc); + +/* Proxy init can take up to 500ms, so wait double that for safety */ +return xe_mmio_wait32 (gt,HECI_FWSTS1 (MTL_GSC_HECI1_BASE ), +HECI1_FWSTS1_CURRENT_STATE , +HECI1_FWSTS1_PROXY_STATE_NORMAL , +USEC_PER_SEC ,NULL , false); +} +static void __gsc_proxy_irq_rmw (struct xe_gsc *gsc,u32 clr,u32 set) {struct xe_gt *gt =gsc_to_gt (gsc);
drivers/gpu/drm/xe/xe_gsc_proxy.h +1 -0
@@ -13,6 +13,7 @@ struct xe_gsc;int xe_gsc_proxy_init (struct xe_gsc *gsc);bool xe_gsc_proxy_init_done (struct xe_gsc *gsc);void xe_gsc_proxy_remove (struct xe_gsc *gsc); +int xe_gsc_wait_for_proxy_init_done (struct xe_gsc *gsc);int xe_gsc_proxy_start (struct xe_gsc *gsc);int xe_gsc_proxy_request_handler (struct xe_gsc *gsc);
drivers/gpu/drm/xe/xe_gt.c +1 -1
@@ -828,7 +828,7 @@ void xe_gt_suspend_prepare(struct xe_gt {XE_WARN_ON (xe_force_wake_get (gt_to_fw (gt),XE_FORCEWAKE_ALL )); -xe_uc_stop_prepare (>->uc); +xe_uc_suspend_prepare (>->uc);XE_WARN_ON (xe_force_wake_put (gt_to_fw (gt),XE_FORCEWAKE_ALL )); }
drivers/gpu/drm/xe/xe_uc.c +7 -1
@@ -241,7 +241,7 @@ void xe_uc_gucrc_disable(struct xe_uc *uvoid xe_uc_stop_prepare (struct xe_uc *uc) { -xe_gsc_wait_for_worker_completion (&uc->gsc); +xe_gsc_stop_prepare (&uc->gsc);xe_guc_stop_prepare (&uc->guc); }
@@ -275,6 +275,12 @@ again: goto again; } +void xe_uc_suspend_prepare (struct xe_uc *uc) +{ +xe_gsc_wait_for_worker_completion (&uc->gsc); +xe_guc_stop_prepare (&uc->guc); +} +int xe_uc_suspend (struct xe_uc *uc) {/* GuC submission not enabled, nothing to do */
drivers/gpu/drm/xe/xe_uc.h +1 -0
@@ -18,6 +18,7 @@ int xe_uc_reset_prepare(struct xe_uc *ucvoid xe_uc_stop_prepare (struct xe_uc *uc);void xe_uc_stop (struct xe_uc *uc);int xe_uc_start (struct xe_uc *uc); +void xe_uc_suspend_prepare (struct xe_uc *uc);int xe_uc_suspend (struct xe_uc *uc);int xe_uc_sanitize_reset (struct xe_uc *uc);void xe_uc_remove (struct xe_uc *uc);
Greg Kroah-Hartman
maintainerPATCH 131/143 mm/page_alloc: fix race condition in unaccepted memory handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill A. Shutemov <[email protected]>
commit fefc075182275057ce607effaa3daa9e6e3bdc73 upstream.
The page allocator tracks the number of zones that have unaccepted memory using static_branch_enc/dec() and uses that static branch in hot paths to determine if it needs to deal with unaccepted memory.
Borislav and Thomas pointed out that the tracking is racy: operations on static_branch are not serialized against adding/removing unaccepted pages to/from the zone.
Sanity checks inside static_branch machinery detects it:
WARNING: CPU: 0 PID: 10 at kernel/jump_label.c:276 __static_key_slow_dec_cpuslocked+0x8e/0xa0
The comment around the WARN() explains the problem:
/*
* Warn about the '-1' case though; since that means a
* decrement is concurrent with a first (0->1) increment. IOW
* people are trying to disable something that wasn't yet fully
* enabled. This suggests an ordering problem on the user side. */
The effect of this static_branch optimization is only visible on microbenchmark.
Instead of adding more complexity around it, remove it altogether.
--- mm/page_alloc.c | 23 ----------------------- 1 file changed, 23 deletions(-)
mm/page_alloc.c +0 -23
@@ -7041,9 +7041,6 @@ bool has_managed_dma(void)#ifdef CONFIG_UNACCEPTED_MEMORY -/* Counts number of zones with unaccepted pages. */ -static DEFINE_STATIC_KEY_FALSE (zones_with_unaccepted_pages); -static bool lazy_accept = true;static int __init accept_memory_parse (char *p)
@@ -7070,11 +7067,7 @@ static bool page_contains_unaccepted(strstatic void __accept_page (struct zone *zone,unsigned long *flags,struct page *page) { -bool last; -list_del (&page->lru); - last =list_empty (&zone->unaccepted_pages); -account_freepages (zone, -MAX_ORDER_NR_PAGES ,MIGRATE_MOVABLE );__mod_zone_page_state (zone,NR_UNACCEPTED , -MAX_ORDER_NR_PAGES );__ClearPageUnaccepted (page);
@@ -7083,9 +7076,6 @@ static void __accept_page(struct zone *zaccept_memory (page_to_phys (page),PAGE_SIZE <<MAX_PAGE_ORDER );__free_pages_ok (page,MAX_PAGE_ORDER ,FPI_TO_TAIL ); - -if (last) -static_branch_dec (&zones_with_unaccepted_pages); }void accept_page (struct page *page)
@@ -7122,19 +7112,11 @@ static bool try_to_accept_memory_one(strreturn true; } -static inline bool has_unaccepted_memory (void ) -{ -return static_branch_unlikely (&zones_with_unaccepted_pages); -} -static bool cond_accept_memory (struct zone *zone,unsigned int order) {long to_accept, wmark;bool ret = false; -if (!has_unaccepted_memory ()) -return false; -if (list_empty (&zone->unaccepted_pages))return false;
@@ -7168,22 +7150,17 @@ static bool __free_unaccepted(struct pag {struct zone *zone =page_zone (page);unsigned long flags; -bool first = false;if (!lazy_accept)return false;spin_lock_irqsave (&zone->lock, flags); - first =list_empty (&zone->unaccepted_pages);list_add_tail (&page->lru, &zone->unaccepted_pages);account_freepages (zone,MAX_ORDER_NR_PAGES ,MIGRATE_MOVABLE );__mod_zone_page_state (zone,NR_UNACCEPTED ,MAX_ORDER_NR_PAGES );__SetPageUnaccepted (page);spin_unlock_irqrestore (&zone->lock, flags); -if (first) -static_branch_inc (&zones_with_unaccepted_pages); -return true; }
Greg Kroah-Hartman
maintainerPATCH 132/143 accel/ivpu: Rename ivpu_log_level to fw_log_level
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 3a3fb8110c65d361cd9d750c9e16520f740c93f2 upstream.
Rename module param ivpu_log_level to fw_log_level, so it is clear what log level is actually changed.
--- drivers/accel/ivpu/ivpu_fw.c | 4 ++-- drivers/accel/ivpu/ivpu_fw_log.c | 12 ++++++------ drivers/accel/ivpu/ivpu_fw_log.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/accel/ivpu/ivpu_fw.c +2 -2
@@ -218,7 +218,7 @@ static int ivpu_fw_parse(struct ivpu_dev fw->cold_boot_entry_point = fw_hdr->entry_point; fw->entry_point = fw->cold_boot_entry_point; - fw->trace_level =min_t (u32, ivpu_log_level,IVPU_FW_LOG_FATAL ); + fw->trace_level =min_t (u32, ivpu_fw_log_level,IVPU_FW_LOG_FATAL ); fw->trace_destination_mask =VPU_TRACE_DESTINATION_VERBOSE_TRACING ; fw->trace_hw_component_mask =-1 ;
@@ -323,7 +323,7 @@ static int ivpu_fw_mem_init(struct ivpu_ goto err_free_fw_mem; } -if (ivpu_log_level <=IVPU_FW_LOG_INFO ) +if (ivpu_fw_log_level <=IVPU_FW_LOG_INFO ) log_verb_size =IVPU_FW_VERBOSE_BUFFER_LARGE_SIZE ;else log_verb_size =IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE ;
drivers/accel/ivpu/ivpu_fw_log.c +6 -6
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* -* Copyright (C) 2020-2023 Intel Corporation +* Copyright (C) 2020-2024 Intel Corporation */ #include <linux/ctype.h>
@@ -15,12 +15,12 @@#include "ivpu_fw_log.h" #include "ivpu_gem.h" -#define IVPU_FW_LOG_LINE_LENGTH 256 +#define IVPU_FW_LOG_LINE_LENGTH 256 -unsigned int ivpu_log_level =IVPU_FW_LOG_ERROR ; -module_param (ivpu_log_level, uint,0444 ); -MODULE_PARM_DESC (ivpu_log_level, - "NPU firmware default trace level: debug=" __stringify(IVPU_FW_LOG_DEBUG) +unsigned int ivpu_fw_log_level =IVPU_FW_LOG_ERROR ; +module_param_named (fw_log_level, ivpu_fw_log_level, uint,0444 ); +MODULE_PARM_DESC (fw_log_level, + "NPU firmware default log level: debug=" __stringify(IVPU_FW_LOG_DEBUG) " info=" __stringify(IVPU_FW_LOG_INFO) " warn=" __stringify(IVPU_FW_LOG_WARN) " error=" __stringify(IVPU_FW_LOG_ERROR)
drivers/accel/ivpu/ivpu_fw_log.h +3 -3
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0-only */ /* -* Copyright (C) 2020-2023 Intel Corporation +* Copyright (C) 2020-2024 Intel Corporation */ #ifndef __IVPU_FW_LOG_H__
@@ -17,12 +17,12 @@#define IVPU_FW_LOG_ERROR 4#define IVPU_FW_LOG_FATAL 5 -extern unsigned int ivpu_log_level; -#define IVPU_FW_VERBOSE_BUFFER_SMALL_SIZE SZ_1M#define IVPU_FW_VERBOSE_BUFFER_LARGE_SIZE SZ_8M#define IVPU_FW_CRITICAL_BUFFER_SIZE SZ_512K +extern unsigned int ivpu_fw_log_level; +void ivpu_fw_log_print (struct ivpu_device *vdev,bool only_new_msgs,struct drm_printer *p);void ivpu_fw_log_clear (struct ivpu_device *vdev);
Greg Kroah-Hartman
maintainerPATCH 133/143 accel/ivpu: Reset fw log on cold boot
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Rusinowicz <[email protected]>
commit 4b4d9e394b6f45ac26ac6144b31604c76b7e3705 upstream.
Add ivpu_fw_log_reset() that resets the read_index of all FW logs on cold boot so logs are properly read.
--- drivers/accel/ivpu/ivpu_fw_log.c | 14 ++++++++++++++ drivers/accel/ivpu/ivpu_fw_log.h | 1 + drivers/accel/ivpu/ivpu_pm.c | 1 + 3 files changed, 16 insertions(+)
drivers/accel/ivpu/ivpu_fw_log.c +14 -0
@@ -140,3 +140,17 @@ void ivpu_fw_log_clear(struct ivpu_devicwhile (fw_log_ptr (vdev, vdev->fw->mem_log_verb, &next, &log_header) ==0 ) log_header->read_index = log_header->write_index; } + +void ivpu_fw_log_reset (struct ivpu_device *vdev) +{ +struct vpu_tracing_buffer_header *log_header; +u32 next; + + next =0 ; +while (fw_log_ptr (vdev, vdev->fw->mem_log_crit, &next, &log_header) ==0 ) + log_header->read_index =0 ; + + next =0 ; +while (fw_log_ptr (vdev, vdev->fw->mem_log_verb, &next, &log_header) ==0 ) + log_header->read_index =0 ; +}
drivers/accel/ivpu/ivpu_fw_log.h +1 -0
@@ -25,6 +25,7 @@ extern unsigned int ivpu_fw_log_level;void ivpu_fw_log_print (struct ivpu_device *vdev,bool only_new_msgs,struct drm_printer *p);void ivpu_fw_log_clear (struct ivpu_device *vdev); +void ivpu_fw_log_reset (struct ivpu_device *vdev);#endif /* __IVPU_FW_LOG_H__ */
drivers/accel/ivpu/ivpu_pm.c +1 -0
@@ -38,6 +38,7 @@ static void ivpu_pm_prepare_cold_boot(stivpu_cmdq_reset_all_contexts (vdev);ivpu_ipc_reset (vdev); +ivpu_fw_log_reset (vdev);ivpu_fw_load (vdev); fw->entry_point = fw->cold_boot_entry_point; }
Greg Kroah-Hartman
maintainerPATCH 134/143 accel/ivpu: Refactor functions in ivpu_fw_log.c
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 1fc1251149a76d3b75d7f4c94d9c4e081b7df6b4 upstream.
Make function names more consistent and (arguably) readable in fw log code. Add fw_log_print_all_in_bo() that remove duplicated code in ivpu_fw_log_print().
--- drivers/accel/ivpu/ivpu_debugfs.c | 2 - drivers/accel/ivpu/ivpu_fw_log.c | 62 ++++++++++++++++++++------------------ drivers/accel/ivpu/ivpu_fw_log.h | 2 - 3 files changed, 35 insertions(+), 31 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +1 -1
@@ -201,7 +201,7 @@ fw_log_fops_write(struct file *file, conif (!size)return -EINVAL ; -ivpu_fw_log_clear (vdev); +ivpu_fw_log_mark_read (vdev);return size; }
drivers/accel/ivpu/ivpu_fw_log.c +33 -29
117 lines not on this page · raw message
drivers/accel/ivpu/ivpu_fw_log.h +1 -1
@@ -24,7 +24,7 @@extern unsigned int ivpu_fw_log_level;void ivpu_fw_log_print (struct ivpu_device *vdev,bool only_new_msgs,struct drm_printer *p); -void ivpu_fw_log_clear (struct ivpu_device *vdev); +void ivpu_fw_log_mark_read (struct ivpu_device *vdev);void ivpu_fw_log_reset (struct ivpu_device *vdev);
Greg Kroah-Hartman
maintainerPATCH 135/143 accel/ivpu: Fix fw log printing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 4bc988b47019536b3b1f7d9c5b83893c712d94d6 upstream.
- Fix empty log detection that couldn't work without read_wrap_count
- Start printing wrapped log from correct position (log_start)
- Properly handle logs that are wrapped multiple times in reference to reader position
- Don't add a newline when log buffer is wrapped
- Always add a newline after printing a log buffer in case log does not end with one
--- drivers/accel/ivpu/ivpu_fw_log.c | 49 +++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 17 deletions(-)
drivers/accel/ivpu/ivpu_fw_log.c +32 -17
@@ -87,7 +87,7 @@ static void fw_log_print_lines(char *buf } line[index] =0 ;if (index !=0 ) -drm_printf (p,"%s\n" , line); +drm_printf (p,"%s" , line); } static void fw_log_print_buffer(struct vpu_tracing_buffer_header *log, const char *prefix,
@@ -95,23 +95,29 @@ static void fw_log_print_buffer(struct v {char *log_data = (void *)log + log->header_size;u32 data_size = log->size - log->header_size; -u32 log_start = log->read_index; -u32 log_end = log->write_index; +u32 log_start = only_new_msgs ?READ_ONCE (log->read_index) :0 ; +u32 log_end =READ_ONCE (log->write_index); -if (!(log->write_index || log->wrap_count) || - (log->write_index == log->read_index && only_new_msgs)) { -drm_printf (p,"==== %s \"%s\" log empty ====\n" , prefix, log->name); -return ; +if (log->wrap_count == log->read_wrap_count) { +if (log_end <= log_start) { +drm_printf (p,"==== %s \"%s\" log empty ====\n" , prefix, log->name); +return ; + } + }else if (log->wrap_count == log->read_wrap_count +1 ) { +if (log_end > log_start) + log_start = log_end; + }else { + log_start = log_end; }drm_printf (p,"==== %s \"%s\" log start ====\n" , prefix, log->name); -if (log->write_index > log->read_index) { +if (log_end > log_start) {fw_log_print_lines (log_data + log_start, log_end - log_start, p); }else { -fw_log_print_lines (log_data + log_end, data_size - log_end, p); +fw_log_print_lines (log_data + log_start, data_size - log_start, p);fw_log_print_lines (log_data, log_end, p); } -drm_printf (p,"\x1b[0m" ); +drm_printf (p,"\n\x1b[0m" );/* add new line and clear formatting */ drm_printf (p,"==== %s \"%s\" log end ====\n" , prefix, log->name); }
@@ -135,14 +141,19 @@ void ivpu_fw_log_print(struct ivpu_devicvoid ivpu_fw_log_mark_read (struct ivpu_device *vdev) {struct vpu_tracing_buffer_header *log; -u32 next =0 ; +u32 next; -while (fw_log_from_bo (vdev, vdev->fw->mem_log_crit, &next, &log) ==0 ) - log->read_index = log->write_index; + next =0 ; +while (fw_log_from_bo (vdev, vdev->fw->mem_log_crit, &next, &log) ==0 ) { + log->read_index =READ_ONCE (log->write_index); + log->read_wrap_count =READ_ONCE (log->wrap_count); + } next =0 ; -while (fw_log_from_bo (vdev, vdev->fw->mem_log_verb, &next, &log) ==0 ) - log->read_index = log->write_index; +while (fw_log_from_bo (vdev, vdev->fw->mem_log_verb, &next, &log) ==0 ) { + log->read_index =READ_ONCE (log->write_index); + log->read_wrap_count =READ_ONCE (log->wrap_count); + } }void ivpu_fw_log_reset (struct ivpu_device *vdev)
@@ -151,10 +162,14 @@ void ivpu_fw_log_reset(struct ivpu_devicu32 next; next =0 ; -while (fw_log_from_bo (vdev, vdev->fw->mem_log_crit, &next, &log) ==0 ) +while (fw_log_from_bo (vdev, vdev->fw->mem_log_crit, &next, &log) ==0 ) { log->read_index =0 ; + log->read_wrap_count =0 ; + } next =0 ; -while (fw_log_from_bo (vdev, vdev->fw->mem_log_verb, &next, &log) ==0 ) +while (fw_log_from_bo (vdev, vdev->fw->mem_log_verb, &next, &log) ==0 ) { log->read_index =0 ; + log->read_wrap_count =0 ; + } }
Greg Kroah-Hartman
maintainerPATCH 136/143 iio: light: opt3001: fix deadlock due to concurrent flag access
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
commit f063a28002e3350088b4577c5640882bf4ea17ea upstream.
The threaded IRQ function in this driver is reading the flag twice: once to lock a mutex and once to unlock it. Even though the code setting the flag is designed to prevent it, there are subtle cases where the flag could be true at the mutex_lock stage and false at the mutex_unlock stage. This results in the mutex not being unlocked, resulting in a deadlock.
Fix it by making the opt3001_irq() code generally more robust, reading the flag into a variable and using the variable value at both stages.
--- drivers/iio/light/opt3001.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/light/opt3001.c +3 -2
@@ -692,8 +692,9 @@ static irqreturn_t opt3001_irq(int irq,struct opt3001 *opt =iio_priv (iio);int ret;bool wake_result_ready_queue = false; +bool ok_to_ignore_lock = opt->ok_to_ignore_lock; -if (!opt->ok_to_ignore_lock) +if (!ok_to_ignore_lock)mutex_lock (&opt->lock); ret =i2c_smbus_read_word_swapped (opt->client,OPT3001_CONFIGURATION );
@@ -730,7 +731,7 @@ static irqreturn_t opt3001_irq(int irq, } out: -if (!opt->ok_to_ignore_lock) +if (!ok_to_ignore_lock)mutex_unlock (&opt->lock);if (wake_result_ready_queue)
Greg Kroah-Hartman
maintainerPATCH 137/143 Bluetooth: btnxpuart: Fix kernel panic during FW release
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neeraj Sanjay Kale <[email protected]>
commit 1f77c05408c96bc0b58ae476a9cadc9e5b9cfd0f upstream.
This fixes a kernel panic seen during release FW in a stress test scenario where WLAN and BT FW download occurs simultaneously, and due to a HW bug, chip sends out only 1 bootloader signatures.
When driver receives the bootloader signature, it enters FW download mode, but since no consequtive bootloader signatures seen, FW file is not requested.
After 60 seconds, when FW download times out, release_firmware causes a kernel panic.
[ 2601.949184] Unable to handle kernel paging request at virtual address 0000312e6f006573 [ 2601.992076] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000111802000 [ 2601.992080] [0000312e6f006573] pgd=0000000000000000, p4d=0000000000000000 [ 2601.992087] Internal error: Oops: 0000000096000021 [#1] PREEMPT SMP [ 2601.992091] Modules linked in: algif_hash algif_skcipher af_alg btnxpuart(O) pciexxx(O) mlan(O) overlay fsl_jr_uio caam_jr caamkeyblob_desc caamhash_desc caamalg_desc crypto_engine authenc libdes crct10dif_ce polyval_ce snd_soc_fsl_easrc snd_soc_fsl_asoc_card imx8_media_dev(C) snd_soc_fsl_micfil polyval_generic snd_soc_fsl_xcvr snd_soc_fsl_sai snd_soc_imx_audmux snd_soc_fsl_asrc snd_soc_imx_card snd_soc_imx_hdmi snd_soc_fsl_aud2htx snd_soc_fsl_utils imx_pcm_dma dw_hdmi_cec flexcan can_dev [ 2602.001825] CPU: 2 PID: 20060 Comm: hciconfig Tainted: G C O 6.6.23-lts-next-06236-gb586a521770e #1 [ 2602.010182] Hardware name: NXP i.MX8MPlus EVK board (DT) [ 2602.010185] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 2602.010191] pc : _raw_spin_lock+0x34/0x68 [ 2602.010201] lr : free_fw_priv+0x20/0xfc [ 2602.020561] sp : ffff800089363b30 [ 2602.020563] x29: ffff800089363b30 x28: ffff0000d0eb5880 x27: 0000000000000000 [ 2602.020570] x26: 0000000000000000 x25: ffff0000d728b330 x24: 0000000000000000 [ 2602.020577] x23: ffff0000dc856f38 [ 2602.033797] x22: ffff800089363b70 x21: ffff0000dc856000 [ 2602.033802] x20: ff00312e6f006573 x19: ffff0000d0d9ea80 x18: 0000000000000000 [ 2602.033809] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaaad80dd480 [ 2602.083320] x14: 0000000000000000 x13: 00000000000001b9 x12: 0000000000000002 [ 2602.083326] x11: 0000000000000000 x10: 0000000000000a60 x9 : ffff800089363a30 [ 2602.083333] x8 : ffff0001793d75c0 x7 : ffff0000d6dbc400 x6 : 0000000000000000 [ 2602.083339] x5 : 00000000410fd030 x4 : 0000000000000000 x3 : 0000000000000001 [ 2602.083346] x2 : 0000000000000000 x1 : 0000000000000001 x0 : ff00312e6f006573 [ 2602.083354] Call trace: [ 2602.083356] _raw_spin_lock+0x34/0x68 [ 2602.083364] release_firmware+0x48/0x6c [ 2602.083370] nxp_setup+0x3c4/0x540 [btnxpuart] [ 2602.083383] hci_dev_open_sync+0xf0/0xa34 [ 2602.083391] hci_dev_open+0xd8/0x178 [ 2602.083399] hci_sock_ioctl+0x3b0/0x590 [ 2602.083405] sock_do_ioctl+0x60/0x118 [ 2602.083413] sock_ioctl+0x2f4/0x374 [ 2602.091430] __arm64_sys_ioctl+0xac/0xf0 [ 2602.091437] invoke_syscall+0x48/0x110 [ 2602.091445] el0_svc_common.constprop.0+0xc0/0xe0 [ 2602.091452] do_el0_svc+0x1c/0x28 [ 2602.091457] el0_svc+0x40/0xe4 [ 2602.091465] el0t_64_sync_handler+0x120/0x12c [ 2602.091470] el0t_64_sync+0x190/0x194
--- drivers/bluetooth/btnxpuart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/bluetooth/btnxpuart.c +4 -2
@@ -612,8 +612,10 @@ static int nxp_download_firmware(struct &nxpdev->tx_state), msecs_to_jiffies(60000)); -release_firmware (nxpdev->fw); -memset (nxpdev->fw_name,0 ,sizeof (nxpdev->fw_name)); +if (nxpdev->fw &&strlen (nxpdev->fw_name)) { +release_firmware (nxpdev->fw); +memset (nxpdev->fw_name,0 ,sizeof (nxpdev->fw_name)); + }if (err ==0 ) { bt_dev_err(hdev, "FW Download Timeout. offset: %d",
Greg Kroah-Hartman
maintainerPATCH 138/143 drm/fbdev-dma: Support struct drm_driver.fbdev_probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 8998eedda2539d2528cfebdc7c17eed0ad35b714 upstream.
Rework fbdev probing to support fbdev_probe in struct drm_driver and reimplement the old fb_probe callback on top of it. Provide an initializer macro for struct drm_driver that sets the callback according to the kernel configuration.
This change allows the common fbdev client to run on top of DMA- based DRM drivers.
--- drivers/gpu/drm/drm_fbdev_dma.c | 60 ++++++++++++++++++++++++---------------- include/drm/drm_fbdev_dma.h | 12 ++++++++ 2 files changed, 48 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_fbdev_dma.c +36 -24
@@ -106,6 +106,40 @@ static const struct fb_ops drm_fbdev_dmastatic int drm_fbdev_dma_helper_fb_probe (struct drm_fb_helper *fb_helper,struct drm_fb_helper_surface_size *sizes) { +return drm_fbdev_dma_driver_fbdev_probe (fb_helper, sizes); +} + +static int drm_fbdev_dma_helper_fb_dirty (struct drm_fb_helper *helper, +struct drm_clip_rect *clip) +{ +struct drm_device *dev = helper->dev; +int ret; + +/* Call damage handlers only if necessary */ +if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) +return 0 ; + +if (helper->fb->funcs->dirty) { + ret = helper->fb->funcs->dirty (helper->fb,NULL ,0 ,0 , clip,1 ); +if (drm_WARN_ONCE (dev, ret,"Dirty helper failed: ret=%d\n" , ret)) +return ret; + } + +return 0 ; +} + +static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = { + .fb_probe = drm_fbdev_dma_helper_fb_probe, + .fb_dirty = drm_fbdev_dma_helper_fb_dirty, +}; + +/* +* struct drm_fb_helper +*/ + +int drm_fbdev_dma_driver_fbdev_probe (struct drm_fb_helper *fb_helper, +struct drm_fb_helper_surface_size *sizes) +{struct drm_client_dev *client = &fb_helper->client;struct drm_device *dev = fb_helper->dev;bool use_deferred_io = false;
@@ -148,6 +182,7 @@ static int drm_fbdev_dma_helper_fb_probe goto err_drm_client_buffer_delete; } + fb_helper->funcs = &drm_fbdev_dma_helper_funcs; fb_helper->buffer = buffer; fb_helper->fb = fb;
@@ -211,30 +246,7 @@ err_drm_client_buffer_delete:drm_client_framebuffer_delete (buffer);return ret; } - -static int drm_fbdev_dma_helper_fb_dirty (struct drm_fb_helper *helper, -struct drm_clip_rect *clip) -{ -struct drm_device *dev = helper->dev; -int ret; - -/* Call damage handlers only if necessary */ -if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) -return 0 ; - -if (helper->fb->funcs->dirty) { - ret = helper->fb->funcs->dirty (helper->fb,NULL ,0 ,0 , clip,1 ); -if (drm_WARN_ONCE (dev, ret,"Dirty helper failed: ret=%d\n" , ret)) -return ret; - } - -return 0 ; -} - -static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = { - .fb_probe = drm_fbdev_dma_helper_fb_probe, - .fb_dirty = drm_fbdev_dma_helper_fb_dirty, -}; +EXPORT_SYMBOL (drm_fbdev_dma_driver_fbdev_probe);/* * struct drm_client_funcs
include/drm/drm_fbdev_dma.h +12 -0
@@ -4,12 +4,24 @@#define DRM_FBDEV_DMA_H struct drm_device ; +struct drm_fb_helper ; +struct drm_fb_helper_surface_size ;#ifdef CONFIG_DRM_FBDEV_EMULATION +int drm_fbdev_dma_driver_fbdev_probe (struct drm_fb_helper *fb_helper, +struct drm_fb_helper_surface_size *sizes); + +#define DRM_FBDEV_DMA_DRIVER_OPS \ + .fbdev_probe = drm_fbdev_dma_driver_fbdev_probe +void drm_fbdev_dma_setup (struct drm_device *dev,unsigned int preferred_bpp);#else static inline void drm_fbdev_dma_setup (struct drm_device *dev,unsigned int preferred_bpp) { } + +#define DRM_FBDEV_DMA_DRIVER_OPS \ + .fbdev_probe = NULL +#endif #endif