Skip to contentSkip to conversation

6.18.63-rc1 review

PATCH In review Greg Kroah-Hartman 11 participants 880 messages Nov 7 – Nov 9 Page 1 of 7

Subsystems (5)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 6.18.63-rc1 review

This is the start of the stable review cycle for the 6.18.63 release. There are 869 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 Mon, 09 Nov 2026 13:46:08 +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.18.63-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.18.y
and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 6.18.63-rc1

John Johansen <[email protected]>
apparmor: on failed load ensure profile files are removed before parent

John Johansen <[email protected]>
apparmor: fix uninitialized variable warning in aa_inherit_files

Joseph Qi <[email protected]>
ocfs2: read the xattr entry hash before defragmenting the bucket

Avi Weiss <[email protected]>
init/bootconfig: pass init arguments in documented order

Amir Goldstein <[email protected]>
fs: don't fail __d_obtain_alias() for unlinked inodes

Hungyu Lin <[email protected]>
fs: skip copy_file_range write limits when there is no data

Edvard Conrad <[email protected]>
fs: let backing files inherit FMODE_NONOTIFY from the user file

Daehyeon Ko <[email protected]>
splice: avoid stale f_pos writeback on error

Chris Mason <[email protected]>
iov_iter: fix NULL deref in iov_iter_alignment()

Christian Brauner <[email protected]>
backing-file: enforce append-only and immutable backing inodes

Chris Mason <[email protected]>
aio: fix NULL deref when a fault races ring truncation

Georgia Garcia <[email protected]>
apparmor: remove fs entries created by a failed policy load

Kyle Zeng <[email protected]>
tcp: fix reordering addition overflow in MTU probing

Kyle Zeng <[email protected]>
net/packet: check TX_RING fragments before memory accounting

Guanglei Zhu <[email protected]>
apparmor: check accept index + 1 is in bounds

Li RongQing <[email protected]>
apparmor: avoid potential double free when remapping DFA tables

John Johansen <[email protected]>
apparmor: fix refcount leak in aa_get_newest_profile()

Zhiling Zou <[email protected]>
tcp: check congestion control restriction first

Christian Brauner <[email protected]>
proc: don't let an entry below /proc/<pid>/net be a mountpoint

Kunhai Dai <[email protected]>
blk-iocost: abort weight transfer on invalid donation weights

Christian Brauner <[email protected]>
userns: don't drop the exec securebits

Josef Bacik <[email protected]>
mount: refuse setns() with a shared fs_struct again

Linmao Li <[email protected]>
r8152: Use BMSR to detect the link state

Georgia Garcia <[email protected]>

    apparmor: don't revalidate inherited files under files->file_lock

Maxime Bélair <[email protected]>

    apparmor: fix NULL ctx->peer derefs in unix socket ctx updates

Yongjian Wang <[email protected]>
Revert "net: advertise TCP MSS from the configured MTU, not the learned PMTU"

Avi Weiss <[email protected]>
irqchip/irq-msi-lib: Free wired MSI descriptors

Avi Weiss <[email protected]>
irqchip/riscv-imsic: Report successful hardware retrigger

Eric Biggers <[email protected]>

    fsverity: Be more careful with return value of ->get_verity_descriptor()

Fang Xieyan <[email protected]>
kgdb: Fix buffer overflow in the qRcmd packet handler

Fang Xieyan <[email protected]>
kgdb: Fix buffer overflow in the 'M' and 'X' packet handlers

Fang Xieyan <[email protected]>
kgdb: Fix buffer overflow in the 'm' packet handler

Guixin Liu <[email protected]>
nvmet: Free the old negotiation state when restarting authentication

Guixin Liu <[email protected]>
nvmet: Finish the blk plug when integrity allocation fails

Seiji Nishikawa <[email protected]>
nvme-tcp: fix io_work priority inversion when send_mutex is held

Martin Belanger <[email protected]>
nvme-tcp: start error recovery when read_sock fails

Guixin Liu <[email protected]>
nvmet-fc: Tear down the association when the admin queue allocation fails

Shao Mingyin <[email protected]>
nvmet-auth: fix error handling on CHALLENGE failure

Andrea Parri <[email protected]>
nvmet: pci-epf: require SGLs to match the command data length

Andrea Parri <[email protected]>
nvmet: pci-epf: report transport errors in command completions

Andrea Parri <[email protected]>
nvmet-fc: only send read data for successful commands

Weiming Shi <[email protected]>
nvmet-rdma: reject short connection requests

Tristan Madani <[email protected]>
ppp: fix stale pointer access after pskb_may_pull in ppp_ccp_peek

Peter Ujfalusi <[email protected]>
ASoC: hdac_hda: Keep runtime PM state in sync across codec remove/probe

Hongling Zeng <[email protected]>
ntfs3: fix mapping pairs bounds check for alignment

Hyeontae Lee <[email protected]>

    fs/ntfs3: bound DeleteAttribute asize against rec->used in do_action

Hyeontae Lee <[email protected]>
fs/ntfs3: bound CreateAttribute asize against record_size in do_action

David Yang <[email protected]>
net: hisilicon: hisi_femac: Stop the receiver before releasing the RX ring

Xia Yan <[email protected]>
macvlan: fix passthru promiscuity accounting while down

Kamil Sawicki <[email protected]>
net: limit priority VLAN untag depth

Jesse Zhang <[email protected]>
drm/amdkfd: evict the queues only once for CRIU PROCESS_INFO

Jiale Yao <[email protected]>
drm/amdkfd: validate SRAT subtables before parsing

Avi Weiss <[email protected]>
drm/amd/display: Initialize missing TD-LUT programming inputs

Jesse Zhang <[email protected]>
drm/amdkfd: split vram_pages of SVM ranges prefetched without a GPU mapping

Jesse Zhang <[email protected]>
drm/amdgpu: reject CS chunks too large for kvmalloc()

Luigi Lauro <[email protected]>
drm/amd/display: take a runtime PM reference only when a CRTC turns on

Olivier Kaloudoff <[email protected]>
drm/amdkfd: stop restore retries on device unplug

lvyating <[email protected]>
perf machine: Fix NULL deref in thread__resolve_callchain_sample()

Zhao Gongyi <[email protected]>
arm64/mm: restrict transparent contpte mappings to valid PTEs

Zhongqiu Han <[email protected]>
cpufreq: stats: Fix potential out-of-bounds access in deferred reset

Tiezhu Yang <[email protected]>
LoongArch: Fix perf hardware breakpoint failure via installation

Tiezhu Yang <[email protected]>
LoongArch: Only send SIGTRAP signal if necessary in do_watch()

Tiezhu Yang <[email protected]>
LoongArch: Fix architectural naming typo for CSR_FWPS_SKIP

Tiezhu Yang <[email protected]>
LoongArch: Fix bitmask corruption in update_bp_registers()

Tiezhu Yang <[email protected]>
LoongArch: Remove redundant call in update_bp_registers()

Tiezhu Yang <[email protected]>
LoongArch: Remove arch-specific __smp_mb__{before,after}_atomic()

Huacai Chen <[email protected]>
LoongArch: Use pa_to_nid()/nid_to_addrbase() rather than hard-code

Huacai Chen <[email protected]>
LoongArch: Call cpu_final_simd() with pure_initcall()

Peter Ujfalusi <[email protected]>
ASoC: hdac_hda: Balance the runtime PM disable in codec remove

Eric Dumazet <[email protected]>
ixgbe: reserve TX timestamp after skb preparation

Peter Ujfalusi <[email protected]>
ALSA: hda: Reject codec reset on ASoC (ext_ops) buses

Sinan Turunc <[email protected]>
ALSA: usb-audio: Bound packet copies by the PCM buffer size

Dominik Maier <[email protected]>
loop: check for read-write open mode on LOOP_SET_STATUS in lo_compat_ioctl()

Paul Moses <[email protected]>
xsk: restore UMEM flags after failed pool assignment

Yingjie Wang <[email protected]>
tcp: limit tcp_tso_rtt_log to a valid shift count

Miquel Raynal <[email protected]>
dt-bindings: clock: ma35d1: Document the missing crystal inputs

Ido Schimmel <[email protected]>
ipmr: fully initialize the synthetic IP header in ipmr_get_route()

Jiayuan Chen <[email protected]>
bonding: fix out-of-bounds read of arp_ip_target

Wei Jie Law <[email protected]>
net: usb: pegasus: check rx pkt_len against the received length

Srinivas Kandagatla <[email protected]>
ASoC: codecs: wsa883x: Accept temperatures across the full trim range

Srinivas Kandagatla <[email protected]>
ASoC: codecs: wsa884x: Accept temperatures across the full trim range

Val Packett <[email protected]>
ASoC: qcom: qdsp6: q6afe: fix clk vote response type mismatch

Chao Yu <[email protected]>
f2fs: fix to update superblock crc in sanity_check_area_boundary()

Alex Markuze <[email protected]>
ceph: fix uninitialized err in ceph_netfs_issue_read()

sung byeongchan <[email protected]>
ceph: validate encoded xattr name lengths

sung byeongchan <[email protected]>
ceph: validate MDS reply fragtree split array length

sung byeongchan <[email protected]>
ceph: bound name skips in ceph_mdsmap_decode() by the message end

sung byeongchan <[email protected]>
ceph: validate fscrypt auth blob length

Venky Shankar <[email protected]>
ceph: don't fail write_begin with -EAGAIN after flushing old snapc

Yuanfu Xie <[email protected]>
ceph: clamp MDS reply result code to the errno range

Jérémy Jean <[email protected]>
libceph: fix out-of-bounds reads from repeated CRUSH bucket entries

Jérémy Jean <[email protected]>
ceph: fix 32-bit overflow in readdir reply count check

Wentao Liang <[email protected]>
ceph: Fix mds session leak in __open_export_target_session()

Wentao Liang <[email protected]>
ceph: Fix xattr buffer leak in __send_cap()

Xiang Mei <[email protected]>
ceph: fix integer overflow in the snap trace bounds check

Yogesh Gaur <[email protected]>
libceph: reject an initial monmap with no monitors

Felix Hoffmann <[email protected]>
libceph: reject mismatched CRUSH weight-set sizes

Raphael Zimmer <[email protected]>
libceph: Fix multiple unsafe decodes in ceph_oloc_decode()

Raphael Zimmer <[email protected]>
libceph: Fix unsafe decode in ceph_redirect_decode()

Xiubo Li <[email protected]>
libceph: only set read_from_replica on read requests

Xiang Mei <[email protected]>
ceph: require the dentry lease record to cover struct ceph_mds_reply_lease

Xiang Mei <[email protected]>
ceph: reject mdsmaps that claim more than CEPH_MAX_MDS ranks

Guanglei Zhu <[email protected]>
ceph: fix out-of-bounds read in ceph_netfs_issue_op_inline()

Max Kellermann <[email protected]>
ceph: avoid pending truncate during nonblocking cap acquire

Fuad Tabba <[email protected]>
KVM: arm64: Set HCR_EL2.BSU to Inner Shareable for guests

Hungyu Lin <[email protected]>
time/namespace: Fix overflow when converting absolute deadlines

Hungyu Lin <[email protected]>
timers/itimer: Keep a nonzero value at CPU timer expiry

Wang Haoran <[email protected]>
fbdev: atmel_lcdfb: fix list_first_entry() on possibly empty modelist in probe

Baokun Li <[email protected]>
fscrypt: Fix missing barrier in fscrypt_find_mode_key()

Siddharth Chintamaneni <[email protected]>

    mm: multi-gen LRU: fix NULL lruvec->pgdat deref with memcg disabled on cmdline

Yunhui Cui <[email protected]>
riscv: mm: exclude invalid THP PMDs from page table check

Gregory Price (Meta) <[email protected]>
mm/mempolicy: apply bind policies against the scoped allocation zone

Gregory Price (Meta) <[email protected]>
mm/vmscan: reclaim every zone in per-node proactive reclaim

Lorenzo Stoakes (ARM) <[email protected]>
mm/mremap: correctly uncharge accountable VMAs in error path

Lorenzo Stoakes (ARM) <[email protected]>
mm/mremap: populate calculated fields in vrm state correctly

Nickolai Zeldovich <[email protected]>
mm/truncate: fix the zeroing end of pagecache_isize_extended()

Rik van Riel <[email protected]>
mm/page_alloc: count guard pages as free again when their buddy merges

Jiayuan Chen <[email protected]>
mm/swap: fix swap_cache_get_folio() returning a folio that left the swap cache

Vernon Yang <[email protected]>
mm: vmscan: don't count per-node proactive reclaim as memory pressure

Weilin Tong <[email protected]>
ipc/shm: fix RSS accounting for hugetlb shared memory

Pedro Falcato <[email protected]>
mm/madvise: atomically clear the young bit on THP MADV_COLD

Harry Yoo (Meta) <[email protected]>
mm/percpu: account full object size for percpu memory allocations

Cen Zhang (Microsoft) <[email protected]>
userfaultfd: fix UFFDIO_MOVE livelock on large folio with extra references

Nickolai Zeldovich <[email protected]>
mm/mlock: use a long for the page count in mlock_fixup()

Wei Yang <[email protected]>
mm/madvise: add cond_resched() in THP branch of madvise_cold_or_pageout_pte_range()

David Hildenbrand (Arm) <[email protected]>
mm: disallow ioremap'ing ordinary RAM in generic_access_phys()

Hongfu Li <[email protected]>
mm/hugetlb: account migration target folio in per-node NR_HUGETLB vmstat

David Hildenbrand (Arm) <[email protected]>
mm/mremap: fix calling fixup_hugetlb_reservations() on the wrong VMA

Josef Bacik <[email protected]>
mm/hugetlb: don't clear the resv_map of a VMA whose lock is held

Cen Zhang <[email protected]>
ocfs2/cluster: remove zero-address nodes from IP tree on teardown

Cen Zhang <[email protected]>
ocfs2: snapshot the dentry name while tracing file release

Caleb Kan <[email protected]>
stackdepot: stop preallocating after the final pool

Hungyu Lin <[email protected]>
compat: avoid double rounding in times()

Stanley Jhu <[email protected]>
scsi: ufs: core: Remove completed-without-interrupt path in ufshcd_abort()

Stanley Jhu <[email protected]>
scsi: ufs: core: Remove an always-false WARN_ONCE()

Ratnaker Gautam <[email protected]>
scsi: libiscsi_tcp: Prevent R2T range check overflow

Stanley Jhu <[email protected]>
scsi: ufs: core: Clear stale UIC result byte before peer DME retries

Stanley Jhu <[email protected]>
scsi: ufs: bsg: Clear the reply buffer before use

Stanley Jhu <[email protected]>
scsi: ufs: bsg: Complete the job on error

yanxia <[email protected]>
veth: fix stale peer max_mtu on XDP program replacement

Igor Velkov <[email protected]>
genirq/kexec: Do not take the bus lock of an interrupt chip on the crash path

Aamir Ahmed <[email protected]>
gve: fix out-of-bounds read in gve_get_flow_rule_entry()

Sasha Levin <[email protected]>
cgroup: don't kill migrated processes through their exiting threads

Thomas Weißschuh (Schneider Electric) <[email protected]>
timekeeping: Update offsets on sequence counter retry in ktime_get_update_offsets_now()

Cen Zhang (Microsoft) <[email protected]>
posix-cpu-timers: Fix pid refcount leak in do_cpu_nanosleep() signal path

Pufan Jin <[email protected]>
spi: zynq-qspi: fix address buffer corruption and support 4-byte address

Christian Marangi <[email protected]>
i2c: mt7621: fix copying uninitialized kernel stack with reduced page_len

Alex Kazinsky <[email protected]>
ASoC: tlv320aic32x4: Prevent division by zero in divider callbacks

Jean Delu <[email protected]>
parisc: eisa_enumerator: Fix out-of-bounds reads of the EEPROM buffer

Adrian Ambrozewicz <[email protected]>
gpiolib: don't report -ENOMEM for a requested line without a label

Pei Xiao <[email protected]>
tpm: fix zero-length read discarding the pending response

Pei Xiao <[email protected]>
tpm: tpm_nsc: stop using the cleanup callback as dev.release

Pei Xiao <[email protected]>
tpm: tpm_nsc: fix NULL pointer dereference on init failure

Navon John Lukose <[email protected]>
i2c: designware: queue only one read command for block reads

Ma Ke <[email protected]>
i2c: acpi: Fix adapter reference leak in i2c_acpi_new_device_by_fwnode()

Tristan Madani <[email protected]>
cpufreq: intel_pstate: cancel HWP notify work in driver cleanup

Nickolai Zeldovich <[email protected]>
ucount: take the rlimit reference before checking the limit

Christian Brauner <[email protected]>
listmount: don't wrap around with a U64_MAX cursor

Christian Brauner <[email protected]>
statmount: don't copy the reserved empty string past the buffer

Chuck Lever <[email protected]>
exportfs: Release the get_name() directory file synchronously

Henry Martin <[email protected]>
tipc: fix broadcast sender hang on last acker departure

Liu Chao <[email protected]>
net: wwan: iosm: validate msg_head before indexing msg_ring

Yu Zhang <[email protected]>

    nvmet: take subsys->lock while force-reconnecting in nvmet_subsys_attr_qid_max_store()

Runyu Xiao <[email protected]>
sh: maple: Use the matching IRQ cookie when invoking free_irq()

Henrik Enquist <[email protected]>
ALSA: aloop: Update the PCM Slave controls for a matching playback

Julian Sun <[email protected]>
writeback: clear old wb dirty state after inode switches

Julian Sun <[email protected]>
writeback: reset dirtied_when when switching wbs

Bartu Alev <[email protected]>
platform/x86: asus-wmi: fix TUF keyboard power state shutdown naming

Michael Kelley <[email protected]>
Documentation: hyperv: Update documentation for sending VMBus packets

Cen Zhang <[email protected]>
ocfs2/cluster: initialize heartbeat regions before publishing them

Joseph Qi <[email protected]>
ocfs2: deal with legacy signed xattr name hash values

Joseph Qi <[email protected]>
ocfs2: use the stored hash when checking xattr bucket collision

Joseph Qi <[email protected]>
ocfs2: deal with legacy signed dir index name hash values

Joseph Qi <[email protected]>
ocfs2: reserve value tree metadata when moving an xattr into the inode

Joseph Qi <[email protected]>
ocfs2: reserve metadata for a new xattr block and its value tree

Matt Turner <[email protected]>
alpha: determine tininess after rounding in the FP emulation

Bryam Vargas <[email protected]>
net/smc: queue the copied chunk when smc_tx_sendmsg() faults

Yingjie Wang <[email protected]>
net: unix: reject negative max_dgram_qlen values

Nguyen Ngoc Thang <[email protected]>
net/rds: ib: don't enable IRQs in rds_ib_conn_free()

Guangshuo Li <[email protected]>
PCI: qcom-ep: Deinitialize endpoint on remove

Tingjie Zhong <[email protected]>
fbdev: bitblit: Fix glyph clipping when fbcon pans

Daehyeon Ko <[email protected]>
ipv6: do not restart DAD for a dead ifaddr

Daehyeon Ko <[email protected]>
ipv6: initialize temporary ifaddr before publication

Daehyeon Ko <[email protected]>
ipv6: serialize address publication with device teardown

Daehyeon Ko <[email protected]>
ipv6: remove ifaddr from hash during ifdown list cleanup

Zhen Han <[email protected]>
drm/amdkfd: correct vram_available calculation

Daniel Phillips <[email protected]>
amdkfd: Fix memory availability double accounting of kfd pinned objects

John Fisher <[email protected]>
drm/amdgpu: wait for pending page table updates before switching a VM to CPU updates

William Palacek <[email protected]>
drm/amdkfd: wait for a GPU reset before freeing a BO

Keita Morisaki <[email protected]>
drm/amd/display: Fix swap in median3() for DSC rate control

Elena Sakhnovitch <[email protected]>
drm/amdgpu/gmc9: add extra type-2 TLB flush for gfx942/gfx950

Jesse Zhang <[email protected]>
drm/amdkfd: don't drop an SVM CWSR reference that was never taken

Kevin Wang <[email protected]>
drm/amd/pm: reapply umd profile state after recovery

Jesse Zhang <[email protected]>
drm/amdgpu: reject ANONONLY userptrs that span multiple VMAs

Mario Limonciello <[email protected]>
drm/amd/display: don't WARN when removing an unallocated MST payload

Henry Martin <[email protected]>
drm/amdkfd: fix doorbell allocation race creating duplicate allocations

Maciej Kucharek <[email protected]>
drm/amdgpu: reset VI ASIC on Apple boards with VRAM at 0

Maciej Kucharek <[email protected]>
drm/amdgpu: reset CIK ASIC on Apple boards with VRAM at 0

Maciej Kucharek <[email protected]>
drm/amdgpu: reset SI ASIC on MacBookPros with VRAM at 0

Luigi Lauro <[email protected]>
drm/amdgpu: require _PR3 for BOCO

Nirmoy Das <[email protected]>
blk-mq: clear stale inactive flag on hctx reuse

Sahaj Chaudhari <[email protected]>
gpio: pca953x: Handle direction register read errors in IRQ paths

Sahaj Chaudhari <[email protected]>
gpio: davinci: Clear interrupt status in every bank on suspend

Takashi Iwai <[email protected]>
ALSA: line6: Handle period elapsed calls outside the locks

Baek Kyu, Kim <[email protected]>
gpiolib: Free chip resources when allocating the label fails

Takashi Iwai <[email protected]>
ALSA: emux: Stop voices before freeing zones in all cases

Wang Yan <[email protected]>
ALSA: mtpav: restore negation dropped in guard() conversion

Peter Ujfalusi <[email protected]>
ALSA: compress: reject restarting an ACTIVE task via origin_seqno

Peter Ujfalusi <[email protected]>
ALSA: compress: add missing OPEN-state gate to SET_METADATA

Peter Ujfalusi <[email protected]>
ALSA: compress: reject buffer geometry change on gapless next_track

Peter Ujfalusi <[email protected]>
ALSA: compress: fix buffer leak on failed SET_PARAMS

Sorah Fukumori <[email protected]>
net: gro: don't chain linear parts larger than gso_size into frag_list

Jamal Hadi Salim <[email protected]>
netdevsim: reject cls_bpf programs bound to another device

Kir Kolyshkin <[email protected]>
cgroup: fix cgroup.kill for exited thread group leader

Alexander Kochetkov <[email protected]>
Revert "Input: matrix_keypad - force switch rows to input mode"

Dmitry Torokhov <[email protected]>
Input: always accept EV_SYN in input_event()

Armin Wolf <[email protected]>
hwmon: (acpi_power_meter) Fix 18.45 TW bug

Baek Kyu, Kim <[email protected]>
hwmon: (sht3x) Return the consumed count for heater writes

Igor Velkov <[email protected]>
rtc: pcf8563: pass the driver data to the alarm interrupt handler

Ma Ke <[email protected]>
platform/x86/amd/pmc: Fix RTC reference leak in amd_pmc_verify_czn_rtc()

Gregory Price <[email protected]>
rtc: cmos: Disable ACPI RTC event before handling it

Jianyun Gao <[email protected]>
dax: fix wrong error code returned from dax_dedupe_file_range_compare()

Seongjae Jeong <[email protected]>
f2fs: fix submit accounting for IPU writeback

Wenjie Qi <[email protected]>
f2fs: flush SIT journal during filesystem resize

Jiale Yao <[email protected]>
hwmon: (gigabyte_waterforce) reject short input reports

Ximing Zhang <[email protected]>
hwmon: (coretemp) Fix handling of isolated SMT siblings

Kyle Zeng <[email protected]>
netfilter: nf_reject: initialize IPCB at inet ingress

George Christidis <[email protected]>
ALSA: hda/realtek: Fix headset mic on ASUS Zenbook 14 UX3402VA

Adrian Ambrozewicz <[email protected]>
gpiolib: cdev: don't set GPIOD_FLAG_IS_OUT

Nickolai Zeldovich <[email protected]>
lib/buildid: reject file offsets that do not fit in pgoff_t

Sanan Hasanov <[email protected]>
hwmon: (corsair-cpro) Make wait_input_report_lock IRQ safe

Baek Kyu, Kim <[email protected]>
hwmon: (sht4x) Reject incomplete heater command transfers

Tom Verdonck <[email protected]>
hwmon: (sht4x) Fix jiffies wraparound in heater-ready check

Weibin Liu <[email protected]>
spi: ch341: handle transfers without a TX or RX buffer

Vasiliy Kovalev <[email protected]>
ALSA: hda/via: Apply runtime PM workaround for ASUS X55A

Magnus Lindholm <[email protected]>
alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms

Magnus Lindholm <[email protected]>
alpha: do not clear remote MMU contexts in migrate_flush_tlb_page()

Magnus Lindholm <[email protected]>
alpha: invalidate the local context in flush_icache_user_page()

Magnus Lindholm <[email protected]>
alpha: invalidate the local context in flush_tlb_mm()

Magnus Lindholm <[email protected]>
alpha: fix the local TLB invalidate in the UP flush_tlb_page()

Magnus Lindholm <[email protected]>
alpha: fix the local TLB invalidate in flush_tlb_page()

Magnus Lindholm <[email protected]>
alpha: invalidate the local context in flush_tlb_page()

Magnus Lindholm <[email protected]>
alpha: only use a targeted tbi() when the target mm is really current

Magnus Lindholm <[email protected]>
alpha: run check_mmu_context() from finish_arch_post_lock_switch()

Magnus Lindholm <[email protected]>
alpha: load the MMU context when switch_mm() switches the current task

Matt Turner <[email protected]>
alpha: handle VM_FAULT_HWPOISON in do_page_fault()

Brandon Williams <[email protected]>
power: supply: qcom_battmgr: Notify charger supplies of online changes

Tim Douglas <[email protected]>
power: supply: generic-adc-battery: fix status with no supplier

Andrew Pam <[email protected]>
power: supply: cros_charge-control: restore EC state on resume

Fabricio Akio <[email protected]>
power: supply: qcom_smbx: set the charge enable after software control

Luis Gerardo Lopez Hernandez <[email protected]>
ALSA: hda/realtek: Fix internal speakers on Acer Aspire AL16-31P

Takashi Iwai <[email protected]>
ALSA: seq: oss: Skip events until fully initialized

Paolo Abeni <[email protected]>
mptcp: fix subflow bitfield misuse

Quanye Yang <[email protected]>
mptcp: reset msk state on early connect failure

Kees Cook <[email protected]>
ipc, msg: Account msg_msg allocations with GFP_KERNEL_ACCOUNT again

sonotri <[email protected]>
ublk: pin module while release work is pending

Chengfeng Ye <[email protected]>
fuse: fix copy_file_range reply handling race

Fan Wu <[email protected]>

    virtio_fs: read the vring size under virtio_fs_mutex in ->get_tree

Joanne Koong <[email protected]>
fuse: don't launder folios of a bad inode

Huacai Chen <[email protected]>
cpufreq: loongson3: Replace IOCSR read/write with MMIO ones

Huacai Chen <[email protected]>
cpufreq: loongson3: Use global physical CPU ID in get/target callbacks

Huacai Chen <[email protected]>
cpufreq: loongson3: Replace per-package mutex with per-node

Huacai Chen <[email protected]>
cpufreq: loongson3: Adjust the width of id and val in smc_message

Huacai Chen <[email protected]>
cpufreq: loongson3: Make this driver depend on MACH_LOONGSON64

Shubham Antil <[email protected]>
RDS/IB: validate receive fragment completions

Seung Min Shin <[email protected]>
sctp: hold transport reference across connect wait

Zixuan Chai <[email protected]>
ipv6: defrag: orphan skb before queuing

Josef Bacik <[email protected]>
net: skbuff: don't BUG() on a bad csum_start in skb_copy_and_csum_dev()

Ming Lei <[email protected]>

    ublk: reset the FETCH round under ub->mutex

Ming Lei <[email protected]>
ublk: reset the FETCH round in release also without a disk

Jianyun Gao <[email protected]>
dax: fix dax_range_compare_iter() to use correct size and address offset

Jianyun Gao <[email protected]>
dax: Return errors from dax_core_init()

David Carlier <[email protected]>
ring-buffer: Take cpus_read_lock() when changing the subbuf order

Gyokhan Kochmarla <[email protected]>
erofs: use on-disk blkszbits for lz4 max pcluster bound

Weibin Liu <[email protected]>

    spi: amd: fix len==0 underflow and FIFO overflow

Keng-Yu Lin <[email protected]>
PCI/PM: Restore BARs after powering up during enumeration

Weibin Liu <[email protected]>
spi: bcm-qspi: reject oversized dummy bytes in mspi exec_mem_op

Vladyslav Tymoshchuk <[email protected]>
ASoC: qcom: q6apm: reset the hw pointer with the fragment queue

Radiy Zhambakiev <[email protected]>
mfd: tps65217: Use devres for IRQ domain and wake teardown

Radiy Zhambakiev <[email protected]>
mfd: tps65217: Check return value when masking interrupt sources

Radiy Zhambakiev <[email protected]>
mfd: tps65217: Fix NULL pointer dereference on IRQ init failure

Weibin Liu <[email protected]>
spi: npcm-fiu: limit UMA data_size to the 16-byte staging buffer

Marc Zyngier <[email protected]>

    KVM: arm64: Turn vcpu->arch.pause into a counter

Marc Zyngier <[email protected]>
KVM: arm64: Move IN_GUEST_MODE ahead of state being loaded

Marc Zyngier <[email protected]>
KVM: arm64: Move OUTSIDE_GUEST_MODE publication past context being saved

Ard Biesheuvel <[email protected]>
efi/libstub: Don't replace an existing LINUX_EFI_MEMRESERVE table

Ard Biesheuvel <[email protected]>
efi/libstub: arm64: Don't use the platform register x18

Weibin Liu <[email protected]>
spi: jcore: fix divide-by-zero when speed_hz is zero

Tal Zussman <[email protected]>
gfs2: fix the escaped block copy in gfs2_before_commit()

Takashi Iwai <[email protected]>
ALSA: ump: Correct return size of fill_rpn()

Karl Mehltretter <[email protected]>
irqchip/atmel-aic[5]: Disable interrupts in the irq_pm_shutdown() callbacks

Wentao Liang <[email protected]>
irqchip/mchp-eic: Fix clock reference leak in mchp_eic_probe()

Guangshuo Li <[email protected]>
irqchip/imx-intmux: Fix runtime PM teardown on remove

Fuad Tabba <[email protected]>
irqchip/gic-v3-its: Don't clamp nvecs to zero when id_bits is 32

Ahsan Atta <[email protected]>
crypto: qat - fix use of destroyed vf2pf_lock on VF restart

Ahsan Atta <[email protected]>
crypto: qat - initialise state_lock on every path in adf_devmgr_add_dev()

Andrea Parri <[email protected]>
iommufd: Reject a zero-length dirty bitmap request

Nathan Chancellor <[email protected]>
kbuild: AutoFDO: Update split machine function argument for upstream rename

Wentao Liang <[email protected]>
PCI: xilinx-xdma: Fix device node reference leak in xilinx_pl_dma_pcie_init_irq_domain()

Hui Su <[email protected]>
cpufreq: schedutil: Serialize sugov_start() against rate limit updates

Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Use default TxWindow for zero socket option

Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Reject invalid TxWindow in configuration requests

Siwei Zhang <[email protected]>
Bluetooth: L2CAP: Reject mode changes on connected channels

Bui Viet Dung <[email protected]>
Bluetooth: hci_debugfs: Pin module for debugfs file operations

Bui Viet Dung <[email protected]>
Bluetooth: 6lowpan: Pin module for 6lowpan_control debugfs file

Nikolaj Klitlund Børty <[email protected]>
Bluetooth: btusb: Add device ID for Realtek RTL8761BUE (StarTech AV53C1)

Francesco Orlando <[email protected]>
Input: xpad - add GameSir Nova Lite support

Stian Halseth <[email protected]>
PCI: Set supported_speeds in set_pcie_port_type()

Karl Mehltretter <[email protected]>
ARM: 9523/1: topology: allocate the cacheinfo early on the boot CPU

Karl Mehltretter <[email protected]>
ARM: 9522/1: cacheinfo: guard the CLIDR read in populate_cache_leaves()

Karl Mehltretter <[email protected]>
ARM: 9521/1: cacheinfo: count external caches in early_cache_level()

Karl Mehltretter <[email protected]>
ARM: 9520/1: cacheinfo: avoid out-of-bounds write in populate_cache_leaves()

Karl Mehltretter <[email protected]>
ARM: 9491/1: alignment: restore uaccess state on emulation fault

Karl Mehltretter <[email protected]>
ARM: 9488/1: smp: set current pointer in assembly before jumping into C

Weibin Liu <[email protected]>
spi: cadence-xspi: fix stack buffer overflow in the Marvell b0 path

Martin Belanger <[email protected]>
nvme: make the DH-HMAC-CHAP secret attributes readable by root only

Matt Fleming <[email protected]>
iommu/amd: Don't allocate kdump device table from DMA32

Matt Fleming <[email protected]>
iommu/amd: Program device table when kdump reuse fails

Tim Douglas <[email protected]>
serial: pmac_zilog: push received data to the port that received it

Nicolai Buchwitz <[email protected]>
serial: amba-pl011: keep transmitter enabled when disabling RS485

Nicolai Buchwitz <[email protected]>
serial: amba-pl011: honour delay_rts_before_send for every write

Jiri Slaby (SUSE) <[email protected]>

    serial: 8250_omap: set priv->line before enabling the IRQ

Jiri Slaby (SUSE) <[email protected]>
serial: 8250_lpss: do not touch uninitialized line in ehl_serial_exit()

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: NUL-terminate the SPM auth token

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: allow clearing current_password

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: return -E2BIG from validate_password_input()

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: fix non-ASCII truncation in hp_get_string_from_buffer()

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: fix OOB reads in hp_get_string_from_buffer()

Denis Arefev <[email protected]>
ALSA: cs46xx: fix unit mismatch in DSP code area bounds check

Aaron Erhardt <[email protected]>
platform/x86/tuxedo: Fix keyboard LED map ordering

Gergo Koteles <[email protected]>
ALSA: hda/tas2781: Skip invalid TAS2563 UEFI calibration data

Kazuki Hanai <[email protected]>
tmpfs: fix unicode_map leaks in casefold option handling

Aamir Ahmed <[email protected]>
lib: decompress_bunzip2: fix integer overflow in run-length decoding

Bradley Morgan <[email protected]>
panic: flatten nmi_panic control flow

Matt Turner <[email protected]>
lib/decompress_bunzip2: fix off-by-one in run-length bounds check

Ma Ke <[email protected]>
pinctrl: stm32: Fix fwnode reference leak in stm32_gpiolib_register_bank()

Weibin Liu <[email protected]>
spi: ljca: validate the response length before copying the data

Daeho Jeong <[email protected]>
f2fs: disallow mmap write and data-modifying fallocate on atomic files

Zhan Xusheng <[email protected]>
f2fs: fix defragment writeback range truncation on 32-bit

Kaixuan Li <[email protected]>

    f2fs: check every cur_*_segno[] entry on readonly images

Nanzhe Zhao <[email protected]>
f2fs: read i_size once in f2fs_vm_page_mkwrite

Joanne Chang <[email protected]>
f2fs: allow pinning empty compressed files

Nanzhe Zhao <[email protected]>
f2fs: remove mappedtodisk flag usage in mmap write path

Karl Mehltretter <[email protected]>
sh: intc: Sort the prio and sense lists after filling them

Geraldo Nascimento <[email protected]>
PCI: rockchip: Drive at 2.5 GT/s, error other speeds

Geraldo Nascimento <[email protected]>
PCI: rockchip-host: Do not attempt 5.0 GT/s retraining

Geraldo Nascimento <[email protected]>
PCI: rockchip-ep: Do not attempt 5.0 GT/s retraining

Daeho Jeong <[email protected]>
f2fs: convert inline quota files when turning quota on

Andrea Parri <[email protected]>
nvmet: zns: don't leak stale memory in zone management receive

Yehyeong Lee <[email protected]>
nvme: bound FDP config log reads to the received buffer

Sung Byeongchan <[email protected]>
nvmet: require authentication before property set

Jérémy Jean <[email protected]>
nvmet: free the bvec on file namespace range errors

Yehyeong Lee <[email protected]>
nvme-auth: fail when the controller does not authenticate itself

Daejun Park <[email protected]>
nvmet: fix preempt of another registrant by the reservation holder

Yehyeong Lee <[email protected]>
nvme-rdma: don't complete a request after a bogus remote invalidation

Andrea Parri <[email protected]>
iomap: don't lose a fiemap iteration error when emitting the last extent

Kathiravan Thirumoorthy <[email protected]>
clk: qcom: ipq5332: add 24MHz rate for USB UTMI clock

Kathiravan Thirumoorthy <[email protected]>
clk: qcom: ipq5018: add 24MHz rate for USB UTMI clock

Aamir Ahmed <[email protected]>
clk: qcom: ipq-cmn-pll: Assign .num before accessing .hws

Samuel Thibault <[email protected]>
speakup: Fix NULL pointer dereference on VT switch + selection

Wentao Guan <[email protected]>
mei: vsc: Fix packet CRC computed over pointer size

Mikulas Patocka <[email protected]>
dm-bufio: fix a race leading to an unsigned integer underflow

Mikulas Patocka <[email protected]>
dm-bufio: fix non-working memory limit

Jiri Slaby (SUSE) <[email protected]>
serial: 8250_exar: store the GPIO platform device in struct exar8250

Myeonghun Pak <[email protected]>
fbdev: kyro: Release WC setup on registration failure

Lorenzo Stoakes (ARM) <[email protected]>
fbdev: sh_mobile_lcdc: check for fb_deferred_io_init() error

Lorenzo Stoakes (ARM) <[email protected]>
fbdev: smscufx: check for fb_deferred_io_init() error

Lorenzo Stoakes (ARM) <[email protected]>
fbdev: udlfb: check for fb_deferred_io_init() error

Lorenzo Stoakes (ARM) <[email protected]>
fbdev: xen-fbfront: check for fb_deferred_io_init() error

Lorenzo Stoakes (ARM) <[email protected]>
fbdev: ssd1307fb: check for fb_deferred_io_init() error

David E. Box <[email protected]>
platform/x86/intel/vsec: Fix inverted walk_header() test in get_features()

Guixiong Wei <[email protected]>
platform/x86/intel-uncore-freq: Continue restoring limits on resume

Mario Limonciello <[email protected]>
platform/x86/amd: hfi: Fix out-of-bounds reads when parsing ranking data

Guangshuo Li <[email protected]>
platform/x86: simatic-ipc: fix platform device leak on registration failure

Antheas Kapenekakis <[email protected]>
platform/x86: oxpec: Fix Apex charge limit control

Jack Boykin <[email protected]>
platform/x86/amd/pmf: Fix power_supply refcount leak in amd_pmf_get_battery_prop()

Muhammad Bilal <[email protected]>
platform/x86: hp-wmi: fix heap OOB read and memory corruption in hp_wmi_perform_query()

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: fix 16-byte heap overflow for empty auth token

Denis Benato <[email protected]>
platform/x86: asus-wmi: fix screenpad power state detection

Denis Benato <[email protected]>

    platform/x86: asus-wmi: fix unclear usage of bd->props.power

Mario Limonciello <[email protected]>
platform/x86/amd: Stop counting intermediate cycles with metrics table

Mario Limonciello <[email protected]>
platform/x86/amd/pmf: Validate the APTS state index

Donggeun Yoo <[email protected]>
mm/damon/tests/core-kunit: test the size charged for a filter-trimmed region

Donggeun Yoo <[email protected]>
mm/damon/core: charge only the part of a region the filter left

Hao Ge <[email protected]>
mm/alloc_tag: account for reserved tag ids in the kernel tag check

Breno Leitao <[email protected]>
mm/shmem: report RCU-tasks quiescent states while undoing a range

Hongfu Li <[email protected]>
mm/hugetlb_cgroup: move per-node usage on cgroup reparenting

Hongfu Li <[email protected]>
mm/hugetlb_cgroup: move per-node usage on cross node migration

Yuanhe Shu <[email protected]>
mm/page_alloc: do not boost watermarks in kdump capture kernels

Gregory Price <[email protected]>
mm/madvise: use folio_trylock() in the cold/pageout PMD split

Gregory Price <[email protected]>
mm/madvise: reclaim isolated folios if PTE restart fails

SJ Park <[email protected]>

    mm/damon/sysfs-schemes: read sysfs_filter->addr_range only once

Imre Kaloz <[email protected]>

    PCI: Avoid D3 on PLX PEX 8532/8533/8548 downstream ports

Yongjian Mu <[email protected]>
xprtrdma: trim head iovec when the payload arrives via a Write chunk

Tim Menninger <[email protected]>
xprtrdma: prevent disconnect feedback during endpoint teardown

Weigang He <[email protected]>
mtd: parsers: qcom: fix offset/size overflow on large partitions

Gabor Juhos <[email protected]>
mtd: rawnand: qcom: fix read location register usage in config_nand_cw_read()

Hengyu Liang <[email protected]>
btrfs: return -ENOTTY for unknown ioctls on the control device

Wentao Liang <[email protected]>
btrfs: zoned: fix block group reference leak in btrfs_repair_one_zone()

Ard Biesheuvel <[email protected]>
arm64/efi: Clear PTE_WRITE when applying EFI_MEMORY_RO

Mikulas Patocka <[email protected]>
dm-snapshot: fix crash if dm_io_client_create fails

Johan Hovold <[email protected]>
USB: serial: sierra: fix urb leak on write completion

Anup Vishwakarma <[email protected]>
mailbox: qcom-ipcc: Guard against NULL con_priv in send_data()

Wentao Liang <[email protected]>
mailbox: mtk-cmdq: Fix runtime PM leak in cmdq_mbox_flush()

Florian Fainelli <[email protected]>
mailbox: bcm74110: Cap rx_svc_init_list growth to prevent PMC-induced OOM

Runyu Xiao <[email protected]>
mailbox: altera: shut down RX polling timer on channel teardown

Wayne Chang <[email protected]>
usb: typec: ucsi_ccg: Add retry mechanism in ccg_read

Mathias Nyman <[email protected]>
xhci: Prevent invalid vdev dereference during sideband unregister

Michal Pecio <[email protected]>
usb: xhci: Fix bounce buffer overflow

Seungjin Bae <[email protected]>
usb: typec: ucsi: ccg: Validate altmode index in GET_CURRENT_CAM response

Ali Resool Tuama <[email protected]>
USB: quirks: add USB_QUIRK_WINDOWS_CONFIG_REQ_SIZE for GameSir G7 SE

Drobyshev Vladimir <[email protected]>
USB: cdc-acm: add VeriFone VX820 device ID

Adam Harshbarger <[email protected]>
lib/plist: fix plist_requeue() corrupting order in the last bucket

Koichiro Den <[email protected]>
cxl/acpi: Convert QTG _DSM latencies to picoseconds

Koichiro Den <[email protected]>
cxl: Account for link width in latency calculation

Koichiro Den <[email protected]>
cxl/port: Convert PCIe link latency to nanoseconds

Guixin Liu <[email protected]>
cxl/pci: Program the Port GPF timeouts before caching the DVSEC

Seongjun Hong <[email protected]>
vfio/mlx5: Fix boundary check in set_report_output()

Xiaofeng Yuan <[email protected]>
RISC-V: KVM: Fix IPI delivery for out-of-order vcpu_id

Ross Lagerwall <[email protected]>
xen-blkfront: Fix IO race during unplug

Zongmin Zhou <[email protected]>
slimbus: messaging: fix leaked PM vote on tid allocation failure

Johan Hovold <[email protected]>
USB: serial: usb_wwan: fix urb leak on disconnect

Michael Wyraz <[email protected]>
USB: serial: option: add support for ASR 1286:4e3c modem

Reinhard Speyerer <[email protected]>
USB: serial: option: add Rolling Wireless RN947R

Johan Hovold <[email protected]>
USB: cdc-acm: fix urb leak on disconnect

Jiale Yao <[email protected]>
wifi: ath12k: validate MAC/PHY capability count before saving

Olivier Kaloudoff <[email protected]>
ALSA: usb-audio: Add mic resolution quirk for Logitech Webcam C200

Jesse Zhang <[email protected]>
drm/ttm: return an error when kmapping a BO without pages

Krzysztof Karas <[email protected]>
iommu/dma: Catch scatterlist length overflows

Wentao Liang <[email protected]>
xen-pciback: Fix pcistub_device ref leak in pcistub_get_gsi_from_sbdf()

Yehyeong Lee <[email protected]>
xen/pcifront: check that an AER callback exists before calling it

Koichiro Den <[email protected]>
xen/privcmd: Only claim ioreqs matching an ioeventfd

Myeonghun Pak <[email protected]>
soc: fsl: dpio: Free the IRQ before releasing the I/O object

Myeonghun Pak <[email protected]>
soc: fsl: dpio: Fix cleanup on IRQ registration failure

Wentao Liang <[email protected]>
soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms()

Abdifatah Suruur <[email protected]>
xen/gntdev: prevent private mappings from becoming writable

Wentao Liang <[email protected]>
clk: imx: Fix clock reference leak in imx_obtain_fixed_clock_hw()

Wentao Liang <[email protected]>
clk: imx: Fix clock reference leak in imx_get_clk_hw_by_name()

Longlong Xia <[email protected]>
mm/zswap: enable zswap_ever_enabled in zswap_pool_create()

Longlong Xia <[email protected]>
mm/zswap: publish the initial pool with list_add_rcu()

Jinmeng Zhou <[email protected]>
mm/hugetlb: fix subpool minimum reservation rollback

Anastasios Papagiannis <[email protected]>
mm/nommu: reject wrapping ranges in access_remote_vm()

Mike Rapoport (Microsoft) <[email protected]>
mm/execmem: free ROX cache chunks only when they span an entire vm area

Luxiao Xu <[email protected]>
mm/memory: constrain generic_access_phys() to page boundary

Yogesh Gaur <[email protected]>

    md: don't hand out the array before md_alloc() has added mddev->kobj

Jake Labelle <[email protected]>
nilfs2: validate directory position after llseek in readdir

Jinjie Ruan <[email protected]>
ext4: fix out-of-bounds read in ext4_get_group_info()

Sergey Senozhatsky <[email protected]>
ext4: fix ABBA deadlock in ext4_rmdir()

Daejun Park <[email protected]>
ext4: don't report delalloc data as a hole on indirect-mapped inodes

Hemanth Selam <[email protected]>
ext4: skip extra isize expansion while unmounting

Daejun Park <[email protected]>
jbd2: don't advance j_fc_off before the buffer is recorded

guzebing <[email protected]>
ext4: reject delalloc to nodelalloc before applying remount options

Hsiu-Hsien Lee <[email protected]>
ext4: fix fast commit replay failing on a read-only mount

guzebing <[email protected]>
ext4: only update tune mount options when requested

Matthias Goergens <[email protected]>
fanotify: report names longer than NAME_MAX

Peter Ujfalusi <[email protected]>
ALSA: hda/hdmi: clamp sad_count in ELD proc write handler

Peter Ujfalusi <[email protected]>

    ALSA: hda/hdmi: clamp num_cvts against cvt_nids[] in hdmi_read_pin_conn

Daehyeon Ko <[email protected]>
crypto: algif_skcipher - rewind rounded output bytes

Tristan Madani <[email protected]>
wifi: rtw89: fix IE length passed to cfg80211_find_ie() in WoW AKM

Krzysztof Wilczyński <[email protected]>
PCI/sysfs: Pass the device name length in UTF-16 code units

Josef Bacik <[email protected]>
aoe: pull in the headers each received packet type reads

Pin-Hao Chen <[email protected]>
spi: stm32: fix double free of SRAM buffer on MDMA fallback

Wentao Liang <[email protected]>
clocksource/drivers/digicolor: Fix clk reference leak on request_irq failure

Wentao Liang <[email protected]>
clocksource/drivers/fttmr010: Fix clk reference leak in error paths

Linlin Yang <[email protected]>

    wifi: mt76: mt7996: fix PCI device reference leak in mt7996_pci_init_hif2()

Wentao Liang <[email protected]>
wifi: mt76: Fix of_node reference leak in mt76_get_rate_power_limits()

Jiale Yao <[email protected]>
wifi: mt76: mt7615: cancel reset work during unregister

Devin Wittmayer <[email protected]>
wifi: mt76: mt7925: cancel mlo_pm_work on the USB stop path

Myeonghun Pak <[email protected]>
wifi: mt76: mt7615: restore DBDC state after ext PHY failure

Eason Lai <[email protected]>
wifi: mt76: fix memory leak in USB TX path

Eason Lai <[email protected]>
wifi: mt76: mt792x: fix UAF in SDIO TX path when out of memory

Mark Anthony Agarro <[email protected]>
wifi: mt76: mt7615: do not tear down BSS/STA state for monitor vifs

Mark Anthony Agarro <[email protected]>
wifi: mt76: mt76x02: validate TX-status rate index before mac80211 handoff

Joseph Qi <[email protected]>
ocfs2: skip uninitialized lockres in ocfs2_mark_lockres_freeing()

Joseph Qi <[email protected]>
ocfs2: restrict OCFS2_INVALID_SLOT suballoc slot to system inodes

Karl Mehltretter <[email protected]>
fork: honor task_struct's declared alignment

Konstantin Khorenko <[email protected]>
selftests/core: fix unshare_test with large fs.nr_open

Joseph Qi <[email protected]>
ocfs2: free replay slots in ocfs2_recovery_exit()

Joseph Qi <[email protected]>
ocfs2: exit recovery thread on mount error path

Thorsten Blum <[email protected]>
init: fix early boot crash with bare hostname parameter

Zi Yan <[email protected]>
USB: gadgetfs: do not WARN about excessively large memory allocations

Michael Liang <[email protected]>
fault-inject: fix dentry leak

OGAWA Hirofumi <[email protected]>
fat: fix fat_ent_write() for reverting the value

DAI RENJIE <[email protected]>
resource: fix lost wakeup when waiting for a muxed region

SJ Park <[email protected]>
mm/damon/sysfs: set next refresh jiffies per sysfs context

SJ Park <[email protected]>
mm/damon/core: handle extreme memory state in damon_get_node_mem_bp()

SJ Park <[email protected]>
mm/damon/vaddr: respect folio end for DAMOS_STAT

SJ Park <[email protected]>
mm/damon/paddr: respect folio end for DAMOS actions except STAT

SJ Park <[email protected]>
mm/damon/paddr: respect folio end for DAMOS_STAT

Zhiling Zou <[email protected]>
mm/page_table_check: skip zero pages

Joe Damato <[email protected]>
mm: memcontrol: raise MEMCG_MAX for charges that fail without reclaiming

Gregory Price <[email protected]>
mm/mempolicy: take a cpuset cookie for the interleave node count

Qi Xi <[email protected]>
mm/page_isolation: guard compound_order() against racing

Qi Xi <[email protected]>
mm/page_isolation: fix UBSAN shift-out-of-bounds warning

Chengfeng Ye <[email protected]>
mm/ksm: mark migration stores with WRITE_ONCE()

Nathan Chancellor <[email protected]>
wifi: brcmsmac: Adjust txpwrindex value in nphy_ipa_rxcal_gaintbl_2GHz

Darrick J. Wong <[email protected]>
xfs: cross-reference the primary superblock

Priyank Rathod <[email protected]>
PCI/AER: Fix memory leak in aer_recover_queue() on kfifo buffer overflow

Donggeun Yoo <[email protected]>
PCI/DOE: Fix double free of a duplicate feature's sysfs name

Eric Dumazet <[email protected]>
dlm: fix send buffer backpressure handling

Denis Efremov (Oracle) <[email protected]>
floppy: return the drive state flags from the 32-bit FDGETDRVSTAT

Denis Efremov (Oracle) <[email protected]>
floppy: don't store a stack buffer in timeout_message

Myeonghun Pak <[email protected]>
ASoC: codecs: rt5682s: disable jack detection work on shutdown

Chuck Lever <[email protected]>
svcrdma: Grant credits from the clamped sc_max_requests

Runyu Xiao <[email protected]>
perf: xgene: initialize lock before requesting IRQ

Linus Walleij <[email protected]>
power: supply: ab8500_fg: Report sub-percent charge changes

Linus Walleij <[email protected]>
power: supply: ab8500_fg: Accept status from supplied power

Henrik Enquist <[email protected]>
ALSA: aloop: Don't constrain playback params in notify mode

Andrey Albershteyn <[email protected]>
fsverity: hoist statx reporting of fs-verity flag

Maurizio Casciano <[email protected]>
power: supply: core: Honor supplied-from with CONFIG_OF=y

Tharit Tangkijwanichakul <[email protected]>
media: hantro: disable runtime PM before hardware teardown

Jiawen Liu <[email protected]>
media: amphion: fix runtime PM imbalance on probe failure

Tharit Tangkijwanichakul <[email protected]>
media: hantro: release runtime resources when device_run fails

Tharit Tangkijwanichakul <[email protected]>
media: hantro: Harden MPEG-2 control access against NULL

Junrui Luo <[email protected]>
media: vicodec: fix NULL deref on oversized frame

Pengpeng Hou <[email protected]>
media: mediatek: jpeg: retry HW selection after successful wait

Michail Tatas <[email protected]>
media: verisilicon: rockchip: Fix leaks in init

Guangshuo Li <[email protected]>
media: mediatek: vpu: release reserved memory on remove

Guangshuo Li <[email protected]>
media: mediatek: vcodec: destroy core workqueue on remove

Wentao Liang <[email protected]>
media: mtk-jpeg: Fix runtime PM leak in mtk_jpegenc_worker()

Wentao Liang <[email protected]>
media: mtk-jpeg: Fix runtime PM leak in mtk_jpegdec_worker()

Wentao Liang <[email protected]>
media: platform: mtk-mdp3: Fix device reference leak in mdp_comp_init()

Fan Wu <[email protected]>
media: mediatek: vpu: free IRQ before destroying watchdog workqueue

Myeonghun Pak <[email protected]>
media: amphion: prevent unbind while video instances are open

Myeonghun Pak <[email protected]>
media: amphion: drain message work before releasing core state

Michael Freidkin <[email protected]>
media: meson: vdec: size capture planes from the aligned canvas

Guangshuo Li <[email protected]>
media: chips-media: wave5: Check decoder qbuf runtime resume

Linmao Li <[email protected]>
media: chips-media: wave5: Balance runtime PM on encoder close errors

Linmao Li <[email protected]>
media: chips-media: wave5: Handle polling IRQ thread failure

Runyu Xiao <[email protected]>
media: sti: delta: use unaligned accessors for MJPEG SOF fields

Nas Chung <[email protected]>
media: v4l2-common: Fix P010 format info

Thorsten Blum <[email protected]>
media: imagination: Fix value clamping in calculate_qp_tables

Karl Mehltretter <[email protected]>
KVM: arm64: vgic-v3: Roll back assignments from the new region

Alexey Klimov <[email protected]>
soc: samsung: exynos-pmu: fix error paths in cpuhotplug/idle states setup

Karl Mehltretter <[email protected]>
KVM: arm64: vgic-v3: Undo assignment on iodev registration failure

Kim Phillips <[email protected]>
x86/bugs: Fix CONFIG_MITIGATION_RETPOLINE=n mitigation reporting

Fuad Tabba <[email protected]>
KVM: arm64: Validate the host vCPU's VM before reading it under pKVM

Jérémy Jean <[email protected]>
crypto: ecc - Handle exceptional points in Shamir multiplication

Aldo Ariel Panzardo <[email protected]>
crypto: nx - validate 'ignore' before subtracting in decompress

Thorsten Blum <[email protected]>
hwrng: core - reject unknown RNG names

Thorsten Blum <[email protected]>
hwrng: ba431 - fix reported byte count

Thorsten Blum <[email protected]>
hwrng: amd - report partial reads in non-blocking mode

ZhaoJinming <[email protected]>
crypto: caam - fix double-free in caam_rsa_set_priv_key_form()

Wei Jie Law <[email protected]>
media: uvcvideo: Fix NULL deref on events for uninitialized controls

Imre Kaloz <[email protected]>
PCI: Disable MSI for ULi M1575 EHCI controller

Runyu Xiao <[email protected]>
block: amiflop: synchronize flush timer before track flush

Vasileios Almpanis <[email protected]>
block: drop the cached plug time when blk_add_rq_to_plug() flushes

Danish Khateeb <[email protected]>
pps: generators: stop the generator on unregister

Vincent Donnefort <[email protected]>
KVM: arm64: Fix MMFR0 TGRAN advertisement for pVMs

Mikulas Patocka <[email protected]>
dm-writecache: fix REQ_FUA processing

Mikulas Patocka <[email protected]>
dm-writecache: fix uncommitted_blocks underflow

Mikulas Patocka <[email protected]>
dm-writecache: fix a crash if we attempt to use non-dax device

Mikulas Patocka <[email protected]>
dm-writecache: fix a quirk in statistics

Mikulas Patocka <[email protected]>
dm-writecache: report I/O error if flush failed

Mikulas Patocka <[email protected]>
dm: fix a bug in dm_accept_partial_bio

Kaho Jiang <[email protected]>
media: em28xx: fix double free in em28xx_alloc_urbs

Ginger Li <[email protected]>
media: exynos4-is: Fix a race between s_stream(0) and the interrupt handler

Guangshuo Li <[email protected]>
media: rtl28xxu: fix SDR platform device leak

Wentao Liang <[email protected]>
media: pvrusb2: Fix USB parent device leak in class_dev_create()

Guangshuo Li <[email protected]>
media: tw686x: fix V4L2 device lifetime on probe failure

Tianchu Chen <[email protected]>
staging: rtl8723bs: fix RX buffer OOB write from device-reported length

Johan Hovold <[email protected]>
staging: greybus: uart: fix racy TIOCMIWAIT implementation

Wentao Liang <[email protected]>
drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g()

Krzysztof Kozlowski <[email protected]>
drm/msm/hdmi_bridge: Correct poweroff/audio cleanup order in post_disable

Krzysztof Kozlowski <[email protected]>
drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable()

Krzysztof Kozlowski <[email protected]>
drm/msm/hdmi_phy: Cleanup after msm_hdmi_phy_resource_enable() failure

Fan Wu <[email protected]>
i3c: master: adi: free the IRQ before unregistering the master

Runyu Xiao <[email protected]>
IB/hfi1: Shutdown self-rearming timers before freeing

Alexander Sverdlin <[email protected]>
pwm: tiehrpwm: Clear period on disable to allow reconfiguration

Ryusuke Konishi <[email protected]>
nilfs2: ignore non-fatal signals during synchronous log write wait

Ryusuke Konishi <[email protected]>
nilfs2: clear dirty flag on bdev buffers on log write failure

Runyu Xiao <[email protected]>
ASoC: pcm6240: do not free an unrequested IRQ

Srish Srinivasan <[email protected]>
pseries/plpks: clear SED key data after use

Srish Srinivasan <[email protected]>
pseries/plpks: clear signed update authentication buffer

Srish Srinivasan <[email protected]>
pseries/plpks: clear sensitive PLPKS buffers

Srish Srinivasan <[email protected]>
pseries/plpks: validate input to plpks_signed_update_var()

Srish Srinivasan <[email protected]>
pseries/plpks: fix error handling in plpks_read_var()

Wentao Liang <[email protected]>
clk: starfive: jh7110-isp: fix refcount leak in jh7110_ispcrg_probe()

Takashi Iwai <[email protected]>
ALSA: core: Check shutdown flag at D0 power-state, too

Runyu Xiao <[email protected]>
m68k: dmasound: Keep the Q40 IRQ handler registered

Runyu Xiao <[email protected]>
ALSA: sgio2audio: Only free successfully requested IRQs

Vishnu Reddy <[email protected]>
media: iris: Fix frame interval enumeration for non-divisor framerates

Vishnu Reddy <[email protected]>
media: iris: Fix bus_info prefix in VIDIOC_QUERYCAP

Vishnu Reddy <[email protected]>
media: venus: Fix iova allocation from restrict region

Hans de Goede <[email protected]>
media: qcom: camss: Add "gcc_axi_hf" to 8775p VFE lite clock lists

Hitesh Patel <[email protected]>
media: qcom: camss: vfe: Fix VFE reset while another line is streaming

Hitesh Patel <[email protected]>
media: qcom: camss: vfe-17x: Fix write master selection for RDI lines

Hitesh Patel <[email protected]>
media: qcom: camss: vfe-17x: Fix write master buffer done being dropped

Jiale Yao <[email protected]>
cxl/acpi: Check ACPI companion before use

Ibrahim Hashimov <[email protected]>
fs/ntfs3: fix integer overflow in find_log_rec() causing OOB read

Lucas Costa <[email protected]>
spi: bcm2835: fix device_node reference leak in bcm2835_spi_setup()

Cheick Traore <[email protected]>
iio: adc: stm32: fix minimum sampling time values

Jiale Yao <[email protected]>
iio: accel: adxl380: reject devices without match data

Jiale Yao <[email protected]>
iio: accel: adxl313: reject devices without match data

Jiale Yao <[email protected]>
iio: adc: ti-adc128s052: validate SPI match data

Jiale Yao <[email protected]>
iio: adc: mcp3911: reject devices without match data

Jiale Yao <[email protected]>
iio: adc: max11205: reject devices without match data

Jiale Yao <[email protected]>
iio: adc: ad7606: reject devices without match data

Jiale Yao <[email protected]>
iio: pressure: bmp280: validate SPI match data

Jiale Yao <[email protected]>
iio: potentiometer: x9250: reject devices without match data

Jiale Yao <[email protected]>
iio: imu: adis16400: validate SPI match data

Jiale Yao <[email protected]>
iio: frequency: adf4377: reject devices without match data

Jiale Yao <[email protected]>
iio: dac: ad5755: validate SPI match data

Wentao Liang <[email protected]>
ASoC: codecs: wcd9335: Fix SLIM interface device leak in wcd9335_slim_status()

Runyu Xiao <[email protected]>
ALSA: mpu401: shut down timer before freeing MPU

Lu Baolu <[email protected]>
iommu/vt-d: Avoid out-of-range shift in qi_desc_dev_iotlb_pasid()

Kathiravan Thirumoorthy <[email protected]>
arm64: dts: qcom: ipq9574: Wire up USB3 PHY PIPE clock to GCC

David Heidelberg <[email protected]>
arm64: dts: qcom: sdm845-xiaomi-polaris: Extend the xbl_mem region

David Heidelberg <[email protected]>
arm64: dts: qcom: sdm845-xiaomi-beryllium: Extend the xbl_mem region

Piotr Kubik <[email protected]>
netfilter: ctnetlink: fix inverted IPv6 address match in dump filter

Orgad Shaneh <[email protected]>
MIPS: mm: do not write a huge TLB entry when the probe misses

Orgad Shaneh <[email protected]>
MIPS: mm: align hugetlb mappings in arch_get_unmapped_area()

Runyu Xiao <[email protected]>
peci: npcm: Initialize state before requesting IRQ

Runyu Xiao <[email protected]>
peci: aspeed: Initialize state before requesting IRQ

Ma Ke <[email protected]>
ASoC: wcd9335: Fix device reference leak in wcd9335_slim_status()

David Cemin <[email protected]>
ASoC: sdw_utils: clear stale RT711 device reference on exit

Breno Leitao <[email protected]>
dcache: report a Tasks-RCU quiescent state in dentry_kill()

Ricardo Neri <[email protected]>
hwmon: (coretemp) Refresh the temperature on the first read

Richard Weinberger <[email protected]>
mtd: Call get_wunit() on the master partition

Wentao Liang <[email protected]>
mtd: mtdsuper: Fix MTD device reference leak in mtd_get_sb()

Wentao Liang <[email protected]>
mtd: maps: l440gx: Fix double put of the PM device in init_l440gx()

Wentao Liang <[email protected]>
mtd: maps: l440gx: Fix double put of the ISA bridge in init_l440gx()

Wentao Liang <[email protected]>
mtd: amd76xrom: Fix PCI device reference leak in amd76xrom_init_one()

Orgad Shaneh <[email protected]>
mtd: cfi_cmdset_0002: cap the write-buffer chunk at 256 bytes on an x8 device

Myeonghun Pak <[email protected]>
mtd: maps: pci: balance PCI enable on cleanup

Wentao Liang <[email protected]>
mtd: rawnand: atmel: Fix MCK clock leak in atmel_nand_controller_init()

Guangshuo Li <[email protected]>
mtd: rawnand: nuvoton: fix clock cleanup on probe failure

Michael J. Ruhl <[email protected]>
platform/x86/intel/pmt: Block mmap when callback is present

Joanne Koong <[email protected]>
fuse: don't drop destination page cache on a zero byte copy reply

Ridham Khurana <[email protected]>
hwmon: (lm95245) Fix negative temperature conversion

Wentao Liang <[email protected]>
regulator: core: Fix coupled regulators reference leak on removal

Aamir Ahmed <[email protected]>
clk: mvebu: ap-cpu-clk: Assign .num before accessing .hws

Junjie Cao <[email protected]>
ASoC: rt712-sdca-dmic: fix drvdata type in the gain controls

Guangshuo Li <[email protected]>
ASoC: Intel: atom: Fix platform device leak on probe failure

Jiacheng Xu <[email protected]>
kobject: fix out-of-bounds access in kobject_action_type()

Ryusuke Konishi <[email protected]>
nilfs2: fix deadlock between nilfs_evict_inode() and find_inode()

Tiezhu Yang <[email protected]>
perf loongarch: Fix discarded const qualifier in _get_field()

Lin Wang <[email protected]>
hwmon: (k10temp) Stop matching Hygon devices

David Heidelberg <[email protected]>
mfd: wcd934x: Fix NULL pointer dereference on IRQ probe deferral

David Heidelberg <[email protected]>
mfd: wcd934x: set DMA mask on parent to silence "DMA mask not set"

David Heidelberg <[email protected]>
mfd: Fix MAX77705 dependency on regmap

Hongyan Xu <[email protected]>
mfd: da903x: Cancel IRQ work during teardown

Casey Connolly <[email protected]>
drm/panel: ebbg-ft8719: Set prepare_prev_first

Gabor Juhos <[email protected]>
clk: qcom: gcc-ipq5018: mark 'gpll0_main' clock as critical

Francesco Dolcini <[email protected]>
arm64: dts: freescale: imx8mp-verdin-yavia: fix external GPIOs

Francesco Dolcini <[email protected]>
arm64: dts: freescale: imx8mp-toradex-smarc: fix SMARC_SLEEP# gpio-line-names typo

Francesco Dolcini <[email protected]>
arm64: dts: freescale: imx8mp-verdin-ivy: fix DIGI_1/DIGI_2 gpio-line-names

Francesco Dolcini <[email protected]>
arm64: dts: freescale: imx8mm-verdin-ivy: fix DIGI_1/DIGI_2 gpio-line-names

Diego Fernando Mancera Gomez <[email protected]>
memory: stm32_omm: fix child clock leak on set_amcr() error path

Myeonghun Pak <[email protected]>
ASoC: fsl_xcvr: free IRQ before canceling reset work

Guangshuo Li <[email protected]>
media: atmel-isi: release unregistered video device on remove

Lucas Sinn <[email protected]>
media: synopsys: hdmirx: fetch colordepth before calculating pixelclock

Wentao Liang <[email protected]>
media: vpif_display: Fix i2c adapter reference leak in vpif_probe()

Wentao Liang <[email protected]>
media: vpif_capture: Fix i2c adapter reference leak in vpif_probe()

Wentao Liang <[email protected]>
media: au0828: Fix media device leak in au0828_usb_probe()

Runyu Xiao <[email protected]>
media: adv7180: Initialize mutex before ancillary clients

Myeonghun Pak <[email protected]>
media: tw68: balance PCI enable on cleanup

Myeonghun Pak <[email protected]>
media: cx18: Disable PCI device on probe failure

Myeonghun Pak <[email protected]>
media: go7007: unregister the I2C adapter on USB probe failure

Myeonghun Pak <[email protected]>
media: marvell: manage the MMP camera clock provider

Rohinthan P <[email protected]>

    media: v4l2-ctrls: do nothing if controls[0] == NULL in cluster functions

Pengpeng Hou <[email protected]>
media: cec: extron: clear response tail before dispatch

Karl Mehltretter <[email protected]>
crypto: qat - zero the VF migration state buffer on save

Weili Qian <[email protected]>
crypto: hisilicon/hpre - fix GFP flags for dma_alloc_coherent

Weili Qian <[email protected]>
crypto: hisilicon/hpre - fix ECDH destination DMA mapping

Weili Qian <[email protected]>
crypto: hisilicon/hpre - return -EOVERFLOW for small ECDH output buffer

Weili Qian <[email protected]>
crypto: hisilicon/hpre - fix pointer dereference before length check

Mohamad Raizudeen <[email protected]>
crypto: amlogic - Fix IRQ handler return value and fallthrough logic

Suman Kumar Chakraborty <[email protected]>
crypto: qat - fix error source for QAT GEN6 transmit interface faults

Yuchao Zhang <[email protected]>
md: validate bblog_size when loading v1.x badblocks metadata

Wentao Liang <[email protected]>
EDAC/i10nm: Fix mdev reference leak in i10nm_get_ddr_munits()

Aldo Ariel Panzardo <[email protected]>
nilfs2: fix checkpoint root lifetime on sysfs errors

Wentao Guan <[email protected]>
cpufreq/amd-pstate: Skip auto_sel write when it already matches the mode

Wentao Liang <[email protected]>
drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable()

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62x-phyboard-lyra: Set SD clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62-phycore-som: Set eMMC clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am625-sk-common: Set eMMC clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62x-sk-common: Set SD clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am625-beagleplay: Set MMC clock pins as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62-pocketbeagle2: Set SD clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62-lp-sk: Set eMMC clock pins as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62a-phycore-som: Set eMMC clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62a7-sk: Set SD clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62a7-sk: Set eMMC clock pin as OUTPUT

Judith Mendez <[email protected]>
arm64: dts: ti: k3-am62a: Fix MMC0_CLK register address

Wentao Liang <[email protected]>
ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()

Sean Young <[email protected]>
media: meson-ir-tx: Prevent divide by zero in meson_irtx_prepare_pulse()

Sean Young <[email protected]>
media: ir_toy: Validate the maximum tx carrier

Sean Young <[email protected]>
media: serial_ir: Fix race condition where timer can be re-armed

Sean Young <[email protected]>
media: ene_ir: Ensure teardown is done in the correct order

Myeonghun Pak <[email protected]>
leds: ktd2692: Pass context to regulator cleanup

Cong Nguyen <[email protected]>
staging: media: imx: csc-scaler: fix ipu_image_convert_run leak on queue error

Hui Peng <[email protected]>

    seccomp: restore knotif->state when SECCOMP_ADDFD_FLAG_SEND is interrupted

Oleg Nesterov <[email protected]>
signalfd: don't dequeue the forced fatal signals

Adrian Hunter <[email protected]>
i3c: mipi-i3c-hci: Bounce short reads irrespective of the IOMMU

Adrian Hunter <[email protected]>
i3c: master: Fix out-of-bounds read in DMA bounce buffer setup

Runyu Xiao <[email protected]>
PCI: pciehp: Make 'pciehp_poll_mode' parameter read-only

Hui Peng <[email protected]>
ata: libata-scsi: abort multi-sector pass-through commands when multi_count is 0

Tsz Shan Chan <[email protected]>
iio: light: apds9306: fix default sampling frequency definition

Jean-Baptiste Maneyrol <[email protected]>
iio: imu: inv_icm42600: force accel odr change when switching power mode

Shehryar Ahmad <[email protected]>
iio: accel: adis16201: fix channel order for buffer mode

Wentao Liang <[email protected]>
regulator: rt6190: Fix runtime PM imbalance in rt6190_out_enable()

Karl Mehltretter <[email protected]>
fpga: Fix of_fpga_mgr_get() reference in fpga_mgr_lock() docs

Wentao Liang <[email protected]>
ASoC: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()

Guangshuo Li <[email protected]>
crypto: omap-des - fix crypto engine cleanup

Thorsten Blum <[email protected]>
crypto: zynqmp-sha - fix NULL pointer dereference in init_tfm

Maciej W. Rozycki <[email protected]>
PCI: Skip Target Speed quirk on clamped ports with no link

Wentao Liang <[email protected]>
regulator: core: Fix rdev reference leak in regulator_resolve_supply()

Wentao Liang <[email protected]>
regulator: core: Fix c_rdev reference leak in regulator_resolve_coupling()

Jiaming Zhang <[email protected]>
nilfs2: force clear dirty state when restoring from the shadow map

Shengming Hu <[email protected]>
cpufreq: conservative: Restrict deferred downscaling to low load

Johan Alvarado <[email protected]>

    spi: spi-qpic-snand: publish the ECC context to snandc->qspi

Thomas Zimmermann <[email protected]>
drm/panic: Test address from kmap op for NULL

Thomas Zimmermann <[email protected]>
drm/panic: Do not use un-escaped URL as format string

Martin Wilck <[email protected]>
md/raid5: validate payload size before calculating payload_len

Cao Guanghui <[email protected]>
md/raid5: fix NULL pointer dereference in raid5_free_percpu

Cao Guanghui <[email protected]>
md/raid5: track disks array size to fix extra_page leak on error paths

Guangshuo Li <[email protected]>
iio: adc: at91-sama5d2: disable autosuspend on remove

Guangshuo Li <[email protected]>
iio: accel: mma9553: disable autosuspend on remove

Guangshuo Li <[email protected]>
iio: accel: mma9551: disable autosuspend on remove

Guangshuo Li <[email protected]>
iio: accel: kxcjk-1013: Disable autosuspend on remove

Wentao Liang <[email protected]>
ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()

Wentao Liang <[email protected]>
ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()

Liu Chao <[email protected]>
usb: fotg210: validate endpoint index in ep0 handlers

Karl Mehltretter <[email protected]>
crypto: atmel-tdes - sync output bounce buffer before DMA

Yousef Alhouseen <[email protected]>
ntfs3: bound index head insertions by buffer capacity

Muhammad Bilal <[email protected]>
platform/x86: hp-bioscfg: fix slab-out-of-bounds write in hp_convert_hexstr_to_str()

Guangshuo Li <[email protected]>
media: i2c: ov2735: fix power cleanup on remove

Guangshuo Li <[email protected]>
media: i2c: alvium-csi2: balance runtime PM usage count on remove

Niklas Cassel <[email protected]>
ata: libata: Do not leave ata_host_stop() registered when activation fails

Niklas Cassel <[email protected]>
ata: libahci: Free the IRQs when activating a multi-IRQ host fails

Niklas Cassel <[email protected]>
ata: ahci_st: Assert the power down reset in the probe() error path

Niklas Cassel <[email protected]>
ata: ahci_st: Do not ignore errors when getting the reset controls

Chao Yu <[email protected]>
f2fs: compress: fix to handle race between truncate and writeback

Jiucheng Xu <[email protected]>
f2fs: force out-place update for all writes on compressed file

Matthew Sakai <[email protected]>
dm vdo indexer: validate record page numbers better

Matthew Sakai <[email protected]>
dm vdo indexer: prevent delta list overflow on load

Kyle Zeng <[email protected]>
affs: validate blocks before freeing them

Bradley Morgan <[email protected]>
PM: CPU: Restore synchronize_rcu() to cpu_pm_unregister_notifier()

Runyu Xiao <[email protected]>
crypto: ccp - Initialize DBC ioctl mutex before registering device

Karl Mehltretter <[email protected]>
lib/842: require a complete history block for repeat templates

Karl Mehltretter <[email protected]>
lib/842: reject output overflows from index and short data

Karl Mehltretter <[email protected]>
crypto: atmel-aes - fix AADLENR for standalone GHASH

Karl Mehltretter <[email protected]>
crypto: atmel-tdes - zero-initialize device state

Junrui Luo <[email protected]>
media: vicodec: zero-initialize stateful decoder heap buffers

Fan Wu <[email protected]>
media: vivid: cancel svid ctrl work on release

Juan Perdomo <[email protected]>
media: cx231xx: preserve I2C transfer length

Maxim Skokov <[email protected]>
media: vivid: round the height down to the vertical subsampling factor

Eric Kim <[email protected]>
sched/fair: Reset NUMA fault locality after scan period update

Jean-Baptiste Maneyrol <[email protected]>
iio: imu: inv_icm42600: fix odr change not caught in certain cases

Fan Wu <[email protected]>
power: supply: bq27xxx: Ensure poll work is cancelled on remove

Shengzhuo Wei <[email protected]>
power: supply: bq27xxx: synchronize work cancellation on suspend

Robin Snyders <[email protected]>
power: supply: qcom_smbx: notify battery overvoltage recovery

Robin Snyders <[email protected]>
power: supply: qcom_smbx: validate battery float voltage

Robin Snyders <[email protected]>
power: supply: qcom_smbx: fix float voltage selector

Robin Snyders <[email protected]>
power: supply: qcom_smbx: test battery health status bits

Robin Snyders <[email protected]>
power: supply: qcom_smbx: include base when petting watchdog

Runyu Xiao <[email protected]>
hte: tegra194-test: shut down timer before GPIO release

Karl Mehltretter <[email protected]>
ACPI: pfr_update: zero-initialize capability query result

Runyu Xiao <[email protected]>
dmaengine: altera-msgdma: initialize state before requesting IRQ

Damon Ding <[email protected]>
drm/bridge: analogix_dp: Restore mandatory samsung DP DT properties

Fan Wu <[email protected]>
media: nuvoton: npcm-video: quiesce VCD IRQ before teardown

Alexander Shiyan <[email protected]>
media: synopsys: hdmirx: use request_any_context_irq() for 5V detection IRQ

Greg Kroah-Hartman <[email protected]>

    media: stv0900: bound DiSEqC reply length to msg[] size

Greg Kroah-Hartman <[email protected]>

    media: stv090x: bound DiSEqC reply length to msg[] size

Greg Kroah-Hartman <[email protected]>
media: adv7604: avoid negative array index in log_status when cp_read fails

James Hilliard <[email protected]>
mtd: rawnand: sunxi: reject ECC maximization on small pages

Myeonghun Pak <[email protected]>
media: stm32: csi: unregister async notifier on cleanup

Alain Volmat <[email protected]>
media: stm32: csi: correct remote pad retrieval

Balakrishnan Sambath <[email protected]>
media: microchip-isc: don't sleep in the clk .is_enabled callback

Balakrishnan Sambath <[email protected]>
media: microchip-isc: fix PM runtime leak in AWB work handler

Balakrishnan Sambath <[email protected]>
media: microchip-isc: do not touch WB registers when not streaming

Balakrishnan Sambath <[email protected]>
media: microchip-isc: disable histogram and flush AWB work on teardown

Balakrishnan Sambath <[email protected]>
media: microchip-isc: synchronize the IRQ before disabling clocks on stop

Balakrishnan Sambath <[email protected]>
media: microchip-isc: fix awb_mutex and lock lifecycle

Wang Yan <[email protected]>
perf powerpc-vpadtl: Fix off-by-one in auxtrace_info minimum size check

Srinivas Kandagatla <[email protected]>
ASoC: codecs: lpass-wsa-macro: use v2.5 Compander1 addresses on v2.5+

Xu Rao <[email protected]>
media: m2m-deinterlace: fix default capture field

Punnay Sharma <[email protected]>
staging: media: av7110: fix sp8870 initialization failure state

Punnay Sharma <[email protected]>
staging: media: av7110: fix corrupted BER reporting in sp8870

Julian Braha <[email protected]>
media: marvell-cam: fix unmet dependency for VIDEO_MMP_CAMERA

Jeffin Philip <[email protected]>
media: vidtv: fix uaf in vidtv_bridge_on_new_pkts_avail

Piyush Patle <[email protected]>
media: vidtv: fix frontend reference leak on unbind

Junrui Luo <[email protected]>
media: vicodec: make encoder CAPTURE dimensions read-only

Junrui Luo <[email protected]>
media: vicodec: fix out-of-bounds write on under-rounded coded dimensions

Younho Choi <[email protected]>
media: vim2m: keep transaction buffer count stable while streaming

Runyu Xiao <[email protected]>
media: saa7146: Initialize interrupt lock before requesting IRQ

Shengzhuo Wei <[email protected]>
media: go7007: bound EZ-USB I2C transfers to the usb_buf size

Linkai Gong <[email protected]>
media: i2c: tc358743: add missing color-space strings

Ruoyu Wang <[email protected]>
media: au0828: Free URBs when starting DVB streaming fails

Takashi Sakamoto <[email protected]>
firewire: core: fix source bus ID detection for AT context in big-endian systems

Andi Shyti <[email protected]>
media: cx231xx: Fix cleanup path on failure

Fan Wu <[email protected]>
media: cx231xx-audio: drain wq_trigger before audio fini

Andrea Pesaresi <[email protected]>
arm64: dts: mediatek: mt7986: correct timer frequency

Baolin Liu <[email protected]>
isofs: fix Rock Ridge CE extent validation on multisession media

Thorsten Blum <[email protected]>

    thermal: intel: int340x: Fix temperature selection around 0 C

Thorsten Blum <[email protected]>
thermal: intel: powerclamp: Reject invalid window_size values

Francesco Dolcini <[email protected]>
arm64: dts: ti: k3-am62-verdin: Set MMC clock pins as OUTPUT

Amir Goldstein <[email protected]>
fs: make sure to call fsnotify_inoderemove() only once when inode is dead

Karl Mehltretter <[email protected]>
fs_pin: publish pins with RCU list helpers

Miquel Raynal <[email protected]>
mtd: spi-nor: Unprepare legacy controllers upon RWW wait interruption

HyeongJun An <[email protected]>
mtd: spi-nor: sfdp: check the length of the SCCR map

HyeongJun An <[email protected]>
mtd: spi-nor: sfdp: check the length of the xSPI Profile 1.0 table

Serin Yeh <[email protected]>
media: i2c: ov8856: fix debug message to report actual CSI-2 lane count

Serin Yeh <[email protected]>
media: i2c: ov8856 : remove ACPI node bypass mechanism

Abdun Nihaal <[email protected]>
wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup()

Runyu Xiao <[email protected]>
hte: tegra194: Initialize slice locks before registering chip

Yuan Chen <[email protected]>
bpf: Fix queue/stack map u32 index overflow

Yo'av Moshe <[email protected]>
ARM: imx: Fix suspend/resume crash with Clang CFI

hanzhijian <[email protected]>
clk: mstar: msc313-mpll: fix off-by-one in clock array allocation

Sakari Ailus <[email protected]>
platform/x86: int3472: Fix uninitialised variable warning

Laxman Acharya Padhya <[email protected]>
wifi: rtw89: cap firmware section_num before parsing

Yi Cong <[email protected]>
wifi: rtw89: 8851b: fix swapped DPK channel/bandwidth backup fields

イムティヤズ <[email protected]>
wifi: rtw88: fix out-of-bounds CAM write when key table is full

Lad Prabhakar <[email protected]>
memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile

Justin Chen <[email protected]>
memory: brcmstb_dpfe: Bounds check DCPU-supplied MSG_ARG_COUNT

Justin Chen <[email protected]>
memory: brcmstb_dpfe: Fix out-of-bounds access due to DCPU offset

Sam Price <[email protected]>
microblaze: preserve the MSR carry flags across signals

Ramin Moussavi <[email protected]>
microblaze: restore the ABI argument home area below pt_regs (PTO)

Ramin Moussavi <[email protected]>
microblaze: don't clobber r3/r4 restored by rt_sigreturn

Ramin Moussavi <[email protected]>
microblaze: reserve the ABI argument-home area in the signal frame

Viken Dadhaniya <[email protected]>
soc: qcom: geni-se: Fix write to read-only firmware buffer

Viken Dadhaniya <[email protected]>
soc: qcom: geni-se: Fix fw_end computed before round-up; propagate size to caller

Viken Dadhaniya <[email protected]>
soc: qcom: geni-se: Widen fw_size to u32 to prevent wrap-around

Viken Dadhaniya <[email protected]>
soc: qcom: geni-se: Fix endian conversion for serial_protocol comparison

HyeongJun An <[email protected]>
remoteproc: elf_loader: Bound the section header table

Daehyeon Ko <[email protected]>
ipc/mqueue: release notification resources during inode eviction

Daehyeon Ko <[email protected]>
aio: prevent eventfd/epoll recursion on poll

Jan Kara <[email protected]>
udf: Make sure there's enough space for LVID implementation use field

Karl Mehltretter <[email protected]>
microblaze: Fix MB_MANAGER build with older binutils

Fan Wu <[email protected]>
media: imx-jpeg: finish the job on device_run() error paths

Sean Young <[email protected]>
media: ir-hix5hd2: Ensure rdev is setup before interrupts are enabled

Sean Young <[email protected]>
media: meson-ir-tx: Ensure probe error is propagated

Sean Young <[email protected]>
media: meson-ir-tx: Ensure rc_free_device() is called on unbind

Sean Young <[email protected]>
media: meson-ir-tx: Ensure clock is disabled on unbind

Sean Young <[email protected]>
media: sunxi-cir: Ensure no more interrupts can occur before free

Sean Young <[email protected]>
media: redrat3: Ensure all urbs are suspended

Sean Young <[email protected]>
media: redrat3: Ensure we don't read beyond the end of the packet

Sean Young <[email protected]>
media: streamzap: Add missing rc_unregister_device()

Daniel Schwierzeck <[email protected]>
cpufreq: airoha: fix probe failure with correct error check

Jakub Szczudlo <[email protected]>
iio: adc: ti-ads1100: Fix incorrect reading when datarate changed in single mode

Harry Wentland <[email protected]>
drm/amd/display: Force GAMCOR for subsampled surfaces with PQ/Gamma22/HLG

YuBiao Wang <[email protected]>
drm/amdgpu: recompute the dw estimate after allocating a new VM update job

Marek Czernohous <[email protected]>
drm/nouveau: don't dereference outp before checking it in nouveau_dp_irq

Marek Czernohous <[email protected]>
drm/nouveau: cancel the DP IRQ work before freeing the connector

Marek Czernohous <[email protected]>
drm/nouveau: disable the fence uevent work instead of just cancelling it

Marek Czernohous <[email protected]>
drm/nouveau/pci: use config-space MSI rearm on MCP79/MCP7A (NVAC)

Zhenhao Wan <[email protected]>
drm/nouveau/svm: drain fault handler before freeing svmm

Zhenhao Wan <[email protected]>
drm/nouveau: reject zero-size notifier object allocation

Miguel Ojeda <[email protected]>
rust: bitmap: fix intra-doc link

Vernon Yang <[email protected]>
mm: khugepaged: fix swap entry value to folio_pfn()

Sami Tolvanen <[email protected]>
rust: dma: declare cfi_encoding for dma_data_direction

Sami Tolvanen <[email protected]>
rust: hrtimer: declare cfi_encoding for hrtimer_restart

Sami Tolvanen <[email protected]>
rust: irq: declare cfi_encoding for irqreturn

Jérémy Jean <[email protected]>
nvmet-auth: serialize access to DH-HMAC-CHAP state to fix UAF

Marco Crivellari <[email protected]>
nvmet: replace use of system_wq with system_percpu_wq

Danish Khateeb <[email protected]>
pps: generators: don't use the driver's info after unregister

Weiming Shi <[email protected]>
virtio_net: atomically disable rx mode work

Ruide Cao <[email protected]>
mptcp: hold MP_JOIN msk ref when cloning reqsk

Chia-Yu Chang <[email protected]>
tcp: accecn: unset ECT if receive or send ACE=0 in AccECN negotiaion

Kuniyuki Iwashima <[email protected]>
tcp: Remove timeout arg from reqsk_timeout().

Tianchu Chen <[email protected]>
staging: rtl8723bs: fix protected RX frame validation in decrypt path

Khasar Munkh-Erdene <[email protected]>
staging: rtl8723bs: fix spacing around operators in rtw_recv.c

Zhang Yi <[email protected]>
mm/truncate: look up the end-edge straddler by index

Sean Christopherson <[email protected]>
KVM: guest_memfd: Gracefully handle xarray errors when binding a memslot

Honglei Huang <[email protected]>
drm/amdgpu: drop retry loop in amdgpu_hmm_range_get_pages

Hyunwoo Kim <[email protected]>
inet: reject unhashed sockets during established lookups

Mike Rapoport (Microsoft) <[email protected]>
x86/mm/pat: Use pr_warn() for early W^X warnings

Sean Christopherson <[email protected]>

    KVM: VMX: Formally define KVM's "0xdead" exit reason used for failed VM-Enter

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

Diffstat:

 .../bindings/clock/nuvoton,ma35d1-clk.yaml         |  16 +-
 Documentation/hwmon/k10temp.rst                    |   8 +-
 Documentation/networking/ip-sysctl.rst             |   5 +-
 Documentation/userspace-api/check_exec.rst         |   4 +
 Documentation/virt/hyperv/vmbus.rst                |  17 +-
 Makefile                                           |   4 +-
 arch/alpha/include/asm/mmu_context.h               |  35 ++-
 arch/alpha/include/asm/sfp-machine.h               |   4 +
 arch/alpha/include/asm/switch_to.h                 |   1 -
 arch/alpha/include/asm/tlbflush.h                  |   3 +-
 arch/alpha/kernel/smp.c                            |  67 ++--
 arch/alpha/mm/fault.c                              |  23 +-
 arch/alpha/mm/tlbflush.c                           |  18 +-
 arch/arm/include/asm/linkage.h                     |  29 ++
 arch/arm/include/asm/smp.h                         |   2 +-
 arch/arm/kernel/cacheinfo.c                        |  51 +--
 arch/arm/kernel/head-nommu.S                       |   1 +
 arch/arm/kernel/head.S                             |   1 +
 arch/arm/kernel/smp.c                              |  15 +-
 arch/arm/kernel/topology.c                         |  13 +
 arch/arm/mach-imx/pm-imx6.c                        |  26 +-
 arch/arm/mach-imx/suspend-imx6.S                   |   6 +-
 arch/arm/mm/alignment.c                            |  51 ++-
 .../boot/dts/freescale/imx8mm-verdin-ivy.dtsi      |   4 +-
 .../boot/dts/freescale/imx8mp-toradex-smarc.dtsi   |   2 +-
 .../boot/dts/freescale/imx8mp-verdin-ivy.dtsi      |   4 +-
 .../boot/dts/freescale/imx8mp-verdin-yavia.dtsi    |   7 +-
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi          |   1 +
 arch/arm64/boot/dts/qcom/ipq9574.dtsi              |   2 +-
 .../dts/qcom/sdm845-xiaomi-beryllium-common.dtsi   |   6 +
 arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts |   6 +
 arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts           |   2 +-
 arch/arm64/boot/dts/ti/k3-am62-phycore-som.dtsi    |   2 +-
 arch/arm64/boot/dts/ti/k3-am62-pocketbeagle2.dts   |   2 +-
 arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi         |   6 +-
 arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts     |   6 +-
 arch/arm64/boot/dts/ti/k3-am625-sk-common.dtsi     |   2 +-
 arch/arm64/boot/dts/ti/k3-am62a-phycore-som.dtsi   |   2 +-
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts            |   5 +-
 arch/arm64/boot/dts/ti/k3-am62x-phyboard-lyra.dtsi |   2 +-
 arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi     |   2 +-
 arch/arm64/include/asm/kvm_arm.h                   |   2 +-
 arch/arm64/include/asm/kvm_host.h                  |   7 +-
 arch/arm64/include/asm/pgtable.h                   |   3 +
 arch/arm64/kernel/efi.c                            |   8 +-
 arch/arm64/kvm/arm.c                               |  49 +--
 arch/arm64/kvm/hyp/exception.c                     |   5 +-
 arch/arm64/kvm/hyp/include/hyp/adjust_pc.h         |  28 ++
 arch/arm64/kvm/hyp/include/nvhe/pkvm.h             |   2 +
 arch/arm64/kvm/hyp/nvhe/pkvm.c                     |  37 +++
 arch/arm64/kvm/hyp/nvhe/sys_regs.c                 |   3 +
 arch/arm64/kvm/vgic/vgic-mmio-v3.c                 |  33 +-
 arch/arm64/mm/contpte.c                            |   4 +-
 arch/loongarch/include/asm/barrier.h               |   3 -
 arch/loongarch/include/asm/hw_breakpoint.h         |   4 +-
 arch/loongarch/include/asm/loongarch.h             |   4 +-
 arch/loongarch/include/asm/numa.h                  |   2 +-
 arch/loongarch/kernel/cpu-probe.c                  |   2 +-
 arch/loongarch/kernel/hw_breakpoint.c              |  27 +-
 arch/loongarch/kernel/irq.c                        |   3 +-
 arch/loongarch/kernel/traps.c                      |  13 +-
 arch/loongarch/pci/pci.c                           |   3 +-
 arch/microblaze/include/asm/entry.h                |  13 +
 arch/microblaze/include/asm/processor.h            |   2 +-
 arch/microblaze/kernel/entry.S                     | 348 +++++++++++----------
 arch/microblaze/kernel/hw_exception_handler.S      |   5 +
 arch/microblaze/kernel/process.c                   |   5 +-
 arch/microblaze/kernel/signal.c                    |  26 ++
 arch/mips/mm/mmap.c                                |   6 +-
 arch/mips/mm/tlb-r4k.c                             |  21 +-
 arch/powerpc/platforms/pseries/plpks.c             |  27 +-
 arch/powerpc/platforms/pseries/plpks_sed_ops.c     |  12 +-
 arch/riscv/include/asm/pgtable.h                   |   9 +-
 arch/riscv/kvm/vcpu_sbi_replace.c                  |  12 +-
 arch/x86/include/asm/vmx.h                         |   8 +
 arch/x86/kernel/cpu/bugs.c                         |   2 +-
 arch/x86/kvm/vmx/vmx.c                             |   4 +-
 arch/x86/mm/pat/set_memory.c                       |  15 +
 block/blk-iocost.c                                 |   2 +
 block/blk-mq.c                                     |   2 +
 crypto/algif_skcipher.c                            |   8 +-
 crypto/ecc.c                                       |  33 +-
 crypto/testmgr.c                                   |  11 +-
 crypto/testmgr.h                                   | 327 ++++++++++++++++++-
 drivers/accessibility/speakup/selection.c          |   6 +
 drivers/acpi/pfr_update.c                          |   2 +-
 drivers/ata/ahci_st.c                              |  78 ++---
 drivers/ata/libahci.c                              |  28 +-
 drivers/ata/libahci_platform.c                     |   4 +
 drivers/ata/libata-core.c                          |  75 ++++-
 drivers/ata/libata-scsi.c                          |   5 +
 drivers/ata/libata-sff.c                           |   5 +
 drivers/ata/sata_fsl.c                             |   6 +-
 drivers/ata/sata_qstor.c                           |   8 +-
 drivers/block/amiflop.c                            |  71 ++++-
 drivers/block/aoe/aoenet.c                         |  14 +-
 drivers/block/floppy.c                             |   8 +-
 drivers/block/loop.c                               |   6 +-
 drivers/block/ublk_drv.c                           |  27 +-
 drivers/block/xen-blkfront.c                       |   4 +-
 drivers/bluetooth/btusb.c                          |   2 +
 drivers/char/hw_random/amd-rng.c                   |   2 +-
 drivers/char/hw_random/ba431-rng.c                 |   2 +-
 drivers/char/hw_random/core.c                      |   1 +
 drivers/char/tpm/tpm-dev-common.c                  |   3 +
 drivers/char/tpm/tpm_nsc.c                         |   8 +-
 drivers/clk/imx/clk.c                              |  15 +-
 drivers/clk/mstar/clk-msc313-mpll.c                |   2 +-
 drivers/clk/mvebu/ap-cpu-clk.c                     |   4 +-
 drivers/clk/qcom/gcc-ipq5018.c                     |  10 +
 drivers/clk/qcom/gcc-ipq5332.c                     |   1 +
 drivers/clk/qcom/ipq-cmn-pll.c                     |   3 +-
 drivers/clk/starfive/clk-starfive-jh7110-isp.c     |   2 +-
 drivers/clocksource/timer-digicolor.c              |   2 +
 drivers/clocksource/timer-fttmr010.c               |   2 +
 drivers/cpufreq/Kconfig                            |   1 +
 drivers/cpufreq/airoha-cpufreq.c                   |   2 +-
 drivers/cpufreq/amd-pstate.c                       |   6 +-
 drivers/cpufreq/cpufreq_conservative.c             |   8 +-
 drivers/cpufreq/cpufreq_governor.c                 |  29 +-
 drivers/cpufreq/cpufreq_governor.h                 |   2 +
 drivers/cpufreq/cpufreq_stats.c                    |   4 +
 drivers/cpufreq/intel_pstate.c                     |   2 +
 drivers/cpufreq/loongson3_cpufreq.c                |  73 +++--
 drivers/crypto/amlogic/amlogic-gxl-core.c          |   7 +-
 drivers/crypto/atmel-aes.c                         |   2 +-
 drivers/crypto/atmel-tdes.c                        |   6 +-
 drivers/crypto/caam/caampkc.c                      |   6 +
 drivers/crypto/ccp/dbc.c                           |   4 +-
 drivers/crypto/hisilicon/hpre/hpre_crypto.c        |  20 +-
 drivers/crypto/intel/qat/qat_common/adf_dev_mgr.c  |  10 +-
 .../crypto/intel/qat/qat_common/adf_gen4_vf_mig.c  |   5 +
 drivers/crypto/intel/qat/qat_common/adf_gen6_ras.c |  20 +-
 drivers/crypto/intel/qat/qat_common/adf_gen6_ras.h |  24 +-
 drivers/crypto/intel/qat/qat_common/adf_vf_isr.c   |   2 -
 drivers/crypto/nx/nx-842.c                         |   2 +
 drivers/crypto/omap-des.c                          |   2 +
 drivers/crypto/xilinx/zynqmp-sha.c                 |   2 +-
 drivers/cxl/acpi.c                                 |  20 +-
 drivers/cxl/core/pci.c                             |  50 +--
 drivers/cxl/core/port.c                            |   3 +
 drivers/dax/super.c                                |   2 +-
 drivers/dma/altera-msgdma.c                        |  10 +-
 drivers/edac/i10nm_base.c                          |   1 +
 drivers/firewire/ohci-serdes-test.c                |   4 +-
 drivers/firewire/ohci.h                            |   2 +-
 drivers/firmware/efi/libstub/Makefile              |   2 +-
 drivers/firmware/efi/libstub/efi-stub.c            |   8 +
 drivers/fpga/fpga-mgr.c                            |   2 +-
 drivers/gpio/gpio-davinci.c                        |   6 +-
 drivers/gpio/gpio-pca953x.c                        |  14 +-
 drivers/gpio/gpiolib-cdev.c                        |   5 -
 drivers/gpio/gpiolib.c                             |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h                |  11 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h         |  19 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c   | 105 ++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c             |   6 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c         |  12 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c            |  14 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c            |   9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c         |  33 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c            |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c             |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c          |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c        |   5 +
 drivers/gpu/drm/amd/amdgpu/cik.c                   |  10 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c              |  18 +-
 drivers/gpu/drm/amd/amdgpu/si.c                    |  10 +
 drivers/gpu/drm/amd/amdgpu/vi.c                    |  10 +
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c           |  48 +--
 drivers/gpu/drm/amd/amdkfd/kfd_crat.c              |  35 ++-
 drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c          |  23 +-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h              |   4 +
 drivers/gpu/drm/amd/amdkfd/kfd_process.c           |   4 +-
 drivers/gpu/drm/amd/amdkfd/kfd_queue.c             |  23 +-
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c               |  21 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  11 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  |   2 +-
 .../gpu/drm/amd/display/dc/dml/dsc/rc_calc_fpu.c   |   2 +-
 .../dml21/src/dml2_core/dml2_core_dcn4_calcs.c     |   2 +
 .../drm/amd/display/modules/color/color_gamma.c    |   3 +-
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     |   2 +
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c                |  85 +++++
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h            |   1 +
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c   |  33 +-
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c          |  87 +++++-
 drivers/gpu/drm/arm/malidp_crtc.c                  |   1 +
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  13 +-
 drivers/gpu/drm/drm_panic.c                        |   5 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c                 |   2 +
 drivers/gpu/drm/msm/hdmi/hdmi_bridge.c             |  32 +-
 drivers/gpu/drm/msm/hdmi/hdmi_phy.c                |  16 +-
 drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h  |   1 +
 drivers/gpu/drm/nouveau/nouveau_abi16.c            |   4 +
 drivers/gpu/drm/nouveau/nouveau_connector.c        |   1 +
 drivers/gpu/drm/nouveau/nouveau_dp.c               |   4 +-
 drivers/gpu/drm/nouveau/nouveau_fence.c            |   2 +-
 drivers/gpu/drm/nouveau/nouveau_svm.c              |  13 +
 drivers/gpu/drm/nouveau/nvkm/engine/device/base.c  |   2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild     |   1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/pci/mcp79.c    |  35 +++
 drivers/gpu/drm/panel/panel-ebbg-ft8719.c          |   2 +
 drivers/gpu/drm/ttm/ttm_bo_util.c                  |  11 +-
 drivers/hte/hte-tegra194-test.c                    |   2 +-
 drivers/hte/hte-tegra194.c                         |  10 +-
 drivers/hwmon/acpi_power_meter.c                   |  10 +-
 drivers/hwmon/coretemp.c                           |  31 +-
 drivers/hwmon/corsair-cpro.c                       |   9 +-
 drivers/hwmon/gigabyte_waterforce.c                |   5 +
 drivers/hwmon/k10temp.c                            |   5 +-
 drivers/hwmon/lm95245.c                            |   6 +-
 drivers/hwmon/sht3x.c                              |   5 +-
 drivers/hwmon/sht4x.c                              |  22 +-
 drivers/i2c/busses/i2c-designware-master.c         |   8 +
 drivers/i2c/busses/i2c-mt7621.c                    |   9 +-
 drivers/i2c/i2c-core-acpi.c                        |   6 +-
 drivers/i3c/master.c                               |   7 +-
 drivers/i3c/master/adi-i3c-master.c                |   4 +
 drivers/i3c/master/mipi-i3c-hci/dma.c              |   2 +-
 drivers/iio/accel/adis16201.c                      |  10 +-
 drivers/iio/accel/adxl313_spi.c                    |   2 +
 drivers/iio/accel/adxl380_spi.c                    |   2 +
 drivers/iio/accel/kxcjk-1013.c                     |   1 +
 drivers/iio/accel/mma9551.c                        |   1 +
 drivers/iio/accel/mma9553.c                        |   1 +
 drivers/iio/adc/ad7606_spi.c                       |   6 +-
 drivers/iio/adc/at91-sama5d2_adc.c                 |   1 +
 drivers/iio/adc/max11205.c                         |   2 +
 drivers/iio/adc/mcp3911.c                          |   2 +
 drivers/iio/adc/stm32-adc.c                        |   4 +-
 drivers/iio/adc/ti-adc128s052.c                    |   8 +-
 drivers/iio/adc/ti-ads1100.c                       | 107 ++++++-
 drivers/iio/dac/ad5755.c                           |   3 +
 drivers/iio/frequency/adf4377.c                    |   3 +
 drivers/iio/imu/adis16400.c                        |   3 +
 drivers/iio/imu/inv_icm42600/inv_icm42600.h        |   1 +
 drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c  |  17 +-
 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c |   2 +
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c   |   9 +
 drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c   |   8 +-
 drivers/iio/light/apds9306.c                       |   2 +-
 drivers/iio/potentiometer/x9250.c                  |   7 +-
 drivers/iio/pressure/bmp280-spi.c                  |   2 +
 drivers/infiniband/hw/hfi1/chip.c                  |   4 +-
 drivers/infiniband/hw/hfi1/fault.c                 |   1 -
 drivers/input/input.c                              |   4 +-
 drivers/input/joystick/xpad.c                      |   1 +
 drivers/input/keyboard/matrix_keypad.c             |   3 -
 drivers/iommu/amd/init.c                           |  23 +-
 drivers/iommu/dma-iommu.c                          |  20 +-
 drivers/iommu/intel/iommu.h                        |  17 +-
 drivers/iommu/iommufd/io_pagetable.c               |   3 +
 drivers/irqchip/irq-atmel-aic.c                    |   2 +-
 drivers/irqchip/irq-atmel-aic5.c                   |   2 +-
 drivers/irqchip/irq-gic-v3-its.c                   |   2 +-
 drivers/irqchip/irq-imx-intmux.c                   |  15 +-
 drivers/irqchip/irq-mchp-eic.c                     |   4 +-
 drivers/irqchip/irq-msi-lib.c                      |   1 +
 drivers/irqchip/irq-riscv-imsic-platform.c         |   2 +-
 drivers/leds/flash/leds-ktd2692.c                  |  10 +-
 drivers/mailbox/bcm74110-mailbox.c                 |  13 +
 drivers/mailbox/mailbox-altera.c                   |   2 +-
 drivers/mailbox/mtk-cmdq-mailbox.c                 |   7 +-
 drivers/mailbox/qcom-ipcc.c                        |   6 +
 drivers/md/dm-bufio.c                              |  45 ++-
 drivers/md/dm-snap-persistent.c                    |   7 +-
 drivers/md/dm-vdo/indexer/chapter-index.c          |  15 +-
 drivers/md/dm-vdo/indexer/delta-index.c            |  17 +-
 drivers/md/dm-vdo/indexer/volume.c                 |   6 -
 drivers/md/dm-writecache.c                         |  54 +++-
 drivers/md/dm.c                                    |   2 +-
 drivers/md/md.c                                    |  17 +-
 drivers/md/raid5-cache.c                           |  34 +-
 drivers/md/raid5.c                                 |   8 +-
 drivers/md/raid5.h                                 |   1 +
 .../extron-da-hd-4k-plus/extron-da-hd-4k-plus.c    |   4 +-
 drivers/media/common/saa7146/saa7146_core.c        |   3 +-
 drivers/media/dvb-frontends/stv0900_core.c         |   2 +
 drivers/media/dvb-frontends/stv090x.c              |   2 +
 drivers/media/i2c/adv7180.c                        |   2 +-
 drivers/media/i2c/adv7604.c                        |   3 +-
 drivers/media/i2c/alvium-csi2.c                    |   1 +
 drivers/media/i2c/ov2735.c                         |   1 +
 drivers/media/i2c/ov8856.c                         |  32 +-
 drivers/media/i2c/tc358743.c                       |   3 +-
 drivers/media/pci/cx18/cx18-driver.c               |   9 +-
 drivers/media/pci/tw68/tw68-core.c                 |   2 +-
 drivers/media/pci/tw686x/tw686x-core.c             |  10 +
 drivers/media/platform/amphion/vpu_core.c          |  19 +-
 drivers/media/platform/amphion/vpu_drv.c           |   1 +
 drivers/media/platform/atmel/atmel-isi.c           |   7 +-
 .../platform/chips-media/wave5/wave5-vpu-dec.c     |   8 +-
 .../media/platform/chips-media/wave5/wave5-vpu.c   |   7 +
 .../platform/chips-media/wave5/wave5-vpuapi.c      |  15 +-
 .../media/platform/imagination/e5010-jpeg-enc.c    |   4 +-
 drivers/media/platform/m2m-deinterlace.c           |   2 +-
 drivers/media/platform/marvell/Kconfig             |   1 +
 drivers/media/platform/marvell/mmp-driver.c        |   5 +-
 .../media/platform/mediatek/jpeg/mtk_jpeg_core.c   |  17 +-
 .../media/platform/mediatek/mdp3/mtk-mdp3-comp.c   |  14 +-
 .../mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c   |   2 +
 drivers/media/platform/mediatek/vpu/mtk_vpu.c      |   2 +
 .../media/platform/microchip/microchip-isc-base.c  |  56 ++--
 .../media/platform/microchip/microchip-isc-clk.c   |   7 +-
 drivers/media/platform/microchip/microchip-isc.h   |   1 +
 .../platform/microchip/microchip-sama5d2-isc.c     |  11 +
 .../platform/microchip/microchip-sama7g5-isc.c     |  11 +
 drivers/media/platform/nuvoton/npcm-video.c        |   9 +-
 drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c     |  21 +-
 drivers/media/platform/qcom/camss/camss-vfe-17x.c  |  46 +--
 drivers/media/platform/qcom/camss/camss-vfe.c      |  14 +-
 drivers/media/platform/qcom/camss/camss.c          |  25 +-
 drivers/media/platform/qcom/iris/iris_vidc.c       |   6 +-
 drivers/media/platform/qcom/venus/core.c           |  66 +++-
 drivers/media/platform/qcom/venus/core.h           |   6 +
 .../media/platform/samsung/exynos4-is/fimc-lite.c  |   3 +-
 .../media/platform/st/sti/delta/delta-mjpeg-hdr.c  |   7 +-
 drivers/media/platform/st/stm32/stm32-csi.c        |   5 +-
 .../media/platform/synopsys/hdmirx/snps_hdmirx.c   |  80 ++---
 drivers/media/platform/ti/davinci/vpif_capture.c   |   5 +-
 drivers/media/platform/ti/davinci/vpif_display.c   |   3 +
 drivers/media/platform/verisilicon/hantro_drv.c    |  75 +++--
 .../platform/verisilicon/hantro_g1_mpeg2_dec.c     |   5 +
 .../verisilicon/rockchip_vpu981_hw_av1_dec.c       |  68 +++-
 drivers/media/rc/ene_ir.c                          |   4 +-
 drivers/media/rc/ir-hix5hd2.c                      |   5 +-
 drivers/media/rc/ir_toy.c                          |   2 +-
 drivers/media/rc/meson-ir-tx.c                     |  20 +-
 drivers/media/rc/redrat3.c                         |  17 +
 drivers/media/rc/serial_ir.c                       |   2 +-
 drivers/media/rc/streamzap.c                       |   1 +
 drivers/media/rc/sunxi-cir.c                       |   2 +-
 drivers/media/test-drivers/vicodec/codec-fwht.h    |   2 +-
 drivers/media/test-drivers/vicodec/vicodec-core.c  |  16 +-
 drivers/media/test-drivers/vidtv/vidtv_bridge.c    |   4 +
 drivers/media/test-drivers/vidtv/vidtv_demod.c     |   9 -
 drivers/media/test-drivers/vim2m.c                 |  29 +-
 drivers/media/test-drivers/vivid/vivid-core.c      |   1 +
 drivers/media/test-drivers/vivid/vivid-vid-cap.c   |  13 +
 drivers/media/usb/au0828/au0828-core.c             |   4 +
 drivers/media/usb/au0828/au0828-dvb.c              |  19 +-
 drivers/media/usb/cx231xx/cx231xx-audio.c          |  15 +-
 drivers/media/usb/cx231xx/cx231xx-cards.c          |   2 +-
 drivers/media/usb/cx231xx/cx231xx.h                |   2 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c            |  14 +-
 drivers/media/usb/em28xx/em28xx-core.c             |   3 -
 drivers/media/usb/go7007/go7007-usb.c              |   8 +
 drivers/media/usb/pvrusb2/pvrusb2-sysfs.c          |   1 +
 drivers/media/usb/uvc/uvc_ctrl.c                   |   2 +-
 drivers/media/v4l2-core/v4l2-common.c              |   2 +-
 drivers/media/v4l2-core/v4l2-ctrls-core.c          |  12 +-
 drivers/memory/brcmstb_dpfe.c                      |  24 +-
 drivers/memory/renesas-rpc-if.c                    |   1 +
 drivers/memory/stm32_omm.c                         |   2 +
 drivers/mfd/Kconfig                                |   2 +
 drivers/mfd/da903x.c                               |  34 +-
 drivers/mfd/tps65217.c                             |  69 ++--
 drivers/mfd/wcd934x.c                              |   8 +-
 drivers/misc/mei/vsc-tp.c                          |   2 +-
 drivers/mtd/chips/cfi_cmdset_0002.c                |  15 +
 drivers/mtd/maps/amd76xrom.c                       |   2 +
 drivers/mtd/maps/l440gx.c                          |   2 -
 drivers/mtd/maps/pci.c                             |   2 +-
 drivers/mtd/mtdcore.c                              |   2 +-
 drivers/mtd/mtdsuper.c                             |   4 +-
 drivers/mtd/nand/raw/atmel/nand-controller.c       |   6 +-
 .../mtd/nand/raw/nuvoton-ma35d1-nand-controller.c  |   1 -
 drivers/mtd/nand/raw/qcom_nandc.c                  |   8 +-
 drivers/mtd/nand/raw/sunxi_nand.c                  |   3 +
 drivers/mtd/parsers/qcomsmempart.c                 |   4 +-
 drivers/mtd/spi-nor/core.c                         |   9 +
 drivers/mtd/spi-nor/sfdp.c                         |   8 +
 drivers/net/bonding/bond_main.c                    |   2 +-
 drivers/net/ethernet/google/gve/gve_flow_rule.c    |   1 +
 drivers/net/ethernet/hisilicon/hisi_femac.c        |   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c      |  40 ++-
 drivers/net/macvlan.c                              |   3 +-
 drivers/net/netdevsim/bpf.c                        |  11 +
 drivers/net/ppp/ppp_generic.c                      |   1 +
 drivers/net/usb/pegasus.c                          |  12 +-
 drivers/net/usb/r8152.c                            |  10 +-
 drivers/net/veth.c                                 |   5 +-
 drivers/net/virtio_net.c                           |  25 +-
 drivers/net/wireless/ath/ath11k/dp.c               |   2 +
 drivers/net/wireless/ath/ath12k/wmi.c              |  17 +
 .../broadcom/brcm80211/brcmsmac/phy/phy_n.c        |   2 +-
 drivers/net/wireless/mediatek/mt76/eeprom.c        |  17 +-
 drivers/net/wireless/mediatek/mt76/mt7615/init.c   |  17 +-
 drivers/net/wireless/mediatek/mt76/mt7615/main.c   |   6 +-
 .../net/wireless/mediatek/mt76/mt7615/pci_init.c   |   1 +
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c   |  19 +-
 .../net/wireless/mediatek/mt76/mt76x02_usb_mcu.c   |   2 +-
 drivers/net/wireless/mediatek/mt76/mt7925/usb.c    |  11 +-
 drivers/net/wireless/mediatek/mt76/mt7996/pci.c    |  12 +-
 drivers/net/wireless/mediatek/mt76/tx.c            |   2 +-
 drivers/net/wireless/mediatek/mt76/usb.c           |  31 +-
 drivers/net/wireless/realtek/rtw88/mac80211.c      |   2 +-
 drivers/net/wireless/realtek/rtw89/fw.c            |  32 ++
 drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c  |   4 +-
 drivers/net/wireless/realtek/rtw89/wow.c           |   6 +-
 drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c      |   5 +
 drivers/nvme/host/auth.c                           |  15 +-
 drivers/nvme/host/core.c                           |  15 +-
 drivers/nvme/host/rdma.c                           |   1 +
 drivers/nvme/host/sysfs.c                          |  14 +-
 drivers/nvme/host/tcp.c                            |  24 +-
 drivers/nvme/target/admin-cmd.c                    |   2 +-
 drivers/nvme/target/auth.c                         |   2 +
 drivers/nvme/target/configfs.c                     |   2 +
 drivers/nvme/target/fabrics-cmd-auth.c             |  42 ++-
 drivers/nvme/target/fabrics-cmd.c                  |   4 +
 drivers/nvme/target/fc.c                           |  10 +-
 drivers/nvme/target/io-cmd-bdev.c                  |   5 +-
 drivers/nvme/target/io-cmd-file.c                  |   4 +-
 drivers/nvme/target/nvmet.h                        |   2 +
 drivers/nvme/target/pci-epf.c                      |  30 +-
 drivers/nvme/target/pr.c                           |   2 +-
 drivers/nvme/target/rdma.c                         |   2 +-
 drivers/nvme/target/zns.c                          |  10 +
 drivers/parisc/eisa_enumerator.c                   |  15 +-
 drivers/pci/controller/dwc/pcie-qcom-ep.c          |   2 +
 drivers/pci/controller/pcie-rockchip-ep.c          |  13 -
 drivers/pci/controller/pcie-rockchip-host.c        |  20 --
 drivers/pci/controller/pcie-rockchip.c             |  14 +-
 drivers/pci/controller/pcie-rockchip.h             |   3 -
 drivers/pci/controller/pcie-xilinx-dma-pl.c        |  10 +-
 drivers/pci/doe.c                                  |   5 +-
 drivers/pci/hotplug/pciehp_core.c                  |   2 +-
 drivers/pci/pci-label.c                            |   2 +-
 drivers/pci/pci.c                                  |  33 +-
 drivers/pci/pcie/aer.c                             |   7 +-
 drivers/pci/probe.c                                |   5 +-
 drivers/pci/quirks.c                               |  26 +-
 drivers/pci/xen-pcifront.c                         |  11 +-
 drivers/peci/controller/peci-aspeed.c              |   6 +-
 drivers/peci/controller/peci-npcm.c                |   6 +-
 drivers/perf/xgene_pmu.c                           |   4 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c              |   6 +-
 drivers/platform/x86/amd/hfi/hfi.c                 |  20 +-
 drivers/platform/x86/amd/pmc/pmc.c                 |  20 +-
 drivers/platform/x86/amd/pmf/spc.c                 |   8 +-
 drivers/platform/x86/amd/pmf/sps.c                 |  10 +-
 drivers/platform/x86/asus-wmi.c                    |  42 ++-
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.c       |  82 ++---
 .../x86/hp/hp-bioscfg/passwdobj-attributes.c       |  16 +-
 .../platform/x86/hp/hp-bioscfg/spmobj-attributes.c |   5 +-
 drivers/platform/x86/hp/hp-wmi.c                   |   7 +-
 drivers/platform/x86/intel/int3472/discrete.c      |  25 +-
 drivers/platform/x86/intel/pmt/class.c             |   9 +-
 .../x86/intel/uncore-frequency/uncore-frequency.c  |   2 +-
 drivers/platform/x86/intel/vsec.c                  |   2 +-
 drivers/platform/x86/oxpec.c                       |  68 +++-
 drivers/platform/x86/siemens/simatic-ipc.c         |  21 +-
 drivers/platform/x86/tuxedo/nb04/wmi_ab.c          |   8 +-
 drivers/power/supply/ab8500_fg.c                   |  69 ++--
 drivers/power/supply/bq27xxx_battery.c             |  12 +-
 drivers/power/supply/cros_charge-control.c         |  29 +-
 drivers/power/supply/generic-adc-battery.c         |   2 +-
 drivers/power/supply/power_supply_core.c           |  84 ++---
 drivers/power/supply/qcom_battmgr.c                |  26 +-
 drivers/power/supply/qcom_smbx.c                   | 109 +++++--
 drivers/pps/generators/pps_gen.c                   |  40 ++-
 drivers/pwm/pwm-tiehrpwm.c                         |   3 +
 drivers/regulator/core.c                           |   4 +
 drivers/regulator/rt6190-regulator.c               |  18 +-
 drivers/remoteproc/remoteproc_elf_loader.c         |  23 +-
 drivers/rtc/rtc-cmos.c                             |   6 +-
 drivers/rtc/rtc-pcf8563.c                          |   2 +-
 drivers/scsi/libiscsi_tcp.c                        |   3 +-
 drivers/sh/intc/core.c                             |  11 +-
 drivers/sh/maple/maple.c                           |   4 +-
 drivers/slimbus/messaging.c                        |   2 +-
 drivers/soc/fsl/dpio/dpio-driver.c                 |   9 +-
 drivers/soc/fsl/qe/tsa.c                           |  16 +-
 drivers/soc/qcom/qcom-geni-se.c                    |  49 +--
 drivers/soc/samsung/exynos-pmu.c                   |  61 +++-
 drivers/spi/spi-amd.c                              |  17 +
 drivers/spi/spi-bcm-qspi.c                         |   3 +-
 drivers/spi/spi-bcm2835.c                          |   4 +-
 drivers/spi/spi-cadence-xspi.c                     |  16 +-
 drivers/spi/spi-ch341.c                            |   6 +
 drivers/spi/spi-jcore.c                            |   2 +
 drivers/spi/spi-ljca.c                             |   7 +-
 drivers/spi/spi-npcm-fiu.c                         |   8 +
 drivers/spi/spi-qpic-snand.c                       |   3 +
 drivers/spi/spi-stm32.c                            |   3 +-
 drivers/spi/spi-zynq-qspi.c                        |  13 +-
 drivers/staging/greybus/uart.c                     |  32 +-
 drivers/staging/media/av7110/sp8870.c              |   5 +-
 drivers/staging/media/imx/imx-media-csc-scaler.c   |   1 +
 drivers/staging/media/meson/vdec/vdec.c            |   2 +-
 drivers/staging/rtl8723bs/core/rtw_recv.c          | 103 +++---
 drivers/staging/rtl8723bs/hal/sdio_ops.c           |   7 +
 .../int340x_thermal/processor_thermal_device.c     |  10 +-
 drivers/thermal/intel/intel_powerclamp.c           |   3 +-
 drivers/tty/serial/8250/8250_exar.c                |  36 +--
 drivers/tty/serial/8250/8250_lpss.c                |   7 +-
 drivers/tty/serial/8250/8250_omap.c                |   3 +
 drivers/tty/serial/amba-pl011.c                    |  37 ++-
 drivers/tty/serial/pmac_zilog.c                    |   4 +-
 drivers/ufs/core/ufs_bsg.c                         |  10 +-
 drivers/ufs/core/ufshcd.c                          |  21 +-
 drivers/usb/class/cdc-acm.c                        |   6 +-
 drivers/usb/core/quirks.c                          |   3 +
 drivers/usb/fotg210/fotg210-udc.c                  |  17 +-
 drivers/usb/gadget/legacy/inode.c                  |   4 +-
 drivers/usb/host/xhci-ring.c                       |   9 +-
 drivers/usb/host/xhci.c                            |  11 +-
 drivers/usb/serial/option.c                        |   5 +
 drivers/usb/serial/sierra.c                        |   3 +-
 drivers/usb/serial/usb_wwan.c                      |   3 +
 drivers/usb/typec/ucsi/ucsi_ccg.c                  |  37 ++-
 drivers/vfio/pci/mlx5/cmd.c                        |   2 +-
 drivers/video/fbdev/atmel_lcdfb.c                  |  13 +-
 drivers/video/fbdev/core/bitblit.c                 |   7 +-
 drivers/video/fbdev/kyro/fbdev.c                   |   4 +-
 drivers/video/fbdev/sh_mobile_lcdcfb.c             |   6 +-
 drivers/video/fbdev/smscufx.c                      |   9 +-
 drivers/video/fbdev/ssd1307fb.c                    |   6 +-
 drivers/video/fbdev/udlfb.c                        |   9 +-
 drivers/video/fbdev/xen-fbfront.c                  |   7 +-
 drivers/xen/gntdev.c                               |   7 +
 drivers/xen/privcmd.c                              |  47 ++-
 drivers/xen/xen-pciback/pci_stub.c                 |   7 +-
 fs/affs/bitmap.c                                   |   2 +-
 fs/aio.c                                           |  18 +-
 fs/backing-file.c                                  |  39 +++
 fs/btrfs/inode.c                                   |   3 -
 fs/btrfs/super.c                                   |   3 +
 fs/btrfs/volumes.c                                 |   6 +-
 fs/ceph/addr.c                                     |  15 +-
 fs/ceph/caps.c                                     |   6 +
 fs/ceph/crypto.c                                   |   3 +
 fs/ceph/mds_client.c                               |  28 +-
 fs/ceph/mdsmap.c                                   |  12 +-
 fs/ceph/snap.c                                     |   7 +-
 fs/ceph/xattr.c                                    |  10 +
 fs/crypto/keysetup.c                               |   8 +-
 fs/dax.c                                           |  14 +-
 fs/dcache.c                                        |  16 +-
 fs/dlm/lowcomms.c                                  |   6 +-
 fs/erofs/decompressor.c                            |   2 +-
 fs/exportfs/expfs.c                                |   6 +-
 fs/ext4/balloc.c                                   |   2 +-
 fs/ext4/ext4.h                                     |   3 +
 fs/ext4/extents.c                                  |  26 +-
 fs/ext4/indirect.c                                 |  17 +
 fs/ext4/inode.c                                    |  13 +-
 fs/ext4/ioctl.c                                    |   3 +-
 fs/ext4/namei.c                                    |  11 +-
 fs/ext4/super.c                                    |  29 +-
 fs/f2fs/compress.c                                 |  10 +-
 fs/f2fs/data.c                                     |  11 +-
 fs/f2fs/file.c                                     |  49 +--
 fs/f2fs/segment.c                                  |   3 +-
 fs/f2fs/super.c                                    |  48 ++-
 fs/fat/fat.h                                       |   2 +-
 fs/fat/fatent.c                                    |  21 +-
 fs/fat/file.c                                      |   3 +-
 fs/fat/misc.c                                      |   6 +-
 fs/fs-writeback.c                                  |   7 +-
 fs/fs_pin.c                                        |   9 +-
 fs/fuse/file.c                                     |  15 +-
 fs/fuse/virtio_fs.c                                |  21 +-
 fs/gfs2/lops.c                                     |   4 +-
 fs/iomap/fiemap.c                                  |   8 +-
 fs/isofs/inode.c                                   |   2 +
 fs/isofs/isofs.h                                   |   2 +
 fs/isofs/rock.c                                    |  11 +-
 fs/jbd2/journal.c                                  |   2 +-
 fs/namespace.c                                     |   7 +-
 fs/nilfs2/dir.c                                    |  34 ++
 fs/nilfs2/inode.c                                  |   8 +-
 fs/nilfs2/ioctl.c                                  |   2 +-
 fs/nilfs2/mdt.c                                    |   6 +-
 fs/nilfs2/page.c                                   |  50 +--
 fs/nilfs2/page.h                                   |   4 +-
 fs/nilfs2/recovery.c                               |   2 +-
 fs/nilfs2/segment.c                                |  12 +-
 fs/nilfs2/sysfs.c                                  |   5 +-
 fs/nilfs2/the_nilfs.c                              |  34 +-
 fs/notify/fanotify/fanotify.c                      |   7 +-
 fs/notify/fanotify/fanotify.h                      |  21 +-
 fs/ntfs3/fslog.c                                   |  29 +-
 fs/ntfs3/index.c                                   |  13 +-
 fs/ocfs2/cluster/heartbeat.c                       |  26 +-
 fs/ocfs2/cluster/nodemanager.c                     |   7 +-
 fs/ocfs2/dir.c                                     |  76 ++++-
 fs/ocfs2/dlmglue.c                                 |   4 +
 fs/ocfs2/file.c                                    |  18 +-
 fs/ocfs2/inode.c                                   |  37 ++-
 fs/ocfs2/journal.c                                 |   3 +-
 fs/ocfs2/journal.h                                 |   1 -
 fs/ocfs2/super.c                                   |  16 +-
 fs/ocfs2/xattr.c                                   | 142 +++++++--
 fs/proc/generic.c                                  |   5 +-
 fs/read_write.c                                    |   8 +-
 fs/signalfd.c                                      |  28 +-
 fs/splice.c                                        |  12 +-
 fs/stat.c                                          |   6 +-
 fs/udf/super.c                                     |   5 +-
 fs/verity/open.c                                   |  38 +--
 fs/xfs/scrub/agheader.c                            |  15 +-
 include/linux/fault-inject.h                       |  10 +-
 include/linux/fs.h                                 |   4 +-
 include/linux/libata.h                             |   1 +
 include/linux/pci.h                                |   2 +-
 include/linux/pps_gen_kernel.h                     |   2 +
 include/linux/rtc.h                                |   2 +
 include/math-emu/op-common.h                       |  23 +-
 include/math-emu/soft-fp.h                         |   8 +
 include/media/v4l2-ctrls.h                         |   6 +
 include/net/addrconf.h                             |   3 +
 include/net/inet_connection_sock.h                 |   8 -
 include/net/ip.h                                   |  25 --
 include/net/ip6_route.h                            |  37 ---
 include/net/mptcp.h                                |   9 +
 include/net/tcp.h                                  |   7 +
 include/trace/events/huge_memory.h                 |   6 +-
 init/main.c                                        |   6 +-
 init/version.c                                     |   3 +
 ipc/mqueue.c                                       |   7 +
 ipc/msgutil.c                                      |   3 +-
 ipc/shm.c                                          |  23 +-
 kernel/bpf/queue_stack_maps.c                      |   3 +
 kernel/cgroup/cgroup.c                             |   2 +-
 kernel/cpu_pm.c                                    |   9 +-
 kernel/debug/gdbstub.c                             |  55 +++-
 kernel/fork.c                                      |   3 +-
 kernel/irq/internals.h                             |   1 +
 kernel/irq/kexec.c                                 |   2 +-
 kernel/irq/manage.c                                |  43 +--
 kernel/panic.c                                     |   3 +-
 kernel/resource.c                                  |   2 +-
 kernel/sched/cpufreq_schedutil.c                   |  14 +-
 kernel/sched/fair.c                                |   7 +-
 kernel/seccomp.c                                   |   7 +-
 kernel/sys.c                                       |   3 +
 kernel/time/itimer.c                               |   2 +-
 kernel/time/namespace.c                            |   2 +-
 kernel/time/posix-cpu-timers.c                     |   4 +-
 kernel/time/timekeeping.c                          |   3 +-
 kernel/trace/ring_buffer.c                         |   2 +
 kernel/ucount.c                                    |  21 +-
 kernel/user_namespace.c                            |   5 +-
 lib/842/842_decompress.c                           |   7 +-
 lib/alloc_tag.c                                    |   2 +-
 lib/buildid.c                                      |   4 +
 lib/decompress_bunzip2.c                           |   6 +-
 lib/fault-inject.c                                 |   7 +-
 lib/iov_iter.c                                     |   4 +
 lib/kobject_uevent.c                               |   2 +-
 lib/plist.c                                        |   7 +
 lib/stackdepot.c                                   |   2 +-
 mm/damon/core.c                                    |   8 +
 mm/damon/paddr.c                                   |   8 +-
 mm/damon/sysfs-schemes.c                           |   6 +-
 mm/damon/sysfs.c                                   |  11 +-
 mm/damon/tests/core-kunit.h                        | 316 +++++++++++++++++++
 mm/damon/vaddr.c                                   |   5 +-
 mm/execmem.c                                       |   4 +-
 mm/hugetlb.c                                       |  66 ++--
 mm/hugetlb_cgroup.c                                |  33 ++
 mm/khugepaged.c                                    |   7 +-
 mm/ksm.c                                           |   5 +-
 mm/madvise.c                                       |  12 +-
 mm/memcontrol.c                                    |  28 +-
 mm/memory.c                                        |  24 +-
 mm/mempolicy.c                                     |  14 +-
 mm/mlock.c                                         |   2 +-
 mm/mremap.c                                        |  33 +-
 mm/nommu.c                                         |   6 +-
 mm/page_alloc.c                                    |  18 +-
 mm/page_isolation.c                                |  40 ++-
 mm/page_table_check.c                              |   4 +-
 mm/percpu.c                                        |   5 +-
 mm/shmem.c                                         |  11 +-
 mm/swap_state.c                                    |  16 +-
 mm/truncate.c                                      |  33 +-
 mm/userfaultfd.c                                   |   6 +-
 mm/vmscan.c                                        |  10 +-
 mm/zswap.c                                         |   5 +-
 net/bluetooth/6lowpan.c                            |   1 +
 net/bluetooth/hci_debugfs.c                        |   9 +
 net/bluetooth/l2cap_core.c                         |  41 ++-
 net/bluetooth/l2cap_sock.c                         |   4 +
 net/ceph/mon_client.c                              |   3 +
 net/ceph/osd_client.c                              |  13 +-
 net/ceph/osdmap.c                                  |  16 +-
 net/core/dev.c                                     |   8 +
 net/core/gro.c                                     |   4 +
 net/core/skbuff.c                                  |  13 +-
 net/ipv4/inet_connection_sock.c                    |  19 +-
 net/ipv4/inet_hashtables.c                         |   5 +-
 net/ipv4/ipmr.c                                    |   1 +
 net/ipv4/netfilter/nf_reject_ipv4.c                |   5 +
 net/ipv4/route.c                                   |   4 +-
 net/ipv4/syncookies.c                              |   2 +
 net/ipv4/sysctl_net_ipv4.c                         |   2 +
 net/ipv4/tcp_cong.c                                |   4 +-
 net/ipv4/tcp_input.c                               |   6 +-
 net/ipv4/tcp_minisocks.c                           |  35 ++-
 net/ipv4/tcp_output.c                              |   7 +-
 net/ipv4/tcp_timer.c                               |   3 +
 net/ipv6/addrconf.c                                |  46 ++-
 net/ipv6/inet6_hashtables.c                        |   4 +-
 net/ipv6/netfilter/nf_reject_ipv6.c                |   5 +
 net/ipv6/reassembly.c                              |   1 +
 net/ipv6/route.c                                   |   2 +-
 net/mptcp/protocol.c                               |   9 +-
 net/mptcp/protocol.h                               |   6 +-
 net/mptcp/subflow.c                                |  35 ++-
 net/netfilter/nf_conntrack_netlink.c               |   8 +-
 net/packet/af_packet.c                             |  12 +-
 net/rds/ib_cm.c                                    |   6 +-
 net/rds/ib_recv.c                                  |  13 +-
 net/sctp/socket.c                                  |  26 +-
 net/smc/smc_tx.c                                   |   7 +
 net/sunrpc/xprtrdma/rpc_rdma.c                     |  27 +-
 net/sunrpc/xprtrdma/svc_rdma_transport.c           |   3 +-
 net/sunrpc/xprtrdma/verbs.c                        |   9 +-
 net/tipc/group.c                                   |  19 +-
 net/tipc/socket.c                                  |  12 +-
 net/unix/sysctl_net_unix.c                         |   4 +-
 net/xdp/xsk_buff_pool.c                            |   2 +
 rust/Makefile                                      |   5 +-
 rust/bindgen_parameters                            |   5 +
 rust/bindings/lib.rs                               |   1 +
 rust/kernel/bitmap.rs                              |   2 +-
 rust/kernel/dma.rs                                 |  21 +-
 rust/kernel/irq/request.rs                         |  22 +-
 rust/kernel/time/hrtimer.rs                        |   6 +-
 scripts/Makefile.autofdo                           |   2 +-
 security/apparmor/af_unix.c                        |  20 +-
 security/apparmor/file.c                           |  59 ++--
 security/apparmor/include/label.h                  |   6 +-
 security/apparmor/label.c                          |   1 -
 security/apparmor/match.c                          |   3 +-
 security/apparmor/policy.c                         |  16 +
 security/apparmor/policy_unpack.c                  |   9 +
 sound/core/compress_offload.c                      |  32 +-
 sound/core/init.c                                  |  12 +-
 sound/core/seq/oss/seq_oss_device.h                |   1 +
 sound/core/seq/oss/seq_oss_event.c                 |   3 +
 sound/core/seq/oss/seq_oss_init.c                  |   2 +
 sound/core/ump_convert.c                           |   2 +-
 sound/drivers/aloop.c                              |  31 +-
 sound/drivers/mpu401/mpu401_uart.c                 |   8 +-
 sound/drivers/mtpav.c                              |   2 +-
 sound/hda/codecs/hdmi/eld.c                        |   6 +-
 sound/hda/codecs/hdmi/hdmi.c                       |   3 +-
 sound/hda/codecs/realtek/alc269.c                  |   3 +-
 sound/hda/codecs/side-codecs/tas2781_hda_i2c.c     |   5 +
 sound/hda/codecs/via.c                             |   1 +
 sound/hda/common/codec.c                           |   6 +
 sound/hda/common/sysfs.c                           |   4 +
 sound/mips/sgio2audio.c                            |  13 +-
 sound/oss/dmasound/dmasound_q40.c                  |  65 ++--
 sound/pci/cs46xx/dsp_spos.c                        |   2 +-
 sound/soc/codecs/arizona-jack.c                    |   1 +
 sound/soc/codecs/hdac_hda.c                        |  16 +
 sound/soc/codecs/lpass-wsa-macro.c                 |  42 ++-
 sound/soc/codecs/pcm6240.c                         |   2 -
 sound/soc/codecs/rt5682s.c                         |   4 +-
 sound/soc/codecs/rt712-sdca-dmic.c                 |   4 +-
 sound/soc/codecs/tlv320aic32x4-clk.c               |   8 +-
 sound/soc/codecs/wcd9335.c                         |  25 +-
 sound/soc/codecs/wm8994.c                          |   3 +
 sound/soc/codecs/wsa883x.c                         |  13 +-
 sound/soc/codecs/wsa884x.c                         |  11 +-
 sound/soc/fsl/fsl_xcvr.c                           |  28 +-
 sound/soc/intel/atom/sst/sst_acpi.c                |  14 +-
 sound/soc/qcom/qdsp6/q6afe.c                       |  10 +-
 sound/soc/qcom/qdsp6/q6apm.c                       |   1 +
 sound/soc/sdw_utils/soc_sdw_rt711.c                |   1 +
 sound/soc/ti/davinci-mcasp.c                       |   1 +
 sound/synth/emux/emux.c                            |  10 +-
 sound/synth/emux/soundfont.c                       |   9 +
 sound/usb/line6/capture.c                          |  25 +-
 sound/usb/line6/capture.h                          |   2 +-
 sound/usb/line6/playback.c                         |  31 +-
 sound/usb/pcm.c                                    |  20 +-
 sound/usb/quirks.c                                 |   2 +
 tools/perf/arch/loongarch/util/header.c            |   2 +-
 tools/perf/util/machine.c                          |   2 +-
 tools/perf/util/powerpc-vpadtl.c                   |   2 +-
 tools/testing/selftests/core/unshare_test.c        |  19 +-
 tools/testing/selftests/seccomp/seccomp_bpf.c      | 179 +++++++++++
 virt/kvm/guest_memfd.c                             |  12 +-
 789 files changed, 8003 insertions(+), 2923 deletions(-)
author maintainer
#1 lore raw

PATCH 1/869 KVM: VMX: Formally define KVMs "0xdead" exit reason used for failed VM-Enter

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

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

From: Sean Christopherson <[email protected]>

[ Upstream commit d85f7dc8cf3c91a131946dae4c3aa8d9c97322d7 ]

Add EXIT_REASON_UNDEFINED to track KVM's magic "0xdead" value that's used to stuff the exit reason on a failed VM-Enter so that the magic can be reused by TDX, and to make it more obvious that it's an arbitrary, KVM- defined value (though the whole "dead" thing makes it pretty darn obvious).

Opportunistically add a compile-time assert to ensure the KVM-defined exit reason never collides with a "real" exit reason.

No functional change intended.

---
 arch/x86/include/asm/vmx.h | 8 ++++++++
 arch/x86/kvm/vmx/vmx.c     | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/include/asm/vmx.h +8 -0
index c85c500195239..a9daddd84ad6c 100644
@@ -20,6 +20,14 @@
 #include <asm/trapnr.h>
 #include <asm/vmxfeatures.h>
 
+/*
+ * UNDEFINED is a KVM-defined value used to indicate that the basic exit reason
+ * is undefined/invalid, e.g. on VM-Fail or if TDX never attempted VM-Enter.
+ * The value itself is arbitrary, it just needs to not collide with a real exit
+ * reason.
+ */
+#define EXIT_REASON_UNDEFINED			0xdead
+
 #define VMCS_CONTROL_BIT(x)	BIT(VMX_FEATURE_##x & 0x1f)
 
 /*
arch/x86/kvm/vmx/vmx.c +3 -1
index 8da96a6c61773..ced20415a14f0 100644
@@ -6151,6 +6151,8 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
 static const int kvm_vmx_max_exit_handlers =
 	ARRAY_SIZE(kvm_vmx_exit_handlers);
 
+static_assert(EXIT_REASON_UNDEFINED >= ARRAY_SIZE(kvm_vmx_exit_handlers));
+
 void vmx_get_exit_info(struct kvm_vcpu *vcpu, u32 *reason,
 		       u64 *info1, u64 *info2, u32 *intr_info, u32 *error_code)
 {
@@ -7333,7 +7335,7 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,
 	vmx_enable_fb_clear(vmx);
 
 	if (unlikely(vmx->fail)) {
-		vmx->vt.exit_reason.full = 0xdead;
+		vmx->vt.exit_reason.full = EXIT_REASON_UNDEFINED;
 		goto out;
 	}
 
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH 2/869 x86/mm/pat: Use pr_warn() for early W^X warnings

In reply to Greg Kroah-Hartman

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

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

From: Mike Rapoport (Microsoft) <[email protected]>

[ Upstream commit ea6fd393cb9e6811a748c7551de0dd3090f9dcde ]

Nathan Chancellor reports the following warning:

CPA detected W^X violation: 8000000000000123 -> 0000000000000123 range: 0xffffffffc0400000 - 0xffffffffc0400fff PFN 100e00

from its_alloc() doing set_memory_x() during early retpoline setup.

The warning is not factually wrong but it is unproductive. First, the RWX permission is temporary and fixed up by execmem_restore_rox(). Second, at the time of the warning, all kernel text is mapped RWX. So there is not even a transient actual security issue.

The right way to fix this up is to relax RWX detection during boot but make a final verification pass over all kernel page tables before running userspace. There is code to do that today (debug_checkwx()) but it must be enabled explicitly in Kconfig.

For now, retain the warning even if it's unproductive, but make it scream less loudly: use pr_warn_once() rather than WARN_ONCE().

Remove the warning once debug_checkwx() behavior becomes unconditional.

---
 arch/x86/mm/pat/set_memory.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/x86/mm/pat/set_memory.c +15 -0
index 12b7de5f0957e..9fc18a091311f 100644
@@ -718,6 +718,21 @@ static inline pgprot_t verify_rwx(pgprot_t old, pgprot_t new, unsigned long star
 		return new;
 
 	end = start + npg * PAGE_SIZE - 1;
+
+	/*
+	 * If the kernel text is still RWX, gently complain, this could be a
+	 * false positive.
+	 * Once debug_checkwx() becomes mandatory for CONFIG_STRICT_KERNEL_RWX,
+	 * the warning can be removed completely.
+	 */
+	if (!kernel_set_to_readonly) {
+		pr_warn_once("CPA detected W^X violation: %016llx -> %016llx range: 0x%016lx - 0x%016lx PFN %lx\n",
+		  (unsigned long long)pgprot_val(old),
+		  (unsigned long long)pgprot_val(new),
+		  start, end, pfn);
+		return new;
+	}
+
 	WARN_ONCE(1, "CPA detected W^X violation: %016llx -> %016llx range: 0x%016lx - 0x%016lx PFN %lx\n",
 		  (unsigned long long)pgprot_val(old),
 		  (unsigned long long)pgprot_val(new),
Signature · 1 line
2.53.0
author maintainer
#3 lore raw

PATCH 3/869 inet: reject unhashed sockets during established lookups

In reply to Greg Kroah-Hartman

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

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

From: Hyunwoo Kim <[email protected]>

[ Upstream commit 4e2b3ef19e0e04adca38442f07dd6bc93c712bf1 ]

TCP established ehash lookups are lockless. The socket caches involved use SLAB_TYPESAFE_BY_RCU, so memory can be reused before an RCU reader that retained its old address has finished.

After a tuple match, __inet_lookup_established() and __inet6_lookup_established() acquire a reference and repeat the tuple check. They do not check whether the new object is hashed. If the address is reused for a socket with the same tuple, the lookup can acquire a reference to the new object and return it while its nulls node is unhashed.

A PoC that drives reuse with a SYN cookie request socket reproduced the crash. The new request socket is unhashed and has a NULL rsk_listener. A lookup that had loaded the address of the old request socket acquired the reference published by tcp_get_cookie_sock() and returned the new object. tcp_v4_rcv() then read sk_state through the NULL listener.

The resulting crash was:

  BUG: kernel NULL pointer dereference, address: 0000000000000012
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  ...
  Oops: Oops: 0000 [#1] SMP NOPTI
  CPU: 4 UID: 0 PID: 0 Comm: swapper/4 Not tainted 7.3.0-00591-g0e135910deec #1 PREEMPT(lazy)
  ...
  RIP: 0010:tcp_v4_rcv+0x44e/0x1280
  ...
  R10: 0000000000000001 R11: 00000000024ca8c0 R12: 0000000000000000
  ...
  CR2: 0000000000000012 CR3: 0000000103d50004 CR4: 0000000000770ef0
  ...
  Call Trace:
   <IRQ>
   ? raw_local_deliver+0xae/0x240
   ip_protocol_deliver_rcu+0x2d/0x180
   ip_local_deliver_finish+0x84/0x100
   ip_sublist_rcv_finish+0x5f/0x70
   ip_sublist_rcv+0x12a/0x1d0
   ip_list_rcv+0xfd/0x130
   __netif_receive_skb_list_core+0x223/0x250
   netif_receive_skb_list_internal+0x1d2/0x2c0
   ? try_fill_recv+0x39/0x7b0
   napi_complete_done+0x74/0x170
   virtnet_poll+0x445/0x600
   __napi_poll+0x27/0x1e0
   net_rx_action+0x2fe/0x3b0
   handle_softirqs+0xc2/0x2c0
   __irq_exit_rcu+0x74/0xd0
   common_interrupt+0x7f/0x90
   </IRQ>
  ...
  Kernel panic - not syncing: Fatal exception in interrupt

After taking a reference, check whether the nulls node is unhashed in both IPv4 and IPv6 established lookups. If it is unhashed or the tuple no longer matches, drop the reference and restart the lookup.

Lookups racing with the TIME_WAIT hashdance, or with a request being replaced by its child, now restart and find the new socket instead of returning the old one.

Request sockets that were never inserted into ehash can have a nonzero refcount, and a stale lookup can hold a transient reference. Therefore, when SYN cookie, Fast Open, and request migration paths fail after setting a nonzero refcount, release the references held by those paths with reqsk_put() instead of freeing the request directly.

---
 net/ipv4/inet_connection_sock.c | 10 +++++++---
 net/ipv4/inet_hashtables.c      |  5 +++--
 net/ipv4/syncookies.c           |  2 ++
 net/ipv4/tcp_input.c            |  4 +++-
 net/ipv6/inet6_hashtables.c     |  4 +++-
 5 files changed, 18 insertions(+), 7 deletions(-)
net/ipv4/inet_connection_sock.c +7 -3
index 6b36652d6bb9d..3e9eaf9d341d1 100644
@@ -1154,10 +1154,14 @@ static void reqsk_timer_handler(struct timer_list *t)
 	 */
 	if (nreq) {
 		__NET_INC_STATS(net, LINUX_MIB_TCPMIGRATEREQFAILURE);
+		/* The timer was not armed, drop its reference here. */
+		reqsk_put(nreq);
 no_ownership:
 		reqsk_migrate_reset(nreq);
 		reqsk_queue_removed(queue, nreq);
-		__reqsk_free(nreq);
+		/* Drop the temporary reference and the one reserved for ehash. */
+		reqsk_put(nreq);
+		reqsk_put(nreq);
 	}
 
 drop:
@@ -1460,7 +1464,7 @@ struct sock *inet_csk_complete_hashdance(struct sock *sk, struct sock *child,
 
 			__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMIGRATEREQFAILURE);
 			reqsk_migrate_reset(nreq);
-			__reqsk_free(nreq);
+			reqsk_put(nreq);
 		} else if (inet_csk_reqsk_queue_add(sk, req, child)) {
 			return child;
 		}
@@ -1515,7 +1519,7 @@ void inet_csk_listen_stop(struct sock *sk)
 					__NET_INC_STATS(sock_net(nsk),
 							LINUX_MIB_TCPMIGRATEREQFAILURE);
 					reqsk_migrate_reset(nreq);
-					__reqsk_free(nreq);
+					reqsk_put(nreq);
 				}
 				rcu_read_unlock();
 
net/ipv4/inet_hashtables.c +3 -2
index a57e33ff92d77..49c70d752a892 100644
@@ -549,8 +549,9 @@ struct sock *__inet_lookup_established(const struct net *net,
 		if (likely(inet_match(net, sk, acookie, ports, dif, sdif))) {
 			if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt)))
 				goto out;
-			if (unlikely(!inet_match(net, sk, acookie,
-						 ports, dif, sdif))) {
+			if (unlikely(hlist_nulls_unhashed_lockless(&sk->sk_nulls_node) ||
+				     !inet_match(net, sk, acookie, ports, dif,
+						 sdif))) {
 				sock_gen_put(sk);
 				goto begin;
 			}
net/ipv4/syncookies.c +2 -0
index b5f0a65c67864..8b3d4e8ee4556 100644
@@ -218,6 +218,8 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
 
 		bh_unlock_sock(child);
 		sock_put(child);
+		reqsk_put(req);
+		return NULL;
 	}
 	__reqsk_free(req);
 
net/ipv4/tcp_input.c +3 -1
index e1785140bf9b1..6a2c05dff4215 100644
@@ -7561,7 +7561,9 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 		if (!inet_csk_reqsk_queue_add(sk, req, fastopen_sk)) {
 			bh_unlock_sock(fastopen_sk);
 			sock_put(fastopen_sk);
-			goto drop_and_free;
+			/* tcp_disconnect() already dropped one reqsk ref. */
+			reqsk_put(req);
+			goto drop;
 		}
 		READ_ONCE(sk->sk_data_ready)(sk);
 		bh_unlock_sock(fastopen_sk);
net/ipv6/inet6_hashtables.c +3 -1
index 182d38e6d6d8d..f4f39a20e9514 100644
@@ -73,7 +73,9 @@ struct sock *__inet6_lookup_established(const struct net *net,
 		if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt)))
 			goto out;
 
-		if (unlikely(!inet6_match(net, sk, saddr, daddr, ports, dif, sdif))) {
+		if (unlikely(hlist_nulls_unhashed_lockless(&sk->sk_nulls_node) ||
+			     !inet6_match(net, sk, saddr, daddr, ports, dif,
+					  sdif))) {
 			sock_gen_put(sk);
 			goto begin;
 		}
Signature · 1 line
2.53.0
author maintainer
#4 lore raw

PATCH 4/869 drm/amdgpu: drop retry loop in amdgpu_hmm_range_get_pages

In reply to Greg Kroah-Hartman

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

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

From: Honglei Huang <[email protected]>

[ Upstream commit 342981fff32802a819d6fc7cf3c9fedf9f3d9d60 ]

Since commit c08972f55594 ("drm/amdgpu: fix amdgpu_hmm_range_get_pages") moved mmu_interval_read_begin() out of the per-chunk loop, the captured notifier_seq is no longer refreshed across retries. As a result, the existing -EBUSY retry path can never make progress:

hmm_range_fault() returns -EBUSY only when mmu_interval_check_retry(notifier, notifier_seq) reports that the sequence is stale. Once the sequence has advanced, the stored seq will never match again, so every subsequent call within the same invocation returns -EBUSY immediately.

The "goto retry" therefore degenerates into a busy spin that simply burns CPU for the full HMM_RANGE_DEFAULT_TIMEOUT (~1s) window before finally bailing out with -EAGAIN. This is pure latency with no chance of recovery, and it actively hurts the KFD userptr stack: the caller ends up blocked for a second while holding mmap_lock, only to return -EAGAIN to the restore worker (or to userspace) which would have re-driven the operation immediately anyway.

Drop the retry/timeout entirely and let -EBUSY propagate straight to out_free_pfns, where it is already translated to -EAGAIN. Recovery is handled at a higher level: the KFD restore_userptr_worker reschedules itself, and the userptr ioctl path returns -EAGAIN to userspace.

No functional regression: the previous behaviour on -EBUSY was already to fail with -EAGAIN after a 1s stall; we just skip the stall.

[ sashal: Adjusted the declaration context: this tree allocates hmm_range with kzalloc() as a plain pointer rather than embedding it, so only the timeout declaration was dropped. ]
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +1 -8
index db2bb5cb671d3..fa3676c5babcd 100644
@@ -173,7 +173,6 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
 	const u64 max_bytes = SZ_2G;
 
 	struct hmm_range *hmm_range;
-	unsigned long timeout;
 	unsigned long *pfns;
 	unsigned long end;
 	int r;
@@ -204,15 +203,9 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
 		pr_debug("hmm range: start = 0x%lx, end = 0x%lx",
 			hmm_range->start, hmm_range->end);
 
-		timeout = jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
-
-retry:
 		r = hmm_range_fault(hmm_range);
-		if (unlikely(r)) {
-			if (r == -EBUSY && !time_after(jiffies, timeout))
-				goto retry;
+		if (unlikely(r))
 			goto out_free_pfns;
-		}
 
 		if (hmm_range->end == end)
 			break;
Signature · 1 line
2.53.0
author maintainer
#5 lore raw

PATCH 5/869 KVM: guest_memfd: Gracefully handle xarray errors when binding a memslot

In reply to Greg Kroah-Hartman

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

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

From: Sean Christopherson <[email protected]>

[ Upstream commit e6ecb88711d93b9e014532f17d3d29b57e80932c ]

If inserting a memslot into a guest_memfd's bindings xarray fails, propagate the error back to the caller, i.e. fail memslot creation as well. Signalling success and continuing on with memslot creation results in use-after-free, as the guest_memfd instance will remain reachable via the memslot after the file is freed (kvm_gmem_release() won't nullify the file pointer due to lack of a valid binding).

Opportunistically WARN and reject binding if KVM_MEMSLOT_GMEM_ONLY is already set, partly to guard against goofs elsewhere, but mostly so that KVM doesn't need to worry about clobbering flags when unwinding on failure.

Regarding the unwind, the slot must be fully prepared before inserting it into the bindings, at which point the slot becomes reachable. I.e. waiting to update the slot in order to avoid the ugly unwind isn't an option. And as part of the unwind, explicitly nullify the relevant bindings, as xarray can store a subset of entries when populating a range.

Fixes a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory")
[ sashal: Changed the two &f->bindings references to &gmem->bindings to match the existing variable name. ]
---
 virt/kvm/guest_memfd.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
virt/kvm/guest_memfd.c +10 -2
index a59a4446b8461..2ab7bb46a371e 100644
@@ -576,6 +576,9 @@ int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_slot *slot,
 	BUILD_BUG_ON(sizeof(gpa_t) != sizeof(offset));
 	BUILD_BUG_ON(sizeof(gfn_t) != sizeof(slot->gmem.pgoff));
 
+	if (WARN_ON_ONCE(slot->flags & KVM_MEMSLOT_GMEM_ONLY))
+		return -EINVAL;
+
 	file = fget(fd);
 	if (!file)
 		return -EBADF;
@@ -613,7 +616,13 @@ int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_slot *slot,
 	if (kvm_gmem_supports_mmap(inode))
 		slot->flags |= KVM_MEMSLOT_GMEM_ONLY;
 
-	xa_store_range(&gmem->bindings, start, end - 1, slot, GFP_KERNEL);
+	r = xa_err(xa_store_range(&gmem->bindings, start, end - 1, slot, GFP_KERNEL));
+	if (r) {
+		xa_store_range(&gmem->bindings, start, end - 1, NULL, GFP_KERNEL);
+		slot->gmem.file = NULL;
+		slot->gmem.pgoff = 0;
+		slot->flags &= ~KVM_MEMSLOT_GMEM_ONLY;
+	}
 	filemap_invalidate_unlock(inode->i_mapping);
 
 	/*
@@ -621,7 +630,6 @@ int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_slot *slot,
 	 * not the other way 'round.  Active bindings are invalidated if the
 	 * file is closed before memslots are destroyed.
 	 */
-	r = 0;
 err:
 	fput(file);
 	return r;
Signature · 1 line
2.53.0
author maintainer
#7 lore raw

PATCH 6/869 mm/truncate: look up the end-edge straddler by index

In reply to Greg Kroah-Hartman

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

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

From: Zhang Yi <[email protected]>

[ Upstream commit f47dee903b9f0f1e4e7181e8a398a7678cabf0a5 ]

In truncate_inode_partial_folio(), after the first split at the start edge, folio_split() unlocks and drops the refcount of the after-split sub-folios. The sub-folio straddling the end of the truncation range is therefore unlocked and only transiently ref'd in the page cache while the code still derives it from a page pointer inside the original folio.

Between the first split finishing and page_folio() resolving split_at2, that tail page can be reclaimed, freed and reallocated as a new large folio in the same mapping at a different file offset. folio2 then points at a folio that does not cover the end boundary, yet folio2->mapping == folio->mapping still holds, so the stale pointer passes the mapping check and folio_split_or_unmap() splits a folio at a wrong position (or, with a transient refcount, a use-after-free window opens between try_get and the split). __folio_split()'s own folio != page_folio(split_at) check cannot catch this either since split_at2 has been reallocated as part of the new folio, so page_folio(split_at2) resolves back to folio2.

Look the straddler up by its page index instead. __filemap_get_folio() returns the folio currently covering the boundary, ref'd and locked, with the mapping validated under the lock, so the split target is always the real folio at the end edge.

Fixes 7460b470a131 ("mm/truncate: use folio_split() in truncate operation")
Cc David Hildenbrand <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Joanne Koong <[email protected]>
Cc Darrick J. Wong <[email protected]>
Cc Yang Erkun <[email protected]>
Cc Zhihao Cheng <[email protected]>
Cc Kefeng Wang <[email protected]>
[ sashal: Retained try_folio_split_or_unmap() instead of folio_split_or_unmap() to preserve the uniform-split fallback. ]
---
 mm/truncate.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
mm/truncate.c +16 -14
index 4bf64fd610c94..9b1baa688a104 100644
@@ -259,30 +259,32 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end)
 		 * for shmem truncate
 		 */
 		struct folio *folio2;
+		pgoff_t end_idx;
 
 		if (offset + length == size)
 			goto no_split;
 
-		split_at2 = folio_page(folio,
-				PAGE_ALIGN_DOWN(offset + length) / PAGE_SIZE);
-		folio2 = page_folio(split_at2);
-
-		if (!folio_try_get(folio2))
+		/*
+		 * After the first split at the start edge, the folio at the
+		 * end edge may be freed and reused concurrently.
+		 * __filemap_get_folio() looks up the straddler at end_idx
+		 * and returns it locked and ref'd with the mapping
+		 * validated.
+		 */
+		end_idx = (pos + offset + length) >> PAGE_SHIFT;
+		folio2 = __filemap_get_folio(folio->mapping, end_idx,
+					     FGP_LOCK | FGP_NOWAIT, 0);
+		if (IS_ERR(folio2))
 			goto no_split;
 
+		/* make sure folio2 is large */
 		if (!folio_test_large(folio2))
 			goto out;
 
-		if (!folio_trylock(folio2))
-			goto out;
-
-		/* make sure folio2 is large and does not change its mapping */
-		if (folio_test_large(folio2) &&
-		    folio2->mapping == folio->mapping)
-			try_folio_split_or_unmap(folio2, split_at2, min_order);
-
-		folio_unlock(folio2);
+		split_at2 = folio_page(folio2, (end_idx - folio2->index));
+		try_folio_split_or_unmap(folio2, split_at2, min_order);
 out:
+		folio_unlock(folio2);
 		folio_put(folio2);
 no_split:
 		return true;
Signature · 1 line
2.53.0
author maintainer
#8 lore raw

PATCH 7/869 staging: rtl8723bs: fix spacing around operators in rtw_recv.c

In reply to Greg Kroah-Hartman

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

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

From: Khasar Munkh-Erdene <[email protected]>

[ Upstream commit 393b267e6f04a11d4b18b7dc1423fa59f173f72b ]

Fix coding style issues by adding missing spaces around binary and ternary operators, as reported by checkpatch.pl.

Stable-dep-of: 495cb31c791b ("staging: rtl8723bs: fix protected RX frame validation in decrypt path")

---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 84 +++++++++++------------
 1 file changed, 42 insertions(+), 42 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +42 -42
index 4727f94df4355..9f9d80e42e4db 100644
@@ -316,7 +316,7 @@ static void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup)
 	} else {
 		cur_time = jiffies;
 
-		if (cur_time - psecuritypriv->last_mic_err_time < 60*HZ) {
+		if (cur_time - psecuritypriv->last_mic_err_time < 60 * HZ) {
 			psecuritypriv->btkip_countermeasure = true;
 			psecuritypriv->last_mic_err_time = 0;
 			psecuritypriv->btkip_countermeasure_time = cur_time;
@@ -384,13 +384,13 @@ static signed int recvframe_chkmic(struct adapter *adapter,  union recv_frame *p
 				mickey = &stainfo->dot11tkiprxmickey.skey[0];
 			}
 
-			datalen = precvframe->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len-prxattrib->icv_len-8;/* icv_len included the mic code */
+			datalen = precvframe->u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len - prxattrib->icv_len - 8;/* icv_len included the mic code */
 			pframe = precvframe->u.hdr.rx_data;
-			payload = pframe+prxattrib->hdrlen+prxattrib->iv_len;
+			payload = pframe + prxattrib->hdrlen + prxattrib->iv_len;
 
 			rtw_seccalctkipmic(mickey, pframe, payload, datalen, &miccode[0], (unsigned char)prxattrib->priority); /* care the length of the data */
 
-			pframemic = payload+datalen;
+			pframemic = payload + datalen;
 
 			bmic_err = false;
 
@@ -437,9 +437,9 @@ static union recv_frame *decryptor(struct adapter *padapter, union recv_frame *p
 	u32  res = _SUCCESS;
 
 	if (prxattrib->encrypt > 0) {
-		u8 *iv = precv_frame->u.hdr.rx_data+prxattrib->hdrlen;
+		u8 *iv = precv_frame->u.hdr.rx_data + prxattrib->hdrlen;
 
-		prxattrib->key_index = (((iv[3])>>6)&0x3);
+		prxattrib->key_index = (((iv[3]) >> 6) & 0x3);
 
 		if (prxattrib->key_index > WEP_KEYS) {
 			switch (prxattrib->encrypt) {
@@ -561,7 +561,7 @@ static signed int recv_decache(union recv_frame *precv_frame, u8 bretry, struct
 {
 	signed int tid = precv_frame->u.hdr.attrib.priority;
 
-	u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num&0xffff) << 4) |
+	u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) |
 		(precv_frame->u.hdr.attrib.frag_num & 0xf);
 
 	if (tid > 15)
@@ -625,29 +625,29 @@ static void process_wmmps_data(struct adapter *padapter, union recv_frame *precv
 	if (!psta->qos_option)
 		return;
 
-	if (!(psta->qos_info&0xf))
+	if (!(psta->qos_info & 0xf))
 		return;
 
-	if (psta->state&WIFI_SLEEP_STATE) {
+	if (psta->state & WIFI_SLEEP_STATE) {
 		u8 wmmps_ac = 0;
 
 		switch (pattrib->priority) {
 		case 1:
 		case 2:
-			wmmps_ac = psta->uapsd_bk&BIT(1);
+			wmmps_ac = psta->uapsd_bk & BIT(1);
 			break;
 		case 4:
 		case 5:
-			wmmps_ac = psta->uapsd_vi&BIT(1);
+			wmmps_ac = psta->uapsd_vi & BIT(1);
 			break;
 		case 6:
 		case 7:
-			wmmps_ac = psta->uapsd_vo&BIT(1);
+			wmmps_ac = psta->uapsd_vo & BIT(1);
 			break;
 		case 0:
 		case 3:
 		default:
-			wmmps_ac = psta->uapsd_be&BIT(1);
+			wmmps_ac = psta->uapsd_be & BIT(1);
 			break;
 		}
 
@@ -967,20 +967,20 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
 		switch (pattrib->priority) {
 		case 1:
 		case 2:
-			wmmps_ac = psta->uapsd_bk&BIT(0);
+			wmmps_ac = psta->uapsd_bk & BIT(0);
 			break;
 		case 4:
 		case 5:
-			wmmps_ac = psta->uapsd_vi&BIT(0);
+			wmmps_ac = psta->uapsd_vi & BIT(0);
 			break;
 		case 6:
 		case 7:
-			wmmps_ac = psta->uapsd_vo&BIT(0);
+			wmmps_ac = psta->uapsd_vo & BIT(0);
 			break;
 		case 0:
 		case 3:
 		default:
-			wmmps_ac = psta->uapsd_be&BIT(0);
+			wmmps_ac = psta->uapsd_be & BIT(0);
 			break;
 		}
 
@@ -992,7 +992,7 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
 			psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
 		}
 
-		if ((psta->state&WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap&BIT(psta->aid))) {
+		if ((psta->state & WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap & BIT(psta->aid))) {
 			struct list_head	*xmitframe_plist, *xmitframe_phead;
 			struct xmit_frame *pxmitframe = NULL;
 			struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -1036,7 +1036,7 @@ static signed int validate_recv_ctrl_frame(struct adapter *padapter, union recv_
 				/* spin_unlock_bh(&psta->sleep_q.lock); */
 				spin_unlock_bh(&pxmitpriv->lock);
 
-				if (pstapriv->tim_bitmap&BIT(psta->aid)) {
+				if (pstapriv->tim_bitmap & BIT(psta->aid)) {
 					if (psta->sleepq_len == 0) {
 						/* issue nulldata with More data bit = 0 to indicate we have no buffered packets */
 						issue_nulldata_in_interrupt(padapter, psta->hwaddr);
@@ -1412,9 +1412,9 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
 				goto validate_80211w_fail;
 			precv_frame = decryptor(adapter, precv_frame);
 			/* save actual management data frame body */
-			memcpy(mgmt_DATA, ptr+pattrib->hdrlen+pattrib->iv_len, data_len);
+			memcpy(mgmt_DATA, ptr + pattrib->hdrlen + pattrib->iv_len, data_len);
 			/* overwrite the iv field */
-			memcpy(ptr+pattrib->hdrlen, mgmt_DATA, data_len);
+			memcpy(ptr + pattrib->hdrlen, mgmt_DATA, data_len);
 			/* remove the iv and icv length */
 			pattrib->pkt_len = pattrib->pkt_len - pattrib->iv_len - pattrib->icv_len;
 			kfree(mgmt_DATA);
@@ -1470,7 +1470,7 @@ static signed int validate_recv_frame(struct adapter *adapter, union recv_frame
 	struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
 
 	u8 *ptr = precv_frame->u.hdr.rx_data;
-	u8  ver = (unsigned char) (*ptr)&0x3;
+	u8  ver = (unsigned char) (*ptr) & 0x3;
 
 	/* add version chk */
 	if (ver != 0) {
@@ -1508,7 +1508,7 @@ static signed int validate_recv_frame(struct adapter *adapter, union recv_frame
 		retval = _FAIL; /*  only data frame return _SUCCESS */
 		break;
 	case WIFI_DATA_TYPE: /* data */
-		pattrib->qos = (subtype & BIT(7)) ? 1:0;
+		pattrib->qos = (subtype & BIT(7)) ? 1 : 0;
 		retval = validate_recv_data_frame(adapter, precv_frame);
 		if (retval == _FAIL) {
 			struct recv_priv *precvpriv = &adapter->recvpriv;
@@ -1553,8 +1553,8 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)
 	if (pattrib->encrypt)
 		recvframe_pull_tail(precvframe, pattrib->icv_len);
 
-	psnap = (struct ieee80211_snap_hdr	*)(ptr+pattrib->hdrlen + pattrib->iv_len);
-	psnap_type = ptr+pattrib->hdrlen + pattrib->iv_len+SNAP_SIZE;
+	psnap = (struct ieee80211_snap_hdr	*)(ptr + pattrib->hdrlen + pattrib->iv_len);
+	psnap_type = ptr + pattrib->hdrlen + pattrib->iv_len + SNAP_SIZE;
 	/* convert hdr + possible LLC headers into Ethernet header */
 	/* eth_type = (psnap_type[0] << 8) | psnap_type[1]; */
 	if ((!memcmp(psnap, rfc1042_header, SNAP_SIZE) &&
@@ -1568,37 +1568,37 @@ static signed int wlanhdr_to_ethhdr(union recv_frame *precvframe)
 		/* Leave Ethernet header part of hdr and full payload */
 		bsnaphdr = false;
 
-	rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr?SNAP_SIZE:0);
+	rmv_len = pattrib->hdrlen + pattrib->iv_len + (bsnaphdr ? SNAP_SIZE : 0);
 	len = precvframe->u.hdr.len - rmv_len;
 
-	memcpy(&be_tmp, ptr+rmv_len, 2);
+	memcpy(&be_tmp, ptr + rmv_len, 2);
 	eth_type = ntohs(be_tmp); /* pattrib->ether_type */
 	pattrib->eth_type = eth_type;
 
 	if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)) {
 		ptr += rmv_len;
 		*ptr = 0x87;
-		*(ptr+1) = 0x12;
+		*(ptr + 1) = 0x12;
 
 		eth_type = 0x8712;
 		/*  append rx status for mp test packets */
-		ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr)+2)-24);
+		ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + 2) - 24);
 		if (!ptr)
 			return _FAIL;
 		memcpy(ptr, get_rxmem(precvframe), 24);
 		ptr += 24;
 	} else {
-		ptr = recvframe_pull(precvframe, (rmv_len-sizeof(struct ethhdr) + (bsnaphdr?2:0)));
+		ptr = recvframe_pull(precvframe, (rmv_len - sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0)));
 		if (!ptr)
 			return _FAIL;
 	}
 
 	memcpy(ptr, pattrib->dst, ETH_ALEN);
-	memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN);
+	memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN);
 
 	if (!bsnaphdr) {
 		be_tmp = htons(len);
-		memcpy(ptr+12, &be_tmp, 2);
+		memcpy(ptr + 12, &be_tmp, 2);
 	}
 
 	return _SUCCESS;
@@ -1736,7 +1736,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
 		pdata += nSubframe_Length;
 		a_len -= nSubframe_Length;
 		if (a_len != 0) {
-			padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4-1));
+			padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4 - 1));
 			if (padding_len == 4)
 				padding_len = 0;
 
@@ -2002,7 +2002,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
 
 			rtw_recv_indicatepkt(padapter, prframe);
 
-			preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096;
+			preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) % 4096;
 
 			return _SUCCESS;
 		}
@@ -2012,7 +2012,7 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
 
 			retval = amsdu_to_msdu(padapter, prframe);
 
-			preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096;
+			preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) % 4096;
 
 			if (retval != _SUCCESS) {
 			}
@@ -2201,7 +2201,7 @@ static int recv_func(struct adapter *padapter, union recv_frame *rframe)
 			!psecuritypriv->busetkipkey) {
 			rtw_enqueue_recvframe(rframe, &padapter->recvpriv.uc_swdec_pending_queue);
 
-			if (recvpriv->free_recvframe_cnt < NR_RECVFRAME/4) {
+			if (recvpriv->free_recvframe_cnt < NR_RECVFRAME / 4) {
 				/* to prevent from recvframe starvation, get recvframe from uc_swdec_pending_queue to free_recvframe_cnt  */
 				rframe = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
 				if (rframe)
@@ -2289,19 +2289,19 @@ static void rtw_signal_stat_timer_hdl(struct timer_list *t)
 		}
 
 		/* update value of signal_strength, rssi, signal_qual */
-		tmp_s = (avg_signal_strength+(_alpha-1)*recvpriv->signal_strength);
+		tmp_s = (avg_signal_strength + (_alpha - 1) * recvpriv->signal_strength);
 		if (tmp_s % _alpha)
-			tmp_s = tmp_s/_alpha + 1;
+			tmp_s = tmp_s / _alpha + 1;
 		else
-			tmp_s = tmp_s/_alpha;
+			tmp_s = tmp_s / _alpha;
 		if (tmp_s > 100)
 			tmp_s = 100;
 
-		tmp_q = (avg_signal_qual+(_alpha-1)*recvpriv->signal_qual);
+		tmp_q = (avg_signal_qual + (_alpha - 1) * recvpriv->signal_qual);
 		if (tmp_q % _alpha)
-			tmp_q = tmp_q/_alpha + 1;
+			tmp_q = tmp_q / _alpha + 1;
 		else
-			tmp_q = tmp_q/_alpha;
+			tmp_q = tmp_q / _alpha;
 		if (tmp_q > 100)
 			tmp_q = 100;
 
Signature · 1 line
2.53.0
author maintainer
#9 lore raw

PATCH 8/869 staging: rtl8723bs: fix protected RX frame validation in decrypt path

In reply to Greg Kroah-Hartman

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

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

From: Tianchu Chen <[email protected]>

[ Upstream commit 495cb31c791bdf3f9efef255a9587b05b0526c9d ]

The RX software decrypt path mishandles crafted protected frames from a malicious AP in two ways:

1) decryptor() never checks that a protected frame is long enough to hold the 802.11 header plus the per-cipher trailer. All of rtw_wep_decrypt(), rtw_tkip_decrypt() and rtw_aes_decrypt() compute

	length = hdr.len - hdrlen - iv_len;

and act on the result, and recvframe_chkmic() similarly computes

	datalen = hdr.len - hdrlen - iv_len - icv_len - 8;

for TKIP (the 8-byte Michael MIC is not accounted for in icv_len). A frame shorter than hdrlen + iv_len + icv_len (+ 8 for TKIP) underflows these unsigned subtractions, turning into a ~4 GiB iteration count in aes_decipher()/arc4_crypt()/rtw_seccalctkipmic() or a ~4 GiB crc32_le() length, causing out-of-bounds reads/writes of up to ~4 GiB starting from the rx skb. Reject such frames in decryptor() before touching the IV; this covers all three ciphers and the TKIP MIC check, and also keeps the unconditional iv[3] access within the frame.

2) validate_80211w_mgmt() keeps using the frame - two memcpys through the stale rx_data pointer and a pkt_len update - before checking whether decryptor() returned NULL. On decrypt failure (e.g. a unicast protected deauth/disassoc/action frame with a bad MIC, which this path always software-decrypts) the skb has already been freed, so this is a use-after-free read/write, and the caller's error path frees the frame a second time, drifting free_recvframe_cnt. Bail out immediately when decryptor() fails, freeing the temporary mgmt_DATA buffer first.

Discovered by Atuin - Automated Vulnerability Discovery Engine.

Fixes 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Assisted-by LLM
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +18 -3
index 9f9d80e42e4db..f8ade0bea1da0 100644
@@ -437,8 +437,21 @@ static union recv_frame *decryptor(struct adapter *padapter, union recv_frame *p
 	u32  res = _SUCCESS;
 
 	if (prxattrib->encrypt > 0) {
-		u8 *iv = precv_frame->u.hdr.rx_data + prxattrib->hdrlen;
+		u8 *iv;
+		u32 min_len = prxattrib->hdrlen + prxattrib->iv_len + prxattrib->icv_len;
 
+		/* TKIP appends an 8-byte Michael MIC that icv_len doesn't account for */
+		if (prxattrib->encrypt == _TKIP_)
+			min_len += 8;
+
+		/* a protected frame must be long enough to hold the IV and ICV/MIC */
+		if (precv_frame->u.hdr.len < min_len) {
+			rtw_free_recvframe(precv_frame,
+					   &padapter->recvpriv.free_recv_queue);
+			return NULL;
+		}
+
+		iv = precv_frame->u.hdr.rx_data + prxattrib->hdrlen;
 		prxattrib->key_index = (((iv[3]) >> 6) & 0x3);
 
 		if (prxattrib->key_index > WEP_KEYS) {
@@ -1411,6 +1424,10 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
 			if (!mgmt_DATA)
 				goto validate_80211w_fail;
 			precv_frame = decryptor(adapter, precv_frame);
+			if (!precv_frame) {
+				kfree(mgmt_DATA);
+				goto validate_80211w_fail;
+			}
 			/* save actual management data frame body */
 			memcpy(mgmt_DATA, ptr + pattrib->hdrlen + pattrib->iv_len, data_len);
 			/* overwrite the iv field */
@@ -1418,8 +1435,6 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
 			/* remove the iv and icv length */
 			pattrib->pkt_len = pattrib->pkt_len - pattrib->iv_len - pattrib->icv_len;
 			kfree(mgmt_DATA);
-			if (!precv_frame)
-				goto validate_80211w_fail;
 		} else if (is_multicast_ether_addr(GetAddr1Ptr(ptr)) &&
 			(subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC)) {
 			signed int BIP_ret = _SUCCESS;
Signature · 1 line
2.53.0
author maintainer
#10 lore raw

PATCH 9/869 tcp: Remove timeout arg from reqsk_timeout().

In reply to Greg Kroah-Hartman

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

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

From: Kuniyuki Iwashima <[email protected]>

[ Upstream commit 207ce0f6bc131812c96cf4f6db328af5396cebac ]

reqsk_timeout() is always called with @timeout being TCP_RTO_MAX.

Let's remove the arg.

As a prep for the next patch, reqsk_timeout() is moved to tcp.h and renamed to tcp_reqsk_timeout().

Stable-dep-of: c9c90cf437a9 ("mptcp: hold MP_JOIN msk ref when cloning reqsk")

---
 include/net/inet_connection_sock.h | 8 --------
 include/net/tcp.h                  | 7 +++++++
 net/ipv4/inet_connection_sock.c    | 2 +-
 net/ipv4/tcp_minisocks.c           | 5 +++--
 4 files changed, 11 insertions(+), 11 deletions(-)
include/net/inet_connection_sock.h +0 -8
index d50e0afc3193f..39ccb785dd4c1 100644
@@ -297,14 +297,6 @@ static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)
 bool inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req);
 void inet_csk_reqsk_queue_drop_and_put(struct sock *sk, struct request_sock *req);
 
-static inline unsigned long
-reqsk_timeout(struct request_sock *req, unsigned long max_timeout)
-{
-	u64 timeout = (u64)req->timeout << req->num_timeout;
-
-	return (unsigned long)min_t(u64, timeout, max_timeout);
-}
-
 void inet_csk_destroy_sock(struct sock *sk);
 void inet_csk_prepare_for_destroy_sock(struct sock *sk);
 void inet_csk_prepare_forced_close(struct sock *sk);
include/net/tcp.h +7 -0
index e40bad5606486..f9bcfa8773a3a 100644
@@ -838,6 +838,13 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
 	return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us);
 }
 
+static inline unsigned long tcp_reqsk_timeout(struct request_sock *req)
+{
+	u64 timeout = (u64)req->timeout << req->num_timeout;
+
+	return (unsigned long)min_t(u64, timeout, TCP_RTO_MAX);
+}
+
 u32 tcp_delack_max(const struct sock *sk);
 
 /* Compute the actual rto_min value */
net/ipv4/inet_connection_sock.c +1 -1
index 3e9eaf9d341d1..9a87ea6c63b46 100644
@@ -1128,7 +1128,7 @@ static void reqsk_timer_handler(struct timer_list *t)
 	     inet_rsk(req)->acked)) {
 		if (req->num_timeout++ == 0)
 			atomic_dec(&queue->young);
-		mod_timer(&req->rsk_timer, jiffies + reqsk_timeout(req, TCP_RTO_MAX));
+		mod_timer(&req->rsk_timer, jiffies + tcp_reqsk_timeout(req));
 
 		if (!nreq)
 			return;
net/ipv4/tcp_minisocks.c +3 -2
index d05009f985afc..2d78801866396 100644
@@ -717,7 +717,8 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 			 * it can be estimated (approximately)
 			 * from another data.
 			 */
-			tmp_opt.ts_recent_stamp = ktime_get_seconds() - reqsk_timeout(req, TCP_RTO_MAX) / HZ;
+			tmp_opt.ts_recent_stamp = ktime_get_seconds() -
+				tcp_reqsk_timeout(req) / HZ;
 			paws_reject = tcp_paws_reject(&tmp_opt, th->rst);
 		}
 	}
@@ -756,7 +757,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 		    !tcp_rtx_synack(sk, req)) {
 			unsigned long expires = jiffies;
 
-			expires += reqsk_timeout(req, TCP_RTO_MAX);
+			expires += tcp_reqsk_timeout(req);
 			if (!fastopen)
 				mod_timer_pending(&req->rsk_timer, expires);
 			else
Signature · 1 line
2.53.0
author maintainer
#11 lore raw

PATCH 10/869 tcp: accecn: unset ECT if receive or send ACE=0 in AccECN negotiaion

In reply to Greg Kroah-Hartman

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

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

From: Chia-Yu Chang <[email protected]>

[ Upstream commit 4024081feb87fb11ac7bd36d8c397ccdd81ed302 ]

Based on specification:
https://tools.ietf.org/id/draft-ietf-tcpm-accurate-ecn-28.txt

Based on Section 3.1.5 of AccECN spec (RFC9768), a TCP Server in AccECN mode MUST NOT set ECT on any packet for the rest of the connection, if it has received or sent at least one valid SYN or Acceptable SYN/ACK with (AE,CWR,ECE) = (0,0,0) during the handshake.

In addition, a host in AccECN mode that is feeding back the IP-ECN field on a SYN or SYN/ACK MUST feed back the IP-ECN field on the latest valid SYN or acceptable SYN/ACK to arrive.

Stable-dep-of: c9c90cf437a9 ("mptcp: hold MP_JOIN msk ref when cloning reqsk")

---
 net/ipv4/inet_connection_sock.c |  3 +++
 net/ipv4/tcp_input.c            |  2 ++
 net/ipv4/tcp_minisocks.c        | 36 ++++++++++++++++++++++++---------
 net/ipv4/tcp_output.c           |  5 ++++-
 net/ipv4/tcp_timer.c            |  3 +++
 5 files changed, 38 insertions(+), 11 deletions(-)
net/ipv4/inet_connection_sock.c +3 -0
index 9a87ea6c63b46..15ad4414cbdb9 100644
@@ -20,6 +20,7 @@
 #include <net/tcp_states.h>
 #include <net/xfrm.h>
 #include <net/tcp.h>
+#include <net/tcp_ecn.h>
 #include <net/sock_reuseport.h>
 #include <net/addrconf.h>
 
@@ -1126,6 +1127,8 @@ static void reqsk_timer_handler(struct timer_list *t)
 	    (!resend ||
 	     !tcp_rtx_synack(sk_listener, req) ||
 	     inet_rsk(req)->acked)) {
+		if (req->num_retrans > 1 && tcp_rsk(req)->accecn_ok)
+			tcp_rsk(req)->accecn_fail_mode |= TCP_ACCECN_ACE_FAIL_SEND;
 		if (req->num_timeout++ == 0)
 			atomic_dec(&queue->young);
 		mod_timer(&req->rsk_timer, jiffies + tcp_reqsk_timeout(req));
net/ipv4/tcp_input.c +2 -0
index 6a2c05dff4215..28db1353445bf 100644
@@ -6236,6 +6236,8 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 	if (th->syn) {
 		if (tcp_ecn_mode_accecn(tp)) {
 			accecn_reflector = true;
+			tp->syn_ect_rcv = TCP_SKB_CB(skb)->ip_dsfield &
+					  INET_ECN_MASK;
 			if (tp->rx_opt.accecn &&
 			    tp->saw_accecn_opt < TCP_ACCECN_OPT_COUNTER_SEEN) {
 				u8 saw_opt = tcp_accecn_option_init(skb, tp->rx_opt.accecn);
net/ipv4/tcp_minisocks.c +26 -10
index 2d78801866396..ebcd78ad13efa 100644
@@ -484,6 +484,10 @@ static void tcp_ecn_openreq_child(struct sock *sk,
 		tp->syn_ect_snt = treq->syn_ect_snt;
 		tcp_accecn_third_ack(sk, skb, treq->syn_ect_snt);
 		tp->saw_accecn_opt = treq->saw_accecn_opt;
+		if (treq->accecn_fail_mode & TCP_ACCECN_ACE_FAIL_SEND)
+			tcp_accecn_fail_mode_set(tp, TCP_ACCECN_ACE_FAIL_SEND);
+		if (treq->accecn_fail_mode & TCP_ACCECN_ACE_FAIL_RECV)
+			tcp_accecn_fail_mode_set(tp, TCP_ACCECN_ACE_FAIL_RECV);
 		tp->prev_ecnfield = treq->syn_ect_rcv;
 		tp->accecn_opt_demand = 1;
 		tcp_ecn_received_counters_payload(sk, skb);
@@ -752,16 +756,28 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 		 */
 		if (!tcp_oow_rate_limited(sock_net(sk), skb,
 					  LINUX_MIB_TCPACKSKIPPEDSYNRECV,
-					  &tcp_rsk(req)->last_oow_ack_time) &&
-
-		    !tcp_rtx_synack(sk, req)) {
-			unsigned long expires = jiffies;
-
-			expires += tcp_reqsk_timeout(req);
-			if (!fastopen)
-				mod_timer_pending(&req->rsk_timer, expires);
-			else
-				req->rsk_timer.expires = expires;
+					  &tcp_rsk(req)->last_oow_ack_time)) {
+			if (tcp_rsk(req)->accecn_ok) {
+				u8 ect_rcv = TCP_SKB_CB(skb)->ip_dsfield &
+					     INET_ECN_MASK;
+
+				tcp_rsk(req)->syn_ect_rcv = ect_rcv;
+				if (tcp_accecn_ace(tcp_hdr(skb)) == 0x0)
+					tcp_rsk(req)->accecn_fail_mode |= TCP_ACCECN_ACE_FAIL_RECV;
+			}
+			if (!tcp_rtx_synack(sk, req)) {
+				unsigned long expires = jiffies;
+
+				if (req->num_retrans > 1 && tcp_rsk(req)->accecn_ok)
+					tcp_rsk(req)->accecn_fail_mode |= TCP_ACCECN_ACE_FAIL_SEND;
+
+				expires += tcp_reqsk_timeout(req);
+				if (!fastopen)
+					mod_timer_pending(&req->rsk_timer,
+							  expires);
+				else
+					req->rsk_timer.expires = expires;
+			}
 		}
 		return NULL;
 	}
net/ipv4/tcp_output.c +4 -1
index ddcc7e53f2e34..f6210d4a3408f 100644
@@ -333,8 +333,11 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb,
 		return;
 
 	if (tcp_ecn_mode_accecn(tp)) {
-		if (!tcp_accecn_ace_fail_recv(tp))
+		if (!tcp_accecn_ace_fail_recv(tp) &&
+		    !tcp_accecn_ace_fail_send(tp))
 			INET_ECN_xmit(sk);
+		else
+			INET_ECN_dontxmit(sk);
 		tcp_accecn_set_ace(tp, skb, th);
 		skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN;
 	} else {
net/ipv4/tcp_timer.c +3 -0
index eb549fea8fdd9..017a52022a1a2 100644
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <net/tcp.h>
+#include <net/tcp_ecn.h>
 #include <net/rstreason.h>
 
 static u32 tcp_clamp_rto_to_user_timeout(const struct sock *sk)
@@ -482,6 +483,8 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
 	 * it's not good to give up too easily.
 	 */
 	tcp_rtx_synack(sk, req);
+	if (req->num_retrans > 1 && tcp_rsk(req)->accecn_ok)
+		tcp_rsk(req)->accecn_fail_mode |= TCP_ACCECN_ACE_FAIL_SEND;
 	req->num_timeout++;
 	tcp_update_rto_stats(sk);
 	if (!tp->retrans_stamp)
Signature · 1 line
2.53.0
author maintainer
#12 lore raw

PATCH 11/869 mptcp: hold MP_JOIN msk ref when cloning reqsk

In reply to Greg Kroah-Hartman

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

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

From: Ruide Cao <[email protected]>

[ Upstream commit c9c90cf437a9e6597611b6d3aad6e255fad22867 ]

TCP request migration clones pending request sockets with inet_reqsk_clone(). For MPTCP MP_JOIN requests this byte-copies subflow_req->msk, but the clone does not own a reference.

The original and cloned requests can consequently drop the same msk reference, leaving one request with a dangling pointer. This manifests as a KASAN slab-use-after-free in subflow_req_destructor():

  BUG: KASAN: slab-use-after-free in subflow_req_destructor (net/mptcp/subflow.c:45)
  Write of size 4 at addr ff1100010e008d40 by task swapper/0/0
  CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 7.2.0-rc5-00353-gc27e36054537 #10 PREEMPT(full)

  Call Trace:
   subflow_req_destructor (net/mptcp/subflow.c:45)
   subflow_v4_req_destructor (net/mptcp/subflow.c:694)
   __reqsk_free (net/ipv4/inet_connection_sock.c:906)
   reqsk_timer_handler (include/net/request_sock.h:137 net/ipv4/inet_connection_sock.c:1147)

  Allocated by task 10014:
   sk_prot_alloc (net/core/sock.c:2246)
   sk_clone (net/core/sock.c:2488)
   mptcp_sk_clone_init (include/net/sock.h:1848 net/mptcp/protocol.c:3564)
   subflow_syn_recv_sock (net/mptcp/subflow.c:883)
   tcp_check_req (net/ipv4/tcp_minisocks.c:934)

  Freed by task 0:
   slab_free_after_rcu_debug (include/linux/kasan.h:235 mm/slub.c:2677 mm/slub.c:6439)
   rcu_core (kernel/rcu/tree.c:2645 kernel/rcu/tree.c:2897)

  Last potentially related work creation:
   kmem_cache_free (mm/slub.c:2638 mm/slub.c:6377 mm/slub.c:6504)
   __sk_destruct (net/core/sock.c:2289 net/core/sock.c:2391)
   sk_destruct (net/core/sock.c:2419)
   __sk_free (net/core/sock.c:2430)
   sk_free (net/core/sock.c:2441)
   mptcp_close (include/net/sock.h:2020 net/mptcp/protocol.c:3399)
   inet_release (net/ipv4/af_inet.c:442)

  The buggy address belongs to the cache MPTCP of size 2968
  The buggy address is 128 bytes inside a freed 2968-byte region

A non-NULL subflow_req->msk means that the request owns one reference. The third ACK can concurrently transfer the original request reference to the child and release it, so taking an unconditional hold on the copied pointer is unsafe.

MPTCP sockets use SLAB_TYPESAFE_BY_RCU and all current inet_reqsk_clone() callers run in an RCU read-side critical section. Document and lockdep-check that calling-context requirement. Read the pointer from the original request and acquire a reference only if it is still live. Use refcount_inc_not_zero_acquire() so the subsequent ownership validation cannot be reordered before the try-get, then re-read the original request to verify that it still owns the same msk. If either check fails, clear the clone pointer; otherwise its normal destructor balances the new reference. Mark the ownership-transfer store with WRITE_ONCE() to match the lockless reads.

The following patch completes the clone fixup for MP_CAPABLE token ownership. Both patches carry the same Fixes tag and are required for stable backports.

---
 include/net/mptcp.h             |  9 +++++++++
 net/ipv4/inet_connection_sock.c |  4 ++++
 net/mptcp/subflow.c             | 35 ++++++++++++++++++++++++++++++++-
 3 files changed, 47 insertions(+), 1 deletion(-)
include/net/mptcp.h +9 -0
index f7263fe2a2e40..a296f711e92f3 100644
@@ -219,6 +219,9 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req,
 struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops,
 					       struct sock *sk_listener,
 					       bool attach_listener);
+/* Caller must hold an RCU read-side lock. */
+void mptcp_subflow_reqsk_clone(struct request_sock *req,
+			       struct request_sock *new_req);
 
 __be32 mptcp_get_reset_option(const struct sk_buff *skb);
 
@@ -314,6 +317,12 @@ static inline struct request_sock *mptcp_subflow_reqsk_alloc(const struct reques
 	return NULL;
 }
 
+/* Caller must hold an RCU read-side lock. */
+static inline void mptcp_subflow_reqsk_clone(struct request_sock *req,
+					     struct request_sock *new_req)
+{
+}
+
 static inline __be32 mptcp_reset_option(const struct sk_buff *skb)  { return htonl(0u); }
 
 static inline void mptcp_active_detect_blackhole(struct sock *sk, bool expired) { }
net/ipv4/inet_connection_sock.c +4 -0
index 15ad4414cbdb9..dd14944ad3edd 100644
@@ -21,6 +21,7 @@
 #include <net/xfrm.h>
 #include <net/tcp.h>
 #include <net/tcp_ecn.h>
+#include <net/mptcp.h>
 #include <net/sock_reuseport.h>
 #include <net/addrconf.h>
 
@@ -983,6 +984,9 @@ static struct request_sock *inet_reqsk_clone(struct request_sock *req,
 		rcu_assign_pointer(tcp_sk(nreq->sk)->fastopen_rsk, nreq);
 	}
 
+	if (rsk_is_mptcp(req))
+		mptcp_subflow_reqsk_clone(req, nreq);
+
 	return nreq;
 }
 
net/mptcp/subflow.c +34 -1
index 1932fcf9f9252..e020960f093e0 100644
@@ -47,6 +47,39 @@ static void subflow_req_destructor(struct request_sock *req)
 	mptcp_token_destroy_request(req);
 }
 
+void mptcp_subflow_reqsk_clone(struct request_sock *req,
+			       struct request_sock *new_req)
+{
+	struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
+	struct mptcp_subflow_request_sock *new_subflow_req;
+	struct mptcp_sock *msk;
+
+	new_subflow_req = mptcp_subflow_rsk(new_req);
+	RCU_LOCKDEP_WARN(!rcu_read_lock_any_held(),
+			 "MPTCP reqsk clone called without RCU");
+
+	/* A non-NULL ->msk means the request owns one reference.  The clone
+	 * copied only the pointer, while the original request can concurrently
+	 * transfer its reference to the child.  Acquire a reference for the
+	 * clone, then verify that the original request still owns the same msk.
+	 * MPTCP sockets use SLAB_TYPESAFE_BY_RCU and all clone callers run in
+	 * an RCU read-side critical section, keeping the memory stable here.
+	 */
+	msk = READ_ONCE(subflow_req->msk);
+	if (msk) {
+		struct sock *sk = (struct sock *)msk;
+
+		if (!refcount_inc_not_zero_acquire(&sk->sk_refcnt)) {
+			msk = NULL;
+		} else if (READ_ONCE(subflow_req->msk) != msk) {
+			sock_put(sk);
+			msk = NULL;
+		}
+	}
+
+	new_subflow_req->msk = msk;
+}
+
 static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2,
 				  void *hmac)
 {
@@ -925,7 +958,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 			}
 
 			/* move the msk reference ownership to the subflow */
-			subflow_req->msk = NULL;
+			WRITE_ONCE(subflow_req->msk, NULL);
 			ctx->conn = (struct sock *)owner;
 
 			if (subflow_use_different_sport(owner, sk)) {
Signature · 1 line
2.53.0
author maintainer
#13 lore raw

PATCH 12/869 virtio_net: atomically disable rx mode work

In reply to Greg Kroah-Hartman

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

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

From: Weiming Shi <[email protected]>

[ Upstream commit 1234707482053f1d1ac7c5756207d2c29057974c ]

virtio-net uses a boolean to gate rx_mode_work during device teardown. The flag is changed under RTNL, but ndo_set_rx_mode checks it under the address-list lock. A callback can therefore pass the check and enqueue work after teardown has flushed it. The work is also enabled before late probe operations that can fail, allowing probe unwind to free the netdev with work still queued.

KASAN reports the worker using a virtqueue that probe unwind already freed:

  BUG: KASAN: slab-use-after-free in virtqueue_add_split
  Workqueue: events virtnet_rx_mode_work
  Call Trace:
   virtqueue_add_split (drivers/virtio/virtio_ring.c:706)
   virtqueue_add_sgs (drivers/virtio/virtio_ring.c:2839)
   virtnet_send_command_reply (drivers/net/virtio_net.c:3565)
   virtnet_rx_mode_work (drivers/net/virtio_net.c:3833)
   process_one_work (kernel/workqueue.c:3322)
   worker_thread (kernel/workqueue.c:3405)
  Freed by task 119:
   kfree (mm/slub.c:6625)
   vp_del_vq.isra.0 (drivers/virtio/virtio_pci_common.c:259)
   vp_del_vqs (drivers/virtio/virtio_pci_common.c:285)
   virtnet_probe (drivers/net/virtio_net.c:7129)

Use the workqueue disable mechanism to atomically reject new queue attempts and drain running work. Keep work disabled until probe succeeds or restore has reattached the netdev, then enable it and replay receive-mode state for a running interface. Disable it before resource teardown in freeze and remove.

Fixes b9f7425239a0 ("virtio-net: convert rx mode setting to use workqueue")
Assisted-by LLM
[ sashal: Adjusted context to preserve existing refill handling and restore error paths. ]
---
 drivers/net/virtio_net.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/net/virtio_net.c +9 -16
index b7ab57f4e277a..34390befdf8a8 100644
@@ -458,9 +458,6 @@ struct virtnet_info {
 	/* Work struct for setting rx mode */
 	struct work_struct rx_mode_work;
 
-	/* OK to queue work setting RX mode? */
-	bool rx_mode_work_enabled;
-
 	/* Does the affinity hint is set for virtqueues? */
 	bool affinity_hint_set;
 
@@ -740,16 +737,13 @@ static void disable_delayed_refill(struct virtnet_info *vi)
 
 static void enable_rx_mode_work(struct virtnet_info *vi)
 {
-	rtnl_lock();
-	vi->rx_mode_work_enabled = true;
-	rtnl_unlock();
+	if (enable_work(&vi->rx_mode_work) && netif_running(vi->dev))
+		schedule_work(&vi->rx_mode_work);
 }
 
 static void disable_rx_mode_work(struct virtnet_info *vi)
 {
-	rtnl_lock();
-	vi->rx_mode_work_enabled = false;
-	rtnl_unlock();
+	disable_work_sync(&vi->rx_mode_work);
 }
 
 static void virtqueue_napi_schedule(struct napi_struct *napi,
@@ -3996,8 +3990,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
 {
 	struct virtnet_info *vi = netdev_priv(dev);
 
-	if (vi->rx_mode_work_enabled)
-		schedule_work(&vi->rx_mode_work);
+	schedule_work(&vi->rx_mode_work);
 }
 
 static int virtnet_vlan_rx_add_vid(struct net_device *dev,
@@ -5813,7 +5806,6 @@ static void virtnet_freeze_down(struct virtio_device *vdev)
 	/* Make sure no work handler is accessing the device */
 	flush_work(&vi->config_work);
 	disable_rx_mode_work(vi);
-	flush_work(&vi->rx_mode_work);
 
 	if (netif_running(vi->dev)) {
 		rtnl_lock();
@@ -5840,7 +5832,6 @@ static int virtnet_restore_up(struct virtio_device *vdev)
 	virtio_device_ready(vdev);
 
 	enable_delayed_refill(vi);
-	enable_rx_mode_work(vi);
 
 	if (netif_running(vi->dev)) {
 		rtnl_lock();
@@ -5853,6 +5844,8 @@ static int virtnet_restore_up(struct virtio_device *vdev)
 	netif_tx_lock_bh(vi->dev);
 	netif_device_attach(vi->dev);
 	netif_tx_unlock_bh(vi->dev);
+
+	enable_rx_mode_work(vi);
 	return err;
 }
 
@@ -6952,6 +6945,7 @@ static int virtnet_probe(struct virtio_device *vdev)
 
 	INIT_WORK(&vi->config_work, virtnet_config_changed_work);
 	INIT_WORK(&vi->rx_mode_work, virtnet_rx_mode_work);
+	disable_work(&vi->rx_mode_work);
 	spin_lock_init(&vi->refill_lock);
 
 	if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) {
@@ -7103,8 +7097,6 @@ static int virtnet_probe(struct virtio_device *vdev)
 	if (vi->has_rss || vi->has_rss_hash_report)
 		virtnet_init_default_rss(vi);
 
-	enable_rx_mode_work(vi);
-
 	/* serialize netdev register + virtio_device_ready() with ndo_open() */
 	rtnl_lock();
 
@@ -7204,6 +7196,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 		goto free_unregister_netdev;
 	}
 
+	enable_rx_mode_work(vi);
+
 	pr_debug("virtnet: registered device %s with %d RX and TX vq's\n",
 		 dev->name, max_queue_pairs);
 
@@ -7255,7 +7249,6 @@ static void virtnet_remove(struct virtio_device *vdev)
 	/* Make sure no work handler is accessing the device. */
 	flush_work(&vi->config_work);
 	disable_rx_mode_work(vi);
-	flush_work(&vi->rx_mode_work);
 
 	virtnet_free_irq_moder(vi);
 
Signature · 1 line
2.53.0
author maintainer
#14 lore raw

PATCH 13/869 pps: generators: dont use the drivers info after unregister

In reply to Greg Kroah-Hartman

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

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

From: Danish Khateeb <[email protected]>

[ Upstream commit 4e8063cae337cb7328e6856235cf4de5d165516e ]

A file that was opened before pps_gen_unregister_source() keeps pps_gen, and with it the pointer to the driver's pps_gen_source_info. PPS_GEN_SETENABLE and PPS_GEN_USESYSTEMCLOCK keep using that pointer after the driver has gone:

- pps_gen_tio allocates its info with devm_kzalloc(), so after an unbind both ioctls read freed memory, and SETENABLE calls the driver's enable() with its freed private data.

- pps_gen-dummy does not set info->owner, so it can be unloaded while the file is open, and the ioctls then read the unloaded module's data and call its code.

TIO can't probe in a VM, as it needs ART. A test driver that registers its info in devm memory like TIO does, unbound while /dev/pps-gen0 is open, gives:

  BUG: KASAN: slab-use-after-free in pps_gen_cdev_ioctl+0x4c1/0x580
  Read of size 1 at addr ffff88800e647f38 by task ppsgen64/145
  ...
  Freed by task 146:
   kfree+0x25a/0x6d0
   release_nodes+0xd1/0x140
   devres_release_all+0x10e/0x1a0
   device_unbind_cleanup+0x71/0x250
   device_release_driver_internal+0x41b/0x570
   unbind_store+0xd9/0x100

and unloading pps_gen-dummy while its file is open oopses:

  BUG: unable to handle page fault for address: ffffffffa0203040
  Oops: Oops: 0000 [#1] SMP KASAN NOPTI
  RIP: 0010:pps_gen_cdev_ioctl+0x372/0x580

Protect info in the ioctl handler with a mutex, and clear it under the mutex on unregister, so that unregister waits for the ioctls using it and later ones fail with -ENODEV. PPS_KC_BIND does the same for a removed PPS device since commit 3649f9a6b897 ("pps: don't allow PPS_KC_BIND on removed devices"). The sysfs attributes need nothing
new: they are removed, and their callbacks drained, before info is cleared.

---
 drivers/pps/generators/pps_gen.c | 31 ++++++++++++++++++++++++++-----
 include/linux/pps_gen_kernel.h   |  2 ++
 2 files changed, 28 insertions(+), 5 deletions(-)
drivers/pps/generators/pps_gen.c +26 -5
index 69a470fa164d6..630a8804d63e7 100644
@@ -69,17 +69,28 @@ static long pps_gen_cdev_ioctl(struct file *file,
 		if (ret)
 			return -EFAULT;
 
-		ret = pps_gen->info->enable(pps_gen, status);
-		if (ret)
-			return ret;
-		pps_gen->enabled = status;
+		scoped_guard(mutex, &pps_gen->info_lock) {
+			if (!pps_gen->info)
+				return -ENODEV;
+
+			ret = pps_gen->info->enable(pps_gen, status);
+			if (ret)
+				return ret;
+			pps_gen->enabled = status;
+		}
 
 		break;
 
 	case PPS_GEN_USESYSTEMCLOCK:
 		dev_dbg(&pps_gen->dev, "PPS_GEN_USESYSTEMCLOCK\n");
 
-		ret = put_user(pps_gen->info->use_system_clock, uiuarg);
+		scoped_guard(mutex, &pps_gen->info_lock) {
+			if (!pps_gen->info)
+				return -ENODEV;
+			status = pps_gen->info->use_system_clock;
+		}
+
+		ret = put_user(status, uiuarg);
 		if (ret)
 			return -EFAULT;
 
@@ -212,6 +223,15 @@ static void pps_gen_unregister_cdev(struct pps_gen_device *pps_gen)
 {
 	pr_debug("unregistering pps-gen%d\n", pps_gen->id);
 	cdev_device_del(&pps_gen->cdev, &pps_gen->dev);
+
+	/*
+	 * An open file keeps pps_gen around, but the driver may free info as
+	 * soon as we return. The sysfs files are gone now, so wait for the
+	 * ioctls using info and make later ones fail.
+	 */
+	scoped_guard(mutex, &pps_gen->info_lock)
+		pps_gen->info = NULL;
+
 	put_device(&pps_gen->dev);
 }
 
@@ -243,6 +263,7 @@ struct pps_gen_device *pps_gen_register_source(const struct pps_gen_source_info
 	pps_gen->info = info;
 	pps_gen->enabled = false;
 
+	mutex_init(&pps_gen->info_lock);
 	init_waitqueue_head(&pps_gen->queue);
 	spin_lock_init(&pps_gen->lock);
 
include/linux/pps_gen_kernel.h +2 -0
index f26f6aac000dc..c4d22b1af1186 100644
@@ -11,6 +11,7 @@
 #include <linux/pps_gen.h>
 #include <linux/cdev.h>
 #include <linux/device.h>
+#include <linux/mutex.h>
 
 /*
  * Global defines
@@ -44,6 +45,7 @@ struct pps_gen_source_info {
 /* The main struct */
 struct pps_gen_device {
 	const struct pps_gen_source_info *info;	/* PSS generator info */
+	struct mutex info_lock;			/* protects info */
 	bool enabled;				/* PSS generator status */
 
 	unsigned int event;
Signature · 1 line
2.53.0
author maintainer
#15 lore raw

PATCH 14/869 nvmet: replace use of system_wq with system_percpu_wq

In reply to Greg Kroah-Hartman

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

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

From: Marco Crivellari <[email protected]>

[ Upstream commit 3d553be6d295b6cca8fd35cb673fd13934ac4cbc ]

This patch continues the effort to refactor workqueue APIs, which has begun with the changes introducing new workqueues and a new alloc_workqueue flag:

commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")

The point of the refactoring is to eventually alter the default behavior of workqueues to become unbound by default so that their workload placement is optimized by the scheduler.

Before that to happen, workqueue users must be converted to the better named new workqueues with no intended behaviour changes:

system_wq -> system_percpu_wq
system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be removed in the future.

Stable-dep-of: 53f6efe00cea ("nvmet-auth: serialize access to DH-HMAC-CHAP state to fix UAF")

---
 drivers/nvme/target/admin-cmd.c        | 2 +-
 drivers/nvme/target/fabrics-cmd-auth.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/admin-cmd.c +1 -1
index fa9920787a8ff..623b5303de2aa 100644
@@ -1606,7 +1606,7 @@ void nvmet_execute_keep_alive(struct nvmet_req *req)
 
 	pr_debug("ctrl %d update keep-alive timer for %d secs\n",
 		ctrl->cntlid, ctrl->kato);
-	mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
+	mod_delayed_work(system_percpu_wq, &ctrl->ka_work, ctrl->kato * HZ);
 out:
 	nvmet_req_complete(req, status);
 }
drivers/nvme/target/fabrics-cmd-auth.c +1 -1
index 5b010318286e4..af712c6624b36 100644
@@ -410,7 +410,7 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
 	    req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) {
 		unsigned long auth_expire_secs = ctrl->kato ? ctrl->kato : 120;
 
-		mod_delayed_work(system_wq, &req->sq->auth_expired_work,
+		mod_delayed_work(system_percpu_wq, &req->sq->auth_expired_work,
 				 auth_expire_secs * HZ);
 		goto complete;
 	}
Signature · 1 line
2.53.0
author maintainer
#16 lore raw

PATCH 15/869 nvmet-auth: serialize access to DH-HMAC-CHAP state to fix UAF

In reply to Greg Kroah-Hartman

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

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

From: Jérémy Jean <[email protected]>

[ Upstream commit 53f6efe00cea0c0cf7bd99debe3cdac8567170b5 ]

A REPLY AUTH_SEND command can derive a dhchap_skey key while a concurrent AUTH_RECEIVE command observing this REPLY state executes the failure path and frees that key. The REPLY command then continues and writes into freed memory, causing a use-after-free. KASAN reports it as:

  BUG: KASAN: slab-use-after-free in __sha256_final
  Write of size 4 at addr ffff88800359c540
  ...
  nvmet_auth_sq_free (drivers/nvme/target/auth.c:237)
  nvmet_execute_auth_receive (drivers/nvme/target/fabrics-cmd-auth.c:621)

Add a mutex to each submission queue to serialize authentication commands and timeout handling. Unlock the mutex before completing requests and ignore outdated timeout callbacks. Limit timeout delays to prevent immediate expiry on 32-bit kernels.

Fixes 7a277c37d352 ("nvmet-auth: Diffie-Hellman key exchange support")
Assisted-by LLM
---
 drivers/nvme/target/auth.c             |  1 +
 drivers/nvme/target/fabrics-cmd-auth.c | 32 ++++++++++++++++++++++----
 drivers/nvme/target/nvmet.h            |  2 ++
 3 files changed, 31 insertions(+), 4 deletions(-)
drivers/nvme/target/auth.c +1 -0
index 8230a0563616b..4c68225411be3 100644
@@ -238,6 +238,7 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
 
 void nvmet_auth_sq_free(struct nvmet_sq *sq)
 {
+	sq->auth_expiry_active = false;
 	cancel_delayed_work(&sq->auth_expired_work);
 #ifdef CONFIG_NVME_TARGET_TCP_TLS
 	sq->tls_key = NULL;
drivers/nvme/target/fabrics-cmd-auth.c +28 -4
index af712c6624b36..20a2dfcbbc57f 100644
@@ -6,6 +6,7 @@
  */
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/blkdev.h>
+#include <linux/jiffies.h>
 #include <linux/random.h>
 #include <linux/nvme-auth.h>
 #include <crypto/hash.h>
@@ -18,16 +19,27 @@ static void nvmet_auth_expired_work(struct work_struct *work)
 	struct nvmet_sq *sq = container_of(to_delayed_work(work),
 			struct nvmet_sq, auth_expired_work);
 
+	mutex_lock(&sq->auth_lock);
+	/* A command may have cancelled or rearmed this timeout. */
+	if (!sq->auth_expiry_active ||
+	    delayed_work_pending(&sq->auth_expired_work))
+		goto out_unlock;
+	sq->auth_expiry_active = false;
+
 	pr_debug("%s: ctrl %d qid %d transaction %u expired, resetting\n",
 		 __func__, sq->ctrl->cntlid, sq->qid, sq->dhchap_tid);
 	sq->dhchap_step = NVME_AUTH_DHCHAP_MESSAGE_NEGOTIATE;
 	sq->dhchap_tid = -1;
+out_unlock:
+	mutex_unlock(&sq->auth_lock);
 }
 
 void nvmet_auth_sq_init(struct nvmet_sq *sq)
 {
 	/* Initialize in-band authentication */
+	mutex_init(&sq->auth_lock);
 	INIT_DELAYED_WORK(&sq->auth_expired_work, nvmet_auth_expired_work);
+	sq->auth_expiry_active = false;
 	sq->authenticated = false;
 	sq->dhchap_step = NVME_AUTH_DHCHAP_MESSAGE_NEGOTIATE;
 }
@@ -258,6 +270,8 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
 	u16 status = 0;
 	u8 dhchap_status;
 
+	mutex_lock(&req->sq->auth_lock);
+
 	if (req->cmd->auth_send.secp != NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER) {
 		status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
 		req->error_loc =
@@ -283,8 +297,10 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
 			offsetof(struct nvmf_auth_send_command, tl);
 		goto done;
 	}
-	if (!nvmet_check_transfer_len(req, tl)) {
+	if (unlikely(tl != req->transfer_len)) {
 		pr_debug("%s: transfer length mismatch (%u)\n", __func__, tl);
+		mutex_unlock(&req->sq->auth_lock);
+		nvmet_check_transfer_len(req, tl);
 		return;
 	}
 
@@ -408,10 +424,12 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
 			 status, req->error_loc);
 	if (req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 &&
 	    req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) {
-		unsigned long auth_expire_secs = ctrl->kato ? ctrl->kato : 120;
+		unsigned long auth_expire = min_t(u64, MAX_JIFFY_OFFSET,
+			(u64)(ctrl->kato ? ctrl->kato : 120) * HZ);
 
+		req->sq->auth_expiry_active = true;
 		mod_delayed_work(system_percpu_wq, &req->sq->auth_expired_work,
-				 auth_expire_secs * HZ);
+				 auth_expire);
 		goto complete;
 	}
 	/* Final states, clear up variables */
@@ -420,6 +438,7 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
 		nvmet_ctrl_fatal_error(ctrl);
 
 complete:
+	mutex_unlock(&req->sq->auth_lock);
 	nvmet_req_complete(req, status);
 }
 
@@ -538,6 +557,8 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
 	u32 al;
 	u16 status = 0;
 
+	mutex_lock(&req->sq->auth_lock);
+
 	if (req->cmd->auth_receive.secp != NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER) {
 		status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
 		req->error_loc =
@@ -563,8 +584,10 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
 			offsetof(struct nvmf_auth_receive_command, al);
 		goto done;
 	}
-	if (!nvmet_check_transfer_len(req, al)) {
+	if (unlikely(al != req->transfer_len)) {
 		pr_debug("%s: transfer length mismatch (%u)\n", __func__, al);
+		mutex_unlock(&req->sq->auth_lock);
+		nvmet_check_transfer_len(req, al);
 		return;
 	}
 
@@ -623,5 +646,6 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
 		nvmet_auth_sq_free(req->sq);
 		nvmet_ctrl_fatal_error(ctrl);
 	}
+	mutex_unlock(&req->sq->auth_lock);
 	nvmet_req_complete(req, status);
 }
drivers/nvme/target/nvmet.h +2 -0
index 87e2fdbd18656..45fc188412d28 100644
@@ -156,8 +156,10 @@ struct nvmet_sq {
 	u32			sqhd;
 	bool			sqhd_disabled;
 #ifdef CONFIG_NVME_TARGET_AUTH
+	struct mutex		auth_lock;
 	bool			authenticated;
 	struct delayed_work	auth_expired_work;
+	bool			auth_expiry_active;
 	u16			dhchap_tid;
 	u8			sc_c;
 	u8			dhchap_status;
Signature · 1 line
2.53.0
author maintainer
#17 lore raw

PATCH 16/869 rust: irq: declare cfi_encoding for irqreturn

In reply to Greg Kroah-Hartman

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

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

From: Sami Tolvanen <[email protected]>

[ Upstream commit 01f3e6b4b1c8c1748e59ba53631ab1f5d9ad0ea4 ]

The IRQ callbacks return c_uint. C calls them through irq_handler_t, which returns enum irqreturn. kCFI encodes enum types by name even with integer normalization, so the type ids never match and every call fails the CFI check.

Generate irqreturn as a newtype with a cfi_encoding, as is done for lru_status, and return bindings::irqreturn_t from the callbacks.

Fixes 0851d34a8cc3 ("rust: irq: add support for non-threaded IRQs and handlers")
Fixes 135d40523244 ("rust: irq: add support for threaded IRQs and handlers")
[ sashal: replaced bindgen's custom enum attribute option with sed post-processing to support older bindgen ]
---
 rust/Makefile              |  3 ++-
 rust/bindgen_parameters    |  3 +++
 rust/bindings/lib.rs       |  1 +
 rust/kernel/irq/request.rs | 22 +++++++++++-----------
 4 files changed, 17 insertions(+), 12 deletions(-)
rust/Makefile +2 -1
index d4618f646b05b..3867ff14fbdec 100644
@@ -367,7 +367,8 @@ quiet_cmd_bindgen = BINDGEN $@
 $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
     $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
 $(obj)/bindings/bindings_generated.rs: private bindgen_target_extra = ; \
-    sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const \1/g' $@
+    sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const \1/g' $@; \
+    sed -Ei 's/^pub struct irqreturn\(/#[cfi_encoding="9irqreturn"]\n&/' $@
 $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
     $(src)/bindgen_parameters FORCE
 	$(call if_changed_dep,bindgen)
rust/bindgen_parameters +3 -0
index e13c6f9dd17b2..9e02500dc9792 100644
@@ -23,6 +23,9 @@
 # warning. We don't need to peek into it anyway.
 --opaque-type spinlock
 
+# enums that appear in indirect function calls should specify a cfi type
+--newtype-enum irqreturn
+
 # `seccomp`'s comment gets understood as a doctest
 --no-doc-comments
 
rust/bindings/lib.rs +1 -0
index 8305adbdf8cbf..37f584727eba1 100644
@@ -23,6 +23,7 @@
     unreachable_pub,
     unsafe_op_in_unsafe_fn
 )]
+#![feature(cfi_encoding)]
 
 #[allow(dead_code)]
 #[allow(clippy::as_underscore)]
rust/kernel/irq/request.rs +11 -11
index 70700f43ddd37..4f2b315856b9b 100644
@@ -20,10 +20,10 @@
 #[repr(u32)]
 pub enum IrqReturn {
     /// The interrupt was not from this device or was not handled.
-    None = bindings::irqreturn_IRQ_NONE,
+    None = bindings::irqreturn::IRQ_NONE.0,
 
     /// The interrupt was handled by this device.
-    Handled = bindings::irqreturn_IRQ_HANDLED,
+    Handled = bindings::irqreturn::IRQ_HANDLED.0,
 }
 
 /// Callbacks for an IRQ handler.
@@ -275,7 +275,7 @@ pub fn synchronize(&self, dev: &Device<Bound>) -> Result {
 unsafe extern "C" fn handle_irq_callback<T: Handler + 'static>(
     _irq: i32,
     ptr: *mut c_void,
-) -> c_uint {
+) -> bindings::irqreturn_t {
     // SAFETY: `ptr` is a pointer to `RegistrationInner` set in `Registration::new`
     let inner = unsafe { &*(ptr as *const RegistrationInner) };
     // SAFETY: `inner.handler` is a pointer to `T` set in `Registration::new`
@@ -284,20 +284,20 @@ pub fn synchronize(&self, dev: &Device<Bound>) -> Result {
     // callback is running implies that the device has not yet been unbound.
     let device = unsafe { inner.dev.as_bound() };
 
-    T::handle(handler, device) as c_uint
+    bindings::irqreturn_t(T::handle(handler, device) as c_uint)
 }
 
 /// The value that can be returned from [`ThreadedHandler::handle`].
 #[repr(u32)]
 pub enum ThreadedIrqReturn {
     /// The interrupt was not from this device or was not handled.
-    None = bindings::irqreturn_IRQ_NONE,
+    None = bindings::irqreturn::IRQ_NONE.0,
 
     /// The interrupt was handled by this device.
-    Handled = bindings::irqreturn_IRQ_HANDLED,
+    Handled = bindings::irqreturn::IRQ_HANDLED.0,
 
     /// The handler wants the handler thread to wake up.
-    WakeThread = bindings::irqreturn_IRQ_WAKE_THREAD,
+    WakeThread = bindings::irqreturn::IRQ_WAKE_THREAD.0,
 }
 
 /// Callbacks for a threaded IRQ handler.
@@ -501,7 +501,7 @@ pub fn synchronize(&self, dev: &Device<Bound>) -> Result {
 unsafe extern "C" fn handle_threaded_irq_callback<T: ThreadedHandler + 'static>(
     _irq: i32,
     ptr: *mut c_void,
-) -> c_uint {
+) -> bindings::irqreturn_t {
     // SAFETY: `ptr` is a pointer to `RegistrationInner` set in `ThreadedRegistration::new`
     let inner = unsafe { &*(ptr as *const RegistrationInner) };
     // SAFETY: `inner.handler` is a pointer to `T` set in `ThreadedRegistration::new`
@@ -510,7 +510,7 @@ pub fn synchronize(&self, dev: &Device<Bound>) -> Result {
     // callback is running implies that the device has not yet been unbound.
     let device = unsafe { inner.dev.as_bound() };
 
-    T::handle(handler, device) as c_uint
+    bindings::irqreturn_t(T::handle(handler, device) as c_uint)
 }
 
 /// # Safety
@@ -519,7 +519,7 @@ pub fn synchronize(&self, dev: &Device<Bound>) -> Result {
 unsafe extern "C" fn thread_fn_callback<T: ThreadedHandler + 'static>(
     _irq: i32,
     ptr: *mut c_void,
-) -> c_uint {
+) -> bindings::irqreturn_t {
     // SAFETY: `ptr` is a pointer to `RegistrationInner` set in `ThreadedRegistration::new`
     let inner = unsafe { &*(ptr as *const RegistrationInner) };
     // SAFETY: `inner.handler` is a pointer to `T` set in `ThreadedRegistration::new`
@@ -528,5 +528,5 @@ pub fn synchronize(&self, dev: &Device<Bound>) -> Result {
     // callback is running implies that the device has not yet been unbound.
     let device = unsafe { inner.dev.as_bound() };
 
-    T::handle_threaded(handler, device) as c_uint
+    bindings::irqreturn_t(T::handle_threaded(handler, device) as c_uint)
 }
Signature · 1 line
2.53.0
author maintainer
#18 lore raw

PATCH 17/869 rust: hrtimer: declare cfi_encoding for hrtimer_restart

In reply to Greg Kroah-Hartman

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

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

From: Sami Tolvanen <[email protected]>

commit 39fe6892fd52faed6325ff7f13a92da01ab35727 upstream.

The hrtimer callbacks return bindings::hrtimer_restart, which bindgen generates as c_uint. C calls them through hrtimer->function, which returns enum hrtimer_restart. kCFI encodes enum types by name even with integer normalization, so the type ids never match and every call fails the CFI check.

Generate hrtimer_restart as a newtype with a cfi_encoding, as is done for lru_status, and adapt HrTimerRestart to the newtype.

[ Replaced bindgen's custom enum attribute option with sed
post-processing to support older bindgen. - Miguel ]

---
 rust/Makefile               | 1 +
 rust/bindgen_parameters     | 1 +
 rust/kernel/time/hrtimer.rs | 6 +++---
 3 files changed, 5 insertions(+), 3 deletions(-)
rust/Makefile +1 -0
index 3867ff14fbdec..3f1abad648e66 100644
@@ -368,6 +368,7 @@ $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
     $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
 $(obj)/bindings/bindings_generated.rs: private bindgen_target_extra = ; \
     sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const \1/g' $@; \
+    sed -Ei 's/^pub struct hrtimer_restart\(/#[cfi_encoding="15hrtimer_restart"]\n&/' $@; \
     sed -Ei 's/^pub struct irqreturn\(/#[cfi_encoding="9irqreturn"]\n&/' $@
 $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
     $(src)/bindgen_parameters FORCE
rust/bindgen_parameters +1 -0
index 9e02500dc9792..6f76fdcffd58d 100644
@@ -24,6 +24,7 @@
 --opaque-type spinlock
 
 # enums that appear in indirect function calls should specify a cfi type
+--newtype-enum hrtimer_restart
 --newtype-enum irqreturn
 
 # `seccomp`'s comment gets understood as a doctest
rust/kernel/time/hrtimer.rs +3 -3
index 856d2d929a008..35ff2ef7d9441 100644
@@ -498,14 +498,14 @@ unsafe fn start(this: *const Self, expires: <Self::TimerMode as HrTimerMode>::Ex
 #[repr(u32)]
 pub enum HrTimerRestart {
     /// Timer should not be restarted.
-    NoRestart = bindings::hrtimer_restart_HRTIMER_NORESTART,
+    NoRestart = bindings::hrtimer_restart::HRTIMER_NORESTART.0,
     /// Timer should be restarted.
-    Restart = bindings::hrtimer_restart_HRTIMER_RESTART,
+    Restart = bindings::hrtimer_restart::HRTIMER_RESTART.0,
 }
 
 impl HrTimerRestart {
     fn into_c(self) -> bindings::hrtimer_restart {
-        self as bindings::hrtimer_restart
+        bindings::hrtimer_restart(self as c_uint)
     }
 }
 
Signature · 1 line
2.53.0
author maintainer
#19 lore raw

PATCH 18/869 rust: dma: declare cfi_encoding for dma_data_direction

In reply to Greg Kroah-Hartman

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

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

From: Sami Tolvanen <[email protected]>

commit 7d109178cd644268326cd31702ed46c7ac8bb300 upstream.

bindgen generates bindings::dma_data_direction as an integer by default, while C callback tables such as dma_buf_ops declare the parameter as enum dma_data_direction. kCFI encodes enum types by name even with integer normalization, so the type ids would not match when C calls into a Rust callback taking bindings::dma_data_direction.

Generate dma_data_direction as a newtype with a cfi_encoding, as is done for lru_status, and convert DataDirection through the newtype's constants.

[ Replaced bindgen's custom enum attribute option with sed
post-processing to support older bindgen. - Miguel ]

---
 rust/Makefile           |  1 +
 rust/bindgen_parameters |  1 +
 rust/kernel/dma.rs      | 21 +++++++++++----------
 3 files changed, 13 insertions(+), 10 deletions(-)
rust/Makefile +1 -0
index 3f1abad648e66..d6429e68949fe 100644
@@ -368,6 +368,7 @@ $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \
     $(shell grep -Ev '^#|^$$' $(src)/bindgen_parameters)
 $(obj)/bindings/bindings_generated.rs: private bindgen_target_extra = ; \
     sed -Ei 's/pub const RUST_CONST_HELPER_([a-zA-Z0-9_]*)/pub const \1/g' $@; \
+    sed -Ei 's/^pub struct dma_data_direction\(/#[cfi_encoding="18dma_data_direction"]\n&/' $@; \
     sed -Ei 's/^pub struct hrtimer_restart\(/#[cfi_encoding="15hrtimer_restart"]\n&/' $@; \
     sed -Ei 's/^pub struct irqreturn\(/#[cfi_encoding="9irqreturn"]\n&/' $@
 $(obj)/bindings/bindings_generated.rs: $(src)/bindings/bindings_helper.h \
rust/bindgen_parameters +1 -0
index 6f76fdcffd58d..a5d547dc8e8ea 100644
@@ -24,6 +24,7 @@
 --opaque-type spinlock
 
 # enums that appear in indirect function calls should specify a cfi type
+--newtype-enum dma_data_direction
 --newtype-enum hrtimer_restart
 --newtype-enum irqreturn
 
rust/kernel/dma.rs +11 -10
index 4ce9e5d7f3dd0..b6c73db358ced 100644
@@ -267,25 +267,25 @@ pub enum DataDirection {
     ///
     /// This is used when the buffer can be both read from and written to by the device.
     /// The cache for the corresponding memory region is both flushed and invalidated.
-    Bidirectional = Self::const_cast(bindings::dma_data_direction_DMA_BIDIRECTIONAL),
+    Bidirectional = Self::const_cast(bindings::dma_data_direction::DMA_BIDIRECTIONAL),
 
     /// The DMA mapping is for data transfer from memory to the device (write).
     ///
     /// The CPU has prepared data in the buffer, and the device will read it.
     /// The cache for the corresponding memory region is flushed before device access.
-    ToDevice = Self::const_cast(bindings::dma_data_direction_DMA_TO_DEVICE),
+    ToDevice = Self::const_cast(bindings::dma_data_direction::DMA_TO_DEVICE),
 
     /// The DMA mapping is for data transfer from the device to memory (read).
     ///
     /// The device will write data into the buffer for the CPU to read.
     /// The cache for the corresponding memory region is invalidated before CPU access.
-    FromDevice = Self::const_cast(bindings::dma_data_direction_DMA_FROM_DEVICE),
+    FromDevice = Self::const_cast(bindings::dma_data_direction::DMA_FROM_DEVICE),
 
     /// The DMA mapping is not for data transfer.
     ///
     /// This is primarily for debugging purposes. With this direction, the DMA mapping API
     /// will not perform any cache coherency operations.
-    None = Self::const_cast(bindings::dma_data_direction_DMA_NONE),
+    None = Self::const_cast(bindings::dma_data_direction::DMA_NONE),
 }
 
 impl DataDirection {
@@ -297,7 +297,7 @@ const fn const_cast(val: bindings::dma_data_direction) -> u32 {
         // CAST: The C standard allows compilers to choose different integer types for enums.
         // To safely check the value, we cast it to a wide signed integer type (`i128`)
         // which can hold any standard C integer enum type without truncation.
-        let wide_val = val as i128;
+        let wide_val = val.0 as i128;
 
         // Check if the value is outside the valid range for the target type `u32`.
         // CAST: `u32::MAX` is cast to `i128` to match the type of `wide_val` for the comparison.
@@ -315,11 +315,12 @@ const fn const_cast(val: bindings::dma_data_direction) -> u32 {
 impl From<DataDirection> for bindings::dma_data_direction {
     /// Returns the raw representation of [`enum dma_data_direction`].
     fn from(direction: DataDirection) -> Self {
-        // CAST: `direction as u32` gets the underlying representation of our `#[repr(u32)]` enum.
-        // The subsequent cast to `Self` (the bindgen type) assumes the C enum is compatible
-        // with the enum variants of `DataDirection`, which is a valid assumption given our
-        // compile-time checks.
-        direction as u32 as Self
+        match direction {
+            DataDirection::Bidirectional => Self::DMA_BIDIRECTIONAL,
+            DataDirection::ToDevice => Self::DMA_TO_DEVICE,
+            DataDirection::FromDevice => Self::DMA_FROM_DEVICE,
+            DataDirection::None => Self::DMA_NONE,
+        }
     }
 }
 
Signature · 1 line
2.53.0
author maintainer
#20 lore raw

PATCH 19/869 mm: khugepaged: fix swap entry value to folio_pfn()

In reply to Greg Kroah-Hartman

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

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

From: Vernon Yang <[email protected]>

[ Upstream commit 942c8ec27aa4ffc587511650718349964e1696e6 ]

Patch series "mm: khugepaged: fix tracepoint UAF", v5.

The khugepaged tracepoints take a folio pointer and call folio_pfn(), but by then the folio may no longer be valid: freed after folio_put(), folio_unlock() or pte_unmap_unlock(), or not a folio at all but an xarray-encoded swap entry. On classic SPARSEMEM, dereferencing it oopses khugepaged as soon as the trace event is enabled; on other memory models it merely prints a bogus pfn.

Pass the pfn to the tracepoints directly, captured while the folio is still pinned, closing the use-after-free windows in mm_khugepaged_scan_file(), mm_khugepaged_scan_pmd() and mm_khugepaged_collapse_file().

This patch (of 3):

When the swap entries found exceed max_ptes_swap, the loop is left via break with folio still holding the xarray value that encodes the swap entry, not valid folio pointer.

That value is passed to trace_mm_khugepaged_scan_file(), which feeds it to folio_pfn(). On FLATMEM and SPARSEMEM_VMEMMAP, the page_to_pfn() is plain pointer arithmetic, so the trace event merely prints bogus scan_pfn. On classic SPARSEMEM, the page_to_pfn() reads page->flags, dereferencing the tiny encoded integer and oopsing khugepaged whenever the trace event is enabled.

So when folio is the swap entry value, simply set pfn to -1, just like exhausted scan naturally.

And the folio_put() has maybe dropped the last reference of folio. The trace_mm_khugepaged_scan_file() is left with a dangling folio pointer. so using the folio_pfn() before dropping the reference, closing use-after-free window.

Fixes d41fd2016ed0 ("mm/khugepaged: add tracepoint to hpage_collapse_scan_file()")
Cc Barry Song <[email protected]>
Cc Dev Jain <[email protected]>
Cc Lance Yang <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Zach O'Keefe <[email protected]>
[ sashal: Retained int result instead of enum scan_result in hpage_collapse_scan_file(). ]
---
 include/trace/events/huge_memory.h | 6 +++---
 mm/khugepaged.c                    | 7 ++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)
include/trace/events/huge_memory.h +3 -3
index 2276614691dfd..1464d45c90abf 100644
@@ -167,10 +167,10 @@ TRACE_EVENT(mm_collapse_huge_page_swapin,
 
 TRACE_EVENT(mm_khugepaged_scan_file,
 
-	TP_PROTO(struct mm_struct *mm, struct folio *folio, struct file *file,
+	TP_PROTO(struct mm_struct *mm, unsigned long pfn, struct file *file,
 		 int present, int swap, int result),
 
-	TP_ARGS(mm, folio, file, present, swap, result),
+	TP_ARGS(mm, pfn, file, present, swap, result),
 
 	TP_STRUCT__entry(
 		__field(struct mm_struct *, mm)
@@ -183,7 +183,7 @@ TRACE_EVENT(mm_khugepaged_scan_file,
 
 	TP_fast_assign(
 		__entry->mm = mm;
-		__entry->pfn = folio ? folio_pfn(folio) : -1;
+		__entry->pfn = pfn;
 		__assign_str(filename);
 		__entry->present = present;
 		__entry->swap = swap;
mm/khugepaged.c +6 -1
index e2ac26c05064f..cc3a09a0c2596 100644
@@ -2308,6 +2308,7 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr,
 	int present, swap;
 	int node = NUMA_NO_NODE;
 	int result = SCAN_SUCCEED;
+	unsigned long failed_pfn = -1;
 
 	present = 0;
 	swap = 0;
@@ -2344,6 +2345,7 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr,
 		    folio->index == start) {
 			/* Maybe PMD-mapped */
 			result = SCAN_PTE_MAPPED_HUGEPAGE;
+			failed_pfn = folio_pfn(folio);
 			/*
 			 * For SCAN_PTE_MAPPED_HUGEPAGE, further processing
 			 * by the caller won't touch the page cache, and so
@@ -2357,6 +2359,7 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr,
 		node = folio_nid(folio);
 		if (hpage_collapse_scan_abort(node, cc)) {
 			result = SCAN_SCAN_ABORT;
+			failed_pfn = folio_pfn(folio);
 			folio_put(folio);
 			break;
 		}
@@ -2364,12 +2367,14 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr,
 
 		if (!folio_test_lru(folio)) {
 			result = SCAN_PAGE_LRU;
+			failed_pfn = folio_pfn(folio);
 			folio_put(folio);
 			break;
 		}
 
 		if (folio_expected_ref_count(folio) + 1 != folio_ref_count(folio)) {
 			result = SCAN_PAGE_COUNT;
+			failed_pfn = folio_pfn(folio);
 			folio_put(folio);
 			break;
 		}
@@ -2401,7 +2406,7 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr,
 		}
 	}
 
-	trace_mm_khugepaged_scan_file(mm, folio, file, present, swap, result);
+	trace_mm_khugepaged_scan_file(mm, failed_pfn, file, present, swap, result);
 	return result;
 }
 
Signature · 1 line
2.53.0
author maintainer
#21 lore raw

PATCH 20/869 rust: bitmap: fix intra-doc link

In reply to Greg Kroah-Hartman

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

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

From: Miguel Ojeda <[email protected]>

BitmapVec::MAX_LEN does not exist in 6.18.y, so rustdoc warns:

    warning: unresolved link to `BitmapVec::MAX_LEN`
      --> rust/kernel/bitmap.rs:24:25
       |
    24 | /// This also matches [`BitmapVec::MAX_LEN`].
       |                         ^^^^^^^^^^^^^^^^^^ the struct `BitmapVec` has no field or associated item named `MAX_LEN`
       |
       = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

Thus link to BitmapVec::new() instead.

Fixes 37f45fe068e0 ("rust: bitmap: restrict bitmap length to at most i32::MAX")
---
 rust/kernel/bitmap.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/bitmap.rs +1 -1
index 0e5e825aefb6c..a00988bc8191a 100644
@@ -19,7 +19,7 @@
 /// Must reference a `[c_ulong]` long enough to fit `data.len()` bits.
 /// Must not be longer than [`i32::MAX`] bits, so offsets and lengths used with
 /// [`Bitmap`] functions fit in the `int` and `unsigned int` arguments of the C bitmap API.
-/// This also matches [`BitmapVec::MAX_LEN`].
+/// This also matches the maximum length accepted by [`BitmapVec::new`].
 #[cfg_attr(CONFIG_64BIT, repr(align(8)))]
 #[cfg_attr(not(CONFIG_64BIT), repr(align(4)))]
 pub struct Bitmap {
Signature · 1 line
2.53.0
author maintainer
#22 lore raw

PATCH 21/869 drm/nouveau: reject zero-size notifier object allocation

In reply to Greg Kroah-Hartman

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

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

From: Zhenhao Wan <[email protected]>

[ Upstream commit 38125d38d850bd2fdd5d7840c3bd52d9d208995b ]

nouveau_abi16_ioctl_notifierobj_alloc() passes the userspace-controlled info->size to nvkm_mm_head() as both size_max and size_min without a lower bound. A zero size satisfies the allocator's "e - s < size_min" gate (size_min == 0 makes the unsigned comparison inert) and yields a zero-length node, after which

	args.limit = ntfy->node->offset + ntfy->node->length - 1;

underflows (offset 0, length 0 -> 0xffffffff) into an oversized ~4 GiB DMA window. The dma object constructor only rejects start > limit, so the validly ordered [base, base + 0xffffffff] range passes and is programmed into the GPU DMA context. The ioctl is DRM_RENDER_ALLOW, so any render node client can trigger this on pre-Fermi hardware.

Reject a zero-size request before allocating anything.

---
 drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/nouveau/nouveau_abi16.c +4 -0
index a3ba07fc48a08..a067c7244e7ec 100644
@@ -631,6 +631,10 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
 	if (unlikely(device->info.family >= NV_DEVICE_INFO_V0_FERMI))
 		return nouveau_abi16_put(abi16, -EINVAL);
 
+	/* zero size yields a zero-length node, underflowing args.limit */
+	if (unlikely(!info->size))
+		return nouveau_abi16_put(abi16, -EINVAL);
+
 	chan = nouveau_abi16_chan(abi16, info->channel);
 	if (!chan)
 		return nouveau_abi16_put(abi16, -ENOENT);
Signature · 1 line
2.53.0
author maintainer
#23 lore raw

PATCH 22/869 drm/nouveau/svm: drain fault handler before freeing svmm

In reply to Greg Kroah-Hartman

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

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

From: Zhenhao Wan <[email protected]>

[ Upstream commit b46ddaf0823405f81e681eb26ec98508f3eb9a07 ]

The SVM fault handler nouveau_svm_fault() looks up each fault's nouveau_svmm under svm->mutex, caches it in the fault array, then drops svm->mutex and dereferences the svmm across blocking faults (mmu_interval_notifier_insert(), hmm_range_fault()).

nouveau_svmm is not refcounted. On DRM file close nouveau_svmm_fini() -> mmu_notifier_put() frees it asynchronously via call_srcu() without waiting for the handler, and mmget_not_zero() pins the mm, not the svmm. flush_work() on the fault buffer otherwise runs only at device removal and suspend, never on close, so a fault handled concurrently with a close can dereference a freed svmm.

The instance is already unlinked by nouveau_svmm_part() earlier in the same close, so no new fault can resolve to it. Drain the handler in nouveau_svmm_fini() before the free, guarding the flush with a NULL check on drm->svm: on device teardown nouveau_svm_fini() runs first and frees drm->svm (NULL) after blocking the notify and flushing the buffer, so the handler is already drained; on per-client close drm->svm is alive and the flush runs.

Fixes eeaf06ac1a55 ("drm/nouveau/svm: initial support for shared virtual memory")
Assisted-by Claude:claude-opus-5
---
 drivers/gpu/drm/nouveau/nouveau_svm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/nouveau/nouveau_svm.c +13 -0
index 6fa387da06371..dc6c79f57a56d 100644
@@ -304,6 +304,19 @@ nouveau_svmm_fini(struct nouveau_svmm **psvmm)
 {
 	struct nouveau_svmm *svmm = *psvmm;
 	if (svmm) {
+		struct nouveau_svm *svm = svmm->vmm->cli->drm->svm;
+
+		/* The fault handler caches svmm pointers under svm->mutex and
+		 * dereferences them after dropping it, across blocking faults.
+		 * The instance is already unlinked (nouveau_svmm_part), so drain
+		 * the handler before the free to release any in-flight reference.
+		 *
+		 * On device teardown nouveau_svm_fini() ran first and freed
+		 * drm->svm (NULL) after draining the buffer; nothing to flush.
+		 */
+		if (svm)
+			flush_work(&svm->buffer[0].work);
+
 		mutex_lock(&svmm->mutex);
 		svmm->vmm = NULL;
 		mutex_unlock(&svmm->mutex);
Signature · 1 line
2.53.0
author maintainer
#24 lore raw

PATCH 23/869 drm/nouveau/pci: use config-space MSI rearm on MCP79/MCP7A (NVAC)

In reply to Greg Kroah-Hartman

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

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

From: Marek Czernohous <[email protected]>

[ Upstream commit 354d47fb3f35461b7f942831c1b2a7105e92b57f ]

NVAC (MCP79/MCP7A) uses g94_pci_func, whose .msi_rearm is nv40_pci_msi_rearm(): a re-arm write through the MMIO mirror of PCI config space. On this IGP that path is unreliable; when a re-arm is missed the interrupt line stays dead, command submission times out and the GPU appears hung until reboot. On an Apple Mac mini (early 2009, MCP79, boot0 0x0ac080b1) this showed as sporadic fifo timeouts and GPU hangs under load unless MSI was disabled via config=NvMSI=0.

Give NVAC its own pci func that re-arms through real PCI config space (nv46_pci_msi_rearm) instead. This follows existing precedent: nv46.c documents the MMIO-mirror re-arm as broken on several related parts, and commit 5112abc6a433 ("drm/nouveau/pci/g92: Fix rearm") fixed g92 the same way while moving the remaining chipsets, NVAC included, into the newly added shared g94 table, where NVAC stayed on the MMIO path. This change completes that fix for NVAC. The sibling IGP NVAA (MCP77/MCP78) has MSI disabled entirely as "reported broken" in nvkm_pci_new_(); NVAC works correctly once the re-arm goes through config space, so disabling MSI is not necessary.

Only NVAC is switched: that is the hardware this has been validated on. The other users of g94_pci_func (G94/G96/G98/GT2xx and the MCP77/MCP89 IGPs) keep their current behavior; MCP77 and MCP89 plausibly want the same treatment but were not tested.

Tested on the Mac mini as a daily driver for two months with MSI enabled and zero fifo timeouts. Independently confirmed stable on an iMac9,1 (MCP79) running 6.12.90 with the v1 form of this change (the same one-line functional switch, applied to that kernel's g94 implementation).

Fixes 5112abc6a433 ("drm/nouveau/pci/g92: Fix rearm")
Cc <[email protected]> # v6.16+
Assisted-by Claude:claude-opus-4-7
Assisted-by Claude:claude-opus-4-8
---
 .../gpu/drm/nouveau/include/nvkm/subdev/pci.h |  1 +
 .../gpu/drm/nouveau/nvkm/engine/device/base.c |  2 +-
 .../gpu/drm/nouveau/nvkm/subdev/pci/Kbuild    |  1 +
 .../gpu/drm/nouveau/nvkm/subdev/pci/mcp79.c   | 35 +++++++++++++++++++
 4 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/pci/mcp79.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h +1 -0
index 112b674ed9c8a..0172e0d200f81 100644
@@ -46,6 +46,7 @@ int nv4c_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct n
 int g84_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
 int g92_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
 int g94_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
+int mcp79_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
 int gf100_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
 int gf106_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
 int gk104_pci_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_pci **);
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -1
index 3738c4664fb6a..305b16d9bcc7a 100644
@@ -1237,7 +1237,7 @@ nvac_chipset = {
 	.mc       = { 0x00000001, g98_mc_new },
 	.mmu      = { 0x00000001, mcp77_mmu_new },
 	.mxm      = { 0x00000001, nv50_mxm_new },
-	.pci      = { 0x00000001, g94_pci_new },
+	.pci      = { 0x00000001, mcp79_pci_new },
 	.therm    = { 0x00000001, g84_therm_new },
 	.timer    = { 0x00000001, nv41_timer_new },
 	.volt     = { 0x00000001, nv40_volt_new },
drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild +1 -0
index a14ea0f7b1c87..90f03baeb22ac 100644
@@ -9,6 +9,7 @@ nvkm-y += nvkm/subdev/pci/nv4c.o
 nvkm-y += nvkm/subdev/pci/g84.o
 nvkm-y += nvkm/subdev/pci/g92.o
 nvkm-y += nvkm/subdev/pci/g94.o
+nvkm-y += nvkm/subdev/pci/mcp79.o
 nvkm-y += nvkm/subdev/pci/gf100.o
 nvkm-y += nvkm/subdev/pci/gf106.o
 nvkm-y += nvkm/subdev/pci/gk104.o
drivers/gpu/drm/nouveau/nvkm/subdev/pci/mcp79.c new file +35 -0
new file mode 100644
index 0000000000000..e2ae242f1aa77
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2026 Marek Czernohous
+ *
+ * MCP79/MCP7A (NVAC): like g94, but MSI re-arm goes through real PCI
+ * config space.  The MMIO-mirror re-arm is unreliable on this IGP and a
+ * missed re-arm kills the interrupt line (see the nv46 comment; g92
+ * already re-arms through config space for the same reason).
+ */
+#include "priv.h"
+
+static const struct nvkm_pci_func
+mcp79_pci_func = {
+	.cfg = { .addr = 0x088000, .size = 0x1000 },
+
+	.init = g84_pci_init,
+	.msi_rearm = nv46_pci_msi_rearm,
+
+	.pcie.init = g84_pcie_init,
+	.pcie.set_link = g84_pcie_set_link,
+
+	.pcie.max_speed = g84_pcie_max_speed,
+	.pcie.cur_speed = g84_pcie_cur_speed,
+
+	.pcie.set_version = g84_pcie_set_version,
+	.pcie.version = g84_pcie_version,
+	.pcie.version_supported = g92_pcie_version_supported,
+};
+
+int
+mcp79_pci_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
+	      struct nvkm_pci **ppci)
+{
+	return nvkm_pci_new_(&mcp79_pci_func, device, type, inst, ppci);
+}
Signature · 1 line
2.53.0
author maintainer
#25 lore raw

PATCH 24/869 drm/nouveau: disable the fence uevent work instead of just cancelling it

In reply to Greg Kroah-Hartman

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

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

From: Marek Czernohous <[email protected]>

[ Upstream commit 827eb9328eaed831d7cc426ac2705038a40835b6 ]

nouveau_fence_context_del() drains the uevent work while the event that feeds it is still armed:

	cancel_work_sync(&fctx->uevent_work);
	nouveau_fence_context_kill(fctx, 0);
	nvif_event_dtor(&fctx->event);

nouveau_fence_wait_uevent_handler() queues the work unconditionally:

	schedule_work(&fctx->uevent_work);
	return NVIF_EVENT_KEEP;

so a non-stall interrupt arriving after cancel_work_sync() has returned re-arms the work that was just drained. The window closes in two steps, neither of which is the drain. The kill blocks the event when the last fence holding a notify_ref is signalled, which reaches atomic_xchg(&ntfy->allowed, 0) (nvkm/core/event.c:104), and nvkm_event_ntfy() skips a ntfy that is not allowed (:183). That stops further handlers from starting, but not one that is already inside nvkm_event_ntfy(): the event is created with wait = false (nouveau_fence.c:201), so nvkm_event_ntfy_block_() leaves it on the list and never takes event->list_lock. Only nvif_event_dtor() waits that one
out: nvkm_event_ntfy_del() (:141) goes through nvkm_event_ntfy_remove(), which takes write_lock_irq() on that same list_lock (:84).

Either way the re-arm happens after the drain, and the caller drops its reference immediately afterwards, for example nv84_fence_context_del():

	nouveau_fence_context_del(&fctx->base);
	chan->fence = NULL;
	nouveau_fence_context_free(&fctx->base);

That is a kref_put() on fctx->fence_ref, so the context outlives the teardown only while emitted fences still hold a reference of their own. That is no safety net: whenever none do, the count reaches zero right there and nouveau_fence_context_put() kfree()s fctx while the work is still queued. &fctx->uevent_work is embedded in that allocation, so the workqueue already dereferences freed memory when it picks the item up, and nouveau_fence_uevent_work() can then take fctx->lock on it. With CONFIG_DEBUG_OBJECTS_WORK and CONFIG_DEBUG_OBJECTS_FREE, kfree() of a still-queued work item is reported as the free of an active object.

On live memory the re-armed work has nothing left to do:
nouveau_fence_context_kill() empties fctx->pending and sets fctx->killed under fctx->lock, nouveau_fence_emit() then returns -ENODEV rather than queueing anything new, and nouveau_fence_update() only reaches nvif_event_block() if it signalled something off that list. The defect is the access to freed memory, not what the work would have found.

Only chips from G84 on can reach this at all: nouveau_fence_context_new() returns before nvif_event_ctor() when priv->uevent is clear, and nv84_fence_create() is the only place that sets it. nv84_fence_context_del() is the context_del for all of those, because nvc0_fence_create() and gv100_fence_create() build on nv84_fence_create() and override only context_new.

Use disable_work_sync() instead. It drains the work exactly like cancel_work_sync() does, and additionally increments the work item's disable count, after which "any attempt to queue @work will fail and return %false" (kernel/workqueue.c, disable_work()). The handler's schedule_work() then has nothing to re-arm, and the teardown order stays as it is.

Draining a second time after nvif_event_dtor() would close the window as well, and without the newer API: once nvkm_event_ntfy_remove() has returned, no handler can start or still be running, so nothing re-arms the work past that point. disable_work_sync() is preferred here because it needs one synchronisation point instead of two, it keeps the work from being queued at all rather than cleaning up after it, and it is what drm has settled on for this (drm/xe, drm/panthor, drm_pagemap). Blocking the event rather than the work is not an option: fctx->event is created with wait = false, so a handler already inside nvkm_event_ntfy() can still queue the work.

Note for backports: disable_work_sync() arrived in v6.10 with commit 86898fa6b8cd ("workqueue: Implement disable/enable for (delayed) work items"), while the fix being corrected here reached 6.6.18 and 6.7.6. linux-6.6.y therefore carries this bug without the API, and this patch would apply there and then fail to build. A 6.6.y backport wants the second drain described above instead, as its own patch.

Fixes 39126abc5e20 ("nouveau: offload fence uevents work to workqueue")
Cc <[email protected]> # 6.10.x
Assisted-by Claude:claude-opus-5
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_fence.c +1 -1
index 4a193b7d6d9e4..7acf241c4daf3 100644
@@ -95,7 +95,7 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
 void
 nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
 {
-	cancel_work_sync(&fctx->uevent_work);
+	disable_work_sync(&fctx->uevent_work);
 	nouveau_fence_context_kill(fctx, 0);
 	nvif_event_dtor(&fctx->event);
 	fctx->dead = 1;
Signature · 1 line
2.53.0
author maintainer
#26 lore raw

PATCH 25/869 drm/nouveau: cancel the DP IRQ work before freeing the connector

In reply to Greg Kroah-Hartman

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

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

From: Marek Czernohous <[email protected]>

[ Upstream commit f60849975a886d70883bcb6b3658c0fa83c6971f ]

nouveau_connector_destroy() tears the two nvif events down and then frees the connector, but never cancels the work the IRQ event queues:

	nvif_event_dtor(&nv_connector->irq);
	nvif_event_dtor(&nv_connector->hpd);
	kfree(nv_connector->edid);
	...
	kfree(connector);

nouveau_connector_irq() queues that work unconditionally:

	schedule_work(&nv_connector->irq_work);
	return NVIF_EVENT_KEEP;

A DP IRQ arriving just before nvif_event_dtor() therefore leaves nv_connector->irq_work on the system queue past the kfree(). When it runs, nouveau_dp_irq() derives both nv_connector and connector from the work_struct and dereferences them, and goes on to take outp->dp.hpd_irq_lock.

There is no cancel_work_sync() for irq_work anywhere in the driver, so nothing else covers this. Add it after the event teardown, where no further work can be queued, and before anything is freed.

Reported by the Sashiko review bot as a pre-existing issue, in its review of an earlier nv04 FIFO series of mine, and confirmed against the source.

---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -0
index 7c6d91ee2722d..f9662e067c56c 100644
@@ -397,6 +397,7 @@ nouveau_connector_destroy(struct drm_connector *connector)
 	struct nouveau_connector *nv_connector = nouveau_connector(connector);
 	nvif_event_dtor(&nv_connector->irq);
 	nvif_event_dtor(&nv_connector->hpd);
+	cancel_work_sync(&nv_connector->irq_work);
 	kfree(nv_connector->edid);
 	drm_connector_unregister(connector);
 	drm_connector_cleanup(connector);
Signature · 1 line
2.53.0
author maintainer
#27 lore raw

PATCH 26/869 drm/nouveau: dont dereference outp before checking it in nouveau_dp_irq

In reply to Greg Kroah-Hartman

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

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

From: Marek Czernohous <[email protected]>

[ Upstream commit 843bc34db94bff0612c8294861b156489958897b ]

nouveau_dp_irq() looks the encoder up and dereferences it in the same breath, five lines before testing it:

	struct nouveau_encoder *outp = find_encoder(connector, DCB_OUTPUT_DP);
	struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
	...
	if (!outp)
		return;

find_encoder() walks the connector's possible encoders and returns NULL when none of them matches the requested type, so the NULL test is not
decoration: it is the author saying this can happen. The initialiser above it dereferences the same pointer regardless.

The NULL test predates the dereference. commit 773eb04d14a1 ("drm/nouveau/disp: expose conn event class") turned nouveau_dp_irq() into a work callback, and since the drm pointer was no longer passed in as an argument it was recovered from the encoder in the declaration block, which put the dereference above the existing test.

Move the drm lookup below the test. No functional change when outp is non-NULL.

Fixes 773eb04d14a1 ("drm/nouveau/disp: expose conn event class")
Assisted-by Claude:claude-opus-5
---
 drivers/gpu/drm/nouveau/nouveau_dp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_dp.c +3 -1
index 55691ec44abaa..738802358d85c 100644
@@ -486,7 +486,7 @@ nouveau_dp_irq(struct work_struct *work)
 		container_of(work, typeof(*nv_connector), irq_work);
 	struct drm_connector *connector = &nv_connector->base;
 	struct nouveau_encoder *outp = find_encoder(connector, DCB_OUTPUT_DP);
-	struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
+	struct nouveau_drm *drm;
 	struct nv50_mstm *mstm;
 	u64 hpd = 0;
 	int ret;
@@ -494,6 +494,8 @@ nouveau_dp_irq(struct work_struct *work)
 	if (!outp)
 		return;
 
+	drm = nouveau_drm(outp->base.base.dev);
+
 	mstm = outp->dp.mstm;
 	NV_DEBUG(drm, "service %s\n", connector->name);
 
Signature · 1 line
2.53.0
author maintainer
#28 lore raw

PATCH 27/869 drm/amdgpu: recompute the dw estimate after allocating a new VM update job

In reply to Greg Kroah-Hartman

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

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

From: YuBiao Wang <[email protected]>

[ Upstream commit a74c7832b11827907de560169c7d4ac94505fd87 ]

amdgpu_vm_sdma_update() keeps the number of free dwords of the current job in a local variable. When the job runs out of room it is committed and a new one is allocated, but that local variable is not refreshed and still describes the job which was just submitted.

The stale value is then used to decide how many PTEs fit into the new job. If it happens to be copy_pte_num_dw + 7, or one more than that, the result is zero. copy_pte() encodes the transfer size as count * 8 - 1, so a count of zero asks the engine for a 1GB copy starting inside the IB pool. That runs off the end of the pool, faults on the first unmapped GART page above it and hangs the ring.

Re-initialize the estimate from the newly allocated job, which is empty and therefore has its full budget available.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +5 -0
index 36805dcfa1598..902d0a538e419 100644
@@ -254,6 +254,11 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,
 						     AMDGPU_KERNEL_JOB_ID_VM_UPDATE);
 			if (r)
 				return r;
+
+			/* The estimate above describes the job which was just
+			 * submitted, take the budget of the newly allocated one.
+			 */
+			ndw = p->num_dw_left;
 		}
 
 		if (!p->pages_addr) {
Signature · 1 line
2.53.0
author maintainer
#29 lore raw

PATCH 28/869 drm/amd/display: Force GAMCOR for subsampled surfaces with PQ/Gamma22/HLG

In reply to Greg Kroah-Hartman

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

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

From: Harry Wentland <[email protected]>

[ Upstream commit 2ffaa7c4050605cb27756f5336f778d1b21268b9 ]

The ROM early-return checks for PQ, Gamma 2.2, and HLG in mod_color_calculate_degamma_params() do not consider the map_user_ramp parameter. When map_user_ramp is true (indicating a subsampled surface that requires post-scaler degamma via GAMCOR), the function still takes the ROM path, programming PRE_DEGAM instead.

For subsampled formats the chroma channels must be upsampled by the scaler before degamma is applied. PRE_DEGAM sits before the scaler in the pipeline (CNVC domain), while GAMCOR sits after it (CM domain). Using the ROM for subsampled surfaces means degamma is applied to subsampled chroma before upsampling, producing incorrect results.

Fix by gating the dcn_arch ROM capability checks on !map_user_ramp, forcing PQ/Gamma22/HLG through the GAMCOR LUT path when the surface is subsampled.

Fixes a8bf71649088 ("drm/amd/display: Internal refactoring to abstract color caps")
Assisted-by Copilot:claude-opus-4.6
---
 drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +2 -1
index a71df052cf252..7103d8cfb4799 100644
@@ -1694,7 +1694,8 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps,
 			return true;
 
 		if (dc_caps != NULL &&
-			dc_caps->dpp.dcn_arch == 1) {
+			dc_caps->dpp.dcn_arch == 1 &&
+			!map_user_ramp) {
 
 			if (input_tf->tf == TRANSFER_FUNCTION_PQ &&
 					dc_caps->dpp.dgam_rom_caps.pq == 1)
Signature · 1 line
2.53.0
author maintainer
#30 lore raw

PATCH 29/869 iio: adc: ti-ads1100: Fix incorrect reading when datarate changed in single mode

In reply to Greg Kroah-Hartman

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

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

From: Jakub Szczudlo <[email protected]>

[ Upstream commit 38dbf24dfbd0a73b89fa2871a7148429aef05531 ]

When device is suspended and it is in single mode then changing datarate doesn't make it actually wait for new measurement, so to be sure that read after change is correct, functions that changes datarate and gain will wait for a new data.

Fixes 541880542f2b ("iio: adc: Add TI ADS1100 and ADS1000")
---
 drivers/iio/adc/ti-ads1100.c | 107 +++++++++++++++++++++++++++++++++--
 1 file changed, 103 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-ads1100.c +103 -4
index aa8946063c7d6..5c08bed48018c 100644
@@ -15,10 +15,12 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
+#include <linux/iopoll.h>
 #include <linux/mutex.h>
 #include <linux/property.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
+#include <linux/time.h>
 #include <linux/units.h>
 
 #include <linux/iio/iio.h>
@@ -43,6 +45,9 @@
 static const int ads1100_data_rate[] = { 128, 32, 16, 8 };
 static const int ads1100_data_rate_bits[] = { 12, 14, 15, 16 };
 
+/* Timeout based on the minimum sample rate of 8 SPS (7500ms) */
+#define ADS1100_MAX_DRDY_TIMEOUT_US	(7500 * USEC_PER_MSEC)
+
 struct ads1100_data {
 	struct i2c_client *client;
 	struct regulator *reg_vdd;
@@ -123,10 +128,86 @@ static int ads1100_get_adc_result(struct ads1100_data *data, int chan, int *val)
 	return 0;
 }
 
+static int ads1100_conversion_busy(struct ads1100_data *data)
+{
+	u8 buffer[3];
+	int ret;
+
+	ret = i2c_master_recv(data->client, (char *)&buffer, sizeof(buffer));
+	if (ret < 0) {
+		dev_err(&data->client->dev, "I2C read fail: %d\n", ret);
+		return ret;
+	}
+
+	return FIELD_GET(ADS1100_CFG_ST_BSY, buffer[2]);
+}
+
+static int ads1100_wait_single_conversion(struct ads1100_data *data)
+{
+	int data_rate_index = FIELD_GET(ADS1100_DR_MASK, data->config);
+	int data_rate_Hz = ads1100_data_rate[data_rate_index];
+	unsigned long poll_us = DIV_ROUND_CLOSEST(USEC_PER_SEC, data_rate_Hz) / 4;
+	int busy;
+	int ret;
+
+	ret = readx_poll_timeout(ads1100_conversion_busy, data,
+				 busy, busy <= 0,
+				 poll_us, ADS1100_MAX_DRDY_TIMEOUT_US);
+	if (busy < 0)
+		return busy;
+
+	return ret;
+}
+
+static int ads1100_start_single_conversion(struct ads1100_data *data)
+{
+	u8 config = data->config | ADS1100_CFG_SC;
+	int ret;
+
+	ret = i2c_master_send(data->client, &config, sizeof(config));
+	if (ret < 0) {
+		dev_err(&data->client->dev, "I2C write fail: %d\n", ret);
+		return ret;
+	}
+	/* Need to wait because of change from continuous to single mode */
+	ret = ads1100_wait_single_conversion(data);
+	if (ret)
+		return ret;
+
+	config |= ADS1100_CFG_ST_BSY;
+
+	ret = i2c_master_send(data->client, &config, sizeof(config));
+	if (ret < 0) {
+		dev_err(&data->client->dev, "I2C write fail: %d\n", ret);
+		return ret;
+	}
+
+	/* No need to cache it, it's status bit */
+	data->config = config & ~ADS1100_CFG_ST_BSY;
+
+	return 0;
+}
+
+static int ads1100_poll_data_ready(struct ads1100_data *data)
+{
+	int ret;
+
+	ret = ads1100_start_single_conversion(data);
+	if (ret)
+		return ret;
+
+	ret = ads1100_wait_single_conversion(data);
+	if (ret)
+		return ret;
+
+	return ads1100_set_config_bits(data, ADS1100_CFG_SC, ADS1100_CONTINUOUS);
+}
+
 static int ads1100_set_scale(struct ads1100_data *data, int val, int val2)
 {
 	int microvolts;
 	int gain;
+	int ret;
 
 	/* With Vdd between 2.7 and 5V, the scale is always below 1 */
 	if (val)
@@ -135,6 +216,11 @@ static int ads1100_set_scale(struct ads1100_data *data, int val, int val2)
 	if (!val2)
 		return -EINVAL;
 
+	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(&data->client->dev, pm);
+	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
+	if (ret)
+		return ret;
+
 	microvolts = regulator_get_voltage(data->reg_vdd);
 	/*
 	 * val2 is in 'micro' units, n = val2 / 1000000
@@ -149,22 +235,35 @@ static int ads1100_set_scale(struct ads1100_data *data, int val, int val2)
 
 	ads1100_set_config_bits(data, ADS1100_PGA_MASK, ffs(gain) - 1);
 
-	return 0;
+	return ads1100_poll_data_ready(data);
 }
 
 static int ads1100_set_data_rate(struct ads1100_data *data, int chan, int rate)
 {
 	unsigned int i;
 	unsigned int size;
+	int ret;
 
 	size = data->supports_data_rate ? ARRAY_SIZE(ads1100_data_rate) : 1;
 	for (i = 0; i < size; i++) {
 		if (ads1100_data_rate[i] == rate)
-			return ads1100_set_config_bits(data, ADS1100_DR_MASK,
-						       FIELD_PREP(ADS1100_DR_MASK, i));
+			break;
 	}
 
-	return -EINVAL;
+	if (i == size)
+		return -EINVAL;
+
+	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(&data->client->dev, pm);
+	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
+	if (ret)
+		return ret;
+
+	ret = ads1100_set_config_bits(data, ADS1100_DR_MASK,
+				      FIELD_PREP(ADS1100_DR_MASK, i));
+	if (ret)
+		return ret;
+
+	return ads1100_poll_data_ready(data);
 }
 
 static int ads1100_get_vdd_millivolts(struct ads1100_data *data)
Signature · 1 line
2.53.0
author maintainer
#31 lore raw

PATCH 30/869 cpufreq: airoha: fix probe failure with correct error check

In reply to Greg Kroah-Hartman

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

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

From: Daniel Schwierzeck <[email protected]>

[ Upstream commit 801ade22c4fc078ea9b11e1f3fe3aae8b8bef886 ]

dev_pm_domain_attach_list() returns the number of attached PM domains on success (a positive count), or a negative error code on failure. The driver checks "if (ret)" which treats a successful attachment of one or more PM domains as an error, causing the probe to fail with return code 1.

Fix by checking "if (ret < 0)" like all other users of this API.

Fixes 84cf9e541ccc ("cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver")
---
 drivers/cpufreq/airoha-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/airoha-cpufreq.c +1 -1
index b6b1cdc4d11d6..ec9b2fc00f5e0 100644
@@ -64,7 +64,7 @@ static int airoha_cpufreq_probe(struct platform_device *pdev)
 	/* Attach PM for OPP */
 	ret = dev_pm_domain_attach_list(cpu_dev, &attach_data,
 					&priv->pd_list);
-	if (ret)
+	if (ret < 0)
 		goto clear_opp_config;
 
 	cpufreq_dt = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
Signature · 1 line
2.53.0
author maintainer
#32 lore raw

PATCH 31/869 media: streamzap: Add missing rc_unregister_device()

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit 3982d2eeb1bdf7a9c14e4ff69015cb456f11da51 ]

If usb_submit_urb() fails during probe, then the error path is missing a call to rc_unregister_device(), which will leak various things like the input device.

Fixes 42844992664f ("media: rc: streamzap: Error handling in probe")
---
 drivers/media/rc/streamzap.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/rc/streamzap.c +1 -0
index 8c85b9f30a3a9..e91cf2ffbc876 100644
@@ -365,6 +365,7 @@ static int streamzap_probe(struct usb_interface *intf,
 
 	return 0;
 rc_submit_fail:
+	rc_unregister_device(sz->rdev);
 	rc_free_device(sz->rdev);
 	usb_set_intfdata(intf, NULL);
 rc_dev_fail:
Signature · 1 line
2.53.0
author maintainer
#33 lore raw

PATCH 32/869 media: redrat3: Ensure we dont read beyond the end of the packet

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit cd49f62f4161c7340d9c9f53b67757575900c0bc ]

The length and offset is provided by the usb device, so it should be validated.

Fixes 2154be651b90 ("[media] redrat3: new rc-core IR transceiver device driver")
---
 drivers/media/rc/redrat3.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/media/rc/redrat3.c +16 -0
index 3170bd72a8e6f..4cbbe16a8ac47 100644
@@ -358,8 +358,24 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3)
 
 	/* process each rr3 encoded byte into an int */
 	sig_size = be16_to_cpu(rr3->irdata.sig_size);
+
+	/*
+	 * Note we are not checking if we are reading beyond the end of the
+	 * packet which was sent, and reading stale data. If the device
+	 * sends a packet which is short then we get garbage IR, but no
+	 * out of bounds read.
+	 */
+	if (sig_size > RR3_MAX_SIG_SIZE) {
+		dev_err(dev, "length %u is incorrect\n", sig_size);
+		return;
+	}
+
 	for (i = 0; i < sig_size; i++) {
 		offset = rr3->irdata.sigdata[i];
+		if (offset >= RR3_DRIVER_MAXLENS) {
+			dev_err(dev, "offset %u is incorrect\n", offset);
+			return;
+		}
 		val = get_unaligned_be16(&rr3->irdata.lens[offset]);
 
 		/* we should always get pulse/space/pulse/space samples */
Signature · 1 line
2.53.0
author maintainer
#34 lore raw

PATCH 33/869 media: redrat3: Ensure all urbs are suspended

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit 1582f545273f2aa4eb4ee6f3a89b433f5c85c68f ]

Ensure that the learn urb is stopped before suspend.

Fixes c49fcdde38cb ("[media] redrat3: enable carrier reports using wideband receiver")
---
 drivers/media/rc/redrat3.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/rc/redrat3.c +1 -0
index 4cbbe16a8ac47..c9a5c030f7726 100644
@@ -1170,6 +1170,7 @@ static int redrat3_dev_suspend(struct usb_interface *intf, pm_message_t message)
 	usb_kill_urb(rr3->narrow_urb);
 	usb_kill_urb(rr3->wide_urb);
 	usb_kill_urb(rr3->flash_urb);
+	usb_kill_urb(rr3->learn_urb);
 	return 0;
 }
 
Signature · 1 line
2.53.0
author maintainer
#35 lore raw

PATCH 34/869 media: sunxi-cir: Ensure no more interrupts can occur before free

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit f9b33ec404200c03dd490ec133b8f9bf599c5444 ]

Only call rc_free_device() once the hardware has been stopped.

Fixes dccc0c3ddf8f ("media: rc: fix race between unregister and urb/irq callbacks")
---
 drivers/media/rc/sunxi-cir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/sunxi-cir.c +1 -1
index 28e840a7e5b8c..af1ee08ffdbec 100644
@@ -374,8 +374,8 @@ static void sunxi_ir_remove(struct platform_device *pdev)
 	struct sunxi_ir *ir = platform_get_drvdata(pdev);
 
 	rc_unregister_device(ir->rc);
-	rc_free_device(ir->rc);
 	sunxi_ir_hw_exit(&pdev->dev);
+	rc_free_device(ir->rc);
 }
 
 static void sunxi_ir_shutdown(struct platform_device *pdev)
Signature · 1 line
2.53.0
author maintainer
#36 lore raw

PATCH 35/869 media: meson-ir-tx: Ensure clock is disabled on unbind

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit 1517326fcc9dfdb9acb24f42472366ac1b4b8237 ]

clk_prepare_enable() needs a call to clk_disable_unprepare() on driver unbind. Make it devm managed.

Fixes 49be1c78d575 ("media: rc: introduce Meson IR TX driver")
---
 drivers/media/rc/meson-ir-tx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/rc/meson-ir-tx.c +4 -3
index fded2c256f2a6..6beb9e97453dd 100644
@@ -288,11 +288,12 @@ static int meson_irtx_mod_clock_probe(struct meson_irtx *ir,
 	if (!np)
 		return -ENODEV;
 
-	clock = devm_clk_get(ir->dev, "xtal");
-	if (IS_ERR(clock) || clk_prepare_enable(clock))
+	*clk_nr = IRB_MOD_XTAL3_CLK;
+
+	clock = devm_clk_get_enabled(ir->dev, "xtal");
+	if (IS_ERR(clock))
 		return -ENODEV;
 
-	*clk_nr = IRB_MOD_XTAL3_CLK;
 	ir->clk_rate = clk_get_rate(clock) / 3;
 
 	if (ir->clk_rate < IRB_MOD_1US_CLK_RATE) {
Signature · 1 line
2.53.0
author maintainer
#37 lore raw

PATCH 36/869 media: meson-ir-tx: Ensure rc_free_device() is called on unbind

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit 32999b8a9d5c4f497c9739e70ac4ee390cd650a7 ]

Make rc_dev devm managed.

Fixes dccc0c3ddf8f ("media: rc: fix race between unregister and urb/irq callbacks")
---
 drivers/media/rc/meson-ir-tx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/rc/meson-ir-tx.c +2 -4
index 6beb9e97453dd..e8e3c1a303279 100644
@@ -346,7 +346,7 @@ static int meson_irtx_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "irq request failed\n");
 
-	rc = rc_allocate_device(RC_DRIVER_IR_RAW_TX);
+	rc = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW_TX);
 	if (!rc)
 		return -ENOMEM;
 
@@ -359,10 +359,8 @@ static int meson_irtx_probe(struct platform_device *pdev)
 	rc->s_tx_duty_cycle = meson_irtx_set_duty_cycle;
 
 	ret = devm_rc_register_device(dev, rc);
-	if (ret < 0) {
-		rc_free_device(rc);
+	if (ret < 0)
 		return dev_err_probe(dev, ret, "rc_dev registration failed\n");
-	}
 
 	return 0;
 }
Signature · 1 line
2.53.0
author maintainer
#38 lore raw

PATCH 37/869 media: meson-ir-tx: Ensure probe error is propagated

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit 2eb8a4cba70f521a8217021e227cfa28ba17724b ]

devm_clk_get_enabled() may return -EPROBE_DEFER which needs to be propagated else the probe will not be deferred, it will fail instead.

Fixes 49be1c78d575 ("media: rc: introduce Meson IR TX driver")
---
 drivers/media/rc/meson-ir-tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/rc/meson-ir-tx.c +2 -2
index e8e3c1a303279..1ab898069e67f 100644
@@ -292,7 +292,7 @@ static int meson_irtx_mod_clock_probe(struct meson_irtx *ir,
 
 	clock = devm_clk_get_enabled(ir->dev, "xtal");
 	if (IS_ERR(clock))
-		return -ENODEV;
+		return PTR_ERR(clock);
 
 	ir->clk_rate = clk_get_rate(clock) / 3;
 
@@ -325,7 +325,7 @@ static int meson_irtx_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return -ENODEV;
+		return irq;
 
 	ir->dev = dev;
 	ir->carrier = MIRTX_DEFAULT_CARRIER;
Signature · 1 line
2.53.0
author maintainer
#39 lore raw

PATCH 38/869 media: ir-hix5hd2: Ensure rdev is setup before interrupts are enabled

In reply to Greg Kroah-Hartman

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

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

From: Sean Young <[email protected]>

[ Upstream commit f7509d2567cf92eeccc31c363a2e2ae43188930c ]

Once the interrupt handler is enabled, priv->rdev can be used. Ensure it is setup correctly so there is no race condition.

Fixes a84fcdaa9058 ("[media] rc: Introduce hix5hd2 IR transmitter driver")
---
 drivers/media/rc/ir-hix5hd2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/ir-hix5hd2.c +3 -2
index bb0f95833df57..04982ffde68f9 100644
@@ -316,6 +316,9 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto clkerr;
 
+	priv->rdev = rdev;
+	priv->dev = dev;
+
 	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
 			     0, pdev->name, priv) < 0) {
 		dev_err(dev, "IRQ %d register failed\n", priv->irq);
@@ -323,8 +326,6 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
 		goto regerr;
 	}
 
-	priv->rdev = rdev;
-	priv->dev = dev;
 	platform_set_drvdata(pdev, priv);
 
 	return ret;
Signature · 1 line
2.53.0
author maintainer
#40 lore raw

PATCH 39/869 media: imx-jpeg: finish the job on device_run() error paths

In reply to Greg Kroah-Hartman

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

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

From: Fan Wu <[email protected]>

[ Upstream commit 30b35fd2b999e1b8c26f8191d974d20c8848d2d6 ]

mxc_jpeg_device_run() returns early through a shared "end" label on several error paths (no free slot, mxc_jpeg_alloc_slot_data() failure, or missing buffers or queue data), and none of them calls v4l2_m2m_job_finish(). Since the delayed work is queued only after the hardware is started, those paths neither finish the job directly nor queue timeout work that could finish it later. The job is left with TRANS_RUNNING set, so the wait_event() in v4l2_m2m_cancel_job() (reached from v4l2_m2m_ctx_release() at close) waits indefinitely and the close hangs.

mxc_jpeg_alloc_slot_data() uses dma_alloc_coherent(), so the failure path is reachable under memory pressure.

Return the src/dst buffers with VB2_BUF_STATE_ERROR and call v4l2_m2m_job_finish() on those paths: paths that have buffers use a "buf_finish" label; the no-buffer path uses "job_finish" directly. This mirrors the existing jpeg_parse_error path.

This bug was found by static analysis.

Fixes 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
---
 .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 21 +++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +15 -6
index 4ac4f576fdd10..9f0794dd5c544 100644
@@ -1525,15 +1525,15 @@ static void mxc_jpeg_device_run(void *priv)
 	dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 	if (!src_buf || !dst_buf) {
 		dev_err(dev, "Null src or dst buf\n");
-		goto end;
+		goto job_finish;
 	}
 
 	q_data_cap = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
 	if (!q_data_cap)
-		goto end;
+		goto buf_finish;
 	q_data_out = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
 	if (!q_data_out)
-		goto end;
+		goto buf_finish;
 	src_buf->sequence = q_data_out->sequence++;
 	dst_buf->sequence = q_data_cap->sequence++;
 
@@ -1571,11 +1571,11 @@ static void mxc_jpeg_device_run(void *priv)
 	ctx->slot = mxc_get_free_slot(&jpeg->slot_data);
 	if (ctx->slot < 0) {
 		dev_err(dev, "No more free slots\n");
-		goto end;
+		goto buf_finish;
 	}
 	if (!mxc_jpeg_alloc_slot_data(jpeg)) {
 		dev_err(dev, "Cannot allocate slot data\n");
-		goto end;
+		goto buf_finish;
 	}
 
 	mxc_jpeg_enable_slot(reg, ctx->slot);
@@ -1597,8 +1597,17 @@ static void mxc_jpeg_device_run(void *priv)
 		mxc_jpeg_dec_mode_go(dev, reg);
 	}
 	schedule_delayed_work(&ctx->task_timer, msecs_to_jiffies(hw_timeout));
-end:
+
 	spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags);
+	return;
+buf_finish:
+	v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
+	v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
+	v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR);
+	v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR);
+job_finish:
+	spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags);
+	v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
 }
 
 static int mxc_jpeg_decoder_cmd(struct file *file, void *priv,
Signature · 1 line
2.53.0
author maintainer
#41 lore raw

PATCH 40/869 microblaze: Fix MB_MANAGER build with older binutils

In reply to Greg Kroah-Hartman

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

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

From: Karl Mehltretter <[email protected]>

[ Upstream commit 79c8aa4da3d5453dd956d2170d1c9c716311ea06 ]

Commit 88707ebe77e2 ("microblaze: Add custom break vector handler for mb manager") added the suspend mnemonic to the MB Manager break handler.

GNU as only learned this mnemonic in binutils 2.42. Linux supports binutils 2.30, where enabling CONFIG_MB_MANAGER fails:

arch/microblaze/kernel/entry.S:946: Error: unknown opcode "suspend"

The suspend mnemonic is an alias for mbar 24, and both encode as 0xbb020004. Use the underlying instruction, which GNU as 2.30 already supports.

---
 arch/microblaze/kernel/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/microblaze/kernel/entry.S +1 -1
index 582d7256d8154..ad44341a5dbc7 100644
@@ -943,7 +943,7 @@ ret_from_break:
 	mbar	1
 	mbar	2
 	bri	4
-	suspend
+	mbar	24 /* suspend */
 	nop
 #endif
 
Signature · 1 line
2.53.0
author maintainer
#42 lore raw

PATCH 41/869 udf: Make sure theres enough space for LVID implementation use field

In reply to Greg Kroah-Hartman

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

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

From: Jan Kara <[email protected]>

[ Upstream commit a61fb39759d719a4f4966742b4d28387e33d81c4 ]

udf_lvid_valid() verifies that the LVID has enough space for all the tables and the reported length of ImplementationUse field. However it doesn't make sure the reported length is large enough to contain logicalVolIntegrityDescImpUse structure which OSTA specification requires. This can thus lead to accesses beyond the end of LVID buffer for suitably corrupted UDF filesystem. Add the length check.

---
 fs/udf/super.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/udf/super.c +4 -1
index f91b231b7d7bd..556540f2797ae 100644
@@ -1611,7 +1611,10 @@ static bool udf_lvid_valid(struct super_block *sb,
 
 	parts = le32_to_cpu(lvid->numOfPartitions);
 	impuselen = le32_to_cpu(lvid->lengthOfImpUse);
-	if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize ||
+	if (sizeof(struct logicalVolIntegrityDescImpUse) > impuselen ||
+	    impuselen >= sb->s_blocksize)
+		return false;
+	if (parts >= sb->s_blocksize ||
 	    sizeof(struct logicalVolIntegrityDesc) + impuselen +
 	    2 * parts * sizeof(u32) > sb->s_blocksize)
 		return false;
Signature · 1 line
2.53.0
author maintainer
#43 lore raw

PATCH 42/869 aio: prevent eventfd/epoll recursion on poll

In reply to Greg Kroah-Hartman

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

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

From: Daehyeon Ko <[email protected]>

[ Upstream commit 398e3fa789aa5ffddc8689d8cbc7b31e1824130c ]

aio_poll_wake() can complete a keyed poll request inline while the provider waitqueue lock is held. If the polled file is an epoll instance and the AIO result eventfd is watched by that same instance, signaling the result can feed back into epoll and try to take the provider waitqueue lock again.

For example, a timerfd wake can follow this path:

timerfd -> ep_poll_callback -> aio_poll_wake -> aio_complete

          -> eventfd_signal -> ep_poll_callback -> ep_poll_safewake

The second ep_poll_safewake() recursively acquires ep->poll_wait.lock. eventfd_signal_allowed() does not prevent this because the wake chain did not begin in eventfd, so the task's eventfd recursion bit is still clear when aio_poll_wake() decides to complete inline.

An unprivileged process can construct this graph and make a CPU spin on the recursive lock. DEBUG_SPINLOCK reports "BUG: spinlock recursion", and lockdep reports the same epoll waitqueue lock as both held and requested.

Always defer eventfd-backed poll completions through the existing aio_poll_put_work() path. At this point the request has already been detached from the waitqueue and active request list, so the work item can publish the completion after the provider callback releases its lock. Poll completions without a result eventfd remain inline.

Fixes e8693bcfa0b4 ("aio: allow direct aio poll comletions for keyed wakeups")
---
 fs/aio.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/aio.c +6 -1
index 5bc1333864078..bd92bd3e13408 100644
@@ -1816,7 +1816,12 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
 		list_del_init(&req->wait.entry);
 		list_del(&iocb->ki_list);
 		iocb->ki_res.res = mangle_poll(mask);
-		if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
+		/*
+		 * We hold an arbitrary provider waitqueue lock here.  Signaling a
+		 * result eventfd can feed back through epoll and try to take the same
+		 * lock again.  Defer all eventfd-backed poll completions.
+		 */
+		if (iocb->ki_eventfd) {
 			iocb = NULL;
 			INIT_WORK(&req->work, aio_poll_put_work);
 			schedule_work(&req->work);
Signature · 1 line
2.53.0
author maintainer
#44 lore raw

PATCH 43/869 ipc/mqueue: release notification resources during inode eviction

In reply to Greg Kroah-Hartman

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

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

From: Daehyeon Ko <[email protected]>

[ Upstream commit eb85469f0dd69ca145d63117450e14c31f67f698 ]

mqueue_flush_file() removes an mq_notify() registration only when the closing task belongs to the thread group stored in notify_owner.

A task in a separate thread group created with CLONE_FILES can register SIGEV_THREAD notification and exit without closing the shared file table. If another thread group then unlinks and last-closes the queue, ->flush() skips the registration and inode eviction loses the only pointers to its resources.

The orphaned registration permanently retains the notification skb, its netlink socket, a pid reference and a user namespace reference. An unprivileged process can repeat the sequence with new queues and sockets.

No inode users remain during eviction. Remove any stale registration there after dropping info->lock, since netlink_sendskb() may release the final socket reference.

---
 ipc/mqueue.c | 7 +++++++
 1 file changed, 7 insertions(+)
ipc/mqueue.c +7 -0
index 093551fe66a7e..11eaf5df3645f 100644
@@ -529,6 +529,13 @@ static void mqueue_evict_inode(struct inode *inode)
 		list_add_tail(&msg->m_list, &tmp_msg);
 	kfree(info->node_cache);
 	spin_unlock(&info->lock);
+	/*
+	 * A shared file table can let the notification owner exit without
+	 * running ->flush(). No users of the inode remain during eviction, so
+	 * tear down any stale notification after dropping info->lock because
+	 * netlink_sendskb() may release the final socket reference.
+	 */
+	remove_notification(info);
 
 	list_for_each_entry_safe(msg, nmsg, &tmp_msg, m_list) {
 		list_del(&msg->m_list);
Signature · 1 line
2.53.0
author maintainer
#45 lore raw

PATCH 44/869 remoteproc: elf_loader: Bound the section header table

In reply to Greg Kroah-Hartman

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

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

From: HyeongJun An <[email protected]>

[ Upstream commit b32177ead5f8925aa66ceed2bd533a85196f4f0c ]

The rproc_elf_sanity_check() only checks the image is big enough to hold one section header. But find_table() walks e_shnum of them, and first dereferences the header at e_shstrndx to locate the section name table. Both fields are u16 and both come from the image, so an e_shstrndx of 65535 reads about 4 MB past the buffer.

The commit 9f9967fed9d0 ("soc: qcom: mdt_loader: Ensure we don't read past the ELF header") added the same check to the MDT loader, and says the header "is sanitized beforehand" under remoteproc. That is what this patch makes true.

Check e_shoff against the image size first, so the two bounds can use size_add() without an e_shoff above SIZE_MAX wrapping on 32-bit. The bounds are separate because e_shnum may be zero while find_table() still reads the e_shstrndx header.

Fixes 400e64df6b23 ("remoteproc: add framework for controlling remote processors")
Assisted-by Claude:claude-opus-4-8
---
 drivers/remoteproc/remoteproc_elf_loader.c | 23 ++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/remoteproc/remoteproc_elf_loader.c +21 -2
index 94177e4160473..da3cddbe7d4cb 100644
@@ -46,8 +46,9 @@ int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw)
 	struct elf32_hdr *ehdr;
 	u32 elf_shdr_get_size;
 	u64 phoff, shoff;
+	size_t shend;
 	char class;
-	u16 phnum;
+	u16 phnum, shnum, shstrndx;
 
 	if (!fw) {
 		dev_err(dev, "failed to load %s\n", name);
@@ -90,9 +91,27 @@ int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw)
 	phoff = elf_hdr_get_e_phoff(class, fw->data);
 	shoff = elf_hdr_get_e_shoff(class, fw->data);
 	phnum =  elf_hdr_get_e_phnum(class, fw->data);
+	shnum = elf_hdr_get_e_shnum(class, fw->data);
+	shstrndx = elf_hdr_get_e_shstrndx(class, fw->data);
 	elf_shdr_get_size = elf_size_of_shdr(class);
 
-	if (fw->size < shoff + elf_shdr_get_size) {
+	/* keeps shoff in size_t range for the two bounds below */
+	if (shoff > fw->size) {
+		dev_err(dev, "Section header table is out of bounds\n");
+		return -EINVAL;
+	}
+
+	if (shnum) {
+		shend = size_add(size_mul(elf_shdr_get_size, shnum), shoff);
+		if (shend > fw->size) {
+			dev_err(dev, "Section headers are out of bounds\n");
+			return -EINVAL;
+		}
+	}
+
+	/* find_table() reads the header at shstrndx even with no sections */
+	shend = size_add(size_mul(elf_shdr_get_size, (size_t)shstrndx + 1), shoff);
+	if (shend > fw->size) {
 		dev_err(dev, "Image is too small\n");
 		return -EINVAL;
 	}
Signature · 1 line
2.53.0
author maintainer
#46 lore raw

PATCH 45/869 soc: qcom: geni-se: Fix endian conversion for serial_protocol comparison

In reply to Greg Kroah-Hartman

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

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

From: Viken Dadhaniya <[email protected]>

[ Upstream commit 0231382f070df26a8b267f9e68c5440928b87c89 ]

serial_protocol is declared as __le16 in struct se_fw_hdr, but was decoded with le32_to_cpu(). On big-endian systems the extra byte swap causes the field to always compare unequal to the protocol argument, so no firmware segment is ever selected.

Use le16_to_cpu() to match the field width.

---
 drivers/soc/qcom/qcom-geni-se.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/qcom-geni-se.c +1 -1
index 2fa6a45904e97..53e53736766fc 100644
@@ -1059,7 +1059,7 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 		if (le32_to_cpu(sefw->magic) != SE_MAGIC_NUM || le32_to_cpu(sefw->version) != 1)
 			continue;
 
-		if (le32_to_cpu(sefw->serial_protocol) != protocol)
+		if (le16_to_cpu(sefw->serial_protocol) != protocol)
 			continue;
 
 		if (fw_size % 2 != 0) {
Signature · 1 line
2.53.0
author maintainer
#47 lore raw

PATCH 46/869 soc: qcom: geni-se: Widen fw_size to u32 to prevent wrap-around

In reply to Greg Kroah-Hartman

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

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

From: Viken Dadhaniya <[email protected]>

[ Upstream commit e976c865bf31b562ab3908f0f1e2160da77fa156 ]

fw_size is read from the 16-bit fw_size_in_items field and incremented when the count is odd. If fw_size_in_items == 0xffff the increment wraps to 0 as a u16, making the bounds check below pass for a firmware segment whose actual size was not validated. Widen fw_size to u32 so the increment never wraps.

---
 drivers/soc/qcom/qcom-geni-se.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/qcom-geni-se.c +1 -1
index 53e53736766fc..f73ac13e90014 100644
@@ -1009,7 +1009,7 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 	struct se_fw_hdr *sefw;
 	u32 fw_end, cfg_idx_end, cfg_val_end;
 	u32 prog_ram_depth;
-	u16 fw_size;
+	u32 fw_size;
 	int i;
 
 	if (!fw || fw->size < sizeof(struct elf32_hdr))
Signature · 1 line
2.53.0
author maintainer
#48 lore raw

PATCH 47/869 soc: qcom: geni-se: Fix fw_end computed before round-up; propagate size to caller

In reply to Greg Kroah-Hartman

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

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

From: Viken Dadhaniya <[email protected]>

[ Upstream commit d1750c530e9b9b75c8d1b29d3c76e052a049f51f ]

fw_end was computed from the raw fw_size_in_items, before the odd-word round-up. A segment with an odd word count could pass the bounds check at the unrounded value but then be copied one word past the validated limit. Move fw_end (and the cfg_{idx,val}_end) calculations to after the round-up so they always reflect the true copy extent.

The caller geni_load_se_fw() re-read hdr->fw_size_in_items for the memcpy_toio() length, bypassing the validated and rounded value established by geni_find_protocol_fw(). Add a fw_size_out output parameter and use it in the caller.

---
 drivers/soc/qcom/qcom-geni-se.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/soc/qcom/qcom-geni-se.c +14 -9
index f73ac13e90014..917f43192e950 100644
@@ -991,6 +991,8 @@ EXPORT_SYMBOL_GPL(geni_icc_disable);
  * @se: Pointer to the serial engine structure.
  * @fw: Pointer to the firmware image.
  * @protocol: Expected serial engine protocol type.
+ * @fw_size_out: Non-NULL output parameter; receives the rounded, validated
+ *               firmware word count on success.
  *
  * Identifies the appropriate firmware image or configuration required for a
  * specific communication protocol instance running on a Qualcomm GENI
@@ -1000,7 +1002,8 @@ EXPORT_SYMBOL_GPL(geni_icc_disable);
  * Return: pointer to a valid 'struct se_fw_hdr' if found, or NULL otherwise.
  */
 static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct firmware *fw,
-					       enum geni_se_protocol_type protocol)
+					       enum geni_se_protocol_type protocol,
+					       u32 *fw_size_out)
 {
 	struct device *dev = se->dev;
 	const struct elf32_hdr *ehdr;
@@ -1050,11 +1053,6 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 
 		sefw = (struct se_fw_hdr *)(fw->data + phdr->p_offset);
 		fw_size = le16_to_cpu(sefw->fw_size_in_items);
-		fw_end = le16_to_cpu(sefw->fw_offset) + fw_size * sizeof(u32);
-		cfg_idx_end = le16_to_cpu(sefw->cfg_idx_offset) +
-			      le16_to_cpu(sefw->cfg_size_in_items) * sizeof(u8);
-		cfg_val_end = le16_to_cpu(sefw->cfg_val_offset) +
-			      le16_to_cpu(sefw->cfg_size_in_items) * sizeof(u32);
 
 		if (le32_to_cpu(sefw->magic) != SE_MAGIC_NUM || le32_to_cpu(sefw->version) != 1)
 			continue;
@@ -1067,6 +1065,12 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 			sefw->fw_size_in_items = cpu_to_le16(fw_size);
 		}
 
+		fw_end = le16_to_cpu(sefw->fw_offset) + fw_size * sizeof(u32);
+		cfg_idx_end = le16_to_cpu(sefw->cfg_idx_offset) +
+			      le16_to_cpu(sefw->cfg_size_in_items) * sizeof(u8);
+		cfg_val_end = le16_to_cpu(sefw->cfg_val_offset) +
+			      le16_to_cpu(sefw->cfg_size_in_items) * sizeof(u32);
+
 		prog_ram_depth = FIELD_GET(PROG_RAM_DEPTH_MSK,
 					   readl_relaxed(se->base + SE_HW_PARAM_2));
 		if (fw_size >= prog_ram_depth) {
@@ -1081,6 +1085,7 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 			continue;
 		}
 
+		*fw_size_out = fw_size;
 		return sefw;
 	}
 
@@ -1191,11 +1196,11 @@ static int geni_load_se_fw(struct geni_se *se, const struct firmware *fw,
 {
 	const u32 *fw_data, *cfg_val_arr;
 	const u8 *cfg_idx_arr;
-	u32 i, reg_value;
+	u32 i, reg_value, fw_size_in_items;
 	int ret;
 	struct se_fw_hdr *hdr;
 
-	hdr = geni_find_protocol_fw(se, fw, protocol);
+	hdr = geni_find_protocol_fw(se, fw, protocol, &fw_size_in_items);
 	if (!hdr)
 		return -EINVAL;
 
@@ -1272,7 +1277,7 @@ static int geni_load_se_fw(struct geni_se *se, const struct firmware *fw,
 
 	/* Program RAM address space. */
 	memcpy_toio(se->base + SE_GENI_CFG_RAMN, fw_data,
-		    le16_to_cpu(hdr->fw_size_in_items) * sizeof(u32));
+		    fw_size_in_items * sizeof(u32));
 
 	/* Put default values on GENI's output pads. */
 	writel_relaxed(0x1, se->base + GENI_FORCE_DEFAULT_REG);
Signature · 1 line
2.53.0
author maintainer
#49 lore raw

PATCH 48/869 soc: qcom: geni-se: Fix write to read-only firmware buffer

In reply to Greg Kroah-Hartman

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

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

From: Viken Dadhaniya <[email protected]>

[ Upstream commit 28b9c15f1829fff7b26db0dbbbde1c6b466cb156 ]

geni_find_protocol_fw() casts fw->data to a non-const struct se_fw_hdr pointer and writes back the rounded-up fw_size value:

        sefw->fw_size_in_items = cpu_to_le16(fw_size);

The firmware subsystem maps the firmware blob read-only. Writing through the cast pointer causes a level-3 permission fault on AArch64 and crashes the kernel during driver probe.

The write-back is no longer necessary: geni_find_protocol_fw() now propagates the rounded size to the caller via fw_size_out. Remove the write-back and make sefw (and the hdr pointer in the caller) const-correct.

---
 drivers/soc/qcom/qcom-geni-se.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/soc/qcom/qcom-geni-se.c +10 -12
index 917f43192e950..f85cac34c7260 100644
@@ -999,17 +999,17 @@ EXPORT_SYMBOL_GPL(geni_icc_disable);
  * controller. Validates the firmware size against the hardware PROG_RAM_DEPTH
  * read from SE_HW_PARAM_2.
  *
- * Return: pointer to a valid 'struct se_fw_hdr' if found, or NULL otherwise.
+ * Return: pointer to a valid 'const struct se_fw_hdr' if found, or NULL otherwise.
  */
-static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct firmware *fw,
-					       enum geni_se_protocol_type protocol,
-					       u32 *fw_size_out)
+static const struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct firmware *fw,
+						     enum geni_se_protocol_type protocol,
+						     u32 *fw_size_out)
 {
 	struct device *dev = se->dev;
 	const struct elf32_hdr *ehdr;
 	const struct elf32_phdr *phdrs;
 	const struct elf32_phdr	*phdr;
-	struct se_fw_hdr *sefw;
+	const struct se_fw_hdr *sefw;
 	u32 fw_end, cfg_idx_end, cfg_val_end;
 	u32 prog_ram_depth;
 	u32 fw_size;
@@ -1051,7 +1051,7 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 		if (phdr->p_filesz < sizeof(struct se_fw_hdr))
 			continue;
 
-		sefw = (struct se_fw_hdr *)(fw->data + phdr->p_offset);
+		sefw = (const struct se_fw_hdr *)(fw->data + phdr->p_offset);
 		fw_size = le16_to_cpu(sefw->fw_size_in_items);
 
 		if (le32_to_cpu(sefw->magic) != SE_MAGIC_NUM || le32_to_cpu(sefw->version) != 1)
@@ -1060,10 +1060,8 @@ static struct se_fw_hdr *geni_find_protocol_fw(struct geni_se *se, const struct
 		if (le16_to_cpu(sefw->serial_protocol) != protocol)
 			continue;
 
-		if (fw_size % 2 != 0) {
+		if (fw_size % 2 != 0)
 			fw_size++;
-			sefw->fw_size_in_items = cpu_to_le16(fw_size);
-		}
 
 		fw_end = le16_to_cpu(sefw->fw_offset) + fw_size * sizeof(u32);
 		cfg_idx_end = le16_to_cpu(sefw->cfg_idx_offset) +
@@ -1198,15 +1196,15 @@ static int geni_load_se_fw(struct geni_se *se, const struct firmware *fw,
 	const u8 *cfg_idx_arr;
 	u32 i, reg_value, fw_size_in_items;
 	int ret;
-	struct se_fw_hdr *hdr;
+	const struct se_fw_hdr *hdr;
 
 	hdr = geni_find_protocol_fw(se, fw, protocol, &fw_size_in_items);
 	if (!hdr)
 		return -EINVAL;
 
-	fw_data = (const u32 *)((u8 *)hdr + le16_to_cpu(hdr->fw_offset));
+	fw_data = (const u32 *)((const u8 *)hdr + le16_to_cpu(hdr->fw_offset));
 	cfg_idx_arr = (const u8 *)hdr + le16_to_cpu(hdr->cfg_idx_offset);
-	cfg_val_arr = (const u32 *)((u8 *)hdr + le16_to_cpu(hdr->cfg_val_offset));
+	cfg_val_arr = (const u32 *)((const u8 *)hdr + le16_to_cpu(hdr->cfg_val_offset));
 
 	ret = geni_icc_set_bw(se);
 	if (ret)
Signature · 1 line
2.53.0
author maintainer
#50 lore raw

PATCH 49/869 microblaze: reserve the ABI argument-home area in the signal frame

In reply to Greg Kroah-Hartman

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

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

From: Ramin Moussavi <[email protected]>

[ Upstream commit c5947d28c20955de897eeb98430f96db0494f7d7 ]

The MicroBlaze procedure call standard reserves [r1+0] for the return address and lets a callee store its incoming register arguments r5..r10 into the caller-provided home slots at [r1+4]..[r1+24]. When the kernel enters a signal handler it sets r1 to point at struct rt_sigframe, whose leading member is the siginfo prepared for the handler. A handler that homes its arguments - which an unoptimised (-O0) build always does - therefore overwrites the first 24 bytes of that siginfo, so an SA_SIGINFO handler reads corrupted values. The stores stay within siginfo (128 bytes) and do not reach the ucontext behind it.

Reserve the home area by making a seven-word gap -- the return-address slot plus the six argument slots, 28 bytes -- the first member of struct rt_sigframe, so the handler's argument stores land in scratch space instead of clobbering siginfo.

Tested on qemu-system-microblazeel (petalogix-s3adsp1800) with the uClibc-ng NPTL test suite: tst-timer4, tst-timer5, tst-mqueue5 and tst-signal6 pass; before this change they failed because the handler clobbered the signal frame.

Fixes 2148daa9c45f ("microblaze_v8: Signal support")
Assisted-by Claude:claude-opus-5
---
 arch/microblaze/kernel/signal.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/microblaze/kernel/signal.c +8 -0
index c78a0ff480660..4956014a99379 100644
@@ -49,6 +49,14 @@ struct sigframe {
 };
 
 struct rt_sigframe {
+	/*
+	 * Home area for the handler's register arguments: the MicroBlaze
+	 * ABI reserves [r1+0] for the return address and lets the callee
+	 * store r5..r10 at [r1+4]..[r1+24], and r1 points at this frame
+	 * when the handler is entered.  Without the gap those stores
+	 * corrupt frame->info.
+	 */
+	unsigned long abi_gap[7];
 	struct siginfo info;
 	struct ucontext uc;
 	unsigned long tramp[2];	/* signal trampoline */
Signature · 1 line
2.53.0
author maintainer
#51 lore raw

PATCH 50/869 microblaze: dont clobber r3/r4 restored by rt_sigreturn

In reply to Greg Kroah-Hartman

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

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

From: Ramin Moussavi <[email protected]>

[ Upstream commit da6829138a39fa3b9ec318ca54ff89af9d94d350 ]

ret_from_trap begins by storing the system call return values r3 and r4 back into the saved user pt_regs. That is right for an ordinary system call, but sys_rt_sigreturn() returns through the same path and has to be
transparent: restore_sigcontext() has just filled pt_regs from the signal frame, and every register must reach userspace exactly as saved. The two stores overwrite the restored r3/r4 with whatever the C function left in those registers.

Only r4 is actually lost, and that follows from how sigreturn is written everywhere rather than from chance. Architectures have sys_rt_sigreturn() return the restored return-value register precisely so that this writeback stores the restored value -- arm returns regs->ARM_r0, riscv and csky regs->a0, arc regs->r0 -- and microblaze does the same through *rval_p = regs->r3 in restore_sigcontext(). But the entry macros treat r3 and r4 as a pair, so ret_from_trap writes back two registers while a C function has only one return value; nothing carries the restored r4.

Commit 791d0a169b91 ("microblaze: Fix sys_rt_sigreturn_wrapper") introduced this in v2.6.37. The old wrapper saved r3/r4 before the call and reloaded them from pt_regs afterwards; switching brlid to brid removed the only point where they were reloaded, and the stores have been overwriting them ever since.

Fix it the way the sibling paths already behave: ret_from_irq and ret_from_exc restore the full register set and do not perform these stores at all. Label the instruction after the stores ret_from_trap_no_rval and enter there, biasing r15 by -8 so that the ABI return "rtsd r15, 8" lands on it; naming the entry rather than computing ret_from_trap + 8 keeps it correct if the number of stores ever changes. Restoring the old save/reload would work too, but costs four memory accesses and a branch to undo damage that is better not done.

Any value the compiler keeps in r4 across a signal is lost. The tightest windows are the lwx/swx compare-and-swap retry loops gcc emits for atomics:
in uClibc-ng's libc.so alone, 50 of 364 such loops hold the address in r4. This is not specific to one libc -- musl passes the address as "r"(p), and glibc has no microblaze atomic-machine.h and so uses gcc's __atomic builtins, which expand the same way. Triggering it needs threads plus a signal storm, which is why it survived 15 years.

Reproduced on qemu-system-microblazeel (petalogix-s3adsp1800) by running the uClibc-ng NPTL test tst-eintr1 40 times against an unchanged userspace:
on v7.2 built with gcc 16.2.0, 23 of 40 iterations died with SIGSEGV without this patch and 0 of 40 with it; on v7.0 built with gcc 12.5.0 the same comparison gave 6 of 40 against 0 of 40. The register dump of a failing iteration shows the signature: a zero r4 and a fault at address 0, while r3 came back intact.

Fixes 791d0a169b91 ("microblaze: Fix sys_rt_sigreturn_wrapper")
Assisted-by Claude:claude-opus-5
---
 arch/microblaze/kernel/entry.S | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
arch/microblaze/kernel/entry.S +16 -1
index ad44341a5dbc7..efa4ab056fb5f 100644
@@ -434,7 +434,13 @@ C_ENTRY(_user_exception):
 C_ENTRY(ret_from_trap):
 	swi	r3, r1, PT_R3
 	swi	r4, r1, PT_R4
-
+/*
+ * Entry point for returns that must not store r3/r4 back into pt_regs,
+ * i.e. rt_sigreturn, which has already restored them from the signal
+ * context.  Reached as "rtsd r15, 8" with r15 set to this label minus 8,
+ * so it stays correct if the number of stores above ever changes.
+ */
+ret_from_trap_no_rval:
 	lwi	r11, r1, PT_MODE;
 /* See if returning to kernel mode, if so, skip resched &c.  */
 	bnei	r11, 2f;
@@ -518,6 +524,15 @@ C_ENTRY(ret_from_kernel_thread):
 
 C_ENTRY(sys_rt_sigreturn_wrapper):
 	addik	r30, r0, 0		/* no restarts */
+	/*
+	 * rt_sigreturn restores the full register set from the signal
+	 * context, so it must skip the r3/r4 syscall-return stores at the
+	 * head of ret_from_trap which would otherwise overwrite the
+	 * just-restored r3/r4.  Every C function returns with "rtsd r15, 8"
+	 * -- the ABI return, where the 8 skips the caller's branch and its
+	 * delay slot -- so bias r15 by -8 to land on ret_from_trap_no_rval.
+	 */
+	addik	r15, r0, ret_from_trap_no_rval - 8
 	brid	sys_rt_sigreturn	/* Do real work */
 	addik	r5, r1, 0;		/* add user context as 1st arg */
 
Signature · 1 line
2.53.0
author maintainer
#52 lore raw

PATCH 51/869 microblaze: restore the ABI argument home area below pt_regs (PTO)

In reply to Greg Kroah-Hartman

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

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

From: Ramin Moussavi <[email protected]>

[ Upstream commit c35d40a3efd2e575ef51a761e983f2bf7113be6c ]

The MicroBlaze ABI has the caller reserve stack space for the arguments it passes in registers: REG_PARM_STACK_SPACE is 24 and OUTGOING_REG_PARM_STACK_SPACE is 1 in the gcc backend, so a callee may write to [caller_sp + 4, caller_sp + 28). The kernel calls C functions from entry.S with r1 pointing at pt_regs, handing the callee license to spill its incoming arguments over the saved registers -- the syscall dispatch is the worst case, where the first argument slot is PT_R1, the saved user stack pointer.

This was latent until GCC 15: since 3b9b8d6cfdf5 ("ira: Scale save/restore costs of callee save registers with block frequency") the allocator prefers spilling incoming arguments over copying them into callee-saved registers, and a kernel built with gcc >= 15 (without the TARGET_CALLEE_SAVE_COST workaround some distributions carry) corrupts PT_R1 on the first syscall: init takes SIGSEGV and the kernel panics.

The kernel had exactly this reservation until 2011:
commit 6e83557c38b4 ("microblaze: Remove r0_ram pointer and PTO alignment") removed STATE_SAVE_ARG_SPACE and with it the PTO offset, as part of cleaning up what was thought to be copied-from-v850 leftovers. Restore
it: the frame is STATE_SAVE_SIZE = PT_SIZE + PTO, r1 stays at the frame base through every asm-to-C call, and the saved registers are reached at r1 + PTO + PT_*. PTO is 28 rather than the historic 24, which was one word short: FIRST_PARM_OFFSET is 4 and REG_PARM_STACK_SPACE is 24, so the area spans [sp+4, sp+28) and needs 28 bytes. With 24 the last argument slot overlapped pt_regs' r0 -- harmless only because r0 is the constant-zero register. STACK_BOUNDARY is 32 bits, so 28 needs no further rounding.

Two places deliberately keep their mainline addressing. hw_exception_handler.S needs no offset change: its real-mode handler saves into the standalone pt_pool_space buffer rather than a stack frame, and _unaligned_data_exception works through a pointer to pt_regs in r7, where plain PT_* offsets are already right. And the user-SP reload after popping the frame keeps PT_R1 - PT_SIZE because PTO cancels there: (PTO + PT_R1) - (PT_SIZE + PTO) = PT_R1 - PT_SIZE. Both are exactly as the pre-2011 code had them.

The instruction count is unchanged -- the same instructions with different immediates, no per-call reservation and no trampolines. The cost is 28 bytes more kernel stack per saved frame.

Fixes 6e83557c38b4 ("microblaze: Remove r0_ram pointer and PTO alignment")
Assisted-by Claude:claude-opus-5
---
 arch/microblaze/include/asm/entry.h           |  13 +
 arch/microblaze/include/asm/processor.h       |   2 +-
 arch/microblaze/kernel/entry.S                | 329 +++++++++---------
 arch/microblaze/kernel/hw_exception_handler.S |   5 +
 arch/microblaze/kernel/process.c              |   5 +-
 5 files changed, 189 insertions(+), 165 deletions(-)
arch/microblaze/include/asm/entry.h +13 -0
index 9efadf12397ca..05acf4d7bc4b1 100644
@@ -21,6 +21,19 @@
 
 #define PER_CPU(var) var
 
+/*
+ * The MicroBlaze ABI has the caller reserve an argument home area:
+ * REG_PARM_STACK_SPACE is 24 and OUTGOING_REG_PARM_STACK_SPACE is 1, so a
+ * callee may write to [caller_sp + 4, caller_sp + 28).  The kernel calls C
+ * with r1 at the frame base, so reserve that area below pt_regs and reach
+ * the saved registers through PTO.  This restores what 6e83557c38b4
+ * ("microblaze: Remove r0_ram pointer and PTO alignment") removed; the old
+ * value of 24 was one word short and left the last argument slot
+ * overlapping pt_regs' r0.
+ */
+#define PTO			28
+#define STATE_SAVE_SIZE		(PT_SIZE + PTO)
+
 # ifndef __ASSEMBLER__
 DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
 DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
arch/microblaze/include/asm/processor.h +1 -1
index d59bdfffca7cc..595c24db27283 100644
@@ -73,7 +73,7 @@ unsigned long __get_wchan(struct task_struct *p);
 #  define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
 
 #  define task_pt_regs_plus_args(tsk) \
-	((void *)task_pt_regs(tsk))
+	(((void *)task_pt_regs(tsk)) - PTO)
 
 #  define task_sp(task)	(task_regs(task)->r1)
 #  define task_pc(task)	(task_regs(task)->pc)
arch/microblaze/kernel/entry.S +167 -162

675 lines not on this page · raw message

arch/microblaze/kernel/hw_exception_handler.S +5 -0
index 07ea23965f817..4693916be5267 100644
@@ -313,6 +313,11 @@ _MB_HW_ExceptionVectorTable:
 .align 4
 .ent _hw_exception_handler
 _hw_exception_handler:
+	/*
+	 * This handler saves into the static pt_pool_space buffer, not into a
+	 * stack frame, so the plain PT_* offsets are right here -- do not add
+	 * the PTO of entry.S's frames.
+	 */
 	swi	r1, r0, TOPHYS(pt_pool_space + PT_R1); /* GET_SP */
 	/* Save date to kernel memory. Here is the problem
 	 * when you came from user space */
arch/microblaze/kernel/process.c +3 -2
index 6cbf642d7b801..090e1697ea7ae 100644
@@ -19,6 +19,7 @@
 #include <linux/bitops.h>
 #include <linux/ptrace.h>
 #include <asm/cacheflush.h>
+#include <asm/entry.h>
 
 void show_regs(struct pt_regs *regs)
 {
@@ -65,7 +66,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 		 * the registers. That's OK for a brand new thread.*/
 		memset(childregs, 0, sizeof(struct pt_regs));
 		memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
-		ti->cpu_context.r1  = (unsigned long)childregs;
+		ti->cpu_context.r1  = (unsigned long)childregs - PTO;
 		ti->cpu_context.r20 = (unsigned long)args->fn;
 		ti->cpu_context.r19 = (unsigned long)args->fn_arg;
 		childregs->pt_mode = 1;
@@ -79,7 +80,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 		childregs->r1 = usp;
 
 	memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
-	ti->cpu_context.r1 = (unsigned long)childregs;
+	ti->cpu_context.r1 = (unsigned long)childregs - PTO;
 	childregs->msr |= MSR_UMS;
 
 	/* we should consider the fact that childregs is a copy of the parent
Signature · 1 line
2.53.0
author maintainer
#53 lore raw

PATCH 52/869 microblaze: preserve the MSR carry flags across signals

In reply to Greg Kroah-Hartman

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

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

From: Sam Price <[email protected]>

[ Upstream commit ca35dd21a5f8343f47a23e4e5b3f0ffccf76a4ae ]

setup_sigcontext() and restore_sigcontext() copy r0-r31, pc, ear, esr and fsr to and from the signal frame but never touch MSR. The interrupted MSR is therefore dropped from the signal context entirely: the handler's ucontext does not expose it, a handler cannot adjust the resumed arithmetic flags through uc_mcontext.regs.msr, and -- because restore_sigcontext() leaves regs->msr as whatever the rt_sigreturn trap left in it -- the interrupted context resumes with the carry produced by the syscall entry path (_user_exception does "addi r14, r14, 4", which writes carry), not with its own.

Other architectures round-trip the user-visible flags through the signal frame (arm's cpsr, csky's carry, x86's eflags), so a handler can both read and adjust the resumed flags; purely privileged status registers such as riscv's sstatus are left out. MicroBlaze should do the same for the user-writable bits.

Concretely, MSR[C] (carry) is lost across signal delivery. Code that keeps a live carry across a point where a signal can be delivered -- for example an lwx/swx compare-and-swap retry loop, between the swx and the carry test -- resumes with the handler's carry and mis-evaluates the result; the same failure class as the rt_sigreturn r3/r4 clobber, reached through a different register. Demonstrated under qemu-system-microblazeel (machine petalogix-s3adsp1800): a handler that sets MSR_C in uc_mcontext.regs.msr has no effect before this change (0 of 132 in-window signals propagated) and takes effect after (130 of 132).

Save MSR in setup_sigcontext() so the handler's ucontext exposes it. The signal frame is user-writable, so restore_sigcontext() must not restore it
verbatim: MicroBlaze packs the user-writable carry (MSR_C, MSR_CC) and the privileged control bits (MSR_UM, MSR_VM, MSR_IE, MSR_EE, ...) into the one register, and a verbatim restore would let userspace alter privileged return state -- rtbd derives the resumed mode from MSR_UMS/MSR_VMS. Restore only MSR_C | MSR_CC from the frame and keep the rest from the current regs->msr. This mirrors x86's
restore_sigcontext(), which masks the restored EFLAGS to FIX_EFLAGS for the same reason; arches whose status register is purely privileged (e.g. riscv sstatus) simply do not restore it at all.

Comment on the exposed MSR reworded: it is not read-only, restore_sigcontext() applies MSR_C|MSR_CC from the frame. Author's Signed-off-by kept; he agreed to comment and changelog cleanups.

---
 arch/microblaze/kernel/signal.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/microblaze/kernel/signal.c +18 -0
index 4956014a99379..6bbc16f98d5eb 100644
@@ -33,6 +33,7 @@
 #include <linux/linkage.h>
 #include <linux/resume_user_mode.h>
 #include <asm/entry.h>
+#include <asm/registers.h>
 #include <asm/ucontext.h>
 #include <linux/uaccess.h>
 #include <linux/syscalls.h>
@@ -81,6 +82,22 @@ static int restore_sigcontext(struct pt_regs *regs,
 	COPY(pc);	COPY(ear);	COPY(esr);	COPY(fsr);
 #undef COPY
 
+	/*
+	 * The frame is user-writable, so restore only the user-writable
+	 * status flags (carry) and keep the kernel-controlled MSR bits
+	 * (UMS/VMS/IE/EE/...) from regs->msr: rtbd derives the resumed mode
+	 * from UMS/VMS, so a verbatim restore would hand userspace the
+	 * privileged return state.  Same idea as x86 masking the restored
+	 * EFLAGS to FIX_EFLAGS.
+	 */
+	{
+		unsigned long msr;
+
+		err |= __get_user(msr, &sc->regs.msr);
+		regs->msr = (regs->msr & ~(MSR_C | MSR_CC)) |
+			    (msr & (MSR_C | MSR_CC));
+	}
+
 	*rval_p = regs->r3;
 
 	return err;
@@ -140,6 +157,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
 	COPY(r26);	COPY(r27);	COPY(r28);	COPY(r29);
 	COPY(r30);	COPY(r31);
 	COPY(pc);	COPY(ear);	COPY(esr);	COPY(fsr);
+	COPY(msr);	/* restore_sigcontext() accepts only carry state */
 #undef COPY
 
 	err |= __put_user(mask, &sc->oldmask);
Signature · 1 line
2.53.0
author maintainer
#54 lore raw

PATCH 53/869 memory: brcmstb_dpfe: Fix out-of-bounds access due to DCPU offset

In reply to Greg Kroah-Hartman

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

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

From: Justin Chen <[email protected]>

[ Upstream commit 7c0b82d087908765c6c7daeb06943e21b78d523e ]

On API v1/v2 boards, the DCPU coprocessor can steer kernel readl_relaxed() and writel_relaxed() to any address within 256 MB of the ioremapped DPFE dmem or regs base. The DCPU firmware provides a 28-bit offset which the driver adds to the ioremap base without any bounds checking in get_msg_ptr().

This allows a compromised DCPU firmware to trick the host kernel into reading or writing arbitrary memory-mapped I/O registers in vmalloc space. When combined with a root-writable sysfs file like dpfe_refresh, it provides an arbitrary MMIO write primitive. Similarly, world-readable sysfs files can be used to leak other devices' register contents.

Fix this by recording the resource_size() of the dmem and regs ioremaps at probe time, and rejecting any offset that, along with the largest field accessed (DRAM_VENDOR_ERROR + sizeof(u32)), exceeds the recorded mapping size.

Fixes fee5f1ef6cf7 ("memory: brcmstb: dpfe: support new way of passing data from the DCPU")
Assisted-by Gemini:gemini-3.1-pro-preview cursor
---
 drivers/memory/brcmstb_dpfe.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/memory/brcmstb_dpfe.c +20 -2
index 08d9e05b1b338..66343205f585b 100644
@@ -182,6 +182,8 @@ struct brcmstb_dpfe_priv {
 	void __iomem *regs;
 	void __iomem *dmem;
 	void __iomem *imem;
+	resource_size_t regs_size;
+	resource_size_t dmem_size;
 	struct device *dev;
 	const struct dpfe_api *dpfe_api;
 	struct mutex lock;
@@ -401,9 +403,14 @@ static void __iomem *get_msg_ptr(struct brcmstb_dpfe_priv *priv, u32 response,
 	 */
 	switch (msg_type) {
 	case 1:
+		if (DCPU_MSG_RAM_START + offset + DRAM_VENDOR_ERROR +
+		    sizeof(u32) > priv->regs_size)
+			goto bad_offset;
 		ptr = priv->regs + DCPU_MSG_RAM_START + offset;
 		break;
 	case 0:
+		if (offset + DRAM_VENDOR_ERROR + sizeof(u32) > priv->dmem_size)
+			goto bad_offset;
 		ptr = priv->dmem + offset;
 		break;
 	default:
@@ -415,6 +422,12 @@ static void __iomem *get_msg_ptr(struct brcmstb_dpfe_priv *priv, u32 response,
 	}
 
 	return ptr;
+
+bad_offset:
+	dev_err(priv->dev, "DCPU returned out-of-range offset %#x\n", offset);
+	if (buf && size)
+		*size = sprintf(buf, "ERROR: DCPU offset out of range\n");
+	return NULL;
 }
 
 static void __finalize_command(struct brcmstb_dpfe_priv *priv)
@@ -858,6 +871,7 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct brcmstb_dpfe_priv *priv;
+	struct resource *res;
 	int ret;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -869,17 +883,21 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
 	mutex_init(&priv->lock);
 	platform_set_drvdata(pdev, priv);
 
-	priv->regs = devm_platform_ioremap_resource_byname(pdev, "dpfe-cpu");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu");
+	priv->regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(priv->regs)) {
 		dev_err(dev, "couldn't map DCPU registers\n");
 		return -ENODEV;
 	}
+	priv->regs_size = resource_size(res);
 
-	priv->dmem = devm_platform_ioremap_resource_byname(pdev, "dpfe-dmem");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-dmem");
+	priv->dmem = devm_ioremap_resource(dev, res);
 	if (IS_ERR(priv->dmem)) {
 		dev_err(dev, "Couldn't map DCPU data memory\n");
 		return -ENOENT;
 	}
+	priv->dmem_size = resource_size(res);
 
 	priv->imem = devm_platform_ioremap_resource_byname(pdev, "dpfe-imem");
 	if (IS_ERR(priv->imem)) {
Signature · 1 line
2.53.0
author maintainer
#55 lore raw

PATCH 54/869 memory: brcmstb_dpfe: Bounds check DCPU-supplied MSG_ARG_COUNT

In reply to Greg Kroah-Hartman

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

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

From: Justin Chen <[email protected]>

[ Upstream commit 6b07f8c06caca015a0db69e3f323b5186469bc66 ]

A compromised or buggy DCPU coprocessor can make any user who reads world-readable /sys/devices/.../dpfe_info|dpfe_dram trigger a kernel stack out-of-bounds read of arbitrary extent. This bounds checks chksum_idx against MSG_FIELD_MAX after reading the response from DCPU message RAM.

Fixes 5d06f53d9509 ("memory: brcmstb: dpfe: Compute checksum at __send_command() time")
Assisted-by Gemini:gemini-3.1-pro-preview cursor
---
 drivers/memory/brcmstb_dpfe.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/memory/brcmstb_dpfe.c +2 -0
index 66343205f585b..7b02c36c7fca7 100644
@@ -503,6 +503,8 @@ static int __send_command(struct brcmstb_dpfe_priv *priv, unsigned int cmd,
 		for (i = 0; i < MSG_FIELD_MAX; i++)
 			result[i] = readl_relaxed(regs + DCPU_MSG_RAM(i));
 		chksum_idx = result[MSG_ARG_COUNT] + MSG_ARG_COUNT + 1;
+		if (chksum_idx >= MSG_FIELD_MAX)
+			ret = -EINVAL;
 	}
 
 	/* Tell DCPU we are done */
Signature · 1 line
2.53.0
author maintainer
#56 lore raw

PATCH 55/869 memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile

In reply to Greg Kroah-Hartman

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

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

From: Lad Prabhakar <[email protected]>

[ Upstream commit 3db1fb5e1bb4c9eefc554f985f6f3316fa1292e5 ]

Add XSPI_CDD1BUF0 to the xSPI regmap volatile register table.

XSPI_CDD1BUF0 is a data buffer register used during manual transfers and, like XSPI_CDD0BUF0, its contents are transient and should not be cached by regmap. Mark it as volatile so reads always access the hardware register.

Fixes 687cac9559d8 ("memory: renesas-rpc-if: Add RZ/G3E xSPI support")
---
 drivers/memory/renesas-rpc-if.c | 1 +
 1 file changed, 1 insertion(+)
drivers/memory/renesas-rpc-if.c +1 -0
index 4a417b6930805..7f75052b6ae34 100644
@@ -34,6 +34,7 @@ static const struct regmap_access_table rpcif_volatile_table = {
 
 static const struct regmap_range xspi_volatile_ranges[] = {
 	regmap_reg_range(XSPI_CDD0BUF0, XSPI_CDD0BUF0),
+	regmap_reg_range(XSPI_CDD1BUF0, XSPI_CDD1BUF0),
 };
 
 static const struct regmap_access_table xspi_volatile_table = {
Signature · 1 line
2.53.0
author maintainer
#57 lore raw

PATCH 56/869 wifi: rtw88: fix out-of-bounds CAM write when key table is full

In reply to Greg Kroah-Hartman

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

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

From: イムティヤズ <[email protected]>

[ Upstream commit 10d58823cb44681466c022054030b8e68d94ce2f ]

In rtw_ops_set_key(), when the CAM table is full, rtw_sec_get_free_cam() returns RTW_MAX_SEC_CAM_NUM (32) because find_next_zero_bit()/find_first_zero_bit() return the bitmap size when no free slot exists. The bounds check compares the returned index with ">" against total_cam_num (32), so the invalid index 32 passes the check.

rtw_sec_write_cam() then indexes cam_table[32], an array declared with RTW_MAX_SEC_CAM_NUM (32) entries, causing an out-of-bounds write that corrupts the cam_map allocation bitmap. The write also sets bit 32 of cam_map, which overruns the bitmap as well.

Fix the off-by-one by rejecting indices >= total_cam_num.

Tested on: RTL8821CE (PCIe) on kernel 7.2.0-rc6-rtw88test-00059-g0d8395707651. The patched module loaded and associated to a WPA2 network; ping traffic passed with 0% packet loss. Reassociation and disconnect/reconnect cycles completed without errors, and the CAM table (debugfs dump_cam) showed valid key entries. The CAM-full boundary (28+ pairwise keys) requires an access point with 28+ clients and is not reachable in a single-client setup, so that path was verified by code inspection.

---
 drivers/net/wireless/realtek/rtw88/mac80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/mac80211.c +1 -1
index 766f22d31079e..3b6302f14de03 100644
@@ -597,7 +597,7 @@ static int rtw_ops_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		hw_key_idx = key->keyidx;
 	}
 
-	if (hw_key_idx > sec->total_cam_num) {
+	if (hw_key_idx >= sec->total_cam_num) {
 		ret = -ENOSPC;
 		goto out;
 	}
Signature · 1 line
2.53.0
author maintainer
#58 lore raw

PATCH 57/869 wifi: rtw89: 8851b: fix swapped DPK channel/bandwidth backup fields

In reply to Greg Kroah-Hartman

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

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

From: Yi Cong <[email protected]>

[ Upstream commit 7e080e17ca38b72f6cf01e3bc750c243573e69a7 ]

The .ch and .bw backup fields are swapped; .ch should store the channel and .bw the bandwidth, matching all other chips.

---
 drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c +2 -2
index 84c46d2f4d85e..6d2382cb5cd8c 100644
@@ -1895,8 +1895,8 @@ static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
 	u8 kidx = dpk->cur_idx[path];
 
 	dpk->bp[path][kidx].band = chan->band_type;
-	dpk->bp[path][kidx].ch = chan->band_width;
-	dpk->bp[path][kidx].bw = chan->channel;
+	dpk->bp[path][kidx].ch = chan->channel;
+	dpk->bp[path][kidx].bw = chan->band_width;
 
 	rtw89_debug(rtwdev, RTW89_DBG_RFK,
 		    "[DPK] S%d[%d] (PHY%d): TSSI %s/ DBCC %s/ %s/ CH%d/ %s\n",
Signature · 1 line
2.53.0
author maintainer
#59 lore raw

PATCH 58/869 wifi: rtw89: cap firmware section_num before parsing

In reply to Greg Kroah-Hartman

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

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

From: Laxman Acharya Padhya <[email protected]>

[ Upstream commit 273b0a8be083df6d0319ce62caa870e927f94a31 ]

rtw89_fw_bin_info.section_info has FWDL_SECTION_MAX_NUM (10) entries. The v0/v1 header parsers take section_num from an 8-bit firmware field (0..255) and write info->section_info[i] with no cap. rtw89_fw_download_suit() keeps that object on the stack, so a crafted firmware blob overflows the stack.

Reject a truncated header and a section table that does not fit in the firmware image before reading fw_hdr->sections[i].

---
 drivers/net/wireless/realtek/rtw89/fw.c | 32 +++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
drivers/net/wireless/realtek/rtw89/fw.c +32 -0
index 299526220380f..c4fb9c226faeb 100644
@@ -156,8 +156,24 @@ static int rtw89_fw_hdr_parser_v0(struct rtw89_dev *rtwdev, const u8 *fw, u32 le
 	if (!info)
 		return -EINVAL;
 
+	if (len < sizeof(*fw_hdr)) {
+		rtw89_err(rtwdev, "[ERR]fw header truncated\n");
+		return -EINVAL;
+	}
+
 	info->section_num = le32_get_bits(fw_hdr->w6, FW_HDR_W6_SEC_NUM);
+	if (!info->section_num || info->section_num > FWDL_SECTION_MAX_NUM) {
+		rtw89_err(rtwdev, "[ERR]invalid fw section num %u\n",
+			  info->section_num);
+		return -EINVAL;
+	}
+
 	base_hdr_len = struct_size(fw_hdr, sections, info->section_num);
+	if (base_hdr_len > len) {
+		rtw89_err(rtwdev, "[ERR]fw header truncated\n");
+		return -EINVAL;
+	}
+
 	info->dynamic_hdr_en = le32_get_bits(fw_hdr->w7, FW_HDR_W7_DYN_HDR);
 	info->idmem_share_mode = le32_get_bits(fw_hdr->w7, FW_HDR_W7_IDMEM_SHARE_MODE);
 
@@ -449,9 +465,25 @@ static int rtw89_fw_hdr_parser_v1(struct rtw89_dev *rtwdev, const u8 *fw, u32 le
 	int ret;
 	u32 i;
 
+	if (len < sizeof(*fw_hdr)) {
+		rtw89_err(rtwdev, "[ERR]fw header truncated\n");
+		return -EINVAL;
+	}
+
 	info->section_num = le32_get_bits(fw_hdr->w6, FW_HDR_V1_W6_SEC_NUM);
+	if (!info->section_num || info->section_num > FWDL_SECTION_MAX_NUM) {
+		rtw89_err(rtwdev, "[ERR]invalid fw section num %u\n",
+			  info->section_num);
+		return -EINVAL;
+	}
+
 	info->dsp_checksum = le32_get_bits(fw_hdr->w6, FW_HDR_V1_W6_DSP_CHKSUM);
 	base_hdr_len = struct_size(fw_hdr, sections, info->section_num);
+	if (base_hdr_len > len) {
+		rtw89_err(rtwdev, "[ERR]fw header truncated\n");
+		return -EINVAL;
+	}
+
 	info->dynamic_hdr_en = le32_get_bits(fw_hdr->w7, FW_HDR_V1_W7_DYN_HDR);
 	info->idmem_share_mode = le32_get_bits(fw_hdr->w7, FW_HDR_V1_W7_IDMEM_SHARE_MODE);
 
Signature · 1 line
2.53.0
author maintainer
#60 lore raw

PATCH 59/869 platform/x86: int3472: Fix uninitialised variable warning

In reply to Greg Kroah-Hartman

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

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

From: Sakari Ailus <[email protected]>

[ Upstream commit 70e6384fe0f4cf9768944f81924f6c1478b0ce43 ]

Fix a compiler warning about an uninitialised err_msg variable by printing the error where it is handled:

drivers/platform/x86/intel/int3472/discrete.c:440:24: warning: ‘err_msg’ may be used uninitialized [-Wmaybe-uninitialized]
440 | return dev_err_probe(int3472->dev, ret, err_msg);

---
 drivers/platform/x86/intel/int3472/discrete.c | 25 +++++++++++--------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/platform/x86/intel/int3472/discrete.c +14 -11
index 1505fc3ef7a85..96c33ba80002f 100644
@@ -280,7 +280,6 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 	unsigned long gpio_flags;
 	union acpi_object *obj;
 	struct gpio_desc *gpio;
-	const char *err_msg;
 	const char *con_id;
 	int ret;
 
@@ -326,7 +325,8 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 	case INT3472_GPIO_TYPE_HOTPLUG_DETECT:
 		ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, con_id, gpio_flags);
 		if (ret)
-			err_msg = "Failed to map GPIO pin to sensor\n";
+			dev_err_probe(int3472->dev, ret,
+				      "Failed to map GPIO pin to sensor\n");
 
 		break;
 	case INT3472_GPIO_TYPE_CLK_ENABLE:
@@ -336,7 +336,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 		gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, con_id, gpio_flags);
 		if (IS_ERR(gpio)) {
 			ret = PTR_ERR(gpio);
-			err_msg = "Failed to get GPIO\n";
+			dev_err_probe(int3472->dev, ret, "Failed to get GPIO\n");
 			break;
 		}
 
@@ -344,13 +344,15 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 		case INT3472_GPIO_TYPE_CLK_ENABLE:
 			ret = skl_int3472_register_gpio_clock(int3472, gpio);
 			if (ret)
-				err_msg = "Failed to register clock\n";
+				dev_err_probe(int3472->dev, ret,
+					      "Failed to register clock\n");
 
 			break;
 		case INT3472_GPIO_TYPE_PRIVACY_LED:
 			ret = skl_int3472_register_pled(int3472, gpio);
 			if (ret)
-				err_msg = "Failed to register LED\n";
+				dev_err_probe(int3472->dev, ret,
+					      "Failed to register LED\n");
 
 			break;
 		case INT3472_GPIO_TYPE_POWER_ENABLE:
@@ -360,7 +362,8 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 			ret = skl_int3472_register_regulator(int3472, gpio, enable_time_us,
 							     con_id, second_sensor);
 			if (ret)
-				err_msg = "Failed to register regulator\n";
+				dev_err_probe(int3472->dev, ret,
+					      "Failed to register regulator\n");
 
 			break;
 		default: /* Never reached */
@@ -383,11 +386,11 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
 	int3472->ngpios++;
 	ACPI_FREE(obj);
 
-	if (ret < 0)
-		return dev_err_probe(int3472->dev, ret, err_msg);
-
-	/* Tell acpi_dev_get_resources() to not make a copy of the resource */
-	return 1;
+	/*
+	 * Either return an error or tell acpi_dev_get_resources() to not make a
+	 * copy of the resource.
+	 */
+	return ret < 0 ? ret : 1;
 }
 
 int int3472_discrete_parse_crs(struct int3472_discrete_device *int3472)
Signature · 1 line
2.53.0
author maintainer
#61 lore raw

PATCH 60/869 clk: mstar: msc313-mpll: fix off-by-one in clock array allocation

In reply to Greg Kroah-Hartman

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

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

From: hanzhijian <[email protected]>

[ Upstream commit 712b75152c00a8ab0c56dbfe34caf88e3870ddde ]

The hws array of mpll->clk_data is allocated with struct_size() using ARRAY_SIZE(output_dividers) as the element count, giving it 7 elements. But the probe function stores the MPLL clock at hws[0] and one fixed-factor clock for each output divider at hws[i + 1] for i in [0, ARRAY_SIZE(output_dividers)), writing 8 elements in total. The final write to hws[7] is past the end of the allocation.

clk_data->num is also set to NUMOUTPUTS (8), so the clock framework reads hws[0..7], again accessing hws[7] out of bounds.

Use NUMOUTPUTS as the element count so the allocation matches the number of clocks actually stored and exposed.

Found by smatch:
drivers/clk/mstar/clk-msc313-mpll.c:134 msc313_mpll_probe()
error: buffer overflow 'mpll->clk_data->hws' 7 <= 7

Fixes bef7a78da716 ("clk: mstar: MStar/SigmaStar MPLL driver")
---
 drivers/clk/mstar/clk-msc313-mpll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mstar/clk-msc313-mpll.c +1 -1
index 61beb4e875250..bd45aa0aec011 100644
@@ -105,7 +105,7 @@ static int msc313_mpll_probe(struct platform_device *pdev)
 		return PTR_ERR(mpll->loop_div_second);
 
 	mpll->clk_data = devm_kzalloc(dev, struct_size(mpll->clk_data, hws,
-			ARRAY_SIZE(output_dividers)), GFP_KERNEL);
+				NUMOUTPUTS), GFP_KERNEL);
 	if (!mpll->clk_data)
 		return -ENOMEM;
 
Signature · 1 line
2.53.0
author maintainer
#62 lore raw

PATCH 61/869 ARM: imx: Fix suspend/resume crash with Clang CFI

In reply to Greg Kroah-Hartman

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

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

From: Yo'av Moshe <[email protected]>

[ Upstream commit 242757d109bd5c9b8fb7194fb4d44625be0b859a ]

The suspend code that runs from OCRAM is copied there with fncpy(), which does not copy the kCFI type hash preceding the function. With CONFIG_CFI=y the indirect call through imx6_suspend_in_ocram_fn therefore panics.

Keep the call covered by CFI instead of exempting it:

- Add SYM_TYPED_FUNC_START_ALIGNED(), a variant of SYM_TYPED_FUNC_START() that aligns the function entry rather than the type hash preceding it, and use it to declare imx6_suspend():
fncpy() requires the entry point of the function it copies to be 8-byte aligned. The macro lives in arch/arm/include/asm/linkage.h since the requirement comes from arm's fncpy().

- Add a cfi_type member at the end of struct imx6_cpu_pm_info, which directly precedes the OCRAM copy of the function. It fits in the struct's tail padding, so no sizes or offsets change. Fill it using cfi_get_func_hash(), putting the hash where the caller's CFI check expects it: four bytes before the function entry.

Also mark ccm_base, suspend_ocram_base and imx6_suspend_in_ocram_fn as __ro_after_init: they are only written during __init, and the function pointer in particular should not be writable afterwards.

---
 arch/arm/include/asm/linkage.h   | 29 +++++++++++++++++++++++++++++
 arch/arm/mach-imx/pm-imx6.c      | 26 +++++++++++++++++++++++---
 arch/arm/mach-imx/suspend-imx6.S |  6 ++++--
 3 files changed, 56 insertions(+), 5 deletions(-)
arch/arm/include/asm/linkage.h +29 -0
index c4670694ada79..bba992f5d7a80 100644
@@ -9,4 +9,33 @@
   .type name, %function; \
   END(name)
 
+#ifdef __ASSEMBLY__
+
+/*
+ * Variants of SYM_TYPED_START/SYM_TYPED_FUNC_START that align the
+ * function entry itself instead of the kCFI type hash preceding it,
+ * for functions whose entry point must meet an alignment requirement,
+ * such as the 8-byte alignment fncpy() demands of its source.
+ */
+#ifdef CONFIG_CFI
+
+#define SYM_TYPED_START_ALIGNED(name, linkage, align)	\
+	linkage(name) ASM_NL				\
+	.balign align ASM_NL				\
+	.fill (align) - 4, 1, 0 ASM_NL			\
+	__CFI_TYPE(name) ASM_NL				\
+	name:
+
+#else /* CONFIG_CFI */
+
+#define SYM_TYPED_START_ALIGNED(name, linkage, align)	\
+	SYM_START(name, linkage, .balign align)
+
+#endif /* CONFIG_CFI */
+
+#define SYM_TYPED_FUNC_START_ALIGNED(name, align)	\
+	SYM_TYPED_START_ALIGNED(name, SYM_L_GLOBAL, align)
+
+#endif /* __ASSEMBLY__ */
+
 #endif
arch/arm/mach-imx/pm-imx6.c +23 -3
index a671ca498f887..3c73e2cdb8ceb 100644
@@ -4,6 +4,8 @@
  * Copyright 2011 Linaro Ltd.
  */
 
+#include <linux/build_bug.h>
+#include <linux/cfi.h>
 #include <linux/clk/imx.h>
 #include <linux/delay.h>
 #include <linux/init.h>
@@ -18,6 +20,7 @@
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
+#include <linux/stddef.h>
 #include <linux/suspend.h>
 #include <asm/cacheflush.h>
 #include <asm/fncpy.h>
@@ -61,9 +64,9 @@
 #define MX6Q_SUSPEND_OCRAM_SIZE		0x1000
 #define MX6_MAX_MMDC_IO_NUM		33
 
-static void __iomem *ccm_base;
-static void __iomem *suspend_ocram_base;
-static void (*imx6_suspend_in_ocram_fn)(void __iomem *ocram_vbase);
+static void __iomem *ccm_base __ro_after_init;
+static void __iomem *suspend_ocram_base __ro_after_init;
+static void (*imx6_suspend_in_ocram_fn)(void __iomem *ocram_vbase) __ro_after_init;
 
 /*
  * suspend ocram space layout:
@@ -229,8 +232,18 @@ struct imx6_cpu_pm_info {
 	struct imx6_pm_base l2_base;
 	u32 mmdc_io_num; /* Number of MMDC IOs which need saved/restored. */
 	u32 mmdc_io_val[MX6_MAX_MMDC_IO_NUM][2]; /* To save offset and value */
+	u32 cfi_type; /* kCFI type hash of imx6_suspend() */
 } __aligned(8);
 
+/*
+ * The ocram copy of imx6_suspend() starts right after struct imx6_cpu_pm_info,
+ * and the CFI check on the indirect call reads the kCFI type hash from the
+ * four bytes preceding the function entry, so cfi_type must occupy the last
+ * four bytes of the struct, i.e. fit into its tail padding.
+ */
+static_assert(offsetofend(struct imx6_cpu_pm_info, cfi_type) ==
+	      sizeof(struct imx6_cpu_pm_info));
+
 void imx6_set_int_mem_clk_lpm(bool enable)
 {
 	u32 val = readl_relaxed(ccm_base + CGPR);
@@ -568,6 +581,13 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
 			mmdc_offset_array[i]);
 	}
 
+	/*
+	 * Mask out the Thumb bit, as cfi_get_func_hash() expects the
+	 * function's actual start address. Returns 0 if CONFIG_CFI=n.
+	 */
+	pm_info->cfi_type =
+		cfi_get_func_hash((void *)((uintptr_t)&imx6_suspend & ~1UL));
+
 	imx6_suspend_in_ocram_fn = fncpy(
 		suspend_ocram_base + sizeof(*pm_info),
 		&imx6_suspend,
arch/arm/mach-imx/suspend-imx6.S +4 -2
index 63ccc2d0e920a..95d5f723ea0ed 100644
@@ -3,6 +3,7 @@
  * Copyright 2014 Freescale Semiconductor, Inc.
  */
 
+#include <linux/cfi_types.h>
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 #include <asm/asm-offsets.h>
@@ -148,7 +149,8 @@
 
 	.endm
 
-ENTRY(imx6_suspend)
+/* fncpy() requires an 8-byte-aligned entry; see arch/arm/include/asm/fncpy.h */
+SYM_TYPED_FUNC_START_ALIGNED(imx6_suspend, 8)
 	ldr	r1, [r0, #PM_INFO_PBASE_OFFSET]
 	ldr	r2, [r0, #PM_INFO_RESUME_ADDR_OFFSET]
 	ldr	r3, [r0, #PM_INFO_DDR_TYPE_OFFSET]
@@ -329,4 +331,4 @@ resume:
 	resume_mmdc
 
 	ret	lr
-ENDPROC(imx6_suspend)
+SYM_FUNC_END(imx6_suspend)
Signature · 1 line
2.53.0
author maintainer
#63 lore raw

PATCH 62/869 bpf: Fix queue/stack map u32 index overflow

In reply to Greg Kroah-Hartman

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

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

From: Yuan Chen <[email protected]>

[ Upstream commit 802a30c5db726639df7f93b3a1982ecc64202abe ]

The queue/stack map addresses elements[] with the product of a u32 head/tail index and value_size, but the storage itself is allocated in 64-bit arithmetic. When max_entries * value_size reaches or exceeds U32_MAX, the product wraps and push/peek/pop operate on the wrong element, corrupting map data and leaking stale values to user space. max_entries == U32_MAX would also make the u32 capacity counter qs->size (max_entries + 1) wrap to 0 and permanently break the map.

The original bound check was removed by commit a37fb7ef24a4 ("bpf:
Eliminate rlimit-based memory accounting for queue_stack_maps maps"), which deleted the bpf_map_charge_init() call and with it the U32_MAX - PAGE_SIZE check that had earlier been moved into bpf_map_charge_init() by c85d69135a91. Oversized queue/stack maps can therefore be created again.

Restore the bound in queue_stack_map_alloc_check() with a single comparison that rejects any max_entries/value_size combination whose element storage would reach or exceed U32_MAX bytes, keeping the u32 index multiplication overflow-free and the capacity counter valid.

Fixes a37fb7ef24a4 ("bpf: Eliminate rlimit-based memory accounting for queue_stack_maps maps")
---
 kernel/bpf/queue_stack_maps.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/bpf/queue_stack_maps.c +3 -0
index c1c9dee4dcdd0..b5628e4149817 100644
@@ -59,6 +59,9 @@ static int queue_stack_map_alloc_check(union bpf_attr *attr)
 		 */
 		return -E2BIG;
 
+	if (attr->max_entries >= U32_MAX / attr->value_size)
+		return -E2BIG;
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
author maintainer
#64 lore raw

PATCH 63/869 hte: tegra194: Initialize slice locks before registering chip

In reply to Greg Kroah-Hartman

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

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

From: Runyu Xiao <[email protected]>

[ Upstream commit 1329abe1bae416ab2cff89c3312d33f745d341c7 ]

Registering the HTE chip publishes its request callbacks to consumers. Initialize every slice lock before registration so a concurrent HTE request cannot use an uninitialized lock.

Fixes 09574cca6ad6 ("hte: Add Tegra194 HTE kernel provider")
---
 drivers/hte/hte-tegra194.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hte/hte-tegra194.c +5 -5
index 690eb9be30fb8..4644677370022 100644
@@ -787,17 +787,17 @@ static int tegra_hte_probe(struct platform_device *pdev)
 
 	hte_dev->chip = gc;
 
+	for (i = 0; i < slices; i++) {
+		hte_dev->sl[i].flags = 0;
+		spin_lock_init(&hte_dev->sl[i].s_lock);
+	}
+
 	ret = devm_hte_register_chip(hte_dev->chip);
 	if (ret) {
 		dev_err(gc->dev, "hte chip register failed");
 		return ret;
 	}
 
-	for (i = 0; i < slices; i++) {
-		hte_dev->sl[i].flags = 0;
-		spin_lock_init(&hte_dev->sl[i].s_lock);
-	}
-
 	val = HTE_TECTRL_ENABLE_ENABLE |
 	      (HTE_TECTRL_INTR_ENABLE << HTE_TECTRL_INTR_SHIFT) |
 	      (hte_dev->itr_thrshld << HTE_TECTRL_OCCU_SHIFT);
Signature · 1 line
2.53.0
author maintainer
#65 lore raw

PATCH 64/869 wifi: ath11k: Fix possible memory leak in ath11k_dp_srng_setup()

In reply to Greg Kroah-Hartman

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

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

From: Abdun Nihaal <[email protected]>

[ Upstream commit 6132d70d0890c03546f6970893fd71938efb2a2f ]

In ath11k_dp_srng_setup(), the memory allocated for ring->vaddr_unaligned is not freed in the error paths that follow. Fix that by calling ath11k_dp_srng_cleanup() in those error paths.

Compile tested only. Issue found using a prototype static analysis tool built on the LLVM compiler infrastructure.

Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Assisted-by Claude:claude-sonnet-4-6
---
 drivers/net/wireless/ath/ath11k/dp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath11k/dp.c +2 -0
index 68c7ef190780a..5e67f088962e5 100644
@@ -316,6 +316,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
 	case HAL_RXDMA_DIR_BUF:
 		break;
 	default:
+		ath11k_dp_srng_cleanup(ab, ring);
 		ath11k_warn(ab, "Not a valid ring type in dp :%d\n", type);
 		return -EINVAL;
 	}
@@ -327,6 +328,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
 
 	ret = ath11k_hal_srng_setup(ab, type, ring_num, mac_id, &params);
 	if (ret < 0) {
+		ath11k_dp_srng_cleanup(ab, ring);
 		ath11k_warn(ab, "failed to setup srng: %d ring_id %d\n",
 			    ret, ring_num);
 		return ret;
Signature · 1 line
2.53.0
author maintainer
#66 lore raw

PATCH 65/869 media: i2c: ov8856 : remove ACPI node bypass mechanism

In reply to Greg Kroah-Hartman

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

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

From: Serin Yeh <[email protected]>

[ Upstream commit 609a71568664acb7ee57b42de002ca782e3769e8 ]

On Intel platforms the sensor is enumerated via ACPI, and an INT3472 "discrete" companion device (the power-logic-control driver under drivers/platform/x86/intel/int3472) registers the sensor's reset/powerdown GPIOs and the regulator supply. These resources are therefore discoverable and usable through the standard gpiod/regulator lookups at probe time.

However, the driver guarded both the GPIO/regulator acquisition in ov8856_get_hwcfg() and the whole power-on/off sequence with is_acpi_node() and skipped them on ACPI. As a result the sensor was never powered or reset by the driver, and probe failed when reading the chip ID in ov8856_identify_module().

Remove the is_acpi_node() checks so the GPIO/regulator resources are acquired and the full power sequence runs regardless of the firmware interface. The driver now behaves consistently across DT and ACPI platforms and initialises the hardware correctly.

Tested on Intel platforms with kernel 6.17 and 7.0.

Fixes d2fa1134a48b ("media: i2c: ov8856: Use V4L2 legacy sensor clock helper")
---
 drivers/media/i2c/ov8856.c | 29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)
drivers/media/i2c/ov8856.c +10 -19
index dd01e1d515ff6..2e104734ef0b1 100644
@@ -2071,9 +2071,6 @@ static int ov8856_power_on(struct device *dev)
 	struct ov8856 *ov8856 = to_ov8856(sd);
 	int ret;
 
-	if (is_acpi_node(dev_fwnode(dev)))
-		return 0;
-
 	ret = clk_prepare_enable(ov8856->xvclk);
 	if (ret < 0) {
 		dev_err(dev, "failed to enable xvclk\n");
@@ -2109,9 +2106,6 @@ static int ov8856_power_off(struct device *dev)
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct ov8856 *ov8856 = to_ov8856(sd);
 
-	if (is_acpi_node(dev_fwnode(dev)))
-		return 0;
-
 	gpiod_set_value_cansleep(ov8856->reset_gpio, 1);
 	regulator_bulk_disable(ARRAY_SIZE(ov8856_supply_names),
 			       ov8856->supplies);
@@ -2282,21 +2276,18 @@ static int ov8856_get_hwcfg(struct ov8856 *ov8856)
 		dev_warn(dev, "external clock rate %u is unsupported",
 			 xvclk_rate);
 
-	if (!is_acpi_node(fwnode)) {
-		ov8856->reset_gpio = devm_gpiod_get_optional(dev, "reset",
-							     GPIOD_OUT_LOW);
-		if (IS_ERR(ov8856->reset_gpio))
-			return PTR_ERR(ov8856->reset_gpio);
+	ov8856->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+						     GPIOD_OUT_LOW);
+	if (IS_ERR(ov8856->reset_gpio))
+		return PTR_ERR(ov8856->reset_gpio);
 
-		for (i = 0; i < ARRAY_SIZE(ov8856_supply_names); i++)
-			ov8856->supplies[i].supply = ov8856_supply_names[i];
+	for (i = 0; i < ARRAY_SIZE(ov8856_supply_names); i++)
+		ov8856->supplies[i].supply = ov8856_supply_names[i];
 
-		ret = devm_regulator_bulk_get(dev,
-					      ARRAY_SIZE(ov8856_supply_names),
-					      ov8856->supplies);
-		if (ret)
-			return ret;
-	}
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ov8856_supply_names),
+				      ov8856->supplies);
+	if (ret)
+		return ret;
 
 	ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
 	if (!ep)
Signature · 1 line
2.53.0
author maintainer
#67 lore raw

PATCH 66/869 media: i2c: ov8856: fix debug message to report actual CSI-2 lane count

In reply to Greg Kroah-Hartman

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

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

From: Serin Yeh <[email protected]>

[ Upstream commit a15976e69b1c70ea16ef1f7172a846f6ef5dfa14 ]

The driver currently prints the number of data lanes using ov8856->cur_mode->data_lanes in ov8856_get_hwcfg(). However, the ov8856->cur_mode structure is not assigned to a clearly supported mode at that point. Due to the missing pointer, enabling dynamic debug may lead to a kernel panic.

Instead, the correct number of CSI-2 data lanes should be taken from bus_cfg.bus.mipi_csi2.num_data_lanes, which represents the real hardware configuration determined at runtime.

Fixes c492ec9ae9ed ("media: ov8856: Add support for 2 data lanes")
---
 drivers/media/i2c/ov8856.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/ov8856.c +2 -1
index 2e104734ef0b1..27d7ca17d4d68 100644
@@ -2307,7 +2307,8 @@ static int ov8856_get_hwcfg(struct ov8856 *ov8856)
 		goto check_hwcfg_error;
 	}
 
-	dev_dbg(dev, "Using %u data lanes\n", ov8856->cur_mode->data_lanes);
+	dev_dbg(dev, "Using %u data lanes\n",
+		bus_cfg.bus.mipi_csi2.num_data_lanes);
 
 	if (bus_cfg.bus.mipi_csi2.num_data_lanes == 2)
 		ov8856->priv_lane = &lane_cfg_2;
Signature · 1 line
2.53.0
author maintainer
#68 lore raw

PATCH 67/869 mtd: spi-nor: sfdp: check the length of the xSPI Profile 1.0 table

In reply to Greg Kroah-Hartman

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

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

From: HyeongJun An <[email protected]>

[ Upstream commit b9f34a95a81021fa1f3c9cb8cfd458e66824cad6 ]

The spi_nor_parse_profile1() sizes its buffer from the table length the flash reports in the SFDP parameter header. But it then reads DWORD1, DWORD4 and DWORD5 without ever checking the table is that long.

So if a flash reports a length of one, the buffer is only four bytes while DWORD4 and DWORD5 sit at byte offsets 12 and 16. With a length of zero kmalloc() returns ZERO_SIZE_PTR rather than an error, so the NULL check doesn't catch it and the first read dereferences it. And the value doesn't just get thrown away. It ends up as the dummy cycle count for 8D-8D-8D fast reads.

To fix this, reject a table that's too short for the highest DWORD the parser reads, the way spi_nor_parse_4bait() already does. The table is optional, so this isn't fatal. The spi_nor_parse_sfdp() warns and carries on.

Fixes fb27f198971a ("mtd: spi-nor: sfdp: parse xSPI Profile 1.0 table")
Assisted-by Claude:claude-opus-4-8
---
 drivers/mtd/spi-nor/sfdp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mtd/spi-nor/sfdp.c +4 -0
index a8324c2da0acf..7d6a604b89954 100644
@@ -1175,6 +1175,7 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
 #define PROFILE1_DWORD5_DUMMY_166MHZ		GENMASK(31, 27)
 #define PROFILE1_DWORD5_DUMMY_133MHZ		GENMASK(21, 17)
 #define PROFILE1_DWORD5_DUMMY_100MHZ		GENMASK(11, 7)
+#define SFDP_PROFILE1_DWORD_MIN			5
 
 /**
  * spi_nor_parse_profile1() - parse the xSPI Profile 1.0 table
@@ -1192,6 +1193,9 @@ static int spi_nor_parse_profile1(struct spi_nor *nor,
 	int ret;
 	u8 dummy, opcode;
 
+	if (profile1_header->length < SFDP_PROFILE1_DWORD_MIN)
+		return -EINVAL;
+
 	len = profile1_header->length * sizeof(*dwords);
 	dwords = kmalloc(len, GFP_KERNEL);
 	if (!dwords)
Signature · 1 line
2.53.0
author maintainer
#69 lore raw

PATCH 68/869 mtd: spi-nor: sfdp: check the length of the SCCR map

In reply to Greg Kroah-Hartman

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

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

From: HyeongJun An <[email protected]>

[ Upstream commit 1413f38f37194673502e61cd3749e091c031370b ]

The spi_nor_parse_sccr() sizes its buffer from the table length the flash reports in the SFDP parameter header. But it then reads DWORD1 and DWORD22 without ever checking the table is that long.

So if a flash reports a length of one, the buffer is only four bytes while DWORD22 sits at byte offset 84. With a length of zero kmalloc() returns ZERO_SIZE_PTR rather than an error, so the NULL check doesn't catch it and the first read dereferences it.

To fix this, reject a table that's too short for the highest DWORD the parser reads, the way spi_nor_parse_4bait() already does. The table is optional, so this isn't fatal. The spi_nor_parse_sfdp() warns and carries on.

The spi_nor_parse_sccr_mc() doesn't need the same check. It works out the number of dice from the length it allocated with, so its highest index stays inside the buffer.

Fixes 7ab8b810757a ("mtd: spi-nor: sfdp: Add support for SCCR map for multi-chip device")
Assisted-by Claude:claude-opus-4-8
---
 drivers/mtd/spi-nor/sfdp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mtd/spi-nor/sfdp.c +4 -0
index 7d6a604b89954..a9668c83ac5ef 100644
@@ -1266,6 +1266,7 @@ static int spi_nor_parse_profile1(struct spi_nor *nor,
 }
 
 #define SCCR_DWORD22_OCTAL_DTR_EN_VOLATILE		BIT(31)
+#define SFDP_SCCR_DWORD_MIN				22
 
 /**
  * spi_nor_parse_sccr() - Parse the Status, Control and Configuration Register
@@ -1284,6 +1285,9 @@ static int spi_nor_parse_sccr(struct spi_nor *nor,
 	size_t len;
 	int ret;
 
+	if (sccr_header->length < SFDP_SCCR_DWORD_MIN)
+		return -EINVAL;
+
 	len = sccr_header->length * sizeof(*dwords);
 	dwords = kmalloc(len, GFP_KERNEL);
 	if (!dwords)
Signature · 1 line
2.53.0
author maintainer
#70 lore raw

PATCH 69/869 mtd: spi-nor: Unprepare legacy controllers upon RWW wait interruption

In reply to Greg Kroah-Hartman

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

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

From: Miquel Raynal <[email protected]>

[ Upstream commit f594a33f9721f08facd98d0a31adc14ff6da9d70 ]

All the parallel locking helpers (spi_nor_prep_and_lock(), spi_nor_prep_and_lock_pe() and spi_nor_prep_and_lock_rd()) call spi_nor_prep() then wait with a killable sleep. If the sleep gets killed, we leave the controller in its prepared state.

Call ->unprepare() in these cases.

Fixes 74df43b3f626 ("mtd: spi-nor: Enhance locking to support reads while writes")
---
 drivers/mtd/spi-nor/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mtd/spi-nor/core.c +9 -0
index 037407fc2e113..512d0e4e3b1f6 100644
@@ -1281,6 +1281,9 @@ int spi_nor_prep_and_lock(struct spi_nor *nor)
 		ret = wait_event_killable(nor->rww.wait,
 					  spi_nor_rww_start_exclusive(nor));
 
+	if (ret)
+		spi_nor_unprep(nor);
+
 	return ret;
 }
 
@@ -1352,6 +1355,9 @@ static int spi_nor_prep_and_lock_pe(struct spi_nor *nor, loff_t start, size_t le
 		ret = wait_event_killable(nor->rww.wait,
 					  spi_nor_rww_start_pe(nor, start, len));
 
+	if (ret)
+		spi_nor_unprep(nor);
+
 	return ret;
 }
 
@@ -1425,6 +1431,9 @@ static int spi_nor_prep_and_lock_rd(struct spi_nor *nor, loff_t start, size_t le
 		ret = wait_event_killable(nor->rww.wait,
 					  spi_nor_rww_start_rd(nor, start, len));
 
+	if (ret)
+		spi_nor_unprep(nor);
+
 	return ret;
 }
 
Signature · 1 line
2.53.0
author maintainer
#71 lore raw

PATCH 70/869 fs_pin: publish pins with RCU list helpers

In reply to Greg Kroah-Hartman

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

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

From: Karl Mehltretter <[email protected]>

[ Upstream commit 8d01d6b4c17c406f37a9b6edac93dfb858af30d0 ]

pin_insert() initializes a pin before adding it under pin_lock. The kill paths read the list heads under RCU without taking that lock. Plain hlist insertion does not publish the earlier initialization to those readers.

KCSAN weak-memory checking reported acct_on() callback initialization racing with pin_kill() after the superblock-list publication. The corresponding LKMM model permits the stale read with plain publication; the RCU release/acquire pair forbids it.

Use the RCU hlist add and dereference helpers for both pin lists.

---
 fs/fs_pin.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
fs/fs_pin.c +5 -4
index 47ef3c71ce907..1a508f2167e0a 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/fs.h>
+#include <linux/rculist.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include "internal.h"
@@ -22,8 +23,8 @@ void pin_remove(struct fs_pin *pin)
 void pin_insert(struct fs_pin *pin, struct vfsmount *m)
 {
 	spin_lock(&pin_lock);
-	hlist_add_head(&pin->s_list, &m->mnt_sb->s_pins);
-	hlist_add_head(&pin->m_list, &real_mount(m)->mnt_pins);
+	hlist_add_head_rcu(&pin->s_list, &m->mnt_sb->s_pins);
+	hlist_add_head_rcu(&pin->m_list, &real_mount(m)->mnt_pins);
 	spin_unlock(&pin_lock);
 }
 
@@ -73,7 +74,7 @@ void mnt_pin_kill(struct mount *m)
 	while (1) {
 		struct hlist_node *p;
 		rcu_read_lock();
-		p = READ_ONCE(m->mnt_pins.first);
+		p = rcu_dereference(hlist_first_rcu(&m->mnt_pins));
 		if (!p) {
 			rcu_read_unlock();
 			break;
@@ -87,7 +88,7 @@ void group_pin_kill(struct hlist_head *p)
 	while (1) {
 		struct hlist_node *q;
 		rcu_read_lock();
-		q = READ_ONCE(p->first);
+		q = rcu_dereference(hlist_first_rcu(p));
 		if (!q) {
 			rcu_read_unlock();
 			break;
Signature · 1 line
2.53.0
author maintainer
#72 lore raw

PATCH 71/869 fs: make sure to call fsnotify_inoderemove() only once when inode is dead

In reply to Greg Kroah-Hartman

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

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

From: Amir Goldstein <[email protected]>

[ Upstream commit 669bb5af15d41a21359d00a441490f87a88eb52a ]

Daehyeon reported a race wherein fsnotify_removeinode() can be called when inode still has a live alias. This can lead to several undesired outcomes such as crashes in fsnotify code or avoidance of inode mark notifications.

Check that inode is really "dead", meaning no nlink and no more aliases before calling fsnotify_inoderemove() for final cleanup of inode marks. Also do not allow open_by_handle() to add new aliases to a "dead" inode.

Ideally, we'd call fsnotify_inoderemove() once last inode reference is dropped to make things simpler. Alas fsnotify inode marks currently hold inode references and thus this doesn't work. Once we teach fsnotify to avoid holding inode references, these games with dead inodes can go as well.

---
 fs/dcache.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
fs/dcache.c +24 -3
index 5ee1c3d592c85..1b4c210338022 100644
@@ -442,6 +442,17 @@ static void dentry_free(struct dentry *dentry)
 		call_rcu(&dentry->d_u.d_rcu, __d_free);
 }
 
+/*
+ * If inode is unlinked and doesn't have any aliases (i.e., all fds pointing to
+ * it are closed), it is pretty much dead. Except that file handle lookup could
+ * still revive it which causes issues to fsnotify. So once inode reaches this
+ * state we make sure to block creating any new aliases.
+ */
+static bool inode_notify_dead(struct inode *inode)
+{
+	return !inode->i_nlink && hlist_empty(&inode->i_dentry);
+}
+
 /*
  * Release the dentry's inode, using the filesystem
  * d_iput() operation if defined.
@@ -451,14 +462,16 @@ static void dentry_unlink_inode(struct dentry * dentry)
 	__releases(dentry->d_inode->i_lock)
 {
 	struct inode *inode = dentry->d_inode;
+	bool notify_dead;
 
 	raw_write_seqcount_begin(&dentry->d_seq);
 	__d_clear_type_and_inode(dentry);
 	hlist_del_init(&dentry->d_u.d_alias);
 	raw_write_seqcount_end(&dentry->d_seq);
+	notify_dead = inode_notify_dead(inode);
 	spin_unlock(&dentry->d_lock);
 	spin_unlock(&inode->i_lock);
-	if (!inode->i_nlink)
+	if (notify_dead)
 		fsnotify_inoderemove(inode);
 	if (dentry->d_op && dentry->d_op->d_iput)
 		dentry->d_op->d_iput(dentry, inode);
@@ -2022,7 +2035,12 @@ static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected)
 
 	sb = inode->i_sb;
 
-	res = d_find_any_alias(inode); /* existing alias? */
+	spin_lock(&inode->i_lock);
+	if (!inode_notify_dead(inode))
+		res = __d_find_any_alias(inode);	/* existing alias? */
+	else
+		res = ERR_PTR(-ESTALE);
+	spin_unlock(&inode->i_lock);
 	if (res)
 		goto out;
 
@@ -2034,7 +2052,10 @@ static struct dentry *__d_obtain_alias(struct inode *inode, bool disconnected)
 
 	security_d_instantiate(new, inode);
 	spin_lock(&inode->i_lock);
-	res = __d_find_any_alias(inode); /* recheck under lock */
+	if (!inode_notify_dead(inode))
+		res = __d_find_any_alias(inode);	/* recheck under lock */
+	else
+		res = ERR_PTR(-ESTALE);
 	if (likely(!res)) { /* still no alias, attach a disconnected dentry */
 		unsigned add_flags = d_flags_for_inode(inode);
 
Signature · 1 line
2.53.0
author maintainer
#73 lore raw

PATCH 72/869 arm64: dts: ti: k3-am62-verdin: Set MMC clock pins as OUTPUT

In reply to Greg Kroah-Hartman

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

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

From: Francesco Dolcini <[email protected]>

[ Upstream commit 0ddd661c19ec1465e1f2c204fa9b2488acfabf4b ]

MMC clock pins must be configured as OUTPUT-only per TRM [0] with receiver disabled (RXACTIVE bit = 0). Change MMC CLK pins from PIN_INPUT to PIN_OUTPUT to match documentation.

Link https://www.ti.com/lit/pdf/spruiv7 Rev. C: Table 12-246. MMCSDi I/O Signals [0]
Fixes 316b80246b16 ("arm64: dts: ti: add verdin am62")
---
 arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-verdin.dtsi +3 -3
index 059ec492a973e..5e8830fffb949 100644
@@ -573,7 +573,7 @@ AM62X_IOPAD(0x15c, PIN_INPUT, 0)  /* (AB22) MDIO0_MDIO */ /* ETH_1_MDIO, SODIMM
 	pinctrl_sdhci0: main-mmc0-default-pins {
 		pinctrl-single,pins = <
 			AM62X_IOPAD(0x220, PIN_INPUT,        0) /*  (Y3) MMC0_CMD  */
-			AM62X_IOPAD(0x218, PIN_INPUT,        0) /* (AB1) MMC0_CLK  */
+			AM62X_IOPAD(0x218, PIN_OUTPUT,       0) /* (AB1) MMC0_CLK  */
 			AM62X_IOPAD(0x214, PIN_INPUT,        0) /* (AA2) MMC0_DAT0 */
 			AM62X_IOPAD(0x210, PIN_INPUT_PULLUP, 0) /* (AA1) MMC0_DAT1 */
 			AM62X_IOPAD(0x20c, PIN_INPUT_PULLUP, 0) /* (AA3) MMC0_DAT2 */
@@ -589,7 +589,7 @@ AM62X_IOPAD(0x1f8, PIN_INPUT_PULLUP, 0) /* (AC2) MMC0_DAT7 */
 	pinctrl_sdhci1: main-mmc1-default-pins {
 		pinctrl-single,pins = <
 			AM62X_IOPAD(0x23c, PIN_INPUT,        0) /* (A21) MMC1_CMD  */ /* SODIMM 74 */
-			AM62X_IOPAD(0x234, PIN_INPUT,        0) /* (B22) MMC1_CLK  */ /* SODIMM 78 */
+			AM62X_IOPAD(0x234, PIN_OUTPUT,       0) /* (B22) MMC1_CLK  */ /* SODIMM 78 */
 			AM62X_IOPAD(0x230, PIN_INPUT,        0) /* (A22) MMC1_DAT0 */ /* SODIMM 80 */
 			AM62X_IOPAD(0x22c, PIN_INPUT,        0) /* (B21) MMC1_DAT1 */ /* SODIMM 82 */
 			AM62X_IOPAD(0x228, PIN_INPUT,        0) /* (C21) MMC1_DAT2 */ /* SODIMM 70 */
@@ -601,7 +601,7 @@ AM62X_IOPAD(0x224, PIN_INPUT,        0) /* (D22) MMC1_DAT3 */ /* SODIMM 72 */
 	pinctrl_sdhci2: main-mmc2-default-pins {
 		pinctrl-single,pins = <
 			AM62X_IOPAD(0x120, PIN_INPUT, 0) /* (C24) MMC2_CMD   */ /* WiFi_SDIO_CMD   */
-			AM62X_IOPAD(0x118, PIN_INPUT, 0) /* (D25) MMC2_CLK   */ /* WiFi_SDIO_CLK   */
+			AM62X_IOPAD(0x118, PIN_OUTPUT,0) /* (D25) MMC2_CLK   */ /* WiFi_SDIO_CLK   */
 			AM62X_IOPAD(0x114, PIN_INPUT, 0) /* (B24) MMC2_DAT0  */ /* WiFi_SDIO_DATA0 */
 			AM62X_IOPAD(0x110, PIN_INPUT, 0) /* (C25) MMC2_DAT1  */ /* WiFi_SDIO_DATA1 */
 			AM62X_IOPAD(0x10c, PIN_INPUT, 0) /* (E23) MMC2_DAT2  */ /* WiFi_SDIO_DATA2 */
Signature · 1 line
2.53.0
author maintainer
#74 lore raw

PATCH 73/869 thermal: intel: powerclamp: Reject invalid window_size values

In reply to Greg Kroah-Hartman

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

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

From: Thorsten Blum <[email protected]>

[ Upstream commit 40989202104e498ff9adfb8c575d6cd159f13988 ]

window_size_set() sets ret to -EINVAL if new_window_size is outside the valid range, but then falls through and still updates window_size to the clamped value.

Return -EINVAL immediately and do not update window_size. Also drop the now-redundant clamp() call.

Fixes d6d71ee4a14a ("PM: Introduce Intel PowerClamp Driver")
Cc All applicable <[email protected]>
---
 drivers/thermal/intel/intel_powerclamp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/intel/intel_powerclamp.c +2 -1
index 9a4cec0009106..61665f945b4c0 100644
@@ -290,9 +290,10 @@ static int window_size_set(const char *arg, const struct kernel_param *kp)
 		pr_err("Out of recommended window size %lu, between 2-10\n",
 			new_window_size);
 		ret = -EINVAL;
+		goto exit_win;
 	}
 
-	window_size = clamp(new_window_size, 2ul, 10ul);
+	window_size = new_window_size;
 	smp_mb();
 
 exit_win:
Signature · 1 line
2.53.0
author maintainer
#75 lore raw

PATCH 74/869 thermal: intel: int340x: Fix temperature selection around 0 C

In reply to Greg Kroah-Hartman

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

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

From: Thorsten Blum <[email protected]>

[ Upstream commit e56e2b49c67d132728e52ce493079e83cc914657 ]

Since commit 7251b9e8a007 ("thermal/intel: Fix intel_tcc_get_temp() to support negative CPU temperature"), intel_tcc_get_temp() can report negative temperatures.

proc_thermal_get_zone_temp() still uses *temp as the current maximum and as an implicit "no reading yet" marker. However, this breaks when a CPU reports 0 C, because a subsequent negative reading can overwrite it.

Use bool temp_valid to track whether a valid temperature has been read. Initialize *temp with the first valid reading and only update it with warmer readings.

Fixes 7251b9e8a007 ("thermal/intel: Fix intel_tcc_get_temp() to support negative CPU temperature")
Cc 6.3+ <[email protected]> # 6.3+
---
 .../intel/int340x_thermal/processor_thermal_device.c   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +7 -3
index 48e7849d48160..dc9c82e8650e7 100644
@@ -178,17 +178,21 @@ static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone,
 {
 	int cpu;
 	int curr_temp, ret;
-
-	*temp = 0;
+	bool temp_valid = false;
 
 	for_each_online_cpu(cpu) {
 		ret = intel_tcc_get_temp(cpu, &curr_temp, false);
 		if (ret < 0)
 			return ret;
-		if (!*temp || curr_temp > *temp)
+		if (!temp_valid || curr_temp > *temp) {
 			*temp = curr_temp;
+			temp_valid = true;
+		}
 	}
 
+	if (!temp_valid)
+		return -ENODATA;
+
 	*temp *= 1000;
 
 	return 0;
Signature · 1 line
2.53.0
author maintainer
#76 lore raw

PATCH 75/869 isofs: fix Rock Ridge CE extent validation on multisession media

In reply to Greg Kroah-Hartman

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

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

From: Baolin Liu <[email protected]>

[ Upstream commit 43de050fa4a31f7e7a73cf8974dcf6037e161a39 ]

Commit a36d990f5913 ("isofs: validate Rock Ridge CE continuation extent against volume size") compares the CE extent directly with s_nzones. The extent is an absolute block number, while s_nzones is the number of blocks relative to the selected ISO session. The comparison is therefore wrong when a multisession disc starts at a non-zero block.

isofs_get_last_session() selects the last session on multisession media, and its volume descriptors describe a volume beginning at that session's LBA.
For example, a session beginning at LBA 45447 with 64 blocks can contain a valid CE at absolute LBA 45467. The existing check rejects that CE, so the ER continuation record is not read, Rock Ridge is disabled, and the mount falls back to Joliet names.

Save the selected session start in filesystem-block units and validate the CE extent against the half-open interval [session_start, session_end). Scale the session length to the same block units and retain a separate block-device limit. The lower bound is intentional: accepting arbitrary blocks before the selected session could make a CE read data from a previous session or another filesystem on the device.

Only apply the bounds check when cont_extent is non-zero. A zero extent is the in-memory sentinel indicating that no CE continuation was found, rather than a request to read block zero.

For a single-session image, session_start is zero and the effective volume boundary remains unchanged.

Build-tested with:

make CONFIG_RUST= CONFIG_RUST_DRIVERS= fs/isofs/

Fixes a36d990f5913 ("isofs: validate Rock Ridge CE continuation extent against volume size")
---
 fs/isofs/inode.c |  2 ++
 fs/isofs/isofs.h |  2 ++
 fs/isofs/rock.c  | 11 +++++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)
fs/isofs/inode.c +2 -0
index 3433fa14cd014..8a0da54f391d0 100644
@@ -821,6 +821,8 @@ static int isofs_fill_super(struct super_block *s, struct fs_context *fc)
 	if (!sb_set_blocksize(s, orig_zonesize))
 		goto out_freesbi;
 
+	sbi->s_session_start = (sector_t)vol_desc_start <<
+				(ISOFS_BLOCK_BITS - s->s_blocksize_bits);
 	sbi->s_nls_iocharset = NULL;
 
 #ifdef CONFIG_JOLIET
fs/isofs/isofs.h +2 -0
index 5065558375333..a36a634797435 100644
@@ -35,6 +35,8 @@ struct isofs_sb_info {
 	unsigned long s_firstdatazone;
 	unsigned long s_log_zone_size;
 	unsigned long s_max_size;
+	/* Session start in filesystem block units. */
+	sector_t s_session_start;
 	
 	int           s_rock_offset; /* offset of SUSP fields within SU area */
 	s32           s_sbsector;
fs/isofs/rock.c +9 -2
index 869b331eff4f6..a4a337301b6f9 100644
@@ -9,6 +9,7 @@
 
 #include <linux/slab.h>
 #include <linux/pagemap.h>
+#include <linux/blkdev.h>
 
 #include "isofs.h"
 #include "rock.h"
@@ -84,6 +85,10 @@ static void init_rock_state(struct rock_state *rs, struct inode *inode)
  */
 static int rock_continue(struct rock_state *rs)
 {
+	struct super_block *sb = rs->inode->i_sb;
+	struct isofs_sb_info *sbi = ISOFS_SB(sb);
+	sector_t session_end = sbi->s_session_start +
+		((sector_t)sbi->s_nzones << (ISOFS_BLOCK_BITS - sb->s_blocksize_bits));
 	int ret = 1;
 	int blocksize = 1 << rs->inode->i_blkbits;
 	const int min_de_size = offsetof(struct rock_ridge, u);
@@ -101,11 +106,13 @@ static int rock_continue(struct rock_state *rs)
 		goto out;
 	}
 
-	if ((unsigned)rs->cont_extent >= ISOFS_SB(rs->inode->i_sb)->s_nzones) {
+	if (rs->cont_extent &&
+	    (rs->cont_extent < sbi->s_session_start ||
+	     rs->cont_extent >= session_end)) {
 		printk(KERN_NOTICE "rock: corrupted directory entry. "
 			"extent=%u out of volume (nzones=%lu)\n",
 			(unsigned)rs->cont_extent,
-			ISOFS_SB(rs->inode->i_sb)->s_nzones);
+			sbi->s_nzones);
 		ret = -EIO;
 		goto out;
 	}
Signature · 1 line
2.53.0
author maintainer
#77 lore raw

PATCH 76/869 arm64: dts: mediatek: mt7986: correct timer frequency

In reply to Greg Kroah-Hartman

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

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

From: Andrea Pesaresi <[email protected]>

[ Upstream commit 1cf18e4b9815beaf0439c5b57b65b45151c82ad7 ]

The MT7986 architected timer runs at 12,986,200 Hz rather than 13 MHz. Firmware reports 13 MHz through CNTFRQ_EL0, causing the system clock to run slow by about 1062 ppm. This exceeds the kernel's 500 ppm NTP correction limit and leaves clock discipline saturated.

The corrected rate comes from MediaTek's downstream OpenWrt feed, where it is applied to both MT7986A and MT7986B. Since upstream mt7986b.dtsi includes mt7986a.dtsi, add it once to the common timer node so the architected timer driver uses the actual counter rate.

---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +1 -0
index 6786e5b590e85..df5f7d831d819 100644
@@ -653,6 +653,7 @@ cpu_trip_active_low: active-low {
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupt-parent = <&gic>;
+		clock-frequency = <12986200>;
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
Signature · 1 line
2.53.0
author maintainer
#78 lore raw

PATCH 77/869 media: cx231xx-audio: drain wq_trigger before audio fini

In reply to Greg Kroah-Hartman

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

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

From: Fan Wu <[email protected]>

[ Upstream commit a691c54986412e1fa87f036d2577d5a78a75e658 ]

audio_trigger() is deferred work (dev->wq_trigger) armed from snd_cx231xx_capture_trigger() on every PCM START/STOP; it dereferences dev->adev state and may free the URBs via cx231xx_isoc_audio_deinit(). cx231xx_audio_fini() tore down that state without draining wq_trigger, so work armed before or racing fini ran against freed state.

Use disable_work_sync() in fini to drain the work and prevent further queueing. Initialize the work, lock and stream_started counter at the top of cx231xx_audio_init(), before any fallible allocation, and clear the partially-built audio state on its error path, so fini is safe even if a later step fails.

This issue was found by an in-house static analysis tool.

Fixes 61b04cb24a12 ("[media] cx231xx-audio: fix some locking issues")
Cc [email protected] # v6.10+
Assisted-by Codex:gpt-5.6
---
 drivers/media/usb/cx231xx/cx231xx-audio.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/media/usb/cx231xx/cx231xx-audio.c +12 -3
index 9c71b32552df3..1179cb0334f4d 100644
@@ -576,12 +576,19 @@ static int cx231xx_audio_init(struct cx231xx *dev)
 	dev_dbg(dev->dev,
 		"probing for cx231xx non standard usbaudio\n");
 
+	/*
+	 * Extension init errors are ignored by the cx231xx core, so fini()
+	 * must be safe even if initialization fails part way through.
+	 */
+	spin_lock_init(&adev->slock);
+	INIT_WORK(&dev->wq_trigger, audio_trigger);
+	atomic_set(&dev->stream_started, 0);
+
 	err = snd_card_new(dev->dev, index[devnr], "Cx231xx Audio",
 			   THIS_MODULE, 0, &card);
 	if (err < 0)
 		return err;
 
-	spin_lock_init(&adev->slock);
 	err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm);
 	if (err < 0)
 		goto err_free_card;
@@ -596,8 +603,6 @@ static int cx231xx_audio_init(struct cx231xx *dev)
 	strscpy(card->shortname, "Cx231xx Audio", sizeof(card->shortname));
 	strscpy(card->longname, "Conexant cx231xx Audio", sizeof(card->longname));
 
-	INIT_WORK(&dev->wq_trigger, audio_trigger);
-
 	err = snd_card_register(card);
 	if (err < 0)
 		goto err_free_card;
@@ -651,8 +656,10 @@ static int cx231xx_audio_init(struct cx231xx *dev)
 
 err_free_pkt_size:
 	kfree(adev->alt_max_pkt_size);
+	adev->alt_max_pkt_size = NULL;
 err_free_card:
 	snd_card_free(card);
+	adev->sndcard = NULL;
 
 	return err;
 }
@@ -669,6 +676,8 @@ static int cx231xx_audio_fini(struct cx231xx *dev)
 		return 0;
 	}
 
+	disable_work_sync(&dev->wq_trigger);
+
 	if (dev->adev.sndcard) {
 		snd_card_free_when_closed(dev->adev.sndcard);
 		kfree(dev->adev.alt_max_pkt_size);
Signature · 1 line
2.53.0
author maintainer
#79 lore raw

PATCH 78/869 media: cx231xx: Fix cleanup path on failure

In reply to Greg Kroah-Hartman

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

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

From: Andi Shyti <[email protected]>

[ Upstream commit 6e30287eaf3e41b86dfb86df3b811526693d74b4 ]

If cx231xx_init_v4l2() fails the probe currently jumps to err_init, which only unregisters the V4L2 device. The analog devices and I2C resources are left registered while the driver state can be released.

A subsequent driver bind attempts to create the same I2C mux channel links and triggers a warning when the existing "channel-0" link is encountered. The remaining devices may also access released driver state. This produces the following warning

    can't create symlink to channel 0
    WARNING: drivers/i2c/i2c-mux.c:403 at i2c_mux_add_adapter+0xcd8/0xeb0
    Call Trace:
     i2c_mux_add_adapter+0xcdc/0xeb0
     cx231xx_dev_init+0x2fb/0x1260
     cx231xx_usb_probe+0xc48/0x2140
     usb_probe_interface+0x657/0xc70
     ...

Jump to err_video_alt instead, which performs the full device cleanup before unregistering the V4L2 device.

---
 drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/cx231xx/cx231xx-cards.c +1 -1
index d96b9ab276b76..1824e36e541f8 100644
@@ -1828,7 +1828,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
 
 	retval = cx231xx_init_v4l2(dev, udev, interface, isoc_pipe);
 	if (retval)
-		goto err_init;
+		goto err_video_alt;
 
 	if (dev->current_pcb_config.ts1_source != 0xff) {
 		/* compute alternate max packet sizes for TS1 */
Signature · 1 line
2.53.0
author maintainer
#80 lore raw

PATCH 79/869 firewire: core: fix source bus ID detection for AT context in big-endian systems

In reply to Greg Kroah-Hartman

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

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

From: Takashi Sakamoto <[email protected]>

[ Upstream commit 6393d75914a6ac95a05621db8d9d6a98eafe72f7 ]

The source bus ID bit in AT DMA context is not detected correctly on big-endian systems because the little-endian data is not converted to CPU endianness.

Fix the bug. The helper functions related to this are never used in driver code, so extend the test to check the field instead.

Fixes 8db9d1557122 ("firewire: ohci: add static inline functions to serialize/deserialize data of AT DMA")
---
 drivers/firewire/ohci-serdes-test.c | 4 ++--
 drivers/firewire/ohci.h             | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/firewire/ohci-serdes-test.c +2 -2
index 258f668619ef1..87b136e041de3 100644
@@ -43,7 +43,7 @@ static void test_self_id_receive_buffer_deserialization(struct kunit *test)
 static void test_at_data_serdes(struct kunit *test)
 {
 	static const __le32 expected[] = {
-		cpu_to_le32(0x00020e80),
+		cpu_to_le32(0x00820e80),
 		cpu_to_le32(0xffc2ffff),
 		cpu_to_le32(0xe0000000),
 	};
@@ -56,7 +56,7 @@ static void test_at_data_serdes(struct kunit *test)
 	unsigned int destination_id = ohci1394_at_data_get_destination_id(expected);
 	u64 destination_offset = ohci1394_at_data_get_destination_offset(expected);
 
-	KUNIT_EXPECT_FALSE(test, has_src_bus_id);
+	KUNIT_EXPECT_TRUE(test, has_src_bus_id);
 	KUNIT_EXPECT_EQ(test, 0x02, speed);
 	KUNIT_EXPECT_EQ(test, 0x03, tlabel);
 	KUNIT_EXPECT_EQ(test, 0x02, retry);
drivers/firewire/ohci.h +1 -1
index 218666cfe14a5..63ccf2f445045 100644
@@ -178,7 +178,7 @@
 
 static inline bool ohci1394_at_data_get_src_bus_id(const __le32 *data)
 {
-	return !!((data[0] & OHCI1394_AT_DATA_Q0_srcBusID_MASK) >> OHCI1394_AT_DATA_Q0_srcBusID_SHIFT);
+	return !!((le32_to_cpu(data[0]) & OHCI1394_AT_DATA_Q0_srcBusID_MASK) >> OHCI1394_AT_DATA_Q0_srcBusID_SHIFT);
 }
 
 static inline void ohci1394_at_data_set_src_bus_id(__le32 *data, bool src_bus_id)
Signature · 1 line
2.53.0
author maintainer
#81 lore raw

PATCH 80/869 media: au0828: Free URBs when starting DVB streaming fails

In reply to Greg Kroah-Hartman

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

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

From: Ruoyu Wang <[email protected]>

[ Upstream commit b8dd133d96a40012f4b67fd48d8ddd7306a3e024 ]

start_urb_transfer() stores each allocated URB in dev->urbs[], but sets urb_streaming only after all URBs have been submitted. If a later URB or transfer buffer allocation fails, earlier entries are left allocated. A submission failure calls stop_urb_transfer(), but that function returns immediately while urb_streaming is false, leaving both submitted and unsubmitted URBs behind.

Make stop_urb_transfer() release every populated slot regardless of the streaming flag and clear each slot after release. Route all start errors through this cleanup. usb_kill_urb() safely handles both submitted and unsubmitted URBs, while the existing preallocation check preserves the lifetime of shared transfer buffers.

This issue was found by a static analysis checker and confirmed by manual source review.

Fixes 265a6510629a ("V4L/DVB (7621): Add support for Hauppauge HVR950Q/HVR850/FusioHDTV7-USB")
---
 drivers/media/usb/au0828/au0828-dvb.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/media/usb/au0828/au0828-dvb.c +11 -8
index 51752a922a744..4dc6377466858 100644
@@ -163,9 +163,6 @@ static int stop_urb_transfer(struct au0828_dev *dev)
 
 	dprintk(2, "%s()\n", __func__);
 
-	if (!dev->urb_streaming)
-		return 0;
-
 	if (dev->bulk_timeout_running == 1) {
 		dev->bulk_timeout_running = 0;
 		timer_delete(&dev->bulk_timeout);
@@ -179,6 +176,7 @@ static int stop_urb_transfer(struct au0828_dev *dev)
 				kfree(dev->urbs[i]->transfer_buffer);
 
 			usb_free_urb(dev->urbs[i]);
+			dev->urbs[i] = NULL;
 		}
 	}
 
@@ -200,8 +198,10 @@ static int start_urb_transfer(struct au0828_dev *dev)
 	for (i = 0; i < URB_COUNT; i++) {
 
 		dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL);
-		if (!dev->urbs[i])
-			return -ENOMEM;
+		if (!dev->urbs[i]) {
+			ret = -ENOMEM;
+			goto err;
+		}
 
 		purb = dev->urbs[i];
 
@@ -217,7 +217,7 @@ static int start_urb_transfer(struct au0828_dev *dev)
 			ret = -ENOMEM;
 			pr_err("%s: failed big buffer allocation, err = %d\n",
 			       __func__, ret);
-			return ret;
+			goto err;
 		}
 
 		purb->status = -EINPROGRESS;
@@ -235,10 +235,9 @@ static int start_urb_transfer(struct au0828_dev *dev)
 	for (i = 0; i < URB_COUNT; i++) {
 		ret = usb_submit_urb(dev->urbs[i], GFP_ATOMIC);
 		if (ret != 0) {
-			stop_urb_transfer(dev);
 			pr_err("%s: failed urb submission, err = %d\n",
 			       __func__, ret);
-			return ret;
+			goto err;
 		}
 	}
 
@@ -249,6 +248,10 @@ static int start_urb_transfer(struct au0828_dev *dev)
 	dev->bulk_timeout_running = 1;
 
 	return 0;
+
+err:
+	stop_urb_transfer(dev);
+	return ret;
 }
 
 static void au0828_start_transport(struct au0828_dev *dev)
Signature · 1 line
2.53.0
author maintainer
#82 lore raw

PATCH 81/869 media: i2c: tc358743: add missing color-space strings

In reply to Greg Kroah-Hartman

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

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

From: Linkai Gong <[email protected]>

[ Upstream commit cb37e83f1bbdf0964ed0a9524ce45a0694f98205 ]

VI_STATUS3 S_V_COLOR is four bits, so the index after the shift is 0-15. input_color_space[] only has 14 entries. Add the two reserved values so log_status() cannot walk off the table.

Fixes d32d98642de6 ("[media] Driver for Toshiba TC358743 HDMI to CSI-2 bridge")
---
 drivers/media/i2c/tc358743.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/tc358743.c +2 -1
index a0ca19359c431..aefc442b5737c 100644
@@ -1373,7 +1373,8 @@ static int tc358743_log_status(struct v4l2_subdev *sd)
 	static const char * const input_color_space[] = {
 		"RGB", "YCbCr 601", "opRGB", "YCbCr 709", "NA (4)",
 		"xvYCC 601", "NA(6)", "xvYCC 709", "NA(8)", "sYCC601",
-		"NA(10)", "NA(11)", "NA(12)", "opYCC 601"};
+		"NA(10)", "NA(11)", "NA(12)", "opYCC 601", "NA(14)",
+		"NA(15)"};
 
 	v4l2_info(sd, "-----Chip status-----\n");
 	v4l2_info(sd, "Chip ID: 0x%02x\n",
Signature · 1 line
2.53.0
author maintainer
#83 lore raw

PATCH 82/869 media: go7007: bound EZ-USB I2C transfers to the usb_buf size

In reply to Greg Kroah-Hartman

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

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

From: Shengzhuo Wei <[email protected]>

[ Upstream commit 816c4628b23e8c3d925978433f4dd1a13620c01b ]

go7007_usb_i2c_master_xfer() copies msgs[i].len bytes into go->usb_buf, a 16-byte buffer embedded in struct go7007, without any length check. The adapter declares no transfer limits, so an SMBus block transfer issued through /dev/i2c-N can write up to 34 bytes into it and corrupt the struct fields that follow the buffer.

Bound the transfer size with i2c_adapter_quirks so the I2C core rejects oversized messages before they reach the driver.

Fixes 7955f03d18d1 ("[media] go7007: move out of staging into drivers/media/usb.")
Assisted-by GLM:5.3
---
 drivers/media/usb/go7007/go7007-usb.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/usb/go7007/go7007-usb.c +6 -0
index 334cdde81a5c8..bf3cf320b2c9c 100644
@@ -1029,10 +1029,16 @@ static const struct i2c_algorithm go7007_usb_algo = {
 	.functionality	= go7007_usb_functionality,
 };
 
+static const struct i2c_adapter_quirks go7007_usb_quirks = {
+	.max_write_len	= 12,
+	.max_read_len	= 15,
+};
+
 static struct i2c_adapter go7007_usb_adap_templ = {
 	.owner			= THIS_MODULE,
 	.name			= "WIS GO7007SB EZ-USB",
 	.algo			= &go7007_usb_algo,
+	.quirks			= &go7007_usb_quirks,
 };
 
 /********************* USB add/remove functions *********************/
Signature · 1 line
2.53.0
author maintainer
#84 lore raw

PATCH 83/869 media: saa7146: Initialize interrupt lock before requesting IRQ

In reply to Greg Kroah-Hartman

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

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

From: Runyu Xiao <[email protected]>

[ Upstream commit e07c75a6bc4adf1ed09ede31756261e2c6bdede5 ]

The saa7146 interrupt handler can call SAA7146_IER_DISABLE(), which serializes register access with dev->int_slock. request_irq() allows the shared handler to run before saa7146_init_one() reaches the current lock initialization block.

Initialize dev->int_slock before requesting the interrupt so every handler path sees an initialized lock.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by Codex:GPT-5
---
 drivers/media/common/saa7146/saa7146_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/common/saa7146/saa7146_core.c +2 -1
index 27c53eed8fe39..e908af0693d26 100644
@@ -340,6 +340,8 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
 		goto out;
 	}
 
+	spin_lock_init(&dev->int_slock);
+
 	/* create a nice device name */
 	sprintf(dev->name, "saa7146 (%d)", saa7146_num);
 
@@ -425,7 +427,6 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
 	dev->ext = ext;
 
 	mutex_init(&dev->v4l2_lock);
-	spin_lock_init(&dev->int_slock);
 	spin_lock_init(&dev->slock);
 
 	mutex_init(&dev->i2c_lock);
Signature · 1 line
2.53.0
author maintainer
#85 lore raw

PATCH 84/869 media: vim2m: keep transaction buffer count stable while streaming

In reply to Greg Kroah-Hartman

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

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

From: Younho Choi <[email protected]>

[ Upstream commit 50f5fed44d8e24081e8feed5154746fe193f11b8 ]

V4L2_CID_TRANS_NUM_BUFS controls how many buffer pairs a vim2m mem2mem job processes before the job is completed. The driver stores the value in ctx->translen and device_work() uses it later to decide whether the current transaction should continue.

Letting userspace change this control while streaming is active can make a queued job observe a different transaction length than the one it started with. That leaves the transaction state inconsistent with the buffers currently queued for the job.

Grab the transaction buffer count control while either queue is streaming, and release it only after both queues have stopped streaming. The V4L2 control framework then rejects changes with -EBUSY while the value is in use, while still allowing userspace to configure the value before streaming starts.

Keep the control handler alive until after v4l2_m2m_ctx_release(), since releasing the mem2mem context can call stop_streaming(), which now ungrabs the control.

Fixes 96d8eab5d0a1 ("V4L/DVB: [v5,2/2] v4l: Add a mem-to-mem videobuf framework test device")
---
 drivers/media/test-drivers/vim2m.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
drivers/media/test-drivers/vim2m.c +26 -3
index 86c32699111ad..5db440bf728e9 100644
@@ -205,6 +205,7 @@ struct vim2m_ctx {
 	struct vim2m_dev	*dev;
 
 	struct v4l2_ctrl_handler hdl;
+	struct v4l2_ctrl	*trans_num_bufs_ctrl;
 
 	/* Processed buffers in this transaction */
 	u8			num_processed;
@@ -1270,9 +1271,27 @@ static int vim2m_start_streaming(struct vb2_queue *q, unsigned int count)
 		ctx->aborting = 0;
 
 	q_data->sequence = 0;
+	v4l2_ctrl_grab(ctx->trans_num_bufs_ctrl, true);
+
 	return 0;
 }
 
+static bool vim2m_other_queue_is_streaming(struct vim2m_ctx *ctx,
+					   struct vb2_queue *q)
+{
+	struct vb2_queue *other_vq;
+
+	if (!ctx->fh.m2m_ctx)
+		return false;
+
+	if (V4L2_TYPE_IS_OUTPUT(q->type))
+		other_vq = v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx);
+	else
+		other_vq = v4l2_m2m_get_src_vq(ctx->fh.m2m_ctx);
+
+	return vb2_is_streaming(other_vq);
+}
+
 static void vim2m_stop_streaming(struct vb2_queue *q)
 {
 	struct vim2m_ctx *ctx = vb2_get_drv_priv(q);
@@ -1286,11 +1305,14 @@ static void vim2m_stop_streaming(struct vb2_queue *q)
 		else
 			vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
 		if (!vbuf)
-			return;
+			break;
 		v4l2_ctrl_request_complete(vbuf->vb2_buf.req_obj.req,
 					   &ctx->hdl);
 		v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
 	}
+
+	if (!vim2m_other_queue_is_streaming(ctx, q))
+		v4l2_ctrl_grab(ctx->trans_num_bufs_ctrl, false);
 }
 
 static void vim2m_buf_request_complete(struct vb2_buffer *vb)
@@ -1392,7 +1414,8 @@ static int vim2m_open(struct file *file)
 
 	vim2m_ctrl_trans_time_msec.def = default_transtime;
 	v4l2_ctrl_new_custom(hdl, &vim2m_ctrl_trans_time_msec, NULL);
-	v4l2_ctrl_new_custom(hdl, &vim2m_ctrl_trans_num_bufs, NULL);
+	ctx->trans_num_bufs_ctrl =
+		v4l2_ctrl_new_custom(hdl, &vim2m_ctrl_trans_num_bufs, NULL);
 	if (hdl->error) {
 		rc = hdl->error;
 		v4l2_ctrl_handler_free(hdl);
@@ -1447,10 +1470,10 @@ static int vim2m_release(struct file *file)
 
 	v4l2_fh_del(&ctx->fh, file);
 	v4l2_fh_exit(&ctx->fh);
-	v4l2_ctrl_handler_free(&ctx->hdl);
 	mutex_lock(&dev->dev_mutex);
 	v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
 	mutex_unlock(&dev->dev_mutex);
+	v4l2_ctrl_handler_free(&ctx->hdl);
 	kfree(ctx);
 
 	atomic_dec(&dev->num_inst);
Signature · 1 line
2.53.0
author maintainer
#86 lore raw

PATCH 85/869 media: vicodec: fix out-of-bounds write on under-rounded coded dimensions

In reply to Greg Kroah-Hartman

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

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

From: Junrui Luo <[email protected]>

[ Upstream commit 0183746ebca4c478027e2261b904f844f1443b19 ]

A capture format whose width or height is one more than a multiple of 16 makes the FWHT codec write one 8x8 block row, or column, past the end of the capture plane, and read the same block out of the reference frame for P-coded frames.

vic_round_dim() is documented to round a frame dimension up so that both the luma and the chroma plane end up a multiple of 8, but it only rounds the chroma plane:

	round_up((dim) / (div), 8) * (div)

For div == 2 the result is a multiple of 16 in every case but one: when dim % 16 == 1, dim / div is already a multiple of 8 and the macro returns dim - 1. encode_plane() and decode_plane() round the same dimension with round_up(dim, 8), which yields dim + 7 -- one block more than the coded dimension that sized the buffer.

On a KASAN-enabled kernel, a 641x360 YUYV P-frame triggers:

  BUG: KASAN: slab-out-of-bounds in add_deltas+0x450/0xcc0
  Read of size 1 at addr ffff888009070800 by task trigger_bin/70

  Call Trace:
   add_deltas+0x450/0xcc0
   decode_plane+0x1916/0x3390
   fwht_decode_frame+0x173/0x620
   v4l2_fwht_decode+0x751/0x1120
   device_run+0x6bb/0x1850

Round the dimension itself up to a multiple of 8 * div. The rounding changes only for div == 2 and dim % 16 == 1, and MAX_WIDTH and MAX_HEIGHT are both multiples of 16, so the rounded value still fits the advertised limits.

Fixes 3b15f68e19c2 ("media: vicodec: Add support for resolution change event.")
Assisted-by Claude:claude-opus-5
---
 drivers/media/test-drivers/vicodec/codec-fwht.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/test-drivers/vicodec/codec-fwht.h +1 -1
index 0eab24020e9e6..4b4d390310899 100644
@@ -61,7 +61,7 @@
  * both luma and chroma components resolutions are rounded up to
  * a multiple of 8
  */
-#define vic_round_dim(dim, div) (round_up((dim) / (div), 8) * (div))
+#define vic_round_dim(dim, div) round_up(dim, 8 * (div))
 
 struct fwht_cframe_hdr {
 	u32 magic1;
Signature · 1 line
2.53.0
author maintainer
#87 lore raw

PATCH 86/869 media: vicodec: make encoder CAPTURE dimensions read-only

In reply to Greg Kroah-Hartman

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

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

From: Junrui Luo <[email protected]>

[ Upstream commit 2532e9d2f8ccb330a9c924b1ee34c5629240d352 ]

Setting the encoder's compressed CAPTURE format to a smaller resolution than the raw OUTPUT format makes the encoder write past the end of the CAPTURE buffer.

For a stateful encoder the CAPTURE width and height are not client-settable; Documentation/userspace-api/media/v4l/dev-encoder.rst specifies them as "ignored (read-only)" on VIDIOC_S_FMT. vicodec only implements half of that: vidioc_s_fmt_vid_out() derives the CAPTURE coded size and sizeimage from the OUTPUT format, but S_FMT on the CAPTURE queue overwrites them. The encoder then takes its geometry from the OUTPUT queue alone, and v4l2_fwht_encode() gets no destination length.

Overwrite the requested width and height with the OUTPUT queue's coded dimensions in vidioc_try_fmt_vid_cap(), making them read-only as the interface requires.

Fixes efec9c815e5d ("media: vicodec: pass on enc output format to capture side")
Assisted-by Claude:claude-opus-5
---
 drivers/media/test-drivers/vicodec/vicodec-core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/media/test-drivers/vicodec/vicodec-core.c +10 -0
index 654da27b11406..cdc3af33b4bbe 100644
@@ -893,6 +893,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 				  struct v4l2_format *f)
 {
 	struct vicodec_ctx *ctx = file2ctx(file);
+	struct vicodec_q_data *q_data_out =
+		get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
 	struct v4l2_pix_format_mplane *pix_mp;
 	struct v4l2_pix_format *pix;
 
@@ -903,6 +905,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 		pix = &f->fmt.pix;
 		pix->pixelformat = ctx->is_enc ? V4L2_PIX_FMT_FWHT :
 				   find_fmt(f->fmt.pix.pixelformat)->id;
+		if (ctx->is_enc) {
+			pix->width = q_data_out->coded_width;
+			pix->height = q_data_out->coded_height;
+		}
 		pix->colorspace = ctx->state.colorspace;
 		pix->xfer_func = ctx->state.xfer_func;
 		pix->ycbcr_enc = ctx->state.ycbcr_enc;
@@ -914,6 +920,10 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 		pix_mp = &f->fmt.pix_mp;
 		pix_mp->pixelformat = ctx->is_enc ? V4L2_PIX_FMT_FWHT :
 				      find_fmt(pix_mp->pixelformat)->id;
+		if (ctx->is_enc) {
+			pix_mp->width = q_data_out->coded_width;
+			pix_mp->height = q_data_out->coded_height;
+		}
 		pix_mp->colorspace = ctx->state.colorspace;
 		pix_mp->xfer_func = ctx->state.xfer_func;
 		pix_mp->ycbcr_enc = ctx->state.ycbcr_enc;
Signature · 1 line
2.53.0
author maintainer
#88 lore raw

PATCH 87/869 media: vidtv: fix frontend reference leak on unbind

In reply to Greg Kroah-Hartman

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

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

From: Piyush Patle <[email protected]>

[ Upstream commit 6f412f9fe6a1f3ce9694757f50353bbec221d832 ]

dvb_register_frontend() keeps two references to the frontend. One is released by dvb_unregister_frontend(), and the other by dvb_frontend_detach(). vidtv only called dvb_unregister_frontend(), so the second reference was never released. As a result, __dvb_frontend_free() was never called, leaking the frontend private data and its struct dvb_device.

The detach call was removed by commit 63101b756893 ("media: vidtv: fix driver unbind/remove") because it caused an OOPS. The demod .release callback freed vidtv_demod_state, and the I2C remove callbacks then accessed the freed state.

That commit also removed those accesses from the I2C remove callbacks. Restore the detach call, but remove the demod .release callback. vidtv_demod_state is owned by the I2C client and is already freed by vidtv_demod_i2c_remove(), so the frontend detach path should not free it.

Tested with kmemleak and KASAN over 10 bind/unbind cycles. The reported frontend and dvb_device leaks were present before the fix and were gone after it, with no KASAN reports.

---
 drivers/media/test-drivers/vidtv/vidtv_bridge.c | 2 ++
 drivers/media/test-drivers/vidtv/vidtv_demod.c  | 9 ---------
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +2 -0
index 8a8e097d2ac96..d6b90290bd4dd 100644
@@ -474,6 +474,7 @@ static int vidtv_bridge_dvb_init(struct vidtv_dvb *dvb)
 fail_demod_probe:
 	for (i = i - 1; i >= 0; --i) {
 		dvb_unregister_frontend(dvb->fe[i]);
+		dvb_frontend_detach(dvb->fe[i]);
 fail_fe:
 		dvb_module_release(dvb->i2c_client_tuner[i]);
 fail_tuner_probe:
@@ -552,6 +553,7 @@ static void vidtv_bridge_remove(struct platform_device *pdev)
 
 	for (i = 0; i < NUM_FE; ++i) {
 		dvb_unregister_frontend(dvb->fe[i]);
+		dvb_frontend_detach(dvb->fe[i]);
 		dvb_module_release(dvb->i2c_client_tuner[i]);
 		dvb_module_release(dvb->i2c_client_demod[i]);
 	}
drivers/media/test-drivers/vidtv/vidtv_demod.c +0 -9
index 505f96fccbf30..36bfeb33476b2 100644
@@ -343,13 +343,6 @@ static int vidtv_diseqc_send_burst(struct dvb_frontend *fe,
 	return 0;
 }
 
-static void vidtv_demod_release(struct dvb_frontend *fe)
-{
-	struct vidtv_demod_state *state = fe->demodulator_priv;
-
-	kfree(state);
-}
-
 static const struct dvb_frontend_ops vidtv_demod_ops = {
 	.delsys = {
 		SYS_DVBT,
@@ -390,8 +383,6 @@ static const struct dvb_frontend_ops vidtv_demod_ops = {
 			FE_CAN_HIERARCHY_AUTO,
 	},
 
-	.release = vidtv_demod_release,
-
 	.set_frontend = vidtv_demod_set_frontend,
 	.get_frontend = vidtv_demod_get_frontend,
 
Signature · 1 line
2.53.0
author maintainer
#89 lore raw

PATCH 88/869 media: vidtv: fix uaf in vidtv_bridge_on_new_pkts_avail

In reply to Greg Kroah-Hartman

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

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

From: Jeffin Philip <[email protected]>

[ Upstream commit 2af02ccd048b77713695d7817cf645ca50bf349e ]

Attempting to unbind a dvbdevice that is in the process of feeding data causes a UAF as we free the underlying device without stopping the feed first. Fix this by stopping the stream first using vidtv_stop_streaming(). However, our codepath in the reproducer (mentioned in the below reply) does not decrement our users (dmxdev->dvr_dvbdev->users) to 1 after it has been incremented to 2 by our read() in the reproducer, that is only possible on .release. This can cause a task hang as dvb_dmxdev_release() uses wait_event() in the wait_queue unless we use a close(fd)(in the reproducer). Is this a problem? Please advise.

---
 drivers/media/test-drivers/vidtv/vidtv_bridge.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +2 -0
index d6b90290bd4dd..60310ece35302 100644
@@ -551,6 +551,8 @@ static void vidtv_bridge_remove(struct platform_device *pdev)
 
 	mutex_destroy(&dvb->feed_lock);
 
+	vidtv_stop_streaming(dvb);
+
 	for (i = 0; i < NUM_FE; ++i) {
 		dvb_unregister_frontend(dvb->fe[i]);
 		dvb_frontend_detach(dvb->fe[i]);
Signature · 1 line
2.53.0
author maintainer
#90 lore raw

PATCH 89/869 media: marvell-cam: fix unmet dependency for VIDEO_MMP_CAMERA

In reply to Greg Kroah-Hartman

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

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

From: Julian Braha <[email protected]>

[ Upstream commit 1179929b3abd4adb6ca7fae91d649c64a7293aca ]

VIDEO_MMP_CAMERA selects I2C_GPIO without ensuring
'GPIOLIB || COMPILE_TEST' is enabled, despite I2C_GPIO depending on it.

Let's add the same dependency to VIDEO_MMP_CAMERA.

This unmet dependency bug was found by kconfirm, a static analysis tool for Kconfig.

Fixes 67a8dbbc4e04 ("[media] marvell-cam: Basic working MMP camera driver")
---
 drivers/media/platform/marvell/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/marvell/Kconfig +1 -0
index d31f4730f2a38..ab58175e433c3 100644
@@ -22,6 +22,7 @@ config VIDEO_MMP_CAMERA
 	depends on V4L_PLATFORM_DRIVERS
 	depends on I2C && VIDEO_DEV
 	depends on ARCH_MMP || COMPILE_TEST
+	depends on GPIOLIB || COMPILE_TEST
 	depends on COMMON_CLK
 	select VIDEO_OV7670 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
 	select I2C_GPIO
Signature · 1 line
2.53.0
author maintainer
#91 lore raw

PATCH 90/869 staging: media: av7110: fix corrupted BER reporting in sp8870

In reply to Greg Kroah-Hartman

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

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

From: Punnay Sharma <[email protected]>

[ Upstream commit 5764f9bd7b7a72c6df49db6c8c00d4f9994a55ba ]

In sp8870_read_ber(), the 14-bit Bit Error Rate (BER) is assembled by reading two I2C registers: 0xC08 (lower 6 bits) and 0xC07 (upper 8 bits).

The current implementation masks the lower bits via tmp = ret & 0x3F; but subsequently overwrites tmp entirely when processing the upper bits using a direct assignment (tmp = ret << 6;). This logical error causes the lower 6 bits of the BER hardware metric to be silently discarded.

Fix this by using a bitwise OR (tmp |= ret << 6;) to correctly merge the MSB and LSB payloads before returning the metric to the DVB core.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/staging/media/av7110/sp8870.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/av7110/sp8870.c +1 -1
index 0c813860f5b20..96fd738777744 100644
@@ -401,7 +401,7 @@ static int sp8870_read_ber(struct dvb_frontend *fe, u32 *ber)
 	if (ret < 0)
 		return -EIO;
 
-	tmp = ret << 6;
+	tmp |= ret << 6;
 	if (tmp >= 0x3FFF0)
 		tmp = ~0;
 
Signature · 1 line
2.53.0
author maintainer
#92 lore raw

PATCH 91/869 staging: media: av7110: fix sp8870 initialization failure state

In reply to Greg Kroah-Hartman

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

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

From: Punnay Sharma <[email protected]>

[ Upstream commit 30684fa98394bc0eb4362282908612aab7d4dad9 ]

The SP8870 DVB frontend driver prematurely flags the device as initialized at the very beginning of the sp8870_init() routine, prior to requesting the firmware (dvb-fe-sp8870.fw) and executing the I2C upload sequence.

If request_firmware() times out or sp8870_firmware_upload() encounters an I2C bus error, the function aborts and returns -EIO. However, because state->initialised is already set to 1, all subsequent invocations of fe->ops.init() by the DVB core will immediately return 0 (success) without attempting to load the firmware again. This leaves the demodulator microcontroller halted and the frontend permanently dead until the module is forcibly reloaded.

Relocate the state->initialised = 1 assignment to the end of sp8870_init(), ensuring the flag is only set after the firmware is successfully uploaded and the system controller is actually restarted.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/staging/media/av7110/sp8870.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/av7110/sp8870.c +2 -1
index 96fd738777744..b5b49f1ef5e7b 100644
@@ -315,7 +315,6 @@ static int sp8870_init(struct dvb_frontend *fe)
 	sp8870_wake_up(state);
 	if (state->initialised)
 		return 0;
-	state->initialised = 1;
 
 	dprintk("initialising frontend...\n");
 
@@ -353,6 +352,8 @@ static int sp8870_init(struct dvb_frontend *fe)
 	sp8870_writereg(state, 0x0D00, 0x010);
 	sp8870_writereg(state, 0x0D01, 0x000);
 
+	state->initialised = 1;
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
author maintainer
#93 lore raw

PATCH 92/869 media: m2m-deinterlace: fix default capture field

In reply to Greg Kroah-Hartman

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

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

From: Xu Rao <[email protected]>

[ Upstream commit 4ee3ebede5d01efdcdd88c94f9df271d2eb237de ]

queue_init() initializes default formats for both the source and capture queues. It first sets the source field to V4L2_FIELD_SEQ_TB, but then stores the capture default, V4L2_FIELD_INTERLACED_TB, in the source queue again while initializing the capture queue.

This overwrites the valid source default and leaves the capture field at its zero-initialized value, V4L2_FIELD_ANY. vidioc_streamon() accepts only V4L2_FIELD_SEQ_TB or V4L2_FIELD_SEQ_BT on the source queue, and requires the capture queue to use a compatible interlaced or NONE field. Userspace that relies on the default formats can therefore get -EINVAL when starting streaming.

Initialize the capture field instead. The bug is usually hidden because mem2mem applications commonly call S_FMT on both queues before streaming; the TRY_FMT paths normalize the fields and S_FMT overwrites q_data[].field.

Fixes 8f0755c06b90 ("[media] media: Add mem2mem deinterlacing driver")
---
 drivers/media/platform/m2m-deinterlace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/m2m-deinterlace.c +1 -1
index e07e57d4206ba..83d6c54f015db 100644
@@ -829,7 +829,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	q_data[V4L2_M2M_DST].width = 640;
 	q_data[V4L2_M2M_DST].height = 480;
 	q_data[V4L2_M2M_DST].sizeimage = (640 * 480 * 3) / 2;
-	q_data[V4L2_M2M_SRC].field = V4L2_FIELD_INTERLACED_TB;
+	q_data[V4L2_M2M_DST].field = V4L2_FIELD_INTERLACED_TB;
 
 	return vb2_queue_init(dst_vq);
 }
Signature · 1 line
2.53.0
author maintainer
#94 lore raw

PATCH 93/869 ASoC: codecs: lpass-wsa-macro: use v2.5 Compander1 addresses on v2.5+

In reply to Greg Kroah-Hartman

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

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

From: Srinivas Kandagatla <[email protected]>

[ Upstream commit 233d36a96009682208cc4ca1139b9e5641a8bf09 ]

wsa_macro_set_spkr_mode() unconditionally writes CDC_WSA_COMPANDER1_CTL3 (0x5CC) and CDC_WSA_COMPANDER1_CTL7 (0x5DC). On v2.5+ silicon these registers moved to CDC_2_5_WSA_COMPANDER1_CTL3 (0x5EC) and CDC_2_5_WSA_COMPANDER1_CTL7 (0x5FC); the v2.1 addresses are dead on that hardware, so the update_bits() calls take a bus error:

wsa_macro 6c90000.codec: ASoC error (-5): at
snd_soc_component_update_bits() on 6c90000.codec for
register: [0x000005dc]

The flat regcache had been hiding the read side of this by returning the zero-initialised cache slot instead of doing a bus read, so the error only becomes visible once the cache reports the miss honestly and regmap falls back to a real bus read.

Select the correct address for Compander1 CTL3/CTL7 based on codec_version. The Compander0 and Boost registers used in the same function have the same address across versions, so they stay unchanged. Also collapse the two mode branches to a single sequence with mode-selected values, which is what the switch was doing anyway.

Fixes 727de4fbc546 ("ASoC: codecs: lpass-wsa-macro: Correct support for newer v2.5 version")
---
 sound/soc/codecs/lpass-wsa-macro.c | 42 ++++++++++++++++++------------
 1 file changed, 25 insertions(+), 17 deletions(-)
sound/soc/codecs/lpass-wsa-macro.c +25 -17
index 8350b02b575fb..f094225ba40a4 100644
@@ -1129,27 +1129,35 @@ static const struct regmap_config wsa_regmap_config = {
 int wsa_macro_set_spkr_mode(struct snd_soc_component *component, int mode)
 {
 	struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
+	unsigned int comp1_ctl3, comp1_ctl7;
+	u8 comp_val, boost_val;
 
 	wsa->spkr_mode = mode;
 
-	switch (mode) {
-	case WSA_MACRO_SPKR_MODE_1:
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER0_CTL3, 0x80, 0x00);
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER1_CTL3, 0x80, 0x00);
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER0_CTL7, 0x01, 0x00);
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER1_CTL7, 0x01, 0x00);
-		snd_soc_component_update_bits(component, CDC_WSA_BOOST0_BOOST_CTL, 0x7C, 0x44);
-		snd_soc_component_update_bits(component, CDC_WSA_BOOST1_BOOST_CTL, 0x7C, 0x44);
-		break;
-	default:
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER0_CTL3, 0x80, 0x80);
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER1_CTL3, 0x80, 0x80);
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER0_CTL7, 0x01, 0x01);
-		snd_soc_component_update_bits(component, CDC_WSA_COMPANDER1_CTL7, 0x01, 0x01);
-		snd_soc_component_update_bits(component, CDC_WSA_BOOST0_BOOST_CTL, 0x7C, 0x58);
-		snd_soc_component_update_bits(component, CDC_WSA_BOOST1_BOOST_CTL, 0x7C, 0x58);
-		break;
+	/* Compander1 CTL3/CTL7 moved on v2.5+ silicon. */
+	if (wsa->codec_version >= LPASS_CODEC_VERSION_2_5) {
+		comp1_ctl3 = CDC_2_5_WSA_COMPANDER1_CTL3;
+		comp1_ctl7 = CDC_2_5_WSA_COMPANDER1_CTL7;
+	} else {
+		comp1_ctl3 = CDC_WSA_COMPANDER1_CTL3;
+		comp1_ctl7 = CDC_WSA_COMPANDER1_CTL7;
 	}
+
+	if (mode == WSA_MACRO_SPKR_MODE_1) {
+		comp_val = 0x00;
+		boost_val = 0x44;
+	} else {
+		comp_val = 0x80;
+		boost_val = 0x58;
+	}
+
+	snd_soc_component_update_bits(component, CDC_WSA_COMPANDER0_CTL3, 0x80, comp_val);
+	snd_soc_component_update_bits(component, comp1_ctl3, 0x80, comp_val);
+	snd_soc_component_update_bits(component, CDC_WSA_COMPANDER0_CTL7, 0x01, comp_val ? 0x01 : 0x00);
+	snd_soc_component_update_bits(component, comp1_ctl7, 0x01, comp_val ? 0x01 : 0x00);
+	snd_soc_component_update_bits(component, CDC_WSA_BOOST0_BOOST_CTL, 0x7C, boost_val);
+	snd_soc_component_update_bits(component, CDC_WSA_BOOST1_BOOST_CTL, 0x7C, boost_val);
+
 	return 0;
 }
 EXPORT_SYMBOL(wsa_macro_set_spkr_mode);
Signature · 1 line
2.53.0
author maintainer
#95 lore raw

PATCH 94/869 perf powerpc-vpadtl: Fix off-by-one in auxtrace_info minimum size check

In reply to Greg Kroah-Hartman

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

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

From: Wang Yan <[email protected]>

[ Upstream commit d9c7e2ede92ce258a5d4a6cbc55f75acd379c97d ]

min_sz is set to sizeof(u64) * POWERPC_VPADTL_TYPE, but the code reads auxtrace_info->priv[POWERPC_VPADTL_TYPE], which needs at least POWERPC_VPADTL_TYPE + 1 elements. POWERPC_VPADTL_TYPE is the first enumerator of the priv index enum (0), so min_sz evaluates to 0 and the check validates only the perf_record_auxtrace_info header itself. A PERF_RECORD_AUXTRACE_INFO event carrying a zero-length priv array then passes the size check, and the subsequent priv[POWERPC_VPADTL_TYPE] read runs one u64 past the validated region.

This is the same off-by-one fixed for Intel PT by commit c4362d5e1a5e ("perf intel-pt: Fix off-by-one in auxtrace_info minimum size check") and for Intel BTS by commit b9fb8225951c ("perf intel-bts: Fix off-by-one in auxtrace_info minimum size check").

Use sizeof(u64) * (POWERPC_VPADTL_TYPE + 1) so the highest accessed priv index is covered by the minimum-size validation.

Fixes c4bbd4ec2e50a9ed ("perf powerpc: Process auxtrace events and display in 'perf report -D'")
Cc Athira Rajeev <[email protected]>
---
 tools/perf/util/powerpc-vpadtl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/powerpc-vpadtl.c +1 -1
index 55b9b6e070746..eacc845ebda26 100644
@@ -681,7 +681,7 @@ int powerpc_vpadtl_process_auxtrace_info(union perf_event *event,
 				  struct perf_session *session)
 {
 	struct perf_record_auxtrace_info *auxtrace_info = &event->auxtrace_info;
-	size_t min_sz = sizeof(u64) * POWERPC_VPADTL_TYPE;
+	size_t min_sz = sizeof(u64) * (POWERPC_VPADTL_TYPE + 1);
 	struct powerpc_vpadtl *vpa;
 	int err;
 
Signature · 1 line
2.53.0
author maintainer
#96 lore raw

PATCH 95/869 media: microchip-isc: fix awb_mutex and lock lifecycle

In reply to Greg Kroah-Hartman

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

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

From: Balakrishnan Sambath <[email protected]>

[ Upstream commit 5540b48c0702f6a1389db3d473d7fd0db930422a ]

isc->lock and awb_mutex were initialised in isc_async_complete() and destroyed in isc_async_unbind(), tying their lifetime to the subdev bind/unbind cycle instead of the device:

- isc_async_unbind() destroyed awb_mutex before cancel_work_sync(), which takes it;
- a failed .complete() left them initialised, and isc->lock was destroyed only on the .complete() error path, so the normal unbind path leaked it;
- a rebind runs .complete() again and reinitialises a live mutex.

Initialise both with devm_mutex_init() at probe so they live for the whole device lifetime and are freed at remove, and drop the init and destroy from the .complete()/.unbind() callbacks.

isc_async_complete_err then only returned ret, so drop the label and return directly at each error site.

Fixes 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming")
---
 .../media/platform/microchip/microchip-isc-base.c | 15 ++++-----------
 .../platform/microchip/microchip-sama5d2-isc.c    |  9 +++++++++
 .../platform/microchip/microchip-sama7g5-isc.c    |  9 +++++++++
 3 files changed, 22 insertions(+), 11 deletions(-)
drivers/media/platform/microchip/microchip-isc-base.c +4 -11
index 32bdeae04ad07..ca4f3b5f58aa9 100644
@@ -1703,7 +1703,6 @@ static void isc_async_unbind(struct v4l2_async_notifier *notifier,
 {
 	struct isc_device *isc = container_of(notifier->v4l2_dev,
 					      struct isc_device, v4l2_dev);
-	mutex_destroy(&isc->awb_mutex);
 	cancel_work_sync(&isc->awb_work);
 	video_unregister_device(&isc->video_dev);
 	v4l2_ctrl_handler_free(&isc->ctrls.handler);
@@ -1767,8 +1766,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
 
 	isc->current_subdev = container_of(notifier,
 					   struct isc_subdev_entity, notifier);
-	mutex_init(&isc->lock);
-	mutex_init(&isc->awb_mutex);
 
 	init_completion(&isc->comp);
 
@@ -1787,7 +1784,7 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
 	ret = vb2_queue_init(q);
 	if (ret < 0) {
 		dev_err(isc->dev, "vb2_queue_init() failed: %d\n", ret);
-		goto isc_async_complete_err;
+		return ret;
 	}
 
 	/* Init video dma queues */
@@ -1798,13 +1795,13 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
 	ret = isc_set_default_fmt(isc);
 	if (ret) {
 		dev_err(isc->dev, "Could not set default format\n");
-		goto isc_async_complete_err;
+		return ret;
 	}
 
 	ret = isc_ctrl_init(isc);
 	if (ret) {
 		dev_err(isc->dev, "Init isc ctrols failed: %d\n", ret);
-		goto isc_async_complete_err;
+		return ret;
 	}
 
 	/* Register video device */
@@ -1824,7 +1821,7 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
 	ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
 	if (ret < 0) {
 		dev_err(isc->dev, "video_register_device failed: %d\n", ret);
-		goto isc_async_complete_err;
+		return ret;
 	}
 
 	ret = isc_scaler_link(isc);
@@ -1839,10 +1836,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
 
 isc_async_complete_unregister_device:
 	video_unregister_device(vdev);
-
-isc_async_complete_err:
-	mutex_destroy(&isc->awb_mutex);
-	mutex_destroy(&isc->lock);
 	return ret;
 }
 
drivers/media/platform/microchip/microchip-sama5d2-isc.c +9 -0
index 88e6d8e1c6c9c..18e1ec0b94fa6 100644
@@ -30,6 +30,7 @@
 #include <linux/interrupt.h>
 #include <linux/math64.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/platform_device.h>
@@ -424,6 +425,14 @@ static int microchip_isc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, isc);
 	isc->dev = dev;
 
+	ret = devm_mutex_init(dev, &isc->lock);
+	if (ret)
+		return ret;
+
+	ret = devm_mutex_init(dev, &isc->awb_mutex);
+	if (ret)
+		return ret;
+
 	io_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(io_base))
 		return PTR_ERR(io_base);
drivers/media/platform/microchip/microchip-sama7g5-isc.c +9 -0
index 77c6c183451bf..07cfe1109ff09 100644
@@ -33,6 +33,7 @@
 #include <linux/interrupt.h>
 #include <linux/math64.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
 #include <linux/platform_device.h>
@@ -413,6 +414,14 @@ static int microchip_xisc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, isc);
 	isc->dev = dev;
 
+	ret = devm_mutex_init(dev, &isc->lock);
+	if (ret)
+		return ret;
+
+	ret = devm_mutex_init(dev, &isc->awb_mutex);
+	if (ret)
+		return ret;
+
 	io_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(io_base))
 		return PTR_ERR(io_base);
Signature · 1 line
2.53.0
author maintainer
#97 lore raw

PATCH 96/869 media: microchip-isc: synchronize the IRQ before disabling clocks on stop

In reply to Greg Kroah-Hartman

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

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

From: Balakrishnan Sambath <[email protected]>

[ Upstream commit 19fa5407da5ef3e605cacfcd90f70d8b2c121cd7 ]

isc_stop_streaming() masks the DMA interrupt and then drops the runtime PM reference, which disables the ISC clocks. microchip_isc_interrupt() may still be executing on another CPU at that point; it reads ISC_INTSR over regmap, and touching the unclocked registers triggers an external abort.

Store the IRQ number at probe and call synchronize_irq() after masking the interrupt, before dropping the PM reference.

Fixes 106267444f12 ("[media] atmel-isc: add the Image Sensor Controller code")
---
 drivers/media/platform/microchip/microchip-isc-base.c    | 3 +++
 drivers/media/platform/microchip/microchip-isc.h         | 1 +
 drivers/media/platform/microchip/microchip-sama5d2-isc.c | 2 ++
 drivers/media/platform/microchip/microchip-sama7g5-isc.c | 2 ++
 4 files changed, 8 insertions(+)
drivers/media/platform/microchip/microchip-isc-base.c +3 -0
index ca4f3b5f58aa9..debbc38717de1 100644
@@ -425,6 +425,9 @@ static void isc_stop_streaming(struct vb2_queue *vq)
 	/* Disable DMA interrupt */
 	regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE);
 
+	/* let a running IRQ handler finish before the clock is disabled */
+	synchronize_irq(isc->irq);
+
 	pm_runtime_put_sync(isc->dev);
 
 	/* Disable stream on the sub device */
drivers/media/platform/microchip/microchip-isc.h +1 -0
index ad4e98a1dd8fc..f5e322c2e36bc 100644
@@ -287,6 +287,7 @@ struct isc_device {
 	u32			dcfg;
 
 	struct device		*dev;
+	int			irq;
 	struct v4l2_device	v4l2_dev;
 	struct video_device	video_dev;
 
drivers/media/platform/microchip/microchip-sama5d2-isc.c +2 -0
index 18e1ec0b94fa6..5bd109e93a8fb 100644
@@ -448,6 +448,8 @@ static int microchip_isc_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
+	isc->irq = irq;
+
 	ret = devm_request_irq(dev, irq, microchip_isc_interrupt, 0,
 			       "microchip-sama5d2-isc", isc);
 	if (ret < 0) {
drivers/media/platform/microchip/microchip-sama7g5-isc.c +2 -0
index 07cfe1109ff09..d978ce448a4d2 100644
@@ -437,6 +437,8 @@ static int microchip_xisc_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
+	isc->irq = irq;
+
 	ret = devm_request_irq(dev, irq, microchip_isc_interrupt, 0,
 			       "microchip-sama7g5-xisc", isc);
 	if (ret < 0) {
Signature · 1 line
2.53.0
author maintainer
#98 lore raw

PATCH 97/869 media: microchip-isc: disable histogram and flush AWB work on teardown

In reply to Greg Kroah-Hartman

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

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

From: Balakrishnan Sambath <[email protected]>

[ Upstream commit 00d87c379915a3689b2488bd37f490875d79e20f ]

isc_stop_streaming() and the isc_start_streaming() error path dropped the runtime PM reference with the histogram still enabled. A HISDONE firing just before the stop, or a failed isc_update_profile() on the start path, can queue isc_awb_work(), which reads the histogram registers before taking its own PM reference and faults on the unclocked device.

Disable the histogram, synchronize the IRQ and flush the work before the device is left unclocked. isc_configure() is the one enabling the histogram and then calling isc_update_profile(), so do the cleanup in its own failure path; isc_stop_streaming() does the same on teardown. synchronize_irq() must come before cancel_work_sync(), so an in-flight handler cannot re-queue awb_work after it is cancelled.

Fixes 93d4a26c3dab ("[media] atmel-isc: add the isc pipeline function")
---
 .../media/platform/microchip/microchip-isc-base.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/media/platform/microchip/microchip-isc-base.c +14 -1
index debbc38717de1..0f486dd5bd82c 100644
@@ -289,6 +289,7 @@ static int isc_configure(struct isc_device *isc)
 	struct regmap *regmap = isc->regmap;
 	u32 pfe_cfg0, dcfg, mask, pipeline;
 	struct isc_subdev_entity *subdev = isc->current_subdev;
+	int ret;
 
 	pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps;
 	pipeline = isc->config.bits_pipeline;
@@ -321,7 +322,15 @@ static int isc_configure(struct isc_device *isc)
 		isc_set_histogram(isc, false);
 
 	/* Update profile */
-	return isc_update_profile(isc);
+	ret = isc_update_profile(isc);
+	if (ret) {
+		/* flush the histogram work before the clocks are gated */
+		isc_set_histogram(isc, false);
+		synchronize_irq(isc->irq);
+		cancel_work_sync(&isc->awb_work);
+	}
+
+	return ret;
 }
 
 static int isc_prepare_streaming(struct vb2_queue *vq)
@@ -425,9 +434,13 @@ static void isc_stop_streaming(struct vb2_queue *vq)
 	/* Disable DMA interrupt */
 	regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE);
 
+	isc_set_histogram(isc, false);
+
 	/* let a running IRQ handler finish before the clock is disabled */
 	synchronize_irq(isc->irq);
 
+	cancel_work_sync(&isc->awb_work);
+
 	pm_runtime_put_sync(isc->dev);
 
 	/* Disable stream on the sub device */
Signature · 1 line
2.53.0
author maintainer
#99 lore raw

PATCH 98/869 media: microchip-isc: do not touch WB registers when not streaming

In reply to Greg Kroah-Hartman

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

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

From: Balakrishnan Sambath <[email protected]>

[ Upstream commit d8983c47d4d95eb1ed889dbb7516d3738fa854d8 ]

isc_s_awb_ctrl() called isc_update_awb_ctrls() unconditionally, writing the white balance registers even when the device is runtime suspended; on many ARM platforms accessing the unclocked registers is an external abort. The write was also done without awb_lock, racing isc_awb_work(), which holds it so the DMA done IRQ cannot latch a half-updated pipeline.

Write the registers only while streaming and not stopping, under awb_lock, and update the profile there. The isc->stop check covers the window where isc_stop_streaming() has gated the clocks but vb2 still reports streaming. Otherwise the new values stay cached and isc_configure() programs them at the next stream start.

Fixes 4e52889f48fe ("media: atmel: atmel-isc-base: expose white balance as v4l2 controls")
---
 .../platform/microchip/microchip-isc-base.c   | 20 +++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/media/platform/microchip/microchip-isc-base.c +12 -8
index 0f486dd5bd82c..cf4611443fd13 100644
@@ -1511,20 +1511,24 @@ static int isc_s_awb_ctrl(struct v4l2_ctrl *ctrl)
 		if (ctrl->cluster[ISC_CTRL_GB_OFF]->is_new)
 			ctrls->offset[ISC_HIS_CFG_MODE_GB] = isc->gb_off_ctrl->val;
 
-		isc_update_awb_ctrls(isc);
-
 		mutex_lock(&isc->awb_mutex);
-		if (vb2_is_streaming(&isc->vb2_vidq)) {
+		if (vb2_is_streaming(&isc->vb2_vidq) && !isc->stop) {
+			unsigned long flags;
+
 			/*
-			 * If we are streaming, we can update profile to
-			 * have the new settings in place.
+			 * awb_lock keeps the DMA done IRQ from latching a
+			 * partially written WB pipeline.
 			 */
+			spin_lock_irqsave(&isc->awb_lock, flags);
+			isc_update_awb_ctrls(isc);
+			spin_unlock_irqrestore(&isc->awb_lock, flags);
+
 			isc_update_profile(isc);
 		} else {
 			/*
-			 * The auto cluster will activate automatically this
-			 * control. This has to be deactivated when not
-			 * streaming.
+			 * Not streaming: keep the cached values for the next
+			 * stream start and deactivate the cluster-activated
+			 * do_white_balance button.
 			 */
 			v4l2_ctrl_activate(isc->do_wb_ctrl, false);
 		}
Signature · 1 line
2.53.0
author maintainer
#100 lore raw

PATCH 99/869 media: microchip-isc: fix PM runtime leak in AWB work handler

In reply to Greg Kroah-Hartman

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

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

From: Balakrishnan Sambath <[email protected]>

[ Upstream commit 21ad8225822a892c4c273bf1368d477a83a19dbb ]

Early return when streaming stops skips pm_runtime_put_sync(), leaking the reference and preventing runtime suspend.

Fixes 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming")
---
 drivers/media/platform/microchip/microchip-isc-base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/microchip/microchip-isc-base.c +2 -1
index cf4611443fd13..21d108eb93c7b 100644
@@ -1432,7 +1432,7 @@ static void isc_awb_work(struct work_struct *w)
 	/* streaming is not active anymore */
 	if (isc->stop) {
 		mutex_unlock(&isc->awb_mutex);
-		return;
+		goto out_pm_put;
 	}
 
 	isc_update_profile(isc);
@@ -1443,6 +1443,7 @@ static void isc_awb_work(struct work_struct *w)
 	if (ctrls->awb)
 		regmap_write(regmap, ISC_CTRLEN, ISC_CTRL_HISREQ);
 
+out_pm_put:
 	pm_runtime_put_sync(isc->dev);
 }
 
Signature · 1 line
2.53.0
author maintainer
#101 lore raw

PATCH 100/869 media: microchip-isc: dont sleep in the clk .is_enabled callback

In reply to Greg Kroah-Hartman

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

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

From: Balakrishnan Sambath <[email protected]>

[ Upstream commit 61490ff518c7b3ea3ff1cd16bbc012e9e4f1ab74 ]

isc_clk_is_enabled() calls pm_runtime_resume_and_get() and pm_runtime_put_sync(), which can sleep and are not safe here, as .is_enabled must run in atomic context. clk_disable_unused() calls it so at boot, and CONFIG_DEBUG_ATOMIC_SLEEP reports a "sleeping function called from invalid context" BUG.

Use the atomic-safe pm_runtime_get_if_active() and pm_runtime_put() instead. A suspended ISC has its clocks gated, so report the clock disabled when the device is not already active.

Fixes 01192aa1c5c2 ("media: atmel-isc: Enable the clocks during probe")
---
 drivers/media/platform/microchip/microchip-isc-clk.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/media/platform/microchip/microchip-isc-clk.c +3 -4
index 24358d804e75d..66dc522a61908 100644
@@ -98,15 +98,14 @@ static int isc_clk_is_enabled(struct clk_hw *hw)
 {
 	struct isc_clk *isc_clk = to_isc_clk(hw);
 	u32 status;
-	int ret;
 
-	ret = pm_runtime_resume_and_get(isc_clk->dev);
-	if (ret < 0)
+	/* Runs in atomic context, so must not sleep to resume the ISC. */
+	if (pm_runtime_get_if_active(isc_clk->dev) <= 0)
 		return 0;
 
 	regmap_read(isc_clk->regmap, ISC_CLKSR, &status);
 
-	pm_runtime_put_sync(isc_clk->dev);
+	pm_runtime_put(isc_clk->dev);
 
 	return status & ISC_CLK(isc_clk->id) ? 1 : 0;
 }
Signature · 1 line
2.53.0
author maintainer
#102 lore raw

PATCH 101/869 media: stm32: csi: correct remote pad retrieval

In reply to Greg Kroah-Hartman

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

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

From: Alain Volmat <[email protected]>

[ Upstream commit b83651d321d4fd07979a59f359dcb0266391f17a ]

The function media_entity_get_fwnode_pad is called in order to retrieve the remote pad, which is the source of the CSI. However this function is expecting the sensor endpoint fwnode and not sensor device fwnode as it is currently given. Correct this by properly relying on the notified matched fwnode data instead of the subdev entity fwnode.

Fixes dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver")
---
 drivers/media/platform/st/stm32/stm32-csi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/st/stm32/stm32-csi.c +1 -1
index fd2b6dfbd44c5..ecd0ed8e76b59 100644
@@ -825,7 +825,7 @@ static int stm32_csi_async_bound(struct v4l2_async_notifier *notifier,
 	int remote_pad;
 
 	remote_pad = media_entity_get_fwnode_pad(&s_subdev->entity,
-						 s_subdev->fwnode,
+						 asd->match.fwnode,
 						 MEDIA_PAD_FL_SOURCE);
 	if (remote_pad < 0) {
 		dev_err(csidev->dev, "Couldn't find output pad for subdev %s\n",
Signature · 1 line
2.53.0
author maintainer
#103 lore raw

PATCH 102/869 media: stm32: csi: unregister async notifier on cleanup

In reply to Greg Kroah-Hartman

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

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

From: Myeonghun Pak <[email protected]>

[ Upstream commit 4957d480a0c87cf3d024e6ff1f57d1222f9212cb ]

stm32_csi_parse_dt() registers the async notifier before probe finishes. If a later operation fails, the error path only cleans up the notifier's connections. It does not unregister the notifier, leaving its entry on the global notifier list after the devm-allocated csidev is freed.

The remove path has the same problem. A later async operation can then walk the stale notifier entry and access freed memory.

Unregister the notifier before cleaning up its resources on both paths.

Fixes dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver")
---
 drivers/media/platform/st/stm32/stm32-csi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/platform/st/stm32/stm32-csi.c +3 -0
index ecd0ed8e76b59..78c68cf90ffcb 100644
@@ -1059,6 +1059,7 @@ static int stm32_csi_probe(struct platform_device *pdev)
 	return 0;
 
 err_cleanup:
+	v4l2_async_nf_unregister(&csidev->notifier);
 	v4l2_async_nf_cleanup(&csidev->notifier);
 	return ret;
 }
@@ -1067,6 +1068,8 @@ static void stm32_csi_remove(struct platform_device *pdev)
 {
 	struct stm32_csi_dev *csidev = platform_get_drvdata(pdev);
 
+	v4l2_async_nf_unregister(&csidev->notifier);
+	v4l2_async_nf_cleanup(&csidev->notifier);
 	v4l2_async_unregister_subdev(&csidev->sd);
 
 	pm_runtime_disable(&pdev->dev);
Signature · 1 line
2.53.0
author maintainer
#104 lore raw

PATCH 103/869 mtd: rawnand: sunxi: reject ECC maximization on small pages

In reply to Greg Kroah-Hartman

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

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

From: James Hilliard <[email protected]>

[ Upstream commit a3c84084a73e170374b7dd493947efdef4ee57bc ]

When nand-ecc-maximize is set, the driver selects a 1024-byte ECC step and divides the available OOB bytes by the resulting number of steps. A NAND with a smaller page therefore produces zero steps and a division by zero.

The older controllers also provide a 512-byte ECC block mode, but the hardware documentation describes that as an ECC block size within NAND pages whose supported sizes start at 1024 bytes. It does not document a 512-byte NAND page mode.

Reject pages smaller than 1024 bytes before deriving the step count. This prevents the division by zero at the point where the incompatible maximized geometry is selected without changing explicitly configured 512-byte ECC block handling.

Fixes 4796d8655915 ("mtd: nand: sunxi: Support ECC maximization")
---
 drivers/mtd/nand/raw/sunxi_nand.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/nand/raw/sunxi_nand.c +3 -0
index 75db1713e6177..f9b72671c5253 100644
@@ -1631,6 +1631,9 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
 	if (nanddev->ecc.user_conf.flags & NAND_ECC_MAXIMIZE_STRENGTH) {
 		int bytes;
 
+		if (mtd->writesize < 1024)
+			return -EINVAL;
+
 		ecc->size = 1024;
 		nsectors = mtd->writesize / ecc->size;
 
Signature · 1 line
2.53.0
author maintainer
#105 lore raw

PATCH 104/869 media: adv7604: avoid negative array index in log_status when cp_read fails

In reply to Greg Kroah-Hartman

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

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

From: Greg Kroah-Hartman <[email protected]>

[ Upstream commit 10d8dfda1c08f6788049aa100685e223d857f901 ]

cp_read() returns the negative errno from regmap_read() on I2C failure. adv76xx_log_status() shifts the result right by 4 and uses it directly to index csc_coeff_sel_rb[16] causing the right shift of a negative number to result in -1, reading a negative place in the array.

Commit 8163419e3e05 ("media: adv7842: Avoid possible out-of-bounds array accesses in adv7842_cp_log_status()") fixed the identical pattern in the adv7842, so do the same thing here.

Fixes 54450f591c99 ("[media] adv7604: driver for the Analog Devices ADV7604 video decoder")
Assisted-by gregkh_clanker_t1000
---
 drivers/media/i2c/adv7604.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/i2c/adv7604.c +2 -1
index 516553fb17e98..cfecfff4c3aaa 100644
@@ -2641,8 +2641,9 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)
 					"(16-235)" : "(0-255)",
 				(reg_io_0x02 & 0x08) ? "enabled" : "disabled");
 	}
+	ret = cp_read(sd, info->cp_csc) >> 4;
 	v4l2_info(sd, "Color space conversion: %s\n",
-			csc_coeff_sel_rb[cp_read(sd, info->cp_csc) >> 4]);
+			ret < 0 ? "" : csc_coeff_sel_rb[ret]);
 
 	if (!is_digital_input(sd))
 		return 0;
Signature · 1 line
2.53.0
author maintainer
#106 lore raw

PATCH 105/869 media: stv090x: bound DiSEqC reply length to msg[] size

In reply to Greg Kroah-Hartman

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

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

From: Greg Kroah-Hartman <[email protected]>

[ Upstream commit bad6ce6e0856f344910ba95b006e6c0ebee2d9c8 ]

The FIFO_BYTENBR_FIELD register field is 4 bits wide, giving a length of 0..15, but reply->msg is __u8[4] in struct dvb_diseqc_slave_reply. A faulty or malicious DiSEqC slave (or i2c bus glitch) reporting more than 4 bytes will the array and clobber the stack.

The stb0899, tda10071, and s5h1420 drivers all properly bound the FIFO count against sizeof(reply->msg) before the read loop, so do the same thing in this driver.

Fixes e415c689a884 ("V4L/DVB (11579): Initial go at TT S2-1600")
Assisted-by gregkh_clanker_t1000
---
 drivers/media/dvb-frontends/stv090x.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/dvb-frontends/stv090x.c +2 -0
index f273efa330cfe..b95b6b4a69c73 100644
@@ -3902,6 +3902,8 @@ static int stv090x_recv_slave_reply(struct dvb_frontend *fe, struct dvb_diseqc_s
 
 	if (rx_end) {
 		reply->msg_len = STV090x_GETFIELD_Px(reg, FIFO_BYTENBR_FIELD);
+		if (reply->msg_len > sizeof(reply->msg))
+			reply->msg_len = sizeof(reply->msg);
 		for (i = 0; i < reply->msg_len; i++)
 			reply->msg[i] = STV090x_READ_DEMOD(state, DISRXDATA);
 	}
Signature · 1 line
2.53.0