* [PATCH 6.18 000/703] 6.18.67-rc1 review
@ 2026-12-04 9:58 Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 001/703] drm/gem-dma: Support dedicated DMA device for allocation and mapping Greg Kroah-Hartman
` (407 more replies)
0 siblings, 408 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, linux-kernel, torvalds, akpm, linux,
shuah, patches, lkft-triage, pavel, jonathanh, f.fainelli,
sudipm.mukherjee, rwarsow, conor, hargar, broonie, achill, sr
This is the start of the stable review cycle for the 6.18.67 release.
There are 703 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 Sun, 06 Dec 2026 10:04:59 +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.67-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 <gregkh@linuxfoundation.org>
Linux 6.18.67-rc1
Paulo Alcantara <pc@manguebit.org>
smb: client: don't spend read retries on reads cut short by a reconnect
Paulo Alcantara <pc@manguebit.org>
smb: client: don't give up writeback on the first replayable error
Paulo Alcantara <pc@manguebit.org>
smb: client: don't retry failed writes forever regardless of mount options
Paulo Alcantara <pc@manguebit.org>
smb: client: let umount -f abort retried reads and writes
Christopher Lusk <clusk@northecho.dev>
smb: client: set replay flag on the read send-error retry path
Marc Herrero <marcht@proton.me>
ASoC: qcom: audioreach: use a 32-bit container for S24_LE PCM
Marek Szyprowski <m.szyprowski@samsung.com>
dma-pool: release CMA pages on atomic_pool_expand() error path
Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
dma-pool: fix page leak in atomic_pool_expand() cleanup
Marek Szyprowski <m.szyprowski@samsung.com>
dma: swiotlb: Round restricted DMA pool size down to IO_TLB_SEGSIZE
Yao Yiqi <yaoyiqi3@huawei.com>
fbcon: Avoid cancel_delayed_work_sync() in atomic context
Leon Ming <leonming@meta.com>
fuse: set dentry epoch before making the dentry visible
Hanson Wang <hanson.wang@ugreen.com>
drm/i915/dsb: Realign GOSUB only for QW slots 6 and 7
Jouni Högander <jouni.hogander@intel.com>
drm/i915/psr: Clear CFF state on flip flush
Imre Deak <imre.deak@intel.com>
drm/i915/ptl+: Fix TypeC detection for eDP on port B
Imre Deak <imre.deak@intel.com>
drm/i915/tc: Add separate intel_tc_phy_port_to_tc() for TC DDI/PHY ports
Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
drm/sched: Ensure stopped entity cannot be re-added to the run-queue
Fei Yu <fei.yu@intel.com>
drm/syncobj: Limit the number of handles and use kvmalloc for user-sized arrays
Thomas Hellström <thomas.hellstrom@linux.intel.com>
drm/xe/dma-buf: Validate BOs on export to charge the exporter
Thomas Hellström <thomas.hellstrom@linux.intel.com>
drm/xe: Don't abort the shrinker walk on -EBUSY
Shuicheng Lin <shuicheng.lin@intel.com>
drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory
Tejas Upadhyay <tejas.upadhyay@intel.com>
drm/xe/xe3p_lpg: flush shrinker bo cachelines manually
Paul Menzel <pmenzel@molgen.mpg.de>
drm/amd/display: Don't warn about vendor infoframe for non-infoframe sinks
Davey Hughes <davidralphhughes@gmail.com>
drm/amd/display: Keep FreeSync flip timing across plane resets
Maíra Canal <mcanal@igalia.com>
drm/vc4: Look up the async page flip fence before committing the flip
Maíra Canal <mcanal@igalia.com>
drm/vc4: Rebuild the V3D interrupt mask on every power transition
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: validate backup buffer size in command buffer processing
Chen, Junjia <junjia.chen@intel.com>
drm/xe: Unwrap sync fences before adding them as job dependencies
Guenter Roeck <linux@roeck-us.net>
hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126
Liam R. Howlett (Google) <liam@infradead.org>
maple_tree: update internal warning and bug_on code
Aleksandr Loktionov <aleksandr.loktionov@intel.com>
i40e: avoid resetting BQL state when freeing temporary Tx rings in set_ringparam
Filip Balluch <fballuch@redhat.com>
i40e: fix freeing of TX rings on RX allocation failure
Günther Noack <gnoack3000@gmail.com>
landlock: Fix layer composition of LANDLOCK_ACCESS_FS_REFER
Axel Mierczuk <axel.mierczuk@1password.com>
ipvs: skip cport 0 connections in ip_vs_conn_out_get()
Zi Yan <ziy@nvidia.com>
mm/huge_memory: prevent losing PG_waiters in __split_folio_to_order()
Kuniyuki Iwashima <kuniyu@google.com>
mm/kasan: detect double-free involving kfree_rcu_sheaf()
Mike Rapoport (Microsoft) <rppt@kernel.org>
mm/vma: undo userfaultfd unmap preparation when unmapping fails
Amit Machhiwal <amachhiw@linux.ibm.com>
ring-buffer: Do not check si_mem_available() before deferred init completes
Marek Szyprowski <m.szyprowski@samsung.com>
riscv: mm: reserve the DTB before scanning reserved memory
Muchun Song <muchun.song@linux.dev>
riscv/mm: fix hotplug page-table destructor handling
Jisheng Zhang <jszhang@kernel.org>
riscv: convert pgtable_l4|l5_enabled to inline function
Mike Rapoport (Microsoft) <rppt@kernel.org>
userfaultfd: clear uffd state in child PTEs if uffd is released during fork
Umang Pokhriyal <umangpokhriyall@gmail.com>
userfaultfd: validate the whole range before changing write protection
Christian Schmidbauer <opensource@grische.xyz>
net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets
Guixin Liu <kanie@linux.alibaba.com>
nvmet: use GFP_KERNEL for PR allocations
Stanley Jhu <stanleyjhu@google.com>
scsi: ufs: sysfs: Propagate runtime PM resume errors
Can Guo <can.guo@oss.qualcomm.com>
scsi: ufs: core: Introduce function ufshcd_query_attr_qword()
ozgun kultekin <ozgunkultekin@gmail.com>
smb: client: do not let the server grow a write subrequest
Shyam Prasad N <sprasad@microsoft.com>
cifs: make retry logic in read/write path consistent with other paths
Siddharth Chintamaneni <sidchintamaneni@gmail.com>
smb: client: fix busy dentry and inode on unmount from late oplock break
Siddharth Chintamaneni <sidchintamaneni@gmail.com>
smb: client: fix busy dentry on unmount from persistent handle reopen
Ruben Wauters <ruben.wauters@linux.dev>
drm/gud: fix potential divide error due to optimisation
Adrian Ambrozewicz <aambrozewicz@nvidia.com>
gpiolib: free the label of lines released after their chip was removed
Adrian Ambrozewicz <aambrozewicz@nvidia.com>
gpiolib: wait for pending label frees before cleaning up desc_srcu
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpiolib: don't overwrite the entire flags field in gpiod_free_commit()
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpiolib: clear debounce period before the "requested" flag
Cooper Morgan <ext-github@cwooper.dev>
drm/amd/display: Saturate refresh rates in v1/v2 FreeSync infopackets
Luca Ceresoli <luca.ceresoli@bootlin.com>
drm/display: bridge-connector: attach the encoder to the created connector
Christoph Hellwig <hch@lst.de>
direct-io: remove IOCB_NOWAIT support
Martin Belanger <martin.belanger@dell.com>
nvme-tcp: consume TLS records without application data
Martin Belanger <martin.belanger@dell.com>
nvme-tcp: move the TLS record read loop into a helper
Martin Belanger <martin.belanger@dell.com>
nvme-tcp: use an aligned buffer for the TLS record type
Miguel Ojeda <ojeda@kernel.org>
x86/rust: use `-Zindirect-branch-cs-prefix` for RETPOLINE builds
Gyeyoung Baek <gye976@gmail.com>
accel/rocket: Fix drm_mm UAF on close vs in-flight job
Guangshuo Li <lgs201920130244@gmail.com>
accel/rocket: put IOMMU domain on BO creation failure
Hugo Sales <hugo@hsal.es>
drm/amd/display: Add the AUX backlight minimum once on the custom curve
Carlos Bilbao <carlos.bilbao@kernel.org>
scsi: target: iscsi: reject invalid size Extended CDB AHS
Shuai Liu <847807867@qq.com>
xfrm: interface: drop non-IP packets before pskb_inet_may_pull()
Zhao Gongyi <zhaogongyi@bytedance.com>
ext4: fix OOB memmove in ext4_xattr_set_entry
Guicai Ma <maguicai@kylinos.cn>
KEYS: Use kfree_sensitive() in keyctl_pkey_e_d_s()
Jarkko Sakkinen <jarkko@kernel.org>
KEYS: trusted: Update static calls before init
Sinan Turunc <enscrpt@pm.me>
KEYS: serialise key instantiation against keyctl_chown_key()
Guicai Ma <maguicai@kylinos.cn>
KEYS: Fix userspace buffer overflow in keyctl_pkey_e_d_s()
Henry Martin <bsdhenrymartin@gmail.com>
KEYS: Fix crash on big_key read
Jarkko Sakkinen <jarkko@kernel.org>
KEYS: Fix asym key overflow in keyctl_pkey_verify()
Abhiraj Dutta <abhirajdutta7@gmail.com>
ALSA: hda/realtek: Fix duplicate LEDs on HP Spectre x360 16-f2xxx
Abhiraj Dutta <abhirajdutta7@gmail.com>
ALSA: hda/realtek: Add quirk for HP Spectre x360 2-in-1 Laptop 16-f2xxx
Parmjot Singh <parmjotsinghrobot@gmail.com>
ALSA: hda/realtek: Enable mute LEDs on HP Envy x360 15-ew0xxx
Oleg Antonyan <oleg.b.antonyan@gmail.com>
ALSA: hda/realtek: Fix headset mic on ASUS Zenbook S 13 UX5304MA
Akhil Arul <akhilarul324@gmail.com>
ALSA: hda/tas2781-spi: Set tas_hda->dev in probe
Takashi Iwai <tiwai@suse.de>
ALSA: oss: Fix deadlock at unregistering (again)
Suyuan Wang <stevewong@hust.edu.cn>
ALSA: fireworks: Abort the transaction on a bus reset
Suyuan Wang <stevewong@hust.edu.cn>
ALSA: firewire-lib: Abort the FCP transaction on a bus reset
Vasileios Almpanis <vasilisalmpanis@gmail.com>
usb: gadget: f_uac1_legacy: fix double close of the ALSA devices
Dave Airlie <airlied@redhat.com>
i915/vma: use kfree_rcu to make sure vma are freed after a rcu grace period
Michael S. Tsirkin <mst@redhat.com>
vhost: reject used ring batches larger than the ring
Michael S. Tsirkin <mst@redhat.com>
Revert "vhost: split out-of-order used ring batches at every wrap"
Aamir Ahmed <elb12345@hotmail.co.uk>
vhost: Run TIF_NOTIFY_RESUME work in the vhost_task loop
Xu Rao <raoxu@uniontech.com>
vhost/net: Fix receive queue test in busy poll
Brajesh Gupta <brajesh.gupta@imgtec.com>
drm/imagination: Set scheduler timeout period higher than Firmware timeout
Andrea Righi <arighi@nvidia.com>
sched_ext: Enable tick for finite slices on nohz_full
Po-Hao Huang <phhuang@realtek.com>
wifi: rtw89: modify active scan rule for 6GHz band
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
ASoC: SOF: Intel: lnl: Enable offload for UAOL link
Kuniyuki Iwashima <kuniyu@google.com>
ipv6: Flush exception route while replacing nexthop.
Kuniyuki Iwashima <kuniyu@google.com>
ipv6: Remove FIB6_EXCEPTION_BUCKET_FLUSHED.
David Hildenbrand (Arm) <david@kernel.org>
mm/gup: limit pagecache folio refcount when grabbing references
David Hildenbrand (Arm) <david@kernel.org>
mm/mmu_gather: flush pending references early before the folio limit
David Hildenbrand (Arm) <david@kernel.org>
mm: limit pagecache folio refcount when splicing into pipes
David Hildenbrand (Arm) <david@kernel.org>
mm: limit pagecache folio refcount when mapping pages
Zhan Xusheng <zhanxusheng1024@gmail.com>
vdso/math64: Use OPTIMIZER_HIDE_VAR() in __iter_div_u64_rem()
Chris Mason <mason@kernel.org>
futex: Fix private hash use-after-free on resize
Bernard Pidoux <bernard.f6bvp@gmail.com>
rose: say when we are busy, and leave the busy state on read
Bernard Pidoux <bernard.f6bvp@gmail.com>
rose: acknowledge delivered data before resetting a call
Bernard Pidoux <bernard.f6bvp@gmail.com>
ax25: leave the busy state when the application reads
Bernard Pidoux <bernard.f6bvp@gmail.com>
mkiss: leave the escaped state on any byte after FESC
Bernard Pidoux <bernard.f6bvp@gmail.com>
netrom: leave the busy state when the application reads
Bernard Pidoux <bernard.f6bvp@gmail.com>
netrom: bound the resequencing queue while we are busy
Bernard Pidoux <bernard.f6bvp@gmail.com>
netrom: clear the choke flag on frames sent again
Samuel Holland <samuel@sholland.org>
Revert "drm/rockchip: dw_hdmi_qp: remove now-redundant call to drm_connector_attach_encoder()"
Vincent Donnefort <vdonnefort@google.com>
tracing: Take trace_access_lock() in tracing_buffers_ioctl()
David Carlier <devnexen@gmail.com>
tracing: Ignore .function on the function trace event
David Carlier <devnexen@gmail.com>
tracing: Drop the synthetic event ref when clearing hist triggers
Steven Rostedt <rostedt@goodmis.org>
tracing: Do not allow user events to add a system name
Jaewon Jung <jaewon8868@gmail.com>
tracing: Avoid undefined shifts for zero histogram map size
Kyle Zeng <kylebot@openai.com>
tracing/filters: Treat zero-length dynamic strings as empty
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/filters: Handle out-of-range CPU for OP_NE in cpumask comparison
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/filters: Fix MATCH_END_ONLY regex matching for fixed-size strings
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/filters: Fix false success return in process_system_preds()
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/filters: Check for missing operand after operator in parse_pred()
David Carlier <devnexen@gmail.com>
tracing/user_events: Don't free an event that a dynamic event still references
Chaosheng Qu <chaosheng.qu.linux@gmail.com>
tracing/osnoise: Don't start a kthread in timerlat user-space mode
koraynilay <koray.fra@gmail.com>
smb: client: fix times assignments in cifs_posix_to_fattr()
koraynilay <koray.fra@gmail.com>
smb: client: fix negative timestamps being read from smb
Suyuan Wang <stevewong@hust.edu.cn>
smb: client: fail SMB2 responses with a bad signature
Fredric Cover <fredric.cover.lkernel@gmail.com>
smb: client: convert path_consumed to mount charset units
Stanley Jhu <stanleyjhu@google.com>
scsi: ufs: core: Introduce ufshcd_rpm_resume_and_get() helper
Stanley Jhu <stanleyjhu@google.com>
scsi: ufs: bsg: Abort ufs_bsg_request() when runtime resume fails
Praneeth Balasubramanian <praneeth@ucsb.edu>
scsi: target: iscsi: Check for existing sessions only after authentication
Shao Mingyin <shao.mingyin@zte.com.cn>
scsi: target: Fix NULL pointer dereference in target_dev_alua_lu_gp_store()
Shao Mingyin <shao.mingyin@zte.com.cn>
scsi: target: Fix NULL pointer dereference in core_alua_do_port_transition()
Ciro Iriarte <ciro.iriarte+software@gmail.com>
scsi: target: core: Parse APTPL res_type and res_scope as hex
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet: zns: return the namespace lookup error for Identify
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet: zero the entire Get Log Page transfer buffer
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet: use overflow-safe range checks in the file backend
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet: roll back queue bindings on connection failure
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet: handle short reads and writes in the file backend
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet-tcp: only wait for in-capsule data for inline SGLs
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet-fcloop: free the LS request when delivery fails
Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet-fc: reject duplicate queue IDs on Create Connection
Yaohan Li <shunsheng1218@gmail.com>
nvme: stop asynchronous event work before ANA teardown
Shao Mingyin <shao.mingyin@zte.com.cn>
nvme: reject invalid reconnect_delay sysfs values
Yingjie Wang <1075151112@qq.com>
nvme: avoid wrapping admin_timeout and io_timeout
Shao Mingyin <shao.mingyin@zte.com.cn>
nvme-tcp: require the R2T offset to match the data sent
Shao Mingyin <shao.mingyin@zte.com.cn>
nvme-loop: release the target request when SG setup fails
Shao Mingyin <shao.mingyin@zte.com.cn>
nvme-auth: use the parsed offset for the DH-CHAP key
Joas Antonio dos Santos <joasantonio108@gmail.com>
net: usb: smsc75xx: reject frames without a full header and FCS
Zxyan Zhu <zxyan0222@gmail.com>
net: stmmac: re-enable on-chip parity checkers for XGMAC ASP 0x2
Christian Schmidbauer <opensource@grische.xyz>
net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path
Christian Schmidbauer <opensource@grische.xyz>
net: stmmac: dwmac1000: don't discard frames with only a checksum error
Arun Iyengar <aiyengar1990@gmail.com>
net: stmmac: drop the rest of the frame when napi_build_skb() fails
Chris J Arges <carges@cloudflare.com>
net: prevent receive header offset overflow during decapsulation
Eric Dumazet <edumazet@kernel.org>
net: openvswitch: use skb_set_transport_header_careful() in parse_ipv6hdr()
Nathan Chancellor <nathan@kernel.org>
net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
Anthony Pighin <anthony.pighin@nokia.com>
net: gianfar: clear the pending Rx skb when freeing the Rx ring
Svyatoslav Nikolenko <nsvatoslav515@gmail.com>
net: e1000: fix warning in iounmap on probe failure
Daniel Wade <danjwade95@gmail.com>
net: bridge: fix skb leak of reinjected link-local frames
Daejun Park <daejun7.park@samsung.com>
xfs: wait for direct I/O before swapping extents
Rik van Riel <riel@surriel.com>
xfs: keep successful near rt allocations
Hengyu Liang <hengyul@cs.unc.edu>
xfs: fix f_bfree underflow in statfs()
Daejun Park <daejun7.park@samsung.com>
xfs: break layouts before swapping extents
Ding Feng <dingf3ng@gmail.com>
zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits()
Krystian Kaniewski <krystianmkaniewski@gmail.com>
xarray: fix index jumping backwards in xas_find()
Adrian Schlegel <me@adrianschlegel.com>
x86/mce: Do not treat cache hierarchy errors as memory errors
Richard Weinberger <richard@nod.at>
x86/Kconfig: Enable ROX also when STRICT_KERNEL_RWX is present
WeitaoWang-oc <WeitaoWang-oc@zhaoxin.com>
x86/apic/msi: Fix MSI interrupt affinity configuration
Antonio Borneo <antonio.borneo@foss.st.com>
watchdog: stm32_iwdg: set driver data before requesting interrupt
Antonio Borneo <antonio.borneo@foss.st.com>
watchdog: stm32_iwdg: serialize accesses to EWCR register
Zhao Feng <zhaofeng2@cmss.chinamobile.com>
watchdog: npcm: fix sleeping clock call in restart handler
Miklos Szeredi <mszeredi@redhat.com>
virtiofs: fix use-after-free of fs->tag on device removal
Michael S. Tsirkin <mst@redhat.com>
vhost: split out-of-order used ring batches at every wrap
Matt Turner <mattst88@gmail.com>
vgacon: Fall back to the dummy console if mapping VGA memory fails
Eric Dumazet <edumazet@kernel.org>
udp: use skb_set_transport_header_careful() in __udp6_lib_err_encap()
Juan Agustin Niccolini <juanagusnicco@gmail.com>
tcp: Fix the SO_REUSEPORT bind cache admitting a conflicting socket
Sebastian Reichel <sebastian.reichel@collabora.com>
spi: Fix runtime PM imbalance on pump transfer message error
Stephen Smalley <stephen.smalley.work@gmail.com>
selinux: check MAP_SHARED_VALIDATE mappings as shared
Günther Noack <gnoack3000@gmail.com>
selftests/landlock: Test that layering does not break refer
SJ Park <sj@kernel.org>
selftests/damon/sysfs_memcg_path_leak: define ksft_skip
Eric Dumazet <edumazet@kernel.org>
sctp: use skb_set_transport_header_careful() in sctp_v6_err()
Yves Bieri <yves.bieri@theori.io>
sctp: do not free a new asoc peeled off while sendmsg slept
Cen Zhang <zzzccc427@gmail.com>
ocfs2: serialize inode journal access with shutdown
Zhiyuan Zhang <zhiyuanzhang912@gmail.com>
ocfs2: fix kernel BUG in ocfs2_page_mkwrite() when write_end fails
Cen Zhang <zzzccc427@gmail.com>
ocfs2: advance locking_state through the live cursor
Cen Zhang <zzzccc427@gmail.com>
ocfs2/dlmfs: keep the superblock alive during lock work
Miguel Ojeda <ojeda@kernel.org>
objtool/rust: add more `noreturn` Rust functions for Rust 1.101.0
Karl Mehltretter <kmehltretter@gmail.com>
parisc: irq: Trace hardirq state in do_cpu_irq_mask()
Karl Mehltretter <kmehltretter@gmail.com>
parisc: Fix register corruption in 32-bit dynamic ftrace
Boyan Liu <yymhvert@gmail.com>
scsi: sd_zbc: Cap zone report count by buffer size
Shao Mingyin <shao.mingyin@zte.com.cn>
scsi: rdac: Keep the error status when controller lookup fails
Milan P. Gandhi <mgandhi@redhat.com>
scsi: mpi3mr: Validate reply frame size bounds
Jiale Yao <yaojiale02@163.com>
s390/dcssblk: Initialize device semaphore before sysfs registration
Gerald Schaefer <gerald.schaefer@linux.ibm.com>
s390/appldata: Fix error handling in appldata_generic_handler()
Peder Bergan <peder.bergan@gmail.com>
rust: str: tie Formatter to its backing buffer
Marwan Mohamed Zein <marawanzein222@gmail.com>
rust: iov: fix return lifetime of `copy_from_iter_raw()`
Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
riscv: unaligned: fix __setup handlers
Guobin Zhang <guobin.zhang@intel.com>
riscv: signal: protect regs->status RMW from concurrent preemption
Yunhui Cui <cuiyunhui@bytedance.com>
riscv: Fix SR_SUM leakage across context switches
Bradley Morgan <brads@mainlining.org>
powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller
Nathan Chancellor <nathan@kernel.org>
powerpc/xmon: Avoid unsequenced accesses to tsk in show_task()
Jiale Yao <yaojiale02@163.com>
powerpc/eeh: NUL-terminate force recovery input
Paul Moses <p@1g4.org>
perf record: Reject CPU indices equal to the mask size
Yehyeong Lee <yhlee@isslab.korea.ac.kr>
RDMA/srpt: widen the indirect RDMA context counters
Yehyeong Lee <yhlee@isslab.korea.ac.kr>
RDMA/srpt: reject zero-length buffer descriptors
Yehyeong Lee <yhlee@isslab.korea.ac.kr>
RDMA/srpt: bound the indirect descriptor table to the IU
Deep Shah <deepshah146@gmail.com>
RDMA/siw: Fix use-after-free in siw_mem_id2obj()
Jaeyeong Lee <lee@jaeyeong.cc>
RDMA/rtrs: Register client event handler after capability check
Moshe Shemesh <moshe@nvidia.com>
RDMA/mlx5: Skip vport context query on FW without ib_virt support
Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
RDMA/mlx5: Fix DevX umem page size truncation for pages >= 4G
Abhijit Gangurde <abhijit.gangurde@amd.com>
RDMA/ionic: Use a linear QID space when udma_shift is zero
Nathan Chancellor <nathan@kernel.org>
rcu/nocb: Avoid unsequenced accesses to jiffies in show_rcu_nocb_state()
Nathan Chancellor <nathan@kernel.org>
qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
Shrikanth Hegde <sshegde@linux.ibm.com>
PPC32: Fix hard_irq_disable to follow tracing and lockdep state
Muchun Song <muchun.song@linux.dev>
mm: fix missing page-table destructor in pagetable_free()
David Hildenbrand (Arm) <david@kernel.org>
mm/userfaultfd: fix PTE table overruns in UFFDIO_MOVE
David Hildenbrand (Arm) <david@kernel.org>
mm/rmap: fix PTE table overruns during batched unmap
Ridong Chen <chenridong@xiaomi.com>
mm/migrate: move NR_KERNEL_FILE_PAGES on cross-node migration
Ridong Chen <chenridong@xiaomi.com>
mm/migrate: move NR_FILE_THPS on cross-node migration
Andrew Morton <akpm@linux-foundation.org>
mm/mempolicy: use one node set for interleave weights
David Hildenbrand (Arm) <david@kernel.org>
mm/memfd: handle GUP pins more reliably when write-sealing
David Hildenbrand (Arm) <david@kernel.org>
mm/khugepaged: don't map folios that are not uptodate in MADV_COLLAPSE
Kuniyuki Iwashima <kuniyu@google.com>
mm/kasan/kunit: add double-free tests involving kfree_rcu_sheaf()
Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
mm/filemap: stop fault-around when the walk steps back
Wang Xiaolei <xiaoleiwangxiaolei@gmail.com>
mm/damon/tests/sysfs-kunit: fix leaked pid reference in add_targets test
Aveline Noir <jm5905938@gmail.com>
mm/damon/core: reset watermark wait state on each iteration
Mani Tofigh <mt4022@columbia.edu>
mm, swap: stop cluster list scans once swapoff clears SWP_WRITEOK
Gautam Menghani <gautam@linux.ibm.com>
KVM: PPC: Book3S HV: XICS: Update irq_type for cleanup to work
Gautam Menghani <gautam@linux.ibm.com>
KVM: PPC: Book3S HV: XICS: Avoid NULL ptr deref in kvmppc_xive_cleanup_vcpu()
Gautam Menghani <gautam@linux.ibm.com>
KVM: PPC: Book3S HV: Take SRCU read lock around kvmppc_h_page_init() call
Gautam Menghani <gautam@linux.ibm.com>
KVM: PPC: Book3S HV: Ensure that calls to idr_alloc are synchronized
Amit Machhiwal <amachhiw@linux.ibm.com>
KVM: PPC: Book3S HV: Disable preemption around host-side HPT lock users
Gautam Menghani <gautam@linux.ibm.com>
KVM: PPC: Book3S HV: Avoid spurious interrupts caused by LPCR_MER bit
Axel Mierczuk <axel.mierczuk@1password.com>
ipvs: validate cport in received sync records
Zihan Xi <zihanx@nebusec.ai>
ipvs: reject FTP control ports as data ports
Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
ipvs: ftp: skip conntrack templates in ip_vs_ftp_out
Eric Dumazet <edumazet@kernel.org>
ipv6: mcast: use skb_set_transport_header_careful() in ipv6_mc_check_exthdrs()
Eric Dumazet <edumazet@kernel.org>
ipv6: gro: limit the number of extension headers
Jaeyeong Lee <lee@jaeyeong.cc>
net/tls: serialize context removal in tls_device_down()
Nathan Chancellor <nathan@kernel.org>
mptcp: Avoid unsequenced accesses to jiffies in mptcp_reset_tout_timer()
Liam R. Howlett (Google) <liam@infradead.org>
maple_tree: fix rcu reader NULL dereference after the tree is emptied
Joas Antonio dos Santos <joasantonio108@gmail.com>
mac802154: llsec: reject secured frames with security level 0
Alice Ryhl <aliceryhl@google.com>
kbuild: rust: disable function merging unconditionally
Henry Martin <bsdhenrymartin@gmail.com>
ip6mr: prevent info-leak in ip6mr_cache_report()
David Hildenbrand (Arm) <david@kernel.org>
iommufd: fix cleanup when adding memfd folio pins fails
Juan Parrado <jparrado.1817@gmail.com>
Input: xpad.c - add support for Hyperkin Xenon, Hori Taiko Controller DX, and 8BitDo M30
Juan Parrado <jparrado.1817@gmail.com>
Input: xpad - add support to Hori Real Arcade Pro 4
Sergei Kuznetsov <kernel@phnx47.net>
Input: xpad - add GameSir G7 Pro support
Yuan Yao <yaoyuan0329os@gmail.com>
Input: trackpoint - add new TP JYT_NDT device variant id 7
Liu Chao <liuc63@xiaopeng.com>
Input: goodix - reject a bak_ref length that cannot hold the checksum
Ivan Verbovoy <ivanverbovoy@gmail.com>
Input: da7280 - do not advertise FF_GAIN
Wentao Liang <vulab@iscas.ac.cn>
Input: cyapa - fix runtime PM leak in cyapa_update_rt_suspend_scanrate()
Ziheng Wei <zihengw03@163.com>
hwmon: (w83792d) Fix incorrect struct cast in show_temp1() and store_temp1()
Ziheng Wei <zihengw03@163.com>
hwmon: (w83791d) Fix incorrect struct cast in show_temp1() and store_temp1()
Wayne Ho <wayneho219@gmail.com>
hwmon: (sht3x) Fix overflow when writing alert limits
Guenter Roeck <linux@roeck-us.net>
hwmon: (nct6775) Fix tolerance bitmask when reading REG_FAN_MODE
Guenter Roeck <linux@roeck-us.net>
hwmon: (nct6775) Fix swapped temperature tolerance register writes
Ziheng Wei <zihengw03@163.com>
hwmon: (nct6775) Fix incorrect struct cast in beep callbacks
Rosen Penev <rosenp@gmail.com>
hwmon: (dell-smm) Reject out-of-range pwm values
Rosen Penev <rosenp@gmail.com>
hwmon: (dell-smm) Reject a fan_max that the BIOS cannot take
Vítor Hugo Silva <vitorhg20080@gmail.com>
hwmon: (ads7871) Add error handle from spi_setup()
Guenter Roeck <linux@roeck-us.net>
hwmon: Use per-device lockdep keys
Xuanqiang Luo <luoxuanqiang@kylinos.cn>
iavf: fix QoS capabilities memory leak
Xuanqiang Luo <luoxuanqiang@kylinos.cn>
iavf: fix ASQ command buffer leak on init failure
Xuanqiang Luo <luoxuanqiang@kylinos.cn>
iavf: add missing PTP adjustment callbacks
Sung Byeongchan <tjdqudcks0424@naver.com>
ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR
Joas Antonio dos Santos <joasantonio108@gmail.com>
hugetlbfs: move hugetlbfs_free_inode tracepoint to ->destroy_inode()
Amaan Cheval <amaan.cheval@gmail.com>
gve: refuse XDP on queue formats without XDP support
Amaan Cheval <amaan.cheval@gmail.com>
gve: fix RX page refcount overflow from INT_MAX pagecnt_bias
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpiolib: don't overwrite the entire flags field in gpiod_get_direction()
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpiolib: keep the line state workqueue alive until device release
Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
gpio: virtio: compute the line names size in a size_t
Lianjie Wang <lian@is.s.u-tokyo.ac.jp>
gpio: virtio: bound the line names block by its configured size
David Thompson <davthompson@nvidia.com>
gpio: mlxbf2: Disable interrupts around the chip lock in direction ops
Alexandre Becholey <alex@becholey.ch>
gpio: ljca: Validate the pin index of interrupt events
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpio: cdev: don't overwrite the whole flags field when configuring lines
Junyoung Jang <graypanda.inzag@gmail.com>
fuse: skip dcache instantiation for readdirplus names with embedded NUL
Miklos Szeredi <mszeredi@redhat.com>
fuse: limit name size in listxattr
Miklos Szeredi <mszeredi@redhat.com>
fuse: fix possible UAF in fuse_direntplus_link()
Hungyu Lin <dennylin0707@gmail.com>
fuse: clear the old EOF tail before writeback-cache writes
Weiming Shi <bestswngs@gmail.com>
fbdev: vfb: Validate framebuffer geometry and memory size
Tim Douglas <me@timdoug.com>
fbdev: valkyriefb: keep the framebuffer mapping size fixed
Xue Haolin <xuehaolin@uniontech.com>
fbdev: sstfb: Error out if pixclock equals zero
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
fbdev: smscufx: keep the usb_device alive while ufx_data is in use
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
fbdev: smscufx: don't free registered framebuffer on probe error
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
fbdev: smscufx: allocate the size advertised in smem_len
Jianqiang Zou <jq.zou@outlook.com>
fbdev: radeonfb: reject a zero pixclock in radeonfb_check_var()
Tim Douglas <me@timdoug.com>
fbdev: macmodes: compare the pixel clock of each candidate mode
Steffen A. Mork <linux-dev@morknet.de>
fbdev: fm2fb: Fix iomem access
Eric Biggers <ebiggers@kernel.org>
fscrypt: Initialize ->ci_master_key before publication
Breno Leitao <leitao@debian.org>
fgraph: Do not mark index 0 in every shadow stack frame
Vineet Gupta <vineet.gupta@linux.dev>
fgraph: Allocate shadow stacks inline with GFP_NOWAIT
Sang-Heon Jeon <ekffu200098@gmail.com>
fault-inject: fix boot failure with fault injection boot parameters
Aristeu Rozanski <aris@redhat.com>
EDAC/i5000: Fix slot number passed to determine_mtr()
Marek Szyprowski <m.szyprowski@samsung.com>
dma: swiotlb: Serialize restricted DMA pool initialization
Marek Szyprowski <m.szyprowski@samsung.com>
dma: swiotlb: Properly tear down the default pool on exit
Marek Szyprowski <m.szyprowski@samsung.com>
dma-coherent: serialize reserved memory pool initialization
Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
cpufreq: Skip inactive policies in cpufreq_driver_target()
Sumit Gupta <sumitg@nvidia.com>
cpufreq: CPPC: Set CPPC Enable register in cpu_init()
Mickaël Salaün <mic@digikod.net>
capabilities: Check PR_SET_SECUREBITS with ns_capable()
Jiri Olsa <jolsa@kernel.org>
bpf: Restrict uprobe ctx writes to the registers ptrace can set
Xu Rao <raoxu@uniontech.com>
Bluetooth: MGMT: Fix runtime config status opcode
Joas Antonio dos Santos <joasantonio108@gmail.com>
Bluetooth: hci_qca: clear qca_memdump when discarding dump packets
Alex Kazinsky <a.kazinsky@ideco.ru>
blk-iocost: Fix overflow in donation weight calculation
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT
Justinien Bouron <jbouron@amazon.com>
ata: libata-core: Add max sector quirk to INTEL SSDSCKKB240G8
Chen Yuxi <chenyuxi19@huawei.com>
ASoC: wm8962: Fix broken headset button caused by wrong guard constant
yzddMr6 <yzddmr6@gmail.com>
ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks
Julius Bairaktaris <julius@bairaktaris.de>
ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer
Julius Bairaktaris <julius@bairaktaris.de>
ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer
Marc Herrero <marcht@proton.me>
ASoC: qcom: audioreach: only disconnect the route a mixer control owns
Nicholas E. Andrade <sdnick484@gmail.com>
ASoC: amd: acp: fix PDM ring buffer address on ACP7.x resume
Ben Cressey <ben@cressey.dev>
arm64: kexec: use a typed entry to fix kCFI oops
Ryan Roberts <ryan.roberts@arm.com>
arm64: cpufeature: Remove Neoverse-V3/AE from the BBML3 allow list
Muchun Song <muchun.song@linux.dev>
arm64/mm: fix destructor for unconstructed hotplug page tables
Vineet Gupta <vgupta@kernel.org>
ARC: io: work around GCC PR127718 in __raw_write{w,l}()
Christian Loehle <christian.loehle@arm.com>
ACPI: CPPC: Reject EPP registers narrower than 8 bits
Ye Weihua <yeweihua4@huawei.com>
ALSA: pcm: oss: Restore params flag after failed reconfiguration
Aldo Ariel Panzardo <qwe.aldo@gmail.com>
drm/vmwgfx: close TOCTOU on guest_memory_bo in surface reference ioctl
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: validate the framebuffer selected for cursor updates
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: validate GB-only cursor command limits
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: validate command body sizes before parsing
Aldo Ariel Panzardo <qwe.aldo@gmail.com>
drm/vmwgfx: return an error when a shared GB surface has no backup buffer
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: reserve dumb buffers while detaching their surfaces
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: reserve cursor MOBs before unpinning them
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: log MOB limits outside the manager spinlock
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: log missing primary planes only once
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: keep cursor mappings and pins with each plane state
Tomas M <tomas@slax.org>
drm/vmwgfx: include legacy hotspots in GB-only cursor images
Vladimir Popov <popov.nkv@gmail.com>
drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence()
Jaeyeong Lee <finpiler@protonmail.com>
drm/vmwgfx: Erase the detached resource entry on resource release
Aldo Ariel Panzardo <qwe.aldo@gmail.com>
drm/vmwgfx: do not hand the embedded sg_table to the PRIME core
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: bound MKSSTAT lengths before rounding to pages
Zack Rusin <zack.rusin@broadcom.com>
drm/vmwgfx: avoid underflow when stripping short GuestInfo replies
Maíra Canal <mcanal@igalia.com>
drm/vc4: Complete async page flips from an ordered workqueue
Maíra Canal <mcanal@igalia.com>
drm/vc4: Start shader code at varying offsets in its BO
Maíra Canal <mcanal@igalia.com>
drm/vc4: Fix off-by-one in the shader record BO handle check
Maíra Canal <mcanal@igalia.com>
drm/vc4: Drop BO usecnt before releasing the old FB
Maíra Canal <mcanal@igalia.com>
drm/vc4: Clear the slice caches before resetting a stalled GPU
Maíra Canal <mcanal@igalia.com>
drm/vc4: Check for a validated shader before reading its thread mode
Maíra Canal <mcanal@igalia.com>
drm/vc4: Hold a runtime PM reference while allocating the binner BO
Wentao Liang <vulab@iscas.ac.cn>
drm/vc4: Fix firmware reference leak in vc4_hvs_bind()
Qiang Han <qiangh@amd.com>
drm/amdkfd: wait for the queue quiesce in concurrent SVM evictions
Jesse Zhang <Jesse.Zhang@amd.com>
drm/amdkfd: keep the DMA addresses of a range intact if splitting fails
Apurv Mishra <Apurv.Mishra@amd.com>
drm/amdkfd: Don't reuse a VRAM page that is still referenced
Perry Yuan <perry.yuan@amd.com>
drm/amdkfd: check CRIU SVM priv data bounds before allocating
David Francis <David.Francis@amd.com>
drm/amdkfd: Acquire cwsr buffer during CRIU resume
Jiaming Fan <fan.jiaming@hotmail.com>
drm/amdgpu: only unregister the ATPX handler if we registered it
David Rosca <david.rosca@amd.com>
drm/amdgpu: Fix VCE buffer size check for DPB and input surface
Erhan Bilgili <erhan.bilgili@gmail.com>
drm/amdgpu: Fix UserQ slot availability checks
Andrei Krautsou <an9949an@gmail.com>
drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2
Lijo Lazar <lijo.lazar@amd.com>
drm/amdgpu: Allow cancelling a requested NPS mode
Jackie Liu <liuyun01@kylinos.cn>
drm/amd/display: Fix logger leak on perf trace allocation failure
Wang Jiang <jiangwang@kylinos.cn>
drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F
Joshua Horne <hornejd@etsu.edu>
drm/amd/pm: send smu8 sclk level indices, not the level mask
Igor Paunovic <royalnet026@gmail.com>
accel/rocket: number the cores by devicetree position, not bind order
Sanjay Yadav <sanjay.kumar.yadav@intel.com>
drm/xe/query: Use ordered clock reads for engine cycles cpu_delta
Zongyao Bai <zongyao.bai@intel.com>
drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled
Thomas Zimmermann <tzimmermann@suse.de>
drm/vblank: timer: Do not block within critical section
Jiaming Fan <fan.jiaming@hotmail.com>
drm/radeon: only unregister the ATPX handler if we registered it
Andrey Misiurov <amisiurov@cloudlinux.com>
drm/radeon: Bound GPIO I2C table entry count from VBIOS
Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
drm/nouveau: do not return early from a synchronous VM_BIND
Joe Finzel <joe@sudmix.de>
drm/nouveau/gsp: only handle GSP interrupts routed to the host
Dave Airlie <airlied@redhat.com>
drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit) (attempt 2)
Shigeaki Asai <y-asai.0816@docomonet.jp>
drm/meson: encoder_dsi: load ENCL gamma table while ENCL is disabled
Imre Deak <imre.deak@intel.com>
drm/i915/ptl+: Add TypeC HPD pin selection for port B
Imre Deak <imre.deak@intel.com>
drm/i915/pps: Reset PPS state after TypeC port init on resume
Imre Deak <imre.deak@intel.com>
drm/i915/pps: Hold a TypeC link reference for PPS VDD
Imre Deak <imre.deak@intel.com>
drm/i915/dp_aux: Take the TypeC port lock after the PPS lock
Jouni Högander <jouni.hogander@intel.com>
drm/i915/display: Flush the fbdev frontbuffer
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
drm/gud: avoid divide error in gud_stats_debugfs
Zizhi Wo <wozizhi@huawei.com>
block: fix BLKSECDISCARD zero-length range causing page cache invalidation
Sechang Lim <rhkrqnwk98@gmail.com>
bpf, sockmap: Clear the redirect target after the stream parser runs
Sechang Lim <rhkrqnwk98@gmail.com>
bpf: Reject kernel threads in bpf_task_work_schedule()
Marco Giunta <marco_giunta@outlook.it>
ASoC: aw88399: fix register used to disable I2S TX
Rosen Penev <rosenp@gmail.com>
gpio: mvebu: validate ngpios before use
Sahaj Chaudhari <sahaj123.sc@gmail.com>
gpio: davinci: use controller-specific MMIO for BINTEN
Peter Zijlstra <peterz@infradead.org>
perf: Fix sigtrap vs fast-switch
Peter Zijlstra <peterz@infradead.org>
perf: Fix sigtrap for software events
Tengda Wu <wutengda@huaweicloud.com>
perf: Prevent duplicate sigtrap task work enqueue
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: tag_brcm: fix link-local detection with a prepended tag
Shravya KN <shravya.k-n@broadcom.com>
tg3: Fix heap overflow in unbuffered NVRAM write path
Pavan Chebbi <pavan.chebbi@broadcom.com>
tg3: Skip management FW version when APE firmware is not ready
Pavan Chebbi <pavan.chebbi@broadcom.com>
tg3: Don't fail probe if 31-bit coherent DMA mask is unsupported
Linus Torvalds <torvalds@linux-foundation.org>
net: dpaa2-eth: fix objtool warning and logic bug
Jiayuan Chen <jiayuan.chen@linux.dev>
tcp: fix negative sk_forward_alloc after MSG_ZEROCOPY append
Alexei Starovoitov <ast@kernel.org>
bpf, sockmap: Hold the psock of the work in sk_psock_backlog()
Alexei Starovoitov <ast@kernel.org>
bpf: Keep the MAC header in bpf_skb_change_tail()
Alexei Starovoitov <ast@kernel.org>
bpf: Take a neighbour of the L3 master in bpf_redirect_neigh()
Alexei Starovoitov <ast@kernel.org>
bpf: Clear family and port of a short address for cgroup sockaddr hooks
Alexei Starovoitov <ast@kernel.org>
bpf: Fail loads from a network header that was not set
Alexei Starovoitov <ast@kernel.org>
bpf: Clear the data that bpf_msg_push_data() adds
Alexei Starovoitov <ast@kernel.org>
bpf: Require CAP_PERFMON to read pinned maps with special fields
Alexei Starovoitov <ast@kernel.org>
bpf: Zero bpf_list_head in copies of map values
Alexei Starovoitov <ast@kernel.org>
bpf: Require CAP_PERFMON for dumps of xlated insns
Altgelt, Max (Nextron) <max.altgelt@nextron-systems.com>
bpf: don't skip other information if xlated_prog_insns is skipped
Alexei Starovoitov <ast@kernel.org>
bpf: Limit reads of variables of the kernel
Alexei Starovoitov <ast@kernel.org>
bpf: Give syscall programs without CAP_PERFMON the base helpers only
Alexei Starovoitov <ast@kernel.org>
bpf: Fix reads past an enum in prints of BTF data
Alexei Starovoitov <ast@kernel.org>
bpf: Refuse mmap() of a part of an arena
Alexei Starovoitov <ast@kernel.org>
bpf: Check the attach type when a cgroup link gets another program
Alexei Starovoitov <ast@kernel.org>
bpf: Fix NULL dereference in XDP redirect from async callbacks
Alexei Starovoitov <ast@kernel.org>
bpf: Do not fill jited line info for a hidden subprog
Alexei Starovoitov <ast@kernel.org>
bpf: Add the symbol of a prog before its id
Alexei Starovoitov <ast@kernel.org>
bpf: Do not trust the neighbour of tp_btf/neigh_create
Alexei Starovoitov <ast@kernel.org>
bpf: Keep the names in front of a number in delegate options
Alexei Starovoitov <ast@kernel.org>
bpf: Do not allow bpf_d_path() by an id of another BTF
Kuniyuki Iwashima <kuniyu@google.com>
tcp: Don't clear saddr before ->put_port().
Eric Dumazet <edumazet@kernel.org>
ipv6: mcast: do not pass uninitialized bytes to dev_mc_add()
Aristo Chen <aristo.chen@canonical.com>
net: dsa: felix: fix NULL pointer dereference in felix_port_enable()
Jan Schär <jan@jschaer.ch>
gpiolib: fix inverted trace values in gpiod_get_array_value()
Alexei Starovoitov <ast@kernel.org>
bpf: Save irq flags on the stack when freeing a list head or rb root
Kaitao Cheng <chengkaitao@kylinos.cn>
bpf: clear list node owner and unlink before drop
Alexei Starovoitov <ast@kernel.org>
bpf: net_sched: Defer bpf_kfree_skb() to irq_work with irqs off
Antonio Quartulli <antonio@mandelbit.com>
tun: bound the NAPI receive queue
Jiayuan Chen <jiayuan.chen@linux.dev>
ipv4: fix conntrack defrag forwarding after ip_frag_reinit()
Nicolai Buchwitz <nb@tipi-net.de>
net: systemport: accumulate the DIM packet and byte counters
Nicolai Buchwitz <nb@tipi-net.de>
net: systemport: restart DIM from the default profile on start
Nicolai Buchwitz <nb@tipi-net.de>
net: bcmgenet: reset the Rx discard count with the ring
Nicolai Buchwitz <nb@tipi-net.de>
net: bcmgenet: accumulate the DIM packet and byte counters
Nicolai Buchwitz <nb@tipi-net.de>
net: bcmgenet: keep DIM from getting stuck after close or suspend
Wang Haoran <wanghr2026@mail.zgclab.edu.cn>
net: bcmasp: avoid refcount drain on probe
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: fix mirror destination and source state tracking
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: use the correct override register 2 Gbps bit
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: clear stale state when creating an ARL entry
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: fix the SRAB grant timeout check
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: initialize the jumbo frame size register offset
Jakub Kicinski <kuba@kernel.org>
eth: bnxt_en: restore Tx coalescing after re-allocating the completion ring
Jakub Kicinski <kuba@kernel.org>
eth: bnxt_en: restore Rx coalescing after re-allocating the completion ring
Saurabh Sengar <ssengar@linux.microsoft.com>
workqueue: Skip redundant unbound updates during CPU bringup
Marco Giunta <marco_giunta@outlook.it>
ASoC: aw88166: fix backup restoring the RE value instead of saving it
Andrea Parri <parri.andrea@gmail.com>
ftrace: Fix lost recursion records in ftrace_record_recursion()
Patrick Delaunay <patrick.delaunay@foss.st.com>
arm64: dts: st: mark STM32MP23 timer as stopping in suspend
Patrick Delaunay <patrick.delaunay@foss.st.com>
arm64: dts: st: add PSCI idle state to STM32MP23 CPU domains
Patrick Delaunay <patrick.delaunay@foss.st.com>
arm64: dts: st: add PSCI idle state to STM32MP25 CPU domains
Rodrigo Vivi <rodrigo.vivi@intel.com>
drm/xe/hwmon: Unregister hwmon before the device is unplugged
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: intel_pstate: Use dedicated lock in set_power_ctl_ee_state()
Ard Biesheuvel <ardb@kernel.org>
efi/tpm: Allocate the event log from EFI loader data again
Ard Biesheuvel <ardb@kernel.org>
x86/efi: Disregard the INITRD and MEMATTR config tables after kexec
Karl Mehltretter <kmehltretter@gmail.com>
cgroup/rstat: disable preemption in css_rstat_updated()
Shihuang Liu <shlomojune6@gmail.com>
net: sock_reuseport: Check program type on the migration path
Alexei Starovoitov <ast@kernel.org>
bpf: Let the bpf_fastcall boundary cover the longest pattern
Christian Göttsche <cgzones@googlemail.com>
jbd2: set JBD2_LOADED under j_state_lock
Filipe Manana <fdmanana@suse.com>
btrfs: fix delayed inode count leak after failure to delete inode ref
Filipe Manana <fdmanana@suse.com>
btrfs: fix incorrect task accounting on error during io_uring read
Caleb Sander Mateos <csander@purestorage.com>
io_uring/uring_cmd: avoid double indirect call in task work dispatch
Filipe Manana <fdmanana@suse.com>
btrfs: fix blocking allocation for nowait encoded reads of inline extents
Filipe Manana <fdmanana@suse.com>
btrfs: abort transaction on failure to update inode after hole punching
Filipe Manana <fdmanana@suse.com>
btrfs: fix double release of space when cloning compressed inline extent
Filipe Manana <fdmanana@suse.com>
btrfs: fiemap: deal with inline extent in fiemap_find_last_extent_offset()
Arnav Kapoor <kapoorarnav43@gmail.com>
ASoC: SOF: control: reject out-of-range enum values
Filipe Manana <fdmanana@suse.com>
btrfs: zstd: fix UAF due to race between putting workspace and reclaim
Filipe Manana <fdmanana@suse.com>
btrfs: fix race between concurrent sync direct IO writes
Boris Burkov <boris@bur.io>
btrfs: downgrade the reflink source inode lock for tree walking
Boris Burkov <boris@bur.io>
btrfs: pre-flush reflink source before taking inode locks
Cheng Yongkang <teel4res@gmail.com>
btrfs: remove devid kobject when deleting a missing device
Hugo Sales <hugo@hsal.es>
cpufreq: intel_pstate: Refresh cpuinfo.max_freq when a CPU goes online
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: intel_pstate: Use mutex guard for driver locking
Stefan Ghetu <stefan.ghetu@nxp.com>
ASoC: fsl_asrc_m2m: allow only one task at a time per stream
Stefan Ghetu <stefan.ghetu@nxp.com>
ASoC: fsl_easrc: fix context ownership on repeated hw_params
Stefan Ghetu <stefan.ghetu@nxp.com>
ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params
Stefan Ghetu <stefan.ghetu@nxp.com>
ASoC: fsl_asrc_m2m: fix out-of-bounds write when draining the output FIFO
Binbin Deng <18983559317@163.com>
btrfs: wait for a grace period before freeing a new device
Filipe Manana <fdmanana@suse.com>
btrfs: send: fix invalid access to inline extents in clone_range()
Filipe Manana <fdmanana@suse.com>
btrfs: send: fix missing hole punching during incremental send
Eric Dumazet <edumazet@kernel.org>
tun: flush uc and mc addresses in TUNSETLINK
Randy Dunlap <rdunlap@infradead.org>
chardev: GPIO common access methods: repair non-kernel-doc comment
Anastasia Eskova <anastasia.eskova@ibm.com>
s390/cert_store: Only allow the kernel to create cert_store_key keys
Anastasia Eskova <anastasia.eskova@ibm.com>
s390/cert_store: Allocate keyring with link restriction
Zhu Jun <zhujun2@cmss.chinamobile.com>
tools: gpio: Return success after monitoring requested events
Zhu Jun <zhujun2@cmss.chinamobile.com>
tools: gpio: Preserve device listing errors in lsgpio
Zhu Jun <zhujun2@cmss.chinamobile.com>
tools: gpio-hammer: Accept the maximum number of line offsets
Antonio Quartulli <antonio@mandelbit.com>
tun: complete the zerocopy buffer of packets consumed by XDP
Yifan Feng <evanfengff@gmail.com>
tracing/fprobe: Do not let KASAN check the $stackN read
Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
tools/bootconfig: Use the registered global tracing parameter names
Kai Vehmanen <kai.vehmanen@linux.intel.com>
ALSA: hda: intel: Release i915 power also when delayed probe fails
Petr Oros <poros@redhat.com>
ice: allow reading the last byte of the NVM and Shadow RAM regions
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
ice: use global queue index in TC to-queue offload
Uri Dar <udar@nvidia.com>
net/mlx5: E-Switch, skip vport change work for disabled vports
Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
net: do not run out of frags in alloc_skb_with_frags()
Han Gao <gaohan@iscas.ac.cn>
riscv: efi: Map runtime MMIO with device attributes
Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
net: qrtr: ns: keep notifying local servers after a failed send
Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails
Dimitri Daskalakis <daskald@meta.com>
eth: fbnic: skip freed Tx rings in fbnic_get_ts_stats()
Dimitri Daskalakis <daskald@meta.com>
eth: fbnic: skip disabled Tx rings when setting the queue NAPI
Yevgeny Kliteynik <kliteyn@nvidia.com>
net/mlx5: DR, Fix out-of-bounds write when sync to HW fails
Yevgeny Kliteynik <kliteyn@nvidia.com>
net/mlx5: HWS, Handle NULL in vport destination action creation
Eric Dumazet <edumazet@kernel.org>
net: clear skb->mac_len in skb_unset_mac_header()
Gal Pressman <gal@nvidia.com>
net/mlx5e: Release FIB event work flows before dropping RTNL
Imre Kaloz <kaloz@kernel.org>
net: marvell: prestera: disable port before changing its MAC mode
Jiayuan Chen <jiayuan.chen@linux.dev>
ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check
Jingxuan Xie <jingxuanxie@deeproute.ai>
af_packet: avoid waiting for TPACKET_V3 copies at retirement
chris@kode54.net <chris@kode54.net>
ALSA: usb-audio: Ignore trailing whitespace in quirk_flags
Takashi Iwai <tiwai@suse.de>
ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()
Kiran K <kiran.k@intel.com>
Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
Thomas de Gruijter <thomasdegruijter@pm.me>
Bluetooth: MSFT: Only enable the advertisement filter with monitors
Thomas de Gruijter <thomasdegruijter@pm.me>
Bluetooth: MSFT: Record the filter state on Command Disallowed
Jiale Yao <yaojiale02@163.com>
usb: cdns3: report endpoint reset timeout
Sang-Hoon Choi <csh0052@gmail.com>
HID: nintendo: release the player ID when LED setup fails
Mathias Krause <minipli@grsecurity.net>
HID: Intel-thc-hid: Fix REGMAP dependency
Tim Zimmermann <tim@linux4.de>
hid: intel-thc-hid: Select SGL_ALLOC
Eren Çakar <hey@erencakar.com>
HID: letsketch: skip string descriptors the firmware does not implement
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor-hub: Remove clients before stopping hardware
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor: custom: Register enable attribute after misc device
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor: custom: Serialize misc device reads
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor: custom: Fix state lifetime during removal
Shunbo Shi <shishunbo@cmss.chinamobile.com>
usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails
Shunbo Shi <shishunbo@cmss.chinamobile.com>
usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response
Shunbo Shi <shishunbo@cmss.chinamobile.com>
usb: gadget: f_hid: fix report_list entries leak
Koichiro Den <den@valinux.co.jp>
dmaengine: rcar-dmac: Add missing dma_descriptor_unmap()
Zhang Shurong <zhang_shurong@foxmail.com>
dmaengine: rcar-dmac: Fix PM usage counter imbalance
SeungUk Nam <tmddnr49449@gmail.com>
dmaengine: idxd: Free the minor number when cdev setup fails
Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
Thaison Phan <thaisonphan@google.com>
tcp: accecn: initialize AccECN fields in syncookie path
Thaison Phan <thaisonphan@google.com>
tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check()
Tariq Toukan <tariqt@nvidia.com>
net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state
Terrence Adams <tadamsjr@google.com>
scsi: pm8001: Offset hardware queue index for MSI-X pre-vector
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: order the TX ring index accesses
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: publish the buffer address before OWN
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: unmap RX buffers on stop with their mapped size
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: unmap the buffer of a dropped RX frame
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: release the TX ring on stop
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: drop a TX frame whose DMA mapping failed
Kordian Chmielewski <kudzo51@gmail.com>
net: bcm4908_enet: fix the TX ring wrap
Artemii Mashanov <ralerrdirsardx@gmail.com>
cxgb4: allocate the full ethtool filter location array
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Wait for in-flight PTP timestamps before treating Tx as idle
Tianyi Gao <tianyi@cloudflare.com>
xsk: reject TX checksum requests that overflow skb->csum_start
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor: custom: Disable sensor before hub close on removal
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor: custom: Set owner for misc device
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
HID: sensor-hub: Synchronize callback removal with raw events
Myeonghun Pak <mhun512@gmail.com>
HID: magicmouse: disable the multitouch work on removal
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_core: Don't fail removing a monitor unknown to the controller
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: MSFT: Free the response of the monitor commands
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: MSFT: Protect the event prefix with hdev->lock
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: mgmt: Fix mesh transmission locking and lifetime
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: L2CAP: Don't use uninitialized EFS in l2cap_parse_conf_rsp()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: mgmt: Reject zero multi advertising rotation duration
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Initialize ism array in query_diag320_subcodes()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Fix out-of-bounds read in pr_dbf_vce()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Validate hash length in check_certificate_valid()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Do not search the process keyrings for the cert_store keyring
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Fix keyring refcount handling in get_user_session_keyring()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Fix error handling of get_user_session_keyring()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Remove unnecessary static specifier in create_cs_keyring()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Fix potential use-after-free caused by find_cs_keyring()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring()
Heiko Carstens <hca@linux.ibm.com>
s390/cert_store: Check key_lookup() return code in invalidate_keyring_keys()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: SMP: Don't create the BR/EDR channel while unregistered
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: SMP: Check smp_data before using SMP_DEV()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: SMP: Serialize link key updates from smp_notify_keys()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: hci_core: Take req_sync lock in hci_power_on()
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: mgmt: Fix read_index_list() buffer overflow
Shawn Lin <shawn.lin@rock-chips.com>
phy: rockchip: snps-pcie3: Raise the SRAM init timeout
Changyul Lee <lcy8047@gmail.com>
scsi: ch: Remove the minor from ch_index_idr after device_destroy()
Kyle Mahlkuch <kmahlkuc@linux.ibm.com>
scsi: lpfc: Fix race conditions in ELS retry handling
Miri Korenblit <miriam.rachel.korenblit@intel.com>
wifi: iwlwifi: mvm: correctly check the API version
Michail Andreas Michalopoulos <mike.michalo@gmail.com>
ksmbd: sign the last response of a compound that ends early
Hongling Zeng <zenghongling@kylinos.cn>
phy: ti-pipe3: Fix clock leaks in init/exit error paths
Hongling Zeng <zenghongling@kylinos.cn>
phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources
Hongling Zeng <zenghongling@kylinos.cn>
phy: ti: pipe3: Fix clock resource leak on probe errors
Hongling Zeng <zenghongling@kylinos.cn>
phy: ti-pipe3: Fix ignored clock enable return value in init
Felix Gu <ustc.gu@gmail.com>
phy: ingenic: fix unbalanced regulator disable in exit
Sasha Levin <sashal@kernel.org>
selftests: drivers/s390x: Select uvdevice tests using the target architecture
Bart Van Assche <bvanassche@acm.org>
drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata()
Rob Clark <robin.clark@oss.qualcomm.com>
drm/msm/gem: Clear nr_ops in lookup_ops() failure path
Rob Clark <robin.clark@oss.qualcomm.com>
drm/msm/gem: Decrement loop idx if handle lookup fails
Rob Clark <robin.clark@oss.qualcomm.com>
drm/msm/gem: Disallow nr_bos for VM_BIND contexts
Thomas Hellström <thomas.hellstrom@linux.intel.com>
drm/msm: Remove abuse of drm_exec internals
Rob Clark <robin.clark@oss.qualcomm.com>
drm/msm/gem: Fix VM_BIND range check
Hung-Chun Tseng <alan.tseng.cs@gmail.com>
reset: spacemit: Fix the RCPU2 PWM reset registers
Colton Lewis <coltonlewis@google.com>
irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
reset: scmi: Set the device for the reset controller
Fuad Tabba <fuad.tabba@linux.dev>
irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure
Fuad Tabba <fuad.tabba@linux.dev>
irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them
Selby Mashiki <mashikiselby@gmail.com>
memory: tegra: fix device_node leak in tegra186_mc_probe_device()
Myeonghun Pak <mhun512@gmail.com>
memory: tegra: Shut down Tegra210 EMC timers before teardown
Oleg Keri <okerixx@gmail.com>
soundwire: qcom: disable the interrupt before gating the clock
Sudeep Holla <sudeep.holla@kernel.org>
firmware: arm_scmi: Free mailbox state on mapping failure
Sudeep Holla <sudeep.holla@kernel.org>
firmware: arm_scmi: Unregister notifier on enable failure
Sudeep Holla <sudeep.holla@kernel.org>
firmware: arm_scmi: imx: Validate MISC control response size
Zhengping Jiang <jiangzp@google.com>
HID: vivaldi: avoid redundant feature report reads per usage
Shashikirana H K <shashikiranah@chromium.org>
HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping()
Julian Braha <julianbraha@gmail.com>
irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64
Julian Braha <julianbraha@gmail.com>
firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n
David Cemin <dcemin@nvidia.com>
firmware: arm_ffa: Compare notify_id when looking up notifier callbacks
Geert Uytterhoeven <geert+renesas@glider.be>
firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale
Mario Limonciello <mario.limonciello@amd.com>
tpm: Call cmd_ready/go_idle for each command transmission
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Revert "wifi: ath10k: Stop unanswered temperature reads"
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: inv_sensors: do not compute period estimation when updating odr
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: inv_sensors: fix estimated value larger than interrupt timestamp
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: inv_sensors: prevent timestamps going back in time in transitions
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: inv_sensors: improve period measurement by using a longer delay
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: inv_sensors: better timestamp alignment when using watermark
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: inv_sensors: convert to kernel types
Shi Hao <i.shihao.999@gmail.com>
iio: common: fix spelling mistakes in comments
Jocelyn Falempe <jfalempe@redhat.com>
drm/ast: Handle framebuffer from dma-buf
Julian Anastasov <ja@ssi.bg>
ipvs: honor the overload state and do not enter it forever
Julian Anastasov <ja@ssi.bg>
ipvs: read flags and seqs in master atomically
Myeonghun Pak <mhun512@gmail.com>
iio: proximity: hx9023s: Allocate trigger before requesting IRQ
Pan Chuang <panchuang@vivo.com>
iio: proximity: Remove redundant dev_err()/dev_err_probe()
Christopher Hoover <ch@murgatroid.com>
iio: humidity: hid-sensor-humidity: Use per-instance callbacks
Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove
Josef Bacik <josef@toxicpanda.com>
w1: w1_therm: lock the list of slaves for the bulk read
Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths
Sean Anderson <sean.anderson@linux.dev>
usb: dwc3: Always deassert xilinx resets
Ihor Urazov <z0rc3r@gmail.com>
usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14
Paulo Alcantara <pc@manguebit.org>
smb: client: don't fail writeback preparation if the task is dying
Paulo Alcantara <pc@manguebit.org>
smb: client: don't write back through O_DIRECT handles
Joseph Qi <joseph.qi@linux.alibaba.com>
smb: client: hold server ref while queueing reconnect work
Daejun Park <daejun7.park@samsung.com>
ovl: bump the impure dir version when linking a file with origin
Giuseppe Scrivano <giuseppe@scrivano.org>
ovl: follow lower to lowerdata redirects from any lower layer
Amir Goldstein <amir73il@gmail.com>
ovl: do not check the deferred lowerdata redirect on index lookup
Amir Goldstein <amir73il@gmail.com>
ovl: fix leak of lowerdata redirect on ovl_get_inode() failure
Amir Goldstein <amir73il@gmail.com>
ovl: do not read the flags of a put upper dentry in lookup
Christian Brauner <brauner@kernel.org>
ovl: refactor ovl_lookup()
Takashi Iwai <tiwai@suse.de>
Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B"
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI: PM: Avoid initializing power management for absent devices
Christopher Hoover <ch@murgatroid.com>
iio: temperature: hid-sensor-temperature: Use per-instance callbacks
Josef Bacik <josef@toxicpanda.com>
iio: adc: ad7923: add the AD7927 to the SPI ID table
Ming-Hung Tsai <mtsai@redhat.com>
dm: fix use-after-free when dm_get_device() widens the open mode
Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
dm cache: validate the discard block size before narrowing
Sasha Levin <sashal@kernel.org>
Revert "mm/hugetlb_vmemmap: fix incorrect vmemmap restore in rollback"
Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Bluetooth: l2cap: defer conn param update to avoid conn->lock/hdev->lock inversion
Tejun Heo <tj@kernel.org>
sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online()
Vishwaroop A <va@nvidia.com>
spi: tegra210-quad: Unmap DMA buffers on transfer timeout
Vishwaroop A <va@nvidia.com>
spi: tegra210-quad: Check hardware status on timeout
Vishwaroop A <va@nvidia.com>
spi: tegra210-quad: Refactor error handling into helper functions
Zhao Li <enderaoelyther@gmail.com>
Bluetooth: L2CAP: Only accept LE responses to outstanding requests
Vlastimil Babka (SUSE) <vbabka@kernel.org>
mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx()
Brendan Jackman <jackmanb@google.com>
mm: rejig pageblock mask definitions
Josef Bacik <josef@toxicpanda.com>
mm: page_isolation: do not take slab pages for free
David Hildenbrand (Arm) <david@kernel.org>
mm/memory_hotplug: fix possible race in scan_movable_pages()
Kefeng Wang <wangkefeng.wang@huawei.com>
mm: page_isolation: introduce page_is_unmovable()
Gregory Price (Meta) <gourry@gourry.net>
mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt
Gregory Price <gourry@gourry.net>
page_alloc: allow migration of smaller hugepages during contig_alloc
Gregory Price (Meta) <gourry@gourry.net>
mm/hugetlb: retry the pool walk when the zonelist is rebuilt
Gregory Price (Meta) <gourry@gourry.net>
mm/page_alloc: retry allocations that raced with a zonelist rebuild
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: Fix updates of cached resolved frequency and index
Wentao Liang <vulab@iscas.ac.cn>
gpio: keep the chip reference when deferred setup fails
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()
Rosen Penev <rosenp@gmail.com>
gpio: mvebu: name regmaps to fix debugfs collisions
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211_hwsim: ignore non-generic netlink releases
Ian Bridges <icb@fastmail.org>
ksmbd: skip metadata-only opens in sharing checks
Seiji Nishikawa <snishika@redhat.com>
sched/core: Do not touch SMT siblings that have not joined the core yet
Stefan Haberland <sth@linux.ibm.com>
s390/dasd: Re-initialize RCD buffer with "V1.0" before every start
Stefan Haberland <sth@linux.ibm.com>
s390/dasd: Fix typo 'immediatly' -> 'immediately'
Anton Lundin <glance@ac2.se>
hwmon: (nct6775) Handle dual use registers
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
watchdog: rzv2h: Drop runtime PM handling from WDTDCR init
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
watchdog: rzv2h: Use pm_runtime_put_sync()
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
watchdog: rz: Discard pm_runtime_put() return values
Tim Menninger <tmenninger@everpuredata.com>
pNFS: avoid repeatedly cancelling I/O for the same lseg
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: Force passing target frequency to driver during resume
Viresh Kumar <viresh.kumar@linaro.org>
cpufreq: Avoid redundant target() calls for unchanged limits
Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
arm64: suspend: Only track cpuidle context for idle tasks
Ada Couprie Diaz <ada.coupriediaz@arm.com>
arm64: suspend: rely on daif helpers to handle PMR
Waiman Long <longman@redhat.com>
cgroup/cpuset: Correctly set isolated_cpus when switching partition state
Yingjie Wang <x-professor@outlook.com>
tcp: free saved_syn after an RCU grace period
Eric Dumazet <edumazet@google.com>
tcp: move __reqsk_free() out of line
Cheng Yongkang <teel4res@gmail.com>
btrfs: reject refs=0 subvolume without DEAD in SUBVOL_SYNC_WAIT
Yuansheng Yang <0xbeac@gmail.com>
KEYS: Protect pkey method checks against type removal
Mohammed EL Kadiri <med08elkadiri@gmail.com>
keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP
Jarkko Sakkinen <jarkko@kernel.org>
KEYS: Expand key->{datalen,quotalen} to unsigned int
Masami Hiramatsu (Google) <mhiramat@kernel.org>
kprobes: Switch ftrace ops when adding probe with post_handler
Arnav Kapoor <kapoorarnav43@gmail.com>
iio: proximity: sx9360: fix sampling frequency write and available range
Kuba Piecuch <jpiecuch@google.com>
sched_ext: Read exit_kind before flushing in scx_flush_disable_work()
Kuniyuki Iwashima <kuniyu@google.com>
ipv6: Remove IPV6_ADDRFORM.
Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
tools/bootconfig: Close only opened braces in compact output
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Bluetooth: btusb: fix use-after-free in force_poll_sync
Longxuan Yu <ylong030@ucr.edu>
8021q: delete cleared egress QoS mappings
Longxuan Yu <ylong030@ucr.edu>
8021q: use RCU for egress QoS mappings
Alice Ryhl <aliceryhl@google.com>
rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY
Ian Abbott <abbotti@mev.co.uk>
comedi: comedi_bond: Fix leak of opened device references
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/probes: Fix BTF bitfield parsing and out-of-bounds buffer write
Wahid Khan <wahidzk0091@gmail.com>
ksmbd: refuse to read a handle that is not open for reading
Jiwoo Kim <arpe1618@gmail.com>
ksmbd: pin parent dentries in SMB2 CREATE ACL path
Eric Dumazet <edumazet@kernel.org>
net: wait for in-flight device unregistrations before netns dismantle
Pin-yen Lin <treapking@google.com>
gve: Block invalid ring sizes when device options are 0
Pin-yen Lin <treapking@google.com>
gve: Fix race between stats query and queue reconfig
Tim Menninger <tmenninger@everpuredata.com>
xprtrdma: serialize unmap_sync with xprt_disconnect
JP Kobryn <jp.kobryn@linux.dev>
mm/page_alloc: use existing highatomic reserves on the buddy fastpath
Frank van der Linden <fvdl@google.com>
mm/page_alloc: don't increase highatomic reserve after pcp alloc
Gregory Price (Meta) <gourry@gourry.net>
mm/mmzone: read each zoneref slot once when filtering by nodemask
Leon Hwang <leon.hwang@linux.dev>
bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn
Leon Hwang <leon.hwang@linux.dev>
bpf: Disallow interpreter fallback for arena-related insns
Tiezhu Yang <yangtiezhu@loongson.cn>
bpf: Reject programs with inlined helpers if JIT is not available
Tiezhu Yang <yangtiezhu@loongson.cn>
bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call()
Jan Kara <jack@suse.cz>
ext4: fix transaction overflow during writeback
Jan Kara <jack@suse.cz>
ext4: teach ext4_meta_trans_blocks() about number of allocated extents
Eric Dumazet <edumazet@google.com>
net: flush skb_defer_nodes in dev_cpu_dead()
Jamal Hadi Salim <jhs@mojatatu.com>
net/sched: codel: bound the dropping loop per dequeue call
Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
sctp: validate cookie AUTH state before use
Alexei Starovoitov <ast@kernel.org>
net: reject a negative TCP header offset in qdisc_pkt_len_segs_init()
Eric Dumazet <edumazet@kernel.org>
net: harden qdisc_pkt_len_segs_init() against malicious GSO packets
Cosmin Ratiu <cratiu@nvidia.com>
xfrm: Don't clobber inner headers when already set
Eric Dumazet <edumazet@google.com>
net: pull headers in qdisc_pkt_len_segs_init()
Eric Dumazet <edumazet@google.com>
net: init shinfo->gso_segs from qdisc_pkt_len_init()
Eric Dumazet <edumazet@google.com>
netlink: do not free nlk->groups while lockless readers can use it
Sabrina Dubroca <sd@queasysnail.net>
mpls: add seqcount to protect the platform_label{,s} pair
Chen-Yu Tsai <wenst@chromium.org>
drm/gem-dma: Support dedicated DMA device for allocation and mapping
-------------
Diffstat:
Documentation/arch/arm64/silicon-errata.rst | 4 +
Documentation/filesystems/overlayfs.rst | 24 +-
Documentation/trace/boottime-trace.rst | 8 +-
Makefile | 8 +-
arch/arc/include/asm/io.h | 13 +-
arch/arm64/boot/dts/st/stm32mp231.dtsi | 16 +-
arch/arm64/boot/dts/st/stm32mp233.dtsi | 1 +
arch/arm64/boot/dts/st/stm32mp251.dtsi | 14 +
arch/arm64/boot/dts/st/stm32mp253.dtsi | 1 +
arch/arm64/include/asm/kexec.h | 2 +
arch/arm64/kernel/cpufeature.c | 2 -
arch/arm64/kernel/machine_kexec.c | 7 +-
arch/arm64/kernel/probes/uprobes.c | 6 +
arch/arm64/kernel/relocate_kernel.S | 11 +-
arch/arm64/kernel/suspend.c | 23 +-
arch/arm64/kernel/vmlinux.lds.S | 5 +-
arch/arm64/mm/mmu.c | 3 +-
arch/parisc/kernel/entry.S | 4 -
arch/parisc/kernel/ftrace.c | 2 +-
arch/parisc/kernel/irq.c | 4 +-
arch/powerpc/include/asm/hw_irq.h | 2 +-
arch/powerpc/kernel/eeh.c | 6 +-
arch/powerpc/kernel/module_32.c | 3 +
arch/powerpc/kvm/book3s_64_mmu_hv.c | 33 +-
arch/powerpc/kvm/book3s_hv.c | 4 +-
arch/powerpc/kvm/book3s_hv_nested.c | 34 +-
arch/powerpc/kvm/book3s_xive.c | 5 +-
arch/powerpc/xmon/xmon.c | 3 +-
arch/riscv/include/asm/pgalloc.h | 14 +-
arch/riscv/include/asm/pgtable-32.h | 4 +-
arch/riscv/include/asm/pgtable-64.h | 50 +--
arch/riscv/include/asm/pgtable.h | 4 +-
arch/riscv/include/asm/switch_to.h | 30 +-
arch/riscv/include/asm/vector.h | 2 +
arch/riscv/include/asm/vmalloc.h | 5 +-
arch/riscv/kernel/cpu.c | 4 +-
arch/riscv/kernel/efi.c | 2 +-
arch/riscv/kernel/entry.S | 6 +-
arch/riscv/kernel/kernel_mode_fpu.c | 4 +-
arch/riscv/kernel/probes/uprobes.c | 6 +
arch/riscv/kernel/signal.c | 2 +
arch/riscv/kernel/unaligned_access_speed.c | 4 +-
arch/riscv/mm/init.c | 105 +++---
arch/riscv/mm/kasan_init.c | 20 +-
arch/riscv/mm/pgtable.c | 4 +-
arch/riscv/mm/ptdump.c | 4 +-
arch/s390/appldata/appldata_base.c | 12 +-
arch/s390/kernel/cert_store.c | 108 ++++---
arch/x86/Kconfig | 2 +-
arch/x86/Makefile | 1 +
arch/x86/kernel/apic/msi.c | 2 +-
arch/x86/kernel/cpu/mce/core.c | 18 +-
arch/x86/kernel/uprobes.c | 15 +
arch/x86/platform/efi/efi.c | 34 ++
arch/x86/platform/efi/quirks.c | 4 -
block/blk-iocost.c | 3 +-
block/ioctl.c | 19 +-
drivers/accel/rocket/rocket_core.h | 4 +
drivers/accel/rocket/rocket_drv.c | 96 +++---
drivers/accel/rocket/rocket_drv.h | 13 +-
drivers/accel/rocket/rocket_gem.c | 33 +-
drivers/accel/rocket/rocket_gem.h | 4 +-
drivers/accel/rocket/rocket_job.c | 6 +-
drivers/accel/rocket/rocket_job.h | 2 +-
drivers/acpi/cppc_acpi.c | 9 +
drivers/acpi/device_pm.c | 23 +-
drivers/acpi/glue.c | 8 +-
drivers/android/binder/error.rs | 1 -
drivers/android/binder/thread.rs | 44 ++-
drivers/ata/libata-core.c | 3 +
drivers/ata/libata-scsi.c | 2 +-
drivers/block/ublk_drv.c | 22 +-
drivers/bluetooth/btintel_pcie.c | 11 +-
drivers/bluetooth/btusb.c | 10 +-
drivers/bluetooth/hci_qca.c | 1 +
drivers/char/tpm/tpm-chip.c | 24 --
drivers/char/tpm/tpm-interface.c | 22 ++
drivers/comedi/drivers/comedi_bond.c | 24 +-
drivers/cpufreq/cppc_cpufreq.c | 14 +-
drivers/cpufreq/cpufreq.c | 81 +++--
drivers/cpufreq/intel_pstate.c | 151 +++++----
drivers/dma/idxd/cdev.c | 1 +
drivers/dma/sh/rcar-dmac.c | 4 +-
drivers/dma/stm32/stm32-mdma.c | 1 +
drivers/edac/i5000_edac.c | 4 +-
drivers/firmware/arm_ffa/driver.c | 11 +-
drivers/firmware/arm_scmi/notify.c | 4 +-
drivers/firmware/arm_scmi/transports/Kconfig | 2 +-
drivers/firmware/arm_scmi/transports/mailbox.c | 7 +-
.../firmware/arm_scmi/vendors/imx/imx-sm-misc.c | 16 +-
drivers/firmware/efi/libstub/tpm.c | 2 +-
drivers/gpio/gpio-davinci.c | 4 +-
drivers/gpio/gpio-ljca.c | 11 +-
drivers/gpio/gpio-mlxbf2.c | 29 +-
drivers/gpio/gpio-mvebu.c | 24 +-
drivers/gpio/gpio-virtio.c | 13 +-
drivers/gpio/gpiolib-cdev.c | 95 +++---
drivers/gpio/gpiolib.c | 64 ++--
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 13 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 52 ++-
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 4 +
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 33 +-
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 7 +-
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 13 +
drivers/gpu/drm/amd/amdgpu/soc21.c | 3 +
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 20 +-
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +
.../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 32 ++
drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 4 +-
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 65 ++--
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 34 +-
drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +
.../drm/amd/display/modules/freesync/freesync.c | 12 +-
.../gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 14 +-
drivers/gpu/drm/ast/ast_mode.c | 11 +-
drivers/gpu/drm/display/drm_bridge_connector.c | 11 +-
drivers/gpu/drm/drm_gem_dma_helper.c | 21 +-
drivers/gpu/drm/drm_syncobj.c | 45 ++-
drivers/gpu/drm/drm_vblank.c | 34 +-
drivers/gpu/drm/gud/gud_drv.c | 13 +-
drivers/gpu/drm/i915/display/intel_ddi.c | 10 +-
drivers/gpu/drm/i915/display/intel_display.c | 32 +-
drivers/gpu/drm/i915/display/intel_display.h | 1 +
drivers/gpu/drm/i915/display/intel_dp_aux.c | 39 ++-
drivers/gpu/drm/i915/display/intel_dsb.c | 16 +-
drivers/gpu/drm/i915/display/intel_fbdev.c | 13 +-
drivers/gpu/drm/i915/display/intel_pps.c | 14 +
drivers/gpu/drm/i915/display/intel_psr.c | 34 +-
drivers/gpu/drm/i915/display/intel_tc.c | 9 +-
drivers/gpu/drm/i915/i915_vma.c | 2 +-
drivers/gpu/drm/i915/i915_vma_types.h | 3 +
drivers/gpu/drm/imagination/pvr_queue.c | 3 +-
drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 +-
drivers/gpu/drm/msm/msm_drv.c | 3 +-
drivers/gpu/drm/msm/msm_gem.h | 1 +
drivers/gpu/drm/msm/msm_gem_submit.c | 9 +-
drivers/gpu/drm/msm/msm_gem_vma.c | 11 +-
.../gpu/drm/nouveau/include/nvkm/engine/falcon.h | 1 +
drivers/gpu/drm/nouveau/nouveau_display.c | 11 +-
drivers/gpu/drm/nouveau/nouveau_sched.c | 6 +-
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 1 +
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 1 +
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c | 4 +-
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 1 +
drivers/gpu/drm/radeon/radeon_atombios.c | 22 +-
drivers/gpu/drm/radeon/radeon_atpx_handler.c | 13 +-
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 2 +-
drivers/gpu/drm/scheduler/sched_entity.c | 17 +-
drivers/gpu/drm/vc4/vc4_bo.c | 43 ++-
drivers/gpu/drm/vc4/vc4_crtc.c | 136 ++++----
drivers/gpu/drm/vc4/vc4_drv.h | 21 +-
drivers/gpu/drm/vc4/vc4_gem.c | 20 +-
drivers/gpu/drm/vc4/vc4_hvs.c | 18 +-
drivers/gpu/drm/vc4/vc4_irq.c | 37 ++-
drivers/gpu/drm/vc4/vc4_v3d.c | 7 +-
drivers/gpu/drm/vc4/vc4_validate.c | 15 +-
drivers/gpu/drm/vc4/vc4_validate_shaders.c | 7 +-
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 3 +
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 166 +++++++---
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h | 4 +
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 208 ++++++++++++
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c | 11 +-
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 55 ++--
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +-
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 21 +-
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 1 +
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_streamoutput.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 28 +-
drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | 13 +-
drivers/gpu/drm/xe/xe_bo.c | 7 +-
drivers/gpu/drm/xe/xe_device.c | 32 +-
drivers/gpu/drm/xe/xe_device.h | 1 +
drivers/gpu/drm/xe/xe_dma_buf.c | 30 +-
drivers/gpu/drm/xe/xe_guc_tlb_inval.c | 14 +-
drivers/gpu/drm/xe/xe_hwmon.c | 22 +-
drivers/gpu/drm/xe/xe_hwmon.h | 2 +
drivers/gpu/drm/xe/xe_query.c | 6 +-
drivers/gpu/drm/xe/xe_shrinker.c | 81 +++--
drivers/gpu/drm/xe/xe_sync.c | 33 +-
drivers/hid/hid-letsketch.c | 21 +-
drivers/hid/hid-magicmouse.c | 2 +-
drivers/hid/hid-nintendo.c | 2 +-
drivers/hid/hid-sensor-custom.c | 125 +++++---
drivers/hid/hid-sensor-hub.c | 27 +-
drivers/hid/hid-vivaldi-common.c | 91 +++---
drivers/hid/intel-thc-hid/Kconfig | 2 +
drivers/hwmon/ads7871.c | 4 +-
drivers/hwmon/dell-smm-hwmon.c | 9 +
drivers/hwmon/hwmon.c | 7 +-
drivers/hwmon/nct6775-core.c | 22 +-
drivers/hwmon/sht3x.c | 4 +-
drivers/hwmon/w83791d.c | 4 +-
drivers/hwmon/w83792d.c | 4 +-
drivers/iio/adc/ad7923.c | 1 +
.../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
.../iio/common/hid-sensors/hid-sensor-attributes.c | 2 +-
.../iio/common/inv_sensors/inv_sensors_timestamp.c | 134 ++++----
drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 2 +-
drivers/iio/humidity/hid-sensor-humidity.c | 14 +-
drivers/iio/proximity/as3935.c | 4 +-
drivers/iio/proximity/d3323aa.c | 2 +-
drivers/iio/proximity/hx9023s.c | 16 +-
drivers/iio/proximity/irsd200.c | 2 +-
drivers/iio/proximity/mb1232.c | 4 +-
drivers/iio/proximity/srf04.c | 4 +-
drivers/iio/proximity/sx9360.c | 29 +-
drivers/iio/proximity/sx_common.c | 2 +-
drivers/iio/proximity/vcnl3020.c | 6 +-
drivers/iio/proximity/vl53l0x-i2c.c | 4 +-
drivers/iio/temperature/hid-sensor-temperature.c | 14 +-
drivers/infiniband/hw/ionic/ionic_lif_cfg.c | 2 +-
drivers/infiniband/hw/ionic/ionic_res.h | 23 +-
drivers/infiniband/hw/mlx5/devx.c | 6 +-
drivers/infiniband/hw/mlx5/main.c | 3 +-
drivers/infiniband/sw/siw/siw.h | 1 +
drivers/infiniband/sw/siw/siw_mem.c | 2 +-
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 8 +-
drivers/infiniband/ulp/srpt/ib_srpt.c | 21 +-
drivers/infiniband/ulp/srpt/ib_srpt.h | 4 +-
drivers/input/joystick/xpad.c | 5 +
drivers/input/misc/da7280.c | 1 -
drivers/input/mouse/cyapa.c | 4 +-
drivers/input/mouse/trackpoint.c | 2 +
drivers/input/mouse/trackpoint.h | 1 +
drivers/input/touchscreen/goodix_fwupload.c | 4 +-
drivers/iommu/iommufd/pages.c | 15 +-
drivers/irqchip/Kconfig | 2 +-
drivers/irqchip/irq-gic-v4.c | 39 ++-
drivers/md/dm-cache-target.c | 14 +-
drivers/md/dm-ioctl.c | 2 +-
drivers/md/dm-table.c | 146 +++++----
drivers/md/dm.c | 2 +-
drivers/md/dm.h | 18 +-
drivers/memory/tegra/tegra186.c | 1 +
drivers/memory/tegra/tegra210-emc-core.c | 16 +-
drivers/net/dsa/b53/b53_common.c | 209 +++++++++---
drivers/net/dsa/b53/b53_priv.h | 4 +
drivers/net/dsa/b53/b53_regs.h | 1 +
drivers/net/dsa/b53/b53_srab.c | 2 +-
drivers/net/dsa/bcm_sf2.c | 4 +
drivers/net/dsa/ocelot/felix.c | 13 +-
drivers/net/ethernet/broadcom/asp2/bcmasp.c | 2 +-
drivers/net/ethernet/broadcom/bcm4908_enet.c | 143 ++++++---
drivers/net/ethernet/broadcom/bcmsysport.c | 20 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 47 +++
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 19 +-
drivers/net/ethernet/broadcom/tg3.c | 43 ++-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 4 +-
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 28 +-
drivers/net/ethernet/freescale/gianfar.c | 1 +
drivers/net/ethernet/google/gve/gve.h | 7 +-
drivers/net/ethernet/google/gve/gve_adminq.c | 4 +-
.../net/ethernet/google/gve/gve_buffer_mgmt_dqo.c | 4 +-
drivers/net/ethernet/google/gve/gve_main.c | 49 ++-
drivers/net/ethernet/google/gve/gve_rx.c | 8 +-
drivers/net/ethernet/google/gve/gve_utils.c | 12 +-
drivers/net/ethernet/google/gve/gve_utils.h | 2 +-
drivers/net/ethernet/intel/e1000/e1000_main.c | 3 +-
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 9 +-
drivers/net/ethernet/intel/iavf/iavf_adminq.c | 1 +
drivers/net/ethernet/intel/iavf/iavf_main.c | 1 +
drivers/net/ethernet/intel/iavf/iavf_ptp.c | 12 +
drivers/net/ethernet/intel/ice/devlink/devlink.c | 2 +-
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 3 +-
.../net/ethernet/marvell/prestera/prestera_main.c | 17 +-
.../ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 +-
.../mellanox/mlx5/core/en_accel/en_accel.h | 5 +-
.../mellanox/mlx5/core/en_accel/ktls_txrx.h | 21 ++
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 +-
.../mellanox/mlx5/core/steering/hws/fs_hws.c | 2 +
.../mellanox/mlx5/core/steering/sws/dr_icm_pool.c | 32 +-
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 3 +-
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c | 3 +
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 89 ++++--
drivers/net/ethernet/microchip/encx24j600.c | 3 +-
drivers/net/ethernet/qualcomm/qca_spi.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 3 +-
.../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 8 +
.../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 6 +-
drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 8 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +-
drivers/net/hamradio/mkiss.c | 8 +
drivers/net/tun.c | 70 +++-
drivers/net/usb/smsc75xx.c | 8 +
drivers/net/wireless/ath/ath10k/core.c | 1 -
drivers/net/wireless/ath/ath10k/thermal.c | 9 +-
drivers/net/wireless/ath/ath10k/thermal.h | 2 -
drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 12 +-
drivers/net/wireless/realtek/rtw89/core.c | 12 -
drivers/net/wireless/virtual/mac80211_hwsim.c | 2 +-
drivers/nvme/common/auth.c | 6 +-
drivers/nvme/host/core.c | 11 +-
drivers/nvme/host/ioctl.c | 7 +-
drivers/nvme/host/multipath.c | 7 +
drivers/nvme/host/nvme.h | 13 +-
drivers/nvme/host/sysfs.c | 3 +
drivers/nvme/host/tcp.c | 172 ++++++++--
drivers/nvme/target/admin-cmd.c | 51 ++-
drivers/nvme/target/fabrics-cmd.c | 3 +
drivers/nvme/target/fc.c | 13 +-
drivers/nvme/target/fcloop.c | 2 +
drivers/nvme/target/io-cmd-file.c | 47 ++-
drivers/nvme/target/loop.c | 1 +
drivers/nvme/target/pr.c | 10 +-
drivers/nvme/target/tcp.c | 42 ++-
drivers/nvme/target/zns.c | 3 +-
drivers/phy/ingenic/phy-ingenic-usb.c | 1 -
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 9 +-
drivers/phy/ti/phy-ti-pipe3.c | 63 +++-
drivers/reset/reset-scmi.c | 1 +
drivers/reset/reset-spacemit.c | 18 +-
drivers/s390/block/dasd.c | 5 +-
drivers/s390/block/dasd_alias.c | 2 +-
drivers/s390/block/dasd_eckd.c | 66 ++--
drivers/s390/block/dasd_int.h | 17 +-
drivers/s390/block/dcssblk.c | 3 +-
drivers/scsi/ch.c | 6 +-
drivers/scsi/device_handler/scsi_dh_rdac.c | 6 +-
drivers/scsi/lpfc/lpfc_els.c | 29 +-
drivers/scsi/lpfc/lpfc_hbadisc.c | 11 +-
drivers/scsi/mpi3mr/mpi3mr.h | 1 +
drivers/scsi/mpi3mr/mpi3mr_fw.c | 18 ++
drivers/scsi/pm8001/pm8001_defs.h | 1 +
drivers/scsi/pm8001/pm8001_init.c | 15 +-
drivers/scsi/pm8001/pm80xx_hwi.c | 13 +-
drivers/scsi/sd_zbc.c | 9 +-
drivers/soundwire/qcom.c | 2 +
drivers/spi/spi-tegra210-quad.c | 164 +++++++---
drivers/spi/spi.c | 4 -
drivers/target/iscsi/iscsi_target.c | 22 +-
drivers/target/iscsi/iscsi_target_nego.c | 6 +-
drivers/target/target_core_alua.c | 7 +
drivers/target/target_core_configfs.c | 16 +-
drivers/ufs/core/ufs-sysfs.c | 97 ++++--
drivers/ufs/core/ufs_bsg.c | 4 +-
drivers/ufs/core/ufshcd-priv.h | 8 +-
drivers/ufs/core/ufshcd.c | 133 ++++----
drivers/ufs/host/ufs-mediatek.c | 10 +
drivers/usb/cdns3/cdns3-gadget.c | 6 +-
drivers/usb/dwc3/dwc3-xilinx.c | 166 ++++++----
drivers/usb/gadget/function/f_hid.c | 41 ++-
drivers/usb/gadget/function/f_uac1_legacy.c | 8 +-
drivers/usb/gadget/function/u_uac1_legacy.c | 17 +-
drivers/usb/typec/ucsi/ucsi_acpi.c | 34 ++
drivers/vhost/net.c | 2 +-
drivers/vhost/vhost.c | 12 +
drivers/video/console/vgacon.c | 2 +
drivers/video/fbdev/aty/radeon_base.c | 3 +
drivers/video/fbdev/core/fbcon.c | 41 ++-
drivers/video/fbdev/core/fbcon.h | 1 +
drivers/video/fbdev/fm2fb.c | 2 +-
drivers/video/fbdev/macmodes.c | 2 +-
drivers/video/fbdev/smscufx.c | 26 +-
drivers/video/fbdev/sstfb.c | 3 +
drivers/video/fbdev/valkyriefb.c | 3 +-
drivers/video/fbdev/vfb.c | 18 +-
drivers/w1/slaves/w1_therm.c | 8 +
drivers/watchdog/npcm_wdt.c | 19 +-
drivers/watchdog/rzg2l_wdt.c | 4 +-
drivers/watchdog/rzv2h_wdt.c | 12 +-
drivers/watchdog/stm32_iwdg.c | 29 +-
fs/btrfs/btrfs_inode.h | 6 +
fs/btrfs/delayed-inode.c | 3 +-
fs/btrfs/direct-io.c | 22 +-
fs/btrfs/fiemap.c | 2 +
fs/btrfs/file.c | 7 +-
fs/btrfs/inode.c | 4 +-
fs/btrfs/ioctl.c | 15 +-
fs/btrfs/reflink.c | 60 +++-
fs/btrfs/send.c | 98 +++++-
fs/btrfs/volumes.c | 9 +-
fs/btrfs/zstd.c | 8 +-
fs/crypto/keysetup.c | 14 +-
fs/direct-io.c | 15 +-
fs/ext4/ext4.h | 2 +-
fs/ext4/extents.c | 2 +-
fs/ext4/inline.c | 6 +
fs/ext4/inode.c | 36 +--
fs/ext4/move_extent.c | 1 +
fs/ext4/xattr.c | 12 +
fs/fuse/dev.c | 4 +-
fs/fuse/dev_uring.c | 7 +-
fs/fuse/dir.c | 12 +-
fs/fuse/file.c | 5 +
fs/fuse/readdir.c | 27 +-
fs/fuse/virtio_fs.c | 9 +-
fs/fuse/xattr.c | 2 +-
fs/hugetlbfs/inode.c | 2 +-
fs/jbd2/journal.c | 3 +
fs/nfs/flexfilelayout/flexfilelayout.c | 12 +
fs/nfs/flexfilelayout/flexfilelayout.h | 1 +
fs/ocfs2/dlmfs/userdlm.c | 12 +-
fs/ocfs2/dlmglue.c | 19 +-
fs/ocfs2/inode.c | 17 +-
fs/ocfs2/journal.c | 30 +-
fs/ocfs2/journal.h | 17 +-
fs/ocfs2/mmap.c | 12 +-
fs/ocfs2/ocfs2.h | 1 +
fs/ocfs2/super.c | 1 +
fs/overlayfs/dir.c | 12 +-
fs/overlayfs/namei.c | 352 ++++++++++++---------
fs/overlayfs/overlayfs.h | 15 +-
fs/overlayfs/params.c | 45 ++-
fs/overlayfs/params.h | 2 +
fs/overlayfs/super.c | 17 +-
fs/smb/client/cifs_fs_sb.h | 2 +
fs/smb/client/cifsacl.c | 6 +-
fs/smb/client/cifsfs.c | 20 +-
fs/smb/client/cifsglob.h | 6 +
fs/smb/client/cifsproto.h | 2 +
fs/smb/client/dfs.c | 77 ++++-
fs/smb/client/file.c | 139 +++++++-
fs/smb/client/misc.c | 6 +-
fs/smb/client/netmisc.c | 3 +-
fs/smb/client/readdir.c | 3 +-
fs/smb/client/smb2ops.c | 9 +-
fs/smb/client/smb2pdu.c | 123 ++++++-
fs/smb/client/smb2proto.h | 9 +
fs/smb/client/smb2transport.c | 7 +-
fs/smb/client/trace.h | 1 +
fs/smb/client/transport.c | 5 +
fs/smb/server/smb2pdu.c | 82 +++--
fs/smb/server/smb_common.c | 34 +-
fs/smb/server/smb_common.h | 5 +
fs/smb/server/smbacl.c | 9 +-
fs/smb/server/vfs.c | 4 +
fs/smb/server/vfs_cache.h | 2 +
fs/userfaultfd.c | 19 ++
fs/xfs/xfs_bmap_util.c | 11 +-
fs/xfs/xfs_rtalloc.c | 6 +-
fs/xfs/xfs_super.c | 2 +-
fs/zonefs/file.c | 9 +-
include/asm-generic/tlb.h | 4 +-
include/linux/arm-smccc.h | 7 +
include/linux/bpf.h | 31 +-
include/linux/cpufreq.h | 3 +
include/linux/efi.h | 3 +
include/linux/filter.h | 14 +-
include/linux/firmware/imx/sm.h | 6 +
include/linux/ftrace.h | 2 +-
include/linux/if_vlan.h | 25 +-
include/linux/iio/common/inv_sensors_timestamp.h | 43 +--
include/linux/io_uring/cmd.h | 22 +-
include/linux/io_uring_types.h | 1 -
include/linux/kasan.h | 15 +-
include/linux/key.h | 4 +-
include/linux/maple_tree.h | 48 +--
include/linux/mm.h | 128 ++++++--
include/linux/net.h | 2 +-
include/linux/nsc_gpio.h | 2 +-
include/linux/page-isolation.h | 2 +
include/linux/pageblock-flags.h | 6 +-
include/linux/perf_event.h | 1 +
include/linux/pgtable.h | 24 ++
include/linux/skbuff.h | 2 +
include/linux/tcp.h | 6 +-
include/linux/uprobes.h | 5 +
include/linux/userfaultfd_k.h | 5 +
include/net/ax25.h | 1 +
include/net/bluetooth/hci_core.h | 9 +-
include/net/bluetooth/l2cap.h | 1 +
include/net/codel.h | 5 +
include/net/codel_impl.h | 16 +-
include/net/dropreason-core.h | 9 +
include/net/inet_hashtables.h | 2 +
include/net/ip_vs.h | 2 +-
include/net/net_namespace.h | 1 +
include/net/netns/mpls.h | 2 +
include/net/netrom.h | 1 +
include/net/request_sock.h | 12 +-
include/net/rose.h | 1 +
include/net/sctp/auth.h | 3 +
include/scsi/scsi_proto.h | 3 +
include/trace/events/hugetlbfs.h | 2 +-
include/vdso/math64.h | 13 +-
io_uring/uring_cmd.c | 18 +-
kernel/bpf/arena.c | 13 +-
kernel/bpf/btf.c | 30 +-
kernel/bpf/cgroup.c | 25 +-
kernel/bpf/core.c | 12 +-
kernel/bpf/helpers.c | 52 ++-
kernel/bpf/inode.c | 10 +-
kernel/bpf/syscall.c | 33 +-
kernel/bpf/verifier.c | 39 ++-
kernel/cgroup/cpuset.c | 21 +-
kernel/cgroup/rstat.c | 1 +
kernel/dma/coherent.c | 11 +-
kernel/dma/pool.c | 11 +-
kernel/dma/swiotlb.c | 35 +-
kernel/events/core.c | 44 ++-
kernel/events/uprobes.c | 9 +
kernel/futex/core.c | 10 +-
kernel/kprobes.c | 55 +++-
kernel/rcu/tree_nocb.h | 6 +-
kernel/sched/core.c | 8 +-
kernel/sched/core_sched.c | 3 +-
kernel/sched/ext.c | 146 +++++----
kernel/sched/sched.h | 28 +-
kernel/trace/bpf_trace.c | 14 +-
kernel/trace/fgraph.c | 45 +--
kernel/trace/ring_buffer.c | 11 +-
kernel/trace/trace.c | 8 +-
kernel/trace/trace.h | 2 +
kernel/trace/trace_events_filter.c | 98 ++++--
kernel/trace/trace_events_hist.c | 25 +-
kernel/trace/trace_events_trigger.c | 2 +
kernel/trace/trace_events_user.c | 12 +
kernel/trace/trace_osnoise.c | 8 +
kernel/trace/trace_probe.c | 59 +++-
kernel/trace/trace_recursion_record.c | 17 +-
kernel/vhost_task.c | 9 +
kernel/workqueue.c | 9 +
lib/fault-inject.c | 8 +-
lib/maple_tree.c | 120 +++++--
lib/test_xarray.c | 70 ++++
lib/xarray.c | 8 +-
mm/damon/core.c | 5 +-
mm/damon/tests/sysfs-kunit.h | 9 +
mm/filemap.c | 35 +-
mm/gup.c | 32 +-
mm/huge_memory.c | 64 +++-
mm/hugetlb.c | 13 +-
mm/hugetlb_vmemmap.c | 36 +--
mm/internal.h | 25 +-
mm/kasan/common.c | 13 +-
mm/kasan/generic.c | 17 +-
mm/kasan/kasan.h | 34 +-
mm/kasan/kasan_test_c.c | 139 ++++++++
mm/khugepaged.c | 6 +
mm/memfd.c | 7 +
mm/memory.c | 46 ++-
mm/memory_hotplug.c | 18 +-
mm/mempolicy.c | 13 +-
mm/migrate.c | 21 ++
mm/mmu_gather.c | 10 +-
mm/mmzone.c | 10 +-
mm/page_alloc.c | 215 ++++++++++---
mm/page_isolation.c | 194 ++++++------
mm/rmap.c | 2 +-
mm/shmem.c | 7 +-
mm/slub.c | 13 +-
mm/swap.c | 26 ++
mm/swapfile.c | 5 +
mm/userfaultfd.c | 49 ++-
mm/vma.c | 28 +-
net/8021q/vlan_dev.c | 45 +--
net/8021q/vlan_netlink.c | 10 +-
net/8021q/vlanproc.c | 12 +-
net/ax25/af_ax25.c | 9 +
net/ax25/ax25_std_timer.c | 11 +-
net/ax25/ax25_subr.c | 27 ++
net/bluetooth/hci_conn.c | 105 ++++--
net/bluetooth/hci_core.c | 83 ++++-
net/bluetooth/hci_debugfs.c | 32 +-
net/bluetooth/hci_event.c | 9 +-
net/bluetooth/hci_sync.c | 31 +-
net/bluetooth/l2cap_core.c | 95 +++---
net/bluetooth/mgmt.c | 337 +++++++++++++++-----
net/bluetooth/mgmt_config.c | 10 +-
net/bluetooth/mgmt_util.c | 23 +-
net/bluetooth/msft.c | 118 +++++--
net/bluetooth/smp.c | 58 +++-
net/bridge/br_input.c | 18 +-
net/core/dev.c | 188 ++++++++---
net/core/dev.h | 2 +
net/core/filter.c | 23 +-
net/core/skbuff.c | 45 ++-
net/core/skmsg.c | 4 +-
net/core/sock.c | 4 +-
net/core/sock_reuseport.c | 16 +-
net/dsa/tag_brcm.c | 7 +-
net/ieee802154/socket.c | 4 +
net/ipv4/af_inet.c | 5 +-
net/ipv4/inet_connection_sock.c | 29 +-
net/ipv4/ip_fragment.c | 2 +
net/ipv4/ip_input.c | 6 +
net/ipv4/syncookies.c | 7 +
net/ipv4/tcp.c | 2 +
net/ipv4/tcp_input.c | 2 +-
net/ipv6/af_inet6.c | 8 +-
net/ipv6/calipso.c | 5 +-
net/ipv6/ip6_fib.c | 14 +-
net/ipv6/ip6_input.c | 4 +
net/ipv6/ip6_offload.c | 8 +
net/ipv6/ip6mr.c | 2 +-
net/ipv6/ipv6_sockglue.c | 95 ------
net/ipv6/mcast.c | 10 +-
net/ipv6/mcast_snoop.c | 3 +-
net/ipv6/route.c | 51 +--
net/ipv6/syncookies.c | 6 +
net/ipv6/udp.c | 7 +-
net/mac802154/llsec.c | 2 +
net/mpls/af_mpls.c | 37 ++-
net/mptcp/protocol.c | 3 +-
net/netfilter/ipvs/ip_vs_conn.c | 6 +-
net/netfilter/ipvs/ip_vs_ctl.c | 30 +-
net/netfilter/ipvs/ip_vs_ftp.c | 20 +-
net/netfilter/ipvs/ip_vs_lblc.c | 8 +-
net/netfilter/ipvs/ip_vs_lblcr.c | 13 +-
net/netfilter/ipvs/ip_vs_sync.c | 42 ++-
net/netlink/af_netlink.c | 42 ++-
net/netlink/diag.c | 18 +-
net/netrom/af_netrom.c | 7 +
net/netrom/nr_in.c | 107 +++++--
net/netrom/nr_out.c | 10 +
net/netrom/nr_timer.c | 9 +-
net/openvswitch/flow.c | 3 +-
net/packet/af_packet.c | 40 ++-
net/qrtr/ns.c | 21 +-
net/rose/af_rose.c | 5 +
net/rose/rose_in.c | 16 +-
net/rose/rose_out.c | 21 ++
net/rose/rose_timer.c | 10 +-
net/sched/bpf_qdisc.c | 27 ++
net/sctp/auth.c | 75 +++++
net/sctp/ipv6.c | 5 +-
net/sctp/sm_make_chunk.c | 3 +
net/sctp/socket.c | 12 +-
net/sunrpc/xprtrdma/frwr_ops.c | 89 ++++--
net/sunrpc/xprtrdma/transport.c | 2 +
net/sunrpc/xprtrdma/verbs.c | 16 +-
net/sunrpc/xprtrdma/xprt_rdma.h | 10 +-
net/tls/tls_device.c | 10 +-
net/xdp/xsk.c | 3 +-
net/xfrm/xfrm_interface_core.c | 8 +
net/xfrm/xfrm_output.c | 20 +-
rust/Makefile | 2 +-
rust/kernel/iov.rs | 2 +-
rust/kernel/str.rs | 4 +-
security/commoncap.c | 45 +--
security/keys/big_key.c | 16 +-
security/keys/key.c | 4 +
security/keys/keyctl_pkey.c | 124 ++++++--
security/keys/trusted-keys/trusted_core.c | 15 +-
security/landlock/errata/abi-4.h | 21 ++
security/landlock/ruleset.h | 13 +-
security/selinux/hooks.c | 5 +-
sound/core/oss/pcm_oss.c | 4 +-
sound/core/pcm_native.c | 63 ++--
sound/core/sound_oss.c | 35 +-
sound/firewire/fcp.c | 5 +-
sound/firewire/fireworks/fireworks_transaction.c | 4 +-
sound/hda/codecs/realtek/alc269.c | 7 +-
sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 1 +
sound/hda/controllers/intel.c | 5 +-
sound/soc/amd/acp/acp-legacy-common.c | 5 +-
sound/soc/codecs/aw88166.c | 2 +-
sound/soc/codecs/aw88399-lib.c | 2 +-
sound/soc/codecs/wm8962.c | 2 +-
sound/soc/fsl/fsl_asrc.c | 22 ++
sound/soc/fsl/fsl_asrc_m2m.c | 30 +-
sound/soc/fsl/fsl_easrc.c | 10 +
sound/soc/qcom/qdsp6/audioreach.c | 10 +-
sound/soc/qcom/qdsp6/q6apm-dai.c | 3 +
sound/soc/qcom/qdsp6/q6asm-dai.c | 3 +
sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c | 14 +-
sound/soc/qcom/qdsp6/topology.c | 4 +-
sound/soc/sof/control.c | 5 +
sound/soc/sof/intel/lnl.c | 17 +-
sound/usb/quirks.c | 2 +-
tools/bootconfig/main.c | 29 +-
tools/bootconfig/samples/exp-good-mixed-kv1.bconf | 7 +
tools/bootconfig/samples/good-mixed-kv1.bconf | 5 +
tools/bootconfig/scripts/bconf2ftrace.sh | 21 +-
tools/bootconfig/scripts/ftrace2bconf.sh | 5 +-
tools/bootconfig/test-bootconfig.sh | 6 +
tools/gpio/gpio-event-mon.c | 4 +-
tools/gpio/gpio-hammer.c | 4 +-
tools/gpio/lsgpio.c | 3 +-
tools/objtool/check.c | 4 +
tools/perf/builtin-record.c | 4 +-
tools/testing/radix-tree/maple.c | 13 +-
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 7 +
.../selftests/damon/sysfs_memcg_path_leak.sh | 3 +
.../selftests/drivers/s390x/uvdevice/Makefile | 19 +-
tools/testing/selftests/landlock/fs_test.c | 54 ++++
tools/testing/shared/maple-shared.h | 33 ++
tools/testing/vma/vma_internal.h | 4 +
682 files changed, 10277 insertions(+), 4044 deletions(-)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 001/703] drm/gem-dma: Support dedicated DMA device for allocation and mapping
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 002/703] mpls: add seqcount to protect the platform_label{,s} pair Greg Kroah-Hartman
` (406 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Zimmermann,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Maíra Canal,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <wenst@chromium.org>
[ Upstream commit a9da24732aaa80d631bffc8a1390836d4b896690 ]
Support for a dedicated DMA device for prime imports was added in commit
143ec8d3f939 ("drm/prime: Support dedicated DMA device for dma-buf imports").
This allowed the DRM driver to provide a dedicated DMA device when its
own underlying device was not capable of DMA, for example when it is a
USB device (the original target) or a virtual device. The latter case is
common on embedded SoCs, on which the display pipeline is composed of
various fixed function blocks, and the DRM device is simply a made-up
device, an address space managing the routing between the blocks, or
whichever block the implementor thought made sense at the time. The
point is that the chosen device is often not the actual device doing
the DMA. Various drivers have used workarounds or reimplemented the
GEM DMA helpers to get the DMA addresses and IOMMUs to work correctly.
Add support for the dedicated DMA device to the GEM DMA helpers.
No existing driver currently uses the GEM DMA helpers and calls
drm_dev_set_dma_dev() to set a dedicated DMA device, so no existing
users should be affected.
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20260311094929.3393338-3-wenst@chromium.org
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/drm_gem_dma_helper.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c
index 4f0320df858f8..55246a59e8bb8 100644
--- a/drivers/gpu/drm/drm_gem_dma_helper.c
+++ b/drivers/gpu/drm/drm_gem_dma_helper.c
@@ -144,12 +144,13 @@ struct drm_gem_dma_object *drm_gem_dma_create(struct drm_device *drm,
return dma_obj;
if (dma_obj->map_noncoherent) {
- dma_obj->vaddr = dma_alloc_noncoherent(drm->dev, size,
+ dma_obj->vaddr = dma_alloc_noncoherent(drm_dev_dma_dev(drm),
+ size,
&dma_obj->dma_addr,
DMA_TO_DEVICE,
GFP_KERNEL | __GFP_NOWARN);
} else {
- dma_obj->vaddr = dma_alloc_wc(drm->dev, size,
+ dma_obj->vaddr = dma_alloc_wc(drm_dev_dma_dev(drm), size,
&dma_obj->dma_addr,
GFP_KERNEL | __GFP_NOWARN);
}
@@ -234,12 +235,14 @@ void drm_gem_dma_free(struct drm_gem_dma_object *dma_obj)
drm_prime_gem_destroy(gem_obj, dma_obj->sgt);
} else if (dma_obj->vaddr) {
if (dma_obj->map_noncoherent)
- dma_free_noncoherent(gem_obj->dev->dev, dma_obj->base.size,
+ dma_free_noncoherent(drm_dev_dma_dev(gem_obj->dev),
+ dma_obj->base.size,
dma_obj->vaddr, dma_obj->dma_addr,
DMA_TO_DEVICE);
else
- dma_free_wc(gem_obj->dev->dev, dma_obj->base.size,
- dma_obj->vaddr, dma_obj->dma_addr);
+ dma_free_wc(drm_dev_dma_dev(gem_obj->dev),
+ dma_obj->base.size, dma_obj->vaddr,
+ dma_obj->dma_addr);
}
drm_gem_object_release(gem_obj);
@@ -428,7 +431,7 @@ struct sg_table *drm_gem_dma_get_sg_table(struct drm_gem_dma_object *dma_obj)
if (!sgt)
return ERR_PTR(-ENOMEM);
- ret = dma_get_sgtable(obj->dev->dev, sgt, dma_obj->vaddr,
+ ret = dma_get_sgtable(drm_dev_dma_dev(obj->dev), sgt, dma_obj->vaddr,
dma_obj->dma_addr, obj->size);
if (ret < 0)
goto out;
@@ -535,12 +538,12 @@ int drm_gem_dma_mmap(struct drm_gem_dma_object *dma_obj, struct vm_area_struct *
if (dma_obj->map_noncoherent) {
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
- ret = dma_mmap_pages(dma_obj->base.dev->dev,
+ ret = dma_mmap_pages(drm_dev_dma_dev(dma_obj->base.dev),
vma, vma->vm_end - vma->vm_start,
virt_to_page(dma_obj->vaddr));
} else {
- ret = dma_mmap_wc(dma_obj->base.dev->dev, vma, dma_obj->vaddr,
- dma_obj->dma_addr,
+ ret = dma_mmap_wc(drm_dev_dma_dev(dma_obj->base.dev), vma,
+ dma_obj->vaddr, dma_obj->dma_addr,
vma->vm_end - vma->vm_start);
}
if (ret)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 002/703] mpls: add seqcount to protect the platform_label{,s} pair
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 001/703] drm/gem-dma: Support dedicated DMA device for allocation and mapping Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 003/703] netlink: do not free nlk->groups while lockless readers can use it Greg Kroah-Hartman
` (405 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Tan, Yifan Wu, Juefei Pu,
Xin Liu, Sabrina Dubroca, Jakub Kicinski, Artem Dinaburg,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <sd@queasysnail.net>
[ Upstream commit 629ec78ef8608d955ce217880cdc3e1873af3a15 ]
The RCU-protected codepaths (mpls_forward, mpls_dump_routes) can have
an inconsistent view of platform_labels vs platform_label in case of a
concurrent resize (resize_platform_label_table, under
platform_mutex). This can lead to OOB accesses.
This patch adds a seqcount, so that we get a consistent snapshot.
Note that mpls_label_ok is also susceptible to this, so the check
against RTA_DST in rtm_to_route_config, done outside platform_mutex,
is not sufficient. This value gets passed to mpls_label_ok once more
in both mpls_route_add and mpls_route_del, so there is no issue, but
that additional check must not be removed.
Reported-by: Yuan Tan <tanyuan98@outlook.com>
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Fixes: 7720c01f3f590 ("mpls: Add a sysctl to control the size of the mpls label table")
Fixes: dde1b38e873c ("mpls: Convert mpls_dump_routes() to RCU.")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/cd8fca15e3eb7e212b094064cd83652e20fd9d31.1774284088.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: 6.18.y has neither the per-netns platform_mutex
(upstream e833eb25161a) nor the RCU conversion of mpls_dump_routes()
(upstream dde1b38e873c); resize_platform_label_table() is serialized
by RTNL. Use a plain seqcount_t instead of seqcount_mutex_t and
disable preemption explicitly around the write section, since
local_bh_disable() does not do so on PREEMPT_RT. Keep
rcu_dereference_rtnl() in the helper because mpls_getroute() reaches
it under RTNL without rcu_read_lock(). mpls_dump_routes() still runs
under RTNL, so it is left unchanged. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/netns/mpls.h | 2 ++
net/mpls/af_mpls.c | 37 ++++++++++++++++++++++++++++++-------
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/include/net/netns/mpls.h b/include/net/netns/mpls.h
index 19ad2574b267c..9b83b7f43d83b 100644
--- a/include/net/netns/mpls.h
+++ b/include/net/netns/mpls.h
@@ -7,6 +7,7 @@
#define __NETNS_MPLS_H__
#include <linux/types.h>
+#include <linux/seqlock.h>
struct mpls_route;
struct ctl_table_header;
@@ -16,6 +17,7 @@ struct netns_mpls {
int default_ttl;
size_t platform_labels;
struct mpls_route __rcu * __rcu *platform_label;
+ seqcount_t platform_label_seq;
struct ctl_table_header *ctl;
};
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 608c43a4602d6..9ed136931c4f1 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -75,16 +75,31 @@ static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt,
struct nlmsghdr *nlh, struct net *net, u32 portid,
unsigned int nlm_flags);
+static struct mpls_route __rcu **mpls_platform_label_rcu(struct net *net, size_t *platform_labels)
+{
+ struct mpls_route __rcu **platform_label;
+ unsigned int sequence;
+
+ do {
+ sequence = read_seqcount_begin(&net->mpls.platform_label_seq);
+ platform_label = rcu_dereference_rtnl(net->mpls.platform_label);
+ *platform_labels = net->mpls.platform_labels;
+ } while (read_seqcount_retry(&net->mpls.platform_label_seq, sequence));
+
+ return platform_label;
+}
+
static struct mpls_route *mpls_route_input_rcu(struct net *net, unsigned index)
{
- struct mpls_route *rt = NULL;
+ struct mpls_route __rcu **platform_label;
+ size_t platform_labels;
- if (index < net->mpls.platform_labels) {
- struct mpls_route __rcu **platform_label =
- rcu_dereference_rtnl(net->mpls.platform_label);
- rt = rcu_dereference_rtnl(platform_label[index]);
- }
- return rt;
+ platform_label = mpls_platform_label_rcu(net, &platform_labels);
+
+ if (index >= platform_labels)
+ return NULL;
+
+ return rcu_dereference_rtnl(platform_label[index]);
}
bool mpls_output_possible(const struct net_device *dev)
@@ -2582,8 +2597,14 @@ static int resize_platform_label_table(struct net *net, size_t limit)
}
/* Update the global pointers */
+ local_bh_disable();
+ preempt_disable();
+ write_seqcount_begin(&net->mpls.platform_label_seq);
net->mpls.platform_labels = limit;
rcu_assign_pointer(net->mpls.platform_label, labels);
+ write_seqcount_end(&net->mpls.platform_label_seq);
+ preempt_enable();
+ local_bh_enable();
rtnl_unlock();
@@ -2664,6 +2685,8 @@ static int mpls_net_init(struct net *net)
struct ctl_table *table;
int i;
+ seqcount_init(&net->mpls.platform_label_seq);
+
net->mpls.platform_labels = 0;
net->mpls.platform_label = NULL;
net->mpls.ip_ttl_propagate = 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 003/703] netlink: do not free nlk->groups while lockless readers can use it
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 001/703] drm/gem-dma: Support dedicated DMA device for allocation and mapping Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 002/703] mpls: add seqcount to protect the platform_label{,s} pair Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 004/703] net: init shinfo->gso_segs from qdisc_pkt_len_init() Greg Kroah-Hartman
` (404 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Burton, Eric Dumazet,
Jakub Kicinski, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit ceac0de741bfb47ca255eee075257b3bb31f0651 ]
netlink_realloc_groups() uses krealloc() under netlink_table_grab().
Whenever NLGRPSZ(groups) lands in a different kmalloc bucket, the old
bitmap is freed immediately.
Two readers of nlk->groups / nlk->ngroups do not hold the netlink
table lock:
1) sk_diag_dump_groups(). Hashed (bound) sockets are dumped from the
rhashtable walk in __netlink_diag_dump(), which only holds RCU.
Only the mc_list part of the dump takes nl_table_lock.
2) netlink_native_seq_show() (/proc/net/netlink), whose walk has been
lockless since commit 21e4902aea80 ("netlink: Lockless lookup with
RCU grace period in socket release").
Both can read a freed buffer, and sk_diag_dump_groups() can also read
past the end of the old (smaller) buffer if it happens to load the old
@groups pointer together with the new @ngroups value, copying the
result into a NETLINK_DIAG_GROUPS attribute.
This is the same class of bug that commit f773608026ee ("netlink:
access nlk groups safely in netlink bind and getname") fixed for bind()
and getname(); these two readers were missed. Simply grabbing the table
lock in sk_diag_dump_groups() is not an option, because it is also
called with nl_table_lock already held from the mc_list section of the
dump.
Make the lockless readers safe instead:
- Allocate a new bitmap and free the old one after an RCU grace period,
instead of relying on the implicit kfree() done by krealloc().
- Publish @groups before @ngroups, both with release semantics, and have
the lockless readers load @ngroups first. A reader can then never pair
the new (bigger) size with the old (smaller) buffer, and a reader
picking up the new pointer while still seeing the old size is
guaranteed to see the initialized bitmap.
netlink_realloc_groups() is called from process context (bind() and
setsockopt()), so kfree_rcu_mightsleep() can be used, once the table
has been released.
Fixes: 21e4902aea80 ("netlink: Lockless lookup with RCU grace period in socket release")
Fixes: ad202074320c ("netlink: Use rhashtable walk interface in diag dump")
Reported-by: James Burton <jamesburton@meta.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260911160804.917099-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: context adjusted in netlink_native_seq_show(),
where 6.18.y prints sock_i_ino() with "%-8lu" instead of "%-8llu";
the code change is identical to upstream. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netlink/af_netlink.c | 42 ++++++++++++++++++++++++++++++++--------
net/netlink/diag.c | 20 +++++++++++++++----
2 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 9e1f64f18e3f8..83e5780afd4c1 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -923,9 +923,9 @@ netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
static int netlink_realloc_groups(struct sock *sk)
{
+ unsigned long *new_groups, *old_groups = NULL;
struct netlink_sock *nlk = nlk_sk(sk);
unsigned int groups;
- unsigned long *new_groups;
int err = 0;
netlink_table_grab();
@@ -939,18 +939,37 @@ static int netlink_realloc_groups(struct sock *sk)
if (nlk->ngroups >= groups)
goto out_unlock;
- new_groups = krealloc(nlk->groups, NLGRPSZ(groups), GFP_ATOMIC);
- if (new_groups == NULL) {
+ /* Can not use krealloc(), because the old buffer might be freed
+ * immediately, while lockless readers (netlink diag dump and
+ * /proc/net/netlink) can still be looking at it.
+ */
+ new_groups = kzalloc(NLGRPSZ(groups), GFP_ATOMIC);
+ if (!new_groups) {
err = -ENOMEM;
goto out_unlock;
}
- memset((char *)new_groups + NLGRPSZ(nlk->ngroups), 0,
- NLGRPSZ(groups) - NLGRPSZ(nlk->ngroups));
+ old_groups = nlk->groups;
+ if (old_groups)
+ memcpy(new_groups, old_groups, NLGRPSZ(nlk->ngroups));
+
+ /* Publish the new bitmap and its content: pairs with the address
+ * dependency in lockless readers, which can pick up the new pointer
+ * while still seeing the old (smaller) nlk->ngroups.
+ */
+ smp_store_release(&nlk->groups, new_groups);
+
+ /* Then publish the new size: pairs with smp_load_acquire() from
+ * lockless readers, so that they can not read NLGRPSZ(new ngroups)
+ * bytes from the old buffer.
+ */
+ smp_store_release(&nlk->ngroups, groups);
- nlk->groups = new_groups;
- nlk->ngroups = groups;
out_unlock:
netlink_table_ungrab();
+
+ if (old_groups)
+ kfree_rcu_mightsleep(old_groups);
+
return err;
}
@@ -2719,12 +2738,19 @@ static int netlink_native_seq_show(struct seq_file *seq, void *v)
} else {
struct sock *s = v;
struct netlink_sock *nlk = nlk_sk(s);
+ const unsigned long *groups;
+
+ /* Lockless read : netlink_realloc_groups() can change
+ * nlk->groups under us. The old buffer is freed after an
+ * RCU grace period, and this walk is RCU protected.
+ */
+ groups = READ_ONCE(nlk->groups);
seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n",
s,
s->sk_protocol,
nlk->portid,
- nlk->groups ? (u32)nlk->groups[0] : 0,
+ groups ? (u32)groups[0] : 0,
sk_rmem_alloc_get(s),
sk_wmem_alloc_get(s),
READ_ONCE(nlk->cb_running),
diff --git a/net/netlink/diag.c b/net/netlink/diag.c
index b8e58132e8af1..16de6618e0bea 100644
--- a/net/netlink/diag.c
+++ b/net/netlink/diag.c
@@ -12,12 +12,24 @@
static int sk_diag_dump_groups(struct sock *sk, struct sk_buff *nlskb)
{
struct netlink_sock *nlk = nlk_sk(sk);
-
- if (nlk->groups == NULL)
+ unsigned long *groups;
+ unsigned int ngroups;
+
+ /* Hashed sockets are dumped from the rhashtable walk, which only
+ * holds rcu_read_lock(), while netlink_realloc_groups() can replace
+ * nlk->groups and nlk->ngroups at any time.
+ *
+ * Read nlk->ngroups first : this pairs with smp_store_release()
+ * from netlink_realloc_groups(), so that we can not use the new
+ * (bigger) size with the old (smaller) buffer. The old buffer is
+ * freed after an RCU grace period.
+ */
+ ngroups = smp_load_acquire(&nlk->ngroups);
+ groups = READ_ONCE(nlk->groups);
+ if (!groups)
return 0;
- return nla_put(nlskb, NETLINK_DIAG_GROUPS, NLGRPSZ(nlk->ngroups),
- nlk->groups);
+ return nla_put(nlskb, NETLINK_DIAG_GROUPS, NLGRPSZ(ngroups), groups);
}
static int sk_diag_put_flags(struct sock *sk, struct sk_buff *skb)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 004/703] net: init shinfo->gso_segs from qdisc_pkt_len_init()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (2 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 003/703] netlink: do not free nlk->groups while lockless readers can use it Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 005/703] net: pull headers in qdisc_pkt_len_segs_init() Greg Kroah-Hartman
` (403 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Paolo Abeni,
Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit be1b70ab21cbe8f8bb8ecf39eb34880882252773 ]
Qdisc use shinfo->gso_segs for their pkts stats in bstats_update(),
but this field needs to be initialized for SKB_GSO_DODGY users.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20251121083256.674562-3-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 7fb4c1967011 ("net: pull headers in qdisc_pkt_len_segs_init()")
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 91da33c29aa18..4c907f483ca42 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4138,7 +4138,7 @@ EXPORT_SYMBOL_GPL(validate_xmit_skb_list);
static void qdisc_pkt_len_init(struct sk_buff *skb)
{
- const struct skb_shared_info *shinfo = skb_shinfo(skb);
+ struct skb_shared_info *shinfo = skb_shinfo(skb);
qdisc_skb_cb(skb)->pkt_len = skb->len;
@@ -4179,6 +4179,7 @@ static void qdisc_pkt_len_init(struct sk_buff *skb)
if (payload <= 0)
return;
gso_segs = DIV_ROUND_UP(payload, shinfo->gso_size);
+ shinfo->gso_segs = gso_segs;
}
qdisc_skb_cb(skb)->pkt_len += (gso_segs - 1) * hdr_len;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 005/703] net: pull headers in qdisc_pkt_len_segs_init()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (3 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 004/703] net: init shinfo->gso_segs from qdisc_pkt_len_init() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 006/703] xfrm: Dont clobber inner headers when already set Greg Kroah-Hartman
` (402 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Joe Damato,
Jakub Kicinski, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 7fb4c19670110f052c04e1ec1d2b953b9f4f57e4 ]
Most ndo_start_xmit() methods expects headers of gso packets
to be already in skb->head.
net/core/tso.c users are particularly at risk, because tso_build_hdr()
does a memcpy(hdr, skb->data, hdr_len);
qdisc_pkt_len_segs_init() already does a dissection of gso packets.
Use pskb_may_pull() instead of skb_header_pointer() to make
sure drivers do not have to reimplement this.
Some malicious packets could be fed, detect them so that we can
drop them sooner with a new SKB_DROP_REASON_SKB_BAD_GSO drop_reason.
Fixes: e876f208af18 ("net: Add a software TSO helper API")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260403221540.3297753-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: 6.18.y lacks the qdisc_pkt_len_segs_init() rename
with per-skb pkt_segs accounting and the preceding no-functional-change
cleanup 30e02ec3b4b6 ("net: qdisc_pkt_len_segs_init() cleanup"), so the
upstream result is applied to qdisc_pkt_len_init() without the pkt_segs
lines. In 6.18.y only __dev_queue_xmit() calls the function, so only
that caller handles the returned drop reason. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/dropreason-core.h | 3 ++
net/core/dev.c | 83 +++++++++++++++++++++--------------
2 files changed, 52 insertions(+), 34 deletions(-)
diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index 811057ae8ed25..ab36e3eded67e 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -79,6 +79,7 @@
FN(UNHANDLED_PROTO) \
FN(SKB_CSUM) \
FN(SKB_GSO_SEG) \
+ FN(SKB_BAD_GSO) \
FN(SKB_UCOPY_FAULT) \
FN(DEV_HDR) \
FN(DEV_READY) \
@@ -422,6 +423,8 @@ enum skb_drop_reason {
SKB_DROP_REASON_SKB_CSUM,
/** @SKB_DROP_REASON_SKB_GSO_SEG: gso segmentation error */
SKB_DROP_REASON_SKB_GSO_SEG,
+ /** @SKB_DROP_REASON_SKB_BAD_GSO: malicious gso packet. */
+ SKB_DROP_REASON_SKB_BAD_GSO,
/**
* @SKB_DROP_REASON_SKB_UCOPY_FAULT: failed to copy data from user space,
* e.g., via zerocopy_sg_from_iter() or skb_orphan_frags_rx()
diff --git a/net/core/dev.c b/net/core/dev.c
index 4c907f483ca42..792cc34fc218a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4136,53 +4136,63 @@ struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *d
}
EXPORT_SYMBOL_GPL(validate_xmit_skb_list);
-static void qdisc_pkt_len_init(struct sk_buff *skb)
+static enum skb_drop_reason qdisc_pkt_len_init(struct sk_buff *skb)
{
struct skb_shared_info *shinfo = skb_shinfo(skb);
+ unsigned int hdr_len, tlen;
+ u16 gso_segs;
qdisc_skb_cb(skb)->pkt_len = skb->len;
+ if (!shinfo->gso_size)
+ return SKB_NOT_DROPPED_YET;
+
+ gso_segs = shinfo->gso_segs;
/* To get more precise estimation of bytes sent on wire,
* we add to pkt_len the headers size of all segments
*/
- if (shinfo->gso_size && skb_transport_header_was_set(skb)) {
- u16 gso_segs = shinfo->gso_segs;
- unsigned int hdr_len;
-
- /* mac layer + network layer */
- if (!skb->encapsulation)
- hdr_len = skb_transport_offset(skb);
- else
- hdr_len = skb_inner_transport_offset(skb);
- /* + transport layer */
- if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
- const struct tcphdr *th;
- struct tcphdr _tcphdr;
+ /* mac layer + network layer */
+ if (!skb->encapsulation) {
+ if (unlikely(!skb_transport_header_was_set(skb)))
+ return SKB_NOT_DROPPED_YET;
+ hdr_len = skb_transport_offset(skb);
+ } else {
+ hdr_len = skb_inner_transport_offset(skb);
+ }
+ /* + transport layer */
+ if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
+ const struct tcphdr *th;
- th = skb_header_pointer(skb, hdr_len,
- sizeof(_tcphdr), &_tcphdr);
- if (likely(th))
- hdr_len += __tcp_hdrlen(th);
- } else if (shinfo->gso_type & SKB_GSO_UDP_L4) {
- struct udphdr _udphdr;
+ if (!pskb_may_pull(skb, hdr_len + sizeof(struct tcphdr)))
+ return SKB_DROP_REASON_SKB_BAD_GSO;
- if (skb_header_pointer(skb, hdr_len,
- sizeof(_udphdr), &_udphdr))
- hdr_len += sizeof(struct udphdr);
- }
+ th = (const struct tcphdr *)(skb->data + hdr_len);
+ tlen = __tcp_hdrlen(th);
+ if (tlen < sizeof(*th))
+ return SKB_DROP_REASON_SKB_BAD_GSO;
+ hdr_len += tlen;
+ if (!pskb_may_pull(skb, hdr_len))
+ return SKB_DROP_REASON_SKB_BAD_GSO;
+ } else if (shinfo->gso_type & SKB_GSO_UDP_L4) {
+ if (!pskb_may_pull(skb, hdr_len + sizeof(struct udphdr)))
+ return SKB_DROP_REASON_SKB_BAD_GSO;
+ hdr_len += sizeof(struct udphdr);
+ }
- if (unlikely(shinfo->gso_type & SKB_GSO_DODGY)) {
- int payload = skb->len - hdr_len;
+ /* prior pskb_may_pull() might have changed skb->head. */
+ shinfo = skb_shinfo(skb);
+ if (unlikely(shinfo->gso_type & SKB_GSO_DODGY)) {
+ int payload = skb->len - hdr_len;
- /* Malicious packet. */
- if (payload <= 0)
- return;
- gso_segs = DIV_ROUND_UP(payload, shinfo->gso_size);
- shinfo->gso_segs = gso_segs;
- }
- qdisc_skb_cb(skb)->pkt_len += (gso_segs - 1) * hdr_len;
+ /* Malicious packet. */
+ if (payload <= 0)
+ return SKB_DROP_REASON_SKB_BAD_GSO;
+ gso_segs = DIV_ROUND_UP(payload, shinfo->gso_size);
+ shinfo->gso_segs = gso_segs;
}
+ qdisc_skb_cb(skb)->pkt_len += (gso_segs - 1) * hdr_len;
+ return SKB_NOT_DROPPED_YET;
}
static int dev_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *q,
@@ -4772,6 +4782,12 @@ int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
(SKBTX_SCHED_TSTAMP | SKBTX_BPF)))
__skb_tstamp_tx(skb, NULL, NULL, skb->sk, SCM_TSTAMP_SCHED);
+ reason = qdisc_pkt_len_init(skb);
+ if (unlikely(reason)) {
+ dev_core_stats_tx_dropped_inc(dev);
+ kfree_skb_reason(skb, reason);
+ return -EINVAL;
+ }
/* Disable soft irqs for various locks below. Also
* stops preemption for RCU.
*/
@@ -4779,7 +4795,6 @@ int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
skb_update_prio(skb);
- qdisc_pkt_len_init(skb);
tcx_set_ingress(skb, false);
#ifdef CONFIG_NET_EGRESS
if (static_branch_unlikely(&egress_needed_key)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 006/703] xfrm: Dont clobber inner headers when already set
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (4 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 005/703] net: pull headers in qdisc_pkt_len_segs_init() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 007/703] net: harden qdisc_pkt_len_segs_init() against malicious GSO packets Greg Kroah-Hartman
` (401 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cosmin Ratiu, Steffen Klassert,
Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <cratiu@nvidia.com>
[ Upstream commit fa90a3145c0340c3f624206a81637c542254ea1d ]
On VXLAN over IPsec egress, xfrm{4,6}_transport_output() blindly
overwrite inner_transport_header (== the inner TCP header saved in VXLAN
iptunnel_handle_offloads() -> skb_reset_inner_headers()) with the
current transport_header (== the VXLAN outer UDP header set by
udp_tunnel_xmit_skb()).
This was a latent bug, harmless until commit [1] added a doff validation
check in qdisc_pkt_len_segs_init() for encapsulated GSO packets. With
the wrong inner_transport_header set by xfrm, qdisc_pkt_len_segs_init()
interprets inner_transport_header as a TCP header, reads doff=0 from the
upper byte of the VNI and drops the packet with DROP_REASON_SKB_BAD_GSO.
Besides the use in GSO to determine the header size of segmented
packets, inner_transport_header might be used by drivers to set up
inner checksum offloading by pointing the HW to the inner transport
header. A quick browse through available drivers shows that mlx5 uses
skb->csum_start specifically for this scenario, while others either
don't support VXLAN over IPsec crypto offload (ixgbe) or the HW is
capable of parsing the packets itself (nfp, Chelsio).
But in all cases, it is more correct to let the inner_transport_header
point to the innermost header instead of overwriting it in xfrm.
So fix this by guarding all four inner header save sites in
xfrm_output.c (xfrm{4,6}_transport_output, xfrm{4,6}_tunnel_encap_add)
with a check for skb->inner_protocol. When inner_protocol is set, a
tunnel layer (VXLAN, Geneve, GRE, etc.) has already saved the correct
inner header offsets and they must not be overwritten. When
inner_protocol is zero, no prior tunnel encapsulation exists and xfrm
must save the inner headers itself. The tunnel mode checks are only
added for completion, since they aren't strictly required, as
xfrm_output() forces software GSO in tunnel mode before encap.
This makes the previously added test pass:
# ./tools/testing/selftests/drivers/net/hw/ipsec_vxlan.py
TAP version 13
1..4
ok 1 ipsec_vxlan.test_vxlan_ipsec_crypto_offload.outer_v4_inner_v4
ok 2 ipsec_vxlan.test_vxlan_ipsec_crypto_offload.outer_v4_inner_v6
ok 3 ipsec_vxlan.test_vxlan_ipsec_crypto_offload.outer_v6_inner_v4
ok 4 ipsec_vxlan.test_vxlan_ipsec_crypto_offload.outer_v6_inner_v6
# Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0
[1] commit 7fb4c1967011 ("net: pull headers in qdisc_pkt_len_segs_init()")
Fixes: f1bd7d659ef0 ("xfrm: Add encapsulation header offsets while SKB is not encrypted")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xfrm/xfrm_output.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 262eea7bdea30..433ce19c29002 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -67,7 +67,9 @@ static int xfrm4_transport_output(struct xfrm_state *x, struct sk_buff *skb)
struct iphdr *iph = ip_hdr(skb);
int ihl = iph->ihl * 4;
- skb_set_inner_transport_header(skb, skb_transport_offset(skb));
+ if (!skb->inner_protocol)
+ skb_set_inner_transport_header(skb,
+ skb_transport_offset(skb));
skb_set_network_header(skb, -x->props.header_len);
skb->mac_header = skb->network_header +
@@ -168,7 +170,9 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
int hdr_len;
iph = ipv6_hdr(skb);
- skb_set_inner_transport_header(skb, skb_transport_offset(skb));
+ if (!skb->inner_protocol)
+ skb_set_inner_transport_header(skb,
+ skb_transport_offset(skb));
hdr_len = xfrm6_hdr_offset(x, skb, &prevhdr);
if (hdr_len < 0)
@@ -277,8 +281,10 @@ static int xfrm4_tunnel_encap_add(struct xfrm_state *x, struct sk_buff *skb)
struct iphdr *top_iph;
int flags;
- skb_set_inner_network_header(skb, skb_network_offset(skb));
- skb_set_inner_transport_header(skb, skb_transport_offset(skb));
+ if (!skb->inner_protocol) {
+ skb_set_inner_network_header(skb, skb_network_offset(skb));
+ skb_set_inner_transport_header(skb, skb_transport_offset(skb));
+ }
skb_set_network_header(skb, -x->props.header_len);
skb->mac_header = skb->network_header +
@@ -322,8 +328,10 @@ static int xfrm6_tunnel_encap_add(struct xfrm_state *x, struct sk_buff *skb)
struct ipv6hdr *top_iph;
int dsfield;
- skb_set_inner_network_header(skb, skb_network_offset(skb));
- skb_set_inner_transport_header(skb, skb_transport_offset(skb));
+ if (!skb->inner_protocol) {
+ skb_set_inner_network_header(skb, skb_network_offset(skb));
+ skb_set_inner_transport_header(skb, skb_transport_offset(skb));
+ }
skb_set_network_header(skb, -x->props.header_len);
skb->mac_header = skb->network_header +
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 007/703] net: harden qdisc_pkt_len_segs_init() against malicious GSO packets
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (5 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 006/703] xfrm: Dont clobber inner headers when already set Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 008/703] net: reject a negative TCP header offset in qdisc_pkt_len_segs_init() Greg Kroah-Hartman
` (400 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, shaos, Eric Dumazet,
Jamal Hadi Salim, Michael S. Tsirkin, Willem de Bruijn,
Jakub Kicinski, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit c6648c9f3b51c5a8a3df470c1542b2aa378d88f9 ]
An SKB_GSO_DODGY packet can carry untrusted gso_size and headers.
For instance, gso_size=1 and hdr_len=65532 for a 524275-byte frame
makes qdisc_pkt_len_segs_init() compute an accounted length of
about 4,294,574,091 bytes (after gso_segs silently wrapped in a u16).
With DRR quantum 256, the dequeue path then needs ~16.8 million
deficit refills before it can dequeue the skb, keeping the CPU in
the qdisc path long enough to trigger the soft-lockup watchdog.
Commit 8f735d64382d ("net/sched: bound qdisc_pkt_len to prevent
qdisc soft lockup") added QDISC_PKT_LEN_MAX to bound size table
amplification. Use the same bound for DODGY packets:
- Make gso_segs a u32 and drop packets whose segment count does
not fit GSO_MAX_SEGS, instead of silently truncating it.
- Drop packets whose estimated qdisc_pkt_len() would exceed
QDISC_PKT_LEN_MAX.
Fixes: 15e5a0307164 ("net_sched: better precise estimation on packet length for untrusted packets")
Reported-by: shaos <shawnq1@163.com>
Closes: https://lore.kernel.org/netdev/20261022144755.65025-1-shawnq1@163.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261022155436.117507-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: context adjusted; 6.18.y keeps the name
qdisc_pkt_len_init() and has no qdisc_skb_cb()->pkt_segs. The code
change is identical to upstream. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 792cc34fc218a..40f3bb73c0ca3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4140,7 +4140,7 @@ static enum skb_drop_reason qdisc_pkt_len_init(struct sk_buff *skb)
{
struct skb_shared_info *shinfo = skb_shinfo(skb);
unsigned int hdr_len, tlen;
- u16 gso_segs;
+ u32 gso_segs;
qdisc_skb_cb(skb)->pkt_len = skb->len;
if (!shinfo->gso_size)
@@ -4189,6 +4189,15 @@ static enum skb_drop_reason qdisc_pkt_len_init(struct sk_buff *skb)
if (payload <= 0)
return SKB_DROP_REASON_SKB_BAD_GSO;
gso_segs = DIV_ROUND_UP(payload, shinfo->gso_size);
+ /* shinfo->gso_segs is a 16bit field.
+ * Also make sure untrusted gso_size/hdr_len can not inflate
+ * qdisc_pkt_len() beyond QDISC_PKT_LEN_MAX, or deficit
+ * schedulers could spin in their refill loops.
+ */
+ if (unlikely(gso_segs > GSO_MAX_SEGS ||
+ skb->len + (u64)(gso_segs - 1) * hdr_len >
+ QDISC_PKT_LEN_MAX))
+ return SKB_DROP_REASON_SKB_BAD_GSO;
shinfo->gso_segs = gso_segs;
}
qdisc_skb_cb(skb)->pkt_len += (gso_segs - 1) * hdr_len;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 008/703] net: reject a negative TCP header offset in qdisc_pkt_len_segs_init()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (6 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 007/703] net: harden qdisc_pkt_len_segs_init() against malicious GSO packets Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 009/703] sctp: validate cookie AUTH state before use Greg Kroah-Hartman
` (399 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Eric Dumazet,
Michael S. Tsirkin, Paolo Abeni, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 35d2d6e5ac0d22428b2a0216061f3330c095393c ]
qdisc_pkt_len_segs_init() stores skb_transport_offset(), or the inner
offset, in the unsigned hdr_len. A header in front of skb->data gives a
negative offset. For an offset a little below zero, pskb_may_pull() gets a
small length and succeeds. Then a 64-bit kernel reads the TCP header far
after the skb and can crash. Further below zero pskb_may_pull() fails.
Commit 28a57fb2c5df ("net: iptunnel: fix stale transport header during
tunnel decapsulation") fixed one source of such offsets. Other code that
removes bytes from the front of a packet can leave the same stale header.
Return SKB_DROP_REASON_SKB_BAD_GSO for a negative offset in the TCP branch.
SKB_GSO_UDP_L4 and the other GSO types read no header and still get a wrong
qdisc_pkt_len(). On a 64-bit kernel only packets that cause the read after
the skb today get a new result. Then __dev_queue_xmit() drops them and
returns -EINVAL, but sch_handle_ingress() ignores the result. Their content
can be valid. Thus the code that leaves the header stale needs its own fix.
Fixes: 7fb4c1967011 ("net: pull headers in qdisc_pkt_len_segs_init()")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
CC: stable@vger.kernel.org
Link: https://patch.msgid.link/20261101194433.2637113-1-alexei.starovoitov@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Backport to 6.18.y: in 6.18.y the function is qdisc_pkt_len_init()
and __dev_queue_xmit() is its only caller; sch_handle_ingress() does
not call it. The code change is identical to upstream. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 40f3bb73c0ca3..c0aa4e8625b5d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4164,7 +4164,9 @@ static enum skb_drop_reason qdisc_pkt_len_init(struct sk_buff *skb)
if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) {
const struct tcphdr *th;
- if (!pskb_may_pull(skb, hdr_len + sizeof(struct tcphdr)))
+ /* A header in front of skb->data gives a negative offset. */
+ if ((int)hdr_len < 0 ||
+ !pskb_may_pull(skb, hdr_len + sizeof(struct tcphdr)))
return SKB_DROP_REASON_SKB_BAD_GSO;
th = (const struct tcphdr *)(skb->data + hdr_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 009/703] sctp: validate cookie AUTH state before use
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (7 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 008/703] net: reject a negative TCP header offset in qdisc_pkt_len_segs_init() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 010/703] net/sched: codel: bound the dropping loop per dequeue call Greg Kroah-Hartman
` (398 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jérémy Jean, Xin Long,
Jakub Kicinski, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
[ Upstream commit 3dbb44d88b1e94dd31fe43588af7437b34b44d56 ]
When cookie authentication is disabled, COOKIE_ECHO restores fixed-size
AUTH fields directly from peer-controlled cookie bytes. A forged RANDOM
length, HMAC list, or CHUNKS list can then reach association consumers
with lengths or identifiers that were never validated against the local
backing arrays.
A forged RANDOM length can cause out-of-bounds reads during key-vector
construction. A forged HMAC identifier also caused a 32-byte write past
a zero-length AUTH chunk, providing a primitive for a local privilege
escalation chain.
Validate the cookie's RANDOM, HMACS, and CHUNKS parameters at the cookie
trust boundary before copying them into the association. Reject invalid
types, malformed lengths, unsupported HMAC identifiers, HMAC lists
without SHA1, and forbidden chunk ids.
Fixes: bbd0d59809f9 ("[SCTP]: Implement the receive and verification of AUTH chunk")
Fixes: 1f485649f529 ("[SCTP]: Implement SCTP-AUTH internals")
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20260804200042.2412009-1-Jeremy.Jean@oss.cyber.gouv.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: context adjusted in include/net/sctp/auth.h, where
6.18.y still declares sctp_auth_init_hmacs(), and in
sctp_unpack_cookie(), where 6.18.y still sets retval->c.peer_addr
after copying the cookie. No code changes. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/sctp/auth.h | 3 ++
net/sctp/auth.c | 75 ++++++++++++++++++++++++++++++++++++++++
net/sctp/sm_make_chunk.c | 3 ++
3 files changed, 81 insertions(+)
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h
index 3d5879e08e78a..fe45c8df210f9 100644
--- a/include/net/sctp/auth.h
+++ b/include/net/sctp/auth.h
@@ -22,6 +22,7 @@ struct sctp_endpoint;
struct sctp_association;
struct sctp_authkey;
struct sctp_hmacalgo;
+struct sctp_cookie;
/* Defines an HMAC algorithm supported by SCTP chunk authentication */
struct sctp_hmac {
@@ -72,6 +73,8 @@ struct sctp_shared_key *sctp_auth_get_shkey(
int sctp_auth_asoc_copy_shkeys(const struct sctp_endpoint *ep,
struct sctp_association *asoc,
gfp_t gfp);
+bool sctp_auth_verify_cookie_params(const struct sctp_endpoint *ep,
+ const struct sctp_cookie *cookie);
int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp);
const struct sctp_hmac *sctp_auth_get_hmac(__u16 hmac_id);
const struct sctp_hmac *
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index fbbfa0c279552..95c272948c60a 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -377,6 +377,81 @@ int sctp_auth_asoc_copy_shkeys(const struct sctp_endpoint *ep,
return -ENOMEM;
}
+static bool sctp_auth_chunk_id_forbidden(__u8 chunk_id)
+{
+ switch (chunk_id) {
+ case SCTP_CID_INIT:
+ case SCTP_CID_INIT_ACK:
+ case SCTP_CID_SHUTDOWN_COMPLETE:
+ case SCTP_CID_AUTH:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* Verify AUTH parameters copied from a state cookie before they are restored
+ * into an association. When cookie authentication is disabled these fields
+ * are peer-controlled, so they must satisfy the same constraints as locally
+ * generated AUTH parameters.
+ */
+bool sctp_auth_verify_cookie_params(const struct sctp_endpoint *ep,
+ const struct sctp_cookie *cookie)
+{
+ const struct sctp_paramhdr *random;
+ const struct sctp_hmac_algo_param *hmacs;
+ const struct sctp_chunks_param *chunks;
+ u16 hmacs_len, chunks_len;
+ u16 n_hmacs, n_chunks, i;
+ bool has_sha1 = false;
+
+ if (sctp_sk(ep->base.sk)->cookie_auth_enable || !ep->auth_enable)
+ return true;
+
+ random = (const struct sctp_paramhdr *)cookie->auth_random;
+ if (random->type != SCTP_PARAM_RANDOM ||
+ ntohs(random->length) != sizeof(*random) + SCTP_AUTH_RANDOM_LENGTH)
+ return false;
+
+ hmacs = (const struct sctp_hmac_algo_param *)cookie->auth_hmacs;
+ hmacs_len = ntohs(hmacs->param_hdr.length);
+ if (hmacs->param_hdr.type != SCTP_PARAM_HMAC_ALGO ||
+ hmacs_len < sizeof(struct sctp_paramhdr) +
+ sizeof(hmacs->hmac_ids[0]) ||
+ hmacs_len > sizeof(cookie->auth_hmacs) ||
+ (hmacs_len - sizeof(struct sctp_paramhdr)) %
+ sizeof(hmacs->hmac_ids[0]))
+ return false;
+
+ n_hmacs = (hmacs_len - sizeof(struct sctp_paramhdr)) /
+ sizeof(hmacs->hmac_ids[0]);
+ for (i = 0; i < n_hmacs; i++) {
+ u16 hmac_id = ntohs(hmacs->hmac_ids[i]);
+
+ if (!sctp_hmac_supported(hmac_id))
+ return false;
+ if (hmac_id == SCTP_AUTH_HMAC_ID_SHA1)
+ has_sha1 = true;
+ }
+ if (!has_sha1)
+ return false;
+
+ chunks = (const struct sctp_chunks_param *)cookie->auth_chunks;
+ chunks_len = ntohs(chunks->param_hdr.length);
+ if (chunks->param_hdr.type != SCTP_PARAM_CHUNKS ||
+ chunks_len < sizeof(struct sctp_paramhdr) ||
+ chunks_len > sizeof(cookie->auth_chunks))
+ return false;
+
+ n_chunks = chunks_len - sizeof(struct sctp_paramhdr);
+ for (i = 0; i < n_chunks; i++) {
+ if (sctp_auth_chunk_id_forbidden(chunks->chunks[i]))
+ return false;
+ }
+
+ return true;
+}
+
/* Public interface to create the association shared key.
* See code above for the algorithm.
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index db9406f4681c9..ae4ca90fce9ab 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1867,6 +1867,9 @@ struct sctp_association *sctp_unpack_cookie(
/* Set up our peer's port number. */
retval->peer.port = ntohs(chunk->sctp_hdr->source);
+ if (!sctp_auth_verify_cookie_params(ep, bear_cookie))
+ goto malformed;
+
/* Populate the association from the cookie. */
memcpy(&retval->c, bear_cookie, sizeof(*bear_cookie));
retval->c.peer_addr = paddr;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 010/703] net/sched: codel: bound the dropping loop per dequeue call
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (8 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 009/703] sctp: validate cookie AUTH state before use Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 011/703] net: flush skb_defer_nodes in dev_cpu_dead() Greg Kroah-Hartman
` (397 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vega, Eric Dumazet, Victor Nogueira,
Jamal Hadi Salim, Toke Høiland-Jørgensen,
Jakub Kicinski, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
[ Upstream commit 7f4a5ec6258fd7c92633ec4b0493fc51166d9398 ]
The CoDel control law schedules the next drop one interval/sqrt(count)
after the previous drop, using the configured interval
(codel_params.interval). For very small intervals the scheduled step
rounds down to zero, so the dropping loop in codel_dequeue() never
advances and drains the entire backlog under the qdisc lock in one
call - an unprivileged user can trigger a soft lockup this way.
Fix in the shared codel code used by both codel and fq_codel:
1. Make the control-law step at least 1 tick so the dropping loop
always moves forward.
2. Cap the dropping loop at CODEL_MAX_DROPS_PER_DEQUEUE (256) drops
per codel_dequeue() call, resyncing drop_next to now when the cap
is hit: the catch-up owed to the loop grows with the idle gap and
the backlog, which no interval threshold can bound. This is a
deliberate behaviour change after long idle gaps.
The cap applies to fq_codel (4b549a2ef4be) and the mac80211 TXQ path
(fixed interval, cap only).
The target sojourn delay (codel_params.target) is not validated: it
does not feed the control law, so a sub-tick value is aggressive
rather than deadlock-prone.
Conditions to recreate the bug:
- tc qdisc add dev lo root handle 1: tbf rate 1kbit burst 2kb limit 1000000
- tc qdisc add dev lo parent 1:1 handle 10: codel interval 2us target 1ms noecn limit 1000000 (same for fq_codel)
- unpatched kernel: tc accepts it; a UDP flood under the 1kbit tbf
soft-lockups (watchdog: BUG: soft lockup) while one
codel_dequeue() call drops the backlog under the qdisc lock
- patched kernel: same setup, at most 256 drops per dequeue call,
no soft lockup
Testing: claim reproducer and interval 2us/3us variants run clean;
tdc qdisc category passes (see the selftests patch).
Fixes: 76e3cc126bb2 ("codel: Controlled Delay AQM")
Reported-by: Vega <vega@nebusec.ai>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/QDISC-1L5H.v1.20260912080102@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: context adjusted in codel_dequeue(); 6.18.y lacks
the upstream WRITE_ONCE() annotations of the codel state. The added
code is unchanged. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/codel.h | 5 +++++
include/net/codel_impl.h | 16 +++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/net/codel.h b/include/net/codel.h
index aa80f744826cd..183d43c2bd434 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -140,6 +140,11 @@ struct codel_vars {
/* needed shift to get a Q0.32 number from rec_inv_sqrt */
#define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS)
+/* Cap on drops per codel_dequeue() call: the loop's work depends on the
+ * idle gap and backlog, both outside our control; resync when exceeded.
+ */
+#define CODEL_MAX_DROPS_PER_DEQUEUE 256
+
/**
* struct codel_stats - contains codel shared variables and stats
* @maxpacket: largest packet we've seen so far
diff --git a/include/net/codel_impl.h b/include/net/codel_impl.h
index b2c359c6dd1b8..4d5e471472f6a 100644
--- a/include/net/codel_impl.h
+++ b/include/net/codel_impl.h
@@ -93,12 +93,17 @@ static void codel_Newton_step(struct codel_vars *vars)
* CoDel control_law is t + interval/sqrt(count)
* We maintain in rec_inv_sqrt the reciprocal value of sqrt(count) to avoid
* both sqrt() and divide operation.
+ *
+ * Clamp the increment to at least 1 tick: a very small interval (or a
+ * large count) can truncate it to zero, stalling the dropping loop.
*/
static codel_time_t codel_control_law(codel_time_t t,
codel_time_t interval,
u32 rec_inv_sqrt)
{
- return t + reciprocal_scale(interval, rec_inv_sqrt << REC_INV_SQRT_SHIFT);
+ return t + max_t(u32, 1,
+ reciprocal_scale(interval,
+ rec_inv_sqrt << REC_INV_SQRT_SHIFT));
}
static bool codel_should_drop(const struct sk_buff *skb,
@@ -154,6 +159,7 @@ static struct sk_buff *codel_dequeue(void *ctx,
codel_skb_dequeue_t dequeue_func)
{
struct sk_buff *skb = dequeue_func(vars, ctx);
+ unsigned int drops = 0;
codel_time_t now;
bool drop;
@@ -180,6 +186,14 @@ static struct sk_buff *codel_dequeue(void *ctx,
*/
while (vars->dropping &&
codel_time_after_eq(now, vars->drop_next)) {
+ if (++drops > CODEL_MAX_DROPS_PER_DEQUEUE) {
+ /* fell far behind the schedule */
+ WRITE_ONCE(vars->drop_next,
+ codel_control_law(now,
+ params->interval,
+ vars->rec_inv_sqrt));
+ break;
+ }
vars->count++; /* dont care of possible wrap
* since there is no more divide
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 011/703] net: flush skb_defer_nodes in dev_cpu_dead()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (9 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 010/703] net/sched: codel: bound the dropping loop per dequeue call Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 012/703] ext4: teach ext4_meta_trans_blocks() about number of allocated extents Greg Kroah-Hartman
` (396 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Kris Pan,
Jakub Kicinski, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 06e3f54e8b22040ada01a28343badf1990b4dd7d ]
When a CPU goes offline, dev_cpu_dead() drains its softnet queues
(completion_queue, output_queue, poll_list, process_queue, and
input_pkt_queue), but leaves net_hotdata.skb_defer_nodes untouched.
If oldcpu goes offline while holding pending skbs in its
skb_defer_nodes lists (e.g. below the sysctl_skb_defer_max >> 1 IPI
threshold, or if the IPI races with CPU teardown), those skbs remain
stranded until oldcpu is brought back online. If any of these skbs
hold page_pool fragments, page_pool_destroy() will stall indefinitely
waiting for inflight pages to be returned when a netdev or driver is
torn down while oldcpu is offline.
Additionally, if smp_call_function_single_async() fails in
kick_defer_list_purge() because the target CPU went offline, reset
defer_ipi_scheduled to 0 so future IPI kicks are not blocked when the
CPU comes back online.
Also, if oldcpu was the last online CPU on its NUMA node, drain that
node's slot across all CPUs so no skbs deferred from that node remain
stranded on idle remote CPUs (or if the node itself is subsequently
offlined).
Finally, in skb_attempt_defer_free(), re-check cpu_online(cpu) and
whether the caller migrated CPUs after llist_add(), flushing the node
list if so, to close the preemption TOCTOU race against CPU/node
teardown.
Fixes: 68822bdf76f1 ("net: generalize skb freeing deferral to per-cpu lists")
Fixes: 5628f3fe3b16 ("net: add NUMA awareness to skb_attempt_defer_free()")
Closes: https://lore.kernel.org/netdev/20260916003430.3612956-1-kris.pan@intel.com/
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Kris Pan <kris.pan@intel.com>
Link: https://patch.msgid.link/20260923130318.607255-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Backport to 6.18.y: 6.18.y loads skb->alloc_cpu in the declaration of
cpu and lacks the upstream skb_defer_disable_key and skb_zcopy()
bypasses, so my_cpu is declared separately and the remaining hunks
are adjusted for context. The 6.18.y flush loop has no prefetch();
the new __skb_defer_free_flush() helper adds it as upstream does.
skb_defer_free_flush() keeps the for_each_online_node() iteration
from commit 58fb1e2a33ea ("net: iterate online nodes in
skb_defer_free_flush()"), already in 6.18.y. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 46 +++++++++++++++++++++++++++++++++++-----------
net/core/dev.h | 2 ++
net/core/skbuff.c | 11 +++++++++--
3 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index c0aa4e8625b5d..f7e672a4a39f7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5327,7 +5327,8 @@ void kick_defer_list_purge(unsigned int cpu)
backlog_unlock_irq_restore(sd, flags);
} else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) {
- smp_call_function_single_async(cpu, &sd->defer_csd);
+ if (smp_call_function_single_async(cpu, &sd->defer_csd))
+ WRITE_ONCE(sd->defer_ipi_scheduled, 0);
}
}
@@ -6865,24 +6866,35 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
}
EXPORT_SYMBOL(napi_complete_done);
-static void skb_defer_free_flush(void)
+static void __skb_defer_free_flush(struct skb_defer_node *sdn, int budget)
{
struct llist_node *free_list;
struct sk_buff *skb, *next;
+
+ if (llist_empty(&sdn->defer_list))
+ return;
+ atomic_long_set(&sdn->defer_count, 0);
+ free_list = llist_del_all(&sdn->defer_list);
+
+ llist_for_each_entry_safe(skb, next, free_list, ll_node) {
+ prefetch(next);
+ napi_consume_skb(skb, budget);
+ }
+}
+
+void skb_defer_node_flush(struct skb_defer_node *sdn)
+{
+ __skb_defer_free_flush(sdn, 0);
+}
+
+static void skb_defer_free_flush(void)
+{
struct skb_defer_node *sdn;
int node;
for_each_online_node(node) {
sdn = this_cpu_ptr(net_hotdata.skb_defer_nodes) + node;
-
- if (llist_empty(&sdn->defer_list))
- continue;
- atomic_long_set(&sdn->defer_count, 0);
- free_list = llist_del_all(&sdn->defer_list);
-
- llist_for_each_entry_safe(skb, next, free_list, ll_node) {
- napi_consume_skb(skb, 1);
- }
+ __skb_defer_free_flush(sdn, 1);
}
}
@@ -12704,6 +12716,7 @@ static int dev_cpu_dead(unsigned int oldcpu)
struct sk_buff **list_skb;
struct sk_buff *skb;
unsigned int cpu;
+ int node;
struct softnet_data *sd, *oldsd, *remsd = NULL;
local_irq_disable();
@@ -12764,6 +12777,17 @@ static int dev_cpu_dead(unsigned int oldcpu)
rps_input_queue_head_incr(oldsd);
}
+ for_each_node(node)
+ skb_defer_node_flush(per_cpu_ptr(net_hotdata.skb_defer_nodes,
+ oldcpu) + node);
+ node = cpu_to_node(oldcpu);
+ if (node_possible(node) &&
+ !cpumask_intersects(cpumask_of_node(node), cpu_online_mask)) {
+ for_each_possible_cpu(cpu)
+ skb_defer_node_flush(per_cpu_ptr(net_hotdata.skb_defer_nodes,
+ cpu) + node);
+ }
+
return 0;
}
diff --git a/net/core/dev.h b/net/core/dev.h
index 6a84413e673ae..7e5bce3c78e3a 100644
--- a/net/core/dev.h
+++ b/net/core/dev.h
@@ -360,6 +360,8 @@ static inline void napi_assert_will_not_race(const struct napi_struct *napi)
WARN_ON(READ_ONCE(napi->list_owner) != -1);
}
+struct skb_defer_node;
+void skb_defer_node_flush(struct skb_defer_node *sdn);
void kick_defer_list_purge(unsigned int cpu);
int dev_set_hwtstamp_phylib(struct net_device *dev,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 07df2030ccf2a..60eb8b4328f89 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -7324,10 +7324,12 @@ void skb_attempt_defer_free(struct sk_buff *skb)
struct skb_defer_node *sdn;
unsigned long defer_count;
int cpu = skb->alloc_cpu;
+ int my_cpu;
unsigned int defer_max;
bool kick;
- if (cpu == raw_smp_processor_id() ||
+ my_cpu = raw_smp_processor_id();
+ if (cpu == my_cpu ||
WARN_ON_ONCE(cpu >= nr_cpu_ids) ||
!cpu_online(cpu)) {
nodefer: kfree_skb_napi_cache(skb);
@@ -7338,7 +7340,7 @@ nodefer: kfree_skb_napi_cache(skb);
DEBUG_NET_WARN_ON_ONCE(skb->destructor);
DEBUG_NET_WARN_ON_ONCE(skb_nfct(skb));
- sdn = per_cpu_ptr(net_hotdata.skb_defer_nodes, cpu) + numa_node_id();
+ sdn = per_cpu_ptr(net_hotdata.skb_defer_nodes, cpu) + cpu_to_node(my_cpu);
defer_max = READ_ONCE(net_hotdata.sysctl_skb_defer_max);
defer_count = atomic_long_inc_return(&sdn->defer_count);
@@ -7348,6 +7350,11 @@ nodefer: kfree_skb_napi_cache(skb);
llist_add(&skb->ll_node, &sdn->defer_list);
+ if (unlikely(!cpu_online(cpu) || my_cpu != raw_smp_processor_id())) {
+ skb_defer_node_flush(sdn);
+ return;
+ }
+
/* Send an IPI every time queue reaches half capacity. */
kick = (defer_count - 1) == (defer_max >> 1);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 012/703] ext4: teach ext4_meta_trans_blocks() about number of allocated extents
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (10 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 011/703] net: flush skb_defer_nodes in dev_cpu_dead() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 013/703] ext4: fix transaction overflow during writeback Greg Kroah-Hartman
` (395 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Kara, Theodore Tso, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <jack@suse.cz>
[ Upstream commit 25b2a7e8d420c49fc46f25b6f953603e4dae1dbf ]
So far ext4_meta_trans_blocks() expects that each extent counted in
@pextents will be allocated in the transaction we estimate credits for.
This is correct for the use in ext4_chunk_trans_blocks() and
ext4_chunk_trans_extent() however the use in atomic write path
(ext4_convert_unwritten_extents_atomic() and ext4_iomap_alloc() for
IOMAP_ATOMIC) unnecessarily overestimates the number of necessary
credits as neither of them allocates any data. Add argument to
ext4_meta_trans_blocks() for number of extents that are going to be
allocated in the transaction.
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260805153605.166545-4-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[ sashal: adjusted ext4.h prototype context for missing upstream declarations, and updated the move_extent.c caller to pass block_len_in_page as the new alloc_extents argument. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/ext4.h | 2 +-
fs/ext4/extents.c | 2 +-
fs/ext4/inode.c | 30 +++++++++++++++---------------
fs/ext4/move_extent.c | 1 +
4 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 9c67a2c28faf5..dc7232e8e8315 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -3123,7 +3123,7 @@ extern int ext4_normal_submit_inode_data_buffers(struct jbd2_inode *jinode);
extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
extern int ext4_chunk_trans_extent(struct inode *inode, int nrblocks);
extern int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
- int pextents);
+ int pextents, int alloc_extents);
extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
loff_t lstart, loff_t lend);
extern vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 80d41be515644..d789c7c2b5357 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4946,7 +4946,7 @@ int ext4_convert_unwritten_extents_atomic(handle_t *handle, struct inode *inode,
* it can tell if the extent in the cache is a split extent.
* But for now let's assume pextents as 2 always.
*/
- credits = ext4_meta_trans_blocks(inode, max_blocks, 2);
+ credits = ext4_meta_trans_blocks(inode, max_blocks, 2, 0);
}
if (credits) {
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d46d243d53c47..a8325b778355e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3731,8 +3731,8 @@ static int ext4_iomap_alloc(struct inode *inode, struct ext4_map_blocks *map,
return ret;
if (map->m_len < orig_mlen) {
map->m_len = orig_mlen;
- dio_credits = ext4_meta_trans_blocks(inode, orig_mlen,
- map->m_len);
+ dio_credits = ext4_meta_trans_blocks(inode, map->m_len,
+ map->m_len, 0);
} else {
dio_credits = ext4_chunk_trans_blocks(inode,
map->m_len);
@@ -6271,17 +6271,17 @@ static int ext4_index_trans_blocks(struct inode *inode, int lblocks,
}
/*
- * Account for index blocks, block groups bitmaps and block group
- * descriptor blocks if modify datablocks and index blocks
- * worse case, the indexs blocks spread over different block groups
- *
- * If datablocks are discontiguous, they are possible to spread over
- * different block groups too. If they are contiguous, with flexbg,
- * they could still across block group boundary.
- *
- * Also account for superblock, inode, quota and xattr blocks
+ * Calculate number of credits needed in a transaction to:
+ * * Allocate data blocks from @alloc_extents different groups - note that
+ * with flexbg a single physical extent can span multiple groups but
+ * single mballoc request only returns extent within one group.
+ * * Allocate metatadata (extent tree blocks, indirect blocks) to store
+ * pointers to @pextents data extents having @lblocks in total.
+ * * Modify extent tree / indirect block tree, inode, superblock, quota
+ * tracking, xattr blocks
*/
-int ext4_meta_trans_blocks(struct inode *inode, int lblocks, int pextents)
+int ext4_meta_trans_blocks(struct inode *inode, int lblocks, int pextents,
+ int alloc_extents)
{
ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb);
int gdpblocks;
@@ -6298,7 +6298,7 @@ int ext4_meta_trans_blocks(struct inode *inode, int lblocks, int pextents)
* Now let's see how many group bitmaps and group descriptors need
* to account
*/
- groups = idxblocks + pextents;
+ groups = idxblocks + alloc_extents;
gdpblocks = groups;
if (groups > ngroups)
groups = ngroups;
@@ -6324,7 +6324,7 @@ int ext4_chunk_trans_extent(struct inode *inode, int nrblocks)
{
int ret;
- ret = ext4_meta_trans_blocks(inode, nrblocks, 1);
+ ret = ext4_meta_trans_blocks(inode, nrblocks, 1, 1);
/* Account for data blocks for journalled mode */
if (ext4_should_journal_data(inode))
ret += nrblocks;
@@ -6342,7 +6342,7 @@ int ext4_chunk_trans_extent(struct inode *inode, int nrblocks)
*/
int ext4_chunk_trans_blocks(struct inode *inode, int nrblocks)
{
- return ext4_meta_trans_blocks(inode, nrblocks, 1);
+ return ext4_meta_trans_blocks(inode, nrblocks, 1, 1);
}
/*
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index e2705ea5e5c63..6a60d29e433bc 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -281,6 +281,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
again:
*err = 0;
jblocks = ext4_meta_trans_blocks(orig_inode, block_len_in_page,
+ block_len_in_page,
block_len_in_page) * 2;
handle = ext4_journal_start(orig_inode, EXT4_HT_MOVE_EXTENTS, jblocks);
if (IS_ERR(handle)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 013/703] ext4: fix transaction overflow during writeback
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (11 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 012/703] ext4: teach ext4_meta_trans_blocks() about number of allocated extents Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 014/703] bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call() Greg Kroah-Hartman
` (394 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Kara, Theodore Tso, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <jack@suse.cz>
[ Upstream commit 46e8e31771f4f1c5e1cdec37a889a6730e42e9f1 ]
Commit 95ad8ee45cdb ("ext4: correct the reserved credits for extent
conversion") was correct to note that we need to reserve enough credits
for all extents possibly underlying a large folio. However it was too
eager to reduce the number of reserved credits. Extent conversion may
not only need to touch several leaf extent blocks, it may also need to
split extents - for example a single large unwritten extent may need to
be split into many small written ones in case of sparse folio dirtying.
This can thus result not only in extent leaf modifications but also in a
need to allocate new extent tree nodes. As a result the reserved
transaction credits were not sufficient in some corner cases. Use
ext4_meta_trans_blocks() for correct upper bound credit estimate.
Fixes: 95ad8ee45cdb ("ext4: correct the reserved credits for extent conversion")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260805153605.166545-5-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext4/inode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a8325b778355e..2a9167bff4c26 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2862,10 +2862,10 @@ static int ext4_do_writepages(struct mpage_da_data *mpd)
if (ext4_should_dioread_nolock(inode)) {
int bpf = ext4_journal_blocks_per_folio(inode);
/*
- * We may need to convert up to one extent per block in
- * the folio and we may dirty the inode.
+ * We may need to convert up to one extent per block in the
+ * folio.
*/
- rsv_blocks = 1 + ext4_ext_index_trans_blocks(inode, bpf);
+ rsv_blocks = ext4_meta_trans_blocks(inode, bpf, bpf, 0);
}
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 014/703] bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (12 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 013/703] ext4: fix transaction overflow during writeback Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 015/703] bpf: Reject programs with inlined helpers if JIT is not available Greg Kroah-Hartman
` (393 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, KaFai Wan,
Leon Hwang, Tiezhu Yang, Eduard Zingerman, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <yangtiezhu@loongson.cn>
[ Upstream commit 9a6df65d5c6a9947ddab4e563e329720f44b8747 ]
Introduce a 'jit_required' bitfield flag in struct bpf_prog to track
whether a BPF program strictly requires the JIT compiler to run. This
prevents a dangerous runtime fallback to the interpreter for features
that are only implemented in the JIT compiler.
Currently, bpf_prog_has_kfunc_call() is used only for kernel function
calls, replace the kfunc-specific helper with the new 'jit_required'
flag. This makes it easy to support other JIT-only BPF features, such
as inlined helpers.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Suggested-by: KaFai Wan <kafai.wan@linux.dev>
Suggested-by: Leon Hwang <leon.hwang@linux.dev>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
[edit]
Adapt the bpf_fixup_call_args() change to fixup_call_args() in
kernel/bpf/verifier.c, and the __bpf_prog_select_runtime() change to
bpf_prog_select_runtime() in kernel/bpf/core.c.
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 9 ++-------
kernel/bpf/core.c | 7 ++-----
kernel/bpf/verifier.c | 12 ++++--------
3 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 2d8cb15fb9ba7..cc9c58ea53b10 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1706,8 +1706,9 @@ struct bpf_prog_aux {
struct bpf_prog {
u16 pages; /* Number of allocated pages */
- u16 jited:1, /* Is our filter JIT'ed? */
+ u32 jited:1, /* Is our filter JIT'ed? */
jit_requested:1,/* archs need to JIT the prog */
+ jit_required:1, /* program strictly requires JIT compiler */
gpl_compatible:1, /* Is filter GPL compatible? */
cb_access:1, /* Is control block accessed? */
dst_needed:1, /* Do we need dst entry? */
@@ -2868,7 +2869,6 @@ const struct bpf_func_proto *bpf_base_func_proto(enum bpf_func_id func_id,
const struct bpf_prog *prog);
void bpf_task_storage_free(struct task_struct *task);
void bpf_cgrp_storage_free(struct cgroup *cgroup);
-bool bpf_prog_has_kfunc_call(const struct bpf_prog *prog);
const struct btf_func_model *
bpf_jit_find_kfunc_model(const struct bpf_prog *prog,
const struct bpf_insn *insn);
@@ -3151,11 +3151,6 @@ static inline void bpf_task_storage_free(struct task_struct *task)
{
}
-static inline bool bpf_prog_has_kfunc_call(const struct bpf_prog *prog)
-{
- return false;
-}
-
static inline const struct btf_func_model *
bpf_jit_find_kfunc_model(const struct bpf_prog *prog,
const struct bpf_insn *insn)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 59c87eeb07cdb..1d1d834482228 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -125,6 +125,7 @@ struct bpf_prog *bpf_prog_alloc_no_stats(unsigned int size, gfp_t gfp_extra_flag
fp->aux->main_prog_aux = aux;
fp->aux->prog = fp;
fp->jit_requested = ebpf_jit_enabled();
+ fp->jit_required = IS_ENABLED(CONFIG_BPF_JIT_ALWAYS_ON);
fp->blinding_requested = bpf_jit_blinding_enabled(fp);
#ifdef CONFIG_CGROUP_BPF
aux->cgroup_atype = CGROUP_BPF_ATTACH_TYPE_INVALID;
@@ -2566,15 +2567,11 @@ struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err)
/* In case of BPF to BPF calls, verifier did all the prep
* work with regards to JITing, etc.
*/
- bool jit_needed = false;
+ bool jit_needed = fp->jit_required;
if (fp->bpf_func)
goto finalize;
- if (IS_ENABLED(CONFIG_BPF_JIT_ALWAYS_ON) ||
- bpf_prog_has_kfunc_call(fp))
- jit_needed = true;
-
if (!bpf_prog_select_interpreter(fp))
jit_needed = true;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index a004c95969636..32bb4c3f70fba 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -3383,6 +3383,8 @@ static int add_kfunc_call(struct bpf_verifier_env *env, u32 func_id, s16 offset)
prog_aux->kfunc_tab = tab;
}
+ env->prog->jit_required = 1;
+
/* func_id == 0 is always invalid, but instead of returning an error, be
* conservative and wait until the code elimination pass before returning
* error, so that invalid calls that get pruned out can be in BPF programs
@@ -3491,11 +3493,6 @@ static void sort_kfunc_descs_by_imm_off(struct bpf_prog *prog)
kfunc_desc_cmp_by_imm_off, NULL);
}
-bool bpf_prog_has_kfunc_call(const struct bpf_prog *prog)
-{
- return !!prog->aux->kfunc_tab;
-}
-
const struct btf_func_model *
bpf_jit_find_kfunc_model(const struct bpf_prog *prog,
const struct bpf_insn *insn)
@@ -22533,7 +22530,6 @@ static int fixup_call_args(struct bpf_verifier_env *env)
#ifndef CONFIG_BPF_JIT_ALWAYS_ON
struct bpf_prog *prog = env->prog;
struct bpf_insn *insn = prog->insnsi;
- bool has_kfunc_call = bpf_prog_has_kfunc_call(prog);
int i, depth;
#endif
int err = 0;
@@ -22547,8 +22543,8 @@ static int fixup_call_args(struct bpf_verifier_env *env)
return err;
}
#ifndef CONFIG_BPF_JIT_ALWAYS_ON
- if (has_kfunc_call) {
- verbose(env, "calling kernel functions are not allowed in non-JITed programs\n");
+ if (prog->jit_required) {
+ verbose(env, "program requires BPF JIT compiler but it is not available\n");
return -EINVAL;
}
if (env->subprog_cnt > 1 && env->prog->aux->tail_call_reachable) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 015/703] bpf: Reject programs with inlined helpers if JIT is not available
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (13 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 014/703] bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 016/703] bpf: Disallow interpreter fallback for arena-related insns Greg Kroah-Hartman
` (392 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, KaFai Wan,
Leon Hwang, Tiezhu Yang, Eduard Zingerman, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <yangtiezhu@loongson.cn>
[ Upstream commit f1c27922576edccb99d0257827d09bd05c0304a6 ]
When an architecture (such as LoongArch, ARM64, and RISC-V) implements
bpf_jit_inlines_helper_call(), the verifier skips rewriting the helper
call offset (insn->imm) in bpf_do_misc_fixups(). This is because the
helper is expected to be inlined by the JIT compiler later. Therefore,
insn->imm remains as the raw helper enum ID.
However, if JIT is disabled at runtime (net.core.bpf_jit_enable=0) or
if JIT compilation fails dynamically (e.g., due to OOM), the program
falls back to the BPF interpreter.
When the interpreter executes (__bpf_call_base + insn->imm) with the
unpatched raw ID, it jumps into an invalid address space, triggering
an instruction alignment fault or a kernel panic.
Although these helpers have valid C implementations in the kernel, the
omission of offset rewriting makes runtime interpreter fallback fatal.
Fix this by setting 'prog->jit_required = 1' when helper call rewriting
is skipped for JIT inlining. This ensures that such programs are safely
rejected if JIT is not available, preventing the runtime kernel panic.
Fixes: 2ddec2c80b44 ("riscv, bpf: inline bpf_get_smp_processor_id()")
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Suggested-by: KaFai Wan <kafai.wan@linux.dev>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
[edit]
Apply the bpf_do_misc_fixups() change from kernel/bpf/fixups.c to
do_misc_fixups() in kernel/bpf/verifier.c.
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 32bb4c3f70fba..d62d844ae3f86 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -23155,8 +23155,10 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
}
/* Skip inlining the helper call if the JIT does it. */
- if (bpf_jit_inlines_helper_call(insn->imm))
+ if (bpf_jit_inlines_helper_call(insn->imm)) {
+ prog->jit_required = 1;
goto next_insn;
+ }
if (insn->imm == BPF_FUNC_get_route_realm)
prog->dst_needed = 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 016/703] bpf: Disallow interpreter fallback for arena-related insns
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (14 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 015/703] bpf: Reject programs with inlined helpers if JIT is not available Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 017/703] bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn Greg Kroah-Hartman
` (391 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leon Hwang, Kumar Kartikeya Dwivedi,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <leon.hwang@linux.dev>
[ Upstream commit 34746b5a84ec37c0ea2bf6808c65c5ed8790eb51 ]
Since the interpreter does not support the arena-related insns,
interpreter fallback should not be allowed for these insns in
core.c::__bpf_prog_select_runtime().
Currently, when the interpreter executes the arena ST/LDX/STX insns,
it would hit the BUG_ON() in ___bpf_prog_run() at run time.
[ 2.579196] BPF interpreter: unknown opcode a2 (imm: 0x0)
[ 2.579998] ------------[ cut here ]------------
[ 2.580652] kernel BUG at kernel/bpf/core.c:2349!
[ 2.581314] Oops: invalid opcode: 0000 [#1] SMP PTI
Set jit_required as true when arena map is used in the prog to disallow
interpreter fallback for arena-related insns.
Fixes: 6082b6c328b5 ("bpf: Recognize addr_space_cast instruction in the verifier.")
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/bpf/20260715141122.15783-2-leon.hwang@linux.dev
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index d62d844ae3f86..ec862cd11942b 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -21172,6 +21172,7 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env,
return -EOPNOTSUPP;
}
env->prog->aux->arena = (void *)map;
+ env->prog->jit_required = true;
if (!bpf_arena_get_user_vm_start(env->prog->aux->arena)) {
verbose(env, "arena's user address must be set via map_extra or mmap()\n");
return -EINVAL;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 017/703] bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (15 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 016/703] bpf: Disallow interpreter fallback for arena-related insns Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 018/703] mm/mmzone: read each zoneref slot once when filtering by nodemask Greg Kroah-Hartman
` (390 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leon Hwang, Kumar Kartikeya Dwivedi,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <leon.hwang@linux.dev>
[ Upstream commit 7a0855e73757ee9cf25ba635a1c735018ecba742 ]
The BPF_MOV64_PERCPU_REG insn requires JIT to emit native code to for
'dst_reg = src_reg + <percpu_base_off>'.
However, the interpreter ignores the 'off' at its ALU64_MOV_X label.
The 'off' indicates the insn is BPF_MOV64_PERCPU_REG insn. Then, when
the interpreter loads memory from the register, it will hit a page
fault.
[ 2.545572] BUG: unable to handle page fault for address: ffffffffacaaf034
[ 2.546485] #PF: supervisor read access in kernel mode
[ 2.547167] #PF: error_code(0x0000) - not-present page
[ 2.547850] PGD 134e63067 P4D 134e63067 PUD 134e64063 PMD 10021c063 PTE 800ffffeca550062
[ 2.548912] Oops: Oops: 0000 [#1] SMP PTI
Set jit_required as true in order to disallow interpreter fallback in
core.c::__bpf_prog_select_runtime(), if any BPF_ADDR_PERCPU insn is
patched to the prog.
BTW, rename the helper bpf_map_supports_cpu_flags() to
bpf_map_is_percpu_map().
Fixes: 7bdbf7446305 ("bpf: add special internal-only MOV instruction to resolve per-CPU addrs")
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://lore.kernel.org/bpf/20260715141122.15783-4-leon.hwang@linux.dev
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[edit]
Add bpf_map_is_percpu_map() directly because 6.18.y lacks
bpf_map_supports_cpu_flags().
Apply the map lookup and bpf_get_smp_processor_id() changes to
do_misc_fixups() in kernel/bpf/verifier.c.
Omit the current-task helper hunk because 6.18.y lacks the verifier
inlining introduced by commit
eaedea154eb9 ("bpf, x86: inline bpf_get_current_task() for x86_64").
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 13 +++++++++++++
kernel/bpf/verifier.c | 4 ++++
2 files changed, 17 insertions(+)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index cc9c58ea53b10..74110a8c800d9 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -3784,4 +3784,17 @@ int bpf_prog_get_file_line(struct bpf_prog *prog, unsigned long ip, const char *
const char **linep, int *nump);
struct bpf_prog *bpf_prog_find_from_stack(void);
+static inline bool bpf_map_is_percpu_map(enum bpf_map_type map_type)
+{
+ switch (map_type) {
+ case BPF_MAP_TYPE_PERCPU_ARRAY:
+ case BPF_MAP_TYPE_PERCPU_HASH:
+ case BPF_MAP_TYPE_LRU_PERCPU_HASH:
+ case BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE:
+ return true;
+ default:
+ return false;
+ }
+}
+
#endif /* _LINUX_BPF_H */
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index ec862cd11942b..40265041cc056 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -23346,6 +23346,9 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
return -EFAULT;
}
+ if (bpf_map_is_percpu_map(map_ptr->map_type))
+ prog->jit_required = true;
+
new_prog = bpf_patch_insn_data(env, i + delta,
insn_buf, cnt);
if (!new_prog)
@@ -23450,6 +23453,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
* way, it's fine to back out this inlining logic
*/
#ifdef CONFIG_SMP
+ prog->jit_required = true;
insn_buf[0] = BPF_MOV64_IMM(BPF_REG_0, (u32)(unsigned long)&cpu_number);
insn_buf[1] = BPF_MOV64_PERCPU_REG(BPF_REG_0, BPF_REG_0);
insn_buf[2] = BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_0, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 018/703] mm/mmzone: read each zoneref slot once when filtering by nodemask
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (16 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 017/703] bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 019/703] mm/page_alloc: dont increase highatomic reserve after pcp alloc Greg Kroah-Hartman
` (389 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit e55119ab611a0e47595db7e1d2ac1e69f7a73ff0 ]
__next_zones_zonelist() tests a slot's zone for NULL, then reads the
slot again to look up the zone's node. Offlining a zone's last block
rebuilds the zonelists in place, so the second read can return the
terminator:
CPU 0 CPU 1
__next_zones_zonelist(nodemask)
zonelist_zone(slot 1) = NORMAL
offline_pages()
build_all_zonelists()
[MOVABLE, NORMAL, NULL]
-> [NORMAL, NULL]
zref_in_nodemask(slot 1)
zone_to_nid(NULL)
Current GCC and clang merge the two reads, but nothing requires it.
With mm/mmzone.o built with -fno-inline -fno-ipa-sra, holding a
nodemask allocation between the reads while the node's last movable
block goes offline oopses every time:
BUG: kernel NULL pointer dereference, address: 0000000000000060
RIP: 0010:zone_to_nid+0x0/0x10
Call Trace:
zref_in_nodemask+0x9/0x20
__next_zones_zonelist+0x23/0x70
prepare_alloc_pages.constprop.0+0x16c/0x190
__alloc_frozen_pages_noprof+0xaf/0x330
Read the slot once and test that zone. A NULL zone still ends the walk.
To achieve that, rename zref_in_nodemask() to zone_in_nodemask() and
pass a zone instead of zoneref pointer.
Fixes: 11cd8638c37f ("mm, page_alloc: remove stop_machine from build_all_zonelists")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Link: https://patch.msgid.link/20261101021340.2251928-8-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Adjusted the context line because the helper still has the old one-line signature, and took upstream's const nodemask_t * post-image unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/mmzone.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 0c8f181d9d500..cabe38127f798 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -43,12 +43,14 @@ struct zone *next_zone(struct zone *zone)
return zone;
}
-static inline int zref_in_nodemask(struct zoneref *zref, nodemask_t *nodes)
+/* A NULL zone terminates the zonelist, so it ends the search. */
+static inline bool zone_in_nodemask(const struct zone *zone,
+ const nodemask_t *nodes)
{
#ifdef CONFIG_NUMA
- return node_isset(zonelist_node_idx(zref), *nodes);
+ return !zone || node_isset(zone_to_nid(zone), *nodes);
#else
- return 1;
+ return true;
#endif /* CONFIG_NUMA */
}
@@ -66,7 +68,7 @@ struct zoneref *__next_zones_zonelist(struct zoneref *z,
z++;
else
while (zonelist_zone_idx(z) > highest_zoneidx ||
- (zonelist_zone(z) && !zref_in_nodemask(z, nodes)))
+ !zone_in_nodemask(zonelist_zone(z), nodes))
z++;
return z;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 019/703] mm/page_alloc: dont increase highatomic reserve after pcp alloc
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (17 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 018/703] mm/mmzone: read each zoneref slot once when filtering by nodemask Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 020/703] mm/page_alloc: use existing highatomic reserves on the buddy fastpath Greg Kroah-Hartman
` (388 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhiguo Jiang, Frank van der Linden,
Vlastimil Babka (SUSE), Brendan Jackman, Johannes Weiner,
Michal Hocko, Suren Baghdasaryan, Zi Yan, Andrew Morton,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank van der Linden <fvdl@google.com>
[ Upstream commit b480cbb071020bd590a0dc0166635b448e9fc46b ]
Higher order GFP_ATOMIC allocations can be served through a PCP list with
ALLOC_HIGHATOMIC set. Such an allocation can e.g. happen if a zone is
between the low and min watermarks, and get_page_from_freelist is retried
after the alloc_flags are relaxed.
The call to reserve_highatomic_pageblock() after such a PCP allocation
will result in an increase every single time: the page from the
(unmovable) PCP list will never have migrate type MIGRATE_HIGHATOMIC,
since MIGRATE_HIGHATOMIC pages do not appear on the unmovable PCP list.
So a new pageblock is converted to MIGRATE_HIGHATOMIC.
Eventually that leads to the maximum of 1% of the zone being used up by
(often mostly free) MIGRATE_HIGHATOMIC pageblocks, for no good reason.
Since this space is not available for normal allocations, this wastes
memory and will push things in to reclaim too soon.
This was observed on a system that ran a test with bursts of memory
activity, paired with GFP_ATOMIC SLUB activity. These would lead to a new
slab being allocated with GFP_ATOMIC, sometimes hitting the
get_page_from_freelist retry path by being below the low watermark. While
the frequency of those allocations was low, it kept adding up over time,
and the number of MIGRATE_ATOMIC pageblocks kept increasing.
If a higher order atomic allocation can be served by the unmovable PCP
list, there is probably no need yet to extend the reserves. So, move the
check and possible extension of the highatomic reserves to the buddy case
only, and do not refill the PCP list for ALLOC_HIGHATOMIC if it's empty.
This way, the PCP list is tried for ALLOC_HIGHATOMIC for a fast atomic
allocation. But it will immediately fall back to rmqueue_buddy() if it's
empty. In rmqueue_buddy(), the MIGRATE_HIGHATOMIC buddy lists are tried
first (as before), and the reserves are extended only if that fails.
With this change, the test was stable. Highatomic reserves were built up,
but to a normal level. No highatomic failures were seen.
This is similar to the patch proposed in [1] by Zhiguo Jiang, but
re-arranged a bit.
Link: https://lkml.kernel.org/r/20260320173426.1831267-1-fvdl@google.com
Link: https://lore.kernel.org/all/20231122013925.1507-1-justinjiang@vivo.com/ [1]
Fixes: 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com>
Signed-off-by: Frank van der Linden <fvdl@google.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zhiguo Jiang <justinjiang@vivo.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 074178f4d7a07..6b4a1dd7253e8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -244,6 +244,8 @@ unsigned int pageblock_order __read_mostly;
static void __free_pages_ok(struct page *page, unsigned int order,
fpi_t fpi_flags);
+static void reserve_highatomic_pageblock(struct page *page, int order,
+ struct zone *zone);
/*
* results with 256, 32 in the lowmem_reserve sysctl:
@@ -3256,6 +3258,13 @@ struct page *rmqueue_buddy(struct zone *preferred_zone, struct zone *zone,
spin_unlock_irqrestore(&zone->lock, flags);
} while (check_new_pages(page, order));
+ /*
+ * If this is a high-order atomic allocation then check
+ * if the pageblock should be reserved for the future
+ */
+ if (unlikely(alloc_flags & ALLOC_HIGHATOMIC))
+ reserve_highatomic_pageblock(page, order, zone);
+
__count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
zone_statistics(preferred_zone, zone, 1);
@@ -3327,6 +3336,20 @@ struct page *__rmqueue_pcplist(struct zone *zone, unsigned int order,
int batch = nr_pcp_alloc(pcp, zone, order);
int alloced;
+ /*
+ * Don't refill the list for a higher order atomic
+ * allocation under memory pressure, as this would
+ * not build up any HIGHATOMIC reserves, which
+ * might be needed soon.
+ *
+ * Instead, direct it towards the reserves by
+ * returning NULL, which will make the caller fall
+ * back to rmqueue_buddy. This will try to use the
+ * reserves first and grow them if needed.
+ */
+ if (alloc_flags & ALLOC_HIGHATOMIC)
+ return NULL;
+
alloced = rmqueue_bulk(zone, order,
batch, list,
migratetype, alloc_flags);
@@ -3955,13 +3978,6 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
if (page) {
prep_new_page(page, order, gfp_mask, alloc_flags);
- /*
- * If this is a high-order atomic allocation then check
- * if the pageblock should be reserved for the future
- */
- if (unlikely(alloc_flags & ALLOC_HIGHATOMIC))
- reserve_highatomic_pageblock(page, order, zone);
-
return page;
} else {
if (cond_accept_memory(zone, order, alloc_flags))
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 020/703] mm/page_alloc: use existing highatomic reserves on the buddy fastpath
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (18 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 019/703] mm/page_alloc: dont increase highatomic reserve after pcp alloc Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 021/703] xprtrdma: serialize unmap_sync with xprt_disconnect Greg Kroah-Hartman
` (387 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, JP Kobryn, Vlastimil Babka (SUSE),
Johannes Weiner, Shakeel Butt, Brendan Jackman, David Hildenbrand,
Frank van der Linden, Liam R. Howlett, Lorenzo Stoakes,
Michal Hocko, Mike Rapoport, Suren Baghdasaryan, Zi Yan,
Andrew Morton, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: JP Kobryn <jp.kobryn@linux.dev>
[ Upstream commit 9f2fd03c9bde366c928c9242fc9b2e2c5111a134 ]
ALLOC_HIGHATOMIC currently provides both access to MIGRATE_HIGHATOMIC free
pages and permission to create new highatomic pageblock reserves. This
makes it unsuitable for the fastpath.
However, the fastpath can reach rmqueue_buddy() while MIGRATE_HIGHATOMIC
reserves have free pages available. In this situation, the allocation can
fall back to other migratetypes without trying those reserves first.
Allow high-priority non-blocking allocations to use existing
MIGRATE_HIGHATOMIC reserves on the buddy fastpath without growing them.
First tighten the criteria for reserving pageblocks so that growth may
only occur in the slowpath. Then allow fastpath usage by enabling
ALLOC_HIGHATOMIC when the GFP mask describes a non-blocking high-priority
allocation. This logic has been factored out from gfp_to_alloc_flags() to
a new function gfp_to_alloc_flags_nonblocking().
A UDP receive workload was run with free MIGRATE_HIGHATOMIC pageblocks
available in the target zone. Before this patch, the workload did not
consume these blocks. With this patch, eligible order-1 allocations
reaching the buddy path consumed existing MIGRATE_HIGHATOMIC pageblocks,
with no highatomic misses observed. The workload did not grow highatomic
reserves and NAPI page-frag allocations remained healthy with no failures
or order-0 fallbacks.
Link: https://lore.kernel.org/20260623004600.113347-1-jp.kobryn@linux.dev
Signed-off-by: JP Kobryn <jp.kobryn@linux.dev>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Frank van der Linden <fvdl@google.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6b4a1dd7253e8..7c10d42e31d8f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3259,10 +3259,11 @@ struct page *rmqueue_buddy(struct zone *preferred_zone, struct zone *zone,
} while (check_new_pages(page, order));
/*
- * If this is a high-order atomic allocation then check
- * if the pageblock should be reserved for the future
+ * Slowpath (precarious) high-atomic allocations may reserve
+ * a pageblock for future use.
*/
- if (unlikely(alloc_flags & ALLOC_HIGHATOMIC))
+ if (unlikely((alloc_flags & ALLOC_HIGHATOMIC) &&
+ ((alloc_flags & ALLOC_WMARK_MASK) == ALLOC_WMARK_MIN)))
reserve_highatomic_pageblock(page, order, zone);
__count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
@@ -4544,6 +4545,29 @@ static void wake_all_kswapds(unsigned int order, gfp_t gfp_mask,
}
}
+static inline unsigned int
+gfp_to_alloc_flags_nonblocking(gfp_t gfp_mask, unsigned int order)
+{
+ unsigned int alloc_flags = 0;
+
+ if (gfp_mask & __GFP_DIRECT_RECLAIM)
+ return 0;
+
+ /*
+ * Not worth trying to allocate harder for __GFP_NOMEMALLOC even
+ * if it can't schedule.
+ */
+ if (gfp_mask & __GFP_NOMEMALLOC)
+ return 0;
+
+ alloc_flags |= ALLOC_NON_BLOCK;
+
+ if (order > 0 && (gfp_mask & __GFP_HIGH))
+ alloc_flags |= ALLOC_HIGHATOMIC;
+
+ return alloc_flags;
+}
+
static inline unsigned int
gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
{
@@ -4566,18 +4590,9 @@ gfp_to_alloc_flags(gfp_t gfp_mask, unsigned int order)
alloc_flags |= (__force int)
(gfp_mask & (__GFP_HIGH | __GFP_KSWAPD_RECLAIM));
- if (!(gfp_mask & __GFP_DIRECT_RECLAIM)) {
- /*
- * Not worth trying to allocate harder for __GFP_NOMEMALLOC even
- * if it can't schedule.
- */
- if (!(gfp_mask & __GFP_NOMEMALLOC)) {
- alloc_flags |= ALLOC_NON_BLOCK;
-
- if (order > 0 && (alloc_flags & ALLOC_MIN_RESERVE))
- alloc_flags |= ALLOC_HIGHATOMIC;
- }
+ alloc_flags |= gfp_to_alloc_flags_nonblocking(gfp_mask, order);
+ if (!(gfp_mask & __GFP_DIRECT_RECLAIM)) {
/*
* Ignore cpuset mems for non-blocking __GFP_HIGH (probably
* GFP_ATOMIC) rather than fail, see the comment for
@@ -5370,6 +5385,7 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
* memory until all local zones are considered.
*/
alloc_flags |= alloc_flags_nofragment(zonelist_zone(ac.preferred_zoneref), gfp);
+ alloc_flags |= gfp_to_alloc_flags_nonblocking(gfp, order) & ALLOC_HIGHATOMIC;
/* First allocation attempt */
page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 021/703] xprtrdma: serialize unmap_sync with xprt_disconnect
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (19 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 020/703] mm/page_alloc: use existing highatomic reserves on the buddy fastpath Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 022/703] gve: Fix race between stats query and queue reconfig Greg Kroah-Hartman
` (386 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever, Tim Menninger,
Anna Schumaker, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Menninger <tmenninger@everpuredata.com>
[ Upstream commit 1fa415883c37b02ff17acdd7977ed591d3d389ee ]
frwr_unmap_sync() posts LOCAL_INV Work Requests to the QP and waits
for the matching CQE. This can race with rpcrdma_xprt_disconnect():
1. frwr_unmap_sync() samples r_xprt->rx_ep
2. rpcrdma_xprt_disconnect() drains the QP
3. frwr_unmap_sync() posts LOCAL_INV WRs after the drain
4. No CQE arrives, so wait_for_completion() blocks indefinitely
The hung task appears in the rpciod workqueue:
Workqueue: rpciod rpc_async_schedule [sunrpc]
wait_for_completion()
frwr_unmap_sync()
xprt_rdma_free()
xprt_release()
Serialize synchronous MR invalidation against QP teardown with
rx_unmap_rwsem. frwr_unmap_sync() holds the read side while it builds
and submits the LOCAL_INV chain. Disconnect holds the write side across
QP drain and resource teardown. Drop the read side before waiting so
disconnect can drain the submitted Work Requests and deliver their CQEs.
Disconnect can reset a request while frwr_unmap_sync() waits for the
read side. Recheck rl_registered after acquiring the rwsem and return
without posting if the request has already been reset.
Move the synchronous invalidation completion from the final MR to the
request, whose lifetime covers xprt_rdma_free(). This allows disconnect
to destroy MRs after draining the QP while frwr_unmap_sync() is still
waiting. On a post failure, call rpcrdma_force_disconnect() before
dropping the read side so the endpoint is not dereferenced after
disconnect can run.
frwr_unmap_async() runs inline from Receive completion processing.
rpcrdma_xprt_drain() drains the Receive Queue before the Send Queue, so
asynchronous LOCAL_INV Work Requests are submitted before Send Queue
drain. frwr_unmap_sync(), however, runs from xprt_rdma_free() after the
transport send lock has been released, so it is not ordered against
disconnect.
Tested on v7.4-rc1 under pNFS load with repeated data server restarts
to provoke rapid QP disconnect/reconnect cycling. Without the fix, a
hung task in frwr_unmap_sync() reproduced twice in six attempts. With
the fix, no hang occurred across 200 cycles.
Also observed on v6.8 and v6.18.34.
Fixes: e28ce90083f0 ("xprtrdma: kmalloc rpcrdma_ep separate from rpcrdma_xprt")
Cc: stable@vger.kernel.org
Assisted-by: Claude:opus-4-7
Reviewed-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/xprtrdma/frwr_ops.c | 89 ++++++++++++++++++++-------------
net/sunrpc/xprtrdma/transport.c | 2 +
net/sunrpc/xprtrdma/verbs.c | 16 ++++--
net/sunrpc/xprtrdma/xprt_rdma.h | 10 +++-
4 files changed, 78 insertions(+), 39 deletions(-)
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index a82eefe5e6b58..90107c4e8317a 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -27,13 +27,17 @@
/* Transport recovery
*
- * frwr_map and frwr_unmap_* cannot run at the same time the transport
- * connect worker is running. The connect worker holds the transport
- * send lock, just as ->send_request does. This prevents frwr_map and
- * the connect worker from running concurrently. When a connection is
- * closed, the Receive completion queue is drained before the allowing
- * the connect worker to get control. This prevents frwr_unmap and the
- * connect worker from running concurrently.
+ * frwr_map() is serialized with the connect worker by the transport
+ * send lock.
+ *
+ * frwr_unmap_async() runs from Receive completion processing.
+ * rpcrdma_xprt_drain() drains the Receive Queue before the Send Queue,
+ * so asynchronous LOCAL_INV Work Requests are submitted before Send
+ * Queue drain.
+ *
+ * frwr_unmap_sync() runs after the transport send lock is released.
+ * rx_unmap_rwsem orders its LOCAL_INV submission before disconnect
+ * drains the QP.
*
* When the underlying transport disconnects, MRs that are in flight
* are flushed and are likely unusable. Thus all MRs are destroyed.
@@ -139,7 +143,6 @@ int frwr_mr_init(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr *mr)
mr->mr_ibmr = frmr;
mr->mr_device = NULL;
INIT_LIST_HEAD(&mr->mr_list);
- init_completion(&mr->mr_linv_done);
frwr_cid_init(ep, mr);
sg_init_table(sg, depth);
@@ -468,40 +471,60 @@ static void frwr_wc_localinv(struct ib_cq *cq, struct ib_wc *wc)
* @cq: completion queue
* @wc: WCE for a completed LocalInv WR
*
- * Awaken anyone waiting for an MR to finish being fenced.
+ * Wake frwr_unmap_sync() after the final LOCAL_INV completion.
*/
static void frwr_wc_localinv_wake(struct ib_cq *cq, struct ib_wc *wc)
{
struct ib_cqe *cqe = wc->wr_cqe;
struct rpcrdma_mr *mr = container_of(cqe, struct rpcrdma_mr, mr_cqe);
+ struct rpcrdma_req *req = mr->mr_req;
/* WARNING: Only wr_cqe and status are reliable at this point */
trace_xprtrdma_wc_li_wake(wc, &mr->mr_cid);
frwr_mr_done(wc, mr);
- complete(&mr->mr_linv_done);
+ complete(&req->rl_linv_done);
rpcrdma_flush_disconnect(cq->cq_context, wc);
}
/**
- * frwr_unmap_sync - invalidate memory regions that were registered for @req
+ * frwr_unmap_sync - synchronously invalidate MRs registered for @req
* @r_xprt: controlling transport instance
- * @req: rpcrdma_req with a non-empty list of MRs to process
+ * @req: request whose registered MRs are to be invalidated
*
- * Sleeps until it is safe for the host CPU to access the previously mapped
- * memory regions. This guarantees that registered MRs are properly fenced
- * from the server before the RPC consumer accesses the data in them. It
- * also ensures proper Send flow control: waking the next RPC waits until
- * this RPC has relinquished all its Send Queue entries.
+ * If @req still owns registered MRs after synchronizing with transport
+ * disconnect, post a chain of LOCAL_INV Work Requests and wait for the
+ * final completion. On successful completion, this fences the mapped
+ * regions from remote access and preserves Send Queue flow control.
+ *
+ * A concurrent disconnect can reset @req while this function waits for
+ * the read side. In that case the MRs have already been released and no
+ * LOCAL_INV Work Requests are posted.
+ *
+ * Context: Process context. Takes and releases
+ * @r_xprt->rx_unmap_rwsem for read. May sleep.
*/
void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
{
struct ib_send_wr *first, **prev, *last;
- struct rpcrdma_ep *ep = r_xprt->rx_ep;
const struct ib_send_wr *bad_wr;
+ struct rpcrdma_ep *ep;
struct rpcrdma_mr *mr;
int rc;
+ /* serialize against rpcrdma_xprt_disconnect() */
+ down_read(&r_xprt->rx_unmap_rwsem);
+
+ /*
+ * Disconnect can reset this request while we wait for the read side.
+ * Recheck rl_registered in case rx_ep now refers to a new connection.
+ */
+ ep = r_xprt->rx_ep;
+ if (!ep || list_empty(&req->rl_registered)) {
+ up_read(&r_xprt->rx_unmap_rwsem);
+ return;
+ }
+
/* ORDER: Invalidate all of the MRs first
*
* Chain the LOCAL_INV Work Requests and post them with
@@ -528,37 +551,35 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
prev = &last->next;
} while ((mr = rpcrdma_mr_pop(&req->rl_registered)));
- mr = container_of(last, struct rpcrdma_mr, mr_invwr);
-
/* Strong send queue ordering guarantees that when the
* last WR in the chain completes, all WRs in the chain
* are complete.
*/
last->wr_cqe->done = frwr_wc_localinv_wake;
- reinit_completion(&mr->mr_linv_done);
+ reinit_completion(&req->rl_linv_done);
- /* Transport disconnect drains the receive CQ before it
- * replaces the QP. The RPC reply handler won't call us
- * unless re_id->qp is a valid pointer.
+ /*
+ * The read side prevents disconnect from draining this QP until the
+ * LOCAL_INV chain has been submitted.
*/
bad_wr = NULL;
rc = ib_post_send(ep->re_id->qp, first, &bad_wr);
+ if (rc) {
+ /* On error, the MRs get destroyed once the QP has drained. */
+ trace_xprtrdma_post_linv_err(req, rc);
+
+ /* Force a connection loss to ensure complete recovery.
+ */
+ rpcrdma_force_disconnect(ep);
+ }
+ up_read(&r_xprt->rx_unmap_rwsem);
/* The final LOCAL_INV WR in the chain is supposed to
* do the wake. If it was never posted, the wake will
* not happen, so don't wait in that case.
*/
if (bad_wr != first)
- wait_for_completion(&mr->mr_linv_done);
- if (!rc)
- return;
-
- /* On error, the MRs get destroyed once the QP has drained. */
- trace_xprtrdma_post_linv_err(req, rc);
-
- /* Force a connection loss to ensure complete recovery.
- */
- rpcrdma_force_disconnect(ep);
+ wait_for_completion(&req->rl_linv_done);
}
/**
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 5ff8e5126a6c2..308fd79e09df3 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -364,6 +364,8 @@ xprt_setup_rdma(struct xprt_create *args)
INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
xprt_rdma_connect_worker);
+ init_rwsem(&new_xprt->rx_unmap_rwsem);
+
xprt->max_payload = RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT;
return xprt;
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 111c415f1aeda..3c44c2c28c4f3 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -572,20 +572,24 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
* rpcrdma_xprt_disconnect - Disconnect underlying transport
* @r_xprt: controlling transport instance
*
- * Caller serializes. Either the transport send lock is held,
- * or we're being called to destroy the transport.
+ * Context: Caller serializes. Either the transport send lock is held,
+ * or the transport is being destroyed. Takes and releases
+ * @r_xprt->rx_unmap_rwsem for write. May sleep.
*
* On return, @r_xprt is completely divested of all hardware
* resources and prepared for the next ->connect operation.
*/
void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
{
- struct rpcrdma_ep *ep = r_xprt->rx_ep;
+ struct rpcrdma_ep *ep;
struct rdma_cm_id *id;
int rc;
+ down_write(&r_xprt->rx_unmap_rwsem);
+
+ ep = r_xprt->rx_ep;
if (!ep)
- return;
+ goto out_unlock;
/* Prevent teardown-generated events from requesting another close. */
atomic_xchg(&ep->re_force_disconnect, 1);
@@ -604,6 +608,9 @@ void rpcrdma_xprt_disconnect(struct rpcrdma_xprt *r_xprt)
rdma_destroy_id(id);
r_xprt->rx_ep = NULL;
+
+out_unlock:
+ up_write(&r_xprt->rx_unmap_rwsem);
}
/* Fixed-size circular FIFO queue. This implementation is wait-free and
@@ -912,6 +919,7 @@ struct rpcrdma_req *rpcrdma_req_create(struct rpcrdma_xprt *r_xprt,
INIT_LIST_HEAD(&req->rl_free_mrs);
INIT_LIST_HEAD(&req->rl_registered);
+ init_completion(&req->rl_linv_done);
spin_lock(&buffer->rb_lock);
list_add(&req->rl_all, &buffer->rb_allreqs);
spin_unlock(&buffer->rb_lock);
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index ae14f6a526e6e..d8e02a06771f4 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -46,6 +46,7 @@
#include <linux/spinlock.h> /* spinlock_t, etc */
#include <linux/atomic.h> /* atomic_t, etc */
#include <linux/kref.h> /* struct kref */
+#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/workqueue.h> /* struct work_struct */
#include <linux/llist.h>
@@ -248,7 +249,6 @@ struct rpcrdma_mr {
int mr_nents;
enum dma_data_direction mr_dir;
struct ib_cqe mr_cqe;
- struct completion mr_linv_done;
union {
struct ib_reg_wr mr_regwr;
struct ib_send_wr mr_invwr;
@@ -331,6 +331,7 @@ struct rpcrdma_req {
struct list_head rl_free_mrs;
struct list_head rl_registered;
struct rpcrdma_mr_seg rl_segments[RPCRDMA_MAX_SEGS];
+ struct completion rl_linv_done;
};
static inline struct rpcrdma_req *
@@ -432,6 +433,13 @@ struct rpcrdma_xprt {
struct delayed_work rx_connect_worker;
struct rpc_timeout rx_timeout;
struct rpcrdma_stats rx_stats;
+
+ /*
+ * Orders frwr_unmap_sync()'s LOCAL_INV submission ahead of the
+ * QP drain. Disconnect holds the write side across the drain
+ * and resource teardown.
+ */
+ struct rw_semaphore rx_unmap_rwsem;
};
#define rpcx_to_rdmax(x) container_of(x, struct rpcrdma_xprt, rx_xprt)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 022/703] gve: Fix race between stats query and queue reconfig
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (20 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 021/703] xprtrdma: serialize unmap_sync with xprt_disconnect Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 023/703] gve: Block invalid ring sizes when device options are 0 Greg Kroah-Hartman
` (385 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Debarghya Kundu, Pin-yen Lin,
Harshitha Ramamurthy, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pin-yen Lin <treapking@google.com>
[ Upstream commit 7de69da15088ac2add08eb2b5f5c0a79fd461c1e ]
Fix a concurrency bug where network statistics queries race with queue
reconfiguration or interface teardown, causing a Use-After-Free (UAF) or
NULL pointer dereference.
Currently, statistics queries access priv->tx and priv->rx without
locking. When an interface is brought down or reconfigured,
gve_queues_mem_remove() frees these arrays. A concurrent stats query
can dereference freed queue structures and crash the kernel.
This issue was discovered and actually triggered by the
drivers/net/stats.py selftest. When an interface was brought down,
querying per-queue statistics via Netlink caused a kernel NULL pointer
dereference in gve_get_rx_queue_stats():
BUG: kernel NULL pointer dereference, address: 00000000000000a0
RIP: 0010:gve_get_rx_queue_stats+0x17/0x50 [gve]
Call Trace:
<TASK>
netdev_stat_queue_sum+0x11c/0x250
netdev_nl_stats_by_netdev+0x21b/0x2d0
netdev_nl_qstats_get_dumpit+0xd2/0x220
genl_dumpit+0x32/0x90
netlink_dump+0x1d2/0x450
__netlink_dump_start+0x1db/0x2a0
genl_family_rcv_msg_dumpit+0x9b/0x100
...
The per-queue stats callbacks run under the netdev instance lock, so
this NULL dereference is not a race; it happens on any query while the
interface is down.
Additionally, concurrent stats queries during queue reconfiguration can
race with gve_queues_mem_remove(), causing a Use-After-Free.
This affects gve_get_stats(), which does not hold the instance lock.
gve_handle_report_stats() also runs without it; it is stopped before
queue teardown, but can still read priv->rx[idx] while the single-queue
restart path rewrites it.
Fix this by introducing stats_lock to serialize stats queries against
queue teardown. In gve_queues_mem_remove(), queue pointers are set to
NULL under stats_lock before freeing. Stats readers acquire the lock
and verify pointers are non-NULL before reading counters.
The per-queue stats callbacks already run under the instance lock, but
take stats_lock as well for consistency.
The single-queue restart path also rewrites priv->rx[idx] in place, so
gve_rx_queue_stop() and gve_rx_queue_start() do those writes under
stats_lock as well.
This change was tested using the DQO RDA queue format.
Cc: stable@vger.kernel.org
Fixes: f5cedc84a30d ("gve: Add transmit and receive support")
Fixes: 2e5e0932dff5 ("gve: add support for basic queue stats")
Co-developed-by: Debarghya Kundu <debarghyak@google.com>
Signed-off-by: Debarghya Kundu <debarghyak@google.com>
Signed-off-by: Pin-yen Lin <treapking@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20261109182036.2910559-2-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Adjusted context in gve_queues_start() and gve_queues_mem_remove() because this tree lacks the qpl, header-split and packet-buffer-size lines, so the unlock follows rx_desc_cnt. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/google/gve/gve.h | 5 +++
drivers/net/ethernet/google/gve/gve_main.c | 43 ++++++++++++++++++++--
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h
index f0bc910dd6d44..2aecaf892d659 100644
--- a/drivers/net/ethernet/google/gve/gve.h
+++ b/drivers/net/ethernet/google/gve/gve.h
@@ -877,6 +877,11 @@ struct gve_priv {
struct workqueue_struct *gve_wq;
struct work_struct service_task;
struct work_struct stats_report_task;
+ /* Protects the priv->tx/priv->rx arrays, the in-place rewrite of
+ * priv->rx[idx] and the queue counts against stats readers that do
+ * not hold the netdev instance lock.
+ */
+ spinlock_t stats_lock;
unsigned long service_task_flags;
unsigned long state_flags;
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 9b1f8933813cb..66a3b526b5a6f 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -113,6 +113,7 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
int num_tx_queues;
int ring;
+ spin_lock_bh(&priv->stats_lock);
num_tx_queues = gve_num_tx_queues(priv);
if (priv->rx) {
for (ring = 0; ring < priv->rx_cfg.num_queues; ring++) {
@@ -140,6 +141,7 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s)
s->tx_bytes += bytes;
}
}
+ spin_unlock_bh(&priv->stats_lock);
}
static int gve_alloc_flow_rule_caches(struct gve_priv *priv)
@@ -1343,9 +1345,13 @@ static void gve_queues_mem_remove(struct gve_priv *priv)
struct gve_rx_alloc_rings_cfg rx_alloc_cfg = {0};
gve_get_curr_alloc_cfgs(priv, &tx_alloc_cfg, &rx_alloc_cfg);
- gve_queues_mem_free(priv, &tx_alloc_cfg, &rx_alloc_cfg);
+
+ spin_lock_bh(&priv->stats_lock);
priv->tx = NULL;
priv->rx = NULL;
+ spin_unlock_bh(&priv->stats_lock);
+
+ gve_queues_mem_free(priv, &tx_alloc_cfg, &rx_alloc_cfg);
}
/* The passed-in queue memory is stored into priv and the queues are made live.
@@ -1359,6 +1365,7 @@ static int gve_queues_start(struct gve_priv *priv,
int err;
/* Record new resources into priv */
+ spin_lock_bh(&priv->stats_lock);
priv->tx = tx_alloc_cfg->tx;
priv->rx = rx_alloc_cfg->rx;
@@ -1368,10 +1375,11 @@ static int gve_queues_start(struct gve_priv *priv,
priv->rx_cfg = *rx_alloc_cfg->qcfg_rx;
priv->tx_desc_cnt = tx_alloc_cfg->ring_size;
priv->rx_desc_cnt = rx_alloc_cfg->ring_size;
+ gve_init_sync_stats(priv);
+ spin_unlock_bh(&priv->stats_lock);
gve_tx_start_rings(priv, gve_num_tx_queues(priv));
gve_rx_start_rings(priv, rx_alloc_cfg->qcfg_rx->num_queues);
- gve_init_sync_stats(priv);
err = netif_set_real_num_tx_queues(dev, priv->tx_cfg.num_queues);
if (err)
@@ -2265,6 +2273,7 @@ void gve_handle_report_stats(struct gve_priv *priv)
if (!gve_get_report_stats(priv))
return;
+ spin_lock_bh(&priv->stats_lock);
be64_add_cpu(&priv->stats_report->written_count, 1);
/* tx stats */
if (priv->tx) {
@@ -2329,6 +2338,7 @@ void gve_handle_report_stats(struct gve_priv *priv)
};
}
}
+ spin_unlock_bh(&priv->stats_lock);
}
/* Handle NIC status register changes, reset requests and report stats */
@@ -2601,8 +2611,10 @@ static int gve_rx_queue_stop(struct net_device *dev, void *per_q_mem, int idx)
gve_turnup_and_check_status(priv);
gve_per_q_mem = (struct gve_rx_ring *)per_q_mem;
+ spin_lock_bh(&priv->stats_lock);
*gve_per_q_mem = priv->rx[idx];
memset(&priv->rx[idx], 0, sizeof(priv->rx[idx]));
+ spin_unlock_bh(&priv->stats_lock);
return 0;
}
@@ -2656,7 +2668,9 @@ static int gve_rx_queue_start(struct net_device *dev,
return -EAGAIN;
gve_per_q_mem = (struct gve_rx_ring *)per_q_mem;
+ spin_lock_bh(&priv->stats_lock);
priv->rx[idx] = *gve_per_q_mem;
+ spin_unlock_bh(&priv->stats_lock);
/* Single-queue creation requires quiescence on all queues */
gve_turndown(priv);
@@ -2692,7 +2706,9 @@ static int gve_rx_queue_start(struct net_device *dev,
* which needs the rtnl lock, will not run till this func returns and
* its caller gives up the lock.
*/
+ spin_lock_bh(&priv->stats_lock);
memset(&priv->rx[idx], 0, sizeof(priv->rx[idx]));
+ spin_unlock_bh(&priv->stats_lock);
return err;
}
@@ -2708,9 +2724,15 @@ static void gve_get_rx_queue_stats(struct net_device *dev, int idx,
struct netdev_queue_stats_rx *rx_stats)
{
struct gve_priv *priv = netdev_priv(dev);
- struct gve_rx_ring *rx = &priv->rx[idx];
+ struct gve_rx_ring *rx;
unsigned int start;
+ spin_lock_bh(&priv->stats_lock);
+ if (!priv->rx)
+ goto unlock;
+
+ rx = &priv->rx[idx];
+
do {
start = u64_stats_fetch_begin(&rx->statss);
rx_stats->packets = rx->rpackets;
@@ -2718,20 +2740,32 @@ static void gve_get_rx_queue_stats(struct net_device *dev, int idx,
rx_stats->alloc_fail = rx->rx_skb_alloc_fail +
rx->rx_buf_alloc_fail;
} while (u64_stats_fetch_retry(&rx->statss, start));
+
+unlock:
+ spin_unlock_bh(&priv->stats_lock);
}
static void gve_get_tx_queue_stats(struct net_device *dev, int idx,
struct netdev_queue_stats_tx *tx_stats)
{
struct gve_priv *priv = netdev_priv(dev);
- struct gve_tx_ring *tx = &priv->tx[idx];
+ struct gve_tx_ring *tx;
unsigned int start;
+ spin_lock_bh(&priv->stats_lock);
+ if (!priv->tx)
+ goto unlock;
+
+ tx = &priv->tx[idx];
+
do {
start = u64_stats_fetch_begin(&tx->statss);
tx_stats->packets = tx->pkt_done;
tx_stats->bytes = tx->bytes_done;
} while (u64_stats_fetch_retry(&tx->statss, start));
+
+unlock:
+ spin_unlock_bh(&priv->stats_lock);
}
static void gve_get_base_stats(struct net_device *dev,
@@ -2848,6 +2882,7 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
INIT_WORK(&priv->service_task, gve_service_task);
INIT_WORK(&priv->stats_report_task, gve_stats_report_task);
+ spin_lock_init(&priv->stats_lock);
priv->tx_cfg.max_queues = max_tx_queues;
priv->rx_cfg.max_queues = max_rx_queues;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 023/703] gve: Block invalid ring sizes when device options are 0
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (21 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 022/703] gve: Fix race between stats query and queue reconfig Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 024/703] net: wait for in-flight device unregistrations before netns dismantle Greg Kroah-Hartman
` (384 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pin-yen Lin, Joshua Washington,
Jordan Rhee, Harshitha Ramamurthy, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pin-yen Lin <treapking@google.com>
[ Upstream commit edc9a730ad3c98662047a76db2d7f26ea4350b2e ]
On older device versions, minimum ring sizes in the device option are
reported as 0. The driver imports these 0 values, allowing userspace
(`ethtool -G`) to request invalidly small ring sizes.
This issue was discovered and actually triggered by the
drivers/net/ring_reconfig.py selftest (ringparam test case). Halving the
ring size down to 1 triggered a kernel NULL pointer dereference in
gve_tx_alloc_rings_dqo():
BUG: kernel NULL pointer dereference, address: 0000000000000002
RIP: 0010:gve_tx_alloc_rings_dqo+0x1c4/0x510 [gve]
Call Trace:
<TASK>
gve_queues_mem_alloc+0x29/0xa0 [gve]
gve_adjust_config+0x1b/0x140 [gve]
gve_set_ringparam+0x1f4/0x250 [gve]
ethnl_set_rings+0x260/0x440
...
Fix this by falling back to the driver's default minimum ring sizes
(GVE_DEFAULT_MIN_RX_RING_SIZE and GVE_DEFAULT_MIN_TX_RING_SIZE) whenever
the device option reports minimum ring sizes as 0.
The device reports either both minimum ring sizes or neither, so a
single fallback for both is sufficient.
This change was tested using the DQO RDA queue format.
Cc: stable@vger.kernel.org
Fixes: ed4fb326947d ("gve: add support to read ring size ranges from the device")
Signed-off-by: Pin-yen Lin <treapking@google.com>
Reviewed-by: Joshua Washington <joshwash@google.com>
Reviewed-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20261109182036.2910559-4-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/google/gve/gve_adminq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
index 367a9f0e89b5c..bcd9a340cefc2 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.c
+++ b/drivers/net/ethernet/google/gve/gve_adminq.c
@@ -189,7 +189,9 @@ void gve_parse_device_option(struct gve_priv *priv,
*dev_op_modify_ring = (void *)(option + 1);
/* device has not provided min ring size */
- if (option_length == GVE_DEVICE_OPTION_NO_MIN_RING_SIZE)
+ if (option_length == GVE_DEVICE_OPTION_NO_MIN_RING_SIZE ||
+ be16_to_cpu((*dev_op_modify_ring)->min_rx_ring_size) == 0 ||
+ be16_to_cpu((*dev_op_modify_ring)->min_tx_ring_size) == 0)
priv->default_min_ring_size = true;
break;
case GVE_DEV_OPT_ID_FLOW_STEERING:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 024/703] net: wait for in-flight device unregistrations before netns dismantle
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (22 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 023/703] gve: Block invalid ring sizes when device options are 0 Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 025/703] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
` (383 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+1269fe6cc2016008124e,
Henry Martin, Eric Dumazet, Naman Gulati, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit c164a431a646983275d0076ff5b0e4c326fbc10b ]
A device can be unregistered by a context other than the cleanup_net()
of its own netns, for instance a veth whose peer in another netns is
deleted. If references on it are still held, it stays in
netdev_wait_allrefs_any(), which rebroadcasts NETDEV_UNREGISTER every
second.
Meanwhile its netns can be dismantled: default_device_exit_batch()
only takes care of devices still listed in the netns, then pernet exit
handlers free their state, and finally struct net is freed while the
device still points to it.
The rebroadcasts then run notifiers against torn down pernet state, or
freed memory. Three instances were reported so far:
- netdev_genl_netdevice_event(): net->genl_sock is NULL [1]
- nh_netdev_event(): net->nexthop.devhash is NULL [2]
- nf_tables netdevice notifiers: use-after-free of the nftables
pernet storage [3]
but any notifier using dev_net(dev) is affected, as is
netdev_wait_allrefs_any() itself (__rtnl_net_lock(dev_net(dev)) with
CONFIG_DEBUG_NET_SMALL_RTNL=y).
This was prevented by rtnl_lock_unregistering() until I removed it
in commit 8a4fc54b07d7 ("net: get rid of rtnl_lock_unregistering()"),
considering only the loopback dependency, and missing the notifiers one.
Restore a per-netns counter of devices sitting in netdev_run_todo(),
and make default_device_exit_batch() wait for it to reach zero, after
it has unregistered all devices of the dying netns(es). At this point
no new unregistration can be started for these netns.
Unlike the old barrier, this only waits for devices of the netns being
dismantled and runs after their own devices are gone.
Tested on a KASAN kernel with a debug-only hack holding a reference
on a veth device for 5 seconds after its unregistration: a nexthop
on the veth in netns X, delete its peer from init_net, then delete X.
Without this patch, the nexthop_flush_dev() null-ptr-deref from [2]
triggers. With it, no splat; netns churn and dismantle of a netns
whose own device is held still work.
[1] https://lore.kernel.org/netdev/6adf9f64.6200f071.51519.0ed1.GAE@google.com/
[2] https://lore.kernel.org/netdev/20261105114707.3030737-1-bsdhenrymartin@gmail.com/
[3] https://lore.kernel.org/netdev/20261105114817.3033625-1-bsdhenrymartin@gmail.com/
Fixes: 8a4fc54b07d7 ("net: get rid of rtnl_lock_unregistering()")
Cc: stable@vger.kernel.org
Reported-by: syzbot+1269fe6cc2016008124e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6adf9f64.6200f071.51519.0ed1.GAE@google.com/
Reported-by: Henry Martin <bsdhenrymartin@gmail.com>
Closes: https://lore.kernel.org/netdev/20261105114707.3030737-1-bsdhenrymartin@gmail.com/
Closes: https://lore.kernel.org/netdev/20261105114817.3033625-1-bsdhenrymartin@gmail.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Naman Gulati <namangulati@google.com>
Link: https://patch.msgid.link/20261105144543.1624238-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: dropped the nonexistent dev_mc_genid and rtnl_net_flush_workqueue() context lines, keeping only the added dev_unreg_pending field and wait_event(), with fuzz in netdev_run_todo(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/net_namespace.h | 1 +
net/core/dev.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 9a1d7ef17c4e9..9f16cca93227b 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -68,6 +68,7 @@ struct net {
spinlock_t rules_mod_lock;
unsigned int dev_base_seq; /* protected by rtnl_mutex */
+ atomic_t dev_unreg_pending; /* devices in netdev_run_todo() */
u32 ifindex;
spinlock_t nsid_lock;
diff --git a/net/core/dev.c b/net/core/dev.c
index f7e672a4a39f7..7b88c6b8aa4f9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10832,6 +10832,14 @@ atomic_t dev_unreg_count = ATOMIC_INIT(0);
static void net_set_todo(struct net_device *dev)
{
list_add_tail(&dev->todo_list, &net_todo_list);
+ atomic_inc(&dev_net(dev)->dev_unreg_pending);
+}
+
+/* Paired with net_set_todo(). @net must not be used after this call. */
+static void net_unreg_done(struct net *net)
+{
+ if (atomic_dec_and_test(&net->dev_unreg_pending))
+ wake_up(&netdev_unregistering_wq);
}
static netdev_features_t netdev_sync_upper_features(struct net_device *lower,
@@ -11721,6 +11729,7 @@ void netdev_run_todo(void)
if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
netdev_WARN(dev, "run_todo but not unregistering\n");
list_del(&dev->todo_list);
+ net_unreg_done(dev_net(dev));
continue;
}
@@ -11732,8 +11741,11 @@ void netdev_run_todo(void)
cnt = 0;
while (!list_empty(&list)) {
+ struct net *net;
+
dev = netdev_wait_allrefs_any(&list);
list_del(&dev->todo_list);
+ net = dev_net(dev);
/* paranoia */
BUG_ON(netdev_refcnt_read(dev) != 1);
@@ -11752,6 +11764,8 @@ void netdev_run_todo(void)
/* Free network device */
kobject_put(&dev->dev.kobj);
+
+ net_unreg_done(net);
}
if (cnt && atomic_sub_and_test(cnt, &dev_unreg_count))
wake_up(&netdev_unregistering_wq);
@@ -13079,6 +13093,17 @@ static void __net_exit default_device_exit_net(struct net *net)
}
}
+static bool __net_exit netns_dev_unreg_pending(const struct list_head *net_list)
+{
+ struct net *net;
+
+ list_for_each_entry(net, net_list, exit_list) {
+ if (atomic_read(&net->dev_unreg_pending))
+ return true;
+ }
+ return false;
+}
+
static void __net_exit default_device_exit_batch(struct list_head *net_list)
{
/* At exit all network devices most be removed from a network
@@ -13106,6 +13131,16 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list)
}
unregister_netdevice_many(&dev_kill_list);
rtnl_unlock();
+
+ /* Devices of these netns unregistered from another context
+ * (e.g. a veth whose peer was deleted) can still be waiting
+ * in netdev_run_todo() for their last references, while
+ * NETDEV_UNREGISTER is rebroadcast for them. Wait for them
+ * before pernet exit handlers tear down the state used by
+ * netdevice notifiers, and before the netns is freed.
+ * No new unregistration can start: all devices are unlisted.
+ */
+ wait_event(netdev_unregistering_wq, !netns_dev_unreg_pending(net_list));
}
static struct pernet_operations __net_initdata default_device_ops = {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 025/703] ksmbd: pin parent dentries in SMB2 CREATE ACL path
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (23 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 024/703] net: wait for in-flight device unregistrations before netns dismantle Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 026/703] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
` (382 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Jiwoo Kim, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiwoo Kim <arpe1618@gmail.com>
[ Upstream commit 0383a66dabd7aa06237b9b24713c03656abeffe4 ]
smb2_open() and smb_inherit_dacl() read a child's d_parent without a
dentry reference. A concurrent SMB request can move the child and
remove the parent while CREATE uses its inode for permission, status,
and ACL inheritance work. A remote SMB race with concurrent opener and
mover connections on a writable KSMBD acl_xattr share triggered an
8-byte slab-use-after-free read in get_cached_acl on tmpfs and ext4
KASAN guests. With oops=panic, it also caused an Oops and kernel panic
on an ext4 guest.
Take a parent dentry reference around each parent inode or ACL access
in these paths and release it when the operation completes. Treat a
negative parent dentry as -ENOENT for the affected operation.
On a tmpfs KASAN QEMU guest, two 3,000-round reproducer instances
completed without a KASAN report or Oops; SMB remained reachable. On
an ext4 non-KASAN QEMU guest with oops=panic, a 2,000-operation no-race
control and two 5,000-round reproducer instances completed without an
Oops or panic. An SMB health probe still succeeded.
OpenAI Codex assisted with finding the bug, generating the SMB race
reproducer, drafting this fix and changelog, and running the tests.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@kernel.org
Signed-off-by: Jiwoo Kim <arpe1618@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Dropped the <kunit/visibility.h> context include and changed const struct mnt_idmap *idmap to non-const struct mnt_idmap *idmap to match the older tree's code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 39 +++++++++++++++++++++++++++++++--------
fs/smb/server/smbacl.c | 9 ++++++++-
2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index aae6e9adf2e84..c46b537bdab8a 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -3438,16 +3438,32 @@ int smb2_open(struct ksmbd_work *work)
if ((daccess & FILE_DELETE_LE) ||
(req->CreateOptions & FILE_DELETE_ON_CLOSE_LE)) {
- rc = inode_permission(idmap,
- d_inode(path.dentry->d_parent),
- MAY_EXEC | MAY_WRITE);
+ struct dentry *parent = dget_parent(path.dentry);
+ struct inode *parent_inode = d_inode(parent);
+
+ if (parent_inode)
+ rc = inode_permission(idmap, parent_inode,
+ MAY_EXEC | MAY_WRITE);
+ else
+ rc = -ENOENT;
+ dput(parent);
if (rc)
goto err_out;
}
}
}
- rc = ksmbd_query_inode_status(path.dentry->d_parent);
+ {
+ struct dentry *parent = dget_parent(path.dentry);
+
+ if (!d_inode(parent)) {
+ dput(parent);
+ rc = -ENOENT;
+ goto err_out;
+ }
+ rc = ksmbd_query_inode_status(parent);
+ dput(parent);
+ }
if (rc == KSMBD_INODE_STATUS_PENDING_DELETE) {
rc = -EBUSY;
goto err_out;
@@ -3501,10 +3517,17 @@ int smb2_open(struct ksmbd_work *work)
if (created) {
int posix_acl_rc;
struct inode *inode = d_inode(path.dentry);
-
- posix_acl_rc = ksmbd_vfs_inherit_posix_acl(idmap,
- &path,
- d_inode(path.dentry->d_parent));
+ struct inode *parent_inode;
+ struct dentry *parent;
+
+ parent = dget_parent(path.dentry);
+ parent_inode = d_inode(parent);
+ if (parent_inode)
+ posix_acl_rc = ksmbd_vfs_inherit_posix_acl(idmap, &path,
+ parent_inode);
+ else
+ posix_acl_rc = -ENOENT;
+ dput(parent);
if (posix_acl_rc)
ksmbd_debug(SMB, "inherit posix acl failed : %d\n", posix_acl_rc);
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index 42a638d1d2b97..1bd816153e542 100644
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -7,6 +7,7 @@
*/
#include <linux/fs.h>
+#include <linux/dcache.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/mnt_idmapping.h>
@@ -1200,7 +1201,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn,
struct smb_acl *parent_pdacl;
struct smb_ntsd *parent_pntsd = NULL;
struct smb_sid owner_sid, group_sid;
- struct dentry *parent = path->dentry->d_parent;
+ struct dentry *parent;
struct mnt_idmap *idmap = mnt_idmap(path->mnt);
int inherited_flags = 0, flags = 0, i, nt_size = 0, pdacl_size;
int rc = 0, pntsd_type, ppntsd_size, acl_len, aces_size;
@@ -1210,8 +1211,14 @@ int smb_inherit_dacl(struct ksmbd_conn *conn,
char *aces_base;
bool is_dir = S_ISDIR(d_inode(path->dentry)->i_mode);
+ parent = dget_parent(path->dentry);
+ if (!d_inode(parent)) {
+ dput(parent);
+ return -ENOENT;
+ }
ppntsd_size = ksmbd_vfs_get_sd_xattr(conn, idmap,
parent, &parent_pntsd);
+ dput(parent);
if (ppntsd_size <= 0)
return -ENOENT;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 026/703] ksmbd: refuse to read a handle that is not open for reading
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (24 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 025/703] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 027/703] tracing/probes: Fix BTF bitfield parsing and out-of-bounds buffer write Greg Kroah-Hartman
` (381 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wahid Khan, Ian Bridges, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wahid Khan <wahidzk0091@gmail.com>
[ Upstream commit 2fd145f8865bb1a6c38a3dc68fa44290008789d8 ]
smb2_create_open_flags() picks the open mode from the read and write
bits of the desired access. FILE_EXECUTE and FILE_READ_ATTRIBUTES select
neither, so a request for FILE_WRITE_DATA | FILE_EXECUTE |
FILE_READ_ATTRIBUTES opens the file O_WRONLY.
smb2_read() accepts FILE_READ_ATTRIBUTES and ksmbd_vfs_read() accepts
FILE_EXECUTE, so a later READ on that handle passes both checks and
reaches __kernel_read() on a file that has no FMODE_READ:
WARNING: fs/read_write.c:518 at __kernel_read
__kernel_read
ksmbd_vfs_read
smb2_read
handle_ksmbd_work
Any client that can open a file with write access on a share, including
a guest session, can trigger it; with panic_on_warn it takes the machine
down.
Return STATUS_ACCESS_DENIED when the file is not readable.
Fixes: f44158485826 ("cifsd: add file operations")
Cc: stable@vger.kernel.org
Signed-off-by: Wahid Khan <wahidzk0091@gmail.com>
Reviewed-by: Ian Bridges <icb@fastmail.org>
Tested-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: adjusted context: the new FMODE_READ check is inserted before this tree's if (!work->tcon->posix_extensions) { line instead of upstream's if (!fp->is_posix_ctxt) {. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/vfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index 466a0853dc486..96ec655d61900 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -393,6 +393,10 @@ int ksmbd_vfs_read(struct ksmbd_work *work, struct ksmbd_file *fp, size_t count,
if (ksmbd_stream_fd(fp))
return ksmbd_vfs_stream_read(fp, rbuf, pos, count);
+ /* The access granted on open can include FILE_EXECUTE for a write-only file */
+ if (!(filp->f_mode & FMODE_READ))
+ return -EACCES;
+
if (!work->tcon->posix_extensions) {
int ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 027/703] tracing/probes: Fix BTF bitfield parsing and out-of-bounds buffer write
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (25 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 026/703] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 028/703] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
` (380 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit 9b6e9d6a11090ac34516c45f48663b37ac94a9b1 ]
BTF bitfield parsing in trace_probe.c assumes a 64-bit (8-byte) container
when computing FETCH_OP_MOD_BF shift amounts and basesize, whereas the
preceding store instruction only allocates and writes the field's fetch
type size (which may be 1, 2, or 4 bytes when kflag=1). At runtime,
fetch_apply_bitfield() performs an 8-byte read-modify-write on the
smaller ring buffer slot, corrupting adjacent ring buffer data or writing
past the end of the event record.
In addition, signed bitfields with bit widths other than 8/16/32/64 fail
to resolve a fetch type, bitfields whose width is a multiple of 8 inside
a larger integer or spanning a byte boundary fail to emit FETCH_OP_MOD_BF
or select a container wide enough for bitoffs + bitsize, kflag=0 bitfield
offsets >= 8 bits are not folded into the byte offset, and big-endian
architectures use the little-endian left-shift formula in
parse_btf_bitfield().
Compute the bitfield byte and bit offsets consistently during field
lookup, select the smallest unsigned fetch type that covers the bit
offset and bit width, and calculate the FETCH_OP_MOD_BF parameters from
the selected fetch type size for both big- and little-endian bitfields.
Link: https://lore.kernel.org/all/179455850711.403392.10512730891220678403.stgit@devnote2/
Fixes: c440adfbe302 ("tracing/probes: Support BTF based data structure field access")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ sashal: Re-indented the BTF field loop one level deeper, and used mtype in place of the upstream container_type helper variable, because this tree has the loop inline instead of a separate helper. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_probe.c | 61 ++++++++++++++++++++++++++++----------
1 file changed, 46 insertions(+), 15 deletions(-)
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index ac31528b981b6..33fb1a42bbad3 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -439,6 +439,18 @@ static const char *fetch_type_from_btf_type(struct btf *btf,
{
u32 intdata;
+ if (ctx->last_bitsize) {
+ u32 bits = ctx->last_bitsize + ctx->last_bitoffs;
+
+ if (bits <= 8)
+ return "u8";
+ if (bits <= 16)
+ return "u16";
+ if (bits <= 32)
+ return "u32";
+ return "u64";
+ }
+
/* TODO: const char * could be converted as a string */
switch (BTF_INFO_KIND(type->info)) {
case BTF_KIND_ENUM:
@@ -476,10 +488,6 @@ static const char *fetch_type_from_btf_type(struct btf *btf,
case 64:
return "u64";
}
- /* bitfield, size is encoded in the type */
- ctx->last_bitsize = BTF_INT_BITS(intdata);
- ctx->last_bitoffs += BTF_INT_OFFSET(intdata);
- return "u64";
}
}
/* TODO: support other types */
@@ -632,6 +640,12 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
/* Add anonymous structure/union offset */
bitoffs += anon_offs;
+ type = btf_type_skip_modifiers(btf, field->type, NULL);
+ if (!type) {
+ trace_probe_log_err(ctx->offset, BAD_BTF_TID);
+ return -EINVAL;
+ }
+
/* Accumulate the bit-offsets of the dot-connected fields */
if (btf_type_kflag(mtype)) {
bitoffs += BTF_MEMBER_BIT_OFFSET(field->offset);
@@ -639,12 +653,15 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
} else {
bitoffs += field->offset;
ctx->last_bitsize = 0;
- }
-
- type = btf_type_skip_modifiers(btf, field->type, NULL);
- if (!type) {
- trace_probe_log_err(ctx->offset, BAD_BTF_TID);
- return -EINVAL;
+ if (BTF_INFO_KIND(type->info) == BTF_KIND_INT) {
+ u32 intdata = btf_type_int(type);
+
+ bitoffs += BTF_INT_OFFSET(intdata);
+ if ((bitoffs % 8) ||
+ BTF_INT_BITS(intdata) != BYTES_TO_BITS(type->size) ||
+ !is_power_of_2(type->size))
+ ctx->last_bitsize = BTF_INT_BITS(intdata);
+ }
}
ctx->offset += next - fieldname;
@@ -790,13 +807,22 @@ static const struct fetch_type *find_fetch_type_from_btf_type(
}
static int parse_btf_bitfield(struct fetch_insn **pcode,
+ const struct fetch_type *t,
struct traceprobe_parse_context *ctx)
{
struct fetch_insn *code = *pcode;
- if ((ctx->last_bitsize % 8 == 0) && ctx->last_bitoffs == 0)
+ if ((ctx->last_bitsize == 0 ||
+ ctx->last_bitsize == BYTES_TO_BITS(t->size)) &&
+ ctx->last_bitoffs == 0)
return 0;
+ if (ctx->last_bitsize == 0 ||
+ BYTES_TO_BITS(t->size) < (ctx->last_bitsize + ctx->last_bitoffs)) {
+ trace_probe_log_err(ctx->offset, BAD_BITFIELD);
+ return -EINVAL;
+ }
+
code++;
if (code->op != FETCH_OP_NOP) {
trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
@@ -805,9 +831,13 @@ static int parse_btf_bitfield(struct fetch_insn **pcode,
*pcode = code;
code->op = FETCH_OP_MOD_BF;
- code->lshift = 64 - (ctx->last_bitsize + ctx->last_bitoffs);
- code->rshift = 64 - ctx->last_bitsize;
- code->basesize = 64 / 8;
+#ifdef __BIG_ENDIAN_BITFIELD
+ code->lshift = ctx->last_bitoffs;
+#else
+ code->lshift = BYTES_TO_BITS(t->size) - (ctx->last_bitsize + ctx->last_bitoffs);
+#endif
+ code->rshift = BYTES_TO_BITS(t->size) - ctx->last_bitsize;
+ code->basesize = t->size;
return 0;
}
@@ -891,6 +921,7 @@ static int parse_btf_arg(char *varname,
}
static int parse_btf_bitfield(struct fetch_insn **pcode,
+ const struct fetch_type *t,
struct traceprobe_parse_context *ctx)
{
trace_probe_log_err(ctx->offset, NOSUP_BTFARG);
@@ -1570,7 +1601,7 @@ static int finalize_fetch_insn(struct fetch_insn *code,
} else if (IS_ENABLED(CONFIG_PROBE_EVENTS_BTF_ARGS) &&
ctx->last_type) {
/* If user not specified the type, try parsing BTF bitfield. */
- ret = parse_btf_bitfield(&code, ctx);
+ ret = parse_btf_bitfield(&code, parg->type, ctx);
if (ret)
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 028/703] comedi: comedi_bond: Fix leak of opened device references
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (26 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 027/703] tracing/probes: Fix BTF bitfield parsing and out-of-bounds buffer write Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 029/703] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY Greg Kroah-Hartman
` (379 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Wentao Liang, Ian Abbott,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <abbotti@mev.co.uk>
commit fa0858523f07f8dd71d89b221f4422c3b8096d90 upstream.
bonding_attach() calls do_dev_config() to open other comedi devices
specified by the user and tries to make use of them as part of the
'bonding' device. If it successfully opens the other device but cannot
use it (either because it does not any subdevices of a type the
'bonding' device can use, or because of some error that occurs while
dealing with its subdevices) then it is left in the open state and the
fact that it is open does not get recorded by the 'bonding' device, so
the reference to the opened device gets lost. Fix it by closing the
opened device if it could not be bound to the 'bonding' device.
To match previous behavior, if the opened device is unsuitable then
ignore it (after closing it). The opened devices recorded by the
'bonding' device will eventually get closed by bonding_detach() even if
bonding_attach() returns an error.
Fixes: 3cf840f65ad5 ("Staging: comedi: add comedi_bond driver")
Cc: stable <stable@kernel.org>
Reported-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/lkml/20261103063301.1025860-1-vulab@iscas.ac.cn
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20261103173610.89687-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fa0858523f07f8dd71d89b221f4422c3b8096d90)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/comedi/drivers/comedi_bond.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/comedi/drivers/comedi_bond.c b/drivers/comedi/drivers/comedi_bond.c
index 78c39fa841776..076aecae2c776 100644
--- a/drivers/comedi/drivers/comedi_bond.c
+++ b/drivers/comedi/drivers/comedi_bond.c
@@ -182,7 +182,9 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
char file[sizeof("/dev/comediXXXXXX")];
int minor = it->options[i];
struct comedi_device *d;
- int sdev = -1, nchans;
+ int sdev = -1;
+ int nchans;
+ int nope = 1;
struct bonded_device *bdev;
struct bonded_device **devs;
@@ -221,11 +223,14 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
dev_err(dev->class_dev,
"comedi_get_n_channels() returned %d on minor %u subdev %d!\n",
nchans, minor, sdev);
- return -EINVAL;
+ nope = -EINVAL;
+ break;
}
bdev = kmalloc(sizeof(*bdev), GFP_KERNEL);
- if (!bdev)
- return -ENOMEM;
+ if (!bdev) {
+ nope = -ENOMEM;
+ break;
+ }
bdev->dev = d;
bdev->minor = minor;
@@ -246,10 +251,12 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
dev_err(dev->class_dev,
"Could not allocate memory. Out of memory?\n");
kfree(bdev);
- return -ENOMEM;
+ nope = -ENOMEM;
+ break;
}
devpriv->devs = devs;
devpriv->devs[devpriv->ndevs++] = bdev;
+ nope = 0; /* keeps the device open */
{
/* Append dev:subdev to devpriv->name */
char buf[20];
@@ -260,6 +267,13 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it)
sizeof(devpriv->name));
}
}
+
+ if (nope) {
+ /* Opened device cannot be used, so close it. */
+ comedi_close(d);
+ if (nope < 0)
+ return nope;
+ }
}
if (!devpriv->nchans) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 029/703] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (27 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 028/703] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 030/703] 8021q: use RCU for egress QoS mappings Greg Kroah-Hartman
` (378 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alice Ryhl, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Ryhl <aliceryhl@google.com>
commit ff9de8571f05e8f62f9cbe29f38e0aedda9389cf upstream.
When building a reply fails in Thread::reply_inner(), BR_FAILED_REPLY is
delivered to the caller before BR_TRANSACTION_COMPLETE is pushed to the
replying thread's work list.
In a nested transaction, the caller can wake up upon receiving
BR_FAILED_REPLY and send an outer reply to the replying thread before
BR_TRANSACTION_COMPLETE is queued. This causes the outer BR_REPLY to
arrive ahead of BR_TRANSACTION_COMPLETE, which is not legal. This leads
to userspace tripping on an assertion.
Thus, push BR_TRANSACTION_COMPLETE in Thread::reply_inner() before
delivering BR_FAILED_REPLY to the caller.
As a nice side effect, this lets us remove the now-unused
BR_TRANSACTION_COMPLETE error path in Thread::transaction().
Cc: stable@vger.kernel.org
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Link: https://patch.msgid.link/20261028-binder-reply-fail-v1-1-8b71d4daaf1d@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[aliceryhl: resolve conflicts in Thread::transaction() and reply_inner()]
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/android/binder/error.rs | 1 -
drivers/android/binder/thread.rs | 46 +++++++++++++++-----------------
2 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/drivers/android/binder/error.rs b/drivers/android/binder/error.rs
index fd9e9d9e5658b..4b5689cdb2b8e 100644
--- a/drivers/android/binder/error.rs
+++ b/drivers/android/binder/error.rs
@@ -78,7 +78,6 @@ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"),
BR_FROZEN_REPLY => f.pad("BR_FROZEN_REPLY"),
BR_TRANSACTION_PENDING_FROZEN => f.pad("BR_TRANSACTION_PENDING_FROZEN"),
- BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"),
_ => match self.source.as_ref() {
Some(source) => source.fmt(f),
None => self.reply.fmt(f),
diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index e2320704c722e..5ae26faaf13bc 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -1262,26 +1262,25 @@ fn transaction(self: &Arc<Self>, cmd: u32, reader: &mut UserSliceReader) -> Resu
self.transaction_inner(&mut info)
};
+ // This runs when a transaction fails with an error returned to the caller.
if let Err(err) = ret {
self.push_return_work(err.reply);
- if err.reply != BR_TRANSACTION_COMPLETE {
- info.reply = err.reply;
- if let Some(source) = &err.source {
- info.errno = source.to_errno();
-
- {
- let mut inner = self.inner.lock();
- inner.extended_error =
- ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
- }
-
- pr_warn!(
- "{}:{} transaction to {} failed: {err:?}",
- info.from_pid,
- info.from_tid,
- info.to_pid
- );
+ info.reply = err.reply;
+ if let Some(source) = &err.source {
+ info.errno = source.to_errno();
+
+ {
+ let mut inner = self.inner.lock();
+ inner.extended_error =
+ ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
}
+
+ pr_warn!(
+ "{}:{} transaction to {} failed: {err:?}",
+ info.from_pid,
+ info.from_tid,
+ info.to_pid
+ );
}
}
@@ -1336,7 +1335,7 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
info.to_pid = orig.from.process.task.pid();
// We need to complete the transaction even if we cannot complete building the reply.
- let out = (|| -> BinderResult<_> {
+ if let Err(err) = (|| -> BinderResult<_> {
let completion = DTRWrap::arc_try_new(DeliverCode::new(BR_TRANSACTION_COMPLETE))?;
let process = orig.from.process.clone();
let allow_fds = orig.flags & TF_ACCEPT_FDS != 0;
@@ -1344,11 +1343,10 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
self.inner.lock().push_work(completion);
orig.from.deliver_reply(Ok(reply), &orig, None);
Ok(())
- })()
- .map_err(|mut err| {
+ })() {
// At this point we only return `BR_TRANSACTION_COMPLETE` to the caller, and we must let
// the sender know that the transaction has completed (with an error in this case).
-
+ self.push_return_work(BR_TRANSACTION_COMPLETE);
pr_warn!(
"{}:{} reply to {} failed: {err:?}",
info.from_pid,
@@ -1360,11 +1358,9 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
let ee = ExtendedError::new(info.debug_id as u32, err.reply, param);
orig.from
.deliver_reply(Err(BR_FAILED_REPLY), &orig, Some(ee));
- err.reply = BR_TRANSACTION_COMPLETE;
- err
- });
+ }
- out
+ Ok(())
}
fn oneway_transaction_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 030/703] 8021q: use RCU for egress QoS mappings
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (28 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 029/703] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 031/703] 8021q: delete cleared " Greg Kroah-Hartman
` (377 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Tan, Longxuan Yu, Ren Wei,
Paolo Abeni, Artem Dinaburg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longxuan Yu <ylong030@ucr.edu>
[ Upstream commit fc69decc811b155a0ed8eef17ee940f28c4f6dbc ]
The TX fast path and reporting paths walk egress QoS mappings without
RTNL. Convert the mapping lists to RCU-protected pointers, use RCU
reader annotations in readers, and defer freeing mapping nodes with an
embedded rcu_head.
This prepares the egress QoS mapping code for safe removal of mapping
nodes in a follow-up change while preserving the current behavior.
Co-developed-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Longxuan Yu <ylong030@ucr.edu>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Link: https://patch.msgid.link/9136768189f8c6d3f824f476c62d2fa1111688e8.1776647968.git.yuantan098@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Backport to 6.18.y: context adjusted in vlan_dev_set_egress_priority();
6.18.y predates the kmalloc_obj() conversion. No functional change
from upstream. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/if_vlan.h | 25 ++++++++++++++++---------
net/8021q/vlan_dev.c | 31 ++++++++++++++++---------------
net/8021q/vlan_netlink.c | 10 ++++++----
net/8021q/vlanproc.c | 12 ++++++++----
4 files changed, 46 insertions(+), 32 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 89472ba4425f0..2c30c5b62fb59 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -147,11 +147,13 @@ extern __be16 vlan_dev_vlan_proto(const struct net_device *dev);
* @priority: skb priority
* @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
* @next: pointer to next struct
+ * @rcu: used for deferred freeing of mapping nodes
*/
struct vlan_priority_tci_mapping {
u32 priority;
u16 vlan_qos;
- struct vlan_priority_tci_mapping *next;
+ struct vlan_priority_tci_mapping __rcu *next;
+ struct rcu_head rcu;
};
struct proc_dir_entry;
@@ -177,7 +179,7 @@ struct vlan_dev_priv {
unsigned int nr_ingress_mappings;
u32 ingress_priority_map[8];
unsigned int nr_egress_mappings;
- struct vlan_priority_tci_mapping *egress_priority_map[16];
+ struct vlan_priority_tci_mapping __rcu *egress_priority_map[16];
__be16 vlan_proto;
u16 vlan_id;
@@ -209,19 +211,24 @@ static inline u16
vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio)
{
struct vlan_priority_tci_mapping *mp;
+ u16 vlan_qos = 0;
- smp_rmb(); /* coupled with smp_wmb() in vlan_dev_set_egress_priority() */
+ rcu_read_lock();
- mp = vlan_dev_priv(dev)->egress_priority_map[(skprio & 0xF)];
+ mp = rcu_dereference(vlan_dev_priv(dev)->egress_priority_map[skprio & 0xF]);
while (mp) {
if (mp->priority == skprio) {
- return mp->vlan_qos; /* This should already be shifted
- * to mask correctly with the
- * VLAN's TCI */
+ vlan_qos = READ_ONCE(mp->vlan_qos);
+ break;
}
- mp = mp->next;
+ mp = rcu_dereference(mp->next);
}
- return 0;
+ rcu_read_unlock();
+
+ /* This should already be shifted to mask correctly with
+ * the VLAN's TCI.
+ */
+ return vlan_qos;
}
extern bool vlan_do_receive(struct sk_buff **skb);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 27b84c4120082..f86f6b7706099 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -208,39 +208,34 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
u32 skb_prio, u16 vlan_prio)
{
struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
- struct vlan_priority_tci_mapping *mp = NULL;
+ struct vlan_priority_tci_mapping *mp;
struct vlan_priority_tci_mapping *np;
+ u32 bucket = skb_prio & 0xF;
u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK;
/* See if a priority mapping exists.. */
- mp = vlan->egress_priority_map[skb_prio & 0xF];
+ mp = rtnl_dereference(vlan->egress_priority_map[bucket]);
while (mp) {
if (mp->priority == skb_prio) {
if (mp->vlan_qos && !vlan_qos)
vlan->nr_egress_mappings--;
else if (!mp->vlan_qos && vlan_qos)
vlan->nr_egress_mappings++;
- mp->vlan_qos = vlan_qos;
+ WRITE_ONCE(mp->vlan_qos, vlan_qos);
return 0;
}
- mp = mp->next;
+ mp = rtnl_dereference(mp->next);
}
/* Create a new mapping then. */
- mp = vlan->egress_priority_map[skb_prio & 0xF];
np = kmalloc(sizeof(struct vlan_priority_tci_mapping), GFP_KERNEL);
if (!np)
return -ENOBUFS;
- np->next = mp;
np->priority = skb_prio;
np->vlan_qos = vlan_qos;
- /* Before inserting this element in hash table, make sure all its fields
- * are committed to memory.
- * coupled with smp_rmb() in vlan_dev_get_egress_qos_mask()
- */
- smp_wmb();
- vlan->egress_priority_map[skb_prio & 0xF] = np;
+ RCU_INIT_POINTER(np->next, rtnl_dereference(vlan->egress_priority_map[bucket]));
+ rcu_assign_pointer(vlan->egress_priority_map[bucket], np);
if (vlan_qos)
vlan->nr_egress_mappings++;
return 0;
@@ -616,11 +611,17 @@ void vlan_dev_free_egress_priority(const struct net_device *dev)
int i;
for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
- while ((pm = vlan->egress_priority_map[i]) != NULL) {
- vlan->egress_priority_map[i] = pm->next;
- kfree(pm);
+ pm = rtnl_dereference(vlan->egress_priority_map[i]);
+ RCU_INIT_POINTER(vlan->egress_priority_map[i], NULL);
+ while (pm) {
+ struct vlan_priority_tci_mapping *next;
+
+ next = rtnl_dereference(pm->next);
+ kfree_rcu(pm, rcu);
+ pm = next;
}
}
+ vlan->nr_egress_mappings = 0;
}
static void vlan_dev_uninit(struct net_device *dev)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index a000b1ef05206..a5b16833e2cee 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -260,13 +260,15 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
goto nla_put_failure;
for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
- for (pm = vlan->egress_priority_map[i]; pm;
- pm = pm->next) {
- if (!pm->vlan_qos)
+ for (pm = rcu_dereference_rtnl(vlan->egress_priority_map[i]); pm;
+ pm = rcu_dereference_rtnl(pm->next)) {
+ u16 vlan_qos = READ_ONCE(pm->vlan_qos);
+
+ if (!vlan_qos)
continue;
m.from = pm->priority;
- m.to = (pm->vlan_qos >> 13) & 0x7;
+ m.to = (vlan_qos >> 13) & 0x7;
if (nla_put(skb, IFLA_VLAN_QOS_MAPPING,
sizeof(m), &m))
goto nla_put_failure;
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index fa67374bda494..0e424e0895b7e 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -262,15 +262,19 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
vlan->ingress_priority_map[7]);
seq_printf(seq, " EGRESS priority mappings: ");
+ rcu_read_lock();
for (i = 0; i < 16; i++) {
- const struct vlan_priority_tci_mapping *mp
- = vlan->egress_priority_map[i];
+ const struct vlan_priority_tci_mapping *mp =
+ rcu_dereference(vlan->egress_priority_map[i]);
while (mp) {
+ u16 vlan_qos = READ_ONCE(mp->vlan_qos);
+
seq_printf(seq, "%u:%d ",
- mp->priority, ((mp->vlan_qos >> 13) & 0x7));
- mp = mp->next;
+ mp->priority, ((vlan_qos >> 13) & 0x7));
+ mp = rcu_dereference(mp->next);
}
}
+ rcu_read_unlock();
seq_puts(seq, "\n");
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 031/703] 8021q: delete cleared egress QoS mappings
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (29 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 030/703] 8021q: use RCU for egress QoS mappings Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 032/703] Bluetooth: btusb: fix use-after-free in force_poll_sync Greg Kroah-Hartman
` (376 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Yifan Wu, Juefei Pu, Xin Liu,
Yuan Tan, Longxuan Yu, Ren Wei, Paolo Abeni, Artem Dinaburg,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Longxuan Yu <ylong030@ucr.edu>
[ Upstream commit 7dddc74af369478ba7f9bc136d0fc1dc4570cb66 ]
vlan_dev_set_egress_priority() currently keeps cleared egress
priority mappings in the hash as tombstones. Repeated set/clear cycles
with distinct skb priorities therefore accumulate mapping nodes until
device teardown and leak memory.
Delete mappings when vlan_prio is cleared instead of keeping tombstones.
Now that the egress mapping lists are RCU protected, the node can be
unlinked safely and freed after a grace period.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@kernel.org
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Co-developed-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Longxuan Yu <ylong030@ucr.edu>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Link: https://patch.msgid.link/ecfa6f6ce2467a42647ff4c5221238ae85b79a59.1776647968.git.yuantan098@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ Backport to 6.18.y: context adjusted in vlan_dev_set_egress_priority();
6.18.y predates the kmalloc_obj() conversion. No functional change
from upstream. ]
Signed-off-by: Artem Dinaburg <artem@trailofbits.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/8021q/vlan_dev.c | 20 ++++++++++++++------
net/8021q/vlan_netlink.c | 4 ----
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index f86f6b7706099..5b4ac6c127f08 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -208,26 +208,34 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
u32 skb_prio, u16 vlan_prio)
{
struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+ struct vlan_priority_tci_mapping __rcu **mpp;
struct vlan_priority_tci_mapping *mp;
struct vlan_priority_tci_mapping *np;
u32 bucket = skb_prio & 0xF;
u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK;
/* See if a priority mapping exists.. */
- mp = rtnl_dereference(vlan->egress_priority_map[bucket]);
+ mpp = &vlan->egress_priority_map[bucket];
+ mp = rtnl_dereference(*mpp);
while (mp) {
if (mp->priority == skb_prio) {
- if (mp->vlan_qos && !vlan_qos)
+ if (!vlan_qos) {
+ rcu_assign_pointer(*mpp, rtnl_dereference(mp->next));
vlan->nr_egress_mappings--;
- else if (!mp->vlan_qos && vlan_qos)
- vlan->nr_egress_mappings++;
- WRITE_ONCE(mp->vlan_qos, vlan_qos);
+ kfree_rcu(mp, rcu);
+ } else {
+ WRITE_ONCE(mp->vlan_qos, vlan_qos);
+ }
return 0;
}
- mp = rtnl_dereference(mp->next);
+ mpp = &mp->next;
+ mp = rtnl_dereference(*mpp);
}
/* Create a new mapping then. */
+ if (!vlan_qos)
+ return 0;
+
np = kmalloc(sizeof(struct vlan_priority_tci_mapping), GFP_KERNEL);
if (!np)
return -ENOBUFS;
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index a5b16833e2cee..368d53ca7d870 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -263,10 +263,6 @@ static int vlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
for (pm = rcu_dereference_rtnl(vlan->egress_priority_map[i]); pm;
pm = rcu_dereference_rtnl(pm->next)) {
u16 vlan_qos = READ_ONCE(pm->vlan_qos);
-
- if (!vlan_qos)
- continue;
-
m.from = pm->priority;
m.to = (vlan_qos >> 13) & 0x7;
if (nla_put(skb, IFLA_VLAN_QOS_MAPPING,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 032/703] Bluetooth: btusb: fix use-after-free in force_poll_sync
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (30 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 031/703] 8021q: delete cleared " Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 033/703] tools/bootconfig: Close only opened braces in compact output Greg Kroah-Hartman
` (375 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bin Yu, Cheng Wen,
Luiz Augusto von Dentz, YuanZhe Liu, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
[ Upstream commit 868c886f45f7c10dc888b94c6993352702a84d04 ]
The force_poll_sync debugfs file uses the driver's struct btusb_data as
its private data. The file is created under hdev->debugfs and is removed
only when the HCI device is released, while btusb_disconnect() frees
btusb_data unconditionally. The HCI device can outlive the driver data,
for example when an HCI socket still references it, so reading or
writing the already opened file then dereferences freed memory:
BUG: KASAN: slab-use-after-free in force_poll_sync_read+0x129/0x140
Read of size 1 at addr ffff88800cfb7038
...
Freed by task ...:
kfree
btusb_disconnect
Remove the debugfs file before the private data is freed.
debugfs_remove() waits for callers that are already inside the file
operations, and any later access fails with -EIO instead of reaching the
driver, so the force_poll_sync file can no longer dereference btusb_data
after it is gone.
Fixes: 800fe5ec302e ("Bluetooth: btusb: Add support for queuing during polling interval")
Cc: stable@vger.kernel.org
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btusb.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 6143414711c5d..99bee6e6d286f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1018,6 +1018,8 @@ struct btusb_data {
int oob_wake_irq; /* irq for out-of-band wake-on-bt */
+ struct dentry *force_poll_sync_dentry;
+
struct qca_dump_info qca_dump;
};
@@ -4418,8 +4420,9 @@ static int btusb_probe(struct usb_interface *intf,
usb_set_intfdata(intf, data);
- debugfs_create_file("force_poll_sync", 0644, hdev->debugfs, data,
- &force_poll_sync_fops);
+ data->force_poll_sync_dentry =
+ debugfs_create_file("force_poll_sync", 0644, hdev->debugfs,
+ data, &force_poll_sync_fops);
return 0;
@@ -4455,6 +4458,9 @@ static void btusb_disconnect(struct usb_interface *intf)
if (!data)
return;
+ debugfs_remove(data->force_poll_sync_dentry);
+ data->force_poll_sync_dentry = NULL;
+
hdev = data->hdev;
usb_set_intfdata(data->intf, NULL);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 033/703] tools/bootconfig: Close only opened braces in compact output
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (31 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 032/703] Bluetooth: btusb: fix use-after-free in force_poll_sync Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 034/703] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
` (374 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Eduardo Mucelli Rezende Oliveira, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
commit 26fa92f351d4993428268afebf6c60c987477af5 upstream.
A key may have both a value and subkeys. When it has only one subkey,
xbc_show_compact_tree() can print that subkey using dotted notation
without opening a brace. During backtracking, however, it treats the
value node followed by a subkey as evidence that a brace was opened.
For example, a.b=v, a.b.c=w and a.z=q are printed with the brace for a
closed before z. Reading that output back changes a.z into the root key
z, silently changing the configuration.
Check the key children when deciding whether to close a brace. Skip the
value child, and account for a sole subkey that itself has both a value
and subkeys, since that combination is not compacted. This follows the
conditions used to open braces without keeping a depth-indexed array.
Extend the mixed-value/subkey sample to cover the lost sibling.
The stable test script only checks whether the good samples can
be attached. Add the compact-output comparison for the extended
mixed-value/subkey sample and add its expected output file.
Link: https://lore.kernel.org/all/6ad67e4cda05238cd173c99e820a85de2c13f5fc.1794337724.git.edumucelli@gmail.com/
Fixes: e5efaeb8a8f5 ("bootconfig: Support mixing a value and subkeys under a key")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/bootconfig/main.c | 29 ++++++++++++++-----
.../samples/exp-good-mixed-kv1.bconf | 7 +++++
tools/bootconfig/samples/good-mixed-kv1.bconf | 5 ++++
tools/bootconfig/test-bootconfig.sh | 6 ++++
4 files changed, 40 insertions(+), 7 deletions(-)
create mode 100644 tools/bootconfig/samples/exp-good-mixed-kv1.bconf
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 6f5d60045f90b..43f0a7fa87c9b 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -39,6 +39,23 @@ static int xbc_show_value(struct xbc_node *node, bool semicolon)
return i;
}
+/* Match the conditions under which the compact formatter opens braces. */
+static bool xbc_node_needs_braces(struct xbc_node *node)
+{
+ struct xbc_node *child = xbc_node_get_child(node);
+
+ if (child && xbc_node_is_value(child))
+ child = xbc_node_get_next(child);
+ if (!child)
+ return false;
+ if (child->next)
+ return true;
+
+ /* A single subkey with both a value and subkeys is not compacted. */
+ child = xbc_node_get_child(child);
+ return child && xbc_node_is_value(child) && child->next;
+}
+
static void xbc_show_compact_tree(void)
{
struct xbc_node *node, *cnode = NULL, *vnode;
@@ -99,14 +116,12 @@ static void xbc_show_compact_tree(void)
node = xbc_node_get_parent(node);
if (!node)
return;
- if (!xbc_node_get_child(node)->next)
+ if (!depth || !xbc_node_needs_braces(node))
continue;
- if (depth) {
- depth--;
- for (i = 0; i < depth; i++)
- printf("\t");
- printf("}\n");
- }
+ depth--;
+ for (i = 0; i < depth; i++)
+ printf("\t");
+ printf("}\n");
}
node = xbc_node_get_next(node);
}
diff --git a/tools/bootconfig/samples/exp-good-mixed-kv1.bconf b/tools/bootconfig/samples/exp-good-mixed-kv1.bconf
new file mode 100644
index 0000000000000..0b8b2f59da31e
--- /dev/null
+++ b/tools/bootconfig/samples/exp-good-mixed-kv1.bconf
@@ -0,0 +1,7 @@
+key = "value";
+key.subkey = "another-value";
+a {
+ b = "v";
+ b.c = "w";
+ z = "q";
+}
diff --git a/tools/bootconfig/samples/good-mixed-kv1.bconf b/tools/bootconfig/samples/good-mixed-kv1.bconf
index 1761547dd05ca..35442ee62b751 100644
--- a/tools/bootconfig/samples/good-mixed-kv1.bconf
+++ b/tools/bootconfig/samples/good-mixed-kv1.bconf
@@ -1,3 +1,8 @@
# value -> subkey pattern
key = value
key.subkey = another-value
+
+# A valued parent with one subkey must not close its enclosing brace.
+a.b = v
+a.b.c = w
+a.z = q
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index d6211efe6dbee..615f5f72ff1a5 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -200,6 +200,12 @@ for i in samples/good-* ; do
done
+echo "Compact output keeps siblings under their parent"
+xpass $BOOTCONF -a samples/good-mixed-kv1.bconf $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xpass cmp samples/exp-good-mixed-kv1.bconf $OUTFILE
+
+
echo
echo "=== Summary ==="
echo "# of Passed: $(expr $NO - $NG - 1)"
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 034/703] ipv6: Remove IPV6_ADDRFORM.
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (32 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 033/703] tools/bootconfig: Close only opened braces in compact output Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 035/703] sched_ext: Read exit_kind before flushing in scx_flush_disable_work() Greg Kroah-Hartman
` (373 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daehyeon Ko, Hyunwoo Kim,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 31c5ea8a3296e1486ac34bccea452bfe8c0bb1f9 ]
Recently, IPV6_ADDRFORM has received many AI-driven bug reports.
Fixing them properly would needlessly churn the fast paths in TCP
and UDP.
IPV6_ADDRFORM was initially introduced in RFC 2133 in 1997,
but only two years later, it was removed from RFC 2553 in 1999.
In 2026, modern applications natively support dual-stack sockets;
notably, systemd's socket activation does not use IPV6_ADDRFORM.
Also, getsockopt(IPV6_ADDRFORM) can be replaced with SO_DOMAIN.
Let's remove IPV6_ADDRFORM.
Later, we can remove sk->sk_prot_creator and revert commit
c26c192c3d48 ("udp: properly deal with xfrm encap and ADDRFORM").
Reported-by: Daehyeon Ko <4ncienth@gmail.com>
Closes: https://lore.kernel.org/netdev/20260902010408.1057857-1-4ncienth@gmail.com/
Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
Closes: https://lore.kernel.org/netdev/20260824033331.1084971-1-imv4bel@gmail.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260904033543.2635540-3-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Hyunwoo Kim: Remove UDP-Lite handling from the IPV6_ADDRFORM
set/get branches on 6.18.y. ]
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/net.h | 2 +-
net/core/sock.c | 4 +-
net/ipv4/af_inet.c | 3 --
net/ipv6/af_inet6.c | 4 --
net/ipv6/ipv6_sockglue.c | 95 ----------------------------------------
5 files changed, 2 insertions(+), 106 deletions(-)
diff --git a/include/linux/net.h b/include/linux/net.h
index ec09620f40f70..e3b4c1af30917 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -122,7 +122,7 @@ struct socket {
struct file *file;
struct sock *sk;
- const struct proto_ops *ops; /* Might change with IPV6_ADDRFORM or MPTCP. */
+ const struct proto_ops *ops; /* Might change with MPTCP. */
struct socket_wq wq;
};
diff --git a/net/core/sock.c b/net/core/sock.c
index 857790b478e97..ed625b8ac32ab 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -771,7 +771,7 @@ bool sk_mc_loop(const struct sock *sk)
sk = sk_const_to_full_sk(sk);
if (!sk)
return true;
- /* IPV6_ADDRFORM can change sk->sk_family under us. */
+
switch (READ_ONCE(sk->sk_family)) {
case AF_INET:
return inet_test_bit(MC_LOOP, sk);
@@ -3901,7 +3901,6 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
return READ_ONCE(sk->sk_prot)->getsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL(sock_common_getsockopt);
@@ -3923,7 +3922,6 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
return READ_ONCE(sk->sk_prot)->setsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL(sock_common_setsockopt);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 72cb7d9aee910..a581289384795 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -577,7 +577,6 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
if (addr_len < sizeof(uaddr->sa_family))
return -EINVAL;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
if (uaddr->sa_family == AF_UNSPEC)
@@ -778,7 +777,6 @@ int inet_accept(struct socket *sock, struct socket *newsock,
{
struct sock *sk1 = sock->sk, *sk2;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
arg->err = -EINVAL;
sk2 = READ_ONCE(sk1->sk_prot)->accept(sk1, arg);
if (!sk2)
@@ -863,7 +861,6 @@ void inet_splice_eof(struct socket *sock)
if (unlikely(inet_send_prepare(sk)))
return;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
if (prot->splice_eof)
prot->splice_eof(sock);
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 1c45e1d15506c..6301428bb6c16 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -444,7 +444,6 @@ int inet6_bind_sk(struct sock *sk, struct sockaddr *uaddr, int addr_len)
const struct proto *prot;
int err = 0;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
/* If the socket has its own bind function then use it. */
if (prot->bind)
@@ -583,7 +582,6 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCSIFDSTADDR:
return addrconf_set_dstaddr(net, argp);
default:
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
if (!prot->ioctl)
return -ENOIOCTLCMD;
@@ -654,7 +652,6 @@ int inet6_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
if (unlikely(inet_send_prepare(sk)))
return -EAGAIN;
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
return INDIRECT_CALL_2(prot->sendmsg, tcp_sendmsg, udpv6_sendmsg,
sk, msg, size);
@@ -671,7 +668,6 @@ int inet6_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
if (likely(!(flags & MSG_ERRQUEUE)))
sock_rps_record_flow(sk);
- /* IPV6_ADDRFORM can change sk->sk_prot under us. */
prot = READ_ONCE(sk->sk_prot);
return INDIRECT_CALL_2(prot->recvmsg, tcp_recvmsg, udpv6_recvmsg,
sk, msg, size, flags);
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index d784a8644ff20..f4a84817579e6 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -548,93 +548,7 @@ int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
sockopt_lock_sock(sk);
- /* Another thread has converted the socket into IPv4 with
- * IPV6_ADDRFORM concurrently.
- */
- if (unlikely(sk->sk_family != AF_INET6))
- goto unlock;
-
switch (optname) {
-
- case IPV6_ADDRFORM:
- if (optlen < sizeof(int))
- goto e_inval;
- if (val == PF_INET) {
- if (sk->sk_type == SOCK_RAW)
- break;
-
- if (sk->sk_protocol == IPPROTO_UDP ||
- sk->sk_protocol == IPPROTO_UDPLITE) {
- struct udp_sock *up = udp_sk(sk);
- if (up->pending == AF_INET6) {
- retv = -EBUSY;
- break;
- }
- } else if (sk->sk_protocol == IPPROTO_TCP) {
- if (sk->sk_prot != &tcpv6_prot) {
- retv = -EBUSY;
- break;
- }
- } else {
- break;
- }
-
- if (sk->sk_state != TCP_ESTABLISHED) {
- retv = -ENOTCONN;
- break;
- }
-
- if (ipv6_only_sock(sk) ||
- !ipv6_addr_v4mapped(&sk->sk_v6_daddr)) {
- retv = -EADDRNOTAVAIL;
- break;
- }
-
- __ipv6_sock_mc_close(sk);
- __ipv6_sock_ac_close(sk);
-
- if (sk->sk_protocol == IPPROTO_TCP) {
- struct inet_connection_sock *icsk = inet_csk(sk);
-
- sock_prot_inuse_add(net, sk->sk_prot, -1);
- sock_prot_inuse_add(net, &tcp_prot, 1);
-
- /* Paired with READ_ONCE(sk->sk_prot) in inet6_stream_ops */
- WRITE_ONCE(sk->sk_prot, &tcp_prot);
- /* Paired with READ_ONCE() in tcp_(get|set)sockopt() */
- WRITE_ONCE(icsk->icsk_af_ops, &ipv4_specific);
- WRITE_ONCE(sk->sk_socket->ops, &inet_stream_ops);
- WRITE_ONCE(sk->sk_family, PF_INET);
- tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
- } else {
- struct proto *prot = &udp_prot;
-
- if (sk->sk_protocol == IPPROTO_UDPLITE)
- prot = &udplite_prot;
-
- sock_prot_inuse_add(net, sk->sk_prot, -1);
- sock_prot_inuse_add(net, prot, 1);
-
- /* Paired with READ_ONCE(sk->sk_prot) in inet6_dgram_ops */
- WRITE_ONCE(sk->sk_prot, prot);
- WRITE_ONCE(sk->sk_socket->ops, &inet_dgram_ops);
- WRITE_ONCE(sk->sk_family, PF_INET);
- }
-
- /* Disable all options not to allocate memory anymore,
- * but there is still a race. See the lockless path
- * in udpv6_sendmsg() and ipv6_local_rxpmtu().
- */
- np->rxopt.all = 0;
-
- inet6_cleanup_sock(sk);
-
- module_put(THIS_MODULE);
- retv = 0;
- break;
- }
- goto e_inval;
-
case IPV6_V6ONLY:
if (optlen < sizeof(int) ||
inet_sk(sk)->inet_num)
@@ -1096,15 +1010,6 @@ int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
if (copy_from_sockptr(&len, optlen, sizeof(int)))
return -EFAULT;
switch (optname) {
- case IPV6_ADDRFORM:
- if (sk->sk_protocol != IPPROTO_UDP &&
- sk->sk_protocol != IPPROTO_UDPLITE &&
- sk->sk_protocol != IPPROTO_TCP)
- return -ENOPROTOOPT;
- if (sk->sk_state != TCP_ESTABLISHED)
- return -ENOTCONN;
- val = sk->sk_family;
- break;
case MCAST_MSFILTER:
if (in_compat_syscall())
return compat_ipv6_get_msfilter(sk, optval, optlen, len);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 035/703] sched_ext: Read exit_kind before flushing in scx_flush_disable_work()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (33 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 034/703] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 036/703] iio: proximity: sx9360: fix sampling frequency write and available range Greg Kroah-Hartman
` (372 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Kuba Piecuch, Andrea Righi,
Tejun Heo, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuba Piecuch <jpiecuch@google.com>
[ Upstream commit 3133107d98057595c0af39ff907c852134926912 ]
scx_disable_workfn() sets exit_kind to SCX_EXIT_DONE before it tears the
scheduler down. scx_flush_disable_work() reads exit_kind after syncing
disable_irq_work and flushing disable_work, so it can observe DONE from
a disable_work that was queued after its flush and return while the
teardown is still running:
CPU A CPU B
----- -----
scx_vexit()
scx_claim_exit() -> true
bpf_struct_ops_map_link_detach()
bpf_scx_unreg()
scx_disable()
scx_claim_exit() -> false
scx_flush_disable_work()
irq_work_sync() // not queued
kthread_flush_work() // not queued
irq_work_queue()
scx_disable_irq_workfn()
kthread_queue_work()
scx_disable_workfn()
exit_kind = SCX_EXIT_DONE
scx_root_disable()
atomic_read() -> SCX_EXIT_DONE
bpf_map_put()
Once bpf_scx_unreg() returns, its caller drops the struct_ops map
reference, and the struct_ops trampolines can be freed while
scx_root_disable() is still running and can still call into the BPF
scheduler, e.g. ops.exit().
Read exit_kind before syncing and flushing, with acquire ordering paired
with the atomic_try_cmpxchg() in scx_disable_workfn(). DONE is only set
from disable_work, so once it is observed, the following
kthread_flush_work() sees the queued work and waits for the teardown to
finish.
This patch was created with the help of an AI coding assistant.
Fixes: d99f7a32f09d ("sched_ext: Fix scx_flush_disable_work() UAF race")
Cc: stable@vger.kernel.org # v7.1+
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-195908@kernel.org/
Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ jpiecuch: applied kernel/sched/ext/ext.c hunk to kernel/sched/ext.c;
kept error_irq_work instead of disable_irq_work. ]
Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/ext.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index b3a6d60709403..64a68d698b823 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4247,10 +4247,17 @@ static void scx_flush_disable_work(struct scx_sched *sch)
{
int kind;
+ /*
+ * scx_disable_workfn() sets SCX_EXIT_DONE before tearing down. Read
+ * exit_kind with acquire ordering (paired with atomic_try_cmpxchg() in
+ * scx_disable_workfn()) before syncing and flushing so that, once DONE
+ * is seen, the following flush observes the queued work and waits for
+ * the teardown to finish.
+ */
do {
+ kind = atomic_read_acquire(&sch->exit_kind);
irq_work_sync(&sch->error_irq_work);
kthread_flush_work(&sch->disable_work);
- kind = atomic_read(&sch->exit_kind);
} while (kind != SCX_EXIT_NONE && kind != SCX_EXIT_DONE);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 036/703] iio: proximity: sx9360: fix sampling frequency write and available range
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (34 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 035/703] sched_ext: Read exit_kind before flushing in scx_flush_disable_work() Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 037/703] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
` (371 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Jonathan Cameron,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
commit d252425c1533bfacd5940faa3371af82196bff5b upstream.
GNRL_CTRL1/2 hold the scan period in units of 8192 / FOSC, but
sx9360_set_samp_freq() computes freq * 8192 / FOSC and mis-scales val2,
which is in micro units. Any integer frequency then programs a period
of 0, and fractional parts above ~0.26 Hz overflow the int, writing
0x10 to GNRL_CTRL1 outside the SCANPERIOD field.
Compute FOSC / (freq * 8192), rounded to the closest value, and reject
frequencies outside the 1..2047 period range.
The available range doesn't match the limits in the comments next to it
either: 4 MHz / 8192 is 488.28125 Hz, not 448.28125 Hz,
4 MHz / (8192 * 2047) is 0.238535 Hz, and (max - min) / 2047 is
0.238419 Hz. Use those values.
Fixes: 1cdb4c47f7f5 ("iio:proximity:sx9360: Add sx9360 support")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ Context: <linux/mod_devicetable.h> is still included here and the ID
tables carry driver data. ]
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/proximity/sx9360.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/proximity/sx9360.c b/drivers/iio/proximity/sx9360.c
index 4448988d4e7eb..7bb54eb7b1c89 100644
--- a/drivers/iio/proximity/sx9360.c
+++ b/drivers/iio/proximity/sx9360.c
@@ -14,11 +14,13 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/log2.h>
+#include <linux/math64.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regmap.h>
+#include <linux/units.h>
#include <linux/iio/iio.h>
@@ -44,6 +46,7 @@
#define SX9360_REG_GNRL_CTRL1_SCANPERIOD_MASK GENMASK(2, 0)
#define SX9360_REG_GNRL_CTRL2 0x12
#define SX9360_REG_GNRL_CTRL2_PERIOD_102MS 0x32
+#define SX9360_REG_GNRL_SCANPERIOD_MAX GENMASK(10, 0)
#define SX9360_REG_GNRL_REG_2_PERIOD_MS(_r) \
(((_r) * 8192) / (SX9360_FOSC_HZ / 1000))
#define SX9360_REG_GNRL_FREQ_2_REG(_f) (((_f) * 8192) / SX9360_FOSC_HZ)
@@ -183,9 +186,9 @@ static const struct {
int val;
int val2;
} sx9360_samp_freq_interval[] = {
- { 0, 281250 }, /* 4MHz / (8192 * 2047) */
- { 0, 281250 },
- { 448, 281250 }, /* 4MHz / 8192 */
+ { 0, 238535 }, /* 4MHz / (8192 * 2047) */
+ { 0, 238419 },
+ { 488, 281250 }, /* 4MHz / 8192 */
};
static const struct regmap_range sx9360_writable_reg_ranges[] = {
@@ -384,11 +387,25 @@ static int sx9360_read_avail(struct iio_dev *indio_dev,
static int sx9360_set_samp_freq(struct sx_common_data *data,
int val, int val2)
{
- int reg;
+ unsigned int period_ticks;
+ u64 freq_uHz;
__be16 buf;
- reg = val * 8192 / SX9360_FOSC_HZ + val2 * 8192 / (SX9360_FOSC_MHZ);
- buf = cpu_to_be16(reg);
+ if (val < 0 || val2 < 0)
+ return -EINVAL;
+
+ freq_uHz = (u64)val * MICROHZ_PER_HZ + val2;
+ if (!freq_uHz)
+ return -EINVAL;
+
+ /* The register holds the scan period in ticks of 8192 FOSC cycles. */
+ period_ticks = DIV64_U64_ROUND_CLOSEST((u64)SX9360_FOSC_HZ * MICROHZ_PER_HZ,
+ freq_uHz * 8192);
+ if (!period_ticks || period_ticks > SX9360_REG_GNRL_SCANPERIOD_MAX)
+ return -EINVAL;
+
+ buf = cpu_to_be16(period_ticks);
+
guard(mutex)(&data->mutex);
return regmap_bulk_write(data->regmap, SX9360_REG_GNRL_CTRL1, &buf,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 037/703] kprobes: Switch ftrace ops when adding probe with post_handler
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (35 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 036/703] iio: proximity: sx9360: fix sampling frequency write and available range Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 038/703] KEYS: Expand key->{datalen,quotalen} to unsigned int Greg Kroah-Hartman
` (370 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
[ Upstream commit f60f98881b54b0cf36b61f41c91fbd93b76a2d9c ]
When an ftrace-based kprobe is registered without a post_handler, it is
armed using kprobe_ftrace_ops. If a second probe with a post_handler is
subsequently registered at the same address, register_aggr_kprobe() sets
ap->post_handler to aggr_post_handler, but leaves the probe armed using
kprobe_ftrace_ops.
When the probe is later disarmed or disabled, disarm_kprobe_ftrace()
checks whether p->post_handler is non-NULL and attempts to disarm from
kprobe_ipmodify_ops. This fails with -ENOENT, decrements
kprobe_ipmodify_enabled below zero, leaves the probe armed on
kprobe_ftrace_ops, and aborts unregistration, leading to a use-after-free
if the probe module is unloaded.
Switch the armed probe from kprobe_ftrace_ops to kprobe_ipmodify_ops in
register_aggr_kprobe() outside of text_mutex and cpus_read_lock to avoid
lockdep and deadlock issues when modifying ftrace code. Defer adding the
new probe onto ap->list until the ftrace ops switch completes so that the
new probe's handlers are not published prematurely while ap is still on
kprobe_ftrace_ops, and mark ap disabled if rollback re-arming fails.
Also restore ftrace ops registration and counter if ftrace_set_filter_ip()
fails in __disarm_kprobe_ftrace().
Link: https://lore.kernel.org/all/179440641120.328088.15542754095040659094.stgit@devnote2/
Fixes: 5dd7caf0bdc5 ("kprobes: Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/kprobes.c | 55 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 45 insertions(+), 10 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index a180911d31d58..9b4447879a2ef 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1120,9 +1120,14 @@ static int __disarm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
(*cnt)--;
ret = ftrace_set_filter_ip(ops, (unsigned long)p->addr, 1, 0);
- WARN_ONCE(ret < 0, "Failed to disarm kprobe-ftrace at %pS (error %d)\n",
- p->addr, ret);
- return ret;
+ if (WARN_ONCE(ret < 0, "Failed to disarm kprobe-ftrace at %pS (error %d)\n",
+ p->addr, ret)) {
+ if (*cnt == 0)
+ register_ftrace_function(ops);
+ (*cnt)++;
+ return ret;
+ }
+ return 0;
}
static int disarm_kprobe_ftrace(struct kprobe *p)
@@ -1251,16 +1256,12 @@ void kprobe_busy_end(void)
}
/* Add the new probe to 'ap->list'. */
-static int add_new_kprobe(struct kprobe *ap, struct kprobe *p)
+static void add_new_kprobe(struct kprobe *ap, struct kprobe *p)
{
if (p->post_handler)
unoptimize_kprobe(ap, true); /* Fall back to normal kprobe */
list_add_rcu(&p->list, &ap->list);
- if (p->post_handler && !ap->post_handler)
- ap->post_handler = aggr_post_handler;
-
- return 0;
}
/*
@@ -1293,6 +1294,8 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p)
{
int ret = 0;
struct kprobe *ap = orig_p;
+ bool reset_post_handler = false;
+ bool ftrace_switch_ops = false;
scoped_guard(cpus_read_lock) {
/* For preparing optimization, jump_label_text_reserved() is called */
@@ -1339,18 +1342,50 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p)
| KPROBE_FLAG_DISABLED;
}
+ if (p->post_handler && !ap->post_handler) {
+ reset_post_handler = true;
+ if (kprobe_ftrace(ap) && !kprobes_all_disarmed &&
+ !kprobe_disabled(ap))
+ ftrace_switch_ops = true;
+ else
+ ap->post_handler = aggr_post_handler;
+ }
+
/* Copy the insn slot of 'p' to 'ap'. */
copy_kprobe(ap, p);
- ret = add_new_kprobe(ap, p);
+ if (!ftrace_switch_ops)
+ add_new_kprobe(ap, p);
+ }
+
+ if (ftrace_switch_ops) {
+ /*
+ * Must switch ftrace ops outside of text_mutex and cpus_read_lock
+ * to prevent deadlocks when ftrace code modification acquires text_mutex.
+ */
+ ret = disarm_kprobe_ftrace(ap);
+ if (ret)
+ return ret;
+
+ ap->post_handler = aggr_post_handler;
+ ret = arm_kprobe_ftrace(ap);
+ if (ret) {
+ ap->post_handler = NULL;
+ if (arm_kprobe_ftrace(ap))
+ ap->flags |= KPROBE_FLAG_DISABLED;
+ return ret;
+ }
+ add_new_kprobe(ap, p);
}
- if (ret == 0 && kprobe_disabled(ap) && !kprobe_disabled(p)) {
+ if (kprobe_disabled(ap) && !kprobe_disabled(p)) {
ap->flags &= ~KPROBE_FLAG_DISABLED;
if (!kprobes_all_disarmed) {
/* Arm the breakpoint again. */
ret = arm_kprobe(ap);
if (ret) {
ap->flags |= KPROBE_FLAG_DISABLED;
+ if (reset_post_handler)
+ ap->post_handler = NULL;
list_del_rcu(&p->list);
synchronize_rcu();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 038/703] KEYS: Expand key->{datalen,quotalen} to unsigned int
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (36 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 037/703] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 039/703] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP Greg Kroah-Hartman
` (369 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Eric Biggers,
Jarkko Sakkinen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <jarkko@kernel.org>
[ Upstream commit 4a65eaf146f0d10ebaa88cfaef9c3b24f93766d9 ]
In key_alloc() and key_payload_reserve(), key->quotalen and key->datalen
can receive values larger than USHRT_MAX.
Example:
keyctl new_session >/dev/null
owner=$(keyctl newring owner @s)
keeper=$(keyctl newring keeper @s)
for ((i=0; i<16384; i++)); do
key=$(keyctl add user "k$i" x "$keeper")
keyctl link "$key" "$owner"
done
awk -v uid="$(id -u):" '$1 == uid {print $NF}' /proc/key-users
keyctl clear "$owner"
awk -v uid="$(id -u):" '$1 == uid {print $NF}' /proc/key-users
Because key->datalen wraps around 65535, the quota refunded upon clearing
is truncated, causing quota bytes to leak in /proc/key-users.
Change the types of key->datalen and key->quotalen from unsigned short to
unsigned int so that they can carry the full payload length without
truncation.
Cc: stable@vger.kernel.org
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/r/20261020174325.2229448-2-jarkko@kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
[ sashal: Dropped the context lines using the smb_EIO1/smb_EIO2 helpers, which don't exist here, keeping plain -EIO, and applied only the %hu to %u change in the cifs_dbg strings. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsacl.c | 6 +++---
include/linux/key.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
index 9dcda4c244c3b..f14ca1cbd31f1 100644
--- a/fs/smb/client/cifsacl.c
+++ b/fs/smb/client/cifsacl.c
@@ -319,7 +319,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid)
goto out_revert_creds;
} else if (sidkey->datalen < CIFS_SID_BASE_SIZE) {
rc = -EIO;
- cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu)\n",
+ cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%u)\n",
__func__, sidkey->datalen);
goto invalidate_key;
}
@@ -336,7 +336,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid)
ksid_size = CIFS_SID_BASE_SIZE + (ksid->num_subauth * sizeof(__le32));
if (ksid_size > sidkey->datalen) {
rc = -EIO;
- cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu, ksid_size=%u)\n",
+ cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%u, ksid_size=%u)\n",
__func__, sidkey->datalen, ksid_size);
goto invalidate_key;
}
@@ -430,7 +430,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
*/
BUILD_BUG_ON(sizeof(uid_t) != sizeof(gid_t));
if (sidkey->datalen != sizeof(uid_t)) {
- cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu)\n",
+ cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%u)\n",
__func__, sidkey->datalen);
key_invalidate(sidkey);
goto out_key_put;
diff --git a/include/linux/key.h b/include/linux/key.h
index 77efb30bb73cf..3b8af14fb3239 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -219,8 +219,8 @@ struct key {
kuid_t uid;
kgid_t gid;
key_perm_t perm; /* access permissions */
- unsigned short quotalen; /* length added to quota */
- unsigned short datalen; /* payload data length
+ unsigned int quotalen; /* length added to quota */
+ unsigned int datalen; /* payload data length
* - may not match RCU dereferenced payload
* - payload should contain own length
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 039/703] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (37 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 038/703] KEYS: Expand key->{datalen,quotalen} to unsigned int Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 040/703] KEYS: Protect pkey method checks against type removal Greg Kroah-Hartman
` (368 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mohammed EL Kadiri, Jarkko Sakkinen,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohammed EL Kadiri <med08elkadiri@gmail.com>
[ Upstream commit 1b9524250996b1f2f49833a1b2ae21c34e486f85 ]
Replace two BUG() calls in keyctl_pkey_params_get_2() and
keyctl_pkey_e_d_s() default cases with -EOPNOTSUPP, matching
the error style already used in these functions.
Signed-off-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Stable-dep-of: bab48a104447 ("KEYS: Protect pkey method checks against type removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/keys/keyctl_pkey.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c
index ba150ee2d4a37..15b6bf6399b59 100644
--- a/security/keys/keyctl_pkey.c
+++ b/security/keys/keyctl_pkey.c
@@ -163,7 +163,7 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
params->out_len = info.max_sig_size;
break;
default:
- BUG();
+ return -EOPNOTSUPP;
}
params->in_len = uparams.in_len;
@@ -245,7 +245,8 @@ long keyctl_pkey_e_d_s(int op,
params.op = kernel_pkey_sign;
break;
default:
- BUG();
+ ret = -EOPNOTSUPP;
+ goto error_params;
}
in = memdup_user(_in, params.in_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 040/703] KEYS: Protect pkey method checks against type removal
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (38 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 039/703] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP Greg Kroah-Hartman
@ 2026-12-04 9:58 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 041/703] btrfs: reject refs=0 subvolume without DEAD in SUBVOL_SYNC_WAIT Greg Kroah-Hartman
` (367 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:58 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuansheng Yang, Jarkko Sakkinen,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuansheng Yang <0xbeac@gmail.com>
[ Upstream commit bab48a1044475f62d6e910c6d7267ce4bae847f9 ]
keyctl_pkey_query(), keyctl_pkey_e_d_s() and keyctl_pkey_verify() check
that key->type has the ->asym_*() method they need and call it later,
without holding key->sem. A reference keeps the key alive, but does not
pin the module that provides its type.
When that module is unloaded, unregister_key_type() waits for the key GC
to process every remaining key of the type. For each such key, the GC
takes key->sem for writing, switches key->type to key_type_dead, whose
->asym_*() methods are NULL, and destroys the payload. If that happens
between the check and the call, the keyctl calls a NULL method; if it
happens while the method runs, the method returns into freed module text.
In-tree, turris-signing-key provides ->asym_query() and ->asym_eds_op()
and can be built as a module.
Take key->sem for reading around each method call, and check the method
again under it, right before the call. While the lock is held the GC
cannot switch the key to key_type_dead, so unregister_key_type() and the
module unload cannot complete until the method returns. If the type is
already gone, the check finds key_type_dead and the keyctl fails with
-EOPNOTSUPP, as it does for any key type without the method.
memdup_user() and copy_to_user() stay outside key->sem, as in
keyctl_read_key(), so no page fault is taken with key->sem held. The
in-tree ->asym_*() methods do not take key->sem themselves. Nothing else
in the kernel calls these methods, so these four call sites are the full
coverage:
- keyctl_pkey_query(): ->asym_query() for KEYCTL_PKEY_QUERY
- keyctl_pkey_params_get_2(): ->asym_query(), and the op-specific check
for KEYCTL_PKEY_ENCRYPT, _DECRYPT, _SIGN and _VERIFY
- keyctl_pkey_e_d_s(): ->asym_eds_op() for _ENCRYPT, _DECRYPT and _SIGN
- keyctl_pkey_verify(): ->asym_verify_signature() for _VERIFY
This problem was recently fixed for keyctl_read_key() by 925c84e3cc21
("keys: Protect the read method check against type removal") and for
key_update() by aef3a8a4f988 ("KEYS: Protect the update method check
against type removal").
Fixes: 00d60fd3b932 ("KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver #2]")
Cc: stable@vger.kernel.org
Signed-off-by: Yuansheng Yang <0xbeac@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261110030252.9979-1-0xbeac@gmail.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/keys/keyctl_pkey.c | 100 +++++++++++++++++++++++++++---------
1 file changed, 76 insertions(+), 24 deletions(-)
diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c
index 15b6bf6399b59..e7121523b9c9a 100644
--- a/security/keys/keyctl_pkey.c
+++ b/security/keys/keyctl_pkey.c
@@ -129,45 +129,77 @@ static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_par
if (ret < 0)
return ret;
+ down_read(¶ms->key->sem);
+
+ if (!params->key->type->asym_query) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params->key->type->asym_query(params, &info);
if (ret < 0)
- return ret;
+ goto out_up_key_sem;
switch (op) {
case KEYCTL_PKEY_ENCRYPT:
if (uparams.in_len > info.max_dec_size ||
- uparams.out_len > info.max_enc_size)
- return -EINVAL;
+ uparams.out_len > info.max_enc_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_enc_size;
break;
case KEYCTL_PKEY_DECRYPT:
if (uparams.in_len > info.max_enc_size ||
- uparams.out_len > info.max_dec_size)
- return -EINVAL;
+ uparams.out_len > info.max_dec_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_dec_size;
break;
case KEYCTL_PKEY_SIGN:
if (uparams.in_len > info.max_data_size ||
- uparams.out_len > info.max_sig_size)
- return -EINVAL;
+ uparams.out_len > info.max_sig_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_sig_size;
break;
case KEYCTL_PKEY_VERIFY:
if (uparams.in_len > info.max_data_size ||
- uparams.in2_len > info.max_sig_size)
- return -EINVAL;
+ uparams.in2_len > info.max_sig_size) {
+ ret = -EINVAL;
+ goto out_up_key_sem;
+ }
params->out_len = info.max_sig_size;
break;
default:
- return -EOPNOTSUPP;
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
}
params->in_len = uparams.in_len;
- return 0;
+
+ switch (op) {
+ case KEYCTL_PKEY_VERIFY:
+ if (!params->key->type->asym_verify_signature)
+ ret = -EOPNOTSUPP;
+ break;
+ case KEYCTL_PKEY_ENCRYPT:
+ case KEYCTL_PKEY_DECRYPT:
+ case KEYCTL_PKEY_SIGN:
+ if (!params->key->type->asym_eds_op)
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
+out_up_key_sem:
+ up_read(¶ms->key->sem);
+ return ret;
}
/*
@@ -185,7 +217,16 @@ long keyctl_pkey_query(key_serial_t id,
if (ret < 0)
goto error;
+ down_read(¶ms.key->sem);
+ if (!params.key->type->asym_query) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params.key->type->asym_query(¶ms, &res);
+
+out_up_key_sem:
+ up_read(¶ms.key->sem);
if (ret < 0)
goto error;
@@ -230,10 +271,6 @@ long keyctl_pkey_e_d_s(int op,
if (ret < 0)
goto error_params;
- ret = -EOPNOTSUPP;
- if (!params.key->type->asym_eds_op)
- goto error_params;
-
switch (op) {
case KEYCTL_PKEY_ENCRYPT:
params.op = kernel_pkey_encrypt;
@@ -260,7 +297,16 @@ long keyctl_pkey_e_d_s(int op,
if (!out)
goto error_in;
+ down_read(¶ms.key->sem);
+ if (!params.key->type->asym_eds_op) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params.key->type->asym_eds_op(¶ms, in, out);
+
+out_up_key_sem:
+ up_read(¶ms.key->sem);
if (ret < 0)
goto error_out;
@@ -305,31 +351,37 @@ long keyctl_pkey_verify(const struct keyctl_pkey_params __user *_params,
ret = keyctl_pkey_params_get_2(_params, _info, KEYCTL_PKEY_VERIFY,
¶ms);
if (ret < 0)
- goto error_params;
-
- ret = -EOPNOTSUPP;
- if (!params.key->type->asym_verify_signature)
- goto error_params;
+ goto out_free_params;
in = memdup_user(_in, params.in_len);
if (IS_ERR(in)) {
ret = PTR_ERR(in);
- goto error_params;
+ goto out_free_params;
}
in2 = memdup_user(_in2, params.in2_len);
if (IS_ERR(in2)) {
ret = PTR_ERR(in2);
- goto error_in;
+ goto out_free_in;
}
params.op = kernel_pkey_verify;
+ down_read(¶ms.key->sem);
+ if (!params.key->type->asym_verify_signature) {
+ ret = -EOPNOTSUPP;
+ goto out_up_key_sem;
+ }
+
ret = params.key->type->asym_verify_signature(¶ms, in, in2);
+out_up_key_sem:
+ up_read(¶ms.key->sem);
kfree(in2);
-error_in:
+
+out_free_in:
kfree(in);
-error_params:
+
+out_free_params:
keyctl_pkey_params_free(¶ms);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 041/703] btrfs: reject refs=0 subvolume without DEAD in SUBVOL_SYNC_WAIT
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (39 preceding siblings ...)
2026-12-04 9:58 ` [PATCH 6.18 040/703] KEYS: Protect pkey method checks against type removal Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 042/703] tcp: move __reqsk_free() out of line Greg Kroah-Hartman
` (366 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Cheng Yongkang, Qu Wenruo,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
[ Upstream commit 9a58e56e70f610e29b53821e9c706600e529cca3 ]
btrfs_ioctl_subvol_sync() assumes that a cached root with zero
references has BTRFS_ROOT_SUBVOL_DEAD set, and asserts that before
waiting for the cleaner. Two states break the assumption:
- A corrupt ROOT_ITEM with zero references and a matching orphan item,
on a writable filesystem.
- A failed subvolume deletion. btrfs_delete_subvolume() zeroes the
root references, aborts the transaction, which forces the filesystem
read-only, and then clears DEAD again. No on-disk metadata is
corrupted in this case.
With CONFIG_BTRFS_ASSERT=y, both reach a BUG().
Change the ASSERT() into a proper rejection to avoid triggering a BUG().
Fixes: 6c83d153ed86 ("btrfs: add new ioctl to wait for cleaned subvolumes")
CC: stable@vger.kernel.org
Suggested-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Link: https://lore.kernel.org/linux-btrfs/dd97efe9-91ec-495b-b698-acff1447421c@gmx.com/
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
[ Rework the commit message, drop the ad-hoc RW check. ]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[ sashal: The removed ASSERT() is the older one-line form, since this tree does not have the ASSERT() message conversion. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/ioctl.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 84305ed0dc70e..2bf61cf1fd6bb 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -5224,7 +5224,12 @@ static int btrfs_ioctl_subvol_sync(struct btrfs_fs_info *fs_info, void __user *a
return -ENOENT;
wait_for_deletion = true;
- ASSERT(root_flags & BTRFS_ROOT_SUBVOL_DEAD);
+ if (unlikely(!(root_flags & BTRFS_ROOT_SUBVOL_DEAD))) {
+ btrfs_err(fs_info,
+ "subvol %llu has refs 0 without DEAD flag",
+ args.subvolid);
+ return -EUCLEAN;
+ }
sched_ret = schedule_timeout_interruptible(HZ);
/* Early wake up or error. */
if (sched_ret != 0)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 042/703] tcp: move __reqsk_free() out of line
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (40 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 041/703] btrfs: reject refs=0 subvolume without DEAD in SUBVOL_SYNC_WAIT Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 043/703] tcp: free saved_syn after an RCU grace period Greg Kroah-Hartman
` (365 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
[ Upstream commit 22c1264415ef0d4564dd74e3de66e1895d3f7bc0 ]
Inlining __reqsk_free() is overkill, let's reclaim 2 Kbytes of text.
$ scripts/bloat-o-meter -t vmlinux.old vmlinux.new
add/remove: 2/4 grow/shrink: 2/14 up/down: 225/-2338 (-2113)
Function old new delta
__reqsk_free - 114 +114
sock_edemux 18 82 +64
inet_csk_listen_start 233 264 +31
__pfx___reqsk_free - 16 +16
__pfx_reqsk_queue_alloc 16 - -16
__pfx_reqsk_free 16 - -16
reqsk_queue_alloc 46 - -46
tcp_req_err 272 177 -95
reqsk_fastopen_remove 348 253 -95
cookie_bpf_check 157 62 -95
cookie_tcp_reqsk_alloc 387 290 -97
cookie_v4_check 1568 1465 -103
reqsk_free 105 - -105
cookie_v6_check 1519 1412 -107
sock_gen_put 187 78 -109
sock_pfree 212 82 -130
tcp_try_fastopen 1818 1683 -135
tcp_v4_rcv 3478 3294 -184
reqsk_put 306 90 -216
tcp_get_cookie_sock 551 318 -233
tcp_v6_rcv 3404 3141 -263
tcp_conn_request 2677 2384 -293
Total: Before=24887415, After=24885302, chg -0.01%
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260204055147.1682705-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 2b9fd1a0abf0 ("tcp: free saved_syn after an RCU grace period")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/request_sock.h | 9 +--------
net/ipv4/inet_connection_sock.c | 10 ++++++++++
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index cd4d4cf71d0d2..e5108d0b14d72 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -124,14 +124,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb,
return sk;
}
-static inline void __reqsk_free(struct request_sock *req)
-{
- req->rsk_ops->destructor(req);
- if (req->rsk_listener)
- sock_put(req->rsk_listener);
- kfree(req->saved_syn);
- kmem_cache_free(req->rsk_ops->slab, req);
-}
+void __reqsk_free(struct request_sock *req);
static inline void reqsk_free(struct request_sock *req)
{
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 1f75a4a94cad4..e70dd99c2f912 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -934,6 +934,16 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
}
EXPORT_SYMBOL(inet_reqsk_alloc);
+void __reqsk_free(struct request_sock *req)
+{
+ req->rsk_ops->destructor(req);
+ if (req->rsk_listener)
+ sock_put(req->rsk_listener);
+ kfree(req->saved_syn);
+ kmem_cache_free(req->rsk_ops->slab, req);
+}
+EXPORT_SYMBOL_GPL(__reqsk_free);
+
static struct request_sock *inet_reqsk_clone(struct request_sock *req,
struct sock *sk)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 043/703] tcp: free saved_syn after an RCU grace period
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (41 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 042/703] tcp: move __reqsk_free() out of line Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 044/703] cgroup/cpuset: Correctly set isolated_cpus when switching partition state Greg Kroah-Hartman
` (364 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yingjie Wang, Kuniyuki Iwashima,
Eric Dumazet, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <x-professor@outlook.com>
[ Upstream commit 2b9fd1a0abf0c1c7200be7a33cfeeca1c68089b6 ]
tcp_reqsk_record_syn() allocates saved_syn separately from its request
socket. bpf_sock_ops_get_syn() can load that pointer while processing a
retransmitted SYN under RCU.
There are two ownership transfers which can let another CPU reclaim the
allocation while such a reader is still using it.
First, tcp_move_syn() transfers req->saved_syn to a newly created child
socket. The child can be closed and tcp_saved_syn_free() can reclaim the
allocation before a reader of the old request finishes.
Second, inet_reqsk_clone() shallow-copies request_sock during request
migration. After reqsk_migrate_reset() clears the old request pointer, the
migrated clone owns it. However, a reader which already loaded the pointer
from the old request can still be using it when the clone is released.
I found this through LLM-assisted concurrency fuzzing.
Mark the request-socket saved_syn pointer as RCU protected and use RCU
accessors for its reads and updates. Keep the full-socket pointer plain
because all of its accesses hold the socket lock. Embed an rcu_head in
struct saved_syn and use kfree_rcu() in both teardown paths. This lets a
request-side reader which loaded the object before an ownership transfer
finish.
This follows commit e3f33b0a1d89 ("ipv4: free inet_opt and ireq_opt
after an RCU grace period"), which fixed the same ownership-transfer
pattern for IPv4 options.
The issue was confirmed with KASAN on v7.3-16007-g36aad21d50d1 using
temporary kernel instrumentation to widen the reader and request-migration
window. KASAN reported a slab-use-after-free read in
bpf_sock_ops_get_syn(), with the allocation freed by __reqsk_free() from
reqsk_timer_handler(). The same explicit migration test completed without
a report with deferred reclamation. A patched kernel without the delay
instrumentation also completed a successful migration and seven saved-SYN
reads without a KASAN report.
Fixes: 0813a841566f ("bpf: tcp: Allow bpf prog to write and parse TCP header option")
Fixes: c905dee62232 ("tcp: Migrate TCP_NEW_SYN_RECV requests at retransmitting SYN+ACKs.")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/38fa9f2cc476502e9b1c1fef09ebba1df5dd5901.1793795528.git.x-professor@outlook.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/tcp.h | 6 +++---
include/net/request_sock.h | 3 ++-
net/core/filter.c | 2 +-
net/ipv4/inet_connection_sock.c | 6 +++---
net/ipv4/tcp_input.c | 2 +-
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7cc2ddcd9bc0d..9796c101b22d2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -604,13 +604,13 @@ static inline void fastopen_queue_tune(struct sock *sk, int backlog)
static inline void tcp_move_syn(struct tcp_sock *tp,
struct request_sock *req)
{
- tp->saved_syn = req->saved_syn;
- req->saved_syn = NULL;
+ tp->saved_syn = unrcu_pointer(req->saved_syn);
+ RCU_INIT_POINTER(req->saved_syn, NULL);
}
static inline void tcp_saved_syn_free(struct tcp_sock *tp)
{
- kfree(tp->saved_syn);
+ kfree_rcu(tp->saved_syn, rcu);
tp->saved_syn = NULL;
}
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index e5108d0b14d72..8717559d028b9 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -40,6 +40,7 @@ struct request_sock_ops {
};
struct saved_syn {
+ struct rcu_head rcu;
u32 mac_hdrlen;
u32 network_hdrlen;
u32 tcp_hdrlen;
@@ -69,7 +70,7 @@ struct request_sock {
struct timer_list rsk_timer;
const struct request_sock_ops *rsk_ops;
struct sock *sk;
- struct saved_syn *saved_syn;
+ struct saved_syn __rcu *saved_syn;
u32 secid;
u32 peer_secid;
u32 timeout;
diff --git a/net/core/filter.c b/net/core/filter.c
index 8b76dd1201038..ec8ce9faca0c5 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5931,7 +5931,7 @@ static int bpf_sock_ops_get_syn(struct bpf_sock_ops_kern *bpf_sock,
* not be available. It has to resort to
* saved_syn (if it is saved).
*/
- saved_syn = inet_reqsk(sk)->saved_syn;
+ saved_syn = rcu_dereference(inet_reqsk(sk)->saved_syn);
else
saved_syn = tcp_sk(sk)->saved_syn;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index e70dd99c2f912..5f2ddb5a4ad23 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -897,7 +897,7 @@ reqsk_alloc_noprof(const struct request_sock_ops *ops, struct sock *sk_listener,
req_to_sk(req)->sk_prot = sk_listener->sk_prot;
sk_node_init(&req_to_sk(req)->sk_node);
sk_tx_queue_clear(req_to_sk(req));
- req->saved_syn = NULL;
+ RCU_INIT_POINTER(req->saved_syn, NULL);
req->syncookie = 0;
req->timeout = 0;
req->num_timeout = 0;
@@ -939,7 +939,7 @@ void __reqsk_free(struct request_sock *req)
req->rsk_ops->destructor(req);
if (req->rsk_listener)
sock_put(req->rsk_listener);
- kfree(req->saved_syn);
+ kfree_rcu(unrcu_pointer(req->saved_syn), rcu);
kmem_cache_free(req->rsk_ops->slab, req);
}
EXPORT_SYMBOL_GPL(__reqsk_free);
@@ -1011,7 +1011,7 @@ static void reqsk_queue_migrated(struct request_sock_queue *queue,
static void reqsk_migrate_reset(struct request_sock *req)
{
- req->saved_syn = NULL;
+ RCU_INIT_POINTER(req->saved_syn, NULL);
#if IS_ENABLED(CONFIG_IPV6)
inet_rsk(req)->ipv6_opt = NULL;
inet_rsk(req)->pktopts = NULL;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 41db56f936f06..ec956f96b77eb 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -7454,7 +7454,7 @@ static void tcp_reqsk_record_syn(const struct sock *sk,
saved_syn->network_hdrlen = skb_network_header_len(skb);
saved_syn->tcp_hdrlen = tcp_hdrlen(skb);
memcpy(saved_syn->data, base, len);
- req->saved_syn = saved_syn;
+ RCU_INIT_POINTER(req->saved_syn, saved_syn);
}
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 044/703] cgroup/cpuset: Correctly set isolated_cpus when switching partition state
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (42 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 043/703] tcp: free saved_syn after an RCU grace period Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 045/703] arm64: suspend: rely on daif helpers to handle PMR Greg Kroah-Hartman
` (363 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Waiman Long, Ridong Chen, Tejun Heo,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <longman@redhat.com>
[ Upstream commit 56681bc448a80bb2473026b41c44c133766bc38d ]
When update_prstate() is called to switch the partition state from
root to isolated or vice versa, the whole effective_xcpus is passed to
isolated_cpus_update(). However, if there are child partitions present,
some of the effective_xcpus are dedicated to those child partitions
and their partition states will remain the same or get invalidated in
the case of child root partition with isolated parent in the latter
update_cpumasks_hier() call. In the latter case, their exclusive CPUs
will be returned to their parent.
Therefore isolated_cpus may be set incorrectly with child partitions
underneath. Fix that by excluding their exclusive CPUs in computing
the correct cpumask of exclusive CPUs used by that partition alone.
Add new test cases into test_cpuset_prs.sh to test for such cases.
Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Cc: stable@vger.kernel.org # v6.8+
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
Tested-by: Ridong Chen <ridong.chen@linux.dev>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Context differs because the tree lacks the PERR_ISOPARENT check and has a different if/else shape, and the selftest matrix has different neighboring rows; the two new selftest rows carry :S+, which test_cpuset_prs.sh still needs on this tree, and the other added lines are unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 21 ++++++++++++++++++-
.../selftests/cgroup/test_cpuset_prs.sh | 7 +++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 9bd1753dbcbe2..52eed70c2eb43 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -3235,7 +3235,26 @@ static int update_prstate(struct cpuset *cs, int new_prs)
disable_partition = true;
err = PERR_HKEEPING;
} else {
+ struct cgroup_subsys_state *css;
+ struct cpuset *child;
+
+ /*
+ * Need to scan child partitions, if present, and
+ * exclude their effective_xcpus from cs. In the case
+ * of switching to isolated partition with child root
+ * partitions, those child partitions will be
+ * invalidated in update_cpumasks_hier().
+ */
isolcpus_updated = true;
+ cpumask_copy(tmpmask.new_cpus, cs->effective_xcpus);
+ rcu_read_lock();
+ cpuset_for_each_child(child, css, cs) {
+ if (!is_partition_valid(child))
+ continue;
+ cpumask_andnot(tmpmask.new_cpus, tmpmask.new_cpus,
+ child->effective_xcpus);
+ }
+ rcu_read_unlock();
}
} else {
/*
@@ -3273,7 +3292,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
if (!is_partition_valid(cs))
reset_partition_data(cs);
else if (isolcpus_updated)
- isolated_cpus_update(old_prs, new_prs, cs->effective_xcpus);
+ isolated_cpus_update(old_prs, new_prs, tmpmask.new_cpus);
spin_unlock_irq(&callback_lock);
update_isolation_cpumasks(isolcpus_updated);
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 25eef20c17466..af083a527b24e 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -441,6 +441,13 @@ TEST_MATRIX=(
"C1-4:P1:S+ C3-4:P2 . . T:C4-6 . . . 0 A1:5-6|A2:4 A1:P1|A2:P2 4"
"C1-4:P1:S+ C1-2:P2 . . T:C4-6 . . . 0 A1:4-6|A2:4-6 A1:P1|A2:P-2 ."
+ # Switch PRS state (root <=> isolated) will properly update cpuset.cpus.isolated
+ # even if child partitions are present.
+ " C1-6:P1:S+ C3-6:P1:S+ C5-6:P2 . . P2 . . 0 A1:1-2|A2:3-4|A3:5-6 \
+ A1:P1|A2:P2|A3:P2 3-6"
+ " C1-6:P1:S+ C3-6:P2:S+ C5-6:P2 . . P1 . . 0 A1:1-2|A2:3-4|A3:5-6 \
+ A1:P1|A2:P1|A3:P2 5-6"
+
#
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
# ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 045/703] arm64: suspend: rely on daif helpers to handle PMR
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (43 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 044/703] cgroup/cpuset: Correctly set isolated_cpus when switching partition state Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 046/703] arm64: suspend: Only track cpuidle context for idle tasks Greg Kroah-Hartman
` (362 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ada Couprie Diaz, Vladimir Murzin,
Jinjie Ruan, Will Deacon, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
[ Upstream commit 630ca6c58fcfeaddd96dd46e7b11826013977955 ]
Commit 77345ef70445 ("arm64: suspend: Use cpuidle context helpers
in cpu_suspend()") added cpuidle helpers to handle PMR manipulation
and restoration to ensure that the CPU receives interrupts when suspended
and pseudo-NMIs are enabled.
However, those helpers are called in between a pair of `local_daif_save()`
and `local_daif_restore()`, which already configure the PMR as expected.
Effectively, `arm_cpuidle_save_irq_context()` is a no-op here,
even when using pseudo-NMIs, and `arm_cpuidle_restore_irq_context()`
would not restore proper interrupt masking configuration early enough
if there were unexpected changes during suspend or resume.
(This can be observed with Trusted Firmware A (TF-A) at EL3 handling
suspend through PSCI. Even though it should not be the case, TF-A can
reset `ICC_PMR_EL1` during CPU_SUSPEND, thus resuming the kernel
with an inconsistent priority mask value on hardware implementing
more than the minimum number of priority levels, such as Morello.)
Thus : remove the cpuidle context helpers as they do not do anything,
but keep the comment mentioning the need for interrupts to reach the CPU
if we are using pseudo-NMIs.
Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Will Deacon <will@kernel.org>
Stable-dep-of: ad3fc05c7e65 ("arm64: suspend: Only track cpuidle context for idle tasks")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kernel/suspend.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index eaaff94329cdd..c41724a40b756 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -99,7 +99,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
int ret = 0;
unsigned long flags;
struct sleep_stack_data state;
- struct arm_cpuidle_irq_context context;
/*
* Some portions of CPU state (e.g. PSTATE.{PAN,DIT}) are initialized
@@ -121,6 +120,9 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
* Strictly speaking the trace_hardirqs_off() here is superfluous,
* hardirqs should be firmly off by now. This really ought to use
* something like raw_local_daif_save().
+ *
+ * This also unmasks interrupts in PMR in order to reliably
+ * resume if we're using pseudo-NMIs.
*/
flags = local_daif_save();
@@ -131,12 +133,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
*/
pause_graph_tracing();
- /*
- * Switch to using DAIF.IF instead of PMR in order to reliably
- * resume if we're using pseudo-NMIs.
- */
- arm_cpuidle_save_irq_context(&context);
-
ct_cpuidle_enter();
if (__cpu_suspend_enter(&state)) {
@@ -159,8 +155,6 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
__cpu_suspend_exit();
}
- arm_cpuidle_restore_irq_context(&context);
-
unpause_graph_tracing();
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 046/703] arm64: suspend: Only track cpuidle context for idle tasks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (44 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 045/703] arm64: suspend: rely on daif helpers to handle PMR Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 047/703] cpufreq: Avoid redundant target() calls for unchanged limits Greg Kroah-Hartman
` (361 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+79883955da3a62652a80,
Uladzislau Zhauniarovich, Catalin Marinas, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
[ Upstream commit ad3fc05c7e65009355effeea06aa629a687acef2 ]
Commit 19235e472798 ("cpuidle, arm64: Fix the ARM64 cpuidle logic") moved
the calls to ct_cpuidle_enter() and ct_cpuidle_exit() into cpu_suspend() so
that arm64 cpuidle could keep RCU watching longer and manage context
tracking internally. However, cpu_suspend() is called not only by cpuidle
via psci_cpu_suspend_enter() (which runs in the context of the idle task),
but also during system suspend via psci_system_suspend_enter() (which runs
in the context of the task initiating suspend, such as a process writing to
/sys/power/state).
When entering system suspend, current is a non-idle task. Calling
ct_cpuidle_enter() invokes ct_kernel_exit() from kernel space (!user) on a
non-idle task. With CONFIG_RCU_EQS_DEBUG enabled, this violates context
tracking invariants and triggers a warning:
WARNING: kernel/context_tracking.c:120 at ct_kernel_exit+0x1b4/0x1f4
kernel/context_tracking.c:118
Call trace:
ct_kernel_exit+0x1b4/0x1f4 kernel/context_tracking.c:118
ct_idle_enter+0x20/0x34 kernel/context_tracking.c:299
ct_cpuidle_enter include/linux/cpuidle.h:134 [inline]
cpu_suspend+0x264/0x474 arch/arm64/kernel/suspend.c:136
psci_system_suspend_enter+0x4c/0x80 drivers/firmware/psci/psci.c:544
suspend_enter kernel/power/suspend.c:468 [inline]
suspend_devices_and_enter+0x88c/0xd0c kernel/power/suspend.c:533
enter_state kernel/power/suspend.c:618 [inline]
pm_suspend+0x498/0x698 kernel/power/suspend.c:644
state_store+0x14c/0x1fc kernel/power/main.c:819
kobj_attr_store+0x6c/0x90 lib/kobject.c:842
sysfs_kf_write+0xe0/0x108 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x260/0x3b8 fs/kernfs/file.c:345
vfs_write+0x51c/0xa0c fs/read_write.c:687
ksys_write+0x12c/0x228 fs/read_write.c:739
A corresponding warning is subsequently triggered in ct_kernel_enter() via
ct_cpuidle_exit() upon resume.
Fix this by checking is_idle_task(current) in cpu_suspend() and only
invoking ct_cpuidle_enter() and ct_cpuidle_exit() when executing in the
context of an idle task.
Fixes: 19235e472798 ("cpuidle, arm64: Fix the ARM64 cpuidle logic")
Cc: <stable@vger.kernel.org>
Assisted-by: Gemini:gemini-3.8-flash Gemini:gemini-3.1-pro-preview syzbot
Reported-by: syzbot+79883955da3a62652a80@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=79883955da3a62652a80
Link: https://syzkaller.appspot.com/ai_job?id=5359e16f-013b-4850-9cbc-ddfb3bac95e5
Signed-off-by: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Tested-by: Uladzislau Zhauniarovich <uladzislau.zhauniarovich@gmail.com>
Link: https://lore.kernel.org/r/3e92ccb0-2952-4317-af4c-45457c15efae@gmail.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/kernel/suspend.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index c41724a40b756..cde0b8c19377e 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -5,6 +5,7 @@
#include <linux/uaccess.h>
#include <linux/pgtable.h>
#include <linux/cpuidle.h>
+#include <linux/sched.h>
#include <asm/alternative.h>
#include <asm/cacheflush.h>
#include <asm/cpufeature.h>
@@ -99,6 +100,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
int ret = 0;
unsigned long flags;
struct sleep_stack_data state;
+ bool idle = is_idle_task(current);
/*
* Some portions of CPU state (e.g. PSTATE.{PAN,DIT}) are initialized
@@ -133,7 +135,8 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
*/
pause_graph_tracing();
- ct_cpuidle_enter();
+ if (idle)
+ ct_cpuidle_enter();
if (__cpu_suspend_enter(&state)) {
/* Call the suspend finisher */
@@ -149,9 +152,11 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
if (!ret)
ret = -EOPNOTSUPP;
- ct_cpuidle_exit();
+ if (idle)
+ ct_cpuidle_exit();
} else {
- ct_cpuidle_exit();
+ if (idle)
+ ct_cpuidle_exit();
__cpu_suspend_exit();
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 047/703] cpufreq: Avoid redundant target() calls for unchanged limits
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (45 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 046/703] arm64: suspend: Only track cpuidle context for idle tasks Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 048/703] cpufreq: Force passing target frequency to driver during resume Greg Kroah-Hartman
` (360 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Viresh Kumar, Lifeng Zheng,
Zhongqiu Han, Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <viresh.kumar@linaro.org>
[ Upstream commit 9801be8bef65dbcbc40c1a9c2f03d70ed67a5d30 ]
Drivers setting CPUFREQ_NEED_UPDATE_LIMITS expect target() to be
invoked even if the target frequency remains unchanged, so they can
update their internal policy limits state.
Currently the core invokes target() unconditionally whenever the
requested frequency matches policy->cur for such drivers, even if
policy->min and policy->max haven't changed since the previous update.
Track pending policy limit updates explicitly and skip redundant
target() invocations when neither the target frequency nor the
effective limits changed.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Link: https://patch.msgid.link/d0107c364b709abca21acf88072220bc05478594.1779423281.git.viresh.kumar@linaro.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 342d3a73c5db ("cpufreq: Force passing target frequency to driver during resume")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++++---------
include/linux/cpufreq.h | 3 +++
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 962faa2463db6..94f611512cfc8 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2407,9 +2407,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
* exactly same freq is called again and so we can save on few function
* calls.
*/
- if (target_freq == policy->cur &&
- !(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS))
- return 0;
+ if (target_freq == policy->cur) {
+ if (!(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS) ||
+ !policy->update_limits)
+ return 0;
+
+ policy->update_limits = false;
+ }
if (cpufreq_driver->target) {
/*
@@ -2669,6 +2673,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
{
struct cpufreq_policy_data new_data;
struct cpufreq_governor *old_gov;
+ unsigned int freq;
int ret;
memcpy(&new_data.cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo));
@@ -2701,12 +2706,20 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
* compiler optimizations around them because they may be accessed
* concurrently by cpufreq_driver_resolve_freq() during the update.
*/
- WRITE_ONCE(policy->max, __resolve_freq(policy, new_data.max,
- new_data.min, new_data.max,
- CPUFREQ_RELATION_H));
- new_data.min = __resolve_freq(policy, new_data.min, new_data.min,
- new_data.max, CPUFREQ_RELATION_L);
- WRITE_ONCE(policy->min, new_data.min > policy->max ? policy->max : new_data.min);
+ freq = __resolve_freq(policy, new_data.max, new_data.min, new_data.max,
+ CPUFREQ_RELATION_H);
+ if (freq != policy->max) {
+ WRITE_ONCE(policy->max, freq);
+ policy->update_limits = true;
+ }
+
+ freq = __resolve_freq(policy, new_data.min, new_data.min, new_data.max,
+ CPUFREQ_RELATION_L);
+ freq = min(freq, policy->max);
+ if (freq != policy->min) {
+ WRITE_ONCE(policy->min, freq);
+ policy->update_limits = true;
+ }
trace_cpu_frequency_limits(policy);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 69034172a7558..fa5d92d408a8c 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -145,6 +145,9 @@ struct cpufreq_policy {
/* Per policy boost supported flag. */
bool boost_supported;
+ /* Pending policy->min/max update for the driver */
+ bool update_limits;
+
/* The policy has been suspended. */
bool suspended;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 048/703] cpufreq: Force passing target frequency to driver during resume
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (46 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 047/703] cpufreq: Avoid redundant target() calls for unchanged limits Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 049/703] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
` (359 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zak Brighton Knight, Doug Smythies,
Rafael J. Wysocki, Zhongqiu Han, Viresh Kumar, Christian Loehle,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit 342d3a73c5dbc2f1cd0c5142e2d11bda4dc54cd7 ]
The policy->cur value preserved across a system suspend-resume cycle
may become stale in some cases and it may prevent the CPU performance
scaling logic from being updated due to the target_freq == policy->cur
check in __cpufreq_driver_target() [1].
To address this, adjust the existing mechanism to force the invocation
of the driver .target() callback in __cpufreq_driver_target() and make
cpufreq_resume_policy() use it.
This involves renaming update_limits in struct cpufreq_policy to
force_target and moving the driver CPUFREQ_NEED_UPDATE_LIMITS flag check
from __cpufreq_driver_target() to cpufreq_set_policy(), where it is used
as a condition for setting policy->force_target.
In cpufreq_resume_policy(), policy->force_target is set for drivers that
implement the .target() callback, but don't implement the .get() one,
which is the case when the driver callback needs to run if policy->cur
becomes stale while suspended.
Fixes: 2f0aea936360 ("cpufreq: suspend governors on system suspend/hibernate")
Link: https://lore.kernel.org/linux-pm/20261027143725.3763827-1-zakbrightonknight@gmail.com/ [1]
Reported-by: Zak Brighton Knight <zakbrightonknight@gmail.com>
Reported-by: Doug Smythies <dsmythies@telus.net>
Cc: All applicable <stable@vger.kernel.org> # eee2a44e4e2b cpufreq: Improve suspend-resume synchronization
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Zak Brighton Knight <zakbrightonknight@gmail.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Doug Smythies <dsmythies@telus.net>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/1995295.tdWV9SEqCh@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 33 +++++++++++++++++++++------------
include/linux/cpufreq.h | 4 ++--
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 94f611512cfc8..cd2eb696548b7 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2029,6 +2029,15 @@ static void cpufreq_resume_policy(struct cpufreq_policy *policy, bool start)
if (!start)
return;
+ /*
+ * Force executing the driver .target() callback, if present, in the
+ * next invocation of __cpufreq_driver_target() in case policy->cur has
+ * become stale while suspended, but do it only for drivers without a
+ * .get() callback for which cpufreq_verify_current_freq() is a NOP.
+ */
+ if (cpufreq_driver->target && !cpufreq_driver->get)
+ policy->force_target = true;
+
if (cpufreq_start_governor(policy))
pr_err("%s: Failed to start governor for CPU%u's policy\n",
__func__, policy->cpu);
@@ -2402,17 +2411,14 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
policy->cpu, target_freq, relation, old_target_freq);
/*
- * This might look like a redundant call as we are checking it again
- * after finding index. But it is left intentionally for cases where
- * exactly same freq is called again and so we can save on few function
- * calls.
+ * Unless invoking the target callback is forced, skip the update if the
+ * frequency is not really changing.
*/
- if (target_freq == policy->cur) {
- if (!(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS) ||
- !policy->update_limits)
- return 0;
-
- policy->update_limits = false;
+ if (policy->force_target) {
+ /* Avoid forcing the driver callback unnecessarily next time. */
+ policy->force_target = false;
+ } else if (target_freq == policy->cur) {
+ return 0;
}
if (cpufreq_driver->target) {
@@ -2671,6 +2677,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
struct cpufreq_governor *new_gov,
unsigned int new_pol)
{
+ bool need_update_limits = cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS;
struct cpufreq_policy_data new_data;
struct cpufreq_governor *old_gov;
unsigned int freq;
@@ -2710,7 +2717,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
CPUFREQ_RELATION_H);
if (freq != policy->max) {
WRITE_ONCE(policy->max, freq);
- policy->update_limits = true;
+ if (need_update_limits)
+ policy->force_target = true;
}
freq = __resolve_freq(policy, new_data.min, new_data.min, new_data.max,
@@ -2718,7 +2726,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
freq = min(freq, policy->max);
if (freq != policy->min) {
WRITE_ONCE(policy->min, freq);
- policy->update_limits = true;
+ if (need_update_limits)
+ policy->force_target = true;
}
trace_cpu_frequency_limits(policy);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index fa5d92d408a8c..2b896d30c35d8 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -145,8 +145,8 @@ struct cpufreq_policy {
/* Per policy boost supported flag. */
bool boost_supported;
- /* Pending policy->min/max update for the driver */
- bool update_limits;
+ /* Force passing target frequency to the driver. */
+ bool force_target;
/* The policy has been suspended. */
bool suspended;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 049/703] pNFS: avoid repeatedly cancelling I/O for the same lseg
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (47 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 048/703] cpufreq: Force passing target frequency to driver during resume Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 050/703] watchdog: rz: Discard pm_runtime_put() return values Greg Kroah-Hartman
` (358 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tim Menninger, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Menninger <tmenninger@everpuredata.com>
[ Upstream commit 9e28836b480c66cca4c3d391177f5b3a50927f7d ]
Commit b739a5bd9d9f ("NFSv4/flexfiles: Cancel I/O if the layout is
recalled or revoked") added I/O cancellation when a layout segment is
invalidated while outstanding references remain.
The invalid segment stays on the layout's segment list until those
references drain. Subsequent scans can find it again and repeatedly
invoke the layout driver's cancel_io() callback. For flexfiles, this
cancels matching RPC tasks and disconnects data server RPC clients.
During RPC/RDMA data server recovery, repeated cancellation can cause a
reconnect loop that consumes essentially all client CPU and prevents
forward progress.
Record cancellation requests per mirror stripe in the flexfiles layout
segment. Each stripe is cancelled at most once, regardless of how many
times the invalid segment is encountered. A per-stripe bitmap rather
than a single per-segment bit preserves the ability to cancel I/O to a
different device after an earlier device-specific cancellation.
Cancellation is best-effort. An RPC that has already passed the
layout-validity check may not yet be visible to the cancellation
scan. Such I/O retains its lseg reference and remains subject to
the normal RPC completion and recovery paths. Suppress repeated
cancellation and disconnect requests without changing the existing
lseg lifetime and deferred layout-return accounting.
This reproduced on 6.8.0, 7.0.0, and 7.4.0-rc1. It was tested on
7.4.0-rc1 with sustained pNFS/flexfiles I/O over RPC/RDMA while
restarting the NFS service on a data server. Without it, repeated
cancellation led to a reconnect loop and no workload recovery. With it,
the client recovered after the data server returned.
Fixes: b739a5bd9d9f ("NFSv4/flexfiles: Cancel I/O if the layout is recalled or revoked")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
[ sashal: Adapted the ff_layout_cancel_io() hunk to this tree's older one-argument version with no devid filter or RCU, placing the cancelled_stripes guard after the mirror_ds check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/flexfilelayout/flexfilelayout.c | 12 ++++++++++++
fs/nfs/flexfilelayout/flexfilelayout.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index f45508bd30f6e..48c769f05b8a2 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -11,6 +11,7 @@
#include <linux/nfs_mount.h>
#include <linux/nfs_page.h>
#include <linux/module.h>
+#include <linux/bitmap.h>
#include <linux/file.h>
#include <linux/sched/mm.h>
@@ -337,6 +338,7 @@ static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls)
{
if (fls) {
ff_layout_free_mirror_array(fls);
+ bitmap_free(fls->cancelled_stripes);
kfree(fls);
}
}
@@ -652,6 +654,12 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
fls->mirror_array[i]->report_interval = be32_to_cpup(p);
out_sort_mirrors:
+ fls->cancelled_stripes = bitmap_zalloc(
+ fls->mirror_array_cnt * dss_count, gfp_flags);
+ if (!fls->cancelled_stripes) {
+ rc = -ENOMEM;
+ goto out_err_free;
+ }
ff_layout_sort_mirrors(fls);
ret = &fls->generic_hdr;
dprintk("<-- %s (success)\n", __func__);
@@ -2548,6 +2556,10 @@ static void ff_layout_cancel_io(struct pnfs_layout_segment *lseg)
mirror_ds = mirror->dss[dss_id].mirror_ds;
if (IS_ERR_OR_NULL(mirror_ds))
continue;
+ /* Do not cancel a stripe again while this lseg drains. */
+ if (test_and_set_bit(idx * mirror->dss_count + dss_id,
+ flseg->cancelled_stripes))
+ continue;
ds = mirror->dss[dss_id].mirror_ds->ds;
if (!ds)
continue;
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
index ec69cd1c3ae96..311df9306b055 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.h
+++ b/fs/nfs/flexfilelayout/flexfilelayout.h
@@ -109,6 +109,7 @@ struct nfs4_ff_layout_segment {
u64 stripe_unit;
u32 flags;
u32 mirror_array_cnt;
+ unsigned long *cancelled_stripes;
struct nfs4_ff_layout_mirror *mirror_array[] __counted_by(mirror_array_cnt);
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 050/703] watchdog: rz: Discard pm_runtime_put() return values
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (48 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 049/703] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 051/703] watchdog: rzv2h: Use pm_runtime_put_sync() Greg Kroah-Hartman
` (357 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Guenter Roeck,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit f52defa7b830abbba6b26df503ca42c0b2f20abe ]
Failing a watchdog stop due to pm_runtime_put() returning a negative
value is not particularly useful.
Returning an error code from pm_runtime_put() merely means that it has
not queued up a work item to check whether or not the device can be
suspended and there are many perfectly valid situations in which that
can happen, like after writing "on" to the devices' runtime PM "control"
attribute in sysfs for one example. It also happens when the kernel is
configured with CONFIG_PM unset.
Accordingly, update rzg2l_wdt_stop() and rzv2h_wdt_stop() to simply
discard the return value of pm_runtime_put().
This will facilitate a planned change of the pm_runtime_put() return
type to void in the future.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/3340071.5fSG56mABF@rafael.j.wysocki
Stable-dep-of: ca800e625d18 ("watchdog: rzv2h: Use pm_runtime_put_sync()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/rzg2l_wdt.c | 4 +---
drivers/watchdog/rzv2h_wdt.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
index 1c9aa366d0a0e..509f9dffdacde 100644
--- a/drivers/watchdog/rzg2l_wdt.c
+++ b/drivers/watchdog/rzg2l_wdt.c
@@ -132,9 +132,7 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
if (ret)
return ret;
- ret = pm_runtime_put(wdev->parent);
- if (ret < 0)
- return ret;
+ pm_runtime_put(wdev->parent);
return 0;
}
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index a1698dc50acd6..83540dd9a37b6 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -174,9 +174,7 @@ static int rzv2h_wdt_stop(struct watchdog_device *wdev)
if (priv->of_data->wdtdcr)
rzt2h_wdt_wdtdcr_count_stop(priv);
- ret = pm_runtime_put(wdev->parent);
- if (ret < 0)
- return ret;
+ pm_runtime_put(wdev->parent);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 051/703] watchdog: rzv2h: Use pm_runtime_put_sync()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (49 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 050/703] watchdog: rz: Discard pm_runtime_put() return values Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 052/703] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Greg Kroah-Hartman
` (356 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lad Prabhakar, Guenter Roeck,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit ca800e625d18a9f5b19f94ab837ceb3fccdca22f ]
pm_runtime_put() may trigger the idle check after pm_runtime_disable()
is run as part of devm_pm_runtime_enable()'s cleanup action, leaving
runtime PM active.
Use pm_runtime_put_sync() to ensure the idle check runs synchronously.
Fixes: f6febd0a30b6e ("watchdog: Add Watchdog Timer driver for RZ/V2H(P)")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20261001165201.763882-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/rzv2h_wdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index 83540dd9a37b6..057b890de0b05 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -174,7 +174,7 @@ static int rzv2h_wdt_stop(struct watchdog_device *wdev)
if (priv->of_data->wdtdcr)
rzt2h_wdt_wdtdcr_count_stop(priv);
- pm_runtime_put(wdev->parent);
+ pm_runtime_put_sync(wdev->parent);
return 0;
}
@@ -268,7 +268,7 @@ static int rzt2h_wdt_wdtdcr_init(struct platform_device *pdev,
rzt2h_wdt_wdtdcr_count_stop(priv);
- pm_runtime_put(&pdev->dev);
+ pm_runtime_put_sync(&pdev->dev);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 052/703] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (50 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 051/703] watchdog: rzv2h: Use pm_runtime_put_sync() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 053/703] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
` (355 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lad Prabhakar, Guenter Roeck,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[ Upstream commit f00afd5d8d5dc03994cb67246543d5c70571ebbe ]
WDTDCR is located in the CPG region, outside the watchdog module, and is
accessible regardless of the watchdog's clocks and reset state.
Drop the unnecessary runtime PM handling from WDTDCR initialization and
access the register directly.
Fixes: f6febd0a30b6e ("watchdog: Add Watchdog Timer driver for RZ/V2H(P)")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20261001165201.763882-5-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/watchdog/rzv2h_wdt.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index 057b890de0b05..537c62c18a935 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -256,20 +256,12 @@ static const struct watchdog_ops rzv2h_wdt_ops = {
static int rzt2h_wdt_wdtdcr_init(struct platform_device *pdev,
struct rzv2h_wdt_priv *priv)
{
- int ret;
-
priv->wdtdcr = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(priv->wdtdcr))
return PTR_ERR(priv->wdtdcr);
- ret = pm_runtime_resume_and_get(&pdev->dev);
- if (ret)
- return ret;
-
rzt2h_wdt_wdtdcr_count_stop(priv);
- pm_runtime_put_sync(&pdev->dev);
-
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 053/703] hwmon: (nct6775) Handle dual use registers
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (51 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 052/703] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 054/703] s390/dasd: Fix typo immediatly -> immediately Greg Kroah-Hartman
` (354 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anton Lundin, Guenter Roeck,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Lundin <glance@ac2.se>
[ Upstream commit ca1abdd1a9b9ce51713a18c8905bf10579533c3b ]
The REG_TARGET register has different meaning, depending on if pwm is in
thermal_cruise or speed_cruise.
This means we can't assume it's always word sized, so we need to handle
it differently depending on which mode we're in.
The code already does this, but the register was configured as word
sized for the speed_cruise mode, which would do the wrong thing in
thermal_cruise mode.
Fixes: 6c009501ff20 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
Fixes: 437b3c2a4bdc ("hwmon: (nct6775) Add support for NCT6126D")
Cc: stable@vger.kernel.org
Signed-off-by: Anton Lundin <glance@ac2.se>
Link: https://patch.msgid.link/20261109082511.851377-2-glance@ac2.se
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/nct6775-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index ce2cf1f229004..ed17b00433109 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1152,14 +1152,12 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg)
case nct6106:
return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
(reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
- reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
- reg == 0x111 || reg == 0x121 || reg == 0x131;
+ reg == 0xe0 || reg == 0xe2 || reg == 0xe4;
case nct6116:
return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
reg == 0x26 || reg == 0x28 || reg == 0x59 || reg == 0x5b ||
reg == 0xe0 || reg == 0xe2 || reg == 0xe4 || reg == 0xe6 ||
- reg == 0xe8 || reg == 0x111 || reg == 0x121 || reg == 0x131 ||
- reg == 0x191 || reg == 0x1a1;
+ reg == 0xe8;
case nct6775:
return (((reg & 0xff00) == 0x100 ||
(reg & 0xff00) == 0x200) &&
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 054/703] s390/dasd: Fix typo immediatly -> immediately
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (52 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 053/703] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 055/703] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
` (353 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jan Höppner,
Stefan Haberland, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
[ Upstream commit ae6f19236b5ae4eef4df2780d51bee19add0eba8 ]
Fix typo in function name dasd_sleep_on_immediatly().
Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://patch.msgid.link/20261112102608.1057852-2-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 25cdc1f63227 ("s390/dasd: Re-initialize RCD buffer with "V1.0" before every start")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/block/dasd.c | 4 ++--
drivers/s390/block/dasd_alias.c | 2 +-
drivers/s390/block/dasd_eckd.c | 14 +++++++-------
drivers/s390/block/dasd_int.h | 2 +-
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index f6e86692a21d7..f887b3657edd2 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2573,7 +2573,7 @@ static inline int _dasd_term_running_cqr(struct dasd_device *device)
return rc;
}
-int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
+int dasd_sleep_on_immediately(struct dasd_ccw_req *cqr)
{
struct dasd_device *device;
int rc;
@@ -2621,7 +2621,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
return rc;
}
-EXPORT_SYMBOL(dasd_sleep_on_immediatly);
+EXPORT_SYMBOL(dasd_sleep_on_immediately);
/*
* Cancels a request that was started with dasd_sleep_on_req.
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index f7e768d8ca766..2afac13cb79c2 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -751,7 +751,7 @@ static int reset_summary_unit_check(struct alias_lcu *lcu,
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
return rc;
}
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 545446b3818f6..499b09162a0ae 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -887,7 +887,7 @@ static int dasd_eckd_read_conf_immediately(struct dasd_device *device,
set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags);
cqr->retries = 5;
cqr->callback = read_conf_cb;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
return rc;
}
@@ -5101,7 +5101,7 @@ dasd_eckd_release(struct dasd_device *device)
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (!rc)
clear_bit(DASD_FLAG_IS_RESERVED, &device->flags);
@@ -5156,7 +5156,7 @@ dasd_eckd_reserve(struct dasd_device *device)
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (!rc)
set_bit(DASD_FLAG_IS_RESERVED, &device->flags);
@@ -5210,7 +5210,7 @@ dasd_eckd_steal_lock(struct dasd_device *device)
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (!rc)
set_bit(DASD_FLAG_IS_RESERVED, &device->flags);
@@ -5273,7 +5273,7 @@ static int dasd_eckd_snid(struct dasd_device *device,
cqr->status = DASD_CQR_FILLED;
cqr->lpm = usrparm.path_mask;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
/* verify that I/O processing didn't modify the path mask */
if (!rc && usrparm.path_mask && (cqr->lpm != usrparm.path_mask))
rc = -EIO;
@@ -5915,7 +5915,7 @@ static int dasd_eckd_read_message_buffer(struct dasd_device *device,
cqr->block = NULL;
cqr->expires = 10 * HZ;
set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags);
- /* dasd_sleep_on_immediatly does not do complex error
+ /* dasd_sleep_on_immediately does not do complex error
* recovery so clear erp flag and set retry counter to
* do basic erp */
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
@@ -5947,7 +5947,7 @@ static int dasd_eckd_read_message_buffer(struct dasd_device *device,
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
- rc = dasd_sleep_on_immediatly(cqr);
+ rc = dasd_sleep_on_immediately(cqr);
if (rc == 0) {
prssdp = (struct dasd_psf_prssd_data *) cqr->data;
message_buf = (struct dasd_rssd_messages *)
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 81cfb5c89681b..99c2534216537 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -857,7 +857,7 @@ void dasd_schedule_device_bh(struct dasd_device *);
void dasd_schedule_block_bh(struct dasd_block *);
int dasd_sleep_on(struct dasd_ccw_req *);
int dasd_sleep_on_queue(struct list_head *);
-int dasd_sleep_on_immediatly(struct dasd_ccw_req *);
+int dasd_sleep_on_immediately(struct dasd_ccw_req *);
int dasd_sleep_on_queue_interruptible(struct list_head *);
int dasd_sleep_on_interruptible(struct dasd_ccw_req *);
void dasd_device_set_timer(struct dasd_device *, int);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 055/703] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (53 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 054/703] s390/dasd: Fix typo immediatly -> immediately Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 056/703] sched/core: Do not touch SMT siblings that have not joined the core yet Greg Kroah-Hartman
` (352 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jan Höppner, Stefan Haberland,
Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
[ Upstream commit 25cdc1f63227a1ea69a1ec823a8a860e33299169 ]
Under z/VM the Read Configuration Data (RCD) buffer has to start with
EBCDIC "V1.0" to request the virtual device SNEQ that carries the
minidisk UIT. The request and the response share the same buffer:
CP evaluates the magic on the way out and the RCD data is written into
the same buffer on the way back.
The magic is only written when the request is built and again in
read_conf_cb() when the original request fails.
Several restart paths do not run that callback:
- ERP use the same buffer and if the same error occurs again,
the ERP restarts the existing ERP request;
if a different error occurs, it adds another ERP request.
Neither re-initializes the magic.
- Terminated (timed out) ERP requests, killed requests and requests
requeued after the last path was gone are restarted without it.
- dasd_sleep_on_immediately() overwrites cqr->callback, so read_conf_cb()
never ran for dasd_eckd_read_conf_immediately(), and its fastpath
retries in dasd_int_handler() do not call a callback either.
If such a restart succeeds, z/VM omits the virtual device SNEQ, the UID
of that path is built without the UIT and the paths are reported as
"Not all channel paths lead to the same device" although they lead to
the same minidisk.
Every start of a request, whatever path led to it, goes through
dasd_start_IO(). Add an optional prepare_io function to the request
that dasd_start_IO() calls before every start of the request and of
its ERP requests, and use it to write the magic for RCD requests.
The ERP handling stays unchanged. read_conf_cb() is no longer needed
and is removed, which also gets rid of its memset() that only cleared
a single byte.
Fixes: 5915a873fcb1 ("[S390] dasd: re-initialize read_conf buffer for retries")
Cc: stable@vger.kernel.org
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://patch.msgid.link/20261112102608.1057852-3-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Context-only conflict in the DASD header: the new helper was added without the neighbouring collision-detection helpers, which this tree lacks. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/block/dasd.c | 1 +
drivers/s390/block/dasd_eckd.c | 52 ++++++++++++----------------------
drivers/s390/block/dasd_int.h | 15 ++++++++++
3 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index f887b3657edd2..de1543bfdb544 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1402,6 +1402,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
cqr->status = DASD_CQR_ERROR;
return -EIO;
}
+ dasd_start_IO_prepare(cqr);
cqr->startclk = get_tod_clock();
cqr->starttime = jiffies;
cqr->retries--;
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 499b09162a0ae..d60d787e17bf2 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -810,20 +810,29 @@ static int dasd_eckd_compare_path_uid(struct dasd_device *device,
return memcmp(&device_uid, &path_uid, sizeof(struct dasd_uid));
}
+/*
+ * The RCD buffer has to start with EBCDIC "V1.0" to show support for
+ * virtual device SNEQ. The RCD data is written into the same buffer, so
+ * a failed attempt may already have overwritten the magic. Re-initialize
+ * it before every start, including restarts by ERP requests.
+ */
+static void dasd_eckd_rcd_prepare_io(struct dasd_ccw_req *cqr)
+{
+ struct ccw1 *ccw = cqr->cpaddr;
+ __u8 *rcd_buffer = dma32_to_virt(ccw->cda);
+
+ rcd_buffer[0] = 0xE5;
+ rcd_buffer[1] = 0xF1;
+ rcd_buffer[2] = 0x4B;
+ rcd_buffer[3] = 0xF0;
+}
+
static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device,
struct dasd_ccw_req *cqr,
__u8 *rcd_buffer,
__u8 lpm)
{
struct ccw1 *ccw;
- /*
- * buffer has to start with EBCDIC "V1.0" to show
- * support for virtual device SNEQ
- */
- rcd_buffer[0] = 0xE5;
- rcd_buffer[1] = 0xF1;
- rcd_buffer[2] = 0x4B;
- rcd_buffer[3] = 0xF0;
ccw = cqr->cpaddr;
ccw->cmd_code = DASD_ECKD_CCW_RCD;
@@ -840,33 +849,10 @@ static void dasd_eckd_fill_rcd_cqr(struct dasd_device *device,
cqr->retries = 256;
cqr->buildclk = get_tod_clock();
cqr->status = DASD_CQR_FILLED;
+ cqr->prepare_io = dasd_eckd_rcd_prepare_io;
set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags);
}
-/*
- * Wakeup helper for read_conf
- * if the cqr is not done and needs some error recovery
- * the buffer has to be re-initialized with the EBCDIC "V1.0"
- * to show support for virtual device SNEQ
- */
-static void read_conf_cb(struct dasd_ccw_req *cqr, void *data)
-{
- struct ccw1 *ccw;
- __u8 *rcd_buffer;
-
- if (cqr->status != DASD_CQR_DONE) {
- ccw = cqr->cpaddr;
- rcd_buffer = dma32_to_virt(ccw->cda);
- memset(rcd_buffer, 0, sizeof(*rcd_buffer));
-
- rcd_buffer[0] = 0xE5;
- rcd_buffer[1] = 0xF1;
- rcd_buffer[2] = 0x4B;
- rcd_buffer[3] = 0xF0;
- }
- dasd_wakeup_cb(cqr, data);
-}
-
static int dasd_eckd_read_conf_immediately(struct dasd_device *device,
struct dasd_ccw_req *cqr,
__u8 *rcd_buffer,
@@ -886,7 +872,6 @@ static int dasd_eckd_read_conf_immediately(struct dasd_device *device,
clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags);
cqr->retries = 5;
- cqr->callback = read_conf_cb;
rc = dasd_sleep_on_immediately(cqr);
return rc;
}
@@ -924,7 +909,6 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
goto out_error;
}
dasd_eckd_fill_rcd_cqr(device, cqr, rcd_buf, lpm);
- cqr->callback = read_conf_cb;
ret = dasd_sleep_on(cqr);
/*
* on success we update the user input parms
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 99c2534216537..beba87a30e75b 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -147,6 +147,8 @@ struct dasd_ccw_req {
void *data; /* pointer to data area */
struct irb irb; /* device status in case of an error */
struct dasd_ccw_req *refers; /* ERP-chain queueing. */
+ /* optional prepare function called before every start_io, must not sleep */
+ void (*prepare_io)(struct dasd_ccw_req *cqr);
void *function; /* originating ERP action */
void *mem_chunk;
@@ -815,6 +817,19 @@ static inline void *dasd_get_callback_data(struct dasd_ccw_req *cqr)
return cqr->callback_data;
}
+/*
+ * Walk down the ERP chain to the original CQR and call its
+ * prepare_io function if set.
+ */
+static inline void dasd_start_IO_prepare(struct dasd_ccw_req *cqr)
+{
+ /* ERP requests use the prepare function of the original request */
+ while (cqr->refers)
+ cqr = cqr->refers;
+ if (cqr->prepare_io)
+ cqr->prepare_io(cqr);
+}
+
/* externals in dasd.c */
#define DASD_PROFILE_OFF 0
#define DASD_PROFILE_ON 1
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 056/703] sched/core: Do not touch SMT siblings that have not joined the core yet
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (54 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 055/703] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 057/703] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
` (351 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+681e729b2cf0d4860042,
Seiji Nishikawa, Peter Zijlstra (Intel), Ingo Molnar, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Nishikawa <snishika@redhat.com>
[ Upstream commit ec6f6731538e0d45872eb279fdeb477bed152d6f ]
When a CPU comes online, it is added to cpu_smt_mask() of its siblings
before sched_core_cpu_starting() sets its rq->core to the core leader.
For example, on x86, ap_starting() calls set_cpu_sibling_map() first,
and calls notify_cpu_starting() after that. This order is intended.
Before sched_core_cpu_starting() runs, rq->core of the new CPU still
points to its own rq. But rq->core_enabled of the new CPU is already
set. __sched_core_flip() sets it for all possible CPUs, also for
offline CPUs, and CPU offline does not clear it. So __rq_lockp() of the
new CPU returns its own rq->__lock. It does not return the core wide
lock.
If a sibling CPU runs pick_next_task() for SCHED_CORE at this time, it
checks all CPUs in cpu_smt_mask(). It calls update_rq_clock() and
pick_task() for the rq of the new CPU. But it holds only its own core
lock, not the lock of the new CPU. Then lockdep shows this warning in
update_rq_clock().
debug_locks && !(lock_is_held(&(__rq_lockp(rq))->dep_map) != 0)
WARNING: kernel/sched/sched.h:1666 at update_rq_clock+0x40a/0xd20 kernel/sched/core.c:875, CPU#0: syz-executor251/5712
Call Trace:
<TASK>
pick_next_task kernel/sched/core.c:6375 [inline]
__schedule+0x1c69/0x6920 kernel/sched/core.c:7199
preempt_schedule_irq+0x4e/0x90 kernel/sched/core.c:7606
The next loops in pick_next_task() also change rq_i->core_pick of this
rq, and can call resched_curr() for it, without its lock.
resched_curr() has the same lockdep_assert_rq_held() check.
__sched_core_account_forceidle() also checks all CPUs in the same mask.
CPU offline does not have this problem. remove_siblinginfo() and
sched_core_cpu_dying() both run in take_cpu_down() under stop_machine.
So no sibling CPU can be in pick_next_task() at that time.
Fix this. In these loops, skip a sibling CPU if its rq->core is
different from our rq->core. At run time, rq->core of a CPU is changed
by sched_core_cpu_starting(), sched_core_cpu_deactivate() and
sched_core_cpu_dying(). The first two hold sched_core_lock(), and
sched_core_lock() takes the rq locks of all CPUs in the SMT mask. The
last one runs under stop_machine, as written above. So while we hold
our core lock, the result of this check does not change. A CPU that is
not in the core yet will pick its own tasks. The comment in the
reschedule loop of pick_next_task() already expects this case.
I tested this with the syzbot C reproducer in QEMU. The two vCPUs were
SMT siblings (-smp 2,sockets=1,cores=1,threads=2). Without this patch,
the warning came after about 100 seconds. Just before the warning, a
debug print showed that the loop on CPU 0 saw CPU 1 with rq->core
pointing to CPU 1 itself, and cpu_online() was false for CPU 1. With
this patch, the same state still happened, but there was no warning
in more than 2 hours.
Fixes: 3c474b3239f1 ("sched: Fix Core-wide rq->lock for uninitialized CPUs")
Closes: https://syzkaller.appspot.com/bug?extid=681e729b2cf0d4860042
Reported-by: syzbot+681e729b2cf0d4860042@syzkaller.appspotmail.com
Signed-off-by: Seiji Nishikawa <snishika@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261104022004.3810619-1-snishika@redhat.com
[ sashal: Dropped the local smt_mask and converted the loops to the new iterators, keeping this tree's existing max initialization and need_sync assignment because it lacks the restart label and annotation. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/core.c | 8 +++-----
kernel/sched/core_sched.c | 3 +--
kernel/sched/sched.h | 19 +++++++++++++++++++
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3b51a93ba609c..d11274908ffc2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6044,7 +6044,6 @@ static struct task_struct *
pick_next_task(struct rq *rq, struct rq_flags *rf)
{
struct task_struct *next, *p, *max = NULL;
- const struct cpumask *smt_mask;
bool fi_before = false;
bool core_clock_updated = (rq == rq->core);
unsigned long cookie;
@@ -6094,7 +6093,6 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
prev_balance(rq, rf);
- smt_mask = cpu_smt_mask(cpu);
need_sync = !!rq->core->core_cookie;
/* reset state */
@@ -6150,7 +6148,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
*
* Tie-break prio towards the current CPU
*/
- for_each_cpu_wrap(i, smt_mask, cpu) {
+ for_each_core_cpu_wrap(i, rq) {
rq_i = cpu_rq(i);
/*
@@ -6174,7 +6172,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
* For each thread: try and find a runnable task that matches @max or
* force idle.
*/
- for_each_cpu(i, smt_mask) {
+ for_each_core_cpu(i, rq) {
rq_i = cpu_rq(i);
p = rq_i->core_pick;
@@ -6220,7 +6218,7 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
* their task. This ensures there is no inter-sibling overlap between
* non-matching user state.
*/
- for_each_cpu(i, smt_mask) {
+ for_each_core_cpu(i, rq) {
rq_i = cpu_rq(i);
/*
diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
index 9ede71ecba7f8..fb64cf180d1f6 100644
--- a/kernel/sched/core_sched.c
+++ b/kernel/sched/core_sched.c
@@ -241,7 +241,6 @@ int sched_core_share_pid(unsigned int cmd, pid_t pid, enum pid_type type,
/* REQUIRES: rq->core's clock recently updated. */
void __sched_core_account_forceidle(struct rq *rq)
{
- const struct cpumask *smt_mask = cpu_smt_mask(cpu_of(rq));
u64 delta, now = rq_clock(rq->core);
struct rq *rq_i;
struct task_struct *p;
@@ -273,7 +272,7 @@ void __sched_core_account_forceidle(struct rq *rq)
delta = div_u64(delta, rq->core->core_forceidle_occupation);
}
- for_each_cpu(i, smt_mask) {
+ for_each_core_cpu(i, rq) {
rq_i = cpu_rq(i);
p = rq_i->core_pick ?: rq_i->curr;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index ad7b72317f0f2..ea470cc608d51 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1430,6 +1430,25 @@ static inline raw_spinlock_t *__rq_lockp(struct rq *rq)
return &rq->__lock;
}
+/*
+ * A CPU coming online is set in cpu_smt_mask() before
+ * sched_core_cpu_starting() links its rq->core to the core leader.
+ * Until then it does not share the core-wide lock, so it must not be
+ * touched as part of the core.
+ */
+static inline bool sched_core_sibling(struct rq *rq, struct rq *rq_i)
+{
+ return rq_i->core == rq->core;
+}
+
+#define for_each_core_cpu(i, rq) \
+ for_each_cpu(i, cpu_smt_mask(rq->cpu)) \
+ if (sched_core_sibling(rq, cpu_rq(i)))
+
+#define for_each_core_cpu_wrap(i, rq) \
+ for_each_cpu_wrap(i, cpu_smt_mask(rq->cpu), rq->cpu) \
+ if (sched_core_sibling(rq, cpu_rq(i)))
+
extern bool
cfs_prio_less(const struct task_struct *a, const struct task_struct *b, bool fi);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 057/703] ksmbd: skip metadata-only opens in sharing checks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (55 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 056/703] sched/core: Do not touch SMT siblings that have not joined the core yet Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 058/703] wifi: mac80211_hwsim: ignore non-generic netlink releases Greg Kroah-Hartman
` (350 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ian Bridges, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Bridges <icb@fastmail.org>
[ Upstream commit 81fefb6c635489e71e286d1465b6dd1d0a27ceec ]
A READ_CONTROL open without sharing can block later reads, writes and
deletes even though it holds no data, execute or delete access.
Keep the existing attribute-only exception. For other pairs, require
both effective access masks to hold one of those rights. MS-FSA
2.1.5.1.2 grants FILE_WRITE_DATA when an open overwrites a file or
stream, or creates a named stream on an existing file. Use that granted
access for sharing checks while keeping the requested access on the
returned handle.
The Time Machine AFP_AfpInfo synthesis keeps its requested access.
ksmbd implements FILE_SUPERSEDE by truncating the file, so count it as
a write.
This also prevents an overwrite from truncating a file while another
open that holds data, execute or delete access does not share writing.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Context-only adjustments: dropped const on idmap and omitted the app_instance_* and posix_append lines, which this tree lacks. The new stream_created declaration and defines were placed beside the nearest existing lines. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 30 ++++++++++++++++++++++--------
fs/smb/server/smb_common.c | 34 +++++++++++++++++++++++++++++++++-
fs/smb/server/smb_common.h | 5 +++++
fs/smb/server/vfs_cache.h | 2 ++
4 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index c46b537bdab8a..2fd2d52eca00c 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2541,7 +2541,8 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
static noinline int smb2_set_stream_name_xattr(const struct path *path,
struct ksmbd_file *fp,
- char *stream_name, int s_type)
+ char *stream_name, int s_type,
+ bool *created)
{
struct mnt_idmap *idmap = mnt_idmap(path->mnt);
size_t xattr_stream_size;
@@ -2579,6 +2580,8 @@ static noinline int smb2_set_stream_name_xattr(const struct path *path,
rc = ksmbd_vfs_setxattr(idmap, path, xattr_stream_name, NULL, 0, 0, false);
if (rc < 0)
pr_err("Failed to store XATTR stream name :%d\n", rc);
+ else
+ *created = true;
return 0;
}
@@ -3004,6 +3007,7 @@ int smb2_open(struct ksmbd_work *work)
char *name = NULL;
char *stream_name = NULL;
bool file_present = false, created = false, already_permitted = false;
+ bool stream_created = false;
int share_ret, need_truncate = 0;
u64 time, alloc_size = 0;
umode_t posix_mode = 0;
@@ -3609,7 +3613,8 @@ int smb2_open(struct ksmbd_work *work)
rc = smb2_set_stream_name_xattr(&path,
fp,
stream_name,
- s_type);
+ s_type,
+ &stream_created);
if (rc)
goto err_out;
file_info = FILE_CREATED;
@@ -3617,12 +3622,24 @@ int smb2_open(struct ksmbd_work *work)
fp->attrib_only = !(req->DesiredAccess & ~(FILE_READ_ATTRIBUTES_LE |
FILE_WRITE_ATTRIBUTES_LE | FILE_SYNCHRONIZE_LE));
+ need_truncate = !S_ISDIR(file_inode(filp)->i_mode) &&
+ open_flags & O_TRUNC && !fp->attrib_only && !stream_name;
+ /*
+ * Count the FILE_WRITE_DATA that MS-FSA 2.1.5.1.2 grants an overwrite,
+ * supersede included, or a new named stream on an existing file.
+ * An attribute-only open of the file is not truncated, and the
+ * synthesized AFP_AfpInfo stream is not created by the client.
+ */
+ fp->implied_write = need_truncate ||
+ (stream_name &&
+ (open_flags & O_TRUNC ||
+ (file_present && stream_created)));
fp->is_posix_ctxt = posix_ctxt;
/* fp should be searchable through ksmbd_inode.m_fp_list
- * after daccess, saccess, attrib_only, and stream are
- * initialized.
+ * after daccess, saccess, attrib_only, implied_write, and
+ * stream are initialized.
*/
down_write(&fp->f_ci->m_lock);
list_add(&fp->node, &fp->f_ci->m_fp_list);
@@ -3637,11 +3654,8 @@ int smb2_open(struct ksmbd_work *work)
if (file_present || created)
path_put(&path);
- if (!S_ISDIR(file_inode(filp)->i_mode) && open_flags & O_TRUNC &&
- !fp->attrib_only && !stream_name) {
+ if (need_truncate)
smb_break_all_oplock(work, fp);
- need_truncate = 1;
- }
share_ret = ksmbd_smb_check_shared_mode(fp->filp, fp);
if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) ||
diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c
index 3a4b7b380a6bc..7ff75a069cd59 100644
--- a/fs/smb/server/smb_common.c
+++ b/fs/smb/server/smb_common.c
@@ -664,10 +664,24 @@ static void smb_shared_mode_error(int error, struct ksmbd_file *prev_fp,
prev_fp->saccess, curr_fp->daccess);
}
+/*
+ * Sharing checks use fp->daccess plus the FILE_WRITE_DATA that MS-FSA
+ * grants an open that overwrites data or creates a named stream.
+ * fp->daccess keeps the open's own access.
+ */
+__le32 ksmbd_sharing_daccess(const struct ksmbd_file *fp)
+{
+ if (fp->implied_write)
+ return fp->daccess | FILE_WRITE_DATA_LE;
+ return fp->daccess;
+}
+
int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
{
int rc = 0;
struct ksmbd_file *prev_fp;
+ __le32 curr_access = ksmbd_sharing_daccess(curr_fp);
+ __le32 access;
/*
* Lookup fp in master fp list, and check desired access and
@@ -688,6 +702,24 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
if (prev_fp->attrib_only != curr_fp->attrib_only)
continue;
+ /*
+ * MS-FSA checks sharing per stream, so a named stream open's
+ * implied write is not a write against the primary stream.
+ * It still decides whether the pair is checked.
+ */
+ access = curr_access;
+ if (ksmbd_stream_fd(curr_fp) && !ksmbd_stream_fd(prev_fp))
+ access = curr_fp->daccess;
+
+ /*
+ * Two opens conflict only if both hold a right in
+ * FILE_SHARE_CHECKED_ACCESS_LE (MS-FSA 2.1.5.1.2.1 and
+ * 2.1.5.1.2.2)
+ */
+ if (!(ksmbd_sharing_daccess(prev_fp) & FILE_SHARE_CHECKED_ACCESS_LE) ||
+ !(curr_access & FILE_SHARE_CHECKED_ACCESS_LE))
+ continue;
+
if (!(prev_fp->saccess & FILE_SHARE_DELETE_LE) &&
curr_fp->daccess & FILE_DELETE_LE) {
smb_shared_mode_error(SHARE_DELETE_ERROR,
@@ -714,7 +746,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
}
if (!(prev_fp->saccess & FILE_SHARE_WRITE_LE) &&
- curr_fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) {
+ access & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE)) {
smb_shared_mode_error(SHARE_WRITE_ERROR,
prev_fp,
curr_fp);
diff --git a/fs/smb/server/smb_common.h b/fs/smb/server/smb_common.h
index d6f72195482f9..912f1bb70b181 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -82,6 +82,10 @@
FILE_EXECUTE | FILE_DELETE_CHILD | \
FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES)
+/* Rights that make an open take part in sharing checks */
+#define FILE_SHARE_CHECKED_ACCESS_LE (FILE_EXECUTE_LE | FILE_READ_DATA_LE | \
+ FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE | FILE_DELETE_LE)
+
#define SMB1_PROTO_NUMBER cpu_to_le32(0x424d53ff)
#define SMB_COM_NEGOTIATE 0x72
#define SMB1_CLIENT_GUID_SIZE (16)
@@ -221,6 +225,7 @@ int ksmbd_extract_shortname(struct ksmbd_conn *conn,
int ksmbd_smb_negotiate_common(struct ksmbd_work *work, unsigned int command);
+__le32 ksmbd_sharing_daccess(const struct ksmbd_file *fp);
int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp);
int __ksmbd_override_fsids(struct ksmbd_work *work,
struct ksmbd_share_config *share);
diff --git a/fs/smb/server/vfs_cache.h b/fs/smb/server/vfs_cache.h
index 03494f2627cd6..c39deb10d2166 100644
--- a/fs/smb/server/vfs_cache.h
+++ b/fs/smb/server/vfs_cache.h
@@ -107,6 +107,8 @@ struct ksmbd_file {
bool is_nt_open;
bool attrib_only;
+ /* writes data on open, see ksmbd_sharing_daccess() */
+ bool implied_write;
bool allocation_size_set;
char client_guid[16];
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 058/703] wifi: mac80211_hwsim: ignore non-generic netlink releases
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (56 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 057/703] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 059/703] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
` (349 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
[ Upstream commit 989f47c56e48d442d79497a25ed946d029c4dc53 ]
Closing an unrelated netlink socket can remove mac80211_hwsim radios or
clear the active wmediumd registration when its port ID matches a generic
netlink socket.
mac80211_hwsim_netlink_notify() handles every NETLINK_URELEASE event,
but netlink port IDs are scoped by protocol. The notifier therefore treats
a release from another protocol as a MAC80211_HWSIM socket release.
Ignore release notifications unless they come from NETLINK_GENERIC.
LLM assistance was used to find the bug and review.
Fixes: 7882513bacb1 ("mac80211_hwsim driver support userspace frame tx/rx")
Fixes: e9ed49bf4c2c ("mac80211-hwsim: Add support for HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028141751.6728-2-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/virtual/mac80211_hwsim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index 89794c724858c..eecd6e2ee27e4 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -6747,7 +6747,7 @@ static int mac80211_hwsim_netlink_notify(struct notifier_block *nb,
{
struct netlink_notify *notify = _notify;
- if (state != NETLINK_URELEASE)
+ if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC)
return NOTIFY_DONE;
remove_user_radios(notify->portid, hwsim_net_get_netgroup(notify->net));
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 059/703] gpio: mvebu: name regmaps to fix debugfs collisions
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (57 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 058/703] wifi: mac80211_hwsim: ignore non-generic netlink releases Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 060/703] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
` (348 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Linus Walleij,
Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 4d305c2273123119c27d6e4c822215e650c451e3 ]
Each marvell,armada-370-gpio node provides both 'gpio' and 'pwm'
register windows, and the driver creates one regmap per window on the
same platform device. The shared regmap_config was unnamed, so both
maps defaulted their debugfs directory to dev_name(), e.g.
debugfs: 'f1018100.gpio' already exists in 'regmap'
because the PWM regmap (and on Armada XP the per-CPU regmap) claimed
the same directory as the GPIO regmap.
Give each regmap a distinct .name so the debugfs directories become
'<dev>.gpio', '<dev>.percpu' and '<dev>.pwm'. This only affects
debugfs naming; register access is unchanged.
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260905004334.177074-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Stable-dep-of: 42269cdb3d3b ("gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mvebu.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index c613d74ed48d0..aa2484a8d8af4 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -599,6 +599,21 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc)
}
static const struct regmap_config mvebu_gpio_regmap_config = {
+ .name = "gpio",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+};
+
+static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
+ .name = "percpu",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+};
+
+static const struct regmap_config mvebu_pwm_regmap_config = {
+ .name = "pwm",
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
@@ -840,7 +855,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
return PTR_ERR(base);
mvpwm->regs = devm_regmap_init_mmio(&pdev->dev, base,
- &mvebu_gpio_regmap_config);
+ &mvebu_pwm_regmap_config);
if (IS_ERR(mvpwm->regs))
return PTR_ERR(mvpwm->regs);
@@ -1107,7 +1122,7 @@ static int mvebu_gpio_probe_raw(struct platform_device *pdev,
mvchip->percpu_regs =
devm_regmap_init_mmio(&pdev->dev, base,
- &mvebu_gpio_regmap_config);
+ &mvebu_gpio_percpu_regmap_config);
if (IS_ERR(mvchip->percpu_regs))
return PTR_ERR(mvchip->percpu_regs);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 060/703] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (58 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 059/703] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 061/703] gpio: keep the chip reference when deferred setup fails Greg Kroah-Hartman
` (347 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
[ Upstream commit 42269cdb3d3b46ba6e80f31d0e00d0bdcff1d8d4 ]
mvebu_gpio_write_level_mask() is called with a raw spinlock taken but
the underlying regmap uses a standard spinlock which can sleep on
RT_PREEMPT kernels. Add the .use_raw_spinlock attribute to the
appropriate regmap config.
Cc: stable@vger.kernel.org
Fixes: 2233bf7a92e7 ("gpio: mvebu: switch to regmap for register access")
Fixes: 4d305c227312 ("gpio: mvebu: name regmaps to fix debugfs collisions")
Closes: https://sashiko.dev/#/bug/linux-6bee0c4f-384c-494c-868e-07c420195d13
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261109-gpio-mvebu-sleeping-while-atomic-v2-1-41f070421e70@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mvebu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index aa2484a8d8af4..7ad2b1fe95d5e 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -603,6 +603,7 @@ static const struct regmap_config mvebu_gpio_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
+ .use_raw_spinlock = true,
};
static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
@@ -610,6 +611,7 @@ static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
+ .use_raw_spinlock = true,
};
static const struct regmap_config mvebu_pwm_regmap_config = {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 061/703] gpio: keep the chip reference when deferred setup fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (59 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 060/703] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 062/703] cpufreq: Fix updates of cached resolved frequency and index Greg Kroah-Hartman
` (346 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wentao Liang, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <vulab@iscas.ac.cn>
[ Upstream commit 7e899fe007d2ffc753e6aa5bc8f2ae0a802b9e07 ]
gpiochip_setup_devs() runs once gpiolib has been initialized and
finishes the registration of the chips that were added before that.
When the registration of such a chip fails, the function drops the
reference taken in gpiochip_add_data_with_key() with
gpio_device_put(), and only then logs the error through &gdev->dev.
For these chips that reference is the last one, so gpiodev_release()
frees gdev: the dev_err() dereferences freed memory, and the chip is
still linked in gpio_devices, so the next lookup walks into the freed
object as well. Here the registration cannot be undone the way
gpiochip_add_data_with_key() does it, as the driver already got success
from gpiochip_add_data() and will call gpiochip_remove(), which unlinks
the chip and drops the reference.
Keep the reference and only report the failure.
Fixes: 16fdabe143fc ("gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20261104025345.1527526-1-vulab@iscas.ac.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
[ sashal: Adjusted the gpiochip_setup_dev() prototype and its call site to take struct gpio_device *gdev instead of struct gpio_chip *gc, since this tree has no per-chip gc lookup in that loop. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a41219961778d..e126218751eb2 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -884,7 +884,8 @@ static const struct device_type gpio_dev_type = {
/*
* An initial reference count has been held in gpiochip_add_data_with_key().
- * The caller should drop the reference via gpio_device_put() on errors.
+ * A caller that tears the chip down on errors must drop the reference via
+ * gpio_device_put().
*/
static int gpiochip_setup_dev(struct gpio_device *gdev)
{
@@ -955,12 +956,16 @@ static void gpiochip_setup_devs(void)
list_for_each_entry_srcu(gdev, &gpio_devices, list,
srcu_read_lock_held(&gpio_devices_srcu)) {
+ /*
+ * The reference taken in gpiochip_add_data_with_key() is
+ * dropped by gpiochip_remove(): this chip is still registered
+ * and its driver has not been told about the failure, so the
+ * reference must be kept here.
+ */
ret = gpiochip_setup_dev(gdev);
- if (ret) {
- gpio_device_put(gdev);
+ if (ret)
dev_err(&gdev->dev,
"Failed to initialize gpio device (%d)\n", ret);
- }
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 062/703] cpufreq: Fix updates of cached resolved frequency and index
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (60 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 061/703] gpio: keep the chip reference when deferred setup fails Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 063/703] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
` (345 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhongqiu Han, Rafael J. Wysocki,
Christian Loehle, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit 75120f31aed010c326b28d7c80d22314df34d9a8 ]
The cached resolved frequency and index, cached_target_freq and
cached_resolved_idx, respectively, may be updated concurrently if
cpufreq_driver_resolve_freq() is called by the schedutil governor
while cpufreq_set_policy() is running for the same policy. Those
concurrent updates are not synchronized in any way and the values
written by cpufreq_set_policy(), if it wins the race, may confuse
drivers using those policy fields [1].
To address this, use the observation that the only place where
cached_target_freq and cached_resolved_idx need to be updated is
cpufreq_driver_resolve_freq() because the only legitimate users of
them are .fast_switch() driver callbacks. Although cached_resolved_idx
is also used in __cpufreq_driver_target(), that is in fact unnecessary
and it is better to use a local variable for storing the frequency
table index in that function.
Accordingly, rearrange __resolve_freq() and its callers so that
cached_target_freq and cached_resolved_idx are only updated in
cpufreq_driver_resolve_freq().
The cached_target_freq initialization in cpufreq_set_policy() is still
needed, but move it after stopping the old governor and before starting
the new one to avoid racing with cpufreq_driver_resolve_freq().
Fixes: f9ccdec24d91 ("cpufreq: Reuse cpufreq_driver_resolve_freq() in __cpufreq_driver_target()")
Fixes: 151717690694 ("cpufreq: Make policy min/max hard requirements")
Reported-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Closes: https://lore.kernel.org/linux-pm/20261105140357.1331894-1-zhongqiu.han@oss.qualcomm.com/ [1]
Co-developed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Cc: All applicable <stable@vger.kernel.org> # 342d3a73c5db cpufreq: Force passing target frequency to driver during resume
Cc: All applicable <stable@vger.kernel.org> # 166207cac451 cpufreq: Cache post-resolution target frequency in __resolve_freq()
Link: https://patch.msgid.link/3472677.aeNJFYEL58@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index cd2eb696548b7..bd56db09ac8e6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -498,7 +498,7 @@ EXPORT_SYMBOL_GPL(cpufreq_disable_fast_switch);
static unsigned int __resolve_freq(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int min, unsigned int max,
- unsigned int relation)
+ unsigned int relation, unsigned int *idx_p)
{
unsigned int idx;
@@ -508,9 +508,10 @@ static unsigned int __resolve_freq(struct cpufreq_policy *policy,
return target_freq;
idx = cpufreq_frequency_table_target(policy, target_freq, min, max, relation);
- policy->cached_resolved_idx = idx;
- policy->cached_target_freq = policy->freq_table[idx].frequency;
- return policy->cached_target_freq;
+ if (idx_p)
+ *idx_p = idx;
+
+ return policy->freq_table[idx].frequency;
}
/**
@@ -541,7 +542,10 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
if (unlikely(min > max))
min = max;
- return __resolve_freq(policy, target_freq, min, max, CPUFREQ_RELATION_LE);
+ policy->cached_target_freq = __resolve_freq(policy, target_freq, min, max,
+ CPUFREQ_RELATION_LE,
+ &policy->cached_resolved_idx);
+ return policy->cached_target_freq;
}
EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq);
@@ -2400,12 +2404,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int relation)
{
unsigned int old_target_freq = target_freq;
+ unsigned int idx = 0;
if (cpufreq_disabled())
return -ENODEV;
target_freq = __resolve_freq(policy, target_freq, policy->min,
- policy->max, relation);
+ policy->max, relation, &idx);
pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
policy->cpu, target_freq, relation, old_target_freq);
@@ -2435,7 +2440,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
if (!cpufreq_driver->target_index)
return -EINVAL;
- return __target_index(policy, policy->cached_resolved_idx);
+ return __target_index(policy, idx);
}
EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
@@ -2714,7 +2719,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
* concurrently by cpufreq_driver_resolve_freq() during the update.
*/
freq = __resolve_freq(policy, new_data.max, new_data.min, new_data.max,
- CPUFREQ_RELATION_H);
+ CPUFREQ_RELATION_H, NULL);
if (freq != policy->max) {
WRITE_ONCE(policy->max, freq);
if (need_update_limits)
@@ -2722,7 +2727,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
}
freq = __resolve_freq(policy, new_data.min, new_data.min, new_data.max,
- CPUFREQ_RELATION_L);
+ CPUFREQ_RELATION_L, NULL);
freq = min(freq, policy->max);
if (freq != policy->min) {
WRITE_ONCE(policy->min, freq);
@@ -2734,8 +2739,6 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
cpufreq_update_pressure(policy);
- policy->cached_target_freq = UINT_MAX;
-
pr_debug("new min and max freqs are %u - %u kHz\n",
policy->min, policy->max);
@@ -2761,6 +2764,12 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
cpufreq_exit_governor(policy);
}
+ /*
+ * Initialize cached_target_freq while no governor is running to avoid
+ * racing with cpufreq_driver_resolve_freq(), which updates it.
+ */
+ policy->cached_target_freq = UINT_MAX;
+
/* start new governor */
policy->governor = new_gov;
ret = cpufreq_init_governor(policy);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 063/703] mm/page_alloc: retry allocations that raced with a zonelist rebuild
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (61 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 062/703] cpufreq: Fix updates of cached resolved frequency and index Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 064/703] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
` (344 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit bcfc8286f0cd5a74c827d502f9f1ad408d7eff30 ]
Onlining the first block of a zone rebuilds every zonelist in place,
shifting the slots after the new zone. The iterator approves a slot,
then the allocator loads the zone from it, so a GFP_KERNEL request can
land in ZONE_MOVABLE and a nodemask request on a node outside its mask:
CPU 0 CPU 1
prepare_alloc_pages()
first_zones_zonelist(nodemask {1})
slot 0 (NORMAL1) approved
online_pages()
build_all_zonelists()
[NORMAL1, NORMAL2, ...]
-> [MOVABLE1, NORMAL1, ...]
get_page_from_freelist()
zone = zonelist_zone(slot 0) /* MOVABLE1 */
allocates from MOVABLE1
zonelist_update_seq detects the rebuild, but only the slowpath's failure
exits check it.
Check it whenever an allocation succeeds too, and if it changed, free
the page and retry, as the memcg charge failure path does. Eligible
pages are dropped as well: zonelists only change when memory comes or
goes, and a retry is simpler than rechecking the page.
Freeing the page does not undo a block the allocation claimed. A
GFP_KERNEL request that lands in a fresh ZONE_MOVABLE converts a free
block to MIGRATE_UNMOVABLE, which stays until the zone's movable free
list runs out and a movable allocation takes it back.
The fast and bulk paths read the seqlock's raw seqcount without waiting:
an ALLOC_NOLOCK caller can be an NMI that interrupted the writer, and on
PREEMPT_RT the seqlock accessor takes the spinlock. A sample taken
mid-write costs a retry, or NULL under ALLOC_NOLOCK.
check_retry_zonelist() returns 0 when compiled out, so a backport
without the hot-add change stays harmless.
Fixes: 11cd8638c37f ("mm, page_alloc: remove stop_machine from build_all_zonelists")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Link: https://patch.msgid.link/20261101021340.2251928-9-gourry@gourry.net
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Added a matching zonelist-cookie check to the separate nolock allocation function (freeing with the trylock flag and returning NULL), and used the non-nolock free flag in the regular path. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7c10d42e31d8f..2039fe1abfe15 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4450,12 +4450,25 @@ static unsigned int zonelist_iter_begin(void)
return 0;
}
+/*
+ * Never wait for the writer, which an ALLOC_NOLOCK caller in NMI may have
+ * interrupted. Read the raw seqcount: on PREEMPT_RT the seqlock accessor takes
+ * the spinlock while a write is in progress.
+ */
+static unsigned int zonelist_iter_sample(void)
+{
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
+ return raw_seqcount_begin(&zonelist_update_seq.seqcount.seqcount);
+
+ return 0;
+}
+
static unsigned int check_retry_zonelist(unsigned int seq)
{
if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
return read_seqretry(&zonelist_update_seq, seq);
- return seq;
+ return 0;
}
/* Perform direct synchronous page reclaim */
@@ -5124,6 +5137,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
warn_alloc(gfp_mask, ac->nodemask,
"page allocation failure: order:%u", order);
got_pg:
+ /* A rebuild during the walk may have handed out an ineligible zone. */
+ if (page && check_retry_zonelist(zonelist_iter_cookie)) {
+ __free_frozen_pages(page, order, FPI_NONE);
+ page = NULL;
+ goto restart;
+ }
return page;
}
@@ -5205,6 +5224,7 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
struct alloc_context ac;
gfp_t alloc_gfp;
unsigned int alloc_flags = ALLOC_WMARK_LOW;
+ unsigned int zonelist_iter_cookie;
int nr_populated = 0, nr_account = 0;
/*
@@ -5245,6 +5265,7 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
/* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
gfp &= gfp_allowed_mask;
alloc_gfp = gfp;
+ zonelist_iter_cookie = zonelist_iter_sample();
if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
goto out;
gfp = alloc_gfp;
@@ -5295,6 +5316,10 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
if (unlikely(!zone))
goto failed;
+ /* The zone was chosen from a zonelist that a rebuild may have changed. */
+ if (unlikely(check_retry_zonelist(zonelist_iter_cookie)))
+ goto failed;
+
/* spin_trylock may fail due to a parallel drain or IRQ reentrancy. */
pcp_trylock_prepare(UP_flags);
pcp = pcp_spin_trylock(zone->per_cpu_pageset);
@@ -5358,6 +5383,7 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
unsigned int alloc_flags = ALLOC_WMARK_LOW;
gfp_t alloc_gfp; /* The gfp_t that was actually used for allocation */
struct alloc_context ac = { };
+ unsigned int zonelist_iter_cookie;
/*
* There are several places where we assume that the order value is sane
@@ -5376,6 +5402,7 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
*/
gfp = current_gfp_context(gfp);
alloc_gfp = gfp;
+ zonelist_iter_cookie = zonelist_iter_sample();
if (!prepare_alloc_pages(gfp, order, preferred_nid, nodemask, &ac,
&alloc_gfp, &alloc_flags))
return NULL;
@@ -5389,6 +5416,10 @@ struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
/* First allocation attempt */
page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
+ if (likely(page) && unlikely(check_retry_zonelist(zonelist_iter_cookie))) {
+ __free_frozen_pages(page, order, FPI_NONE);
+ page = NULL;
+ }
if (likely(page))
goto out;
@@ -7789,6 +7820,7 @@ struct page *alloc_frozen_pages_nolock_noprof(gfp_t gfp_flags, int nid, unsigned
| gfp_flags;
unsigned int alloc_flags = ALLOC_TRYLOCK;
struct alloc_context ac = { };
+ unsigned int zonelist_iter_cookie;
struct page *page;
VM_WARN_ON_ONCE(gfp_flags & ~__GFP_ACCOUNT);
@@ -7820,6 +7852,7 @@ struct page *alloc_frozen_pages_nolock_noprof(gfp_t gfp_flags, int nid, unsigned
if (nid == NUMA_NO_NODE)
nid = numa_node_id();
+ zonelist_iter_cookie = zonelist_iter_sample();
prepare_alloc_pages(alloc_gfp, order, nid, NULL, &ac,
&alloc_gfp, &alloc_flags);
@@ -7828,6 +7861,10 @@ struct page *alloc_frozen_pages_nolock_noprof(gfp_t gfp_flags, int nid, unsigned
* If it's empty attempt to spin_trylock zone->lock.
*/
page = get_page_from_freelist(alloc_gfp, order, alloc_flags, &ac);
+ if (page && unlikely(check_retry_zonelist(zonelist_iter_cookie))) {
+ __free_frozen_pages(page, order, FPI_TRYLOCK);
+ page = NULL;
+ }
/* Unlike regular alloc_pages() there is no __alloc_pages_slowpath(). */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 064/703] mm/hugetlb: retry the pool walk when the zonelist is rebuilt
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (62 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 063/703] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 065/703] page_alloc: allow migration of smaller hugepages during contig_alloc Greg Kroah-Hartman
` (343 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit 9f6674f842bbceda8326cf4e494af5ad3a5a05e6 ]
Onlining the first block of a zone rebuilds every zonelist in place,
shifting the slots after the new zone. dequeue_hugetlb_folio_nodemask()
approves a slot by its node, then loads the zone from it, so a hugetlb
fault bound to one node can take a pool page from another:
CPU 0 CPU 1
dequeue_hugetlb_folio_nodemask(nodemask {2})
slot 3 (NORMAL2) approved
online_pages()
build_all_zonelists()
[.., NORMAL1, NORMAL2]
-> [.., MOVABLE1, NORMAL1, ...]
zone = zonelist_zone(slot 3) /* NORMAL1 */
dequeue_hugetlb_folio_node_exact(h, 1)
Check zonelist_update_seq before using each zone, and on the way out
with nothing found, and restart the walk if it changed. Checking before
the dequeue leaves nothing to put back. Reset the last-tried node on
restart, so it is not skipped.
With kprobes holding the walk across the online, a fault bound to node 2
took a node 1 page in 3 of 3 runs, and a node 2 page in 3 of 3 with this
change.
Fixes: 11cd8638c37f ("mm, page_alloc: remove stop_machine from build_all_zonelists")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261101021340.2251928-10-gourry@gourry.net
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ sashal: Moved zonelist_iter_begin() and check_retry_zonelist() into mm/internal.h since mm/page_alloc.h doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/hugetlb.c | 13 ++++++++++---
mm/internal.h | 19 +++++++++++++++++++
mm/page_alloc.c | 18 +-----------------
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 93634e3524a73..a41a477361a7e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1338,11 +1338,11 @@ static struct folio *dequeue_hugetlb_folio_node_exact(struct hstate *h,
static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_mask,
int nid, nodemask_t *nmask)
{
- unsigned int cpuset_mems_cookie;
+ unsigned int cpuset_mems_cookie, zonelist_cookie;
struct zonelist *zonelist;
struct zone *zone;
struct zoneref *z;
- int node = NUMA_NO_NODE;
+ int node;
/* 'nid' should not be NUMA_NO_NODE. Try to catch any misuse of it and rectifiy. */
if (nid == NUMA_NO_NODE)
@@ -1351,10 +1351,16 @@ static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_
zonelist = node_zonelist(nid, gfp_mask);
retry_cpuset:
+ node = NUMA_NO_NODE;
cpuset_mems_cookie = read_mems_allowed_begin();
+ zonelist_cookie = zonelist_iter_begin();
for_each_zone_zonelist_nodemask(zone, z, zonelist, gfp_zone(gfp_mask), nmask) {
struct folio *folio;
+ /* A rebuild may have shifted a node outside @nmask into this slot. */
+ if (unlikely(check_retry_zonelist(zonelist_cookie)))
+ goto retry_cpuset;
+
if (!cpuset_zone_allowed(zone, gfp_mask))
continue;
/*
@@ -1369,7 +1375,8 @@ static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_
if (folio)
return folio;
}
- if (unlikely(read_mems_allowed_retry(cpuset_mems_cookie)))
+ if (unlikely(read_mems_allowed_retry(cpuset_mems_cookie) ||
+ check_retry_zonelist(zonelist_cookie)))
goto retry_cpuset;
return NULL;
diff --git a/mm/internal.h b/mm/internal.h
index 7504592042b23..9f201e191af7a 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -14,6 +14,7 @@
#include <linux/pagemap.h>
#include <linux/pagewalk.h>
#include <linux/rmap.h>
+#include <linux/seqlock.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/swap_cgroup.h>
@@ -873,6 +874,24 @@ extern void zone_pcp_disable(struct zone *zone);
extern void zone_pcp_enable(struct zone *zone);
extern void zone_pcp_init(struct zone *zone);
+extern seqlock_t zonelist_update_seq;
+
+static inline unsigned int zonelist_iter_begin(void)
+{
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
+ return read_seqbegin(&zonelist_update_seq);
+
+ return 0;
+}
+
+static inline unsigned int check_retry_zonelist(unsigned int seq)
+{
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
+ return read_seqretry(&zonelist_update_seq, seq);
+
+ return 0;
+}
+
extern void *memmap_alloc(phys_addr_t size, phys_addr_t align,
phys_addr_t min_addr,
int nid, bool exact_nid);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2039fe1abfe15..ce32a8bb22da4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4440,15 +4440,7 @@ EXPORT_SYMBOL_GPL(fs_reclaim_release);
* retries the allocation if zonelist changes. Writer side is protected by the
* embedded spin_lock.
*/
-static DEFINE_SEQLOCK(zonelist_update_seq);
-
-static unsigned int zonelist_iter_begin(void)
-{
- if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
- return read_seqbegin(&zonelist_update_seq);
-
- return 0;
-}
+DEFINE_SEQLOCK(zonelist_update_seq);
/*
* Never wait for the writer, which an ALLOC_NOLOCK caller in NMI may have
@@ -4463,14 +4455,6 @@ static unsigned int zonelist_iter_sample(void)
return 0;
}
-static unsigned int check_retry_zonelist(unsigned int seq)
-{
- if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
- return read_seqretry(&zonelist_update_seq, seq);
-
- return 0;
-}
-
/* Perform direct synchronous page reclaim */
static unsigned long
__perform_reclaim(gfp_t gfp_mask, unsigned int order,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 065/703] page_alloc: allow migration of smaller hugepages during contig_alloc
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (63 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 064/703] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 066/703] mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt Greg Kroah-Hartman
` (342 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price, David Hildenbrand,
Zi Yan, Wei Yang, Michal Hocko, David Hildenbrand (Red Hat),
Brendan Jackman, Johannes Weiner, Suren Baghdasaryan,
Vlastimil Babka, Andrew Morton, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price <gourry@gourry.net>
[ Upstream commit 3bb64898f00368cd110d4b31334f93251d56b404 ]
We presently skip regions with hugepages entirely when trying to do
contiguous page allocation. This will cause otherwise-movable 2MB HugeTLB
pages to be considered unmovable, and makes 1GB gigantic page allocation
less reliable on systems utilizing both.
Commit 4d73ba5fa710 ("mm: page_alloc: skip regions with hugetlbfs pages
when allocating 1G pages") skipped all HugePage containing regions because
it can cause significant delays in 1G allocation (as HugeTLB migrations
may fail for a number of reasons).
Instead, if hugepage migration is enabled, consider regions with hugepages
smaller than the target contiguous allocation request as valid targets for
allocation.
We optimize for the existing behavior by searching for non-hugetlb regions
in a first pass, then retrying the search to include hugetlb only on
failure. This allows the existing fast-path to remain the default case
with a slow-path fallback to increase reliability.
We only fallback to the slow path if a hugetlb region was detected, and we
do a full re-scan because the zones/blocks may have changed during the
first pass (and it's not worth further complexity).
isolate_migrate_pages_block() has similar hugetlb filter logic, and the
hugetlb code does a migratable check in folio_isolate_hugetlb() during
isolation. The code servicing the allocation and migration already
supports this exact use case.
To test, allocate a bunch of 2MB HugeTLB pages (in this case 48GB) and
then attempt to allocate some 1G HugeTLB pages (in this case 4GB) (Scale
to your machine's memory capacity).
echo 24576 > .../hugepages-2048kB/nr_hugepages
echo 4 > .../hugepages-1048576kB/nr_hugepages
Prior to this patch, the 1GB page reservation can fail if no contiguous
1GB pages remain. After this patch, the kernel will try to move 2MB pages
and successfully allocate the 1GB pages (assuming overall sufficient
memory is available). Also tested this while a program had the 2MB
reservations mapped, and the 1GB reservation still succeeds.
folio_alloc_gigantic() is the primary user of alloc_contig_pages(),
other users are debug or init-time allocations and largely unaffected.
- ppc/memtrace is a debugfs interface
- x86/tdx memory allocation occurs once on module-init
- kfence/core happens once on module (late) init
- THP uses it in debug_vm_pgtable_alloc_huge_page at __init time
Link: https://lkml.kernel.org/r/20251221124656.2362540-1-gourry@gourry.net
Signed-off-by: Gregory Price <gourry@gourry.net>
Suggested-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/linux-mm/6fe3562d-49b2-4975-aa86-e139c535ad00@redhat.com/
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: da0d7a895e90 ("mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 55 insertions(+), 4 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ce32a8bb22da4..b8dc3071a9053 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7277,7 +7277,8 @@ static int __alloc_contig_pages(unsigned long start_pfn,
}
static bool pfn_range_valid_contig(struct zone *z, unsigned long start_pfn,
- unsigned long nr_pages)
+ unsigned long nr_pages, bool skip_hugetlb,
+ bool *skipped_hugetlb)
{
unsigned long i, end_pfn = start_pfn + nr_pages;
struct page *page;
@@ -7293,8 +7294,42 @@ static bool pfn_range_valid_contig(struct zone *z, unsigned long start_pfn,
if (PageReserved(page))
return false;
- if (PageHuge(page))
- return false;
+ /*
+ * Only consider ranges containing hugepages if those pages are
+ * smaller than the requested contiguous region. e.g.:
+ * Move 2MB pages to free up a 1GB range.
+ * Don't move 1GB pages to free up a 2MB range.
+ *
+ * This makes contiguous allocation more reliable if multiple
+ * hugepage sizes are used without causing needless movement.
+ */
+ if (PageHuge(page)) {
+ unsigned int order;
+
+ if (!IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION))
+ return false;
+
+ if (skip_hugetlb) {
+ *skipped_hugetlb = true;
+ return false;
+ }
+
+ page = compound_head(page);
+ order = compound_order(page);
+ if ((order >= MAX_FOLIO_ORDER) ||
+ (nr_pages <= (1 << order)))
+ return false;
+
+ /*
+ * Reaching this point means we've encounted a huge page
+ * smaller than nr_pages, skip all pfn's for that page.
+ *
+ * We can't get here from a tail-PageHuge, as it implies
+ * we started a scan in the middle of a hugepage larger
+ * than nr_pages - which the prior check filters for.
+ */
+ i += (1 << order) - 1;
+ }
}
return true;
}
@@ -7337,7 +7372,10 @@ struct page *alloc_contig_pages_noprof(unsigned long nr_pages, gfp_t gfp_mask,
struct zonelist *zonelist;
struct zone *zone;
struct zoneref *z;
+ bool skip_hugetlb = true;
+ bool skipped_hugetlb = false;
+retry:
zonelist = node_zonelist(nid, gfp_mask);
for_each_zone_zonelist_nodemask(zone, z, zonelist,
gfp_zone(gfp_mask), nodemask) {
@@ -7345,7 +7383,9 @@ struct page *alloc_contig_pages_noprof(unsigned long nr_pages, gfp_t gfp_mask,
pfn = ALIGN(zone->zone_start_pfn, nr_pages);
while (zone_spans_last_pfn(zone, pfn, nr_pages)) {
- if (pfn_range_valid_contig(zone, pfn, nr_pages)) {
+ if (pfn_range_valid_contig(zone, pfn, nr_pages,
+ skip_hugetlb,
+ &skipped_hugetlb)) {
/*
* We release the zone lock here because
* alloc_contig_range() will also lock the zone
@@ -7364,6 +7404,17 @@ struct page *alloc_contig_pages_noprof(unsigned long nr_pages, gfp_t gfp_mask,
}
spin_unlock_irqrestore(&zone->lock, flags);
}
+ /*
+ * If we failed, retry the search, but treat regions with HugeTLB pages
+ * as valid targets. This retains fast-allocations on first pass
+ * without trying to migrate HugeTLB pages (which may fail). On the
+ * second pass, we will try moving HugeTLB pages when those pages are
+ * smaller than the requested contiguous region size.
+ */
+ if (skip_hugetlb && skipped_hugetlb) {
+ skip_hugetlb = false;
+ goto retry;
+ }
return NULL;
}
#endif /* CONFIG_CONTIG_ALLOC */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 066/703] mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (64 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 065/703] page_alloc: allow migration of smaller hugepages during contig_alloc Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 067/703] mm: page_isolation: introduce page_is_unmovable() Greg Kroah-Hartman
` (341 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
[ Upstream commit da0d7a895e9021dc2cffa90fb6fafd8b9379e544 ]
Onlining the first block of a zone rebuilds every zonelist in place,
shifting the slots after the new zone.
alloc_contig_frozen_pages_noprof() approves a slot by the caller's gfp
and nodemask, then loads the zone from it:
CPU 0 CPU 1
alloc_contig_frozen_pages_noprof(GFP_HIGHUSER | __GFP_THISNODE)
slot 0 (NORMAL1) approved
online_pages()
build_all_zonelists()
[NORMAL1]
-> [MOVABLE1, NORMAL1]
zone = zonelist_zone(slot 0) /* MOVABLE1 */
alloc_contig_frozen_range(MOVABLE1 pfns)
A gigantic hugetlb page can then land in ZONE_MOVABLE, and a nodemask
caller can get a range from another node. Gigantic pages are kept out
of ZONE_MOVABLE since commit 79b63f12abcb ("mm, hugetlb: do not allocate
non-migrateable gigantic pages from movable zones").
Check zonelist_update_seq before using each zone, and restart the walk
if it changed, as the hugetlb pool walk does. Check again before
escalating to the pass that may migrate hugetlb pages, so a pass a
rebuild cut short is redone rather than escalated.
With kprobes holding the walk across the online, the base kernel put the
1G page in ZONE_MOVABLE in 3 of 3 runs, and this change put it in
ZONE_NORMAL in 3 of 3. Direct GFP_KERNEL calls with nodemask {1} and
{2} got a ZONE_MOVABLE range and a node 1 range on base, 3 of 3 each,
and neither with this change.
Fixes: 5e27a2df03b8 ("mm/page_alloc: add alloc_contig_pages()")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Link: https://patch.msgid.link/20261101021340.2251928-11-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b8dc3071a9053..f041971e79b42 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7369,6 +7369,7 @@ struct page *alloc_contig_pages_noprof(unsigned long nr_pages, gfp_t gfp_mask,
int nid, nodemask_t *nodemask)
{
unsigned long ret, pfn, flags;
+ unsigned int zonelist_cookie;
struct zonelist *zonelist;
struct zone *zone;
struct zoneref *z;
@@ -7377,8 +7378,13 @@ struct page *alloc_contig_pages_noprof(unsigned long nr_pages, gfp_t gfp_mask,
retry:
zonelist = node_zonelist(nid, gfp_mask);
+ zonelist_cookie = zonelist_iter_begin();
for_each_zone_zonelist_nodemask(zone, z, zonelist,
gfp_zone(gfp_mask), nodemask) {
+ /* A rebuild may have shifted an ineligible zone into this slot. */
+ if (unlikely(check_retry_zonelist(zonelist_cookie)))
+ goto retry;
+
spin_lock_irqsave(&zone->lock, flags);
pfn = ALIGN(zone->zone_start_pfn, nr_pages);
@@ -7411,6 +7417,9 @@ struct page *alloc_contig_pages_noprof(unsigned long nr_pages, gfp_t gfp_mask,
* second pass, we will try moving HugeTLB pages when those pages are
* smaller than the requested contiguous region size.
*/
+ /* Redo a pass that a rebuild cut short before escalating. */
+ if (unlikely(check_retry_zonelist(zonelist_cookie)))
+ goto retry;
if (skip_hugetlb && skipped_hugetlb) {
skip_hugetlb = false;
goto retry;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 067/703] mm: page_isolation: introduce page_is_unmovable()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (65 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 066/703] mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 068/703] mm/memory_hotplug: fix possible race in scan_movable_pages() Greg Kroah-Hartman
` (340 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kefeng Wang, Zi Yan, Oscar Salvador,
Brendan Jackman, David Hildenbrand, Jane Chu, Johannes Weiner,
Matthew Wilcox (Oracle), Muchun Song, Sidhartha Kumar,
Vlastimil Babka, Andrew Morton, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kefeng Wang <wangkefeng.wang@huawei.com>
[ Upstream commit c83109e95c9d78e41b39e65b6490e511f4b8fba2 ]
Patch series "mm: accelerate gigantic folio allocation".
Optimize pfn_range_valid_contig() and replace_free_hugepage_folios() in
alloc_contig_frozen_pages() to speed up gigantic folio allocation. The
allocation time for 120*1G folios drops from 3.605s to 0.431s.
This patch (of 5):
Factor out the check if a page is unmovable into a new helper, and will be
reused in the following patch.
No functional change intended, the minor changes are as follows,
1) Avoid unnecessary calls by checking CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
2) Directly call PageCompound since PageTransCompound may be dropped
3) Using folio_test_hugetlb()
Link: https://lkml.kernel.org/r/20260112150954.1802953-1-wangkefeng.wang@huawei.com
Link: https://lkml.kernel.org/r/20260112150954.1802953-2-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Jane Chu <jane.chu@oracle.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 213268869301 ("mm: page_isolation: do not take slab pages for free")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/page-isolation.h | 2 +
mm/page_isolation.c | 187 +++++++++++++++++----------------
2 files changed, 101 insertions(+), 88 deletions(-)
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 3e2f960e166ca..6f8638c9904ff 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -67,4 +67,6 @@ void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn);
int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
enum pb_isolate_mode mode);
+bool page_is_unmovable(struct zone *zone, struct page *page,
+ enum pb_isolate_mode mode, unsigned long *step);
#endif
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 2e366e7bd5e93..7a32350eb8c2d 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -15,6 +15,100 @@
#define CREATE_TRACE_POINTS
#include <trace/events/page_isolation.h>
+bool page_is_unmovable(struct zone *zone, struct page *page,
+ enum pb_isolate_mode mode, unsigned long *step)
+{
+ /*
+ * Both, bootmem allocations and memory holes are marked
+ * PG_reserved and are unmovable. We can even have unmovable
+ * allocations inside ZONE_MOVABLE, for example when
+ * specifying "movablecore".
+ */
+ if (PageReserved(page))
+ return true;
+
+ /*
+ * If the zone is movable and we have ruled out all reserved
+ * pages then it should be reasonably safe to assume the rest
+ * is movable.
+ */
+ if (zone_idx(zone) == ZONE_MOVABLE)
+ return false;
+
+ /*
+ * Hugepages are not in LRU lists, but they're movable.
+ * THPs are on the LRU, but need to be counted as #small pages.
+ * We need not scan over tail pages because we don't
+ * handle each tail page individually in migration.
+ */
+ if (PageHuge(page) || PageCompound(page)) {
+ struct folio *folio = page_folio(page);
+
+ if (folio_test_hugetlb(folio)) {
+ struct hstate *h;
+
+ if (!IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION))
+ return true;
+
+ /*
+ * The huge page may be freed so can not
+ * use folio_hstate() directly.
+ */
+ h = size_to_hstate(folio_size(folio));
+ if (h && !hugepage_migration_supported(h))
+ return true;
+
+ } else if (!folio_test_lru(folio)) {
+ return true;
+ }
+
+ *step = folio_nr_pages(folio) - folio_page_idx(folio, page);
+ return false;
+ }
+
+ /*
+ * We can't use page_count without pin a page
+ * because another CPU can free compound page.
+ * This check already skips compound tails of THP
+ * because their page->_refcount is zero at all time.
+ */
+ if (!page_ref_count(page)) {
+ if (PageBuddy(page))
+ *step = (1 << buddy_order(page));
+ return false;
+ }
+
+ /*
+ * The HWPoisoned page may be not in buddy system, and
+ * page_count() is not 0.
+ */
+ if ((mode == PB_ISOLATE_MODE_MEM_OFFLINE) && PageHWPoison(page))
+ return false;
+
+ /*
+ * We treat all PageOffline() pages as movable when offlining
+ * to give drivers a chance to decrement their reference count
+ * in MEM_GOING_OFFLINE in order to indicate that these pages
+ * can be offlined as there are no direct references anymore.
+ * For actually unmovable PageOffline() where the driver does
+ * not support this, we will fail later when trying to actually
+ * move these pages that still have a reference count > 0.
+ * (false negatives in this function only)
+ */
+ if ((mode == PB_ISOLATE_MODE_MEM_OFFLINE) && PageOffline(page))
+ return false;
+
+ if (PageLRU(page) || page_has_movable_ops(page))
+ return false;
+
+ /*
+ * If there are RECLAIMABLE pages, we need to check
+ * it. But now, memory offline itself doesn't call
+ * shrink_node_slabs() and it still to be fixed.
+ */
+ return true;
+}
+
/*
* This function checks whether the range [start_pfn, end_pfn) includes
* unmovable pages or not. The range must fall into a single pageblock and
@@ -35,7 +129,6 @@ static struct page *has_unmovable_pages(unsigned long start_pfn, unsigned long e
{
struct page *page = pfn_to_page(start_pfn);
struct zone *zone = page_zone(page);
- unsigned long pfn;
VM_BUG_ON(pageblock_start_pfn(start_pfn) !=
pageblock_start_pfn(end_pfn - 1));
@@ -52,96 +145,14 @@ static struct page *has_unmovable_pages(unsigned long start_pfn, unsigned long e
return page;
}
- for (pfn = start_pfn; pfn < end_pfn; pfn++) {
- page = pfn_to_page(pfn);
+ while (start_pfn < end_pfn) {
+ unsigned long step = 1;
- /*
- * Both, bootmem allocations and memory holes are marked
- * PG_reserved and are unmovable. We can even have unmovable
- * allocations inside ZONE_MOVABLE, for example when
- * specifying "movablecore".
- */
- if (PageReserved(page))
+ page = pfn_to_page(start_pfn);
+ if (page_is_unmovable(zone, page, mode, &step))
return page;
- /*
- * If the zone is movable and we have ruled out all reserved
- * pages then it should be reasonably safe to assume the rest
- * is movable.
- */
- if (zone_idx(zone) == ZONE_MOVABLE)
- continue;
-
- /*
- * Hugepages are not in LRU lists, but they're movable.
- * THPs are on the LRU, but need to be counted as #small pages.
- * We need not scan over tail pages because we don't
- * handle each tail page individually in migration.
- */
- if (PageHuge(page) || PageTransCompound(page)) {
- struct folio *folio = page_folio(page);
- unsigned int skip_pages;
-
- if (PageHuge(page)) {
- struct hstate *h;
-
- /*
- * The huge page may be freed so can not
- * use folio_hstate() directly.
- */
- h = size_to_hstate(folio_size(folio));
- if (h && !hugepage_migration_supported(h))
- return page;
- } else if (!folio_test_lru(folio)) {
- return page;
- }
-
- skip_pages = folio_nr_pages(folio) - folio_page_idx(folio, page);
- pfn += skip_pages - 1;
- continue;
- }
-
- /*
- * We can't use page_count without pin a page
- * because another CPU can free compound page.
- * This check already skips compound tails of THP
- * because their page->_refcount is zero at all time.
- */
- if (!page_ref_count(page)) {
- if (PageBuddy(page))
- pfn += (1 << buddy_order(page)) - 1;
- continue;
- }
-
- /*
- * The HWPoisoned page may be not in buddy system, and
- * page_count() is not 0.
- */
- if ((mode == PB_ISOLATE_MODE_MEM_OFFLINE) && PageHWPoison(page))
- continue;
-
- /*
- * We treat all PageOffline() pages as movable when offlining
- * to give drivers a chance to decrement their reference count
- * in MEM_GOING_OFFLINE in order to indicate that these pages
- * can be offlined as there are no direct references anymore.
- * For actually unmovable PageOffline() where the driver does
- * not support this, we will fail later when trying to actually
- * move these pages that still have a reference count > 0.
- * (false negatives in this function only)
- */
- if ((mode == PB_ISOLATE_MODE_MEM_OFFLINE) && PageOffline(page))
- continue;
-
- if (PageLRU(page) || page_has_movable_ops(page))
- continue;
-
- /*
- * If there are RECLAIMABLE pages, we need to check
- * it. But now, memory offline itself doesn't call
- * shrink_node_slabs() and it still to be fixed.
- */
- return page;
+ start_pfn += step;
}
return NULL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 068/703] mm/memory_hotplug: fix possible race in scan_movable_pages()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (66 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 067/703] mm: page_isolation: introduce page_is_unmovable() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 069/703] mm: page_isolation: do not take slab pages for free Greg Kroah-Hartman
` (339 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Hildenbrand (Arm),
Lorenzo Stoakes (Oracle), Axel Rasmussen, Liam Howlett,
Michal Hocko, Mike Rapoport, Oscar Salvador, Sidhartha Kumar,
Suren Baghdasaryan, Vlastimil Babka, Wei Xu, Yuanchu Xie,
Andrew Morton, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand (Arm) <david@kernel.org>
[ Upstream commit 89e69c7d187eca8a040d4db0e080f79b5b32163d ]
Patch series "mm: memory hot(un)plug and SPARSEMEM cleanups", v2.
Some cleanups around memory hot(un)plug and SPARSEMEM. In essence, we can
limit CONFIG_MEMORY_HOTPLUG to CONFIG_SPARSEMEM_VMEMMAP, remove some dead
code, and move all the hotplug bits over to mm/sparse-vmemmap.c.
Some further/related cleanups around other unnecessary code (memory hole
handling and complicated usemap allocation).
I have some further sparse.c cleanups lying around, and I'm planning on
getting rid of bootmem_info.c entirely.
This patch (of 15):
If a hugetlb folio gets freed while we are in scan_movable_pages(),
folio_nr_pages() could return 0, resulting in or'ing "0 - 1 = -1" to the
PFN, resulting in PFN = -1. We're not holding any locks or references
that would prevent that.
for_each_valid_pfn() would then search for the next valid PFN, and could
return a PFN that is outside of the range of the original requested range.
do_migrate_page() would then try to migrate quite a big range, which is
certainly undesirable.
To fix it, simply test for valid folio_nr_pages() values. While at it, as
PageHuge() really just does a page_folio() internally, we can just use
folio_test_hugetlb() on the folio directly.
scan_movable_pages() is expected to be fast, and we try to avoid taking
locks or grabbing references. We cannot use folio_try_get() as that does
not work for free hugetlb folios. We could grab the hugetlb_lock, but
that just adds complexity.
The race is unlikely to trigger in practice, so we won't be CCing stable.
Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-0-096addc8800d@kernel.org
Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-1-096addc8800d@kernel.org
Fixes: 16540dae959d ("mm/hugetlb: mm/memory_hotplug: use a folio in scan_movable_pages()")
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 213268869301 ("mm: page_isolation: do not take slab pages for free")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/memory_hotplug.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index bdc064c026ec1..e62c196dfdfb8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1782,6 +1782,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
unsigned long pfn;
for_each_valid_pfn(pfn, start, end) {
+ unsigned long nr_pages;
struct page *page;
struct folio *folio;
@@ -1798,9 +1799,9 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
if (PageOffline(page) && page_count(page))
return -EBUSY;
- if (!PageHuge(page))
- continue;
folio = page_folio(page);
+ if (!folio_test_hugetlb(folio))
+ continue;
/*
* This test is racy as we hold no reference or lock. The
* hugetlb page could have been free'ed and head is no longer
@@ -1810,7 +1811,11 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
*/
if (folio_test_hugetlb_migratable(folio))
goto found;
- pfn |= folio_nr_pages(folio) - 1;
+ nr_pages = folio_nr_pages(folio);
+ if (unlikely(nr_pages < 1 || nr_pages > MAX_FOLIO_NR_PAGES ||
+ !is_power_of_2(nr_pages)))
+ continue;
+ pfn |= nr_pages - 1;
}
return -ENOENT;
found:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 069/703] mm: page_isolation: do not take slab pages for free
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (67 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 068/703] mm/memory_hotplug: fix possible race in scan_movable_pages() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 070/703] mm: rejig pageblock mask definitions Greg Kroah-Hartman
` (338 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Zi Yan, Johannes Weiner, Vlastimil Babka (SUSE), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 213268869301f747d19ca00a391757a6cf2d4fa8 ]
page_is_unmovable() regards a page with a reference count of zero as free
or about to be freed. Since slab allocates frozen pages, they will
be wrongly considered to be freed if order 0 (higher-order compound
pages are caught earlier).
If such slabs are the only unmovable pages of a memory block, memory
offlining now isolates the block, this can lead to offline_pages()
looping without progress.
Thus detect the slab pages as removable to return -EBUSY, as would
happen before commit 9aec2fb0fd5e ("slab: allocate frozen pages").
Fixes: 9aec2fb0fd5e ("slab: allocate frozen pages")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-3-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/memory_hotplug.c | 7 +++++++
mm/page_isolation.c | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index e62c196dfdfb8..1f29e1a64d181 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1799,6 +1799,13 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
if (PageOffline(page) && page_count(page))
return -EBUSY;
+ /*
+ * A page that was allocated, but was not a slab page yet, when
+ * its pageblock was isolated.
+ */
+ if (PageSlab(page))
+ return -EBUSY;
+
folio = page_folio(page);
if (!folio_test_hugetlb(folio))
continue;
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 7a32350eb8c2d..63c29a5527486 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -66,6 +66,13 @@ bool page_is_unmovable(struct zone *zone, struct page *page,
return false;
}
+ /*
+ * Slab pages are frozen: do not take their reference count of zero
+ * for that of a free page.
+ */
+ if (PageSlab(page))
+ return true;
+
/*
* We can't use page_count without pin a page
* because another CPU can free compound page.
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 070/703] mm: rejig pageblock mask definitions
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (68 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 069/703] mm: page_isolation: do not take slab pages for free Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 071/703] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx() Greg Kroah-Hartman
` (337 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Brendan Jackman,
Vlastimil Babka (SUSE), Axel Rasmussen, Barry Song,
David Hildenbrand, Johannes Weiner, Kairui Song, Len Brown,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport (Microsoft), Rafael J. Wysocki, Shakeel Butt,
Suren Baghdasaryan, Wei Xu, Yuanchu Xie, Zi Yan, Andrew Morton,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brendan Jackman <jackmanb@google.com>
[ Upstream commit 3687c0fd67249cb971990b382a47f02f19ed9f67 ]
- Add a PAGEBLOCK_ prefix to the names to avoid polluting the "global
namespace" too much.
- This new prefix makes MIGRATETYPE_AND_ISO_MASK look pretty long. Well,
that global mask only exists for quite a specific purpose, and is
quite a weird thing to have a name for anyway. So drop it and take
advantage of the newly-defined PAGEBLOCK_ISO_MASK.
Link: https://lore.kernel.org/20260513-page_alloc-unmapped-prep-v1-3-dacdf5402be8@google.com
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 2122887b04f3 ("mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/pageblock-flags.h | 6 +++---
mm/page_alloc.c | 18 +++++++++---------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index e046278a01fa8..9a6c3ea17684d 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -36,12 +36,12 @@ enum pageblock_bits {
#define NR_PAGEBLOCK_BITS (roundup_pow_of_two(__NR_PAGEBLOCK_BITS))
-#define MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BIT(PB_migrate_2))
+#define PAGEBLOCK_MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BIT(PB_migrate_2))
#ifdef CONFIG_MEMORY_ISOLATION
-#define MIGRATETYPE_AND_ISO_MASK (MIGRATETYPE_MASK | BIT(PB_migrate_isolate))
+#define PAGEBLOCK_ISO_MASK BIT(PB_migrate_isolate)
#else
-#define MIGRATETYPE_AND_ISO_MASK MIGRATETYPE_MASK
+#define PAGEBLOCK_ISO_MASK 0
#endif
#if defined(CONFIG_HUGETLB_PAGE)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f041971e79b42..5cd96eaf8d7ae 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -400,7 +400,7 @@ get_pfnblock_bitmap_bitidx(const struct page *page, unsigned long pfn,
#else
BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4);
#endif
- BUILD_BUG_ON(__MIGRATE_TYPE_END > MIGRATETYPE_MASK);
+ BUILD_BUG_ON(__MIGRATE_TYPE_END > PAGEBLOCK_MIGRATETYPE_MASK);
VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
bitmap = get_pageblock_bitmap(page, pfn);
@@ -473,7 +473,7 @@ bool get_pfnblock_bit(const struct page *page, unsigned long pfn,
__always_inline enum migratetype
get_pfnblock_migratetype(const struct page *page, unsigned long pfn)
{
- unsigned long mask = MIGRATETYPE_AND_ISO_MASK;
+ unsigned long mask = PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK;
unsigned long flags;
flags = __get_pfnblock_flags_mask(page, pfn, mask);
@@ -482,7 +482,7 @@ get_pfnblock_migratetype(const struct page *page, unsigned long pfn)
if (flags & BIT(PB_migrate_isolate))
return MIGRATE_ISOLATE;
#endif
- return flags & MIGRATETYPE_MASK;
+ return flags & PAGEBLOCK_MIGRATETYPE_MASK;
}
/**
@@ -570,11 +570,11 @@ static void set_pageblock_migratetype(struct page *page,
}
VM_WARN_ONCE(get_pageblock_isolate(page),
"Use clear_pageblock_isolate() to unisolate pageblock");
- /* MIGRATETYPE_AND_ISO_MASK clears PB_migrate_isolate if it is set */
+ /* PAGEBLOCK_ISO_MASK clears PB_migrate_isolate if it is set */
#endif
__set_pfnblock_flags_mask(page, page_to_pfn(page),
(unsigned long)migratetype,
- MIGRATETYPE_AND_ISO_MASK);
+ PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK);
}
void __meminit init_pageblock_migratetype(struct page *page,
@@ -600,7 +600,7 @@ void __meminit init_pageblock_migratetype(struct page *page,
flags |= BIT(PB_migrate_isolate);
#endif
__set_pfnblock_flags_mask(page, page_to_pfn(page), flags,
- MIGRATETYPE_AND_ISO_MASK);
+ PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK);
}
#ifdef CONFIG_DEBUG_VM
@@ -2181,15 +2181,15 @@ static bool __move_freepages_block_isolate(struct zone *zone,
}
move:
- /* Use MIGRATETYPE_MASK to get non-isolate migratetype */
+ /* Use PAGEBLOCK_MIGRATETYPE_MASK to get non-isolate migratetype */
if (isolate) {
from_mt = __get_pfnblock_flags_mask(page, page_to_pfn(page),
- MIGRATETYPE_MASK);
+ PAGEBLOCK_MIGRATETYPE_MASK);
to_mt = MIGRATE_ISOLATE;
} else {
from_mt = MIGRATE_ISOLATE;
to_mt = __get_pfnblock_flags_mask(page, page_to_pfn(page),
- MIGRATETYPE_MASK);
+ PAGEBLOCK_MIGRATETYPE_MASK);
}
__move_freepages_block(zone, start_pfn, from_mt, to_mt);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 071/703] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (69 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 070/703] mm: rejig pageblock mask definitions Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 072/703] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
` (336 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Vlastimil Babka (SUSE),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka (SUSE) <vbabka@kernel.org>
[ Upstream commit 2122887b04f3f2d76daa80055c2c273926032fa0 ]
Whenever the flags of a pageblock are read or written, a kernel with
CONFIG_DEBUG_VM makes sure that the pfn lies within the zone of the page.
Unlike bad_range(), that check reads zone->zone_start_pfn and
zone->spanned_pages without zone->span_seqlock.
Memory hotplug changes the two fields one after the other. If the lower
end of a zone moves, the zone seems to end before its last pages in
between. A page of that part which is freed at that moment, on another
CPU, ends in
page dumped because: VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn))
kernel BUG at mm/page_alloc.c:372!
free_unref_folios+0x55e/0xed0
folios_put_refs+0x2b5/0x530
An attempt has been made [1] to fix this with the span seqlock check.
But that can trigger all sorts of problems in restricted contexts, as
noted by sashiko [2].
Since this is just a sanity debug check and anything with BUG_ON is
frowned upon anyway, just remove it altogether.
Reported-by: Josef Bacik <josef@toxicpanda.com>
Closes: https://lore.kernel.org/all/20261027-pgalloc-ai-hotfixes-v1-9-9c7d1aca801e@kernel.org/ [1]
Link: https://lore.kernel.org/all/sashiko-outbox-188081@kernel.org/ [2]
Fixes: 86051ca5eaf5 ("mm: fix usemap initialization")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-5-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5cd96eaf8d7ae..9c4d5650f47d0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -401,7 +401,6 @@ get_pfnblock_bitmap_bitidx(const struct page *page, unsigned long pfn,
BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4);
#endif
BUILD_BUG_ON(__MIGRATE_TYPE_END > PAGEBLOCK_MIGRATETYPE_MASK);
- VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
bitmap = get_pageblock_bitmap(page, pfn);
*bitidx = pfn_to_bitidx(page, pfn);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 072/703] Bluetooth: L2CAP: Only accept LE responses to outstanding requests
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (70 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 071/703] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 073/703] spi: tegra210-quad: Refactor error handling into helper functions Greg Kroah-Hartman
` (335 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhao Li, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
[ Upstream commit f50b32aa233d4687af2d241ddcb572da969e8989 ]
The LE and ECRED response handlers match channels by identifier without
checking whether they sent the request. An incoming channel stores the
identifier chosen by the peer, so an unsolicited response can bypass
deferred setup, delete an established channel, or leave an unaccepted
socket and channel allocated after l2cap_chan_del().
Extend the BR/EDR lookup from commit a518b9a9ef6e ("Bluetooth: L2CAP:
Only accept connection responses to outstanding requests") to LE.
Require the matching connect-request flag and add a reconfigure-request
flag. Check reconfigure identifiers under the channel lock, since
BT_RCVMTU can replace a request without the connection lock. Match all
members of a rejected ECRED request, which share one identifier.
A reconfigure request can outlive close(). Complete it even in
BT_DISCONN, and call the close callback after deletion to release an
orphaned socket. Otherwise deletion cancels the timer and removes the
channel before the disconnect response or the channel timeout can close
it.
AI assistance was used.
Fixes: f1496dee9cbd ("Bluetooth: Add initial code for LE L2CAP Connect Request")
Fixes: 71fb419724fa ("Bluetooth: Fix handling of L2CAP Command Reject over LE")
Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
Cc: <stable@vger.kernel.org> # 5.7.x: a518b9a9ef6e: Bluetooth: L2CAP: Only accept connection responses to outstanding requests
Cc: <stable@vger.kernel.org> # 5.7.x
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Dropped the __must_hold(&conn->lock) annotations and lockdep_assert_held() calls, and adjusted context in the l2cap_chan_lock and hold lines, because the older tree lacks them. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/l2cap.h | 1 +
net/bluetooth/l2cap_core.c | 78 +++++++++++++++++------------------
2 files changed, 40 insertions(+), 39 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d56db97d45c5d..89b8af8d3e0a7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -752,6 +752,7 @@ enum {
FLAG_DEFER_SETUP,
FLAG_LE_CONN_REQ_SENT,
FLAG_ECRED_CONN_REQ_SENT,
+ FLAG_ECRED_RECONF_REQ_SENT,
FLAG_PENDING_SECURITY,
FLAG_HOLD_HCI_CONN,
FLAG_DEL,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index eef49a65084b4..d03a20b87287b 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -149,23 +149,12 @@ static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
return c;
}
-static struct l2cap_chan *__l2cap_get_chan_by_ident(struct l2cap_conn *conn,
- u8 ident)
-{
- struct l2cap_chan *c;
-
- list_for_each_entry(c, &conn->chan_l, list) {
- if (c->ident == ident)
- return c;
- }
- return NULL;
-}
-
/* Our connection request has been sent and is still outstanding */
static bool l2cap_chan_connect_pending(struct l2cap_chan *chan)
{
return chan->state == BT_CONNECT &&
- test_bit(CONF_CONNECT_PEND, &chan->conf_state);
+ (test_bit(CONF_CONNECT_PEND, &chan->conf_state) ||
+ test_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags));
}
/* Other channels may hold the same ident for a response they still have
@@ -177,7 +166,7 @@ static struct l2cap_chan *__l2cap_get_connect_chan_by_ident(struct l2cap_conn *c
struct l2cap_chan *c;
list_for_each_entry(c, &conn->chan_l, list) {
- if (c->ident == ident && l2cap_chan_connect_pending(c))
+ if (l2cap_chan_connect_pending(c) && c->ident == ident)
return c;
}
return NULL;
@@ -4919,7 +4908,7 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
BT_DBG("dcid 0x%4.4x mtu %u mps %u credits %u result 0x%2.2x",
dcid, mtu, mps, credits, result);
- chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
+ chan = __l2cap_get_connect_chan_by_ident(conn, cmd->ident);
if (!chan)
return -EBADSLT;
@@ -5454,9 +5443,10 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,
struct l2cap_chan *orig;
u16 dcid;
- if (chan->ident != cmd->ident ||
+ if (chan->state != BT_CONNECT ||
chan->mode != L2CAP_MODE_EXT_FLOWCTL ||
- chan->state == BT_CONNECTED)
+ !test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags) ||
+ chan->ident != cmd->ident)
continue;
l2cap_chan_hold(chan);
@@ -5671,23 +5661,24 @@ static inline int l2cap_ecred_reconf_rsp(struct l2cap_conn *conn,
BT_DBG("result 0x%4.4x", result);
- if (!result) {
- list_for_each_entry(chan, &conn->chan_l, list) {
- if (chan->ident == cmd->ident)
- chan->ident = 0;
- }
- return 0;
- }
-
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
- if (chan->ident != cmd->ident)
+ /* Reconfiguration updates ident with only chan->lock held. */
+ if (data_race(READ_ONCE(chan->ident)) != cmd->ident)
continue;
if (!l2cap_chan_hold_unless_zero(chan))
continue;
l2cap_chan_lock(chan);
- l2cap_chan_del(chan, ECONNRESET);
+ if (chan->ident == cmd->ident &&
+ test_and_clear_bit(FLAG_ECRED_RECONF_REQ_SENT, &chan->flags)) {
+ if (result) {
+ l2cap_chan_del(chan, ECONNRESET);
+ chan->ops->close(chan);
+ } else {
+ chan->ident = 0;
+ }
+ }
l2cap_chan_unlock(chan);
l2cap_chan_put(chan);
@@ -5701,25 +5692,33 @@ static inline int l2cap_le_command_rej(struct l2cap_conn *conn,
u8 *data)
{
struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data;
- struct l2cap_chan *chan;
+ struct l2cap_chan *chan, *tmp;
if (cmd_len < sizeof(*rej))
return -EPROTO;
- chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
- if (!chan)
- goto done;
+ list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
+ /* Reconfiguration updates ident with only chan->lock held. */
+ if (data_race(READ_ONCE(chan->ident)) != cmd->ident)
+ continue;
- chan = l2cap_chan_hold_unless_zero(chan);
- if (!chan)
- goto done;
+ if (!l2cap_chan_hold_unless_zero(chan))
+ continue;
- l2cap_chan_lock(chan);
- l2cap_chan_del(chan, ECONNREFUSED);
- l2cap_chan_unlock(chan);
- l2cap_chan_put(chan);
+ l2cap_chan_lock(chan);
+ if (chan->ident == cmd->ident &&
+ ((chan->state == BT_CONNECT &&
+ (test_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags) ||
+ test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags))) ||
+ test_bit(FLAG_ECRED_RECONF_REQ_SENT, &chan->flags))) {
+ l2cap_chan_del(chan, ECONNREFUSED);
+ chan->ops->close(chan);
+ }
+
+ l2cap_chan_unlock(chan);
+ l2cap_chan_put(chan);
+ }
-done:
return 0;
}
@@ -7558,6 +7557,7 @@ static void l2cap_ecred_reconfigure(struct l2cap_chan *chan)
pdu->scid[0] = cpu_to_le16(chan->scid);
chan->ident = l2cap_get_ident(conn);
+ set_bit(FLAG_ECRED_RECONF_REQ_SENT, &chan->flags);
l2cap_send_cmd(conn, chan->ident, L2CAP_ECRED_RECONF_REQ,
struct_size(pdu, scid, 1), pdu);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 073/703] spi: tegra210-quad: Refactor error handling into helper functions
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (71 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 072/703] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 074/703] spi: tegra210-quad: Check hardware status on timeout Greg Kroah-Hartman
` (334 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vishwaroop A, Thierry Reding,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <va@nvidia.com>
[ Upstream commit 6022eacdda8b0b06a2e1d4122e5268099b62ff5d ]
Extract common cleanup code into dedicated helper functions to simplify
the code and improve readability. This refactoring includes:
- tegra_qspi_reset(): Device reset and interrupt cleanup
- tegra_qspi_dma_stop(): DMA termination and disable
- tegra_qspi_pio_stop(): PIO mode disable
No functional changes. This is purely a code reorganization to prepare
for improved timeout handling in subsequent patches.
Signed-off-by: Vishwaroop A <va@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20251028155703.4151791-3-va@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: d04ad85dd801 ("spi: tegra210-quad: Unmap DMA buffers on transfer timeout")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-tegra210-quad.c | 84 +++++++++++++++++----------------
1 file changed, 44 insertions(+), 40 deletions(-)
diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index b91d0131acc51..a7f8fef7d8256 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -1048,17 +1048,22 @@ static void tegra_qspi_dump_regs(struct tegra_qspi *tqspi)
tegra_qspi_readl(tqspi, QSPI_FIFO_STATUS));
}
-static void tegra_qspi_handle_error(struct tegra_qspi *tqspi)
+static void tegra_qspi_reset(struct tegra_qspi *tqspi)
{
- dev_err(tqspi->dev, "error in transfer, fifo status 0x%08x\n", tqspi->status_reg);
- tegra_qspi_dump_regs(tqspi);
- tegra_qspi_flush_fifos(tqspi, true);
if (device_reset(tqspi->dev) < 0) {
dev_warn_once(tqspi->dev, "device reset failed\n");
tegra_qspi_mask_clear_irq(tqspi);
}
}
+static void tegra_qspi_handle_error(struct tegra_qspi *tqspi)
+{
+ dev_err(tqspi->dev, "error in transfer, fifo status 0x%08x\n", tqspi->status_reg);
+ tegra_qspi_dump_regs(tqspi);
+ tegra_qspi_flush_fifos(tqspi, true);
+ tegra_qspi_reset(tqspi);
+}
+
static void tegra_qspi_transfer_end(struct spi_device *spi)
{
struct tegra_qspi *tqspi = spi_controller_get_devdata(spi->controller);
@@ -1103,6 +1108,30 @@ static u32 tegra_qspi_addr_config(bool is_ddr, u8 bus_width, u8 len)
return addr_config;
}
+static void tegra_qspi_dma_stop(struct tegra_qspi *tqspi)
+{
+ u32 value;
+
+ if ((tqspi->cur_direction & DATA_DIR_TX) && tqspi->tx_dma_chan)
+ dmaengine_terminate_all(tqspi->tx_dma_chan);
+
+ if ((tqspi->cur_direction & DATA_DIR_RX) && tqspi->rx_dma_chan)
+ dmaengine_terminate_all(tqspi->rx_dma_chan);
+
+ value = tegra_qspi_readl(tqspi, QSPI_DMA_CTL);
+ value &= ~QSPI_DMA_EN;
+ tegra_qspi_writel(tqspi, value, QSPI_DMA_CTL);
+}
+
+static void tegra_qspi_pio_stop(struct tegra_qspi *tqspi)
+{
+ u32 value;
+
+ value = tegra_qspi_readl(tqspi, QSPI_COMMAND1);
+ value &= ~QSPI_PIO;
+ tegra_qspi_writel(tqspi, value, QSPI_COMMAND1);
+}
+
static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
struct spi_message *msg)
{
@@ -1110,7 +1139,7 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
struct spi_transfer *xfer;
struct spi_device *spi = msg->spi;
u8 transfer_phase = 0;
- u32 cmd1 = 0, dma_ctl = 0;
+ u32 cmd1 = 0;
int ret = 0;
u32 address_value = 0;
u32 cmd_config = 0, addr_config = 0;
@@ -1180,39 +1209,16 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
if (WARN_ON_ONCE(ret == 0)) {
dev_err_ratelimited(tqspi->dev,
"QSPI Transfer failed with timeout\n");
- if (tqspi->is_curr_dma_xfer) {
- if ((tqspi->cur_direction & DATA_DIR_TX) &&
- tqspi->tx_dma_chan)
- dmaengine_terminate_all(tqspi->tx_dma_chan);
- if ((tqspi->cur_direction & DATA_DIR_RX) &&
- tqspi->rx_dma_chan)
- dmaengine_terminate_all(tqspi->rx_dma_chan);
- }
/* Abort transfer by resetting pio/dma bit */
- if (!tqspi->is_curr_dma_xfer) {
- cmd1 = tegra_qspi_readl
- (tqspi,
- QSPI_COMMAND1);
- cmd1 &= ~QSPI_PIO;
- tegra_qspi_writel
- (tqspi, cmd1,
- QSPI_COMMAND1);
- } else {
- dma_ctl = tegra_qspi_readl
- (tqspi,
- QSPI_DMA_CTL);
- dma_ctl &= ~QSPI_DMA_EN;
- tegra_qspi_writel(tqspi, dma_ctl,
- QSPI_DMA_CTL);
- }
+ if (tqspi->is_curr_dma_xfer)
+ tegra_qspi_dma_stop(tqspi);
+ else
+ tegra_qspi_pio_stop(tqspi);
/* Reset controller if timeout happens */
- if (device_reset(tqspi->dev) < 0) {
- dev_warn_once(tqspi->dev,
- "device reset failed\n");
- tegra_qspi_mask_clear_irq(tqspi);
- }
+ tegra_qspi_reset(tqspi);
+
ret = -EIO;
goto exit;
}
@@ -1311,12 +1317,10 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
QSPI_DMA_TIMEOUT);
if (WARN_ON(ret == 0)) {
dev_err(tqspi->dev, "transfer timeout\n");
- if (tqspi->is_curr_dma_xfer) {
- if ((tqspi->cur_direction & DATA_DIR_TX) && tqspi->tx_dma_chan)
- dmaengine_terminate_all(tqspi->tx_dma_chan);
- if ((tqspi->cur_direction & DATA_DIR_RX) && tqspi->rx_dma_chan)
- dmaengine_terminate_all(tqspi->rx_dma_chan);
- }
+
+ if (tqspi->is_curr_dma_xfer)
+ tegra_qspi_dma_stop(tqspi);
+
tegra_qspi_handle_error(tqspi);
ret = -EIO;
goto complete_xfer;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 074/703] spi: tegra210-quad: Check hardware status on timeout
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (72 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 073/703] spi: tegra210-quad: Refactor error handling into helper functions Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 075/703] spi: tegra210-quad: Unmap DMA buffers on transfer timeout Greg Kroah-Hartman
` (333 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vishwaroop A, Thierry Reding,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <va@nvidia.com>
[ Upstream commit 380fd29d57abe6679d87ec56babe65ddc5873a37 ]
Under high system load, QSPI interrupts can be delayed or blocked on the
target CPU, causing wait_for_completion_timeout() to report failure even
though the hardware successfully completed the transfer.
When a timeout occurs, check the QSPI_RDY bit in QSPI_TRANS_STATUS to
determine if the hardware actually completed the transfer. If so, manually
invoke the completion handler to process the transfer successfully instead
of failing it.
This distinguishes lost/delayed interrupts from real hardware timeouts,
preventing unnecessary failures of transfers that completed successfully.
Signed-off-by: Vishwaroop A <va@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20251028155703.4151791-4-va@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: d04ad85dd801 ("spi: tegra210-quad: Unmap DMA buffers on transfer timeout")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-tegra210-quad.c | 100 +++++++++++++++++++++++++-------
1 file changed, 80 insertions(+), 20 deletions(-)
diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index a7f8fef7d8256..8caf17a32e397 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -1077,6 +1077,49 @@ static void tegra_qspi_transfer_end(struct spi_device *spi)
tegra_qspi_writel(tqspi, tqspi->def_command1_reg, QSPI_COMMAND1);
}
+static irqreturn_t handle_cpu_based_xfer(struct tegra_qspi *tqspi);
+static irqreturn_t handle_dma_based_xfer(struct tegra_qspi *tqspi);
+
+/**
+ * tegra_qspi_handle_timeout - Handle transfer timeout with hardware check
+ * @tqspi: QSPI controller instance
+ *
+ * When a timeout occurs but hardware has completed the transfer (interrupt
+ * was lost or delayed), manually trigger transfer completion processing.
+ * This avoids failing transfers that actually succeeded.
+ *
+ * Returns: 0 if transfer was completed, -ETIMEDOUT if real timeout
+ */
+static int tegra_qspi_handle_timeout(struct tegra_qspi *tqspi)
+{
+ irqreturn_t ret;
+ u32 status;
+
+ /* Check if hardware actually completed the transfer */
+ status = tegra_qspi_readl(tqspi, QSPI_TRANS_STATUS);
+ if (!(status & QSPI_RDY))
+ return -ETIMEDOUT;
+
+ /*
+ * Hardware completed but interrupt was lost/delayed. Manually
+ * process the completion by calling the appropriate handler.
+ */
+ dev_warn_ratelimited(tqspi->dev,
+ "QSPI interrupt timeout, but transfer complete\n");
+
+ /* Clear the transfer status */
+ status = tegra_qspi_readl(tqspi, QSPI_TRANS_STATUS);
+ tegra_qspi_writel(tqspi, status, QSPI_TRANS_STATUS);
+
+ /* Manually trigger completion handler */
+ if (!tqspi->is_curr_dma_xfer)
+ ret = handle_cpu_based_xfer(tqspi);
+ else
+ ret = handle_dma_based_xfer(tqspi);
+
+ return (ret == IRQ_HANDLED) ? 0 : -EIO;
+}
+
static u32 tegra_qspi_cmd_config(bool is_ddr, u8 bus_width, u8 len)
{
u32 cmd_config = 0;
@@ -1207,20 +1250,28 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
QSPI_DMA_TIMEOUT);
if (WARN_ON_ONCE(ret == 0)) {
- dev_err_ratelimited(tqspi->dev,
- "QSPI Transfer failed with timeout\n");
-
- /* Abort transfer by resetting pio/dma bit */
- if (tqspi->is_curr_dma_xfer)
- tegra_qspi_dma_stop(tqspi);
- else
- tegra_qspi_pio_stop(tqspi);
-
- /* Reset controller if timeout happens */
- tegra_qspi_reset(tqspi);
-
- ret = -EIO;
- goto exit;
+ /*
+ * Check if hardware completed the transfer
+ * even though interrupt was lost or delayed.
+ * If so, process the completion and continue.
+ */
+ ret = tegra_qspi_handle_timeout(tqspi);
+ if (ret < 0) {
+ /* Real timeout - clean up and fail */
+ dev_err(tqspi->dev, "transfer timeout\n");
+
+ /* Abort transfer by resetting pio/dma bit */
+ if (tqspi->is_curr_dma_xfer)
+ tegra_qspi_dma_stop(tqspi);
+ else
+ tegra_qspi_pio_stop(tqspi);
+
+ /* Reset controller if timeout happens */
+ tegra_qspi_reset(tqspi);
+
+ ret = -EIO;
+ goto exit;
+ }
}
if (tqspi->tx_status || tqspi->rx_status) {
@@ -1316,14 +1367,23 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
ret = wait_for_completion_timeout(&tqspi->xfer_completion,
QSPI_DMA_TIMEOUT);
if (WARN_ON(ret == 0)) {
- dev_err(tqspi->dev, "transfer timeout\n");
+ /*
+ * Check if hardware completed the transfer even though
+ * interrupt was lost or delayed. If so, process the
+ * completion and continue.
+ */
+ ret = tegra_qspi_handle_timeout(tqspi);
+ if (ret < 0) {
+ /* Real timeout - clean up and fail */
+ dev_err(tqspi->dev, "transfer timeout\n");
- if (tqspi->is_curr_dma_xfer)
- tegra_qspi_dma_stop(tqspi);
+ if (tqspi->is_curr_dma_xfer)
+ tegra_qspi_dma_stop(tqspi);
- tegra_qspi_handle_error(tqspi);
- ret = -EIO;
- goto complete_xfer;
+ tegra_qspi_handle_error(tqspi);
+ ret = -EIO;
+ goto complete_xfer;
+ }
}
if (tqspi->tx_status || tqspi->rx_status) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 075/703] spi: tegra210-quad: Unmap DMA buffers on transfer timeout
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (73 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 074/703] spi: tegra210-quad: Check hardware status on timeout Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 076/703] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online() Greg Kroah-Hartman
` (332 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vishwaroop A, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <va@nvidia.com>
[ Upstream commit d04ad85dd8015713b0b2531b5b934fe67828d741 ]
tegra_qspi_start_dma_based_transfer() maps the client TX/RX buffers with
dma_map_single() via tegra_qspi_dma_map_xfer(). The matching unmap only
happens in handle_dma_based_xfer(), which runs from the interrupt bottom
half.
When wait_for_completion_timeout() expires and tegra_qspi_handle_timeout()
cannot establish that the hardware finished, it returns an error without
the bottom half ever having run. Both transfer paths then abort the
transfer with tegra_qspi_dma_stop(), reset the controller and clear
curr_xfer, but never unmap the buffers. Every genuine transfer timeout
therefore leaks the streaming DMA mappings for that chunk, which
gradually exhausts the IOVA space on systems with an IOMMU in front of
QSPI.
Unmap the transfer after stopping DMA on both timeout error paths. The
unmap is placed after tegra_qspi_dma_stop() so the DMA engine is
quiesced before the mappings go away.
The recovery paths that do reach handle_dma_based_xfer() unmap there
themselves. The preceding patch makes tegra_qspi_dma_unmap_xfer() a no-op
once the mapping is released, so this cleanup cannot unmap twice or run
against a chunk that was never mapped.
Fixes: 921fc1838fb0 ("spi: tegra210-quad: Add support for Tegra210 QSPI controller")
Cc: stable@vger.kernel.org # with "spi: tegra210-quad: Track DMA mapping state"
Signed-off-by: Vishwaroop A <va@nvidia.com>
Link: https://patch.msgid.link/20261026111412.3843954-4-va@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-tegra210-quad.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index 8caf17a32e397..1b28dcce8372e 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -1261,10 +1261,12 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
dev_err(tqspi->dev, "transfer timeout\n");
/* Abort transfer by resetting pio/dma bit */
- if (tqspi->is_curr_dma_xfer)
+ if (tqspi->is_curr_dma_xfer) {
tegra_qspi_dma_stop(tqspi);
- else
+ tegra_qspi_dma_unmap_xfer(tqspi, xfer);
+ } else {
tegra_qspi_pio_stop(tqspi);
+ }
/* Reset controller if timeout happens */
tegra_qspi_reset(tqspi);
@@ -1377,8 +1379,10 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
/* Real timeout - clean up and fail */
dev_err(tqspi->dev, "transfer timeout\n");
- if (tqspi->is_curr_dma_xfer)
+ if (tqspi->is_curr_dma_xfer) {
tegra_qspi_dma_stop(tqspi);
+ tegra_qspi_dma_unmap_xfer(tqspi, xfer);
+ }
tegra_qspi_handle_error(tqspi);
ret = -EIO;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 076/703] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (74 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 075/703] spi: tegra210-quad: Unmap DMA buffers on transfer timeout Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 077/703] Bluetooth: l2cap: defer conn param update to avoid conn->lock/hdev->lock inversion Greg Kroah-Hartman
` (331 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tejun Heo, Andrea Righi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <tj@kernel.org>
[ Upstream commit 2227a34ff7bfcf6112931039e3554f4b70b65ab9 ]
ops.cpu_online() documents that the cpu doesn't call ops.enqueue() or
ops.dispatch() before that op. Both are gated on SCX_RQ_ONLINE, which
follows the core's rq online state through the ext class's rq_online and
rq_offline hooks. On a runtime cpu up, sched_cpu_activate() runs:
1. set_cpu_active() marks the cpu active.
2. cpuset_cpu_active() rebuilds the sched domains synchronously, and
rq_attach_root() puts the rq online as the cpu is active now. The
rq_online hook sets SCX_RQ_ONLINE.
3. scx_rq_activate() calls the root's ops.cpu_online().
Between 2 and 3, ops.enqueue() can be called for tasks woken or migrated
onto the cpu, and ops.dispatch() can run on it.
The hooks can't call the ops. They run under the rq lock with IRQs off while
the ops can be sleepable BPF programs, and handle_hotplug() needs the
rebuilt sched domains for its idle topology update.
Track SCX_RQ_ONLINE in handle_hotplug() alone. Set it right after the root's
ops.cpu_online(). Clear it and move the cpu's tasks to its local DSQ when
the cpu goes down. Sched domain rebuilds, which take a live cpu's rq offline
and online again, no longer touch the flag, so a remote dispatch can't see
it cleared by a rebuild and bounce to the global DSQ.
Between 2 and 3, tasks that land on the cpu now go to its local DSQ without
ops.enqueue(), and with sub-schedulers a task whose scheduler lacks caps on
the cpu is admitted anyway and counted in SCX_EV_SUB_FORCED_ADMIT. Both
already happen between 1 and 2.
Fixes: 60c27fb59f6c ("sched_ext: Implement sched_ext_ops.cpu_online/offline()")
Cc: stable@vger.kernel.org # v6.12+
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
[ sashal: Inlined the drain loop into handle_hotplug() since drain_offline_rq() doesn't exist here, and dropped the sub-scheduler, ecaps and rescue-flush parts and the path split into ext/ files. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/ext.c | 84 ++++++++++++++++++++++++--------------------
kernel/sched/sched.h | 9 ++---
2 files changed, 50 insertions(+), 43 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 64a68d698b823..855a49c14142f 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -1244,11 +1244,11 @@ static void direct_dispatch(struct scx_sched *sch, struct task_struct *p,
static bool scx_rq_online(struct rq *rq)
{
/*
- * Test both cpu_active() and %SCX_RQ_ONLINE. %SCX_RQ_ONLINE indicates
- * the online state as seen from the BPF scheduler. cpu_active() test
- * guarantees that, if this function returns %true, %SCX_RQ_ONLINE will
- * stay set until the current scheduling operation is complete even if
- * we aren't locking @rq.
+ * Test both cpu_active() and %SCX_RQ_ONLINE. %SCX_RQ_ONLINE is set
+ * after the root's ops.cpu_online() and cleared when the cpu goes down.
+ * cpu_active() test guarantees that, if this function returns %true,
+ * %SCX_RQ_ONLINE will stay set until the current scheduling operation
+ * is complete even if we aren't locking @rq.
*/
return likely((rq->scx.flags & SCX_RQ_ONLINE) && cpu_active(cpu_of(rq)));
}
@@ -1369,7 +1369,7 @@ static void set_task_runnable(struct rq *rq, struct task_struct *p)
}
/*
- * list_add_tail() must be used. scx_bypass() and rq_offline_scx()
+ * list_add_tail() must be used. scx_bypass() and handle_hotplug()
* depend on tasks being appended to the runnable_list.
*/
list_add_tail(&p->scx.runnable_node, &rq->scx.runnable_list);
@@ -2154,7 +2154,7 @@ static int balance_one(struct rq *rq, struct task_struct *prev)
/*
* scx_rq_online() can't be used. Its cpu_active() test goes false
* before CPU hotplug waits for an RCU grace period, and
- * rq_offline_scx() moves this CPU's tasks to the local DSQ only after
+ * handle_hotplug() moves this CPU's tasks to the local DSQ only after
* the wait. The grace period can depend on those tasks running.
*/
if (unlikely(!SCX_HAS_OP(sch, dispatch)) ||
@@ -2655,6 +2655,25 @@ static void handle_hotplug(struct rq *rq, bool online)
struct scx_sched *sch = scx_root;
int cpu = cpu_of(rq);
+ if (!online) {
+ struct task_struct *p, *n;
+
+ guard(rq_lock_irqsave)(rq);
+ update_rq_clock(rq);
+ rq->scx.flags &= ~SCX_RQ_ONLINE;
+
+ /*
+ * An offline CPU no longer calls ops.dispatch(). Re-enqueue its
+ * tasks onto the local DSQ so that they run here and
+ * balance_push() moves them off.
+ */
+ list_for_each_entry_safe_reverse(p, n, &rq->scx.runnable_list, scx.runnable_node) {
+ if (p->scx.dsq == &rq->scx.local_dsq)
+ continue;
+ guard(sched_change)(p, DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK);
+ }
+ }
+
atomic_long_inc(&scx_hotplug_seq);
/*
@@ -2662,8 +2681,14 @@ static void handle_hotplug(struct rq *rq, bool online)
* stable here. Note that we can't depend on scx_enabled() test as the
* hotplug ops need to be enabled before __scx_enabled is set.
*/
- if (unlikely(!sch))
+ if (unlikely(!sch)) {
+ /* no root to notify, set %SCX_RQ_ONLINE right away */
+ if (online) {
+ guard(rq_lock_irqsave)(rq);
+ rq->scx.flags |= SCX_RQ_ONLINE;
+ }
return;
+ }
if (scx_enabled())
scx_idle_update_selcpu_topology(&sch->ops);
@@ -2677,6 +2702,18 @@ static void handle_hotplug(struct rq *rq, bool online)
SCX_ECODE_ACT_RESTART | SCX_ECODE_RSN_HOTPLUG,
"cpu %d going %s, exiting scheduler", cpu,
online ? "online" : "offline");
+
+ if (online) {
+ /*
+ * The cpu must not call ops.enqueue() or ops.dispatch() before
+ * the root's ops.cpu_online(). The core's rq online state can't
+ * gate them, as the sched domain rebuild in
+ * sched_cpu_activate() can put @rq online before this function
+ * runs. Set %SCX_RQ_ONLINE here.
+ */
+ guard(rq_lock_irqsave)(rq);
+ rq->scx.flags |= SCX_RQ_ONLINE;
+ }
}
void scx_rq_activate(struct rq *rq)
@@ -2689,34 +2726,6 @@ void scx_rq_deactivate(struct rq *rq)
handle_hotplug(rq, false);
}
-static void rq_online_scx(struct rq *rq)
-{
- rq->scx.flags |= SCX_RQ_ONLINE;
-}
-
-static void rq_offline_scx(struct rq *rq)
-{
- struct task_struct *p, *n;
-
- rq->scx.flags &= ~SCX_RQ_ONLINE;
-
- /* sched domain rebuilds call rq_offline with the CPU staying alive */
- if (cpu_active(cpu_of(rq)))
- return;
-
- /*
- * An offline CPU no longer calls ops.dispatch(). Re-enqueue its tasks
- * onto the local DSQ so that they run here and balance_push() moves
- * them off.
- */
- list_for_each_entry_safe_reverse(p, n, &rq->scx.runnable_list, scx.runnable_node) {
- if (p->scx.dsq == &rq->scx.local_dsq)
- continue;
- guard(sched_change)(p, DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK);
- }
-}
-
-
static bool check_rq_for_timeouts(struct rq *rq)
{
struct scx_sched *sch;
@@ -3438,9 +3447,6 @@ DEFINE_SCHED_CLASS(ext) = {
.task_woken = task_woken_scx,
.set_cpus_allowed = set_cpus_allowed_scx,
- .rq_online = rq_online_scx,
- .rq_offline = rq_offline_scx,
-
.task_tick = task_tick_scx,
.switching_to = switching_to_scx,
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index ea470cc608d51..834ef37212b8c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -773,9 +773,10 @@ struct cfs_rq {
/* scx_rq->flags, protected by the rq lock */
enum scx_rq_flags {
/*
- * A hotplugged CPU starts scheduling before rq_online_scx(). Track
- * ops.cpu_on/offline() state so that ops.enqueue/dispatch() are called
- * only while the BPF scheduler considers the CPU to be online.
+ * Set right after the root's ops.cpu_online() when a CPU comes up and
+ * cleared when the CPU goes down, see handle_hotplug(). A hotplugged
+ * CPU starts scheduling before %SCX_RQ_ONLINE is set. ops.enqueue() and
+ * ops.dispatch() are called for the CPU only while the flag is set.
*/
SCX_RQ_ONLINE = 1 << 0,
SCX_RQ_CAN_STOP_TICK = 1 << 1,
@@ -3944,7 +3945,7 @@ extern void balance_callbacks(struct rq *rq, struct balance_callback *head);
* Typically this must be called while holding task_rq_lock, since most/all
* properties are serialized under those locks. There are currently two
* exceptions to this rule in sched/ext which only hold rq->lock: scx_bypass()
- * and rq_offline_scx().
+ * and handle_hotplug().
*/
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 077/703] Bluetooth: l2cap: defer conn param update to avoid conn->lock/hdev->lock inversion
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (75 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 076/703] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 078/703] Revert "mm/hugetlb_vmemmap: fix incorrect vmemmap restore in rollback" Greg Kroah-Hartman
` (330 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mikhail Gavrilov, Paul Menzel,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
[ Upstream commit 91b5a598b5285da794b72619f31777b62dd336f8 ]
When a BLE peripheral sends an L2CAP Connection Parameter Update Request
the processing path is:
process_pending_rx() [takes conn->lock]
l2cap_le_sig_channel()
l2cap_conn_param_update_req()
hci_le_conn_update() [takes hdev->lock]
Meanwhile other code paths take the locks in the opposite order:
l2cap_chan_connect() [takes hdev->lock]
...
mutex_lock(&conn->lock)
l2cap_conn_ready() [hdev->lock via hci_cb_list_lock]
...
mutex_lock(&conn->lock)
This is a classic AB/BA deadlock which lockdep reports as a circular
locking dependency when connecting a BLE MIDI keyboard (Carry-On FC-49).
Fix this by making hci_le_conn_update() defer the HCI command through
hci_cmd_sync_queue() so it no longer needs to take hdev->lock in the
caller context. The sync callback uses __hci_cmd_sync_status_sk() to
wait for the HCI_EV_LE_CONN_UPDATE_COMPLETE event, then updates the
stored connection parameters (hci_conn_params) and notifies userspace
(mgmt_new_conn_param) only after the controller has confirmed the update.
A reference on hci_conn is held via hci_conn_get()/hci_conn_put() for
the lifetime of the queued work to prevent use-after-free, and
hci_conn_valid() is checked before proceeding in case the connection was
removed while the work was pending. The hci_dev_lock is held across
hci_conn_valid() and all conn field accesses to prevent a concurrent
disconnect from invalidating the connection mid-use.
Fixes: f044eb0524a0 ("Bluetooth: Store latency and supervision timeout in connection params")
Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/hci_core.h | 2 +-
net/bluetooth/hci_conn.c | 105 +++++++++++++++++++++++++------
net/bluetooth/l2cap_core.c | 12 +---
3 files changed, 89 insertions(+), 30 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d244fd50345ec..7642508c7ac24 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -2480,7 +2480,7 @@ void mgmt_adv_monitor_device_lost(struct hci_dev *hdev, u16 handle,
bdaddr_t *bdaddr, u8 addr_type);
int hci_abort_conn(struct hci_conn *conn, u8 reason);
-u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
+void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
u16 to_multiplier);
void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
__u8 ltk[16], __u8 key_size);
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 29e13da009505..706699071368a 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -504,40 +504,107 @@ bool hci_setup_sync(struct hci_conn *conn, __u16 handle)
return hci_setup_sync_conn(conn, handle);
}
-u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
- u16 to_multiplier)
+struct le_conn_update_data {
+ struct hci_conn *conn;
+ u16 min;
+ u16 max;
+ u16 latency;
+ u16 to_multiplier;
+};
+
+static int le_conn_update_sync(struct hci_dev *hdev, void *data)
{
- struct hci_dev *hdev = conn->hdev;
+ struct le_conn_update_data *d = data;
+ struct hci_conn *conn = d->conn;
struct hci_conn_params *params;
struct hci_cp_le_conn_update cp;
+ u16 timeout;
+ u8 store_hint;
+ int err;
+ /* Verify connection is still alive and read conn fields under
+ * the same lock to prevent a concurrent disconnect from freeing
+ * or reusing the connection while we build the HCI command.
+ */
hci_dev_lock(hdev);
- params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
- if (params) {
- params->conn_min_interval = min;
- params->conn_max_interval = max;
- params->conn_latency = latency;
- params->supervision_timeout = to_multiplier;
+ if (!hci_conn_valid(hdev, conn)) {
+ hci_dev_unlock(hdev);
+ return -ECANCELED;
}
- hci_dev_unlock(hdev);
-
memset(&cp, 0, sizeof(cp));
cp.handle = cpu_to_le16(conn->handle);
- cp.conn_interval_min = cpu_to_le16(min);
- cp.conn_interval_max = cpu_to_le16(max);
- cp.conn_latency = cpu_to_le16(latency);
- cp.supervision_timeout = cpu_to_le16(to_multiplier);
+ cp.conn_interval_min = cpu_to_le16(d->min);
+ cp.conn_interval_max = cpu_to_le16(d->max);
+ cp.conn_latency = cpu_to_le16(d->latency);
+ cp.supervision_timeout = cpu_to_le16(d->to_multiplier);
cp.min_ce_len = cpu_to_le16(0x0000);
cp.max_ce_len = cpu_to_le16(0x0000);
+ timeout = conn->conn_timeout;
+
+ hci_dev_unlock(hdev);
+
+ err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_CONN_UPDATE,
+ sizeof(cp), &cp,
+ HCI_EV_LE_CONN_UPDATE_COMPLETE,
+ timeout, NULL);
+ if (err)
+ return err;
+
+ /* Update stored connection parameters after the controller has
+ * confirmed the update via the LE Connection Update Complete event.
+ */
+ hci_dev_lock(hdev);
+
+ params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
+ if (params) {
+ params->conn_min_interval = d->min;
+ params->conn_max_interval = d->max;
+ params->conn_latency = d->latency;
+ params->supervision_timeout = d->to_multiplier;
+ store_hint = 0x01;
+ } else {
+ store_hint = 0x00;
+ }
- hci_send_cmd(hdev, HCI_OP_LE_CONN_UPDATE, sizeof(cp), &cp);
+ hci_dev_unlock(hdev);
- if (params)
- return 0x01;
+ mgmt_new_conn_param(hdev, &conn->dst, conn->dst_type, store_hint,
+ d->min, d->max, d->latency, d->to_multiplier);
- return 0x00;
+ return 0;
+}
+
+static void le_conn_update_complete(struct hci_dev *hdev, void *data, int err)
+{
+ struct le_conn_update_data *d = data;
+
+ hci_conn_put(d->conn);
+ kfree(d);
+}
+
+void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
+ u16 to_multiplier)
+{
+ struct le_conn_update_data *d;
+
+ d = kzalloc_obj(*d);
+ if (!d)
+ return;
+
+ hci_conn_get(conn);
+ d->conn = conn;
+ d->min = min;
+ d->max = max;
+ d->latency = latency;
+ d->to_multiplier = to_multiplier;
+
+ if (hci_cmd_sync_queue(conn->hdev, le_conn_update_sync, d,
+ le_conn_update_complete) < 0) {
+ hci_conn_put(conn);
+ kfree(d);
+ }
}
void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d03a20b87287b..801367941642d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4867,16 +4867,8 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_PARAM_UPDATE_RSP,
sizeof(rsp), &rsp);
- if (!err) {
- u8 store_hint;
-
- store_hint = hci_le_conn_update(hcon, min, max, latency,
- to_multiplier);
- mgmt_new_conn_param(hcon->hdev, &hcon->dst, hcon->dst_type,
- store_hint, min, max, latency,
- to_multiplier);
-
- }
+ if (!err)
+ hci_le_conn_update(hcon, min, max, latency, to_multiplier);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 078/703] Revert "mm/hugetlb_vmemmap: fix incorrect vmemmap restore in rollback"
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (76 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 077/703] Bluetooth: l2cap: defer conn param update to avoid conn->lock/hdev->lock inversion Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 079/703] dm cache: validate the discard block size before narrowing Greg Kroah-Hartman
` (329 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
This reverts commit d73f79d1a2c26a8cdf0558d9a0203ee64d9b4f51.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/hugetlb_vmemmap.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index efe4bcc85da2c..a39f9793df69a 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -207,8 +207,6 @@ static void vmemmap_remap_pte(pte_t *pte, unsigned long addr,
/* Remapping the head page requires r/w */
if (unlikely(walk->nr_walked == 0 && walk->vmemmap_head)) {
- VM_WARN_ON_ONCE(!PageHead((const struct page *)addr));
-
list_del(&walk->vmemmap_head->lru);
/*
@@ -220,8 +218,6 @@ static void vmemmap_remap_pte(pte_t *pte, unsigned long addr,
entry = mk_pte(walk->vmemmap_head, PAGE_KERNEL);
} else {
- VM_WARN_ON_ONCE(!PageTail((const struct page *)addr));
-
/*
* Remap the tail pages as read-only to catch illegal write
* operation to the tail pages.
@@ -236,28 +232,33 @@ static void vmemmap_remap_pte(pte_t *pte, unsigned long addr,
static void vmemmap_restore_pte(pte_t *pte, unsigned long addr,
struct vmemmap_remap_walk *walk)
{
- struct page *src = pte_page(ptep_get(pte)), *dst;
+ struct page *page;
+ struct page *from, *to;
+
+ page = list_first_entry(walk->vmemmap_pages, struct page, lru);
+ list_del(&page->lru);
/*
- * When rolling back vmemmap_remap_free(), keep the copied head page
- * mapping and restore only PTEs currently pointing at the shared tail
- * page.
+ * Initialize tail pages in the newly allocated vmemmap page.
+ *
+ * There is folio-scope metadata that is encoded in the first few
+ * tail pages.
+ *
+ * Use the value last tail page in the page with the head page
+ * to initialize the rest of tail pages.
*/
- if (walk->vmemmap_tail && walk->vmemmap_tail != src)
- return;
-
- VM_WARN_ON_ONCE(PageHead((const struct page *)addr));
-
- dst = list_first_entry(walk->vmemmap_pages, struct page, lru);
- list_del(&dst->lru);
- copy_page(page_to_virt(dst), page_to_virt(src));
+ from = compound_head((struct page *)addr) +
+ PAGE_SIZE / sizeof(struct page) - 1;
+ to = page_to_virt(page);
+ for (int i = 0; i < PAGE_SIZE / sizeof(struct page); i++, to++)
+ *to = *from;
/*
* Makes sure that preceding stores to the page contents become visible
* before the set_pte_at() write.
*/
smp_wmb();
- set_pte_at(&init_mm, addr, pte, mk_pte(dst, PAGE_KERNEL));
+ set_pte_at(&init_mm, addr, pte, mk_pte(page, PAGE_KERNEL));
}
/**
@@ -323,7 +324,6 @@ static int vmemmap_remap_free(unsigned long start, unsigned long end,
*/
walk = (struct vmemmap_remap_walk) {
.remap_pte = vmemmap_restore_pte,
- .vmemmap_tail = vmemmap_tail,
.vmemmap_pages = vmemmap_pages,
.flags = 0,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 079/703] dm cache: validate the discard block size before narrowing
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (77 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 078/703] Revert "mm/hugetlb_vmemmap: fix incorrect vmemmap restore in rollback" Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 080/703] dm: fix use-after-free when dm_get_device() widens the open mode Greg Kroah-Hartman
` (328 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+c8564fc0a96e3ecbe4d4,
Kirtikumar Anandrao Ramchandani, Mikulas Patocka, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
[ Upstream commit df8daa4d916c88ef7888c738e0eb3b6f11714a6f ]
The discard block size doubles until the origin fits within the discard
bitset limit. too_many_discard_blocks() passes this sector_t size to
sector_div(), whose divisor is only 32 bits. Once the size exceeds that
range, the division uses a truncated divisor, which can become zero.
Use a 64-bit divisor when checking the block count. The selected size is
stored in a u32, so reject sizes that cannot be represented before the
assignment and before calculating the bitset size. This prevents a
truncated zero size from reaching dm_sector_div_up().
An earlier proposal checks whether the mapped length exceeds the origin
device. This fix also covers an origin device whose valid size requires a
discard block size beyond the field's range.
Reported-by: syzbot+c8564fc0a96e3ecbe4d4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c8564fc0a96e3ecbe4d4
Cc: stable@vger.kernel.org
Fixes: 08b184514f65 ("dm cache: revert 'prevent corruption caused by discard_block_size > cache_block_size'")
Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
[ sashal: Adjusted the include context: added only #include <linux/math64.h> between init.h and mempool.h, since kstrtox.h isn't present in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-cache-target.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 663b1c0fa41d1..a7cb5bdbd5da1 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -16,6 +16,7 @@
#include <linux/dm-kcopyd.h>
#include <linux/jiffies.h>
#include <linux/init.h>
+#include <linux/math64.h>
#include <linux/mempool.h>
#include <linux/module.h>
#include <linux/rwsem.h>
@@ -2389,9 +2390,7 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca,
static bool too_many_discard_blocks(sector_t discard_block_size,
sector_t origin_size)
{
- (void) sector_div(origin_size, discard_block_size);
-
- return origin_size > MAX_DISCARD_BLOCKS;
+ return div64_u64(origin_size, discard_block_size) > MAX_DISCARD_BLOCKS;
}
static sector_t calculate_discard_block_size(sector_t cache_block_size,
@@ -2428,6 +2427,7 @@ static int cache_create(struct cache_args *ca, struct cache **result)
struct cache *cache;
struct dm_target *ti = ca->ti;
dm_block_t origin_blocks;
+ sector_t discard_block_size;
struct dm_cache_metadata *cmd;
bool may_format = ca->features.mode == CM_WRITE;
@@ -2527,9 +2527,15 @@ static int cache_create(struct cache_args *ca, struct cache **result)
}
clear_bitset(cache->dirty_bitset, from_cblock(cache->cache_size));
- cache->discard_block_size =
+ discard_block_size =
calculate_discard_block_size(cache->sectors_per_block,
cache->origin_sectors);
+ if (discard_block_size > U32_MAX) {
+ *error = "Discard block size exceeds 32 bits";
+ r = -EOVERFLOW;
+ goto bad;
+ }
+ cache->discard_block_size = discard_block_size;
cache->discard_nr_blocks = to_dblock(dm_sector_div_up(cache->origin_sectors,
cache->discard_block_size));
cache->discard_bitset = alloc_bitset(from_dblock(cache->discard_nr_blocks));
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 080/703] dm: fix use-after-free when dm_get_device() widens the open mode
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (78 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 079/703] dm cache: validate the discard block size before narrowing Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 081/703] iio: adc: ad7923: add the AD7927 to the SPI ID table Greg Kroah-Hartman
` (327 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ming Hung Tsai, Mikulas Patocka,
Sasha Levin, Claude Opus 5
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <mtsai@redhat.com>
[ Upstream commit c834161ded1a141a58d5f03b24f6894291222c96 ]
There's an UAF bug in dm_get_device(): when a table construction calls
dm_get_device() on the same device twice with widen access mode (e.g.,
read-only first then read-write), the second dm_get_device() calls
upgrade_mode(), which reopens the device in upgraded mode, making
previously returned dm_dev* a stale pointer.
Fixing approaches:
- Add per-mode views (dm_dev_ref) from a per-device dm_dev_internal to
multiple table_devices.
- Keep reusing the dm_dev_ref when the requested mode is included, i.e.,
a read-only reference can reuse the read-write opened device within a
table.
- Maintain a canonical block_device pointer in dm_dev_internal for
handling the DM_TABLE_DEPS ioctl.
Also tweak the way of mode sharing check in find_ref() to
"(x & mask) == mask". The result stays the same to the previous
upgrade_mode() guard "(x | mask) == x".
Pros: keep the relationship between dm_dev_internal and table_device:
one dm_dev_internal per device, regardless the mode, so the output of
DMM_TABLE_DEPS ioctl unchanged.
Cons: extra dm_dev_ref allocation.
Note that now the table_device's count not necessarily mean the number
tables referecing this <dev, mode> pair, since we're allowing multiple
references within a table.
Signed-off-by: Ming Hung Tsai <mtsai@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fixes: 86f1152b117a ("dm: allow active and inactive tables to share dm_devs")
Cc: stable@vger.kernel.org
[ sashal: Adapted upstream's plain returns in dm_get_device() and dm_put_device() to this tree's devices_lock rwsem handling, using goto unlock_ret_r and goto unlock_ret. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/dm-ioctl.c | 2 +-
drivers/md/dm-table.c | 142 +++++++++++++++++++++++-------------------
drivers/md/dm.c | 2 +-
drivers/md/dm.h | 18 +++++-
4 files changed, 97 insertions(+), 67 deletions(-)
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 4495489c488d5..ade31c4a0ead3 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1685,7 +1685,7 @@ static void retrieve_deps(struct dm_table *table,
deps->count = count;
count = 0;
list_for_each_entry(dd, dm_table_get_devices(table), list)
- deps->dev[count++] = huge_encode_dev(dd->dm_dev->bdev->bd_dev);
+ deps->dev[count++] = huge_encode_dev(dd->bdev->bd_dev);
param->data_size = param->data_start + needed;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 81265ed204b54..4f3973e76ed47 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -166,14 +166,16 @@ int dm_table_create(struct dm_table **result, blk_mode_t mode,
static void free_devices(struct list_head *devices, struct mapped_device *md)
{
- struct list_head *tmp, *next;
-
- list_for_each_safe(tmp, next, devices) {
- struct dm_dev_internal *dd =
- list_entry(tmp, struct dm_dev_internal, list);
- DMWARN("%s: dm_table_destroy: dm_put_device call missing for %s",
- dm_device_name(md), dd->dm_dev->name);
- dm_put_table_device(md, dd->dm_dev);
+ struct dm_dev_internal *dd, *dd_next;
+ struct dm_dev_ref *ref, *ref_next;
+
+ list_for_each_entry_safe(dd, dd_next, devices, list) {
+ list_for_each_entry_safe(ref, ref_next, &dd->refs, list) {
+ DMWARN("%s: dm_table_destroy: dm_put_device call missing for %s",
+ dm_device_name(md), ref->dm_dev->name);
+ dm_put_table_device(md, ref->dm_dev);
+ kfree(ref);
+ }
kfree(dd);
}
}
@@ -219,12 +221,27 @@ static struct dm_dev_internal *find_device(struct list_head *l, dev_t dev)
struct dm_dev_internal *dd;
list_for_each_entry(dd, l, list)
- if (dd->dm_dev->bdev->bd_dev == dev)
+ if (dd->bdev->bd_dev == dev)
return dd;
return NULL;
}
+/*
+ * See if the device is already open with a mode that covers the
+ * requested one.
+ */
+static struct dm_dev_ref *find_ref(struct dm_dev_internal *dd, blk_mode_t mode)
+{
+ struct dm_dev_ref *ref;
+
+ list_for_each_entry(ref, &dd->refs, list)
+ if ((ref->dm_dev->mode & mode) == mode)
+ return ref;
+
+ return NULL;
+}
+
/*
* If possible, this checks an area of a destination device is invalid.
*/
@@ -304,31 +321,6 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
return 0;
}
-/*
- * This upgrades the mode on an already open dm_dev, being
- * careful to leave things as they were if we fail to reopen the
- * device and not to touch the existing bdev field in case
- * it is accessed concurrently.
- */
-static int upgrade_mode(struct dm_dev_internal *dd, blk_mode_t new_mode,
- struct mapped_device *md)
-{
- int r;
- struct dm_dev *old_dev, *new_dev;
-
- old_dev = dd->dm_dev;
-
- r = dm_get_table_device(md, dd->dm_dev->bdev->bd_dev,
- dd->dm_dev->mode | new_mode, &new_dev);
- if (r)
- return r;
-
- dd->dm_dev = new_dev;
- dm_put_table_device(md, old_dev);
-
- return 0;
-}
-
/*
* Note: the __ref annotation is because this function can call the __init
* marked early_lookup_bdev when called during early boot code from dm-init.c.
@@ -361,7 +353,9 @@ EXPORT_SYMBOL(dm_devt_from_path);
/*
* Add a device to the list, or just increment the usage count if
- * it's already present.
+ * it's already present with a mode that covers the requested one.
+ * Otherwise open the device again with the requested mode, so the
+ * dm_devs returned earlier stay valid.
*/
int dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode,
struct dm_dev **result)
@@ -369,6 +363,7 @@ int dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode,
int r;
dev_t dev;
struct dm_dev_internal *dd;
+ struct dm_dev_ref *ref;
struct dm_table *t = ti->table;
BUG_ON(!t);
@@ -383,34 +378,48 @@ int dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode,
down_write(&t->devices_lock);
dd = find_device(&t->devices, dev);
- if (!dd) {
- dd = kmalloc(sizeof(*dd), GFP_KERNEL);
+ if (dd) {
+ ref = find_ref(dd, mode);
+ if (ref) {
+ refcount_inc(&ref->count);
+ goto out;
+ }
+ } else {
+ dd = kmalloc_obj(*dd);
if (!dd) {
r = -ENOMEM;
goto unlock_ret_r;
}
+ INIT_LIST_HEAD(&dd->refs);
+ }
- r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev);
- if (r) {
- kfree(dd);
- goto unlock_ret_r;
- }
+ ref = kmalloc_obj(*ref);
+ if (!ref) {
+ r = -ENOMEM;
+ goto bad;
+ }
- refcount_set(&dd->count, 1);
- list_add(&dd->list, &t->devices);
- goto out;
+ r = dm_get_table_device(t->md, dev, mode, &ref->dm_dev);
+ if (r) {
+ kfree(ref);
+ goto bad;
+ }
+ refcount_set(&ref->count, 1);
- } else if (dd->dm_dev->mode != (mode | dd->dm_dev->mode)) {
- r = upgrade_mode(dd, mode, t->md);
- if (r)
- goto unlock_ret_r;
+ /* A device in the list always has at least one ref */
+ if (list_empty(&dd->refs)) {
+ dd->bdev = ref->dm_dev->bdev;
+ list_add(&dd->list, &t->devices);
}
- refcount_inc(&dd->count);
+ list_add_tail(&ref->list, &dd->refs);
out:
up_write(&t->devices_lock);
- *result = dd->dm_dev;
+ *result = ref->dm_dev;
return 0;
+bad:
+ if (list_empty(&dd->refs))
+ kfree(dd);
unlock_ret_r:
up_write(&t->devices_lock);
return r;
@@ -463,26 +472,31 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
*/
void dm_put_device(struct dm_target *ti, struct dm_dev *d)
{
- int found = 0;
struct dm_table *t = ti->table;
struct list_head *devices = &t->devices;
struct dm_dev_internal *dd;
+ struct dm_dev_ref *ref;
down_write(&t->devices_lock);
- list_for_each_entry(dd, devices, list) {
- if (dd->dm_dev == d) {
- found = 1;
- break;
- }
- }
- if (!found) {
- DMERR("%s: device %s not in table devices list",
- dm_device_name(t->md), d->name);
+ list_for_each_entry(dd, devices, list)
+ list_for_each_entry(ref, &dd->refs, list)
+ if (ref->dm_dev == d)
+ goto found;
+
+ DMERR("%s: device %s not in table devices list",
+ dm_device_name(t->md), d->name);
+ goto unlock_ret;
+
+found:
+ if (!refcount_dec_and_test(&ref->count))
goto unlock_ret;
- }
- if (refcount_dec_and_test(&dd->count)) {
- dm_put_table_device(t->md, d);
+
+ dm_put_table_device(t->md, d);
+ list_del(&ref->list);
+ kfree(ref);
+
+ if (list_empty(&dd->refs)) {
list_del(&dd->list);
kfree(dd);
}
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index bc5c501a294cf..3d8a073de9c70 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1587,7 +1587,7 @@ static void __send_empty_flush(struct clone_info *ci)
*/
clone = alloc_tio(ci, NULL, 0, &len, GFP_NOIO);
atomic_add(1, &ci->io->io_count);
- bio_set_dev(clone, dd->dm_dev->bdev);
+ bio_set_dev(clone, dd->bdev);
clone->bi_end_io = clone_endio;
dm_submit_bio_remap(clone, NULL);
}
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 7a795979ec729..34f58060243fb 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -37,10 +37,26 @@
/*
* List of devices that a metadevice uses and should open/close.
+ * There is one dm_dev_internal per device. It holds one dm_dev_ref
+ * for each mode that the targets opened the device with.
*/
struct dm_dev_internal {
struct list_head list;
- refcount_t count;
+ struct block_device *bdev;
+ struct list_head refs;
+};
+
+/*
+ * One open of a device with one mode, shared by the targets of a table.
+ * dm_get_device() reuses a dm_dev_ref whose mode covers the requested
+ * mode, and adds a new one only when none does. So the dm_dev_refs of
+ * a device have different modes, and a table holds each table_device
+ * at most once. table_device->count is still the number of tables that
+ * use the table_device.
+ */
+struct dm_dev_ref {
+ struct list_head list;
+ refcount_t count; /* dm_get_device() calls that returned dm_dev */
struct dm_dev *dm_dev;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 081/703] iio: adc: ad7923: add the AD7927 to the SPI ID table
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (79 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 080/703] dm: fix use-after-free when dm_get_device() widens the open mode Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 082/703] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Greg Kroah-Hartman
` (326 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik, Nuno Sá,
Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 594157b4f3f64db5833dee679194c33a5968f92e ]
The binding describes the AD7927 as
compatible = "adi,ad7927", "adi,ad7928";
The OF match takes the second string. The modalias of the SPI device is
made from the first one, "ad7927", which is not in the spi_device_id table:
spi_get_device_id() returns NULL and ad7923_probe() dereferences it for
the chip information. The module is not loaded automatically either, as the
uevent of an SPI device says "spi:ad7927".
Add the name, with the data of the AD7928.
Fixes: 1140f96cd4af ("dt-bindings: iio: adc: ad7923: adjust documentation")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ sashal: Adapted the new ad7927 entry to the older positional initializer style of the ID table, since the designated-initializer context lines from upstream are not present. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/adc/ad7923.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index 0369151c7db1e..241dc91647688 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -366,6 +366,7 @@ static const struct spi_device_id ad7923_id[] = {
{ "ad7924", AD7924 },
{ "ad7908", AD7908 },
{ "ad7918", AD7918 },
+ { "ad7927", AD7928 },
{ "ad7928", AD7928 },
{ }
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 082/703] iio: temperature: hid-sensor-temperature: Use per-instance callbacks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (80 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 081/703] iio: adc: ad7923: add the AD7927 to the SPI ID table Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 083/703] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
` (325 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christopher Hoover, Joshua Crofts,
Srinivas Pandruvada, Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Hoover <ch@murgatroid.com>
[ Upstream commit 36eeb26031e90eeb81bbac3d3acad61d23fcbdf3 ]
hid-sensor-temperature keeps a single static struct
hid_sensor_hub_callbacks for all instances and overwrites its pdev in
every probe. With two temperature sensors, input reports for one are
delivered with the other's platform device; once that device is
removed, platform_get_drvdata() returns NULL and
temperature_capture_sample() dereferences it:
BUG: kernel NULL pointer dereference, address: 00000000000003a8
RIP: 0010:temperature_capture_sample+0xd/0x50 [hid_sensor_temperature]
The oops happens in sensor_hub_raw_event() with the hub's spinlock
held, so the hub's removal then hangs. It reproduces with two uhid
devices that each declare a temperature sensor, one destroyed while
the other still sends input reports.
Keep the callbacks in struct temperature_state, as the other HID
sensor drivers (accel, gyro, als, ...) do.
Fixes: 59d0f2da3569 ("iio: hid: Add temperature sensor support")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ sashal: Applied cleanly with only line offsets and a re-indented removed context line (&temperature_callbacks);) because the base file differs; the resulting code matches upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/temperature/hid-sensor-temperature.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
index 34bff7e9f3a33..2b3478c6902cc 100644
--- a/drivers/iio/temperature/hid-sensor-temperature.c
+++ b/drivers/iio/temperature/hid-sensor-temperature.c
@@ -16,6 +16,7 @@
struct temperature_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info temperature_attr;
+ struct hid_sensor_hub_callbacks callbacks;
struct {
s32 temperature_data;
aligned_s64 timestamp;
@@ -182,11 +183,6 @@ static int temperature_parse_report(struct platform_device *pdev,
return ret;
}
-static struct hid_sensor_hub_callbacks temperature_callbacks = {
- .send_event = &temperature_proc_event,
- .capture_sample = &temperature_capture_sample,
-};
-
/* Function to initialize the processing for usage id */
static int hid_temperature_probe(struct platform_device *pdev)
{
@@ -238,9 +234,13 @@ static int hid_temperature_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, indio_dev);
- temperature_callbacks.pdev = pdev;
+ temp_st->callbacks = (struct hid_sensor_hub_callbacks) {
+ .send_event = temperature_proc_event,
+ .capture_sample = temperature_capture_sample,
+ .pdev = pdev,
+ };
ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE,
- &temperature_callbacks);
+ &temp_st->callbacks);
if (ret)
goto error_remove_trigger;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 083/703] ACPI: PM: Avoid initializing power management for absent devices
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (81 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 082/703] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 084/703] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
` (324 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alan Borzeszkowski,
Rafael J. Wysocki, Mika Westerberg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit b91ad39f29ceeee3e3d37eedff6b7c912855623c ]
Commit 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power()
early") removed a device presence check from acpi_bus_init_power() which
in some cases causes power management to be initialized for an ACPI
device object and never used going forward. That in turn may prevent
power management from working as expected for other devices.
Namely, if a given ACPI device object is not enabled according to its
_STA, find_child_checks() will return an error for it which will prevent
it from being used as an ACPI companion for a PCI device. Thus if
acpi_device_init_power() initializes power management for it and its
initial power state turns out to be different from D3cold, it may stay
in that power state forever. If it has power resources and they are
"on" during the initialization, they may be reference-counted and never
turned off. If they are shared with other devices, they will prevent
power from going down after attempting to put the other devices into
low-power states.
To prevent that from happening, restore the device presence check in
acpi_bus_init_power(), but also adjust find_child_checks() to return
an error for absent devices (instead of doing that for disabled devices)
in accordance with acpi_bus_init_power() and the existing check in
acpi_bus_attach().
Fixes: 2f4ddf2bd1ba ("ACPI: scan: Stop calling acpi_bus_init_power() early")
Reported-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Tested-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://patch.msgid.link/13013440.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/device_pm.c | 15 +++++++++++++--
drivers/acpi/glue.c | 8 ++------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 62bce1ae8c1d6..b54a4c540344a 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -365,14 +365,25 @@ int acpi_bus_init_power(struct acpi_device *device)
* fails, ACPI power management will not be used for the device going
* forward.
*/
+ if (!acpi_device_is_present(device)) {
+ acpi_handle_debug(device->handle,
+ "Device not present, ACPI PM disabled\n");
+ result = -ENXIO;
+ goto fail;
+ }
+
result = acpi_device_init_power(device);
if (result) {
- device->flags.power_manageable = 0;
- device->power.state = ACPI_D_STATE_INVALID;
acpi_handle_info(device->handle,
"Initial power state undetermined, ACPI PM disabled\n");
+ goto fail;
}
+ return 0;
+
+fail:
+ device->flags.power_manageable = 0;
+ device->power.state = ACPI_D_STATE_INVALID;
return result;
}
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index f915a7c0e7cca..d2c1f969cef27 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -105,14 +105,10 @@ static bool acpi_dev_has_children(struct acpi_device *adev)
static int find_child_checks(struct acpi_device *adev, bool check_children)
{
- unsigned long long sta;
- acpi_status status;
-
if (check_children && !acpi_dev_has_children(adev))
return -ENODEV;
- status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
- if (status == AE_NOT_FOUND) {
+ if (!acpi_has_method(adev->handle, METHOD_NAME__STA)) {
/*
* Special case: backlight device objects without _STA are
* preferred to other objects with the same _ADR value, because
@@ -124,7 +120,7 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
return FIND_CHILD_MIN_SCORE;
}
- if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
+ if (!acpi_device_is_present(adev))
return -ENODEV;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 084/703] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B"
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (82 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 083/703] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 085/703] ovl: refactor ovl_lookup() Greg Kroah-Hartman
` (323 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cristian-Marian Fotache,
Takashi Iwai, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit b9fd2f07df77076f83a58fe7a5640cbcbc5a61ff ]
This reverts commit 2a8ee6897302ca12ff39e8eb180503956797c60c.
We've received a regression report due to this commit, and it turned
out that the PCI SSID for this quirk entry is too generic (10ec:111e)
that may match with several different models.
Usually a workaround would be to apply the quirk for a more unique ID
such as codec SSID, but in this case, unfortunately, the codec SSID is
also 10ec:111e, so BIOS is in a premature state.
For addressing the regression, revert the change for now.
Fixes: 2a8ee6897302 ("ALSA: hda/realtek: Fix silent speaker on Higole F9B")
Reported-by: Cristian-Marian Fotache <cristianmarianfotache@gmail.com>
Closes: https://lore.kernel.org/CACGjpbf73XdwrG34ffjmYU3ZYuStPpFNXf9w+AGYcTmLyHCN_w@mail.gmail.com
Link: https://patch.msgid.link/20261123093436.48511-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/codecs/realtek/alc269.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index dbc7b56f4d42b..5f5b5b2a43530 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -7431,7 +7431,6 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
- SND_PCI_QUIRK(0x10ec, 0x111e, "Higole F9B", ALC290_FIXUP_MONO_SPEAKERS),
SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
SND_PCI_QUIRK(0x10ec, 0x119e, "Positivo SU C1400", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 085/703] ovl: refactor ovl_lookup()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (83 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 084/703] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 086/703] ovl: do not read the flags of a put upper dentry in lookup Greg Kroah-Hartman
` (322 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Amir Goldstein, Christian Brauner,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit 15da486ad3bde6119d9b6353bebc2ffb6e9165c1 ]
Split the core into a separate helper in preparation of converting the
caller to the scoped ovl cred guard.
Link: https://patch.msgid.link/20251117-work-ovl-cred-guard-v4-37-b31603935724@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Stable-dep-of: 7031366be218 ("ovl: do not read the flags of a put upper dentry in lookup")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/namei.c | 316 ++++++++++++++++++++++---------------------
1 file changed, 162 insertions(+), 154 deletions(-)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 6a8c977d6e5c3..0ec6b9b3c4baa 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -1094,57 +1094,44 @@ static bool ovl_check_follow_redirect(struct ovl_lookup_data *d)
return true;
}
-struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
- unsigned int flags)
+struct ovl_lookup_ctx {
+ struct dentry *dentry;
+ struct ovl_entry *oe;
+ struct ovl_path *stack;
+ struct ovl_path *origin_path;
+ struct dentry *upperdentry;
+ struct dentry *index;
+ struct inode *inode;
+ unsigned int ctr;
+};
+
+static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data *d)
{
- struct ovl_entry *oe = NULL;
- const struct cred *old_cred;
+ struct dentry *dentry = ctx->dentry;
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct ovl_entry *poe = OVL_E(dentry->d_parent);
struct ovl_entry *roe = OVL_E(dentry->d_sb->s_root);
- struct ovl_path *stack = NULL, *origin_path = NULL;
- struct dentry *upperdir, *upperdentry = NULL;
- struct dentry *origin = NULL;
- struct dentry *index = NULL;
- unsigned int ctr = 0;
- struct inode *inode = NULL;
- bool upperopaque = false;
bool check_redirect = (ovl_redirect_follow(ofs) || ofs->numdatalayer);
+ struct dentry *upperdir;
struct dentry *this;
- unsigned int i;
- int err;
+ struct dentry *origin = NULL;
+ bool upperopaque = false;
bool uppermetacopy = false;
int metacopy_size = 0;
- struct ovl_lookup_data d = {
- .sb = dentry->d_sb,
- .dentry = dentry,
- .name = dentry->d_name,
- .is_dir = false,
- .opaque = false,
- .stop = false,
- .last = check_redirect ? false : !ovl_numlower(poe),
- .redirect = NULL,
- .upperredirect = NULL,
- .metacopy = 0,
- };
-
- if (dentry->d_name.len > ofs->namelen)
- return ERR_PTR(-ENAMETOOLONG);
+ unsigned int i;
+ int err;
- old_cred = ovl_override_creds(dentry->d_sb);
upperdir = ovl_dentry_upper(dentry->d_parent);
if (upperdir) {
- d.layer = &ofs->layers[0];
- err = ovl_lookup_layer(upperdir, &d, &upperdentry, true);
+ d->layer = &ofs->layers[0];
+ err = ovl_lookup_layer(upperdir, d, &ctx->upperdentry, true);
if (err)
- goto out;
+ return err;
- if (upperdentry && upperdentry->d_flags & DCACHE_OP_REAL) {
- dput(upperdentry);
- err = -EREMOTE;
- goto out;
- }
- if (upperdentry && !d.is_dir) {
+ if (ctx->upperdentry && ctx->upperdentry->d_flags & DCACHE_OP_REAL)
+ return -EREMOTE;
+
+ if (ctx->upperdentry && !d->is_dir) {
/*
* Lookup copy up origin by decoding origin file handle.
* We may get a disconnected dentry, which is fine,
@@ -1155,50 +1142,50 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* number - it's the same as if we held a reference
* to a dentry in lower layer that was moved under us.
*/
- err = ovl_check_origin(ofs, upperdentry, &origin_path);
+ err = ovl_check_origin(ofs, ctx->upperdentry, &ctx->origin_path);
if (err)
- goto out_put_upper;
+ return err;
- if (d.metacopy)
+ if (d->metacopy)
uppermetacopy = true;
- metacopy_size = d.metacopy;
+ metacopy_size = d->metacopy;
}
- if (d.redirect) {
+ if (d->redirect) {
err = -ENOMEM;
- d.upperredirect = kstrdup(d.redirect, GFP_KERNEL);
- if (!d.upperredirect)
- goto out_put_upper;
- if (d.redirect[0] == '/')
+ d->upperredirect = kstrdup(d->redirect, GFP_KERNEL);
+ if (!d->upperredirect)
+ return err;
+ if (d->redirect[0] == '/')
poe = roe;
}
- upperopaque = d.opaque;
+ upperopaque = d->opaque;
}
- if (!d.stop && ovl_numlower(poe)) {
+ if (!d->stop && ovl_numlower(poe)) {
err = -ENOMEM;
- stack = ovl_stack_alloc(ofs->numlayer - 1);
- if (!stack)
- goto out_put_upper;
+ ctx->stack = ovl_stack_alloc(ofs->numlayer - 1);
+ if (!ctx->stack)
+ return err;
}
- for (i = 0; !d.stop && i < ovl_numlower(poe); i++) {
+ for (i = 0; !d->stop && i < ovl_numlower(poe); i++) {
struct ovl_path lower = ovl_lowerstack(poe)[i];
- if (!ovl_check_follow_redirect(&d)) {
+ if (!ovl_check_follow_redirect(d)) {
err = -EPERM;
- goto out_put;
+ return err;
}
if (!check_redirect)
- d.last = i == ovl_numlower(poe) - 1;
- else if (d.is_dir || !ofs->numdatalayer)
- d.last = lower.layer->idx == ovl_numlower(roe);
+ d->last = i == ovl_numlower(poe) - 1;
+ else if (d->is_dir || !ofs->numdatalayer)
+ d->last = lower.layer->idx == ovl_numlower(roe);
- d.layer = lower.layer;
- err = ovl_lookup_layer(lower.dentry, &d, &this, false);
+ d->layer = lower.layer;
+ err = ovl_lookup_layer(lower.dentry, d, &this, false);
if (err)
- goto out_put;
+ return err;
if (!this)
continue;
@@ -1207,11 +1194,11 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* If no origin fh is stored in upper of a merge dir, store fh
* of lower dir and set upper parent "impure".
*/
- if (upperdentry && !ctr && !ofs->noxattr && d.is_dir) {
- err = ovl_fix_origin(ofs, dentry, this, upperdentry);
+ if (ctx->upperdentry && !ctx->ctr && !ofs->noxattr && d->is_dir) {
+ err = ovl_fix_origin(ofs, dentry, this, ctx->upperdentry);
if (err) {
dput(this);
- goto out_put;
+ return err;
}
}
@@ -1224,23 +1211,23 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* matches the dentry found using path based lookup,
* otherwise error out.
*/
- if (upperdentry && !ctr &&
- ((d.is_dir && ovl_verify_lower(dentry->d_sb)) ||
- (!d.is_dir && ofs->config.index && origin_path))) {
- err = ovl_verify_origin(ofs, upperdentry, this, false);
+ if (ctx->upperdentry && !ctx->ctr &&
+ ((d->is_dir && ovl_verify_lower(dentry->d_sb)) ||
+ (!d->is_dir && ofs->config.index && ctx->origin_path))) {
+ err = ovl_verify_origin(ofs, ctx->upperdentry, this, false);
if (err) {
dput(this);
- if (d.is_dir)
+ if (d->is_dir)
break;
- goto out_put;
+ return err;
}
origin = this;
}
- if (!upperdentry && !d.is_dir && !ctr && d.metacopy)
- metacopy_size = d.metacopy;
+ if (!ctx->upperdentry && !d->is_dir && !ctx->ctr && d->metacopy)
+ metacopy_size = d->metacopy;
- if (d.metacopy && ctr) {
+ if (d->metacopy && ctx->ctr) {
/*
* Do not store intermediate metacopy dentries in
* lower chain, except top most lower metacopy dentry.
@@ -1250,15 +1237,15 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
dput(this);
this = NULL;
} else {
- stack[ctr].dentry = this;
- stack[ctr].layer = lower.layer;
- ctr++;
+ ctx->stack[ctx->ctr].dentry = this;
+ ctx->stack[ctx->ctr].layer = lower.layer;
+ ctx->ctr++;
}
- if (d.stop)
+ if (d->stop)
break;
- if (d.redirect && d.redirect[0] == '/' && poe != roe) {
+ if (d->redirect && d->redirect[0] == '/' && poe != roe) {
poe = roe;
/* Find the current layer on the root dentry */
i = lower.layer->idx - 1;
@@ -1269,12 +1256,12 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* Defer lookup of lowerdata in data-only layers to first access.
* Don't require redirect=follow and metacopy=on in this case.
*/
- if (d.metacopy && ctr && ofs->numdatalayer && d.absolute_redirect) {
- d.metacopy = 0;
- ctr++;
- } else if (!ovl_check_follow_redirect(&d)) {
+ if (d->metacopy && ctx->ctr && ofs->numdatalayer && d->absolute_redirect) {
+ d->metacopy = 0;
+ ctx->ctr++;
+ } else if (!ovl_check_follow_redirect(d)) {
err = -EPERM;
- goto out_put;
+ return err;
}
/*
@@ -1285,20 +1272,20 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* For metacopy dentry, path based lookup will find lower dentries.
* Just make sure a corresponding data dentry has been found.
*/
- if (d.metacopy || (uppermetacopy && !ctr)) {
+ if (d->metacopy || (uppermetacopy && !ctx->ctr)) {
pr_warn_ratelimited("metacopy with no lower data found - abort lookup (%pd2)\n",
dentry);
err = -EIO;
- goto out_put;
- } else if (!d.is_dir && upperdentry && !ctr && origin_path) {
- if (WARN_ON(stack != NULL)) {
+ return err;
+ } else if (!d->is_dir && ctx->upperdentry && !ctx->ctr && ctx->origin_path) {
+ if (WARN_ON(ctx->stack != NULL)) {
err = -EIO;
- goto out_put;
+ return err;
}
- stack = origin_path;
- ctr = 1;
- origin = origin_path->dentry;
- origin_path = NULL;
+ ctx->stack = ctx->origin_path;
+ ctx->ctr = 1;
+ origin = ctx->origin_path->dentry;
+ ctx->origin_path = NULL;
}
/*
@@ -1320,38 +1307,39 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* is enabled and if upper had an ORIGIN xattr.
*
*/
- if (!upperdentry && ctr)
- origin = stack[0].dentry;
+ if (!ctx->upperdentry && ctx->ctr)
+ origin = ctx->stack[0].dentry;
if (origin && ovl_indexdir(dentry->d_sb) &&
- (!d.is_dir || ovl_index_all(dentry->d_sb))) {
- index = ovl_lookup_index(ofs, upperdentry, origin, true);
- if (IS_ERR(index)) {
- err = PTR_ERR(index);
- index = NULL;
- goto out_put;
+ (!d->is_dir || ovl_index_all(dentry->d_sb))) {
+ ctx->index = ovl_lookup_index(ofs, ctx->upperdentry, origin, true);
+ if (IS_ERR(ctx->index)) {
+ err = PTR_ERR(ctx->index);
+ ctx->index = NULL;
+ return err;
}
}
- if (ctr) {
- oe = ovl_alloc_entry(ctr);
+ if (ctx->ctr) {
+ ctx->oe = ovl_alloc_entry(ctx->ctr);
err = -ENOMEM;
- if (!oe)
- goto out_put;
+ if (!ctx->oe)
+ return err;
- ovl_stack_cpy(ovl_lowerstack(oe), stack, ctr);
+ ovl_stack_cpy(ovl_lowerstack(ctx->oe), ctx->stack, ctx->ctr);
}
if (upperopaque)
ovl_dentry_set_opaque(dentry);
- if (d.xwhiteouts)
+ if (d->xwhiteouts)
ovl_dentry_set_xwhiteouts(dentry);
- if (upperdentry)
+ if (ctx->upperdentry)
ovl_dentry_set_upper_alias(dentry);
- else if (index) {
+ else if (ctx->index) {
+ char *upperredirect;
struct path upperpath = {
- .dentry = upperdentry = dget(index),
+ .dentry = ctx->upperdentry = dget(ctx->index),
.mnt = ovl_upper_mnt(ofs),
};
@@ -1360,77 +1348,97 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
* assignment happens only if upperdentry is non-NULL, and
* this one only if upperdentry is NULL.
*/
- d.upperredirect = ovl_get_redirect_xattr(ofs, &upperpath, 0);
- if (IS_ERR(d.upperredirect)) {
- err = PTR_ERR(d.upperredirect);
- d.upperredirect = NULL;
- goto out_free_oe;
- }
+ upperredirect = ovl_get_redirect_xattr(ofs, &upperpath, 0);
+ if (IS_ERR(upperredirect))
+ return PTR_ERR(upperredirect);
+ d->upperredirect = upperredirect;
err = ovl_check_metacopy_xattr(ofs, &upperpath, NULL);
if (err < 0)
- goto out_free_oe;
- d.metacopy = uppermetacopy = err;
+ return err;
+ d->metacopy = uppermetacopy = err;
metacopy_size = err;
- if (!ovl_check_follow_redirect(&d)) {
+ if (!ovl_check_follow_redirect(d)) {
err = -EPERM;
- goto out_free_oe;
+ return err;
}
}
- if (upperdentry || ctr) {
+ if (ctx->upperdentry || ctx->ctr) {
+ struct inode *inode;
struct ovl_inode_params oip = {
- .upperdentry = upperdentry,
- .oe = oe,
- .index = index,
- .redirect = d.upperredirect,
+ .upperdentry = ctx->upperdentry,
+ .oe = ctx->oe,
+ .index = ctx->index,
+ .redirect = d->upperredirect,
};
/* Store lowerdata redirect for lazy lookup */
- if (ctr > 1 && !d.is_dir && !stack[ctr - 1].dentry) {
- oip.lowerdata_redirect = d.redirect;
- d.redirect = NULL;
+ if (ctx->ctr > 1 && !d->is_dir && !ctx->stack[ctx->ctr - 1].dentry) {
+ oip.lowerdata_redirect = d->redirect;
+ d->redirect = NULL;
}
+
inode = ovl_get_inode(dentry->d_sb, &oip);
- err = PTR_ERR(inode);
if (IS_ERR(inode))
- goto out_free_oe;
- if (upperdentry && !uppermetacopy)
- ovl_set_flag(OVL_UPPERDATA, inode);
+ return PTR_ERR(inode);
+
+ ctx->inode = inode;
+ if (ctx->upperdentry && !uppermetacopy)
+ ovl_set_flag(OVL_UPPERDATA, ctx->inode);
if (metacopy_size > OVL_METACOPY_MIN_SIZE)
- ovl_set_flag(OVL_HAS_DIGEST, inode);
+ ovl_set_flag(OVL_HAS_DIGEST, ctx->inode);
}
- ovl_dentry_init_reval(dentry, upperdentry, OVL_I_E(inode));
+ ovl_dentry_init_reval(dentry, ctx->upperdentry, OVL_I_E(ctx->inode));
+
+ return 0;
+}
+
+struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
+ unsigned int flags)
+{
+ const struct cred *old_cred;
+ struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
+ struct ovl_entry *poe = OVL_E(dentry->d_parent);
+ bool check_redirect = (ovl_redirect_follow(ofs) || ofs->numdatalayer);
+ int err;
+ struct ovl_lookup_ctx ctx = {
+ .dentry = dentry,
+ };
+ struct ovl_lookup_data d = {
+ .sb = dentry->d_sb,
+ .dentry = dentry,
+ .name = dentry->d_name,
+ .last = check_redirect ? false : !ovl_numlower(poe),
+ };
+
+ if (dentry->d_name.len > ofs->namelen)
+ return ERR_PTR(-ENAMETOOLONG);
+
+ old_cred = ovl_override_creds(dentry->d_sb);
+
+ err = ovl_lookup_layers(&ctx, &d);
ovl_revert_creds(old_cred);
- if (origin_path) {
- dput(origin_path->dentry);
- kfree(origin_path);
+ if (ctx.origin_path) {
+ dput(ctx.origin_path->dentry);
+ kfree(ctx.origin_path);
}
- dput(index);
- ovl_stack_free(stack, ctr);
+ dput(ctx.index);
+ ovl_stack_free(ctx.stack, ctx.ctr);
kfree(d.redirect);
- return d_splice_alias(inode, dentry);
-out_free_oe:
- ovl_free_entry(oe);
-out_put:
- dput(index);
- ovl_stack_free(stack, ctr);
-out_put_upper:
- if (origin_path) {
- dput(origin_path->dentry);
- kfree(origin_path);
+ if (err) {
+ ovl_free_entry(ctx.oe);
+ dput(ctx.upperdentry);
+ kfree(d.upperredirect);
+ return ERR_PTR(err);
}
- dput(upperdentry);
- kfree(d.upperredirect);
-out:
- kfree(d.redirect);
- ovl_revert_creds(old_cred);
- return ERR_PTR(err);
+
+ return d_splice_alias(ctx.inode, dentry);
}
bool ovl_lower_positive(struct dentry *dentry)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 086/703] ovl: do not read the flags of a put upper dentry in lookup
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (84 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 085/703] ovl: refactor ovl_lookup() Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 087/703] ovl: fix leak of lowerdata redirect on ovl_get_inode() failure Greg Kroah-Hartman
` (321 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Amir Goldstein, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
[ Upstream commit 7031366be218f291592a7ad38bc34a7cd1459737 ]
ovl_lookup_layers() passes ctx->upperdentry to ovl_get_inode(), which
takes over the reference. If an overlay inode for the upper inode is
already cached, as for a second hard link, ovl_get_inode() puts the
dentry and returns the cached inode. ovl_lookup_layers() then passes
the put dentry to ovl_dentry_init_reval(), which reads its d_flags.
With a local upper fs the put dentry usually stays in the dcache, but
with a FUSE upper whose entry has timed out, dput() kills it, so this
is a use-after-free.
Fix this by taking the revalidate flags from the upper dentry of the
overlay inode, which is the one that ovl_dentry_revalidate_common()
revalidates.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-986db859-840c-479d-944c-b9c43b93377e
Fixes: bccece1ead36 ("ovl: allow remote upper")
Cc: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/namei.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 0ec6b9b3c4baa..2c962a53cc59e 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -1390,9 +1390,17 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data
if (metacopy_size > OVL_METACOPY_MIN_SIZE)
ovl_set_flag(OVL_HAS_DIGEST, ctx->inode);
- }
- ovl_dentry_init_reval(dentry, ctx->upperdentry, OVL_I_E(ctx->inode));
+ /*
+ * ovl_get_inode() puts ctx->upperdentry if it finds a cached
+ * inode, e.g. for another hard link, so use the upper dentry
+ * of the inode.
+ */
+ ovl_dentry_init_reval(dentry, ovl_i_dentry_upper(inode),
+ OVL_I_E(inode));
+ } else {
+ ovl_dentry_init_reval(dentry, NULL, NULL);
+ }
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 087/703] ovl: fix leak of lowerdata redirect on ovl_get_inode() failure
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (85 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 086/703] ovl: do not read the flags of a put upper dentry in lookup Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 088/703] ovl: do not check the deferred lowerdata redirect on index lookup Greg Kroah-Hartman
` (320 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Amir Goldstein, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
[ Upstream commit f1b7e5534854043077bb72afc8d87ad1e0b283e0 ]
ovl_lookup_layers() moves d->redirect into oip.lowerdata_redirect and
clears d->redirect before calling ovl_get_inode(). When ovl_get_inode()
fails, it does not free oip.lowerdata_redirect, and ovl_lookup() frees
the already cleared d->redirect, so the lowerdata redirect string is
leaked.
Clear d->redirect only after ovl_get_inode() has succeeded, like
d->upperredirect, so that ovl_lookup() frees it on failure.
Fixes: 2b21da920866 ("ovl: prepare to store lowerdata redirect for lazy lowerdata lookup")
Closes: https://sashiko.dev/#/bug/linux-dabbd363-9c71-4915-af72-e2b5e75fa58e
Cc: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/namei.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 2c962a53cc59e..2903f17cfdf91 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -1375,15 +1375,16 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data
};
/* Store lowerdata redirect for lazy lookup */
- if (ctx->ctr > 1 && !d->is_dir && !ctx->stack[ctx->ctr - 1].dentry) {
+ if (ctx->ctr > 1 && !d->is_dir && !ctx->stack[ctx->ctr - 1].dentry)
oip.lowerdata_redirect = d->redirect;
- d->redirect = NULL;
- }
inode = ovl_get_inode(dentry->d_sb, &oip);
if (IS_ERR(inode))
return PTR_ERR(inode);
+ if (oip.lowerdata_redirect)
+ d->redirect = NULL;
+
ctx->inode = inode;
if (ctx->upperdentry && !uppermetacopy)
ovl_set_flag(OVL_UPPERDATA, ctx->inode);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 088/703] ovl: do not check the deferred lowerdata redirect on index lookup
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (86 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 087/703] ovl: fix leak of lowerdata redirect on ovl_get_inode() failure Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 089/703] ovl: follow lower to lowerdata redirects from any lower layer Greg Kroah-Hartman
` (319 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Amir Goldstein, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
[ Upstream commit 011f67b2b5c366679af023261ee02e284d534a96 ]
When a lower metacopy has an absolute redirect into a data-only layer,
ovl_lookup_layers() defers the data lookup and skips
ovl_check_follow_redirect(), but leaves the redirect in d->redirect.
If there is no upper dentry and a sibling hardlink was already copied
up to the index dir, the index branch calls ovl_check_follow_redirect()
again and, with redirect_dir=nofollow (e.g. forced by userxattr), fails
the lookup with -EPERM because of the lower data redirect.
Take the lowerdata redirect out of d->redirect at the point where the
data lookup is deferred, so that the index check only validates the
redirect and metacopy state of the index entry.
Fixes: 5ef7bcdeecc9 ("ovl: relax redirect/metacopy requirements for lower -> data redirect")
Closes: https://sashiko.dev/#/bug/linux-29bea9ea-5376-4e54-88f6-04dabce4db70
Cc: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/namei.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 2903f17cfdf91..313ffc2d51da1 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -26,6 +26,7 @@ struct ovl_lookup_data {
bool last;
char *redirect;
char *upperredirect;
+ char *lowerdata_redirect;
int metacopy;
/* Referring to last redirect xattr */
bool absolute_redirect;
@@ -1259,6 +1260,8 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data
if (d->metacopy && ctx->ctr && ofs->numdatalayer && d->absolute_redirect) {
d->metacopy = 0;
ctx->ctr++;
+ d->lowerdata_redirect = d->redirect;
+ d->redirect = NULL;
} else if (!ovl_check_follow_redirect(d)) {
err = -EPERM;
return err;
@@ -1375,15 +1378,14 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data
};
/* Store lowerdata redirect for lazy lookup */
- if (ctx->ctr > 1 && !d->is_dir && !ctx->stack[ctx->ctr - 1].dentry)
- oip.lowerdata_redirect = d->redirect;
+ if (d->lowerdata_redirect)
+ oip.lowerdata_redirect = d->lowerdata_redirect;
inode = ovl_get_inode(dentry->d_sb, &oip);
if (IS_ERR(inode))
return PTR_ERR(inode);
- if (oip.lowerdata_redirect)
- d->redirect = NULL;
+ d->lowerdata_redirect = NULL;
ctx->inode = inode;
if (ctx->upperdentry && !uppermetacopy)
@@ -1439,6 +1441,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
dput(ctx.index);
ovl_stack_free(ctx.stack, ctx.ctr);
kfree(d.redirect);
+ kfree(d.lowerdata_redirect);
if (err) {
ovl_free_entry(ctx.oe);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 089/703] ovl: follow lower to lowerdata redirects from any lower layer
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (87 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 088/703] ovl: do not check the deferred lowerdata redirect on index lookup Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 090/703] ovl: bump the impure dir version when linking a file with origin Greg Kroah-Hartman
` (318 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giuseppe Scrivano, Amir Goldstein,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giuseppe Scrivano <giuseppe@scrivano.org>
[ Upstream commit cbf4ccabcbfdda3da70c10b37e21e99cd2ee0946 ]
Commit 5ef7bcdeecc9 ("ovl: relax redirect/metacopy requirements for lower
-> data redirect") allowed following redirects from a lower layer to a
data-only layer without redirect_dir=follow and metacopy=on, so that
data-only layers can be used with userxattr.
That fix was incomplete. Without metacopy=on, a metacopy file with an
absolute redirect into a data-only layer is followed only from the lowest
lower layer. From any other lower layer, the lookup fails with EPERM.
That commit also changed the behavior of redirect_dir=nofollow without
making it visible to users. With data-only layers, some redirects are
followed, although the mount options show redirect_dir=nofollow, or
show nothing when that is the default.
Add redirect_dir=followdata, which follows only redirects from lower to
lowerdata, and select it when there are data-only layers, unless
redirect_dir=follow or redirect_dir=on is in effect, so the redirect
follow mode in effect is shown in /proc/self/mountinfo.
Without metacopy=on, the absolute redirect of a lower metacopy file stops
the lookup in the lower layers and the data is looked up in the data-only
layers. Data-only layers cannot be used without following redirects,
so reject an explicit redirect_dir=nofollow with data-only layers.
Fixes: 5ef7bcdeecc9 ("ovl: relax redirect/metacopy requirements for lower -> data redirect")
Cc: stable@vger.kernel.org
Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/filesystems/overlayfs.rst | 24 ++++++++-----
fs/overlayfs/namei.c | 24 +++++++++++--
fs/overlayfs/overlayfs.h | 15 +++++++--
fs/overlayfs/params.c | 45 ++++++++++++++++++++-----
fs/overlayfs/params.h | 2 ++
fs/overlayfs/super.c | 17 ++++++----
6 files changed, 97 insertions(+), 30 deletions(-)
diff --git a/Documentation/filesystems/overlayfs.rst b/Documentation/filesystems/overlayfs.rst
index 2d6202807fd1d..a478f6915b875 100644
--- a/Documentation/filesystems/overlayfs.rst
+++ b/Documentation/filesystems/overlayfs.rst
@@ -237,14 +237,19 @@ Module options (can also be changed through /sys/module/overlay/parameters/):
Mount options:
- "redirect_dir=on":
- Redirects are enabled.
+ Redirects are created and followed.
- "redirect_dir=follow":
Redirects are not created, but followed.
+- "redirect_dir=followdata":
+ Redirects are not created.
+ Only redirects from lower to lowerdata are followed.
- "redirect_dir=nofollow":
Redirects are not created and not followed.
- "redirect_dir=off":
- If "redirect_always_follow" is enabled in the kernel/module config,
- this "off" translates to "follow", otherwise it translates to "nofollow".
+ Redirects are not created.
+ Which redirects are followed depends on "redirect_always_follow" in the
+ kernel/module config, on data-only lower layers and on the "userxattr"
+ mount option.
When the NFS export feature is enabled, every copied up directory is
indexed by the file handle of the lower inode and a file handle of the
@@ -403,8 +408,8 @@ pointed by REDIRECT. This should not be possible on local system as setting
"trusted." xattrs will require CAP_SYS_ADMIN. But it should be possible
for untrusted layers like from a pen drive.
-Note: redirect_dir={off|nofollow|follow[*]} and nfs_export=on mount options
-conflict with metacopy=on, and will result in an error.
+Note: redirect_dir={off|nofollow|followdata|follow[*]} and nfs_export=on
+mount options conflict with metacopy=on, and will result in an error.
[*] redirect_dir=follow only conflicts with metacopy=on if upperdir=... is
given.
@@ -445,10 +450,11 @@ to the absolute path of the "lower data" file in the "data-only" lower layer.
Instead of explicitly enabling "metacopy=on" it is sufficient to specify at
least one data-only layer to enable redirection of data to a data-only layer.
-In this case other forms of metacopy are rejected. Note: this way, data-only
-layers may be used together with "userxattr", in which case careful attention
-must be given to privileges needed to change the "user.overlay.redirect" xattr
-to prevent misuse.
+In this case other forms of metacopy are rejected. A data-only layer selects
+"redirect_dir=followdata", unless "redirect_dir=follow" or "redirect_dir=on" is
+in effect. Note: this way, data-only layers may be used together with
+"userxattr", in which case careful attention must be given to privileges needed
+to change the "user.overlay.redirect" xattr to prevent misuse.
Since kernel version v6.8, "data-only" lower layers can also be added using
the "datadir+" mount options and the fsconfig syscall from new mount api.
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 313ffc2d51da1..a101fa18465b6 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -1088,7 +1088,8 @@ static bool ovl_check_follow_redirect(struct ovl_lookup_data *d)
pr_warn_ratelimited("refusing to follow metacopy origin for (%pd2)\n", d->dentry);
return false;
}
- if ((d->redirect || d->upperredirect) && !ovl_redirect_follow(ofs)) {
+ /* Check follow to lower layer, redirects to lowerdata are not checked here */
+ if ((d->redirect || d->upperredirect) && !ovl_redirect_follow_lower(ofs)) {
pr_warn_ratelimited("refusing to follow redirect for (%pd2)\n", d->dentry);
return false;
}
@@ -1106,13 +1107,26 @@ struct ovl_lookup_ctx {
unsigned int ctr;
};
+/*
+ * Without metacopy=on, the absolute redirect of a lower metacopy file is
+ * followed only into the data-only layers.
+ */
+static bool ovl_is_lowerdata_redirect(struct ovl_lookup_ctx *ctx,
+ struct ovl_lookup_data *d)
+{
+ struct ovl_fs *ofs = OVL_FS(d->sb);
+
+ return ofs->numdatalayer && !ofs->config.metacopy && ctx->ctr &&
+ d->metacopy && d->absolute_redirect;
+}
+
static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data *d)
{
struct dentry *dentry = ctx->dentry;
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct ovl_entry *poe = OVL_E(dentry->d_parent);
struct ovl_entry *roe = OVL_E(dentry->d_sb->s_root);
- bool check_redirect = (ovl_redirect_follow(ofs) || ofs->numdatalayer);
+ bool check_redirect = ovl_redirect_follow(ofs);
struct dentry *upperdir;
struct dentry *this;
struct dentry *origin = NULL;
@@ -1243,6 +1257,10 @@ static int ovl_lookup_layers(struct ovl_lookup_ctx *ctx, struct ovl_lookup_data
ctx->ctr++;
}
+ /* Lookup of lowerdata in the data-only layers only */
+ if (ovl_is_lowerdata_redirect(ctx, d))
+ d->stop = true;
+
if (d->stop)
break;
@@ -1414,7 +1432,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
const struct cred *old_cred;
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct ovl_entry *poe = OVL_E(dentry->d_parent);
- bool check_redirect = (ovl_redirect_follow(ofs) || ofs->numdatalayer);
+ bool check_redirect = ovl_redirect_follow(ofs);
int err;
struct ovl_lookup_ctx ctx = {
.dentry = dentry,
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index c3a0eb0bfd1f0..f0a61663ce169 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -75,11 +75,13 @@ enum ovl_entry_flag {
enum {
/*
- * "off" mode is never used after mount options are verified. In effect
- * it translates to either "follow" or "nofollow".
+ * "off" mode is never used after mount options are verified.
+ * In effect it translates to either "follow", "nofollow" or
+ * "followdata" (with data-only layers).
*/
OVL_REDIRECT_OFF,
OVL_REDIRECT_FOLLOW,
+ OVL_REDIRECT_FOLLOWDATA,
OVL_REDIRECT_NOFOLLOW,
OVL_REDIRECT_ON,
};
@@ -632,11 +634,20 @@ static inline char ovl_get_opaquedir_val(struct ovl_fs *ofs,
return ovl_get_dir_xattr_val(ofs, path, OVL_XATTR_OPAQUE);
}
+/* Are redirects followed into lower layers? */
+static inline bool ovl_redirect_follow_lower(struct ovl_fs *ofs)
+{
+ return ofs->config.redirect_mode == OVL_REDIRECT_FOLLOW ||
+ ofs->config.redirect_mode == OVL_REDIRECT_ON;
+}
+
+/* Are redirects followed into lower or lowerdata layers? */
static inline bool ovl_redirect_follow(struct ovl_fs *ofs)
{
return ofs->config.redirect_mode != OVL_REDIRECT_NOFOLLOW;
}
+/* Are redirects created in upper dir? */
static inline bool ovl_redirect_dir(struct ovl_fs *ofs)
{
return ofs->config.redirect_mode == OVL_REDIRECT_ON;
diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
index 588a50e333404..486e10cec31fb 100644
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -107,6 +107,7 @@ static int ovl_xino_def(void)
const struct constant_table ovl_parameter_redirect_dir[] = {
{ "off", OVL_REDIRECT_OFF },
{ "follow", OVL_REDIRECT_FOLLOW },
+ { "followdata", OVL_REDIRECT_FOLLOWDATA },
{ "nofollow", OVL_REDIRECT_NOFOLLOW },
{ "on", OVL_REDIRECT_ON },
{}
@@ -117,21 +118,29 @@ static const char *ovl_redirect_mode_name(int redirect_mode)
return ovl_parameter_redirect_dir[redirect_mode].name;
}
-static const char *ovl_redirect_mode(struct ovl_config *config)
+const char *ovl_redirect_mode(struct ovl_config *config)
{
return ovl_redirect_mode_name(config->redirect_mode);
}
-static int ovl_redirect_follow_mode(void)
+int ovl_redirect_follow_mode(bool follow_lower, size_t nr_data)
{
- return ovl_redirect_always_follow ? OVL_REDIRECT_FOLLOW :
- OVL_REDIRECT_NOFOLLOW;
+ if (ovl_redirect_always_follow && follow_lower)
+ return OVL_REDIRECT_FOLLOW;
+
+ /* Data-only layers cannot be used without following redirects to them */
+ return nr_data ? OVL_REDIRECT_FOLLOWDATA : OVL_REDIRECT_NOFOLLOW;
}
+/*
+ * The default for show_options() is resolved as if there are no data-only layers,
+ * so that redirect_dir=followdata, which is auto selected with data-only layers,
+ * is displayed in mount options.
+ */
static int ovl_redirect_mode_def(void)
{
return ovl_redirect_dir_def ? OVL_REDIRECT_ON :
- ovl_redirect_follow_mode();
+ ovl_redirect_follow_mode(true, 0);
}
static const struct constant_table ovl_parameter_verity[] = {
@@ -887,6 +896,9 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
struct ovl_opt_set set = ctx->set;
/* The requested redirect_dir=, for reporting conflicts with it */
int redirect_opt = config->redirect_mode;
+ /* The redirect follow mode for redirect_dir=off and for the default */
+ int follow_mode = ovl_redirect_follow_mode(!config->userxattr,
+ ctx->nr_data);
/* Workdir/index are useless in non-upper mount */
if (!config->upperdir) {
@@ -913,9 +925,12 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
config->uuid = OVL_UUID_NULL;
}
- /* Resolve redirect_dir=off to the default redirect follow mode */
+ /*
+ * Resolve redirect_dir=off to the default redirect follow mode.
+ * With userxattr, redirects are not followed to lower by default.
+ */
if (config->redirect_mode == OVL_REDIRECT_OFF)
- config->redirect_mode = ovl_redirect_follow_mode();
+ config->redirect_mode = follow_mode;
/*
* This is to make the logic below simpler. It doesn't make any other
@@ -1012,7 +1027,8 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
/* Resolve userxattr -> !redirect && !metacopy dependency */
if (config->userxattr) {
if (set.redirect &&
- config->redirect_mode != OVL_REDIRECT_NOFOLLOW) {
+ config->redirect_mode != OVL_REDIRECT_NOFOLLOW &&
+ config->redirect_mode != OVL_REDIRECT_FOLLOWDATA) {
pr_err("conflicting options: userxattr,redirect_dir=%s\n",
ovl_redirect_mode_name(redirect_opt));
return -EINVAL;
@@ -1027,10 +1043,21 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
* options must be explicitly enabled if used together with
* userxattr.
*/
- config->redirect_mode = OVL_REDIRECT_NOFOLLOW;
+ if (!set.redirect)
+ config->redirect_mode = follow_mode;
config->metacopy = false;
}
+ /* Data-only layers are reached through redirects */
+ if (ctx->nr_data && config->redirect_mode == OVL_REDIRECT_NOFOLLOW) {
+ pr_err("redirect_dir=nofollow is not supported with data-only layers\n");
+ return -EINVAL;
+ }
+ if (!ctx->nr_data && config->redirect_mode == OVL_REDIRECT_FOLLOWDATA) {
+ pr_err("redirect_dir=followdata requires data-only layers\n");
+ return -EINVAL;
+ }
+
/*
* Fail if we don't have trusted xattr capability and a feature was
* explicitly requested that requires them.
diff --git a/fs/overlayfs/params.h b/fs/overlayfs/params.h
index ffd53cdd84827..3a514a21b14c4 100644
--- a/fs/overlayfs/params.h
+++ b/fs/overlayfs/params.h
@@ -42,3 +42,5 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
struct ovl_config *config);
int ovl_show_options(struct seq_file *m, struct dentry *dentry);
const char *ovl_xino_mode(struct ovl_config *config);
+const char *ovl_redirect_mode(struct ovl_config *config);
+int ovl_redirect_follow_mode(bool follow_lower, size_t nr_data);
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 4c19b204e53da..be78cb804b65c 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -684,7 +684,7 @@ static int ovl_create_volatile_dirty(struct ovl_fs *ofs)
}
static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
- const struct path *workpath)
+ const struct path *workpath, size_t nr_data)
{
struct vfsmount *mnt = ovl_upper_mnt(ofs);
struct dentry *workdir;
@@ -748,9 +748,11 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
if (err) {
pr_warn("failed to set xattr on upper\n");
ofs->noxattr = true;
- if (ovl_redirect_follow(ofs)) {
- ofs->config.redirect_mode = OVL_REDIRECT_NOFOLLOW;
- pr_warn("...falling back to redirect_dir=nofollow.\n");
+ if (ovl_redirect_follow_lower(ofs)) {
+ ofs->config.redirect_mode =
+ ovl_redirect_follow_mode(false, nr_data);
+ pr_warn("...falling back to redirect_dir=%s.\n",
+ ovl_redirect_mode(&ofs->config));
}
if (ofs->config.metacopy) {
ofs->config.metacopy = false;
@@ -827,7 +829,7 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ofs,
const struct path *upperpath,
- const struct path *workpath)
+ const struct path *workpath, size_t nr_data)
{
int err;
@@ -856,7 +858,7 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ofs,
if (err)
return err;
- return ovl_make_workdir(sb, ofs, workpath);
+ return ovl_make_workdir(sb, ofs, workpath, nr_data);
}
static int ovl_get_indexdir(struct super_block *sb, struct ovl_fs *ofs,
@@ -1510,7 +1512,8 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
}
}
- err = ovl_get_workdir(sb, ofs, &ctx->upper, &ctx->work);
+ err = ovl_get_workdir(sb, ofs, &ctx->upper, &ctx->work,
+ ctx->nr_data);
if (err)
goto out_err;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 090/703] ovl: bump the impure dir version when linking a file with origin
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (88 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 089/703] ovl: follow lower to lowerdata redirects from any lower layer Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 091/703] smb: client: hold server ref while queueing reconnect work Greg Kroah-Hartman
` (317 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Daejun Park, Amir Goldstein,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
[ Upstream commit 86e2facd8630cc2fdec6ea80c53e370b26b441d9 ]
Linking a file with copy up origin into a non-merge impure dir does
not bump the dir version. readdir then reuses the impure dir cache
built before the link. It reports the upper inode number as d_ino of
the new link, not st_ino.
Pass whether the linked file has an origin to ovl_dir_modified(), as
rename and unlink do.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-98f207b6-3936-48e9-a40f-88f20be4db7b
Fixes: 4edb83bb1041 ("ovl: constant d_ino for non-merge dirs")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
[ sashal: Added a bool origin parameter to ovl_create_upper() and ovl_create_over_whiteout() and passed it from the direct calls in ovl_create_or_link(), since the upstream ovl_create_handle_whiteouts() wrapper doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/dir.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 8377f112feca3..b9f0eb5e7dd78 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -355,7 +355,7 @@ static bool ovl_type_origin(struct dentry *dentry)
}
static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
- struct ovl_cattr *attr)
+ struct ovl_cattr *attr, bool origin)
{
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
@@ -378,7 +378,7 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
ovl_set_opaque(dentry, newdentry);
}
- ovl_dir_modified(dentry->d_parent, false);
+ ovl_dir_modified(dentry->d_parent, origin);
err = ovl_instantiate(dentry, inode, newdentry, !!attr->hardlink, NULL);
if (err)
goto out_cleanup;
@@ -471,7 +471,7 @@ static int ovl_set_upper_acl(struct ovl_fs *ofs, struct dentry *upperdentry,
}
static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
- struct ovl_cattr *cattr)
+ struct ovl_cattr *cattr, bool origin)
{
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
struct dentry *workdir = ovl_workdir(dentry);
@@ -557,7 +557,7 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
if (err)
goto out_cleanup_unlocked;
}
- ovl_dir_modified(dentry->d_parent, false);
+ ovl_dir_modified(dentry->d_parent, origin);
err = ovl_instantiate(dentry, inode, newdentry, hardlink, NULL);
if (err) {
ovl_cleanup(ofs, upperdir, newdentry);
@@ -656,9 +656,9 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
}
if (!ovl_dentry_is_whiteout(dentry))
- err = ovl_create_upper(dentry, inode, attr);
+ err = ovl_create_upper(dentry, inode, attr, origin);
else
- err = ovl_create_over_whiteout(dentry, inode, attr);
+ err = ovl_create_over_whiteout(dentry, inode, attr, origin);
out_revert_creds:
ovl_revert_creds(old_cred);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 091/703] smb: client: hold server ref while queueing reconnect work
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (89 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 090/703] ovl: bump the impure dir version when linking a file with origin Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 092/703] smb: client: dont write back through O_DIRECT handles Greg Kroah-Hartman
` (316 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joseph Qi, Paulo Alcantara,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <joseph.qi@linux.alibaba.com>
[ Upstream commit f02d249e9756b78990aaaa1635e47e06deb2cb51 ]
When query_server_interfaces() returns -EOPNOTSUPP on a secondary
channel, smb2_reconnect() calls smb3_update_ses_channels() which for a
channel runs cifs_chan_skip_or_disable(). That clears the channel's
slot in the session and calls cifs_put_tcp_session(), which can drop
the last reference of the channel and tear it down.
smb2_reconnect() then falls through to skip_add_channels and queues
reconnect work on that server, using a server that may already be
freed. The send path obtained the channel from cifs_pick_channel(),
which does not take a reference, so the session's channel reference is
the only one.
Take our own reference on the channel before calling
smb3_update_ses_channels() and drop it after the reconnect work has
been queued, so the channel cannot be freed while it is still used.
Fixes: f591062bdbf4 ("cifs: handle servers that still advertise multichannel after disabling")
Cc: stable@vger.kernel.org
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
[ sashal: Used cifs_chan_skip_or_disable() in place of smb3_update_ses_channels(), which doesn't exist in this tree, while keeping the same extra-reference locking and put as upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/smb2pdu.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 7b95493b94642..17230f94eea3b 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -219,9 +219,10 @@ static int
smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
struct TCP_Server_Info *server, bool from_reconnect)
{
+ bool hold_server_ref = false;
struct cifs_ses *ses;
- int xid;
int rc = 0;
+ int xid;
/*
* SMB2s NegProt, SessSetup, Logoff do not have tcon yet so
@@ -439,6 +440,20 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* treat this as server not supporting multichannel
*/
+ /*
+ * If server is a secondary channel,
+ * cifs_chan_skip_or_disable() called below may
+ * drop its last reference, so hold our own
+ * reference until the reconnect work below has
+ * been queued.
+ */
+ spin_lock(&cifs_tcp_ses_lock);
+ if (server->srv_count) {
+ server->srv_count++;
+ hold_server_ref = true;
+ }
+ spin_unlock(&cifs_tcp_ses_lock);
+
rc = cifs_chan_skip_or_disable(ses, server,
from_reconnect);
goto skip_add_channels;
@@ -465,6 +480,8 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
if (smb2_command != SMB2_INTERNAL_CMD)
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
+ if (hold_server_ref)
+ cifs_put_tcp_session(server, from_reconnect);
atomic_inc(&tconInfoReconnectCount);
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 092/703] smb: client: dont write back through O_DIRECT handles
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (90 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 091/703] smb: client: hold server ref while queueing reconnect work Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 093/703] smb: client: dont fail writeback preparation if the task is dying Greg Kroah-Hartman
` (315 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit 0e85145af984f7cae2aadaa694cb8612009027ac ]
Writeback uses the first writable handle of the inode, which may have
been opened with O_DIRECT. Such handles are opened with
FILE_NO_INTERMEDIATE_BUFFERING, for which Windows rejects any unaligned
I/O with STATUS_INVALID_PARAMETER. Writeback of partly dirty pages and
of the unaligned tail of a file through one of them fails, so netfs ends
it with the folios clean and the data never reaches the server.
xfstests generic/051, where fsstress mixes both kinds of opens, loses
about 1% of its writes this way:
smb3_write_err: ... offset=0xde90d7 len=0xbd0b rc=-22
All the rejected writes in a network capture were unaligned writes on a
no-buffering handle; none of the aligned ones, and none of the unaligned
ones on regular handles, were.
Prefer a handle that was not opened with O_DIRECT, and use one that was
only if there is no other.
Fixes: 1013e760d10e ("SMB3: Don't ignore O_SYNC/O_DSYNC and O_DIRECT flags")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
[ sashal: Renamed FIND_* flags to this tree's FIND_WR_* names, used bit 3 for the new flag, and dropped the tmpfile hunk because that code is absent. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsglob.h | 1 +
fs/smb/client/file.c | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index ea6533d057acf..2660a3a0f51cb 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1868,6 +1868,7 @@ enum cifs_writable_file_flags {
FIND_WR_FSUID_ONLY = (1U << 0),
FIND_WR_WITH_DELETE = (1U << 1),
FIND_WR_NO_PENDING_DELETE = (1U << 2),
+ FIND_WR_NO_DIRECT = (1U << 3),
};
#define MID_FREE 0
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 652206fead33c..e11662f2a903c 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -282,9 +282,15 @@ static void cifs_begin_writeback(struct netfs_io_request *wreq)
struct cifs_io_request *req = container_of(wreq, struct cifs_io_request, rreq);
int ret;
- ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_WR_ANY, &req->cfile);
+ ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_WR_NO_DIRECT,
+ &req->cfile);
if (ret) {
- cifs_dbg(VFS, "No writable handle in writepages ret=%d\n", ret);
+ ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_WR_ANY,
+ &req->cfile);
+ }
+ if (ret) {
+ cifs_dbg(VFS, "%s: couldn't find writable handle: %d\n",
+ __func__, ret);
return;
}
@@ -2669,6 +2675,9 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, int flags,
if ((flags & FIND_WR_NO_PENDING_DELETE) &&
open_file->status_file_deleted)
continue;
+ if ((flags & FIND_WR_NO_DIRECT) &&
+ (open_file->f_flags & O_DIRECT))
+ continue;
if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
if (!open_file->invalidHandle) {
/* found a good writable file */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 093/703] smb: client: dont fail writeback preparation if the task is dying
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (91 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 092/703] smb: client: dont write back through O_DIRECT handles Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 094/703] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14 Greg Kroah-Hartman
` (314 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
[ Upstream commit 29ead886deaa1344a43ab68b1ea305ea2c86c378 ]
cifs_prepare_write() may need to reopen an invalidated handle and to wait
for credits, both from the context of the task doing writeback. A dying
task gets the reopen refused at send time and the killable credit wait
interrupted, so the subrequest is failed and, as with refused sends, its
folios end writeback clean and the data is lost.
For writeback in a dying task, skip both and prepare a credit-less
subrequest capped at SMB2_MAX_BUFFER_SIZE, as already done when the
server is low on credits. It gets issued from cifswritebackd, which
reopens the handle if needed and takes a single credit when sending,
neither of which can be interrupted there. Do the same when the reopen
or credit wait fails because a fatal signal arrived meanwhile.
cifs_begin_writeback() reopens the handle too when all the writable ones
got invalidated, e.g. by a reconnect. If that fails, there is no
upload stream, so netfs ends writeback of every folio clean with no
error recorded. Take an invalidated handle as is there and leave
reopening it to cifs_prepare_write(). If there is no writable handle at
all, record -EIO for the mapping, so that the loss gets reported.
Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
[ sashal: Used this tree's FIND_WR_* flag names with FIND_WR_NO_REOPEN on the next free bit, and dropped the TMPFILE find_flags mask that doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsglob.h | 1 +
fs/smb/client/file.c | 47 ++++++++++++++++++++++++++++++----------
2 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 2660a3a0f51cb..09a711268b6e2 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1869,6 +1869,7 @@ enum cifs_writable_file_flags {
FIND_WR_WITH_DELETE = (1U << 1),
FIND_WR_NO_PENDING_DELETE = (1U << 2),
FIND_WR_NO_DIRECT = (1U << 3),
+ FIND_WR_NO_REOPEN = (1U << 4),
};
#define MID_FREE 0
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index e11662f2a903c..0ede5a94d93cf 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -40,6 +40,12 @@
static int cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush);
+static bool cifs_writeback_dying(struct netfs_io_subrequest *subreq)
+{
+ return subreq->rreq->origin == NETFS_WRITEBACK &&
+ fatal_signal_pending(current);
+}
+
/*
* Prepare a subrequest to upload to the server. We need to allocate credits
* so that we know the maximum amount of data that we can include in it.
@@ -68,12 +74,17 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
cifs_negotiate_wsize(server, cifs_sb->ctx,
tlink_tcon(req->cfile->tlink));
+ if (cifs_writeback_dying(subreq))
+ goto defer;
+
retry:
if (open_file->invalidHandle) {
rc = cifs_reopen_file(open_file, false);
if (rc < 0) {
if (rc == -EAGAIN)
goto retry;
+ if (cifs_writeback_dying(subreq))
+ goto defer;
subreq->error = rc;
return netfs_prepare_write_failed(subreq);
}
@@ -82,10 +93,17 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
rc = server->ops->wait_mtu_credits(server, wsize, &stream->sreq_max_len,
&wdata->credits);
if (rc < 0) {
+ if (cifs_writeback_dying(subreq))
+ goto defer;
subreq->error = rc;
return netfs_prepare_write_failed(subreq);
}
+ goto out;
+defer:
+ wdata->credits = (struct cifs_credits){};
+ stream->sreq_max_len = min_t(size_t, wsize, SMB2_MAX_BUFFER_SIZE);
+out:
wdata->credits.rreq_debug_id = subreq->rreq->debug_id;
wdata->credits.rreq_debug_index = subreq->debug_index;
wdata->credits.in_flight_check = 1;
@@ -106,12 +124,6 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
#endif
}
-static bool cifs_writeback_dying(struct netfs_io_subrequest *subreq)
-{
- return subreq->rreq->origin == NETFS_WRITEBACK &&
- fatal_signal_pending(current);
-}
-
/*
* Issue a subrequest to upload to the server.
*/
@@ -153,10 +165,15 @@ static void __cifs_issue_write(struct netfs_io_subrequest *subreq)
static void cifs_issue_write_worker(struct work_struct *work)
{
- struct netfs_io_subrequest *subreq;
+ struct cifs_io_subrequest *wdata;
+ struct cifsFileInfo *cfile;
- subreq = container_of(work, struct netfs_io_subrequest, work);
- __cifs_issue_write(subreq);
+ wdata = container_of(work, struct cifs_io_subrequest, subreq.work);
+ cfile = wdata->req->cfile;
+ while (cfile->invalidHandle &&
+ cifs_reopen_file(cfile, false) == -EAGAIN)
+ ;
+ __cifs_issue_write(&wdata->subreq);
}
static void cifs_issue_write(struct netfs_io_subrequest *subreq)
@@ -282,15 +299,17 @@ static void cifs_begin_writeback(struct netfs_io_request *wreq)
struct cifs_io_request *req = container_of(wreq, struct cifs_io_request, rreq);
int ret;
- ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_WR_NO_DIRECT,
+ ret = cifs_get_writable_file(CIFS_I(wreq->inode),
+ FIND_WR_NO_REOPEN | FIND_WR_NO_DIRECT,
&req->cfile);
if (ret) {
- ret = cifs_get_writable_file(CIFS_I(wreq->inode), FIND_WR_ANY,
- &req->cfile);
+ ret = cifs_get_writable_file(CIFS_I(wreq->inode),
+ FIND_WR_NO_REOPEN, &req->cfile);
}
if (ret) {
cifs_dbg(VFS, "%s: couldn't find writable handle: %d\n",
__func__, ret);
+ mapping_set_error(wreq->mapping, -EIO);
return;
}
@@ -2705,6 +2724,10 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, int flags,
spin_unlock(&cifs_inode->open_file_lock);
if (inv_file) {
+ if (flags & FIND_WR_NO_REOPEN) {
+ *ret_file = inv_file;
+ return 0;
+ }
rc = cifs_reopen_file(inv_file, false);
if (!rc) {
*ret_file = inv_file;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 094/703] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (92 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 093/703] smb: client: dont fail writeback preparation if the task is dying Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 095/703] usb: dwc3: Always deassert xilinx resets Greg Kroah-Hartman
` (313 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Francesco Orro, Ihor Urazov,
Heikki Krogerus, Huang Wei, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ihor Urazov <z0rc3r@gmail.com>
[ Upstream commit 3ee1e1c3fca6fb5d0abbe0fc91539951ffa60aa7 ]
The HP ZBook 8 G2i 14 (board 8ED9) exposes a working UCSI ACPI PPM, but
its UCSI VERSION field reads zero until the first command completes.
ucsi_register() rejects a zero version with -ENODEV, so no Type-C ports
are registered.
The firmware's _DSM READ function (2) is a stub. The mailbox VERSION
field is written only by the EC response handler, after a command
completes, after which it reads 0x0100 (UCSI 1.0). The mailbox is
48 bytes with 16-byte MESSAGE_IN/MESSAGE_OUT fields, the UCSI 1.x
layout, and _DSM function 5 is not implemented.
Add a DMI-specific read_version for this board that substitutes the
version the firmware itself reports, UCSI 1.0, only when VERSION reads
zero. A non-zero firmware version is used as is.
The same firmware defect on the HP ZBook Fury G1i 16 was discussed in
"[RFC PATCH] usb: typec: ucsi: acpi: bootstrap PPM on HP systems with
empty _DSM func 2" [1]. The defect was reported to HP as case
5166176673.
Tested on an HP ZBook 8 G2i 14 with BIOS Y70 01.02.08, from a fresh
boot where VERSION reads zero: three connectors register, the PD
contract and alternate modes of a Thunderbolt dock are reported, and
its DisplayPort output stays up across the PPM reset in ucsi_init().
Dock unplug/replug and s2idle suspend/resume update the connector
state without errors.
Link: https://lore.kernel.org/linux-usb/f3M_fpjtt8FxDqGKcA84vqXmRbKzCBfpCrIK4-jCWvIscER51zkD8qD8FYpz75qZw51rMDRSkUyYlrBvLvdM8CGRY2l8TFVvr4MC1LdTzbc=@interstellar.eu/ [1]
Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
Cc: stable <stable@kernel.org>
Cc: Francesco Orro <ncesco@interstellar.eu>
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ihor Urazov <z0rc3r@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Huang Wei <huangwei@kylinos.cn>
Link: https://patch.msgid.link/20261026-ucsi-hp-zbook-8-g2i-v1-1-91002e9ef073@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: Dropped the .write_message_out line from the new ucsi_hp_ops table, since this tree's ucsi_operations has no such member or helper. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/ucsi/ucsi_acpi.c | 34 ++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index c3f6856032c20..0fbc13ce79237 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -131,6 +131,33 @@ static const struct ucsi_operations ucsi_acer_ops = {
.async_control = ucsi_acpi_async_control
};
+static int ucsi_hp_read_version(struct ucsi *ucsi, u16 *version)
+{
+ struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
+ int ret;
+
+ ret = ucsi_acpi_read_version(ucsi, version);
+ if (ret)
+ return ret;
+
+ /* Firmware fills in VERSION (1.0) only after the first command completes */
+ if (!*version) {
+ dev_warn(ua->dev, "UCSI version is zero, assuming 1.0\n");
+ *version = UCSI_VERSION_1_0;
+ }
+
+ return 0;
+}
+
+static const struct ucsi_operations ucsi_hp_ops = {
+ .read_version = ucsi_hp_read_version,
+ .read_cci = ucsi_acpi_read_cci,
+ .poll_cci = ucsi_acpi_poll_cci,
+ .read_message_in = ucsi_acpi_read_message_in,
+ .sync_control = ucsi_sync_control_common,
+ .async_control = ucsi_acpi_async_control
+};
+
static int ucsi_gram_sync_control(struct ucsi *ucsi, u64 command, u32 *cci,
void *val, size_t len)
{
@@ -177,6 +204,13 @@ static const struct dmi_system_id ucsi_acpi_quirks[] = {
},
.driver_data = (void *)&ucsi_acer_ops,
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+ DMI_MATCH(DMI_BOARD_NAME, "8ED9"),
+ },
+ .driver_data = (void *)&ucsi_hp_ops,
+ },
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 095/703] usb: dwc3: Always deassert xilinx resets
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (93 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 094/703] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14 Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 096/703] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Greg Kroah-Hartman
` (312 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sean Anderson, Thinh Nguyen,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <sean.anderson@linux.dev>
[ Upstream commit ec06c8039d396a1b558cc138f5c5aba17698e175 ]
If we don't have a usb3 phy we don't need to assert the core resets.
Deassert them even if we didn't assert them to support booting when the
bootloader never released the core from reset.
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260106171018.501612-1-sean.anderson@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: f33f0dd2eb01 ("usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/dwc3-xilinx.c | 71 ++++++++++++++++------------------
1 file changed, 34 insertions(+), 37 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 8897fbe554745..449c03223c7f3 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -132,21 +132,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- /*
- * The following core resets are not required unless a USB3 PHY
- * is used, and the subsequent register settings are not required
- * unless a core reset is performed (they should be set properly
- * by the first-stage boot loader, but may be reverted by a core
- * reset). They may also break the configuration if USB3 is actually
- * in use but the usb3-phy entry is missing from the device tree.
- * Therefore, skip these operations in this case.
- */
- if (!priv_data->usb3_phy) {
- /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */
- writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
- goto skip_usb3_phy;
- }
-
crst = devm_reset_control_get_exclusive(dev, "usb_crst");
if (IS_ERR(crst)) {
ret = PTR_ERR(crst);
@@ -171,22 +156,31 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- ret = reset_control_assert(crst);
- if (ret < 0) {
- dev_err(dev, "Failed to assert core reset\n");
- goto err;
- }
-
- ret = reset_control_assert(hibrst);
- if (ret < 0) {
- dev_err(dev, "Failed to assert hibernation reset\n");
- goto err;
- }
-
- ret = reset_control_assert(apbrst);
- if (ret < 0) {
- dev_err(dev, "Failed to assert APB reset\n");
- goto err;
+ /*
+ * Asserting the core resets is not required unless a USB3 PHY is used.
+ * They may also break the configuration if USB3 is actually in use but
+ * the usb3-phy entry is missing from the device tree. Therefore, skip
+ * a full reset cycle and just deassert the resets if the phy is
+ * absent.
+ */
+ if (priv_data->usb3_phy) {
+ ret = reset_control_assert(crst);
+ if (ret < 0) {
+ dev_err(dev, "Failed to assert core reset\n");
+ goto err;
+ }
+
+ ret = reset_control_assert(hibrst);
+ if (ret < 0) {
+ dev_err(dev, "Failed to assert hibernation reset\n");
+ goto err;
+ }
+
+ ret = reset_control_assert(apbrst);
+ if (ret < 0) {
+ dev_err(dev, "Failed to assert APB reset\n");
+ goto err;
+ }
}
ret = phy_init(priv_data->usb3_phy);
@@ -199,11 +193,15 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err_phy_exit;
}
- /* Set PIPE Power Present signal in FPD Power Present Register*/
- writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT);
-
- /* Set the PIPE Clock Select bit in FPD PIPE Clock register */
- writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
+ if (priv_data->usb3_phy) {
+ /* Set PIPE Power Present signal in FPD Power Present Register*/
+ writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT);
+ /* Set the PIPE Clock Select bit in FPD PIPE Clock register */
+ writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
+ } else {
+ /* Deselect the PIPE Clock Select bit in FPD PIPE Clock register */
+ writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
+ }
ret = reset_control_deassert(crst);
if (ret < 0) {
@@ -221,7 +219,6 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
if (ret < 0)
goto err_phy_exit;
-skip_usb3_phy:
/* ulpi reset via gpio-modepin or gpio-framework driver */
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(reset_gpio)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 096/703] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (94 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 095/703] usb: dwc3: Always deassert xilinx resets Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 097/703] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
` (311 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Radhey Shyam Pandey,
Thinh Nguyen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
[ Upstream commit f33f0dd2eb014bffda02ecfd182de3ddab058596 ]
If reset deassert or PHY setup fails partway through
dwc3_xlnx_init_zynqmp(), re-assert the resets that were already
released before unwinding the PHY.
Only undo the reset cycle the function actually performed. The cycle is
skipped when no usb3-phy is present, because asserting the core resets
can break a USB3 configuration that is live but missing from the device
tree, so the error path skips it for the same reason. Asserting an
already asserted reset is harmless, so one block covers however far the
deasserts progressed.
Save the ZynqMP reset handles in driver private data so later probe
teardown can re-assert released resets.
Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")
Cc: stable <stable@kernel.org>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260928120015.3152461-3-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/dwc3-xilinx.c | 55 ++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 449c03223c7f3..7e25ccd42be4f 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -48,6 +48,9 @@ struct dwc3_xlnx {
void __iomem *regs;
int (*pltfm_init)(struct dwc3_xlnx *data);
struct phy *usb3_phy;
+ struct reset_control *usb_crst;
+ struct reset_control *usb_hibrst;
+ struct reset_control *usb_apbrst;
};
static void dwc3_xlnx_mask_phy_rst(struct dwc3_xlnx *priv_data, bool mask)
@@ -120,7 +123,6 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)
static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
{
struct device *dev = priv_data->dev;
- struct reset_control *crst, *hibrst, *apbrst;
struct gpio_desc *reset_gpio;
int ret = 0;
@@ -132,25 +134,25 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
goto err;
}
- crst = devm_reset_control_get_exclusive(dev, "usb_crst");
- if (IS_ERR(crst)) {
- ret = PTR_ERR(crst);
+ priv_data->usb_crst = devm_reset_control_get_exclusive(dev, "usb_crst");
+ if (IS_ERR(priv_data->usb_crst)) {
+ ret = PTR_ERR(priv_data->usb_crst);
dev_err_probe(dev, ret,
"failed to get core reset signal\n");
goto err;
}
- hibrst = devm_reset_control_get_exclusive(dev, "usb_hibrst");
- if (IS_ERR(hibrst)) {
- ret = PTR_ERR(hibrst);
+ priv_data->usb_hibrst = devm_reset_control_get_exclusive(dev, "usb_hibrst");
+ if (IS_ERR(priv_data->usb_hibrst)) {
+ ret = PTR_ERR(priv_data->usb_hibrst);
dev_err_probe(dev, ret,
"failed to get hibernation reset signal\n");
goto err;
}
- apbrst = devm_reset_control_get_exclusive(dev, "usb_apbrst");
- if (IS_ERR(apbrst)) {
- ret = PTR_ERR(apbrst);
+ priv_data->usb_apbrst = devm_reset_control_get_exclusive(dev, "usb_apbrst");
+ if (IS_ERR(priv_data->usb_apbrst)) {
+ ret = PTR_ERR(priv_data->usb_apbrst);
dev_err_probe(dev, ret,
"failed to get APB reset signal\n");
goto err;
@@ -164,19 +166,19 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
* absent.
*/
if (priv_data->usb3_phy) {
- ret = reset_control_assert(crst);
+ ret = reset_control_assert(priv_data->usb_crst);
if (ret < 0) {
dev_err(dev, "Failed to assert core reset\n");
goto err;
}
- ret = reset_control_assert(hibrst);
+ ret = reset_control_assert(priv_data->usb_hibrst);
if (ret < 0) {
dev_err(dev, "Failed to assert hibernation reset\n");
goto err;
}
- ret = reset_control_assert(apbrst);
+ ret = reset_control_assert(priv_data->usb_apbrst);
if (ret < 0) {
dev_err(dev, "Failed to assert APB reset\n");
goto err;
@@ -187,7 +189,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
if (ret < 0)
goto err;
- ret = reset_control_deassert(apbrst);
+ ret = reset_control_deassert(priv_data->usb_apbrst);
if (ret < 0) {
dev_err(dev, "Failed to release APB reset\n");
goto err_phy_exit;
@@ -203,21 +205,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK);
}
- ret = reset_control_deassert(crst);
+ ret = reset_control_deassert(priv_data->usb_crst);
if (ret < 0) {
dev_err(dev, "Failed to release core reset\n");
- goto err_phy_exit;
+ goto err_reset_assert;
}
- ret = reset_control_deassert(hibrst);
+ ret = reset_control_deassert(priv_data->usb_hibrst);
if (ret < 0) {
dev_err(dev, "Failed to release hibernation reset\n");
- goto err_phy_exit;
+ goto err_reset_assert;
}
ret = phy_power_on(priv_data->usb3_phy);
if (ret < 0)
- goto err_phy_exit;
+ goto err_reset_assert;
/* ulpi reset via gpio-modepin or gpio-framework driver */
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
@@ -238,6 +240,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
err_phy_power_off:
phy_power_off(priv_data->usb3_phy);
+err_reset_assert:
+ /*
+ * Undo only the reset cycle performed above. That cycle is skipped
+ * when there is no usb3-phy. The deasserts stay unconditional so a
+ * core the bootloader left in reset still comes up, but they are
+ * deliberately not paired with an assert here: resetting a USB3
+ * configuration that is live but missing from the device tree could
+ * break it. Asserting an already asserted reset is harmless, so one
+ * block covers however far the cycle's deasserts got.
+ */
+ if (priv_data->usb3_phy) {
+ reset_control_assert(priv_data->usb_hibrst);
+ reset_control_assert(priv_data->usb_crst);
+ reset_control_assert(priv_data->usb_apbrst);
+ }
err_phy_exit:
phy_exit(priv_data->usb3_phy);
err:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 097/703] w1: w1_therm: lock the list of slaves for the bulk read
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (95 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 096/703] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 098/703] usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove Greg Kroah-Hartman
` (310 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Josef Bacik,
Krzysztof Kozlowski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 1e46334d38e0217f5d255dc6fd63243593052f8e ]
The callbacks of the file therm_bulk_read walk the list of the slaves of
the master, trigger_bulk_read() three times and therm_bulk_read_show()
once, without the list_mutex which protects it. In the meantime the
thread of the master may find out that a sensor has gone:
write to therm_bulk_read w1_process()
trigger_bulk_read() w1_slave_detach()
list_for_each_entry(sl, ...) w1_unref_slave()
bulk_read_slave(sl) list_del()
w1_therm_remove_slave()
kfree(sl->family_data)
kfree(sl)
SLAVE_CONVERT_TRIGGERED(sl) = 1
The walk reads, and writes to, memory which has been freed, and follows
the poisoned list pointers.
Take list_mutex around each of the four walks. No pointer to a slave is
kept from one walk to the next.
This could not be done as long as w1_unref_slave() held the mutex while
it waited, in w1_therm_remove_slave(), for these very callbacks and for
the readers of the sensor, who need the bus_mutex which
trigger_bulk_read() holds around its second walk. Now nothing is waited
for with list_mutex held, and none of the other mutexes of the subsystem
is taken under it, so it can be nested inside bus_mutex.
Fixes: 57c76221d5af ("w1_therm: adding bulk read support to trigger multiple conversion on bus")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-llm-char-misc-w1-v1-8-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/w1/slaves/w1_therm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 8e0e6f122b08c..f06f87bf976da 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -1509,6 +1509,7 @@ static int trigger_bulk_read(struct w1_master *dev_master)
* and compute duration of conversion for these devices
* so we can apply a strong pullup if required
*/
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl)) {
int t_cur = conversion_time(sl);
@@ -1520,6 +1521,7 @@ static int trigger_bulk_read(struct w1_master *dev_master)
w1_strong_pullup));
}
}
+ mutex_unlock(&dev_master->list_mutex);
/*
* t_conv is the max conversion time required on the bus
@@ -1546,11 +1548,13 @@ static int trigger_bulk_read(struct w1_master *dev_master)
w1_write_8(dev_master, W1_CONVERT_TEMP);
/* set a flag to instruct that converT pending */
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl,
&dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl))
SLAVE_CONVERT_TRIGGERED(sl) = -1;
}
+ mutex_unlock(&dev_master->list_mutex);
if (strong_pullup) { /* some device need pullup */
sleep_rem = msleep_interruptible(t_conv);
@@ -1576,10 +1580,12 @@ static int trigger_bulk_read(struct w1_master *dev_master)
mutex_unlock(&dev_master->bus_mutex);
set_flag:
/* set a flag to register convsersion is done */
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl))
SLAVE_CONVERT_TRIGGERED(sl) = 1;
}
+ mutex_unlock(&dev_master->list_mutex);
error:
return ret;
}
@@ -1944,6 +1950,7 @@ static ssize_t therm_bulk_read_show(struct device *device,
struct w1_slave *sl = NULL;
int ret = 0;
+ mutex_lock(&dev_master->list_mutex);
list_for_each_entry(sl, &dev_master->slist, w1_slave_entry) {
if (bulk_read_slave(sl)) {
if (SLAVE_CONVERT_TRIGGERED(sl) == -1) {
@@ -1956,6 +1963,7 @@ static ssize_t therm_bulk_read_show(struct device *device,
}
}
show_result:
+ mutex_unlock(&dev_master->list_mutex);
return sprintf(buf, "%d\n", ret);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 098/703] usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (96 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 097/703] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 099/703] iio: humidity: hid-sensor-humidity: Use per-instance callbacks Greg Kroah-Hartman
` (309 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Philipp Zabel,
Radhey Shyam Pandey, Thinh Nguyen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
[ Upstream commit 6c6508e742b47539224eb18cb23f7ed5d401dcb6 ]
dwc3_xlnx_init_zynqmp() leaves the controller out of reset with the PHY
powered on, but nothing undoes that if probe fails later or when the
driver is removed. The resets stay deasserted and the PHY stays on with
no driver bound.
Register the teardown with devm_add_action_or_reset() once init has
completed, so it runs on probe failure without the driver having to
track how far init progressed. The teardown only undoes the reset cycle
init performed, so it carries the same usb3-phy guard: with no PHY the
resets were never asserted, and asserting them could break a USB3
configuration that is live but missing from the device tree.
The resets have to be asserted while the clocks are still running, so
both the probe error path and remove() run the teardown explicitly
before gating the clocks rather than leaving it to devres, which would
otherwise run it afterwards. devm_release_action() unlinks the action
before calling it, so devres cannot run it a second time.
Running it from remove() also covers .shutdown, which shares
dwc3_xlnx_remove(): device_shutdown() does not call
devres_release_all(), so a teardown left to devres would never run
there.
Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms")
Cc: stable <stable@kernel.org>
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20260928120015.3152461-4-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/dwc3/dwc3-xilinx.c | 44 +++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c
index 7e25ccd42be4f..05fc5d3ab8899 100644
--- a/drivers/usb/dwc3/dwc3-xilinx.c
+++ b/drivers/usb/dwc3/dwc3-xilinx.c
@@ -120,6 +120,39 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv_data)
return 0;
}
+static void dwc3_xlnx_zynqmp_teardown(void *data)
+{
+ struct dwc3_xlnx *priv_data = data;
+
+ phy_power_off(priv_data->usb3_phy);
+
+ /*
+ * Undo only the reset cycle init performed. As on the init error
+ * path, the unconditional deasserts are not paired with an assert
+ * here: with no usb3-phy, resetting the core could break a USB3
+ * configuration that is live but missing from the device tree.
+ */
+ if (priv_data->usb3_phy) {
+ reset_control_assert(priv_data->usb_hibrst);
+ reset_control_assert(priv_data->usb_crst);
+ reset_control_assert(priv_data->usb_apbrst);
+ }
+
+ phy_exit(priv_data->usb3_phy);
+}
+
+/*
+ * Run the platform teardown explicitly, so the resets are asserted while the
+ * clocks are still running. devm_release_action() unlinks the action before
+ * calling it, so devres will not run it a second time.
+ */
+static void dwc3_xlnx_release_teardown(struct device *dev,
+ struct dwc3_xlnx *priv_data)
+{
+ if (devm_is_action_added(dev, dwc3_xlnx_zynqmp_teardown, priv_data))
+ devm_release_action(dev, dwc3_xlnx_zynqmp_teardown, priv_data);
+}
+
static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
{
struct device *dev = priv_data->dev;
@@ -236,7 +269,8 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG);
- return 0;
+ return devm_add_action_or_reset(dev, dwc3_xlnx_zynqmp_teardown,
+ priv_data);
err_phy_power_off:
phy_power_off(priv_data->usb3_phy);
@@ -363,6 +397,7 @@ static int dwc3_xlnx_probe(struct platform_device *pdev)
pm_runtime_set_suspended(dev);
err_clk_put:
+ dwc3_xlnx_release_teardown(dev, priv_data);
clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks);
return ret;
@@ -375,6 +410,13 @@ static void dwc3_xlnx_remove(struct platform_device *pdev)
of_platform_depopulate(dev);
+ /*
+ * This is also what makes .shutdown behave the same as .remove:
+ * device_shutdown() does not call devres_release_all(), so a teardown
+ * left to devres would never run on the shutdown path.
+ */
+ dwc3_xlnx_release_teardown(dev, priv_data);
+
clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks);
priv_data->num_clocks = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 099/703] iio: humidity: hid-sensor-humidity: Use per-instance callbacks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (97 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 098/703] usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 100/703] iio: proximity: Remove redundant dev_err()/dev_err_probe() Greg Kroah-Hartman
` (308 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christopher Hoover, Joshua Crofts,
Srinivas Pandruvada, Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Hoover <ch@murgatroid.com>
[ Upstream commit bbe4f3f668babc9443fc1f075695e43e17ca7976 ]
hid-sensor-humidity keeps a single static struct
hid_sensor_hub_callbacks for all instances and overwrites its pdev in
every probe, so with two humidity sensors, input reports for one are
delivered with the other's platform device, and a NULL dereference
follows once that device is removed. The same bug was found in
hid-sensor-temperature, which shares this code.
Keep the callbacks in struct hid_humidity_state, as the other HID
sensor drivers (accel, gyro, als, ...) do.
Fixes: d7ed89d5aadf ("iio: hid: Add humidity sensor support")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Hoover <ch@murgatroid.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
[ sashal: Context lines differed only in whitespace and offset, so the hunk was adjusted to match the existing continuation-line indentation; the change itself is otherwise identical to upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/humidity/hid-sensor-humidity.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
index be2338d5f4070..1286e6f5dba3f 100644
--- a/drivers/iio/humidity/hid-sensor-humidity.c
+++ b/drivers/iio/humidity/hid-sensor-humidity.c
@@ -16,6 +16,7 @@
struct hid_humidity_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info humidity_attr;
+ struct hid_sensor_hub_callbacks callbacks;
struct {
s32 humidity_data;
aligned_s64 timestamp;
@@ -184,11 +185,6 @@ static int humidity_parse_report(struct platform_device *pdev,
return ret;
}
-static struct hid_sensor_hub_callbacks humidity_callbacks = {
- .send_event = &humidity_proc_event,
- .capture_sample = &humidity_capture_sample,
-};
-
/* Function to initialize the processing for usage id */
static int hid_humidity_probe(struct platform_device *pdev)
{
@@ -240,9 +236,13 @@ static int hid_humidity_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, indio_dev);
- humidity_callbacks.pdev = pdev;
+ humid_st->callbacks = (struct hid_sensor_hub_callbacks) {
+ .send_event = humidity_proc_event,
+ .capture_sample = humidity_capture_sample,
+ .pdev = pdev,
+ };
ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY,
- &humidity_callbacks);
+ &humid_st->callbacks);
if (ret)
goto error_remove_trigger;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 100/703] iio: proximity: Remove redundant dev_err()/dev_err_probe()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (98 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 099/703] iio: humidity: hid-sensor-humidity: Use per-instance callbacks Greg Kroah-Hartman
@ 2026-12-04 9:59 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 101/703] iio: proximity: hx9023s: Allocate trigger before requesting IRQ Greg Kroah-Hartman
` (307 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 9:59 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pan Chuang, Andy Shevchenko,
Joshua Crofts, Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pan Chuang <panchuang@vivo.com>
[ Upstream commit 7963090626a5de900d2404e451234ea098012ba2 ]
Since commit
55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()"),
devm_request_irq() and devm_request_threaded_irq() automatically log
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() and dev_err_probe() calls.
Standardize error check on if (ret) rather than if (ret < 0)
Signed-off-by: Pan Chuang <panchuang@vivo.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Stable-dep-of: bfa3b177d839 ("iio: proximity: hx9023s: Allocate trigger before requesting IRQ")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/proximity/as3935.c | 4 +---
drivers/iio/proximity/d3323aa.c | 2 +-
drivers/iio/proximity/hx9023s.c | 2 +-
drivers/iio/proximity/irsd200.c | 2 +-
drivers/iio/proximity/mb1232.c | 4 +---
drivers/iio/proximity/srf04.c | 4 +---
drivers/iio/proximity/sx_common.c | 2 +-
drivers/iio/proximity/vcnl3020.c | 6 +-----
drivers/iio/proximity/vl53l0x-i2c.c | 4 +---
9 files changed, 9 insertions(+), 21 deletions(-)
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index f1018b14aecfd..e063bd99af8f3 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -429,10 +429,8 @@ static int as3935_probe(struct spi_device *spi)
dev_name(dev),
indio_dev);
- if (ret) {
- dev_err(dev, "unable to request irq\n");
+ if (ret)
return ret;
- }
ret = devm_iio_device_register(dev, indio_dev);
if (ret < 0) {
diff --git a/drivers/iio/proximity/d3323aa.c b/drivers/iio/proximity/d3323aa.c
index 30821f5834547..7ac230b342ffd 100644
--- a/drivers/iio/proximity/d3323aa.c
+++ b/drivers/iio/proximity/d3323aa.c
@@ -772,7 +772,7 @@ static int d3323aa_probe(struct platform_device *pdev)
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
dev_name(dev), indio_dev);
if (ret)
- return dev_err_probe(dev, ret, "Could not request IRQ\n");
+ return ret;
ret = d3323aa_setup(indio_dev, D3323AA_LP_FILTER_FREQ_DEFAULT_IDX,
D3323AA_FILTER_GAIN_DEFAULT_IDX,
diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index 17e00ee2b6f84..8488b9a751f2c 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -1137,7 +1137,7 @@ static int hx9023s_probe(struct i2c_client *client)
IRQF_ONESHOT,
"hx9023s_event", indio_dev);
if (ret)
- return dev_err_probe(dev, ret, "irq request failed\n");
+ return ret;
data->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name,
diff --git a/drivers/iio/proximity/irsd200.c b/drivers/iio/proximity/irsd200.c
index 65af31d434531..b3db7f3a49f6d 100644
--- a/drivers/iio/proximity/irsd200.c
+++ b/drivers/iio/proximity/irsd200.c
@@ -910,7 +910,7 @@ static int irsd200_probe(struct i2c_client *client)
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
NULL, indio_dev);
if (ret)
- return dev_err_probe(data->dev, ret, "Could not request irq\n");
+ return ret;
trigger = devm_iio_trigger_alloc(data->dev, "%s-dev%d", indio_dev->name,
iio_device_id(indio_dev));
diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c
index 34b49c54e68b0..c4fc840e11fb5 100644
--- a/drivers/iio/proximity/mb1232.c
+++ b/drivers/iio/proximity/mb1232.c
@@ -214,10 +214,8 @@ static int mb1232_probe(struct i2c_client *client)
if (data->irqnr > 0) {
ret = devm_request_irq(dev, data->irqnr, mb1232_handle_irq,
IRQF_TRIGGER_FALLING, id->name, indio_dev);
- if (ret < 0) {
- dev_err(dev, "request_irq: %d\n", ret);
+ if (ret)
return ret;
- }
}
ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
index 337938657449d..884f8578d7fe0 100644
--- a/drivers/iio/proximity/srf04.c
+++ b/drivers/iio/proximity/srf04.c
@@ -304,10 +304,8 @@ static int srf04_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, data->irqnr, srf04_handle_irq,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
pdev->name, indio_dev);
- if (ret < 0) {
- dev_err(data->dev, "request_irq: %d\n", ret);
+ if (ret)
return ret;
- }
platform_set_drvdata(pdev, indio_dev);
diff --git a/drivers/iio/proximity/sx_common.c b/drivers/iio/proximity/sx_common.c
index 59b35e40739b0..4d4937395d9a5 100644
--- a/drivers/iio/proximity/sx_common.c
+++ b/drivers/iio/proximity/sx_common.c
@@ -517,7 +517,7 @@ int sx_common_probe(struct i2c_client *client,
IRQF_ONESHOT,
"sx_event", indio_dev);
if (ret)
- return dev_err_probe(dev, ret, "No IRQ\n");
+ return ret;
data->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name,
diff --git a/drivers/iio/proximity/vcnl3020.c b/drivers/iio/proximity/vcnl3020.c
index d0b8f429999f9..768870127ff87 100644
--- a/drivers/iio/proximity/vcnl3020.c
+++ b/drivers/iio/proximity/vcnl3020.c
@@ -648,12 +648,8 @@ static int vcnl3020_probe(struct i2c_client *client)
NULL, vcnl3020_handle_irq_thread,
IRQF_ONESHOT, indio_dev->name,
indio_dev);
- if (rc) {
- dev_err(&client->dev,
- "Error (%d) irq request failed (%u)\n", rc,
- client->irq);
+ if (rc)
return rc;
- }
}
return devm_iio_device_register(&client->dev, indio_dev);
diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index 913ac191a187e..1dc18b978298d 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -127,10 +127,8 @@ static int vl53l0x_configure_irq(struct i2c_client *client,
ret = devm_request_threaded_irq(&client->dev, client->irq,
NULL, vl53l0x_threaded_irq,
irq_flags | IRQF_ONESHOT, indio_dev->name, indio_dev);
- if (ret) {
- dev_err(&client->dev, "devm_request_irq error: %d\n", ret);
+ if (ret)
return ret;
- }
ret = i2c_smbus_write_byte_data(data->client,
VL_REG_SYSTEM_INTERRUPT_CONFIG_GPIO,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 101/703] iio: proximity: hx9023s: Allocate trigger before requesting IRQ
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (99 preceding siblings ...)
2026-12-04 9:59 ` [PATCH 6.18 100/703] iio: proximity: Remove redundant dev_err()/dev_err_probe() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 102/703] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
` (306 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak,
Joshua Crofts, Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit bfa3b177d839bb303d0187335115b572a2644920 ]
An IRQ handler that already read trigger_enabled can poll data->trig
after buffer disable. Detaching the virtual IRQ does not join this
physical IRQ, and trigger deselection can drop the consumer reference.
Devres may then free the trigger before joining the handler.
Allocate the trigger before requesting the IRQ so devres joins the
handler before dropping the allocation reference.
This issue was identified as part of our ongoing research while
reviewing kernel code.
Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/proximity/hx9023s.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index 8488b9a751f2c..1fba29265bfd5 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -1131,14 +1131,6 @@ static int hx9023s_probe(struct i2c_client *client)
return dev_err_probe(dev, ret, "reg config failed\n");
if (client->irq) {
- ret = devm_request_threaded_irq(dev, client->irq,
- hx9023s_irq_handler,
- hx9023s_irq_thread_handler,
- IRQF_ONESHOT,
- "hx9023s_event", indio_dev);
- if (ret)
- return ret;
-
data->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name,
iio_device_id(indio_dev));
@@ -1148,6 +1140,14 @@ static int hx9023s_probe(struct i2c_client *client)
data->trig->ops = &hx9023s_trigger_ops;
iio_trigger_set_drvdata(data->trig, indio_dev);
+ ret = devm_request_threaded_irq(dev, client->irq,
+ hx9023s_irq_handler,
+ hx9023s_irq_thread_handler,
+ IRQF_ONESHOT,
+ "hx9023s_event", indio_dev);
+ if (ret)
+ return ret;
+
ret = devm_iio_trigger_register(dev, data->trig);
if (ret)
return dev_err_probe(dev, ret,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 102/703] ipvs: read flags and seqs in master atomically
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (100 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 101/703] iio: proximity: hx9023s: Allocate trigger before requesting IRQ Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 103/703] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
` (305 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <ja@ssi.bg>
[ Upstream commit aa9afc79f57ba5ef4385aa85cfb7dd50d5c484f6 ]
After we fixed the double read of cp->flags in the master with
commit 3e3fe49e8678 ("ipvs: fix buffer overflow when sending sync messages")
Sashiko reports that we should also read the cp->flags and the seqs
atomically. So if the SEQ_MASK is set, re-read the flags and the
seqs under cp->lock to provide a snapshot when sending the sync
message.
Fixes: 3e3fe49e8678 ("ipvs: fix buffer overflow when sending sync messages")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260927220816.268206-1-pablo%40netfilter.org
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/ipvs/ip_vs_sync.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index 0036008fee65f..2f18c2b0b3e85 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -540,6 +540,7 @@ static int ip_vs_sync_conn_needed(struct netns_ipvs *ipvs,
static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
int pkts)
{
+ struct ip_vs_sync_conn_options opts;
struct ip_vs_sync_mesg_v0 *m;
struct ip_vs_sync_conn_v0 *s;
struct ip_vs_sync_buff *buff;
@@ -558,6 +559,14 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
if (!ip_vs_sync_conn_needed(ipvs, cp, pkts))
return;
+ if (flags & IP_VS_CONN_F_SEQ_MASK) {
+ /* Take atomic snapshot of flags and seqs */
+ spin_lock_bh(&cp->lock);
+ flags = cp->flags;
+ memcpy(&opts, &cp->sync_conn_opt, sizeof(opts));
+ spin_unlock_bh(&cp->lock);
+ }
+
spin_lock_bh(&ipvs->sync_buff_lock);
if (!(ipvs->sync_state & IP_VS_STATE_MASTER)) {
spin_unlock_bh(&ipvs->sync_buff_lock);
@@ -605,7 +614,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
if (seq_mask) {
struct ip_vs_sync_conn_options *opt =
(struct ip_vs_sync_conn_options *)&s[1];
- memcpy(opt, &cp->sync_conn_opt, sizeof(*opt));
+ memcpy(opt, &opts, sizeof(*opt));
}
m->nr_conns++;
@@ -631,6 +640,7 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,
*/
void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
{
+ struct ip_vs_sync_conn_options opts;
struct ip_vs_sync_mesg *m;
union ip_vs_sync_conn *s;
struct ip_vs_sync_buff *buff;
@@ -652,6 +662,13 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
if (!ip_vs_sync_conn_needed(ipvs, cp, pkts))
goto control;
flags = READ_ONCE(cp->flags);
+ if (flags & IP_VS_CONN_F_SEQ_MASK) {
+ /* Take atomic snapshot of flags and seqs */
+ spin_lock_bh(&cp->lock);
+ flags = cp->flags;
+ memcpy(&opts, &cp->sync_conn_opt, sizeof(opts));
+ spin_unlock_bh(&cp->lock);
+ }
/* Sanity checks */
pe_name_len = 0;
@@ -753,9 +770,9 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)
if (seq_mask) {
*(p++) = IPVS_OPT_SEQ_DATA;
*(p++) = sizeof(struct ip_vs_sync_conn_options);
- hton_seq(&cp->in_seq, (struct ip_vs_seq *)p);
+ hton_seq(&opts.in_seq, (struct ip_vs_seq *)p);
p += sizeof(struct ip_vs_seq);
- hton_seq(&cp->out_seq, (struct ip_vs_seq *)p);
+ hton_seq(&opts.out_seq, (struct ip_vs_seq *)p);
p += sizeof(struct ip_vs_seq);
}
/* Handle pe data */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 103/703] ipvs: honor the overload state and do not enter it forever
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (101 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 102/703] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 104/703] drm/ast: Handle framebuffer from dma-buf Greg Kroah-Hartman
` (304 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julian Anastasov, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <ja@ssi.bg>
[ Upstream commit 567ca80d77baf4c9ab635865375956084c8bb52a ]
Sashiko warns that we may enter the dest overload state forever
if setting the u_threshold to 1 races with the ip_vs_unbind_dest()
call for the last connection for dest. The problem is that we
prefer ip_vs_unbind_dest() to avoid using locks while reading the
threshold.
To avoid the race, add a smp_mb() in __ip_vs_dest_update_overload()
that is paired with the atomic_fetch_dec() in ip_vs_unbind_dest()
which allows to re-read the totalconns and to leave the overload
state if we are below l_threshold_val.
Also, remove the overload parameter from ip_vs_dest_update_overload()
because we just need to know the current state while deciding
which threshold ranges to use. This ip_vs_dest_is_overloaded() check
can be in __ip_vs_dest_update_overload() instead.
To avoid ip_vs_bind_dest() to enter lock just to initialize
u_threshold_val to INT_MAX, do it in ip_vs_new_dest().
The LBLC and LBLCR schedulers do not honor the global overload state
for cached dests, so add a ip_vs_dest_is_overloaded() check for
the situations where we may fallback from overloaded dest (LBLC and
LBLCR) or when we hit a cached dest (LBLC).
Also, move the ip_vs_dest_set_min() call in LBLCR after the
ip_vs_dest_set_erase() call that removes the most-loaded
server because due to races we may work with dest that is
in process of removing, i.e. ip_vs_dest_set_min() and
ip_vs_dest_set_max() may return same dest.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261019150249.1879516-2-pablo%40netfilter.org
Fixes: 3ba20137287f ("ipvs: fix more races around the overload flag")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/ip_vs.h | 2 +-
net/netfilter/ipvs/ip_vs_conn.c | 4 ++--
net/netfilter/ipvs/ip_vs_ctl.c | 30 ++++++++++++++++++------------
net/netfilter/ipvs/ip_vs_lblc.c | 8 +++++---
net/netfilter/ipvs/ip_vs_lblcr.c | 13 +++++++------
5 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 7b887e72bc9f9..03279a0b1c1a8 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1596,7 +1596,7 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
kfree(dest);
}
-void ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload);
+void ip_vs_dest_update_overload(struct ip_vs_dest *dest);
/* Check if dest is in overloaded state */
static inline bool ip_vs_dest_is_overloaded(const struct ip_vs_dest *dest)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index b9d83b4d870a0..1985c90c3aef6 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -634,7 +634,7 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
atomic_inc(&dest->activeconns);
tc = atomic_inc_return(&dest->totalconns);
if (tc >= READ_ONCE(dest->u_threshold_val))
- ip_vs_dest_update_overload(dest, true);
+ ip_vs_dest_update_overload(dest);
} else {
/* It is a persistent connection/template, so increase
the persistent connection counter */
@@ -727,7 +727,7 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
atomic_dec(&dest->activeconns);
tc = atomic_fetch_dec(&dest->totalconns);
if (tc <= READ_ONCE(dest->l_threshold_val))
- ip_vs_dest_update_overload(dest, false);
+ ip_vs_dest_update_overload(dest);
} else {
/* It is a persistent connection/template, so decrease
the persistent connection counter */
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 0afb2ebefcabb..5bf70b991cbae 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -960,12 +960,12 @@ void ip_vs_stats_free(struct ip_vs_stats *stats)
}
}
-/* Update overload flag based on number of dest conns and lower/upper
+/* Update overload state based on number of dest conns and lower/upper
* connection thresholds:
- * - conns reach u_threshold and exceed it: set the flag
- * - conns go below l_threshold (or 75% of u_threshold): clear the flag
+ * - conns reach u_threshold and exceed it: set the overload state
+ * - conns go below l_threshold (or 75% of u_threshold): clear the state
*/
-static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
+static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest)
{
int conns;
u32 l, u;
@@ -976,10 +976,18 @@ static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
/* Low threshold defaults to 75% of upper threshold */
l = READ_ONCE(dest->l_threshold) ? : (u - (u >> 2));
conns = atomic_read(&dest->totalconns);
- if (conns >= (overload ? l : u)) {
+ if (conns >= (ip_vs_dest_is_overloaded(dest) ? l : u)) {
WRITE_ONCE(dest->u_threshold_val, INT_MAX);
WRITE_ONCE(dest->l_threshold_val, l);
- return;
+ /* Commit thresholds before repeating the check,
+ * it is paired with atomic_fetch_dec() in
+ * ip_vs_unbind_dest() to avoid entering the
+ * overload state forever.
+ */
+ smp_mb();
+ conns = atomic_read(&dest->totalconns);
+ if (conns >= l)
+ return;
}
}
@@ -987,10 +995,10 @@ static void __ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
WRITE_ONCE(dest->l_threshold_val, 0);
}
-void ip_vs_dest_update_overload(struct ip_vs_dest *dest, bool overload)
+void ip_vs_dest_update_overload(struct ip_vs_dest *dest)
{
spin_lock_bh(&dest->dst_lock);
- __ip_vs_dest_update_overload(dest, overload);
+ __ip_vs_dest_update_overload(dest);
spin_unlock_bh(&dest->dst_lock);
}
@@ -1062,13 +1070,10 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
if (READ_ONCE(dest->u_threshold) != udest->u_threshold ||
READ_ONCE(dest->l_threshold) != udest->l_threshold) {
- bool overload;
-
spin_lock_bh(&dest->dst_lock);
WRITE_ONCE(dest->u_threshold, udest->u_threshold);
WRITE_ONCE(dest->l_threshold, udest->l_threshold);
- overload = ip_vs_dest_is_overloaded(dest);
- __ip_vs_dest_update_overload(dest, overload);
+ __ip_vs_dest_update_overload(dest);
spin_unlock_bh(&dest->dst_lock);
}
@@ -1133,6 +1138,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
if (ret < 0)
goto err_stats;
+ dest->u_threshold_val = INT_MAX;
dest->af = udest->af;
dest->protocol = svc->protocol;
dest->vaddr = svc->addr;
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index ecbb2960e1f96..6eb3afe88ec1e 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -468,10 +468,11 @@ is_overloaded(struct ip_vs_dest *dest, struct ip_vs_service *svc)
struct ip_vs_dest *d;
list_for_each_entry_rcu(d, &svc->destinations, n_list) {
- if (atomic_read(&d->activeconns)*2
- < atomic_read(&d->weight)) {
+ if (ip_vs_dest_is_overloaded(d))
+ continue;
+ if (atomic_read(&d->activeconns) * 2 <
+ atomic_read(&d->weight))
return 1;
- }
}
}
return 0;
@@ -508,6 +509,7 @@ ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
dest = en->dest;
if ((dest->cflags & IP_VS_DEST_CF_AVAILABLE) &&
+ !ip_vs_dest_is_overloaded(dest) &&
atomic_read(&dest->weight) > 0 && !is_overloaded(dest, svc))
goto out;
}
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index 0639c8510a15a..bdee6e072be71 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -631,10 +631,11 @@ is_overloaded(struct ip_vs_dest *dest, struct ip_vs_service *svc)
struct ip_vs_dest *d;
list_for_each_entry_rcu(d, &svc->destinations, n_list) {
- if (atomic_read(&d->activeconns)*2
- < atomic_read(&d->weight)) {
+ if (ip_vs_dest_is_overloaded(d))
+ continue;
+ if (atomic_read(&d->activeconns) * 2 <
+ atomic_read(&d->weight))
return 1;
- }
}
}
return 0;
@@ -659,9 +660,6 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
if (en) {
en->lastuse = jiffies;
- /* Get the least loaded destination */
- dest = ip_vs_dest_set_min(&en->set);
-
/* More than one destination + enough time passed by, cleanup */
if (atomic_read(&en->set.size) > 1 &&
time_after(jiffies, en->set.lastmod +
@@ -677,6 +675,9 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb,
spin_unlock_bh(&svc->sched_lock);
}
+ /* Get the least loaded destination */
+ dest = ip_vs_dest_set_min(&en->set);
+
/* If the destination is not overloaded, use it */
if (dest && !is_overloaded(dest, svc))
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 104/703] drm/ast: Handle framebuffer from dma-buf
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (102 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 103/703] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 105/703] iio: common: fix spelling mistakes in comments Greg Kroah-Hartman
` (303 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Zimmermann, Jocelyn Falempe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jocelyn Falempe <jfalempe@redhat.com>
[ Upstream commit 3dd0be7a301bb0adcca4f7021cfd2e366ca90a0e ]
In the atomic update callback, ast should call
drm_gem_fb_begin_cpu_access() to make sure it can read the
framebuffer from the CPU, otherwise the data might not be there due
to cache, and synchronization.
Tested on a Lenovo SE100, while rendering on the ArrowLake GPU with
i915 driver, and using ast for display.
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patch.msgid.link/20251030091627.340780-1-jfalempe@redhat.com
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/ast/ast_mode.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 30b011ed0a056..0eb6644637b85 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -572,9 +572,14 @@ static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
ast_set_vbios_color_reg(ast, fb->format, ast_crtc_state->vmode);
}
- drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
- drm_atomic_for_each_plane_damage(&iter, &damage) {
- ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage);
+ /* if the buffer comes from another device */
+ if (drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE) == 0) {
+ drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
+ drm_atomic_for_each_plane_damage(&iter, &damage) {
+ ast_handle_damage(ast_plane, shadow_plane_state->data, fb, &damage);
+ }
+
+ drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 105/703] iio: common: fix spelling mistakes in comments
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (103 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 104/703] drm/ast: Handle framebuffer from dma-buf Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 106/703] iio: inv_sensors: convert to kernel types Greg Kroah-Hartman
` (302 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shi Hao, Jonathan Cameron,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shi Hao <i.shihao.999@gmail.com>
[ Upstream commit 96f46405219d9bf62d9fab76e055e3b6059b0bd5 ]
Fix spelling mistakes in comments.
- exepects -> expects
- fuction -> function
- theoritical -> theoretical
- appopriate -> appropriate
- iio -> IIO
Signed-off-by: Shi Hao <i.shihao.999@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stable-dep-of: 3785dffc7c68 ("iio: inv_sensors: prevent timestamps going back in time in transitions")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 2 +-
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 4 ++--
drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index 82cef4a124427..f34e2bbba2d1e 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -106,7 +106,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
switch (st->core.type) {
case MOTIONSENSE_TYPE_ACCEL:
/*
- * EC returns data in g, iio exepects m/s^2.
+ * EC returns data in g, IIO expects m/s^2.
* Do not use IIO_G_TO_M_S_2 to avoid precision loss.
*/
*val = div_s64(val64 * 980665, 10);
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 2e3f3f41fdaaa..3fd661b1f42f6 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -356,7 +356,7 @@ int hid_sensor_write_raw_hyst_rel_value(struct hid_sensor_common *st,
EXPORT_SYMBOL_NS(hid_sensor_write_raw_hyst_rel_value, "IIO_HID");
/*
- * This fuction applies the unit exponent to the scale.
+ * This function applies the unit exponent to the scale.
* For example:
* 9.806650000 ->exp:2-> val0[980]val1[665000000]
* 9.000806000 ->exp:2-> val0[900]val1[80600000]
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index 97526ba87b934..e0b10366ed2bf 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -154,7 +154,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
valid = inv_update_chip_period(ts, period);
}
- /* no previous data, compute theoritical value from interrupt */
+ /* no previous data, compute theoretical value from interrupt */
if (ts->timestamp == 0) {
/* elapsed time: sensor period * sensor samples number */
interval = (int64_t)ts->period * (int64_t)sample_nb;
@@ -185,7 +185,7 @@ void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts,
/*
* After ODR change the time interval with the previous sample is
- * undertermined (depends when the change occures). So we compute the
+ * undertermined (depends when the change occurs). So we compute the
* timestamp from the current interrupt using the new FIFO period, the
* total number of samples and the current sample numero.
*/
diff --git a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
index 5884708636818..1960a2ce82a8b 100644
--- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
+++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
@@ -96,7 +96,7 @@ EXPORT_SYMBOL_NS(ms_sensors_read_prom_word, "IIO_MEAS_SPEC_SENSORS");
*
* Generic ADC conversion & read function for Measurement Specialties
* devices.
- * The function will issue conversion command, sleep appopriate delay, and
+ * The function will issue conversion command, sleep appropriate delay, and
* issue command to read ADC.
*
* Return: 0 on success, negative errno otherwise.
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 106/703] iio: inv_sensors: convert to kernel types
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (104 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 105/703] iio: common: fix spelling mistakes in comments Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 107/703] iio: inv_sensors: better timestamp alignment when using watermark Greg Kroah-Hartman
` (301 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andy Shevchenko,
Jean-Baptiste Maneyrol, Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit 1330597c7480611334977ff66878fd40b411fa41 ]
Convert standard types (u)intXX_t to kernel type u/sXX.
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Stable-dep-of: 3785dffc7c68 ("iio: inv_sensors: prevent timestamps going back in time in transitions")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../inv_sensors/inv_sensors_timestamp.c | 48 +++++++++----------
.../linux/iio/common/inv_sensors_timestamp.h | 34 ++++++-------
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index e0b10366ed2bf..ecfd54ffe7e92 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -19,9 +19,9 @@
(((_val) * (1000 + (_jitter))) / 1000)
/* Add a new value inside an accumulator and update the estimate value */
-static void inv_update_acc(struct inv_sensors_timestamp_acc *acc, uint32_t val)
+static void inv_update_acc(struct inv_sensors_timestamp_acc *acc, u32 val)
{
- uint64_t sum = 0;
+ u64 sum = 0;
size_t i;
acc->values[acc->idx++] = val;
@@ -58,9 +58,9 @@ void inv_sensors_timestamp_init(struct inv_sensors_timestamp *ts,
EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_init, "IIO_INV_SENSORS_TIMESTAMP");
int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
- uint32_t period, bool fifo)
+ u32 period, bool fifo)
{
- uint32_t mult;
+ u32 mult;
/* when FIFO is on, prevent odr change if one is already pending */
if (fifo && ts->new_mult != 0)
@@ -78,9 +78,9 @@ int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
}
EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_update_odr, "IIO_INV_SENSORS_TIMESTAMP");
-static bool inv_validate_period(struct inv_sensors_timestamp *ts, uint32_t period)
+static bool inv_validate_period(struct inv_sensors_timestamp *ts, u32 period)
{
- uint32_t period_min, period_max;
+ u32 period_min, period_max;
/* check that period is acceptable */
period_min = ts->min_period * ts->mult;
@@ -92,9 +92,9 @@ static bool inv_validate_period(struct inv_sensors_timestamp *ts, uint32_t perio
}
static bool inv_update_chip_period(struct inv_sensors_timestamp *ts,
- uint32_t period)
+ u32 period)
{
- uint32_t new_chip_period;
+ u32 new_chip_period;
if (!inv_validate_period(ts, period))
return false;
@@ -109,19 +109,19 @@ static bool inv_update_chip_period(struct inv_sensors_timestamp *ts,
static void inv_align_timestamp_it(struct inv_sensors_timestamp *ts)
{
- const int64_t period_min = (int64_t)ts->min_period * ts->mult;
- const int64_t period_max = (int64_t)ts->max_period * ts->mult;
- int64_t add_max, sub_max;
- int64_t delta, jitter;
- int64_t adjust;
+ const s64 period_min = (s64)ts->min_period * ts->mult;
+ const s64 period_max = (s64)ts->max_period * ts->mult;
+ s64 add_max, sub_max;
+ s64 delta, jitter;
+ s64 adjust;
/* delta time between last sample and last interrupt */
delta = ts->it.lo - ts->timestamp;
/* adjust timestamp while respecting jitter */
- add_max = period_max - (int64_t)ts->period;
- sub_max = period_min - (int64_t)ts->period;
- jitter = INV_SENSORS_TIMESTAMP_JITTER((int64_t)ts->period, ts->chip.jitter);
+ add_max = period_max - (s64)ts->period;
+ sub_max = period_min - (s64)ts->period;
+ jitter = INV_SENSORS_TIMESTAMP_JITTER((s64)ts->period, ts->chip.jitter);
if (delta > jitter)
adjust = add_max;
else if (delta < -jitter)
@@ -133,11 +133,11 @@ static void inv_align_timestamp_it(struct inv_sensors_timestamp *ts)
}
void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
- size_t sample_nb, int64_t timestamp)
+ size_t sample_nb, s64 timestamp)
{
struct inv_sensors_timestamp_interval *it;
- int64_t delta, interval;
- uint32_t period;
+ s64 delta, interval;
+ u32 period;
bool valid = false;
if (sample_nb == 0)
@@ -157,7 +157,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
/* no previous data, compute theoretical value from interrupt */
if (ts->timestamp == 0) {
/* elapsed time: sensor period * sensor samples number */
- interval = (int64_t)ts->period * (int64_t)sample_nb;
+ interval = (s64)ts->period * (s64)sample_nb;
ts->timestamp = it->up - interval;
return;
}
@@ -169,11 +169,11 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_interrupt, "IIO_INV_SENSORS_TIMESTAMP");
void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts,
- uint32_t fifo_period, size_t fifo_nb,
+ u32 fifo_period, size_t fifo_nb,
unsigned int fifo_no)
{
- int64_t interval;
- uint32_t fifo_mult;
+ s64 interval;
+ u32 fifo_mult;
if (ts->new_mult == 0)
return;
@@ -194,7 +194,7 @@ void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts,
fifo_mult = fifo_period / ts->chip.clock_period;
fifo_period = fifo_mult * ts->chip_period.val;
/* computes time interval between interrupt and this sample */
- interval = (int64_t)(fifo_nb - fifo_no) * (int64_t)fifo_period;
+ interval = (s64)(fifo_nb - fifo_no) * (s64)fifo_period;
ts->timestamp = ts->it.up - interval;
}
}
diff --git a/include/linux/iio/common/inv_sensors_timestamp.h b/include/linux/iio/common/inv_sensors_timestamp.h
index 8d506f1e9df29..e4e720e6f4b72 100644
--- a/include/linux/iio/common/inv_sensors_timestamp.h
+++ b/include/linux/iio/common/inv_sensors_timestamp.h
@@ -13,9 +13,9 @@
* @init_period: chip initial period at reset in ns
*/
struct inv_sensors_timestamp_chip {
- uint32_t clock_period;
- uint32_t jitter;
- uint32_t init_period;
+ u32 clock_period;
+ u32 jitter;
+ u32 init_period;
};
/**
@@ -24,8 +24,8 @@ struct inv_sensors_timestamp_chip {
* @up: interval upper bound
*/
struct inv_sensors_timestamp_interval {
- int64_t lo;
- int64_t up;
+ s64 lo;
+ s64 up;
};
/**
@@ -35,9 +35,9 @@ struct inv_sensors_timestamp_interval {
* @values: table of all measured values, use for computing the mean
*/
struct inv_sensors_timestamp_acc {
- uint32_t val;
+ u32 val;
size_t idx;
- uint32_t values[32];
+ u32 values[32];
};
/**
@@ -54,13 +54,13 @@ struct inv_sensors_timestamp_acc {
*/
struct inv_sensors_timestamp {
struct inv_sensors_timestamp_chip chip;
- uint32_t min_period;
- uint32_t max_period;
+ u32 min_period;
+ u32 max_period;
struct inv_sensors_timestamp_interval it;
- int64_t timestamp;
- uint32_t mult;
- uint32_t new_mult;
- uint32_t period;
+ s64 timestamp;
+ u32 mult;
+ u32 new_mult;
+ u32 period;
struct inv_sensors_timestamp_acc chip_period;
};
@@ -68,19 +68,19 @@ void inv_sensors_timestamp_init(struct inv_sensors_timestamp *ts,
const struct inv_sensors_timestamp_chip *chip);
int inv_sensors_timestamp_update_odr(struct inv_sensors_timestamp *ts,
- uint32_t period, bool fifo);
+ u32 period, bool fifo);
void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
- size_t sample_nb, int64_t timestamp);
+ size_t sample_nb, s64 timestamp);
-static inline int64_t inv_sensors_timestamp_pop(struct inv_sensors_timestamp *ts)
+static inline s64 inv_sensors_timestamp_pop(struct inv_sensors_timestamp *ts)
{
ts->timestamp += ts->period;
return ts->timestamp;
}
void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts,
- uint32_t fifo_period, size_t fifo_nb,
+ u32 fifo_period, size_t fifo_nb,
unsigned int fifo_no);
static inline void inv_sensors_timestamp_reset(struct inv_sensors_timestamp *ts)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 107/703] iio: inv_sensors: better timestamp alignment when using watermark
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (105 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 106/703] iio: inv_sensors: convert to kernel types Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 108/703] iio: inv_sensors: improve period measurement by using a longer delay Greg Kroah-Hartman
` (300 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit 8f4b627656fa1767d8337a95849fe7c895b6f68a ]
Current interrupt timestamp alignment only changes the final timestamp.
When the watermark is in use, we have a batch of samples for each
interrupt. The current code doesn't manage to align the timestamp
because the jitter is too high.
Instead modify the estimated inter interrupt period and use that to
adjust the timestamp alignment over the batch in a linear fashion.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Stable-dep-of: 3785dffc7c68 ("iio: inv_sensors: prevent timestamps going back in time in transitions")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../inv_sensors/inv_sensors_timestamp.c | 51 +++++++------------
1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index ecfd54ffe7e92..2aaaa8df6d03b 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -10,9 +10,7 @@
#include <linux/iio/common/inv_sensors_timestamp.h>
-/* compute jitter, min and max following jitter in per mille */
-#define INV_SENSORS_TIMESTAMP_JITTER(_val, _jitter) \
- (div_s64((_val) * (_jitter), 1000))
+/* compute min and max following jitter in per mille */
#define INV_SENSORS_TIMESTAMP_MIN(_val, _jitter) \
(((_val) * (1000 - (_jitter))) / 1000)
#define INV_SENSORS_TIMESTAMP_MAX(_val, _jitter) \
@@ -102,34 +100,22 @@ static bool inv_update_chip_period(struct inv_sensors_timestamp *ts,
/* update chip internal period estimation */
new_chip_period = period / ts->mult;
inv_update_acc(&ts->chip_period, new_chip_period);
- ts->period = ts->mult * ts->chip_period.val;
return true;
}
-static void inv_align_timestamp_it(struct inv_sensors_timestamp *ts)
+static u32 inv_align_timestamp_it(struct inv_sensors_timestamp *ts,
+ unsigned int sample_nb)
{
const s64 period_min = (s64)ts->min_period * ts->mult;
const s64 period_max = (s64)ts->max_period * ts->mult;
- s64 add_max, sub_max;
- s64 delta, jitter;
- s64 adjust;
-
- /* delta time between last sample and last interrupt */
- delta = ts->it.lo - ts->timestamp;
-
- /* adjust timestamp while respecting jitter */
- add_max = period_max - (s64)ts->period;
- sub_max = period_min - (s64)ts->period;
- jitter = INV_SENSORS_TIMESTAMP_JITTER((s64)ts->period, ts->chip.jitter);
- if (delta > jitter)
- adjust = add_max;
- else if (delta < -jitter)
- adjust = sub_max;
- else
- adjust = 0;
+ s64 new_period;
+
+ /* compute new period aligning last timestamp with interrupt timestamp */
+ new_period = div_s64(ts->it.up - ts->timestamp, sample_nb);
- ts->timestamp += adjust;
+ /* ensure that period never overflows the jitter */
+ return clamp(new_period, period_min, period_max);
}
void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
@@ -143,6 +129,13 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
if (sample_nb == 0)
return;
+ /* no previous data, compute theoretical value from interrupt */
+ if (ts->timestamp == 0) {
+ /* elapsed time: sensor period * sensor samples number */
+ interval = (s64)ts->period * (s64)sample_nb;
+ ts->timestamp = timestamp - interval;
+ }
+
/* update interrupt timestamp and compute chip and sensor periods */
it = &ts->it;
it->lo = it->up;
@@ -154,17 +147,11 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
valid = inv_update_chip_period(ts, period);
}
- /* no previous data, compute theoretical value from interrupt */
- if (ts->timestamp == 0) {
- /* elapsed time: sensor period * sensor samples number */
- interval = (s64)ts->period * (s64)sample_nb;
- ts->timestamp = it->up - interval;
- return;
- }
-
/* if interrupt interval is valid, sync with interrupt timestamp */
if (valid)
- inv_align_timestamp_it(ts);
+ ts->period = inv_align_timestamp_it(ts, sample_nb);
+ else
+ ts->period = ts->mult * ts->chip_period.val;
}
EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_interrupt, "IIO_INV_SENSORS_TIMESTAMP");
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 108/703] iio: inv_sensors: improve period measurement by using a longer delay
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (106 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 107/703] iio: inv_sensors: better timestamp alignment when using watermark Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 109/703] iio: inv_sensors: prevent timestamps going back in time in transitions Greg Kroah-Hartman
` (299 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit 82bd09ce4fd3b15680735eaeafe2e688901e3b00 ]
Period measurement can be difficult when using high sampling
frequency where the jitter criteria is hard to meet because of the
system jitter.
This new version is using the delta time between 2 distant interrupts
to measure an interval of at least 20ms. 20ms is a good compromise
between the mitigation of system jitter and the delay to update
period. This way we decorrelate the period measurement from the
interrupt timestamps syncing using only the 2 last interrupts.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Stable-dep-of: 3785dffc7c68 ("iio: inv_sensors: prevent timestamps going back in time in transitions")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../inv_sensors/inv_sensors_timestamp.c | 26 ++++++++++++++++---
.../linux/iio/common/inv_sensors_timestamp.h | 6 +++++
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index 2aaaa8df6d03b..88a82d1370c50 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -16,6 +16,9 @@
#define INV_SENSORS_TIMESTAMP_MAX(_val, _jitter) \
(((_val) * (1000 + (_jitter))) / 1000)
+/* minimum timestamp delta between 2 interrupts for measuring period (20ms) */
+#define INV_SENSORS_MIN_IT_DELTA (20 * NSEC_PER_MSEC)
+
/* Add a new value inside an accumulator and update the estimate value */
static void inv_update_acc(struct inv_sensors_timestamp_acc *acc, u32 val)
{
@@ -122,7 +125,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
size_t sample_nb, s64 timestamp)
{
struct inv_sensors_timestamp_interval *it;
- s64 delta, interval;
+ s64 delta, delta_threshold, interval;
u32 period;
bool valid = false;
@@ -136,15 +139,32 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
ts->timestamp = timestamp - interval;
}
+ /* update delta timestamps and estimated period */
+ it = &ts->delta;
+ ts->delta_counter += sample_nb;
+ delta = timestamp - it->up;
+ delta_threshold = INV_SENSORS_TIMESTAMP_MIN(INV_SENSORS_MIN_IT_DELTA, ts->chip.jitter);
+ if (delta >= delta_threshold) {
+ it->lo = it->up;
+ it->up = timestamp;
+ if (it->lo != 0) {
+ /* compute period: delta time divided by number of samples */
+ delta = it->up - it->lo;
+ period = div_s64(delta, ts->delta_counter);
+ inv_update_chip_period(ts, period);
+ }
+ ts->delta_counter = 0;
+ }
+
/* update interrupt timestamp and compute chip and sensor periods */
it = &ts->it;
it->lo = it->up;
it->up = timestamp;
delta = it->up - it->lo;
if (it->lo != 0) {
- /* compute period: delta time divided by number of samples */
+ /* compute period and check validity */
period = div_s64(delta, sample_nb);
- valid = inv_update_chip_period(ts, period);
+ valid = inv_validate_period(ts, period);
}
/* if interrupt interval is valid, sync with interrupt timestamp */
diff --git a/include/linux/iio/common/inv_sensors_timestamp.h b/include/linux/iio/common/inv_sensors_timestamp.h
index e4e720e6f4b72..4f08204ede3b4 100644
--- a/include/linux/iio/common/inv_sensors_timestamp.h
+++ b/include/linux/iio/common/inv_sensors_timestamp.h
@@ -46,6 +46,8 @@ struct inv_sensors_timestamp_acc {
* @min_period: minimal acceptable clock period
* @max_period: maximal acceptable clock period
* @it: interrupts interval timestamps
+ * @delta: interval timestamps between several interrupts
+ * @delta_counter: number of data samples in the delta interval
* @timestamp: store last timestamp for computing next data timestamp
* @mult: current internal period multiplier
* @new_mult: new set internal period multiplier (not yet effective)
@@ -57,6 +59,8 @@ struct inv_sensors_timestamp {
u32 min_period;
u32 max_period;
struct inv_sensors_timestamp_interval it;
+ struct inv_sensors_timestamp_interval delta;
+ u32 delta_counter;
s64 timestamp;
u32 mult;
u32 new_mult;
@@ -88,6 +92,8 @@ static inline void inv_sensors_timestamp_reset(struct inv_sensors_timestamp *ts)
const struct inv_sensors_timestamp_interval interval_init = {0LL, 0LL};
ts->it = interval_init;
+ ts->delta = interval_init;
+ ts->delta_counter = 0;
ts->timestamp = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 109/703] iio: inv_sensors: prevent timestamps going back in time in transitions
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (107 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 108/703] iio: inv_sensors: improve period measurement by using a longer delay Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 110/703] iio: inv_sensors: fix estimated value larger than interrupt timestamp Greg Kroah-Hartman
` (298 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit 3785dffc7c68751a8429ae6dd75804c14a5a7c7a ]
Ensure when computing first timestamp and when applying odr change,
that the next timestamp will not be lower than the previous one.
This way there is no risk to have a timestamp going back in time, meaning
being lower than the previous one. It already can never happen without
a transition because we are generating timestamps by adding the period
to the last timestamp.
Fixes: 0ecc363ccea7 ("iio: make invensense timestamp module generic")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../common/inv_sensors/inv_sensors_timestamp.c | 16 ++++++++++++----
include/linux/iio/common/inv_sensors_timestamp.h | 3 ++-
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index 88a82d1370c50..c6699fc9248ae 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -133,10 +133,15 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
return;
/* no previous data, compute theoretical value from interrupt */
- if (ts->timestamp == 0) {
+ if (!ts->init) {
/* elapsed time: sensor period * sensor samples number */
interval = (s64)ts->period * (s64)sample_nb;
- ts->timestamp = timestamp - interval;
+ delta = timestamp - interval;
+ /* prevent next timestamp to be lower than the last one */
+ if ((delta + ts->period) > ts->timestamp)
+ ts->timestamp = delta;
+ ts->init = true;
+
}
/* update delta timestamps and estimated period */
@@ -179,7 +184,7 @@ void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts,
u32 fifo_period, size_t fifo_nb,
unsigned int fifo_no)
{
- s64 interval;
+ s64 interval, timestamp;
u32 fifo_mult;
if (ts->new_mult == 0)
@@ -202,7 +207,10 @@ void inv_sensors_timestamp_apply_odr(struct inv_sensors_timestamp *ts,
fifo_period = fifo_mult * ts->chip_period.val;
/* computes time interval between interrupt and this sample */
interval = (s64)(fifo_nb - fifo_no) * (s64)fifo_period;
- ts->timestamp = ts->it.up - interval;
+ timestamp = ts->it.up - interval;
+ /* prevent next timestamp to be lower than current one */
+ if ((timestamp + ts->period) > ts->timestamp)
+ ts->timestamp = timestamp;
}
}
EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_apply_odr, "IIO_INV_SENSORS_TIMESTAMP");
diff --git a/include/linux/iio/common/inv_sensors_timestamp.h b/include/linux/iio/common/inv_sensors_timestamp.h
index 4f08204ede3b4..91690778ae88b 100644
--- a/include/linux/iio/common/inv_sensors_timestamp.h
+++ b/include/linux/iio/common/inv_sensors_timestamp.h
@@ -66,6 +66,7 @@ struct inv_sensors_timestamp {
u32 new_mult;
u32 period;
struct inv_sensors_timestamp_acc chip_period;
+ bool init;
};
void inv_sensors_timestamp_init(struct inv_sensors_timestamp *ts,
@@ -94,7 +95,7 @@ static inline void inv_sensors_timestamp_reset(struct inv_sensors_timestamp *ts)
ts->it = interval_init;
ts->delta = interval_init;
ts->delta_counter = 0;
- ts->timestamp = 0;
+ ts->init = false;
}
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 110/703] iio: inv_sensors: fix estimated value larger than interrupt timestamp
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (108 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 109/703] iio: inv_sensors: prevent timestamps going back in time in transitions Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 111/703] iio: inv_sensors: do not compute period estimation when updating odr Greg Kroah-Hartman
` (297 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit b1c3c51b0916f7d1b2dceffc0e48abe185958825 ]
When interrupt timestamp interval is not valid, we use an estimated value
that can in rare case be bigger than the interrupt timestamp. This is
obviously wrong, so better use interrupt timestamp in this case.
Fixes: 8f4b627656fa ("iio: inv_sensors: better timestamp alignment when using watermark")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../iio/common/inv_sensors/inv_sensors_timestamp.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index c6699fc9248ae..9040da80f0c73 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -172,11 +172,16 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
valid = inv_validate_period(ts, period);
}
- /* if interrupt interval is valid, sync with interrupt timestamp */
+ /*
+ * If interrupt interval is valid, sync with interrupt timestamp.
+ * Otherwise, use estimated value while ensuring interrupt timestamp
+ * remains the maximum possible value.
+ */
+ period = inv_align_timestamp_it(ts, sample_nb);
if (valid)
- ts->period = inv_align_timestamp_it(ts, sample_nb);
+ ts->period = period;
else
- ts->period = ts->mult * ts->chip_period.val;
+ ts->period = min(ts->mult * ts->chip_period.val, period);
}
EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_interrupt, "IIO_INV_SENSORS_TIMESTAMP");
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 111/703] iio: inv_sensors: do not compute period estimation when updating odr
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (109 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 110/703] iio: inv_sensors: fix estimated value larger than interrupt timestamp Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 112/703] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
` (296 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jean-Baptiste Maneyrol,
Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
[ Upstream commit 0d695709ed380f1bc9303a91f57525d33766a07e ]
When odr is updated, the delta between the interrupts will change and it
will lead to a bad period estimation.
Avoid this by preventing the period estimation in this case.
Fixes: 82bd09ce4fd3 ("iio: inv_sensors: improve period measurement by using a longer delay")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/common/inv_sensors/inv_sensors_timestamp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
index 9040da80f0c73..b3a784d3e67d7 100644
--- a/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
+++ b/drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
@@ -147,6 +147,12 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
/* update delta timestamps and estimated period */
it = &ts->delta;
ts->delta_counter += sample_nb;
+ /* reset in case of odr change */
+ if (ts->new_mult) {
+ it->lo = 0;
+ it->up = 0;
+ ts->delta_counter = 0;
+ }
delta = timestamp - it->up;
delta_threshold = INV_SENSORS_TIMESTAMP_MIN(INV_SENSORS_MIN_IT_DELTA, ts->chip.jitter);
if (delta >= delta_threshold) {
@@ -166,7 +172,7 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts,
it->lo = it->up;
it->up = timestamp;
delta = it->up - it->lo;
- if (it->lo != 0) {
+ if (it->lo != 0 && !ts->new_mult) {
/* compute period and check validity */
period = div_s64(delta, sample_nb);
valid = inv_validate_period(ts, period);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 112/703] Revert "wifi: ath10k: Stop unanswered temperature reads"
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (110 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 111/703] iio: inv_sensors: do not compute period estimation when updating odr Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 113/703] tpm: Call cmd_ready/go_idle for each command transmission Greg Kroah-Hartman
` (295 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jeff Johnson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
commit b1ed5a45b994a6473ca1cf34f35a1bf87f1d8e2a upstream.
As reported by Nicolas Escande [1] this will break some setups where
temperature reporting is supported but there are occasional requests where
there isn't a response. Revert this implementation where a single
unreported temperature read at any time will stop all future requests.
Alternate solutions are being discussed.
Link: https://lore.kernel.org/all/DMRPC2GCD51O.S4DMHZFDKRFG@gmail.com/ # [1]
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/wireless/ath/ath10k/core.c | 1 -
drivers/net/wireless/ath/ath10k/thermal.c | 9 +--------
drivers/net/wireless/ath/ath10k/thermal.h | 2 --
3 files changed, 1 insertion(+), 11 deletions(-)
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2986,7 +2986,6 @@ int ath10k_core_start(struct ath10k *ar,
clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
ar->running_fw = fw;
- ar->thermal.broken = false;
if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
ar->running_fw->fw_file.fw_features)) {
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -75,12 +75,6 @@ static ssize_t ath10k_thermal_show_temp(
goto out;
}
- /* Don't stall every read on firmware that never answers */
- if (ar->thermal.broken) {
- ret = -EOPNOTSUPP;
- goto out;
- }
-
reinit_completion(&ar->thermal.wmi_sync);
ret = ath10k_wmi_pdev_get_temperature(ar);
if (ret) {
@@ -96,8 +90,7 @@ static ssize_t ath10k_thermal_show_temp(
time_left = wait_for_completion_timeout(&ar->thermal.wmi_sync,
ATH10K_THERMAL_SYNC_TIMEOUT_HZ);
if (!time_left) {
- ath10k_warn(ar, "failed to synchronize thermal read, not asking again until the firmware restarts\n");
- ar->thermal.broken = true;
+ ath10k_warn(ar, "failed to synchronize thermal read\n");
ret = -ETIMEDOUT;
goto out;
}
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -19,8 +19,6 @@ struct ath10k_thermal {
/* protected by conf_mutex */
u32 throttle_state;
u32 quiet_period;
- /* the running firmware did not answer a temperature request */
- bool broken;
/* temperature value in Celsius degree
* protected by data_lock
*/
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 113/703] tpm: Call cmd_ready/go_idle for each command transmission
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (111 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 112/703] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 114/703] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale Greg Kroah-Hartman
` (294 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mario Limonciello, Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <mario.limonciello@amd.com>
commit 313acd594a799d6b4b3af937eaca7bf4a1803c4a upstream.
Some TPM implementations, particularly fTPM using the CRB interface,
require the TPM to transition through idle and ready states for each
command rather than once per session.
The current implementation calls cmd_ready once during tpm_chip_start()
and go_idle once during tpm_chip_stop(). For fTPM, when multiple commands
are sent without per-command idle transitions, subsequent commands timeout
as the TPM is waiting for the transition.
Fix this by calling cmd_ready before each command and go_idle on all exit
paths in tpm_try_transmit(). For TPM implementations that don't require
per-command transitions, the callbacks return immediately based on the
start method.
Remove the now-redundant per-session calls from tpm_chip_start() and
tpm_chip_stop() along with their helpers.
This resolves timeout errors during TPM initialization on systems where
BIOS has already performed TPM startup.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20260901213723.3017371-1-mario.limonciello@amd.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/tpm-chip.c | 24 ------------------------
drivers/char/tpm/tpm-interface.c | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 24 deletions(-)
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -66,22 +66,6 @@ static void tpm_relinquish_locality(stru
chip->locality = -1;
}
-static int tpm_cmd_ready(struct tpm_chip *chip)
-{
- if (!chip->ops->cmd_ready)
- return 0;
-
- return chip->ops->cmd_ready(chip);
-}
-
-static int tpm_go_idle(struct tpm_chip *chip)
-{
- if (!chip->ops->go_idle)
- return 0;
-
- return chip->ops->go_idle(chip);
-}
-
static void tpm_clk_enable(struct tpm_chip *chip)
{
if (chip->ops->clk_enable)
@@ -116,13 +100,6 @@ int tpm_chip_start(struct tpm_chip *chip
}
}
- ret = tpm_cmd_ready(chip);
- if (ret) {
- tpm_relinquish_locality(chip);
- tpm_clk_disable(chip);
- return ret;
- }
-
return 0;
}
EXPORT_SYMBOL_GPL(tpm_chip_start);
@@ -137,7 +114,6 @@ EXPORT_SYMBOL_GPL(tpm_chip_start);
*/
void tpm_chip_stop(struct tpm_chip *chip)
{
- tpm_go_idle(chip);
tpm_relinquish_locality(chip);
tpm_clk_disable(chip);
}
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -19,6 +19,7 @@
* calls to msleep.
*/
+#include <linux/cleanup.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/mutex.h>
@@ -89,8 +90,17 @@ static bool tpm_transmit_completed(u8 st
return status_masked == chip->ops->req_complete_val;
}
+static void tpm_go_idle(struct tpm_chip *chip)
+{
+ if (chip->ops->go_idle)
+ chip->ops->go_idle(chip);
+}
+
+DEFINE_FREE(tpm_go_idle, struct tpm_chip *, if (_T) tpm_go_idle(_T))
+
static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz)
{
+ struct tpm_chip *chip_idle __free(tpm_go_idle) = NULL;
struct tpm_header *header = buf;
int rc;
ssize_t len = 0;
@@ -113,6 +123,18 @@ static ssize_t tpm_try_transmit(struct t
return -E2BIG;
}
+ if (chip->ops->cmd_ready) {
+ rc = chip->ops->cmd_ready(chip);
+ if (rc) {
+ dev_err(&chip->dev,
+ "%s: cmd_ready(): error %d\n", __func__, rc);
+ return rc;
+ }
+ }
+
+ /* Ensure go_idle() is called on every exit path from here on. */
+ chip_idle = chip;
+
rc = chip->ops->send(chip, buf, bufsiz, count);
if (rc < 0) {
if (rc != -EPIPE)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 114/703] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (112 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 113/703] tpm: Call cmd_ready/go_idle for each command transmission Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 115/703] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks Greg Kroah-Hartman
` (293 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Geert Uytterhoeven, Sudeep Holla,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <geert+renesas@glider.be>
[ Upstream commit e637b774416775d09540070ceecf972c59070d90 ]
Not enabling any transports no longer breaks the build.
Fixes: c0397c85b53d0bc6 ("firmware: arm_scmi: Use WARN_ON() to check configured transports")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/48c4bed8036dcb55f554f513ce2ae61807c5677d.1790684637.git.geert+renesas@glider.be
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/transports/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/transports/Kconfig b/drivers/firmware/arm_scmi/transports/Kconfig
index 57eccf316e26b..66b10f511827c 100644
--- a/drivers/firmware/arm_scmi/transports/Kconfig
+++ b/drivers/firmware/arm_scmi/transports/Kconfig
@@ -5,7 +5,7 @@ config ARM_SCMI_HAVE_TRANSPORT
bool
help
This declares whether at least one SCMI transport has been configured.
- Used to trigger a build bug when trying to build SCMI without any
+ Used to trigger a runtime warning when enabling SCMI without any
configured transport.
config ARM_SCMI_HAVE_SHMEM
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 115/703] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (113 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 114/703] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 116/703] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
` (292 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, David Cemin, Sudeep Holla,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Cemin <dcemin@nvidia.com>
[ Upstream commit 8ab2e426762d199ce8b799d029edafbfb981f5c6 ]
The notifier callbacks are kept in a hash table keyed by notification ID,
but struct notifier_cb_info does not store the ID and none of the lookup
helpers compare it. hash_for_each_possible() walks the whole bucket, so
any two IDs that hash to the same bucket are treated as the same
registration.
With the 64-bucket table, hash_32() maps IDs 2 and 36 to the same
bucket. A driver that requests notifications sequentially therefore
fails at the 37th request:
ARM FF-A: Failed to register callback for 36 - -22
because update_notifier_cb() finds the node registered for ID 2 and
rejects the new registration as a duplicate. The same lookup is used on
the delivery path, so a notification for a colliding ID can also be
dispatched to the callback registered for the other ID.
Store the notification ID in the node and compare it in all three
lookup helpers.
This was found on an arm64 laptop whose embedded controller partition
declares 38 notifications: the EC driver failed to probe and every
EC event (AC, battery, lid, hotkeys) was lost.
Fixes: e0573444edbf ("firmware: arm_ffa: Add interfaces to request notification callbacks")
Fixes: c10debfe7f02 ("firmware: arm_ffa: Add support for {un,}registration of framework notifications")
Signed-off-by: David Cemin <dcemin@nvidia.com>
Link: https://patch.msgid.link/20261020220902.611138-1-dcemin@nvidia.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_ffa/driver.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 1d0bd586da4d6..e7cc536bdef3a 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1214,6 +1214,7 @@ struct notifier_cb_info {
ffa_fwk_notifier_cb fwk_cb;
ffa_notifier_cb cb;
void *cb_data;
+ u16 notify_id;
};
static int
@@ -1293,7 +1294,8 @@ notifier_hnode_get_by_vmid(u16 notify_id, int vmid)
struct notifier_cb_info *node;
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (node->fwk_cb && vmid == node->dev->vm_id)
+ if (node->notify_id == notify_id && node->fwk_cb &&
+ vmid == node->dev->vm_id)
return node;
return NULL;
@@ -1308,7 +1310,8 @@ notifier_hnode_get_by_vmid_uuid(u16 notify_id, int vmid, const uuid_t *uuid)
return notifier_hnode_get_by_vmid(notify_id, vmid);
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (node->fwk_cb && vmid == node->dev->vm_id &&
+ if (node->notify_id == notify_id && node->fwk_cb &&
+ vmid == node->dev->vm_id &&
uuid_equal(&node->dev->uuid, uuid))
return node;
@@ -1321,7 +1324,8 @@ notifier_hnode_get_by_type(u16 notify_id, enum notify_type type)
struct notifier_cb_info *node;
hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id)
- if (node->cb && type == ffa_notify_type_get(node->dev->vm_id))
+ if (node->notify_id == notify_id && node->cb &&
+ type == ffa_notify_type_get(node->dev->vm_id))
return node;
return NULL;
@@ -1413,6 +1417,7 @@ static int __ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu,
cb_info->dev = dev;
cb_info->cb_data = cb_data;
+ cb_info->notify_id = notify_id;
if (is_framework)
cb_info->fwk_cb = cb;
else
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 116/703] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (114 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 115/703] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 117/703] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64 Greg Kroah-Hartman
` (291 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marc Zyngier, Julian Braha,
Sudeep Holla, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Braha <julianbraha@gmail.com>
[ Upstream commit 6cc03818814aa98c3584a346b82165f1b561f2b7 ]
Add fallbacks for callers to avoid needing #ifdef guards when
HAVE_ARM_SMCCC_DISCOVERY is disabled (32-bit arm).
Fixes: 35727af2b15d ("irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4")
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://patch.msgid.link/20261020222817.1231643-2-julianbraha@gmail.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/arm-smccc.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index 976c5f8001ff2..c4551e9a5cf03 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -318,6 +318,7 @@ enum arm_smccc_conduit {
SMCCC_CONDUIT_HVC,
};
+#ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY
/**
* arm_smccc_1_1_get_conduit()
*
@@ -357,6 +358,12 @@ s32 arm_smccc_get_soc_id_version(void);
* When ARM_SMCCC_ARCH_SOC_ID is not present, returns SMCCC_RET_NOT_SUPPORTED.
*/
s32 arm_smccc_get_soc_id_revision(void);
+#else /* CONFIG_HAVE_ARM_SMCCC_DISCOVERY */
+#define arm_smccc_1_1_get_conduit() SMCCC_CONDUIT_NONE
+#define arm_smccc_get_version() 0
+#define arm_smccc_get_soc_id_version() SMCCC_RET_NOT_SUPPORTED
+#define arm_smccc_get_soc_id_revision() SMCCC_RET_NOT_SUPPORTED
+#endif /* CONFIG_HAVE_ARM_SMCCC_DISCOVERY */
#ifndef __ASSEMBLY__
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 117/703] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (115 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 116/703] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 118/703] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
` (290 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marc Zyngier, Thomas Gleixner,
Julian Braha, Sudeep Holla, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Braha <julianbraha@gmail.com>
[ Upstream commit 40b097fdfd00516ba9a568ccc10e9f166358ddca ]
ARM_PSCI_FW is always enabled for arm64, and the GICv3 driver only
uses HAVE_ARM_SMCCC_DISCOVERY to identify the NVIDIA T241, which is
arm64 anyway.
For ARM_GIC_V3, let's only select HAVE_ARM_SMCCC_DISCOVERY on arm64.
Fixes: 35727af2b15d ("irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4")
Suggested-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Acked-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20261020222817.1231643-3-julianbraha@gmail.com
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index a61c6dc63c29c..eb09bb04b1750 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -38,7 +38,7 @@ config ARM_GIC_V3
select IRQ_DOMAIN_HIERARCHY
select PARTITION_PERCPU
select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
- select HAVE_ARM_SMCCC_DISCOVERY
+ select HAVE_ARM_SMCCC_DISCOVERY if ARM64
select IRQ_MSI_IOMMU
config ARM_GIC_ITS_PARENT
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 118/703] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (116 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 117/703] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64 Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 119/703] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
` (289 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Torokhov, Tzung-Bi Shih,
Sean OBrien, Shashikirana H K, Benjamin Tissoires, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashikirana H K <shashikiranah@chromium.org>
[ Upstream commit 8dbf66b011135422a28ee32da1d6aacbe08ddd7a ]
Currently vivaldi_feature_mapping() passes the raw buffer returned by
hid_hw_raw_request() to hid_report_raw_event() with the descriptor-declared
report_len just to populate field->value[usage->usage_index].
Since vivaldi_feature_mapping() already has the target report, field, and
usage in hand, and nothing else consumes field->value[] for this report,
verify that hid_hw_raw_request() returns the expected report_len, ensure
usage->usage_index is within field->report_count, and extract the value
directly using hid_field_extract(). Also use __free(kfree) to simplify
buffer cleanup.
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixes: 33bbe04a15f2 ("HID: google: extract Vivaldi hid feature mapping for use in hid-hammer")
Cc: Tzung-Bi Shih <tzungbi@chromium.org>
Cc: Sean O'Brien <seobrien@chromium.org>
Signed-off-by: Shashikirana H K <shashikiranah@chromium.org>
Link: https://patch.msgid.link/20261013-upstream-vivaldi-fix-v2-1-ecc20329d24c@chromium.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-vivaldi-common.c | 72 ++++++++++++--------------------
1 file changed, 26 insertions(+), 46 deletions(-)
diff --git a/drivers/hid/hid-vivaldi-common.c b/drivers/hid/hid-vivaldi-common.c
index b12bb5cc091aa..1359a107e63bd 100644
--- a/drivers/hid/hid-vivaldi-common.c
+++ b/drivers/hid/hid-vivaldi-common.c
@@ -5,11 +5,13 @@
* Copyright (C) 2022 Google, Inc
*/
+#include <linux/cleanup.h>
#include <linux/export.h>
#include <linux/hid.h>
#include <linux/input/vivaldi-fmap.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include <linux/types.h>
#include "hid-vivaldi-common.h"
@@ -33,13 +35,14 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
{
struct vivaldi_data *data = hid_get_drvdata(hdev);
struct hid_report *report = field->report;
- u8 *report_data, *buf;
- u32 report_len;
unsigned int fn_key;
+ unsigned int offset;
+ u32 report_len;
int ret;
if (field->logical != HID_USAGE_FN_ROW_PHYSMAP ||
- (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL)
+ (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL ||
+ usage->usage_index >= field->report_count)
return;
fn_key = usage->hid & HID_USAGE;
@@ -49,54 +52,31 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
if (fn_key > data->num_function_row_keys)
data->num_function_row_keys = fn_key;
- report_data = buf = hid_alloc_report_buf(report, GFP_KERNEL);
- if (!report_data)
+ u8 *buf __free(kfree) = hid_alloc_report_buf(report, GFP_KERNEL);
+ if (!buf)
return;
- report_len = hid_report_len(report);
- if (!report->id) {
- /*
- * hid_hw_raw_request() will stuff report ID (which will be 0)
- * into the first byte of the buffer even for unnumbered
- * reports, so we need to account for this to avoid getting
- * -EOVERFLOW in return.
- * Note that hid_alloc_report_buf() adds 7 bytes to the size
- * so we can safely say that we have space for an extra byte.
- */
- report_len++;
- }
-
- ret = hid_hw_raw_request(hdev, report->id, report_data,
- report_len, HID_FEATURE_REPORT,
- HID_REQ_GET_REPORT);
- if (ret < 0) {
- dev_warn(&hdev->dev, "failed to fetch feature %d\n",
- field->report->id);
- goto out;
- }
-
- if (!report->id) {
- /*
- * Undo the damage from hid_hw_raw_request() for unnumbered
- * reports.
- */
- report_data++;
- report_len--;
- }
-
- ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, report_data,
- report_len, report_len, 0);
- if (ret) {
- dev_warn(&hdev->dev, "failed to report feature %d\n",
- field->report->id);
- goto out;
+ /*
+ * hid_hw_raw_request() will stuff report ID (which will be 0)
+ * into the first byte of the buffer even for unnumbered
+ * reports, so we need to account for this to avoid getting
+ * -EOVERFLOW in return.
+ * Note that hid_alloc_report_buf() adds 7 bytes to the size
+ * so we can safely say that we have space for an extra byte.
+ */
+ report_len = hid_report_len(report) + !report->id;
+
+ ret = hid_hw_raw_request(hdev, report->id, buf, report_len,
+ HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
+ if (ret != report_len) {
+ dev_warn(&hdev->dev, "failed to fetch feature %d: %d\n",
+ report->id, ret);
+ return;
}
+ offset = field->report_offset + usage->usage_index * field->report_size;
data->function_row_physmap[fn_key - MIN_FN_ROW_KEY] =
- field->value[usage->usage_index];
-
-out:
- kfree(buf);
+ hid_field_extract(hdev, buf + 1, offset, field->report_size);
}
EXPORT_SYMBOL_GPL(vivaldi_feature_mapping);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 119/703] HID: vivaldi: avoid redundant feature report reads per usage
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (117 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 118/703] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 120/703] firmware: arm_scmi: imx: Validate MISC control response size Greg Kroah-Hartman
` (288 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhengping Jiang, Benjamin Tissoires,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengping Jiang <jiangzp@google.com>
[ Upstream commit 720806515cb6921ab05caaa6f470f7054b56385e ]
vivaldi_feature_mapping() is invoked by report_features() in ascending
usage_index order for each usage in the top-row physical keymap field.
Because fetching the feature report at usage_index == 0 already reads
the entire report from hardware, calling hid_hw_raw_request() again for
subsequent usages redundantly reads the same report N times (e.g., 12
sequential BLE GATT reads taking ~2s on Vivaldi BLE keyboards).
Bail out immediately when usage->usage_index != 0, fetch the feature
report once at usage_index == 0, and iterate over all usages in the
field to populate data->function_row_physmap[].
Fixes: 33bbe04a15f2 ("HID: google: extract Vivaldi hid feature mapping for use in hid-hammer")
Signed-off-by: Zhengping Jiang <jiangzp@google.com>
Link: https://patch.msgid.link/20261015064223.1939367-1-jiangzp@google.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-vivaldi-common.c | 33 +++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/drivers/hid/hid-vivaldi-common.c b/drivers/hid/hid-vivaldi-common.c
index 1359a107e63bd..973393d093561 100644
--- a/drivers/hid/hid-vivaldi-common.c
+++ b/drivers/hid/hid-vivaldi-common.c
@@ -39,19 +39,11 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
unsigned int offset;
u32 report_len;
int ret;
+ int i;
- if (field->logical != HID_USAGE_FN_ROW_PHYSMAP ||
- (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL ||
- usage->usage_index >= field->report_count)
+ if (field->logical != HID_USAGE_FN_ROW_PHYSMAP || usage->usage_index)
return;
- fn_key = usage->hid & HID_USAGE;
- if (fn_key < MIN_FN_ROW_KEY || fn_key > MAX_FN_ROW_KEY)
- return;
-
- if (fn_key > data->num_function_row_keys)
- data->num_function_row_keys = fn_key;
-
u8 *buf __free(kfree) = hid_alloc_report_buf(report, GFP_KERNEL);
if (!buf)
return;
@@ -74,9 +66,24 @@ void vivaldi_feature_mapping(struct hid_device *hdev,
return;
}
- offset = field->report_offset + usage->usage_index * field->report_size;
- data->function_row_physmap[fn_key - MIN_FN_ROW_KEY] =
- hid_field_extract(hdev, buf + 1, offset, field->report_size);
+ for (i = 0; i < field->maxusage && i < field->report_count; i++) {
+ usage = &field->usage[i];
+
+ if ((usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL)
+ continue;
+
+ fn_key = usage->hid & HID_USAGE;
+ if (fn_key < MIN_FN_ROW_KEY || fn_key > MAX_FN_ROW_KEY)
+ continue;
+
+ if (fn_key > data->num_function_row_keys)
+ data->num_function_row_keys = fn_key;
+
+ offset = field->report_offset + i * field->report_size;
+ data->function_row_physmap[fn_key - MIN_FN_ROW_KEY] =
+ hid_field_extract(hdev, buf + 1, offset,
+ field->report_size);
+ }
}
EXPORT_SYMBOL_GPL(vivaldi_feature_mapping);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 120/703] firmware: arm_scmi: imx: Validate MISC control response size
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (118 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 119/703] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 121/703] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
` (287 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Peng Fan, Sudeep Holla,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit 4e3652a0ac715ba7387b072b72eaff76e761aaf9 ]
scmi_imx_misc_ctrl_get() uses @num to report the number of
values returned by firmware, but it did not retain the caller's value
as the capacity of @val.
A response with more values than the caller allocated was copied into
@val unchecked. For example, the MQS regmap callback supplies storage
for one value. Retain the input capacity and reject responses exceeding
it before copying, then update @num only after a successful copy.
Document the in/out @num contract of the exported helper.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-6897b44a-57fb-4964-95f8-447d0ce526e4
Fixes: 61c9f03e22fc ("firmware: arm_scmi: Add initial support for i.MX MISC protocol")
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261028130502.2999676-2-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../firmware/arm_scmi/vendors/imx/imx-sm-misc.c | 16 ++++++++++++----
include/linux/firmware/imx/sm.h | 6 ++++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
index 700a3f24f4efc..b1050c214d046 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.c
@@ -228,10 +228,16 @@ static int scmi_imx_misc_ctrl_get(const struct scmi_protocol_handle *ph,
{
struct scmi_imx_misc_ctrl_get_out *out;
struct scmi_xfer *t;
+ u32 num_values, max_values;
int ret, i;
int max_msg_size = ph->hops->get_max_msg_size(ph);
int max_num = (max_msg_size - sizeof(*out)) / sizeof(__le32);
+ if (!num || !val || !*num)
+ return -EINVAL;
+
+ max_values = *num;
+
ret = scmi_imx_misc_ctrl_validate_id(ph, ctrl_id);
if (ret)
return ret;
@@ -245,16 +251,18 @@ static int scmi_imx_misc_ctrl_get(const struct scmi_protocol_handle *ph,
ret = ph->xops->do_xfer(ph, t);
if (!ret) {
out = t->rx.buf;
- *num = le32_to_cpu(out->num);
+ num_values = le32_to_cpu(out->num);
- if (*num >= max_num ||
- *num * sizeof(__le32) > t->rx.len - sizeof(__le32)) {
+ if (num_values > max_values || num_values >= max_num ||
+ num_values * sizeof(__le32) > t->rx.len - sizeof(__le32)) {
ph->xops->xfer_put(ph, t);
return -EINVAL;
}
- for (i = 0; i < *num; i++)
+ for (i = 0; i < num_values; i++)
val[i] = le32_to_cpu(out->val[i]);
+
+ *num = num_values;
}
ph->xops->xfer_put(ph, t);
diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h
index a33b450273567..c3b99f3d11ed0 100644
--- a/include/linux/firmware/imx/sm.h
+++ b/include/linux/firmware/imx/sm.h
@@ -27,6 +27,12 @@
#define SCMI_IMX94_CTRL_SAI4_MCLK 6U /*!< WAKE SAI4 MCLK */
#if IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV)
+/**
+ * scmi_imx_misc_ctrl_get() - Read an i.MX MISC control
+ * @id: Control identifier
+ * @num: On entry, capacity of @val in words; on return, words read
+ * @val: Buffer for the control value
+ */
int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val);
int scmi_imx_misc_ctrl_set(u32 id, u32 val);
#else
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 121/703] firmware: arm_scmi: Unregister notifier on enable failure
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (119 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 120/703] firmware: arm_scmi: imx: Validate MISC control response size Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 122/703] firmware: arm_scmi: Free mailbox state on mapping failure Greg Kroah-Hartman
` (286 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Peng Fan, Sudeep Holla,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit b9bb2eb88037a3823e7abd096b54d0a07d428f90 ]
scmi_notifier_register() adds the caller's notifier block before
enabling the corresponding event at the platform.
If enablement fails, the caller receives an error and can free its
notifier block. A concurrent registration can retain and later enable
the handler, leaving the failed caller's block in its notification
chain. Event delivery can then dereference the freed block.
Remove the notifier block before dropping the handler reference when
event enablement fails.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-c3c9437c-ba1a-4db6-837f-cb0950d89018
Fixes: e7c215f358a3 ("firmware: arm_scmi: Add notification callbacks-registration")
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261028130502.2999676-3-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/notify.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
index 672c91197a68a..ee2fc0549508c 100644
--- a/drivers/firmware/arm_scmi/notify.c
+++ b/drivers/firmware/arm_scmi/notify.c
@@ -1399,8 +1399,10 @@ static int scmi_notifier_register(const struct scmi_handle *handle,
/* Enable events for not pending handlers */
if (!IS_HNDL_PENDING(hndl)) {
ret = scmi_event_handler_enable_events(hndl);
- if (ret)
+ if (ret) {
+ blocking_notifier_chain_unregister(&hndl->chain, nb);
scmi_put_handler(ni, hndl);
+ }
}
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 122/703] firmware: arm_scmi: Free mailbox state on mapping failure
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (120 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 121/703] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 123/703] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
` (285 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Sudeep Holla, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
[ Upstream commit 38b6268eae651de1ca31c48b912a55ae3e706b94 ]
mailbox_chan_setup() allocates its private state from the SCMI base
device before mapping the shared-memory area. If mapping fails while
setting up an optional RX channel, the core ignores the RX failure and
keeps the base device bound, retaining that devres allocation.
Release the private mailbox state before returning the mapping error.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-fda9bcb5-8255-4157-bbf7-d720bbd86605
Fixes: 1ebc28e9357c ("firmware: arm_scmi: Introduce setup_shmem_iomap")
Link: https://patch.msgid.link/20261028153203.3305067-1-sudeep.holla@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/arm_scmi/transports/mailbox.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
index 308736c3ead9c..237e04c1a0f43 100644
--- a/drivers/firmware/arm_scmi/transports/mailbox.c
+++ b/drivers/firmware/arm_scmi/transports/mailbox.c
@@ -201,8 +201,11 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
smbox->shmem = core->shmem->setup_iomap(cinfo, dev, tx, NULL,
&smbox->io_ops);
- if (IS_ERR(smbox->shmem))
- return PTR_ERR(smbox->shmem);
+ if (IS_ERR(smbox->shmem)) {
+ ret = PTR_ERR(smbox->shmem);
+ devm_kfree(dev, smbox);
+ return ret;
+ }
cl = &smbox->cl;
cl->dev = cdev;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 123/703] soundwire: qcom: disable the interrupt before gating the clock
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (121 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 122/703] firmware: arm_scmi: Free mailbox state on mapping failure Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 124/703] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
` (284 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Keri, Dmitry Baryshkov,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Keri <okerixx@gmail.com>
[ Upstream commit 6c067677192f054bbfa815caf04f536bb8dcdee2 ]
swrm_runtime_suspend() gates hclk straight after the ClockStopNow
broadcast, while the interrupt thread that completed it is still
clearing the status and CLK_STOP_FINISHED is about to fire. Both touch
registers with the clock going away; on x1e80100 and glymur hclk is the
SoundWire clock itself. The next clock-stop exit then fails at random
(bus clash, parity errors, AUTO_ENUM_FAILED) and one side of the
speakers stays detached until reboot.
Disable the interrupt before gating the clock and enable it again once
the clock is back.
Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support")
Signed-off-by: Oleg Keri <okerixx@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20261009082639.22662-1-okerixx@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/soundwire/qcom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index a4f108fdffddb..8a5e8bc282137 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1664,6 +1664,7 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
}
clk_prepare_enable(ctrl->hclk);
+ enable_irq(ctrl->irq);
if (ctrl->clock_stop_not_supported) {
reinit_completion(&ctrl->enumeration);
@@ -1747,6 +1748,7 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev)
}
}
+ disable_irq(ctrl->irq);
clk_disable_unprepare(ctrl->hclk);
usleep_range(300, 305);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 124/703] memory: tegra: Shut down Tegra210 EMC timers before teardown
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (122 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 123/703] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 125/703] memory: tegra: fix device_node leak in tegra186_mc_probe_device() Greg Kroah-Hartman
` (283 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak, Sashiko,
Krzysztof Kozlowski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit c5f343c189aa30285e7c73dbf2f185720467794b ]
The training and refresh timers can outlive the EMC state on removal
or probe failure after clock attachment, causing use-after-free.
Shut down both timers before detaching the clock provider and releasing
the timing tables to wait for callbacks and prevent rearming. Initialize
them before clock attachment, since set_rate() can start training.
Fixes: 10de21148f7d ("memory: tegra: Add EMC scaling support code for Tegra210")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-47538f77-fb50-4a06-b49b-92dbee8b538b
Link: https://patch.msgid.link/20261015002852.2159841-1-mhun512@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/memory/tegra/tegra210-emc-core.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/memory/tegra/tegra210-emc-core.c b/drivers/memory/tegra/tegra210-emc-core.c
index e96ca4157d481..d7939d20dbccf 100644
--- a/drivers/memory/tegra/tegra210-emc-core.c
+++ b/drivers/memory/tegra/tegra210-emc-core.c
@@ -1947,12 +1947,6 @@ static int tegra210_emc_probe(struct platform_device *pdev)
config->same_freq = true;
}
- err = tegra210_clk_emc_attach(emc->clk, &emc->provider);
- if (err < 0) {
- dev_err(&pdev->dev, "failed to attach to EMC clock: %d\n", err);
- goto release;
- }
-
emc->clkchange_delay = 100;
emc->training_interval = 100;
dev_set_drvdata(emc->dev, emc);
@@ -1964,6 +1958,12 @@ static int tegra210_emc_probe(struct platform_device *pdev)
timer_setup(&emc->training, tegra210_emc_train, 0);
+ err = tegra210_clk_emc_attach(emc->clk, &emc->provider);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to attach to EMC clock: %d\n", err);
+ goto release;
+ }
+
tegra210_emc_debugfs_init(emc);
cd = devm_thermal_of_cooling_device_register(emc->dev, np, "emc", emc,
@@ -1979,6 +1979,8 @@ static int tegra210_emc_probe(struct platform_device *pdev)
detach:
debugfs_remove_recursive(emc->debugfs.root);
+ timer_shutdown_sync(&emc->training);
+ timer_shutdown_sync(&emc->refresh_timer);
tegra210_clk_emc_detach(emc->clk);
release:
of_reserved_mem_device_release(emc->dev);
@@ -1991,6 +1993,8 @@ static void tegra210_emc_remove(struct platform_device *pdev)
struct tegra210_emc *emc = platform_get_drvdata(pdev);
debugfs_remove_recursive(emc->debugfs.root);
+ timer_shutdown_sync(&emc->training);
+ timer_shutdown_sync(&emc->refresh_timer);
tegra210_clk_emc_detach(emc->clk);
of_reserved_mem_device_release(emc->dev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 125/703] memory: tegra: fix device_node leak in tegra186_mc_probe_device()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (123 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 124/703] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 126/703] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
` (282 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Selby Mashiki, Krzysztof Kozlowski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selby Mashiki <mashikiselby@gmail.com>
[ Upstream commit 21250426a8469d3bc43c2f0c69ed5497ee9ff7d4 ]
tegra186_mc_probe_device() iterates over the "interconnects" phandles
using of_parse_phandle_with_args(), which increments the reference count
of args.np on each successful call, but never drops the reference with
of_node_put(args.np).
Call of_node_put(args.np) at the end of each loop iteration.
Fixes: fe3b082a6eb8 ("memory: tegra: Add SID override programming for MC clients")
Signed-off-by: Selby Mashiki <mashikiselby@gmail.com>
Link: https://patch.msgid.link/20261025190322.449324-1-mashikiselby@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/memory/tegra/tegra186.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index aee11457bf8e0..f8849e827978f 100644
--- a/drivers/memory/tegra/tegra186.c
+++ b/drivers/memory/tegra/tegra186.c
@@ -147,6 +147,7 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
}
}
+ of_node_put(args.np);
index++;
}
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 126/703] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (124 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 125/703] memory: tegra: fix device_node leak in tegra186_mc_probe_device() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 127/703] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
` (281 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Yao, Fuad Tabba, Marc Zyngier,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <fuad.tabba@linux.dev>
[ Upstream commit 861bebd1fac5f5a25c11e40aec3c3291542045d1 ]
The GICv4 allocation and teardown paths free their irq domains and
fwnodes but leave the pointers set, and the allocation error paths test
those pointers before removing them. struct its_vm and struct its_vpe
are embedded in KVM's per-VM and per-vCPU state, so nothing re-zeroes
them between two attempts, and an error path taken after an earlier one
already freed the domain calls irq_domain_remove() on freed memory.
Reaching this takes two allocation failures, one to leave the stale
pointer behind and one to send the next attempt down the error path.
Fixes: 7de5c0af9c7c ("irqchip/gic-v4: Add per-VM VPE domain creation")
Fixes: 6d31b6ff985d ("irqchip/gic-v4.1: Add VSGI allocation/teardown")
Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260921072958.2918477-2-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-v4.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index 8455b4a5fbb0d..754839e409f88 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -147,10 +147,14 @@ static int its_alloc_vcpu_sgis(struct its_vpe *vpe, int idx)
return 0;
err:
- if (vpe->sgi_domain)
+ if (vpe->sgi_domain) {
irq_domain_remove(vpe->sgi_domain);
- if (vpe->fwnode)
+ vpe->sgi_domain = NULL;
+ }
+ if (vpe->fwnode) {
irq_domain_free_fwnode(vpe->fwnode);
+ vpe->fwnode = NULL;
+ }
kfree(name);
return -ENOMEM;
}
@@ -191,10 +195,14 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
return 0;
err:
- if (vm->domain)
+ if (vm->domain) {
irq_domain_remove(vm->domain);
- if (vm->fwnode)
+ vm->domain = NULL;
+ }
+ if (vm->fwnode) {
irq_domain_free_fwnode(vm->fwnode);
+ vm->fwnode = NULL;
+ }
return -ENOMEM;
}
@@ -215,6 +223,8 @@ static void its_free_sgi_irqs(struct its_vm *vm)
irq_domain_free_irqs(irq, 16);
irq_domain_remove(vm->vpes[i]->sgi_domain);
irq_domain_free_fwnode(vm->vpes[i]->fwnode);
+ vm->vpes[i]->sgi_domain = NULL;
+ vm->vpes[i]->fwnode = NULL;
}
}
@@ -224,6 +234,8 @@ void its_free_vcpu_irqs(struct its_vm *vm)
irq_domain_free_irqs(vm->vpes[0]->irq, vm->nr_vpes);
irq_domain_remove(vm->domain);
irq_domain_free_fwnode(vm->fwnode);
+ vm->domain = NULL;
+ vm->fwnode = NULL;
}
static int its_send_vpe_cmd(struct its_vpe *vpe, struct its_cmd_info *info)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 127/703] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (125 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 126/703] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 128/703] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
` (280 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Yao, Fuad Tabba, Marc Zyngier,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fuad Tabba <fuad.tabba@linux.dev>
[ Upstream commit fd86d69c951765e24e89a162c53dfe33a8aba976 ]
A failure in the its_alloc_vcpu_sgis() loop leaves behind both the SGI
domains created for the vPEs below the failing index and the vPE irqs
allocated before the loop, since irq_domain_remove() frees neither. Each
leaked vPE takes its ITS state with it, a vpe_id and an LPI pending
table.
Free both from a second label before the existing unwind. With the
freed pointers now cleared, its_free_sgi_irqs() can skip a vPE with no
SGI domain and be reused there. The check has to precede the lookup:
irq_find_mapping(NULL, 0) falls back to irq_default_domain, and the
live irq it returns would then be freed.
Fixes: 6d31b6ff985d ("irqchip/gic-v4.1: Add VSGI allocation/teardown")
Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260921072958.2918477-3-fuad.tabba@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-v4.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index 754839e409f88..f707a3cb281aa 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -159,6 +159,8 @@ static int its_alloc_vcpu_sgis(struct its_vpe *vpe, int idx)
return -ENOMEM;
}
+static void its_free_sgi_irqs(struct its_vm *vm);
+
int its_alloc_vcpu_irqs(struct its_vm *vm)
{
int vpe_base_irq, i;
@@ -189,11 +191,14 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
vm->vpes[i]->irq = vpe_base_irq + i;
ret = its_alloc_vcpu_sgis(vm->vpes[i], i);
if (ret)
- goto err;
+ goto err_free_irqs;
}
return 0;
+err_free_irqs:
+ its_free_sgi_irqs(vm);
+ irq_domain_free_irqs(vpe_base_irq, vm->nr_vpes);
err:
if (vm->domain) {
irq_domain_remove(vm->domain);
@@ -215,8 +220,13 @@ static void its_free_sgi_irqs(struct its_vm *vm)
return;
for (i = 0; i < vm->nr_vpes; i++) {
- unsigned int irq = irq_find_mapping(vm->vpes[i]->sgi_domain, 0);
+ unsigned int irq;
+
+ /* irq_find_mapping() falls back to the default domain on NULL. */
+ if (!vm->vpes[i]->sgi_domain)
+ continue;
+ irq = irq_find_mapping(vm->vpes[i]->sgi_domain, 0);
if (WARN_ON(!irq))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 128/703] reset: scmi: Set the device for the reset controller
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (126 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 127/703] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 129/703] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
` (279 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kunihiko Hayashi, Sudeep Holla,
Philipp Zabel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
[ Upstream commit e3e068a457cebe2e475535685c325d5ca305f44a ]
SCMI reset driver does not set rcdev.dev when registering its reset
controller.
If rcdev.of_node is not available, the reset core tries to obtain
the firmware node from rcdev.dev. However, rcdev.dev is also NULL,
causing a NULL pointer dereference.
Set rcdev.dev to the SCMI device.
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
Fixes: c8ae9c2da1cc ("reset: Add support for resets provided by SCMI")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/reset/reset-scmi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c
index 4335811e0cfaa..0fdf593b09e24 100644
--- a/drivers/reset/reset-scmi.c
+++ b/drivers/reset/reset-scmi.c
@@ -107,6 +107,7 @@ static int scmi_reset_probe(struct scmi_device *sdev)
data->rcdev.ops = &scmi_reset_ops;
data->rcdev.owner = THIS_MODULE;
+ data->rcdev.dev = dev;
data->rcdev.of_node = np;
data->rcdev.nr_resets = reset_ops->num_domains_get(ph);
data->ph = ph;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 129/703] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (127 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 128/703] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 130/703] reset: spacemit: Fix the RCPU2 PWM reset registers Greg Kroah-Hartman
` (278 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Colton Lewis, Marc Zyngier,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colton Lewis <coltonlewis@google.com>
[ Upstream commit 7100185bdc1162eb2eca1dd20a036314e27f1561 ]
By default, init_desc() assigns the shared irq_desc_lock_class lockdep
key to desc->lock for every struct irq_desc. Device drivers that
register an IRQ affinity notifier establish a lock dependency chain of
&irq_desc_lock_class --> &pool->lock --> &p->pi_lock --> &rq->__lock
when irq_set_affinity_locked() calls schedule_work() while holding
desc->lock.
On GICv4 systems, scheduling out a KVM vCPU calls kvm_sched_out() ->
kvm_arch_vcpu_put() -> vgic_v3_put() -> vgic_v4_put() ->
its_make_vpe_non_resident() -> irq_set_vcpu_affinity() while holding the
scheduler runqueue lock (&rq->__lock). Acquiring the vPE doorbell IRQ's
desc->lock establishes &rq->__lock --> &irq_desc_lock_class, triggering
a lockdep circular locking splat:
WARNING: possible circular locking dependency detected
------------------------------------------------------
VCPU-0/109705 is trying to acquire lock:
ffff0001e41e4cc8 (&irq_desc_lock_class){-.-.}-{2:2}, at: __irq_get_desc_lock+0x5c/0xb0
but task is already holding lock:
ffff00dad15fd260 (&rq->__lock){-.-.}-{2:2}, at: __schedule+0x23c/0x1850
which lock already depends on the new lock.
Chain exists of:
&irq_desc_lock_class --> &p->pi_lock --> &rq->__lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&rq->__lock);
lock(&p->pi_lock);
lock(&rq->__lock);
lock(&irq_desc_lock_class);
GICv4 vPE doorbell IRQs are internal to KVM and GICv4, set
IRQ_NO_BALANCING, and never register an affinity notifier or queue work
under desc->lock. However, under forced IRQ threading (threadirqs or
CONFIG_PREEMPT_RT), request_irq() creates an IRQ thread for the doorbell
handler, causing irq_set_affinity() -> irq_set_thread_affinity() in
vgic_v4_load() to call wake_up_process() under desc->lock and establish
a real desc->lock --> &p->pi_lock --> &rq->__lock dependency on the vPE
doorbell IRQ itself.
Mark vPE doorbell IRQs with irq_set_nothread() so they are never
force-threaded, and assign them a dedicated lockdep class in
its_alloc_vcpu_irqs() via irq_set_lockdep_class().
Fixes: 8e01d9a396e6 ("KVM: arm64: vgic-v4: Move the GICv4 residency flow to be driven by vcpu_load/put")
Signed-off-by: Colton Lewis <coltonlewis@google.com>
Link: https://patch.msgid.link/20261027180610.2840837-1-coltonlewis@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-gic-v4.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index f707a3cb281aa..019aa0ded1bf9 100644
--- a/drivers/irqchip/irq-gic-v4.c
+++ b/drivers/irqchip/irq-gic-v4.c
@@ -163,6 +163,8 @@ static void its_free_sgi_irqs(struct its_vm *vm);
int its_alloc_vcpu_irqs(struct its_vm *vm)
{
+ static struct lock_class_key vpe_irq_lock_class;
+ static struct lock_class_key vpe_irq_request_class;
int vpe_base_irq, i;
vm->fwnode = irq_domain_alloc_named_id_fwnode("GICv4-vpe",
@@ -189,6 +191,9 @@ int its_alloc_vcpu_irqs(struct its_vm *vm)
for (i = 0; i < vm->nr_vpes; i++) {
int ret;
vm->vpes[i]->irq = vpe_base_irq + i;
+ irq_set_lockdep_class(vm->vpes[i]->irq, &vpe_irq_lock_class,
+ &vpe_irq_request_class);
+ irq_set_nothread(vm->vpes[i]->irq);
ret = its_alloc_vcpu_sgis(vm->vpes[i], i);
if (ret)
goto err_free_irqs;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 130/703] reset: spacemit: Fix the RCPU2 PWM reset registers
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (128 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 129/703] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 131/703] drm/msm/gem: Fix VM_BIND range check Greg Kroah-Hartman
` (277 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hung-Chun Tseng, Yixun Lan,
Troy Mitchell, Philipp Zabel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
[ Upstream commit 168cae7e87463c34758db2b51537937a29b753f1 ]
Every entry in k1_rcpu2_resets[] uses RCPU2_PWM9_CLK_RST, so asserting
or deasserting the reset of any RCPU2 PWM from 0 to 8 acts on PWM9
instead. Each PWM has its own register, RCPU2_PWMn_CLK_RST at offset
4 * n, as k1-syscon.h already defines.
On a Milk-V Jupiter running the vendor kernel, which uses RCPU2 PWM2
for the fan, the RCPU2 registers read:
0x00: 0x4 0x04: 0x4 0x08: 0x1 0x0c: 0x4 ... 0x24: 0x4
Only PWM2's register has its reset deasserted, which matches one
register per PWM.
Use the matching register for each reset. No in-tree device tree uses
the RCPU2 PWMs yet, so this has no effect on current boards, but it
would break the first one that does.
Build-tested only (riscv defconfig, W=1); the fix could not be tested
at runtime, as mainline has no RCPU2 PWM node to exercise it.
Fixes: c479d7cf06c3 ("reset: spacemit: add support for SpacemiT CCU resets")
Signed-off-by: Hung-Chun Tseng <alan.tseng.cs@gmail.com>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/reset/reset-spacemit.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/reset/reset-spacemit.c b/drivers/reset/reset-spacemit.c
index e1272aff28f74..b2eee02d0ae83 100644
--- a/drivers/reset/reset-spacemit.c
+++ b/drivers/reset/reset-spacemit.c
@@ -182,15 +182,15 @@ static const struct ccu_reset_controller_data k1_rcpu_reset_data = {
};
static const struct ccu_reset_data k1_rcpu2_resets[] = {
- [RESET_RCPU2_PWM0] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM1] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM2] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM3] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM4] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM5] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM6] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM7] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
- [RESET_RCPU2_PWM8] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM0] = RESET_DATA(RCPU2_PWM0_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM1] = RESET_DATA(RCPU2_PWM1_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM2] = RESET_DATA(RCPU2_PWM2_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM3] = RESET_DATA(RCPU2_PWM3_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM4] = RESET_DATA(RCPU2_PWM4_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM5] = RESET_DATA(RCPU2_PWM5_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM6] = RESET_DATA(RCPU2_PWM6_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM7] = RESET_DATA(RCPU2_PWM7_CLK_RST, BIT(2), BIT(0)),
+ [RESET_RCPU2_PWM8] = RESET_DATA(RCPU2_PWM8_CLK_RST, BIT(2), BIT(0)),
[RESET_RCPU2_PWM9] = RESET_DATA(RCPU2_PWM9_CLK_RST, BIT(2), BIT(0)),
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 131/703] drm/msm/gem: Fix VM_BIND range check
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (129 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 130/703] reset: spacemit: Fix the RCPU2 PWM reset registers Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 132/703] drm/msm: Remove abuse of drm_exec internals Greg Kroah-Hartman
` (276 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Konrad Dybcio, Dmitry Baryshkov,
Rob Clark, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit 4f0af27c3aef5a9480712cbac4bee14f7509ae5f ]
Use size_add() to guard against overflow.
Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Fixes: 3a3bef68a6c1 ("drm/msm: Fix missing VM_BIND offset/range validation")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/765329/
Message-ID: <20261102172001.508440-2-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_vma.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
index faccb9a77fbe6..d00b4ffeb23f6 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -993,10 +993,10 @@ lookup_op(struct msm_vm_bind_job *job, const struct drm_msm_vm_bind_op *op)
if (invalid_alignment(op->iova))
ret = UERR(EINVAL, dev, "invalid address: %016llx\n", op->iova);
- if (invalid_alignment(op->obj_offset))
+ if (invalid_alignment(op->obj_offset) || (op->obj_offset > SIZE_MAX))
ret = UERR(EINVAL, dev, "invalid bo_offset: %016llx\n", op->obj_offset);
- if (invalid_alignment(op->range))
+ if (invalid_alignment(op->range) || (op->range > SIZE_MAX) || !op->range)
ret = UERR(EINVAL, dev, "invalid range: %016llx\n", op->range);
if (!drm_gpuvm_range_valid(job->vm, op->iova, op->range))
@@ -1099,7 +1099,7 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
op->obj = obj;
cnt++;
- if ((op->range + op->obj_offset) > obj->size) {
+ if (size_add(op->range, op->obj_offset) > obj->size) {
ret = UERR(EINVAL, dev, "invalid range: %016llx + %016llx > %016zx\n",
op->range, op->obj_offset, obj->size);
goto out_unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 132/703] drm/msm: Remove abuse of drm_exec internals
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (130 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 131/703] drm/msm/gem: Fix VM_BIND range check Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 133/703] drm/msm/gem: Disallow nr_bos for VM_BIND contexts Greg Kroah-Hartman
` (275 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Hellström,
Christian König, Rob Clark, Rob Clark, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellström <thomas.hellstrom@linux.intel.com>
[ Upstream commit 8c0e0b4628e5fd98bc614378f1aff4c1c8c26310 ]
The code was reading drm_exec internal state to determine whether
the drm_exec structure had been initialized or not, and therefore
needed cleaning up, relying on undocumented behaviour.
Instead add a bool to struct msm_gem_submit to indicate whether
drm_exec cleaning up is needed.
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rob Clark <rob.clark@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/715502/
Message-ID: <20260331092023.81616-3-thomas.hellstrom@linux.intel.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Stable-dep-of: b3b44f7508c7 ("drm/msm/gem: Disallow nr_bos for VM_BIND contexts")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem.h | 1 +
drivers/gpu/drm/msm/msm_gem_submit.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
index 1bf228d0f8dab..fb6992353536b 100644
--- a/drivers/gpu/drm/msm/msm_gem.h
+++ b/drivers/gpu/drm/msm/msm_gem.h
@@ -458,6 +458,7 @@ struct msm_gem_submit {
bool bos_pinned : 1;
bool fault_dumped:1;/* Limit devcoredump dumping to one per submit */
bool in_rb : 1; /* "sudo" mode, copy cmds into RB */
+ bool has_exec : 1; /* @exec is initialized. */
struct msm_ringbuffer *ring;
unsigned int nr_cmds;
unsigned int nr_bos;
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 2b6b5297f0592..d55897c358371 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -281,6 +281,7 @@ static int submit_lock_objects_vmbind(struct msm_gem_submit *submit)
int ret = 0;
drm_exec_init(&submit->exec, flags, submit->nr_bos);
+ submit->has_exec = true;
drm_exec_until_all_locked (&submit->exec) {
ret = drm_gpuvm_prepare_vm(submit->vm, exec, 1);
@@ -307,6 +308,7 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
return submit_lock_objects_vmbind(submit);
drm_exec_init(&submit->exec, flags, submit->nr_bos);
+ submit->has_exec = true;
drm_exec_until_all_locked (&submit->exec) {
ret = drm_exec_lock_obj(&submit->exec,
@@ -526,7 +528,7 @@ static void submit_cleanup(struct msm_gem_submit *submit, bool error)
if (error)
submit_unpin_objects(submit);
- if (submit->exec.objects)
+ if (submit->has_exec)
drm_exec_fini(&submit->exec);
/* if job wasn't enqueued to scheduler, early retirement: */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 133/703] drm/msm/gem: Disallow nr_bos for VM_BIND contexts
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (131 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 132/703] drm/msm: Remove abuse of drm_exec internals Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 134/703] drm/msm/gem: Decrement loop idx if handle lookup fails Greg Kroah-Hartman
` (274 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Baryshkov, Rob Clark,
Konrad Dybcio, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit b3b44f7508c7f01273ba773595b7787883ceb4e0 ]
If using VM_BIND, it is invalid to attach BOs to a GEM_SUBMIT ioctl.
Only the VM_BIND ioctl should be used for binding objects.
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/765330/
Message-ID: <20261102172001.508440-3-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_submit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index d55897c358371..2997b98b6f874 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -280,7 +280,7 @@ static int submit_lock_objects_vmbind(struct msm_gem_submit *submit)
struct drm_exec *exec = &submit->exec;
int ret = 0;
- drm_exec_init(&submit->exec, flags, submit->nr_bos);
+ drm_exec_init(&submit->exec, flags, 0);
submit->has_exec = true;
drm_exec_until_all_locked (&submit->exec) {
@@ -593,6 +593,9 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
return -EINVAL;
}
+ if (msm_context_is_vmbind(ctx) && args->nr_bos)
+ return UERR(EINVAL, dev, "invalid nr_bos, must be zero for VM_BIND contexts");
+
queue = msm_submitqueue_get(ctx, args->queueid);
if (!queue)
return -ENOENT;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 134/703] drm/msm/gem: Decrement loop idx if handle lookup fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (132 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 133/703] drm/msm/gem: Disallow nr_bos for VM_BIND contexts Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 135/703] drm/msm/gem: Clear nr_ops in lookup_ops() failure path Greg Kroah-Hartman
` (273 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rob Clark, Konrad Dybcio,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit 31708945d3647ad29f91def9d40dafa149ac66f1 ]
In the out_unlock unlock loop, we should skip the op which still has the
gem handle instead of gem obj ptr.
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/765328/
Message-ID: <20261102172001.508440-4-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_vma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
index d00b4ffeb23f6..c4dc0ad036b66 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -1091,6 +1091,7 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
obj = idr_find(&file->object_idr, op->handle);
if (!obj) {
ret = UERR(EINVAL, dev, "invalid handle %u at index %u\n", op->handle, i);
+ i--;
goto out_unlock;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 135/703] drm/msm/gem: Clear nr_ops in lookup_ops() failure path
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (133 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 134/703] drm/msm/gem: Decrement loop idx if handle lookup fails Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 136/703] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata() Greg Kroah-Hartman
` (272 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rob Clark, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <robin.clark@oss.qualcomm.com>
[ Upstream commit b22f5d783eadbebe90481db0c48cecf719e71dad ]
We've already dropped the references taken in the handle lookup loop, so
we don't want to drop them again in msm_vma_job_free().
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Patchwork: https://patchwork.freedesktop.org/patch/765324/
Message-ID: <20261102172001.508440-5-robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_gem_vma.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
index c4dc0ad036b66..bd3408fcb241d 100644
--- a/drivers/gpu/drm/msm/msm_gem_vma.c
+++ b/drivers/gpu/drm/msm/msm_gem_vma.c
@@ -1069,7 +1069,6 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
}
if (ret) {
- job->nr_ops = 0;
goto out;
}
@@ -1124,6 +1123,9 @@ vm_bind_job_lookup_ops(struct msm_vm_bind_job *job, struct drm_msm_vm_bind *args
}
}
out:
+ if (ret)
+ job->nr_ops = 0;
+
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 136/703] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (134 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 135/703] drm/msm/gem: Clear nr_ops in lookup_ops() failure path Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 137/703] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
` (271 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bart Van Assche, Rob Clark,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <bvanassche@acm.org>
[ Upstream commit 1e59855738454b14021b64115f0090eafc7526ae ]
If krealloc() fails, msm_ioctl_gem_info_set_metadata() returns without
unlocking the GEM object. Fix this by jumping to a new label that
unlocks the GEM object before the buffer is freed. This bug has been
detected by the Clang thread-safety analyzer.
Fixes: 1c8c354098ea ("drm/msm: Add error handling for krealloc in metadata setup")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Patchwork: https://patchwork.freedesktop.org/patch/763272/
Message-ID: <9671164f87138a0caf5c69b66129bbd6faf932f8.1793044688.git.bvanassche@acm.org>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/msm_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 8094e5e7e9a54..2eb5a8520e0eb 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -493,13 +493,14 @@ static int msm_ioctl_gem_info_set_metadata(struct drm_gem_object *obj,
krealloc(msm_obj->metadata, metadata_size, GFP_KERNEL);
if (!new_metadata) {
ret = -ENOMEM;
- goto out;
+ goto unlock;
}
msm_obj->metadata = new_metadata;
msm_obj->metadata_size = metadata_size;
memcpy(msm_obj->metadata, buf, metadata_size);
+unlock:
msm_gem_unlock(obj);
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 137/703] selftests: drivers/s390x: Select uvdevice tests using the target architecture
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (135 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 136/703] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 138/703] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
` (270 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sasha Levin, Steffen Eiden,
Christian Borntraeger
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <sashal@kernel.org>
[ Upstream commit 62aef2c04e0e69a9b88affa74ff699ce5c4e8652 ]
The uvdevice Makefile decides whether to build its test from uname -m,
which describes the build host. A cross build for s390 on another host
therefore silently omits the test, while the non-s390 branch provides
no-op build and installation targets but no emit_tests target.
Select the test from the target ARCH when it is given and from the
host's SUBARCH otherwise, accepting both the s390 and s390x spellings,
and include lib.mk unconditionally so that other architectures build,
install and emit an empty runlist. ARCH itself is left unset so that a
native LLVM=1 build keeps using the compiler's native target.
Drop the include path derived from tools/arch/$(ARCH): the test only
needs asm/uvdevice.h from the installed kernel headers, and the path
does not exist for the s390x spelling.
Fixes: cbac924200b8 ("selftests: drivers/s390x: Add uvdevice tests")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../selftests/drivers/s390x/uvdevice/Makefile | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/drivers/s390x/uvdevice/Makefile b/tools/testing/selftests/drivers/s390x/uvdevice/Makefile
index 755d164384c46..586a9aa6fb158 100644
--- a/tools/testing/selftests/drivers/s390x/uvdevice/Makefile
+++ b/tools/testing/selftests/drivers/s390x/uvdevice/Makefile
@@ -1,20 +1,13 @@
include ../../../../../build/Build.include
-UNAME_M := $(shell uname -m)
-
-ifneq ($(UNAME_M),s390x)
-nothing:
-.PHONY: all clean run_tests install
-.SILENT:
-else
+top_srcdir ?= ../../../../../..
+include $(top_srcdir)/scripts/subarch.include
+ARCH_PROCESSED := $(or $(ARCH),$(SUBARCH))
+ifneq (,$(filter s390 s390x,$(ARCH_PROCESSED)))
TEST_GEN_PROGS := test_uvdevice
-top_srcdir ?= ../../../../../..
-LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
-
-CFLAGS += -Wall -Werror -static $(KHDR_INCLUDES) -I$(LINUX_TOOL_ARCH_INCLUDE)
+CFLAGS += -Wall -Werror -static $(KHDR_INCLUDES)
+endif
include ../../../lib.mk
-
-endif
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 138/703] phy: ingenic: fix unbalanced regulator disable in exit
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (136 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 137/703] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 140/703] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
` (269 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Felix Gu, Manivannan Sadhasivam,
Paul Cercueil, Olivier Louvignes, H. Nikolaus Schaller,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <ustc.gu@gmail.com>
[ Upstream commit 71c1be5cc4e083852c8437bd6afcb99ee3050e8e ]
exit() and power_off() both disable vcc_supply, so the regulator
gets disabled twice for every power cycle, causing an unbalanced
disable WARN.
Drop the regulator_disable() call from the exit callback and leave
the regulator to the power_on/power_off pair.
Fixes: 31de313dfdcf ("PHY: Ingenic: Add USB PHY driver using generic PHY framework.")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Olivier Louvignes <olivier@mgcrea.io>
Reviewed-By: H. Nikolaus Schaller <hns@goldelico.com>
Link: https://patch.msgid.link/20260906-ingenic-v1-1-2311f3df8ddc@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/ingenic/phy-ingenic-usb.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/phy/ingenic/phy-ingenic-usb.c b/drivers/phy/ingenic/phy-ingenic-usb.c
index 7e62d46850fda..d8e5ef302b748 100644
--- a/drivers/phy/ingenic/phy-ingenic-usb.c
+++ b/drivers/phy/ingenic/phy-ingenic-usb.c
@@ -124,7 +124,6 @@ static int ingenic_usb_phy_exit(struct phy *phy)
struct ingenic_usb_phy *priv = phy_get_drvdata(phy);
clk_disable_unprepare(priv->clk);
- regulator_disable(priv->vcc_supply);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 140/703] phy: ti: pipe3: Fix clock resource leak on probe errors
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (137 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 138/703] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 141/703] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
` (268 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hongling Zeng, Manivannan Sadhasivam,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <zenghongling@kylinos.cn>
[ Upstream commit 6dc01e3516d79cf4d690d892499a0bd08a14285b ]
When devm_phy_create() or devm_of_phy_provider_register() fails,
the refclk that was enabled earlier is not disabled, causing a
resource leak.
Fix this by adding an error handling path to disable the clock
when these functions fail.
Fixes: 234738ea3390 ("phy: ti-pipe3: move clk initialization to a separate function")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909122630.1313205-3-zenghongling@kylinos.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/ti/phy-ti-pipe3.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
index 0e3bc92187338..021657cbce481 100644
--- a/drivers/phy/ti/phy-ti-pipe3.c
+++ b/drivers/phy/ti/phy-ti-pipe3.c
@@ -834,21 +834,39 @@ static int ti_pipe3_probe(struct platform_device *pdev)
*/
if (phy->mode == PIPE3_MODE_SATA) {
if (!IS_ERR(phy->refclk)) {
- clk_prepare_enable(phy->refclk);
+ ret = clk_prepare_enable(phy->refclk);
+ if (ret) {
+ dev_err(dev, "Failed to enable refclk %d\n", ret);
+ goto err_pm_disable;
+ }
phy->sata_refclk_enabled = true;
}
}
generic_phy = devm_phy_create(dev, NULL, &ops);
- if (IS_ERR(generic_phy))
- return PTR_ERR(generic_phy);
+ if (IS_ERR(generic_phy)) {
+ ret = PTR_ERR(generic_phy);
+ goto err_clk_disable;
+ }
phy_set_drvdata(generic_phy, phy);
ti_pipe3_power_off(generic_phy);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
- return PTR_ERR_OR_ZERO(phy_provider);
+ if (IS_ERR(phy_provider)) {
+ ret = PTR_ERR(phy_provider);
+ goto err_clk_disable;
+ }
+
+ return 0;
+
+err_clk_disable:
+ if (phy->sata_refclk_enabled)
+ clk_disable_unprepare(phy->refclk);
+err_pm_disable:
+ pm_runtime_disable(dev);
+ return ret;
}
static void ti_pipe3_remove(struct platform_device *pdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 141/703] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (138 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 140/703] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 143/703] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
` (267 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Manivannan Sadhasivam, Hongling Zeng,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongling Zeng <zenghongling@kylinos.cn>
[ Upstream commit aeb637c73631851de0965514151f7ff7bc13f940 ]
ti_pipe3_get_clk() has two issues with -EPROBE_DEFER error handling:
1. When devm_clk_get() for sysclk fails, the function returns -EINVAL
instead of propagating the actual error code. This masks -EPROBE_DEFER
to -EINVAL, breaking the probe deferral mechanism and causing permanent
driver initialization failure on systems with non-deterministic probe
ordering.
2. For SATA PHY refclk, the function ignores all errors to support older
DTBs missing the refclk property. However, this incorrectly ignores
-EPROBE_DEFER as well, causing the driver to proceed without waiting
for the clock provider to become available.
Fix both issues:
- Return PTR_ERR(phy->sys_clk) instead of -EINVAL to propagate all
error codes including -EPROBE_DEFER
- Use devm_clk_get_optional() for SATA refclk to handle optional
clocks while propagating -EPROBE_DEFER and other errors
Fixes: a70143bbef6b ("drivers: phy: usb3/pipe3: Adapt pipe3 driver to Generic PHY Framework")
Fixes: 7f33912d2978 ("phy: ti-pipe3: Fix SATA across suspend/resume")
Suggested-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260909122630.1313205-4-zenghongling@kylinos.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/ti/phy-ti-pipe3.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/phy/ti/phy-ti-pipe3.c b/drivers/phy/ti/phy-ti-pipe3.c
index 021657cbce481..fdd81c935e5f3 100644
--- a/drivers/phy/ti/phy-ti-pipe3.c
+++ b/drivers/phy/ti/phy-ti-pipe3.c
@@ -608,14 +608,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
struct clk *clk;
struct device *dev = phy->dev;
- phy->refclk = devm_clk_get(dev, "refclk");
+ /*
+ * refclk is optional for SATA PHY to support older DTBs, but
+ * required for other modes. Use devm_clk_get_optional() for SATA
+ * which returns NULL for -ENOENT, allowing us to propagate all
+ * other errors including -EPROBE_DEFER.
+ */
+ if (phy->mode == PIPE3_MODE_SATA)
+ phy->refclk = devm_clk_get_optional(dev, "refclk");
+ else
+ phy->refclk = devm_clk_get(dev, "refclk");
+
if (IS_ERR(phy->refclk)) {
- dev_err(dev, "unable to get refclk\n");
- /* older DTBs have missing refclk in SATA PHY
- * so don't bail out in case of SATA PHY.
- */
- if (phy->mode != PIPE3_MODE_SATA)
- return PTR_ERR(phy->refclk);
+ return dev_err_probe(dev, PTR_ERR(phy->refclk),
+ "unable to get refclk\n");
}
if (phy->mode != PIPE3_MODE_SATA) {
@@ -631,8 +637,8 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
if (phy->mode != PIPE3_MODE_PCIE || phy->phy_power_syscon) {
phy->sys_clk = devm_clk_get(dev, "sysclk");
if (IS_ERR(phy->sys_clk)) {
- dev_err(dev, "unable to get sysclk\n");
- return -EINVAL;
+ return dev_err_probe(dev, PTR_ERR(phy->sys_clk),
+ "unable to get sysclk\n");
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 143/703] ksmbd: sign the last response of a compound that ends early
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (139 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 141/703] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 144/703] wifi: iwlwifi: mvm: correctly check the API version Greg Kroah-Hartman
` (266 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michail Andreas Michalopoulos,
Ian Bridges, Namjae Jeon, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
[ Upstream commit 3d322b98b56628ee69e4528a52cc1f445880fa17 ]
is_chained_smb2_message() ends a compound early when the next command
does not fit in the request, or its response would not fit in the
response buffer. Since commit e2b76ab8b5c9 ("ksmbd: add support for
read compound"), __handle_ksmbd_work() then signs ksmbd_resp_buf_curr(),
which is_chained_smb2_message() only moves to the response of the
command just processed when it chains to the next command or reaches
the last one. On an early end it returns without moving it, so for a
command after the first, the previous command's response was signed
again, over the iovecs of both responses, and the response of this
command was left unsigned. Neither signature verifies at the client.
Handle an early end as the end of the compound: pad the response to 8
bytes and make it the current one. smb2_allocate_rsp_buf() leaves room
for that padding in the response buffer of a compound.
Only a compound whose NextCommand points past the end of the message,
or whose responses fill the response buffer, takes this path. Sashiko
pointed it out in its review of an unrelated series.
An AI assistant was used to draft the patch and as an independent
reviewer.
Fixes: e2b76ab8b5c9 ("ksmbd: add support for read compound")
Signed-off-by: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
Reviewed-by: Ian Bridges <icb@fastmail.org>
Tested-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 2fd2d52eca00c..49c4354b18053 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -469,22 +469,27 @@ bool is_chained_smb2_message(struct ksmbd_work *work)
get_rfc1002_len(work->request_buf)) {
pr_err("next command(%u) offset exceeds smb msg size\n",
next_cmd);
- return false;
+ goto last_rsp;
}
if ((u64)get_rfc1002_len(work->response_buf) + MAX_CIFS_SMALL_BUFFER_SIZE >
work->response_sz) {
pr_err("next response offset exceeds response buffer size\n");
- return false;
+ goto last_rsp;
}
ksmbd_debug(SMB, "got SMB2 chained command\n");
init_chained_smb2_rsp(work);
return true;
- } else if (work->next_smb2_rcv_hdr_off) {
+ }
+
+last_rsp:
+ if (work->next_smb2_rcv_hdr_off) {
/*
- * This is last request in chained command,
- * align response to 8 byte
+ * This is the last response of a compound, also when the
+ * compound ends early because the next command does not fit.
+ * Align it to 8 bytes and make it the current response, which
+ * is the one the caller signs.
*/
len = ALIGN(get_rfc1002_len(work->response_buf), 8);
len = len - get_rfc1002_len(work->response_buf);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 144/703] wifi: iwlwifi: mvm: correctly check the API version
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (140 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 143/703] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 145/703] scsi: lpfc: Fix race conditions in ELS retry handling Greg Kroah-Hartman
` (265 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Miri Korenblit, Sasha Levin,
Chris Bainbridge
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
[ Upstream commit 06cfbf21b33772266a03a580182b74233f41f2b2 ]
The check for the firmware version for the reset handshake
was wrong. mvm->fw->ucode_ver is the major number itself.
No need to mask it with IWL_UCODE_MAJOR.
We could look at the major number from IWL_UCODE_TLV_FW_VERSION
but we don't remember that number and looking at fw->ucode_ver
is good enough.
Fixes: 0eaa1f245ac0 ("wifi: iwlwifi: mvm: don't support the reset handshake for old firmwares")
Reported-and-tested-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Link: https://lore.kernel.org/linux-wireless/amzVtgQb2p-_nShU@debian.local/
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20261114193144.ab54bc9717fc.I8cda260e2ef7aedd790915a17cb6832010f82aa4@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 3e7c620821069..0208fdb3b75ff 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -1412,15 +1412,13 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg,
sizeof(mvm->hw->wiphy->fw_version),
"%.31s", fw->fw_version);
- trans->conf.fw_reset_handshake =
- fw_has_capa(&mvm->fw->ucode_capa,
- IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE);
-
- /* Those firmware versions claim to support the fw_reset_handshake
+ /* Some firmware versions claim to support the fw_reset_handshake
* but they are buggy.
*/
- if (IWL_UCODE_MAJOR(mvm->fw->ucode_ver) <= 77)
- trans->conf.fw_reset_handshake = false;
+ trans->conf.fw_reset_handshake =
+ fw_has_capa(&mvm->fw->ucode_capa,
+ IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE) &&
+ mvm->fw->ucode_ver > 77;
trans->conf.queue_alloc_cmd_ver =
iwl_fw_lookup_cmd_ver(mvm->fw,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 145/703] scsi: lpfc: Fix race conditions in ELS retry handling
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (141 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 144/703] wifi: iwlwifi: mvm: correctly check the API version Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 146/703] scsi: ch: Remove the minor from ch_index_idr after device_destroy() Greg Kroah-Hartman
` (264 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Mahlkuch, Hannes Reinecke,
Paul Ely, Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Mahlkuch <kmahlkuc@linux.ibm.com>
[ Upstream commit 7470a1f2a84d68d177560b78388e640771b6b94a ]
This patch addresses a race condition in the lpfc driver's ELS retry event
handling that can lead to a use-after-free in the
lpfc_cancel_retry_delay_tmo(), where the NLP_DELAY_TMO flag is cleared
before acquiring the lock to check if the retry event is queued. This
creates a window where the timer can be rescheduled and fire, causing both
the cancel path and the worker thread to release the same reference,
resulting in a double-put and use-after-free.
Moved capture ndlp and clear evt_arg1 under hbalock while dequeuing
LPFC_EVT_ELS_RETRY in lpfc_work_list_done().
Signed-off-by: Kyle Mahlkuch <kmahlkuc@linux.ibm.com>
Fixes: e47c9093531d ("[SCSI] lpfc 8.2.5 : Correct ndlp referencing issues")
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Paul Ely <pely@broadcom.com>
Link: https://patch.msgid.link/dcea48dd-f76c-4bb0-9275-c12ef9bd78a2@linux.ibm.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/lpfc/lpfc_els.c | 29 +++++++++++++++++++++++------
drivers/scsi/lpfc/lpfc_hbadisc.c | 11 ++++++++++-
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c08237f04bce2..7d16b3295d4fa 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4351,18 +4351,35 @@ lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_t retry)
void
lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp)
{
- struct lpfc_work_evt *evtp;
+ struct lpfc_hba *phba = vport->phba;
+ struct lpfc_work_evt *evtp = &nlp->els_retry_evt;
+ struct lpfc_nodelist *arg_ndlp = NULL;
+ unsigned long flags;
if (!test_and_clear_bit(NLP_DELAY_TMO, &nlp->nlp_flag))
return;
timer_delete_sync(&nlp->nlp_delayfunc);
nlp->nlp_last_elscmd = 0;
- if (!list_empty(&nlp->els_retry_evt.evt_listp)) {
- list_del_init(&nlp->els_retry_evt.evt_listp);
- /* Decrement nlp reference count held for the delayed retry */
- evtp = &nlp->els_retry_evt;
- lpfc_nlp_put((struct lpfc_nodelist *)evtp->evt_arg1);
+
+ /*
+ * If retry event is queued, remove it under lock and consume
+ * its payload to prevent double-put. The event holds a reference
+ * to the nodelist that must be released exactly once.
+ */
+ spin_lock_irqsave(&phba->hbalock, flags);
+ if (!list_empty(&evtp->evt_listp)) {
+ list_del_init(&evtp->evt_listp);
+ /* Take local copy and clear to prevent reuse */
+ arg_ndlp = (struct lpfc_nodelist *)evtp->evt_arg1;
+ evtp->evt_arg1 = NULL;
+ smp_wmb(); /* Ensure NULL visible before unlock */
}
+ spin_unlock_irqrestore(&phba->hbalock, flags);
+
+ /* Drop the event-held reference outside the lock */
+ if (arg_ndlp)
+ lpfc_nlp_put(arg_ndlp);
+
if (test_and_clear_bit(NLP_NPR_2B_DISC, &nlp->nlp_flag)) {
if (vport->num_disc_nodes) {
if (vport->port_state < LPFC_VPORT_READY) {
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 717ae56c8e4bd..fd01c2a0a4c0f 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -842,12 +842,21 @@ lpfc_work_list_done(struct lpfc_hba *phba)
while (!list_empty(&phba->work_list)) {
list_remove_head((&phba->work_list), evtp, typeof(*evtp),
evt_listp);
+ /*
+ * The ELS retry event can be requeued by lpfc_els_retry_delay()
+ * as soon as hbalock is dropped. Consume the payload within the
+ * hbalock to prevent reuse or double-put.
+ */
+ if (evtp->evt == LPFC_EVT_ELS_RETRY) {
+ ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1);
+ evtp->evt_arg1 = NULL;
+ }
spin_unlock_irq(&phba->hbalock);
hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags);
free_evt = 1;
switch (evtp->evt) {
case LPFC_EVT_ELS_RETRY:
- ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1);
+ /* ndlp was already captured under hbalock */
if (!hba_pci_err) {
lpfc_els_retry_delay_handler(ndlp);
free_evt = 0; /* evt is part of ndlp */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 146/703] scsi: ch: Remove the minor from ch_index_idr after device_destroy()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (142 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 145/703] scsi: lpfc: Fix race conditions in ELS retry handling Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 147/703] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
` (263 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Changyul Lee, Laurence Oberman,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changyul Lee <lcy8047@gmail.com>
[ Upstream commit 9f9e0b1e5399045982788a954d3461de894e40c7 ]
ch_remove() removes the minor from ch_index_idr before device_destroy()
removes the "sch<N>" device. A changer probed in between can get the same
minor, and its device_create() fails:
sysfs: cannot create duplicate filename '/class/scsi_changer/sch0'
...
ch 1:0:0:0: ch0: device_create failed
The new changer is then not attached.
Replace the IDR entry with NULL instead, so that ch_open() still fails with
-ENXIO for the changer being removed, and remove the minor after
device_destroy().
Fixes: da707c54c342 ("[SCSI] ch: fix device minor number management bug")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Link: https://patch.msgid.link/20261109160651.986356-1-lcy8047@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/ch.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 95bbcc497de9c..711d02353ae7b 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -960,11 +960,15 @@ static int ch_remove(struct device *dev)
scsi_changer *ch = dev_get_drvdata(dev);
spin_lock(&ch_index_lock);
- idr_remove(&ch_index_idr, ch->minor);
+ idr_replace(&ch_index_idr, NULL, ch->minor);
dev_set_drvdata(dev, NULL);
spin_unlock(&ch_index_lock);
device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
+
+ spin_lock(&ch_index_lock);
+ idr_remove(&ch_index_idr, ch->minor);
+ spin_unlock(&ch_index_lock);
scsi_device_put(ch->device);
kref_put(&ch->ref, ch_destroy);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 147/703] phy: rockchip: snps-pcie3: Raise the SRAM init timeout
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (143 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 146/703] scsi: ch: Remove the minor from ch_index_idr after device_destroy() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 148/703] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
` (262 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sebastian Reichel,
Manivannan Sadhasivam, Shawn Lin, Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <shawn.lin@rock-chips.com>
[ Upstream commit 7c2a2268bd3ddf3b2c674ebb7557ae24c22309d7 ]
The SRAM initialization of the PCIe3 PHY may take longer than the 500us
currently allowed, especially on a slow power-up such as at low
temperature. In that case the driver reports
lock failed 0x..., check input refclk and power supply
even though the input refclk and power supply are fine.
Raise the timeout to 20ms and use a named constant for it, applied to
both the RK3568 and RK3588 paths.
A non-zero sleep interval (1ms) is passed to the polling helpers so the
CPU is yielded between reads. With sleep_us == 0 the helpers tight-loop,
which would otherwise burn the CPU during the now much longer wait.
Fixes: 2e9bffc4f713 ("phy: rockchip: Support PCIe v3")
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Link: https://patch.msgid.link/20261102005129.3745527-1-shawn.lin@rock-chips.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
index 4e8ffd173096a..ce7d8db2a7c5f 100644
--- a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
+++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
@@ -18,6 +18,9 @@
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>
+#include <linux/units.h>
+
+#define RK_PCIE_SRAM_INIT_TIMEOUT_US (20 * USEC_PER_MSEC)
/* Register for RK3568 */
#define GRF_PCIE30PHY_CON1 0x4
@@ -127,7 +130,7 @@ static int rockchip_p3phy_rk3568_init(struct rockchip_p3phy_priv *priv)
ret = regmap_read_poll_timeout(priv->phy_grf,
GRF_PCIE30PHY_STATUS0,
reg, SRAM_INIT_DONE(reg),
- 0, 500);
+ 1000, RK_PCIE_SRAM_INIT_TIMEOUT_US);
if (ret)
dev_err(&priv->phy->dev, "%s: lock failed 0x%x, check input refclk and power supply\n",
__func__, reg);
@@ -187,11 +190,11 @@ static int rockchip_p3phy_rk3588_init(struct rockchip_p3phy_priv *priv)
ret = regmap_read_poll_timeout(priv->phy_grf,
RK3588_PCIE3PHY_GRF_PHY0_STATUS1,
reg, RK3588_SRAM_INIT_DONE(reg),
- 0, 500);
+ 1000, RK_PCIE_SRAM_INIT_TIMEOUT_US);
ret |= regmap_read_poll_timeout(priv->phy_grf,
RK3588_PCIE3PHY_GRF_PHY1_STATUS1,
reg, RK3588_SRAM_INIT_DONE(reg),
- 0, 500);
+ 1000, RK_PCIE_SRAM_INIT_TIMEOUT_US);
if (ret)
dev_err(&priv->phy->dev, "lock failed 0x%x, check input refclk and power supply\n",
reg);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 148/703] Bluetooth: mgmt: Fix read_index_list() buffer overflow
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (144 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 147/703] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 149/703] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
` (261 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit cfdd650c5dabbd2f59a0e916aa8ef3f1965a3b4b ]
The first pass counts only configured controllers, but HCI_UNCONFIGURED
can change before the second pass, which may then write more entries than
were allocated. Size the buffer from the total number of controllers as
read_unconf_index_list() already does.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-7841362e-9b8f-465f-aa22-e99c315231e2
Fixes: 73d1df2a7a10 ("Bluetooth: Add support for Read Unconfigured Index List command")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index b16b70a3cab61..90929d9c423f5 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -446,10 +446,8 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data,
read_lock(&hci_dev_list_lock);
count = 0;
- list_for_each_entry(d, &hci_dev_list, list) {
- if (!hci_dev_test_flag(d, HCI_UNCONFIGURED))
- count++;
- }
+ list_for_each_entry(d, &hci_dev_list, list)
+ count++;
rp_len = sizeof(*rp) + (2 * count);
rp = kmalloc(rp_len, GFP_ATOMIC);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 149/703] Bluetooth: hci_core: Take req_sync lock in hci_power_on()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (145 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 148/703] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 150/703] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
` (260 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 6a296a4658124490d7dddd2b751e5f9ae5c5aec7 ]
hci_powered_update_sync() issues synchronous HCI commands but was called
without hci_req_sync_lock(), racing with other request users.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-1baf7393-3aeb-4fa5-806f-19cea743b9f3
Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 54a8942a022ec..f8a3c97d8e70f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -951,7 +951,9 @@ static void hci_power_on(struct work_struct *work)
hci_dev_test_flag(hdev, HCI_MGMT) &&
hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) {
cancel_delayed_work(&hdev->power_off);
+ hci_req_sync_lock(hdev);
err = hci_powered_update_sync(hdev);
+ hci_req_sync_unlock(hdev);
mgmt_power_on(hdev, err);
return;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 150/703] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (146 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 149/703] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 151/703] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
` (259 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 8984b72f9508b2d03c58a82d73881b5e1e5f5bc4 ]
hci_disable_ext_adv_instance_sync() calls hci_find_adv_instance() and
dereferences the instance without hdev->lock, racing with the removal of
the instance. Look the instance up under the lock and only use the values
copied while it is held.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-a364929c-cd00-492a-a83c-5425d042b09f
Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index ba5add3292e33..63c351d099e72 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -1250,16 +1250,26 @@ static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
struct hci_cp_ext_adv_set *set;
u8 data[sizeof(*cp) + sizeof(*set) * 1];
u8 size;
- struct adv_info *adv = NULL;
+ u8 handle = instance;
/* If request specifies an instance that doesn't exist, fail */
if (instance > 0) {
+ struct adv_info *adv;
+ bool enabled = false;
+
+ hci_dev_lock(hdev);
adv = hci_find_adv_instance(hdev, instance);
+ if (adv) {
+ enabled = adv->enabled;
+ handle = adv->handle;
+ }
+ hci_dev_unlock(hdev);
+
if (!adv)
return -EINVAL;
/* If not enabled there is nothing to do */
- if (!adv->enabled)
+ if (!enabled)
return 0;
}
@@ -1272,7 +1282,7 @@ static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)
cp->num_of_sets = !!instance;
cp->enable = 0x00;
- set->handle = adv ? adv->handle : instance;
+ set->handle = handle;
size = sizeof(*cp) + sizeof(*set) * cp->num_of_sets;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 151/703] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (147 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 150/703] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 152/703] Bluetooth: SMP: Serialize link key updates from smp_notify_keys() Greg Kroah-Hartman
` (258 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit c592dfe9637c65eeaff4c9f6fd869f39ad7ae472 ]
The advertising instance returned by hci_find_adv_instance() was
dereferenced without hdev->lock and could be freed concurrently.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-616b1f8e-06ec-4634-a907-5eb4e82f66df
Fixes: cba6b758711c ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 2")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 63c351d099e72..3f75dbd63c279 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2150,9 +2150,13 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
if (hdev->adv_instance_timeout)
return -EBUSY;
+ hci_dev_lock(hdev);
+
adv = hci_find_adv_instance(hdev, instance);
- if (!adv)
+ if (!adv) {
+ hci_dev_unlock(hdev);
return -ENOENT;
+ }
/* A zero timeout means unlimited advertising. As long as there is
* only one instance, duration should be ignored. We still set a timeout
@@ -2182,6 +2186,8 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
secs_to_jiffies(timeout));
}
+ hci_dev_unlock(hdev);
+
/* If we're just re-scheduling the same instance again then do not
* execute any HCI commands. This happens when a single instance is
* being advertised.
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 152/703] Bluetooth: SMP: Serialize link key updates from smp_notify_keys()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (148 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 151/703] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 153/703] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
` (257 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit e428ab70fb3398e835e5d70ba4839e7c06583b83 ]
smp_notify_keys() runs from the L2CAP RX path without hdev->lock, yet
hci_add_link_key() and the debug key removal modify hdev->link_keys and
dereference entries returned by hci_find_link_key(), so a concurrent
unpair or Load Link Keys can free the entry being updated.
hdev->lock can't be taken there since it is ordered before the l2cap
channel lock held by the SMP receive path (see smp_user_confirm_reply()).
Add a dedicated link_keys_lock protecting the writers of hdev->link_keys
(add, remove and clear). SMP holds it while it adds the key, notifies
mgmt and removes a debug key, so the key can't go away meanwhile, and
the debug key removed by hci_link_key_notify_evt() is deleted by
reference with hci_del_link_key() since a lookup by address skips the
keys that are blocked.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-7482a666-d2a0-44a4-9e0d-05354860a5fa
Fixes: 6a77083af57f ("Bluetooth: Add support for LE SC key generation")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/hci_core.h | 6 ++++
net/bluetooth/hci_core.c | 62 +++++++++++++++++++++++++++++---
net/bluetooth/hci_event.c | 3 +-
net/bluetooth/smp.c | 11 ++++--
4 files changed, 74 insertions(+), 8 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7642508c7ac24..a9450d92921a4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -561,6 +561,8 @@ struct hci_dev {
struct list_head accept_list;
struct list_head uuids;
struct list_head link_keys;
+ /* Serializes the writers of link_keys, see hci_add_link_key() */
+ struct mutex link_keys_lock;
struct list_head long_term_keys;
struct list_head identity_resolving_keys;
struct mutex remote_oob_lock;
@@ -1848,6 +1850,10 @@ struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,
void hci_uuids_clear(struct hci_dev *hdev);
void hci_link_keys_clear(struct hci_dev *hdev);
+struct link_key *__hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
+ bdaddr_t *bdaddr, u8 *val, u8 type,
+ u8 pin_len, bool *persistent);
+void hci_del_link_key(struct hci_dev *hdev, struct link_key *key);
u8 *hci_conn_key_enc_size(struct hci_conn *conn);
struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f8a3c97d8e70f..5c5cee7ea9ae6 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1053,10 +1053,14 @@ void hci_link_keys_clear(struct hci_dev *hdev)
{
struct link_key *key, *tmp;
+ mutex_lock(&hdev->link_keys_lock);
+
list_for_each_entry_safe(key, tmp, &hdev->link_keys, list) {
list_del_rcu(&key->list);
kfree_rcu(key, rcu);
}
+
+ mutex_unlock(&hdev->link_keys_lock);
}
void hci_smp_ltks_clear(struct hci_dev *hdev)
@@ -1273,13 +1277,16 @@ struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
return irk_to_return;
}
-struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
- bdaddr_t *bdaddr, u8 *val, u8 type,
- u8 pin_len, bool *persistent)
+/* This function requires the caller holds hdev->link_keys_lock */
+struct link_key *__hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
+ bdaddr_t *bdaddr, u8 *val, u8 type,
+ u8 pin_len, bool *persistent)
{
struct link_key *key, *old_key;
u8 old_key_type;
+ lockdep_assert_held(&hdev->link_keys_lock);
+
old_key = hci_find_link_key(hdev, bdaddr);
if (old_key) {
old_key_type = old_key->type;
@@ -1322,6 +1329,26 @@ struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
return key;
}
+/* The writers of hdev->link_keys are serialized with hdev->link_keys_lock
+ * so the list can be modified without hdev->lock (e.g. from SMP, where it
+ * can't be taken after the l2cap channel lock). The returned key is only
+ * safe to use while hdev->lock is held, callers without it must use
+ * __hci_add_link_key() and keep hdev->link_keys_lock while using the key.
+ */
+struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
+ bdaddr_t *bdaddr, u8 *val, u8 type,
+ u8 pin_len, bool *persistent)
+{
+ struct link_key *key;
+
+ mutex_lock(&hdev->link_keys_lock);
+ key = __hci_add_link_key(hdev, conn, bdaddr, val, type, pin_len,
+ persistent);
+ mutex_unlock(&hdev->link_keys_lock);
+
+ return key;
+}
+
struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type, u8 type, u8 authenticated,
u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand)
@@ -1383,18 +1410,44 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
{
struct link_key *key;
+ mutex_lock(&hdev->link_keys_lock);
+
key = hci_find_link_key(hdev, bdaddr);
- if (!key)
+ if (!key) {
+ mutex_unlock(&hdev->link_keys_lock);
return -ENOENT;
+ }
BT_DBG("%s removing %pMR", hdev->name, bdaddr);
list_del_rcu(&key->list);
kfree_rcu(key, rcu);
+ mutex_unlock(&hdev->link_keys_lock);
+
return 0;
}
+/* Remove a key previously returned by hci_add_link_key(), unlike
+ * hci_remove_link_key() this also works for keys that are blocked.
+ */
+void hci_del_link_key(struct hci_dev *hdev, struct link_key *key)
+{
+ struct link_key *k;
+
+ mutex_lock(&hdev->link_keys_lock);
+
+ list_for_each_entry(k, &hdev->link_keys, list) {
+ if (k == key) {
+ list_del_rcu(&key->list);
+ kfree_rcu(key, rcu);
+ break;
+ }
+ }
+
+ mutex_unlock(&hdev->link_keys_lock);
+}
+
int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type)
{
struct smp_ltk *k, *tmp;
@@ -2537,6 +2590,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
hdev->def_page_scan_window = 0x0012;
mutex_init(&hdev->lock);
+ mutex_init(&hdev->link_keys_lock);
mutex_init(&hdev->req_lock);
mutex_init(&hdev->mgmt_pending_lock);
mutex_init(&hdev->remote_oob_lock);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 797b86f57c6db..094af9cec41c1 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4787,8 +4787,7 @@ static void hci_link_key_notify_evt(struct hci_dev *hdev, void *data,
*/
if (key->type == HCI_LK_DEBUG_COMBINATION &&
!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS)) {
- list_del_rcu(&key->list);
- kfree_rcu(key, rcu);
+ hci_del_link_key(hdev, key);
goto unlock;
}
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index e4cdbb7df16a7..b16bfd85a17ae 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1112,8 +1112,13 @@ static void smp_notify_keys(struct l2cap_conn *conn)
else
type = HCI_LK_UNAUTH_COMBINATION_P256;
- key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst,
- smp->link_key, type, 0, &persistent);
+ /* hdev->lock can't be taken here since it is ordered before
+ * the l2cap channel lock held by the caller.
+ */
+ mutex_lock(&hdev->link_keys_lock);
+
+ key = __hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst,
+ smp->link_key, type, 0, &persistent);
if (key) {
mgmt_new_link_key(hdev, key, persistent);
@@ -1126,6 +1131,8 @@ static void smp_notify_keys(struct l2cap_conn *conn)
kfree_rcu(key, rcu);
}
}
+
+ mutex_unlock(&hdev->link_keys_lock);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 153/703] Bluetooth: SMP: Check smp_data before using SMP_DEV()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (149 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 152/703] Bluetooth: SMP: Serialize link key updates from smp_notify_keys() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 154/703] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
` (256 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit e8764a6946341e9ee809393386e7b815179c5f5f ]
hdev->smp_data is NULL when the SMP channel could not be registered, so
receiving a Pairing Request/Response with the OOB flag set would
dereference NULL through SMP_DEV().
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-9bc9da90-02a8-4a87-a603-87d0a4cf464c
Fixes: 94f14e472812 ("Bluetooth: SMP: Fix trying to use non-existent local OOB data")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/smp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index b16bfd85a17ae..a6b4593c43fbe 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1783,7 +1783,8 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
* successfully received our local OOB data - therefore set the
* flag to indicate that local OOB is in use.
*/
- if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
+ if (req->oob_flag == SMP_OOB_PRESENT && hdev->smp_data &&
+ SMP_DEV(hdev)->local_oob)
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
/* SMP over BR/EDR requires special treatment */
@@ -1969,7 +1970,8 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
* successfully received our local OOB data - therefore set the
* flag to indicate that local OOB is in use.
*/
- if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
+ if (rsp->oob_flag == SMP_OOB_PRESENT && hdev->smp_data &&
+ SMP_DEV(hdev)->local_oob)
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
smp->prsp[0] = SMP_CMD_PAIRING_RSP;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 154/703] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (150 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 153/703] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 155/703] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable Greg Kroah-Hartman
` (255 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 8a119ba64f33dd9ab265d3b978f7811a80b7fe8a ]
smp_force_bredr() created a BR/EDR SMP channel even when the controller
was powered off or not LE capable, leaving a stale channel that
smp_register() later warns about and leaks. Only create it when SMP is
registered and guard the removal; smp_register() creates it on power on
if the flag is set. Since smp_unregister() runs with hdev->lock take it
around smp_register() as well so they can't race with each other nor with
smp_force_bredr().
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-a921c99c-0b41-485c-91a4-1c6e54b45b0b
Fixes: 300acfdec916 ("Bluetooth: Introduce force_bredr_smp debugfs option for testing")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_sync.c | 2 ++
net/bluetooth/smp.c | 20 ++++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 3f75dbd63c279..b17b6b3a08d27 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3823,7 +3823,9 @@ int hci_powered_update_sync(struct hci_dev *hdev)
* registration is required so that LE SMP can clearly decide if
* the public address or static address is used.
*/
+ hci_dev_lock(hdev);
smp_register(hdev);
+ hci_dev_unlock(hdev);
err = hci_write_ssp_mode_sync(hdev, 0x01);
if (err)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index a6b4593c43fbe..5cb4c1e5f6761 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3394,20 +3394,28 @@ int smp_force_bredr(struct hci_dev *hdev, bool enable)
if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
return -EALREADY;
+ /* The channels are only registered while the controller is powered
+ * and LE capable. Otherwise just record the flag, smp_register() will
+ * create the BR/EDR channel on the next power on.
+ */
if (enable) {
struct l2cap_chan *chan;
- chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
- if (IS_ERR(chan))
- return PTR_ERR(chan);
+ if (hdev->smp_data && !hdev->smp_bredr_data) {
+ chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
+ if (IS_ERR(chan))
+ return PTR_ERR(chan);
- hdev->smp_bredr_data = chan;
+ hdev->smp_bredr_data = chan;
+ }
} else {
struct l2cap_chan *chan;
chan = hdev->smp_bredr_data;
- hdev->smp_bredr_data = NULL;
- smp_del_chan(chan);
+ if (chan) {
+ hdev->smp_bredr_data = NULL;
+ smp_del_chan(chan);
+ }
}
hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 155/703] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (151 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 154/703] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 156/703] s390/cert_store: Check key_lookup() return code in invalidate_keyring_keys() Greg Kroah-Hartman
` (254 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit ad7c1f067df2772d73a3a34218a8f5db57ceb41c ]
hci_cc_le_set_ext_adv_enable() read num_of_sets and the set entries from
the last sent command without checking its length.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-42bcc244-62e6-4295-802c-f9a512ca49a3
Fixes: de181e887ac2 ("Bluetooth: Impmlement extended adv enable")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_event.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 094af9cec41c1..8f13af8d61b4f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1622,14 +1622,16 @@ static u8 hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev, void *data,
struct hci_cp_ext_adv_set *set;
struct adv_info *adv = NULL, *n;
struct hci_ev_status *rp = data;
+ size_t len;
bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
if (rp->status)
return rp->status;
- cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE);
- if (!cp)
+ cp = hci_sent_cmd_data_len(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, &len);
+ if (!cp || len < sizeof(*cp) ||
+ len < sizeof(*cp) + cp->num_of_sets * sizeof(*set))
return rp->status;
set = (void *)cp->data;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 156/703] s390/cert_store: Check key_lookup() return code in invalidate_keyring_keys()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (152 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 155/703] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 157/703] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring() Greg Kroah-Hartman
` (253 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 2a102f513a68ef6771e1cf107c7f98985686ad71 ]
keyring->sem is released after writing the key serial numbers into
key_array. Keys corresponding to those serial numbers may have been
removed before key_lookup() is called.
Therefore check the return code of key_lookup() before dereferencing it.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index c217a5e640943..a52bc4b5cbdb3 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -332,8 +332,11 @@ static int invalidate_keyring_keys(struct key *keyring)
goto out;
}
+ rc = 0;
for (key_index = 0; key_index < num_keys; key_index++) {
current_key = key_lookup(key_array[key_index]);
+ if (IS_ERR(current_key))
+ continue;
pr_dbf_msg("Invalidating key %08x", current_key->serial);
key_invalidate(current_key);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 157/703] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (153 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 156/703] s390/cert_store: Check key_lookup() return code in invalidate_keyring_keys() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 158/703] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring() Greg Kroah-Hartman
` (252 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit f992716c4c767a89b6be32e24ee6e4e41ad99da4 ]
create_cs_keyring() returns cs_keyring with a reference held. On the
success path fill_cs_keyring() never drops it, leaking the reference.
The keyring is kept alive by its link to the session keyring.
Drop the reference after add_certificates_to_keyring() returns.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index a52bc4b5cbdb3..e80834adc29e7 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -716,6 +716,7 @@ static int fill_cs_keyring(void)
if (rc)
goto cleanup_cs_keyring;
+ key_put(cs_keyring);
goto out;
cleanup_cs_keyring:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 158/703] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (154 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 157/703] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 159/703] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring() Greg Kroah-Hartman
` (251 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 92d377a611766f6ab7b9a63a530aa7bbd434abbb ]
find_cs_keyring() drops the refcount of cs_keyring before returning it.
Which means that callers operate on potentially already freed memory.
Let find_cs_keyring() return cs_keyring with a reference. Since
cleanup_cs_keys() now performs a balanced put via find_cs_keyring(),
remove the separate cleanup_cs_keyring error label in fill_cs_keyring()
and drop the reference unconditionally instead.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index e80834adc29e7..d96b234204fd5 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -360,17 +360,13 @@ static struct key *find_cs_keyring(void)
cs_keyring_ref = keyring_search(make_key_ref(get_user_session_keyring(), true),
&key_type_keyring, CERT_STORE_KEYRING_NAME,
false);
- if (!IS_ERR(cs_keyring_ref)) {
- cs_keyring = key_ref_to_ptr(cs_keyring_ref);
- key_ref_put(cs_keyring_ref);
- goto found;
- }
+ if (!IS_ERR(cs_keyring_ref))
+ return key_ref_to_ptr(cs_keyring_ref);
+
/* Search default locations: thread, process, session keyrings */
cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL);
if (IS_ERR(cs_keyring))
return NULL;
- key_put(cs_keyring);
-found:
return cs_keyring;
}
@@ -713,14 +709,12 @@ static int fill_cs_keyring(void)
goto cleanup_keys;
rc = add_certificates_to_keyring(vcssb, cs_keyring);
+ key_put(cs_keyring);
if (rc)
- goto cleanup_cs_keyring;
+ goto cleanup_keys;
- key_put(cs_keyring);
goto out;
-cleanup_cs_keyring:
- key_put(cs_keyring);
cleanup_keys:
cleanup_cs_keys();
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 159/703] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (155 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 158/703] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 160/703] s390/cert_store: Fix error handling of get_user_session_keyring() Greg Kroah-Hartman
` (250 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 1a58d930c82fcaf3a6a9e9daf21c7ae9ee088d7e ]
The local variable cs_keyring in create_cs_keyring() never reuses its
assigned value, therefore remove the static specifier. Callers are
serialized by cs_refresh_lock, so this does not fix a bug.
Even though this is not a bug fix, this contains a Fixes tag since other
commits require this as a prereq.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index d96b234204fd5..cf1c3e7f7608e 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -394,7 +394,7 @@ static void cleanup_cs_keys(void)
static struct key *create_cs_keyring(void)
{
- static struct key *cs_keyring;
+ struct key *cs_keyring;
/* Cleanup previous cs_keyring and all associated keys if any. */
cleanup_cs_keys();
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 160/703] s390/cert_store: Fix error handling of get_user_session_keyring()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (156 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 159/703] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring() Greg Kroah-Hartman
@ 2026-12-04 10:00 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 161/703] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring() Greg Kroah-Hartman
` (249 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:00 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 8256791b74e701361398a8d0e43c55bdabadc5ca ]
create_cs_keyring(), cleanup_cs_keys(), and find_cs_keyring() all pass
the return value of get_user_session_keyring() to other functions without
checking it. This can lead to dereferencing an error pointer.
Check the return value before using it.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index cf1c3e7f7608e..bedc0aecb8581 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -354,15 +354,18 @@ static int invalidate_keyring_keys(struct key *keyring)
static struct key *find_cs_keyring(void)
{
+ struct key *cs_keyring, *us_keyring;
key_ref_t cs_keyring_ref;
- struct key *cs_keyring;
-
- cs_keyring_ref = keyring_search(make_key_ref(get_user_session_keyring(), true),
- &key_type_keyring, CERT_STORE_KEYRING_NAME,
- false);
- if (!IS_ERR(cs_keyring_ref))
- return key_ref_to_ptr(cs_keyring_ref);
+ us_keyring = get_user_session_keyring();
+ if (!IS_ERR(us_keyring)) {
+ cs_keyring_ref = keyring_search(make_key_ref(us_keyring, true),
+ &key_type_keyring,
+ CERT_STORE_KEYRING_NAME,
+ false);
+ if (!IS_ERR(cs_keyring_ref))
+ return key_ref_to_ptr(cs_keyring_ref);
+ }
/* Search default locations: thread, process, session keyrings */
cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL);
if (IS_ERR(cs_keyring))
@@ -372,7 +375,7 @@ static struct key *find_cs_keyring(void)
static void cleanup_cs_keys(void)
{
- struct key *cs_keyring;
+ struct key *cs_keyring, *us_keyring;
cs_keyring = find_cs_keyring();
if (!cs_keyring)
@@ -388,21 +391,26 @@ static void cleanup_cs_keys(void)
keyring_clear(cs_keyring);
key_invalidate(cs_keyring);
+ us_keyring = get_user_session_keyring();
+ if (!IS_ERR(us_keyring))
+ key_unlink(us_keyring, cs_keyring);
key_put(cs_keyring);
- key_unlink(get_user_session_keyring(), cs_keyring);
}
static struct key *create_cs_keyring(void)
{
- struct key *cs_keyring;
+ struct key *cs_keyring, *us_keyring;
/* Cleanup previous cs_keyring and all associated keys if any. */
cleanup_cs_keys();
+ us_keyring = get_user_session_keyring();
+ if (IS_ERR(us_keyring))
+ return NULL;
cs_keyring = keyring_alloc(CERT_STORE_KEYRING_NAME, GLOBAL_ROOT_UID,
GLOBAL_ROOT_GID, current_cred(),
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_SET_KEEP,
- NULL, get_user_session_keyring());
+ NULL, us_keyring);
if (IS_ERR(cs_keyring)) {
pr_dbf_msg("Can't allocate cert_store keyring");
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 161/703] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (157 preceding siblings ...)
2026-12-04 10:00 ` [PATCH 6.18 160/703] s390/cert_store: Fix error handling of get_user_session_keyring() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 162/703] s390/cert_store: Do not search the process keyrings for the cert_store keyring Greg Kroah-Hartman
` (248 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit aa7ee9e9cf17fcc7b0af55424aba6f0abd065fa7 ]
get_user_session_keyring() drops the reference of the looked up keyring
before returning it. Callers therefore use the keyring without holding a
reference.
Return the keyring with the reference and let callers drop the reference.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index bedc0aecb8581..444766e89c2db 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -307,7 +307,6 @@ static struct key *get_user_session_keyring(void)
PTR_ERR(us_keyring_ref));
return ERR_PTR(-ENOKEY);
}
- key_ref_put(us_keyring_ref);
return key_ref_to_ptr(us_keyring_ref);
}
@@ -363,6 +362,7 @@ static struct key *find_cs_keyring(void)
&key_type_keyring,
CERT_STORE_KEYRING_NAME,
false);
+ key_put(us_keyring);
if (!IS_ERR(cs_keyring_ref))
return key_ref_to_ptr(cs_keyring_ref);
}
@@ -392,8 +392,10 @@ static void cleanup_cs_keys(void)
keyring_clear(cs_keyring);
key_invalidate(cs_keyring);
us_keyring = get_user_session_keyring();
- if (!IS_ERR(us_keyring))
+ if (!IS_ERR(us_keyring)) {
key_unlink(us_keyring, cs_keyring);
+ key_put(us_keyring);
+ }
key_put(cs_keyring);
}
@@ -411,6 +413,7 @@ static struct key *create_cs_keyring(void)
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_SET_KEEP,
NULL, us_keyring);
+ key_put(us_keyring);
if (IS_ERR(cs_keyring)) {
pr_dbf_msg("Can't allocate cert_store keyring");
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 162/703] s390/cert_store: Do not search the process keyrings for the cert_store keyring
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (158 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 161/703] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 163/703] s390/cert_store: Validate hash length in check_certificate_valid() Greg Kroah-Hartman
` (247 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Heiko Carstens, Jarkko Sakkinen,
Alexander Gordeev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 5ac71bb84e34337d7be280d2c06ff9cae77b7bcf ]
find_cs_keyring() first searches the user session keyring for the
cert_store keyring, and falls back to request_key(), which searches the
thread, process and session keyrings of the calling task. Any keyring
named "cert_store" found this way is accepted.
cleanup_cs_keys() then invalidates and unlinks all of its keys, and
clears and invalidates the keyring itself, without checking permissions.
If the refresh is triggered by a task which inherited a session keyring
that contains a keyring named "cert_store" not created by this code, this
keyring and its keys are destroyed.
create_cs_keyring() always links the keyring into the user session
keyring, so the first search is sufficient. Remove the request_key()
fallback.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 444766e89c2db..8941ca3ad4841 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -353,7 +353,7 @@ static int invalidate_keyring_keys(struct key *keyring)
static struct key *find_cs_keyring(void)
{
- struct key *cs_keyring, *us_keyring;
+ struct key *us_keyring;
key_ref_t cs_keyring_ref;
us_keyring = get_user_session_keyring();
@@ -366,11 +366,7 @@ static struct key *find_cs_keyring(void)
if (!IS_ERR(cs_keyring_ref))
return key_ref_to_ptr(cs_keyring_ref);
}
- /* Search default locations: thread, process, session keyrings */
- cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL);
- if (IS_ERR(cs_keyring))
- return NULL;
- return cs_keyring;
+ return NULL;
}
static void cleanup_cs_keys(void)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 163/703] s390/cert_store: Validate hash length in check_certificate_valid()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (159 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 162/703] s390/cert_store: Do not search the process keyrings for the cert_store keyring Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 164/703] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb() Greg Kroah-Hartman
` (246 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 8b4e340f7742c8c3b12353e882ad5d4d25c7acc9 ]
Validate that vc_hash_length is SHA256_DIGEST_SIZE before checking the
hash and use sizeof(hash) in memcmp(). This avoids an out-of-bounds
read if vc_hash_length is incorrect.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 8941ca3ad4841..56b21b4689c4d 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -260,13 +260,11 @@ static int diag320(unsigned long subcode, void *addr)
static int check_certificate_hash(const struct vce *vce)
{
u8 hash[SHA256_DIGEST_SIZE];
- u16 vc_hash_length;
u8 *vce_hash;
vce_hash = (u8 *)vce + vce->vce_hdr.vc_hash_offset;
- vc_hash_length = vce->vce_hdr.vc_hash_length;
sha256((u8 *)vce + vce->vce_hdr.vc_offset, vce->vce_hdr.vc_length, hash);
- if (memcmp(vce_hash, hash, vc_hash_length) == 0)
+ if (memcmp(vce_hash, hash, sizeof(hash)) == 0)
return 0;
pr_dbf_msg("SHA256 hash of received certificate does not match");
@@ -292,6 +290,10 @@ static int check_certificate_valid(const struct vce *vce)
pr_dbf_msg("Hash type is not supported");
return -EINVAL;
}
+ if (vce->vce_hdr.vc_hash_length != SHA256_DIGEST_SIZE) {
+ pr_dbf_msg("Hash length is not supported");
+ return -EINVAL;
+ }
return check_certificate_hash(vce);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 164/703] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (160 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 163/703] s390/cert_store: Validate hash length in check_certificate_valid() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 165/703] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Greg Kroah-Hartman
` (245 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 9d263bd8ddc31c9c3ebe3612df575d70848f5772 ]
Print the correct value for max_vcxe_length.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 56b21b4689c4d..ff8b3dd0fc633 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -224,7 +224,7 @@ static void pr_dbf_vcssb(const struct vcssb *s)
pr_dbf_msg("total_vc_index_count: %u", s->total_vc_index_count);
pr_dbf_msg("max_vc_index_count: %u", s->max_vc_index_count);
pr_dbf_msg("max_vce_length: %u", s->max_vce_length);
- pr_dbf_msg("max_vcxe_length: %u", s->max_vce_length);
+ pr_dbf_msg("max_vcxe_length: %u", s->max_vcxe_length);
pr_dbf_msg("max_single_vcb_length: %u", s->max_single_vcb_length);
pr_dbf_msg("total_vcb_length: %u", s->total_vcb_length);
pr_dbf_msg("max_single_vcxb_length: %u", s->max_single_vcxb_length);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 165/703] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (161 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 164/703] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 166/703] s390/cert_store: Initialize ism array in query_diag320_subcodes() Greg Kroah-Hartman
` (244 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 539cf27f0b090d84438b7da9045a271a947192ed ]
pr_dbf_vce() dumps the last 128 bytes of the certificate data of a
Verification Certificate Entry (VCE) into a debug area.
However the address calculation is wrong: vce_length is the length of
the whole entry including the header, while cert_data_buf starts
behind the header. Therefore the dump starts at the end of the entry
and starts reading behind it.
Dump the last 128 bytes of the entry like intended. Limit dumps to the
data length.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index ff8b3dd0fc633..6acec6d5ba604 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -180,6 +180,7 @@ static void pr_dbf_vce(const struct vce *e)
{
unsigned char vc_name[VC_NAME_LEN_BYTES + 1];
char log_string[VC_NAME_LEN_BYTES + 40];
+ u32 data_len = 0;
pr_dbf_msg("VCE Header:");
pr_dbf_msg("vce_hdr.vce_length: %d", e->vce_hdr.vce_length);
@@ -205,11 +206,13 @@ static void pr_dbf_vce(const struct vce *e)
debug_text_event(cert_store_hexdump, 3, log_string);
/* Certificate data. */
+ if (e->vce_hdr.vce_length > sizeof(e->vce_hdr))
+ data_len = e->vce_hdr.vce_length - sizeof(e->vce_hdr);
debug_text_event(cert_store_hexdump, 3, "VCE: Certificate data start");
- debug_event(cert_store_hexdump, 3, (u8 *)e->cert_data_buf, 128);
+ debug_event(cert_store_hexdump, 3, (u8 *)e->cert_data_buf, min(data_len, 128U));
debug_text_event(cert_store_hexdump, 3, "VCE: Certificate data end");
- debug_event(cert_store_hexdump, 3,
- (u8 *)e->cert_data_buf + e->vce_hdr.vce_length - 128, 128);
+ if (data_len > 128)
+ debug_event(cert_store_hexdump, 3, (u8 *)e + e->vce_hdr.vce_length - 128, 128);
}
static void pr_dbf_vcssb(const struct vcssb *s)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 166/703] s390/cert_store: Initialize ism array in query_diag320_subcodes()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (162 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 165/703] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 167/703] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
` (243 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Gordeev, Heiko Carstens,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <hca@linux.ibm.com>
[ Upstream commit 2c1f57bce05244165f406e45982bbcd036071d3b ]
The Installed Subcode Block returned by DIAG 320 subcode 0 may be smaller
than the ism array. Initialize it to avoid copying uninitialized data to
the debug area.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 6acec6d5ba604..d8f1c1cd6b1a2 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -663,7 +663,7 @@ static int add_certificates_to_keyring(struct vcssb *vcssb, struct key *keyring)
*/
static int query_diag320_subcodes(void)
{
- unsigned long ism[ISM_LEN_DWORDS];
+ unsigned long ism[ISM_LEN_DWORDS] = {};
int rc;
rc = diag320(0, ism);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 167/703] Bluetooth: mgmt: Reject zero multi advertising rotation duration
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (163 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 166/703] s390/cert_store: Initialize ism array in query_diag320_subcodes() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 168/703] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
` (242 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 4e0dc0523bd98adbd45ce1c66dd1a96d4f6a3ec9 ]
A zero def_multi_adv_rotation_duration makes
hci_schedule_adv_instance_sync() requeue itself with no delay, spinning
the request workqueue. Reject it in Set Default System Configuration.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-24ecb695-0c5c-408a-a016-a980c3115e95
Fixes: 17896406ff35 ("Bluetooth: implement read/set default system parameters mgmt")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt_config.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/bluetooth/mgmt_config.c b/net/bluetooth/mgmt_config.c
index c4063d200c0a6..3eb7b76e94faa 100644
--- a/net/bluetooth/mgmt_config.c
+++ b/net/bluetooth/mgmt_config.c
@@ -206,6 +206,14 @@ int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
MGMT_STATUS_INVALID_PARAMS);
}
+ /* A zero rotation duration would make the advertising instance
+ * scheduler requeue itself with no delay.
+ */
+ if (type == 0x000c && !TLV_GET_LE16(buffer))
+ return mgmt_cmd_status(sk, hdev->id,
+ MGMT_OP_SET_DEF_SYSTEM_CONFIG,
+ MGMT_STATUS_INVALID_PARAMS);
+
buffer_left -= exp_len;
buffer += exp_len;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 168/703] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (164 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 167/703] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 169/703] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
` (241 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit cb3251457da29ac1118f130bf45ac696421594a8 ]
The local EFS values were copied from an on-stack struct even when the
response carried no EFS option. Track whether it was received.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-089f015e-6251-4fea-85ef-7d6761e8c457
Fixes: 66af7aaf9edf ("Bluetooth: EFS: parse L2CAP config response")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/l2cap_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 801367941642d..687967dad5ed0 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3759,6 +3759,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
unsigned long val;
struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC };
struct l2cap_conf_efs efs;
+ bool remote_efs = false;
BT_DBG("chan %p, rsp %p, len %d, req %p", chan, rsp, len, data);
@@ -3814,6 +3815,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
if (olen != sizeof(efs))
break;
memcpy(&efs, (void *)val, olen);
+ remote_efs = true;
if (chan->local_stype != L2CAP_SERV_NOTRAFIC &&
efs.stype != L2CAP_SERV_NOTRAFIC &&
efs.stype != chan->local_stype)
@@ -3852,7 +3854,8 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len,
chan->ack_win = min_t(u16, chan->ack_win,
rfc.txwin_size);
- if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) {
+ if (remote_efs &&
+ test_bit(FLAG_EFS_ENABLE, &chan->flags)) {
chan->local_msdu = le16_to_cpu(efs.msdu);
chan->local_sdu_itime =
le32_to_cpu(efs.sdu_itime);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 169/703] Bluetooth: mgmt: Fix mesh transmission locking and lifetime
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (165 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 168/703] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 170/703] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down() Greg Kroah-Hartman
` (240 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 1d7a527788584e4a88ccc532ed73bfdacd0b1e74 ]
The mesh_pending list is modified under hdev->lock by Mesh Send, but the
cmd_sync callbacks and Mesh Send Cancel add/remove entries and touch
hdev->adv_instances without it, which corrupts the list and the advertising
instances. In addition the queued mesh_send_sync entry holds a raw pointer
to the mesh_tx which a cancel of the transmission can free while the entry
is running, leading to use-after-free.
Fix this by:
- taking hdev->lock around every mesh_pending/adv_instances access in the
cmd_sync callbacks and Mesh Send Cancel, but never across HCI commands;
- queueing the cmd_sync entries with the transmission handle and looking
it up under the lock instead of passing the pointer;
- always sending the first transmission, tracked by HCI_MESH_SENDING which
is only cleared together with the removal of the transmission so Mesh
Send can't start another one in between, and making sure none is left
stranded if queueing fails;
- cancelling a transmission by dequeuing its entry, and the done entry if
it is the one in progress, stopping the done timer, which is queued
with hdev->lock held so a cancel can't miss it;
- not taking hdev->lock from callbacks invoked with -ECANCELED since
those run with the cmd_sync lock held, the transmission is removed by
whoever cancelled the entry;
- flushing the transmissions left, dequeuing the entries still queued for
them and clearing HCI_MESH_SENDING, when the controller is closed (also
when auto powered off) or the index is removed, as nothing is going to
send them and the stale entries would act on the ones started after
the controller is powered on again, and not accepting Mesh Send while
the controller is not powered so none can be left behind;
- not reporting the completion of a transmission that failed to be queued
by Mesh Send itself since userspace wasn't told about its handle;
- not reusing the handle of a transmission still pending when the handle
counter wraps around, now that it is what identifies a transmission.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-4ab89465-fc27-4d91-a870-a8ed49b22e91
Link: https://sashiko.dev/#/bug/linux-ab941894-dbe1-49da-8bac-c52efda6eaee
Link: https://sashiko.dev/#/bug/linux-4016f774-7ac7-4b8a-916f-587ec9d597d4
Fixes: b338d91703fa ("Bluetooth: Implement support for Mesh")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_sync.c | 5 +
net/bluetooth/mgmt.c | 301 +++++++++++++++++++++++++------
net/bluetooth/mgmt_util.c | 23 ++-
4 files changed, 267 insertions(+), 63 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index a9450d92921a4..d080a5d9d1d56 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -2419,6 +2419,7 @@ void mgmt_index_removed(struct hci_dev *hdev);
void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
void mgmt_power_on(struct hci_dev *hdev, int err);
void __mgmt_power_off(struct hci_dev *hdev);
+void mgmt_mesh_flush(struct hci_dev *hdev);
void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
bool persistent);
void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index b17b6b3a08d27..26d7239c25834 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5614,6 +5614,11 @@ int hci_dev_close_sync(struct hci_dev *hdev)
auto_off = hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF);
+ /* Nothing is going to send the mesh transmissions left, whether or not
+ * mgmt is told about the controller being powered off.
+ */
+ mgmt_mesh_flush(hdev);
+
if (!auto_off && !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
hci_dev_test_flag(hdev, HCI_MGMT))
__mgmt_power_off(hdev);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 90929d9c423f5..f589ff7ce6045 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1077,6 +1077,7 @@ static void discov_off(struct work_struct *work)
static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev);
+/* This function requires the caller holds hdev->lock */
static void mesh_send_complete(struct hci_dev *hdev,
struct mgmt_mesh_tx *mesh_tx, bool silent)
{
@@ -1089,37 +1090,95 @@ static void mesh_send_complete(struct hci_dev *hdev,
mgmt_mesh_remove(mesh_tx);
}
-static int mesh_send_done_sync(struct hci_dev *hdev, void *data)
+/* The cmd_sync entries identify the transmission by handle rather than by
+ * pointer since the mesh_tx can be removed while the entry is queued or
+ * running.
+ */
+#define MESH_TX_DATA(_handle) ((void *)(unsigned long)(_handle))
+#define MESH_TX_HANDLE(_data) ((u8)(unsigned long)(_data))
+
+static int mesh_send_sync(struct hci_dev *hdev, void *data);
+static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err);
+
+/* Start sending the first transmission unless one is already in progress,
+ * HCI_MESH_SENDING is set while the first transmission is being sent.
+ * Completion is not reported for @new, the handle of a transmission userspace
+ * wasn't told about yet.
+ *
+ * This function requires the caller holds hdev->lock.
+ */
+static void __mesh_next(struct hci_dev *hdev, u8 new)
{
struct mgmt_mesh_tx *mesh_tx;
+ int err;
- hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
- if (list_empty(&hdev->adv_instances))
- hci_disable_advertising_sync(hdev);
- mesh_tx = mgmt_mesh_next(hdev, NULL);
-
- if (mesh_tx)
- mesh_send_complete(hdev, mesh_tx, false);
+ while (!hci_dev_test_flag(hdev, HCI_MESH_SENDING)) {
+ mesh_tx = mgmt_mesh_next(hdev, NULL);
+ if (!mesh_tx)
+ return;
- return 0;
+ err = hci_cmd_sync_queue(hdev, mesh_send_sync,
+ MESH_TX_DATA(mesh_tx->handle),
+ mesh_send_start_complete);
+ if (err < 0)
+ mesh_send_complete(hdev, mesh_tx,
+ mesh_tx->handle == new);
+ else
+ hci_dev_set_flag(hdev, HCI_MESH_SENDING);
+ }
}
-static int mesh_send_sync(struct hci_dev *hdev, void *data);
-static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err);
static void mesh_next(struct hci_dev *hdev, void *data, int err)
{
- struct mgmt_mesh_tx *mesh_tx = mgmt_mesh_next(hdev, NULL);
-
- if (!mesh_tx)
+ /* The entry is being cancelled with the cmd_sync lock held, which
+ * can't be taken before hdev->lock.
+ */
+ if (err == -ECANCELED)
return;
- err = hci_cmd_sync_queue(hdev, mesh_send_sync, mesh_tx,
- mesh_send_start_complete);
+ hci_dev_lock(hdev);
+ __mesh_next(hdev, 0);
+ hci_dev_unlock(hdev);
+}
- if (err < 0)
+static int mesh_send_done_sync(struct hci_dev *hdev, void *data)
+{
+ struct mgmt_mesh_tx *mesh_tx;
+ u8 handle;
+ bool disable;
+
+ hci_dev_lock(hdev);
+
+ mesh_tx = mgmt_mesh_next(hdev, NULL);
+ if (!mesh_tx || !hci_dev_test_flag(hdev, HCI_MESH_SENDING)) {
+ hci_dev_unlock(hdev);
+ return 0;
+ }
+
+ handle = mesh_tx->handle;
+ disable = list_empty(&hdev->adv_instances);
+
+ hci_dev_unlock(hdev);
+
+ if (disable)
+ hci_disable_advertising_sync(hdev);
+
+ hci_dev_lock(hdev);
+
+ /* The transmission can be cancelled meanwhile, in which case whoever
+ * did so already moved on to the next one. HCI_MESH_SENDING is only
+ * cleared with the transmission removed so Mesh Send doesn't start
+ * another one in between.
+ */
+ mesh_tx = mgmt_mesh_find(hdev, handle);
+ if (mesh_tx) {
mesh_send_complete(hdev, mesh_tx, false);
- else
- hci_dev_set_flag(hdev, HCI_MESH_SENDING);
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ }
+
+ hci_dev_unlock(hdev);
+
+ return 0;
}
static void mesh_send_done(struct work_struct *work)
@@ -1133,6 +1192,33 @@ static void mesh_send_done(struct work_struct *work)
hci_cmd_sync_queue(hdev, mesh_send_done_sync, NULL, mesh_next);
}
+/* Nothing is going to send the transmissions left, e.g. when the controller
+ * is powered off.
+ *
+ * This function requires the caller holds hdev->lock.
+ */
+static void mesh_flush(struct hci_dev *hdev, bool silent)
+{
+ struct mgmt_mesh_tx *mesh_tx;
+
+ /* Stop the timer first, it checks HCI_MESH_SENDING without hdev->lock
+ * so once it is clear and the work is not running anymore nothing can
+ * queue mesh_send_done_sync behind the dequeue below.
+ */
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ cancel_delayed_work_sync(&hdev->mesh_send_done);
+
+ /* Entries still queued would otherwise run after the controller is
+ * powered on again and act on the transmissions started by then. The
+ * destroy callbacks don't take hdev->lock when cancelled.
+ */
+ hci_cmd_sync_dequeue(hdev, mesh_send_sync, NULL, NULL);
+ hci_cmd_sync_dequeue(hdev, mesh_send_done_sync, NULL, NULL);
+
+ while ((mesh_tx = mgmt_mesh_next(hdev, NULL)))
+ mesh_send_complete(hdev, mesh_tx, silent);
+}
+
static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev)
{
if (hci_dev_test_flag(hdev, HCI_MGMT))
@@ -2300,38 +2386,71 @@ static int set_mesh(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
static void mesh_send_start_complete(struct hci_dev *hdev, void *data, int err)
{
- struct mgmt_mesh_tx *mesh_tx = data;
- struct mgmt_cp_mesh_send *send = (void *)mesh_tx->param;
- unsigned long mesh_send_interval;
+ struct mgmt_mesh_tx *mesh_tx;
+ struct mgmt_cp_mesh_send *send;
u8 mgmt_err = mgmt_status(err);
+ /* The entry is being cancelled with the cmd_sync lock held, which
+ * can't be taken before hdev->lock, so leave the removal of the
+ * transmission, and HCI_MESH_SENDING, to whoever cancelled it or to
+ * mgmt_power_off() if the controller is going down.
+ */
+ if (err == -ECANCELED)
+ return;
+
+ hci_dev_lock(hdev);
+
+ /* Cancelled while the entry was running, whoever did so already moved
+ * on to the next transmission.
+ */
+ mesh_tx = mgmt_mesh_find(hdev, MESH_TX_HANDLE(data));
+ if (!mesh_tx) {
+ hci_dev_unlock(hdev);
+ return;
+ }
+
/* Report any errors here, but don't report completion */
if (mgmt_err) {
- hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
/* Send Complete Error Code for handle */
mesh_send_complete(hdev, mesh_tx, false);
- if (err != -ECANCELED)
- mesh_next(hdev, NULL, 0);
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ __mesh_next(hdev, 0);
+ hci_dev_unlock(hdev);
return;
}
- mesh_send_interval = msecs_to_jiffies((send->cnt) * 25);
+ /* Queued with hdev->lock held so a cancel can't miss it */
+ send = (void *)mesh_tx->param;
queue_delayed_work(hdev->req_workqueue, &hdev->mesh_send_done,
- mesh_send_interval);
+ msecs_to_jiffies((send->cnt) * 25));
+
+ hci_dev_unlock(hdev);
}
static int mesh_send_sync(struct hci_dev *hdev, void *data)
{
- struct mgmt_mesh_tx *mesh_tx = data;
- struct mgmt_cp_mesh_send *send = (void *)mesh_tx->param;
+ struct mgmt_mesh_tx *mesh_tx;
+ struct mgmt_cp_mesh_send *send;
struct adv_info *adv, *next_instance;
u8 instance = hdev->le_num_of_adv_sets + 1;
u16 timeout, duration;
int err = 0;
- if (hdev->le_num_of_adv_sets <= hdev->adv_instance_cnt)
+ hci_dev_lock(hdev);
+
+ mesh_tx = mgmt_mesh_find(hdev, MESH_TX_HANDLE(data));
+ if (!mesh_tx) {
+ hci_dev_unlock(hdev);
+ return -ENOENT;
+ }
+
+ send = (void *)mesh_tx->param;
+
+ if (hdev->le_num_of_adv_sets <= hdev->adv_instance_cnt) {
+ hci_dev_unlock(hdev);
return MGMT_STATUS_BUSY;
+ }
timeout = 1000;
duration = send->cnt * INTERVAL_TO_MS(hdev->le_adv_max_interval);
@@ -2369,6 +2488,8 @@ static int mesh_send_sync(struct hci_dev *hdev, void *data)
instance = 0;
}
+ hci_dev_unlock(hdev);
+
if (instance)
return hci_schedule_adv_instance_sync(hdev, instance, true);
@@ -2412,37 +2533,80 @@ static int mesh_features(struct sock *sk, struct hci_dev *hdev,
return 0;
}
+/* Cancel a single transmission, the handle is looked up again after the
+ * entry has been dequeued since it may be gone or have completed meanwhile.
+ */
+static void mesh_cancel_tx(struct hci_dev *hdev, u8 handle)
+{
+ struct mgmt_mesh_tx *mesh_tx;
+ bool in_progress;
+
+ hci_cmd_sync_dequeue(hdev, mesh_send_sync, MESH_TX_DATA(handle), NULL);
+
+ hci_dev_lock(hdev);
+ mesh_tx = mgmt_mesh_find(hdev, handle);
+ in_progress = mesh_tx && hci_dev_test_flag(hdev, HCI_MESH_SENDING) &&
+ mesh_tx == mgmt_mesh_next(hdev, NULL);
+ hci_dev_unlock(hdev);
+
+ /* The done timer may have fired already and be waiting to complete
+ * the transmission in progress, which is being cancelled.
+ */
+ if (in_progress)
+ hci_cmd_sync_dequeue(hdev, mesh_send_done_sync, NULL, NULL);
+
+ hci_dev_lock(hdev);
+
+ mesh_tx = mgmt_mesh_find(hdev, handle);
+ if (mesh_tx) {
+ /* If it is the transmission in progress make sure the timer
+ * doesn't complete the next one in its place.
+ */
+ if (hci_dev_test_flag(hdev, HCI_MESH_SENDING) &&
+ mesh_tx == mgmt_mesh_next(hdev, NULL)) {
+ cancel_delayed_work(&hdev->mesh_send_done);
+ hci_dev_clear_flag(hdev, HCI_MESH_SENDING);
+ }
+
+ mesh_send_complete(hdev, mesh_tx, false);
+ }
+
+ hci_dev_unlock(hdev);
+}
+
static int send_cancel(struct hci_dev *hdev, void *data)
{
struct mgmt_pending_cmd *cmd = data;
struct mgmt_cp_mesh_send_cancel *cancel = (void *)cmd->param;
struct mgmt_mesh_tx *mesh_tx;
+ u8 handle;
if (!cancel->handle) {
- do {
+ for (;;) {
+ hci_dev_lock(hdev);
mesh_tx = mgmt_mesh_next(hdev, cmd->sk);
+ handle = mesh_tx ? mesh_tx->handle : 0;
+ hci_dev_unlock(hdev);
- if (mesh_tx) {
- if (!hci_cmd_sync_dequeue(hdev, mesh_send_sync,
- mesh_tx, NULL))
- mesh_send_complete(hdev, mesh_tx, false);
- }
- } while (mesh_tx);
+ if (!mesh_tx)
+ break;
+
+ mesh_cancel_tx(hdev, handle);
+ }
} else {
+ hci_dev_lock(hdev);
mesh_tx = mgmt_mesh_find(hdev, cancel->handle);
+ handle = mesh_tx && mesh_tx->sk == cmd->sk ? mesh_tx->handle : 0;
+ hci_dev_unlock(hdev);
- if (mesh_tx && mesh_tx->sk == cmd->sk) {
- if (!hci_cmd_sync_dequeue(hdev, mesh_send_sync,
- mesh_tx, NULL))
- mesh_send_complete(hdev, mesh_tx, false);
- }
+ if (handle)
+ mesh_cancel_tx(hdev, handle);
}
mgmt_cmd_complete(cmd->sk, hdev->id, MGMT_OP_MESH_SEND_CANCEL,
0, NULL, 0);
- if (!hci_dev_test_flag(hdev, HCI_MESH_SENDING))
- mesh_next(hdev, NULL, 0);
+ mesh_next(hdev, NULL, 0);
return 0;
}
@@ -2493,7 +2657,6 @@ static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
struct mgmt_cp_mesh_send *send = data;
struct mgmt_rp_mesh_read_features rp;
u16 expected_len;
- bool sending;
int err = 0;
if (!lmp_le_capable(hdev) ||
@@ -2515,6 +2678,15 @@ static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
hci_dev_lock(hdev);
+ /* Transmissions are flushed when the controller is closed, which is
+ * serialized with this by hdev->lock, so none can be left behind.
+ */
+ if (!hdev_is_powered(hdev)) {
+ err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_MESH_SEND,
+ MGMT_STATUS_NOT_POWERED);
+ goto done;
+ }
+
memset(&rp, 0, sizeof(rp));
rp.max_handles = MESH_HANDLES_MAX;
@@ -2526,27 +2698,27 @@ static int mesh_send(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
goto done;
}
- sending = hci_dev_test_flag(hdev, HCI_MESH_SENDING);
mesh_tx = mgmt_mesh_add(sk, hdev, send, len);
-
- if (!mesh_tx)
+ if (!mesh_tx) {
err = -ENOMEM;
- else if (!sending)
- err = hci_cmd_sync_queue(hdev, mesh_send_sync, mesh_tx,
- mesh_send_start_complete);
+ } else {
+ u8 handle = mesh_tx->handle;
+
+ /* The first transmission is the one queued, which may not be
+ * the one just added.
+ */
+ __mesh_next(hdev, handle);
+
+ /* Queueing failed, the transmission was removed */
+ if (!mgmt_mesh_find(hdev, handle))
+ err = -EIO;
+ }
if (err < 0) {
bt_dev_err(hdev, "Send Mesh Failed %d", err);
err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_MESH_SEND,
MGMT_STATUS_FAILED);
-
- if (mesh_tx) {
- if (sending)
- mgmt_mesh_remove(mesh_tx);
- }
} else {
- hci_dev_set_flag(hdev, HCI_MESH_SENDING);
-
mgmt_cmd_complete(sk, hdev->id, MGMT_OP_MESH_SEND, 0,
&mesh_tx->handle, 1);
}
@@ -9789,7 +9961,8 @@ void mgmt_index_removed(struct hci_dev *hdev)
cancel_delayed_work_sync(&hdev->discov_off);
cancel_delayed_work_sync(&hdev->service_cache);
cancel_delayed_work_sync(&hdev->rpa_expired);
- cancel_delayed_work_sync(&hdev->mesh_send_done);
+
+ mesh_flush(hdev, true);
}
void mgmt_power_on(struct hci_dev *hdev, int err)
@@ -9816,6 +9989,16 @@ void mgmt_power_on(struct hci_dev *hdev, int err)
hci_dev_unlock(hdev);
}
+/* This function requires the caller holds hdev->lock */
+void mgmt_mesh_flush(struct hci_dev *hdev)
+{
+ /* The mesh work is only initialized once mgmt is used */
+ if (!hci_dev_test_flag(hdev, HCI_MGMT))
+ return;
+
+ mesh_flush(hdev, false);
+}
+
void __mgmt_power_off(struct hci_dev *hdev)
{
struct cmd_lookup match = { NULL, hdev };
diff --git a/net/bluetooth/mgmt_util.c b/net/bluetooth/mgmt_util.c
index aa7b5585cb268..c4fe63ac2e09f 100644
--- a/net/bluetooth/mgmt_util.c
+++ b/net/bluetooth/mgmt_util.c
@@ -412,16 +412,31 @@ struct mgmt_mesh_tx *mgmt_mesh_add(struct sock *sk, struct hci_dev *hdev,
void *data, u16 len)
{
struct mgmt_mesh_tx *mesh_tx;
+ u8 handle = hdev->mesh_send_ref;
+ int i;
+
+ /* The handle is all that identifies a transmission, so it must not be
+ * in use by one still pending when the counter wraps around.
+ */
+ for (i = 0; i < 255; i++) {
+ handle++;
+ if (!handle)
+ handle++;
+
+ if (!mgmt_mesh_find(hdev, handle))
+ break;
+ }
+
+ if (i == 255)
+ return NULL;
mesh_tx = kzalloc(sizeof(*mesh_tx), GFP_KERNEL);
if (!mesh_tx)
return NULL;
- hdev->mesh_send_ref++;
- if (!hdev->mesh_send_ref)
- hdev->mesh_send_ref++;
+ hdev->mesh_send_ref = handle;
- mesh_tx->handle = hdev->mesh_send_ref;
+ mesh_tx->handle = handle;
mesh_tx->index = hdev->id;
memcpy(mesh_tx->param, data, len);
mesh_tx->param_len = len;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 170/703] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (166 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 169/703] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 171/703] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
` (239 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 7c8dcf322b0d978c80001632c1206d5fe1ee9ba7 ]
mgmt_powering_down() looked up the Set Powered command and read its
parameters after mgmt_pending_find() dropped mgmt_pending_lock, so the
command could be unlinked and freed in between. Do the lookup and read the
parameters while holding the lock.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-e45413fa-48a6-43f1-90be-638841567534
Fixes: 302a1f674c00 ("Bluetooth: MGMT: Fix possible UAFs")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f589ff7ce6045..4652a19cfecc1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -10266,19 +10266,27 @@ bool mgmt_powering_down(struct hci_dev *hdev)
{
struct mgmt_pending_cmd *cmd;
struct mgmt_mode *cp;
+ bool powering_down = false;
if (hci_dev_test_flag(hdev, HCI_POWERING_DOWN))
return true;
- cmd = pending_find(MGMT_OP_SET_POWERED, hdev);
- if (!cmd)
- return false;
+ mutex_lock(&hdev->mgmt_pending_lock);
- cp = cmd->param;
- if (!cp->val)
- return true;
+ list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
+ if (hci_sock_get_channel(cmd->sk) != HCI_CHANNEL_CONTROL ||
+ cmd->opcode != MGMT_OP_SET_POWERED)
+ continue;
- return false;
+ /* cmd can only be freed after it is unlinked under the lock */
+ cp = cmd->param;
+ powering_down = !cp->val;
+ break;
+ }
+
+ mutex_unlock(&hdev->mgmt_pending_lock);
+
+ return powering_down;
}
void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 171/703] Bluetooth: MSFT: Protect the event prefix with hdev->lock
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (167 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 170/703] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 172/703] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags Greg Kroah-Hartman
` (238 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 0434cd10518c1b58ca3f5366341f0b1c469afbca ]
msft_vendor_evt() read msft->evt_prefix_len and compared evt_prefix before
taking hdev->lock, while msft_do_open() (and the supported features
reply) free and reallocate the prefix without it, so an event received
while the controller is being opened could access freed memory. Take
hdev->lock for the whole event processing and while updating the prefix.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-246df501-f32c-46fd-8779-7fa755ed7f9d
Fixes: 5031ffcc79b8 ("Bluetooth: Keep MSFT ext info throughout a hci_dev's life cycle")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 1407225ac7520..14b761e944f81 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -170,11 +170,16 @@ static bool read_supported_features(struct hci_dev *hdev,
goto failed;
}
+ /* The event prefix is used by msft_vendor_evt() with hdev->lock held */
+ hci_dev_lock(hdev);
+
if (rp->evt_prefix_len > 0) {
msft->evt_prefix = kmemdup(rp->evt_prefix, rp->evt_prefix_len,
GFP_KERNEL);
- if (!msft->evt_prefix)
+ if (!msft->evt_prefix) {
+ hci_dev_unlock(hdev);
goto failed;
+ }
}
msft->evt_prefix_len = rp->evt_prefix_len;
@@ -183,6 +188,8 @@ static bool read_supported_features(struct hci_dev *hdev,
if (msft->features & MSFT_FEATURE_MASK_CURVE_VALIDITY)
hdev->msft_curve_validity = true;
+ hci_dev_unlock(hdev);
+
kfree_skb(skb);
return true;
@@ -648,10 +655,12 @@ void msft_do_open(struct hci_dev *hdev)
bt_dev_dbg(hdev, "Initialize MSFT extension");
/* Reset existing MSFT data before re-reading */
+ hci_dev_lock(hdev);
kfree(msft->evt_prefix);
msft->evt_prefix = NULL;
msft->evt_prefix_len = 0;
msft->features = 0;
+ hci_dev_unlock(hdev);
if (!read_supported_features(hdev, msft)) {
hci_dev_lock(hdev);
@@ -1078,12 +1087,15 @@ static void msft_monitor_device_evt(struct hci_dev *hdev, struct sk_buff *skb)
void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb)
{
- struct msft_data *msft = hdev->msft_data;
+ struct msft_data *msft;
u8 *evt_prefix;
u8 *evt;
+ hci_dev_lock(hdev);
+
+ msft = hdev->msft_data;
if (!msft)
- return;
+ goto unlock;
/* When the extension has defined an event prefix, check that it
* matches, and otherwise just return.
@@ -1091,23 +1103,21 @@ void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb)
if (msft->evt_prefix_len > 0) {
evt_prefix = msft_skb_pull(hdev, skb, 0, msft->evt_prefix_len);
if (!evt_prefix)
- return;
+ goto unlock;
if (memcmp(evt_prefix, msft->evt_prefix, msft->evt_prefix_len))
- return;
+ goto unlock;
}
/* Every event starts at least with an event code and the rest of
* the data is variable and depends on the event code.
*/
if (skb->len < 1)
- return;
+ goto unlock;
evt = msft_skb_pull(hdev, skb, 0, sizeof(*evt));
if (!evt)
- return;
-
- hci_dev_lock(hdev);
+ goto unlock;
switch (*evt) {
case MSFT_EV_LE_MONITOR_DEVICE:
@@ -1121,6 +1131,7 @@ void msft_vendor_evt(struct hci_dev *hdev, void *data, struct sk_buff *skb)
break;
}
+unlock:
hci_dev_unlock(hdev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 172/703] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (168 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 171/703] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 173/703] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
` (237 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit b49abf5f92ea0e03ebc0fe41ce4af87b094fe9b5 ]
The debugfs writers checked the current state of the flag, then blindly
inverted it with hci_dev_change_flag(). Two concurrent writers both pass
the check and the second inversion undoes the first one, leaving the flag
out of sync with the actual controller/SMP channel state (e.g. DUT mode
flag vs controller, or the BR/EDR SMP channel being leaked or removed
twice).
Set or clear the flag explicitly instead, redo the dut_mode check under
hci_req_sync_lock() and serialize smp_force_bredr() with hdev->lock. The
same applies to the quirk attributes.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-442108d5-76ce-44a1-a84d-16b44d6a26a6
Fixes: 4b4148e9acc1 ("Bluetooth: Add support for setting DUT mode")
Fixes: b55d1abf568c ("Bluetooth: Expose quirks through debugfs")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_debugfs.c | 32 +++++++++++++++++++++++++-------
net/bluetooth/smp.c | 25 +++++++++++++++++++------
2 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/net/bluetooth/hci_debugfs.c b/net/bluetooth/hci_debugfs.c
index 807c9e0e212c9..921c2ac7522d5 100644
--- a/net/bluetooth/hci_debugfs.c
+++ b/net/bluetooth/hci_debugfs.c
@@ -62,7 +62,7 @@ static ssize_t __name ## _write(struct file *file, \
if (enable == test_bit(__quirk, hdev->quirk_flags)) \
return -EALREADY; \
\
- change_bit(__quirk, hdev->quirk_flags); \
+ assign_bit(__quirk, hdev->quirk_flags, enable); \
\
return count; \
} \
@@ -780,7 +780,10 @@ static ssize_t force_static_address_write(struct file *file,
if (enable == hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR))
return -EALREADY;
- hci_dev_change_flag(hdev, HCI_FORCE_STATIC_ADDR);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_FORCE_STATIC_ADDR);
+ else
+ hci_dev_clear_flag(hdev, HCI_FORCE_STATIC_ADDR);
return count;
}
@@ -1184,7 +1187,10 @@ static ssize_t force_no_mitm_write(struct file *file,
if (enable == hci_dev_test_flag(hdev, HCI_FORCE_NO_MITM))
return -EALREADY;
- hci_dev_change_flag(hdev, HCI_FORCE_NO_MITM);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_FORCE_NO_MITM);
+ else
+ hci_dev_clear_flag(hdev, HCI_FORCE_NO_MITM);
return count;
}
@@ -1310,20 +1316,32 @@ static ssize_t dut_mode_write(struct file *file, const char __user *user_buf,
return -EALREADY;
hci_req_sync_lock(hdev);
+
+ /* Check again now that concurrent writers are excluded */
+ if (enable == hci_dev_test_flag(hdev, HCI_DUT_MODE)) {
+ hci_req_sync_unlock(hdev);
+ return -EALREADY;
+ }
+
if (enable)
skb = __hci_cmd_sync(hdev, HCI_OP_ENABLE_DUT_MODE, 0, NULL,
HCI_CMD_TIMEOUT);
else
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL,
HCI_CMD_TIMEOUT);
- hci_req_sync_unlock(hdev);
-
- if (IS_ERR(skb))
+ if (IS_ERR(skb)) {
+ hci_req_sync_unlock(hdev);
return PTR_ERR(skb);
+ }
kfree_skb(skb);
- hci_dev_change_flag(hdev, HCI_DUT_MODE);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_DUT_MODE);
+ else
+ hci_dev_clear_flag(hdev, HCI_DUT_MODE);
+
+ hci_req_sync_unlock(hdev);
return count;
}
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 5cb4c1e5f6761..345cff1aa37e1 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -3391,8 +3391,14 @@ static void smp_del_chan(struct l2cap_chan *chan)
int smp_force_bredr(struct hci_dev *hdev, bool enable)
{
- if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
- return -EALREADY;
+ int err = 0;
+
+ hci_dev_lock(hdev);
+
+ if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) {
+ err = -EALREADY;
+ goto unlock;
+ }
/* The channels are only registered while the controller is powered
* and LE capable. Otherwise just record the flag, smp_register() will
@@ -3403,8 +3409,10 @@ int smp_force_bredr(struct hci_dev *hdev, bool enable)
if (hdev->smp_data && !hdev->smp_bredr_data) {
chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
- if (IS_ERR(chan))
- return PTR_ERR(chan);
+ if (IS_ERR(chan)) {
+ err = PTR_ERR(chan);
+ goto unlock;
+ }
hdev->smp_bredr_data = chan;
}
@@ -3418,9 +3426,14 @@ int smp_force_bredr(struct hci_dev *hdev, bool enable)
}
}
- hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP);
+ if (enable)
+ hci_dev_set_flag(hdev, HCI_FORCE_BREDR_SMP);
+ else
+ hci_dev_clear_flag(hdev, HCI_FORCE_BREDR_SMP);
- return 0;
+unlock:
+ hci_dev_unlock(hdev);
+ return err;
}
int smp_register(struct hci_dev *hdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 173/703] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (169 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 172/703] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 174/703] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
` (236 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 7f08b6ef44fa17f1a5ad3926663ddb5abe6ff68a ]
hci_remove_single_adv_monitor() and hci_remove_all_adv_monitor() only
require hci_req_sync_lock, yet they look up and free monitors, modifying
hdev->adv_monitors_idr and adv_monitors_cnt, which Read Advertisement
Monitor Features iterates under hdev->lock. Take hdev->lock around the
IDR accesses and the freeing, but not across the HCI commands sent to the
controller.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-8b358899-5ac9-4687-af16-58420a4d9bba
Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_core.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 5c5cee7ea9ae6..03ff64db62861 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2064,7 +2064,10 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
if (status == -ENOENT)
bt_dev_warn(hdev, "Removing monitor with no matching handle %d",
monitor->handle);
+
+ hci_dev_lock(hdev);
hci_free_adv_monitor(hdev, monitor);
+ hci_dev_unlock(hdev);
return status;
}
@@ -2072,7 +2075,11 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
/* This function requires the caller holds hci_req_sync_lock */
int hci_remove_single_adv_monitor(struct hci_dev *hdev, u16 handle)
{
- struct adv_monitor *monitor = idr_find(&hdev->adv_monitors_idr, handle);
+ struct adv_monitor *monitor;
+
+ hci_dev_lock(hdev);
+ monitor = idr_find(&hdev->adv_monitors_idr, handle);
+ hci_dev_unlock(hdev);
if (!monitor)
return -EINVAL;
@@ -2088,7 +2095,10 @@ int hci_remove_all_adv_monitor(struct hci_dev *hdev)
int status = 0;
while (1) {
+ hci_dev_lock(hdev);
monitor = idr_get_next(&hdev->adv_monitors_idr, &idr_next_id);
+ hci_dev_unlock(hdev);
+
if (!monitor)
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 174/703] Bluetooth: MSFT: Free the response of the monitor commands
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (170 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 173/703] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 175/703] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
` (235 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 775eca0c3df2f0272f21ebc8c812ad010fd47243 ]
msft_add_monitor_sync() and msft_remove_monitor_sync() send the MSFT
command with __hci_cmd_sync() and pass the returned skb to the callbacks,
which only parse it, so it is never freed. Free it once the callback
returns.
While at it initialize the RSSI fields of the handle data when it is
created instead of after the command completed, so they are never exposed
uninitialized, and do the lookup of the handle map in
msft_remove_monitor_sync() with hdev->lock held.
Found by the sashiko.dev review of the previous revision of this series.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261117185737.3758255-1-luiz.dentz%40gmail.com
Fixes: b747a83690c8 ("Bluetooth: hci_sync: Refactor add Adv Monitor")
Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 14b761e944f81..da6de53d12637 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -297,6 +297,10 @@ static int msft_le_monitor_advertisement_cb(struct hci_dev *hdev, u16 opcode,
handle_data->mgmt_handle = monitor->handle;
handle_data->msft_handle = rp->handle;
handle_data->cond_type = MSFT_MONITOR_ADVERTISEMENT_TYPE_PATTERN;
+ handle_data->rssi_high = monitor->rssi.high_threshold;
+ handle_data->rssi_low = monitor->rssi.low_threshold;
+ handle_data->rssi_low_interval = (u8)monitor->rssi.low_threshold_timeout;
+ handle_data->rssi_sampling_period = monitor->rssi.sampling_period;
INIT_LIST_HEAD(&handle_data->list);
list_add(&handle_data->list, &msft->handle_map);
@@ -438,23 +442,30 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
struct msft_cp_le_cancel_monitor_advertisement cp;
struct msft_monitor_advertisement_handle_data *handle_data;
struct sk_buff *skb;
+ int err;
+ hci_dev_lock(hdev);
handle_data = msft_find_handle_data(hdev, monitor->handle, true);
+ if (handle_data)
+ cp.handle = handle_data->msft_handle;
+ hci_dev_unlock(hdev);
/* If no matched handle, just remove without telling controller */
if (!handle_data)
return -ENOENT;
cp.sub_opcode = MSFT_OP_LE_CANCEL_MONITOR_ADVERTISEMENT;
- cp.handle = handle_data->msft_handle;
skb = __hci_cmd_sync(hdev, hdev->msft_opcode, sizeof(cp), &cp,
HCI_CMD_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);
- return msft_le_cancel_monitor_advertisement_cb(hdev, hdev->msft_opcode,
- monitor, skb);
+ err = msft_le_cancel_monitor_advertisement_cb(hdev, hdev->msft_opcode,
+ monitor, skb);
+ kfree_skb(skb);
+
+ return err;
}
/* This function requires the caller holds hci_req_sync_lock */
@@ -519,7 +530,6 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
{
struct msft_cp_le_monitor_advertisement *cp;
struct msft_le_monitor_advertisement_pattern_data *pattern_data;
- struct msft_monitor_advertisement_handle_data *handle_data;
struct msft_le_monitor_advertisement_pattern *pattern;
struct adv_pattern *entry;
size_t total_size = sizeof(*cp) + sizeof(*pattern_data);
@@ -571,19 +581,7 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
err = msft_le_monitor_advertisement_cb(hdev, hdev->msft_opcode,
monitor, skb);
- if (err)
- goto out_free;
-
- handle_data = msft_find_handle_data(hdev, monitor->handle, true);
- if (!handle_data) {
- err = -ENODATA;
- goto out_free;
- }
-
- handle_data->rssi_high = cp->rssi_high;
- handle_data->rssi_low = cp->rssi_low;
- handle_data->rssi_low_interval = cp->rssi_low_interval;
- handle_data->rssi_sampling_period = cp->rssi_sampling_period;
+ kfree_skb(skb);
out_free:
kfree(cp);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 175/703] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (171 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 174/703] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 176/703] HID: magicmouse: disable the multitouch work on removal Greg Kroah-Hartman
` (234 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit 8d3e5e6fe6d0be5634b28788abf5685d571b13a4 ]
hci_remove_adv_monitor() frees the monitor when the controller has no
matching handle for it but still returned -ENOENT, so callers took it for
a failure of a monitor that is gone, and hci_remove_all_adv_monitor()
stopped at the first one leaving the others behind. Return success since
the monitor was removed.
Found by the sashiko.dev review of the previous revision of this series.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261117185737.3758255-1-luiz.dentz%40gmail.com
Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
Assisted-by: OpenCode:claude-fable-5.2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 03ff64db62861..8f31efe7fa23a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2069,7 +2069,10 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
hci_free_adv_monitor(hdev, monitor);
hci_dev_unlock(hdev);
- return status;
+ /* The monitor is gone, not having been known by the controller is not
+ * an error for the caller.
+ */
+ return status == -ENOENT ? 0 : status;
}
/* This function requires the caller holds hci_req_sync_lock */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 176/703] HID: magicmouse: disable the multitouch work on removal
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (172 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 175/703] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 177/703] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
` (233 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ijae Kim, Myeonghun Pak, Jiri Kosina,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit 348597b22005a8f20d267cdcc503a41dcc658acf ]
During USB runtime reset-resume, usbhid can call magicmouse_reset_resume()
without serialization against HID driver unbind. The USB interface
remains bound to usbhid, so this callback can queue msc->work after
magicmouse_remove() cancels it. The delayed work can then run after
devres frees msc.
Use disable_delayed_work_sync() to drain the work and reject later
queueing. Probe initializes fresh work on rebind.
Found by a static analysis tool under development.
Fixes: 4253fe22b137 ("HID: magicmouse: re-enable multitouch after reset-resume")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-magicmouse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index cf92c9c9ab2df..ff3dcbc30e724 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -1030,7 +1030,7 @@ static void magicmouse_remove(struct hid_device *hdev)
struct magicmouse_sc *msc = hid_get_drvdata(hdev);
if (msc) {
- cancel_delayed_work_sync(&msc->work);
+ disable_delayed_work_sync(&msc->work);
if (is_usb_magicmouse2(hdev->vendor, hdev->product) ||
is_usb_magictrackpad2(hdev->vendor, hdev->product))
timer_delete_sync(&msc->battery_timer);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 177/703] HID: sensor-hub: Synchronize callback removal with raw events
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (173 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 176/703] HID: magicmouse: disable the multitouch work on removal Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 178/703] HID: sensor: custom: Set owner for misc device Greg Kroah-Hartman
` (232 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit abe10ad9c5fd868553b1262df403d5aaea3eff64 ]
Raw-event processing holds pdata->lock across callback lookup and
invocation, and takes dyn_callback_lock during lookup. Removal must
prevent both active callbacks and future lookups before client state can
be released.
Take pdata->lock before dyn_callback_lock, matching raw-event order,
and unlink the callback while holding both locks. This ensures active
raw-event callbacks have finished and prevents future lookups.
Fixes: 401ca24fb34a ("HID: sensors: introduce sensor framework")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-hub.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index faeb9c4536f52..9f14439cc0788 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -173,7 +173,9 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev);
unsigned long flags;
- spin_lock_irqsave(&pdata->dyn_callback_lock, flags);
+ /* Serialize callback removal with raw-event callback execution. */
+ spin_lock_irqsave(&pdata->lock, flags);
+ spin_lock(&pdata->dyn_callback_lock);
list_for_each_entry(callback, &pdata->dyn_callback_list, list)
if (callback->usage_id == usage_id &&
callback->hsdev == hsdev) {
@@ -181,7 +183,8 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
kfree(callback);
break;
}
- spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags);
+ spin_unlock(&pdata->dyn_callback_lock);
+ spin_unlock_irqrestore(&pdata->lock, flags);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 178/703] HID: sensor: custom: Set owner for misc device
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (174 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 177/703] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 179/703] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
` (231 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit 452a24b2c2ed95aa246fcb3fcaf74a97a95c02a4 ]
Set .owner in the misc-device file operations so open file descriptors
keep the module loaded until their release callbacks have completed.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 0b97d61df0c8b..90e11c4533019 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -719,6 +719,7 @@ static __poll_t hid_sensor_custom_poll(struct file *file,
}
static const struct file_operations hid_sensor_custom_fops = {
+ .owner = THIS_MODULE,
.open = hid_sensor_custom_open,
.read = hid_sensor_custom_read,
.release = hid_sensor_custom_release,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 179/703] HID: sensor: custom: Disable sensor before hub close on removal
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (175 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 178/703] HID: sensor: custom: Set owner for misc device Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 180/703] xsk: reject TX checksum requests that overflow skb->csum_start Greg Kroah-Hartman
` (230 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Joshua Crofts,
Zhang Lixu, Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit 6e66d69837cf07a00cbcdeb6198e08332b422b6c ]
When removing an enabled sensor, set its power and reporting states to
off before closing the hub. Keep the field descriptors alive until the
state update has completed, and release the hub's open reference.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Reviewed-by: Joshua Crofts <crofts@kernel.org>
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 90e11c4533019..2aa71530a1a30 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -1053,6 +1053,13 @@ static void hid_sensor_custom_remove(struct platform_device *pdev)
/* Remove enable_sensor first as it uses fields via power_state/report_state. */
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
&enable_sensor_attr_group);
+ mutex_lock(&sensor_inst->mutex);
+ if (sensor_inst->enable) {
+ set_power_report_state(sensor_inst, false);
+ sensor_hub_device_close(hsdev);
+ sensor_inst->enable = false;
+ }
+ mutex_unlock(&sensor_inst->mutex);
hid_sensor_custom_remove_attributes(sensor_inst);
sensor_hub_remove_callback(hsdev, hsdev->usage);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 180/703] xsk: reject TX checksum requests that overflow skb->csum_start
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (176 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 179/703] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 181/703] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle Greg Kroah-Hartman
` (229 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Tianyi Gao,
Stanislav Fomichev, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianyi Gao <tianyi@cloudflare.com>
[ Upstream commit 4fdfed6d0990c82ce3c268814ba1b2c6ad0ce49d ]
xsk_skb_metadata() sets the u16 skb->csum_start to hr + csum_start. With
64K pages, csum_start can be close to U16_MAX, so the sum can overflow.
The checksum offset then becomes negative. With XDP_UMEM_TX_SW_CSUM,
skb_checksum_help() triggers a warning. Without it, the device gets a
CHECKSUM_PARTIAL skb with a negative offset.
Reject this with -EINVAL. Use the limit of skb_partial_csum_set(), which
also rejects U16_MAX, the "not set" value of transport_header. That
helper cannot be used here, as the skb built for an IFF_TX_SKB_NO_LINEAR
device has no linear data.
Fixes: 48eb03dd2630 ("xsk: Add TX timestamp and TX checksum offload support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-203545@kernel.org/
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20261116162834.30087-1-tianyi@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xdp/xsk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 120453647cf4b..081695428431f 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -896,7 +896,8 @@ static int xsk_skb_metadata(struct sk_buff *skb, void *buffer,
csum_offset = READ_ONCE(meta->request.csum_offset);
if (unlikely(csum_start + csum_offset +
- sizeof(__sum16) > desc->len))
+ sizeof(__sum16) > desc->len ||
+ hr + csum_start >= U16_MAX))
return -EINVAL;
skb->csum_start = hr + csum_start;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 181/703] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (177 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 180/703] xsk: reject TX checksum requests that overflow skb->csum_start Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 182/703] cxgb4: allocate the full ethtool filter location array Greg Kroah-Hartman
` (228 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Duyck, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <alexanderduyck@fb.com>
[ Upstream commit 6ada0c2769666140dff8e808ff21e8f9544ddc99 ]
The fbnic_wait_all_queues_idle function treats the Tx path as idle once
the QM idle registers report every queue idle. Those registers do not
cover the TMI completion path, so they can report idle while a PTP
timestamp request is still outstanding in the MAC or queued in the TMI
completion FIFO.
The check can then pass without a flush, and the completion arrives
after the rings have been flushed, where the fbnic_clean_tsq function
either reports "Tx timestamp without matching packet" or, if the
interface has come back up and a new timestamped frame is already
waiting, matches the stale completion to that frame and hands an
SO_TIMESTAMPING user the wrong Tx timestamp. After a forced flush it can
also turn FBNIC_TMI_DROP_CTRL_CMPL_DIS back off before the queued
completions have drained, as the completion FIFO is only drained while
that bit is set.
Split the Tx wait out into the fbnic_wait_tx_idle function and have its
idle check require the TCE PTP in-flight count to read zero in addition
to the QM idle registers. The count tracks each timestamp request from
when its frame enters the TCE until its completion leaves the TMI
completion FIFO, so the Tx path is only treated as idle once none are
outstanding, and a forced flush keeps the completion disable set until
they have drained. The Rx wait still checks only the QM idle registers.
The count is printed with the other Tx idle registers on failure.
Waiting on the in-flight count means the Tx idle check can now keep
reading the full set of QM idle registers for the whole timeout, and the
poll timeout only counts the delay between polls, not the time spent in
the register reads. Raise the delay between polls of the Tx and Rx waits
from 2us to 20us so the PCIe read latency stays a small part of each
interval and the 500ms timeout stays close to wall time.
Define the register inside the TCE CSR section and move
FBNIC_CSR_END_TCE to the last register of the TCE block (0x040B4,
TCE_SPARE2 in the CSR map), so that the ethtool register dump covers it.
The section previously ended at 0x04050, short of the TXB, PTP and TCAM
status registers. Per the CSR map, every register in the added range is
read-only or read/write, so reading them for the dump has no side
effects.
A device that has dropped off the bus, or whose CSR access the driver
has disabled after a failed read, reads all ones. The QM idle bits treat
that as idle, and so does the in-flight check: the count is bounded by
the timestamp requests the Tx path can hold and can never reach all
ones, so teardown of a lost device, or during DPC recovery, does not
wait out the idle timeouts.
The issue was found by code review and confirmed against the RTL.
Fixes: ad3d9f8bc66c ("eth: fbnic: add TX packets timestamping support")
Fixes: 7d4568edce74 ("fbnic: Disable PTP completions during the Tx force-flush")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/179460248693.8819.282933709034208845.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 3 +-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 73 ++++++++++++++++----
2 files changed, 62 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index e93f9ff6f4d14..376f8249e3960 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -437,7 +437,8 @@ enum {
#define FBNIC_TCE_TXB_NTWRK_DWRR_CTRL_EXT \
0x0404E /* 0x10138 */
#define FBNIC_TCE_TXB_BMC_DWRR_CTRL_EXT 0x0404F /* 0x1013c */
-#define FBNIC_CSR_END_TCE 0x04050 /* CSR section delimiter */
+#define FBNIC_TCE_PTP_INFLIGHT 0x040A7 /* 0x1029c */
+#define FBNIC_CSR_END_TCE 0x040B4 /* CSR section delimiter */
/* TCE RAM registers */
#define FBNIC_CSR_START_TCE_RAM 0x04200 /* CSR section delimiter */
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index 0a278f2a2ee7a..623b2795af3af 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -2339,38 +2339,85 @@ static void fbnic_idle_dump(struct fbnic_dev *fbd,
fbnic_rd32(fbd, regs[i].reg_base + j));
}
-int fbnic_wait_all_queues_idle(struct fbnic_dev *fbd, bool may_fail)
+/* The poll timeout only accounts for the delay between polls, not for
+ * the time spent in the poll itself, and each poll is a series of
+ * non-posted PCIe register reads that take on the order of a
+ * microsecond each. Space the polls out so that the reads stay a small
+ * part of each interval and the timeout stays close to wall time.
+ */
+#define FBNIC_IDLE_POLL_US 20
+#define FBNIC_IDLE_TIMEOUT_US 500000
+
+static bool fbnic_tx_idle(struct fbnic_dev *fbd,
+ const struct fbnic_idle_regs *regs,
+ unsigned int nregs)
+{
+ u32 inflight;
+
+ if (!fbnic_all_idle(fbd, regs, nregs))
+ return false;
+
+ /* The QM idle bits do not cover the TMI completion path, so a
+ * timestamp request can still be waiting on its completion. The
+ * count is bounded by the timestamp requests the Tx path can hold,
+ * so all ones is a failed read, as for the idle bits, not a count.
+ */
+ inflight = fbnic_rd32(fbd, FBNIC_TCE_PTP_INFLIGHT);
+
+ return !inflight || !~inflight;
+}
+
+static int fbnic_wait_tx_idle(struct fbnic_dev *fbd)
{
static const struct fbnic_idle_regs tx[] = {
{ FBNIC_QM_TWQ_IDLE(0), FBNIC_QM_TWQ_IDLE_CNT, },
{ FBNIC_QM_TQS_IDLE(0), FBNIC_QM_TQS_IDLE_CNT, },
{ FBNIC_QM_TDE_IDLE(0), FBNIC_QM_TDE_IDLE_CNT, },
{ FBNIC_QM_TCQ_IDLE(0), FBNIC_QM_TCQ_IDLE_CNT, },
- }, rx[] = {
- { FBNIC_QM_HPQ_IDLE(0), FBNIC_QM_HPQ_IDLE_CNT, },
- { FBNIC_QM_PPQ_IDLE(0), FBNIC_QM_PPQ_IDLE_CNT, },
- { FBNIC_QM_RCQ_IDLE(0), FBNIC_QM_RCQ_IDLE_CNT, },
};
bool idle;
int err;
- err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle, 2, 500000,
- false, fbd, tx, ARRAY_SIZE(tx));
+ err = read_poll_timeout_atomic(fbnic_tx_idle, idle, idle,
+ FBNIC_IDLE_POLL_US,
+ FBNIC_IDLE_TIMEOUT_US, false,
+ fbd, tx, ARRAY_SIZE(tx));
if (err == -ETIMEDOUT) {
fbnic_tx_flush(fbd);
- err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle,
- 2, 500000, false,
+ err = read_poll_timeout_atomic(fbnic_tx_idle, idle, idle,
+ FBNIC_IDLE_POLL_US,
+ FBNIC_IDLE_TIMEOUT_US, false,
fbd, tx, ARRAY_SIZE(tx));
fbnic_tx_flush_off(fbd);
}
if (err) {
fbnic_idle_dump(fbd, tx, ARRAY_SIZE(tx), "Tx", err);
- if (may_fail)
- return err;
+ netdev_err(fbd->netdev, "0x%04x: %08x\n",
+ FBNIC_TCE_PTP_INFLIGHT,
+ fbnic_rd32(fbd, FBNIC_TCE_PTP_INFLIGHT));
}
- err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle, 2, 500000,
- false, fbd, rx, ARRAY_SIZE(rx));
+ return err;
+}
+
+int fbnic_wait_all_queues_idle(struct fbnic_dev *fbd, bool may_fail)
+{
+ static const struct fbnic_idle_regs rx[] = {
+ { FBNIC_QM_HPQ_IDLE(0), FBNIC_QM_HPQ_IDLE_CNT, },
+ { FBNIC_QM_PPQ_IDLE(0), FBNIC_QM_PPQ_IDLE_CNT, },
+ { FBNIC_QM_RCQ_IDLE(0), FBNIC_QM_RCQ_IDLE_CNT, },
+ };
+ bool idle;
+ int err;
+
+ err = fbnic_wait_tx_idle(fbd);
+ if (err && may_fail)
+ return err;
+
+ err = read_poll_timeout_atomic(fbnic_all_idle, idle, idle,
+ FBNIC_IDLE_POLL_US,
+ FBNIC_IDLE_TIMEOUT_US, false,
+ fbd, rx, ARRAY_SIZE(rx));
if (err)
fbnic_idle_dump(fbd, rx, ARRAY_SIZE(rx), "Rx", err);
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 182/703] cxgb4: allocate the full ethtool filter location array
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (178 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 181/703] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 183/703] net: bcm4908_enet: fix the TX ring wrap Greg Kroah-Hartman
` (227 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Artemii Mashanov,
Potnuri Bharat Teja, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artemii Mashanov <ralerrdirsardx@gmail.com>
[ Upstream commit ad2c7240a3981fd5f0142b61ca913b02ab476ede ]
The ethtool filter location array stores nentries u32 values, but
cxgb4_init_ethtool_filters() passes nentries to kvzalloc() as a byte
count. The insertion and lookup paths allow indices below nentries,
which can address memory beyond the requested allocation.
Allocate nentries elements with kvcalloc() and the element size.
The array remains compatible with the existing kvfree() calls.
The size mismatch was found by reviewing the allocation, the array
declaration and the indexed accesses in the filter handlers.
Fixes: d915c299f1da ("cxgb4: add skeleton for ethtool n-tuple filters")
Signed-off-by: Artemii Mashanov <ralerrdirsardx@gmail.com>
Reviewed-by: Potnuri Bharat Teja <bharat@chelsio.com>
Link: https://patch.msgid.link/20261117090608.33178-1-ralerrdirsardx@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
index 23326235d4ab5..bb20ed9e2d6e5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
@@ -2266,7 +2266,9 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
eth_filter->nentries = nentries;
for (i = 0; i < adap->params.nports; i++) {
- eth_filter->port[i].loc_array = kvzalloc(nentries, GFP_KERNEL);
+ eth_filter->port[i].loc_array =
+ kvcalloc(nentries, sizeof(*eth_filter->port[i].loc_array),
+ GFP_KERNEL);
if (!eth_filter->port[i].loc_array) {
ret = -ENOMEM;
goto free_eth_finfo;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 183/703] net: bcm4908_enet: fix the TX ring wrap
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (179 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 182/703] cxgb4: allocate the full ethtool filter location array Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 184/703] net: bcm4908_enet: drop a TX frame whose DMA mapping failed Greg Kroah-Hartman
` (226 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 4f8b1a7cf7548ebefae959486c3acc33799d1116 ]
start_xmit() wraps write_idx at length - 1 and sets WRAP on the
descriptor at length - 2, while poll_tx() wraps read_idx at length,
and the free descriptor count is taken from length. With read_idx at 0
and write_idx at length - 2 the count comes out as 2, the frame is
queued and write_idx wraps to 0 == read_idx: a full ring looks empty.
The following frames overwrite slots whose skbs were never unmapped
or freed, their bytes stay in BQL, and the queue stops for good with
nothing left to wake it.
On a TP-Link Archer AX6000 this stopped everything the CPU sent to the
switch under sustained TX load (about 1.3 Gbit/s through the switch's
CPU port): tx_packets froze, nothing was logged, and BQL showed about
185 KB in flight against a limit of about 10 KB.
The same mismatch also lets poll_tx() step onto slot length - 1, which
start_xmit() never fills: once per lap it completes that slot,
unmapping address 0 with length 0 and counting a packet that was never
sent. That one is from reading the code.
Use every descriptor, with WRAP on the last one, wrap both indexes at
length and keep one descriptor free, so that read_idx == write_idx can
only mean an empty ring. Stop and wake the queue with the
netdev_queues.h helpers: start_xmit() stops it when the ring is full,
also when it finds the ring full on entry, and poll_tx() wakes it once
there is room again.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-2-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 57 ++++++++++++--------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 203e8d0dd04b8..1d5327daabc14 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -13,6 +13,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <net/netdev_queues.h>
#include "bcm4908_enet.h"
#include "unimac.h"
@@ -518,30 +519,34 @@ static int bcm4908_enet_stop(struct net_device *netdev)
return 0;
}
+/* One descriptor always stays unused, so read_idx == write_idx can only
+ * mean an empty ring
+ */
+static int bcm4908_enet_tx_free_descs(struct bcm4908_enet_dma_ring *ring)
+{
+ int free = READ_ONCE(ring->read_idx) - READ_ONCE(ring->write_idx) - 1;
+
+ return free < 0 ? free + ring->length : free;
+}
+
static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netdev)
{
+ struct netdev_queue *txq = netdev_get_tx_queue(netdev, 0);
struct bcm4908_enet *enet = netdev_priv(netdev);
struct bcm4908_enet_dma_ring *ring = &enet->tx_ring;
struct bcm4908_enet_dma_ring_slot *slot;
struct device *dev = enet->dev;
struct bcm4908_enet_dma_ring_bd *buf_desc;
- int free_buf_descs;
u32 tmp;
/* Free transmitted skbs */
if (enet->irq_tx < 0 &&
- !(le32_to_cpu(ring->buf_desc[ring->read_idx].ctl) & DMA_CTL_STATUS_OWN))
+ !(le32_to_cpu(ring->buf_desc[READ_ONCE(ring->read_idx)].ctl) &
+ DMA_CTL_STATUS_OWN))
napi_schedule(&enet->tx_ring.napi);
- /* Don't use the last empty buf descriptor */
- if (ring->read_idx <= ring->write_idx)
- free_buf_descs = ring->read_idx - ring->write_idx + ring->length;
- else
- free_buf_descs = ring->read_idx - ring->write_idx;
- if (free_buf_descs < 2) {
- netif_stop_queue(netdev);
+ if (!netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1))
return NETDEV_TX_BUSY;
- }
/* Hardware removes OWN bit after sending data */
buf_desc = &ring->buf_desc[ring->write_idx];
@@ -562,7 +567,7 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
tmp |= DMA_CTL_STATUS_SOP;
tmp |= DMA_CTL_STATUS_EOP;
tmp |= DMA_CTL_STATUS_APPEND_CRC;
- if (ring->write_idx + 1 == ring->length - 1)
+ if (ring->write_idx == ring->length - 1)
tmp |= DMA_CTL_STATUS_WRAP;
netdev_sent_queue(enet->netdev, skb->len);
@@ -572,8 +577,13 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
- if (++ring->write_idx == ring->length - 1)
- ring->write_idx = 0;
+ if (ring->write_idx == ring->length - 1)
+ WRITE_ONCE(ring->write_idx, 0);
+ else
+ WRITE_ONCE(ring->write_idx, ring->write_idx + 1);
+
+ /* poll_tx() wakes the queue once there is room again */
+ netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1);
return NETDEV_TX_OK;
}
@@ -652,17 +662,19 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
{
struct bcm4908_enet_dma_ring *tx_ring = container_of(napi, struct bcm4908_enet_dma_ring, napi);
struct bcm4908_enet *enet = container_of(tx_ring, struct bcm4908_enet, tx_ring);
+ struct netdev_queue *txq = netdev_get_tx_queue(enet->netdev, 0);
struct bcm4908_enet_dma_ring_bd *buf_desc;
struct bcm4908_enet_dma_ring_slot *slot;
struct device *dev = enet->dev;
+ int read_idx = tx_ring->read_idx;
unsigned int bytes = 0;
int handled = 0;
- while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) {
- buf_desc = &tx_ring->buf_desc[tx_ring->read_idx];
+ while (handled < weight && read_idx != READ_ONCE(tx_ring->write_idx)) {
+ buf_desc = &tx_ring->buf_desc[read_idx];
if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
break;
- slot = &tx_ring->slots[tx_ring->read_idx];
+ slot = &tx_ring->slots[read_idx];
dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
dev_kfree_skb(slot->skb);
@@ -670,22 +682,23 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
handled++;
bytes += slot->len;
- if (++tx_ring->read_idx == tx_ring->length)
- tx_ring->read_idx = 0;
+ if (++read_idx == tx_ring->length)
+ read_idx = 0;
}
+ WRITE_ONCE(tx_ring->read_idx, read_idx);
- netdev_completed_queue(enet->netdev, handled, bytes);
enet->netdev->stats.tx_packets += handled;
enet->netdev->stats.tx_bytes += bytes;
+ /* Reports to BQL, and wakes the queue if start_xmit() stopped it */
+ netif_txq_completed_wake(txq, handled, bytes,
+ bcm4908_enet_tx_free_descs(tx_ring), 1);
+
if (handled < weight) {
napi_complete_done(napi, handled);
bcm4908_enet_dma_ring_intrs_on(enet, tx_ring);
}
- if (netif_queue_stopped(enet->netdev))
- netif_wake_queue(enet->netdev);
-
return handled;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 184/703] net: bcm4908_enet: drop a TX frame whose DMA mapping failed
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (180 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 183/703] net: bcm4908_enet: fix the TX ring wrap Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 185/703] net: bcm4908_enet: release the TX ring on stop Greg Kroah-Hartman
` (225 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit e1d4683fb4cb9d7f45a17c43a56ba2d26ab91ec6 ]
When dma_map_single() fails, start_xmit() returns NETDEV_TX_BUSY with
the queue still running, after it has already stored the skb in the
slot. Documentation/networking/driver.rst treats NETDEV_TX_BUSY under
normal circumstances as a hard error, and a driver that returns it must
not keep any reference to the skb. Here the stack requeues the frame
and retries it while the slot still points at it. Drop the frame
instead: free the skb, count it as dropped and return NETDEV_TX_OK.
Map the buffer before the slot is touched.
Found by reading the code.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-3-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 1d5327daabc14..22ad0914ae46c 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -537,6 +537,7 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
struct bcm4908_enet_dma_ring_slot *slot;
struct device *dev = enet->dev;
struct bcm4908_enet_dma_ring_bd *buf_desc;
+ dma_addr_t dma_addr;
u32 tmp;
/* Free transmitted skbs */
@@ -555,12 +556,17 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
return NETDEV_TX_BUSY;
}
+ dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
+ if (unlikely(dma_mapping_error(dev, dma_addr))) {
+ dev_kfree_skb_any(skb);
+ netdev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
+
slot = &ring->slots[ring->write_idx];
slot->skb = skb;
slot->len = skb->len;
- slot->dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
- if (unlikely(dma_mapping_error(dev, slot->dma_addr)))
- return NETDEV_TX_BUSY;
+ slot->dma_addr = dma_addr;
tmp = skb->len << DMA_CTL_LEN_DESC_BUFLENGTH_SHIFT;
tmp |= DMA_CTL_STATUS_OWN;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 185/703] net: bcm4908_enet: release the TX ring on stop
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (181 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 184/703] net: bcm4908_enet: drop a TX frame whose DMA mapping failed Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 186/703] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
` (224 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kordian Chmielewski, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit e2785f0ff0a210158933221e86ea5bd066992870 ]
bcm4908_enet_stop() disables the TX DMA but leaves the ring as it is:
the skbs that poll_tx() has not freed yet stay mapped and are never
freed, and the descriptors the DMA has not sent yet keep
DMA_CTL_STATUS_OWN. The skbs, the socket memory they hold and their
mappings leak. The next open starts the indexes from 0 again over
those descriptors, so the DMA may send stale frames from before the
stop, and if the first descriptor still has OWN, start_xmit() stops
the queue before it enables the DMA, with nothing left to wake it.
Wait for the TX DMA channel to stop, as is already done for RX, then
unmap and free the skbs between read_idx and write_idx and leave the
ring empty, so that nothing can free them a second time. If the
channel does not stop in time, leave the skbs alone rather than free
them while the DMA may still read them. Clear the TX descriptors when
the ring is initialised. A descriptor that start_xmit() is about to
use then never carries OWN, so drop the check that stopped the queue
on one. The RX helper's timeout warning said TX; make it say RX.
Found by reading the code; I have not seen these on the hardware.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-4-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 55 ++++++++++++++++----
1 file changed, 44 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 22ad0914ae46c..e9ed88ebd3f9f 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -7,6 +7,7 @@
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
#include <linux/interrupt.h>
+#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_net.h>
@@ -313,6 +314,11 @@ static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet,
enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR,
(uint32_t)ring->dma_addr);
+ /* A descriptor the stopped DMA never completed still carries OWN */
+ if (ring->is_tx)
+ memset(ring->buf_desc, 0,
+ ring->length * sizeof(*ring->buf_desc));
+
ring->read_idx = 0;
ring->write_idx = 0;
}
@@ -362,10 +368,22 @@ static void bcm4908_enet_dma_tx_ring_enable(struct bcm4908_enet *enet,
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, ENET_DMA_CH_CFG_ENABLE);
}
-static void bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
- struct bcm4908_enet_dma_ring *ring)
+static int bcm4908_enet_dma_tx_ring_disable(struct bcm4908_enet *enet,
+ struct bcm4908_enet_dma_ring *ring)
{
+ u32 tmp;
+ int err;
+
enet_write(enet, ring->cfg_block + ENET_DMA_CH_CFG, 0);
+
+ /* Wait for the channel to stop, as for RX, before freeing buffers */
+ err = read_poll_timeout(enet_read, tmp, !(tmp & ENET_DMA_CH_CFG_ENABLE),
+ 10, 2000, false, enet,
+ ring->cfg_block + ENET_DMA_CH_CFG);
+ if (err)
+ dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n");
+
+ return err;
}
static void bcm4908_enet_dma_rx_ring_enable(struct bcm4908_enet *enet,
@@ -391,7 +409,7 @@ static void bcm4908_enet_dma_rx_ring_disable(struct bcm4908_enet *enet,
usleep_range(10, 30);
} while (!time_after_eq(jiffies, deadline));
- dev_warn(enet->dev, "Timeout waiting for DMA TX stop\n");
+ dev_warn(enet->dev, "Timeout waiting for DMA RX stop\n");
}
/***
@@ -496,6 +514,25 @@ static int bcm4908_enet_open(struct net_device *netdev)
return 0;
}
+static void bcm4908_enet_tx_ring_clean(struct bcm4908_enet *enet)
+{
+ struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
+ struct device *dev = enet->dev;
+ int i;
+
+ for (i = tx_ring->read_idx; i != tx_ring->write_idx;
+ i = i == tx_ring->length - 1 ? 0 : i + 1) {
+ struct bcm4908_enet_dma_ring_slot *slot = &tx_ring->slots[i];
+
+ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
+ dev_kfree_skb_any(slot->skb);
+ }
+
+ /* Leave the ring empty, so that nothing frees these skbs again */
+ tx_ring->read_idx = 0;
+ tx_ring->write_idx = 0;
+}
+
static int bcm4908_enet_stop(struct net_device *netdev)
{
struct bcm4908_enet *enet = netdev_priv(netdev);
@@ -509,8 +546,10 @@ static int bcm4908_enet_stop(struct net_device *netdev)
netdev_reset_queue(netdev);
bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring);
- bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring);
+ /* Leave the TX buffers alone if the channel may still read them */
+ if (!bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring))
+ bcm4908_enet_tx_ring_clean(enet);
bcm4908_enet_dma_uninit(enet);
free_irq(enet->irq_tx, enet);
@@ -549,13 +588,6 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
if (!netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1))
return NETDEV_TX_BUSY;
- /* Hardware removes OWN bit after sending data */
- buf_desc = &ring->buf_desc[ring->write_idx];
- if (unlikely(le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)) {
- netif_stop_queue(netdev);
- return NETDEV_TX_BUSY;
- }
-
dma_addr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev, dma_addr))) {
dev_kfree_skb_any(skb);
@@ -563,6 +595,7 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
return NETDEV_TX_OK;
}
+ buf_desc = &ring->buf_desc[ring->write_idx];
slot = &ring->slots[ring->write_idx];
slot->skb = skb;
slot->len = skb->len;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 186/703] net: bcm4908_enet: unmap the buffer of a dropped RX frame
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (182 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 185/703] net: bcm4908_enet: release the TX ring on stop Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 187/703] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
` (223 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 1b48d619448c8425bd907722784f08e4e8fa4c5b ]
When poll_rx() drops a frame (too short, or not in a single buffer),
it frees the buffer without unmapping it first, so the memory goes
back to the page allocator while still mapped for the device. Unmap it
as the path for good frames does.
Found by reading the code.
Fixes: 4dc7f09b8bec ("net: broadcom: bcm4908_enet: fix RX path possible mem leak")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-5-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index e9ed88ebd3f9f..219368723a373 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -661,6 +661,8 @@ static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight)
if (len < ETH_ZLEN ||
(ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
+ dma_unmap_single(dev, slot.dma_addr,
+ ENET_RX_BUF_DMA_SIZE, DMA_FROM_DEVICE);
skb_free_frag(slot.buf);
enet->netdev->stats.rx_dropped++;
break;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 187/703] net: bcm4908_enet: unmap RX buffers on stop with their mapped size
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (183 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 186/703] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 188/703] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
` (222 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 1da02595e8d2647a04c2cdd4f668dee0b8ac1ae9 ]
Since the switch to build_skb() the RX buffers are mapped with
ENET_RX_BUF_DMA_SIZE and slot->len is no longer set for them, but
bcm4908_enet_dma_uninit() still unmaps them with slot->len. Use the
size they were mapped with.
Found by reading the code.
Fixes: 3a1cc23a75ab ("net: broadcom: bcm4908_enet: use build_skb()")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-6-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 219368723a373..9e2eb386a8216 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -334,7 +334,8 @@ static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
slot = &rx_ring->slots[i];
if (!slot->buf)
continue;
- dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_FROM_DEVICE);
+ dma_unmap_single(dev, slot->dma_addr, ENET_RX_BUF_DMA_SIZE,
+ DMA_FROM_DEVICE);
skb_free_frag(slot->buf);
slot->buf = NULL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 188/703] net: bcm4908_enet: publish the buffer address before OWN
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (184 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 187/703] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 189/703] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
` (221 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Kordian Chmielewski, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit 4d47e6c2f3ceb638d4ea5c21e304b20f526255bd ]
bcm4908_enet_dma_alloc_rx_buf() hands a descriptor to the DMA by
writing its control word, with DMA_CTL_STATUS_OWN, first and the new
buffer address second. If the DMA read the descriptor between the two
stores, it would write the next frame into the old buffer, which
poll_rx() is turning into an skb. start_xmit() writes the address
first, but nothing orders the two stores, and the descriptors live in
coherent memory, where arm64 may make them visible in either order.
Write the address first on both paths and order it before the control
word with dma_wmb(). In poll_rx(), read what the DMA wrote only after
seeing OWN clear (dma_rmb()), as Documentation/memory-barriers.txt
describes for descriptors shared with a device.
Found by reading the code; I have no test that shows the DMA reading a
descriptor while it is being refilled.
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-7-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 9e2eb386a8216..0ac778e40a8f1 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -291,8 +291,10 @@ static int bcm4908_enet_dma_alloc_rx_buf(struct bcm4908_enet *enet, unsigned int
tmp |= DMA_CTL_STATUS_OWN;
if (idx == enet->rx_ring.length - 1)
tmp |= DMA_CTL_STATUS_WRAP;
- buf_desc->ctl = cpu_to_le32(tmp);
buf_desc->addr = cpu_to_le32(slot->dma_addr);
+ /* Hand the descriptor to the DMA only once it holds the new buffer */
+ dma_wmb();
+ buf_desc->ctl = cpu_to_le32(tmp);
return 0;
}
@@ -613,6 +615,8 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
netdev_sent_queue(enet->netdev, skb->len);
buf_desc->addr = cpu_to_le32((uint32_t)slot->dma_addr);
+ /* The DMA must not see OWN before the buffer address */
+ dma_wmb();
buf_desc->ctl = cpu_to_le32(tmp);
bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
@@ -647,6 +651,8 @@ static int bcm4908_enet_poll_rx(struct napi_struct *napi, int weight)
ctl = le32_to_cpu(buf_desc->ctl);
if (ctl & DMA_CTL_STATUS_OWN)
break;
+ /* Read the rest only after the DMA gave the descriptor back */
+ dma_rmb();
slot = enet->rx_ring.slots[enet->rx_ring.read_idx];
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 189/703] net: bcm4908_enet: order the TX ring index accesses
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (185 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 188/703] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 190/703] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector Greg Kroah-Hartman
` (220 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kordian Chmielewski, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kordian Chmielewski <kudzo51@gmail.com>
[ Upstream commit ebe31472ad0a08e19a31a6647b99c6b51f90026c ]
Since the TX interrupt was added, poll_tx() runs in its own NAPI and
does not take the TX queue lock, so it and start_xmit() share the TX
ring with only the two indexes between them. Nothing orders the
accesses around those indexes:
- poll_tx() reads write_idx, then the descriptor and the slot. On arm64
the later loads may be satisfied first, so poll_tx() may see the new
write_idx together with the previous lap's descriptor, which has no
OWN, and the previous lap's slot. It would then unmap and free a
frame the DMA has not sent yet, or free the old skb a second time.
- poll_tx() publishes read_idx once it is done with the slots it
freed, but that store is not ordered after its loads from those
slots, so start_xmit() may refill a slot before poll_tx() has read
it.
Publish each index with smp_store_release() and read the other side's
index with smp_load_acquire() before touching the slots. start_xmit()
now publishes write_idx right after the descriptor, before the MMIO
write that kicks the DMA rather than after it, which narrows the window
in which the DMA can complete a frame that poll_tx() cannot see yet.
Sashiko's review of the previous version of this series pointed this
out; I have not seen it on the hardware.
Fixes: 12bb508bfe5a ("net: broadcom: bcm4908_enet: support TX interrupt")
Signed-off-by: Kordian Chmielewski <kudzo51@gmail.com>
Link: https://patch.msgid.link/20261113235847.517308-8-kudzo51@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcm4908_enet.c | 26 ++++++++++++++------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 0ac778e40a8f1..d7e0be44d1210 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -566,7 +566,9 @@ static int bcm4908_enet_stop(struct net_device *netdev)
*/
static int bcm4908_enet_tx_free_descs(struct bcm4908_enet_dma_ring *ring)
{
- int free = READ_ONCE(ring->read_idx) - READ_ONCE(ring->write_idx) - 1;
+ /* Pairs with smp_store_release() in bcm4908_enet_poll_tx() */
+ int free = smp_load_acquire(&ring->read_idx) -
+ READ_ONCE(ring->write_idx) - 1;
return free < 0 ? free + ring->length : free;
}
@@ -619,12 +621,14 @@ static netdev_tx_t bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_devic
dma_wmb();
buf_desc->ctl = cpu_to_le32(tmp);
- bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
+ /* Publish the slot and the descriptor before the index; pairs with
+ * smp_load_acquire() in bcm4908_enet_poll_tx()
+ */
+ smp_store_release(&ring->write_idx,
+ ring->write_idx < ring->length - 1 ?
+ ring->write_idx + 1 : 0);
- if (ring->write_idx == ring->length - 1)
- WRITE_ONCE(ring->write_idx, 0);
- else
- WRITE_ONCE(ring->write_idx, ring->write_idx + 1);
+ bcm4908_enet_dma_tx_ring_enable(enet, &enet->tx_ring);
/* poll_tx() wakes the queue once there is room again */
netif_txq_maybe_stop(txq, bcm4908_enet_tx_free_descs(ring), 1, 1);
@@ -718,7 +722,10 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
unsigned int bytes = 0;
int handled = 0;
- while (handled < weight && read_idx != READ_ONCE(tx_ring->write_idx)) {
+ while (handled < weight) {
+ /* Pairs with the release in bcm4908_enet_start_xmit() */
+ if (read_idx == smp_load_acquire(&tx_ring->write_idx))
+ break;
buf_desc = &tx_ring->buf_desc[read_idx];
if (le32_to_cpu(buf_desc->ctl) & DMA_CTL_STATUS_OWN)
break;
@@ -733,7 +740,10 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
if (++read_idx == tx_ring->length)
read_idx = 0;
}
- WRITE_ONCE(tx_ring->read_idx, read_idx);
+ /* Be done with the slots before start_xmit() may reuse them; pairs
+ * with smp_load_acquire() in bcm4908_enet_tx_free_descs()
+ */
+ smp_store_release(&tx_ring->read_idx, read_idx);
enet->netdev->stats.tx_packets += handled;
enet->netdev->stats.tx_bytes += bytes;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 190/703] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (186 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 189/703] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 191/703] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state Greg Kroah-Hartman
` (219 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Terrence Adams, Bart Van Assche,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terrence Adams <tadamsjr@google.com>
[ Upstream commit 3ad578b22f7a34a2391ca8910dfc931b01cc94f6 ]
When MSI-X interrupt vectors are configured in pm8001_setup_msix(), the
driver requests vector affinity with .pre_vectors = 1 to reserve Vector 0
for non-affinitized housekeeping interrupts.
blk_mq_map_hw_queues() maps hardware queues (hwq 0 to nr_hw_queues - 1)
with an offset of 1, mapping hwq 0 to Vector 1, hwq 1 to Vector 2, etc.
However, pm80xx_chip_get_q_index() retrieves the queue index directly from
blk_mq_unique_tag_to_hwq(tag) without adding 1 for the pre-vector
offset. Consequently, commands on hwq 0 are issued with responseQueue 0
(firing unmanaged Vector 0 on CPU 0), while hwq k fires Vector k (the CPU
affinitized to hwq k-1).
This results in 100% of I/O completion interrupts being delivered to the
wrong CPU core, causing heavy cross-CPU IPIs, cache line bouncing, and
increased kernel and IRQ CPU processing overhead.
Define PM8001_PRE_VECTORS for the reserved housekeeping vector and use it
consistently across MSI-X vector allocation, hardware queue setup and
mapping, and queue index lookup. Update pm80xx_chip_get_q_index() to accept
pm8001_ha and add PM8001_PRE_VECTORS to blk_mq_unique_tag_to_hwq() whenever
multi-queue is enabled (number_of_intr > PM8001_PRE_VECTORS), routing
completion interrupts to their affinitized CPU cores.
Note that offsetting completions by PM8001_PRE_VECTORS routes the highest
hardware queue to outbound queue max_q_num - 1, which pm80xx_chip_init()
also programs as the fatal error interrupt vector. As a result,
process_oq() now reads MSGU_SCRATCH_PAD_1 (and MSGU_SCRATCH_PAD_RSVD_0 when
no fatal error is reported) on every interrupt for that queue, matching the
behavior before commit 42f22fe36d51 ("scsi: pm8001: Expose hardware queues
for pm80xx").
Fixes: 42f22fe36d51 ("scsi: pm8001: Expose hardware queues for pm80xx")
Signed-off-by: Terrence Adams <tadamsjr@google.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20261118180344.1159617-1-tadamsjr@google.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/pm8001/pm8001_defs.h | 1 +
drivers/scsi/pm8001/pm8001_init.c | 15 +++++++++------
drivers/scsi/pm8001/pm80xx_hwi.c | 13 +++++++++----
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_defs.h b/drivers/scsi/pm8001/pm8001_defs.h
index a9605ca317f34..9b37a76d8b744 100644
--- a/drivers/scsi/pm8001/pm8001_defs.h
+++ b/drivers/scsi/pm8001/pm8001_defs.h
@@ -178,6 +178,7 @@ enum port_type {
#define PM8001_MAX_INB_NUM 64
#define PM8001_MAX_OUTB_NUM 64
#define PM8001_CAN_QUEUE 508 /* SCSI Queue depth */
+#define PM8001_PRE_VECTORS 1 /* non-affinitized housekeeping vector */
/* Inbound/Outbound queue size */
#define IOMB_SIZE_SPC 64
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 10649b306912d..cec6d573c95d2 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -104,8 +104,9 @@ static void pm8001_map_queues(struct Scsi_Host *shost)
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
- if (pm8001_ha->number_of_intr > 1) {
- blk_mq_map_hw_queues(qmap, &pm8001_ha->pdev->dev, 1);
+ if (pm8001_ha->number_of_intr > PM8001_PRE_VECTORS) {
+ blk_mq_map_hw_queues(qmap, &pm8001_ha->pdev->dev,
+ PM8001_PRE_VECTORS);
return;
}
@@ -977,10 +978,11 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
* include in the affinity spreading.
*/
struct irq_affinity desc = {
- .pre_vectors = 1,
+ .pre_vectors = PM8001_PRE_VECTORS,
};
rc = pci_alloc_irq_vectors_affinity(
- pm8001_ha->pdev, 2, PM8001_MAX_MSIX_VEC,
+ pm8001_ha->pdev, PM8001_PRE_VECTORS + 1,
+ PM8001_MAX_MSIX_VEC,
PCI_IRQ_MSIX | PCI_IRQ_AFFINITY, &desc);
}
@@ -1183,8 +1185,9 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
PM8001_CHIP_DISP->chip_post_init(pm8001_ha);
- if (pm8001_ha->number_of_intr > 1) {
- shost->nr_hw_queues = pm8001_ha->number_of_intr - 1;
+ if (pm8001_ha->number_of_intr > PM8001_PRE_VECTORS) {
+ shost->nr_hw_queues = pm8001_ha->number_of_intr -
+ PM8001_PRE_VECTORS;
/*
* For now, ensure we're not sent too many commands by setting
* host_tagset. This is also required if we start using request
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c
index ecbf3c32e948d..a82cf2a95d8ae 100644
--- a/drivers/scsi/pm8001/pm80xx_hwi.c
+++ b/drivers/scsi/pm8001/pm80xx_hwi.c
@@ -4326,14 +4326,19 @@ static int check_enc_sat_cmd(struct sas_task *task)
return ret;
}
-static u32 pm80xx_chip_get_q_index(struct sas_task *task)
+static u32 pm80xx_chip_get_q_index(struct pm8001_hba_info *pm8001_ha,
+ struct sas_task *task)
{
struct request *rq = sas_task_find_rq(task);
if (!rq)
return 0;
- return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(rq));
+ if (pm8001_ha->number_of_intr > PM8001_PRE_VECTORS)
+ return blk_mq_unique_tag_to_hwq(blk_mq_unique_tag(rq)) +
+ PM8001_PRE_VECTORS;
+
+ return 0;
}
/**
@@ -4369,7 +4374,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7);
memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
task->ssp_task.cmd->cmd_len);
- q_index = pm80xx_chip_get_q_index(task);
+ q_index = pm80xx_chip_get_q_index(pm8001_ha, task);
/* Check if encryption is set */
if (pm8001_ha->chip->encrypt &&
@@ -4508,7 +4513,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
u32 opc = OPC_INB_SATA_HOST_OPSTART;
memset(&sata_cmd, 0, sizeof(sata_cmd));
- q_index = pm80xx_chip_get_q_index(task);
+ q_index = pm80xx_chip_get_q_index(pm8001_ha, task);
if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) {
ATAP = 0x04; /* no data*/
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 191/703] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (187 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 190/703] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 192/703] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Greg Kroah-Hartman
` (218 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tariq Toukan, Gal Pressman,
Cosmin Ratiu, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <tariqt@nvidia.com>
[ Upstream commit e421df3c838692c0c3503768ec3c9183f6df77aa ]
HW-GRO (SHAMPO) sessions are not terminated by HW when the kTLS RX
offload indication in the CQE changes. The driver applies the offload
metadata of the first packet in the session only, so ciphertext and
plaintext can end up in the same skb under a single skb->decrypted
indication, and resync requests carried by non-first packets are lost.
Do not merge a CQE whose decryption state differs from skb->decrypted,
which the first packet of the session sets. Never merge a CQE that
carries a resync request or a TLS error, so that each of them starts a
session and is handled.
The failure was reproduced on ConnectX-7 with HW GRO and kTLS RX offload
on and 0.3% loss added by netem on the sender's egress: TlsDecryptError
increased and the receiving sockets failed with EBADMSG. With this
patch, TlsDecryptError stays 0.
Fixes: 92552d3abd32 ("net/mlx5e: HW_GRO cqe handler implementation")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Link: https://patch.msgid.link/20261118144042.1916204-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mellanox/mlx5/core/en_accel/en_accel.h | 5 +++--
.../mellanox/mlx5/core/en_accel/ktls_txrx.h | 21 +++++++++++++++++++
.../net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +-
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
index a276abebfb016..cde72fa7ba002 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
@@ -236,9 +236,10 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq,
}
static inline bool
-mlx5e_accel_shampo_can_merge(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
+mlx5e_accel_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
{
- return mlx5e_psp_shampo_can_merge(rq->hw_gro_data->skb, cqe);
+ return mlx5e_psp_shampo_can_merge(skb, cqe) &&
+ mlx5e_ktls_shampo_can_merge(skb, cqe);
}
static inline int mlx5e_accel_init_rx(struct mlx5e_priv *priv)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
index cb08799769ee1..a65dc7604d65a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h
@@ -59,6 +59,21 @@ mlx5e_ktls_handle_tx_wqe(struct mlx5_wqe_ctrl_seg *cseg,
{
cseg->tis_tir_num = cpu_to_be32(state->tls_tisn << 8);
}
+
+/* The first CQE of a HW-GRO session sets skb->decrypted. A resync request or
+ * a TLS error is handled on the first CQE only, so it starts a new session.
+ */
+static inline bool
+mlx5e_ktls_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
+{
+ u8 tls_offload = get_cqe_tls_offload(cqe);
+
+ if (unlikely(tls_offload > CQE_TLS_OFFLOAD_DECRYPTED))
+ return false;
+
+ return (tls_offload == CQE_TLS_OFFLOAD_DECRYPTED) ==
+ skb_is_decrypted(skb);
+}
#else
static inline bool
mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
@@ -92,6 +107,12 @@ static inline void mlx5e_ktls_handle_rx_skb(struct mlx5e_rq *rq,
u32 *cqe_bcnt)
{
}
+
+static inline bool
+mlx5e_ktls_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe)
+{
+ return true;
+}
#endif /* CONFIG_MLX5_EN_TLS */
#endif /* __MLX5E_TLS_TXRX_H__ */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index b651b28dd2ed3..fdc3aa1c2f6b9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -2415,7 +2415,7 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq
if (*skb &&
!(match &&
mlx5e_hw_gro_skb_has_enough_space(*skb, data_bcnt, page_size) &&
- mlx5e_accel_shampo_can_merge(rq, cqe))) {
+ mlx5e_accel_shampo_can_merge(*skb, cqe))) {
match = false;
mlx5e_shampo_flush_skb(rq, cqe, match);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 192/703] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (188 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 191/703] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 193/703] tcp: accecn: initialize AccECN fields in syncookie path Greg Kroah-Hartman
` (217 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thaison Phan, Eric Dumazet,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thaison Phan <thaisonphan@google.com>
[ Upstream commit 7411fb1929075884648e9db0b9ec7e424c095185 ]
Commit a3a128f611a9 ("inet: consolidate inet_csk_clone_lock()") moved
the LOOPBACK4_IPV6 initialization for passive IPv6 TCP sockets from
tcp_v6_syn_recv_sock() to tcp_v6_init_req().
IPv6 SYN cookie connections allocate a fresh request_sock without
__GFP_ZERO and call tcp_v6_syn_recv_sock() without tcp_v6_init_req(),
leaving ireq->ir_rmt_addr and ireq->ir_loc_addr uninitialized in
cookie_v6_check(). inet_csk_clone_lock() then copies uninitialized slab
bytes into sk_daddr, sk_rcv_saddr, and inet_saddr, exposing them to
tracepoints and bpf_sock and causing inet_daddr != LOOPBACK4_IPV6 checks
(such as IP_OPTIONS in do_ip_setsockopt()) to misclassify native IPv6
child sockets as IPv4-mapped.
This was originally noticed via an out-of-tree socket hook observing
inet_sk(sk)->inet_saddr != LOOPBACK4_IPV6 on KASAN test runs. KASAN
enables SLUB_RCU_DEBUG by default, introducing an RCU grace period that
prevents cookie_v6_check() from reusing the warm request_sock initialized
during the initial SYN. Upstream, with tcp_syncookies=2,
SLUB_RCU_DEBUG=y, and slub_debug=P, sock:inet_sock_set_state shows slab
poison instead of 127.0.0.6:
... sock:inet_sock_set_state: family=AF_INET6 protocol=IPPROTO_TCP \
sport=59839 dport=41050 \
saddr=90.90.90.90 daddr=90.90.90.90 \
saddrv6=::1 daddrv6=::1 \
oldstate=TCP_LISTEN newstate=TCP_SYN_RECV
Initialize ireq->ir_rmt_addr and ireq->ir_loc_addr to LOOPBACK4_IPV6 in
cookie_v6_check() to match tcp_v6_init_req(). Tested against a QEMU
reproducer checking inet_sock_set_state and IP_OPTIONS, as well as the
packetdrill syncookie selftests.
Fixes: a3a128f611a9 ("inet: consolidate inet_csk_clone_lock()")
Signed-off-by: Thaison Phan <thaisonphan@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261118210933.2477423-2-thaisonphan@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/syncookies.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 4f6f0d751d6c5..e0758a6a6a8f7 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -17,6 +17,7 @@
#include <net/ipv6.h>
#include <net/tcp.h>
#include <net/tcp_ecn.h>
+#include <net/transp_v6.h>
#define COOKIEBITS 24 /* Upper bits store count */
#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
@@ -205,6 +206,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
+ ireq->ir_rmt_addr = LOOPBACK4_IPV6;
+ ireq->ir_loc_addr = LOOPBACK4_IPV6;
if (security_inet_conn_request(sk, skb, req)) {
SKB_DR_SET(reason, SECURITY_HOOK);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 193/703] tcp: accecn: initialize AccECN fields in syncookie path
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (189 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 192/703] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 194/703] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
` (216 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thaison Phan, Matthieu Baerts (NGI0),
Eric Dumazet, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thaison Phan <thaisonphan@google.com>
[ Upstream commit ce28b1a4d137842e428a578269c35d6c84109438 ]
cookie_tcp_reqsk_alloc() and bpf_sk_assign_tcp_reqsk() allocate struct
request_sock without __GFP_ZERO, leaving saw_accecn_opt,
accecn_fail_mode, syn_ect_rcv, and syn_ect_snt uninitialized. When
accecn_ok is negotiated in cookie_{v4,v6}_check(),
tcp_ecn_openreq_child() reads all four fields to initialize the child
socket's AccECN state.
In addition, because the temporary request_sock used to send a cookie
SYN-ACK is immediately freed, treq->syn_ect_snt is lost. For AccECN
connections where the listener marks ECT on the SYN-ACK, leaving
syn_ect_snt as 0 causes tcp_accecn_third_ack() to see a mismatch between
the expected Not-ECT and the peer's reflected ECT in the ACE field,
erroneously flagging TCP_ACCECN_ACE_FAIL_RECV in accecn_fail_mode. Refer
to Table 4 of RFC 9768 for more details.
Initialize the AccECN fields in cookie_tcp_reqsk_init() to match
tcp_openreq_init(). For kernel-generated cookies (!req->syncookie), set
syn_ect_snt from the listener's TOS/tclass in cookie_{v4,v6}_check() to
match tcp_{v4,v6}_send_synack(); for BPF custom syncookies
(req->syncookie), leave syn_ect_snt at 0 (Not-ECT) since the SYN-ACK was
built by the BPF program rather than the kernel and bpf_tcp_req_attrs
does not report the SYN-ACK ECN codepoint.
Found by AI-assisted code inspection comparing tcp_openreq_init() and
cookie_tcp_reqsk_init() while investigating the cookie_v6_check()
LOOPBACK4_IPV6 bug. Reproduced in a QEMU VM with tcp_syncookies=2,
tcp_ecn=3, SLUB_RCU_DEBUG=y, and slub_debug=P, observing bogus
tcpi_accecn_fail_mode and tcpi_accecn_opt_seen values in TCP_INFO on the
accepted child socket (and tcpi_accecn_fail_mode=0x2 on ECT(0)
listeners), and tested with packetdrill AccECN and syncookie selftests.
Fixes: 3cae34274c79 ("tcp: accecn: AccECN negotiation")
Fixes: b40671b5ee58 ("tcp: accecn: AccECN option failure handling")
Signed-off-by: Thaison Phan <thaisonphan@google.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261118210933.2477423-3-thaisonphan@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/syncookies.c | 7 +++++++
net/ipv6/syncookies.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 39dd078cd7034..9fb7e850430e9 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -288,6 +288,10 @@ static int cookie_tcp_reqsk_init(struct sock *sk, struct sk_buff *skb,
treq->rcv_isn = ntohl(th->seq) - 1;
treq->snt_isn = ntohl(th->ack_seq) - 1;
treq->syn_tos = TCP_SKB_CB(skb)->ip_dsfield;
+ treq->saw_accecn_opt = TCP_ACCECN_OPT_NOT_SEEN;
+ treq->accecn_fail_mode = 0;
+ treq->syn_ect_rcv = 0;
+ treq->syn_ect_snt = 0;
#if IS_ENABLED(CONFIG_MPTCP)
treq->is_mptcp = sk_is_mptcp(sk);
@@ -502,6 +506,9 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
ireq->rcv_wscale = rcv_wscale;
ireq->ecn_ok &= cookie_ecn_ok(net, &rt->dst);
treq->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th);
+ /* SYN-ACK was not sent by the kernel if req->syncookie is set. */
+ if (!req->syncookie)
+ treq->syn_ect_snt = READ_ONCE(inet_sk(sk)->tos) & INET_ECN_MASK;
ret = tcp_get_cookie_sock(sk, skb, req, &rt->dst);
/* ip_queue_xmit() depends on our flow being setup
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index e0758a6a6a8f7..f3c6ba3f8457d 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -274,6 +274,9 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
ireq->rcv_wscale = rcv_wscale;
ireq->ecn_ok &= cookie_ecn_ok(net, dst);
tcp_rsk(req)->accecn_ok = ireq->ecn_ok && cookie_accecn_ok(th);
+ /* SYN-ACK was not sent by the kernel if req->syncookie is set. */
+ if (!req->syncookie)
+ tcp_rsk(req)->syn_ect_snt = READ_ONCE(np->tclass) & INET_ECN_MASK;
ret = tcp_get_cookie_sock(sk, skb, req, dst);
if (!ret) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 194/703] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (190 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 193/703] tcp: accecn: initialize AccECN fields in syncookie path Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 195/703] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
` (215 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiangwu Lai, Frank Li,
Amelie Delaunay, Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
[ Upstream commit 34c8c2ea213aab7b452df93e5b7547f4459a49e9 ]
stm32_mdma_pm_suspend() increments the runtime PM usage counter with
pm_runtime_resume_and_get(), but when a channel is still enabled it
returns -EBUSY directly without dropping the reference. The matching
pm_runtime_put_sync() only runs on the success path.
Each failed suspend attempt therefore leaks one runtime PM reference,
so the device can never runtime suspend afterwards. Drop the
reference before returning -EBUSY.
Fixes: 7cb819c856d9 ("dmaengine: stm32-mdma: add suspend/resume power management support")
Signed-off-by: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/20261102104432.873-1-laixiangwu@cmss.chinamobile.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/stm32/stm32-mdma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
index b87d41b234df1..1811c59949d0e 100644
--- a/drivers/dma/stm32/stm32-mdma.c
+++ b/drivers/dma/stm32/stm32-mdma.c
@@ -1785,6 +1785,7 @@ static int stm32_mdma_pm_suspend(struct device *dev)
ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(id));
if (ccr & STM32_MDMA_CCR_EN) {
dev_warn(dev, "Suspend is prevented by Chan %i\n", id);
+ pm_runtime_put_sync(dev);
return -EBUSY;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 195/703] dmaengine: idxd: Free the minor number when cdev setup fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (191 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 194/703] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 196/703] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
` (214 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, SeungUk Nam, Frank Li, Vinod Koul,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeungUk Nam <tmddnr49449@gmail.com>
[ Upstream commit 56cbd7f69ce6037738410a5c50efb7cacf52b0ae ]
idxd_wq_add_cdev() allocates a minor number from cdev_ctx->minor_ida for
the new struct idxd_cdev. When dev_set_name() or cdev_device_add()
fails, the error path calls put_device(), and the release callback
idxd_cdev_dev_release() only frees idxd_cdev, so the minor number is
never returned to the ida. Leaked numbers accumulate across bind/unbind
cycles, up to MINORMASK, for as long as the module stays loaded.
Free the minor number before put_device() drops the last reference on
that path.
Fixes: c311f5e92484 ("dmaengine: idxd: Fix freeing the allocated ida too late")
Signed-off-by: SeungUk Nam <tmddnr49449@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260910074832.15729-1-tmddnr49449@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/idxd/cdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
index 37addcdc10bc2..4c7de92a12823 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -573,6 +573,7 @@ int idxd_wq_add_cdev(struct idxd_wq *wq)
return 0;
err:
+ ida_free(&cdev_ctx->minor_ida, minor);
put_device(dev);
wq->idxd_cdev = NULL;
return rc;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 196/703] dmaengine: rcar-dmac: Fix PM usage counter imbalance
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (192 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 195/703] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 197/703] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
` (213 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhang Shurong, Geert Uytterhoeven,
Frank Li, Laurent Pinchart, Wolfram Sang, Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <zhang_shurong@foxmail.com>
[ Upstream commit d3c108c095712a3b7eab292ef7ea9a57ff5cd5d7 ]
pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here. We
fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.
Fixes: 87244fe5abdf ("dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://patch.msgid.link/20261012123020.11320-6-wsa+renesas@sang-engineering.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/sh/rcar-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 0c45ce8c74aa2..c1ce3b0ae74da 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1068,7 +1068,7 @@ static int rcar_dmac_alloc_chan_resources(struct dma_chan *chan)
if (ret < 0)
return -ENOMEM;
- return pm_runtime_get_sync(chan->device->dev);
+ return pm_runtime_resume_and_get(chan->device->dev);
}
static void rcar_dmac_free_chan_resources(struct dma_chan *chan)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 197/703] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (193 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 196/703] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 198/703] usb: gadget: f_hid: fix report_list entries leak Greg Kroah-Hartman
` (212 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Koichiro Den, Wolfram Sang, Frank Li,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <den@valinux.co.jp>
[ Upstream commit 0ca154b10168d8874b871edf5510640c51b326c3 ]
Call dma_descriptor_unmap() right before dma_cookie_complete() in the
threaded IRQ completion path. Without this, streaming DMA mappings
attached to the descriptor are never released and may eventually exhaust
DMA mapping resources (e.g. IOVA with an IOMMU or bounce-buffer slots
with SWIOTLB), leading to dma_map_* failures.
Also ensure dma_descriptor_unmap() is called in rcar_dmac_chan_reinit()
(error/terminate path) to avoid the same type of leaks.
Fixes: 87244fe5abdf ("dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver")
Signed-off-by: Koichiro Den <den@valinux.co.jp>
[wsa: moved unmap before cookie completion, added Fixes tag]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20261012123020.11320-7-wsa+renesas@sang-engineering.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/sh/rcar-dmac.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index c1ce3b0ae74da..27536d669e151 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -842,6 +842,7 @@ static void rcar_dmac_chan_reinit(struct rcar_dmac_chan *chan)
list_for_each_entry_safe(desc, _desc, &descs, node) {
list_del(&desc->node);
+ dma_descriptor_unmap(&desc->async_tx);
rcar_dmac_desc_put(chan, desc);
}
}
@@ -1651,6 +1652,7 @@ static irqreturn_t rcar_dmac_isr_channel_thread(int irq, void *dev)
while (!list_empty(&chan->desc.done)) {
desc = list_first_entry(&chan->desc.done, struct rcar_dmac_desc,
node);
+ dma_descriptor_unmap(&desc->async_tx);
dma_cookie_complete(&desc->async_tx);
list_del(&desc->node);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 198/703] usb: gadget: f_hid: fix report_list entries leak
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (194 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 197/703] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 199/703] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response Greg Kroah-Hartman
` (211 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shunbo Shi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunbo Shi <shishunbo@cmss.chinamobile.com>
[ Upstream commit 19e8981057fb5947697f99a3c6a3f6ff4a2d85a1 ]
Each GADGET_HID_WRITE_GET_REPORT ioctl for a report ID that is not
yet in hidg->report_list allocates a report_entry and adds it to
the list. hidg_release() frees report_desc and set_report_buf, but
never walks report_list, so every accumulated entry leaks on
function destroy (e.g. when the HID gadget is unbound and the
device is removed).
Free the entries in hidg_release(). This is safe without extra
locking: at release time the function is unbound (the workqueue is
already destroyed and userspace has no way to reach the ioctl).
Fixes: a139c98f760e ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
Signed-off-by: Shunbo Shi <shishunbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261117125051.5646-2-shishunbo@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/f_hid.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 4fe9c38dd2cab..a2c705c730ec2 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -121,6 +121,12 @@ static inline struct f_hidg *func_to_hidg(struct usb_function *f)
static void hidg_release(struct device *dev)
{
struct f_hidg *hidg = container_of(dev, struct f_hidg, dev);
+ struct report_entry *entry, *tmp;
+
+ list_for_each_entry_safe(entry, tmp, &hidg->report_list, node) {
+ list_del(&entry->node);
+ kfree(entry);
+ }
kfree(hidg->report_desc);
kfree(hidg->set_report_buf);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 199/703] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (195 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 198/703] usb: gadget: f_hid: fix report_list entries leak Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 200/703] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails Greg Kroah-Hartman
` (210 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shunbo Shi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunbo Shi <shishunbo@cmss.chinamobile.com>
[ Upstream commit 07ec204e8aecbfee425008832b18d5d720daca6d ]
The GET_REPORT response is served by pointing get_req->buf at the
data[] array of a report_list entry and calling usb_ep_queue().
The request completes asynchronously, so the controller may still
be reading the entry's buffer after get_report_workqueue_handler()
drops get_report_spinlock.
At the same time, userspace can update that same entry via the
GADGET_HID_WRITE_GET_REPORT ioctl: f_hidg_get_report() copies new
report data into the entry while holding the spinlock, but the
transfer reading the entry is not serialized against that update
(the lock was already released by the work handler).
The result is that the host can receive a GET_REPORT response that
mixes bytes of the old and the new report (a torn write), with no
memory-safety violation but corrupted report data on the wire.
Serve the response from a dedicated buffer allocated once in
hidg_alloc() and freed in hidg_release().
This also removes the now unused get_report member from struct
f_hidg.
Fixes: a139c98f760e ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
Signed-off-by: Shunbo Shi <shishunbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261117125051.5646-3-shishunbo@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/f_hid.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index a2c705c730ec2..a31ab0624745c 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -94,7 +94,7 @@ struct f_hidg {
/* get report */
struct usb_request *get_req;
- struct usb_hidg_report get_report;
+ void *get_req_buf;
bool get_report_returned;
int get_report_req_report_id;
int get_report_req_report_length;
@@ -128,6 +128,7 @@ static void hidg_release(struct device *dev)
kfree(entry);
}
+ kfree(hidg->get_req_buf);
kfree(hidg->report_desc);
kfree(hidg->set_report_buf);
kfree(hidg);
@@ -587,7 +588,7 @@ static void get_report_workqueue_handler(struct work_struct *work)
ptr = f_hidg_search_for_report(hidg, hidg->get_report_req_report_id);
if (ptr && !ptr->report_data.userspace_req) {
/* Report exists in list and it is to be used for immediate response */
- req->buf = ptr->report_data.data;
+ memcpy(req->buf, ptr->report_data.data, req->length);
status = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
hidg->get_report_returned = true;
spin_unlock_irqrestore(&hidg->get_report_spinlock, flags);
@@ -622,10 +623,9 @@ static void get_report_workqueue_handler(struct work_struct *work)
* Either get an updated response just serviced by userspace
* or send the latest response in the list
*/
- req->buf = ptr->report_data.data;
+ memcpy(req->buf, ptr->report_data.data, req->length);
} else {
/* If there are no prevoiusly sent reports send empty report */
- req->buf = hidg->get_report.data;
memset(req->buf, 0x0, req->length);
}
@@ -1161,6 +1161,15 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
if (!hidg->get_req)
return -ENOMEM;
+ /*
+ * The GET_REPORT response is served from a dedicated buffer
+ * (allocated in hidg_alloc()), not from the report_list
+ * entries: userspace may update an entry while the controller
+ * is still reading the previous response, which would corrupt
+ * the data on the wire.
+ */
+ hidg->get_req->buf = hidg->get_req_buf;
+
hidg->get_req->zero = 0;
hidg->get_req->complete = hidg_get_report_complete;
hidg->get_req->context = hidg;
@@ -1648,6 +1657,18 @@ static struct usb_function *hidg_alloc(struct usb_function_instance *fi)
}
hidg->use_out_ep = !opts->no_out_endpoint;
+ /*
+ * Dedicated buffer for GET_REPORT responses, allocated once for
+ * the whole lifetime of this function instance: hidg_release()
+ * is the only safe free point, as it runs after all USB
+ * activity has ceased and all file references are gone.
+ */
+ hidg->get_req_buf = kmalloc(MAX_REPORT_LENGTH, GFP_KERNEL);
+ if (!hidg->get_req_buf) {
+ ret = -ENOMEM;
+ goto err_put_device;
+ }
+
++opts->refcnt;
mutex_unlock(&opts->lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 200/703] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (196 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 199/703] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 201/703] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
` (209 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shunbo Shi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunbo Shi <shishunbo@cmss.chinamobile.com>
[ Upstream commit f11175ece1250557ec595ea7a2854f0391cab53d ]
In hidg_bind(), hidg->get_req is allocated early; if
usb_gstrings_attach() subsequently fails, the function returns
directly without freeing the request, leaking it. Unwind through
the fail path instead.
Fixes: a139c98f760e ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
Signed-off-by: Shunbo Shi <shishunbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261117125051.5646-4-shishunbo@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/gadget/function/f_hid.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index a31ab0624745c..db243f3d688e0 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -1178,8 +1178,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
/* maybe allocate device-global string IDs, and patch descriptors */
us = usb_gstrings_attach(c->cdev, ct_func_strings,
ARRAY_SIZE(ct_func_string_defs));
- if (IS_ERR(us))
- return PTR_ERR(us);
+ if (IS_ERR(us)) {
+ status = PTR_ERR(us);
+ goto fail;
+ }
hidg_interface_desc.iInterface = us[CT_FUNC_HID_IDX].id;
/* allocate instance-specific interface IDs, and patch descriptors */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 201/703] HID: sensor: custom: Fix state lifetime during removal
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (197 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 200/703] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 202/703] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
` (208 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit ac6c19392c7996ac8135dba6907c391a4be5beaf ]
Open misc device files can outlive platform-device removal. Since the
devm-allocated state can be freed while a reader is queued on its wait
queue, subsequent file operations may access freed memory.
Allocate the state independently of devres and give every open
file a reference to keep the FIFO and state alive after removal.
On removal, mark the device as disconnected and wake readers; make reads
return -ENODEV and polls report hangup and error. Free the FIFO and state
when the final reference is released. Unregister the sensor hub callback
before tearing down the interface so in-flight raw-event processing
finishes before the sensor state can be freed.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 82 ++++++++++++++++++++++-----------
1 file changed, 56 insertions(+), 26 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 2aa71530a1a30..0ec4f06a1fbac 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/kfifo.h>
+#include <linux/kref.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/poll.h>
@@ -37,6 +38,8 @@ struct hid_sensor_custom_field {
struct hid_sensor_custom {
struct mutex mutex;
+ struct kref ref;
+ bool removed;
struct platform_device *pdev;
struct hid_sensor_hub_device *hsdev;
struct hid_sensor_hub_callbacks callbacks;
@@ -643,6 +646,15 @@ static void hid_sensor_custom_remove_attributes(struct hid_sensor_custom *
kfree(sensor_inst->fields);
}
+static void hid_sensor_custom_free(struct kref *ref)
+{
+ struct hid_sensor_custom *sensor_inst =
+ container_of(ref, struct hid_sensor_custom, ref);
+
+ kfifo_free(&sensor_inst->data_fifo);
+ kfree(sensor_inst);
+}
+
static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
size_t count, loff_t *f_ps)
{
@@ -656,22 +668,27 @@ static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
if (count < sizeof(struct hid_sensor_sample))
return -EINVAL;
- do {
- if (kfifo_is_empty(&sensor_inst->data_fifo)) {
- if (file->f_flags & O_NONBLOCK)
- return -EAGAIN;
+ for (;;) {
+ if (READ_ONCE(sensor_inst->removed))
+ return -ENODEV;
- ret = wait_event_interruptible(sensor_inst->wait,
- !kfifo_is_empty(&sensor_inst->data_fifo));
- if (ret)
- return ret;
- }
ret = kfifo_to_user(&sensor_inst->data_fifo, buf, count,
&copied);
+ if (ret || copied)
+ break;
+
+ if (file->f_flags & O_NONBLOCK)
+ return -EAGAIN;
+
+ ret = wait_event_interruptible(sensor_inst->wait,
+ READ_ONCE(sensor_inst->removed) ||
+ !kfifo_is_empty(&sensor_inst->data_fifo));
if (ret)
return ret;
+ }
- } while (copied == 0);
+ if (ret)
+ return ret;
return copied;
}
@@ -684,6 +701,7 @@ static int hid_sensor_custom_release(struct inode *inode, struct file *file)
struct hid_sensor_custom, custom_dev);
clear_bit(0, &sensor_inst->misc_opened);
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
return 0;
}
@@ -691,14 +709,25 @@ static int hid_sensor_custom_release(struct inode *inode, struct file *file)
static int hid_sensor_custom_open(struct inode *inode, struct file *file)
{
struct hid_sensor_custom *sensor_inst;
+ int ret;
sensor_inst = container_of(file->private_data,
struct hid_sensor_custom, custom_dev);
+ if (READ_ONCE(sensor_inst->removed))
+ return -ENODEV;
+
/* We essentially have single reader and writer */
if (test_and_set_bit(0, &sensor_inst->misc_opened))
return -EBUSY;
- return stream_open(inode, file);
+ kref_get(&sensor_inst->ref);
+ ret = stream_open(inode, file);
+ if (ret) {
+ clear_bit(0, &sensor_inst->misc_opened);
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
+ }
+
+ return ret;
}
static __poll_t hid_sensor_custom_poll(struct file *file,
@@ -712,6 +741,9 @@ static __poll_t hid_sensor_custom_poll(struct file *file,
poll_wait(file, &sensor_inst->wait, wait);
+ if (READ_ONCE(sensor_inst->removed))
+ return EPOLLHUP | EPOLLERR;
+
if (!kfifo_is_empty(&sensor_inst->data_fifo))
mask = EPOLLIN | EPOLLRDNORM;
@@ -741,21 +773,15 @@ static int hid_sensor_custom_dev_if_add(struct hid_sensor_custom *sensor_inst)
sensor_inst->custom_dev.minor = MISC_DYNAMIC_MINOR;
sensor_inst->custom_dev.name = dev_name(&sensor_inst->pdev->dev);
sensor_inst->custom_dev.fops = &hid_sensor_custom_fops;
- ret = misc_register(&sensor_inst->custom_dev);
- if (ret) {
- kfifo_free(&sensor_inst->data_fifo);
- return ret;
- }
- return 0;
+ return misc_register(&sensor_inst->custom_dev);
}
static void hid_sensor_custom_dev_if_remove(struct hid_sensor_custom
*sensor_inst)
{
- wake_up(&sensor_inst->wait);
+ WRITE_ONCE(sensor_inst->removed, true);
+ wake_up_interruptible_all(&sensor_inst->wait);
misc_deregister(&sensor_inst->custom_dev);
- kfifo_free(&sensor_inst->data_fifo);
-
}
/*
@@ -978,8 +1004,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
int ret;
const struct hid_sensor_custom_match *match;
- sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
- GFP_KERNEL);
+ sensor_inst = kzalloc(sizeof(*sensor_inst), GFP_KERNEL);
if (!sensor_inst)
return -ENOMEM;
@@ -989,6 +1014,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
sensor_inst->hsdev = hsdev;
sensor_inst->pdev = pdev;
mutex_init(&sensor_inst->mutex);
+ kref_init(&sensor_inst->ref);
platform_set_drvdata(pdev, sensor_inst);
ret = hid_sensor_custom_get_known(hsdev, &match);
@@ -1000,7 +1026,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"register_platform_device failed\n");
- return ret;
+ goto err_put;
}
return 0;
@@ -1010,7 +1036,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
&sensor_inst->callbacks);
if (ret < 0) {
dev_err(&pdev->dev, "callback reg failed\n");
- return ret;
+ goto err_put;
}
ret = hid_sensor_custom_add_attributes(sensor_inst);
@@ -1035,6 +1061,8 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
hid_sensor_custom_remove_attributes(sensor_inst);
err_remove_callback:
sensor_hub_remove_callback(hsdev, hsdev->usage);
+err_put:
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
return ret;
}
@@ -1046,9 +1074,10 @@ static void hid_sensor_custom_remove(struct platform_device *pdev)
if (sensor_inst->custom_pdev) {
platform_device_unregister(sensor_inst->custom_pdev);
- return;
+ goto out;
}
+ sensor_hub_remove_callback(hsdev, hsdev->usage);
hid_sensor_custom_dev_if_remove(sensor_inst);
/* Remove enable_sensor first as it uses fields via power_state/report_state. */
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
@@ -1061,7 +1090,8 @@ static void hid_sensor_custom_remove(struct platform_device *pdev)
}
mutex_unlock(&sensor_inst->mutex);
hid_sensor_custom_remove_attributes(sensor_inst);
- sensor_hub_remove_callback(hsdev, hsdev->usage);
+out:
+ kref_put(&sensor_inst->ref, hid_sensor_custom_free);
}
static const struct platform_device_id hid_sensor_custom_ids[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 202/703] HID: sensor: custom: Serialize misc device reads
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (198 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 201/703] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 203/703] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
` (207 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit fecb7895fbb1b7891e81a033f0dd1f5f7876dc07 ]
The misc device permits only one open file, but threads sharing that
file can still read concurrently. Serialize readers to preserve the
single-reader assumption of the FIFO while keeping removal independent
of a stalled user copy.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 0ec4f06a1fbac..0dea0bf059807 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -38,6 +38,7 @@ struct hid_sensor_custom_field {
struct hid_sensor_custom {
struct mutex mutex;
+ struct mutex read_mutex;
struct kref ref;
bool removed;
struct platform_device *pdev;
@@ -668,25 +669,39 @@ static ssize_t hid_sensor_custom_read(struct file *file, char __user *buf,
if (count < sizeof(struct hid_sensor_sample))
return -EINVAL;
+ if (file->f_flags & O_NONBLOCK) {
+ if (!mutex_trylock(&sensor_inst->read_mutex))
+ return -EAGAIN;
+ } else {
+ ret = mutex_lock_interruptible(&sensor_inst->read_mutex);
+ if (ret)
+ return ret;
+ }
+
for (;;) {
- if (READ_ONCE(sensor_inst->removed))
- return -ENODEV;
+ if (READ_ONCE(sensor_inst->removed)) {
+ ret = -ENODEV;
+ break;
+ }
ret = kfifo_to_user(&sensor_inst->data_fifo, buf, count,
&copied);
if (ret || copied)
break;
- if (file->f_flags & O_NONBLOCK)
- return -EAGAIN;
+ if (file->f_flags & O_NONBLOCK) {
+ ret = -EAGAIN;
+ break;
+ }
ret = wait_event_interruptible(sensor_inst->wait,
READ_ONCE(sensor_inst->removed) ||
!kfifo_is_empty(&sensor_inst->data_fifo));
if (ret)
- return ret;
+ break;
}
+ mutex_unlock(&sensor_inst->read_mutex);
if (ret)
return ret;
@@ -1014,6 +1029,7 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
sensor_inst->hsdev = hsdev;
sensor_inst->pdev = pdev;
mutex_init(&sensor_inst->mutex);
+ mutex_init(&sensor_inst->read_mutex);
kref_init(&sensor_inst->ref);
platform_set_drvdata(pdev, sensor_inst);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 203/703] HID: sensor: custom: Register enable attribute after misc device
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (199 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 202/703] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 204/703] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
` (206 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit c6ebe27e3ba09edf956139c741b38e8432be3f67 ]
Register the enable_sensor sysfs group only after misc-device setup
succeeds. This prevents userspace from opening the sensor hub while
probe can still fail, which would otherwise leave the hub open reference
unbalanced on unwind.
Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-custom.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 0dea0bf059807..ef311a677521e 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -1059,20 +1059,19 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
if (ret)
goto err_remove_callback;
- ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
- &enable_sensor_attr_group);
+ ret = hid_sensor_custom_dev_if_add(sensor_inst);
if (ret)
goto err_remove_attributes;
- ret = hid_sensor_custom_dev_if_add(sensor_inst);
+ ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj,
+ &enable_sensor_attr_group);
if (ret)
- goto err_remove_group;
+ goto err_remove_dev_if;
return 0;
-err_remove_group:
- sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
- &enable_sensor_attr_group);
+err_remove_dev_if:
+ hid_sensor_custom_dev_if_remove(sensor_inst);
err_remove_attributes:
hid_sensor_custom_remove_attributes(sensor_inst);
err_remove_callback:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 204/703] HID: sensor-hub: Remove clients before stopping hardware
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (200 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 203/703] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 205/703] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
` (205 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Semyon Maryasin, Zhang Lixu,
Srinivas Pandruvada, Jonathan Cameron, Jiri Kosina, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ Upstream commit 41cb3076a221afba052ae1624ccf62e500706b20 ]
Remove MFD clients before stopping the HID hardware so their close calls
remain valid. Runtime-PM teardown may cancel a pending autosuspend without
running the client suspend callback, leaving hub references after child
removal.
Clients share one HID open while ref_cnt is nonzero. After removing the
children, drain any remaining references and call hid_hw_close() once if
the count is nonzero. Then stop the HID hardware. This avoids both a
leaked open and the underflow caused by an unconditional close.
The pending-request walk runs before hid_hw_stop() disconnects HID-core
children such as hidraw. Skip non-platform children and platform children
without sensor-hub data before checking pending request state.
Fixes: 1df3a401154a ("HID: Delay opening HID device")
Reported-by: Semyon Maryasin <simeon@maryasin.name>
Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/
Tested-by: Semyon Maryasin <simeon@maryasin.name>
Tested-by: Zhang Lixu <lixu.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-sensor-hub.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 9f14439cc0788..e9eb32f15f091 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -10,6 +10,7 @@
#include <linux/slab.h>
#include <linux/mfd/core.h>
#include <linux/list.h>
+#include <linux/platform_device.h>
#include <linux/hid-sensor-ids.h>
#include <linux/hid-sensor-hub.h>
#include "hid-ids.h"
@@ -808,7 +809,14 @@ static int sensor_hub_probe(struct hid_device *hdev,
static int sensor_hub_finalize_pending_fn(struct device *dev, void *data)
{
- struct hid_sensor_hub_device *hsdev = dev->platform_data;
+ struct hid_sensor_hub_device *hsdev;
+
+ if (!dev_is_platform(dev))
+ return 0;
+
+ hsdev = to_platform_device(dev)->dev.platform_data;
+ if (!hsdev)
+ return 0;
if (hsdev->pending.status)
complete(&hsdev->pending.ready);
@@ -822,8 +830,6 @@ static void sensor_hub_remove(struct hid_device *hdev)
unsigned long flags;
hid_dbg(hdev, " hardware removed\n");
- hid_hw_close(hdev);
- hid_hw_stop(hdev);
spin_lock_irqsave(&data->lock, flags);
device_for_each_child(&hdev->dev, NULL,
@@ -831,6 +837,14 @@ static void sensor_hub_remove(struct hid_device *hdev)
spin_unlock_irqrestore(&data->lock, flags);
mfd_remove_devices(&hdev->dev);
+ /* Clients share one HID open; release it if references remain. */
+ mutex_lock(&data->mutex);
+ if (data->ref_cnt) {
+ data->ref_cnt = 0;
+ hid_hw_close(hdev);
+ }
+ mutex_unlock(&data->mutex);
+ hid_hw_stop(hdev);
mutex_destroy(&data->mutex);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 205/703] HID: letsketch: skip string descriptors the firmware does not implement
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (201 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 204/703] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 206/703] hid: intel-thc-hid: Select SGL_ALLOC Greg Kroah-Hartman
` (204 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eren Çakar, Hans de Goede,
Jiri Kosina, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eren Çakar <hey@erencakar.com>
[ Upstream commit f2f69bbddd34801cbf6af2e89235ca427f3811c5 ]
The Starcom GC-422 is a rebranded LetSketch WP9620C with the same USB
ID (6161:4d15), so it binds to this driver. Its firmware
("Vision_V201_180530") does not implement every string descriptor index
that the raw mode handshake reads. For those indices usb_string() keeps
returning an empty string or -EPIPE, letsketch_get_string() gives up
after its retries, and the probe fails:
letsketch ...: probe with driver letsketch failed with error -5
The tablet then does not work at all.
The handshake only needs the reads to happen, not their contents. Once
the retries are used up, report an index that still reads as empty or
STALLs as missing with -ENOENT, and let the probe skip it. Other errors
still fail the probe as before, and the retries stay in place, so
firmware that only fails a read now and then behaves as it did.
With this change the GC-422 completes the handshake, switches to raw
mode and reports pen position, pressure and the five pad buttons.
The change and this message were written with the help of an AI coding
assistant (Claude Code); I reviewed them and tested the result on the
hardware.
Fixes: 33a5c2793451 ("HID: Add new Letsketch tablet driver")
Signed-off-by: Eren Çakar <hey@erencakar.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-letsketch.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-letsketch.c b/drivers/hid/hid-letsketch.c
index b52e93a91ae54..6a93245b7ac1e 100644
--- a/drivers/hid/hid-letsketch.c
+++ b/drivers/hid/hid-letsketch.c
@@ -213,6 +213,12 @@ static int letsketch_raw_event(struct hid_device *hdev,
* string descriptors. But the firmware is buggy and does not like it if
* we do this too fast. Even if we go slow sometimes the usb_string() call
* fails. Ignore errors and retry it a couple of times if necessary.
+ *
+ * Some firmware revisions (e.g. "Vision_V201_180530", sold as the Starcom
+ * GC-422) do not implement every string descriptor index the handshake
+ * reads. For those indices usb_string() keeps returning an empty string or
+ * -EPIPE (STALL). Report such an index as missing with -ENOENT once the
+ * retries are used up, so that the caller can skip it.
*/
static int letsketch_get_string(struct usb_device *udev, int index, char *buf, int size)
{
@@ -225,9 +231,14 @@ static int letsketch_get_string(struct usb_device *udev, int index, char *buf, i
return 0;
}
+ if (ret == 0 || ret == -EPIPE) {
+ dev_dbg(&udev->dev, "String descriptor %d not implemented\n", index);
+ return -ENOENT;
+ }
+
dev_err(&udev->dev, "Max retries (%d) exceeded reading string descriptor %d\n",
LETSKETCH_GET_STRING_RETRIES, index);
- return ret ? ret : -EIO;
+ return ret;
}
static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -256,6 +267,8 @@ static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id *
*/
for (i = LETSKETCH_INFO_STR_IDX_BEGIN; i <= LETSKETCH_INFO_STR_IDX_END; i++) {
ret = letsketch_get_string(udev, i, buf, sizeof(buf));
+ if (ret == -ENOENT)
+ continue;
if (ret)
return ret;
@@ -264,16 +277,16 @@ static int letsketch_probe(struct hid_device *hdev, const struct hid_device_id *
for (i = 1; i <= 250; i++) {
ret = letsketch_get_string(udev, i, buf, sizeof(buf));
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
}
ret = letsketch_get_string(udev, 0x64, buf, sizeof(buf));
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
ret = letsketch_get_string(udev, LETSKETCH_INFO_STR_IDX_BEGIN, buf, sizeof(buf));
- if (ret)
+ if (ret && ret != -ENOENT)
return ret;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 206/703] hid: intel-thc-hid: Select SGL_ALLOC
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (202 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 205/703] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 207/703] HID: Intel-thc-hid: Fix REGMAP dependency Greg Kroah-Hartman
` (203 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tim Zimmermann, Even Xu,
Benjamin Tissoires, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Zimmermann <tim@linux4.de>
[ Upstream commit dd76788f9ec4f33f0f43838cac1304265d944328 ]
intel-thc-dma.c uses sgl_alloc() resulting in a build failure
if CONFIG_SGL_ALLOC is not enabled
Signed-off-by: Tim Zimmermann <tim@linux4.de>
Reviewed-by: Even Xu <even.xu@intel.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Stable-dep-of: 914d46521de1 ("HID: Intel-thc-hid: Fix REGMAP dependency")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/intel-thc-hid/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/intel-thc-hid/Kconfig b/drivers/hid/intel-thc-hid/Kconfig
index 0351d11376072..9d74e53b8c62b 100644
--- a/drivers/hid/intel-thc-hid/Kconfig
+++ b/drivers/hid/intel-thc-hid/Kconfig
@@ -7,6 +7,7 @@ menu "Intel THC HID Support"
config INTEL_THC_HID
tristate "Intel Touch Host Controller"
depends on ACPI
+ select SGL_ALLOC
help
THC (Touch Host Controller) is the name of the IP block in PCH that
interfaces with Touch Devices (ex: touchscreen, touchpad etc.). It
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 207/703] HID: Intel-thc-hid: Fix REGMAP dependency
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (203 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 206/703] hid: intel-thc-hid: Select SGL_ALLOC Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 208/703] HID: nintendo: release the player ID when LED setup fails Greg Kroah-Hartman
` (202 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mathias Krause, Even Xu, Jiri Kosina,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <minipli@grsecurity.net>
[ Upstream commit 914d46521de1bdd999fb4c6263172c13b2164218 ]
intel-thc-{dev,dma}.c make use of the regmap API and related data
structures, breaking the build if CONFIG_REGMAP isn't set.
Fix that by forcibly enabling REGMAP when this driver gets build.
Fixes: 1b2d05384c29 ("HID: intel-thc-hid: Add basic THC driver skeleton")
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Reviewed-by: Even Xu <even.xu@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/intel-thc-hid/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/intel-thc-hid/Kconfig b/drivers/hid/intel-thc-hid/Kconfig
index 9d74e53b8c62b..57a1e51cb512e 100644
--- a/drivers/hid/intel-thc-hid/Kconfig
+++ b/drivers/hid/intel-thc-hid/Kconfig
@@ -8,6 +8,7 @@ config INTEL_THC_HID
tristate "Intel Touch Host Controller"
depends on ACPI
select SGL_ALLOC
+ select REGMAP
help
THC (Touch Host Controller) is the name of the IP block in PCH that
interfaces with Touch Devices (ex: touchscreen, touchpad etc.). It
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 208/703] HID: nintendo: release the player ID when LED setup fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (204 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 207/703] HID: Intel-thc-hid: Fix REGMAP dependency Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 209/703] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
` (201 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Changyul Lee, Sang-Hoon Choi,
Jiri Kosina, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sang-Hoon Choi <csh0052@gmail.com>
[ Upstream commit 10bc1d627c297097cfdc099377f8a13efdfffd86 ]
joycon_leds_create() allocates a player ID before allocating the LED
names and registering the LEDs. If one of those later steps fails,
nintendo_hid_probe() jumps to err_io_stop and skips the ID cleanup.
The failed probe leaves the allocated ID in nintendo_player_id_allocator.
Use err_ida for this failure, as the power supply and input setup error
paths already do. If the ID allocation itself failed, player_id is
U32_MAX and ida_free() leaves the allocator untouched.
Fixes: 5307de63d71d ("HID: nintendo: use ida for LED player id")
Reported-by: Changyul Lee <lcy8047@gmail.com>
Assisted-by: LLM
Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/hid-nintendo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index 34642352b439d..e3db2e3531787 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -2698,7 +2698,7 @@ static int nintendo_hid_probe(struct hid_device *hdev,
ret = joycon_leds_create(ctlr);
if (ret) {
hid_err(hdev, "Failed to create leds; ret=%d\n", ret);
- goto err_io_stop;
+ goto err_ida;
}
/* Initialize the battery power supply */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 209/703] usb: cdns3: report endpoint reset timeout
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (205 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 208/703] HID: nintendo: release the player ID when LED setup fails Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 210/703] Bluetooth: MSFT: Record the filter state on Command Disallowed Greg Kroah-Hartman
` (200 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiale Yao, Peter Chen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
[ Upstream commit 8f51823de3c9184fd8b7a4430a030eb071f39dae ]
cdns3_gadget_ep_disable() discards the endpoint reset poll result and
then tests ret, which is still zero. A reset timeout is therefore
neither reported nor returned to the caller.
Store the poll result in ret so the existing diagnostic and return path
expose the timeout.
Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Add: stable@kernel.org
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://patch.msgid.link/20261003081152.433499-1-yaojiale02@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/cdns3/cdns3-gadget.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 331f10cc3fca8..29a69d6d09668 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -2530,9 +2530,9 @@ static int cdns3_gadget_ep_disable(struct usb_ep *ep)
!(val & EP_STS_DBUSY), 1, 10);
writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
- readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,
- !(val & (EP_CMD_CSTALL | EP_CMD_EPRST)),
- 1, 1000);
+ ret = readl_poll_timeout_atomic(&priv_dev->regs->ep_cmd, val,
+ !(val & (EP_CMD_CSTALL | EP_CMD_EPRST)),
+ 1, 1000);
if (unlikely(ret))
dev_err(priv_dev->dev, "Timeout: %s resetting failed.\n",
priv_ep->name);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 210/703] Bluetooth: MSFT: Record the filter state on Command Disallowed
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (206 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 209/703] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 211/703] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
` (199 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas de Gruijter,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas de Gruijter <thomasdegruijter@pm.me>
[ Upstream commit 75d6b9d82c35d35dad9fdd783975be1edd32fe2f ]
msft_le_set_advertisement_filter_enable_cb() treats status 0x0C (Command
Disallowed) as success: a controller returns it when the advertisement
filter is already in the requested state, and some controllers start
with the filter enabled.
Since commit 493ea69970e2 ("Bluetooth: Convert MSFT filter HCI cmd to
hci_sync") the callback is passed the return value of
__hci_cmd_sync_status() instead of the HCI status. That function reports
Command Disallowed as -EBUSY, so the 0x0C branch is never taken and
msft->filter_enabled keeps its old value whenever the filter was already
in the requested state. msft_set_filter_enable() also always returns 0,
hiding real errors from its callers.
Pass the error code to the callback, treat -EBUSY as the filter already
being in the requested state, and return real errors from
msft_set_filter_enable(). Nothing reads msft->filter_enabled yet, but
the next patch relies on it to decide when to change the filter state.
The problem was found, with the help of an AI coding assistant
(Claude Code with Claude Opus 5.5).
Fixes: 493ea69970e2 ("Bluetooth: Convert MSFT filter HCI cmd to hci_sync")
Signed-off-by: Thomas de Gruijter <thomasdegruijter@pm.me>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index da6de53d12637..5eb1b08d816f0 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -1142,26 +1142,27 @@ __u64 msft_get_features(struct hci_dev *hdev)
static void msft_le_set_advertisement_filter_enable_cb(struct hci_dev *hdev,
void *user_data,
- u8 status)
+ int err)
{
struct msft_cp_le_set_advertisement_filter_enable *cp = user_data;
struct msft_data *msft = hdev->msft_data;
- /* Error 0x0C would be returned if the filter enabled status is
+ /* Error 0x0C (Command Disallowed), which __hci_cmd_sync_status()
+ * reports as -EBUSY, would be returned if the filter enabled status is
* already set to whatever we were trying to set.
* Although the default state should be disabled, some controller set
* the initial value to enabled. Because there is no way to know the
* actual initial value before sending this command, here we also treat
* error 0x0C as success.
*/
- if (status != 0x00 && status != 0x0C)
+ if (err && err != -EBUSY)
return;
hci_dev_lock(hdev);
msft->filter_enabled = cp->enable;
- if (status == 0x0C)
+ if (err == -EBUSY)
bt_dev_warn(hdev, "MSFT filter_enable is already %s",
cp->enable ? "on" : "off");
@@ -1212,7 +1213,7 @@ int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
msft_le_set_advertisement_filter_enable_cb(hdev, &cp, err);
- return 0;
+ return err == -EBUSY ? 0 : err;
}
bool msft_curve_validity(struct hci_dev *hdev)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 211/703] Bluetooth: MSFT: Only enable the advertisement filter with monitors
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (207 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 210/703] Bluetooth: MSFT: Record the filter state on Command Disallowed Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 212/703] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Greg Kroah-Hartman
` (198 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas de Gruijter,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas de Gruijter <thomasdegruijter@pm.me>
[ Upstream commit 4a8f9b7fb4f503f48e2ccfc67caa8b07d303f8a8 ]
msft_do_open() unconditionally enables the MSFT LE advertisement filter
on every power on, whether or not any advertisement monitor is
registered.
On MediaTek MT7922 (USB 0e8d:0616, firmware build 20260724) the
controller then drops every LE advertisement: LE Set Extended Scan
Enable succeeds, but no LE Extended Advertising Report is ever
delivered, so LE discovery and passive scanning find nothing. BR/EDR
inquiry is not affected. Sending LE Set Advertisement Filter Enable with
Enable set to 0x00 restores reporting immediately. The Microsoft HCI
extension specification defines the filter as disabled by default and
does not specify what a controller reports while the filter is enabled
without any monitor condition.
Only enable the filter while at least one monitor is offloaded to the
controller, and update it after a monitor is added or removed and after
the monitors are re-registered on power on and resume. Like the
monitors, the filter state does not survive a power off, so reset the
tracked state in msft_do_close() instead of sending a redundant disable
on power on. A command is only sent when the wanted state differs from
msft->filter_enabled, so this depends on the previous patch keeping
that state accurate when the controller reports the filter as already
being in the requested state.
Fixes: 394566bf1e37 ("Bluetooth: advmon offload MSFT handle filter enablement")
Signed-off-by: Thomas de Gruijter <thomasdegruijter@pm.me>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/msft.c | 46 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 5eb1b08d816f0..407acdc393c4d 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -468,6 +468,30 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
return err;
}
+/* Keep the advertisement filter enabled only while at least one monitor is
+ * offloaded to the controller. With the filter enabled and no monitors, some
+ * controllers (e.g. MediaTek MT7922) drop every advertisement, which breaks
+ * LE discovery and passive scanning entirely.
+ *
+ * This function requires the caller holds hci_req_sync_lock
+ */
+static void msft_update_filter_enable(struct hci_dev *hdev)
+{
+ struct msft_data *msft = hdev->msft_data;
+ bool enable, update;
+
+ if (!msft)
+ return;
+
+ hci_dev_lock(hdev);
+ enable = !list_empty(&msft->handle_map);
+ update = enable != msft->filter_enabled;
+ hci_dev_unlock(hdev);
+
+ if (update)
+ msft_set_filter_enable(hdev, enable);
+}
+
/* This function requires the caller holds hci_req_sync_lock */
int msft_suspend_sync(struct hci_dev *hdev)
{
@@ -493,6 +517,8 @@ int msft_suspend_sync(struct hci_dev *hdev)
/* All monitors have been removed */
msft->suspending = false;
+ msft_update_filter_enable(hdev);
+
return 0;
}
@@ -633,6 +659,7 @@ int msft_resume_sync(struct hci_dev *hdev)
hci_dev_unlock(hdev);
reregister_monitor(hdev);
+ msft_update_filter_enable(hdev);
return 0;
}
@@ -670,11 +697,11 @@ void msft_do_open(struct hci_dev *hdev)
if (msft_monitor_supported(hdev)) {
msft->resuming = true;
- msft_set_filter_enable(hdev, true);
/* Monitors get removed on power off, so we need to explicitly
* tell the controller to re-monitor.
*/
reregister_monitor(hdev);
+ msft_update_filter_enable(hdev);
}
}
@@ -706,6 +733,11 @@ void msft_do_close(struct hci_dev *hdev)
kfree(handle_data);
}
+ /* The advertisement filter is back to its default, disabled state
+ * after power off as well.
+ */
+ msft->filter_enabled = false;
+
hci_dev_unlock(hdev);
mutex_lock(&msft->filter_lock);
@@ -1173,6 +1205,7 @@ static void msft_le_set_advertisement_filter_enable_cb(struct hci_dev *hdev,
int msft_add_monitor_pattern(struct hci_dev *hdev, struct adv_monitor *monitor)
{
struct msft_data *msft = hdev->msft_data;
+ int err;
if (!msft)
return -EOPNOTSUPP;
@@ -1180,13 +1213,17 @@ int msft_add_monitor_pattern(struct hci_dev *hdev, struct adv_monitor *monitor)
if (msft->resuming || msft->suspending)
return -EBUSY;
- return msft_add_monitor_sync(hdev, monitor);
+ err = msft_add_monitor_sync(hdev, monitor);
+ msft_update_filter_enable(hdev);
+
+ return err;
}
/* This function requires the caller holds hci_req_sync_lock */
int msft_remove_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)
{
struct msft_data *msft = hdev->msft_data;
+ int err;
if (!msft)
return -EOPNOTSUPP;
@@ -1194,7 +1231,10 @@ int msft_remove_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)
if (msft->resuming || msft->suspending)
return -EBUSY;
- return msft_remove_monitor_sync(hdev, monitor);
+ err = msft_remove_monitor_sync(hdev, monitor);
+ msft_update_filter_enable(hdev);
+
+ return err;
}
int msft_set_filter_enable(struct hci_dev *hdev, bool enable)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 212/703] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (208 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 211/703] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 213/703] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic() Greg Kroah-Hartman
` (197 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paul Menzel, Kiran K,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kiran K <kiran.k@intel.com>
[ Upstream commit b535edbf51782cc38acc2e7a6f5ff590ab865c27 ]
btintel_pcie_mac_init() is called prior to reading device memory via
target access. To acquire MAC access, only the MAC_INIT and
MAC_ACCESS_REQ bits in the function control register need to be
programmed.
Currently, btintel_pcie_mac_init() also modifies FUNC_ENA, FUNC_INIT,
BUS_MASTER_DISCON, and SW_RESET, which are not relevant to MAC access
(though doing so had no observed side effects). Leave those bits
untouched and only set MAC_INIT if it is not already set.
Fixes: b9465e6670a2 ("Bluetooth: btintel_pcie: Read hardware exception data")
Assisted-by: Copilot:Gemini 4 Argon
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btintel_pcie.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 3799e5b20d5f7..c590f071e6889 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -555,14 +555,11 @@ static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
{
u32 reg;
- /* Set MAC_INIT bit to start primary bootloader */
reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
- reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT |
- BTINTEL_PCIE_CSR_FUNC_CTRL_BUS_MASTER_DISCON |
- BTINTEL_PCIE_CSR_FUNC_CTRL_SW_RESET);
- reg |= (BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_ENA |
- BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT);
- btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+ if (!(reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT)) {
+ reg |= BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT;
+ btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+ }
}
static int btintel_pcie_get_mac_access(struct btintel_pcie_data *data)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 213/703] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (209 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 212/703] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 214/703] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags Greg Kroah-Hartman
` (196 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, sashiko-bot, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
[ Upstream commit bedefcbb8a0827e2758d6fc4a0601756eba7c248 ]
snd_pcm_action_nonatomic() is called for PCM PREPARE and other
operations, and the function takes snd_pcm_buffer_access_lock() of the
given substream (that takes runtime->buffer_mutex internally) at
first, followed by the call of snd_pcm_action_group() that takes
buffer_mutex of other substreams in the same link group again.
Recently Sashiko suggested it may lead to an ABBA deadlock when two
different substreams in the same PCM link call it concurrently:
CPU0 CPU1
---- ----
lock(&A->runtime->buffer_mutex)
lock(&B->runtime->buffer_mutex)
lock(&B->runtime->buffer_mutex)
lock(&A->runtime->buffer_mutex)
This patch tries to address the potential deadlock. Instead of taking
the buffer_mutex of the target substream at first and processing the
rest in the loop, take the whole buffer_mutex for each in the loop.
This assures the order of the nested mutexes -- the linked list itself
is kept intact by the read_rwsem() around snd_pcm_action_nonatomic().
Also, this changes the action in the snd_pcm_action_group() loop from
the direct call of mutex_lock(buffer_mutex) to
snd_pcm_buffer_access_lock(). This prevents the unexpected state
transition or the buffer access during the action, too.
Since the target substream is no longer locked before the loop, the
lockdep subclass for buffer_mutex in the loop now starts from 0, so
that a link group of N substreams uses the subclasses 0..N-1 as
before. The subclass for the stream lock case still starts from 1,
as the caller holds the target stream lock at subclass 0.
Note that this change might have a slight side-effect, though: when
some concurrent operations happen during the PREPARE or RESET, now it
may return -EBUSY. But this can be seen rather as an expected
behavior that was overlooked before the fix.
Fixes: 3c3201f8c7bb ("ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/sashiko-outbox-221145@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261119122356.2134523-2-tiwai@suse.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/pcm_native.c | 63 +++++++++++++++++++++++++++--------------
1 file changed, 41 insertions(+), 22 deletions(-)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index aac72020b3737..9e0b99ad92dd5 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -714,14 +714,20 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise
* block the further r/w operations
*/
-static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
+static int __snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime,
+ int depth)
{
if (!atomic_dec_unless_positive(&runtime->buffer_accessing))
return -EBUSY;
- mutex_lock(&runtime->buffer_mutex);
+ mutex_lock_nested(&runtime->buffer_mutex, depth);
return 0; /* keep buffer_mutex, unlocked by below */
}
+static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
+{
+ return __snd_pcm_buffer_access_lock(runtime, 0);
+}
+
/* release buffer_mutex and clear r/w access flag */
static void snd_pcm_buffer_access_unlock(struct snd_pcm_runtime *runtime)
{
@@ -1251,26 +1257,38 @@ struct action_ops {
* this functions is core for handling of linked stream
* Note: the stream state might be changed also on failure
* Note2: call with calling stream lock + link lock
+ *
+ * Locking:
+ * When @stream_lock is false, it takes buffer-access lock for all substreams.
+ * OTOH, when @stream_lock is true, takes substream lock except for the
+ * target substream (that should have taken its lock before calling this).
*/
static int snd_pcm_action_group(const struct action_ops *ops,
struct snd_pcm_substream *substream,
snd_pcm_state_t state,
bool stream_lock)
{
- struct snd_pcm_substream *s = NULL;
- struct snd_pcm_substream *s1;
- int res = 0, depth = 1;
+ struct snd_pcm_substream *s, *s1, *last;
+ int res = 0, depth;
+ /* the caller already holds the target stream lock at depth 0 */
+ depth = stream_lock ? 1 : 0;
+
+ last = NULL;
snd_pcm_group_for_each_entry(s, substream) {
- if (s != substream) {
- if (!stream_lock)
- mutex_lock_nested(&s->runtime->buffer_mutex, depth);
- else if (s->pcm->nonatomic)
+ if (!stream_lock) {
+ res = __snd_pcm_buffer_access_lock(s->runtime, depth);
+ if (res < 0)
+ goto _unlock;
+ depth++;
+ } else if (s != substream) {
+ if (s->pcm->nonatomic)
mutex_lock_nested(&s->self_group.mutex, depth);
else
spin_lock_nested(&s->self_group.lock, depth);
depth++;
}
+ last = s;
res = ops->pre_action(s, state);
if (res < 0)
goto _unlock;
@@ -1285,7 +1303,6 @@ static int snd_pcm_action_group(const struct action_ops *ops,
ops->undo_action(s1, state);
}
}
- s = NULL; /* unlock all */
goto _unlock;
}
}
@@ -1293,17 +1310,19 @@ static int snd_pcm_action_group(const struct action_ops *ops,
ops->post_action(s, state);
}
_unlock:
+ if (!last)
+ return res;
/* unlock streams */
- snd_pcm_group_for_each_entry(s1, substream) {
- if (s1 != substream) {
- if (!stream_lock)
- mutex_unlock(&s1->runtime->buffer_mutex);
- else if (s1->pcm->nonatomic)
- mutex_unlock(&s1->self_group.mutex);
+ snd_pcm_group_for_each_entry(s, substream) {
+ if (!stream_lock) {
+ snd_pcm_buffer_access_unlock(s->runtime);
+ } else if (s != substream) {
+ if (s->pcm->nonatomic)
+ mutex_unlock(&s->self_group.mutex);
else
- spin_unlock(&s1->self_group.lock);
+ spin_unlock(&s->self_group.lock);
}
- if (s1 == s) /* end */
+ if (s == last) /* end */
break;
}
return res;
@@ -1430,13 +1449,13 @@ static int snd_pcm_action_nonatomic(const struct action_ops *ops,
/* Guarantee the group members won't change during non-atomic action */
guard(rwsem_read)(&snd_pcm_link_rwsem);
+ if (snd_pcm_stream_linked(substream))
+ return snd_pcm_action_group(ops, substream, state, false);
+
res = snd_pcm_buffer_access_lock(substream->runtime);
if (res < 0)
return res;
- if (snd_pcm_stream_linked(substream))
- res = snd_pcm_action_group(ops, substream, state, false);
- else
- res = snd_pcm_action_single(ops, substream, state);
+ res = snd_pcm_action_single(ops, substream, state);
snd_pcm_buffer_access_unlock(substream->runtime);
return res;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 214/703] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (210 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 213/703] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 215/703] af_packet: avoid waiting for TPACKET_V3 copies at retirement Greg Kroah-Hartman
` (195 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christopher Snowhill, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: chris@kode54.net <chris@kode54.net>
[ Upstream commit 9d30450b6ac8cfc827be3d38f4f5ee86f68687ad ]
Writing a flag name to the quirk_flags module parameter through sysfs
with echo leaves a trailing newline on the string. The parser keeps it
as part of the last flag name, so a valid flag is rejected:
snd_usb_audio: unknown flag SKIP_IFACE_SETUP
while parsing param quirk_flags
Numeric flags are not affected because kstrtou64() accepts a trailing
newline. Strip leading and trailing whitespace before parsing.
Fixes: ffd586126a82 ("ALSA: usb-audio: improve module param quirk_flags")
Assisted-by: AI
Signed-off-by: Christopher Snowhill <chris@kode54.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261120120356.10909-2-chris@kode54.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/quirks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 01a5564eda7af..139efeb95d47b 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -2602,7 +2602,7 @@ void snd_usb_init_quirk_flags_parse_string(struct snd_usb_audio *chip,
if (!val)
return;
- for (p = val; p && *p;) {
+ for (p = strim(val); p && *p;) {
/* Each entry consists of VID:PID:flags */
field = strsep(&p, ":");
if (!field)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 215/703] af_packet: avoid waiting for TPACKET_V3 copies at retirement
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (211 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 214/703] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 216/703] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check Greg Kroah-Hartman
` (194 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jingxuan Xie, Willem de Bruijn,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jingxuan Xie <jingxuanxie@deeproute.ai>
[ Upstream commit d7f2d9b6c7d0ff0af7d19d889810d35dfe07da90 ]
TPACKET_V3 retires a full or expired block while holding
sk_receive_queue.lock. prb_retire_current_block() takes
blk_fill_in_prog_lock for write to wait for in-flight skb_copy_bits()
before publishing the block.
On PREEMPT_RT a read lock can be held by a task that has been
preempted or is running on another CPU. The packet path or the
retirement timer then blocks on the write lock while holding
sk_receive_queue.lock, and the receive path resumes only after the
copy completes. This was observed as a receive stall of hundreds of
milliseconds in a PREEMPT_RT deployment; manual inspection found the
same unconditional write_lock() in both the full-block and the timer
retirement paths.
Try to take the write lock without blocking on PREEMPT_RT. If a copy
is still in progress, leave the current block and its metadata
untouched:
- the retirement timer re-arms itself and retries after the configured
interval;
- packet allocation returns NULL, so tpacket_rcv() drops this capture
record and accounts it in tp_drops, while the original packet remains
in the network stack;
- a later packet can retire the block once the copier has finished.
Do not dispatch the next block while the current block is still open.
The existing lock order and completion ordering are preserved, and no
new state or worker is introduced. The trade-off is a higher capture
drop rate while a copy is in progress; original traffic is unaffected.
Non-PREEMPT_RT kernels keep the unconditional write_lock(): there
read_lock() disables preemption, so the writer only waits for the copy
to finish, not for a scheduled-out task to run again.
The stall was reproduced on QEMU arm64 SMP PREEMPT_RT by delaying a
copier after frame reservation: without this change the next sender
blocks until the copier is released, with this change only that
capture record is dropped.
Fixes: 632ca50f2cbd ("af_packet: TPACKET_V3: replace busy-wait loop")
Signed-off-by: Jingxuan Xie <jingxuanxie@deeproute.ai>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261118135443.24767-1-jingxuanxie@deeproute.ai
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/packet/af_packet.c | 40 ++++++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 7b8ba1690d543..e48a435e87408 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -199,7 +199,7 @@ static void packet_increment_head(struct packet_ring_buffer *buff);
static int prb_curr_blk_in_use(struct tpacket_block_desc *);
static void *prb_dispatch_next_block(struct tpacket_kbdq_core *,
struct packet_sock *);
-static void prb_retire_current_block(struct tpacket_kbdq_core *,
+static bool prb_retire_current_block(struct tpacket_kbdq_core *,
struct packet_sock *, unsigned int status);
static int prb_queue_frozen(struct tpacket_kbdq_core *);
static void prb_open_block(struct tpacket_kbdq_core *,
@@ -667,6 +667,24 @@ static void init_prb_bdqc(struct packet_sock *po,
prb_open_block(p1, pbd);
}
+/*
+ * Wait for an in-flight skb_copy_bits() before retiring the current block.
+ * On PREEMPT_RT the read lock can be held by a task that has been preempted
+ * or is running on another CPU, so do not block while holding
+ * sk_receive_queue.lock; return false and let the caller retry.
+ */
+static bool prb_wait_for_copy_bits(struct tpacket_kbdq_core *pkc)
+{
+ if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
+ if (!write_trylock(&pkc->blk_fill_in_prog_lock))
+ return false;
+ } else {
+ write_lock(&pkc->blk_fill_in_prog_lock);
+ }
+ write_unlock(&pkc->blk_fill_in_prog_lock);
+ return true;
+}
+
/*
* With a 1MB block-size, on a 1Gbps line, it will take
* i) ~8 ms to fill a block + ii) memcpy etc.
@@ -701,9 +719,9 @@ static enum hrtimer_restart prb_retire_rx_blk_timer_expired(struct hrtimer *t)
*
*/
if (BLOCK_NUM_PKTS(pbd)) {
- /* Waiting for skb_copy_bits to finish... */
- write_lock(&pkc->blk_fill_in_prog_lock);
- write_unlock(&pkc->blk_fill_in_prog_lock);
+ /* Retry later if a packet copy is still in progress. */
+ if (!prb_wait_for_copy_bits(pkc))
+ goto refresh_timer;
}
if (!frozen) {
@@ -728,6 +746,7 @@ static enum hrtimer_restart prb_retire_rx_blk_timer_expired(struct hrtimer *t)
}
}
+refresh_timer:
hrtimer_forward_now(&pkc->retire_blk_timer, pkc->interval_ktime);
spin_unlock(&po->sk.sk_receive_queue.lock);
return HRTIMER_RESTART;
@@ -936,7 +955,7 @@ static void *prb_dispatch_next_block(struct tpacket_kbdq_core *pkc,
return (void *)pkc->nxt_offset;
}
-static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,
+static bool prb_retire_current_block(struct tpacket_kbdq_core *pkc,
struct packet_sock *po, unsigned int status)
{
struct tpacket_block_desc *pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
@@ -953,13 +972,13 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,
* the timer-handler already handled this case.
*/
if (!(status & TP_STATUS_BLK_TMO)) {
- /* Waiting for skb_copy_bits to finish... */
- write_lock(&pkc->blk_fill_in_prog_lock);
- write_unlock(&pkc->blk_fill_in_prog_lock);
+ /* Do not wait for copies while holding the queue lock. */
+ if (!prb_wait_for_copy_bits(pkc))
+ return false;
}
prb_close_block(pkc, pbd, po, status);
- return;
}
+ return true;
}
static int prb_curr_blk_in_use(struct tpacket_block_desc *pbd)
@@ -1087,7 +1106,8 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
}
/* Ok, close the current block */
- prb_retire_current_block(pkc, po, 0);
+ if (!prb_retire_current_block(pkc, po, 0))
+ return NULL;
/* Now, try to dispatch the next block */
curr = (char *)prb_dispatch_next_block(pkc, po);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 216/703] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (212 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 215/703] af_packet: avoid waiting for TPACKET_V3 copies at retirement Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 217/703] net: marvell: prestera: disable port before changing its MAC mode Greg Kroah-Hartman
` (193 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, Paul Moore,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <jiayuan.chen@linux.dev>
[ Upstream commit 18a7abf1a0b168ea6a50f08562de2f286d6f5a86 ]
Issue found by sashiko when reviewing my data-races patch [1]. This is
not a plain READ_ONCE() annotation like the rest of that series but a
real fix, so it is sent separately.
calipso_cache_add() reads calipso_cache_bucketsize twice: the "<= 0"
guard on entry, then the "size < bucketsize" test after taking the
bucket lock. A writer can flip it to 0 in between:
CPU0 CPU1
calipso_cache_add()
calipso_cache_bucketsize == 10 (> 0)
proc_dointvec()
calipso_cache_bucketsize = 0
spin_lock_bh(&bucket.lock)
size(0) < calipso_cache_bucketsize(0) -> false
-> else branch, but the bucket is empty
On an empty bucket the else branch takes list.prev (the list head
itself), list_del()s it and then list_add()s through the now poisoned
head:
Oops: general protection fault, probably for non-canonical address
0xdead000000000108
RIP: 0010:calipso_cache_add+0x2f0/0x380
Call Trace:
<IRQ>
calipso_cache_add+0x4c/0x70
netlbl_cache_add+0x4a/0xa0
selinux_netlbl_skbuff_getsid+0x1ac/0x280
selinux_skb_peerlbl_sid+0x7d/0x100
selinux_socket_sock_rcv_skb+0x2d3/0x460
security_sock_rcv_skb+0x86/0x150
sk_filter_trim_cap+0x56/0x730
sock_queue_rcv_skb_reason+0x1e/0x80
rawv6_rcv+0x679/0xb20
raw6_local_deliver+0x1f0/0x5b0
ip6_protocol_deliver_rcu+0x215/0x9a0
ip6_input_finish+0xb0/0x1b0
ip6_input+0xa8/0x250
ipv6_rcv+0x14b/0x1c0
__netif_receive_skb_one_core+0x8f/0xe0
__netif_receive_skb+0x23/0xb0
process_backlog+0x27a/0x950
__napi_poll.constprop.0+0x61/0x2c0
net_rx_action+0x372/0x800
handle_softirqs+0x109/0x570
__do_softirq+0x10/0x18
do_softirq.part.0+0x47/0xd0
</IRQ>
<TASK>
__local_bh_enable_ip+0xf0/0x120
__dev_queue_xmit+0x578/0x23f0
neigh_resolve_output+0x278/0x3c0
ip6_finish_output2+0x4b1/0xcb0
ip6_finish_output+0x2b6/0x6b0
ip6_output+0x122/0x400
ip6_local_out+0x61/0xb0
ip6_send_skb+0xa0/0x260
ip6_push_pending_frames+0x2b/0x40
rawv6_sendmsg+0x1b7a/0x2750
inet_sendmsg+0xa1/0xb0
__sys_sendto+0x2fe/0x350
__x64_sys_sendto+0x7f/0xb0
do_syscall_64+0xe1/0x450
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Snapshot the sysctl into a local once and use it for both tests, like
cipso_v4_cache_add() has since commit dd44f04b9214 ("cipso: Fix
data-races around sysctl.").
[1] https://lore.kernel.org/netdev/179428999963.994134.16904544500890053668@kernel.org/
Fixes: 4fee5242bf41 ("calipso: Add a label cache.")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://patch.msgid.link/20261115144508.71543-1-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/calipso.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index ae0cf6520f21c..adaf2c2a25bfb 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -264,13 +264,14 @@ static int calipso_cache_check(const unsigned char *key,
static int calipso_cache_add(const unsigned char *calipso_ptr,
const struct netlbl_lsm_secattr *secattr)
{
+ int bkt_size = READ_ONCE(calipso_cache_bucketsize);
int ret_val = -EPERM;
u32 bkt;
struct calipso_map_cache_entry *entry = NULL;
struct calipso_map_cache_entry *old_entry = NULL;
u32 calipso_ptr_len;
- if (!calipso_cache_enabled || calipso_cache_bucketsize <= 0)
+ if (!calipso_cache_enabled || bkt_size <= 0)
return 0;
calipso_ptr_len = calipso_ptr[1];
@@ -290,7 +291,7 @@ static int calipso_cache_add(const unsigned char *calipso_ptr,
bkt = entry->hash & (CALIPSO_CACHE_BUCKETS - 1);
spin_lock_bh(&calipso_cache[bkt].lock);
- if (calipso_cache[bkt].size < calipso_cache_bucketsize) {
+ if (calipso_cache[bkt].size < bkt_size) {
list_add(&entry->list, &calipso_cache[bkt].list);
calipso_cache[bkt].size += 1;
} else {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 217/703] net: marvell: prestera: disable port before changing its MAC mode
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (213 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 216/703] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 218/703] net/mlx5e: Release FIB event work flows before dropping RTNL Greg Kroah-Hartman
` (192 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Imre Kaloz, Elad Nachman,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <kaloz@kernel.org>
[ Upstream commit fdb6fcabdbb8247f1647d54fb1b9dc3575d7fcc8 ]
prestera_pcs_config() writes a new mode, speed or inband setting to an
enabled port. The firmware can then report link down until the port is
disabled and enabled again.
Disable the port before such a write. 2500BASE-X and SGMII share one MAC
mode, so SGMII sets its own speed and the speed is compared as well.
Exercising this needs a link partner, so no in-tree test covers it.
Before this patch, the SFP+ ports (S-RJ01 module in sfp-52) on
a Delta TN48M (98DX3265) with firmware 4.1.0 come up in 21 of 30
attempts. 30 out of 30 with the patch.
Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support")
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
Reviewed-by: Elad Nachman <enachman@marvell.com>
Link: https://patch.msgid.link/20261115230812.29644-1-kaloz@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/marvell/prestera/prestera_main.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index 84ff651dd058b..77e386ac41d08 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -307,13 +307,14 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
bool permit_pause_to_mac)
{
struct prestera_port *port = prestera_pcs_to_port(pcs);
- struct prestera_port_mac_config cfg_mac;
+ struct prestera_port_mac_config cfg_mac, old;
int err;
err = prestera_port_cfg_mac_read(port, &cfg_mac);
if (err)
return err;
+ old = cfg_mac;
cfg_mac.admin = true;
cfg_mac.fec = PRESTERA_PORT_FEC_OFF;
cfg_mac.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
@@ -329,6 +330,7 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
break;
case PHY_INTERFACE_MODE_SGMII:
+ cfg_mac.speed = SPEED_1000;
cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
break;
case PHY_INTERFACE_MODE_1000BASEX:
@@ -339,6 +341,19 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
break;
}
+ /* Firmware may not report link up after the mode, speed or inband
+ * setting of an enabled port changes until the port is disabled and
+ * re-enabled.
+ */
+ if (old.admin && (old.mode != cfg_mac.mode ||
+ old.speed != cfg_mac.speed ||
+ old.inband != cfg_mac.inband)) {
+ old.admin = false;
+ err = prestera_port_cfg_mac_write(port, &old);
+ if (err)
+ return err;
+ }
+
err = prestera_port_cfg_mac_write(port, &cfg_mac);
if (err)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 218/703] net/mlx5e: Release FIB event work flows before dropping RTNL
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (214 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 217/703] net: marvell: prestera: disable port before changing its MAC mode Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 219/703] net: clear skb->mac_len in skb_unset_mac_header() Greg Kroah-Hartman
` (191 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gal Pressman, Jianbo Liu,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <gal@nvidia.com>
[ Upstream commit bfccb4e44e4725270ccef366078d7b6063920ff3 ]
The FIB event work, neigh update work and the neigh stats work all use
flow->tmp_list to hold the encap flows they work on, while RTNL is what
keeps them from using it at the same time.
mlx5e_tc_fib_event_work() drops RTNL before it is done with its list.
A neigh work can then take the same flows while the FIB work is still
walking them, and the two overwrite each other's list.
Release the flow list before dropping RTNL.
The issue was hit once in our regression testing (OVS connection
tracking with the VXLAN endpoint on a VF, KASAN build):
BUG: KASAN: stack-out-of-bounds in mlx5e_flow_put+0x23/0x80 [mlx5_core]
Write of size 4 at addr ffff8881226d7b20 by task kworker/u40:1/20171
Workqueue: mlx5e mlx5e_tc_fib_event_work [mlx5_core]
Call Trace:
mlx5e_flow_put+0x23/0x80 [mlx5_core]
mlx5e_put_flow_list+0x82/0xe0 [mlx5_core]
mlx5e_tc_fib_event_work+0x704/0x1fb0 [mlx5_core]
process_one_work+0x8df/0x1660
The race was also reproduced with an msleep() inserted between
rtnl_unlock() and mlx5e_put_flow_list() to widen the window, a VXLAN
encap rule whose endpoint IP is on a VF, and route churn on the endpoint
address.
Fixes: 8914add2c9e5 ("net/mlx5e: Handle FIB events to update tunnel endpoint device")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261118143653.1915247-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
index 0735d10f2baca..9f6eacdecffde 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
@@ -1721,9 +1721,9 @@ static void mlx5e_tc_fib_event_work(struct work_struct *work)
r->flags |= MLX5E_ROUTE_ENTRY_VALID;
out:
mutex_unlock(&esw->offloads.encap_tbl_lock);
+ mlx5e_put_flow_list(priv, &flow_list);
rtnl_unlock();
- mlx5e_put_flow_list(priv, &flow_list);
mlx5e_route_put(priv, event_data->r);
dev_put(event_data->ul_dev);
kfree(event_data);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 219/703] net: clear skb->mac_len in skb_unset_mac_header()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (215 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 218/703] net/mlx5e: Release FIB event work flows before dropping RTNL Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 220/703] net/mlx5: HWS, Handle NULL in vport destination action creation Greg Kroah-Hartman
` (190 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Piyus Kedia, Kapil Vaswani,
Eric Dumazet, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 7a505bb0168a132c2a3ab4efff4c6d6474ca3aa1 ]
skb_unset_mac_header() marks the mac header as unset but leaves
skb->mac_len alone, so an skb can end up with no mac header and a
non-zero mac_len. Code that uses mac_len to decide whether a mac
header is present is then misled.
end_dt_vrf_rcv() (SRv6 End.DT4/End.DT6) unsets the mac header of the
decapsulated packet so that the VRF device can rebuild it. The VRF
device only does so when a packet sniffer is attached, so without one
the skb continues up the stack with mac_len == 14. In
xfrm4_remove_tunnel_encap() and xfrm6_remove_tunnel_encap(),
skb_mac_header_rebuild() is a no-op for such an skb, and the following
if (skb->mac_len)
eth_hdr(skb)->h_proto = skb->protocol;
writes two bytes at skb->head + 0xffff + offsetof(struct ethhdr, h_proto):
BUG: KASAN: slab-out-of-bounds in xfrm4_remove_tunnel_encap+0x17d/0x220
Write of size 2 at addr ffff88805f85800b by task syz-executor/10831
xfrm4_remove_tunnel_encap
xfrm_input
xfrm4_esp_rcv
ip_protocol_deliver_rcu
ip_local_deliver_finish
seg6_local_input_core
lwtunnel_input
__netif_receive_skb
netif_receive_skb
tun_rx_batched
tun_get_user
__input_process_payload() in net/xfrm/xfrm_iptfs.c has the same three
lines and reported as a use-after-free rather than an out-of-bounds. The
address written is fixed relative to skb->head, so what it lands in is
whatever the allocator placed sixteen pages past the skb: a live object
gives slab-out-of-bounds, a freed one or a page back on the buddy free
list gives use-after-free, and a different live object gives no report at
all. Clearing mac_len at the source makes the guard false at all three
sites.
Clear mac_len in skb_unset_mac_header() so that all callers leave the
skb in a consistent state, and remove the now redundant assignment in
skb_carve_reset_headers(). The other callers are on egress paths
(__bpf_redirect_neigh(), bpf_lwt_push_ip_encap()) or only reach the
helper when the mac header was already unset (bpf_update_srh_state()),
and do not read mac_len afterwards. vrf_prepare_mac_header(), the rebuild
end_dt_vrf_rcv() unsets the header for, pushes ETH_HLEN and then calls
skb_reset_mac_header() and skb_reset_mac_len(), so it recomputes mac_len
itself and never reads the stale value.
The issue was reported on the list by Piyus Kedia and Kapil Vaswani,
who found it by fuzzing with AI assistance and reproduced the KASAN
splat on v7.4-rc3. Their reproducer was not published.
Fixes: 664d6f86868b ("seg6: add support for the SRv6 End.DT4 behavior")
Reported-by: Piyus Kedia <piyus@iiitd.ac.in>
Reported-by: Kapil Vaswani <kapil@presceralabs.ai>
Closes: https://lore.kernel.org/netdev/20261116174531.2540348-2-piyus@iiitd.ac.in/
Suggested-by: Kapil Vaswani <kapil@presceralabs.ai>
Suggested-by: Piyus Kedia <piyus@iiitd.ac.in>
Tested-by: Piyus Kedia <piyus@iiitd.ac.in>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
Link: https://patch.msgid.link/20261117143612.95112-1-piyus@iiitd.ac.in
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/skbuff.h | 1 +
net/core/skbuff.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 1ce81b7028928..dd5ae7a373851 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3163,6 +3163,7 @@ static inline u32 skb_mac_header_len(const struct sk_buff *skb)
static inline void skb_unset_mac_header(struct sk_buff *skb)
{
skb->mac_header = (typeof(skb->mac_header))~0U;
+ skb->mac_len = 0;
}
static inline void skb_reset_mac_header(struct sk_buff *skb)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 60eb8b4328f89..27eb14c2b330f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6813,7 +6813,6 @@ static void skb_carve_reset_headers(struct sk_buff *skb)
skb_unset_mac_header(skb);
skb_unset_transport_header(skb);
skb_reset_network_header(skb);
- skb->mac_len = 0;
/* Inner offsets have no "unset" marker, zero them so that
* skb_inner_network_header_was_set() becomes false and no
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 220/703] net/mlx5: HWS, Handle NULL in vport destination action creation
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (216 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 219/703] net: clear skb->mac_len in skb_unset_mac_header() Greg Kroah-Hartman
@ 2026-12-04 10:01 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 221/703] net/mlx5: DR, Fix out-of-bounds write when sync to HW fails Greg Kroah-Hartman
` (189 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:01 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yevgeny Kliteynik, Alex Vesker,
Erez Shitrit, Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeny Kliteynik <kliteyn@nvidia.com>
[ Upstream commit c0ec15a586556c11583d8e336c3963c231c379c3 ]
mlx5hws_action_create_dest_vport() can return NULL. If this
happens, xa_insert() will insert a NULL entry into the xarray.
The next mlx5hws_action_create_dest_vport() failure will try to
insert NULL again, but xa_insert() will return -EBUSY, because
we already have NULL entry. In such case the code will go into
error flow of action creation, and eventually will cause NULL
dereference at hws_action_destroy_hws().
The issue was discovered by code inspection.
Fixes: 8e2e08a6d1e0 ("net/mlx5: fs, add support for dest vport HWS action")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Alex Vesker <valex@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261118173227.1957670-2-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
index 7b677653be5bd..543f12f51e3fc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
@@ -441,6 +441,8 @@ mlx5_fs_get_dest_action_vport(struct mlx5_fs_hws_context *fs_ctx,
dest = mlx5hws_action_create_dest_vport(ctx, vport_num, vhca_id_valid,
dest_attr->vport.vhca_id, flags);
+ if (!dest)
+ return NULL;
err = xa_insert(dests_xa, idx, dest, GFP_KERNEL);
if (err) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 221/703] net/mlx5: DR, Fix out-of-bounds write when sync to HW fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (217 preceding siblings ...)
2026-12-04 10:01 ` [PATCH 6.18 220/703] net/mlx5: HWS, Handle NULL in vport destination action creation Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 222/703] eth: fbnic: skip disabled Tx rings when setting the queue NAPI Greg Kroah-Hartman
` (188 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yevgeny Kliteynik, Alex Vesker,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeny Kliteynik <kliteyn@nvidia.com>
[ Upstream commit 0e56ff4441eea333bfbfeff86ef39038f6e8c378 ]
mlx5dr_icm_free_chunk() moves a freed chunk to the "hot" chunks array by
writing it to hot_chunks_arr and, once the accumulated hot memory
crosses a threshold, triggers a sync to HW that flushes the array. The
array is large enough to hold the chunks of a single accumulation cycle,
and relies on the sync path to flush it.
However, if sync to HW fails, hot chunks array is not cleared, and every
subsequent mlx5dr_icm_free_chunk will write past the end of
hot_chunks_arr, resulting in an out-of-bounds write and kernel heap
corruption.
A failed sync to HW also means it is no longer safe to recycle ICM: a
chunk's memory may only be returned to the buddy allocator (and thus be
reused) after a sync has confirmed that HW no longer references it.
The issue was discovered by a fuzzer that repeatedly triggered sync
failure, at which point the out-of-bounds write was reported by KASAN:
KASAN log excerpt: BUG:
slab-out-of-bounds in mlx5dr_icm_free_chunk+0x4cd at call 2
(hot_chunks_num=3 > cap=2).
Fix this by putting the pool into an error state on the first failed
sync to HW, reporting the failure once. The sync is not retried, and
while the pool is in this state:
- mlx5dr_icm_free_chunk() doesn't queue freed chunks; the segment is
left reserved and is reclaimed when the pool is destroyed.
- mlx5dr_icm_alloc_chunk() doesn't serve new chunks.
Fixes: 4519fc45beeb ("net/mlx5: DR, Keep track of hot ICM chunks in an array instead of list")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261118173227.1957670-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mlx5/core/steering/sws/dr_icm_pool.c | 32 +++++++++++++++++--
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c
index 0b5af9f3f605b..c0beedffba60f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_icm_pool.c
@@ -33,6 +33,11 @@ struct mlx5dr_icm_pool {
u64 hot_memory_size;
/* hot memory size threshold for triggering sync */
u64 th;
+ /* Set when a sync to HW fails - no new chunks are served, freed
+ * chunks are no longer queued, and their ICM is not returned to
+ * the buddy allocator.
+ */
+ bool error_state;
};
struct mlx5dr_icm_dm {
@@ -369,7 +374,15 @@ static int dr_icm_pool_sync_all_buddy_pools(struct mlx5dr_icm_pool *pool)
err = mlx5dr_cmd_sync_steering(pool->dmn->mdev);
if (err) {
- mlx5dr_err(pool->dmn, "Failed to sync to HW (err: %d)\n", err);
+ /* The hot chunks could not be flushed. Put the pool in an
+ * error state so that no further chunks are queued (which
+ * would overflow hot_chunks_arr), and no new chunks are
+ * served. The sync is not retried.
+ */
+ mlx5dr_err(pool->dmn,
+ "Failed to sync to HW (err: %d), disabling ICM pool\n",
+ err);
+ pool->error_state = true;
return err;
}
@@ -444,6 +457,10 @@ mlx5dr_icm_alloc_chunk(struct mlx5dr_icm_pool *pool,
return NULL;
mutex_lock(&pool->mutex);
+
+ if (pool->error_state)
+ goto out;
+
/* find mem, get back the relevant buddy pool and seg in that mem */
ret = dr_icm_handle_buddies_get_mem(pool, chunk_size, &buddy, &seg);
if (ret)
@@ -476,6 +493,14 @@ void mlx5dr_icm_free_chunk(struct mlx5dr_icm_chunk *chunk)
/* move the chunk to the waiting chunks array, AKA "hot" memory */
mutex_lock(&pool->mutex);
+ /* If the pool is in an error state, the chunk must not be queued.
+ * ICM memory is not returned to the buddy allocator - it is
+ * reclaimed only when the pool is destroyed.
+ * Just free the chunk's bookkeeping struct.
+ */
+ if (pool->error_state)
+ goto out;
+
pool->hot_memory_size += mlx5dr_icm_pool_get_chunk_byte_size(chunk);
hot_chunk = &pool->hot_chunks_arr[pool->hot_chunks_num++];
@@ -483,12 +508,13 @@ void mlx5dr_icm_free_chunk(struct mlx5dr_icm_chunk *chunk)
hot_chunk->seg = chunk->seg;
hot_chunk->size = chunk->size;
- kmem_cache_free(chunks_cache, chunk);
-
/* Check if we have chunks that are waiting for sync-ste */
if (dr_icm_pool_is_sync_required(pool))
dr_icm_pool_sync_all_buddy_pools(pool);
+out:
+ kmem_cache_free(chunks_cache, chunk);
+
mutex_unlock(&pool->mutex);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 222/703] eth: fbnic: skip disabled Tx rings when setting the queue NAPI
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (218 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 221/703] net/mlx5: DR, Fix out-of-bounds write when sync to HW fails Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 223/703] eth: fbnic: skip freed Tx rings in fbnic_get_ts_stats() Greg Kroah-Hartman
` (187 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dimitri Daskalakis,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dimitri Daskalakis <daskald@meta.com>
[ Upstream commit 561175f45a23527d2853e2b745d40bf963e87dce ]
When Rx and Tx channels are not combined, each Rx vector gets a Tx
triad whose sub0 is disabled with a q_idx of 0. fbnic_set_netif_napi()
and fbnic_reset_netif_napi() don't skip it, so every Rx vector
associates Tx queue 0 with its own NAPI, and the netlink queue info
reports the wrong NAPI for Tx queue 0.
This bug was found by AI and verified on HW.
Reproduced with "ethtool -L eth0 combined 0 rx 34 tx 34", and reading
the NAPI IDs with "ynl --family netdev --dump queue-get":
before: tx 0 napi-id 580, tx 1 napi-id 514, rx 33 napi-id 580
^^^ rx 33's NAPI, not vector 0's
after: tx 0 napi-id 513, tx 1 napi-id 514, rx 33 napi-id 580
Fixes: cf4facfb132a ("eth: fbnic: Add support for XDP queues")
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261117215416.1901246-3-dimitri.daskalakis1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index 623b2795af3af..b7e8e33d3b9bd 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -2141,6 +2141,9 @@ static void fbnic_set_netif_napi(struct fbnic_napi_vector *nv)
for (i = 0; i < nv->txt_count; i++) {
struct fbnic_q_triad *qt = &nv->qt[i];
+ if (qt->sub0.flags & FBNIC_RING_F_DISABLED)
+ continue;
+
netif_queue_set_napi(nv->napi.dev, qt->sub0.q_idx,
NETDEV_QUEUE_TYPE_TX, &nv->napi);
}
@@ -2162,6 +2165,9 @@ static void fbnic_reset_netif_napi(struct fbnic_napi_vector *nv)
for (i = 0; i < nv->txt_count; i++) {
struct fbnic_q_triad *qt = &nv->qt[i];
+ if (qt->sub0.flags & FBNIC_RING_F_DISABLED)
+ continue;
+
netif_queue_set_napi(nv->napi.dev, qt->sub0.q_idx,
NETDEV_QUEUE_TYPE_TX, NULL);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 223/703] eth: fbnic: skip freed Tx rings in fbnic_get_ts_stats()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (219 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 222/703] eth: fbnic: skip disabled Tx rings when setting the queue NAPI Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 224/703] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails Greg Kroah-Hartman
` (186 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dimitri Daskalakis,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dimitri Daskalakis <daskald@meta.com>
[ Upstream commit 729f807b58f6ed646b81cf7fd7939b2271daa33f ]
fbnic_stop() frees the NAPI vectors, which clears fbn->tx[] while
num_tx_queues is left unchanged. fbnic_get_ts_stats() walks fbn->tx[]
without checking for NULL, so asking for timestamping statistics while
the interface is down dereferences a NULL ring.
This was found by AI and reproduced on HW.
# ip link set dev eth0 down; ethtool -I -T eth0
BUG: kernel NULL pointer dereference, address: 0000000000000050
RIP: 0010:fbnic_get_ts_stats+0x38/0x60
Call Trace:
tsinfo_prepare_data+0x82/0xb0
ethnl_default_doit+0x213/0x470
genl_family_rcv_msg_doit+0xdd/0x110
...
Fixes: 96f358f75d1a ("eth: fbnic: add ethtool timestamping statistics")
Signed-off-by: Dimitri Daskalakis <daskald@meta.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261117215416.1901246-4-dimitri.daskalakis1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
index d67be9f1a575f..343e14d09561d 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
@@ -1633,6 +1633,9 @@ static void fbnic_get_ts_stats(struct net_device *netdev,
ts_stats->lost = fbn->tx_stats.twq.ts_lost;
for (i = 0; i < fbn->num_tx_queues; i++) {
ring = fbn->tx[i];
+ if (!ring)
+ continue;
+
do {
start = u64_stats_fetch_begin(&ring->stats.syncp);
ts_packets = ring->stats.twq.ts_packets;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 224/703] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (220 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 223/703] eth: fbnic: skip freed Tx rings in fbnic_get_ts_stats() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 225/703] net: qrtr: ns: keep notifying local servers after a failed send Greg Kroah-Hartman
` (185 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Wang, Xiangwu Lai,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
[ Upstream commit 71b5da0b45fb83b590f1ec3df5361c7754b0e113 ]
In ufs_mtk_mphy_power_on(), the power-off path tears the M-PHY down in two
steps before regulator_disable() is called: phy_power_off() puts the PHY
PLL and its clocks down, and ufs_mtk_va09_pwr_ctrl() asks the firmware to
drop the VA09 supply. If regulator_disable() then fails, the M-PHY stays
physically off while host->mphy_powered_on is left set, so the next
power-on attempt bails out through the !(on ^ host->mphy_powered_on) check
and never powers the M-PHY back up, leaving the UFS host with an unpowered
PHY (I/O timeouts, controller lockups).
Simply forcing mphy_powered_on to false would trade this for two more
problems. First, the regulator core drops the consumer enable count only
after a successful disable, so the count stays at 1, the next power-on
raises it to 2 and it never returns to zero: va09 is then never physically
disabled and the devm-acquired regulator would hit WARN_ON(enable_count)
again on release. Second, when the power-off fails during
ufs_mtk_suspend(), the error recovery in __ufshcd_wl_suspend() runs
ufshcd_host_reset_and_restore() without powering the M-PHY back on, which
would run against an unpowered PHY. (Both points were raised by the
Sashiko AI review of v2.)
Since the va09 regulator stays enabled when its disable fails, restore the
M-PHY power state instead: power the PHY back on through
ufs_mtk_va09_pwr_ctrl() and phy_power_on() and leave mphy_powered_on set.
The next power-off attempt then retries the full sequence and the enable
count stays balanced.
Found by code inspection while reviewing the va09 error paths of the
driver; the failure has not been observed on real hardware.
Suggested-by: Peter Wang <peter.wang@mediatek.com>
Link: https://lore.kernel.org/r/sashiko-outbox-220026@kernel.org
Fixes: cf137b3ea49a ("scsi: ufs-mediatek: Support VA09 regulator operations")
Signed-off-by: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Link: https://patch.msgid.link/20261119071611.117-3-laixiangwu@cmss.chinamobile.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ufs/host/ufs-mediatek.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 3c63adca561d2..d465567db433e 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -508,6 +508,16 @@ static int ufs_mtk_mphy_power_on(struct ufs_hba *hba, bool on)
if (ufs_mtk_is_va09_supported(hba)) {
ufs_mtk_va09_pwr_ctrl(res, 0);
ret = regulator_disable(host->reg_va09);
+ if (ret) {
+ /*
+ * The va09 regulator stays enabled, so
+ * bring the M-PHY back up to keep the
+ * software state in sync with the
+ * hardware.
+ */
+ ufs_mtk_va09_pwr_ctrl(res, 1);
+ phy_power_on(mphy);
+ }
}
}
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 225/703] net: qrtr: ns: keep notifying local servers after a failed send
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (221 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 224/703] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 226/703] riscv: efi: Map runtime MMIO with device attributes Greg Kroah-Hartman
` (184 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Opaniuk, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
[ Upstream commit d5b89d55a322b632e2b465b392a4c1d9d338db9c ]
ctrl_cmd_bye() and ctrl_cmd_del_client() forward the event to every
local server, but stop at the first failed send. Each send goes to a
different socket, so a single server with a full receive queue
(-ENOSPC) hides the event from all servers after it.
Log the failure and carry on. Likewise, keep notifying local lookups
when the NEW_SERVER broadcast fails, which can only happen on -ENOMEM.
Tested on the Arduino UNO Q (QRB2210).
Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace")
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Link: https://patch.msgid.link/20261114-upstream-qrtr-hello-gate-fix_b4-v2-1-2fb62c2853bb@oss.qualcomm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/qrtr/ns.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index e8e3ba1b3b823..ea278dd62eea9 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -410,11 +410,11 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from)
msg.msg_name = (struct sockaddr *)&sq;
msg.msg_namelen = sizeof(sq);
+ /* A server that cannot take it must not hide it from the rest */
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0 && ret != -ENODEV) {
- pr_err("failed to send bye cmd\n");
- goto delete_node;
- }
+ if (ret < 0 && ret != -ENODEV)
+ pr_err_ratelimited("failed to send bye cmd to %u:%u: %d\n",
+ srv->node, srv->port, ret);
}
/* Ignore -ENODEV */
@@ -494,11 +494,11 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,
msg.msg_name = (struct sockaddr *)&sq;
msg.msg_namelen = sizeof(sq);
+ /* A server that cannot take it must not hide it from the rest */
ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
- if (ret < 0 && ret != -ENODEV) {
- pr_err("failed to send del client cmd\n");
- return ret;
- }
+ if (ret < 0 && ret != -ENODEV)
+ pr_err_ratelimited("failed to send del client cmd to %u:%u: %d\n",
+ srv->node, srv->port, ret);
}
return 0;
}
@@ -523,11 +523,10 @@ static int ctrl_cmd_new_server(struct sockaddr_qrtr *from,
return -EINVAL;
if (srv->node == qrtr_ns.local_node) {
+ /* The lookups below still need to hear about the server */
ret = service_announce_new(&qrtr_ns.bcast_sq, srv);
- if (ret < 0) {
+ if (ret < 0)
pr_err("failed to announce new service\n");
- return ret;
- }
}
/* Notify any potential lookups about the new server */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 226/703] riscv: efi: Map runtime MMIO with device attributes
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (222 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 225/703] net: qrtr: ns: keep notifying local servers after a failed send Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 227/703] net: do not run out of frags in alloc_skb_with_frags() Greg Kroah-Hartman
` (183 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Han Gao, Ard Biesheuvel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Han Gao <gaohan@iscas.ac.cn>
[ Upstream commit 7d49d6e0898680925ea410cbb9d1a6a0e6441462 ]
EFI_MEMORY_MAPPED_IO regions are mapped with PAGE_KERNEL, so device
registers end up mapped as normal memory.
On Milk-V Pioneer, GetTime() reads the clock controller registers and
faults:
Oops - load access fault [#1]
Workqueue: efi_runtime efi_call_rts
status: 0000000200000120 badaddr: 0000007030012000 cause: 0000000000000005
Use PAGE_KERNEL_IO for these regions.
Fixes: b91540d52a08 ("RISC-V: Add EFI runtime services")
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/riscv/kernel/efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
index b64bf1624a052..0cf27d4e10f0d 100644
--- a/arch/riscv/kernel/efi.c
+++ b/arch/riscv/kernel/efi.c
@@ -22,7 +22,7 @@ static __init pgprot_t efimem_to_pgprot_map(efi_memory_desc_t *md)
u32 type = md->type;
if (type == EFI_MEMORY_MAPPED_IO)
- return PAGE_KERNEL;
+ return PAGE_KERNEL_IO;
/* R-- */
if ((attr & (EFI_MEMORY_XP | EFI_MEMORY_RO)) ==
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 227/703] net: do not run out of frags in alloc_skb_with_frags()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (223 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 226/703] riscv: efi: Map runtime MMIO with device attributes Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 228/703] net/mlx5: E-Switch, skip vport change work for disabled vports Greg Kroah-Hartman
` (182 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haishuang Yan, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
[ Upstream commit 5924465bb4e986eae6809c899ddaf38d3897f55d ]
alloc_skb_with_frags() can need more than MAX_SKB_FRAGS frags for a
data_len that passed its size check, and then fails with -ENOBUFS:
- the tail is split into one frag per bit set in its page count;
- after a failed high-order allocation, the order is lowered without
checking that the frags left can hold the rest.
tun hits this with large GSO packets from a vhost-net guest.
Use one larger page for the tail when splitting it would not fit. Only
lower the order if the rest still fits, else retry the same order with
direct reclaim. If that retry fails too, the allocation still fails.
Found while prototyping >64K TSO in a virtio-net guest. Tested with that
guest, page allocation fault injection and the KUnit test in patch 2.
Fixes: 09c2c90705bb ("net: allow alloc_skb_with_frags() to allocate bigger packets")
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261116115620.18151-2-yanhaishuang@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 27eb14c2b330f..7d05b11c9880f 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6769,17 +6769,40 @@ struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
while (data_len) {
if (nr_frags == MAX_SKB_FRAGS)
goto failure;
- while (order && PAGE_ALIGN(data_len) < (PAGE_SIZE << order))
- order--;
+ if (order && PAGE_ALIGN(data_len) < (PAGE_SIZE << order)) {
+ unsigned long pages = DIV_ROUND_UP(data_len, PAGE_SIZE);
+
+ /* If splitting the rest into smaller pages would need
+ * more frags than we have left, use one larger page.
+ */
+ if (hweight_long(pages) > MAX_SKB_FRAGS - nr_frags)
+ order = order_base_2(pages);
+ else
+ order = ilog2(pages);
+ }
if (order) {
page = alloc_pages((gfp_mask & ~__GFP_DIRECT_RECLAIM) |
__GFP_COMP |
__GFP_NOWARN,
order);
- if (!page) {
- order--;
- continue;
+ if (unlikely(!page)) {
+ unsigned int shift = PAGE_SHIFT + order - 1;
+
+ /* Can smaller pages hold the rest? */
+ if (((data_len - 1) >> shift) + 1 <=
+ MAX_SKB_FRAGS - nr_frags) {
+ order--;
+ continue;
+ }
+ /* No, retry this order with direct reclaim. */
+ if (!gfpflags_allow_blocking(gfp_mask))
+ goto failure;
+ page = alloc_pages(gfp_mask | __GFP_COMP |
+ __GFP_NOWARN | __GFP_NORETRY,
+ order);
+ if (!page)
+ goto failure;
}
} else {
page = alloc_page(gfp_mask);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 228/703] net/mlx5: E-Switch, skip vport change work for disabled vports
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (224 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 227/703] net: do not run out of frags in alloc_skb_with_frags() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 229/703] ice: use global queue index in TC to-queue offload Greg Kroah-Hartman
` (181 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Uri Dar, Shay Drory, Mark Bloch,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uri Dar <udar@nvidia.com>
[ Upstream commit 890f23ba87a7ca1aba97c8320770a686e3b689fb ]
A vport change work can still be pending when its vport is disabled.
For an SF, the vport is then freed in FW and the work's query fails
with syndrome 0x29d722. A disabled vport has nothing to sync, so skip
the work.
Fixes: d970812b91d0 ("net/mlx5: E-switch, Add eswitch helpers for SF vport")
Signed-off-by: Uri Dar <udar@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261118165155.1946097-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 19d203b049512..004c3c217cc52 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -758,7 +758,8 @@ static void esw_vport_change_handler(struct work_struct *work)
struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
mutex_lock(&esw->state_lock);
- esw_vport_change_handle_locked(vport);
+ if (vport->enabled)
+ esw_vport_change_handle_locked(vport);
mutex_unlock(&esw->state_lock);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 229/703] ice: use global queue index in TC to-queue offload
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (225 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 228/703] net/mlx5: E-Switch, skip vport change work for disabled vports Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 230/703] ice: allow reading the last byte of the NVM and Shadow RAM regions Greg Kroah-Hartman
` (180 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aleksandr Loktionov,
Michal Swiatkowski, Simon Horman, Alexander Nowlin, Tony Nguyen,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
[ Upstream commit 9175e1d6d2f0d4f353682833f78188cb35b80e4d ]
Previously index within PF was used, which caused rules to fail on any PF
other than PF0. Switch to global queue index by adding first RX queue id
from caps.
Triggered during code development. Validated on HW by adding different
set of to queue rules on various PFs
Fixes: 143b86f346c7 ("ice: Enable RX queue selection using skbedit action")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Alexander Nowlin <alexander.nowlin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://patch.msgid.link/20261113231225.1864810-2-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index fb9ea7f8ef444..9ce2aba9b59b1 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -1202,7 +1202,8 @@ ice_add_tc_flower_adv_fltr(struct ice_vsi *vsi,
break;
case ICE_FWD_TO_Q:
/* HW queue number in global space */
- rule_info.sw_act.fwd_id.q_id = tc_fltr->action.fwd.q.hw_queue;
+ rule_info.sw_act.fwd_id.q_id = tc_fltr->action.fwd.q.hw_queue +
+ hw->func_caps.common_cap.rxq_first_id;
rule_info.sw_act.vsi_handle = dest_vsi->idx;
rule_info.priority = ICE_SWITCH_FLTR_PRIO_QUEUE;
rule_info.sw_act.src = hw->pf_id;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 230/703] ice: allow reading the last byte of the NVM and Shadow RAM regions
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (226 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 229/703] ice: use global queue index in TC to-queue offload Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 231/703] ALSA: hda: intel: Release i915 power also when delayed probe fails Greg Kroah-Hartman
` (179 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Petr Oros, Przemek Kitszel,
Jacob Keller, Alexander Nowlin, Tony Nguyen, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Oros <poros@redhat.com>
[ Upstream commit dc84cae413bdcebfe130803022b8e02abc2ffa83 ]
ice_devlink_nvm_read() rejects a read whose end lands exactly on the
region size, so feeding back the size devlink itself reports fails:
devlink region show pci/0000:04:00.0/nvm-flash
pci/0000:04:00.0/nvm-flash: size 10485760 snapshot [] max 1
devlink region read pci/0000:04:00.0/nvm-flash address 0 length 10485760
Error: ice: Cannot read beyond the region size.
shadow-ram behaves the same. The regions are created with those sizes, so
a read ending on the size is the whole region and has to be allowed.
ice_read_flat_nvm() uses > for its own Shadow RAM check, and so does
ixgbe, which grew its region support from this code.
Fixes: 3af4b40b0f2f ("ice: implement direct read for NVM and Shadow RAM regions")
Signed-off-by: Petr Oros <poros@redhat.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Alexander Nowlin <alexander.nowlin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://patch.msgid.link/20261113231225.1864810-7-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ice/devlink/devlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index 4bd377a668421..2566fabf78559 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -1947,7 +1947,7 @@ static int ice_devlink_nvm_read(struct devlink *devlink,
return -EOPNOTSUPP;
}
- if (offset + size >= nvm_size) {
+ if (offset + size > nvm_size) {
NL_SET_ERR_MSG_MOD(extack, "Cannot read beyond the region size");
return -ERANGE;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 231/703] ALSA: hda: intel: Release i915 power also when delayed probe fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (227 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 230/703] ice: allow reading the last byte of the NVM and Shadow RAM regions Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 232/703] tools/bootconfig: Use the registered global tracing parameter names Greg Kroah-Hartman
` (178 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michal Grzelak, Kai Vehmanen,
Takashi Iwai, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
[ Upstream commit 0a5550dd94e61852941fb37142f4664ecddef312 ]
Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
work") stopped freeing the card from azx_probe_work() when the delayed
probe fails, and only disconnects it, leaving the free to azx_remove().
This avoids the double free, but the resources that were released by
the card free via azx_free() are now kept until the PCI device is
unbound. In particular the display power reference stay held, blocking
runtime suspend for i915/xe.
Release the display power in the azx_probe_continue() work in all cases.
This power reference is only taken for the purpose of the display codec
probe. If the display codec probe was successful, it will have taken its
own reference. In case of systems with the HDA controller on GPU side
(hda->need_i915_power), functionality is same as before - we have to
keep power.
Fixes: fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe work")
Reported-by: Michal Grzelak <michal.grzelak@intel.com>
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20261120150937.2187228-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/controllers/intel.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
index 6390fc91c0a45..a543580561cf6 100644
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -2385,6 +2385,9 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
}
out_free:
+ if (!hda->need_i915_power)
+ display_power(chip, false);
+
if (err < 0) {
if (hda->vga_switcheroo_registered)
dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
@@ -2395,8 +2398,6 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
return err;
}
- if (!hda->need_i915_power)
- display_power(chip, false);
complete_all(&hda->probe_wait);
to_hda_bus(bus)->bus_probing = 0;
hda->probe_retry = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 232/703] tools/bootconfig: Use the registered global tracing parameter names
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (228 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 231/703] ALSA: hda: intel: Release i915 power also when delayed probe fails Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 233/703] tracing/fprobe: Do not let KASAN check the $stackN read Greg Kroah-Hartman
` (177 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eduardo Mucelli Rezende Oliveira,
Masami Hiramatsu (Google), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
[ Upstream commit 51934668ca98f1b23c51ce4edea3c61018da342c ]
The boot-time tracing guide lists four kernel.* keys that do not match
the parameters registered by the tracing code. For example,
ftrace2bconf.sh emits kernel.fgraph_max_depth, which bootconfig passes
as fgraph_max_depth on the kernel command line. The function-graph
tracer registers ftrace_graph_max_depth.
Use the registered names in the guide and the exporter. Teach
bconf2ftrace.sh to read those names, with the previous script keys as
fallbacks so existing replay configurations still work.
Link: https://lore.kernel.org/all/fecf6e33d4f7e2ddf031526e7a1abef27e28f754.1795307698.git.edumucelli@gmail.com/
Fixes: 47781947947a ("Documentation: tracing: Add boot-time tracing document")
Fixes: 7e66ef0046cc ("tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig")
Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/trace/boottime-trace.rst | 8 ++++----
tools/bootconfig/scripts/bconf2ftrace.sh | 21 ++++++++++++++++-----
tools/bootconfig/scripts/ftrace2bconf.sh | 5 +++--
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime-trace.rst
index 651f3a2c01de8..1bacbd13fb5f0 100644
--- a/Documentation/trace/boottime-trace.rst
+++ b/Documentation/trace/boottime-trace.rst
@@ -36,20 +36,20 @@ these options are passed as a part of kernel legacy command line.
kernel.tp_printk
Output trace-event data on printk buffer too.
-kernel.dump_on_oops [= MODE]
+kernel.ftrace_dump_on_oops [= MODE]
Dump ftrace on Oops. If MODE = 1 or omitted, dump trace buffer
on all CPUs. If MODE = 2, dump a buffer on a CPU which kicks Oops.
kernel.traceoff_on_warning
Stop tracing if WARN_ON() occurs.
-kernel.fgraph_max_depth = MAX_DEPTH
+kernel.ftrace_graph_max_depth = MAX_DEPTH
Set MAX_DEPTH to maximum depth of fgraph tracer.
-kernel.fgraph_filters = FILTER[, FILTER2...]
+kernel.ftrace_graph_filter = FILTER[, FILTER2...]
Add fgraph tracing function filters.
-kernel.fgraph_notraces = FILTER[, FILTER2...]
+kernel.ftrace_graph_notrace = FILTER[, FILTER2...]
Add fgraph non-tracing function filters.
diff --git a/tools/bootconfig/scripts/bconf2ftrace.sh b/tools/bootconfig/scripts/bconf2ftrace.sh
index 850c2073433e1..ba29f7411f62a 100755
--- a/tools/bootconfig/scripts/bconf2ftrace.sh
+++ b/tools/bootconfig/scripts/bconf2ftrace.sh
@@ -275,15 +275,26 @@ setup_instance() { # [instance]
}
# ftrace global configs (kernel.*)
-if xbc_has_key "kernel.dump_on_oops"; then
- dump_mode=`xbc_get_val "kernel.dump_on_oops" 1`
+# Prefer the kernel parameter names and accept the old script keys as fallbacks.
+dump_key=kernel.ftrace_dump_on_oops
+xbc_has_key "$dump_key" || dump_key=kernel.dump_on_oops
+if xbc_has_key "$dump_key"; then
+ dump_mode=`xbc_get_val "$dump_key" 1`
[ "$dump_mode" ] && dump_mode=`eval echo $dump_mode` || dump_mode=1
run_cmd "echo \"$dump_mode\" > /proc/sys/kernel/ftrace_dump_on_oops"
fi
-set_value_of kernel.fgraph_max_depth $TRACEFS/max_graph_depth
-set_array_of kernel.fgraph_filters $TRACEFS/set_graph_function
-set_array_of kernel.fgraph_notraces $TRACEFS/set_graph_notrace
+graph_depth_key=kernel.ftrace_graph_max_depth
+xbc_has_key "$graph_depth_key" || graph_depth_key=kernel.fgraph_max_depth
+set_value_of "$graph_depth_key" $TRACEFS/max_graph_depth
+
+graph_filter_key=kernel.ftrace_graph_filter
+xbc_has_key "$graph_filter_key" || graph_filter_key=kernel.fgraph_filters
+set_array_of "$graph_filter_key" $TRACEFS/set_graph_function
+
+graph_notrace_key=kernel.ftrace_graph_notrace
+xbc_has_key "$graph_notrace_key" || graph_notrace_key=kernel.fgraph_notraces
+set_array_of "$graph_notrace_key" $TRACEFS/set_graph_notrace
# Per-instance/per-event configs
if ! xbc_has_branch "ftrace" ; then
diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index 1603801cf1264..564a3085525f3 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -46,10 +46,11 @@ emit_kv() { # key =|+= value
global_options() {
val=`cat $TRACEFS/max_graph_depth`
- [ $val != 0 ] && emit_kv kernel.fgraph_max_depth = $val
+ [ $val != 0 ] && emit_kv kernel.ftrace_graph_max_depth = $val
if grep -qv "^#" $TRACEFS/set_graph_function $TRACEFS/set_graph_notrace ; then
cat 1>&2 << EOF
-# WARN: kernel.fgraph_filters and kernel.fgraph_notrace are not supported, since the wild card expression was expanded and lost from memory.
+# WARN: Cannot export kernel.ftrace_graph_filter and kernel.ftrace_graph_notrace.
+# Only the expanded function list is available.
EOF
fi
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 233/703] tracing/fprobe: Do not let KASAN check the $stackN read
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (229 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 232/703] tools/bootconfig: Use the registered global tracing parameter names Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 234/703] tun: complete the zerocopy buffer of packets consumed by XDP Greg Kroah-Hartman
` (176 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yifan Feng,
Masami Hiramatsu (Google), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Feng <evanfengff@gmail.com>
[ Upstream commit 49276f7c85ba1c140b2605b816a2596d02b36ba4 ]
ftrace_regs_get_kernel_stack_nth() reads the Nth entry of the kernel
stack for the $stackN argument of fprobe and tracepoint probe events.
That entry can be in the redzone of another stack frame, so with
CONFIG_KASAN_STACK every hit of such an event is reported:
# echo 'f:fp_read vfs_read $stack10' >> dynamic_events
# echo 1 > events/fprobes/fp_read/enable
BUG: KASAN: stack-out-of-bounds in process_fetch_insn+0xac9/0xcb0
Use READ_ONCE_NOCHECK(), as arm64 does in regs_get_kernel_stack_nth()
for kprobe events.
Link: https://lore.kernel.org/all/20261118003205.59804-1-evanfengff@gmail.com/
Fixes: 0566cefe73b9 ("tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/ftrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 62e85b2c65168..8ab04ea1dd75f 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -269,7 +269,7 @@ ftrace_regs_get_kernel_stack_nth(struct ftrace_regs *fregs, unsigned int nth)
stackp = (unsigned long *)ftrace_regs_get_stack_pointer(fregs);
if (((unsigned long)(stackp + nth) & ~(THREAD_SIZE - 1)) ==
((unsigned long)stackp & ~(THREAD_SIZE - 1)))
- return *(stackp + nth);
+ return READ_ONCE_NOCHECK(*(stackp + nth));
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 234/703] tun: complete the zerocopy buffer of packets consumed by XDP
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (230 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 233/703] tracing/fprobe: Do not let KASAN check the $stackN read Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 235/703] tools: gpio-hammer: Accept the maximum number of line offsets Greg Kroah-Hartman
` (175 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Antonio Quartulli, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <antonio@mandelbit.com>
[ Upstream commit 3896ae4adf5ffc11ffd0f7f42c3923e8dc195e75 ]
When vhost-net passes a zerocopy buffer that tun_get_user() does not use,
because the packet spans too many pages, the packet is copied and the
buffer completed. If the copy goes through build_skb() and native XDP
consumes the packet (DROP, TX or REDIRECT), tun_get_user() returns
without completing it: vhost-net never gets the descriptor back, and
closing the vhost-net device then blocks forever.
Complete it in that case too, as copied.
Reproducer: vhost-net with experimental_zcopytx=1 on a tap device with a
native XDP_DROP program; send one 806-byte packet as 40 descriptors, each
in its own page. The descriptor is never returned and close() of the
vhost-net fd does not return. With the patch it is returned.
Tested in an x86-64 VM with the reproducer and the tun kselftest.
Found by the Sashiko AI review bot, as a pre-existing issue while
reviewing an unrelated tun patch, and confirmed with the reproducer.
Link: https://sashiko.dev/#/bug/linux-f9997fb6-303f-41d6-93e2-60c392b1856f
Fixes: 761876c857cb ("tap: XDP support")
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Link: https://patch.msgid.link/20261113232843.2338734-1-antonio@mandelbit.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index b244ae7f4d5eb..d0e7252d8d363 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1790,8 +1790,15 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
err = PTR_ERR_OR_ZERO(skb);
if (err)
goto drop;
- if (!skb)
+ if (!skb) {
+ /* consumed by XDP, after copying */
+ if (msg_control) {
+ struct ubuf_info *uarg = msg_control;
+
+ uarg->ops->complete(NULL, uarg, false);
+ }
return total_len;
+ }
} else {
if (!zerocopy) {
copylen = len;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 235/703] tools: gpio-hammer: Accept the maximum number of line offsets
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (231 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 234/703] tun: complete the zerocopy buffer of packets consumed by XDP Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 236/703] tools: gpio: Preserve device listing errors in lsgpio Greg Kroah-Hartman
` (174 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Jun, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
[ Upstream commit 0b3f1876d6db7fad0391ce714b315269b0dd5758 ]
The offset count is incremented for every -o option, but the final
check rejects the maximum itself and reports one extra offset. Only
reject counts above the maximum and report the actual count.
Fixes: d1ee7e1f5c91 ("tools: gpio-hammer: Avoid potential overflow in main")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261120061827.98066-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/gpio/gpio-hammer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/gpio/gpio-hammer.c b/tools/gpio/gpio-hammer.c
index ba0866eb35814..1b33691a68a36 100644
--- a/tools/gpio/gpio-hammer.c
+++ b/tools/gpio/gpio-hammer.c
@@ -159,10 +159,10 @@ int main(int argc, char **argv)
}
}
- if (i >= GPIOHANDLES_MAX) {
+ if (i > GPIOHANDLES_MAX) {
fprintf(stderr,
"Only %d occurrences of '-o' are allowed, %d were found\n",
- GPIOHANDLES_MAX, i + 1);
+ GPIOHANDLES_MAX, i);
return -1;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 236/703] tools: gpio: Preserve device listing errors in lsgpio
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (232 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 235/703] tools: gpio-hammer: Accept the maximum number of line offsets Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 237/703] tools: gpio: Return success after monitoring requested events Greg Kroah-Hartman
` (173 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Jun, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
[ Upstream commit 809117fc28453aafa7164ad45ea853f900974d08 ]
When no chip is selected, lsgpio breaks out of the directory scan on a
list_device() failure, then unconditionally resets ret to zero. A chip
that cannot be opened or queried is therefore reported as success.
Initialize ret to zero before scanning instead, so an empty scan still
succeeds and errors from list_device() reach the caller.
Fixes: 6d591c46bce0 ("tools/gpio: create GPIO tools")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261120062053.98356-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/gpio/lsgpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
index 52a0be45410c9..de2eccc134796 100644
--- a/tools/gpio/lsgpio.c
+++ b/tools/gpio/lsgpio.c
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
goto error_out;
}
- ret = -ENOENT;
+ ret = 0;
while (ent = readdir(dp), ent) {
if (check_prefix(ent->d_name, "gpiochip")) {
ret = list_device(ent->d_name);
@@ -214,7 +214,6 @@ int main(int argc, char **argv)
}
}
- ret = 0;
if (closedir(dp) == -1) {
perror("scanning devices: Failed to close directory");
ret = -errno;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 237/703] tools: gpio: Return success after monitoring requested events
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (233 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 236/703] tools: gpio: Preserve device listing errors in lsgpio Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 238/703] s390/cert_store: Allocate keyring with link restriction Greg Kroah-Hartman
` (172 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhu Jun, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Jun <zhujun2@cmss.chinamobile.com>
[ Upstream commit 1eaf27d99938dd30ea7855174b65e37a2503a349 ]
After reading the requested number of events, monitor_device() returns
the positive byte count left in ret by read(). main() passes this value
through as the exit status, so a successful invocation with -c reports
failure.
Clear ret when the event limit is reached, keeping read failures on their
existing error paths.
Fixes: 97f69747d8b1 ("tools/gpio: add the gpio-event-mon tool")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261120062107.98391-1-zhujun2@cmss.chinamobile.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/gpio/gpio-event-mon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c
index b70813b0bf8ef..af223e254bc98 100644
--- a/tools/gpio/gpio-event-mon.c
+++ b/tools/gpio/gpio-event-mon.c
@@ -124,8 +124,10 @@ int monitor_device(const char *device_name,
fprintf(stdout, "\n");
i++;
- if (i == loops)
+ if (i == loops) {
+ ret = 0;
break;
+ }
}
exit_line_close:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 238/703] s390/cert_store: Allocate keyring with link restriction
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (234 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 237/703] tools: gpio: Return success after monitoring requested events Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 239/703] s390/cert_store: Only allow the kernel to create cert_store_key keys Greg Kroah-Hartman
` (171 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anastasia Eskova, Jarkko Sakkinen,
Heiko Carstens, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Eskova <anastasia.eskova@ibm.com>
[ Upstream commit 602af7b1c19309330a36ffe787336cb95e040ab1 ]
The keyring is linked into the user session keyring on allocation, but
keyring_restrict() is only called after all certificates were added.
Until then a possessor of the keyring can link arbitrary keys into it.
If keyring_restrict() fails, the error is only logged and the keyring
stays writable.
Allocate the keyring with a restriction which rejects all links, create
the certificate keys with KEY_ALLOC_BYPASS_RESTRICTION and drop the late
keyring_restrict() call.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Anastasia Eskova <anastasia.eskova@ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index d8f1c1cd6b1a2..8c93b94335624 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -402,6 +402,7 @@ static void cleanup_cs_keys(void)
static struct key *create_cs_keyring(void)
{
+ struct key_restriction *restriction;
struct key *cs_keyring, *us_keyring;
/* Cleanup previous cs_keyring and all associated keys if any. */
@@ -409,13 +410,21 @@ static struct key *create_cs_keyring(void)
us_keyring = get_user_session_keyring();
if (IS_ERR(us_keyring))
return NULL;
+ restriction = kzalloc_obj(*restriction);
+ if (!restriction) {
+ key_put(us_keyring);
+ return NULL;
+ }
+ /* Reject all links, the kernel bypasses the restriction. */
+ restriction->check = restrict_link_reject;
cs_keyring = keyring_alloc(CERT_STORE_KEYRING_NAME, GLOBAL_ROOT_UID,
GLOBAL_ROOT_GID, current_cred(),
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_SET_KEEP,
- NULL, us_keyring);
+ restriction, us_keyring);
key_put(us_keyring);
if (IS_ERR(cs_keyring)) {
+ kfree(restriction);
pr_dbf_msg("Can't allocate cert_store keyring");
return NULL;
}
@@ -478,7 +487,7 @@ static int create_key_from_vce(struct vcssb *vcssb, struct vce *vce,
desc, (u8 *)vce + vce->vce_hdr.vc_offset,
vce->vce_hdr.vc_length,
(KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ,
- KEY_ALLOC_NOT_IN_QUOTA);
+ KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_BYPASS_RESTRICTION);
rc = PTR_ERR_OR_ZERO(newkey);
if (rc) {
@@ -646,14 +655,6 @@ static int add_certificates_to_keyring(struct vcssb *vcssb, struct key *keyring)
pr_info("Added %d of %d keys to cert_store keyring", added, count);
- /*
- * Do not allow to link more keys to certificate store keyring after all
- * the VCEs were processed.
- */
- rc = keyring_restrict(make_key_ref(keyring, true), NULL, NULL);
- if (rc)
- pr_dbf_msg("Failed to set restriction to cert_store keyring (%d)", rc);
-
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 239/703] s390/cert_store: Only allow the kernel to create cert_store_key keys
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (235 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 238/703] s390/cert_store: Allocate keyring with link restriction Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 240/703] chardev: GPIO common access methods: repair non-kernel-doc comment Greg Kroah-Hartman
` (170 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anastasia Eskova, Jarkko Sakkinen,
Heiko Carstens, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Eskova <anastasia.eskova@ibm.com>
[ Upstream commit 23a04cb4f2bdbfc87fc4e1c15450e7f8cfc9842a ]
Keys of type cert_store_key can be created by any user with add_key() in
any keyring, as the key type has no vet_description() callback. The type
is registered whenever CONFIG_CERT_STORE is enabled, even if the machine
has no DIAG 320 support.
cert_store_key_describe() expects a description in the format created by
get_key_description(), i.e. a 64 byte key name followed by the VCE index
and the certificate store token. If a key with a shorter description is
created, seq_puts() may read beyond the end of the description
allocation. Reading /proc/keys may then disclose adjacent kernel heap
memory to the user space. Also, a consumer which trusts keys by type can
be fooled by keys that were not created from the certificate store.
Add a vet_description() callback which only accepts the task currently
executing refresh_store(), which creates all valid keys of this type.
Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates")
Signed-off-by: Anastasia Eskova <anastasia.eskova@ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/cert_store.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c
index 8c93b94335624..791c35dd50161 100644
--- a/arch/s390/kernel/cert_store.c
+++ b/arch/s390/kernel/cert_store.c
@@ -45,6 +45,9 @@
static debug_info_t *cert_store_dbf;
static debug_info_t *cert_store_hexdump;
+/* Task currently running refresh_store(). Written under cs_refresh_lock. */
+static struct task_struct *cs_refresh_task;
+
#define pr_dbf_msg(fmt, ...) \
debug_sprintf_event(cert_store_dbf, 3, fmt "\n", ## __VA_ARGS__)
@@ -147,12 +150,24 @@ static void cert_store_key_describe(const struct key *key, struct seq_file *m)
seq_printf(m, ": %u", key->datalen);
}
+/*
+ * Only the kernel may create keys of this type. Accept the task which runs
+ * refresh_store(), as it cannot execute userspace during the refresh.
+ */
+static int cert_store_key_vet_description(const char *description)
+{
+ if (READ_ONCE(cs_refresh_task) != current)
+ return -EPERM;
+ return 0;
+}
+
/*
* Certificate store key type takes over properties of
* user key but cannot be updated.
*/
static struct key_type key_type_cert_store_key = {
.name = CERT_STORE_KEY_TYPE_NAME,
+ .vet_description = cert_store_key_vet_description,
.preparse = user_preparse,
.free_preparse = user_free_preparse,
.instantiate = generic_key_instantiate,
@@ -761,6 +776,7 @@ static ssize_t refresh_store(struct kobject *kobj, struct kobj_attribute *attr,
if (rc)
return rc;
+ WRITE_ONCE(cs_refresh_task, current);
for (retries = 0; retries < DIAG_MAX_RETRIES; retries++) {
/* Request certificates from certificate store. */
rc = fill_cs_keyring();
@@ -769,6 +785,7 @@ static ssize_t refresh_store(struct kobject *kobj, struct kobj_attribute *attr,
if (rc != -EAGAIN)
break;
}
+ WRITE_ONCE(cs_refresh_task, NULL);
cs_status_val = rc;
mutex_unlock(&cs_refresh_lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 240/703] chardev: GPIO common access methods: repair non-kernel-doc comment
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (236 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 239/703] s390/cert_store: Only allow the kernel to create cert_store_key keys Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 241/703] tun: flush uc and mc addresses in TUNSETLINK Greg Kroah-Hartman
` (169 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Randy Dunlap, Jim Cromie,
Linus Walleij, Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <rdunlap@infradead.org>
[ Upstream commit d4dc896fa2bdfd7d1a78911598a0fa3e3c831d92 ]
Change a "/**" non-kernel-doc comment to a plain C comment "/*"
to avoid 21 warnings like these:
Warning: ./include/linux/nsc_gpio.h:2 Cannot find identifier on line:
nsc_gpio.c
Warning: ./include/linux/nsc_gpio.h:4 Cannot find identifier on line:
National Semiconductor GPIO common access methods.
Warning: ./include/linux/nsc_gpio.h:6 Cannot find identifier on line:
struct nsc_gpio_ops abstracts the low-level access
Fixes: fe3a168a2ce1 ("[PATCH] chardev: GPIO for SCx200 & PC-8736x: add gpio-ops vtable")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261123004501.1771603-1-rdunlap@infradead.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/nsc_gpio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/nsc_gpio.h b/include/linux/nsc_gpio.h
index d7a04a6e3783a..342ce97975e8a 100644
--- a/include/linux/nsc_gpio.h
+++ b/include/linux/nsc_gpio.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
-/**
+/*
nsc_gpio.c
National Semiconductor GPIO common access methods.
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 241/703] tun: flush uc and mc addresses in TUNSETLINK
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (237 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 240/703] chardev: GPIO common access methods: repair non-kernel-doc comment Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 242/703] btrfs: send: fix missing hole punching during incremental send Greg Kroah-Hartman
` (168 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Willem de Bruijn,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 5677cf0e039b3cabf79d5aa10facbdb54aea93c6 ]
TUNSETLINK changes dev->type and dev->addr_len, but leaves
dev->uc and dev->mc untouched.
Entries added with the old addr_len stay in lists and rb-trees
that are now searched and dumped with the new addr_len.
When addr_len grows (eg ARPHRD_NONE -> ARPHRD_IP6GRE), dumps like
/proc/net/dev_mcast and RTM_GETMULTICAST expose bytes of
netdev_hw_addr that were never initialized.
bonding and team already call dev_uc_flush() and dev_mc_flush()
between NETDEV_PRE_TYPE_CHANGE and the type change. Do the same
in tun, but only when addr_len changes: if it does not, existing
entries are still valid and there is no reason to drop them.
Fixes: cca8ea3b05c9 ("net: tun: set tun->dev->addr_len during TUNSETLINK processing")
Link: https://lore.kernel.org/netdev/20261116024056.1274402-1-bsdhenrymartin@gmail.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261118125443.1137177-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d0e7252d8d363..4419f7d1f50b7 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3247,6 +3247,8 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
(unsigned short)arg == ARPHRD_6LOWPAN) {
ret = -EINVAL;
} else {
+ unsigned char addr_len = tun_get_addr_len(arg);
+
ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
tun->dev);
ret = notifier_to_errno(ret);
@@ -3255,8 +3257,13 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
"Refused to change device type\n");
break;
}
+ /* Addresses were added with the old dev->addr_len. */
+ if (addr_len != tun->dev->addr_len) {
+ dev_uc_flush(tun->dev);
+ dev_mc_flush(tun->dev);
+ }
tun->dev->type = (int) arg;
- tun->dev->addr_len = tun_get_addr_len(tun->dev->type);
+ tun->dev->addr_len = addr_len;
netif_info(tun, drv, tun->dev, "linktype set to %d\n",
tun->dev->type);
call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 242/703] btrfs: send: fix missing hole punching during incremental send
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (238 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 241/703] tun: flush uc and mc addresses in TUNSETLINK Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 243/703] btrfs: send: fix invalid access to inline extents in clone_range() Greg Kroah-Hartman
` (167 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tristan Elvers, Qu Wenruo,
Filipe Manana, David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 398ee8a011d9187e83fc24738b3391e508da91da ]
When using the no-holes feature (enabled by default since btrfs-progs
v5.15) and doing an incremental send, we can miss issuing a hole punching
command when the following conditions happen:
1) A hole is punched in a tail section of a file extent item that happens
to be the last item in a leaf (for example the extent covers the file
range [1M, 3M) and a hole is punched in the range [2M, 3M)). Between
the end of this file extent item's range and the i_size, there are
other file extent items;
2) The next leaf was not modified in the send snapshot, remaining shared
with the parent snapshot.
In this scenario we are unable to detect a hole was punched and never
issue a hole punch command because with no-holes there we don't have an
explicit file extent item to mark a hole.
Fix this by teaching maybe_send_hole() to detect such case.
A test case for fstests will follow soon.
Reported-by: Tristan Elvers <tristanelvers@gmail.com>
Link: https://lore.kernel.org/linux-btrfs/CAFoLKK+aErV4p6ZJPnVeH5SHQ5++0f=8ZgxPWe-E-CkeKBs8PA@mail.gmail.com/
Fixes: 16e7549f045d ("Btrfs: incompatible format change to remove hole extents")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/send.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 65 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 9067c3ce00cfa..718c6c2f23877 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6401,6 +6401,9 @@ static int range_is_hole_in_parent(struct send_ctx *sctx,
static int maybe_send_hole(struct send_ctx *sctx, struct btrfs_path *path,
struct btrfs_key *key)
{
+ BTRFS_PATH_AUTO_FREE(next_path);
+ const u64 cur_extent_end = btrfs_file_extent_end(path);
+ u64 next_offset;
int ret = 0;
if (sctx->cur_ino != key->objectid || !need_send_hole(sctx))
@@ -6427,14 +6430,72 @@ static int maybe_send_hole(struct send_ctx *sctx, struct btrfs_path *path,
ret = range_is_hole_in_parent(sctx,
sctx->cur_inode_last_extent,
key->offset);
+ if (ret == 0)
+ ret = send_hole(sctx, key->offset);
+ else if (ret == 1)
+ ret = 0;
+
if (ret < 0)
return ret;
- else if (ret == 0)
- ret = send_hole(sctx, key->offset);
+ }
+ sctx->cur_inode_last_extent = cur_extent_end;
+
+ /*
+ * If we are the last file extent item in a leaf, we may have had a tail
+ * section that got a hole punched or the extent replaced with a smaller
+ * one, and if there is no change in the next leaf, we must find out if
+ * we have such a hole and punch it.
+ */
+ if (!btrfs_fs_incompat(sctx->send_root->fs_info, NO_HOLES) ||
+ (sctx->cur_inode_size <= cur_extent_end) ||
+ (path->slots[0] != btrfs_header_nritems(path->nodes[0]) - 1))
+ return 0;
+
+ next_path = alloc_path_for_send();
+ if (!next_path)
+ return -ENOMEM;
+
+ ret = btrfs_search_slot(NULL, sctx->send_root, key, next_path, 0, 0);
+ if (ret < 0)
+ return ret;
+ if (WARN_ON(ret != 0))
+ return -EUCLEAN;
+
+ ret = btrfs_next_leaf(sctx->send_root, next_path);
+ if (ret < 0) {
+ return ret;
+ } else if (ret > 0) {
+ /*
+ * No next leaf, must punch hole to i_size and set the path back
+ * to where it was before.
+ */
+ next_offset = sctx->cur_inode_size;
+ } else {
+ struct btrfs_key next_key;
+
+ btrfs_item_key_to_cpu(next_path->nodes[0], &next_key,
+ next_path->slots[0]);
+ if (next_key.objectid != key->objectid ||
+ next_key.type != BTRFS_EXTENT_DATA_KEY)
+ next_offset = sctx->cur_inode_size;
else
- ret = 0;
+ next_offset = next_key.offset;
}
- sctx->cur_inode_last_extent = btrfs_file_extent_end(path);
+
+ if (next_offset == cur_extent_end)
+ return 0;
+
+ btrfs_free_path(next_path);
+ next_path = NULL;
+
+ ret = range_is_hole_in_parent(sctx, sctx->cur_inode_last_extent, next_offset);
+ if (ret == 0)
+ ret = send_hole(sctx, next_offset);
+ else if (ret == 1)
+ ret = 0;
+
+ sctx->cur_inode_last_extent = next_offset;
+
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 243/703] btrfs: send: fix invalid access to inline extents in clone_range()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (239 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 242/703] btrfs: send: fix missing hole punching during incremental send Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 244/703] btrfs: wait for a grace period before freeing a new device Greg Kroah-Hartman
` (166 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit beed53bd3cb5f0b0a0aad453aa6f0b49060ff2dc ]
We can't access the disk_bytenr and offset fields of a file extent item
that represents an inline extent, since the extent's data starts at the
offset of the disk_bytenr field and the offset field is after that, so
both fields point either to inline data or beyond the file extent item
in case the data is too small.
Fix this by not reading the disk_bytenr and offset fields if we are
dealing with an inline extent.
Link: https://sashiko.dev/#/bug/linux-b662b951-0491-465b-a262-f01a108d8146
Fixes: 040ee6120cb6 ("Btrfs: send, improve clone range")
Fixes: d906d49fc5f4 ("Btrfs: send, fix file corruption due to incorrect cloning operations")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/send.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 718c6c2f23877..b91c1d856e96c 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5872,7 +5872,7 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,
u8 type;
u64 ext_len;
u64 clone_len;
- u64 clone_data_offset;
+ u64 clone_data_offset = 0;
bool crossed_src_i_size = false;
if (slot >= btrfs_header_nritems(leaf)) {
@@ -5936,23 +5936,26 @@ static int clone_range(struct send_ctx *sctx, struct btrfs_path *dst_path,
crossed_src_i_size = true;
}
- clone_data_offset = btrfs_file_extent_offset(leaf, ei);
- if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte) {
- clone_root->offset = key.offset;
- if (clone_data_offset < data_offset &&
- clone_data_offset + ext_len > data_offset) {
- u64 extent_offset;
-
- extent_offset = data_offset - clone_data_offset;
- ext_len -= extent_offset;
- clone_data_offset += extent_offset;
- clone_root->offset += extent_offset;
+ if (type != BTRFS_FILE_EXTENT_INLINE) {
+ clone_data_offset = btrfs_file_extent_offset(leaf, ei);
+ if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte) {
+ clone_root->offset = key.offset;
+ if (clone_data_offset < data_offset &&
+ clone_data_offset + ext_len > data_offset) {
+ u64 extent_offset;
+
+ extent_offset = data_offset - clone_data_offset;
+ ext_len -= extent_offset;
+ clone_data_offset += extent_offset;
+ clone_root->offset += extent_offset;
+ }
}
}
clone_len = min_t(u64, ext_len, len);
- if (btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte &&
+ if (type != BTRFS_FILE_EXTENT_INLINE &&
+ btrfs_file_extent_disk_bytenr(leaf, ei) == disk_byte &&
clone_data_offset == data_offset) {
const u64 src_end = clone_root->offset + clone_len;
const u64 sectorsize = SZ_64K;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 244/703] btrfs: wait for a grace period before freeing a new device
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (240 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 243/703] btrfs: send: fix invalid access to inline extents in clone_range() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 245/703] ASoC: fsl_asrc_m2m: fix out-of-bounds write when draining the output FIFO Greg Kroah-Hartman
` (165 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Vacek, Binbin Deng,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit 38c94b99f8743a5b9aab864a12ecf9a06d36aeb4 ]
KASAN reports a slab-use-after-free in btrfs_statfs() walking
fs_devices->devices. btrfs_init_new_device() publishes the new device
with list_add_rcu() and can fail afterwards, for example with -ENOSPC
in init_first_rw_device() when a user with CAP_SYS_ADMIN adds a device
that is too small to a seeding filesystem mounted read-only. The error
path removes the entry with list_del_rcu() and frees the object in
btrfs_free_device() without waiting for a grace period, while
btrfs_calc_avail_data_space() and btrfs_ioctl_fs_info() keep reading
the device list under rcu_read_lock().
BUG: KASAN: slab-use-after-free in btrfs_statfs+0x11af/0x14a0
Read of size 8 at addr ffff8880096be858 by task poc/252
Call Trace:
<TASK>
dump_stack_lvl+0x53/0x70
print_report+0xd0/0x630
? __pfx__raw_spin_lock_irqsave+0x10/0x10
? filename_lookup+0x1a9/0x540
? btrfs_statfs+0x11af/0x14a0
kasan_report+0xce/0x100
? btrfs_statfs+0x11af/0x14a0
btrfs_statfs+0x11af/0x14a0
statfs_by_dentry+0x117/0x1e0
user_statfs+0xac/0x130
? __pfx_user_statfs+0x10/0x10
__do_sys_statfs+0x80/0xe0
? __pfx___do_sys_statfs+0x10/0x10
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Allocated by task 256:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0x8f/0xa0
__kmalloc_cache_noprof+0x158/0x370
btrfs_alloc_device+0xad/0x3e0
btrfs_init_new_device+0x3e8/0x36e0
btrfs_ioctl+0x150d/0x6c20
__x64_sys_ioctl+0x134/0x1c0
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 256:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x43/0x70
kfree+0x121/0x380
btrfs_init_new_device+0x4a0/0x36e0
btrfs_ioctl+0x150d/0x6c20
__x64_sys_ioctl+0x134/0x1c0
do_syscall_64+0xf9/0x540
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Fix by waiting for an RCU grace period after the device is removed
from the list and before it is freed.Place the synchronize_rcu() after
dropping the mutexes and before the `error_trans` label.
Fixes: 1f78160ce1b1 ("Btrfs: using rcu lock in the reader side of devices list")
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Binbin Deng <18983559317@163.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/volumes.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 3aa2f327ed7e6..ed0db22f0bda2 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3077,6 +3077,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
btrfs_update_per_profile_avail(fs_info);
mutex_unlock(&fs_info->chunk_mutex);
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
+ synchronize_rcu();
error_trans:
if (trans)
btrfs_end_transaction(trans);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 245/703] ASoC: fsl_asrc_m2m: fix out-of-bounds write when draining the output FIFO
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (241 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 244/703] btrfs: wait for a grace period before freeing a new device Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 246/703] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params Greg Kroah-Hartman
` (164 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefan Ghetu, Shengjiu Wang,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ghetu <stefan.ghetu@nxp.com>
[ Upstream commit 6b3f779dcac4ea16e232019b68650395ad55f5a2 ]
asrc_read_last_fifo() checks the FIFO fill level, a number of frames,
against a length in bytes, and ignores the frames already drained by
previous iterations of its retry loop. With an output length close to
the 512 KiB buffer size, which userspace controls through the task input
size and formats, the drain writes past the end of the output buffer:
312 bytes for 10 channels of S24_LE with 8 frames left in the FIFO.
Check the space needed by all drained frames in bytes.
Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20261116093751.138455-2-stefan.ghetu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl_asrc_m2m.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index a94ecb40f9e02..181aefa9be8f2 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -53,21 +53,27 @@ static void asrc_read_last_fifo(struct fsl_asrc_pair *pair, void *dma_vaddr, u32
{
struct fsl_asrc *asrc = pair->asrc;
enum asrc_pair_index index = pair->index;
- u32 i, reg, size, t_size = 0, width;
+ u32 i, reg, size, t_size = 0, width, sample_bytes, frame_bytes;
u32 *reg32 = NULL;
u16 *reg16 = NULL;
u8 *reg24 = NULL;
width = snd_pcm_format_physical_width(pair->sample_format[OUT]);
- if (width == 32)
+ if (width == 32) {
reg32 = dma_vaddr + *length;
- else if (width == 16)
+ sample_bytes = 4;
+ } else if (width == 16) {
reg16 = dma_vaddr + *length;
- else
+ sample_bytes = 2;
+ } else {
reg24 = dma_vaddr + *length;
+ sample_bytes = 3;
+ }
+
+ frame_bytes = pair->channels * sample_bytes;
retry:
size = asrc->get_output_fifo_size(pair);
- if (size + *length > ASRC_M2M_BUFFER_SIZE)
+ if (*length + (t_size + size) * frame_bytes > ASRC_M2M_BUFFER_SIZE)
goto end;
for (i = 0; i < size * pair->channels; i++) {
@@ -89,12 +95,7 @@ static void asrc_read_last_fifo(struct fsl_asrc_pair *pair, void *dma_vaddr, u32
goto retry;
end:
/* Update payload length */
- if (reg32)
- *length += t_size * pair->channels * 4;
- else if (reg16)
- *length += t_size * pair->channels * 2;
- else
- *length += t_size * pair->channels * 3;
+ *length += t_size * frame_bytes;
}
/* config dma channel */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 246/703] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (242 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 245/703] ASoC: fsl_asrc_m2m: fix out-of-bounds write when draining the output FIFO Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 247/703] ASoC: fsl_easrc: fix context ownership on repeated hw_params Greg Kroah-Hartman
` (163 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefan Ghetu, Shengjiu Wang,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ghetu <stefan.ghetu@nxp.com>
[ Upstream commit fbeac9352de6584bd5eb7c23d2f224339772c992 ]
hw_params() can be called again without hw_free() in between, and
hw_free() is also called after a failed hw_params().
fsl_asrc_request_pair() always takes a new pair, so a second hw_params()
leaves the stream in two asrc->pair[] entries. Only one is released, and
after close the other points to freed memory, which is dereferenced by
fsl_asrc_isr() and fsl_asrc_m2m_suspend(). After a failed hw_params(),
fsl_asrc_release_pair() releases a stale index that may belong to
another running stream.
Keep the owned pair and only update its channels when it is requested
again, and ignore a pair the stream does not own on release.
Fixes: 3117bb3109dc ("ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20261116093751.138455-3-stefan.ghetu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl_asrc.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index be55182071a28..22e49eeb0abbb 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -210,6 +210,8 @@ static void fsl_asrc_sel_proc(int inrate, int outrate,
* It assigns pair by the order of A->C->B because allocation of pair B,
* within range [ANCA, ANCA+ANCB-1], depends on the channels of pair A
* while pair A and pair C are comparatively independent.
+ *
+ * If @pair already owns a pair, it is kept and only its channels are updated.
*/
static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
{
@@ -221,6 +223,19 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
spin_lock_irqsave(&asrc->lock, lock_flags);
+ if (asrc->pair[pair->index] == pair) {
+ if (asrc->channel_avail + pair->channels < channels) {
+ dev_err(dev, "can't afford required channels: %d\n", channels);
+ return -EINVAL;
+ }
+
+ asrc->channel_avail += pair->channels;
+ asrc->channel_avail -= channels;
+ pair->channels = channels;
+
+ return 0;
+ }
+
for (i = ASRC_PAIR_A; i < ASRC_PAIR_MAX_NUM; i++) {
if (asrc->pair[i] != NULL)
continue;
@@ -254,6 +269,7 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
* @pair: pair to release
*
* It clears the resource from asrc and releases the occupied channels.
+ * Nothing is done if @pair does not own a pair.
*/
static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
{
@@ -261,6 +277,12 @@ static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
enum asrc_pair_index index = pair->index;
unsigned long lock_flags;
+ /* Only the owner clears its entry, so it cannot change after this check */
+ scoped_guard(spinlock_irqsave, &asrc->lock) {
+ if (asrc->pair[index] != pair)
+ return;
+ }
+
/* Make sure the pair is disabled */
regmap_update_bits(asrc->regmap, REG_ASRCTR,
ASRCTR_ASRCEi_MASK(index), 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 247/703] ASoC: fsl_easrc: fix context ownership on repeated hw_params
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (243 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 246/703] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 248/703] ASoC: fsl_asrc_m2m: allow only one task at a time per stream Greg Kroah-Hartman
` (162 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefan Ghetu, Shengjiu Wang,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ghetu <stefan.ghetu@nxp.com>
[ Upstream commit f50dfefe6d4dd8cf5e826353de21228b9f073e68 ]
hw_params() can be called again without hw_free() in between.
fsl_easrc_hw_params() then requests a second context while the stream
still owns the first one, which is never released. After close, that
easrc->pair[] entry points to freed memory and is dereferenced by
fsl_easrc_runtime_resume() on the next open.
The EASRC slots depend on the number of channels, so release the owned
context before requesting a new one, and make
fsl_easrc_release_context() ignore a context it does not own.
Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20261116093751.138455-5-stefan.ghetu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl_easrc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index fc0364fdaf897..93ae23191f35f 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1353,6 +1353,10 @@ static void fsl_easrc_release_context(struct fsl_asrc_pair *ctx)
spin_lock_irqsave(&easrc->lock, lock_flags);
+ /* Nothing to release if the context is not owned by @ctx */
+ if (easrc->pair[ctx->index] != ctx)
+ return;
+
fsl_easrc_release_slot(easrc, ctx->index);
easrc->channel_avail += ctx->channels;
@@ -1508,6 +1512,12 @@ static int fsl_easrc_hw_params(struct snd_pcm_substream *substream,
snd_pcm_format_t format = params_format(params);
int ret;
+ /* hw_params() may be called again without hw_free() in between */
+ if (ctx_priv->ctx_streams & BIT(substream->stream)) {
+ ctx_priv->ctx_streams &= ~BIT(substream->stream);
+ fsl_easrc_release_context(ctx);
+ }
+
ret = fsl_easrc_request_context(channels, ctx);
if (ret) {
dev_err(dev, "failed to request context\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 248/703] ASoC: fsl_asrc_m2m: allow only one task at a time per stream
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (244 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 247/703] ASoC: fsl_easrc: fix context ownership on repeated hw_params Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 249/703] cpufreq: intel_pstate: Use mutex guard for driver locking Greg Kroah-Hartman
` (161 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefan Ghetu, Shengjiu Wang,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Ghetu <stefan.ghetu@nxp.com>
[ Upstream commit f0277994dbd09cc45d600c2f86cbfde9c17c6fcf ]
All tasks of a stream share one pair and one set of DMA channels, and
get_caps() advertises a single fragment, but the compress core allows
up to 64 tasks. A second task requests the pair again and overwrites the
DMA channels. Freeing both tasks then releases the same channels twice
and leaves a stale asrc->pair[] entry after close.
Return -EBUSY from task_create() while a task exists, and clear the DMA
channel pointers once they are released.
Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20261116093751.138455-6-stefan.ghetu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/fsl/fsl_asrc_m2m.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index 181aefa9be8f2..d338859629e48 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -463,6 +463,10 @@ static int fsl_asrc_m2m_comp_task_create(struct snd_compr_stream *stream,
struct device *dev = &asrc->pdev->dev;
int ret;
+ /* All tasks share the pair and DMA channels: one task at a time */
+ if (pair->dma_chan[IN])
+ return -EBUSY;
+
exp_info_in.ops = &fsl_asrc_m2m_dma_buf_ops;
exp_info_in.size = ASRC_M2M_BUFFER_SIZE;
exp_info_in.flags = O_RDWR;
@@ -517,6 +521,7 @@ static int fsl_asrc_m2m_comp_task_create(struct snd_compr_stream *stream,
err_dma_channel_out:
dma_release_channel(pair->dma_chan[IN]);
+ pair->dma_chan[IN] = NULL;
err_dma_channel_in:
if (asrc->m2m_unprepare)
asrc->m2m_unprepare(pair);
@@ -561,6 +566,8 @@ static int fsl_asrc_m2m_comp_task_free(struct snd_compr_stream *stream,
dma_release_channel(pair->dma_chan[IN]);
if (pair->dma_chan[OUT])
dma_release_channel(pair->dma_chan[OUT]);
+ pair->dma_chan[IN] = NULL;
+ pair->dma_chan[OUT] = NULL;
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 249/703] cpufreq: intel_pstate: Use mutex guard for driver locking
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (245 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 248/703] ASoC: fsl_asrc_m2m: allow only one task at a time per stream Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 250/703] cpufreq: intel_pstate: Refresh cpuinfo.max_freq when a CPU goes online Greg Kroah-Hartman
` (160 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki,
Muhammad Usama Anjum, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit 62c95ea763915aebb8755185d5cdf72966b27cd3 ]
Use guard(mutex)(&intel_pstate_driver_lock), or the scoped variant of
it, wherever intel_pstate_driver_lock needs to be held.
This allows some local variables and goto statements to be dropped as
they are not necessary any more.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://patch.msgid.link/2807232.mvXUDI8C0e@rafael.j.wysocki
Stable-dep-of: a636989f93b4 ("cpufreq: intel_pstate: Refresh cpuinfo.max_freq when a CPU goes online")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/intel_pstate.c | 99 ++++++++++++----------------------
1 file changed, 33 insertions(+), 66 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index fcc41591a3d36..00ac6e509a9bf 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1391,7 +1391,8 @@ static void set_power_ctl_ee_state(bool input)
{
u64 power_ctl;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
+
rdmsrq(MSR_IA32_POWER_CTL, power_ctl);
if (input) {
power_ctl &= ~BIT(MSR_IA32_POWER_CTL_BIT_EE);
@@ -1401,7 +1402,6 @@ static void set_power_ctl_ee_state(bool input)
power_ctl_ee_state = POWER_CTL_EE_DISABLE;
}
wrmsrq(MSR_IA32_POWER_CTL, power_ctl);
- mutex_unlock(&intel_pstate_driver_lock);
}
static void intel_pstate_hwp_enable(struct cpudata *cpudata);
@@ -1523,13 +1523,9 @@ static int intel_pstate_update_status(const char *buf, size_t size);
static ssize_t show_status(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
- ssize_t ret;
-
- mutex_lock(&intel_pstate_driver_lock);
- ret = intel_pstate_show_status(buf);
- mutex_unlock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
- return ret;
+ return intel_pstate_show_status(buf);
}
static ssize_t store_status(struct kobject *a, struct kobj_attribute *b,
@@ -1538,11 +1534,13 @@ static ssize_t store_status(struct kobject *a, struct kobj_attribute *b,
char *p = memchr(buf, '\n', count);
int ret;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
+
ret = intel_pstate_update_status(buf, p ? p - buf : count);
- mutex_unlock(&intel_pstate_driver_lock);
+ if (ret < 0)
+ return ret;
- return ret < 0 ? ret : count;
+ return count;
}
static ssize_t show_turbo_pct(struct kobject *kobj,
@@ -1552,12 +1550,10 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
int total, no_turbo, turbo_pct;
uint32_t turbo_fp;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
- if (!intel_pstate_driver) {
- mutex_unlock(&intel_pstate_driver_lock);
+ if (!intel_pstate_driver)
return -EAGAIN;
- }
cpu = all_cpu_data[0];
@@ -1566,8 +1562,6 @@ static ssize_t show_turbo_pct(struct kobject *kobj,
turbo_fp = div_fp(no_turbo, total);
turbo_pct = 100 - fp_toint(mul_fp(turbo_fp, int_tofp(100)));
- mutex_unlock(&intel_pstate_driver_lock);
-
return sprintf(buf, "%u\n", turbo_pct);
}
@@ -1577,38 +1571,26 @@ static ssize_t show_num_pstates(struct kobject *kobj,
struct cpudata *cpu;
int total;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
- if (!intel_pstate_driver) {
- mutex_unlock(&intel_pstate_driver_lock);
+ if (!intel_pstate_driver)
return -EAGAIN;
- }
cpu = all_cpu_data[0];
total = cpu->pstate.turbo_pstate - cpu->pstate.min_pstate + 1;
- mutex_unlock(&intel_pstate_driver_lock);
-
return sprintf(buf, "%u\n", total);
}
static ssize_t show_no_turbo(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
- ssize_t ret;
+ guard(mutex)(&intel_pstate_driver_lock);
- mutex_lock(&intel_pstate_driver_lock);
-
- if (!intel_pstate_driver) {
- mutex_unlock(&intel_pstate_driver_lock);
+ if (!intel_pstate_driver)
return -EAGAIN;
- }
-
- ret = sprintf(buf, "%u\n", global.no_turbo);
- mutex_unlock(&intel_pstate_driver_lock);
-
- return ret;
+ return sprintf(buf, "%u\n", global.no_turbo);
}
static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
@@ -1620,29 +1602,25 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
if (sscanf(buf, "%u", &input) != 1)
return -EINVAL;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
- if (!intel_pstate_driver) {
- count = -EAGAIN;
- goto unlock_driver;
- }
+ if (!intel_pstate_driver)
+ return -EAGAIN;
no_turbo = !!clamp_t(int, input, 0, 1);
WRITE_ONCE(global.turbo_disabled, turbo_is_disabled());
if (global.turbo_disabled && !no_turbo) {
pr_notice("Turbo disabled by BIOS or unavailable on processor\n");
- count = -EPERM;
if (global.no_turbo)
- goto unlock_driver;
- else
- no_turbo = 1;
- }
+ return -EPERM;
- if (no_turbo == global.no_turbo) {
- goto unlock_driver;
+ no_turbo = 1;
}
+ if (no_turbo == global.no_turbo)
+ return count;
+
WRITE_ONCE(global.no_turbo, no_turbo);
mutex_lock(&intel_pstate_limits_lock);
@@ -1661,9 +1639,6 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
intel_pstate_update_limits_for_all();
arch_set_max_freq_ratio(no_turbo);
-unlock_driver:
- mutex_unlock(&intel_pstate_driver_lock);
-
return count;
}
@@ -1715,12 +1690,10 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b,
if (ret != 1)
return -EINVAL;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
- if (!intel_pstate_driver) {
- mutex_unlock(&intel_pstate_driver_lock);
+ if (!intel_pstate_driver)
return -EAGAIN;
- }
mutex_lock(&intel_pstate_limits_lock);
@@ -1733,8 +1706,6 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b,
else
update_qos_requests(FREQ_QOS_MAX);
- mutex_unlock(&intel_pstate_driver_lock);
-
return count;
}
@@ -1748,12 +1719,10 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b,
if (ret != 1)
return -EINVAL;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
- if (!intel_pstate_driver) {
- mutex_unlock(&intel_pstate_driver_lock);
+ if (!intel_pstate_driver)
return -EAGAIN;
- }
mutex_lock(&intel_pstate_limits_lock);
@@ -1767,8 +1736,6 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b,
else
update_qos_requests(FREQ_QOS_MIN);
- mutex_unlock(&intel_pstate_driver_lock);
-
return count;
}
@@ -1789,10 +1756,10 @@ static ssize_t store_hwp_dynamic_boost(struct kobject *a,
if (ret)
return ret;
- mutex_lock(&intel_pstate_driver_lock);
+ guard(mutex)(&intel_pstate_driver_lock);
+
hwp_boost = !!input;
intel_pstate_update_policies();
- mutex_unlock(&intel_pstate_driver_lock);
return count;
}
@@ -3936,9 +3903,9 @@ static int __init intel_pstate_init(void)
}
- mutex_lock(&intel_pstate_driver_lock);
- rc = intel_pstate_register_driver(default_driver);
- mutex_unlock(&intel_pstate_driver_lock);
+ scoped_guard(mutex, &intel_pstate_driver_lock) {
+ rc = intel_pstate_register_driver(default_driver);
+ }
if (rc) {
intel_pstate_sysfs_remove();
return rc;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 250/703] cpufreq: intel_pstate: Refresh cpuinfo.max_freq when a CPU goes online
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (246 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 249/703] cpufreq: intel_pstate: Use mutex guard for driver locking Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 251/703] btrfs: remove devid kobject when deleting a missing device Greg Kroah-Hartman
` (159 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ximing Zhang, Hugo Sales,
Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Sales <hugo@hsal.es>
[ Upstream commit a636989f93b4f70df0e44dd3025ba13c05266053 ]
A write to no_turbo or a change in the HWP capabilities updates
policy->cpuinfo.max_freq through intel_pstate_update_max_freq(), which
gets the policy with cpufreq_cpu_get(). That returns NULL for an offline
CPU, so its policy keeps the old value. When the CPU comes back, the
core reuses the policy and calls ->online(), and
intel_pstate_cpu_online() doesn't recompute cpuinfo.max_freq either.
Before commit 4adcf2e5829f ("cpufreq: intel_pstate: Add ->offline and
->online callbacks"), ->init() ran on every online and set it
Turning turbo on while a CPU is offline leaves that CPU at the non-turbo
maximum once it's back, while the other CPUs report the turbo frequency.
In the reverse order the CPU keeps the turbo maximum with turbo off
Set cpuinfo.max_freq at the end of intel_pstate_cpu_online(), after HWP
is enabled again, the same way __intel_pstate_update_max_freq() does.
cpufreq_online() applies the policy limits after that. Hold the CPU
hotplug lock in store_no_turbo(), so a CPU can't come online between
the no_turbo store and the update of the online CPUs
Fixes: 4adcf2e5829f ("cpufreq: intel_pstate: Add ->offline and ->online callbacks")
Reported-by: Ximing Zhang <xzhangjr@gmail.com>
Closes: https://lore.kernel.org/all/20261108071225.54656-1-xzhangjr@gmail.com/
Signed-off-by: Hugo Sales <hugo@hsal.es>
Tested-by: Ximing Zhang <xzhangjr@gmail.com>
[ rjw: Renamed the new function ]
Link: https://patch.msgid.link/20261114-intel-pstate-online-max-freq-v1-1-1bbdae2b4986@hsal.es
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/intel_pstate.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 00ac6e509a9bf..23262ce56c246 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1460,16 +1460,24 @@ static void intel_pstate_update_policies(void)
cpufreq_update_policy(cpu);
}
-static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
- struct cpudata *cpudata)
+static void __intel_pstate_update_cpuinfo_max_freq(struct cpufreq_policy *policy,
+ struct cpudata *cpudata)
{
- guard(cpufreq_policy_write)(policy);
+ lockdep_assert_held_write(&policy->rwsem);
if (hwp_active)
intel_pstate_get_hwp_cap(cpudata);
policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ?
cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
+}
+
+static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
+ struct cpudata *cpudata)
+{
+ guard(cpufreq_policy_write)(policy);
+
+ __intel_pstate_update_cpuinfo_max_freq(policy, cpudata);
refresh_frequency_limits(policy);
}
@@ -1603,6 +1611,12 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
return -EINVAL;
guard(mutex)(&intel_pstate_driver_lock);
+ /*
+ * intel_pstate_update_max_freq() skips offline CPUs, and a CPU coming
+ * online reads global.no_turbo in intel_pstate_cpu_online(). Keep CPUs
+ * from coming online until every online CPU has the new limit
+ */
+ guard(cpus_read_lock)();
if (!intel_pstate_driver)
return -EAGAIN;
@@ -3014,6 +3028,14 @@ static int intel_pstate_cpu_online(struct cpufreq_policy *policy)
hybrid_update_capacity(cpu);
}
+ /*
+ * intel_pstate_update_max_freq() skips offline CPUs, so the turbo
+ * setting or the HWP capabilities may have changed since this CPU
+ * went offline. Read the HWP capabilities only once HWP is enabled
+ * again
+ */
+ __intel_pstate_update_cpuinfo_max_freq(policy, cpu);
+
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 251/703] btrfs: remove devid kobject when deleting a missing device
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (247 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 250/703] cpufreq: intel_pstate: Refresh cpuinfo.max_freq when a CPU goes online Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 252/703] btrfs: pre-flush reflink source before taking inode locks Greg Kroah-Hartman
` (158 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Cheng Yongkang,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
[ Upstream commit 9383a7fdcb27142d97e65fc76f28475018980b35 ]
btrfs_rm_device() removes the sysfs device entry only when
device->bdev_file is non-NULL. A missing device (created by
add_missing_dev() for an absent disk) has bdev_file == NULL, but
btrfs_sysfs_add_device() still registers its devid kobject under
/sys/fs/btrfs/<uuid>/devinfo/<devid>.
When such a device is deleted, btrfs_free_device() frees the
btrfs_device while the devid kobject remains registered. The kobject is
embedded in the freed btrfs_device and its show functions use
container_of() to reach it, so reading any devinfo attribute is a
use-after-free:
BUG: KASAN: slab-use-after-free in sysfs_kf_seq_show+0x157/0x490
Read of size 8 at addr ffff88801d8172a8 by task poc/9385
...
Freed by task 9385:
kfree
btrfs_rm_device+0x11ee/0x17b0
btrfs_ioctl_rm_dev+0x265/0x400
Allocated by task 9390:
btrfs_alloc_device+0x7e/0x400
device_list_add
btrfs_scan_one_device
btrfs_control_ioctl
The freed object is kmalloc-1k and the faulting access is 680 bytes
inside it (offsetof(struct btrfs_device, devid_kobj) = 640 plus
offsetof(struct kobject, ktype) = 40), confirming the embedded
devid_kobj.
btrfs_sysfs_remove_device() already skips the block-device link when
device->bdev is NULL and only touches the devid kobject when it is
initialized. Call it for missing devices too.
Fixes: 668e48af7a94 ("btrfs: sysfs, add devid/dev_state kobject and device attributes")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Assisted-by: LLM
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/volumes.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ed0db22f0bda2..de460c151741e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2397,11 +2397,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info,
btrfs_assign_next_active_device(device, NULL);
- if (device->bdev_file) {
+ if (device->bdev_file)
cur_devices->open_devices--;
- /* remove sysfs entry */
- btrfs_sysfs_remove_device(device);
- }
+
+ /* Remove sysfs entry, including for a missing device. */
+ btrfs_sysfs_remove_device(device);
num_devices = btrfs_super_num_devices(fs_info->super_copy) - 1;
btrfs_set_super_num_devices(fs_info->super_copy, num_devices);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 252/703] btrfs: pre-flush reflink source before taking inode locks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (248 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 251/703] btrfs: remove devid kobject when deleting a missing device Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 253/703] btrfs: downgrade the reflink source inode lock for tree walking Greg Kroah-Hartman
` (157 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Filipe Manana, Boris Burkov,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <boris@bur.io>
[ Upstream commit 220c44b1b90fbff746472cbb3dde778b02afbef9 ]
Consider the following sketch of a shell script:
dd if=/dev/urandom of=/mnt/src bs=1M count=4096
cp --reflink=always /mnt/src /mnt/dst &
sleep 0.1 # let the clone reach its flush
time dd if=/mnt/src of=/dev/null bs=4K count=1 iflag=direct
The current logic in reflink ensures the existence and stability of both
the src and destination inode by locking them both and then flushing all
dirty pages / ordered_extents under the inode lock. This blocks
concurrent usage by even readers of the inode locks, like direct reads
or seeks for the duration of writeback on the entirety of the two files.
We observe this particular contention frequently in the Meta fleet.
It is also a relatively common pattern to write the src file, then reflink
it while it is still dirty, so that typical path naturally hits this
contention. This workload motivates a relatively simple optimization:
trigger the unavoidable src flushing outside the locked region.
Therefore, do an optimistic btrfs_wait_ordered_range() without the locks
while relying on the calls to btrfs_wait_ordered_range() under the
locks in btrfs_remap_file_range_prep() to ensure correctness. In the
worst case with concurrent writes while unlocked, we can end up doing
the writeback twice, which I think is a reasonable price to pay to avoid
victimizing innocent readers in a common case.
With and without this patch, the above reproducer runs the reflink in
the same ~0.5s on my system. Without the patch, the direct read blocks
for basically the full duration of the reflink while with the patch it
returns in a few milliseconds.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: ad4bb983915d ("btrfs: fix race between concurrent sync direct IO writes")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/reflink.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index c6f8db5027a42..30e1d8b05fdcd 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -826,6 +826,17 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
return ret;
}
+static u64 calc_remap_wb_len(struct btrfs_inode *src_inode, loff_t off, loff_t len,
+ unsigned int remap_flags)
+{
+ const u32 bs = src_inode->root->fs_info->sectorsize;
+ const loff_t isize = i_size_read(&src_inode->vfs_inode);
+
+ if (len == 0 && !(remap_flags & REMAP_FILE_DEDUP))
+ return ALIGN(isize, bs) - ALIGN_DOWN(off, bs);
+ return ALIGN(len, bs);
+}
+
static int btrfs_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *len, unsigned int remap_flags)
@@ -865,10 +876,7 @@ static int btrfs_remap_file_range_prep(struct file *file_in, loff_t pos_in,
* not for the ordered extents to complete. We need to wait for them
* to complete so that new file extent items are in the fs tree.
*/
- if (*len == 0 && !(remap_flags & REMAP_FILE_DEDUP))
- wb_len = ALIGN(inode_in->vfs_inode.i_size, bs) - ALIGN_DOWN(pos_in, bs);
- else
- wb_len = ALIGN(*len, bs);
+ wb_len = calc_remap_wb_len(inode_in, pos_in, *len, remap_flags);
/*
* Workaround to make sure NOCOW buffered write reach disk as NOCOW.
@@ -919,11 +927,23 @@ loff_t btrfs_remap_file_range(struct file *src_file, loff_t off,
struct btrfs_inode *src_inode = BTRFS_I(file_inode(src_file));
struct btrfs_inode *dst_inode = BTRFS_I(file_inode(dst_file));
bool same_inode = dst_inode == src_inode;
+ u64 wb_start, wb_len;
int ret;
if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
return -EINVAL;
+ /*
+ * Optimistically write out the src inode before taking locks.
+ * Consistency is properly ensured by the btrfs_wait_ordered_range()
+ * inside btrfs_remap_file_range_prep().
+ */
+ wb_start = ALIGN_DOWN(off, src_inode->root->fs_info->sectorsize);
+ wb_len = calc_remap_wb_len(src_inode, off, len, remap_flags);
+ ret = btrfs_wait_ordered_range(src_inode, wb_start, wb_len);
+ if (ret < 0)
+ return ret;
+
if (same_inode) {
btrfs_inode_lock(src_inode, BTRFS_ILOCK_MMAP);
} else {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 253/703] btrfs: downgrade the reflink source inode lock for tree walking
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (249 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 252/703] btrfs: pre-flush reflink source before taking inode locks Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 254/703] btrfs: fix race between concurrent sync direct IO writes Greg Kroah-Hartman
` (156 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Filipe Manana, Boris Burkov,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <boris@bur.io>
[ Upstream commit cf02c310d018c7e5363b80dfd68ffdf159f3c914 ]
When doing a reflink, we are not writing to the src inode or modifying
it in any way, so it is counter-intuitive to have to lock it
exclusively. This has the cost of blocking other shared lock users of
the src file for the duration of any new writeback since the optimistic
pre-flush and all the actual reflinking. So we would like to downgrade
the lock to shared as much as possible.
There are two important gotchas to do with direct io that must be
addressed to make this idea work.
The first gotcha is that dio writes that come in under EOF try to take
inode->i_rwsem shared, which would result in messed up views of the
extents in the reflinked file. Therefore, add "being used as a reflink
src" as another inode flag exception for the dio write shared tests that
already exist to check for other dangerous conditions. In order to
ensure that this flag is visible to the dio writer, reflink must first
take i_rwsem exclusive, then set the flag, then downgrade to shared.
The second is that dio reads increment inode->i_dio_count which blocks
inode_dio_wait() in __generic_remap_file_range_prep(). Therefore, we
must remain exclusive to dio reads through finishing the prep or risk
starving the clone on a stream of dio readers. There is still O(extents)
work in btrfs_clone() which can be done without holding the lock
exclusive, so we should downgrade to shared and admit dio readers (and
other shared lock users like lseek) after we are finished with
inode_dio_wait().
By running concurrent clones and lseeks or dio reads on a src file with
32k extents on a vm, I can demonstrate 100ms+ stalls on the readers
without this patch and they go away entirely with the patch.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: ad4bb983915d ("btrfs: fix race between concurrent sync direct IO writes")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/btrfs_inode.h | 6 ++++++
fs/btrfs/direct-io.c | 7 +++++++
fs/btrfs/reflink.c | 17 +++++++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index b6b46f951f11a..03e5d27970a31 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -98,6 +98,12 @@ enum {
* range).
*/
BTRFS_INODE_COW_WRITE_ERROR,
+ /*
+ * Set by reflink while it holds the source's VFS inode lock shared.
+ * Direct IO writes also take that lock shared; one that finds this bit
+ * set after acquiring it must retry with the exclusive lock.
+ */
+ BTRFS_INODE_REFLINK_SRC,
/*
* Indicate this is a directory that points to a subvolume for which
* there is no root reference item. That's a case like the following:
diff --git a/fs/btrfs/direct-io.c b/fs/btrfs/direct-io.c
index 5f2a99e683353..a5f7f1bb2364b 100644
--- a/fs/btrfs/direct-io.c
+++ b/fs/btrfs/direct-io.c
@@ -909,6 +909,13 @@ ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
goto relock;
}
+ if ((ilock_flags & BTRFS_ILOCK_SHARED) &&
+ test_bit(BTRFS_INODE_REFLINK_SRC, &BTRFS_I(inode)->runtime_flags)) {
+ btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
+ ilock_flags &= ~BTRFS_ILOCK_SHARED;
+ goto relock;
+ }
+
ret = generic_write_checks(iocb, from);
if (ret <= 0) {
btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index 30e1d8b05fdcd..c7e16785462d3 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -928,6 +928,7 @@ loff_t btrfs_remap_file_range(struct file *src_file, loff_t off,
struct btrfs_inode *dst_inode = BTRFS_I(file_inode(dst_file));
bool same_inode = dst_inode == src_inode;
u64 wb_start, wb_len;
+ bool src_downgraded = false;
int ret;
if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
@@ -956,6 +957,12 @@ loff_t btrfs_remap_file_range(struct file *src_file, loff_t off,
if (ret < 0 || len == 0)
goto out_unlock;
+ if (!same_inode) {
+ set_bit(BTRFS_INODE_REFLINK_SRC, &src_inode->runtime_flags);
+ downgrade_write(&src_inode->vfs_inode.i_rwsem);
+ src_downgraded = true;
+ }
+
if (remap_flags & REMAP_FILE_DEDUP)
ret = btrfs_extent_same(&src_inode->vfs_inode, off, len,
&dst_inode->vfs_inode, destoff);
@@ -967,8 +974,14 @@ loff_t btrfs_remap_file_range(struct file *src_file, loff_t off,
btrfs_inode_unlock(src_inode, BTRFS_ILOCK_MMAP);
} else {
btrfs_double_mmap_unlock(src_inode, dst_inode);
- unlock_two_nondirectories(&src_inode->vfs_inode,
- &dst_inode->vfs_inode);
+ if (src_downgraded) {
+ clear_bit(BTRFS_INODE_REFLINK_SRC, &src_inode->runtime_flags);
+ inode_unlock_shared(&src_inode->vfs_inode);
+ inode_unlock(&dst_inode->vfs_inode);
+ } else {
+ unlock_two_nondirectories(&src_inode->vfs_inode,
+ &dst_inode->vfs_inode);
+ }
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 254/703] btrfs: fix race between concurrent sync direct IO writes
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (250 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 253/703] btrfs: downgrade the reflink source inode lock for tree walking Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 255/703] btrfs: zstd: fix UAF due to race between putting workspace and reclaim Greg Kroah-Hartman
` (155 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit ad4bb983915d8588dc9dd3aeb60cf58aff574e3b ]
If we have a direct IO write within i_size, we lock the inode's VFS lock
in shared mode, which allows for concurrent direct IO writes within
different ranges of the file, which is an important optimization for many
applications such as databases.
However if we have a sync direct IO write within i_size, it locks the
inode in shared mode and then enters fsync through the call to the
iomap_dio_complete() function from iomap using the shared lock. This
means that if we have another concurrent direct IO write that locks the
inode in shared mode and the fsync is in fast mode (the inode flag
BTRFS_INODE_NEEDS_FULL_SYNC is not set), the fsync does not wait for
the ordered extent created by the concurrent direct IO write to complete
before logging its extent map. The fsync code relies on direct IO writes
to create ordered extents and wait for their IO to finish while holding
the inode's lock, while the fsync should hold the inode lock in exclusive
mode. This means that this race can end up persisting a log tree with
file extent items that point to extents that were not yet written when
the log is synced.
Fix this by always taking the inode lock in exclusive mode if we have a
sync write.
This issue was identified by Sashiko in the link below, which identifies
two different races between direct IO writes and fsync. The race fixed
here is the second case identified by Sashiko in the link below. The first
race is already being fixed in a separate patch from Josef.
Link: https://sashiko.dev/#/bug/linux-ee047626-2fa7-46d5-b543-861136993fc7
Fixes: 939b656bc8ab ("btrfs: fix corruption after buffer fault in during direct IO append write")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/direct-io.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/direct-io.c b/fs/btrfs/direct-io.c
index a5f7f1bb2364b..52cfe07ed9d04 100644
--- a/fs/btrfs/direct-io.c
+++ b/fs/btrfs/direct-io.c
@@ -882,9 +882,13 @@ ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
* If the write DIO is within EOF, use a shared lock and also only if
* security bits will likely not be dropped by file_remove_privs() called
* from btrfs_write_check(). Either will need to be rechecked after the
- * lock was acquired.
+ * lock was acquired. Also if this is a sync write we will need to fsync
+ * and therefore we must lock in exclusive mode, otherwise we would race
+ * with other concurrent DIO writes and the fsync would not wait for
+ * their ordered extent to finish IO before logging the new extent maps.
*/
- if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode) && IS_NOSEC(inode))
+ if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode) &&
+ IS_NOSEC(inode) && !iocb_is_dsync(iocb))
ilock_flags |= BTRFS_ILOCK_SHARED;
/*
@@ -916,6 +920,13 @@ ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
goto relock;
}
+ /* Sync writes must use exclusive locking, see the comment above. */
+ if ((ilock_flags & BTRFS_ILOCK_SHARED) && iocb_is_dsync(iocb)) {
+ btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
+ ilock_flags &= ~BTRFS_ILOCK_SHARED;
+ goto relock;
+ }
+
ret = generic_write_checks(iocb, from);
if (ret <= 0) {
btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 255/703] btrfs: zstd: fix UAF due to race between putting workspace and reclaim
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (251 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 254/703] btrfs: fix race between concurrent sync direct IO writes Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 256/703] ASoC: SOF: control: reject out-of-range enum values Greg Kroah-Hartman
` (154 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 2d8b3d9b210a388129e41757372d70c66ae20a5b ]
When we put a workspace with a level matching the requested level, we add
it back to the lru list of the workspace manager and set the timer to
run the reclaim function (zstd_reclaim_timer_fn()). If that workspace than
gets used by some other task, obtained with zstd_find_workspace(), for
some compression level lower than the workspace's level, we set the
workspace's req_level field to the requested level (done in
zstd_find_workspace()) and leave it in the lru list without updating the
last_used field of the workspace. Once the last_used field ages past the
ZSTD_BTRFS_RECLAIM_JIFFIES value, when zstd_put_workspace() is called it
skips the lru update branch because the workspace's req_level does not
match its level, and then it sets its req_level to 0 before releasing
the workspace manager's lock - and after that and before
zstd_put_workspace() does:
if (workspace->level == clip_level(ZSTD_BTRFS_MAX_LEVEL))
cond_wake_up(&zwsm->wait);
the reclaim function, zstd_reclaim_timer_fn(), can run, see the workspace
in the lru list and see that it has a req_level of 0 and an expired
last_used time, and therefore call zstd_free_workspace() to free the
workspace, right before the task that is putting the workspace executes
the code above to read its level.
Fix this by reading the workspace's level before unlocking the workspace
manager in zstd_put_workspace().
Link: https://sashiko.dev/#/bug/linux-92b08485-a86c-4bb5-9138-fa80c84389f0
Fixes: 3f93aef535c8 ("btrfs: add zstd compression level support")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zstd.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c
index ced6406425f9d..aaaa1f6657a9c 100644
--- a/fs/btrfs/zstd.c
+++ b/fs/btrfs/zstd.c
@@ -340,6 +340,7 @@ void zstd_put_workspace(struct btrfs_fs_info *fs_info, struct list_head *ws)
{
struct zstd_workspace_manager *zwsm = fs_info->compr_wsm[BTRFS_COMPRESS_ZSTD];
struct workspace *workspace = list_to_workspace(ws);
+ bool wakeup;
ASSERT(zwsm);
spin_lock_bh(&zwsm->lock);
@@ -363,9 +364,14 @@ void zstd_put_workspace(struct btrfs_fs_info *fs_info, struct list_head *ws)
list_add(&workspace->list, &zwsm->idle_ws[workspace->level]);
workspace->req_level = 0;
+ /*
+ * Check if we should wakeup before releasing the lock because after
+ * that the reclaim function can run and free the workspace.
+ */
+ wakeup = (workspace->level == clip_level(ZSTD_BTRFS_MAX_LEVEL));
spin_unlock_bh(&zwsm->lock);
- if (workspace->level == clip_level(ZSTD_BTRFS_MAX_LEVEL))
+ if (wakeup)
cond_wake_up(&zwsm->wait);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 256/703] ASoC: SOF: control: reject out-of-range enum values
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (252 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 255/703] btrfs: zstd: fix UAF due to race between putting workspace and reclaim Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 257/703] btrfs: fiemap: deal with inline extent in fiemap_find_last_extent_offset() Greg Kroah-Hartman
` (153 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Arnav Kapoor, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnav Kapoor <kapoorarnav43@gmail.com>
[ Upstream commit 3092b9e481fedc413bf7acda9edc04b0bd8cb28a ]
snd_sof_enum_put() passes the item indexes from user space to the IPC
enum_put() op unchecked, and the IPC3 and IPC4 ops store them as they
are and send them to the DSP. With the IPC4 sof-hda-generic-2ch.tplg on
a Tiger Lake laptop, "Dmic0 Capture TDFB angle set enum" has 13 items
but accepts 13 and 0xffffffff, and reads them back. The ALSA mixer-test
selftest reports this as a write_invalid failure.
Reject indexes past the last item, as snd_soc_put_enum_double() does.
Fixes: c3078f539704 ("ASoC: SOF: Add Sound Open Firmware KControl support")
Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com>
Link: https://patch.msgid.link/20261118103129.113970-1-kapoorarnav43@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/sof/control.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index a3fd1d523c094..29a22af5fabc7 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -120,6 +120,11 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
struct snd_soc_component *scomp = scontrol->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
+ unsigned int i;
+
+ for (i = 0; i < scontrol->num_channels; i++)
+ if (ucontrol->value.enumerated.item[i] >= se->items)
+ return -EINVAL;
if (tplg_ops && tplg_ops->control && tplg_ops->control->enum_put)
return tplg_ops->control->enum_put(scontrol, ucontrol);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 257/703] btrfs: fiemap: deal with inline extent in fiemap_find_last_extent_offset()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (253 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 256/703] ASoC: SOF: control: reject out-of-range enum values Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 258/703] btrfs: fix double release of space when cloning compressed inline extent Greg Kroah-Hartman
` (152 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit fd573263740371f76cad610cbcc70629b27f6c0c ]
In the while loop that finds the first file extent item, counting from the
end of the file, that is not a hole, we are accessing the disk_bytenr
field of each file extent item, which is wrong in case we have an item
that represents an inline extent. In that case the inline data starts at
the disk_bytenr offset and therefore we are reading user data or in case
the inline data is less than 8 bytes, we are accessing another region of
the leaf or even beyond the leaf boundaries in case it's the last item.
This should be a very rare case, as it implies having an inline extent
followed by a hole file extent item (the no-holes feature is not used).
Fixes: ac3c0d36a2a2 ("btrfs: make fiemap more efficient and accurate reporting extent sharedness")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/fiemap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/fiemap.c b/fs/btrfs/fiemap.c
index 5fb7342a616d1..7bf95a295a00f 100644
--- a/fs/btrfs/fiemap.c
+++ b/fs/btrfs/fiemap.c
@@ -621,6 +621,8 @@ static int fiemap_find_last_extent_offset(struct btrfs_inode *inode,
leaf = path->nodes[0];
ei = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item);
+ if (btrfs_file_extent_type(leaf, ei) == BTRFS_FILE_EXTENT_INLINE)
+ break;
disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, ei);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 258/703] btrfs: fix double release of space when cloning compressed inline extent
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (254 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 257/703] btrfs: fiemap: deal with inline extent in fiemap_find_last_extent_offset() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 259/703] btrfs: abort transaction on failure to update inode after hole punching Greg Kroah-Hartman
` (151 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit ee020b5f0eb81a86533a16dcaafcee2b97a0f74d ]
In copy_inline_to_page(), if we fail to decompress the inline extent, we
jump to the out_unlock label and release the reserved data and metadata
space with a call to btrfs_delalloc_release_space(). However we leave the
range in the inode's io_tree marked as delalloc, which was set by
btrfs_reset_extent_delalloc(), and that means when someone later clears
the delalloc range, using EXTENT_DO_ACCOUNTING (like
btrfs_reset_extent_delalloc() does), it will release again the space.
This does not happen for uncompressed inline extents, because after the
call to btrfs_reset_extent_delalloc() we can't get any other errors.
Link: https://sashiko.dev/#/bug/linux-52478dd4-bd10-48de-baba-a527b38b64aa
Fixes: 05a5a7621ce6 ("Btrfs: implement full reflink support for inline extents")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/reflink.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index c7e16785462d3..e451d768fca1a 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -117,8 +117,21 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
ret = btrfs_decompress(comp_type, data_start, folio,
offset_in_folio(folio, file_offset),
inline_size, datal);
- if (ret)
+ if (ret) {
+ /*
+ * btrfs_reset_extent_delalloc() set the range as
+ * delalloc, so clear it, otherwise we will free the
+ * reserved data and metadata space twice, once below by
+ * btrfs_delalloc_release_space() and once again when
+ * someone else clears the delalloc range with
+ * EXTENT_DO_ACCOUNTING (like
+ * btrfs_reset_extent_delalloc() does).
+ */
+ btrfs_clear_extent_bit(&inode->io_tree, file_offset,
+ range_end, EXTENT_DELALLOC |
+ EXTENT_DELALLOC_NEW, NULL);
goto out_unlock;
+ }
flush_dcache_folio(folio);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 259/703] btrfs: abort transaction on failure to update inode after hole punching
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (255 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 258/703] btrfs: fix double release of space when cloning compressed inline extent Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 260/703] btrfs: fix blocking allocation for nowait encoded reads of inline extents Greg Kroah-Hartman
` (150 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 6cd72166183bfc290fd853470232020c4b807aa2 ]
If we fail to update the inode we simply release the transaction and don't
abort the transaction. This means the transaction can get committed and we
will not persist important updates to the inode item such as nbytes (which
gets reduced after punching holes) and the timestamps. Fix this by adding
the missing abort.
Link: https://sashiko.dev/#/bug/linux-d8b4cb7a-8dfe-454f-9b19-a67af28b81bd
Fixes: 2aaa66558172 ("Btrfs: add hole punching")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/file.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 19f0f9df038cc..46e8690731172 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2736,7 +2736,10 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len)
inode_inc_iversion(inode);
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
ret = btrfs_update_inode(trans, BTRFS_I(inode));
- updated_inode = true;
+ if (ret)
+ btrfs_abort_transaction(trans, ret);
+ else
+ updated_inode = true;
btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
out:
@@ -2762,6 +2765,8 @@ static int btrfs_punch_hole(struct file *file, loff_t offset, loff_t len)
int ret2;
ret = btrfs_update_inode(trans, BTRFS_I(inode));
+ if (ret)
+ btrfs_abort_transaction(trans, ret);
ret2 = btrfs_end_transaction(trans);
if (!ret)
ret = ret2;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 260/703] btrfs: fix blocking allocation for nowait encoded reads of inline extents
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (256 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 259/703] btrfs: abort transaction on failure to update inode after hole punching Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 261/703] io_uring/uring_cmd: avoid double indirect call in task work dispatch Greg Kroah-Hartman
` (149 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 85c98fd512bb3e2f326f1a1cac30f2fb0af30c6a ]
If we are doing a nowait encoded read of an inline extent, we are doing
a GFP_NOFS allocation for the temporary buffer, which can block. We are
also returning -ENOMEM on failure, which is wrong for a nowait context.
Fix this by using GFP_NOWAIT when we are in a nowait context and by
returning -EAGAIN instead of -ENOMEM if the allocation fails.
Fixes: 973a432637ed ("btrfs: don't sleep in btrfs_encoded_read() if IOCB_NOWAIT is set")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c58bf3cbd41d0..28a4adb63dbc1 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9438,9 +9438,9 @@ static ssize_t btrfs_encoded_read_inline(
ptr += iocb->ki_pos - extent_start;
}
- tmp = kmalloc(count, GFP_NOFS);
+ tmp = kmalloc(count, nowait ? GFP_NOWAIT : GFP_NOFS);
if (!tmp)
- return -ENOMEM;
+ return nowait ? -EAGAIN : -ENOMEM;
read_extent_buffer(leaf, tmp, ptr, count);
btrfs_release_path(path);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 261/703] io_uring/uring_cmd: avoid double indirect call in task work dispatch
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (257 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 260/703] btrfs: fix blocking allocation for nowait encoded reads of inline extents Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 262/703] btrfs: fix incorrect task accounting on error during io_uring read Greg Kroah-Hartman
` (148 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Caleb Sander Mateos,
Christoph Hellwig, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Caleb Sander Mateos <csander@purestorage.com>
[ Upstream commit 20fb3d05a34b55c8ec28ec3d3555e70c5bc0c72d ]
io_uring task work dispatch makes an indirect call to struct io_kiocb's
io_task_work.func field to allow running arbitrary task work functions.
In the uring_cmd case, this calls io_uring_cmd_work(), which immediately
makes another indirect call to struct io_uring_cmd's task_work_cb field.
Change the uring_cmd task work callbacks to functions whose signatures
match io_req_tw_func_t. Add a function io_uring_cmd_from_tw() to convert
from the task work's struct io_tw_req argument to struct io_uring_cmd *.
Define a constant IO_URING_CMD_TASK_WORK_ISSUE_FLAGS to avoid
manufacturing issue_flags in the uring_cmd task work callbacks. Now
uring_cmd task work dispatch makes a single indirect call to the
uring_cmd implementation's callback. This also allows removing the
task_work_cb field from struct io_uring_cmd, freeing up 8 bytes for
future storage.
Since fuse_uring_send_in_task() now has access to the io_tw_token_t,
check its cancel field directly instead of relying on the
IO_URING_F_TASK_DEAD issue flag.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 42de7db475fe ("btrfs: fix incorrect task accounting on error during io_uring read")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/ioctl.c | 6 ++++--
drivers/block/ublk_drv.c | 22 +++++++++++-----------
drivers/nvme/host/ioctl.c | 7 ++++---
fs/btrfs/ioctl.c | 5 +++--
fs/fuse/dev_uring.c | 7 ++++---
include/linux/io_uring/cmd.h | 22 +++++++++++++---------
include/linux/io_uring_types.h | 1 -
io_uring/uring_cmd.c | 18 ++----------------
8 files changed, 41 insertions(+), 47 deletions(-)
diff --git a/block/ioctl.c b/block/ioctl.c
index c038a4b27b573..73ba266948f3c 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -771,14 +771,16 @@ struct blk_iou_cmd {
bool nowait;
};
-static void blk_cmd_complete(struct io_uring_cmd *cmd, unsigned int issue_flags)
+static void blk_cmd_complete(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ struct io_uring_cmd *cmd = io_uring_cmd_from_tw(tw_req);
struct blk_iou_cmd *bic = io_uring_cmd_to_pdu(cmd, struct blk_iou_cmd);
if (bic->res == -EAGAIN && bic->nowait)
io_uring_cmd_issue_blocking(cmd);
else
- io_uring_cmd_done(cmd, bic->res, issue_flags);
+ io_uring_cmd_done(cmd, bic->res,
+ IO_URING_CMD_TASK_WORK_ISSUE_FLAGS);
}
static void bio_cmd_bio_end_io(struct bio *bio)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index a955a3ea471d3..613ffa2fba849 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1370,10 +1370,9 @@ static bool ublk_start_io(const struct ublk_queue *ubq, struct request *req,
return true;
}
-static void ublk_dispatch_req(struct ublk_queue *ubq,
- struct request *req,
- unsigned int issue_flags)
+static void ublk_dispatch_req(struct ublk_queue *ubq, struct request *req)
{
+ unsigned int issue_flags = IO_URING_CMD_TASK_WORK_ISSUE_FLAGS;
int tag = req->tag;
struct ublk_io *io = &ubq->ios[tag];
@@ -1420,13 +1419,13 @@ static void ublk_dispatch_req(struct ublk_queue *ubq,
}
}
-static void ublk_cmd_tw_cb(struct io_uring_cmd *cmd,
- unsigned int issue_flags)
+static void ublk_cmd_tw_cb(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ struct io_uring_cmd *cmd = io_uring_cmd_from_tw(tw_req);
struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd);
struct ublk_queue *ubq = pdu->ubq;
- ublk_dispatch_req(ubq, pdu->req, issue_flags);
+ ublk_dispatch_req(ubq, pdu->req);
}
static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq)
@@ -1438,9 +1437,9 @@ static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq)
io_uring_cmd_complete_in_task(cmd, ublk_cmd_tw_cb);
}
-static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd,
- unsigned int issue_flags)
+static void ublk_cmd_list_tw_cb(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ struct io_uring_cmd *cmd = io_uring_cmd_from_tw(tw_req);
struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd);
struct request *rq = pdu->req_list;
struct request *next;
@@ -1448,7 +1447,7 @@ static void ublk_cmd_list_tw_cb(struct io_uring_cmd *cmd,
do {
next = rq->rq_next;
rq->rq_next = NULL;
- ublk_dispatch_req(rq->mq_hctx->driver_data, rq, issue_flags);
+ ublk_dispatch_req(rq->mq_hctx->driver_data, rq);
rq = next;
} while (rq);
}
@@ -2720,9 +2719,10 @@ static inline struct request *__ublk_check_and_get_req(struct ublk_device *ub,
return NULL;
}
-static void ublk_ch_uring_cmd_cb(struct io_uring_cmd *cmd,
- unsigned int issue_flags)
+static void ublk_ch_uring_cmd_cb(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ unsigned int issue_flags = IO_URING_CMD_TASK_WORK_ISSUE_FLAGS;
+ struct io_uring_cmd *cmd = io_uring_cmd_from_tw(tw_req);
int ret = ublk_ch_uring_cmd_local(cmd, issue_flags);
if (ret != -EIOCBQUEUED)
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 2c0d00352f919..a9b59265c5029 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -433,14 +433,15 @@ static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu(
return io_uring_cmd_to_pdu(ioucmd, struct nvme_uring_cmd_pdu);
}
-static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd,
- unsigned issue_flags)
+static void nvme_uring_task_cb(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ struct io_uring_cmd *ioucmd = io_uring_cmd_from_tw(tw_req);
struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
if (pdu->bio)
blk_rq_unmap_user(pdu->bio);
- io_uring_cmd_done32(ioucmd, pdu->status, pdu->result, issue_flags);
+ io_uring_cmd_done32(ioucmd, pdu->status, pdu->result,
+ IO_URING_CMD_TASK_WORK_ISSUE_FLAGS);
}
static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 2bf61cf1fd6bb..8d3882e296552 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4659,8 +4659,9 @@ struct io_btrfs_cmd {
struct btrfs_uring_priv *priv;
};
-static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int issue_flags)
+static void btrfs_uring_read_finished(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ struct io_uring_cmd *cmd = io_uring_cmd_from_tw(tw_req);
struct io_btrfs_cmd *bc = io_uring_cmd_to_pdu(cmd, struct io_btrfs_cmd);
struct btrfs_uring_priv *priv = bc->priv;
struct btrfs_inode *inode = BTRFS_I(file_inode(priv->iocb.ki_filp));
@@ -4705,7 +4706,7 @@ static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int iss
btrfs_unlock_extent(io_tree, priv->start, priv->lockend, &priv->cached_state);
btrfs_inode_unlock(inode, BTRFS_ILOCK_SHARED);
- io_uring_cmd_done(cmd, ret, issue_flags);
+ io_uring_cmd_done(cmd, ret, IO_URING_CMD_TASK_WORK_ISSUE_FLAGS);
add_rchar(current, ret);
for (index = 0; index < priv->nr_pages; index++)
diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index b52d5c2bd4e42..28eb742c72b95 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -1325,14 +1325,15 @@ static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd,
* User buffers are not mapped yet - the application does not have permission
* to write to it - this has to be executed in ring task context.
*/
-static void fuse_uring_send_in_task(struct io_uring_cmd *cmd,
- unsigned int issue_flags)
+static void fuse_uring_send_in_task(struct io_tw_req tw_req, io_tw_token_t tw)
{
+ unsigned int issue_flags = IO_URING_CMD_TASK_WORK_ISSUE_FLAGS;
+ struct io_uring_cmd *cmd = io_uring_cmd_from_tw(tw_req);
struct fuse_ring_ent *ent = uring_cmd_to_ring_ent(cmd);
struct fuse_ring_queue *queue = ent->queue;
int err;
- if (!(issue_flags & IO_URING_F_TASK_DEAD)) {
+ if (!tw.cancel) {
err = fuse_uring_prepare_send(ent, ent->fuse_req);
if (err) {
fuse_uring_next_fuse_req(ent, queue, issue_flags);
diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
index 7509025b40711..375fd048c4cbc 100644
--- a/include/linux/io_uring/cmd.h
+++ b/include/linux/io_uring/cmd.h
@@ -11,17 +11,13 @@
/* io_uring_cmd is being issued again */
#define IORING_URING_CMD_REISSUE (1U << 31)
-typedef void (*io_uring_cmd_tw_t)(struct io_uring_cmd *cmd,
- unsigned issue_flags);
-
struct io_uring_cmd {
struct file *file;
const struct io_uring_sqe *sqe;
- /* callback to defer completions to task context */
- io_uring_cmd_tw_t task_work_cb;
u32 cmd_op;
u32 flags;
u8 pdu[32]; /* available inline for free use */
+ u8 unused[8];
};
static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
@@ -60,7 +56,7 @@ void __io_uring_cmd_done(struct io_uring_cmd *cmd, s32 ret, u64 res2,
unsigned issue_flags, bool is_cqe32);
void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
- io_uring_cmd_tw_t task_work_cb,
+ io_req_tw_func_t task_work_cb,
unsigned flags);
/*
@@ -109,7 +105,7 @@ static inline void __io_uring_cmd_done(struct io_uring_cmd *cmd, s32 ret,
{
}
static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
- io_uring_cmd_tw_t task_work_cb, unsigned flags)
+ io_req_tw_func_t task_work_cb, unsigned flags)
{
}
static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
@@ -132,15 +128,23 @@ static inline bool io_uring_mshot_cmd_post_cqe(struct io_uring_cmd *ioucmd,
}
#endif
+static inline struct io_uring_cmd *io_uring_cmd_from_tw(struct io_tw_req tw_req)
+{
+ return io_kiocb_to_cmd(tw_req.req, struct io_uring_cmd);
+}
+
+/* task_work executor checks the deferred list completion */
+#define IO_URING_CMD_TASK_WORK_ISSUE_FLAGS IO_URING_F_COMPLETE_DEFER
+
/* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */
static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
- io_uring_cmd_tw_t task_work_cb)
+ io_req_tw_func_t task_work_cb)
{
__io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE);
}
static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
- io_uring_cmd_tw_t task_work_cb)
+ io_req_tw_func_t task_work_cb)
{
__io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0);
}
diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
index bdfc3cf7d989d..5d00cc2d396a2 100644
--- a/include/linux/io_uring_types.h
+++ b/include/linux/io_uring_types.h
@@ -47,7 +47,6 @@ enum io_uring_cmd_flags {
/* set when uring wants to cancel a previously issued command */
IO_URING_F_CANCEL = (1 << 11),
IO_URING_F_COMPAT = (1 << 12),
- IO_URING_F_TASK_DEAD = (1 << 13),
};
struct io_wq_work_node {
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 526fdf1034993..3aa341a099c12 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -115,21 +115,8 @@ void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
}
EXPORT_SYMBOL_GPL(io_uring_cmd_mark_cancelable);
-static void io_uring_cmd_work(struct io_tw_req tw_req, io_tw_token_t tw)
-{
- struct io_kiocb *req = tw_req.req;
- struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
- unsigned int flags = IO_URING_F_COMPLETE_DEFER;
-
- if (unlikely(tw.cancel))
- flags |= IO_URING_F_TASK_DEAD;
-
- /* task_work executor checks the deffered list completion */
- ioucmd->task_work_cb(ioucmd, flags);
-}
-
void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
- io_uring_cmd_tw_t task_work_cb,
+ io_req_tw_func_t task_work_cb,
unsigned flags)
{
struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
@@ -137,8 +124,7 @@ void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
if (WARN_ON_ONCE(req->flags & REQ_F_APOLL_MULTISHOT))
return;
- ioucmd->task_work_cb = task_work_cb;
- req->io_task_work.func = io_uring_cmd_work;
+ req->io_task_work.func = task_work_cb;
__io_req_task_work_add(req, flags);
}
EXPORT_SYMBOL_GPL(__io_uring_cmd_do_in_task);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 262/703] btrfs: fix incorrect task accounting on error during io_uring read
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (258 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 261/703] io_uring/uring_cmd: avoid double indirect call in task work dispatch Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 263/703] btrfs: fix delayed inode count leak after failure to delete inode ref Greg Kroah-Hartman
` (147 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 42de7db475fe895d97934b73a06527a2e4912d93 ]
We are passing 'ret' to add_rchar() under the 'out' label, which is meant
to take a byte count for accounting, however if we got an error we pass
it to add_rchar() too, which is just wrong. Fix thing by passing 'ret'
only when it's not an error.
Fixes: 34310c442e17 ("btrfs: add io_uring command for encoded reads (ENCODED_READ ioctl)")
Link: https://sashiko.dev/#/bug/linux-beb0369e-eb47-41d3-86c1-e79cdc2de157
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/ioctl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8d3882e296552..46dbac91b5576 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4707,7 +4707,8 @@ static void btrfs_uring_read_finished(struct io_tw_req tw_req, io_tw_token_t tw)
btrfs_inode_unlock(inode, BTRFS_ILOCK_SHARED);
io_uring_cmd_done(cmd, ret, IO_URING_CMD_TASK_WORK_ISSUE_FLAGS);
- add_rchar(current, ret);
+ if (ret > 0)
+ add_rchar(current, ret);
for (index = 0; index < priv->nr_pages; index++)
__free_page(priv->pages[index]);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 263/703] btrfs: fix delayed inode count leak after failure to delete inode ref
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (259 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 262/703] btrfs: fix incorrect task accounting on error during io_uring read Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 264/703] jbd2: set JBD2_LOADED under j_state_lock Greg Kroah-Hartman
` (146 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Filipe Manana,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit 3100f46985fd14148e79a0e79912180934ef7231 ]
When updating a delayed inode, if we have an inode ref to delete (the flag
BTRFS_DELAYED_NODE_DEL_IREF is set) and we fail the deletion of the inode
ref item (if it's in another leaf), we abort the transaction and then
never release the delayed count for the inode ref deletion (by calling
btrfs_release_delayed_iref()), resulting in a permanent leak of the
delayed inode.
Fix this by jumping to the 'out' label instead and removing the now no
longer necessary 'err_out' label.
Fixes: 67de11769bd5 ("Btrfs: introduce the delayed inode ref deletion for the single link inode")
Link: https://sashiko.dev/#/bug/linux-3520c6eb-7928-477d-b369-9caff2b98d10
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/delayed-inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 382ad94badefa..c339e95fc09e3 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1067,7 +1067,7 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (unlikely(ret < 0)) {
btrfs_abort_transaction(trans, ret);
- goto err_out;
+ goto out;
}
ASSERT(ret > 0);
ASSERT(path->slots[0] > 0);
@@ -1095,7 +1095,6 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
out:
btrfs_release_delayed_iref(node);
btrfs_release_path(path);
-err_out:
btrfs_delayed_inode_release_metadata(fs_info, node, (ret < 0));
btrfs_release_delayed_inode(node);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 264/703] jbd2: set JBD2_LOADED under j_state_lock
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (260 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 263/703] btrfs: fix delayed inode count leak after failure to delete inode ref Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 265/703] bpf: Let the bpf_fastcall boundary cover the longest pattern Greg Kroah-Hartman
` (145 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Göttsche, Jan Kara,
Theodore Tso, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Göttsche <cgzones@googlemail.com>
[ Upstream commit 40e53dad45a92e932156de23a69c991f3e2512c9 ]
j_flags is protected by j_state_lock, with only quick racy checks done
without it. jbd2_journal_load() however sets JBD2_LOADED with a plain
read-modify-write after journal_reset() has already started kjournald2,
which tests and may update j_flags under the lock. KCSAN reports this
while mounting the root file system:
BUG: KCSAN: data-race in jbd2_journal_load / kjournald2
write to 0xffff9c6b012c6000 of 8 bytes by task 1 on cpu 3:
jbd2_journal_load+0x279/0x3c0
ext4_fill_super+0x34dc/0x5740
get_tree_bdev_flags+0x21d/0x340
...
read to 0xffff9c6b012c6000 of 8 bytes by task 77 on cpu 0:
kjournald2+0xc8/0x3e0
kthread+0x1bd/0x200
...
value changed: 0x00000000000000a8 -> 0x00000000000000b8
A concurrent update of another flag, e.g. JBD2_ABORT, could be lost.
Take j_state_lock when setting JBD2_LOADED, like the other writers of
j_flags do.
Fixes: 470decc613ab ("[PATCH] jbd2: initial copy of files from jbd")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260928202159.2463182-1-cgoettsche@seltendoof.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/jbd2/journal.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 1184dbad43e57..ae6eebe40c9de 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2102,7 +2102,10 @@ int jbd2_journal_load(journal_t *journal)
return err;
}
+ /* kjournald2 is already running, see journal_reset(). */
+ write_lock(&journal->j_state_lock);
journal->j_flags |= JBD2_LOADED;
+ write_unlock(&journal->j_state_lock);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 265/703] bpf: Let the bpf_fastcall boundary cover the longest pattern
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (261 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 264/703] jbd2: set JBD2_LOADED under j_state_lock Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 266/703] net: sock_reuseport: Check program type on the migration path Greg Kroah-Hartman
` (144 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov,
Kumar Kartikeya Dwivedi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 95d366cb57752fb8821488676f607ebd0050fa9e ]
A subprog can have bpf_fastcall patterns of different length:
*(u64 *)(r10 - 8) = r2
*(u64 *)(r10 - 16) = r1
call bpf_get_smp_processor_id
r1 = *(u64 *)(r10 - 16)
r2 = *(u64 *)(r10 - 8)
*(u64 *)(r10 - 16) = r1
call bpf_get_smp_processor_id
r1 = *(u64 *)(r10 - 16)
r0 = *(u64 *)(r10 - 8)
For each pattern, take the offset just above its highest spill slot: 0 for
the first pattern here, -8 for the second. Currently
mark_fastcall_pattern_for_call() keeps the lowest of these offsets in
fastcall_stack_off, the bpf_fastcall boundary of the subprog, which is -8
here. check_fastcall_stack_contract() looks only at accesses below the
boundary, so the last load, at -8, does not switch the rewrite off.
bpf_remove_fastcall_spills_fills() then removes all three pairs of a spill
and a fill, and the load reads a slot that nothing wrote, while the
verifier took it for a slot with the type of R2.
Keep the highest of these offsets instead: every slot of every pattern is
below it. Start from S16_MIN, the value that says that nothing is
rewritten. Stop at 0, as min() did, because a pattern in code that never
runs may end above the frame pointer.
Fixes: 5b5f51bff1b6 ("bpf: no_caller_saved_registers attribute for helper calls")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://patch.msgid.link/adbe7671c30f744adf6682d6431b9d818039cefb.1795462417.git.memxor@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 40265041cc056..4d76394cbac1a 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -18379,7 +18379,11 @@ static void mark_fastcall_pattern_for_call(struct bpf_verifier_env *env,
env->insn_aux_data[insn_idx].fastcall_spills_num = i - 1;
else
subprog->keep_fastcall_stack = 1;
- subprog->fastcall_stack_off = min(subprog->fastcall_stack_off, off);
+ /*
+ * The upper end of the longest pattern: no slot of a pattern is above it. Code that never
+ * runs may have a pattern that ends above the frame pointer.
+ */
+ subprog->fastcall_stack_off = max(subprog->fastcall_stack_off, min_t(s16, off, 0));
}
static int mark_fastcall_patterns(struct bpf_verifier_env *env)
@@ -18390,6 +18394,7 @@ static int mark_fastcall_patterns(struct bpf_verifier_env *env)
int s, i;
for (s = 0; s < env->subprog_cnt; ++s, ++subprog) {
+ subprog->fastcall_stack_off = S16_MIN;
/* find lowest stack spill offset used in this subprog */
lowest_off = 0;
for (i = subprog->start; i < (subprog + 1)->start; ++i) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 266/703] net: sock_reuseport: Check program type on the migration path
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (262 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 265/703] bpf: Let the bpf_fastcall boundary cover the longest pattern Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 267/703] cgroup/rstat: disable preemption in css_rstat_updated() Greg Kroah-Hartman
` (143 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shihuang Liu, Alexei Starovoitov,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shihuang Liu <shlomojune6@gmail.com>
[ Upstream commit cbaaeff649b7aa09170cb31db001e5468c2726c0 ]
A BPF_PROG_TYPE_SOCKET_FILTER program can be loaded with
expected_attach_type set to BPF_SK_REUSEPORT_SELECT_OR_MIGRATE and
attached to a SO_REUSEPORT TCP group. Closing a listener that still
has queued children then runs it with a struct sk_reuseport_kern
context even though it was verified against struct sk_buff, which
KASAN reports as a stack-out-of-bounds in ___bpf_prog_run().
Reaching this without CAP_BPF requires
kernel.unprivileged_bpf_disabled=0; with
CONFIG_BPF_UNPRIV_DEFAULT_OFF=y, the Kconfig default, the sysctl
starts at 2.
reuseport_migrate_sock() decides from prog->expected_attach_type
alone, a field user space sets that does not identify the program
type. Require BPF_PROG_TYPE_SK_REUSEPORT there and in
reuseport_stop_listen_sock(); socket filters still work as
selectors, so the selection path is unchanged.
Fixes: d5e4ddaeb6ab ("bpf: Support socket migration by eBPF.")
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20261118153541.172499-1-shlomojune6@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock_reuseport.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
index eb8d24964e2f6..7174c61e2e59c 100644
--- a/net/core/sock_reuseport.c
+++ b/net/core/sock_reuseport.c
@@ -461,6 +461,18 @@ void reuseport_detach_sock(struct sock *sk)
}
EXPORT_SYMBOL(reuseport_detach_sock);
+/*
+ * Only a BPF_PROG_TYPE_SK_REUSEPORT program is verified against
+ * struct sk_reuseport_kern, which is the context bpf_run_sk_reuseport()
+ * passes to it. expected_attach_type is set by user space and does not
+ * identify the program type.
+ */
+static bool reuseport_is_migration_prog(const struct bpf_prog *prog)
+{
+ return prog && prog->type == BPF_PROG_TYPE_SK_REUSEPORT &&
+ prog->expected_attach_type == BPF_SK_REUSEPORT_SELECT_OR_MIGRATE;
+}
+
void reuseport_stop_listen_sock(struct sock *sk)
{
if (sk->sk_protocol == IPPROTO_TCP) {
@@ -475,7 +487,7 @@ void reuseport_stop_listen_sock(struct sock *sk)
lockdep_is_held(&reuseport_lock));
if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_migrate_req) ||
- (prog && prog->expected_attach_type == BPF_SK_REUSEPORT_SELECT_OR_MIGRATE)) {
+ reuseport_is_migration_prog(prog)) {
/* Migration capable, move sk from the listening section
* to the closed section.
*/
@@ -645,7 +657,7 @@ struct sock *reuseport_migrate_sock(struct sock *sk,
hash = migrating_sk->sk_hash;
prog = rcu_dereference(reuse->prog);
- if (!prog || prog->expected_attach_type != BPF_SK_REUSEPORT_SELECT_OR_MIGRATE) {
+ if (!reuseport_is_migration_prog(prog)) {
if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_migrate_req))
goto select_by_hash;
goto failure;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 267/703] cgroup/rstat: disable preemption in css_rstat_updated()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (263 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 266/703] net: sock_reuseport: Check program type on the migration path Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 268/703] x86/efi: Disregard the INITRD and MEMATTR config tables after kexec Greg Kroah-Hartman
` (142 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, Karl Mehltretter,
Shakeel Butt, Tejun Heo, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
[ Upstream commit c99f50e4acf86bfbbe313d79f281d83be1763260 ]
BPF programs can call css_rstat_updated() with preemption enabled.
The kfunc calls __css_rstat_updated(), which requires preemption to
be disabled while it queues an rstat update. A cgroup iterator can
hit the lockdep assertion on both RT and non-RT kernels. The
cgroup_hierarchical_stats selftest can also hit it on PREEMPT_RT:
spin_lock_irqsave() on trace_cgroup_path_lock leaves preemption and
interrupts enabled there.
Disable preemption in the BPF wrapper after validating the CPU and
before calling __css_rstat_updated().
Fixes: 36df6e3dbd7e ("cgroup: make css_rstat_updated nmi safe")
Reported-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Closes: https://lore.kernel.org/r/20251119111402.153727-1-jiayuan.chen@linux.dev/
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/rstat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
index de816a43db9f0..d72fe721cea05 100644
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -131,6 +131,7 @@ __bpf_kfunc void css_rstat_updated(struct cgroup_subsys_state *css, int cpu)
if (unlikely(cpu < 0 || cpu >= nr_cpu_ids || !cpu_possible(cpu)))
return;
+ guard(preempt)();
__css_rstat_updated(css, cpu);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 268/703] x86/efi: Disregard the INITRD and MEMATTR config tables after kexec
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (264 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 267/703] cgroup/rstat: disable preemption in css_rstat_updated() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 269/703] efi/tpm: Allocate the event log from EFI loader data again Greg Kroah-Hartman
` (141 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilias Apalodimas,
Jasmeet (Jazz) Bhatia, Ard Biesheuvel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <ardb@kernel.org>
[ Upstream commit 6863183e8b65e833f8140e20d526282a725e040e ]
When the EFI stub loads the initrd itself, it describes its location and
size to the core kernel via a LINUX_EFI_INITRD_MEDIA_GUID configuration
table, which is allocated from EFI loader data, just like the initrd.
On x86, the stub passes the same information via boot_params as well,
which takes precedence, but the core kernel will fall back to the INITRD
config table if boot_params does not describe an initrd.
The EFI configuration table array is passed on to kexec'd kernels as-is,
and so a kexec'd kernel that is booted without an initrd will pick up
the INITRD config table that was installed during the original boot, and
use the initrd it describes, which no longer exists at that point.
Commit 6e62d1c6f2c7 ("efi: Wipe INITRD config table from memory after
consumption") mitigated this by wiping the base and size fields of the
table once it has been consumed. However, the memory holding the table
is released to the page allocator as well, and so it may have been
reused by the time the kexec occurs, in which case the kexec'd kernel
will interpret whatever happens to be stored there as the base and size
of the initrd, e.g.,
[ 0.000000] efi: ... INITRD=0x7c41cc18 ...
[ 0.000000] RAMDISK: [mem 0x9090909090909090-0xd1e7d1e68aaeafff]
[ 0.000000] Kernel panic - not syncing: Cannot find place for new RAMDISK of size 4708303772963442675
Crash kernels will find the stale table as well, and wipe it again, i.e.,
write to the memory of the crashed kernel that they are supposed to
capture.
Both kexec_file_load() and kexec-tools pass a SETUP_EFI setup_data entry
to the next kernel when EFI is enabled, which the x86 EFI code already
relies on to detect that it was booted via kexec. Such kernels are
entered directly, bypassing the EFI stub, and so any INITRD config table
they encounter is necessarily stale. So wire up
efi_config_table_is_usable() for x86, and use it to disregard the INITRD
config table when a SETUP_EFI setup_data entry is present.
While at it, use the same mechanism to disregard the Memory Attributes
table after kexec, which is currently achieved by overwriting its address
in the firmware's config table array with EFI_INVALID_TABLE_ADDR in
efi_reuse_config(). This only happens on 64-bit firmware, and only if
the SETUP_EFI entry carries the address of an SMBIOS table, which
kexec-tools does not provide on systems that only expose an SMBIOS3
entry point. In that case, the kexec'd kernel will parse the table, which
may be stale as well, given that EDK2 based firmware allocates it from
EFI boot services data, which is released to the page allocator after
boot too, e.g.,
[ 0.000000] efi: memattr: Unexpected EFI Memory Attributes table version -1958647317
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Jasmeet (Jazz) Bhatia <jasmeet.bhatia.us@gmail.com>
Fixes: f4dc7fffa987 ("efi: libstub: unify initrd loading between architectures")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/platform/efi/efi.c | 26 ++++++++++++++++++++++++++
arch/x86/platform/efi/quirks.c | 4 ----
include/linux/efi.h | 3 +++
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 5b00b13f72d4a..2c48a72b2a099 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -433,6 +433,32 @@ static int __init efi_systab_init(unsigned long phys)
return 0;
}
+/*
+ * kexec passes the firmware's config table array on to the next kernel as-is,
+ * but some of the tables it describes must be disregarded when booting via
+ * kexec, which is indicated by the presence of a SETUP_EFI setup_data entry:
+ *
+ * - The INITRD table is installed by the EFI stub to describe the initrd that
+ * it loaded. Both the table and the initrd are allocated from EFI loader
+ * data, which is released to the page allocator once the kernel is up and
+ * running, and so the table is stale by the time kexec boots the next kernel.
+ *
+ * - The Memory Attributes table may reside in EFI boot services data, which is
+ * released to the page allocator as well. Even if it is still intact, the
+ * sanity check in efi_memattr_init() may fail spuriously, given that only
+ * the runtime regions of the EFI memory map are passed on via kexec. Applying
+ * the permissions it describes is not critical, so just ignore it.
+ */
+bool __init x86_efi_config_table_is_usable(const efi_guid_t *guid,
+ unsigned long table)
+{
+ if (!efi_setup)
+ return true;
+
+ return efi_guidcmp(*guid, LINUX_EFI_INITRD_MEDIA_GUID) &&
+ efi_guidcmp(*guid, EFI_MEMORY_ATTRIBUTES_TABLE_GUID);
+}
+
static int __init efi_config_init(const efi_config_table_type_t *arch_tables)
{
void *config_tables;
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index 1f234c33c85a7..e6672a2fcbb4c 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -611,10 +611,6 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID))
((efi_config_table_64_t *)p)->table = data->smbios;
- /* Do not bother to play with mem attr table across kexec */
- if (!efi_guidcmp(guid, EFI_MEMORY_ATTRIBUTES_TABLE_GUID))
- ((efi_config_table_64_t *)p)->table = EFI_INVALID_TABLE_ADDR;
-
p += sz;
}
early_memunmap(tablep, nr_tables * sz);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 0ec9f3dc596d4..1ce4733378890 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1335,10 +1335,13 @@ struct linux_efi_initrd {
#define EFI_SECRET_TABLE_HEADER_GUID EFI_GUID(0x1e74f542, 0x71dd, 0x4d66, 0x96, 0x3e, 0xef, 0x42, 0x87, 0xff, 0x17, 0x3b)
bool xen_efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table);
+bool x86_efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table);
static __always_inline
bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table)
{
+ if (IS_ENABLED(CONFIG_X86) && !x86_efi_config_table_is_usable(guid, table))
+ return false;
if (!IS_ENABLED(CONFIG_XEN_EFI))
return true;
return xen_efi_config_table_is_usable(guid, table);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 269/703] efi/tpm: Allocate the event log from EFI loader data again
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (265 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 268/703] x86/efi: Disregard the INITRD and MEMATTR config tables after kexec Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 270/703] cpufreq: intel_pstate: Use dedicated lock in set_power_ctl_ee_state() Greg Kroah-Hartman
` (140 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jasmeet (Jazz) Bhatia,
Ard Biesheuvel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <ardb@kernel.org>
[ Upstream commit cc919b0db7d322c65067801869bc6354669726dc ]
The EFI stub currently allocates the TPM event log as
EFI_ACPI_RECLAIM_MEMORY. On x86, this becomes an ACPI data entry
in the E820 map.
On a Framework Laptop 16 (AMD Ryzen AI 300 Series), the EFI allocator
can place this allocation at different physical addresses across boots.
Since x86 hibernation validates architecture-specific data from
the firmware E820 map, this causes an otherwise valid hibernation image
to be rejected on resume with the following error:
Hibernate inconsistent memory map detected!
PM: hibernation: Image mismatch: architecture specific data
Allocating the event log as EFI_LOADER_DATA avoids changing the E820
map, but doing that alone would regress the kexec corruption issue fixed
by commit 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event
log to avoid corruption"): the E820 map that kexec passes on to the next
kernel describes EFI loader data as ordinary RAM, and so the event log
may get clobbered before the next kernel gets around to reserving it.
So use the x86 implementation of efi_config_table_is_usable() to
disregard the TPM event log table after kexec, just like the INITRD
table, and go back to allocating it as EFI_LOADER_DATA. This is simpler
than preserving the event log across kexec, e.g., by installing the
memreserve table on x86 and using efi_mem_reserve_persistent(), and the
utility of the event log after kexec is questionable to begin with.
This also protects kexec'd kernels from a clobbered event log if the
previous kernel predates the change above, and allocated the table from
EFI loader data as well. The kexec issue was specific to x86, so other
architectures can use EFI loader data as before.
Tested-by: Jasmeet (Jazz) Bhatia <jasmeet.bhatia.us@gmail.com>
Fixes: 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/platform/efi/efi.c | 8 ++++++++
drivers/firmware/efi/libstub/tpm.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 2c48a72b2a099..f217a441c5ab7 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -443,6 +443,13 @@ static int __init efi_systab_init(unsigned long phys)
* data, which is released to the page allocator once the kernel is up and
* running, and so the table is stale by the time kexec boots the next kernel.
*
+ * - The TPM event log table is installed by the EFI stub too. It is allocated
+ * from EFI loader data rather than ACPI reclaim memory, as the latter would
+ * create an E820 entry that may move around between boots, which breaks
+ * resume from hibernation. It is reserved by the kernel, but the E820 map
+ * that kexec passes on describes it as ordinary RAM, and so it may get
+ * clobbered before the next kernel gets around to reserving it.
+ *
* - The Memory Attributes table may reside in EFI boot services data, which is
* released to the page allocator as well. Even if it is still intact, the
* sanity check in efi_memattr_init() may fail spuriously, given that only
@@ -456,6 +463,7 @@ bool __init x86_efi_config_table_is_usable(const efi_guid_t *guid,
return true;
return efi_guidcmp(*guid, LINUX_EFI_INITRD_MEDIA_GUID) &&
+ efi_guidcmp(*guid, LINUX_EFI_TPM_EVENT_LOG_GUID) &&
efi_guidcmp(*guid, EFI_MEMORY_ATTRIBUTES_TABLE_GUID);
}
diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c
index 73f0011147323..b8183bfdbaa3d 100644
--- a/drivers/firmware/efi/libstub/tpm.c
+++ b/drivers/firmware/efi/libstub/tpm.c
@@ -96,7 +96,7 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca
}
/* Allocate space for the logs and copy them. */
- status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
+ status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
sizeof(*log_tbl) + log_size, (void **)&log_tbl);
if (status != EFI_SUCCESS) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 270/703] cpufreq: intel_pstate: Use dedicated lock in set_power_ctl_ee_state()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (266 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 269/703] efi/tpm: Allocate the event log from EFI loader data again Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 271/703] drm/xe/hwmon: Unregister hwmon before the device is unplugged Greg Kroah-Hartman
` (139 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Borah, Chaitanya Kumar,
Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Upstream commit 569e1eb36b033f42a9c363ffe4bfbf50bdadae51 ]
Commit eee2a44e4e2b ("cpufreq: Improve suspend-resume synchronization")
caused lockdep to complain about a possible circular locking dependency
because intel_pstate_resume() is now called under cpus_read_lock, and it
calls set_power_ctl_ee_state() that acquires intel_pstate_driver_lock
which can be held around CPU hotplug locking.
Fortunately, this cannot lead to a real deadlock because
intel_pstate_resume() does not run in parallel with the other holders
of intel_pstate_driver_lock, but in fact set_power_ctl_ee_state() need
not use that particular lock either. Moreover, the original purpose of
that lock is different, so using it in set_power_ctl_ee_state() is
questionable.
Accordingly, introduce a dedicated mutex for protecting MSR_IA32_POWER_CTL
updates and power_ctl_ee_state accesses and make set_power_ctl_ee_state()
use it instead of intel_pstate_driver_lock. Also take it directly in
intel_pstate_resume() around the EE state restore.
Fixes: eee2a44e4e2b ("cpufreq: Improve suspend-resume synchronization")
Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
Closes: https://lore.kernel.org/linux-pm/efcb1647-46fd-442a-bbda-283560d9df53@intel.com/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/2862244.mvXUDI8C0e@rafael.j.wysocki
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/intel_pstate.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 23262ce56c246..a7c877c668c01 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1385,13 +1385,14 @@ static void intel_pstate_hwp_offline(struct cpudata *cpu)
/* Enable bit for Dynamic Efficiency Control (DEC) */
#define POWER_CTL_DEC_ENABLE 27
+static DEFINE_MUTEX(power_ctl_update_lock);
static int power_ctl_ee_state;
-static void set_power_ctl_ee_state(bool input)
+static void __set_power_ctl_ee_state(bool input)
{
u64 power_ctl;
- guard(mutex)(&intel_pstate_driver_lock);
+ lockdep_assert_held(&power_ctl_update_lock);
rdmsrq(MSR_IA32_POWER_CTL, power_ctl);
if (input) {
@@ -1404,6 +1405,13 @@ static void set_power_ctl_ee_state(bool input)
wrmsrq(MSR_IA32_POWER_CTL, power_ctl);
}
+static void set_power_ctl_ee_state(bool input)
+{
+ guard(mutex)(&power_ctl_update_lock);
+
+ __set_power_ctl_ee_state(input);
+}
+
static void intel_pstate_hwp_enable(struct cpudata *cpudata);
static void intel_pstate_hwp_reenable(struct cpudata *cpu)
@@ -1432,11 +1440,13 @@ static int intel_pstate_resume(struct cpufreq_policy *policy)
pr_debug("CPU %d resuming\n", cpu->cpu);
- /* Only restore if the system default is changed */
- if (power_ctl_ee_state == POWER_CTL_EE_ENABLE)
- set_power_ctl_ee_state(true);
- else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE)
- set_power_ctl_ee_state(false);
+ scoped_guard(mutex, &power_ctl_update_lock) {
+ /* Only restore if the system default has changed */
+ if (power_ctl_ee_state == POWER_CTL_EE_ENABLE)
+ __set_power_ctl_ee_state(true);
+ else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE)
+ __set_power_ctl_ee_state(false);
+ }
if (cpu->suspended && hwp_active) {
mutex_lock(&intel_pstate_limits_lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 271/703] drm/xe/hwmon: Unregister hwmon before the device is unplugged
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (267 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 270/703] cpufreq: intel_pstate: Use dedicated lock in set_power_ctl_ee_state() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 272/703] arm64: dts: st: add PSCI idle state to STM32MP25 CPU domains Greg Kroah-Hartman
` (138 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karthik Poosa, Michael J. Ruhl,
Rodrigo Vivi, Matthew Brost, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
[ Upstream commit 72296e02b46a34e52c8b97c5ebf95c2a970373fd ]
hwmon was registered with devm, so its sysfs attributes stayed
reachable after drm_dev_unplug() until devres teardown. A reader in
that window accesses an unplugged device, e.g. the PMT energy read
on BMG.
Unregister it explicitly in xe_device_remove() and in the probe error
path, before the device is unplugged. Removing the attributes waits
for in-flight reads, so none can run afterwards.
Cc: Karthik Poosa <karthik.poosa@intel.com>
Cc: Michael J. Ruhl <michael.j.ruhl@intel.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Fixes: fb1b70607f73 ("drm/xe/hwmon: Expose power attributes")
Link: https://patch.msgid.link/20261120152753.1346010-2-rodrigo.vivi@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 6bae3d8f569445db5e3385b61efa5f9ba9eed3d3)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_device.c | 9 ++++++---
drivers/gpu/drm/xe/xe_hwmon.c | 22 +++++++++++++++++++---
drivers/gpu/drm/xe/xe_hwmon.h | 2 ++
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 1d5deb149137a..4c5a87c682a0c 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -951,7 +951,7 @@ int xe_device_probe(struct xe_device *xe)
err = xe_i2c_probe(xe);
if (err)
- goto err_unregister_display;
+ goto err_unregister_hwmon;
for_each_gt(gt, xe, id)
xe_gt_sanitize_freq(gt);
@@ -960,14 +960,16 @@ int xe_device_probe(struct xe_device *xe)
err = xe_sriov_init_late(xe);
if (err)
- goto err_unregister_display;
+ goto err_unregister_hwmon;
err = devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe);
if (err)
- goto err_unregister_display;
+ goto err_unregister_hwmon;
return 0;
+err_unregister_hwmon:
+ xe_hwmon_unregister(xe);
err_unregister_display:
xe_display_unregister(xe);
drm_dev_unregister(&xe->drm);
@@ -977,6 +979,7 @@ int xe_device_probe(struct xe_device *xe)
void xe_device_remove(struct xe_device *xe)
{
+ xe_hwmon_unregister(xe);
xe_display_unregister(xe);
drm_dev_unplug(&xe->drm);
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 65621775878b6..a1a78ecd2f554 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -1328,9 +1328,9 @@ int xe_hwmon_register(struct xe_device *xe)
drm_dbg(&xe->drm, "Register xe hwmon interface\n");
/* hwmon_dev points to device hwmon<i> */
- hwmon->hwmon_dev = devm_hwmon_device_register_with_info(dev, "xe", hwmon,
- &hwmon_chip_info,
- hwmon_groups);
+ hwmon->hwmon_dev = hwmon_device_register_with_info(dev, "xe", hwmon,
+ &hwmon_chip_info,
+ hwmon_groups);
if (IS_ERR(hwmon->hwmon_dev)) {
drm_err(&xe->drm, "Failed to register xe hwmon (%pe)\n", hwmon->hwmon_dev);
xe->hwmon = NULL;
@@ -1339,4 +1339,20 @@ int xe_hwmon_register(struct xe_device *xe)
return 0;
}
+
+/**
+ * xe_hwmon_unregister - Remove the hwmon interface
+ * @xe: xe device
+ *
+ * Called before the device is unplugged, so that no hwmon attribute can
+ * be accessed afterwards.
+ */
+void xe_hwmon_unregister(struct xe_device *xe)
+{
+ if (!xe->hwmon)
+ return;
+
+ hwmon_device_unregister(xe->hwmon->hwmon_dev);
+ xe->hwmon = NULL;
+}
MODULE_IMPORT_NS("INTEL_PMT_TELEMETRY");
diff --git a/drivers/gpu/drm/xe/xe_hwmon.h b/drivers/gpu/drm/xe/xe_hwmon.h
index d02c1bfe8c0a0..e67e0134f02a5 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.h
+++ b/drivers/gpu/drm/xe/xe_hwmon.h
@@ -12,8 +12,10 @@ struct xe_device;
#if IS_REACHABLE(CONFIG_HWMON)
int xe_hwmon_register(struct xe_device *xe);
+void xe_hwmon_unregister(struct xe_device *xe);
#else
static inline int xe_hwmon_register(struct xe_device *xe) { return 0; };
+static inline void xe_hwmon_unregister(struct xe_device *xe) { }
#endif
#endif /* _XE_HWMON_H_ */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 272/703] arm64: dts: st: add PSCI idle state to STM32MP25 CPU domains
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (268 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 271/703] drm/xe/hwmon: Unregister hwmon before the device is unplugged Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 273/703] arm64: dts: st: add PSCI idle state to STM32MP23 " Greg Kroah-Hartman
` (137 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Patrick Delaunay, Amelie Delaunay,
Alexandre Torgue, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Delaunay <patrick.delaunay@foss.st.com>
[ Upstream commit ab4ce1d0630f677032d7e20d27c80ecfbd9960cb ]
Define a PSCI CPU suspend state and reference it from both STM32MP25
CPU power domains.
In OSI mode, PSCI power domains are initialized as off. The idle-state
allows the CPU power-domain governor to manage them, avoiding probe
stalls for devices that depend on the cluster power domain, including
SDMMC1.
Fixes: 9c8d852dabbd ("arm64: dts: st: add power domain on stm32mp25")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20261119185544.v2.1.Ia5e0774883d237f5825b7090962b454294922558@changeid
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 14 ++++++++++++++
arch/arm64/boot/dts/st/stm32mp253.dtsi | 1 +
2 files changed, 15 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 323ac04b550a6..8c055548c79ff 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -25,6 +25,19 @@ cpu0: cpu@0 {
power-domains = <&CPU_PD0>;
power-domain-names = "psci";
};
+
+ idle-states {
+ entry-method = "psci";
+
+ cpu_sleep: cpu-sleep {
+ compatible = "arm,idle-state";
+ arm,psci-suspend-param = <0x00000002>;
+ local-timer-stop;
+ entry-latency-us = <150>;
+ exit-latency-us = <200>;
+ min-residency-us = <1000>;
+ };
+ };
};
arm-pmu {
@@ -145,6 +158,7 @@ psci {
CPU_PD0: power-domain-cpu0 {
#power-domain-cells = <0>;
+ domain-idle-states = <&cpu_sleep>;
power-domains = <&CLUSTER_PD>;
};
diff --git a/arch/arm64/boot/dts/st/stm32mp253.dtsi b/arch/arm64/boot/dts/st/stm32mp253.dtsi
index eeceb086252bf..96483733d7a86 100644
--- a/arch/arm64/boot/dts/st/stm32mp253.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp253.dtsi
@@ -26,6 +26,7 @@ arm-pmu {
psci {
CPU_PD1: power-domain-cpu1 {
#power-domain-cells = <0>;
+ domain-idle-states = <&cpu_sleep>;
power-domains = <&CLUSTER_PD>;
};
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 273/703] arm64: dts: st: add PSCI idle state to STM32MP23 CPU domains
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (269 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 272/703] arm64: dts: st: add PSCI idle state to STM32MP25 CPU domains Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 274/703] arm64: dts: st: mark STM32MP23 timer as stopping in suspend Greg Kroah-Hartman
` (136 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Patrick Delaunay, Amelie Delaunay,
Alexandre Torgue, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Delaunay <patrick.delaunay@foss.st.com>
[ Upstream commit 0818ec0de18627ff7d2306e5c2843a0358960874 ]
Define a PSCI CPU suspend state and reference it from both STM32MP23
CPU power domains.
In OSI mode, PSCI power domains are initialized as off. The idle-state
allows the CPU power-domain governor to manage them, avoiding probe
stalls for devices that depend on the cluster power domain, including
SDMMC1.
Fixes: e9b03ef21386 ("arm64: dts: st: introduce stm32mp23 SoCs family")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/all/20261030102907.1.I0ef2a7ac525ef18fa683368382d93e98cc36ee25@changeid/
Link: https://lore.kernel.org/r/20261119184209.v2.1.If2b6b99285c1e60ca11b6e7fccf7d9b130ca20dd@changeid
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/st/stm32mp231.dtsi | 14 ++++++++++++++
arch/arm64/boot/dts/st/stm32mp233.dtsi | 1 +
2 files changed, 15 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp231.dtsi b/arch/arm64/boot/dts/st/stm32mp231.dtsi
index 8a109e46af391..c887ad34d0ff8 100644
--- a/arch/arm64/boot/dts/st/stm32mp231.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp231.dtsi
@@ -24,6 +24,19 @@ cpu0: cpu@0 {
power-domains = <&cpu0_pd>;
power-domain-names = "psci";
};
+
+ idle-states {
+ entry-method = "psci";
+
+ cpu_sleep: cpu-sleep {
+ compatible = "arm,idle-state";
+ arm,psci-suspend-param = <0x00000002>;
+ local-timer-stop;
+ entry-latency-us = <150>;
+ exit-latency-us = <200>;
+ min-residency-us = <1000>;
+ };
+ };
};
arm-pmu {
@@ -117,6 +130,7 @@ psci {
cpu0_pd: power-domain-cpu0 {
#power-domain-cells = <0>;
+ domain-idle-states = <&cpu_sleep>;
power-domains = <&cluster_pd>;
};
diff --git a/arch/arm64/boot/dts/st/stm32mp233.dtsi b/arch/arm64/boot/dts/st/stm32mp233.dtsi
index 78f4059fca5db..cebefd99906f6 100644
--- a/arch/arm64/boot/dts/st/stm32mp233.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp233.dtsi
@@ -26,6 +26,7 @@ arm-pmu {
psci {
cpu1_pd: power-domain-cpu1 {
#power-domain-cells = <0>;
+ domain-idle-states = <&cpu_sleep>;
power-domains = <&cluster_pd>;
};
};
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 274/703] arm64: dts: st: mark STM32MP23 timer as stopping in suspend
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (270 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 273/703] arm64: dts: st: add PSCI idle state to STM32MP23 " Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 275/703] ftrace: Fix lost recursion records in ftrace_record_recursion() Greg Kroah-Hartman
` (135 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Patrick Delaunay, Amelie Delaunay,
Alexandre Torgue, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Delaunay <patrick.delaunay@foss.st.com>
[ Upstream commit 9eb9bea92c7ea2a8886eeab01cdfe4365bee0328 ]
The generic ARM timer, based on STGEN, stops ticking in low-power
states such as Stop1. Replace the always-on property with
arm,no-tick-in-suspend in the STM32MP23 timer node, matching the
STM32MP25 configuration.
Fixes: e9b03ef21386 ("arm64: dts: st: introduce stm32mp23 SoCs family")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20261030102907.1.I0ef2a7ac525ef18fa683368382d93e98cc36ee25@changeid
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/st/stm32mp231.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/st/stm32mp231.dtsi b/arch/arm64/boot/dts/st/stm32mp231.dtsi
index c887ad34d0ff8..93c4b20a7a277 100644
--- a/arch/arm64/boot/dts/st/stm32mp231.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp231.dtsi
@@ -151,7 +151,7 @@ timer {
<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>;
- always-on;
+ arm,no-tick-in-suspend;
};
soc@0 {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 275/703] ftrace: Fix lost recursion records in ftrace_record_recursion()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (271 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 274/703] arm64: dts: st: mark STM32MP23 timer as stopping in suspend Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 276/703] ASoC: aw88166: fix backup restoring the RE value instead of saving it Greg Kroah-Hartman
` (134 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Parri, Steven Rostedt,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
[ Upstream commit 7792e21d0a6e2fa819209949e8ba957504bedcd4 ]
cached_function is set to the current ip before the cmpxchg() that
claims a slot in recursed_functions[]. When that cmpxchg() loses a
race for the same slot, the code bumps index and retries via "goto
again", but the retry immediately matches its own cached_function
write and returns without ever reaching the bumped-index cmpxchg().
Concretely, for two writers racing on the same index:
CPU 0 (ip = A) CPU 1 (ip = B)
-------------- --------------
cmpxchg(&recursed_functions[index].ip,
0, B); // succeeds
cached_function = A;
cmpxchg(&recursed_functions[index].ip,
0, A);
// fails, old == B
index++;
goto again;
if (A == cached_function) // true: matches A's own store
return; // A is dropped, not retried
Once dropped this way, cached_function stays set to A, so every later
recursion of A also hits the fast path and returns before reaching the
retry, until some unrelated ip overwrites the cache.
Set cached_function only after the cmpxchg() has claimed the slot. The
retry path then leaves the cache untouched and no longer matches its
own store. When the cmpxchg() finds ip already present, the writer
that installed it sets the cache.
The bug was found with the help of an LLM.
Link: https://patch.msgid.link/20261026182553.221141-1-parri.andrea@gmail.com
Fixes: 773c16705058e ("ftrace: Add recording of functions that caused recursion")
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_recursion_record.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/kernel/trace/trace_recursion_record.c b/kernel/trace/trace_recursion_record.c
index a520b11afb0dd..800569b647178 100644
--- a/kernel/trace/trace_recursion_record.c
+++ b/kernel/trace/trace_recursion_record.c
@@ -17,8 +17,8 @@ static struct recursed_functions recursed_functions[CONFIG_FTRACE_RECORD_RECURSI
static atomic_t nr_records;
/*
- * Cache the last found function. Yes, updates to this is racey, but
- * so is memory cache ;-)
+ * Cache the last function found in or added to recursed_functions[].
+ * Updates to this are racy, but this is only a best-effort cache.
*/
static unsigned long cached_function;
@@ -67,24 +67,25 @@ void ftrace_record_recursion(unsigned long ip, unsigned long parent_ip)
}
}
- cached_function = ip;
-
/*
* We only want to add a function if it hasn't been added before.
- * Add to the current location before incrementing the count.
- * If it fails to add, then increment the index (save in i)
- * and try again.
+ * Claim the current slot before incrementing the count. If the slot
+ * is occupied by another function, advance to the next slot and retry.
+ *
+ * Do not update cached_function until ip is known to be present;
+ * otherwise the retry would match its own cache update.
*/
old = cmpxchg(&recursed_functions[index].ip, 0, ip);
if (old != 0) {
/* Did something else already added this for us? */
if (old == ip)
return;
- /* Try the next location (use i for the next index) */
+ /* Try the next location */
index++;
goto again;
}
+ cached_function = ip;
recursed_functions[index].parent_ip = parent_ip;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 276/703] ASoC: aw88166: fix backup restoring the RE value instead of saving it
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (272 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 275/703] ftrace: Fix lost recursion records in ftrace_record_recursion() Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 277/703] workqueue: Skip redundant unbound updates during CPU bringup Greg Kroah-Hartman
` (133 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Marco Giunta, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Giunta <marco_giunta@outlook.it>
[ Upstream commit b0d43948d45bef795e4769b88179ba598382bc4f ]
aw_dev_backup_sec_record() saves the VCALB and RE values so that
aw_dev_backup_sec_recovery() can restore them later. However, it passes
AW88166_RECOVERY_SEC_DATA for RE, so instead of reading ACR1/ACR2 it
writes the stored value back to them.
Pass AW88166_RECORD_SEC_DATA instead, as the vendor aw883xx driver does.
Fixes: 94e412c28e61 ("ASoC: codecs: Add aw88166 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
Link: https://patch.msgid.link/SN6PR19MB230389321D29F0C88582B4F6FC452@SN6PR19MB2303.namprd19.prod.outlook.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/aw88166.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c
index fd488fcd214fb..d0806d25d3a5a 100644
--- a/sound/soc/codecs/aw88166.c
+++ b/sound/soc/codecs/aw88166.c
@@ -403,7 +403,7 @@ static int aw_dev_init_re_update(struct aw88166 *aw88166, int flag)
static void aw_dev_backup_sec_record(struct aw88166 *aw88166)
{
aw_dev_init_vcalb_update(aw88166, AW88166_RECORD_SEC_DATA);
- aw_dev_init_re_update(aw88166, AW88166_RECOVERY_SEC_DATA);
+ aw_dev_init_re_update(aw88166, AW88166_RECORD_SEC_DATA);
}
static void aw_dev_backup_sec_recovery(struct aw88166 *aw88166)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 277/703] workqueue: Skip redundant unbound updates during CPU bringup
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (273 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 276/703] ASoC: aw88166: fix backup restoring the RE value instead of saving it Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 278/703] eth: bnxt_en: restore Rx coalescing after re-allocating the completion ring Greg Kroah-Hartman
` (132 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Saurabh Sengar, Tejun Heo,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurabh Sengar <ssengar@linux.microsoft.com>
[ Upstream commit edf1066ba69c89c42c3007e4230c7b9cb13405a8 ]
Before workqueue_init_topology(), all CPUs share the SYSTEM pod,
which contains every possible CPU. The effective cpumask and the
per-pod cpumask of an unbound workqueue are therefore identical,
regardless of which CPUs are online.
During this stage, workqueue_online_cpu() walks every possible CPU for
every unbound workqueue each time a secondary CPU comes online. The
pwq mappings cannot change yet, so this repeats redundant work that
scales quadratically with CPU count.
On a 640-vCPU Hyper-V VM, each of the 639 secondary CPU-online
callbacks walks all 640 possible CPUs for each of the 8 unbound
workqueues, giving 3,271,680 unbound_wq_update_pwq() calls that took
about 975 ms in total.
Skip these updates until workqueue_init_topology(). The pwq mappings
already match the effective cpumask, and wq_update_node_max_active()
does nothing before topology initialization. workqueue_init_topology()
will apply the topology-specific mappings and node limits once ready.
Keep worker rebinding and restoration of unbound worker affinity before
the guard. CPU hotplug after topology initialization is unchanged.
On the same VM running a v7.3 kernel, smp_init() took 1054 ms with this
change, compared to 2008 ms without it, a 47.5% reduction.
Before After Reduction
smp_init() 2008 ms 1054 ms 47.5%
Fixes: 84193c07105c ("workqueue: Generalize unbound CPU pods")
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/workqueue.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 8c74f199cd707..e9fbc9c04e67a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -6823,6 +6823,14 @@ int workqueue_online_cpu(unsigned int cpu)
mutex_unlock(&wq_pool_attach_mutex);
}
+ /*
+ * Before topology initialization, the SYSTEM pod covers all possible
+ * CPUs, so CPU onlining does not require updating pwq mappings.
+ * wq_update_node_max_active() also returns early at this stage.
+ */
+ if (!wq_topo_initialized)
+ goto out_unlock;
+
/* update pod affinity of unbound workqueues */
list_for_each_entry(wq, &workqueues, list) {
struct workqueue_attrs *attrs = wq->unbound_attrs;
@@ -6840,6 +6848,7 @@ int workqueue_online_cpu(unsigned int cpu)
}
}
+out_unlock:
mutex_unlock(&wq_pool_mutex);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 278/703] eth: bnxt_en: restore Rx coalescing after re-allocating the completion ring
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (274 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 277/703] workqueue: Skip redundant unbound updates during CPU bringup Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 279/703] eth: bnxt_en: restore Tx " Greg Kroah-Hartman
` (131 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jakub Kicinski, Pavan Chebbi,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit a6ea69915a230d24e9d9cd8dc0ff0551dab36106 ]
With TPH enabled, queue restart frees and re-allocates the Rx
completion ring in the FW, to apply the new Steering Tag. The new
FW ring starts with default interrupt coalescing parameters. The
driver programs coalescing only at open, from ethtool and from DIM,
so after a restart the ring ignores the configured settings, while
ethtool keeps reporting them.
Re-program Rx coalescing of the ring after allocating it. Use DIM's
current profile if adaptive coalescing is enabled, the static
settings otherwise. The per-ring DIM values may be stale when DIM is
off, ethtool changes to static coalescing don't update them.
With rx-usecs 1000, re-allocating the ring on a BCM57508 lowers the
latency of a 1 byte ping-pong on that queue by ~250us. Latency goes
back up once ethtool re-programs coalescing.
Fixes: 6b6bf60fc95f ("bnxt_en: Reallocate RX completion ring for TPH support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://patch.msgid.link/20261120034645.364630-1-kuba@kernel.org
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 24 +++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 2b1567616f51b..449aea93d3a9a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8465,6 +8465,25 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)
return rc;
}
+/* Program Rx coalescing of a single ring, e.g. after its completion ring
+ * was re-allocated in the FW, which resets the coalescing parameters.
+ */
+static int bnxt_hwrm_set_rx_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi)
+{
+ struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req;
+ int rc;
+
+ if (bp->flags & BNXT_FLAG_DIM)
+ return bnxt_hwrm_set_ring_coal(bp, bnapi);
+
+ rc = hwrm_req_init(bp, req, HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS);
+ if (rc)
+ return rc;
+
+ bnxt_hwrm_set_coal_params(bp, &bp->rx_coal, req);
+ return bnxt_hwrm_set_rx_coal(bp, bnapi, req);
+}
+
static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
{
struct hwrm_stat_ctx_clr_stats_input *req0 = NULL;
@@ -16393,6 +16412,11 @@ static int bnxt_queue_start(struct net_device *dev,
rc = bnxt_hwrm_cp_ring_alloc_p5(bp, rxr->rx_cpr);
if (rc)
goto err_reset;
+
+ rc = bnxt_hwrm_set_rx_ring_coal(bp, bnapi);
+ if (rc)
+ netdev_warn(bp->dev, "HWRM set coalescing failure rc: %d\n",
+ rc);
}
rc = bnxt_hwrm_rx_agg_ring_alloc(bp, rxr);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 279/703] eth: bnxt_en: restore Tx coalescing after re-allocating the completion ring
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (275 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 278/703] eth: bnxt_en: restore Rx coalescing after re-allocating the completion ring Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 280/703] net: dsa: b53: initialize the jumbo frame size register offset Greg Kroah-Hartman
` (130 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jakub Kicinski, Pavan Chebbi,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit 32756b82fde8f6cc98b174fdcd02c2a61033e263 ]
With TPH enabled, queue restart also frees and re-allocates the Tx
completion rings which share the NAPI instance with the Rx queue.
Same as on the Rx side, the new FW rings start with default interrupt
coalescing parameters, and the configured settings are applied again
only at the next open or ethtool change.
On P5+ chips the Tx completion rings are separate from the Rx ones
even in combined channels, and the Tx settings do take effect. On a
BCM57508 the completion latency of sparse Tx traffic follows
tx-usecs, it's ~20us with tx-usecs 1 and ~220us with tx-usecs 200.
Re-program Tx coalescing of each completion ring after allocating it.
DIM only manages Rx, the static settings always apply to Tx.
Fixes: fe96d717d38e ("bnxt_en: Extend queue stop/start for TX rings")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://patch.msgid.link/20261120034645.364630-2-kuba@kernel.org
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 449aea93d3a9a..6ea04df46b292 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8484,6 +8484,24 @@ static int bnxt_hwrm_set_rx_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi)
return bnxt_hwrm_set_rx_coal(bp, bnapi, req);
}
+/* Program Tx coalescing of the completion ring of a single Tx ring, e.g.
+ * after it was re-allocated in the FW.
+ */
+static int bnxt_hwrm_set_tx_ring_coal(struct bnxt *bp,
+ struct bnxt_tx_ring_info *txr)
+{
+ struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req;
+ int rc;
+
+ rc = hwrm_req_init(bp, req, HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS);
+ if (rc)
+ return rc;
+
+ bnxt_hwrm_set_coal_params(bp, &bp->tx_coal, req);
+ req->ring_id = cpu_to_le16(bnxt_cp_ring_for_tx(bp, txr));
+ return hwrm_req_send(bp, req);
+}
+
static void bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
{
struct hwrm_stat_ctx_clr_stats_input *req0 = NULL;
@@ -11688,6 +11706,11 @@ static int bnxt_tx_queue_start(struct bnxt *bp, int idx)
if (rc)
return rc;
+ rc = bnxt_hwrm_set_tx_ring_coal(bp, txr);
+ if (rc)
+ netdev_warn(bp->dev, "HWRM set coalescing failure rc: %d\n",
+ rc);
+
rc = bnxt_hwrm_tx_ring_alloc(bp, txr, false);
if (rc)
return rc;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 280/703] net: dsa: b53: initialize the jumbo frame size register offset
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (276 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 279/703] eth: bnxt_en: restore Tx " Greg Kroah-Hartman
@ 2026-12-04 10:02 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 281/703] net: dsa: b53: fix the SRAB grant timeout check Greg Kroah-Hartman
` (129 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:02 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonas Gorski, Florian Fainelli,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 5d30a02245c375a9c5e557b1b7476710c4a94a2d ]
The chip data specifies both the jumbo port mask and frame size register
offsets, but b53_switch_init() only copies the former into the device.
Since the device is zero-initialized, b53_set_jumbo() writes the frame
size to offset zero instead of the chip-specific size register at 0x05
or 0x08.
Copy jumbo_size_reg from the chip data along with jumbo_pm_reg so frame
size updates reach the intended register.
Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 137bc55b86d6b..cfb01839c5710 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -3155,6 +3155,7 @@ static int b53_switch_init(struct b53_device *dev)
dev->vta_regs[1] = chip->vta_regs[1];
dev->vta_regs[2] = chip->vta_regs[2];
dev->jumbo_pm_reg = chip->jumbo_pm_reg;
+ dev->jumbo_size_reg = chip->jumbo_size_reg;
dev->imp_port = chip->imp_port;
dev->num_vlans = chip->vlans;
dev->num_arl_bins = chip->arl_bins;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 281/703] net: dsa: b53: fix the SRAB grant timeout check
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (277 preceding siblings ...)
2026-12-04 10:02 ` [PATCH 6.18 280/703] net: dsa: b53: initialize the jumbo frame size register offset Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 282/703] net: dsa: b53: clear stale state when creating an ARL entry Greg Kroah-Hartman
` (128 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonas Gorski, Daniel Machon,
Florian Fainelli, Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit bd7fc60896b3de8ce677142142c96277377e5167 ]
b53_srab_request_grant() polls for a grant up to 20 times, but checks for
an iteration count of five to detect a timeout. This rejects a grant
received on the sixth poll and reports success when all 20 polls finish
without a grant. The latter allows a register access to proceed without
ownership of the switch resources.
Check for exhaustion of all 20 iterations instead.
Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_srab.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c
index b9939bbd2cd51..eafd1dfaaf9d1 100644
--- a/drivers/net/dsa/b53/b53_srab.c
+++ b/drivers/net/dsa/b53/b53_srab.c
@@ -105,7 +105,7 @@ static int b53_srab_request_grant(struct b53_device *dev)
break;
usleep_range(10, 100);
}
- if (WARN_ON(i == 5))
+ if (WARN_ON(i == 20))
return -EIO;
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 282/703] net: dsa: b53: clear stale state when creating an ARL entry
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (278 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 281/703] net: dsa: b53: fix the SRAB grant timeout check Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 283/703] net: dsa: b53: use the correct override register 2 Gbps bit Greg Kroah-Hartman
` (127 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Willem de Bruijn,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit c6f0992ff6c2c138ffb1b64f406a66d42615770b ]
When an ARL lookup does not find the requested MAC and VID, b53_arl_read()
returns the first free bin index but leaves the entry populated with the
last bin examined. The multicast add path then ORs the requested port into
that unrelated entry's forwarding bitmap, potentially forwarding packets
to ports which are not members of the multicast group.
Clear the entry before creating a new one. Also return without writing
anything when deleting an entry which is not present, instead of writing
back stale bin contents. The return value for that case is unchanged (0).
Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index cfb01839c5710..af66b6b1b2b16 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2040,9 +2040,13 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
addr, vid);
return is_valid ? ret : 0;
case -ENOENT:
+ if (!is_valid)
+ return 0;
+
/* We could not find a matching MAC, so reset to a new entry */
dev_dbg(dev->dev, "{%pM,%.4d} not found, using idx: %d\n",
addr, vid, idx);
+ memset(&ent, 0, sizeof(ent));
break;
default:
dev_dbg(dev->dev, "{%pM,%.4d} found, using idx: %d\n",
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 283/703] net: dsa: b53: use the correct override register 2 Gbps bit
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (279 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 282/703] net: dsa: b53: clear stale state when creating an ARL entry Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 284/703] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365 Greg Kroah-Hartman
` (126 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonas Gorski, Florian Fainelli,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit fd2752aac6c2193507af2e96cfc1406b28cade6f ]
The IMP and per-port GMII override registers swap the override-enable and 2
Gbps speed bits. Using the IMP speed bit on a GMII port clears its override
enable and leaves any previous 2 Gbps selection intact. Select the speed
bit alongside the register and enable bit so lower speeds clear the correct
bit and 2 Gbps sets it.
Fixes: b6a8a5477fe9 ("net: dsa: b53: fix resetting speed and pause on forced link")
Fixes: 41af38324341 ("net: dsa: b53: restore the NSP IMP port 2 Gbps mode")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index af66b6b1b2b16..ab27e5d52c88f 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1409,17 +1409,19 @@ static void b53_force_port_config(struct b53_device *dev, int port,
int speed, int duplex,
bool tx_pause, bool rx_pause)
{
- u8 reg, val, off;
+ u8 reg, val, off, speed2000;
/* Override the port settings */
if (port == dev->imp_port) {
off = B53_PORT_OVERRIDE_CTRL;
val = PORT_OVERRIDE_EN;
+ speed2000 = PORT_OVERRIDE_SPEED_2000M;
} else if (is5325(dev)) {
return;
} else {
off = B53_GMII_PORT_OVERRIDE_CTRL(port);
val = GMII_PO_EN;
+ speed2000 = GMII_PO_SPEED_2000M;
}
b53_read8(dev, B53_CTRL_PAGE, off, ®);
@@ -1431,11 +1433,12 @@ static void b53_force_port_config(struct b53_device *dev, int port,
reg &= ~(0x3 << GMII_PO_SPEED_S);
if (is5301x(dev) || is58xx(dev))
- reg &= ~PORT_OVERRIDE_SPEED_2000M;
+ reg &= ~speed2000;
switch (speed) {
case 2000:
- reg |= PORT_OVERRIDE_SPEED_2000M;
+ if (is5301x(dev) || is58xx(dev))
+ reg |= speed2000;
fallthrough;
case SPEED_1000:
reg |= PORT_OVERRIDE_SPEED_1000M;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 284/703] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (280 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 283/703] net: dsa: b53: use the correct override register 2 Gbps bit Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 285/703] net: dsa: b53: fix mirror destination and source state tracking Greg Kroah-Hartman
` (125 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Willem de Bruijn,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 000d468855945953c491810f97fb0bd4166b0b07 ]
BCM5325 and BCM5365 use an 11-bit bitmap for the mirror capture port,
whereas newer switches use a four-bit port ID. Programming the port
number directly can select no destination or the wrong destination, and
can select multiple destinations. For example, port 2 requires BIT(2),
but writing 2 selects port 1 instead.
Use the bitmap encoding on BCM5325 and BCM5365, including translating
logical CPU port 5 to hardware bit 8. Apply the corresponding field mask
when checking for a conflicting destination, replacing the destination,
and clearing it after the last mirror source is removed. Keep the port ID
encoding for newer switches.
The ingress and egress mirror source masks use the same layout on these
switches, with the CPU port at bit 8 and bits 5-7 reserved, so apply the
same translation when setting and clearing a source port bit.
Fixes: ed3af5fd08eb ("net: dsa: b53: Add support for port mirroring")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 35 +++++++++++++++++++++++++++-----
drivers/net/dsa/b53/b53_regs.h | 1 +
2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index ab27e5d52c88f..1298d5ac95d4e 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2586,6 +2586,31 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
}
EXPORT_SYMBOL(b53_get_tag_protocol);
+static u16 b53_mirror_capture_port_mask(struct b53_device *dev)
+{
+ if (is5325(dev) || is5365(dev))
+ return CAP_PORT_MASK_25;
+
+ return CAP_PORT_MASK;
+}
+
+static u16 b53_mirror_port_mask(struct b53_device *dev, int port)
+{
+ /* These switches use a bitmap with the CPU port at bit 8. */
+ if ((is5325(dev) || is5365(dev)) && port == B53_CPU_PORT_25)
+ port = B53_CPU_PORT;
+
+ return BIT(port);
+}
+
+static u16 b53_mirror_capture_port(struct b53_device *dev, int port)
+{
+ if (is5325(dev) || is5365(dev))
+ return b53_mirror_port_mask(dev, port);
+
+ return port;
+}
+
int b53_mirror_add(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
struct netlink_ext_ack *extack)
@@ -2599,12 +2624,12 @@ int b53_mirror_add(struct dsa_switch *ds, int port,
loc = B53_EG_MIR_CTL;
b53_read16(dev, B53_MGMT_PAGE, loc, ®);
- reg |= BIT(port);
+ reg |= b53_mirror_port_mask(dev, port);
b53_write16(dev, B53_MGMT_PAGE, loc, reg);
b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
- reg &= ~CAP_PORT_MASK;
- reg |= mirror->to_local_port;
+ reg &= ~b53_mirror_capture_port_mask(dev);
+ reg |= b53_mirror_capture_port(dev, mirror->to_local_port);
reg |= MIRROR_EN;
b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
@@ -2626,7 +2651,7 @@ void b53_mirror_del(struct dsa_switch *ds, int port,
/* Update the desired ingress/egress register */
b53_read16(dev, B53_MGMT_PAGE, loc, ®);
- reg &= ~BIT(port);
+ reg &= ~b53_mirror_port_mask(dev, port);
if (!(reg & MIRROR_MASK))
loc_disable = true;
b53_write16(dev, B53_MGMT_PAGE, loc, reg);
@@ -2645,7 +2670,7 @@ void b53_mirror_del(struct dsa_switch *ds, int port,
/* Both no longer have ports, let's disable mirroring */
if (loc_disable && other_loc_disable) {
reg &= ~MIRROR_EN;
- reg &= ~mirror->to_local_port;
+ reg &= ~b53_mirror_capture_port_mask(dev);
}
b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
}
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index a9414851ea287..9ddbfa6d02896 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -235,6 +235,7 @@
/* Mirror capture control register (16 bit) */
#define B53_MIR_CAP_CTL 0x10
#define CAP_PORT_MASK 0xf
+#define CAP_PORT_MASK_25 0x7ff
#define BLK_NOT_MIR BIT(14)
#define MIRROR_EN BIT(15)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 285/703] net: dsa: b53: fix mirror destination and source state tracking
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (281 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 284/703] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365 Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 286/703] net: bcmasp: avoid refcount drain on probe Greg Kroah-Hartman
` (124 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Joseph Telaak,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit 320bc9b8e2bc8a5fc75537082529b534ace633e3 ]
The mirror capture control register selects one destination for all
ingress and egress sources. Adding a rule for another destination
currently redirects existing rules. Multiple matchall filters can also
share one source bit, but deleting any one of them clears that bit and
can disable mirroring while other filters still need it.
Reject a different destination while either source mask is occupied, and
reference count each port's ingress and egress source bit under RTNL.
Program a source on its first reference and clear it on its last one.
Check every mirror register access and record a first reference only
after programming succeeds. Select the destination before enabling the
source, and log deletion failures because the callback returns no error.
Use the source masks to retain the destination after a failed source
deletion and allow a new destination after a failed capture-control clear.
Not all supported switches receive a hardware reset during setup, so
clear stale capture and source registers before accepting mirror rules.
Introduce b53_mirror_init() together with its b53 and bcm_sf2 setup
callers. Rebuild active sources and their destination from the reference
counts when setup runs again, preserving rules across bcm_sf2 resume.
Propagate initialization failures instead of accepting stale state.
This depends on "net: dsa: b53: fix mirror port encoding on BCM5325 and
BCM5365" for the chip-specific source and capture-port helpers.
Fixes: ed3af5fd08eb ("net: dsa: b53: Add support for port mirroring")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Joseph Telaak <joseph@telaak.dev>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 168 ++++++++++++++++++++++++-------
drivers/net/dsa/b53/b53_priv.h | 4 +
drivers/net/dsa/bcm_sf2.c | 4 +
3 files changed, 140 insertions(+), 36 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 1298d5ac95d4e..6e2c9e4fd7ff4 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1342,6 +1342,10 @@ static int b53_setup(struct dsa_switch *ds)
return ret;
}
+ ret = b53_mirror_init(ds);
+ if (ret)
+ return ret;
+
/* setup default vlan for filtering mode */
pvid = b53_default_pvid(dev);
vl = &dev->vlans[pvid];
@@ -2611,27 +2615,103 @@ static u16 b53_mirror_capture_port(struct b53_device *dev, int port)
return port;
}
+int b53_mirror_init(struct dsa_switch *ds)
+{
+ struct b53_device *dev = ds->priv;
+ u16 ingress = 0, egress = 0, cap_ctl = 0;
+ unsigned int port;
+ int ret;
+
+ /* A switch reset may leave the previous mirror configuration intact. */
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, 0);
+ if (ret)
+ return ret;
+
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_IG_MIR_CTL, 0);
+ if (ret)
+ return ret;
+
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_EG_MIR_CTL, 0);
+ if (ret)
+ return ret;
+
+ /* DSA retains matchall filters across suspend and resume. */
+ for (port = 0; port < dev->num_ports; port++) {
+ if (dev->ports[port].mirror_count[true])
+ ingress |= b53_mirror_port_mask(dev, port);
+ if (dev->ports[port].mirror_count[false])
+ egress |= b53_mirror_port_mask(dev, port);
+ }
+
+ if (!(ingress | egress))
+ return 0;
+
+ cap_ctl = MIRROR_EN | b53_mirror_capture_port(dev, dev->mirror_port);
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, cap_ctl);
+ if (ret)
+ return ret;
+
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_IG_MIR_CTL, ingress);
+ if (ret)
+ return ret;
+
+ return b53_write16(dev, B53_MGMT_PAGE, B53_EG_MIR_CTL, egress);
+}
+EXPORT_SYMBOL(b53_mirror_init);
+
int b53_mirror_add(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
struct netlink_ext_ack *extack)
{
struct b53_device *dev = ds->priv;
- u16 reg, loc;
+ unsigned int *mirror_count = &dev->ports[port].mirror_count[ingress];
+ u16 reg, other_reg, loc, other_loc, cap_ctl;
+ u16 cap_mask = b53_mirror_capture_port_mask(dev);
+ u16 cap_port = b53_mirror_capture_port(dev, mirror->to_local_port);
+ int ret;
- if (ingress)
- loc = B53_IG_MIR_CTL;
- else
- loc = B53_EG_MIR_CTL;
+ loc = ingress ? B53_IG_MIR_CTL : B53_EG_MIR_CTL;
+ other_loc = ingress ? B53_EG_MIR_CTL : B53_IG_MIR_CTL;
- b53_read16(dev, B53_MGMT_PAGE, loc, ®);
- reg |= b53_mirror_port_mask(dev, port);
- b53_write16(dev, B53_MGMT_PAGE, loc, reg);
+ ret = b53_read16(dev, B53_MGMT_PAGE, loc, ®);
+ if (ret)
+ return ret;
- b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
- reg &= ~b53_mirror_capture_port_mask(dev);
- reg |= b53_mirror_capture_port(dev, mirror->to_local_port);
- reg |= MIRROR_EN;
- b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
+ ret = b53_read16(dev, B53_MGMT_PAGE, other_loc, &other_reg);
+ if (ret)
+ return ret;
+
+ ret = b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, &cap_ctl);
+ if (ret)
+ return ret;
+
+ if (((reg | other_reg) & MIRROR_MASK) &&
+ (cap_ctl & cap_mask) != cap_port) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Only one mirroring destination is supported");
+ return -EOPNOTSUPP;
+ }
+
+ if (*mirror_count) {
+ (*mirror_count)++;
+ return 0;
+ }
+
+ /* Select the destination before enabling the new source. */
+ cap_ctl &= ~cap_mask;
+ cap_ctl |= cap_port;
+ cap_ctl |= MIRROR_EN;
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, cap_ctl);
+ if (ret)
+ return ret;
+
+ ret = b53_write16(dev, B53_MGMT_PAGE, loc,
+ reg | b53_mirror_port_mask(dev, port));
+ if (ret)
+ return ret;
+
+ (*mirror_count)++;
+ dev->mirror_port = mirror->to_local_port;
return 0;
}
@@ -2641,38 +2721,54 @@ void b53_mirror_del(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror)
{
struct b53_device *dev = ds->priv;
- bool loc_disable = false, other_loc_disable = false;
- u16 reg, loc;
+ unsigned int *mirror_count =
+ &dev->ports[port].mirror_count[mirror->ingress];
+ u16 reg, other_reg, loc, other_loc;
+ int ret;
- if (mirror->ingress)
- loc = B53_IG_MIR_CTL;
- else
- loc = B53_EG_MIR_CTL;
+ if (!*mirror_count)
+ return;
+
+ if (--(*mirror_count))
+ return;
+
+ loc = mirror->ingress ? B53_IG_MIR_CTL : B53_EG_MIR_CTL;
+ other_loc = mirror->ingress ? B53_EG_MIR_CTL : B53_IG_MIR_CTL;
/* Update the desired ingress/egress register */
- b53_read16(dev, B53_MGMT_PAGE, loc, ®);
+ ret = b53_read16(dev, B53_MGMT_PAGE, loc, ®);
+ if (ret)
+ goto err;
+
reg &= ~b53_mirror_port_mask(dev, port);
- if (!(reg & MIRROR_MASK))
- loc_disable = true;
- b53_write16(dev, B53_MGMT_PAGE, loc, reg);
+ ret = b53_write16(dev, B53_MGMT_PAGE, loc, reg);
+ if (ret)
+ goto err;
/* Now look at the other one to know if we can disable mirroring
* entirely
*/
- if (mirror->ingress)
- b53_read16(dev, B53_MGMT_PAGE, B53_EG_MIR_CTL, ®);
- else
- b53_read16(dev, B53_MGMT_PAGE, B53_IG_MIR_CTL, ®);
- if (!(reg & MIRROR_MASK))
- other_loc_disable = true;
+ ret = b53_read16(dev, B53_MGMT_PAGE, other_loc, &other_reg);
+ if (ret)
+ goto err;
- b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
- /* Both no longer have ports, let's disable mirroring */
- if (loc_disable && other_loc_disable) {
- reg &= ~MIRROR_EN;
- reg &= ~b53_mirror_capture_port_mask(dev);
- }
- b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
+ if ((reg | other_reg) & MIRROR_MASK)
+ return;
+
+ ret = b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
+ if (ret)
+ goto err;
+
+ reg &= ~(MIRROR_EN | b53_mirror_capture_port_mask(dev));
+ ret = b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
+ if (ret)
+ goto err;
+
+ return;
+
+err:
+ dev_err(dev->dev, "Failed to delete mirror rule for port %d: %d\n",
+ port, ret);
}
EXPORT_SYMBOL(b53_mirror_del);
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index dce06110deb8b..38f433470d860 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -118,6 +118,8 @@ struct b53_pcs {
#define B53_N_PCS 2
struct b53_port {
+ /* References to each egress/ingress mirror source mask bit. */
+ unsigned int mirror_count[2];
u16 vlan_ctl_mask;
u16 pvid;
struct ethtool_keee eee;
@@ -169,6 +171,7 @@ struct b53_device {
/* run time configuration */
bool enable_jumbo;
+ unsigned int mirror_port;
unsigned int num_vlans;
struct b53_vlan *vlans;
@@ -531,6 +534,7 @@ int b53_mdb_add(struct dsa_switch *ds, int port,
int b53_mdb_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
struct dsa_db db);
+int b53_mirror_init(struct dsa_switch *ds);
int b53_mirror_add(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
struct netlink_ext_ack *extack);
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index f3b56ea87b07b..babf5b142ad85 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1061,6 +1061,10 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
unsigned int port;
int ret;
+ ret = b53_mirror_init(ds);
+ if (ret)
+ return ret;
+
/* Enable all valid ports and disable those unused */
for (port = 0; port < priv->hw_params.num_ports; port++) {
/* IMP port receives special treatment */
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 286/703] net: bcmasp: avoid refcount drain on probe
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (282 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 285/703] net: dsa: b53: fix mirror destination and source state tracking Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 287/703] net: bcmgenet: keep DIM from getting stuck after close or suspend Greg Kroah-Hartman
` (123 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wang Haoran, Willem de Bruijn,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Haoran <wanghr2026@mail.zgclab.edu.cn>
[ Upstream commit 846a6d0982be30aaba5268aac14a0c557d70cc23 ]
bcmasp_probe() calls of_find_node_by_name(dev->of_node, "ethernet-ports"),
which unconditionally drops the from-node reference the caller never held.
Every probe or bind cycle that reaches the port scan, including ones that
later fail with "No ports found", drains the asp node refcount by one. Once
it hits zero, of_node_release() deadlocks in its error printk (%pOF on the
parent while holding devtree_lock with IRQs off), so the machine freezes
silently with nothing on the console.
Use of_get_child_by_name() which leaves the parent reference alone.
Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Signed-off-by: Wang Haoran <wanghr2026@mail.zgclab.edu.cn>
Link: https://patch.msgid.link/1795076102979-9-385853cc@mail.zgclab.edu.cn
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/asp2/bcmasp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 42f35a47bfa06..8bc929e065618 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1347,7 +1347,7 @@ static int bcmasp_probe(struct platform_device *pdev)
bcmasp_init_wol(priv);
- ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
+ ports_node = of_get_child_by_name(dev->of_node, "ethernet-ports");
if (!ports_node) {
dev_warn(dev, "No ports found\n");
ret = -EINVAL;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 287/703] net: bcmgenet: keep DIM from getting stuck after close or suspend
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (283 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 286/703] net: bcmasp: avoid refcount drain on probe Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 288/703] net: bcmgenet: accumulate the DIM packet and byte counters Greg Kroah-Hartman
` (122 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Florian Fainelli,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit aa5a537ec43c13e4d2850468b0d88f97cce45dd3 ]
A close or WoL suspend cancels the pending profile work and can leave
DIM in DIM_APPLY_NEW_PROFILE, where net_dim() does nothing. Adaptive
coalescing then stays stuck after the next open or resume, and the
profile index no longer matches the hardware. The poll also calls
net_dim() after napi_complete_done(), so it can queue new work after
napi_disable() has returned.
Run net_dim() before completing NAPI and flush the work instead of
cancelling it, so the pending profile gets applied. Also reset the DIM
state on ring init and start from the default profile, which is what
bcmgenet_init_rx_coalesce() programs.
Fixes: 9f4ca05827a2 ("net: bcmgenet: Add support for adaptive RX coalescing")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index bc7200f70cf31..52b5e8daf9276 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2503,15 +2503,16 @@ static int bcmgenet_rx_poll(struct napi_struct *napi, int budget)
work_done = bcmgenet_desc_rx(ring, budget);
- if (work_done < budget && napi_complete_done(napi, work_done))
- bcmgenet_rx_ring_int_enable(ring);
-
+ /* net_dim() can queue work, so run it while NAPI is still owned */
if (ring->dim.use_dim) {
dim_update_sample(ring->dim.event_ctr, ring->dim.packets,
ring->dim.bytes, &dim_sample);
net_dim(&ring->dim.dim, &dim_sample);
}
+ if (work_done < budget && napi_complete_done(napi, work_done))
+ bcmgenet_rx_ring_int_enable(ring);
+
return work_done;
}
@@ -2703,8 +2704,11 @@ static void bcmgenet_init_dim(struct bcmgenet_rx_ring *ring,
{
struct bcmgenet_net_dim *dim = &ring->dim;
+ memset(&dim->dim, 0, sizeof(dim->dim));
INIT_WORK(&dim->dim.work, cb);
dim->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ /* Match the profile bcmgenet_init_rx_coalesce() programs */
+ dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
dim->event_ctr = 0;
dim->packets = 0;
dim->bytes = 0;
@@ -3015,7 +3019,8 @@ static void bcmgenet_disable_rx_napi(struct bcmgenet_priv *priv)
for (i = 0; i <= priv->hw_params->rx_queues; ++i) {
ring = &priv->rx_rings[i];
napi_disable(&ring->napi);
- cancel_work_sync(&ring->dim.dim.work);
+ /* Cancelling would leave DIM stuck in DIM_APPLY_NEW_PROFILE */
+ flush_work(&ring->dim.dim.work);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 288/703] net: bcmgenet: accumulate the DIM packet and byte counters
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (284 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 287/703] net: bcmgenet: keep DIM from getting stuck after close or suspend Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 289/703] net: bcmgenet: reset the Rx discard count with the ring Greg Kroah-Hartman
` (121 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Nicolai Buchwitz,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit a15079369636f4324d2985cede7ce7fbefddf4b3 ]
net_dim() computes rates from the difference between two samples and
needs running totals, but bcmgenet_desc_rx() passes the counts of the
last poll. Adaptive coalescing then picks profiles from wrong rates.
On a CM4 at a steady 300 Mbit/s UDP, DIM changed profile about 1000
times in 20 s. With the fix it settles, and Rx interrupts drop from about
4500/s to 2240/s.
Accumulate the counters instead.
Fixes: 9f4ca05827a2 ("net: bcmgenet: Add support for adaptive RX coalescing")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 52b5e8daf9276..ec40f373cea07 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2487,8 +2487,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
bcmgenet_rdma_ring_writel(priv, ring->index, ring->c_index, RDMA_CONS_INDEX);
}
- ring->dim.bytes = bytes_processed;
- ring->dim.packets = rxpktprocessed;
+ ring->dim.bytes += bytes_processed;
+ ring->dim.packets += rxpktprocessed;
return rxpktprocessed;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 289/703] net: bcmgenet: reset the Rx discard count with the ring
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (285 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 288/703] net: bcmgenet: accumulate the DIM packet and byte counters Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 290/703] net: systemport: restart DIM from the default profile on start Greg Kroah-Hartman
` (120 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Nicolai Buchwitz,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit e99faa3a16209ea5d0b83cc58b64785efd2d9045 ]
Ring init clears the hardware discard counter but not
ring->old_discards. Discards after an ifdown and ifup or a resume are
then missing from rx_missed. On a CM4, after an ifdown and ifup, 3666
discards showed up as 0 in rx_missed.
Reset old_discards together with the ring.
Fixes: d26ea6cc48da ("net: bcmgenet: collect Rx discarded packet count")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index ec40f373cea07..245c7878c5f22 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2827,6 +2827,8 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv,
ring->read_ptr = start_ptr;
ring->cb_ptr = start_ptr;
ring->end_ptr = end_ptr - 1;
+ /* Zeroing RDMA_PROD_INDEX below also clears the discard counter */
+ ring->old_discards = 0;
ret = bcmgenet_rx_ring_create_pool(priv, ring);
if (ret)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 290/703] net: systemport: restart DIM from the default profile on start
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (286 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 289/703] net: bcmgenet: reset the Rx discard count with the ring Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 291/703] net: systemport: accumulate the DIM packet and byte counters Greg Kroah-Hartman
` (119 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Willem de Bruijn,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit 8e428e263fa4fd3a752db8d9e1e584307f446aae ]
A close or suspend can cancel the pending profile work and leave DIM in
DIM_APPLY_NEW_PROFILE, where net_dim() does nothing. Adaptive coalescing
then stays stuck after the next open or resume. The poll also calls
net_dim() after napi_complete_done(), so it can queue new work after
napi_disable() has returned.
Run net_dim() before completing NAPI. Reset the DIM state on start and
begin from the default profile, which is what
bcm_sysport_init_rx_coalesce() programs.
Fixes: b6e0e875421e ("net: systemport: Implement adaptive interrupt coalescing")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index ff2512b2fe7b7..0119d360d4148 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1012,18 +1012,19 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget)
else
rdma_writel(priv, priv->rx_c_index << 16, RDMA_CONS_INDEX);
- if (work_done < budget) {
- napi_complete_done(napi, work_done);
- /* re-enable RX interrupts */
- intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE);
- }
-
+ /* net_dim() can queue work, so run it while NAPI is still owned */
if (priv->dim.use_dim) {
dim_update_sample(priv->dim.event_ctr, priv->dim.packets,
priv->dim.bytes, &dim_sample);
net_dim(&priv->dim.dim, &dim_sample);
}
+ if (work_done < budget) {
+ napi_complete_done(napi, work_done);
+ /* re-enable RX interrupts */
+ intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE);
+ }
+
return work_done;
}
@@ -1452,8 +1453,11 @@ static void bcm_sysport_init_dim(struct bcm_sysport_priv *priv,
{
struct bcm_sysport_net_dim *dim = &priv->dim;
+ memset(&dim->dim, 0, sizeof(dim->dim));
INIT_WORK(&dim->dim.work, cb);
dim->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
+ /* Match the profile bcm_sysport_init_rx_coalesce() programs */
+ dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
dim->event_ctr = 0;
dim->packets = 0;
dim->bytes = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 291/703] net: systemport: accumulate the DIM packet and byte counters
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (287 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 290/703] net: systemport: restart DIM from the default profile on start Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 292/703] ipv4: fix conntrack defrag forwarding after ip_frag_reinit() Greg Kroah-Hartman
` (118 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Nicolai Buchwitz,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Buchwitz <nb@tipi-net.de>
[ Upstream commit 3e7e20beef4ec04f7601e92e78608333f2ab3904 ]
net_dim() computes rates from the difference between two samples and
needs running totals, but bcm_sysport_desc_rx() passes the counts of the
last poll. Adaptive coalescing then picks profiles from wrong rates.
Accumulate the counters instead.
Fixes: b6e0e875421e ("net: systemport: Implement adaptive interrupt coalescing")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 0119d360d4148..5b4e1e3853f37 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -844,8 +844,8 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
priv->rx_read_ptr = 0;
}
- priv->dim.packets = processed;
- priv->dim.bytes = processed_bytes;
+ priv->dim.packets += processed;
+ priv->dim.bytes += processed_bytes;
return processed;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 292/703] ipv4: fix conntrack defrag forwarding after ip_frag_reinit()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (288 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 291/703] net: systemport: accumulate the DIM packet and byte counters Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 293/703] tun: bound the NAPI receive queue Greg Kroah-Hartman
` (117 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Jiayuan Chen,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <jiayuan.chen@linux.dev>
[ Upstream commit 3ab5aae0eb60079d17378af5aab0db84ba946e0e ]
q.max_size and max_df_size are used by ip_frag_reasm() to set
IPCB(skb)->frag_max_size and the DF bit of the reassembled packet.
ip_frag_reinit() reuses the queue for a new datagram but does not
reset them, so the new datagram inherits them from the old one.
On a router with conntrack defrag, if the largest fragment of the old
datagram had DF set and was larger than the egress MTU, a new datagram
without DF gets DF set after reassembly and is rejected with
ICMP_FRAG_NEEDED, even though all its fragments fit.
Reset both fields.
Fixes: 5f2d04f1f9b5 ("ipv4: fix path MTU discovery with connection tracking")
Fixes: d6b915e29f4a ("ip_fragment: don't forward defragmented DF packet")
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261120094700.46500-1-jiayuan.chen@linux.dev
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/ip_fragment.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index ef7fd61284a3f..0688be8142c4b 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -250,6 +250,8 @@ static int ip_frag_reinit(struct ipq *qp)
qp->q.flags = 0;
qp->q.len = 0;
qp->q.meat = 0;
+ qp->q.max_size = 0;
+ qp->max_df_size = 0;
qp->iif = 0;
qp->ecn = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 293/703] tun: bound the NAPI receive queue
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (289 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 292/703] ipv4: fix conntrack defrag forwarding after ip_frag_reinit() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 294/703] bpf: net_sched: Defer bpf_kfree_skb() to irq_work with irqs off Greg Kroah-Hartman
` (116 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Antonio Quartulli, Willem de Bruijn,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <antonio@mandelbit.com>
[ Upstream commit cc7fe6e741730fef549e484379281736d32746f0 ]
With IFF_NAPI, tun_get_user() queues every written packet for NAPI on
an unbounded list. When the poll runs asynchronously (threaded NAPI or
ksoftirqd) and is slower than the writer, the queue grows until the
system runs out of memory. An unprivileged user can do this from its own
user and network namespaces, and the queued skbs are not charged to its
memcg: in a test VM, a uid 1000 process limited to 128 MB caused a
global OOM in ~6 seconds. The socket send buffer does not help: tun sets
it to INT_MAX by default, the build_skb() path is only used while it is
INT_MAX, and the XDP batch path never checks it.
Drop packets once more than netdev_max_backlog of them are queued, like
enqueue_to_backlog() does, and count them as rx_dropped; the write still
reports success, as for a full backlog. The check sits where packets are
queued for NAPI, in tun_get_user() and in tun_xdp_one() for the batches
vhost-net passes, so packets consumed by XDP or delivered through
IFF_NAPI_FRAGS are not affected. A dropped zerocopy skb completes its
buffer when freed. The check is lockless, so concurrent writers can each
still add one packet.
The NAPI poll moved the whole queue out, processed up to its budget and
put the rest back: while it ran, the queue looked empty to writers, so
with the poll on another CPU the backlog could still grow without limit.
Take at most budget packets instead: the rest stays on the queue writers
check.
Dropping also schedules NAPI. vhost-net sends with MSG_MORE while it has
more packets, and tun_get_user() schedules NAPI only for a packet
without it or once more than NAPI_POLL_WEIGHT are queued. With a
netdev_max_backlog below that, the queue fills first and the packet
without MSG_MORE is dropped too: nothing would schedule NAPI, and the
queued packets, with zerocopy also their buffers, would wait forever.
Reproducer, as an unprivileged user in a new user and network
namespace, without kernel modifications or fault injection:
ip tuntap add t0 mode tun; ip addr add 10.11.0.1/24 dev t0
ip link add d0 type dummy; ip addr add 10.20.0.1/24 dev d0
ip link set t0 up; ip link set d0 up; sysctl net.ipv4.ip_forward=1
install ~500 iptables FORWARD rules, to slow down the poll, and a
MASQUERADE rule on d0
open t0 with IFF_TUN | IFF_NO_PI | IFF_NAPI
echo 1 > /sys/class/net/t0/threaded
write() 1400-byte IPv4 packets for 10.20.0.2 in a loop
Found by code inspection while analysing the performance of the tun
write path. Tested in an x86-64 VM on net, with 1 and 2 vCPUs: the
reproducer causes a global OOM without the patch, while with it memory
use stays flat and the forwarding rate is unchanged; the tun kselftest
passes; a local vhost-net test of the batch, copy and zerocopy paths
with netdev_max_backlog set to 8 passes, and fails without the patch;
an XDP program on the device sees every packet while the excess is
dropped.
Still open: neither the packet size nor the queued memory is bounded,
and the skbs are not charged to the writer's memcg. A single write can
create an skb of several hundred KB, so even one queue can hold a lot,
and IFF_MULTI_QUEUE (allowed in a user namespace) and more devices
multiply it. This bounds the queue as enqueue_to_backlog() bounds the
per-CPU backlog; charging the skbs to the writer is left to a follow-up.
Fixes: 943170998b20 ("tun: enable NAPI for TUN/TAP driver")
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261119153056.353156-1-antonio@mandelbit.com
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 52 +++++++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 8 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 4419f7d1f50b7..fa038ecbebf42 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -58,6 +58,7 @@
#include <linux/nsproxy.h>
#include <linux/virtio_net.h>
#include <linux/rcupdate.h>
+#include <net/hotdata.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/rtnetlink.h>
@@ -224,6 +225,16 @@ struct veth {
static void tun_flow_init(struct tun_struct *tun);
static void tun_flow_uninit(struct tun_struct *tun);
+/* In IFF_NAPI mode written packets wait in the tfile's sk_write_queue for the
+ * NAPI poll, which may run later in a kthread or ksoftirqd. Bound that queue
+ * like the per-CPU backlog.
+ */
+static bool tun_napi_queue_full(const struct sk_buff_head *queue)
+{
+ return skb_queue_len_lockless(queue) >
+ READ_ONCE(net_hotdata.max_backlog);
+}
+
static int tun_napi_receive(struct napi_struct *napi, int budget)
{
struct tun_file *tfile = container_of(napi, struct tun_file, napi);
@@ -234,21 +245,22 @@ static int tun_napi_receive(struct napi_struct *napi, int budget)
__skb_queue_head_init(&process_queue);
+ /* At most budget skbs: the rest stays on the queue writers check */
spin_lock(&queue->lock);
- skb_queue_splice_tail_init(queue, &process_queue);
+ if (skb_queue_len(queue) <= budget) {
+ skb_queue_splice_tail_init(queue, &process_queue);
+ } else {
+ while (skb_queue_len(&process_queue) < budget &&
+ (skb = __skb_dequeue(queue)))
+ __skb_queue_tail(&process_queue, skb);
+ }
spin_unlock(&queue->lock);
- while (received < budget && (skb = __skb_dequeue(&process_queue))) {
+ while ((skb = __skb_dequeue(&process_queue))) {
napi_gro_receive(napi, skb);
++received;
}
- if (!skb_queue_empty(&process_queue)) {
- spin_lock(&queue->lock);
- skb_queue_splice(&process_queue, queue);
- spin_unlock(&queue->lock);
- }
-
return received;
}
@@ -1968,6 +1980,19 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
struct sk_buff_head *queue = &tfile->sk.sk_write_queue;
int queue_len;
+ /* Queue full: drop, and schedule NAPI, which a MSG_MORE sender
+ * may not have done yet. Lockless: concurrent writers can each
+ * still add one.
+ */
+ if (unlikely(tun_napi_queue_full(queue))) {
+ local_bh_disable();
+ napi_schedule(&tfile->napi);
+ local_bh_enable();
+ rcu_read_unlock();
+ drop_reason = SKB_DROP_REASON_FULL_RING;
+ goto drop;
+ }
+
spin_lock_bh(&queue->lock);
if (unlikely(tfile->detached)) {
@@ -2530,6 +2555,17 @@ static int tun_xdp_one(struct tun_struct *tun,
if (tfile->napi_enabled) {
queue = &tfile->sk.sk_write_queue;
+
+ /* Queue full: drop, and schedule NAPI so that it drains even if
+ * nothing in this batch gets queued.
+ */
+ if (unlikely(tun_napi_queue_full(queue))) {
+ napi_schedule(&tfile->napi);
+ kfree_skb_reason(skb, SKB_DROP_REASON_FULL_RING);
+ dev_core_stats_rx_dropped_inc(tun->dev);
+ return 0;
+ }
+
spin_lock(&queue->lock);
if (unlikely(tfile->detached)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 294/703] bpf: net_sched: Defer bpf_kfree_skb() to irq_work with irqs off
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (290 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 293/703] tun: bound the NAPI receive queue Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 295/703] bpf: clear list node owner and unlink before drop Greg Kroah-Hartman
` (115 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov,
Kumar Kartikeya Dwivedi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 73f17a98ea707b505b75c45f1ad7535f8d060195 ]
bpf_kfree_skb() is also the destructor of an skb kptr. A destructor runs
wherever an object or a map value with such a field is freed. That can be
with irqs off, for example:
- bpf_list_add() drops the new node when @prev is not in the list, while
the program holds the bpf_spin_lock of the list, which keeps irqs off.
The drop frees a node that has no other reference, with its fields.
- bpf_local_storage_map_free() frees the fields of each value under the
lock of its bucket, which bpf_selem_unlink_nofail() takes with
raw_res_spin_lock_irqsave(). A qdisc program can keep an skb in task
storage.
The rq lock can be held as well. A program that shares a list with the
qdisc program gets there:
prog drops the node with
---------------------- ----------------------------------------
sched_ext ops.dispatch bpf_obj_drop()
tp_btf/sched_switch bpf_list_add(), @prev is not in the list
The check from commit 94c8d1c21be4 ("bpf: Reject bpf_obj_drop() from
tracing progs") catches neither.
Currently bpf_kfree_skb() calls kfree_skb(), which is not made for that.
The destructor of the skb may enable softirqs, take a lock that sleeps on
PREEMPT_RT, or wake a task. sock_wfree() wakes the task that waits for
the socket to become writable, and under the rq lock that deadlocks:
__schedule() holds rq lock, irqs are off
bpf_kfree_skb_dtor(skb)
kfree_skb(skb)
sock_wfree(skb) a task polls the socket for write
__wake_up_common_lock()
try_to_wake_up() the task belongs on this cpu
rq_lock(rq) <- same rq
dev_kfree_skb_any() does not solve it. With irqs off it leaves the skb to
NET_TX_SOFTIRQ, and raising a softirq outside of an interrupt wakes
ksoftirqd:
__schedule() holds rq lock, irqs are off
bpf_kfree_skb_dtor(skb)
dev_kfree_skb_irq_reason(skb)
raise_softirq_irqoff() in_interrupt() == 0
wake_up_process(ksoftirqd)
ttwu_queue() cpu == this_cpu
rq_lock(rq) <- same rq
With irqs on it is kfree_skb(), which on PREEMPT_RT must not run with
preemption off either, as after bpf_preempt_disable():
bpf_kfree_skb(skb) preempt_count() == 1
sock_wfree(skb) a writer sleeps in sk_wq
__wake_up_common_lock()
spin_lock_irqsave(&wq_head->lock)
Free the skb from an irq_work in these contexts, like
bpf_async_refcount_put() does: with irqs off, and on PREEMPT_RT whenever
the caller is not preemptible. The skb waits on a lock-less list, linked
through skb->ll_node. A shared skb only loses the reference of the caller:
as in dev_kfree_skb_irq_reason(), the last reference is the one that may
link the skb.
The irq_work frees the list with dev_kfree_skb_any(). Without PREEMPT_RT
it runs in hard irq context, where dev_kfree_skb_any() leaves the skb to
NET_TX_SOFTIRQ and wakes nobody. With PREEMPT_RT it runs in the irq_work
thread, where dev_kfree_skb_any() is kfree_skb() and may sleep.
Everywhere else bpf_kfree_skb() remains kfree_skb(). Qdisc_ops::enqueue
and Qdisc_ops::dequeue run with irqs on, so a qdisc pays for the test of
the irq flag and no more. NET_SCH_BPF cannot be a module, so no exit path
has to wait for the irq_work.
Fixes: 870c28588afa ("bpf: net_sched: Add basic bpf qdisc kfuncs")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://patch.msgid.link/7a28c63f6b3d61442dbee1950f9a76d278a0f5be.1795550039.git.memxor@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sched/bpf_qdisc.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/net/sched/bpf_qdisc.c b/net/sched/bpf_qdisc.c
index e9bea9890777d..71a230c6fbc36 100644
--- a/net/sched/bpf_qdisc.c
+++ b/net/sched/bpf_qdisc.c
@@ -5,6 +5,7 @@
#include <linux/bpf.h>
#include <linux/btf.h>
#include <linux/filter.h>
+#include <linux/irq_work.h>
#include <net/pkt_sched.h>
#include <net/pkt_cls.h>
@@ -184,6 +185,19 @@ static int bpf_qdisc_gen_epilogue(struct bpf_insn *insn_buf, const struct bpf_pr
return insn - insn_buf;
}
+static LLIST_HEAD(bpf_skb_free_list);
+
+static void bpf_skb_free_irq_work(struct irq_work *work)
+{
+ struct llist_node *list = llist_del_all(&bpf_skb_free_list);
+ struct sk_buff *skb, *next;
+
+ llist_for_each_entry_safe(skb, next, list, ll_node)
+ dev_kfree_skb_any(skb);
+}
+
+static DEFINE_IRQ_WORK(bpf_skb_free_work, bpf_skb_free_irq_work);
+
__bpf_kfunc_start_defs();
/* bpf_skb_get_hash - Get the flow hash of an skb.
@@ -196,9 +210,22 @@ __bpf_kfunc u32 bpf_skb_get_hash(struct sk_buff *skb)
/* bpf_kfree_skb - Release an skb's reference and drop it immediately.
* @skb: The skb whose reference to be released and dropped.
+ *
+ * Also the destructor of an skb kptr, which runs wherever an object or a map
+ * value with such a field is freed: under a bpf_spin_lock too, with irqs off.
+ * rq lock can be held as well, so don't wake up ksoftirqd from here.
*/
__bpf_kfunc void bpf_kfree_skb(struct sk_buff *skb)
{
+ if (irqs_disabled() ||
+ (IS_ENABLED(CONFIG_PREEMPT_RT) && !preemptible())) {
+ /* Only the last reference may link the skb. */
+ if (refcount_dec_not_one(&skb->users))
+ return;
+ llist_add(&skb->ll_node, &bpf_skb_free_list);
+ irq_work_queue(&bpf_skb_free_work);
+ return;
+ }
kfree_skb(skb);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 295/703] bpf: clear list node owner and unlink before drop
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (291 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 294/703] bpf: net_sched: Defer bpf_kfree_skb() to irq_work with irqs off Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 296/703] bpf: Save irq flags on the stack when freeing a list head or rb root Greg Kroah-Hartman
` (114 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kaitao Cheng, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaitao Cheng <chengkaitao@kylinos.cn>
[ Upstream commit cfa6afa4b931aed08288454943e5077f114fd7f3 ]
The issue only becomes exposed once bpf_list_del() is available: callers
can pass an arbitrary bpf_list_head and bpf_list_node pair, including
nodes that are not actually linked to the supplied head, or nodes that
outlive their original head after refcount-based retention. This was
not practically reachable for callers restricted to pop-style helpers
alone; bpf_list_del() widens the API surface.
A failure mode appears when bpf_list_head_free() runs while a program
still holds an independent refcount on a node (for example via
bpf_refcount_acquire()). The list head value embedded in map memory can
go away while the node object survives. If node->owner is left pointing
at the old head address until drop completes, that pointer becomes stale.
If a new bpf_list_head is later allocated at the same address and the
stale node is passed to bpf_list_del(), the owner comparison can succeed
even though the node is not really linked to the new head, and
list_del_init() will follow bogus next/prev pointers with the risk of
memory corruption.
When draining a bpf_list_head, mark each node owner with BPF_PTR_POISON
under the map spinlock while moving it to a private drain list, then
list_del_init() the node and clear owner to NULL before calling
__bpf_obj_drop_impl(). Concurrent readers therefore never observe a
node that appears linked to a head while its list_head is inconsistent,
and surviving refcounted nodes never retain a stale non-NULL owner.
Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
Link: https://lore.kernel.org/r/20260521032306.97118-3-kaitao.cheng@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 81c6c8c608b6 ("bpf: Save irq flags on the stack when freeing a list head or rb root")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/helpers.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 5271bc5178ea3..6b52c7f87efd2 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -2127,10 +2127,11 @@ EXPORT_SYMBOL_GPL(bpf_base_func_proto);
void bpf_list_head_free(const struct btf_field *field, void *list_head,
struct bpf_spin_lock *spin_lock)
{
- struct list_head *head = list_head, *orig_head = list_head;
+ struct list_head *head = list_head, drain, *pos, *n;
BUILD_BUG_ON(sizeof(struct list_head) > sizeof(struct bpf_list_head));
BUILD_BUG_ON(__alignof__(struct list_head) > __alignof__(struct bpf_list_head));
+ INIT_LIST_HEAD(&drain);
/* Do the actual list draining outside the lock to not hold the lock for
* too long, and also prevent deadlocks if tracing programs end up
@@ -2141,20 +2142,30 @@ void bpf_list_head_free(const struct btf_field *field, void *list_head,
__bpf_spin_lock_irqsave(spin_lock);
if (!head->next || list_empty(head))
goto unlock;
- head = head->next;
+ list_for_each_safe(pos, n, head) {
+ struct bpf_list_node_kern *node;
+
+ node = container_of(pos, struct bpf_list_node_kern, list_head);
+ WRITE_ONCE(node->owner, BPF_PTR_POISON);
+ list_move_tail(pos, &drain);
+ }
unlock:
- INIT_LIST_HEAD(orig_head);
+ INIT_LIST_HEAD(head);
__bpf_spin_unlock_irqrestore(spin_lock);
- while (head != orig_head) {
- void *obj = head;
+ while (!list_empty(&drain)) {
+ struct bpf_list_node_kern *node;
- obj -= field->graph_root.node_offset;
- head = head->next;
+ pos = drain.next;
+ node = container_of(pos, struct bpf_list_node_kern, list_head);
+ list_del_init(pos);
+ /* Ensure __bpf_list_add() sees the node as unlinked. */
+ smp_store_release(&node->owner, NULL);
/* The contained type can also have resources, including a
* bpf_list_head which needs to be freed.
*/
- __bpf_obj_drop_impl(obj, field->graph_root.value_rec, false);
+ __bpf_obj_drop_impl((char *)pos - field->graph_root.node_offset,
+ field->graph_root.value_rec, false);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 296/703] bpf: Save irq flags on the stack when freeing a list head or rb root
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (292 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 295/703] bpf: clear list node owner and unlink before drop Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 297/703] gpiolib: fix inverted trace values in gpiod_get_array_value() Greg Kroah-Hartman
` (113 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov,
Kumar Kartikeya Dwivedi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 81c6c8c608b6075846d3bd5b6f57958300a56eda ]
bpf_spin_lock() saves the irq flags in the per-cpu variable irqsave_flags,
and bpf_spin_unlock() restores them from there. One word per cpu is enough
as long as a cpu takes no second bpf_spin_lock before it releases the
first.
bpf_list_head_free() and bpf_rb_root_free() take a second one. They lock
the list or the tree that they free with __bpf_spin_lock_irqsave(), and
they can run while a program holds a bpf_spin_lock of its own.
bpf_list_add(), bpf_list_push_front(), bpf_list_push_back() and
bpf_rbtree_add() drop the node when they fail. The drop frees a node that
has no other reference, with its fields, and the node can have a list or a
tree itself, like struct foo of the selftests' linked_list.h:
bpf_spin_lock(&glock) irqsave_flags = on
bpf_list_add(&ghead, foo, prev) prev is not in the list
bpf_list_head_free(&foo->head)
__bpf_spin_lock_irqsave() irqsave_flags = off
bpf_spin_unlock(&glock) restores off
The program returns with irqs off.
Keep the flags of the two functions in a local variable, and take the lock
with __bpf_spin_lock(). Both functions unlock before they drop the nodes,
so nothing else runs between the save and the restore.
A failed add drops the node since the commit below. Until bpf_list_add()
existed, an add failed only for a node that a list or a tree still owned,
with a reference of its own, so the drop freed the node only in a race
with the release of that reference. bpf_list_add() fails for any node when
@prev is not in the list.
Fixes: d2dcc67df910 ("bpf: Migrate bpf_rbtree_add and bpf_list_push_{front,back} to possibly fail")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://patch.msgid.link/178849392dfb8ddf82d7ba4259be6113349bdc2e.1795550092.git.memxor@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/helpers.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 6b52c7f87efd2..9057efcf73d01 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -2128,6 +2128,7 @@ void bpf_list_head_free(const struct btf_field *field, void *list_head,
struct bpf_spin_lock *spin_lock)
{
struct list_head *head = list_head, drain, *pos, *n;
+ unsigned long flags;
BUILD_BUG_ON(sizeof(struct list_head) > sizeof(struct bpf_list_head));
BUILD_BUG_ON(__alignof__(struct list_head) > __alignof__(struct bpf_list_head));
@@ -2139,7 +2140,8 @@ void bpf_list_head_free(const struct btf_field *field, void *list_head,
* section, and end up doing map ops that call bpf_list_head_free for
* the same map value again.
*/
- __bpf_spin_lock_irqsave(spin_lock);
+ local_irq_save(flags);
+ __bpf_spin_lock(spin_lock);
if (!head->next || list_empty(head))
goto unlock;
list_for_each_safe(pos, n, head) {
@@ -2151,7 +2153,8 @@ void bpf_list_head_free(const struct btf_field *field, void *list_head,
}
unlock:
INIT_LIST_HEAD(head);
- __bpf_spin_unlock_irqrestore(spin_lock);
+ __bpf_spin_unlock(spin_lock);
+ local_irq_restore(flags);
while (!list_empty(&drain)) {
struct bpf_list_node_kern *node;
@@ -2188,19 +2191,22 @@ void bpf_rb_root_free(const struct btf_field *field, void *rb_root,
struct rb_root_cached orig_root, *root = rb_root;
struct bpf_rb_node_kern *node;
struct rb_node *pos, *n;
+ unsigned long flags;
void *obj;
BUILD_BUG_ON(sizeof(struct rb_root_cached) > sizeof(struct bpf_rb_root));
BUILD_BUG_ON(__alignof__(struct rb_root_cached) > __alignof__(struct bpf_rb_root));
- __bpf_spin_lock_irqsave(spin_lock);
+ local_irq_save(flags);
+ __bpf_spin_lock(spin_lock);
orig_root = *root;
bpf_rbtree_postorder_for_each_entry_safe(pos, n, &orig_root.rb_root) {
node = rb_entry(pos, struct bpf_rb_node_kern, rb_node);
WRITE_ONCE(node->owner, BPF_PTR_POISON);
}
*root = RB_ROOT_CACHED;
- __bpf_spin_unlock_irqrestore(spin_lock);
+ __bpf_spin_unlock(spin_lock);
+ local_irq_restore(flags);
bpf_rbtree_postorder_for_each_entry_safe(pos, n, &orig_root.rb_root) {
obj = pos;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 297/703] gpiolib: fix inverted trace values in gpiod_get_array_value()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (293 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 296/703] bpf: Save irq flags on the stack when freeing a list head or rb root Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 298/703] net: dsa: felix: fix NULL pointer dereference in felix_port_enable() Greg Kroah-Hartman
` (112 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jan Schär, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Schär <jan@jschaer.ch>
[ Upstream commit 601acadb79b62ee52edbd29ec69d8f677dc32dcd ]
Almost all trace_gpio_value() calls report the raw value.
gpiod_get_array_value_complex() is the only exception; it reports
the logical value in traces unless the caller requests raw values.
This inconsistency makes GPIO traces confusing.
Move the trace call earlier, where the value is still raw.
Now, all GPIO traces consistently report raw values.
Fixes: eec1d566cdf9 ("gpio: Introduce ->get_multiple callback")
Signed-off-by: Jan Schär <jan@jschaer.ch>
Link: https://patch.msgid.link/20261120130208.89621-1-jan@jschaer.ch
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index e126218751eb2..00c309cf83221 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3458,10 +3458,10 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep,
int hwgpio = gpiod_hwgpio(desc);
int value = test_bit(hwgpio, bits);
+ trace_gpio_value(desc_to_gpio(desc), 1, value);
if (!raw && test_bit(GPIOD_FLAG_ACTIVE_LOW, &desc->flags))
value = !value;
__assign_bit(j, value_bitmap, value);
- trace_gpio_value(desc_to_gpio(desc), 1, value);
j++;
if (array_info)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 298/703] net: dsa: felix: fix NULL pointer dereference in felix_port_enable()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (294 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 297/703] gpiolib: fix inverted trace values in gpiod_get_array_value() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 299/703] ipv6: mcast: do not pass uninitialized bytes to dev_mc_add() Greg Kroah-Hartman
` (111 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aristo Chen, Vladimir Oltean,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aristo Chen <aristo.chen@canonical.com>
[ Upstream commit 469b61e4be88bc671dabe802e11f706b1ea7aa15 ]
DSA registers the user ports in dsa_tree_setup_ports() before it sets
conduit->dsa_ptr in dsa_tree_setup_conduit(). On teardown, it clears
conduit->dsa_ptr in dsa_tree_teardown_conduit() before
dsa_tree_teardown_ports() removes the user ports. RTNL is not held
across either pair of steps, so user space can open a user port while
conduit->dsa_ptr is NULL.
In NPI mode, felix_port_enable() calls felix_cpu_port_for_conduit().
For a physical conduit, that function reads the CPU port index through
conduit->dsa_ptr without checking for NULL. This caused an oops on an
LS1028A RDB when systemd-networkd tried to open a user port while the
switch was being probed again at runtime:
[ 166.722423] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000028
[ 166.816908] Internal error: Oops: 0000000096000004 [#1] SMP
[ 166.961766] pc : felix_cpu_port_for_conduit.isra.0+0x90/0xb8 [mscc_felix_dsa_lib]
[ 166.969289] lr : felix_port_enable+0x120/0x1a0 [mscc_felix_dsa_lib]
The oops left RTNL locked. Later operations that waited for RTNL hung,
and the board had to be power cycled.
NPI mode uses one CPU port for the whole switch. Changing the conduit
of a user port can move the NPI port to another CPU port, and the check
in felix_port_enable() keeps user ports that still use the old CPU port
down.
For a physical conduit, compare dp->cpu_dp->index with the NPI port
instead. DSA sets dp->cpu_dp before it registers the user port and
clears it only after it removes the user port, so the check keeps
working while conduit->dsa_ptr is NULL. As long as the physical
conduit is set up, conduit->dsa_ptr and dp->cpu_dp point to the same
CPU port, so the check gives the same result as before. LAG conduits
keep using felix_cpu_port_for_conduit(), which does not read dsa_ptr
for them.
Fixes: eca70102cfb1 ("net: dsa: felix: add support for changing DSA master")
Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20261119100710.129379-1-aristo.chen@canonical.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/ocelot/felix.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 20ab558fde247..4a4fc26cfdc0b 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1239,8 +1239,19 @@ static int felix_port_enable(struct dsa_switch *ds, int port,
if (ocelot->npi >= 0) {
struct net_device *conduit = dsa_port_to_conduit(dp);
+ int cpu;
- if (felix_cpu_port_for_conduit(ds, conduit) != ocelot->npi) {
+ /* Do not use conduit->dsa_ptr for a physical conduit. It is
+ * NULL before DSA sets up the conduit and after it tears it
+ * down, and opening a user port can reach this check in both
+ * cases.
+ */
+ if (netif_is_lag_master(conduit))
+ cpu = felix_cpu_port_for_conduit(ds, conduit);
+ else
+ cpu = dp->cpu_dp->index;
+
+ if (cpu != ocelot->npi) {
dev_err(ds->dev, "Multiple conduits are not allowed\n");
return -EINVAL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 299/703] ipv6: mcast: do not pass uninitialized bytes to dev_mc_add()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (295 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 298/703] net: dsa: felix: fix NULL pointer dereference in felix_port_enable() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 300/703] tcp: Dont clear saddr before ->put_port() Greg Kroah-Hartman
` (110 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Eric Dumazet,
Hangbin Liu, Ido Schimmel, Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 58f419bfa4c3a6797246a7c4e53a535ee34372ae ]
igmp6_group_added() and igmp6_group_dropped() build a link-layer
multicast address in an on-stack buffer with ndisc_mc_map(), which
fills a number of bytes depending on dev->type.
dev_mc_add() and dev_mc_del() then use dev->addr_len bytes of it.
Since IPv6 multicast joins and leaves no longer hold RTNL, dev->type
and dev->addr_len can change between the two steps, for instance with
TUNSETLINK, or when bonding or team change their type.
If addr_len grows (eg ARPHRD_ETHER -> ARPHRD_IP6GRE), dev_mc_add()
copies uninitialized stack bytes into a netdev_hw_addr, which can
later be dumped to user space by /proc/net/dev_mcast and
RTM_GETMULTICAST.
Zero the buffers.
Found by Sashiko AI review of a tun patch, by code inspection only.
Kernels built with CONFIG_INIT_STACK_ALL_ZERO=y are not affected.
Fixes: 1767bb2d47b7 ("ipv6: mcast: Don't hold RTNL for IPV6_ADD_MEMBERSHIP and MCAST_JOIN_GROUP.")
Link: https://lore.kernel.org/netdev/179512665919.3136.5931555157250030152@kernel.org/
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261123124458.205233-1-edumazet@kernel.org
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/mcast.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index f37357f24a88f..1645d12eb9ac5 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -684,7 +684,10 @@ bool inet6_mc_check(const struct sock *sk, const struct in6_addr *mc_addr,
static void igmp6_group_added(struct ifmcaddr6 *mc)
{
struct net_device *dev = mc->idev->dev;
- char buf[MAX_ADDR_LEN];
+ /* RTNL might not be held: dev->type and dev->addr_len can change.
+ * Make sure dev_mc_{add|del}() do not use uninitialized bytes.
+ */
+ char buf[MAX_ADDR_LEN] = {};
mc_assert_locked(mc->idev);
@@ -720,7 +723,10 @@ static void igmp6_group_added(struct ifmcaddr6 *mc)
static void igmp6_group_dropped(struct ifmcaddr6 *mc)
{
struct net_device *dev = mc->idev->dev;
- char buf[MAX_ADDR_LEN];
+ /* RTNL might not be held: dev->type and dev->addr_len can change.
+ * Make sure dev_mc_{add|del}() do not use uninitialized bytes.
+ */
+ char buf[MAX_ADDR_LEN] = {};
mc_assert_locked(mc->idev);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 300/703] tcp: Dont clear saddr before ->put_port().
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (296 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 299/703] ipv6: mcast: do not pass uninitialized bytes to dev_mc_add() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 301/703] bpf: Do not allow bpf_d_path() by an id of another BTF Greg Kroah-Hartman
` (109 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Eric Dumazet,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 1ab3fb564f20b78615a6d88b8c90da292f29e227 ]
When CGROUP_INET4_POST_BIND or CGROUP_INET6_POST_BIND prog fails,
__inet_bind() / __inet6_bind() calls sk->sk_prot->put_port().
For TCP, __inet_put_port() calls inet_bhashfn_portaddr() to get
the corresponding bhash2 bucket.
inet_bhashfn_portaddr() requires saddr, but it is cleared before
__inet_put_port(), leading to bhash2 lock mismatch.
This triggers list corruption or use-after-free by a conccurent
thread touching the same bhash2 bucket, e.g. tcp_diag_dump()
with TCPF_BOUND_INACTIVE. [0]
Let's clear saddr after calling sk->sk_prot->put_port().
[0]:
BUG: KASAN: slab-use-after-free in tcp_diag_dump (net/ipv4/tcp_diag.c:415)
Read of size 8 at addr ffff88810ae0e7a0 by task a/1007
CPU: 10 UID: 0 PID: 1007 Comm: a Not tainted 7.4.0-rc3-00456-gd5b89d55a322 #295 PREEMPT(lazy)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-debian-1.17.0-1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl (lib/dump_stack.c:120)
print_address_description (mm/kasan/report.c:378)
print_report (mm/kasan/report.c:482)
kasan_report (mm/kasan/report.c:595)
sock_recvmsg (net/socket.c:1154)
__sys_recvfrom (net/socket.c:2333)
__x64_sys_recvfrom (net/socket.c:2348 net/socket.c:2344 net/socket.c:2344)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
RIP: 0033:0x7f2f268f8e92
Code: 08 0f 85 91 41 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 55 bf 01 00
RSP: 002b:00007f2f26874d28 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
RAX: ffffffffffffffda RBX: 00007f2f26879ce4 RCX: 00007f2f268f8e92
RDX: 0000000000004000 RSI: 00007f2f26874db0 RDI: 00000000000007d7
RBP: 00007f2f26874d50 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000021
R13: 00007ffcbb216e70 R14: 0000000000000000 R15: 00007ffcbb216f77
</TASK>
Allocated by task 1009:
kasan_save_track (mm/kasan/common.c:57 mm/kasan/common.c:79)
__kasan_slab_alloc (mm/kasan/common.c:354 mm/kasan/common.c:380)
kmem_cache_alloc_noprof (./include/linux/kasan.h:257 mm/slub.c:4720 mm/slub.c:5033 mm/slub.c:5047)
inet_bind2_bucket_create (net/ipv4/inet_hashtables.c:162)
inet_csk_get_port (net/ipv4/inet_connection_sock.c:573)
__inet_bind (net/ipv4/af_inet.c:544)
inet_bind_sk (net/ipv4/af_inet.c:470)
__sys_bind (net/socket.c:1947 net/socket.c:1978)
__x64_sys_bind (net/socket.c:1983 net/socket.c:1981 net/socket.c:1981)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
Freed by task 1009:
kasan_save_track (mm/kasan/common.c:57 mm/kasan/common.c:79)
kasan_save_free_info (mm/kasan/generic.c:599)
__kasan_slab_free (mm/kasan/common.c:267 mm/kasan/common.c:299)
kmem_cache_free (./include/linux/kasan.h:239 mm/slub.c:2780 mm/slub.c:6637 mm/slub.c:6764)
inet_put_port (net/ipv4/inet_hashtables.c:178)
__inet_bind (net/ipv4/af_inet.c:554)
inet_bind_sk (net/ipv4/af_inet.c:470)
__sys_bind (net/socket.c:1947 net/socket.c:1978)
__x64_sys_bind (net/socket.c:1983 net/socket.c:1981 net/socket.c:1981)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The buggy address belongs to the object at ffff88810ae0e780
which belongs to the cache tcp_bind2_bucket of size 80
Fixes: 28044fc1d495 ("net: Add a bhash2 table hashed by port and address")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261121203537.341320-1-kuniyu@google.com
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/af_inet.c | 2 +-
net/ipv6/af_inet6.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index a581289384795..4f7bee102af34 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -543,9 +543,9 @@ int __inet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
if (!(flags & BIND_FROM_BPF)) {
err = BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk);
if (err) {
- inet->inet_saddr = inet->inet_rcv_saddr = 0;
if (sk->sk_prot->put_port)
sk->sk_prot->put_port(sk);
+ inet->inet_saddr = inet->inet_rcv_saddr = 0;
goto out_release_sock;
}
}
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 6301428bb6c16..4eedc429339b1 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -413,10 +413,10 @@ static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len,
if (!(flags & BIND_FROM_BPF)) {
err = BPF_CGROUP_RUN_PROG_INET6_POST_BIND(sk);
if (err) {
- sk->sk_ipv6only = saved_ipv6only;
- inet_reset_saddr(sk);
if (sk->sk_prot->put_port)
sk->sk_prot->put_port(sk);
+ sk->sk_ipv6only = saved_ipv6only;
+ inet_reset_saddr(sk);
goto out;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 301/703] bpf: Do not allow bpf_d_path() by an id of another BTF
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (297 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 300/703] tcp: Dont clear saddr before ->put_port() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 302/703] bpf: Keep the names in front of a number in delegate options Greg Kroah-Hartman
` (108 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 1139c7d8ffcd941d4860a75ef37eb1ffd15b4f87 ]
For a program that is attached to a program attach_btf_id is an id in
the BTF of the target. bpf_d_path_allowed() looks for it in a list of
kernel functions, it can match by chance. Do not look at the list when
there is a target program.
Fixes: 6e22ab9da793 ("bpf: Add d_path helper")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-5-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/bpf_trace.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 01a8b85c21857..dba382f34171b 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -946,6 +946,10 @@ BTF_SET_END(btf_allowlist_d_path)
static bool bpf_d_path_allowed(const struct bpf_prog *prog)
{
+ /* attach_btf_id is a function of the target program */
+ if (prog->aux->dst_prog)
+ return false;
+
if (prog->type == BPF_PROG_TYPE_TRACING &&
prog->expected_attach_type == BPF_TRACE_ITER)
return true;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 302/703] bpf: Keep the names in front of a number in delegate options
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (298 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 301/703] bpf: Do not allow bpf_d_path() by an id of another BTF Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 303/703] bpf: Do not trust the neighbour of tp_btf/neigh_create Greg Kroah-Hartman
` (107 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 4151f3558d6e65d4ae6cf1a431537ed52ad48239 ]
The delegate_* mount options of bpffs take names and numbers. A number
overwrites the mask, the names in front of it are lost. That is the
order in which /proc/mounts shows them.
Fixes: 6c1752e0b6ca ("bpf: Support symbolic BPF FS delegation mount options")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-11-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/inode.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index cf907fab3721f..795af4a1c436f 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -888,7 +888,7 @@ static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param)
struct bpffs_btf_enums info;
const struct btf_type *enum_t;
const char *enum_pfx;
- u64 *delegate_msk, msk = 0;
+ u64 *delegate_msk, msk = 0, num;
char *p, *str;
int val;
@@ -927,9 +927,10 @@ static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param)
} else if (find_btf_enum_const(info.btf, enum_t, enum_pfx, p, &val)) {
msk |= 1ULL << val;
} else {
- err = kstrtou64(p, 0, &msk);
+ err = kstrtou64(p, 0, &num);
if (err)
return err;
+ msk |= num;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 303/703] bpf: Do not trust the neighbour of tp_btf/neigh_create
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (299 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 302/703] bpf: Keep the names in front of a number in delegate options Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 304/703] bpf: Add the symbol of a prog before its id Greg Kroah-Hartman
` (106 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 2c517088d2ef5f9b17fcb2e44a296e36c5a91843 ]
___neigh_create() calls the tracepoint before it tests the result of
neigh_alloc(). It is NULL when the table is full. The verifier takes it
for a trusted pointer, and a load through it oopses:
BUG: kernel NULL pointer dereference, address: 000000000000013c
RIP: 0010:bpf_prog_56e3384dcafb1b5b_on_create+0x61/0xc4
Mark it untrusted, loads through it are probed then. PTR_MAYBE_NULL
would refuse programs like bpftune, which pass &n->parms to
bpf_probe_read_kernel() without a check. The pointer cannot be passed
as memory or as a trusted argument any more.
Fixes: 838a10bd2ebf ("bpf: Augment raw_tp arguments with PTR_MAYBE_NULL")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-12-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/btf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 64b54b1ee4e15..8da6e7959ce98 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6740,6 +6740,7 @@ static const struct bpf_raw_tp_null_args raw_tp_null_args[] = {
/* iptfs */
{ "iptfs_ingress_postq_event", 0x1000 },
/* neigh */
+ { "neigh_create", 0x4000 },
{ "neigh_update", 0x10 },
/* snd_firewire_lib */
{ "amdtp_packet", 0x100 },
@@ -6925,6 +6926,9 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
/* Is the current arg IS_ERR? */
if (raw_tp_null_args[i].mask & (0x2ULL << (arg * 4)))
ptr_err_raw_tp = true;
+ /* It can be NULL, and programs that do not check it have to load */
+ if (raw_tp_null_args[i].mask & (0x4ULL << (arg * 4)))
+ info->reg_type = PTR_TO_BTF_ID | PTR_UNTRUSTED;
break;
}
/* If we don't know NULL-ness specification and the tracepoint
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 304/703] bpf: Add the symbol of a prog before its id
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (300 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 303/703] bpf: Do not trust the neighbour of tp_btf/neigh_create Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 305/703] bpf: Do not fill jited line info for a hidden subprog Greg Kroah-Hartman
` (105 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit f7a40c2de8d4abdea6d1e21122b447b593e28bd9 ]
A prog can be taken by its id and run before bpf_prog_kallsyms_add().
bpf_throw() does not find the main prog and oopses:
KASAN: null-ptr-deref in range [0x0000000000000568-0x000000000000056f]
RIP: 0010:bpf_throw+0x129/0x220
The exception table is found by the same symbol.
Add the symbol first. bpf_prog_free() removes it when there is no id.
Fixes: 3dec541b2e63 ("bpf: Add support for BTF pointers to x86 JIT")
Fixes: f18b03fabaa9 ("bpf: Implement BPF exceptions")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-15-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index a076c1bc41ac3..c4059cd3027ce 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3094,6 +3094,9 @@ static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr, u32 uattr_size)
if (err < 0)
goto free_used_maps;
+ /* bpf_throw() and faults look for the symbol. The prog can run once it has the id. */
+ bpf_prog_kallsyms_add(prog);
+
err = bpf_prog_alloc_id(prog);
if (err)
goto free_used_maps;
@@ -3112,7 +3115,6 @@ static int bpf_prog_load(union bpf_attr *attr, bpfptr_t uattr, u32 uattr_size)
* Also, any failure handling from this point onwards must
* be using bpf_prog_put() given the program is exposed.
*/
- bpf_prog_kallsyms_add(prog);
perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_LOAD, 0);
bpf_audit_prog(prog, BPF_AUDIT_LOAD);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 305/703] bpf: Do not fill jited line info for a hidden subprog
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (301 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 304/703] bpf: Add the symbol of a prog before its id Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 306/703] bpf: Fix NULL dereference in XDP redirect from async callbacks Greg Kroah-Hartman
` (104 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 2f2b119ea30dfba27563c1c939eb42b5298a391a ]
func_idx of the default exception callback is func_cnt, and the test
for hidden subprogs is off by one. The address of the callback goes to
jited_linfo[0]. libbpf and bpftool refuse the jited line info of the
prog.
Fixes: 335d1c5b5452 ("bpf: Implement support for adding hidden subprogs")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-16-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 1d1d834482228..14d468049b6c2 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -233,7 +233,8 @@ void bpf_prog_fill_jited_linfo(struct bpf_prog *prog,
const struct bpf_line_info *linfo;
void **jited_linfo;
- if (!prog->aux->jited_linfo || prog->aux->func_idx > prog->aux->func_cnt)
+ if (!prog->aux->jited_linfo ||
+ (prog->aux->func_idx && prog->aux->func_idx >= prog->aux->func_cnt))
/* Userspace did not provide linfo */
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 306/703] bpf: Fix NULL dereference in XDP redirect from async callbacks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (302 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 305/703] bpf: Do not fill jited line info for a hidden subprog Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 307/703] bpf: Check the attach type when a cgroup link gets another program Greg Kroah-Hartman
` (103 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit f28ed533106bc01aedba6ba47c0e1a1098c92092 ]
bpf_redirect() and bpf_redirect_map() do not take the context, so the
timer callback of an XDP program can call them. There is no
current->bpf_net_context then:
KASAN: null-ptr-deref in range [0x0000000000000038-0x000000000000003f]
RIP: 0010:bpf_xdp_redirect+0x5b/0x170
Return XDP_ABORTED, like the tc helpers return TC_ACT_SHOT. It is one
more test and branch on a value that is loaded anyway.
Fixes: 401cb7dae813 ("net: Reference bpf_redirect_info via task_struct on PREEMPT_RT.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-17-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/filter.h | 5 +++--
net/core/filter.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a11c92e104965..59a029db56059 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -1784,13 +1784,14 @@ static __always_inline long __bpf_xdp_redirect_map(struct bpf_map *map, u64 inde
u64 flags, const u64 flag_mask,
void *lookup_elem(struct bpf_map *map, u32 key))
{
- struct bpf_redirect_info *ri = bpf_net_ctx_get_ri();
const u64 action_mask = XDP_ABORTED | XDP_DROP | XDP_PASS | XDP_TX;
+ struct bpf_redirect_info *ri;
/* Lower bits of the flags are used as return code on lookup failure */
- if (unlikely(flags & ~(action_mask | flag_mask)))
+ if (unlikely(!bpf_net_ctx_get() || flags & ~(action_mask | flag_mask)))
return XDP_ABORTED;
+ ri = bpf_net_ctx_get_ri();
ri->tgt_value = lookup_elem(map, index);
if (unlikely(!ri->tgt_value) && !(flags & BPF_F_BROADCAST)) {
/* If the lookup fails we want to clear out the state in the
diff --git a/net/core/filter.c b/net/core/filter.c
index ec8ce9faca0c5..b06d7c2515651 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4741,11 +4741,12 @@ int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
BPF_CALL_2(bpf_xdp_redirect, u32, ifindex, u64, flags)
{
- struct bpf_redirect_info *ri = bpf_net_ctx_get_ri();
+ struct bpf_redirect_info *ri;
- if (unlikely(flags))
+ if (unlikely(!bpf_net_ctx_get() || flags))
return XDP_ABORTED;
+ ri = bpf_net_ctx_get_ri();
/* NB! Map type UNSPEC and map_id == INT_MAX (never generated
* by map_idr) is used for ifindex based XDP redirect.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 307/703] bpf: Check the attach type when a cgroup link gets another program
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (303 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 306/703] bpf: Fix NULL dereference in XDP redirect from async callbacks Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 308/703] bpf: Refuse mmap() of a part of an arena Greg Kroah-Hartman
` (102 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit a5e757f6cb34e1be0700359a02567722bcbbf6e3 ]
BPF_LINK_UPDATE compares only the type of the program. A program that is
verified for one hook runs in another one. In setsockopt the result of
bpf_get_retval() is an errno, in getsockopt it is any int.
Check expected_attach_type, as the attach does.
Fixes: 0c991ebc8c69 ("bpf: Implement bpf_prog replacement for an active bpf_cgroup_link")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-18-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/cgroup.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index 14521bd99c7a8..ab14b8bd17588 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -1040,6 +1040,24 @@ static bool cgroup_bpf_storages_compatible(struct bpf_prog *old_prog,
return true;
}
+/* See bpf_prog_attach_check_attach_type() */
+static bool prog_is_for_attach_type(const struct bpf_prog *prog, enum bpf_attach_type type)
+{
+ switch (prog->type) {
+ case BPF_PROG_TYPE_CGROUP_SKB:
+ if (!prog->enforce_expected_attach_type)
+ return true;
+ fallthrough;
+ case BPF_PROG_TYPE_CGROUP_SOCK:
+ case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
+ case BPF_PROG_TYPE_CGROUP_SOCKOPT:
+ case BPF_PROG_TYPE_LSM:
+ return prog->expected_attach_type == type;
+ default:
+ return true;
+ }
+}
+
/**
* __cgroup_bpf_replace() - Replace link's program and propagate the change
* to descendants
@@ -1066,7 +1084,8 @@ static int __cgroup_bpf_replace(struct cgroup *cgrp,
progs = &cgrp->bpf.progs[atype];
- if (link->link.prog->type != new_prog->type)
+ if (link->link.prog->type != new_prog->type ||
+ !prog_is_for_attach_type(new_prog, link->link.attach_type))
return -EINVAL;
hlist_for_each_entry(pl, progs, node) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 308/703] bpf: Refuse mmap() of a part of an arena
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (304 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 307/703] bpf: Check the attach type when a cgroup link gets another program Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 309/703] bpf: Fix reads past an enum in prints of BTF data Greg Kroah-Hartman
` (101 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 0cd1f2029b1b9fd7ceb52e3dfec181452cf20be0 ]
The first mmap() sets the addresses of an arena that has no map_extra.
It can be shorter than max_entries, but all pages stay in the range
tree. An allocation without an address gets pages behind the end of the
mapping. They can be mapped behind the vmalloc area of the arena.
Require the length of the whole arena, as for an arena with map_extra.
libbpf and cilium/ebpf map all pages.
Fixes: b795379757eb ("bpf: Introduce range_tree data structure and use it in bpf arena")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-22-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/arena.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
index 3d3bad292bad0..5d0cb5917b3dc 100644
--- a/kernel/bpf/arena.c
+++ b/kernel/bpf/arena.c
@@ -335,16 +335,13 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long ad
return -EINVAL;
if (len > (u64)map->max_entries * PAGE_SIZE)
return -E2BIG;
+ /* each page in the range tree needs an address */
+ if (len < (u64)map->max_entries * PAGE_SIZE)
+ return -EINVAL;
/* if user_vm_start was specified at arena creation time */
- if (arena->user_vm_start) {
- if (len > arena->user_vm_end - arena->user_vm_start)
- return -E2BIG;
- if (len != arena->user_vm_end - arena->user_vm_start)
- return -EINVAL;
- if (addr != arena->user_vm_start)
- return -EINVAL;
- }
+ if (arena->user_vm_start && addr != arena->user_vm_start)
+ return -EINVAL;
ret = mm_get_unmapped_area(current->mm, filp, addr, len * 2, 0, flags);
if (IS_ERR_VALUE(ret))
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 309/703] bpf: Fix reads past an enum in prints of BTF data
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (305 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 308/703] bpf: Refuse mmap() of a part of an arena Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 310/703] bpf: Give syscall programs without CAP_PERFMON the base helpers only Greg Kroah-Hartman
` (100 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 6c8d5a113c2341a9fc12a6550c0645d5cda0d56d ]
An enum has 1, 2, 4 or 8 bytes. It's read as int, enum64 as u64,
whatever the size is. The file of a map in bpffs shows what is behind
a key or a value that ends with a short enum.
Read as many bytes as the type has. The check of a member of a struct
with bitfields takes any enum for 4 bytes, so an enum of 8 bytes can
stick out of it. Use the size there too.
Short enums are printed by their names. BTF with an enum that sticks
out of its struct is refused, compilers don't make it.
Fixes: 9eea98497951 ("bpf: fix BTF verification of enums")
Fixes: 6089fb325cf7 ("bpf: Add btf enum64 support")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-24-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/btf.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 8da6e7959ce98..907e6388813e5 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -4367,7 +4367,7 @@ static int btf_enum_check_kflag_member(struct btf_verifier_env *env,
return -EINVAL;
}
- nr_bits = int_bitsize;
+ nr_bits = member_type->size * BITS_PER_BYTE;
} else if (nr_bits > int_bitsize) {
btf_verifier_log_member(env, struct_type, member,
"Invalid member bitfield_size");
@@ -4450,12 +4450,30 @@ static void btf_enum_log(struct btf_verifier_env *env,
btf_verifier_log(env, "size=%u vlen=%u", t->size, btf_type_vlen(t));
}
+static s64 btf_enum_read(const struct btf_type *t, const void *data)
+{
+ bool sign = btf_type_kflag(t);
+
+ switch (t->size) {
+ case 1:
+ return sign ? *(s8 *)data : *(u8 *)data;
+ case 2:
+ return sign ? *(s16 *)data : *(u16 *)data;
+ case 4:
+ return sign ? (s64)*(s32 *)data : *(u32 *)data;
+ default:
+ return *(s64 *)data;
+ }
+}
+
static void btf_enum_show(const struct btf *btf, const struct btf_type *t,
u32 type_id, void *data, u8 bits_offset,
struct btf_show *show)
{
const struct btf_enum *enums = btf_type_enum(t);
u32 i, nr_enums = btf_type_vlen(t);
+ /* Old compilers don't set the flag for negative values */
+ u32 mask = t->size < 4 ? BIT(t->size * BITS_PER_BYTE) - 1 : U32_MAX;
void *safe_data;
int v;
@@ -4463,10 +4481,10 @@ static void btf_enum_show(const struct btf *btf, const struct btf_type *t,
if (!safe_data)
return;
- v = *(int *)safe_data;
+ v = btf_enum_read(t, safe_data);
for (i = 0; i < nr_enums; i++) {
- if (v != enums[i].val)
+ if ((v ^ enums[i].val) & mask)
continue;
btf_show_type_value(show, "%s",
@@ -4566,7 +4584,7 @@ static void btf_enum64_show(const struct btf *btf, const struct btf_type *t,
if (!safe_data)
return;
- v = *(u64 *)safe_data;
+ v = btf_enum_read(t, safe_data);
for (i = 0; i < nr_enums; i++) {
if (v != btf_enum64_value(enums + i))
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 310/703] bpf: Give syscall programs without CAP_PERFMON the base helpers only
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (306 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 309/703] bpf: Fix reads past an enum in prints of BTF data Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 311/703] bpf: Limit reads of variables of the kernel Greg Kroah-Hartman
` (99 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 2ff55b023f637d61a56a893b0a3eb534acfb2ffd ]
A syscall program needs CAP_BPF only, and it gets all helpers of tracing
programs. These don't ask for CAP_PERFMON, the load of a tracing program
does.
The helpers for loader programs take current for the loader. It's
another task in a callback. bpf_kallsyms_lookup_name() answers in a
callback of bpf_wq, as a kworker has all capabilities. bpf_sys_close()
in a task work closes a file of any process.
Give the program the base helpers. It loses bpf_perf_event_output() too.
Loader programs are not affected, bpf_sys_bpf() needs CAP_PERFMON
already.
Fixes: 79a7f8bdb159 ("bpf: Introduce bpf_sys_bpf() helper and program type.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-26-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index c4059cd3027ce..24a853c777cef 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -6480,10 +6480,12 @@ static const struct bpf_func_proto bpf_kallsyms_lookup_name_proto = {
static const struct bpf_func_proto *
syscall_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
{
+ if (!bpf_token_capable(prog->aux->token, CAP_PERFMON))
+ return bpf_base_func_proto(func_id, prog);
+
switch (func_id) {
case BPF_FUNC_sys_bpf:
- return !bpf_token_capable(prog->aux->token, CAP_PERFMON)
- ? NULL : &bpf_sys_bpf_proto;
+ return &bpf_sys_bpf_proto;
case BPF_FUNC_btf_find_by_name_kind:
return &bpf_btf_find_by_name_kind_proto;
case BPF_FUNC_sys_close:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 311/703] bpf: Limit reads of variables of the kernel
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (307 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 310/703] bpf: Give syscall programs without CAP_PERFMON the base helpers only Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 312/703] bpf: dont skip other information if xlated_prog_insns is skipped Greg Kroah-Hartman
` (98 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 419c69483a62c9b91654e9fa32e3782efea5dc7c ]
ld_imm64 of a variable that is not a struct gives readable memory, so do
bpf_per_cpu_ptr() and bpf_this_cpu_ptr(). Many variables hold addresses,
and CAP_BPF is enough to read them. The size comes from BTF, and that
can be BTF of the program. Loads from such memory are not probed.
Ask for CAP_PERFMON, as for the access to a struct. Addresses of
functions and of per-cpu variables can be loaded as before. Take BTF of
the kernel and of modules only, libbpf passes no other.
Fixes: eaa6bcb71ef6 ("bpf: Introduce bpf_per_cpu_ptr()")
Fixes: 541c3bad8dc5 ("bpf: Support BPF ksym variables in kernel modules")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-29-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/helpers.c | 8 ++++----
kernel/bpf/verifier.c | 11 +++++++++++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 9057efcf73d01..d1cd4f301f05b 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -2007,10 +2007,6 @@ bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_spin_unlock_proto;
case BPF_FUNC_jiffies64:
return &bpf_jiffies64_proto;
- case BPF_FUNC_per_cpu_ptr:
- return &bpf_per_cpu_ptr_proto;
- case BPF_FUNC_this_cpu_ptr:
- return &bpf_this_cpu_ptr_proto;
case BPF_FUNC_timer_init:
return &bpf_timer_init_proto;
case BPF_FUNC_timer_set_callback:
@@ -2118,6 +2114,10 @@ bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_get_branch_snapshot_proto;
case BPF_FUNC_find_vma:
return &bpf_find_vma_proto;
+ case BPF_FUNC_per_cpu_ptr:
+ return &bpf_per_cpu_ptr_proto;
+ case BPF_FUNC_this_cpu_ptr:
+ return &bpf_this_cpu_ptr_proto;
default:
return NULL;
}
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 4d76394cbac1a..c21799fbaf341 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -20986,6 +20986,12 @@ static int __check_pseudo_btf_id(struct bpf_verifier_env *env,
}
}
+ if (!percpu && !env->allow_ptr_leaks) {
+ verbose(env, "access to '%s' is allowed only to CAP_PERFMON and CAP_SYS_ADMIN\n",
+ sym_name);
+ return -EPERM;
+ }
+
type = t->type;
t = btf_type_skip_modifiers(btf, type, NULL);
if (percpu) {
@@ -21031,6 +21037,11 @@ static int check_pseudo_btf_id(struct bpf_verifier_env *env,
verbose(env, "invalid module BTF object FD specified.\n");
return -EINVAL;
}
+ if (!btf_is_kernel(btf)) {
+ verbose(env, "BTF fd for ksym is not a kernel BTF\n");
+ btf_put(btf);
+ return -EINVAL;
+ }
} else {
if (!btf_vmlinux) {
verbose(env, "kernel is missing BTF, make sure CONFIG_DEBUG_INFO_BTF=y is specified in Kconfig.\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 312/703] bpf: dont skip other information if xlated_prog_insns is skipped
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (308 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 311/703] bpf: Limit reads of variables of the kernel Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 313/703] bpf: Require CAP_PERFMON for dumps of xlated insns Greg Kroah-Hartman
` (97 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Max Altgelt, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Altgelt, Max (Nextron) <max.altgelt@nextron-systems.com>
[ Upstream commit 4722981cca373a338bbcf3a93ecf7144a892b03b ]
If xlated_prog_insns should not be exposed, other information
(such as func_info) still can and should be filled in.
Therefore, instead of directly terminating in this case,
continue with the normal flow.
Signed-off-by: Max Altgelt <max.altgelt@nextron-systems.com>
Link: https://lore.kernel.org/r/efd00fcec5e3e247af551632726e2a90c105fbd8.camel@nextron-systems.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: b8aa487429d4 ("bpf: Require CAP_PERFMON for dumps of xlated insns")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 24a853c777cef..40738a2354d10 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -5092,19 +5092,19 @@ static int bpf_prog_get_info_by_fd(struct file *file,
struct bpf_insn *insns_sanitized;
bool fault;
- if (prog->blinded && !bpf_dump_raw_ok(file->f_cred)) {
+ if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) {
+ insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
+ if (!insns_sanitized)
+ return -ENOMEM;
+ uinsns = u64_to_user_ptr(info.xlated_prog_insns);
+ ulen = min_t(u32, info.xlated_prog_len, ulen);
+ fault = copy_to_user(uinsns, insns_sanitized, ulen);
+ kfree(insns_sanitized);
+ if (fault)
+ return -EFAULT;
+ } else {
info.xlated_prog_insns = 0;
- goto done;
}
- insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
- if (!insns_sanitized)
- return -ENOMEM;
- uinsns = u64_to_user_ptr(info.xlated_prog_insns);
- ulen = min_t(u32, info.xlated_prog_len, ulen);
- fault = copy_to_user(uinsns, insns_sanitized, ulen);
- kfree(insns_sanitized);
- if (fault)
- return -EFAULT;
}
if (bpf_prog_is_offloaded(prog->aux)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 313/703] bpf: Require CAP_PERFMON for dumps of xlated insns
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (309 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 312/703] bpf: dont skip other information if xlated_prog_insns is skipped Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 314/703] bpf: Zero bpf_list_head in copies of map values Greg Kroah-Hartman
` (96 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit b8aa487429d46a72881933c026a6ca2a8e72d6d2 ]
The verifier puts addresses of the kernel to insns: for ksyms, inlined
helpers and hidden arguments. The dump of xlated insns hides the ones of
maps and calls only, the others look like constants by then. Give no
dump, as for a blinded program, to who has no CAP_PERFMON and can't read
kallsyms.
Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-30-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/syscall.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 40738a2354d10..c0901ade5b80c 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -5092,7 +5092,8 @@ static int bpf_prog_get_info_by_fd(struct file *file,
struct bpf_insn *insns_sanitized;
bool fault;
- if (!prog->blinded || bpf_dump_raw_ok(file->f_cred)) {
+ /* The verifier puts addresses to ld_imm64 and mov insns */
+ if (bpf_dump_raw_ok(file->f_cred) || (!prog->blinded && perfmon_capable())) {
insns_sanitized = bpf_insn_prepare_dump(prog, file->f_cred);
if (!insns_sanitized)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 314/703] bpf: Zero bpf_list_head in copies of map values
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (310 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 313/703] bpf: Require CAP_PERFMON for dumps of xlated insns Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 315/703] bpf: Require CAP_PERFMON to read pinned maps with special fields Greg Kroah-Hartman
` (95 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 8252c3517f95f02a8569480563a773e0462dce52 ]
Lookups from user space copy the value to a buffer and init special
fields there. An empty list_head points to itself. The caller gets the
address of the buffer.
Fill the fields with zeros. It's what a new element of a map has.
bpf_refcount in a value reads as 0.
Fixes: 3e81740a9062 ("bpf: Centralize btf_field-specific initialization logic")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-31-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 74110a8c800d9..ca45adf8ddd8e 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -507,7 +507,14 @@ static inline void bpf_obj_init(const struct btf_record *rec, void *obj)
*/
static inline void check_and_init_map_value(struct bpf_map *map, void *dst)
{
- bpf_obj_init(map->record, dst);
+ const struct btf_record *rec = map->record;
+ int i;
+
+ if (IS_ERR_OR_NULL(rec))
+ return;
+ /* Not bpf_obj_init(): an empty list_head has the address of 'dst' */
+ for (i = 0; i < rec->cnt; i++)
+ memset(dst + rec->fields[i].offset, 0, rec->fields[i].size);
}
/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 315/703] bpf: Require CAP_PERFMON to read pinned maps with special fields
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (311 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 314/703] bpf: Zero bpf_list_head in copies of map values Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 316/703] bpf: Clear the data that bpf_msg_push_data() adds Greg Kroah-Hartman
` (94 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 398557b30b9cd673a762d284c714b5c6b2769fbe ]
A read of a pinned map prints values as they are in memory. bpf_timer,
bpf_wq, bpf_list_head and bpf_rb_root are arrays of u64 for BTF and have
addresses. Refuse open() of the file. BPF_OBJ_GET works as before.
Fixes: b00628b1c7d5 ("bpf: Introduce bpf timers.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-32-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/inode.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index 795af4a1c436f..66eae300c4d08 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -276,6 +276,11 @@ static int bpffs_map_open(struct inode *inode, struct file *file)
struct seq_file *m;
int err;
+ /* Special fields are printed as they are. Most have addresses. */
+ if (btf_record_has_field(map->record, ~(BPF_SPIN_LOCK | BPF_RES_SPIN_LOCK)) &&
+ !perfmon_capable())
+ return -EPERM;
+
iter = map_iter_alloc(map);
if (!iter)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 316/703] bpf: Clear the data that bpf_msg_push_data() adds
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (312 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 315/703] bpf: Require CAP_PERFMON to read pinned maps with special fields Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 317/703] bpf: Fail loads from a network header that was not set Greg Kroah-Hartman
` (93 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 401fce9f48b1d684b92dbc08389d7c20bd036280 ]
The helper puts a new page into the message as the allocator gave it.
Bytes that the program does not write can be read by it, and are sent
to the peer. Allocate zeroed memory.
Fixes: 6fff607e2f14 ("bpf: sk_msg program helper bpf_msg_push_data")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-39-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index b06d7c2515651..3f5a9831e7ca4 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2867,7 +2867,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start,
if (unlikely(copy + len < copy))
return -EINVAL;
- page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC | __GFP_COMP,
+ page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC | __GFP_COMP | __GFP_ZERO,
get_order(copy + len));
if (unlikely(!page))
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 317/703] bpf: Fail loads from a network header that was not set
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (313 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 316/703] bpf: Clear the data that bpf_msg_push_data() adds Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 318/703] bpf: Clear family and port of a short address for cgroup sockaddr hooks Greg Kroah-Hartman
` (92 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 766907cdaeefb57faddc5d09a49bdd4ce20a6272 ]
skb->network_header is 0 until something sets it. Loads at SKF_NET_OFF
and bpf_skb_load_bytes_relative() start at skb->head then, and read
headroom that nobody has written. qrtr and AF_XDP in copy mode make such
skbs.
Fail the load, like for the MAC header. A network header at skb->head
counts as set when skb->data or the MAC header is there too. CAN and
6LoWPAN make such skbs.
Fixes: 2e07fa9cd3ba ("[SK_BUFF]: Use offsets for skb->{mac,network,transport}_header on 64bit architectures")
Fixes: 0f5d82f187e1 ("net/filter: Permit reading NET in load_bytes_relative when MAC not set")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-40-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/filter.h | 9 +++++++++
kernel/bpf/core.c | 2 ++
net/core/filter.c | 5 ++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 59a029db56059..623092e20305e 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -976,6 +976,15 @@ static inline void bpf_restore_data_end(
cb->data_end = saved_data_end;
}
+/*
+ * If nothing has set the header, it points to headroom that was not written.
+ * The packet starts at skb->head when skb->data or the MAC header is there.
+ */
+static inline bool bpf_skb_has_network_header(const struct sk_buff *skb)
+{
+ return skb->network_header || !skb->mac_header || !skb_headroom(skb);
+}
+
static inline u8 *bpf_skb_cb(const struct sk_buff *skb)
{
/* eBPF programs may read/write skb->cb[] area to transfer meta
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 14d468049b6c2..f6caaa1014e3e 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -80,6 +80,8 @@ void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, uns
u8 *ptr = NULL;
if (k >= SKF_NET_OFF) {
+ if (unlikely(!bpf_skb_has_network_header(skb)))
+ return NULL;
ptr = skb_network_header(skb) + k - SKF_NET_OFF;
} else if (k >= SKF_LL_OFF) {
if (unlikely(!skb_mac_header_was_set(skb)))
diff --git a/net/core/filter.c b/net/core/filter.c
index 3f5a9831e7ca4..e0a280cec411d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -233,7 +233,8 @@ static int bpf_skb_load_helper_convert_offset(const struct sk_buff *skb, int off
return offset;
if (offset >= SKF_NET_OFF)
- return offset - SKF_NET_OFF + skb_network_offset(skb);
+ return bpf_skb_has_network_header(skb) ?
+ offset - SKF_NET_OFF + skb_network_offset(skb) : INT_MIN;
if (offset >= SKF_LL_OFF && skb_mac_header_was_set(skb))
return offset - SKF_LL_OFF + skb_mac_offset(skb);
@@ -1864,6 +1865,8 @@ BPF_CALL_5(bpf_skb_load_bytes_relative, const struct sk_buff *, skb,
start = skb_mac_header(skb);
break;
case BPF_HDR_START_NET:
+ if (unlikely(!bpf_skb_has_network_header(skb)))
+ goto err_clear;
start = skb_network_header(skb);
break;
default:
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 318/703] bpf: Clear family and port of a short address for cgroup sockaddr hooks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (314 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 317/703] bpf: Fail loads from a network header that was not set Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 319/703] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Greg Kroah-Hartman
` (91 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 2abc088aae543fa97350df8b2dd5eedf622e380d ]
recvmsg() from a unix socket that has no name leaves the buffer of the
address as it is, and that is on the stack of the kernel. The program
reads user_family and user_port whatever the length is.
bpf_sock_addr_set_sun_path() sends the family to user space.
Clear the bytes from the length up to 4. Write AF_UNIX next to the path
in the kfunc.
Fixes: 859051dd165e ("bpf: Implement cgroup sockaddr hooks for unix sockets")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-42-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/cgroup.c | 4 ++++
net/core/filter.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index ab14b8bd17588..ac1f7882cc7d6 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -1791,6 +1791,10 @@ int __cgroup_bpf_run_filter_sock_addr(struct sock *sk,
ctx.uaddrlen = 0;
} else {
ctx.uaddrlen = *uaddrlen;
+ /* Programs read the family and the port also of a short address. */
+ if (ctx.uaddrlen < offsetofend(struct sockaddr_in, sin_port))
+ memset((void *)uaddr + ctx.uaddrlen, 0,
+ offsetofend(struct sockaddr_in, sin_port) - ctx.uaddrlen);
}
cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data);
diff --git a/net/core/filter.c b/net/core/filter.c
index e0a280cec411d..b65d58fe1d4cb 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -12278,6 +12278,7 @@ __bpf_kfunc int bpf_sock_addr_set_sun_path(struct bpf_sock_addr_kern *sa_kern,
return -EINVAL;
un = (struct sockaddr_un *)sa_kern->uaddr;
+ un->sun_family = AF_UNIX;
memcpy(un->sun_path, sun_path, sun_path__sz);
sa_kern->uaddrlen = offsetof(struct sockaddr_un, sun_path) + sun_path__sz;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 319/703] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (315 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 318/703] bpf: Clear family and port of a short address for cgroup sockaddr hooks Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 320/703] bpf: Keep the MAC header in bpf_skb_change_tail() Greg Kroah-Hartman
` (90 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit c1b5decc73149f69db0b8d28ebcea204249e3b0b ]
bpf_redirect_neigh() takes the neighbour from the route, the skb gets
the device that the program has named. They are not always the same for
IPv4, and the queue of a neighbour is purged with its own device only.
When a L3 master was named take a neighbour of that device, as IPv6
does. Its driver drops the header and routes the packet, one entry does
for all.
Fixes: ba452c9e996d ("bpf: Fix bpf_redirect_neigh helper api to support supplying nexthop")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-43-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index b65d58fe1d4cb..f34315dff06ca 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2366,7 +2366,11 @@ static int bpf_out_neigh_v4(struct net *net, struct sk_buff *skb,
}
rcu_read_lock();
- if (!nh) {
+ if (!nh && netif_is_l3_master(dev)) {
+ /* The route leads to another device, this one looks it up again */
+ skb_dst_drop(skb);
+ neigh = ip_neigh_gw4(dev, htonl(INADDR_ANY));
+ } else if (!nh) {
struct rtable *rt = skb_rtable(skb);
neigh = ip_neigh_for_gw(rt, skb, &is_v6gw);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 320/703] bpf: Keep the MAC header in bpf_skb_change_tail()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (316 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 319/703] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 321/703] bpf, sockmap: Hold the psock of the work in sk_psock_backlog() Greg Kroah-Hartman
` (89 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 28ffeb9cb9722f39854f11e5f0511a4a8c12d9fb ]
The least length of the skb is the offset of the transport header when
it's set, also when that is below the offset of the network header.
Callers of tc programs count on a skb that is not shorter than mac_len.
Take the bigger one of the two offsets.
Fixes: 5293efe62df8 ("bpf: add bpf_skb_change_tail helper")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-44-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index f34315dff06ca..1d8cedd4c4f24 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3903,7 +3903,7 @@ static u32 __bpf_skb_min_len(const struct sk_buff *skb)
if (skb_transport_header_was_set(skb)) {
offset = skb_transport_offset(skb);
if (offset > 0)
- min_len = offset;
+ min_len = max_t(u32, min_len, offset);
}
return min_len;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 321/703] bpf, sockmap: Hold the psock of the work in sk_psock_backlog()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (317 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 320/703] bpf: Keep the MAC header in bpf_skb_change_tail() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 322/703] tcp: fix negative sk_forward_alloc after MSG_ZEROCOPY append Greg Kroah-Hartman
` (88 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 9abfa0ad4f7606619586187152a0479efd306b13 ]
The socket can leave its map and come back after the test of
SK_PSOCK_TX_ENABLED. sk_psock_get() takes a reference to the new psock
then, and the work puts the old one that has none left. The new one and
its socket are never freed.
Take the reference that is put.
Fixes: 8259eb0e06d8 ("bpf, sockmap: Avoid using sk_socket after free when sending")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261125032938.670542-46-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skmsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index f5c12ef68675c..9cc738b94209d 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -691,7 +691,7 @@ static void sk_psock_backlog(struct work_struct *work)
* before sk_socket freed. If refcnt increment fails, it indicates
* sock_map_close() completed with sk_socket potentially already freed.
*/
- if (!sk_psock_get(psock->sk))
+ if (!refcount_inc_not_zero(&psock->refcnt))
return;
mutex_lock(&psock->work_mutex);
while ((skb = skb_peek(&psock->ingress_skb))) {
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 322/703] tcp: fix negative sk_forward_alloc after MSG_ZEROCOPY append
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (318 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 321/703] bpf, sockmap: Hold the psock of the work in sk_psock_backlog() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 323/703] net: dpaa2-eth: fix objtool warning and logic bug Greg Kroah-Hartman
` (87 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, Eric Dumazet,
Willem de Bruijn, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <jiayuan.chen@linux.dev>
[ Upstream commit e50436deae925d1b95b01936e2499428c4782a6a ]
Our local syzbot reported the following warning:
WARNING: ./include/linux/ucopysize.h:57 at tcp_sendmsg_locked+0x1e13/0x1f20
Modules linked in:
CPU: 3 UID: 0 PID: 377 Comm: syz.2.2248 Not tainted 7.4.0-rc2+ #398 PREEMPT
RIP: 0010:tcp_sendmsg_locked+0x1e13/0x1f20
Call Trace:
<TASK>
tcp_sendmsg+0x2c/0x50
inet_sendmsg+0x62/0xb0
__sys_sendto+0x2fe/0x350
__x64_sys_sendto+0x7f/0xb0
x64_sys_call+0x1375/0x27e0
do_syscall_64+0xe4/0x470
entry_SYSCALL_64_after_hwframe+0x76/0x7e
</TASK>
The problem is here:
if (!skb_zcopy_pure(skb)) {
copy = tcp_wmem_schedule(sk, copy);
if (!copy)
goto wait_for_space;
}
When MSG_ZEROCOPY data is appended to a skb that already holds copied
data, only the user length is scheduled, but the pinned pages are then
charged by their truesize:
skb_zerocopy_iter_stream
__zerocopy_sg_from_iter
zerocopy_fill_skb_from_iter //truesize += PAGE_ALIGN(copied + start)
sk_mem_charge(sk, truesize) //sk_forward_alloc goes negative
For example, sending 8 iovecs of 1 byte each schedules 8 bytes and
charges 32768 with 4K pages.
On a later sendmsg() without MSG_ZEROCOPY, if sk_wmem_schedule() fails
(e.g. tcp_mem hard limit is reached), tcp_wmem_schedule() returns
min(copy, sk->sk_forward_alloc), which is negative. The negative copy
is passed to skb_copy_to_page_nocache() and triggers the warning, and
sendmsg() fails with -EFAULT.
A few options were considered:
1) Schedule the truesize up front. It is not known before the pages
are pinned, it depends on the iovec layout.
2) Do not append zerocopy data to a non pure skb. This splits a small
header and its zerocopy payload into two skbs.
3) Schedule the missing part right after the pages are charged. They
are already in the skb at this point, so this can not fail.
Go with 3).
Fixes: 849b425cd091 ("tcp: fix possible freeze in tx path under memory pressure")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261123122432.297135-1-jiayuan.chen@linux.dev
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4d41f16bd6103..0c5f5bd2621d7 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1309,6 +1309,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
err = skb_zerocopy_iter_stream(sk, skb, msg, copy, uarg,
binding);
+ if (!skb_zcopy_pure(skb))
+ sk_forced_mem_schedule(sk, 0);
if (err == -EMSGSIZE || err == -EEXIST) {
tcp_mark_push(tp, skb);
goto new_segment;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 323/703] net: dpaa2-eth: fix objtool warning and logic bug
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (319 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 322/703] tcp: fix negative sk_forward_alloc after MSG_ZEROCOPY append Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 324/703] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported Greg Kroah-Hartman
` (86 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Robert-Ionut Alexa, Ioana Ciornei,
David S. Miller, Andrew Lunn, Jakub Kicinski, Paolo Abeni,
Linus Torvalds, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <torvalds@linux-foundation.org>
[ Upstream commit 25faec9ce61c01fb45abf812a222c5b43c3cd5c5 ]
This commit came about because I locally had a build with COMPILE_TEST
and various runtime hardening features (that don't make sense for a pure
build test anyway) disabled - and objtool complained about some of the
code as a result:
drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.o: warning: objtool: dpaa2_eth_add_bufs+0x3f8: stack state mismatch: reg1[15]=-1+0 reg2[15]=-2-208
The reason seems to be that without the hardening features, objtool
notices that gcc is doing really odd things with the 'page' variable,
which is uninitialized in the path where 'ch->xsk_zc' is true.
Now, this seems to be just objtool becoming confused about some ugly
code, but that code is _also_ actively buggy in a different way, so
let's just fix this all.
What confuses objtool seems to be the stack slot for the uninitialized
'page' variable - for the case where that variable isn't actually used.
There is some shared error handling code that frees the previously
allocated page or xsk buffers depending on previous state.
That code is ugly and worth fixing: just free the page or buffers in the
context where they are actually allocated, not at some common point
where you have to wonder "which one is it I'm supposed to free again?".
That gets rid of the objtool warning, because now gcc doesn't take messy
and incomprehensible source code and turn it into messy and even more
incomprehensible object code any more. No more questionable stack
frames with CFI information that blows objtool's little mind.
But fixing that then makes a real bug more obvious: the freeing of the
xsk buffers is buggy. It frees the buffers that never got mapped:
for (; i < batch; i++)
xsk_buff_free(xdp_buffs[i]);
and that looks sane enough: iterate over the unused part of the batch.
But it's horrendously wrong, because it updates 'i'.
And 'i' isn't some harmless little local loop counter. It's the
variable that is supposed to contain how many buffers have been
successfully mapped. So now that 'free the buffers we didn't map' loop
ends up updating that counter, and after the loop 'i' will be the whole
batch we allocated.
So that loop first freed the buffers that failed to map, and then as a
side effect said "all these buffers I just freed were successfully
mapped" and they would be released to hardware.
So objtool didn't actually find a real bug. It just found code that was
so ugly that it triggered a false positive. And as is often the case
with ugly code: people hadn't understood it either, and it was buggy.
It's worth noting that the code is still ugly. A variable name like 'i'
is perfectly fine for some random anonymous loop iterator that is just
that. But when it has serious meaning outside the loop, you should give
it a serious name that makes sense non-locally.
This does not fix that kind of ugliness. This is just the minimal fix
for the objtool warning and the entirely incidental bug it then
uncovered. They had nothing in common except for the obfuscated C code
contest entry.
Fixes: 48276c08cf5d ("net: dpaa2-eth: AF_XDP RX zero copy support")
Cc: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 28 ++++++++-----------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 6fd478572ef8f..964ec0fcf739d 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -1679,11 +1679,9 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv,
struct device *dev = priv->net_dev->dev.parent;
u64 buf_array[DPAA2_ETH_BUFS_PER_CMD];
struct dpaa2_eth_swa *swa;
- struct page *page;
dma_addr_t addr;
int retries = 0;
int i = 0, err;
- u32 batch;
/* Allocate buffers visible to WRIOP */
if (!ch->xsk_zc) {
@@ -1693,14 +1691,16 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv,
* the entire page except for a tailroom reserved for
* skb shared info
*/
- page = dev_alloc_pages(0);
+ struct page *page = dev_alloc_pages(0);
if (!page)
goto err_alloc;
addr = dma_map_page(dev, page, 0, priv->rx_buf_size,
DMA_BIDIRECTIONAL);
- if (unlikely(dma_mapping_error(dev, addr)))
- goto err_map;
+ if (unlikely(dma_mapping_error(dev, addr))) {
+ __free_pages(page, 0);
+ goto err_alloc;
+ }
buf_array[i] = addr;
@@ -1716,8 +1716,8 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv,
* of DPAA2_ETH_BUFS_PER_CMD. Bail out if the UMEM cannot
* provide enough buffers at the moment
*/
- batch = xsk_buff_alloc_batch(ch->xsk_pool, xdp_buffs,
- DPAA2_ETH_BUFS_PER_CMD);
+ u32 batch = xsk_buff_alloc_batch(ch->xsk_pool, xdp_buffs,
+ DPAA2_ETH_BUFS_PER_CMD);
if (!batch)
goto err_alloc;
@@ -1727,8 +1727,11 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv,
swa->xsk.xdp_buff = xdp_buffs[i];
addr = xsk_buff_xdp_get_frame_dma(xdp_buffs[i]);
- if (unlikely(dma_mapping_error(dev, addr)))
- goto err_map;
+ if (unlikely(dma_mapping_error(dev, addr))) {
+ for (int j = i; j < batch; j++)
+ xsk_buff_free(xdp_buffs[j]);
+ goto err_alloc;
+ }
buf_array[i] = addr;
@@ -1759,13 +1762,6 @@ static int dpaa2_eth_add_bufs(struct dpaa2_eth_priv *priv,
return i;
-err_map:
- if (!ch->xsk_zc) {
- __free_pages(page, 0);
- } else {
- for (; i < batch; i++)
- xsk_buff_free(xdp_buffs[i]);
- }
err_alloc:
/* If we managed to allocate at least some buffers,
* release them to hardware
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 324/703] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (320 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 323/703] net: dpaa2-eth: fix objtool warning and logic bug Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 325/703] tg3: Skip management FW version when APE firmware is not ready Greg Kroah-Hartman
` (85 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rui Salvaterra, Pavan Chebbi,
Simon Horman, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavan Chebbi <pavan.chebbi@broadcom.com>
[ Upstream commit 686b8dbcedf8773dc505f9f315a0551c0bca70a3 ]
Commit 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for
BCM57766 chipsets") lowered the coherent DMA mask to 31 bits as a
workaround for a spurious address overflow error in the hardware.
The result of dma_set_coherent_mask() is fatal to probe, so on
platforms that cannot satisfy such a mask the device fails to probe:
tg3 0000:01:00.0: Unable to obtain 64 bit DMA for consistent allocations
tg3 0000:01:00.0: probe with driver tg3 failed with error -5
This was reported on a Mac mini (Macmini6,2, BCM57766) running a
kernel built without CONFIG_ZONE_DMA and with IOMMU passthrough as
the default. Without CONFIG_ZONE_DMA, dma_direct_supported() only
accepts a mask narrower than 32 bits if it covers the highest
physical memory address, so with direct mapping a 31-bit coherent
mask is rejected whenever memory extends above 2GB.
Treat the 31-bit mask as best effort. If it is refused, warn and fall
back to the mask used before 614f4d166eee, so that the device still
probes. Platforms that accept the mask are unaffected. Where it is
refused, 614f4d166eee never protected the device, it only stopped it
from probing, so this restores the behaviour of kernels before that
commit. Warn when a status block lands at an address matching the
pattern described in 614f4d166eee, so that a resulting TX timeout can
be identified.
Fixes: 614f4d166eee ("tg3: Set coherent DMA mask bits to 31 for BCM57766 chipsets")
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Link: https://lore.kernel.org/netdev/CALjTZvYKHWrD5m+RXimjxODvpFPw7Cq_EOEuzRi1PZT9_JxF+g@mail.gmail.com/
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261118105408.1076095-2-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/tg3.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 897bb86bedb13..662d16bdb5c33 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -8868,6 +8868,13 @@ static int tg3_alloc_consistent(struct tg3 *tp)
if (!tnapi->hw_status)
goto err_out;
+ if (tg3_asic_rev(tp) == ASIC_REV_57766 &&
+ (lower_32_bits(tnapi->status_mapping) & 0xffff0000) ==
+ 0xffff0000)
+ dev_warn(&tp->pdev->dev,
+ "Status block at DMA address %pad may cause TX timeouts on this device\n",
+ &tnapi->status_mapping);
+
sblk = tnapi->hw_status;
if (tg3_flag(tp, ENABLE_RSS)) {
@@ -17701,6 +17708,7 @@ static int tg3_init_one(struct pci_dev *pdev,
u64 dma_mask, persist_dma_mask;
netdev_features_t features = 0;
u8 addr[ETH_ALEN] __aligned(2);
+ u64 test_dma_mask = 0;
err = pci_enable_device(pdev);
if (err) {
@@ -17840,15 +17848,22 @@ static int tg3_init_one(struct pci_dev *pdev,
persist_dma_mask = dma_mask = DMA_BIT_MASK(64);
if (tg3_asic_rev(tp) == ASIC_REV_57766)
- persist_dma_mask = DMA_BIT_MASK(31);
+ test_dma_mask = DMA_BIT_MASK(31);
/* Configure DMA attributes. */
if (dma_mask > DMA_BIT_MASK(32)) {
err = dma_set_mask(&pdev->dev, dma_mask);
if (!err) {
features |= NETIF_F_HIGHDMA;
- err = dma_set_coherent_mask(&pdev->dev,
- persist_dma_mask);
+ if (!test_dma_mask ||
+ dma_set_coherent_mask(&pdev->dev,
+ test_dma_mask)) {
+ if (test_dma_mask)
+ dev_warn(&pdev->dev,
+ "Unable to set 31 bit coherent DMA mask, workaround not applied\n");
+ err = dma_set_coherent_mask(&pdev->dev,
+ persist_dma_mask);
+ }
if (err < 0) {
dev_err(&pdev->dev, "Unable to obtain 64 bit "
"DMA for consistent allocations\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 325/703] tg3: Skip management FW version when APE firmware is not ready
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (321 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 324/703] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 326/703] tg3: Fix heap overflow in unbuffered NVRAM write path Greg Kroah-Hartman
` (84 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pavan Chebbi, Simon Horman,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavan Chebbi <pavan.chebbi@broadcom.com>
[ Upstream commit 70e57e1255e06fd7a22d45dd2bf854200fcbd575 ]
When the APE firmware is not present or not ready, for example when
the NCSI component is missing in the NVRAM, tg3_read_fw_ver() still
calls tg3_read_dash_ver() after tg3_probe_ncsi(). The signature and
ready checks that tg3_read_dash_ver() used to make were moved into
tg3_probe_ncsi(), which only sets the NCSI flag and does not stop the
caller. The driver then reads the APE firmware version register, which
holds no valid data in this state, and ethtool -i shows an invalid
"DASH" string with a garbage version.
Make tg3_probe_ncsi() return whether valid, ready APE firmware was
found, and read the version only in that case. Otherwise just report
the bootcode version.
This was seen by a user on BCM5719/BCM5720 with no NCSI component in
the NVRAM. With this change, ethtool -i displays only the bootcode
version.
Fixes: 165f4d1cb3d7 ("tg3: Fix the setting of the APE_HAS_NCSI flag")
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261118105408.1076095-3-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/tg3.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 662d16bdb5c33..2075d9eb8f367 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -16010,20 +16010,26 @@ static void tg3_read_mgmtfw_ver(struct tg3 *tp)
}
}
-static void tg3_probe_ncsi(struct tg3 *tp)
+/* Returns true if valid, ready APE firmware is present, regardless of
+ * whether it advertises NCSI (it may be DASH or SMASH). Sets APE_HAS_NCSI
+ * if the NCSI feature is advertised.
+ */
+static bool tg3_probe_ncsi(struct tg3 *tp)
{
u32 apedata;
apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG);
if (apedata != APE_SEG_SIG_MAGIC)
- return;
+ return false;
apedata = tg3_ape_read32(tp, TG3_APE_FW_STATUS);
if (!(apedata & APE_FW_STATUS_READY))
- return;
+ return false;
if (tg3_ape_read32(tp, TG3_APE_FW_FEATURES) & TG3_APE_FW_FEATURE_NCSI)
tg3_flag_set(tp, APE_HAS_NCSI);
+
+ return true;
}
static void tg3_read_dash_ver(struct tg3 *tp)
@@ -16102,8 +16108,7 @@ static void tg3_read_fw_ver(struct tg3 *tp)
if (tg3_flag(tp, ENABLE_ASF)) {
if (tg3_flag(tp, ENABLE_APE)) {
- tg3_probe_ncsi(tp);
- if (!vpd_vers)
+ if (tg3_probe_ncsi(tp) && !vpd_vers)
tg3_read_dash_ver(tp);
} else if (!vpd_vers) {
tg3_read_mgmtfw_ver(tp);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 326/703] tg3: Fix heap overflow in unbuffered NVRAM write path
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (322 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 325/703] tg3: Skip management FW version when APE firmware is not ready Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 327/703] net: dsa: tag_brcm: fix link-local detection with a prepended tag Greg Kroah-Hartman
` (83 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shravya KN, Pavan Chebbi,
Simon Horman, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shravya KN <shravya.k-n@broadcom.com>
[ Upstream commit 0323a427052447e2c41c650fc98a6c04bf417e5d ]
tg3_nvram_write_block_unbuffered() reads a whole NVRAM page into a
buffer of pagesize bytes, copies the caller's data into it at page_off,
and writes the page back. The copy size was clamped to pagesize rather
than to the room left in the page, pagesize - page_off, so a write at an
offset that is not page aligned, as ETHTOOL_SEEPROM allows, copies past
the end of the buffer and corrupts the kernel heap.
Clamp size to pagesize - page_off. Also advance buf by size on each
iteration. Without this, a write that spans more than one page
programmed every page after the first with the data of the first page,
and a write that did not start on a page boundary lost the tail of the
data without reporting an error.
Reject an nvram_pagesize that is smaller than 4 or not a power of two.
The page mask is pagesize - 1, which is only a valid mask for a power
of two. A page size of 0, which tg3_get_nvram_info() leaves unset for
an unhandled flash vendor, also made the loop issue erase commands at
address 0 forever with the rtnl and NVRAM locks held. ethtool -E now
fails with -EINVAL in these cases.
This was found by an AI code review scan. It has not been observed on
hardware, but it can be reached with ethtool -E on devices with
unbuffered flash.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Shravya KN <shravya.k-n@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261118105408.1076095-4-pavan.chebbi@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/tg3.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 2075d9eb8f367..f3cdf081c8ab2 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -56,6 +56,7 @@
#include <linux/hwmon-sysfs.h>
#include <linux/crc32.h>
#include <linux/dmi.h>
+#include <linux/log2.h>
#include <net/checksum.h>
#include <net/gso.h>
@@ -3379,6 +3380,9 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
u32 nvram_cmd;
u8 *tmp;
+ if (pagesize < 4 || !is_power_of_2(pagesize))
+ return -EINVAL;
+
tmp = kmalloc(pagesize, GFP_KERNEL);
if (tmp == NULL)
return -ENOMEM;
@@ -3399,13 +3403,14 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
break;
page_off = offset & pagemask;
- size = pagesize;
+ size = pagesize - page_off;
if (len < size)
size = len;
len -= size;
memcpy(tmp + page_off, buf, size);
+ buf += size;
offset = offset + (pagesize - page_off);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 327/703] net: dsa: tag_brcm: fix link-local detection with a prepended tag
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (323 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 326/703] tg3: Fix heap overflow in unbuffered NVRAM write path Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 328/703] perf: Prevent duplicate sigtrap task work enqueue Greg Kroah-Hartman
` (82 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <florian.fainelli@broadcom.com>
[ Upstream commit ae8e5ef9fa9eeaf4ee0a9a9bde0fc63023d9b154 ]
brcm_tag_rcv_ll() checks eth_hdr(skb)->h_dest to avoid marking link-local
frames as forwarded by the switch. With a prepended tag, eth_type_trans()
sets the MAC header at the start of the tag, so the address checked is the
tag plus the first two bytes of the real destination address. Link-local
frames such as BPDUs, LLDP or EAPOL are then not recognized and get
skb->offload_fwd_mark set, which keeps the bridge from forwarding them in
software to the other ports of the switch when it is configured to do so.
Read the destination address after the tag instead when the tag is
prepended. Tags embedded after the source address are not affected.
Fixes: 762e7e174da9 ("net: dsa: tag_brcm: do not mark link local traffic as offloaded")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20261118184004.1916105-1-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/dsa/tag_brcm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index 9d2ea75dcb269..e8c8369b8d65c 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -149,6 +149,7 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb,
unsigned int offset)
{
int source_port;
+ const u8 *dest;
u8 *brcm_tag;
if (unlikely(!pskb_may_pull(skb, BRCM_TAG_LEN)))
@@ -176,7 +177,11 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb,
/* Remove Broadcom tag and update checksum */
skb_pull_rcsum(skb, BRCM_TAG_LEN);
- if (likely(!is_link_local_ether_addr(eth_hdr(skb)->h_dest)))
+ /* With a prepended tag, the MAC header set by eth_type_trans() starts
+ * at the tag, and the destination address follows it.
+ */
+ dest = offset == ETH_HLEN ? brcm_tag + BRCM_TAG_LEN : eth_hdr(skb)->h_dest;
+ if (likely(!is_link_local_ether_addr(dest)))
dsa_default_offload_fwd_mark(skb);
return skb;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 328/703] perf: Prevent duplicate sigtrap task work enqueue
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (324 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 327/703] net: dsa: tag_brcm: fix link-local detection with a prepended tag Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 329/703] perf: Fix sigtrap for software events Greg Kroah-Hartman
` (81 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tengda Wu, Peter Zijlstra (Intel),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tengda Wu <wutengda@huaweicloud.com>
[ Upstream commit e4c5112f01816b0ac6d74724545eca1195788c38 ]
The sigtrap handling in __perf_event_overflow() checks
event->pending_work before calling task_work_add(), but only sets
pending_work after the task work has been queued.
This leaves a window where an NMI can interrupt task_work_add() and
re-enter __perf_event_overflow() for the same (software/tracepoint)
event. Since pending_work is still zero, the nested invocation can
enqueue the same pending_task again.
The re-entrant call path looks like this:
__perf_event_overflow()
task_work_add()
<NMI>
__perf_event_overflow()
task_work_add()
The nested invocation may enqueue pending_task before the outer
invocation does. When the outer invocation resumes, it inserts the
same task work entry again, potentially creating a cycle in the task
work list.
As a result, perf_pending_task() may be executed repeatedly, leading
to unbalanced event reference counting.
Fix this by atomically claiming pending_work with cmpxchg_local()
before calling task_work_add(). This ensures that only one invocation
can enqueue the task work, even when another overflow occurs
re-entrantly from an NMI.
Notably: sigtrap events must be per-task, meaning that the there is no
concurrency, only re-entrancy.
[peterz: clarify and rewrite]
Fixes: c5d93d23a260 ("perf: Enqueue SIGTRAP always via task_work.")
Signed-off-by: Tengda Wu <wutengda@huaweicloud.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/45bd71c976aea1a0e8bf5762dd6b6552e6009439.1795053619.git.wutengda@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/events/core.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index eea5cab38bc81..698444fba7736 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7538,9 +7538,15 @@ static void perf_pending_task(struct callback_head *head)
rctx = perf_swevent_get_recursion_context();
if (event->pending_work) {
- event->pending_work = 0;
perf_sigtrap(event);
local_dec(&event->ctx->nr_no_switch_fast);
+ /*
+ * event->pending_work also acts as a 'lock' for
+ * event->{pending_addr, orig_type, attr.sig_data}. As such we
+ * must clear after perf_sigtrap is complete.
+ */
+ barrier();
+ event->pending_work = 0;
}
put_event(event);
@@ -10635,16 +10641,22 @@ static int __perf_event_overflow(struct perf_event *event,
notify_mode = in_nmi() ? TWA_NMI_CURRENT : TWA_RESUME;
- if (!event->pending_work &&
- !task_work_add(current, &event->pending_task, notify_mode)) {
- event->pending_work = pending_id;
- local_inc(&event->ctx->nr_no_switch_fast);
- WARN_ON_ONCE(!atomic_long_inc_not_zero(&event->refcount));
-
- event->pending_addr = 0;
- if (valid_sample && (data->sample_flags & PERF_SAMPLE_ADDR))
- event->pending_addr = data->addr;
-
+ /*
+ * Software events can nest and attempt this recursively;
+ * claim the pending_work before task_work_add() recurses.
+ */
+ if (cmpxchg_local(&event->pending_work, 0, 1) == 0) {
+ if (!task_work_add(current, &event->pending_task, notify_mode)) {
+ event->pending_work = pending_id;
+ local_inc(&event->ctx->nr_no_switch_fast);
+ WARN_ON_ONCE(!atomic_long_inc_not_zero(&event->refcount));
+
+ event->pending_addr = 0;
+ if (valid_sample && (data->sample_flags & PERF_SAMPLE_ADDR))
+ event->pending_addr = data->addr;
+ } else {
+ event->pending_work = 0;
+ }
} else if (event->attr.exclude_kernel && valid_sample) {
/*
* Should not be able to return to user space without
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 329/703] perf: Fix sigtrap for software events
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (325 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 328/703] perf: Prevent duplicate sigtrap task work enqueue Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 330/703] perf: Fix sigtrap vs fast-switch Greg Kroah-Hartman
` (80 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tengda Wu, Peter Zijlstra (Intel),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 38606d2911f7f2fe80388315da0c4a7fc98af0f8 ]
perf_sigtrap() contains:
WARN_ON_ONCE(event->ctx->task != current)
The warning assumes that an event's ctx->task always matches the task
that ends up running the pending task_work. That assumption can be
broken by the context fast-swap path.
The failure sequence is:
1. A -> B switch, perf_event_context_sched_out() takes the fast path
and does WRITE_ONCE(ctx->task, next) / WRITE_ONCE(next_ctx->task, task).
An NMI then hits while the context is swapped, and
__perf_event_overflow() queues pending task_work on the *current*
task (A), even though the event now belongs to B's swapped-in
context view.
2. B -> A switch. Because A now has pending task_work,
nr_no_switch_fast is non-zero, so the slow path is taken and
ctx->task is *not* swapped back.
3. A returns to user mode, task_work runs perf_pending_task() ->
perf_sigtrap(), and event->ctx->task no longer equals current,
tripping the WARN_ON_ONCE().
The nr_no_switch_fast bits hard rely on perf_pmu_disable() actually working. It
turns out the software events do not implement the pmu::pmu_{dis,en}able()
methods and generally ignore the state, making the above scenario worse in that
an overflow can happen in the middle of swapping task contexts, making it
impossible to reconstruct state.
Ensure software and tracepoint events respect the disable state.
Fixes: ca6c21327c6a ("perf: Fix missing SIGTRAPs")
Fixes: c5d93d23a260 ("perf: Enqueue SIGTRAP always via task_work.")
Reported-by: Tengda Wu <wutengda@huaweicloud.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Tengda Wu <wutengda@huaweicloud.com>
Link: https://patch.msgid.link/20261125161342.GP2669272%40noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/perf_event.h | 1 +
kernel/events/core.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 23444b1b2503b..1dd7a2fcebfc0 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1230,6 +1230,7 @@ extern const struct perf_event_attr *perf_event_attrs(struct perf_event *event);
extern void perf_event_print_debug(void);
extern void perf_pmu_disable(struct pmu *pmu);
extern void perf_pmu_enable(struct pmu *pmu);
+extern bool perf_pmu_enabled(struct pmu *pmu);
extern void perf_sched_cb_dec(struct pmu *pmu);
extern void perf_sched_cb_inc(struct pmu *pmu);
extern int perf_event_task_disable(void);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 698444fba7736..012934ddd9ccc 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1265,6 +1265,12 @@ void perf_pmu_enable(struct pmu *pmu)
pmu->pmu_enable(pmu);
}
+bool perf_pmu_enabled(struct pmu *pmu)
+{
+ int *count = &this_cpc(pmu)->pmu_disable_count;
+ return *count == 0;
+}
+
static void perf_assert_pmu_disabled(struct pmu *pmu)
{
int *count = &this_cpc(pmu)->pmu_disable_count;
@@ -10842,6 +10848,9 @@ static int perf_swevent_match(struct perf_event *event,
struct perf_sample_data *data,
struct pt_regs *regs)
{
+ if (!perf_pmu_enabled(event->pmu))
+ return 0;
+
if (event->attr.type != type)
return 0;
@@ -11222,6 +11231,9 @@ static int perf_tp_event_match(struct perf_event *event,
struct perf_raw_record *raw,
struct pt_regs *regs)
{
+ if (!perf_pmu_enabled(event->pmu))
+ return 0;
+
if (event->hw.state & PERF_HES_STOPPED)
return 0;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 330/703] perf: Fix sigtrap vs fast-switch
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (326 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 329/703] perf: Fix sigtrap for software events Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 331/703] gpio: davinci: use controller-specific MMIO for BINTEN Greg Kroah-Hartman
` (79 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tengda Wu, Peter Zijlstra (Intel),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 34dc983cc1628dea5054baa8687477cbb8683e28 ]
perf_sigtrap() contains:
WARN_ON_ONCE(event->ctx->task != current)
The warning assumes that an event's ctx->task always matches the task
that ends up running the pending task_work. That assumption can be
broken by the context fast-swap path.
The failure sequence is:
1. A -> B switch, perf_event_context_sched_out() takes the fast path
and does WRITE_ONCE(ctx->task, next) / WRITE_ONCE(next_ctx->task, task).
An NMI then hits while the context is swapped, and
__perf_event_overflow() queues pending task_work on the *current*
task (A), even though the event now belongs to B's swapped-in
context view.
2. B -> A switch. Because A now has pending task_work,
nr_no_switch_fast is non-zero, so the slow path is taken and
ctx->task is *not* swapped back.
3. A returns to user mode, task_work runs perf_pending_task() ->
perf_sigtrap(), and event->ctx->task no longer equals current,
tripping the WARN_ON_ONCE().
Therefore; the task_work_add() should in fact use event->ctx->task, rather than
current. They are always the same, except in this narrow window between
perf_event_task_sched_out() and switch_to().
Fixes: c5d93d23a260 ("perf: Enqueue SIGTRAP always via task_work.")
Reported-by: Tengda Wu <wutengda@huaweicloud.com>
Tested-by: Tengda Wu <wutengda@huaweicloud.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20261125161342.GP2669272%40noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 012934ddd9ccc..ff9752ff8ff82 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10652,7 +10652,7 @@ static int __perf_event_overflow(struct perf_event *event,
* claim the pending_work before task_work_add() recurses.
*/
if (cmpxchg_local(&event->pending_work, 0, 1) == 0) {
- if (!task_work_add(current, &event->pending_task, notify_mode)) {
+ if (!task_work_add(event->ctx->task, &event->pending_task, notify_mode)) {
event->pending_work = pending_id;
local_inc(&event->ctx->nr_no_switch_fast);
WARN_ON_ONCE(!atomic_long_inc_not_zero(&event->refcount));
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 331/703] gpio: davinci: use controller-specific MMIO for BINTEN
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (327 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 330/703] perf: Fix sigtrap vs fast-switch Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 332/703] gpio: mvebu: validate ngpios before use Greg Kroah-Hartman
` (78 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Sahaj Chaudhari,
Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sahaj Chaudhari <sahaj123.sc@gmail.com>
[ Upstream commit a142f1c5de4b9c03910cc304a26fbbdef69ca422 ]
The file-global gpio_base can be overwritten when probes for multiple
DaVinci GPIO controllers overlap. The later IRQ setup can then write the
BINTEN register of a different controller.
Derive the BINTEN address from the current controller's mapped bank
instead of shared global state.
Fixes: 118150f22d6b ("gpio: davinci: move to platform device")
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Sahaj Chaudhari <sahaj123.sc@gmail.com>
Link: https://patch.msgid.link/20261124121500.2cd5cbf30f89-2-sahaj123.sc@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-davinci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 80b3b36cf703a..bf9bb081c595a 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -42,7 +42,6 @@ typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
-static void __iomem *gpio_base;
static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0};
struct davinci_gpio_irq_data {
@@ -151,6 +150,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
unsigned int ngpio, nbank, nirq, gpio_unbanked;
struct davinci_gpio_controller *chips;
struct device *dev = &pdev->dev;
+ void __iomem *gpio_base;
/*
* The gpio banks conceptually expose a segmented bitmap,
@@ -570,7 +570,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
* BINTEN -- per-bank interrupt enable. genirq would also let these
* bits be set/cleared dynamically.
*/
- writel_relaxed(binten, gpio_base + BINTEN);
+ writel_relaxed(binten, chips->regs[0] - offset_array[0] + BINTEN);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 332/703] gpio: mvebu: validate ngpios before use
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (328 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 331/703] gpio: davinci: use controller-specific MMIO for BINTEN Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 333/703] ASoC: aw88399: fix register used to disable I2S TX Greg Kroah-Hartman
` (77 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 62a41997c1553b723a7a333c0246d0646ebd2c95 ]
If ngpios is read as 0 from device tree, it is passed via
irq_alloc_domain_generic_chips() as irqs_per_chip, which leads to a
division by zero in DIV_ROUND_UP(d->revmap_size, irqs_per_chip).
Reject ngpios == 0 early.
Also reject higher than 32, which is the limit.
Fixes: fefe7b0923459 ("gpio: introduce gpio-mvebu driver for Marvell SoCs")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20261126002650.603321-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mvebu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 7ad2b1fe95d5e..689eb0f7d397a 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -1186,6 +1186,9 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
return -ENODEV;
}
+ if (ngpios == 0 || ngpios > MVEBU_MAX_GPIO_PER_BANK)
+ return dev_err_probe(&pdev->dev, -EINVAL, "ngpios must be between 1 and 32\n");
+
id = of_alias_get_id(pdev->dev.of_node, "gpio");
if (id < 0) {
dev_err(&pdev->dev, "Couldn't get OF id\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 333/703] ASoC: aw88399: fix register used to disable I2S TX
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (329 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 332/703] gpio: mvebu: validate ngpios before use Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 334/703] bpf: Reject kernel threads in bpf_task_work_schedule() Greg Kroah-Hartman
` (76 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Marco Giunta, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Giunta <marco_giunta@outlook.it>
[ Upstream commit 1e5a677a5c53b96abf8004cc4d7ba0387f4e8505 ]
aw_dev_i2s_tx_enable() uses I2SCTRL3 when enabling the I2S transmitter
but I2SCFG1 when disabling it. Per the datasheet, the I2STXEN bit lives
in I2SCTRL3.
As a result, the I2S transmitter is never disabled when the device is
stopped.
Use I2SCTRL3 in both cases, as the vendor Android driver (aw883xx) and
aw88166 (which is also derived from aw883xx) do.
Fixes: 8ade6cc7e261 ("ASoC: codecs: Add aw88399 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
Link: https://patch.msgid.link/SN6PR19MB23038B66A212CA32A4B6B3CCFC472@SN6PR19MB2303.namprd19.prod.outlook.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/aw88399-lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/aw88399-lib.c b/sound/soc/codecs/aw88399-lib.c
index 7d4d701083376..fd384330e1d0d 100644
--- a/sound/soc/codecs/aw88399-lib.c
+++ b/sound/soc/codecs/aw88399-lib.c
@@ -561,7 +561,7 @@ static void aw_dev_i2s_tx_enable(struct aw_device *aw_dev, bool flag)
ret = regmap_update_bits(aw_dev->regmap, AW88399_I2SCTRL3_REG,
~AW88399_I2STXEN_MASK, AW88399_I2STXEN_ENABLE_VALUE);
else
- ret = regmap_update_bits(aw_dev->regmap, AW88399_I2SCFG1_REG,
+ ret = regmap_update_bits(aw_dev->regmap, AW88399_I2SCTRL3_REG,
~AW88399_I2STXEN_MASK, AW88399_I2STXEN_DISABLE_VALUE);
if (ret)
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 334/703] bpf: Reject kernel threads in bpf_task_work_schedule()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (330 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 333/703] ASoC: aw88399: fix register used to disable I2S TX Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 335/703] bpf, sockmap: Clear the redirect target after the stream parser runs Greg Kroah-Hartman
` (75 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sechang Lim, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sechang Lim <rhkrqnwk98@gmail.com>
[ Upstream commit 3c625090b46b0d683112465a07d95bf5ff71174f ]
bpf_task_work_schedule_signal() on a kernel thread sets
TIF_NOTIFY_SIGNAL, but the thread never returns to user space, so
nothing clears it and signal_pending() stays true. Interruptible sleeps
in the thread return immediately.
For kthreadd this means spinning at 100% CPU. io_ring_exit_work() waits
on ctx->ref_comp interruptibly, assuming a kworker gets no signals. If a
prog running in that kworker schedules task work on current, the wait
returns -ERESTARTSYS and the ctx is freed while ctx->refs is still
switching to atomic:
WARNING: lib/percpu-refcount.c:114 at __percpu_ref_exit+0x77/0x110
Workqueue: iou_exit io_ring_exit_work
...
BUG: KASAN: slab-use-after-free in rcu_cblist_dequeue+0xd3/0x120
The callback can't run before the thread exits anyway. Reject kernel
threads with -EPERM, as bpf_send_signal() does.
Fixes: 38aa7003e369 ("bpf: task work scheduling kfuncs")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261126053016.1145482-1-rhkrqnwk98@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/helpers.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index d1cd4f301f05b..fe1082782962d 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -4228,6 +4228,9 @@ static int bpf_task_work_schedule(struct task_struct *task, struct bpf_task_work
BTF_TYPE_EMIT(struct bpf_task_work);
+ if (task->flags & PF_KTHREAD)
+ return -EPERM;
+
prog = bpf_prog_inc_not_zero(aux->prog);
if (IS_ERR(prog))
return -EBADF;
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 335/703] bpf, sockmap: Clear the redirect target after the stream parser runs
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (331 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 334/703] bpf: Reject kernel threads in bpf_task_work_schedule() Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 336/703] block: fix BLKSECDISCARD zero-length range causing page cache invalidation Greg Kroah-Hartman
` (74 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sechang Lim, Alexei Starovoitov,
Jiayuan Chen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sechang Lim <rhkrqnwk98@gmail.com>
[ Upstream commit 14f6b10422d640695803c621687f790f6f3d2401 ]
A stream parser can call bpf_sk_redirect_{map,hash}(), which store the
target socket in skb->_sk_redir. sk_psock_strp_parse() never clears it,
and it shares storage with skb->_skb_refdst, so skb_dst_drop() later
passes the socket to dst_release():
KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f]
RIP: 0010:percpu_counter_add_batch+0x24/0x220
Call Trace:
dst_release.part.0+0xc9/0x180
skb_release_head_state+0x1cc/0x2f0
sk_skb_reason_drop+0xbc/0x420
strp_done+0xcf/0x150
sk_psock_destroy+0x85e/0xb10
Drop the dst before the parser runs, as the verdict paths do, and clear
the redirect after it. The parser's redirect was never used.
Fixes: e3526bb92a20 ("skmsg: Move sk_redir from TCP_SKB_CB to skb")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261126101950.1682160-1-rhkrqnwk98@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skmsg.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 9cc738b94209d..04cd168f919bb 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -1156,7 +1156,9 @@ static int sk_psock_strp_parse(struct strparser *strp, struct sk_buff *skb)
prog = READ_ONCE(psock->progs.stream_parser);
if (likely(prog)) {
skb->sk = psock->sk;
+ skb_dst_drop(skb);
ret = bpf_prog_run_pin_on_cpu(prog, skb);
+ skb_bpf_redirect_clear(skb);
skb->sk = NULL;
}
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 336/703] block: fix BLKSECDISCARD zero-length range causing page cache invalidation
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (332 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 335/703] bpf, sockmap: Clear the redirect target after the stream parser runs Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 337/703] drm/gud: avoid divide error in gud_stats_debugfs Greg Kroah-Hartman
` (73 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zizhi Wo, Yu Kuai, Christoph Hellwig,
Bart Van Assche, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <wozizhi@huawei.com>
[ Upstream commit aea1c2ec03b399434ff1bafbb2f0d5076f74ce03 ]
Commit 697ba0b6ec4a ("block: fix integer overflow in BLKSECDISCARD") fixed
the start+len overflow via check_add_overflow() but did not handle the
start=0, len=0 case. There, start + len = 0, so end = 0 passes all checks,
and truncate_bdev_range()->truncate_inode_pages_range() is then called with
lend=UINT64_MAX, whitch is the "truncate to the end of file" sentinel, so
the entire page cache is invalidated.
Fix this by replacing the validation with blk_validate_byte_range(), which
already rejects a zero-length range and is what BLKDISCARD uses. This also
switches the alignment check from a hardcoded 512 to
bdev_logical_block_size().
Fixes: 0bd1ed4860d0 ("block: pass inclusive 'lend' parameter to truncate_inode_pages_range")
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20261102080420.3774409-1-wozizhi@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/ioctl.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/block/ioctl.c b/block/ioctl.c
index 73ba266948f3c..8d043b5cd22e1 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -183,8 +183,7 @@ static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode,
static int blk_ioctl_secure_erase(struct block_device *bdev, blk_mode_t mode,
void __user *argp)
{
- uint64_t start, len, end;
- uint64_t range[2];
+ uint64_t range[2], start, len;
int err;
if (!(mode & BLK_OPEN_WRITE))
@@ -196,15 +195,13 @@ static int blk_ioctl_secure_erase(struct block_device *bdev, blk_mode_t mode,
start = range[0];
len = range[1];
- if ((start & 511) || (len & 511))
- return -EINVAL;
- if (check_add_overflow(start, len, &end) ||
- end > bdev_nr_bytes(bdev))
- return -EINVAL;
+ err = blk_validate_byte_range(bdev, start, len);
+ if (err)
+ return err;
inode_lock(bdev->bd_mapping->host);
filemap_invalidate_lock(bdev->bd_mapping);
- err = truncate_bdev_range(bdev, mode, start, end - 1);
+ err = truncate_bdev_range(bdev, mode, start, start + len - 1);
if (!err)
err = blkdev_issue_secure_erase(bdev, start >> 9, len >> 9,
GFP_KERNEL);
--
2.53.0
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 337/703] drm/gud: avoid divide error in gud_stats_debugfs
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (333 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 336/703] block: fix BLKSECDISCARD zero-length range causing page cache invalidation Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 338/703] drm/i915/display: Flush the fbdev frontbuffer Greg Kroah-Hartman
` (72 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bin Yu, Cheng Wen, YuanZhe Liu,
Ruben Wauters
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit 431c2dffd2b7c1240a6e579f0c74104cd2e17329 upstream.
gud_stats_debugfs() computes the compression ratio by dividing the
accumulated uncompressed length by stats_actual_length. That counter is
zero until the first framebuffer flush has completed, so reading the
stats debugfs file on a display which negotiates LZ4 compression raises
a divide error before any frame has been sent. The wrap-around reset in
gud_flush_rect() also clears the counter for a moment, which a
concurrent read can observe.
Copy the counter into a local variable and skip the ratio computation
when it is zero.
Fixes: 40e1a70b4aed ("drm: Add GUD USB Display driver")
Cc: stable@vger.kernel.org
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Acked-by: Ruben Wauters <rubenru09@aol.com>
Link: https://patch.msgid.link/20261029073311.14556-1-25031212351@stu.xidian.edu.cn
Signed-off-by: Ruben Wauters <rubenru09@aol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/gud/gud_drv.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/gud/gud_drv.c
+++ b/drivers/gpu/drm/gud/gud_drv.c
@@ -329,10 +329,17 @@ static int gud_stats_debugfs(struct seq_
seq_puts(m, "\n");
if (gdrm->compression) {
+ u64 actual_length = gdrm->stats_actual_length;
u64 remainder;
- u64 ratio = div64_u64_rem(gdrm->stats_length, gdrm->stats_actual_length,
- &remainder);
- u64 ratio_frac = div64_u64(remainder * 10, gdrm->stats_actual_length);
+ u64 ratio, ratio_frac;
+
+ if (!actual_length) {
+ seq_puts(m, "Compression ratio: n/a\n");
+ return 0;
+ }
+
+ ratio = div64_u64_rem(gdrm->stats_length, actual_length, &remainder);
+ ratio_frac = div64_u64(remainder * 10, actual_length);
seq_printf(m, "Compression ratio: %llu.%llu\n", ratio, ratio_frac);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 338/703] drm/i915/display: Flush the fbdev frontbuffer
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (334 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 337/703] drm/gud: avoid divide error in gud_stats_debugfs Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 339/703] drm/i915/dp_aux: Take the TypeC port lock after the PPS lock Greg Kroah-Hartman
` (71 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maarten Lankhorst,
Jouni Högander, Mika Kahola, Joonas Lahtinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <jouni.hogander@intel.com>
commit f1f5942c3fdac3bb553d0019f60d11ca35f9b836 upstream.
fbdev invalidates on set_par, blank, pan_display and restore, but never
flushes. On i915, unrelated rendering may clear the bits; Xe has no
ORIGIN_CS invalidation, so PSR and FBC can remain disabled indefinitely.
Flush after these operations; they are already complete.
Fixes: 44e694958b95 ("drm/xe/display: Implement display support")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patch.msgid.link/20261102100051.272137-5-jouni.hogander@intel.com
(cherry picked from commit ab965cbc781e4f4f8f81e48d01e0a0d78c94d369)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/i915/display/intel_fbdev.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -76,9 +76,10 @@ static struct intel_frontbuffer *to_fron
return ifbdev->fb->frontbuffer;
}
-static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
+/* The console operation has already completed, hence flush not invalidate. */
+static void intel_fbdev_flush(struct intel_fbdev *ifbdev)
{
- intel_frontbuffer_invalidate(to_frontbuffer(ifbdev), ORIGIN_CPU);
+ intel_frontbuffer_flush(to_frontbuffer(ifbdev), ORIGIN_CPU);
}
FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(intel_fbdev,
@@ -92,7 +93,7 @@ static int intel_fbdev_set_par(struct fb
ret = drm_fb_helper_set_par(info);
if (ret == 0)
- intel_fbdev_invalidate(ifbdev);
+ intel_fbdev_flush(ifbdev);
return ret;
}
@@ -104,7 +105,7 @@ static int intel_fbdev_blank(int blank,
ret = drm_fb_helper_blank(blank, info);
if (ret == 0)
- intel_fbdev_invalidate(ifbdev);
+ intel_fbdev_flush(ifbdev);
return ret;
}
@@ -117,7 +118,7 @@ static int intel_fbdev_pan_display(struc
ret = drm_fb_helper_pan_display(var, info);
if (ret == 0)
- intel_fbdev_invalidate(ifbdev);
+ intel_fbdev_flush(ifbdev);
return ret;
}
@@ -182,7 +183,7 @@ static void intelfb_restore(struct drm_f
{
struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper);
- intel_fbdev_invalidate(ifbdev);
+ intel_fbdev_flush(ifbdev);
}
static void intelfb_set_suspend(struct drm_fb_helper *fb_helper, bool suspend)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 339/703] drm/i915/dp_aux: Take the TypeC port lock after the PPS lock
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (335 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 338/703] drm/i915/display: Flush the fbdev frontbuffer Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 340/703] drm/i915/pps: Hold a TypeC link reference for PPS VDD Greg Kroah-Hartman
` (70 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mika Kahola, Imre Deak,
Joonas Lahtinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <imre.deak@intel.com>
commit 5a3ffd06d47d3a7694288327855d6faff42ec3c0 upstream.
An upcoming change will need to acquire a TypeC port link reference
along with an AUX power domain reference when enabling PPS VDD for the
port during an AUX transfer. Acquiring the link reference requires
holding the TypeC port lock.
To allow the PPS VDD code to take this lock itself, acquire the TypeC
port lock in the AUX transfer function only after locking PPS and
enabling VDD.
CC: stable@vger.kernel.org # 6.14+
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20261029113017.618286-2-imre.deak@intel.com
(cherry picked from commit 86fabed8d8cf7db734a9a3f63af5f500cf0ed139)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/i915/display/intel_dp_aux.c | 39 +++++++++++++---------------
1 file changed, 19 insertions(+), 20 deletions(-)
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -256,22 +256,6 @@ intel_dp_aux_xfer(struct intel_dp *intel
for (i = 0; i < ARRAY_SIZE(ch_data); i++)
ch_data[i] = intel_dp->aux_ch_data_reg(intel_dp, i);
- intel_digital_port_lock(encoder);
- /*
- * Abort transfers on a disconnected port as required by
- * DP 1.4a link CTS 4.2.1.5, also avoiding the long AUX
- * timeouts that would otherwise happen.
- */
- if (!intel_dp_is_edp(intel_dp) &&
- !intel_digital_port_connected_locked(&dig_port->base)) {
- ret = -ENXIO;
- goto out_unlock;
- }
-
- aux_domain = intel_aux_power_domain(dig_port);
-
- aux_wakeref = intel_display_power_get(display, aux_domain);
-
/*
* The PPS state needs to be locked for:
* - eDP on all platforms, since AUX transfers on eDP need VDD power
@@ -294,6 +278,21 @@ intel_dp_aux_xfer(struct intel_dp *intel
*/
vdd = intel_pps_vdd_on_unlocked(intel_dp);
+ intel_digital_port_lock(encoder);
+ /*
+ * Abort transfers on a disconnected port as required by
+ * DP 1.4a link CTS 4.2.1.5, also avoiding the long AUX
+ * timeouts that would otherwise happen.
+ */
+ if (!intel_dp_is_edp(intel_dp) &&
+ !intel_digital_port_connected_locked(&dig_port->base)) {
+ ret = -ENXIO;
+ goto out_unlock;
+ }
+
+ aux_domain = intel_aux_power_domain(dig_port);
+ aux_wakeref = intel_display_power_get(display, aux_domain);
+
/*
* dp aux is extremely sensitive to irq latency, hence request the
* lowest possible wakeup latency and so prevent the cpu from going into
@@ -439,16 +438,16 @@ done:
out:
cpu_latency_qos_update_request(&intel_dp->pm_qos, PM_QOS_DEFAULT_VALUE);
+ intel_display_power_put_async(display, aux_domain, aux_wakeref);
+out_unlock:
+ intel_digital_port_unlock(encoder);
+
if (vdd)
intel_pps_vdd_off_unlocked(intel_dp, false);
if (pps_wakeref)
intel_pps_unlock(intel_dp, pps_wakeref);
- intel_display_power_put_async(display, aux_domain, aux_wakeref);
-out_unlock:
- intel_digital_port_unlock(encoder);
-
return ret;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 340/703] drm/i915/pps: Hold a TypeC link reference for PPS VDD
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (336 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 339/703] drm/i915/dp_aux: Take the TypeC port lock after the PPS lock Greg Kroah-Hartman
@ 2026-12-04 10:03 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 341/703] drm/i915/pps: Reset PPS state after TypeC port init on resume Greg Kroah-Hartman
` (69 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:03 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mika Kahola, Imre Deak,
Joonas Lahtinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <imre.deak@intel.com>
commit 2e28d9e416d3e9cfd3cb90addc2b0107fa000c33 upstream.
On TypeC ports, the AUX power domain reference held for PPS VDD requires
the TypeC mode to remain unchanged. Hold a TypeC link reference for the
lifetime of the PPS VDD power reference.
This prepares for an upcoming change that will use the TypeC port type
for eDP on TypeC ports. Allow the additional PPS link reference when
sanitizing the TypeC mode.
CC: stable@vger.kernel.org # 6.14+
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20261029113017.618286-3-imre.deak@intel.com
(cherry picked from commit 3e2444989824139e342aa9affd10cd920255aabc)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/i915/display/intel_pps.c | 14 ++++++++++++++
drivers/gpu/drm/i915/display/intel_tc.c | 9 +++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/i915/display/intel_pps.c
+++ b/drivers/gpu/drm/i915/display/intel_pps.c
@@ -23,6 +23,7 @@
#include "intel_pps.h"
#include "intel_pps_regs.h"
#include "intel_quirks.h"
+#include "intel_tc.h"
static void vlv_steal_power_sequencer(struct intel_display *display,
enum pipe pipe);
@@ -761,6 +762,9 @@ bool intel_pps_vdd_on_unlocked(struct in
if (edp_have_panel_vdd(intel_dp))
return need_to_disable;
+ if (intel_encoder_is_tc(&dig_port->base))
+ intel_tc_port_get_link(dig_port, 1);
+
drm_WARN_ON(display->drm, intel_dp->pps.vdd_wakeref);
intel_dp->pps.vdd_wakeref = intel_display_power_get(display,
intel_aux_power_domain(dig_port));
@@ -868,6 +872,9 @@ static void intel_pps_vdd_off_sync_unloc
intel_display_power_put(display,
intel_aux_power_domain(dig_port),
fetch_and_zero(&intel_dp->pps.vdd_wakeref));
+
+ if (intel_encoder_is_tc(&dig_port->base))
+ intel_tc_port_put_link(dig_port);
}
void intel_pps_vdd_off_sync(struct intel_dp *intel_dp)
@@ -1077,6 +1084,9 @@ void intel_pps_off_unlocked(struct intel
intel_display_power_put(display,
intel_aux_power_domain(dig_port),
fetch_and_zero(&intel_dp->pps.vdd_wakeref));
+
+ if (intel_encoder_is_tc(&dig_port->base))
+ intel_tc_port_put_link(dig_port);
}
void intel_pps_off(struct intel_dp *intel_dp)
@@ -1354,6 +1364,10 @@ static void pps_vdd_init(struct intel_dp
"[ENCODER:%d:%s] %s VDD left on by BIOS, adjusting state tracking\n",
dig_port->base.base.base.id, dig_port->base.base.name,
pps_name(intel_dp));
+
+ if (intel_encoder_is_tc(&dig_port->base))
+ intel_tc_port_get_link(dig_port, 1);
+
drm_WARN_ON(display->drm, intel_dp->pps.vdd_wakeref);
intel_dp->pps.vdd_wakeref = intel_display_power_get(display,
intel_aux_power_domain(dig_port));
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -1676,7 +1676,7 @@ void intel_tc_port_sanitize_mode(struct
mutex_lock(&tc->lock);
- drm_WARN_ON(display->drm, tc->link_refcount != 1);
+ drm_WARN_ON(display->drm, tc->link_refcount < 1);
if (!tc_port_has_active_streams(tc, crtc_state)) {
/*
* TBT-alt is the default mode in any case the PHY ownership is not
@@ -1690,7 +1690,12 @@ void intel_tc_port_sanitize_mode(struct
"Port %s: PHY left in %s mode on disabled port, disconnecting it\n",
tc->port_name,
tc_port_mode_name(tc->init_mode));
- tc_phy_disconnect(tc);
+ /*
+ * A link reference taken during a preceding (eDP) connector initialization will be
+ * dropped later, also disconnecting the PHY.
+ */
+ if (tc->link_refcount == 1)
+ tc_phy_disconnect(tc);
__intel_tc_port_put_link(tc);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 341/703] drm/i915/pps: Reset PPS state after TypeC port init on resume
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (337 preceding siblings ...)
2026-12-04 10:03 ` [PATCH 6.18 340/703] drm/i915/pps: Hold a TypeC link reference for PPS VDD Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 342/703] drm/i915/ptl+: Add TypeC HPD pin selection for port B Greg Kroah-Hartman
` (68 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mika Kahola, Imre Deak,
Joonas Lahtinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <imre.deak@intel.com>
commit af8b4d4817678a255ee310dbca983193cc09a075 upstream.
Resetting the PPS state involves acquiring an AUX power domain
reference. On TypeC ports, the AUX power domain depends on the TypeC
mode of the port using the PPS.
An upcoming change will set the port/PHY type to TypeC for eDP ports on
PTL+ platforms with an eDP DDI mapped to a TypeC PHY. Prepare for this by
resetting the PPS state on resume only after initializing the port's
TypeC mode.
CC: stable@vger.kernel.org # 6.14+
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20261029113017.618286-4-imre.deak@intel.com
(cherry picked from commit 43eb42b332fe48ab8649bd5e4e0ef351473d8a4a)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/i915/display/intel_ddi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4611,10 +4611,10 @@ static void intel_ddi_encoder_reset(stru
intel_dp->reset_link_params = true;
intel_dp_invalidate_source_oui(intel_dp);
- intel_pps_encoder_reset(intel_dp);
-
if (intel_encoder_is_tc(&dig_port->base))
intel_tc_port_init_mode(dig_port);
+
+ intel_pps_encoder_reset(intel_dp);
}
static int intel_ddi_encoder_late_register(struct drm_encoder *_encoder)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 342/703] drm/i915/ptl+: Add TypeC HPD pin selection for port B
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (338 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 341/703] drm/i915/pps: Reset PPS state after TypeC port init on resume Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 343/703] drm/meson: encoder_dsi: load ENCL gamma table while ENCL is disabled Greg Kroah-Hartman
` (67 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mika Kahola, Imre Deak,
Joonas Lahtinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <imre.deak@intel.com>
commit 899f7dc007391b8e3fd514b30645cdb263970db3 upstream.
Handle the TypeC PHY on port B case while mapping the port to an HPD
pin. This prepares for an upcoming change that will set port B's PHY
type to TypeC on PTL+ platforms with an eDP panel connected to a TypeC
PHY.
Keep the existing port >= PORT_TC1 case and its HPD pin mapping for
DG2, where PORT_TC1 has a non-TypeC PHY.
CC: stable@vger.kernel.org # 6.14+
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20261029113017.618286-5-imre.deak@intel.com
(cherry picked from commit 0f35ced2b44db21527cdb80065e80693fb0ab563)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/i915/display/intel_ddi.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4918,6 +4918,8 @@ static enum hpd_pin xelpd_hpd_pin(struct
return HPD_PORT_D + port - PORT_D_XELPD;
else if (port >= PORT_TC1)
return HPD_PORT_TC1 + port - PORT_TC1;
+ else if (intel_phy_is_tc(display, intel_port_to_phy(display, port)))
+ return HPD_PORT_TC1 + intel_port_to_tc(display, port) - TC_PORT_1;
else
return HPD_PORT_A + port - PORT_A;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 343/703] drm/meson: encoder_dsi: load ENCL gamma table while ENCL is disabled
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (339 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 342/703] drm/i915/ptl+: Add TypeC HPD pin selection for port B Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 344/703] drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit) (attempt 2) Greg Kroah-Hartman
` (66 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, John Williams, Shigeaki Asai,
Neil Armstrong
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeaki Asai <y-asai.0816@docomonet.jp>
commit 0cb7f6d9e4b1d0a411b628ccf78695ad41c66570 upstream.
meson_encoder_dsi_atomic_enable() programmed the ENCL gamma LUT right
after meson_venc_mipi_dsi_mode_set(), i.e. while the ENCL timing
generator was already running (ENCL_VIDEO_EN=1). Writing the LUT
during active video stalls the hardware: L_GAMMA_CNTL_PORT
WR_RDY/ADR_RDY deassert and the ENCL line counter (ENCL_INFO_READ)
freezes, so every remaining write times out (~8s total at boot) and
the panel ends up with a corrupted gamma table (wrong colors).
Instrumented boots on the ODROID-GO Ultra (S922X) show:
failing: start: VIDEO_EN=1 INFO 0000001a->002d0000 GAMMA_CNTL=00000030
stall: INFO 002d0000->002d0000 GAMMA_CNTL=00000000
(VID_CLK_CNTL2 / VIID_CLK_CNTL / VIID_CLK_DIV unchanged,
i.e. the ENCL clock is still running)
fixed: start: VIDEO_EN=0 INFO 00000000->00000000 GAMMA_CNTL=00000030
no stall, no timeout
Whether it failed depended only on timing, which is why enabling
lock debugging (LOCKDEP etc.) appeared to "fix" it most of the time.
It happens regardless of the bootloader (mainline or Hardkernel vendor
U-Boot).
The function already writes ENCL_VIDEO_EN=0 right afterwards before
re-enabling the encoder, so simply move meson_encl_load_gamma() after
that write. This matches the order used by the vendor U-Boot's own LCD
driver, which never times out.
Tested on the ODROID-GO Ultra with mainline U-Boot: 5 cold boots +
3 warm reboots, no timeouts, correct colors, LOCKDEP disabled.
Fixes: 42dcf15f901c ("drm/meson: add DSI encoder")
Cc: stable@vger.kernel.org
Tested-by: John Williams <porschemad911@gmail.com>
Signed-off-by: Shigeaki Asai <y-asai.0816@docomonet.jp>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20261004-meson-gamma-v1-1-6347558e2bb3@docomonet.jp
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/meson/meson_encoder_dsi.c
+++ b/drivers/gpu/drm/meson/meson_encoder_dsi.c
@@ -66,9 +66,9 @@ static void meson_encoder_dsi_atomic_ena
/* ENCL clock setup is handled by CCF */
meson_venc_mipi_dsi_mode_set(priv, &crtc_state->adjusted_mode);
- meson_encl_load_gamma(priv);
writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN));
+ meson_encl_load_gamma(priv);
writel_bits_relaxed(ENCL_VIDEO_MODE_ADV_VFIFO_EN, ENCL_VIDEO_MODE_ADV_VFIFO_EN,
priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 344/703] drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit) (attempt 2)
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (340 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 343/703] drm/meson: encoder_dsi: load ENCL gamma table while ENCL is disabled Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 345/703] drm/nouveau/gsp: only handle GSP interrupts routed to the host Greg Kroah-Hartman
` (65 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ruben Wauters, Lyude Paul,
Dave Airlie
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <airlied@redhat.com>
commit ed7fb901fce31588bd12ab95adc36ebcb51bc8ea upstream.
commit 604826acb3f5 attempted to add these flags but
commit 6c65db809796 reverted it due to it
failing on hw from pre-atomic times.
So use a second set of functions.
original commit msg from Lyude:
"Apparently we never actually filled these in, despite the fact that we do
in fact technically support atomic modesetting.
Since not having these filled in causes us to potentially forget to disable
fbdev and friends during suspend/resume, let's fix it."
Reported-by: Ruben Wauters <rubenru09@aol.com>
Closes: https://gitlab.freedesktop.org/drm/nouveau/-/work_items/517
Fixes: 6c65db809796 ("Revert "drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit)"")
Cc: stable@vger.kernel.org
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patch.msgid.link/20261111-nouveau-atomic-fix-v1-1-118e65d3a2f5@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/nouveau/nouveau_display.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -353,6 +353,11 @@ static const struct drm_mode_config_func
.fb_create = nouveau_user_framebuffer_create,
};
+static const struct drm_mode_config_funcs nouveau_mode_config_funcs_atomic = {
+ .fb_create = nouveau_user_framebuffer_create,
+ .atomic_commit = drm_atomic_helper_commit,
+ .atomic_check = drm_atomic_helper_check,
+};
struct nouveau_drm_prop_enum_list {
u8 gen_mask;
@@ -653,7 +658,11 @@ nouveau_display_create(struct drm_device
drm_mode_create_scaling_mode_property(dev);
drm_mode_create_dvi_i_properties(dev);
- dev->mode_config.funcs = &nouveau_mode_config_funcs;
+ /* this only gets set if the driver has the ATOMIC flag */
+ if (drm_drv_uses_atomic_modeset(dev))
+ dev->mode_config.funcs = &nouveau_mode_config_funcs_atomic;
+ else
+ dev->mode_config.funcs = &nouveau_mode_config_funcs;
dev->mode_config.min_width = 0;
dev->mode_config.min_height = 0;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 345/703] drm/nouveau/gsp: only handle GSP interrupts routed to the host
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (341 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 344/703] drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit) (attempt 2) Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 346/703] drm/nouveau: do not return early from a synchronous VM_BIND Greg Kroah-Hartman
` (64 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joe Finzel, Dave Airlie
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Finzel <joe@sudmix.de>
commit 54d3ff1b5ac08d0e28029b93a1719ddd9ff670a4 upstream.
The GSP's interrupt handler takes every pending interrupt the RISC-V
IRQMASK enables as its own, without looking at IRQDEST, which says
whether an interrupt goes to the host or to the GSP itself. One that
belongs to GSP-RM, pending when the host's handler runs for the message
queue, is reported as unknown, cleared and masked off with IRQMCLR,
taking it away from the firmware:
nouveau 0000:01:00.0: gsp: intr 00040000
NVIDIA's driver reads the interrupts routed to the host as
IRQSTAT & IRQMASK & IRQDEST (kflcnRiscvReadIntrStatus_TU102() and
_GA102()). Do the same, with IRQDEST from NVIDIA's register headers
next to IRQMASK on each falcon.
Seen once in a few boots on an RTX 3070 Ti (GA104, GSP-RM 570.144),
before the login prompt. There IRQMASK reads 0x01049042 and IRQDEST
0x01000040: 0x00040000 is enabled but routed to the GSP.
Fixes: 830531e94712 ("drm/nouveau/gsp/r535: add interrupt handling")
Cc: stable@vger.kernel.org
Signed-off-by: Joe Finzel <joe@sudmix.de>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patch.msgid.link/20261023-nouveau-gsp-irqdest-v1-1-5dd6131faa14@sudmix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h | 1 +
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c | 1 +
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c | 1 +
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c | 4 +++-
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c | 1 +
5 files changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h
@@ -63,6 +63,7 @@ struct nvkm_falcon_func {
int (*select)(struct nvkm_falcon *);
u32 addr2;
u32 riscv_irqmask;
+ u32 riscv_irqdest;
bool reset_pmc;
int (*reset_eng)(struct nvkm_falcon *);
int (*reset_prep)(struct nvkm_falcon *);
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga100.c
@@ -27,6 +27,7 @@ ga100_gsp_flcn = {
.enable = gm200_flcn_enable,
.addr2 = 0x1000,
.riscv_irqmask = 0x2b4,
+ .riscv_irqdest = 0x2b8,
.reset_eng = gp102_flcn_reset_eng,
.reset_wait_mem_scrubbing = gm200_flcn_reset_wait_mem_scrubbing,
.bind_inst = gm200_flcn_bind_inst,
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c
@@ -140,6 +140,7 @@ ga102_gsp_flcn = {
.select = ga102_flcn_select,
.addr2 = 0x1000,
.riscv_irqmask = 0x528,
+ .riscv_irqdest = 0x52c,
.reset_eng = gp102_flcn_reset_eng,
.reset_prep = ga102_flcn_reset_prep,
.reset_wait_mem_scrubbing = ga102_flcn_reset_wait_mem_scrubbing,
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
@@ -64,7 +64,9 @@ r535_gsp_intr(struct nvkm_inth *inth)
u32 intr = nvkm_falcon_rd32(&gsp->falcon, 0x0008);
u32 inte = nvkm_falcon_rd32(&gsp->falcon, gsp->falcon.func->addr2 +
gsp->falcon.func->riscv_irqmask);
- u32 stat = intr & inte;
+ u32 dest = nvkm_falcon_rd32(&gsp->falcon, gsp->falcon.func->addr2 +
+ gsp->falcon.func->riscv_irqdest);
+ u32 stat = intr & inte & dest;
if (!stat) {
nvkm_debug(subdev, "inte %08x %08x\n", intr, inte);
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/tu102.c
@@ -363,6 +363,7 @@ tu102_gsp_flcn = {
.enable = gm200_flcn_enable,
.addr2 = 0x1000,
.riscv_irqmask = 0x2b4,
+ .riscv_irqdest = 0x2b8,
.reset_eng = gp102_flcn_reset_eng,
.reset_wait_mem_scrubbing = gm200_flcn_reset_wait_mem_scrubbing,
.bind_inst = gm200_flcn_bind_inst,
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 346/703] drm/nouveau: do not return early from a synchronous VM_BIND
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (342 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 345/703] drm/nouveau/gsp: only handle GSP interrupts routed to the host Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 347/703] drm/radeon: Bound GPIO I2C table entry count from VBIOS Greg Kroah-Hartman
` (63 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mohamed Ahmed, Thomas Andersen,
Dave Airlie
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
commit b1939b201353d803f09a8eb07aa69e44f8441701 upstream.
A synchronous VM_BIND waits for its job with an interruptible wait and
ignores the result. On a signal the ioctl returns 0 while the job is
still queued. Userspace can then use the new mappings before the page
tables are written, and the channel can take an MMU fault.
Wait uninterruptibly. A synchronous job takes no syncobjs, so only the
jobs queued before it on the same scheduler can delay it.
Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI")
Cc: stable@vger.kernel.org
Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
Tested-by: Thomas Andersen <phomes@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patch.msgid.link/20261117214352.337961-2-mohamedahmedegypt2001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/nouveau/nouveau_sched.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/nouveau/nouveau_sched.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sched.c
@@ -330,7 +330,11 @@ nouveau_job_submit(struct nouveau_job *j
mutex_unlock(&sched->mutex);
if (done_fence) {
- dma_fence_wait(done_fence, true);
+ /* The job is queued and its VA space changes are applied. It
+ * can neither be restarted nor reported as failed, so wait
+ * until it has run.
+ */
+ dma_fence_wait(done_fence, false);
dma_fence_put(done_fence);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 347/703] drm/radeon: Bound GPIO I2C table entry count from VBIOS
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (343 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 346/703] drm/nouveau: do not return early from a synchronous VM_BIND Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 348/703] drm/radeon: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
` (62 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Andrey Misiurov
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <amisiurov@cloudlinux.com>
commit 7345797c8652c976d18dc4be4bae632557c3bc38 upstream.
radeon_atombios_i2c_init() derives the number of GPIO I2C entries from
the size field of the VBIOS GPIO_I2C_Info table and stores a bus for
every valid entry in rdev->i2c_bus[i], which has RADEON_MAX_I2C_BUS
(16) slots. A table that claims more than 16 entries makes it write
past the end of the array into the rest of struct radeon_device. A
size smaller than the common header wraps the subtraction and the loop
walks far past the table. radeon_lookup_i2c_gpio() uses the same
calculation.
Reject undersized tables and cap the entry count at
RADEON_MAX_I2C_BUS.
Fixes: f376b94fbc0a ("drm/radeon/kms: unify i2c handling")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ad5ddb2f77ff5e80b3c793f062dc1cad9907a2b9)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/radeon/radeon_atombios.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -125,6 +125,22 @@ static struct radeon_i2c_bus_rec radeon_
return i2c;
}
+/*
+ * The VBIOS table size is not checked against the image; cap the
+ * entry count to RADEON_MAX_I2C_BUS, the size of rdev->i2c_bus[].
+ */
+static int radeon_atombios_gpio_i2c_num_entries(uint16_t size)
+{
+ u32 bytes;
+
+ if (size < sizeof(ATOM_COMMON_TABLE_HEADER))
+ return 0;
+
+ bytes = size - sizeof(ATOM_COMMON_TABLE_HEADER);
+ return min_t(u32, bytes / sizeof(ATOM_GPIO_I2C_ASSIGMENT),
+ RADEON_MAX_I2C_BUS);
+}
+
static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev,
uint8_t id)
{
@@ -142,8 +158,7 @@ static struct radeon_i2c_bus_rec radeon_
if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
- num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
- sizeof(ATOM_GPIO_I2C_ASSIGMENT);
+ num_indices = radeon_atombios_gpio_i2c_num_entries(size);
gpio = &i2c_info->asGPIO_Info[0];
for (i = 0; i < num_indices; i++) {
@@ -176,8 +191,7 @@ void radeon_atombios_i2c_init(struct rad
if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
- num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
- sizeof(ATOM_GPIO_I2C_ASSIGMENT);
+ num_indices = radeon_atombios_gpio_i2c_num_entries(size);
gpio = &i2c_info->asGPIO_Info[0];
for (i = 0; i < num_indices; i++) {
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 348/703] drm/radeon: only unregister the ATPX handler if we registered it
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (344 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 347/703] drm/radeon: Bound GPIO I2C table entry count from VBIOS Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 349/703] drm/vblank: timer: Do not block within critical section Greg Kroah-Hartman
` (61 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Jiaming Fan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaming Fan <fan.jiaming@hotmail.com>
commit 83876755d089321e426a58f365a31b27b2c77f3b upstream.
radeon_register_atpx_handler() registers the ATPX handler with
vga_switcheroo only when ATPX is detected, and ignores the result:
vga_switcheroo has a single handler slot and refuses a second handler
with -EINVAL. radeon_unregister_atpx_handler() calls
vga_switcheroo_unregister_handler() in either case, and that clears the
slot no matter who set it.
So unloading radeon removes a handler registered by another driver, such
as apple-gmux. No Radeon GPU is needed for this; loading and unloading
radeon is enough. amdgpu is another such driver: when radeon and amdgpu
are both loaded and both detect ATPX, only the first one gets the slot,
and unloading the other one clears it. Afterwards vga_switcheroo can no
longer switch outputs, and a client that uses the vga_switcheroo runtime
PM domain, such as nouveau on a non-Optimus machine with a v1 DSM, can
dereference the now NULL handler during runtime suspend.
Record whether the registration succeeded and unregister only in that
case. amdgpu has the same problem and gets the same fix.
Fixes: 6a9ee8af344e ("vga_switcheroo: initial implementation (v15)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiaming Fan <fan.jiaming@hotmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f90ef5de500fa47d8e2371d429700f0275e0b88d)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/radeon/radeon_atpx_handler.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -34,6 +34,7 @@ struct radeon_atpx {
static struct radeon_atpx_priv {
bool atpx_detected;
bool bridge_pm_usable;
+ bool handler_registered;
/* handle for device - and atpx */
acpi_handle dhandle;
struct radeon_atpx atpx;
@@ -605,7 +606,8 @@ void radeon_register_atpx_handler(void)
if (!r)
return;
- vga_switcheroo_register_handler(&radeon_atpx_handler, handler_flags);
+ if (!vga_switcheroo_register_handler(&radeon_atpx_handler, handler_flags))
+ radeon_atpx_priv.handler_registered = true;
}
/**
@@ -615,5 +617,14 @@ void radeon_register_atpx_handler(void)
*/
void radeon_unregister_atpx_handler(void)
{
+ /*
+ * vga_switcheroo has a single handler slot and unregistering clears it
+ * no matter who set it, so leave a handler registered by another
+ * driver, such as amdgpu or apple-gmux, in place.
+ */
+ if (!radeon_atpx_priv.handler_registered)
+ return;
+
vga_switcheroo_unregister_handler();
+ radeon_atpx_priv.handler_registered = false;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 349/703] drm/vblank: timer: Do not block within critical section
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (345 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 348/703] drm/radeon: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 350/703] drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled Greg Kroah-Hartman
` (60 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ville Syrjälä,
Thomas Zimmermann, Zack Rusin, Louis Chauvet,
Javier Martinez Canillas, David Airlie, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, dri-devel
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <tzimmermann@suse.de>
commit f02d1f70d361c42d09569e51612d6be5ffceb7d6 upstream.
Remove try-to-cancel loop from drm_crtc_vblank_start_timer() to avoid
a possible livelock while spinning within the loop. Hold interval_lock
when starting and forwarding the vblank timer's hrtimer to avoid
forwarding an already queued timer.
The vblank helper drm_vblank_disable_and_save() and the vblank IRQ
handler hold the spin lock vblank_time_lock at some point. This can
result in a deadlock if the vblank timer's disable code in
drm_crtc_vblank_cancel_timer() calls hrtimer_cancel() directly: the
helper waits for the timer function to complete and the timer function
waits for the helper to release vblank_time_lock.
drm_crtc_vblank_cancel_timer() works around this problem by calling
hrtimer_try_to_cancel() instead. For re-enabling the vblank timer,
drm_crtc_vblank_start_timer() currently waits for the vblank timer
to stop. It runs into the same locking problem while waiting for the
timer function to complete.
Resolve the locking problem by removing hrtimer_try_to_cancel() from
drm_crtc_vblank_start_timer(). Hold interval_lock while starting or
forwarding the hrtimer. Without holding interval_lock,
drm_crtc_vblank_start_timer() could set an interval and start the
hrtimer; while a concurrent timer function forwards the timer with the
old interval. This can corrupt the ordering of the hrtimer's internal
queue. Holding the lock prevents this from happening.
When starting the vblank timer, it is still possible that an already
running timer sends out a vblank event at the previous vblank interval.
This is merely an inconsistency and not critical.
Closes: https://lore.kernel.org/dri-devel/20260914111129.300691F00898@smtp.kernel.org/
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Fixes: 74afeb812850 ("drm/vblank: Add vblank timer")
Cc: Louis Chauvet <louis.chauvet@bootlin.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.19+
Link: https://patch.msgid.link/20261110084710.503870-2-tzimmermann@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/drm_vblank.c | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -2185,19 +2185,18 @@ static enum hrtimer_restart drm_vblank_t
struct drm_crtc *crtc = vtimer->crtc;
const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
struct drm_device *dev = crtc->dev;
- unsigned long flags;
- ktime_t interval;
- u64 ret_overrun;
+ u64 ret_overrun = 1;
bool succ;
- spin_lock_irqsave(&vtimer->interval_lock, flags);
- interval = vtimer->interval;
- spin_unlock_irqrestore(&vtimer->interval_lock, flags);
+ scoped_guard(spinlock_irqsave, &vtimer->interval_lock) {
+ ktime_t interval = vtimer->interval;
- if (!interval)
- return HRTIMER_NORESTART;
+ if (!interval || hrtimer_is_queued(timer))
+ return HRTIMER_NORESTART;
+
+ ret_overrun = hrtimer_forward_now(timer, interval);
+ }
- ret_overrun = hrtimer_forward_now(&vtimer->timer, interval);
if (ret_overrun != 1)
drm_dbg_vbl(dev, "vblank timer overrun\n");
@@ -2226,7 +2225,6 @@ int drm_crtc_vblank_start_timer(struct d
{
struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
struct drm_vblank_crtc_timer *vtimer = &vblank->vblank_timer;
- unsigned long flags;
if (!vtimer->crtc) {
/*
@@ -2236,22 +2234,14 @@ int drm_crtc_vblank_start_timer(struct d
spin_lock_init(&vtimer->interval_lock);
hrtimer_setup(&vtimer->timer, drm_vblank_timer_function,
CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- } else {
- /*
- * Timer should not be active. If it is, wait for the
- * previous cancel operations to finish.
- */
- while (hrtimer_active(&vtimer->timer))
- hrtimer_try_to_cancel(&vtimer->timer);
}
drm_calc_timestamping_constants(crtc, &crtc->mode);
- spin_lock_irqsave(&vtimer->interval_lock, flags);
- vtimer->interval = ns_to_ktime(vblank->framedur_ns);
- spin_unlock_irqrestore(&vtimer->interval_lock, flags);
-
- hrtimer_start(&vtimer->timer, vtimer->interval, HRTIMER_MODE_REL);
+ scoped_guard(spinlock_irqsave, &vtimer->interval_lock) {
+ vtimer->interval = ns_to_ktime(vblank->framedur_ns);
+ hrtimer_start(&vtimer->timer, vtimer->interval, HRTIMER_MODE_REL);
+ }
return 0;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 350/703] drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (346 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 349/703] drm/vblank: timer: Do not block within critical section Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 351/703] drm/xe/query: Use ordered clock reads for engine cycles cpu_delta Greg Kroah-Hartman
` (59 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthew Brost, Zongyao Bai,
Shuicheng Lin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zongyao Bai <zongyao.bai@intel.com>
commit b865310c41f5b68c7de3bec86f205ba8cd284fd1 upstream.
During a GT reset the GuC CT channel goes through two states before it
is enabled again:
gt_reset_worker()
xe_uc_stop() ENABLED -> STOPPED send: -ECANCELED
xe_tlb_inval_reset()
do_gt_reset()
do_gt_restart()
xe_uc_sanitize_reset() STOPPED -> DISABLED send: -ENODEV
GuC load, CT enable DISABLED -> ENABLED
xe_tlb_inval_issue() treats -ECANCELED as "undelivered, report done",
but -ENODEV is propagated to the caller. A userptr invalidation from an
MMU notifier (e.g. munmap() on a fault-mode VM) issued in the DISABLED
window thus trips the XE_WARN_ON() in xe_vma_userptr_do_inval() and
taints the kernel:
Tile0: GT1: GT: reset started
WARNING: drivers/gpu/drm/xe/xe_userptr.c:133 at xe_vma_userptr_do_inval+0x340/0x4a0 [xe]
RAX: 00000000ffffffed
xe_vma_userptr_invalidate_start+0x4b7/0x7c0 [xe]
__mmu_notifier_invalidate_range_start+0x247/0x370
unmap_vmas+0x1af/0x1c0
unmap_region+0x91/0xf0
...
The TLB invalidation ops contract is that the backend returns
-ECANCELED when it is mid-reset. The reset invalidates all TLBs, so
there is nothing left to do. Map -ENODEV to -ECANCELED in
send_tlb_inval() so that every GuC TLB invalidation type handles it the
same way, instead of only send_tlb_inval_ggtt_full() as done so far.
The CT is also DISABLED across system suspend and runtime suspend. On
resume from system suspend the GuC is reloaded with all TLBs invalid, so
nothing is lost there either; user space and the MM kernel threads are
frozen by then, so such a request is not expected anyway. A request
issued while runtime suspended violates the PM rules and is still
reported by the "Missing outer runtime PM protection" warning in
xe_tlb_inval_fence_init().
Fixes: db16f9d90c1d ("drm/xe: Split TLB invalidation code in frontend and backend")
Cc: stable@vger.kernel.org # v6.18+
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Zongyao Bai <zongyao.bai@intel.com>
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Link: https://patch.msgid.link/20261116192220.3872267-2-zongyao.bai@intel.com
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit c17474e39028c7fb5cd6b2fb0f0413d07b1bf232)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/xe/xe_guc_tlb_inval.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
+++ b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
@@ -26,12 +26,22 @@
static int send_tlb_inval(struct xe_guc *guc, const u32 *action, int len)
{
struct xe_gt *gt = guc_to_gt(guc);
+ int ret;
xe_gt_assert(gt, action[1]); /* Seqno */
xe_gt_stats_incr(gt, XE_GT_STATS_ID_TLB_INVAL, 1);
- return xe_guc_ct_send(&guc->ct, action, len,
- G2H_LEN_DW_TLB_INVALIDATE, 1);
+ ret = xe_guc_ct_send(&guc->ct, action, len, G2H_LEN_DW_TLB_INVALIDATE, 1);
+
+ /*
+ * A disabled CT can't deliver the request, and the GuC is reloaded
+ * with all TLBs invalid before the CT is enabled again, so there is
+ * nothing left to invalidate. Report it as cancelled, like a stopped CT.
+ */
+ if (ret == -ENODEV)
+ return -ECANCELED;
+
+ return ret;
}
#define MAKE_INVAL_OP(type) ((type << XE_GUC_TLB_INVAL_TYPE_SHIFT) | \
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 351/703] drm/xe/query: Use ordered clock reads for engine cycles cpu_delta
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (347 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 350/703] drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 352/703] accel/rocket: number the cores by devicetree position, not bind order Greg Kroah-Hartman
` (58 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Umesh Nerlige Ramappa, Matthew Brost,
Rodrigo Vivi, Aleksander Czerwionka, Sanjay Yadav
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
commit 65ef9dec511c018bcbe5993e9749c52c26e573e2 upstream.
cpu_delta is meant to bound the time taken to read the engine timestamp
register, but it is measured with local_clock(), which on x86 is a plain
RDTSC that is not ordered against loads. Either end of the window can
thus be sampled while an earlier MMIO read is still in flight.
A reproducer looping on DRM_XE_DEVICE_QUERY_ENGINE_CYCLES on BMG reports
cpu_delta as low as 18 ns, while the MMIO read alone takes > 1.5 us.
Use ktime_get_raw_ns() at both ends instead. Its clocksource read is
ordered (rdtsc_ordered() on x86).
With this, the reproducer reports min/median cpu_delta of 1567/1745 ns
and no short values.
Fixes: 7793d00d1bf5 ("drm/xe: Correlate engine and cpu timestamps with better accuracy")
Cc: <stable@vger.kernel.org> # v6.8+
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Suggested-by: Aleksander Czerwionka <aleksander.czerwionka@intel.com>
Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patch.msgid.link/20261111090401.975803-2-sanjay.kumar.yadav@intel.com
(cherry picked from commit 146dec4ce1f0794fefe5ad1d549655745358b515)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/xe/xe_query.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -6,7 +6,6 @@
#include "xe_query.h"
#include <linux/nospec.h>
-#include <linux/sched/clock.h>
#include <drm/ttm/ttm_placement.h>
#include <generated/xe_wa_oob.h>
@@ -97,13 +96,14 @@ hwe_read_timestamp(struct xe_hw_engine *
u32 upper, lower, old_upper, loop = 0;
struct xe_reg upper_reg = RING_TIMESTAMP_UDW(hwe->mmio_base),
lower_reg = RING_TIMESTAMP(hwe->mmio_base);
+ u64 delta_start;
upper = xe_mmio_read32(mmio, upper_reg);
do {
- *cpu_delta = local_clock();
+ delta_start = ktime_get_raw_ns();
*cpu_ts = cpu_clock();
lower = xe_mmio_read32(mmio, lower_reg);
- *cpu_delta = local_clock() - *cpu_delta;
+ *cpu_delta = ktime_get_raw_ns() - delta_start;
old_upper = upper;
upper = xe_mmio_read32(mmio, upper_reg);
} while (upper != old_upper && loop++ < 2);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 352/703] accel/rocket: number the cores by devicetree position, not bind order
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (348 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 351/703] drm/xe/query: Use ordered clock reads for engine cycles cpu_delta Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 353/703] drm/amd/pm: send smu8 sclk level indices, not the level mask Greg Kroah-Hartman
` (57 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Paunovic, Heiko Stuebner,
Tomeu Vizoso
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Paunovic <royalnet026@gmail.com>
commit 97e48904cbdb32e4a66bd60d26ce45657f58bc46 upstream.
rocket_job_hw_submit() programs the S_POINTER registers of a core with an
extra bit derived from core->index, the way the vendor driver derives it
from the hardware number of the core. rocket_probe() sets core->index to
the slot the core takes in rdev->cores[], which is the order the cores
bind in.
The two agree only while the cores that bind are a prefix of the core
nodes in the devicetree, in devicetree order. Unbind them and bind them
back with a different core first, have one core's probe deferred behind a
sibling's, or disable a core other than the last one, and every task
submitted to a core whose slot is not its hardware number times out after
500 ms. The reset that follows does not help, and the inference finishes
with wrong output.
Observed on an Orange Pi 5 Plus with a KASAN build, over all six bind
orders of the three cores: only the devicetree order ran clean. The other
five produced 27 to 141 "NPU job timed out". In four of them no output
tensor changed with the input, and the harness gave up before its first
measured round; the fifth got through a six-second run with 27 timeouts
and a wrong top-1 class. All but one of the timeouts land on the cores
whose slot is not their hardware number, in proportion to the tasks the
scheduler hands them, and in both directions of the mismatch.
Number the cores by their position among the core nodes in the devicetree
instead, which is what the hardware number is.
The wrong value has been assigned since the driver was added, but it only
reached the hardware once the extra bit was introduced, hence the Fixes
tag below.
Fixes: 0810d5ad88a1 ("accel/rocket: Add job submission IOCTL")
Cc: stable@vger.kernel.org
Assisted-by: LLM sparse
Signed-off-by: Igor Paunovic <royalnet026@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
[tomeu: shortened the comments and dropped checkpatch from Assisted-by]
Reviewed-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Link: https://patch.msgid.link/20260922080114.44662-3-royalnet026@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/accel/rocket/rocket_core.h | 4 ++++
drivers/accel/rocket/rocket_drv.c | 22 +++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
--- a/drivers/accel/rocket/rocket_core.h
+++ b/drivers/accel/rocket/rocket_core.h
@@ -30,6 +30,10 @@
struct rocket_core {
struct device *dev;
struct rocket_device *rdev;
+ /*
+ * Hardware number of the core: its position among the core nodes in
+ * the devicetree.
+ */
unsigned int index;
int irq;
--- a/drivers/accel/rocket/rocket_drv.c
+++ b/drivers/accel/rocket/rocket_drv.c
@@ -157,10 +157,30 @@ static const struct drm_driver rocket_dr
.desc = "rocket DRM",
};
+static int rocket_core_hw_index(struct device *dev)
+{
+ struct device_node *np;
+ int index = 0;
+
+ for_each_matching_node(np, dev->driver->of_match_table) {
+ if (np == dev->of_node) {
+ of_node_put(np);
+ return index;
+ }
+ index++;
+ }
+
+ return -ENODEV;
+}
+
static int rocket_probe(struct platform_device *pdev)
{
+ int index = rocket_core_hw_index(&pdev->dev);
int ret;
+ if (index < 0)
+ return index;
+
if (rdev == NULL) {
/* First core probing, initialize DRM device. */
rdev = rocket_device_init(drm_dev, &rocket_drm_driver);
@@ -179,7 +199,7 @@ static int rocket_probe(struct platform_
rdev->cores[core].rdev = rdev;
rdev->cores[core].dev = &pdev->dev;
- rdev->cores[core].index = core;
+ rdev->cores[core].index = index;
rdev->num_cores++;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 353/703] drm/amd/pm: send smu8 sclk level indices, not the level mask
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (349 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 352/703] accel/rocket: number the cores by devicetree position, not bind order Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 354/703] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F Greg Kroah-Hartman
` (56 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Joshua Horne
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Horne <hornejd@etsu.edu>
commit 535f6852652e3239c8688491ccd0ed4b6e09d14f upstream.
smu8_force_clock_level() passes the pp_dpm_sclk level mask straight to
PPSMC_MSG_SetSclkSoftMin and PPSMC_MSG_SetSclkSoftMax, which take a
level index, as the other smu8 callers do through smu8_get_sclk_level().
In manual mode, "echo 0 > pp_dpm_sclk" thus selects level 1, "echo 2"
selects level 4, and masks above the highest level index are out of
range for the SMU, so e.g. "echo 3", "echo 7" or "echo 0 1 2 3 4 5 6 7"
do not select the requested levels. The original single level version
sent 1 << level and had the same problem.
Send the lowest and highest level in the mask, as smu10 does, and reject
levels above those the SMU has enabled, as smu10 and vega20 do.
Fixes: d7341ef66870 ("drm/amd/powerplay: add some hwmgr functions for sysfs interface on Carrizo")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Joshua Horne <hornejd@etsu.edu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8ff6b368360adb24ccf145047b0261dfae77f28a)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c
@@ -1546,15 +1546,25 @@ static int smu8_get_dal_power_level(stru
static int smu8_force_clock_level(struct pp_hwmgr *hwmgr,
enum pp_clock_type type, uint32_t mask)
{
+ struct phm_clock_voltage_dependency_table *table =
+ hwmgr->dyn_state.vddc_dependency_on_sclk;
+ uint32_t low, high;
+
switch (type) {
case PP_SCLK:
+ /* the SMU takes level indices, not a mask of levels */
+ low = mask ? (ffs(mask) - 1) : 0;
+ high = mask ? (fls(mask) - 1) : 0;
+ if (high >= min(table->count, smu8_get_max_sclk_level(hwmgr)))
+ return -EINVAL;
+
smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetSclkSoftMin,
- mask,
+ low,
NULL);
smum_send_msg_to_smc_with_parameter(hwmgr,
PPSMC_MSG_SetSclkSoftMax,
- mask,
+ high,
NULL);
break;
default:
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 354/703] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (350 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 353/703] drm/amd/pm: send smu8 sclk level indices, not the level mask Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 355/703] drm/amd/display: Fix logger leak on perf trace allocation failure Greg Kroah-Hartman
` (55 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Wang Jiang
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Jiang <jiangwang@kylinos.cn>
commit 24916f2c98f86c90db617d0e828d930d7a35577e upstream.
GFXOFF causes gfx ring timeout and desktop freeze on Lenovo 90NYA05DCD
(Ryzen 5 3400G, Picasso). Add a quirk entry with ANY_REV marker to
disable gfxoff for subsystem 17aa:318f regardless of chip revision.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Wang Jiang <jiangwang@kylinos.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 32a647c3218d8bb5bf03f68784fbc405c1e5fbd3)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1364,6 +1364,9 @@ struct amdgpu_gfxoff_quirk {
u8 revision;
};
+/* Match any chip revision in amdgpu_gfxoff_quirk.revision */
+#define AMDGPU_GFXOFF_QUIRK_ANY_REV 0xff
+
static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
/* https://bugzilla.kernel.org/show_bug.cgi?id=204689 */
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
@@ -1373,6 +1376,7 @@ static const struct amdgpu_gfxoff_quirk
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
/* Apple MacBook Pro (15-inch, 2019) Radeon Pro Vega 20 4 GB */
{ 0x1002, 0x69af, 0x106b, 0x019a, 0xc0 },
+ { 0x1002, 0x15d8, 0x17aa, 0x318f, AMDGPU_GFXOFF_QUIRK_ANY_REV },
/* https://bbs.openkylin.top/t/topic/171497 */
{ 0x1002, 0x15d8, 0x19e5, 0x3e14, 0xc2 },
/* HP 705G4 DM with R5 2400G */
@@ -1389,7 +1393,8 @@ static bool gfx_v9_0_should_disable_gfxo
pdev->device == p->chip_device &&
pdev->subsystem_vendor == p->subsys_vendor &&
pdev->subsystem_device == p->subsys_device &&
- pdev->revision == p->revision) {
+ (p->revision == AMDGPU_GFXOFF_QUIRK_ANY_REV ||
+ pdev->revision == p->revision)) {
return true;
}
++p;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 355/703] drm/amd/display: Fix logger leak on perf trace allocation failure
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (351 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 354/703] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 356/703] drm/amdgpu: Allow cancelling a requested NPS mode Greg Kroah-Hartman
` (54 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Wayne Lin, Jackie Liu, Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jackie Liu <liuyun01@kylinos.cn>
commit 5b148562d193fd63e5d1ae3c442d3d54403c7e51 upstream.
dc_construct_ctx() allocates a logger and stores an alias in dc->dml.logger
before allocating the performance trace object. If dc_perf_trace_create()
fails, the function frees dc_ctx without releasing the logger. Since
dc->ctx is assigned only after the trace allocation succeeds,
dc_destruct() cannot reclaim the logger on this error path.
Free the logger before discarding dc_ctx and clear dc->dml.logger to avoid
leaving a dangling alias after the failed construction.
Fixes: 5d72e247e58c ("drm/amd/display: switch DC over to the new DRM logging macros")
Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ac088505e74932f276ea6e3bbe19713e5770e7a1)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1023,6 +1023,8 @@ static bool dc_construct_ctx(struct dc *
dc_ctx->perf_trace = dc_perf_trace_create();
if (!dc_ctx->perf_trace) {
+ kfree(dc_ctx->logger);
+ dc->dml.logger = NULL;
kfree(dc_ctx);
ASSERT_CRITICAL(false);
return false;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 356/703] drm/amdgpu: Allow cancelling a requested NPS mode
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (352 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 355/703] drm/amd/display: Fix logger leak on perf trace allocation failure Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 357/703] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2 Greg Kroah-Hartman
` (53 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Lijo Lazar, Asad Kamal, Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <lijo.lazar@amd.com>
commit 9284db9e6ebf300b754b406525576d4848ea96f5 upstream.
NPS mode change request doesn't allow to request the current mode. This
causes an issue where a user stores a request and later wants to cancel
the request by writing the current mode back. The pending request stays
the same as before.
Allow user to change the mode by comparing against the cached request.
Writing the current mode back clears the pending request without asking
for a reload.
Fixes: 012be6f22c01 ("drm/amdgpu: Add sysfs interfaces for NPS mode")
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 595b5879f1bf776a8c2d085253d3bff2d19dfb57)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 52 ++++++++++++++++++++++++--------
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 4 ++
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 13 ++++++++
3 files changed, 56 insertions(+), 13 deletions(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -1220,6 +1220,40 @@ static ssize_t available_memory_partitio
return size;
}
+void amdgpu_gmc_set_requested_nps_mode(struct amdgpu_device *adev,
+ enum amdgpu_memory_partition mode)
+{
+ struct amdgpu_hive_info *hive;
+
+ /* If device is part of hive, all devices in the hive should request the
+ * same mode. Hence store the requested mode in hive.
+ */
+ hive = amdgpu_get_xgmi_hive(adev);
+ if (hive) {
+ atomic_set(&hive->requested_nps_mode, mode);
+ amdgpu_put_xgmi_hive(hive);
+ } else {
+ adev->gmc.requested_nps_mode = mode;
+ }
+}
+
+enum amdgpu_memory_partition
+amdgpu_gmc_get_requested_nps_mode(struct amdgpu_device *adev)
+{
+ struct amdgpu_hive_info *hive;
+ enum amdgpu_memory_partition mode;
+
+ hive = amdgpu_get_xgmi_hive(adev);
+ if (hive) {
+ mode = atomic_read(&hive->requested_nps_mode);
+ amdgpu_put_xgmi_hive(hive);
+ } else {
+ mode = adev->gmc.requested_nps_mode;
+ }
+
+ return mode;
+}
+
static ssize_t current_memory_partition_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
@@ -1227,7 +1261,6 @@ static ssize_t current_memory_partition_
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = drm_to_adev(ddev);
enum amdgpu_memory_partition mode;
- struct amdgpu_hive_info *hive;
int i;
mode = UNKNOWN_MEMORY_PARTITION_MODE;
@@ -1241,23 +1274,16 @@ static ssize_t current_memory_partition_
if (mode == UNKNOWN_MEMORY_PARTITION_MODE)
return -EINVAL;
- if (mode == adev->gmc.gmc_funcs->query_mem_partition_mode(adev)) {
+ if (mode == amdgpu_gmc_get_requested_nps_mode(adev)) {
dev_info(
adev->dev,
- "requested NPS mode is same as current NPS mode, skipping\n");
+ "requested NPS mode is same as current/already requested NPS mode, skipping\n");
return count;
}
- /* If device is part of hive, all devices in the hive should request the
- * same mode. Hence store the requested mode in hive.
- */
- hive = amdgpu_get_xgmi_hive(adev);
- if (hive) {
- atomic_set(&hive->requested_nps_mode, mode);
- amdgpu_put_xgmi_hive(hive);
- } else {
- adev->gmc.requested_nps_mode = mode;
- }
+ amdgpu_gmc_set_requested_nps_mode(adev, mode);
+ if (mode == amdgpu_gmc_query_memory_partition(adev))
+ return count;
dev_info(
adev->dev,
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
@@ -465,6 +465,10 @@ enum amdgpu_memory_partition
amdgpu_gmc_get_memory_partition(struct amdgpu_device *adev, u32 *supp_modes);
enum amdgpu_memory_partition
amdgpu_gmc_query_memory_partition(struct amdgpu_device *adev);
+void amdgpu_gmc_set_requested_nps_mode(struct amdgpu_device *adev,
+ enum amdgpu_memory_partition mode);
+enum amdgpu_memory_partition
+amdgpu_gmc_get_requested_nps_mode(struct amdgpu_device *adev);
int amdgpu_gmc_init_mem_ranges(struct amdgpu_device *adev);
void amdgpu_gmc_init_sw_mem_ranges(struct amdgpu_device *adev,
struct amdgpu_mem_partition_info *mem_ranges);
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1636,6 +1636,7 @@ static int gmc_v9_0_early_init(struct am
static int gmc_v9_0_late_init(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
+ bool nps_switch_support;
int r;
r = amdgpu_gmc_allocate_vm_inv_eng(adev);
@@ -1664,6 +1665,18 @@ static int gmc_v9_0_late_init(struct amd
if (r)
return r;
+ nps_switch_support = !adev->gmc.xgmi.connected_to_cpu &&
+ (hweight32(adev->gmc.supported_nps_modes &
+ AMDGPU_ALL_NPS_MASK) > 1);
+ /* Initialize requested NPS mode to be the same as current mode */
+ if (nps_switch_support) {
+ enum amdgpu_memory_partition mode =
+ amdgpu_gmc_get_requested_nps_mode(adev);
+ if (mode == UNKNOWN_MEMORY_PARTITION_MODE)
+ amdgpu_gmc_set_requested_nps_mode(
+ adev, amdgpu_gmc_query_memory_partition(adev));
+ }
+
return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 357/703] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (353 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 356/703] drm/amdgpu: Allow cancelling a requested NPS mode Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 358/703] drm/amdgpu: Fix UserQ slot availability checks Greg Kroah-Hartman
` (52 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrei Krautsou, Kenneth Feng,
Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Krautsou <an9949an@gmail.com>
commit 491aa2b083e18ef11d34f776bcb0e396a84f47e4 upstream.
GC 11.0.2 (Navi33) never got the GFX MGCG, FGCG and PERF_CLK clock
gating flags. GC 11.0.0, 11.0.1 and 11.0.4 have all three, GC 11.0.3
has MGCG. The gfx_v11_0 code behind these flags is shared by all
GC 11 parts. Enable them for GC 11.0.2, same as for GC 11.0.0.
Without the flags the driver does not clear the override bits in
RLC_CGTT_MGCG_OVERRIDE (0x000605e7 under load), so this gating stays
off. On RX 7600S the GFX clock is limited by the GFX TDC limit
(68 A), in Linux and in Windows. With the gating off each MHz costs
more GFX current, so PMFW stops at a lower clock than in Windows.
vkpeak fp32-scalar for 300 s, median after the first 60 s, GFX
current is about 68 A (TDC limit) in all cases:
gfxclk VDDGFX GFLOPS
current flags 2030 MHz 800 mV 8915
+ MGCG 2261 MHz 873 mV 9921
+ MGCG, FGCG, PERF_CLK 2314 MHz 894 mV 10104
Windows 11, AMD driver 910 mV 10157-10186
GFLOPS per MHz is the same, only the current per clock goes down.
Windows shows other clock sensors, so there I compare GFLOPS only.
With all three flags vkpeak is within 1% of Windows. MGCG gives most
of the gain, FGCG and PERF_CLK add about 2% more.
Tested on one laptop, ASUS TUF A16 FA617NS (RX 7600S, PMFW 82.97.0),
Fedora kernel 7.2.11, Mesa 26.2.5, with the same flags set by a local
debug patch. One 300 s vkpeak run for each setting and some gaming,
no amdgpu errors in dmesg. Suspend/resume and long runs are not
tested yet.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/6082
Signed-off-by: Andrei Krautsou <an9949an@gmail.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Andrei Krautsou <an9949an@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 85e5015b7879c04f7b9aabc865cdf7bcdf3d7470)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/soc21.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/gpu/drm/amd/amdgpu/soc21.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc21.c
@@ -613,7 +613,10 @@ static int soc21_common_early_init(struc
adev->cg_flags =
AMD_CG_SUPPORT_GFX_CGCG |
AMD_CG_SUPPORT_GFX_CGLS |
+ AMD_CG_SUPPORT_GFX_MGCG |
AMD_CG_SUPPORT_REPEATER_FGCG |
+ AMD_CG_SUPPORT_GFX_FGCG |
+ AMD_CG_SUPPORT_GFX_PERF_CLK |
AMD_CG_SUPPORT_VCN_MGCG |
AMD_CG_SUPPORT_JPEG_MGCG |
AMD_CG_SUPPORT_ATHUB_MGCG |
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 358/703] drm/amdgpu: Fix UserQ slot availability checks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (354 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 357/703] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2 Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 359/703] drm/amdgpu: Fix VCE buffer size check for DPB and input surface Greg Kroah-Hartman
` (51 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Erhan Bilgili
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erhan Bilgili <erhan.bilgili@gmail.com>
commit cfb11282e0fbf5bd06e3f329f56dddc93e749679 upstream.
The compute and DMA queries check each other's disable_uq flags.
When the flags differ, this can hide available slots or report slots
for disabled UserQs.
Check gfx.disable_uq for compute and sdma.disable_uq for DMA.
Fixes: 78d0a27ae0e2 ("drm/amdgpu: Add user queue instance count in HW IP info")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Erhan Bilgili <erhan.bilgili@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit ed4f6b1f8848ad8890fd188da6b2ddfdd538a036)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -432,7 +432,7 @@ static int amdgpu_hw_ip_info(struct amdg
!adev->gfx.compute_ring[i].no_user_submission)
++num_rings;
- if (!adev->sdma.disable_uq) {
+ if (!adev->gfx.disable_uq) {
for (i = 0; i < AMDGPU_MES_MAX_COMPUTE_PIPES; i++)
num_slots += hweight32(adev->mes.compute_hqd_mask[i]);
}
@@ -447,7 +447,7 @@ static int amdgpu_hw_ip_info(struct amdg
!adev->sdma.instance[i].ring.no_user_submission)
++num_rings;
- if (!adev->gfx.disable_uq) {
+ if (!adev->sdma.disable_uq) {
for (i = 0; i < AMDGPU_MES_MAX_SDMA_PIPES; i++)
num_slots += hweight32(adev->mes.sdma_hqd_mask[i]);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 359/703] drm/amdgpu: Fix VCE buffer size check for DPB and input surface
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (355 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 358/703] drm/amdgpu: Fix UserQ slot availability checks Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 360/703] drm/amdgpu: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
` (50 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leo Liu, Ruijing Dong, David Rosca,
Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rosca <david.rosca@amd.com>
commit 87a841d8c0b711519fb76e2412bb293743f602bd upstream.
In create command we get pitch and height for DPB, input surface
pitch and height is in encode command.
Fix the calculation to also consider different luma and chroma pitch.
Acked-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Signed-off-by: David Rosca <david.rosca@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 24c0be8ac3ef2eaa20f614b540e41382b5e97afc)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 35 +++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -748,6 +748,7 @@ int amdgpu_vce_ring_parse_cs(struct amdg
uint32_t allocated = 0;
uint32_t tmp, handle = 0;
uint32_t dummy = 0xffffffff;
+ uint32_t luma_pitch, chroma_pitch, height;
uint32_t *size = &dummy;
unsigned int idx;
int i, r = 0;
@@ -853,19 +854,19 @@ int amdgpu_vce_ring_parse_cs(struct amdg
goto out;
}
- uint32_t width, height;
- width = amdgpu_ib_get_value(ib, idx + 8);
- height = amdgpu_ib_get_value(ib, idx + 10);
-
- if (width == 0 || height == 0 ||
- width > 4096 || height > 2304) {
- DRM_ERROR("invalid VCE image size: %ux%u\n",
- width, height);
+ luma_pitch = amdgpu_ib_get_value(ib, idx + 8);
+ chroma_pitch = amdgpu_ib_get_value(ib, idx + 9);
+ height = amdgpu_ib_get_value(ib, idx + 10); /* encRefYHeightInQw */
+
+ if (luma_pitch == 0 || chroma_pitch == 0 || height == 0 ||
+ luma_pitch > 4096 || chroma_pitch > 4096 || height > 2304 / 8) {
+ DRM_ERROR("invalid VCE ref image size: (%u %u)x%u\n",
+ luma_pitch, chroma_pitch, height * 8);
r = -EINVAL;
goto out;
}
- *size = width * height * 8 * 3 / 2;
+ *size = luma_pitch * height * 8 + chroma_pitch * height * 8 / 2;
break;
@@ -894,13 +895,25 @@ int amdgpu_vce_ring_parse_cs(struct amdg
break;
case 0x03000001: /* encode */
+ height = amdgpu_ib_get_value(ib, idx + 13);
+ luma_pitch = amdgpu_ib_get_value(ib, idx + 14);
+ chroma_pitch = amdgpu_ib_get_value(ib, idx + 15);
+
+ if (luma_pitch == 0 || chroma_pitch == 0 || height == 0 ||
+ luma_pitch > 4096 || chroma_pitch > 4096 || height > 2304) {
+ DRM_ERROR("invalid VCE image size: (%u %u)x%u\n",
+ luma_pitch, chroma_pitch, height);
+ r = -EINVAL;
+ goto out;
+ }
+
r = amdgpu_vce_cs_reloc(p, ib, idx + 10, idx + 9,
- *size, 0);
+ luma_pitch * height, 0);
if (r)
goto out;
r = amdgpu_vce_cs_reloc(p, ib, idx + 12, idx + 11,
- *size / 3, 0);
+ chroma_pitch * height / 2, 0);
if (r)
goto out;
break;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 360/703] drm/amdgpu: only unregister the ATPX handler if we registered it
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (356 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 359/703] drm/amdgpu: Fix VCE buffer size check for DPB and input surface Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 361/703] drm/amdkfd: Acquire cwsr buffer during CRIU resume Greg Kroah-Hartman
` (49 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Deucher, Jiaming Fan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaming Fan <fan.jiaming@hotmail.com>
commit 53fc1be11892a8e695937fdbc24db2699d23dabf upstream.
amdgpu_register_atpx_handler() registers the ATPX handler with
vga_switcheroo only when ATPX is detected, and ignores the result:
vga_switcheroo has a single handler slot and refuses a second handler
with -EINVAL. amdgpu_unregister_atpx_handler() calls
vga_switcheroo_unregister_handler() in either case, and that clears the
slot no matter who set it.
So unloading amdgpu removes a handler registered by another driver, such
as apple-gmux. No AMD GPU is needed for this; loading and unloading
amdgpu is enough. Afterwards vga_switcheroo can no longer switch outputs,
and a client that uses the vga_switcheroo runtime PM domain, such as
nouveau on a non-Optimus machine with a v1 DSM, can dereference the now
NULL handler during runtime suspend.
Record whether the registration succeeded and unregister only in that
case.
Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiaming Fan <fan.jiaming@hotmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit fbb6ebeff9d5327e8d06a83a3f7daa88422c9127)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
@@ -45,6 +45,7 @@ struct amdgpu_atpx {
static struct amdgpu_atpx_priv {
bool atpx_detected;
bool bridge_pm_usable;
+ bool handler_registered;
unsigned int quirks;
/* handle for device - and atpx */
acpi_handle dhandle;
@@ -663,7 +664,8 @@ void amdgpu_register_atpx_handler(void)
if (!r)
return;
- vga_switcheroo_register_handler(&amdgpu_atpx_handler, handler_flags);
+ if (!vga_switcheroo_register_handler(&amdgpu_atpx_handler, handler_flags))
+ amdgpu_atpx_priv.handler_registered = true;
}
/**
@@ -673,5 +675,14 @@ void amdgpu_register_atpx_handler(void)
*/
void amdgpu_unregister_atpx_handler(void)
{
+ /*
+ * vga_switcheroo has a single handler slot and unregistering clears it
+ * no matter who set it, so leave a handler registered by another
+ * driver, such as apple-gmux, in place.
+ */
+ if (!amdgpu_atpx_priv.handler_registered)
+ return;
+
vga_switcheroo_unregister_handler();
+ amdgpu_atpx_priv.handler_registered = false;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 361/703] drm/amdkfd: Acquire cwsr buffer during CRIU resume
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (357 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 360/703] drm/amdgpu: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 362/703] drm/amdkfd: check CRIU SVM priv data bounds before allocating Greg Kroah-Hartman
` (48 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Francis, Felix Kuehling,
Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Francis <David.Francis@amd.com>
commit 86aa8332ab2b2296cda98cde189e2ec539c4e1b3 upstream.
In normal kfd queue create, a reference to the cwsr svm range
is acquired so that this buffer is not freed from underneath the
queue. We weren't doing that.
After svm ranges are restored in RESUME phase of CRIU, go through
all the queues and acquire a reference to the cwsr.
Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 5a00bdd267a5d87307f9aaddabf550f2410c9d40)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 32 +++++++++++++++++
drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 4 +-
4 files changed, 39 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -2690,6 +2690,8 @@ static int criu_resume(struct file *file
goto exit;
}
+ kfd_criu_resume_queues(target);
+
ret = amdgpu_amdkfd_criu_resume(target->kgd_process_info);
if (ret)
pr_err("amdgpu_amdkfd_criu_resume failed for %i\n", args->pid);
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -1328,6 +1328,8 @@ int kfd_criu_restore_event(struct file *
uint8_t __user *user_priv_data,
uint64_t *priv_data_offset,
uint64_t max_priv_data_size);
+
+int kfd_criu_resume_queues(struct kfd_process *p);
/* CRIU - End */
/* Queue Context Management */
@@ -1344,6 +1346,7 @@ void kfd_queue_unref_bo_va(struct amdgpu
int kfd_queue_unref_bo_vas(struct kfd_process_device *pdd,
struct queue_properties *properties);
void kfd_queue_ctx_save_restore_size(struct kfd_topology_device *dev);
+int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size);
struct mqd_manager *mqd_manager_init_cik(enum KFD_MQD_TYPE type,
struct kfd_node *dev);
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -1108,6 +1108,38 @@ exit:
return ret;
}
+int kfd_criu_resume_queues(struct kfd_process *p)
+{
+ int ret, i;
+ u64 total_cwsr_size;
+
+ for (i = 0; i < p->n_pdds; i++) {
+ struct kfd_process_device *pdd = p->pdds[i];
+ struct kfd_topology_device *topo_dev;
+ struct queue *q;
+
+ topo_dev = kfd_topology_device_by_id(pdd->dev->id);
+
+ list_for_each_entry(q, &pdd->qpd.queues_list, list) {
+ total_cwsr_size = q->properties.ctx_save_restore_area_size +
+ topo_dev->node_props.debug_memory_size;
+ if (check_mul_overflow(total_cwsr_size,
+ NUM_XCC(pdd->dev->xcc_mask),
+ &total_cwsr_size))
+ return -EINVAL;
+ total_cwsr_size = ALIGN(total_cwsr_size, PAGE_SIZE);
+
+ ret = kfd_queue_buffer_svm_get(pdd, q->properties.ctx_save_restore_area_address,
+ total_cwsr_size);
+ if (ret)
+ return ret;
+ }
+
+ }
+
+ return 0;
+}
+
int pqm_get_queue_checkpoint_info(struct process_queue_manager *pqm,
unsigned int qid,
uint32_t *mqd_size,
--- a/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_queue.c
@@ -88,7 +88,7 @@ void uninit_queue(struct queue *q)
#if IS_ENABLED(CONFIG_HSA_AMD_SVM)
-static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
+int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
{
struct kfd_process *p = pdd->process;
struct list_head update_list;
@@ -183,7 +183,7 @@ static void kfd_queue_buffer_svm_put(str
}
#else
-static int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
+int kfd_queue_buffer_svm_get(struct kfd_process_device *pdd, u64 addr, u64 size)
{
return -EINVAL;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 362/703] drm/amdkfd: check CRIU SVM priv data bounds before allocating
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (358 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 361/703] drm/amdkfd: Acquire cwsr buffer during CRIU resume Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 363/703] drm/amdkfd: Dont reuse a VRAM page that is still referenced Greg Kroah-Hartman
` (47 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Perry Yuan, Yifan Zhang,
Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Perry Yuan <perry.yuan@amd.com>
commit 732239b002678d8c534503f52a16afc310095523 upstream.
kfd_criu_restore_svm() allocated the per-range metadata before checking
that the range fits in the user supplied private data buffer, so an out
of range offset cost a pointless kzalloc()/kfree() round trip. Do the
bounds check first and return -EINVAL directly.
v2:
- split the original patch into two, one change per patch (Yifan)
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 0c3caec1161e458092364cb448e5bd165a26dcdb)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -4116,15 +4116,14 @@ int kfd_criu_restore_svm(struct kfd_proc
svm_priv_data_size = sizeof(struct kfd_criu_svm_range_priv_data) +
svm_attrs_size;
+ if (*priv_data_offset + svm_priv_data_size > max_priv_data_size)
+ return -EINVAL;
+
criu_svm_md = kzalloc(svm_object_md_size, GFP_KERNEL);
if (!criu_svm_md) {
pr_err("failed to allocate memory to store svm metadata\n");
return -ENOMEM;
}
- if (*priv_data_offset + svm_priv_data_size > max_priv_data_size) {
- ret = -EINVAL;
- goto exit;
- }
ret = copy_from_user(&criu_svm_md->data, user_priv_ptr + *priv_data_offset,
svm_priv_data_size);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 363/703] drm/amdkfd: Dont reuse a VRAM page that is still referenced
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (359 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 362/703] drm/amdkfd: check CRIU SVM priv data bounds before allocating Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 364/703] drm/amdkfd: keep the DMA addresses of a range intact if splitting fails Greg Kroah-Hartman
` (46 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Apurv Mishra, Philip Yang,
Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Apurv Mishra <Apurv.Mishra@amd.com>
commit 8cd5429d429eced2441173b3306f7e137a4dc31f upstream.
In svm_migrate_copy_to_vram(), skip VRAM pages with a non-zero refcount
and leave those pages in system memory for this migration.
When an svm_bo is reused, a VRAM page can still be held by an in-flight
CPU fault (do_swap_page -> svm_migrate_to_ram). Migrating to VRAM then
re-initializes the page via zone_device_page_init(), resetting its
refcount. The fault's late put_page() frees the page mid-migration, so
migrate_vma_finalize() never restores that PTE. It is left pointing at a
freed system page and hmm_range_fault() hits BUG_ON in
pfn_swap_entry_to_page() (swapops.h).
Signed-off-by: Apurv Mishra <Apurv.Mishra@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 1f19aa7acacbce35584dd8f75a30880096fda6a4)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
@@ -289,16 +289,26 @@ svm_migrate_copy_to_vram(struct kfd_node
amdgpu_res_first(prange->ttm_res, ttm_res_offset,
npages << PAGE_SHIFT, &cursor);
for (i = j = 0; (i < npages) && (mpages < migrate->cpages); i++) {
- struct page *spage;
+ struct page *spage = migrate_pfn_to_page(migrate->src[i]);
if (migrate->src[i] & MIGRATE_PFN_MIGRATE) {
dst[i] = cursor.start + (j << PAGE_SHIFT);
migrate->dst[i] = svm_migrate_addr_to_pfn(adev, dst[i]);
- svm_migrate_get_vram_page(prange, migrate->dst[i]);
- migrate->dst[i] = migrate_pfn(migrate->dst[i]);
- mpages++;
+ /*
+ * A reused svm_bo page may still be held by a CPU fault.
+ * Reinitializing it would free it under this migration,
+ * so leave this page in system memory.
+ */
+ if (page_ref_count(pfn_to_page(migrate->dst[i]))) {
+ dst[i] = 0;
+ migrate->dst[i] = 0;
+ spage = NULL;
+ } else {
+ svm_migrate_get_vram_page(prange, migrate->dst[i]);
+ migrate->dst[i] = migrate_pfn(migrate->dst[i]);
+ mpages++;
+ }
}
- spage = migrate_pfn_to_page(migrate->src[i]);
if (spage && !is_zone_device_page(spage)) {
src[i] = dma_map_page(dev, spage, 0, PAGE_SIZE,
DMA_BIDIRECTIONAL);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 364/703] drm/amdkfd: keep the DMA addresses of a range intact if splitting fails
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (360 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 363/703] drm/amdkfd: Dont reuse a VRAM page that is still referenced Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 365/703] drm/amdkfd: wait for the queue quiesce in concurrent SVM evictions Greg Kroah-Hartman
` (45 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Felix Kuehling, Jesse Zhang,
Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Zhang <Jesse.Zhang@amd.com>
commit 63b42ad2fdd371ae4a86658295943d60a86a519b upstream.
svm_range_split_pages() splits the DMA address array of one GPU after
the other, and each split replaces the old range's array by a shorter
one. If a later GPU's array can't be allocated, the old range is left
with the arrays of the earlier GPUs already shortened, but with its old
size. Unmapping it then walks past their end.
On navi31 with its iGPU, an SVM range accessible by both GPUs, and
unmapping a page in its middle with allocations failing in turn through
failslab:
BUG: KASAN: slab-out-of-bounds in svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu]
Read of size 8 at addr ffff88819ac32800 by task kworker/8:1/171
svm_range_dma_unmap_dev+0x13f/0x170 [amdgpu]
svm_range_dma_unmap+0x119/0x2c0 [amdgpu]
svm_range_free+0x312/0x520 [amdgpu]
svm_range_handle_list_op+0x326/0x500 [amdgpu]
svm_range_deferred_list_work+0x338/0x790 [amdgpu]
Allocated by task 2749:
svm_range_copy_array.constprop.0+0x55/0x190 [amdgpu]
svm_range_split+0x388/0x17b0 [amdgpu]
svm_range_unmap_split+0x254/0x370 [amdgpu]
svm_range_cpu_invalidate_pagetables+0xb29/0x11d0 [amdgpu]
The buggy address is located 0 bytes to the right of
allocated 2048-byte region [ffff88819ac32000, ffff88819ac32800)
Split the arrays of all GPUs first and only replace the old ones once
all succeeded. With that the 2759 unmaps of the same sweep give no
report.
Fixes: f80fe9d3c114 ("drm/amdkfd: map svm range to GPUs")
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 3cbd0b498ac18821ec01c08e39050a4d22ea9eeb)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -975,7 +975,7 @@ svm_range_split_array(void *ppnew, void
kvfree(new);
return -ENOMEM;
}
- kvfree(pold);
+ /* The caller frees pold once all arrays of the range are split */
*(void **)ppold = old;
*(void **)ppnew = new;
@@ -986,19 +986,36 @@ static int
svm_range_split_pages(struct svm_range *new, struct svm_range *old,
uint64_t start, uint64_t last)
{
+ dma_addr_t *old_dma[MAX_GPU_INSTANCE];
uint64_t npages = last - start + 1;
bool has_dma_addr = false;
int i, r;
+ /*
+ * Split the arrays of all GPUs before replacing any of them, the old
+ * range must stay intact if one fails.
+ */
for (i = 0; i < MAX_GPU_INSTANCE; i++) {
+ old_dma[i] = old->dma_addr[i];
if (old->dma_addr[i])
has_dma_addr = true;
- r = svm_range_split_array(&new->dma_addr[i], &old->dma_addr[i],
+ r = svm_range_split_array(&new->dma_addr[i], &old_dma[i],
sizeof(*old->dma_addr[i]), old->start,
npages, new->start, new->npages,
old->actual_loc ? &new->vram_pages : NULL);
- if (r)
+ if (r) {
+ /* new->dma_addr[] goes with the new range */
+ while (i--)
+ if (old_dma[i] != old->dma_addr[i])
+ kvfree(old_dma[i]);
return r;
+ }
+ }
+ for (i = 0; i < MAX_GPU_INSTANCE; i++) {
+ if (old_dma[i] == old->dma_addr[i])
+ continue;
+ kvfree(old->dma_addr[i]);
+ old->dma_addr[i] = old_dma[i];
}
if (old->actual_loc) {
/*
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 365/703] drm/amdkfd: wait for the queue quiesce in concurrent SVM evictions
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (361 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 364/703] drm/amdkfd: keep the DMA addresses of a range intact if splitting fails Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 366/703] drm/vc4: Fix firmware reference leak in vc4_hvs_bind() Greg Kroah-Hartman
` (44 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qiang Han, Philip Yang,
Felix Kuehling, Alex Deucher
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiang Han <qiangh@amd.com>
commit 8c417209754a9d2cd8dc1e78c0dfadefd0ad0e82 upstream.
With XNACK off, svm_range_evict() leaves the GPU page tables in place
and relies on the process's queues being stopped before the MMU
notifier returns.
Only the first eviction (evicted_ranges == 1) calls
kgd2kfd_quiesce_mm(). The quiesce preempts every GPU the process has
opened and takes milliseconds. Any other range invalidated in the
meantime sees evicted_ranges > 1 and returns at once. The core mm then
frees, migrates or reuses the page while the queues still run, and an
in-flight SDMA or blit copy accesses it through the old GPU PTE. The
result is silent corruption of the copy, or of whatever process now
owns the page.
Hold a new svms->evict_lock across the first evictor's quiesce, so that
concurrent evictions return only after the queues have stopped. This is
the scheme amdgpu_amdkfd_evict_userptr() uses with
process_info->notifier_lock. evict_lock nests inside prange->lock and
is taken nowhere else. Under it, the quiesce path takes the dqm lock,
which is already used in MMU notifiers (memalloc_noreclaim).
One way to reach this: a pageable hipMemcpy() larger than 1 MiB. ROCclr
pins the buffer with hsa_amd_memory_lock(), libhsakmt registers it as
a KFD SVM range, and host memory pressure (reclaim, compaction,
allocator purge) invalidates the range.
Fixes: 8a7c184a16d7 ("drm/amdkfd: svm range eviction and restore")
Signed-off-by: Qiang Han <qiangh@amd.com>
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit d443bd2512c04a5d34c4473ce9ce2f2a6f7bf8f5)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 35 ++++++++++++++++++++++------------
2 files changed, 25 insertions(+), 12 deletions(-)
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -887,6 +887,8 @@ struct svm_range_list {
struct list_head deferred_range_list;
struct list_head criu_svm_metadata_list;
spinlock_t deferred_list_lock;
+ /* serializes XNACK-off evictions with the queue quiesce */
+ struct mutex evict_lock;
atomic_t evicted_ranges;
atomic_t drain_pagefaults;
struct delayed_work restore_work;
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -2023,21 +2023,30 @@ svm_range_evict(struct svm_range *prange
if (prange->start <= last && prange->last >= start)
atomic_inc(&prange->invalid);
+ /* The MMU notifier must not return before the GPU has stopped
+ * accessing the invalidated pages. Only the first eviction stops
+ * the queues, which takes milliseconds (HWS preemption on every
+ * GPU of the process). Serialize all evictions of this process so
+ * that a concurrent invalidation of another range waits until
+ * that quiesce has completed instead of returning while queues
+ * still run on stale PTEs.
+ */
+ mutex_lock(&svms->evict_lock);
evicted_ranges = atomic_inc_return(&svms->evicted_ranges);
- if (evicted_ranges != 1)
- return r;
+ if (evicted_ranges == 1) {
+ pr_debug("evicting svms 0x%p range [0x%lx 0x%lx]\n",
+ prange->svms, prange->start, prange->last);
- pr_debug("evicting svms 0x%p range [0x%lx 0x%lx]\n",
- prange->svms, prange->start, prange->last);
-
- /* First eviction, stop the queues */
- r = kgd2kfd_quiesce_mm(mm, KFD_QUEUE_EVICTION_TRIGGER_SVM);
- if (r)
- pr_debug("failed to quiesce KFD\n");
+ /* First eviction, stop the queues */
+ r = kgd2kfd_quiesce_mm(mm, KFD_QUEUE_EVICTION_TRIGGER_SVM);
+ if (r)
+ pr_debug("failed to quiesce KFD\n");
- pr_debug("schedule to restore svm %p ranges\n", svms);
- queue_delayed_work(system_freezable_wq, &svms->restore_work,
- msecs_to_jiffies(AMDGPU_SVM_RANGE_RESTORE_DELAY_MS));
+ pr_debug("schedule to restore svm %p ranges\n", svms);
+ queue_delayed_work(system_freezable_wq, &svms->restore_work,
+ msecs_to_jiffies(AMDGPU_SVM_RANGE_RESTORE_DELAY_MS));
+ }
+ mutex_unlock(&svms->evict_lock);
} else {
unsigned long s, l;
uint32_t trigger;
@@ -3335,6 +3344,7 @@ void svm_range_list_fini(struct kfd_proc
svm_range_free(prange, true);
}
+ mutex_destroy(&p->svms.evict_lock);
mutex_destroy(&p->svms.lock);
pr_debug("process pid %d svms 0x%p done\n",
@@ -3348,6 +3358,7 @@ int svm_range_list_init(struct kfd_proce
svms->objects = RB_ROOT_CACHED;
mutex_init(&svms->lock);
+ mutex_init(&svms->evict_lock);
INIT_LIST_HEAD(&svms->list);
atomic_set(&svms->evicted_ranges, 0);
atomic_set(&svms->drain_pagefaults, 0);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 366/703] drm/vc4: Fix firmware reference leak in vc4_hvs_bind()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (362 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 365/703] drm/amdkfd: wait for the queue quiesce in concurrent SVM evictions Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 367/703] drm/vc4: Hold a runtime PM reference while allocating the binner BO Greg Kroah-Hartman
` (43 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Maíra Canal, Wentao Liang
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <vulab@iscas.ac.cn>
commit af200e91c7b996177aa90981b2f0e794b085d43a upstream.
The firmware reference taken via rpi_firmware_get() is leaked when
either of the devm_clk_get() calls for the core or display clocks
fails, as both error paths return without releasing it.
Fix it by moving the firmware lookup below the clock lookups, so that
the reference is taken right before the firmware property is read and
released immediately afterwards. The rpi_firmware_find_node() call
moves with it: the device node reference it returns would otherwise be
leaked by those same error paths.
The candidate was found by our static analysis tooling, and this change
was prepared with assistance from DeepSeek-V4.1-Flash and GPT-6.1-Sol.
Fixes: 2a001ca00ad5 ("drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection code")
Cc: stable@vger.kernel.org
Suggested-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20261106092016.2282805-1-vulab@iscas.ac.cn
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_hvs.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -1676,15 +1676,6 @@ static int vc4_hvs_bind(struct device *d
struct device_node *node;
unsigned int max_rate;
- node = rpi_firmware_find_node();
- if (!node)
- return -EINVAL;
-
- firmware = rpi_firmware_get(node);
- of_node_put(node);
- if (!firmware)
- return -EPROBE_DEFER;
-
hvs->core_clk = devm_clk_get(&pdev->dev,
(vc4->gen >= VC4_GEN_6_C) ? "core" : NULL);
if (IS_ERR(hvs->core_clk)) {
@@ -1699,6 +1690,15 @@ static int vc4_hvs_bind(struct device *d
return PTR_ERR(hvs->disp_clk);
}
+ node = rpi_firmware_find_node();
+ if (!node)
+ return -EINVAL;
+
+ firmware = rpi_firmware_get(node);
+ of_node_put(node);
+ if (!firmware)
+ return -EPROBE_DEFER;
+
max_rate = rpi_firmware_clk_get_max_rate(firmware,
RPI_FIRMWARE_CORE_CLK_ID);
rpi_firmware_put(firmware);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 367/703] drm/vc4: Hold a runtime PM reference while allocating the binner BO
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (363 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 366/703] drm/vc4: Fix firmware reference leak in vc4_hvs_bind() Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 368/703] drm/vc4: Check for a validated shader before reading its thread mode Greg Kroah-Hartman
` (42 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit a7d7a25b566635ac1ee6af1c3ef06484cf752c3f upstream.
bin_bo_alloc() arms the out-of-memory interrupt once it has allocated the
binner BO, and accessing a V3D register requires the block to be powered.
vc4_submit_cl_ioctl() already holds a runtime PM reference by the time it
reaches vc4_get_bcl(), but vc4_create_bo_ioctl() reaches vc4_grab_bin_bo()
without one, so the write can land on a suspended device.
Take the reference in vc4_v3d_bin_bo_get(), which covers both callers, and
take it before bin_bo_lock so that runtime PM is never waited for with the
mutex held.
Cc: stable@vger.kernel.org
Fixes: 35c8b4b2c0fe ("drm/vc4: Allocate binner bo when starting to use the V3D")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261111-vc4-irq-cleanup-v2-1-aa757bb742f2@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_v3d.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -320,11 +320,15 @@ static int bin_bo_alloc(struct vc4_dev *
int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used)
{
- int ret = 0;
+ int ret;
if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4))
return -ENODEV;
+ ret = vc4_v3d_pm_get(vc4);
+ if (ret)
+ return ret;
+
mutex_lock(&vc4->bin_bo_lock);
if (used && *used)
@@ -340,6 +344,7 @@ int vc4_v3d_bin_bo_get(struct vc4_dev *v
complete:
mutex_unlock(&vc4->bin_bo_lock);
+ vc4_v3d_pm_put(vc4);
return ret;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 368/703] drm/vc4: Check for a validated shader before reading its thread mode
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (364 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 367/703] drm/vc4: Hold a runtime PM reference while allocating the binner BO Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 369/703] drm/vc4: Clear the slice caches before resetting a stalled GPU Greg Kroah-Hartman
` (41 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit 15da41dff1f66a389d238db60a1c19fa83582d07 upstream.
validate_gl_shader_rec() reads the thread mode from the validated_shader
of the FS, VS and CS BOs before checking it for NULL. A shader record
pointing at a BO not created by DRM_IOCTL_VC4_CREATE_SHADER_BO has no
validated_shader, so userspace can trigger a NULL pointer dereference.
Check that every shader BO has a validated shader before using it.
Cc: stable@vger.kernel.org
Fixes: c778cc5df944 ("drm/vc4: Add fragment shader threading support")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-2-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_validate.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -822,6 +822,9 @@ validate_gl_shader_rec(struct drm_device
bo[i] = to_drm_gem_dma_obj(exec->bo[src_handles[i]]);
if (!bo[i])
return -EINVAL;
+
+ if (!to_vc4_bo(&bo[i]->base)->validated_shader)
+ return -EINVAL;
}
for (i = shader_reloc_count; i < nr_relocs; i++) {
bo[i] = vc4_use_bo(exec, src_handles[i]);
@@ -842,7 +845,8 @@ validate_gl_shader_rec(struct drm_device
}
for (i = 0; i < shader_reloc_count; i++) {
- struct vc4_validated_shader_info *validated_shader;
+ struct vc4_validated_shader_info *validated_shader =
+ to_vc4_bo(&bo[i]->base)->validated_shader;
uint32_t o = shader_reloc_offsets[i];
uint32_t src_offset = *(uint32_t *)(pkt_u + o);
uint32_t *texture_handles_u;
@@ -857,10 +861,6 @@ validate_gl_shader_rec(struct drm_device
return -EINVAL;
}
- validated_shader = to_vc4_bo(&bo[i]->base)->validated_shader;
- if (!validated_shader)
- return -EINVAL;
-
if (validated_shader->uniforms_src_size >
exec->uniforms_size) {
DRM_DEBUG("Uniforms src buffer overflow\n");
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 369/703] drm/vc4: Clear the slice caches before resetting a stalled GPU
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (365 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 368/703] drm/vc4: Check for a validated shader before reading its thread mode Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 370/703] drm/vc4: Drop BO usecnt before releasing the old FB Greg Kroah-Hartman
` (40 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit af1cf92e8617a7f7aa24b415596cbf64b76a12e7 upstream.
Starting shader code at varying offsets makes the GFXH-16 icache livelock
unlikely, but not impossible. When the livelock happens, the QPUs make no
progress and the hangcheck resets the GPU, losing the job.
When the hangcheck finds no progress, clear the slice instruction and
uniforms caches and check again before resetting. If the stall is a
livelock, clearing the caches can break it and let the job continue.
Drop round_jiffies_up() from the hangcheck timer, so checks run every
100 ms instead of at the next whole second. This shortens the screen
freeze before the caches are cleared. Long jobs are unaffected: while the
control lists advance, the hangcheck won't clear the caches or reset the
GPU.
Cc: stable@vger.kernel.org
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-4-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_drv.h | 5 +++++
drivers/gpu/drm/vc4/vc4_gem.c | 20 ++++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -223,6 +223,11 @@ struct vc4_dev {
struct {
struct timer_list timer;
struct work_struct reset_work;
+
+ /* The instruction and uniforms caches were cleared at the
+ * last check that found no progress.
+ */
+ bool caches_cleared;
} hangcheck;
struct drm_modeset_lock ctm_state_lock;
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -42,8 +42,7 @@ vc4_queue_hangcheck(struct drm_device *d
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
- mod_timer(&vc4->hangcheck.timer,
- round_jiffies_up(jiffies + msecs_to_jiffies(100)));
+ mod_timer(&vc4->hangcheck.timer, jiffies + msecs_to_jiffies(100));
}
struct vc4_hang_state {
@@ -342,6 +341,7 @@ vc4_hangcheck_elapsed(struct timer_list
/* If idle, we can stop watching for hangs. */
if (!bin_exec && !render_exec) {
+ vc4->hangcheck.caches_cleared = false;
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
return;
}
@@ -358,11 +358,27 @@ vc4_hangcheck_elapsed(struct timer_list
bin_exec->last_ct0ca = ct0ca;
if (render_exec)
render_exec->last_ct1ca = ct1ca;
+
+ vc4->hangcheck.caches_cleared = false;
+
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
vc4_queue_hangcheck(dev);
return;
}
+ /* Clear the slice caches to workaround GFXH-16 */
+ if (!vc4->hangcheck.caches_cleared) {
+ V3D_WRITE(V3D_SLCACTL, VC4_SET_FIELD(0xf, V3D_SLCACTL_ICC) |
+ VC4_SET_FIELD(0xf, V3D_SLCACTL_UCC));
+
+ vc4->hangcheck.caches_cleared = true;
+ spin_unlock_irqrestore(&vc4->job_lock, irqflags);
+ vc4_queue_hangcheck(dev);
+ return;
+ }
+
+ vc4->hangcheck.caches_cleared = false;
+
spin_unlock_irqrestore(&vc4->job_lock, irqflags);
/* We've gone too long with no progress, reset. This has to
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 370/703] drm/vc4: Drop BO usecnt before releasing the old FB
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (366 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 369/703] drm/vc4: Clear the slice caches before resetting a stalled GPU Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 371/703] drm/vc4: Fix off-by-one in the shader record BO handle check Greg Kroah-Hartman
` (39 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit 43b85636ea0d33152bf16816b7601e785723596d upstream.
The async page flip completion drops the old FB reference before
decrementing its BO usecnt. If that was the last reference, the BO is
already freed or recycled into the BO cache when vc4_bo_dec_usecnt()
runs, leading to a use-after-free or a refcount underflow. For example,
while running glmark2-es2-drm in the Raspberry Pi 3, the following
warning appears:
[ 459.078834] ------------[ cut here ]------------
[ 459.078855] refcount_t: underflow; use-after-free.
[ 459.078952] WARNING: lib/refcount.c:96 at refcount_dec_not_one+0xa0/0xa8, CPU#0: swapper/0/0
<snip>
[ 459.079316] Call trace:
[ 459.079323] refcount_dec_not_one+0xa0/0xa8 (P)
[ 459.079335] vc4_bo_dec_usecnt+0x30/0x118 [vc4]
[ 459.079371] vc4_async_page_flip_complete_with_cleanup+0xa0/0xc4 [vc4]
[ 459.079395] dma_fence_signal_timestamp_locked+0xb0/0x12c
[ 459.079408] dma_fence_signal+0x3c/0x6c
[ 459.079416] vc4_irq_render_job_done+0x24/0xbc [vc4]
[ 459.079440] vc4_irq+0x120/0x138 [vc4]
This could happen when userspace removes the old FB and closes its GEM
handle while the flip is still pending.
Decrement the BO usecnt before releasing the old FB reference. Do this
by unifying the two fence callbacks and only decrementing the BO usecnt
in VC4_GEN_4.
Cc: stable@vger.kernel.org
Fixes: 4d12c36fb73b ("drm/vc4: crtc: Move the BO handling out of common page-flip callback")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261114-vc4-async-flip-fixes-v2-1-d33cbe99ed5d@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 60 ++++++++++++++---------------------------
1 file changed, 21 insertions(+), 39 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -895,6 +895,7 @@ vc4_async_page_flip_complete(struct vc4_
{
struct drm_crtc *crtc = flip_state->crtc;
struct drm_device *dev = crtc->dev;
+ struct vc4_dev *vc4 = to_vc4_dev(dev);
struct drm_plane *plane = crtc->primary;
vc4_plane_async_set_fb(plane, flip_state->fb);
@@ -909,39 +910,27 @@ vc4_async_page_flip_complete(struct vc4_
drm_crtc_vblank_put(crtc);
drm_framebuffer_put(flip_state->fb);
- if (flip_state->old_fb)
- drm_framebuffer_put(flip_state->old_fb);
-
- kfree(flip_state);
-}
+ if (flip_state->old_fb) {
+ /*
+ * Decrement the BO usecnt in order to keep the inc/dec
+ * calls balanced when the planes are updated through
+ * the async update path.
+ *
+ * FIXME: we should move to generic async-page-flip when
+ * it's available, so that we can get rid of this
+ * hand-made cleanup_fb() logic.
+ */
+ if (vc4->gen == VC4_GEN_4) {
+ struct drm_gem_dma_object *dma_bo =
+ drm_fb_dma_get_gem_obj(flip_state->old_fb, 0);
-static void vc4_async_page_flip_complete_with_cleanup(struct dma_fence *fence,
- struct dma_fence_cb *cb)
-{
- struct vc4_async_flip_state *flip_state =
- container_of(cb, struct vc4_async_flip_state, cb);
- struct vc4_bo *bo = NULL;
+ vc4_bo_dec_usecnt(to_vc4_bo(&dma_bo->base));
+ }
- if (flip_state->old_fb) {
- struct drm_gem_dma_object *dma_bo =
- drm_fb_dma_get_gem_obj(flip_state->old_fb, 0);
- bo = to_vc4_bo(&dma_bo->base);
+ drm_framebuffer_put(flip_state->old_fb);
}
- vc4_async_page_flip_complete(flip_state);
- dma_fence_put(fence);
-
- /*
- * Decrement the BO usecnt in order to keep the inc/dec
- * calls balanced when the planes are updated through
- * the async update path.
- *
- * FIXME: we should move to generic async-page-flip when
- * it's available, so that we can get rid of this
- * hand-made cleanup_fb() logic.
- */
- if (bo)
- vc4_bo_dec_usecnt(bo);
+ kfree(flip_state);
}
static void vc4_async_page_flip_fence_complete(struct dma_fence *fence,
@@ -959,30 +948,23 @@ static int vc4_async_set_fence_cb(struct
{
struct drm_framebuffer *fb = flip_state->fb;
struct drm_gem_dma_object *dma_bo = drm_fb_dma_get_gem_obj(fb, 0);
- dma_fence_func_t async_page_flip_complete_function;
- struct vc4_dev *vc4 = to_vc4_dev(dev);
struct dma_fence *fence;
int ret;
- if (vc4->gen == VC4_GEN_4)
- async_page_flip_complete_function = vc4_async_page_flip_complete_with_cleanup;
- else
- async_page_flip_complete_function = vc4_async_page_flip_fence_complete;
-
ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ, &fence);
if (ret)
return ret;
/* If there's no fence, complete the page flip immediately */
if (!fence) {
- async_page_flip_complete_function(fence, &flip_state->cb);
+ vc4_async_page_flip_fence_complete(fence, &flip_state->cb);
return 0;
}
/* If the fence has already been completed, complete the page flip */
if (dma_fence_add_callback(fence, &flip_state->cb,
- async_page_flip_complete_function))
- async_page_flip_complete_function(fence, &flip_state->cb);
+ vc4_async_page_flip_fence_complete))
+ vc4_async_page_flip_fence_complete(fence, &flip_state->cb);
return 0;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 371/703] drm/vc4: Fix off-by-one in the shader record BO handle check
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (367 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 370/703] drm/vc4: Drop BO usecnt before releasing the old FB Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 372/703] drm/vc4: Start shader code at varying offsets in its BO Greg Kroah-Hartman
` (38 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit 1fbbd14add401c70c178f0fa13016a3a53ef0de5 upstream.
validate_gl_shader_rec() accepts a shader BO handle equal to
exec->bo_count, reading one entry past the end of exec->bo[] and
using it as a GEM object.
Reject handles that aren't below exec->bo_count.
Cc: stable@vger.kernel.org
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-1-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_validate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -814,7 +814,7 @@ validate_gl_shader_rec(struct drm_device
exec->shader_rec_size -= packet_size;
for (i = 0; i < shader_reloc_count; i++) {
- if (src_handles[i] > exec->bo_count) {
+ if (src_handles[i] >= exec->bo_count) {
DRM_DEBUG("Shader handle %d too big\n", src_handles[i]);
return -EINVAL;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 372/703] drm/vc4: Start shader code at varying offsets in its BO
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (368 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 371/703] drm/vc4: Fix off-by-one in the shader record BO handle check Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 373/703] drm/vc4: Complete async page flips from an ordered workqueue Greg Kroah-Hartman
` (37 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit c0e1ed41ad86cf5230d64dc5f2c6d2e3aeb59937 upstream.
VC4 is affected by the HW erratum GFXH-16: the QPUs can get stuck in a
loop where instruction cache loads are evicted before they are used.
The QPUs of a slice share one instruction cache. Shader BOs are page
aligned and the code always starts at offset 0, so instructions at the
same position in different shaders end up mapping to the same cache sets.
When the four QPUs of a slice run four different shaders, their fills
evict each other, no instruction executes and the hangcheck resets the
GPU.
Place each shader's code at one of four offsets, 256 bytes apart, inside
its BO, and add the offset when relocating the shader record. Shader code
is position independent, as the validator only accepts relative branches.
The offsets are tracked per client, so shaders a given client creates in
sequence (which tend to run together) start in different sets.
Notice that this approach makes the livelock unlikely, but not impossible.
The next commit will address the remaining cases.
On a Raspberry Pi 3 running the issue's reproducer, GPU resets went from
dozens in an hour to none.
Cc: stable@vger.kernel.org
Fixes: 463873d57014 ("drm/vc4: Add an API for creating GPU shaders in GEM BOs.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261118-vc4-icache-workaround-v1-3-5b8adc2c84fe@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_bo.c | 43 ++++++++++++++++++++++-------
drivers/gpu/drm/vc4/vc4_drv.h | 10 ++++++
drivers/gpu/drm/vc4/vc4_validate.c | 3 +-
drivers/gpu/drm/vc4/vc4_validate_shaders.c | 7 ++--
4 files changed, 48 insertions(+), 15 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -17,6 +17,7 @@
*/
#include <linux/dma-buf.h>
+#include <linux/overflow.h>
#include <drm/drm_fourcc.h>
@@ -837,6 +838,19 @@ int vc4_mmap_bo_ioctl(struct drm_device
return 0;
}
+/*
+ * QPUs sharing a slice's instruction cache can livelock evicting each
+ * other's fills. Considering that shader BOs are page aligned, any code
+ * at offset 0 maps every shader to the same cache sets. This makes a
+ * livelock more likely to happen due to GFXH-16.
+ *
+ * Start each shader at one of four offsets, cycled per client, to spread
+ * them across sets. The use of four different offsets is motivated by the
+ * number of QPUs per slice (4 QPUs).
+ */
+#define VC4_SHADER_OFFSET_STEP 256
+#define VC4_SHADER_OFFSET_NUM 4
+
int
vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
@@ -845,6 +859,7 @@ vc4_create_shader_bo_ioctl(struct drm_de
struct vc4_file *vc4file = file_priv->driver_priv;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_bo *bo = NULL;
+ u32 offset, size;
int ret;
if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4))
@@ -866,29 +881,37 @@ vc4_create_shader_bo_ioctl(struct drm_de
return -EINVAL;
}
+ offset = ((u32)atomic_inc_return(&vc4file->shader_offset_idx) %
+ VC4_SHADER_OFFSET_NUM) * VC4_SHADER_OFFSET_STEP;
+
+ if (check_add_overflow(offset, args->size, &size))
+ return -EINVAL;
+
ret = vc4_grab_bin_bo(vc4, vc4file);
if (ret)
return ret;
- bo = vc4_bo_create(dev, args->size, true, VC4_BO_TYPE_V3D_SHADER);
+ bo = vc4_bo_create(dev, size, true, VC4_BO_TYPE_V3D_SHADER);
if (IS_ERR(bo))
return PTR_ERR(bo);
bo->madv = VC4_MADV_WILLNEED;
+ bo->shader_offset = offset;
- if (copy_from_user(bo->base.vaddr,
- (void __user *)(uintptr_t)args->data,
- args->size)) {
+ /* Clear the memory around the code, which may come from the BO
+ * cache.
+ */
+ memset(bo->base.vaddr, 0, offset);
+ if (copy_from_user(bo->base.vaddr + offset,
+ (void __user *)(uintptr_t)args->data,
+ args->size)) {
ret = -EFAULT;
goto fail;
}
- /* Clear the rest of the memory from allocating from the BO
- * cache.
- */
- memset(bo->base.vaddr + args->size, 0,
- bo->base.base.size - args->size);
+ memset(bo->base.vaddr + offset + args->size, 0,
+ bo->base.base.size - offset - args->size);
- bo->validated_shader = vc4_validate_shader(&bo->base);
+ bo->validated_shader = vc4_validate_shader(&bo->base, offset);
if (!bo->validated_shader) {
ret = -EINVAL;
goto fail;
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -265,6 +265,9 @@ struct vc4_bo {
*/
struct vc4_validated_shader_info *validated_shader;
+ /* Byte offset of the shader code in the BO. */
+ u32 shader_offset;
+
/* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i
* for user-allocated labels.
*/
@@ -802,6 +805,11 @@ struct vc4_file {
} perfmon;
bool bin_bo_used;
+
+ /* Counter picking the start offset of the next shader BO's code,
+ * see vc4_create_shader_bo_ioctl().
+ */
+ atomic_t shader_offset_idx;
};
static inline struct vc4_exec_info *
@@ -1088,7 +1096,7 @@ bool vc4_check_tex_size(struct vc4_exec_
/* vc4_validate_shader.c */
struct vc4_validated_shader_info *
-vc4_validate_shader(struct drm_gem_dma_object *shader_obj);
+vc4_validate_shader(struct drm_gem_dma_object *shader_obj, u32 offset);
/* vc4_perfmon.c */
void vc4_perfmon_get(struct vc4_perfmon *perfmon);
--- a/drivers/gpu/drm/vc4/vc4_validate.c
+++ b/drivers/gpu/drm/vc4/vc4_validate.c
@@ -853,7 +853,8 @@ validate_gl_shader_rec(struct drm_device
void *uniform_data_u;
uint32_t tex, uni;
- *(uint32_t *)(pkt_v + o) = bo[i]->dma_addr + src_offset;
+ *(uint32_t *)(pkt_v + o) = bo[i]->dma_addr + src_offset +
+ to_vc4_bo(&bo[i]->base)->shader_offset;
if (src_offset != 0) {
DRM_DEBUG("Shaders must be at offset 0 of "
--- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c
+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
@@ -777,7 +777,7 @@ vc4_handle_branch_target(struct vc4_shad
}
struct vc4_validated_shader_info *
-vc4_validate_shader(struct drm_gem_dma_object *shader_obj)
+vc4_validate_shader(struct drm_gem_dma_object *shader_obj, u32 offset)
{
struct vc4_dev *vc4 = to_vc4_dev(shader_obj->base.dev);
bool found_shader_end = false;
@@ -791,8 +791,9 @@ vc4_validate_shader(struct drm_gem_dma_o
return NULL;
memset(&validation_state, 0, sizeof(validation_state));
- validation_state.shader = shader_obj->vaddr;
- validation_state.max_ip = shader_obj->base.size / sizeof(uint64_t);
+ validation_state.shader = shader_obj->vaddr + offset;
+ validation_state.max_ip = (shader_obj->base.size - offset) /
+ sizeof(uint64_t);
reset_validation_state(&validation_state);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 373/703] drm/vc4: Complete async page flips from an ordered workqueue
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (369 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 372/703] drm/vc4: Start shader code at varying offsets in its BO Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 374/703] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Greg Kroah-Hartman
` (36 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Iago Toral Quiroga, Maíra Canal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <mcanal@igalia.com>
commit 12a321af56c436e299414d8c276457dcf387e0cf upstream.
Async page flips complete from a dma_fence callback, which runs in the
fence signaling context: the VC4 render job IRQ handler on RPi 0-3 since
commit e8941ac97f28 ("drm/vc4: Remove BOs seqnos"), and the V3D IRQ
handler on RPi 4-5 since commit d19e00ee06a9 ("drm/vc4: crtc: Fix out of
order frames during asynchronous page flips").
Completing the flip may sleep: on RPi 0-3, vc4_bo_dec_usecnt() takes
bo->madv_lock, and on all platforms, dropping the last framebuffer
reference takes fb_lock and can free the BO. When running the kernel
with CONFIG_DEBUG_ATOMIC_SLEEP=y on RPi 3, this triggers the following
warning:
[ 2511.636319] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:623
[ 2511.636667] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/0
[ 2511.636681] preempt_count: 1000002, expected: 0
[ 2511.636689] RCU nest depth: 0, expected: 0
[ 2511.636698] locks held by swapper/0/0: 1, on CPU#0:
[ 2511.636711] #0: ffff000037183198 (&fence->inline_lock){-...}-{3:3}, at: dma_fence_signal+0x88/0xec
<snip>
[ 2511.636892] Hardware name: Raspberry Pi 3 Model B Plus Rev 1.3 (DT)
[ 2511.636899] Call trace:
<snip>
[ 2511.636991] mutex_lock_nested+0x24/0x30
[ 2511.637002] vc4_bo_dec_usecnt+0x40/0x124 [vc4]
[ 2511.637070] vc4_async_page_flip_complete_with_cleanup+0xa0/0xc4 [vc4]
[ 2511.637102] dma_fence_signal_timestamp_locked+0x118/0x290
[ 2511.637116] dma_fence_signal+0x9c/0xec
[ 2511.637126] vc4_irq_render_job_done+0x24/0x114 [vc4]
[ 2511.637158] vc4_irq+0x16c/0x274 [vc4]
Make the fence callback only queue a work item on a per-CRTC ordered
workqueue and complete the flip from it. Flips with no fence or an already
signaled one still complete inline, but only after flushing that workqueue,
so they can't complete before earlier flips on the same CRTC whose fence
already signaled.
Cc: stable@vger.kernel.org
Fixes: d19e00ee06a9 ("drm/vc4: crtc: Fix out of order frames during asynchronous page flips")
Fixes: e8941ac97f28 ("drm/vc4: Remove BOs seqnos")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261114-vc4-async-flip-fixes-v2-2-d33cbe99ed5d@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 51 +++++++++++++++++++++++++----------------
drivers/gpu/drm/vc4/vc4_drv.h | 6 ++++
2 files changed, 38 insertions(+), 19 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -884,15 +884,18 @@ struct vc4_async_flip_state {
struct drm_framebuffer *fb;
struct drm_framebuffer *old_fb;
struct drm_pending_vblank_event *event;
+ struct dma_fence *fence;
struct dma_fence_cb cb;
+ struct work_struct work;
};
-/* Called when the V3D execution for the BO being flipped to is done, so that
- * we can actually update the plane's address to point to it.
+/* Executed when the V3D execution for the BO being flipped to is done, so
+ * that we can actually update the plane's address to point to it.
*/
-static void
-vc4_async_page_flip_complete(struct vc4_async_flip_state *flip_state)
+static void vc4_async_page_flip_work(struct work_struct *work)
{
+ struct vc4_async_flip_state *flip_state =
+ container_of(work, struct vc4_async_flip_state, work);
struct drm_crtc *crtc = flip_state->crtc;
struct drm_device *dev = crtc->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
@@ -930,17 +933,19 @@ vc4_async_page_flip_complete(struct vc4_
drm_framebuffer_put(flip_state->old_fb);
}
+ dma_fence_put(flip_state->fence);
kfree(flip_state);
}
-static void vc4_async_page_flip_fence_complete(struct dma_fence *fence,
- struct dma_fence_cb *cb)
+static void vc4_async_page_flip_fence_cb(struct dma_fence *fence,
+ struct dma_fence_cb *cb)
{
struct vc4_async_flip_state *flip_state =
container_of(cb, struct vc4_async_flip_state, cb);
+ struct vc4_crtc *vc4_crtc = to_vc4_crtc(flip_state->crtc);
- vc4_async_page_flip_complete(flip_state);
- dma_fence_put(fence);
+ /* Completing the flip may sleep, so defer it to a worker. */
+ queue_work(vc4_crtc->async_flip_wq, &flip_state->work);
}
static int vc4_async_set_fence_cb(struct drm_device *dev,
@@ -948,23 +953,26 @@ static int vc4_async_set_fence_cb(struct
{
struct drm_framebuffer *fb = flip_state->fb;
struct drm_gem_dma_object *dma_bo = drm_fb_dma_get_gem_obj(fb, 0);
- struct dma_fence *fence;
+ struct vc4_crtc *vc4_crtc = to_vc4_crtc(flip_state->crtc);
int ret;
- ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ, &fence);
+ INIT_WORK(&flip_state->work, vc4_async_page_flip_work);
+
+ ret = dma_resv_get_singleton(dma_bo->base.resv, DMA_RESV_USAGE_READ,
+ &flip_state->fence);
if (ret)
return ret;
- /* If there's no fence, complete the page flip immediately */
- if (!fence) {
- vc4_async_page_flip_fence_complete(fence, &flip_state->cb);
+ if (flip_state->fence &&
+ !dma_fence_add_callback(flip_state->fence, &flip_state->cb,
+ vc4_async_page_flip_fence_cb))
return 0;
- }
- /* If the fence has already been completed, complete the page flip */
- if (dma_fence_add_callback(fence, &flip_state->cb,
- vc4_async_page_flip_fence_complete))
- vc4_async_page_flip_fence_complete(fence, &flip_state->cb);
+ /* No fence or the fence has already signaled. Complete the flip
+ * immediately, after earlier queued flips.
+ */
+ flush_workqueue(vc4_crtc->async_flip_wq);
+ vc4_async_page_flip_work(&flip_state->work);
return 0;
}
@@ -990,7 +998,7 @@ vc4_async_page_flip_common(struct drm_cr
/* Save the current FB before it's replaced by the new one in
* drm_atomic_set_fb_for_plane(). We'll need the old FB in
- * vc4_async_page_flip_complete() to decrement the BO usecnt and keep
+ * vc4_async_page_flip_work() to decrement the BO usecnt and keep
* it consistent.
* FIXME: we should move to generic async-page-flip when it's
* available, so that we can get rid of this hand-made cleanup_fb()
@@ -1397,6 +1405,11 @@ int __vc4_crtc_init(struct drm_device *d
drm_crtc_helper_add(crtc, crtc_helper_funcs);
+ vc4_crtc->async_flip_wq = drmm_alloc_ordered_workqueue(drm, "%s-async-flip",
+ 0, crtc->name);
+ if (IS_ERR(vc4_crtc->async_flip_wq))
+ return PTR_ERR(vc4_crtc->async_flip_wq);
+
if (vc4->gen == VC4_GEN_4) {
drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r));
drm_crtc_enable_color_mgmt(crtc, 0, false, crtc->gamma_size);
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -602,6 +602,12 @@ struct vc4_crtc {
* access to that value.
*/
unsigned int current_hvs_channel;
+
+ /**
+ * @async_flip_wq: Ordered workqueue completing the CRTC's async
+ * page flips.
+ */
+ struct workqueue_struct *async_flip_wq;
};
#define to_vc4_crtc(_crtc) \
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 374/703] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (370 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 373/703] drm/vc4: Complete async page flips from an ordered workqueue Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 375/703] drm/vmwgfx: bound MKSSTAT lengths before rounding to pages Greg Kroah-Hartman
` (35 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 05ee42f3dd5484415fac587d0efb8fe846b74c2c upstream.
vmw_host_get_guestinfo subtracts the two-byte reply prefix using
max(reply_len - 2, (size_t)0). Since reply_len is unsigned, a one-byte
reply wraps to SIZE_MAX instead of being clamped to zero. The subsequent
copy can read past the host reply allocation.
Theoretically malformed host reply can reach this path when the driver
queries the GuestInfo parameter used to enable VKMS.
Check the reply length before subtracting the prefix so short replies
produce an empty payload and cannot cause an out-of-bounds read.
Sashiko reported this while reviewing the i386 hypercall changes.
Fixes: 89da76fde68d ("drm/vmwgfx: Add VMWare host messaging capability")
Cc: stable@vger.kernel.org
Closes: https://sashiko.dev/#/patchset/4ab10678a8f50053934b62b56af81f881c1d3798.1788414669.git.zack.rusin%40broadcom.com
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261029215738.3010276-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -431,7 +431,7 @@ int vmw_host_get_guestinfo(const char *g
/* Remove reply code, which are the first 2 characters of
* the reply
*/
- reply_len = max(reply_len - 2, (size_t) 0);
+ reply_len = reply_len > 2 ? reply_len - 2 : 0;
reply_len = min(reply_len, *length);
if (reply_len > 0)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 375/703] drm/vmwgfx: bound MKSSTAT lengths before rounding to pages
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (371 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 374/703] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 376/703] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core Greg Kroah-Hartman
` (34 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 9725b0454e65f15ae76788f2004a7ba8b493362a upstream.
vmw_mksstat_add_ioctl rounds the user-supplied 64bit lengths to page
counts before comparing them with the descriptors page arrays. PFN_UP
can wrap for lengths near U64_MAX. On 32bit kernels, storing a large page
count in size_t can also truncate it to a value that passes the checks.
A render-node client can therefore register a descriptor with lengths
that exceed its pinned page arrays, including nonzero lengths with no
backing pages.
Compare each byte length with its page array's capacity before rounding
or narrowing it. Compute those capacities in 64 bits and calculate the
page counts only after all three lengths have passed validation.
Sashiko reported this while reviewing the i386 hypercall changes.
Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats")
Cc: stable@vger.kernel.org
Closes: https://sashiko.dev/#/patchset/4ab10678a8f50053934b62b56af81f881c1d3798.1788414669.git.zack.rusin%40broadcom.com
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261029215738.3010276-2-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -939,9 +939,12 @@ int vmw_mksstat_add_ioctl(struct drm_dev
struct vmw_private *const dev_priv = vmw_priv(dev);
- const size_t num_pages_stat = PFN_UP(arg->stat_len);
- const size_t num_pages_info = PFN_UP(arg->info_len);
- const size_t num_pages_strs = PFN_UP(arg->strs_len);
+ const u64 max_stat_len = (u64)MKS_GUEST_STAT_INSTANCE_MAX_STAT_PPNS * PAGE_SIZE;
+ const u64 max_info_len = (u64)MKS_GUEST_STAT_INSTANCE_MAX_INFO_PPNS * PAGE_SIZE;
+ const u64 max_strs_len = (u64)MKS_GUEST_STAT_INSTANCE_MAX_STRS_PPNS * PAGE_SIZE;
+ size_t num_pages_stat;
+ size_t num_pages_info;
+ size_t num_pages_strs;
long desc_len;
long nr_pinned_stat;
long nr_pinned_info;
@@ -965,11 +968,15 @@ int vmw_mksstat_add_ioctl(struct drm_dev
if (!arg->description)
return -EINVAL;
- if (num_pages_stat > ARRAY_SIZE(pdesc->statPPNs) ||
- num_pages_info > ARRAY_SIZE(pdesc->infoPPNs) ||
- num_pages_strs > ARRAY_SIZE(pdesc->strsPPNs))
+ if (arg->stat_len > max_stat_len ||
+ arg->info_len > max_info_len ||
+ arg->strs_len > max_strs_len)
return -EINVAL;
+ num_pages_stat = PFN_UP(arg->stat_len);
+ num_pages_info = PFN_UP(arg->info_len);
+ num_pages_strs = PFN_UP(arg->strs_len);
+
/* Find an available slot in the mksGuestStats user array and reserve it */
for (slot = 0; slot < ARRAY_SIZE(dev_priv->mksstat_user_pids); ++slot)
if (!atomic_cmpxchg(&dev_priv->mksstat_user_pids[slot], 0, MKSSTAT_PID_RESERVED))
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 376/703] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (372 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 375/703] drm/vmwgfx: bound MKSSTAT lengths before rounding to pages Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 377/703] drm/vmwgfx: Erase the detached resource entry on resource release Greg Kroah-Hartman
` (33 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Aldo Ariel Panzardo, Zack Rusin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
commit 030e6d11d3e5eb7328f7a3e8177737a4b1c30654 upstream.
vmw_gem_object_get_sg_table() returns vmw_tt->vsgt.sgt when the buffer
object has already been DMA mapped. vmw_ttm_map_dma() sets that field
to &vmw_tt->sgt, which is a member embedded inside the struct
vmw_ttm_tt allocation and not a table of its own.
The core owns whatever .get_sg_table returns. drm_gem_map_dma_buf()
takes the table and drm_gem_unmap_dma_buf() destroys it in full:
dma_unmap_sgtable(attach->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);
sg_free_table(sgt);
kfree(sgt);
Both are ops of drm_gem_prime_dmabuf_ops, so the core ends up calling
kfree() on &vmw_tt->sgt, which is not the start of an allocation. The
preceding sg_free_table() also destroys a scatterlist that vmwgfx still
considers its own and frees again from vmw_ttm_unmap_dma().
drm_gem_unmap_dma_buf() runs from dma_buf_detach(), including the
importer's error path, so a failed import is enough to reach it:
exporting a bound buffer with DRM_IOCTL_PRIME_HANDLE_TO_FD and
importing it on a second DRM device with DRM_IOCTL_PRIME_FD_TO_HANDLE
is sufficient. Both ioctls are DRM_RENDER_ALLOW.
Observed on 6.12.101 with KASAN, as uid 65534:
BUG: KASAN: invalid-free in drm_gem_unmap_dma_buf+0xb3/0xf0
Free of addr ffff888008290450 by task poc_mm04_sgtabl/321
CPU: 1 UID: 65534 PID: 321 Comm: poc_mm04_sgtabl Not tainted 6.12.101 #4
kasan_report_invalid_free+0x94/0xc0
check_slab_allocation+0x116/0x120
kfree+0x103/0x360
drm_gem_unmap_dma_buf+0xb3/0xf0
dma_buf_detach+0x165/0x510
drm_gem_prime_import_dev+0x33e/0x430
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 80 bytes inside of
144-byte region [ffff888008290400, ffff888008290490)
80 is offsetof(struct vmw_ttm_tt, sgt) and 144 is sizeof(struct
vmw_ttm_tt), which identifies the freed pointer as the embedded member.
Always return a table the core can own, as the other drivers do.
Reusing the cached representation would require copying it into a
freshly allocated sg_table, never returning the alias.
Fixes: 8afa13a0583f ("drm/vmwgfx: Implement DRIVER_GEM")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20260923122601.438892-1-qwe.aldo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gem.c
@@ -73,10 +73,13 @@ static struct sg_table *vmw_gem_object_g
struct vmw_ttm_tt *vmw_tt =
container_of(bo->ttm, struct vmw_ttm_tt, dma_ttm);
- if (vmw_tt->vsgt.sgt)
- return vmw_tt->vsgt.sgt;
-
- return drm_prime_pages_to_sg(obj->dev, vmw_tt->dma_ttm.pages, vmw_tt->dma_ttm.num_pages);
+ /*
+ * Do not return &vmw_tt->sgt: the core owns what this returns and
+ * drm_gem_unmap_dma_buf() sg_free_table()s and kfree()s it, but that
+ * sg_table is embedded in the vmw_ttm_tt allocation.
+ */
+ return drm_prime_pages_to_sg(obj->dev, vmw_tt->dma_ttm.pages,
+ vmw_tt->dma_ttm.num_pages);
}
static int vmw_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 377/703] drm/vmwgfx: Erase the detached resource entry on resource release
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (373 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 376/703] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 378/703] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Greg Kroah-Hartman
` (32 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jaeyeong Lee, Zack Rusin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaeyeong Lee <finpiler@protonmail.com>
commit c4b134969ce350cdd4e726b5102b85b8a2d6fad5 upstream.
vmw_bo_add_detached_resource() stores a raw struct vmw_resource pointer in
bo->detached_resources without taking a reference on the resource, and the
only place that erases the entry again is vmw_resource_mob_attach(). A
resource that is never validated, and therefore never attached to its
backing mob, keeps its entry until the buffer object itself is destroyed.
vmw_resource_release() detaches the resource from the mob RB tree and drops
its reference on the backing buffer object, but leaves the
detached_resources entry in place. Userspace can hold an independent GEM
handle on that buffer object, either because DRM_VMW_GB_SURFACE_CREATE
returned one in rep.buffer_handle, or because DRM_VMW_GB_SURFACE_REF minted
one with drm_gem_handle_create(). The buffer object then outlives the
surface while still holding a pointer to freed memory.
Any later surface lookup for that buffer object dereferences it:
vmw_prime_handle_to_fd()
vmw_lookup_surface_handle_for_buffer()
vmw_lookup_user_surface_for_buffer()
vmw_bo_surface()
res->func->res_type <-- use-after-free read
vmw_bo_surface() walks detached_resources before the mob RB tree, so the
stale entry is matched first. The kref_get_unless_zero() in
vmw_lookup_user_surface_for_buffer() does not help here: it runs after
the dereference, and struct vmw_user_surface is freed with kfree_rcu()
on a slab that is not SLAB_TYPESAFE_BY_RCU, so the memory is handed out
to unrelated allocations once the grace period elapses.
A sequence that reaches this from userspace is to create a guest-backed
surface with drm_vmw_surface_flag_create_buffer, never validate it,
release it with DRM_VMW_UNREF_SURFACE, and then call
DRM_IOCTL_PRIME_HANDLE_TO_FD on the buffer handle returned by the create
ioctl. All of the ioctls involved are DRM_RENDER_ALLOW.
Erase the entry next to the existing vmw_resource_mob_detach() call, so
that a released resource is removed from both containers, mirroring what
vmw_resource_mob_attach() does. The dumb buffer teardown path in
vmw_bo_free() clears res->guest_memory_bo before dropping its surface
reference, so it does not reach this code and is unaffected.
Fixes: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers")
Cc: stable@vger.kernel.org
Signed-off-by: Jaeyeong Lee <finpiler@protonmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
[zack: rebased; dropped the v7.2-rc4 analysis note from the commit message]
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20260725143859.797134-1-finpiler@protonmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -138,6 +138,7 @@ static void vmw_resource_release(struct
}
res->guest_memory_dirty = false;
vmw_resource_mob_detach(res);
+ vmw_bo_del_detached_resource(res->guest_memory_bo, res);
if (res->dirty)
res->func->dirty_free(res);
if (res->coherent)
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 378/703] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (374 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 377/703] drm/vmwgfx: Erase the detached resource entry on resource release Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 379/703] drm/vmwgfx: include legacy hotspots in GB-only cursor images Greg Kroah-Hartman
` (31 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vladimir Popov, Zack Rusin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Popov <popov.nkv@gmail.com>
commit 06f8a6708a98dff199ef7ea553b092efc38b4eab upstream.
If vmw_execbuf_fence_commands() call fails in
vmw_kms_helper_validation_finish(), it sets *p_fence = NULL. If
ctx->bo_list is not empty, the caller, vmw_kms_helper_validation_finish(),
passes the fence through a chain of functions to dma_fence_is_array(),
which causes a NULL pointer dereference in dma_fence_is_array():
vmw_kms_helper_validation_finish() // pass NULL fence
vmw_validation_done()
vmw_validation_bo_fence()
ttm_eu_fence_buffer_objects() // pass NULL fence
dma_resv_add_fence()
dma_fence_is_container()
dma_fence_is_array() // NULL deref
Fix this by adding a NULL check in vmw_validation_bo_fence(): if the fence
is NULL, fall back to ttm_eu_backoff_reservation()to safely release
the buffer object reservations without attempting to add a NULL fence to
dma_resv. This is safe because when fence is NULL, vmw_fallback_wait()
has already been called inside vmw_execbuf_fence_commands() to synchronize
the GPU.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 038ecc503236 ("drm/vmwgfx: Add a validation module v2")
Cc: stable@vger.kernel.org
Signed-off-by: Vladimir Popov <popov.nkv@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20260414105529.9883-1-popov.nkv@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
@@ -127,16 +127,23 @@ vmw_validation_bo_reserve(struct vmw_val
* vmw_validation_bo_fence - Unreserve and fence buffer objects registered
* with a validation context
* @ctx: The validation context
+ * @fence: Fence with which to fence all buffer objects taking part in the
+ * command submission.
*
* This function unreserves the buffer objects previously reserved using
- * vmw_validation_bo_reserve, and fences them with a fence object.
+ * vmw_validation_bo_reserve, and fences them with a fence object if the
+ * given fence object is not NULL.
*/
static inline void
vmw_validation_bo_fence(struct vmw_validation_context *ctx,
struct vmw_fence_obj *fence)
{
- ttm_eu_fence_buffer_objects(&ctx->ticket, &ctx->bo_list,
- (void *) fence);
+ /* fence is able to be NULL if vmw_execbuf_fence_commands() fails */
+ if (fence)
+ ttm_eu_fence_buffer_objects(&ctx->ticket, &ctx->bo_list,
+ (void *)fence);
+ else
+ ttm_eu_backoff_reservation(&ctx->ticket, &ctx->bo_list);
}
/**
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 379/703] drm/vmwgfx: include legacy hotspots in GB-only cursor images
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (375 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 378/703] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 380/703] drm/vmwgfx: keep cursor mappings and pins with each plane state Greg Kroah-Hartman
` (30 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tomas M, Maaz Mombasawala, fausten,
Zack Rusin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas M <tomas@slax.org>
commit c116d38c3ad3ccdc1153ee7713c0eafd62b1c235 upstream.
The guest-backed cursor path without cursor MOB support defines the image
using only the hotspot from the plane state. Its position calculation
also includes the legacy hotspot supplied through DRM_VMW_CURSOR_BYPASS.
Xorg's xf86-video-vmware driver supplies its hotspot through that ioctl
and loads the image with drmModeSetCursor(), which does not set a plane
hotspot. The mismatched image and position hotspots displace the visible
cursor by the legacy offset.
Use the combined hotspot for both the GB-only image command and cursor
position, matching the legacy and MOB image paths.
Fixes: eef295a85082 ("drm/vmwgfx: Restore Guest-Backed only cursor plane support")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Tomas M <tomas@slax.org>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20261027211729.646988-4-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
@@ -815,6 +815,10 @@ vmw_cursor_plane_atomic_update(struct dr
return;
}
+ /* Include legacy Xorg cursor-bypass offsets in the image and position. */
+ hotspot_x = vps->cursor.legacy.hotspot_x + new_state->hotspot_x;
+ hotspot_y = vps->cursor.legacy.hotspot_y + new_state->hotspot_y;
+
switch (vps->cursor.update_type) {
case VMW_CURSOR_UPDATE_LEGACY:
vmw_cursor_plane_update_legacy(dev_priv, vps);
@@ -828,8 +832,7 @@ vmw_cursor_plane_atomic_update(struct dr
vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
vps->base.crtc_w,
vps->base.crtc_h,
- vps->base.hotspot_x,
- vps->base.hotspot_y);
+ hotspot_x, hotspot_y);
break;
case VMW_CURSOR_UPDATE_NONE:
/* do nothing */
@@ -842,9 +845,6 @@ vmw_cursor_plane_atomic_update(struct dr
cursor_x = new_state->crtc_x + du->set_gui_x;
cursor_y = new_state->crtc_y + du->set_gui_y;
- hotspot_x = vps->cursor.legacy.hotspot_x + new_state->hotspot_x;
- hotspot_y = vps->cursor.legacy.hotspot_y + new_state->hotspot_y;
-
vmw_cursor_update_position(dev_priv, true, cursor_x + hotspot_x,
cursor_y + hotspot_y);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 380/703] drm/vmwgfx: keep cursor mappings and pins with each plane state
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (376 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 379/703] drm/vmwgfx: include legacy hotspots in GB-only cursor images Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 381/703] drm/vmwgfx: log missing primary planes only once Greg Kroah-Hartman
` (29 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala,
fausten
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 556271f0ade9d3f1ed0a386f29d3363be294c1fc upstream.
Cursor plane states duplicate the user object reference without acquiring
its mapping or pin. Preparing the duplicated state nevertheless unmaps
that object, and only pins the new buffer if it is not already pinned.
Cleanup of an older state can therefore remove a mapping or pin still
needed by another cursor commit. Repeated cursor updates from KMS clients
can then access an unmapped or movable buffer.
Give each prepared state its own mapping, buffer reference and pin, and
reset the mapping when duplicating a state. Release only the resources
owned by that state in cleanup_fb(). Map the required image extent for
every state so resizing a cursor on the same buffer cannot reuse a
smaller cached mapping. Unwind the pin and reservation if preparation
fails.
Fixes: 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-2-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 69 ++++++++++++++++-----------
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h | 4 +
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 1
3 files changed, 48 insertions(+), 26 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
@@ -112,8 +112,7 @@ static void vmw_cursor_update_mob(struct
{
SVGAGBCursorHeader *header;
SVGAGBAlphaCursorHeader *alpha_header;
- struct vmw_bo *bo = vmw_user_object_buffer(&vps->uo);
- u32 *image = vmw_bo_map_and_cache(bo);
+ u32 *image = vps->cursor.map.virtual;
const u32 image_size = vps->base.crtc_w * vps->base.crtc_h * sizeof(*image);
header = vmw_bo_map_and_cache(vps->cursor.mob);
@@ -132,7 +131,6 @@ static void vmw_cursor_update_mob(struct
memcpy(header + 1, image, image_size);
vmw_write(vmw, SVGA_REG_CURSOR_MOBID, vmw_bo_mobid(vps->cursor.mob));
- vmw_bo_unmap(bo);
vmw_bo_unmap(vps->cursor.mob);
}
@@ -490,9 +488,21 @@ vmw_cursor_plane_cleanup_fb(struct drm_p
{
struct vmw_cursor_plane *vcp = vmw_plane_to_vcp(plane);
struct vmw_plane_state *vps = vmw_plane_state_to_vps(old_state);
+ struct vmw_bo *bo;
+ int ret;
- if (!vmw_user_object_is_null(&vps->uo))
- vmw_user_object_unmap(&vps->uo);
+ if (vps->cursor.map.bo) {
+ bo = to_vmw_bo(&vps->cursor.map.bo->base);
+ ret = ttm_bo_reserve(&bo->tbo, false, false, NULL);
+ if (WARN_ON_ONCE(ret))
+ return;
+
+ ttm_bo_kunmap(&vps->cursor.map);
+ vps->cursor.map.bo = NULL;
+ ttm_bo_unpin(&bo->tbo);
+ ttm_bo_unreserve(&bo->tbo);
+ vmw_bo_unreference(&bo);
+ }
vmw_cursor_mob_unmap(vps);
vmw_cursor_mob_put(vcp, vps);
@@ -625,10 +635,12 @@ int vmw_cursor_plane_prepare_fb(struct d
struct vmw_surface *surface;
int ret = 0;
- if (!vmw_user_object_is_null(&vps->uo)) {
- vmw_user_object_unmap(&vps->uo);
+ /*
+ * A duplicated state only owns the user object reference. Its mappings
+ * and pins belong to the old state until cleanup_fb().
+ */
+ if (!vmw_user_object_is_null(&vps->uo))
vmw_user_object_unref(&vps->uo);
- }
if (fb) {
if (vmw_framebuffer_to_vfb(fb)->bo) {
@@ -652,31 +664,34 @@ int vmw_cursor_plane_prepare_fb(struct d
bo = vmw_user_object_buffer(&vps->uo);
if (bo) {
struct ttm_operation_ctx ctx = { false, false };
+ size_t size = (size_t)new_state->crtc_w *
+ new_state->crtc_h * sizeof(u32);
ret = ttm_bo_reserve(&bo->tbo, true, false, NULL);
if (ret != 0)
- return -ENOMEM;
+ return ret;
ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
if (ret != 0)
- return -ENOMEM;
+ goto out_unreserve;
/*
- * vmw_bo_pin_reserved also validates, so to skip
- * the extra validation use ttm_bo_pin directly
+ * vmw_bo_pin_reserved() also validates, so to skip
+ * the extra validation use ttm_bo_pin directly.
+ * Every state takes its own pin, the buffer can
+ * still be in use by an older state whose commit
+ * hasn't been cleaned up yet.
*/
- if (!bo->tbo.pin_count)
- ttm_bo_pin(&bo->tbo);
+ ttm_bo_pin(&bo->tbo);
- if (vmw_framebuffer_to_vfb(fb)->bo) {
- const u32 size = new_state->crtc_w *
- new_state->crtc_h *
- sizeof(u32);
-
- (void)vmw_bo_map_and_cache_size(bo, size);
- } else {
- vmw_bo_map_and_cache(bo);
+ ret = ttm_bo_kmap(&bo->tbo, 0, PFN_UP(size),
+ &vps->cursor.map);
+ if (ret) {
+ vps->cursor.map.bo = NULL;
+ ttm_bo_unpin(&bo->tbo);
+ goto out_unreserve;
}
+ vmw_bo_reference(bo);
ttm_bo_unreserve(&bo->tbo);
}
if (!vmw_user_object_is_null(&vps->uo)) {
@@ -703,6 +718,10 @@ int vmw_cursor_plane_prepare_fb(struct d
}
return 0;
+
+out_unreserve:
+ ttm_bo_unreserve(&bo->tbo);
+ return ret;
}
/**
@@ -796,7 +815,6 @@ void
vmw_cursor_plane_atomic_update(struct drm_plane *plane,
struct drm_atomic_state *state)
{
- struct vmw_bo *bo;
struct drm_plane_state *new_state =
drm_atomic_get_new_plane_state(state, plane);
struct drm_plane_state *old_state =
@@ -827,9 +845,8 @@ vmw_cursor_plane_atomic_update(struct dr
vmw_cursor_update_mob(dev_priv, vps);
break;
case VMW_CURSOR_UPDATE_GB_ONLY:
- bo = vmw_user_object_buffer(&vps->uo);
- if (bo)
- vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
+ if (vps->cursor.map.virtual)
+ vmw_send_define_cursor_cmd(dev_priv, vps->cursor.map.virtual,
vps->base.crtc_w,
vps->base.crtc_h,
hotspot_x, hotspot_y);
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h
@@ -14,6 +14,8 @@
#include "drm/drm_fourcc.h"
#include "drm/drm_plane.h"
+#include <drm/ttm/ttm_bo.h>
+
#include <linux/types.h>
struct SVGA3dCmdHeader;
@@ -41,6 +43,8 @@ struct vmw_cursor_plane_state {
enum vmw_cursor_update_type update_type;
bool changed;
bool surface_changed;
+ /* The mapped buffer is referenced and pinned by this state. */
+ struct ttm_bo_kmap_obj map;
struct vmw_bo *mob;
struct {
s32 hotspot_x;
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -275,6 +275,7 @@ vmw_du_plane_duplicate_state(struct drm_
vps->cpp = 0;
vps->cursor.mob = NULL;
+ memset(&vps->cursor.map, 0, sizeof(vps->cursor.map));
/* Each ref counted resource needs to be acquired again */
vmw_user_object_ref(&vps->uo);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 381/703] drm/vmwgfx: log missing primary planes only once
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (377 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 380/703] drm/vmwgfx: keep cursor mappings and pins with each plane state Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 382/703] drm/vmwgfx: log MOB limits outside the manager spinlock Greg Kroah-Hartman
` (28 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit f01848d84577e5860a187eea64f5321acaf1f893 upstream.
Stop filling kernel logs due to something that's not even a bug. Some
igt tests, e.g. kms_flip trigger this message ~17000 times which makes
all the other diagnostics almost impossible to find.
Just inform the user about this condition once and let it through
afterward.
Fixes: a60ccade88f9 ("drm/vmwgfx: Fix crtc's atomic check conditional")
Cc: stable@vger.kernel.org
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261029215540.3008997-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -147,9 +147,8 @@ int vmw_du_crtc_atomic_check(struct drm_
* some actual rendering so give a clue as why it's blank.
*/
if (new_state->enable && !has_primary)
- drm_dbg_driver(&vmw->drm,
- "CRTC without a primary plane will be blank.\n");
-
+ drm_info_once(&vmw->drm,
+ "CRTC without a primary plane will be blank.\n");
if (new_state->connector_mask != connector_mask &&
new_state->connector_mask != 0) {
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 382/703] drm/vmwgfx: log MOB limits outside the manager spinlock
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (378 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 381/703] drm/vmwgfx: log missing primary planes only once Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 383/703] drm/vmwgfx: reserve cursor MOBs before unpinning them Greg Kroah-Hartman
` (27 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit eee4285a8c3c918bbd21791e17f2bb261a709792 upstream.
vmw_gmrid_man_get_node reports MOB limit expansion and allocation
failures through vmw_host_printf while holding gman->lock. The helper
formats its messages with GFP_KERNEL allocations, which may sleep.
KDE startup and desktop mode changes can reach this path, producing
"BUG: sleeping function called from invalid context" from kvasprintf()
while the manager spinlock is held. That's likely a separate bug
because KDE shouldn't be using that much memory but to debug
that properly stop filling kernel logs with warnings.
Defer both host messages until after dropping the spinlock. Capture the
failed allocation's page limit and roll back its accounting while locked,
then report the error and free the resource after unlocking. Use
drm_warn for the guest messages so they identify the device.
Fixes: cfdc3458db8a ("drm/vmwgfx: Be a lot more flexible with MOB limits")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261029215700.3009996-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 55 ++++++++++++++++----------
1 file changed, 34 insertions(+), 21 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -54,8 +54,11 @@ static int vmw_gmrid_man_get_node(struct
const struct ttm_place *place,
struct ttm_resource **res)
{
+ struct vmw_private *vmw = vmw_priv_from_ttm(bo->bdev);
struct vmwgfx_gmrid_man *gman = to_gmrid_manager(man);
- int id;
+ u32 max_gmr_pages = 0;
+ bool mob_overflow = false;
+ int id, ret = 0;
*res = kmalloc(sizeof(**res), GFP_KERNEL);
if (!*res)
@@ -85,43 +88,53 @@ static int vmw_gmrid_man_get_node(struct
const unsigned long max_graphics_pages = totalram_pages() / 2;
uint32_t new_max_pages = 0;
- DRM_WARN("vmwgfx: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n");
- vmw_host_printf("vmwgfx, warning: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n");
+ mob_overflow = true;
+ drm_warn(&vmw->drm,
+ "vmwgfx: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n");
if (gman->max_gmr_pages > (max_graphics_pages / 2)) {
- DRM_WARN("vmwgfx: guest requires more than half of RAM for graphics.\n");
+ drm_warn(&vmw->drm,
+ "vmwgfx: guest requires more than half of RAM for graphics.\n");
new_max_pages = max_graphics_pages;
} else
new_max_pages = gman->max_gmr_pages * 2;
if (new_max_pages > gman->max_gmr_pages && new_max_pages >= gman->used_gmr_pages) {
- DRM_WARN("vmwgfx: increasing guest mob limits to %u KiB.\n",
- ((new_max_pages) << (PAGE_SHIFT - 10)));
+ drm_warn(&vmw->drm,
+ "vmwgfx: increasing guest mob limits to %u KiB.\n",
+ new_max_pages << (PAGE_SHIFT - 10));
gman->max_gmr_pages = new_max_pages;
} else {
- char buf[256];
- snprintf(buf, sizeof(buf),
- "vmwgfx, error: guest graphics is out of memory (mob limit at: %u KiB).\n",
- ((gman->max_gmr_pages) << (PAGE_SHIFT - 10)));
- vmw_host_printf(buf);
- DRM_WARN("%s", buf);
- goto nospace;
+ max_gmr_pages = gman->max_gmr_pages;
+ gman->used_gmr_pages -= PFN_UP((*res)->size);
+ ret = -ENOSPC;
+ goto out_unlock;
}
}
}
(*res)->start = id;
+out_unlock:
spin_unlock(&gman->lock);
- return 0;
-nospace:
- gman->used_gmr_pages -= PFN_UP((*res)->size);
- spin_unlock(&gman->lock);
- ida_free(&gman->gmr_ida, id);
- ttm_resource_fini(man, *res);
- kfree(*res);
- return -ENOSPC;
+ /* Host logging allocates with GFP_KERNEL and must run unlocked. */
+ if (mob_overflow)
+ vmw_host_printf("%s",
+ "vmwgfx, warning: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n");
+ if (ret) {
+ char buf[256];
+
+ snprintf(buf, sizeof(buf),
+ "vmwgfx, error: guest graphics is out of memory (mob limit at: %u KiB).\n",
+ max_gmr_pages << (PAGE_SHIFT - 10));
+ vmw_host_printf("%s", buf);
+ drm_warn(&vmw->drm, "%s", buf);
+ ida_free(&gman->gmr_ida, id);
+ ttm_resource_fini(man, *res);
+ kfree(*res);
+ }
+ return ret;
}
static void vmw_gmrid_man_put_node(struct ttm_resource_manager *man,
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 383/703] drm/vmwgfx: reserve cursor MOBs before unpinning them
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (379 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 382/703] drm/vmwgfx: log MOB limits outside the manager spinlock Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 384/703] drm/vmwgfx: reserve dumb buffers while detaching their surfaces Greg Kroah-Hartman
` (26 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala,
fausten
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 8a9b3b4c3a6cc95ea959183e20871d2421a6b986 upstream.
vmw_cursor_mob_destroy() unpins cursor MOBs when discarding an image from
the plane's cache or destroying the cursor plane. It calls ttm_bo_unpin()
without reserving the BO, although TTM requires its reservation to be held
when changing pin counts and LRU membership.
KMS clients issuing repeated nonblocking cursor updates can exhaust the
cache and reach this path. On a lockdep-enabled kernel this triggers
reservation assertions in ttm_bo_unpin() and ttm_resource_unevictable().
Reserve the MOB around ttm_bo_unpin(), then release the reservation before
dropping the BO reference.
Fixes: 485d98d472d5 ("drm/vmwgfx: Add support for CursorMob and CursorBypass 4")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-7-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
@@ -150,10 +150,17 @@ static u32 vmw_cursor_mob_size(enum vmw_
static void vmw_cursor_mob_destroy(struct vmw_bo **vbo)
{
+ int ret;
+
if (!(*vbo))
return;
+ ret = ttm_bo_reserve(&(*vbo)->tbo, false, false, NULL);
+ if (WARN_ON_ONCE(ret))
+ return;
+
ttm_bo_unpin(&(*vbo)->tbo);
+ ttm_bo_unreserve(&(*vbo)->tbo);
vmw_bo_unreference(vbo);
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 384/703] drm/vmwgfx: reserve dumb buffers while detaching their surfaces
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (380 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 383/703] drm/vmwgfx: reserve cursor MOBs before unpinning them Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 385/703] drm/vmwgfx: return an error when a shared GB surface has no backup buffer Greg Kroah-Hartman
` (25 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala,
fausten
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 13e766130673ec3b9df8b72ff1dbe6826cac1dfe upstream.
vmw_bo_free() detaches the surface associated with a dumb buffer and
clears its guest memory binding. It reserves the resource, but does not
hold the buffer reservation required by vmw_resource_mob_detach(). TTM
releases that reservation before invoking the buffer destructor.
KMS clients destroying dumb buffers can therefore trigger the reservation
assertion from vmw_resource_mob_detach(). GNOME reaches this path through
DRM_IOCTL_MODE_DESTROY_DUMB during cursor and display updates.
Reacquire the buffer reservation while detaching the surface and clearing
its dirty tracking and guest memory binding. Acquire it after
cmdbuf_mutex, following the command validation lock order, and release it
before releasing the resource and GEM object.
Fixes: d6667f0ddf46 ("drm/vmwgfx: Fix handling of dumb buffers")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-5-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -55,6 +55,8 @@ static void vmw_bo_free(struct ttm_buffe
/* Reserve and switch the backing mob. */
mutex_lock(&res->dev_priv->cmdbuf_mutex);
(void)vmw_resource_reserve(res, false, true);
+ /* TTM drops the reservation before calling the destructor. */
+ dma_resv_lock(bo->base.resv, NULL);
vmw_resource_mob_detach(res);
if (res->dirty)
res->func->dirty_free(res);
@@ -62,6 +64,7 @@ static void vmw_bo_free(struct ttm_buffe
vmw_bo_dirty_release(res->guest_memory_bo);
res->guest_memory_bo = NULL;
res->guest_memory_offset = 0;
+ dma_resv_unlock(bo->base.resv);
vmw_resource_unreserve(res, true, false, false, NULL,
0);
mutex_unlock(&res->dev_priv->cmdbuf_mutex);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 385/703] drm/vmwgfx: return an error when a shared GB surface has no backup buffer
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (381 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 384/703] drm/vmwgfx: reserve dumb buffers while detaching their surfaces Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 386/703] drm/vmwgfx: validate command body sizes before parsing Greg Kroah-Hartman
` (24 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Aldo Ariel Panzardo
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
commit 3a2f97af36754b64083d463a4cee0af26826bec8 upstream.
vmw_gb_surface_reference_internal() rejects a surface that has no backup
buffer by logging an error and jumping to out_bad_resource, but it never
sets ret on that path. ret is still 0 from the earlier successful
vmw_surface_handle_reference(), so the ioctl returns success while
leaving the reply structure unfilled — user space is handed a
"successful" reply that was never produced. DRM_VMW_GB_SURFACE_REF is
DRM_RENDER_ALLOW, so an unprivileged local user can reach it.
Set ret to -EINVAL and, on the error paths, drop the reference that
vmw_surface_handle_reference() took; once the ioctl fails user space no
longer releases it via DRM_VMW_UNREF_SURFACE. The unref is guarded by
ret so the shared success fall-through keeps the reference the caller
still owns, and it also plugs the same leak on the drm_gem_handle_create()
failure path.
Fixes: 14b1c33e8429 ("drm/vmwgfx: Add new ioctl for GB surface create and reference")
Cc: stable@vger.kernel.org
Suggested-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
[zack: aligned a continuation line with the open parenthesis]
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20261007212051.2574235-2-qwe.aldo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1720,6 +1720,7 @@ vmw_gb_surface_reference_internal(struct
srf = &user_srf->srf;
if (!srf->res.guest_memory_bo) {
DRM_ERROR("Shared GB surface is missing a backup buffer.\n");
+ ret = -EINVAL;
goto out_bad_resource;
}
metadata = &srf->metadata;
@@ -1758,6 +1759,9 @@ vmw_gb_surface_reference_internal(struct
rep->creq.must_be_zero = 0;
out_bad_resource:
+ if (ret)
+ ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
+ base->handle);
ttm_base_object_unref(&base);
return ret;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 386/703] drm/vmwgfx: validate command body sizes before parsing
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (382 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 385/703] drm/vmwgfx: return an error when a shared GB surface has no backup buffer Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 387/703] drm/vmwgfx: validate GB-only cursor command limits Greg Kroah-Hartman
` (23 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 06069d6d650dbef746eb933e2f4fbfc686b6d330 upstream.
vmw_cmd_check verifies that a command's declared size fits in the
submitted buffer, but handlers can access fields beyond the declared
body. A truncated body can therefore cause relocations to target the
next command. Applying those relocations after validation can change
an already validated command ID and bypass command restrictions.
Legacy query conversion can also overwrite the next command, while
texture-state parsing can access fields beyond a truncated final record.
Check each handler's minimum body size before accessing command fields.
Use the common prefix for shared handlers to preserve shorter command
variants, and reject texture-state arrays containing incomplete records.
Fixes: fb1d9738ca05 ("drm/vmwgfx: Add DRM driver for VMware Virtual GPU")
Cc: stable@vger.kernel.org
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Link: https://patch.msgid.link/20261111193836.3161904-1-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 200 ++++++++++++++++++++++++++++++++
1 file changed, 200 insertions(+)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -565,6 +565,29 @@ static int vmw_cmd_ok(struct vmw_private
}
/**
+ * vmw_cmd_body_fits - Check that a command body covers what a handler reads
+ *
+ * @header: Pointer to the command header in the command stream.
+ * @size: Number of body bytes that the command handler interprets.
+ *
+ * vmw_cmd_check() only verifies that @header->size fits into the submitted
+ * command buffer. A handler that reads past the declared body reads the next
+ * command, which is verified separately. A relocation recorded there would
+ * rewrite the already verified command after verification has finished.
+ *
+ * Return: true if the body is at least @size bytes, false otherwise.
+ */
+static bool vmw_cmd_body_fits(const SVGA3dCmdHeader *header, size_t size)
+{
+ if (likely(header->size >= size))
+ return true;
+
+ VMW_DEBUG_USER("SVGA3D command %u: body size %u is smaller than %zu.\n",
+ header->id, header->size, size);
+ return false;
+}
+
+/**
* vmw_resources_reserve - Reserve all resources on the sw_context's resource
* list.
*
@@ -810,6 +833,9 @@ static int vmw_cmd_cid_check(struct vmw_
VMW_DECLARE_CMD_VAR(*cmd, uint32_t) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
&cmd->body, NULL);
@@ -853,6 +879,8 @@ static int vmw_cmd_set_render_target_che
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (cmd->body.type >= SVGA3D_RT_MAX) {
VMW_DEBUG_USER("Illegal render target type %u.\n",
@@ -898,6 +926,8 @@ static int vmw_cmd_surface_copy_check(st
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
@@ -918,6 +948,9 @@ static int vmw_cmd_buffer_copy_check(str
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.src, NULL);
@@ -937,6 +970,9 @@ static int vmw_cmd_pred_copy_check(struc
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.srcSid, NULL);
@@ -956,6 +992,9 @@ static int vmw_cmd_stretch_blt_check(str
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.src.sid, NULL);
@@ -974,6 +1013,9 @@ static int vmw_cmd_blt_surf_screen_check
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBlitSurfaceToScreen) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.srcImage.sid, NULL);
@@ -986,6 +1028,9 @@ static int vmw_cmd_present_check(struct
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdPresent) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1243,6 +1288,8 @@ static int vmw_cmd_dx_define_query(struc
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (cmd->body.type < SVGA3D_QUERYTYPE_MIN ||
cmd->body.type >= SVGA3D_QUERYTYPE_MAX)
@@ -1280,6 +1327,8 @@ static int vmw_cmd_dx_bind_query(struct
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
/*
* Look up the buffer pointed to by q.mobid, put it on the relocation
@@ -1310,6 +1359,9 @@ static int vmw_cmd_begin_gb_query(struct
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBeginGBQuery) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
&cmd->body.cid, NULL);
@@ -1329,6 +1381,9 @@ static int vmw_cmd_begin_query(struct vm
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBeginQuery) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (unlikely(dev_priv->has_mob)) {
VMW_DECLARE_CMD_VAR(gb_cmd, SVGA3dCmdBeginGBQuery);
@@ -1364,6 +1419,9 @@ static int vmw_cmd_end_gb_query(struct v
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
if (unlikely(ret != 0))
return ret;
@@ -1394,6 +1452,9 @@ static int vmw_cmd_end_query(struct vmw_
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (dev_priv->has_mob) {
VMW_DECLARE_CMD_VAR(gb_cmd, SVGA3dCmdEndGBQuery);
@@ -1440,6 +1501,9 @@ static int vmw_cmd_wait_gb_query(struct
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
if (unlikely(ret != 0))
return ret;
@@ -1468,6 +1532,9 @@ static int vmw_cmd_wait_query(struct vmw
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (dev_priv->has_mob) {
VMW_DECLARE_CMD_VAR(gb_cmd, SVGA3dCmdWaitForGBQuery);
@@ -1637,6 +1704,15 @@ static int vmw_cmd_tex_state(struct vmw_
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
+ /* The loop below must not read a truncated trailing state. */
+ if ((header->size - sizeof(cmd->body)) % sizeof(*cur_state)) {
+ VMW_DEBUG_USER("Invalid texture state size %u.\n",
+ header->size);
+ return -EINVAL;
+ }
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -1782,6 +1858,9 @@ static int vmw_cmd_bind_gb_surface(struc
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBindGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_surface,
user_surface_converter, &cmd->body.sid,
&cmd->body.mobid, 0);
@@ -1801,6 +1880,9 @@ static int vmw_cmd_update_gb_image(struc
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdUpdateGBImage) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.image.sid, NULL);
@@ -1820,6 +1902,9 @@ static int vmw_cmd_update_gb_surface(str
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdUpdateGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_CLEAR, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1839,6 +1924,9 @@ static int vmw_cmd_readback_gb_image(str
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdReadbackGBImage) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.image.sid, NULL);
@@ -1859,6 +1947,9 @@ static int vmw_cmd_readback_gb_surface(s
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdReadbackGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_CLEAR, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1879,6 +1970,9 @@ static int vmw_cmd_invalidate_gb_image(s
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdInvalidateGBImage) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.image.sid, NULL);
@@ -1899,6 +1993,9 @@ static int vmw_cmd_invalidate_gb_surface
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdInvalidateGBSurface) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_CLEAR, user_surface_converter,
&cmd->body.sid, NULL);
@@ -1921,6 +2018,8 @@ static int vmw_cmd_shader_define(struct
struct vmw_resource *ctx;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -1960,6 +2059,8 @@ static int vmw_cmd_shader_destroy(struct
struct vmw_resource *ctx;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -1999,6 +2100,8 @@ static int vmw_cmd_set_shader(struct vmw
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (!vmw_shadertype_is_valid(VMW_SM_LEGACY, cmd->body.type)) {
VMW_DEBUG_USER("Illegal shader type %u.\n",
@@ -2077,6 +2180,8 @@ static int vmw_cmd_set_shader_const(stru
int ret;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET, user_context_converter,
@@ -2104,6 +2209,9 @@ static int vmw_cmd_bind_gb_shader(struct
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdBindGBShader) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
return vmw_cmd_switch_backup(dev_priv, sw_context, vmw_res_shader,
user_shader_converter, &cmd->body.shid,
&cmd->body.mobid, cmd->body.offsetInBytes);
@@ -2133,6 +2241,9 @@ vmw_cmd_dx_set_single_constant_buffer(st
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.sid, &res);
@@ -2186,6 +2297,9 @@ vmw_cmd_dx_set_constant_buffer_offset(st
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (cmd->body.slot >= SVGA3D_DX_MAX_CONSTBUFFERS) {
VMW_DEBUG_USER("Illegal const buffer slot %u.\n",
(unsigned int) cmd->body.slot);
@@ -2217,6 +2331,9 @@ static int vmw_cmd_dx_set_shader_res(str
u32 num_sr_view = (cmd->header.size - sizeof(cmd->body)) /
sizeof(SVGA3dShaderResourceViewId);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if ((u64) cmd->body.startView + (u64) num_sr_view >
(u64) SVGA3D_DX_MAX_SRVIEWS ||
!vmw_shadertype_is_valid(dev_priv->sm_type, cmd->body.type)) {
@@ -2252,6 +2369,8 @@ static int vmw_cmd_dx_set_shader(struct
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
if (!vmw_shadertype_is_valid(dev_priv->sm_type, cmd->body.type)) {
VMW_DEBUG_USER("Illegal shader type %u.\n",
@@ -2309,6 +2428,9 @@ static int vmw_cmd_dx_set_vertex_buffers
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
num = (cmd->header.size - sizeof(cmd->body)) /
sizeof(SVGA3dVertexBuffer);
if ((u64)num + (u64)cmd->body.startBuffer >
@@ -2360,6 +2482,9 @@ static int vmw_cmd_dx_set_index_buffer(s
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.sid, &res);
@@ -2395,6 +2520,9 @@ static int vmw_cmd_dx_set_rendertargets(
sizeof(SVGA3dRenderTargetViewId);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (num_rt_view > SVGA3D_DX_MAX_RENDER_TARGETS) {
VMW_DEBUG_USER("Invalid DX Rendertarget binding.\n");
return -EINVAL;
@@ -2426,6 +2554,9 @@ static int vmw_cmd_dx_clear_rendertarget
container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_view_id_val_add(sw_context, vmw_view_rt,
cmd->body.renderTargetViewId);
@@ -2448,6 +2579,9 @@ static int vmw_cmd_dx_clear_depthstencil
container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_view_id_val_add(sw_context, vmw_view_ds,
cmd->body.depthStencilViewId);
@@ -2481,6 +2615,9 @@ static int vmw_cmd_dx_view_define(struct
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(*cmd) - sizeof(*header)))
+ return -EINVAL;
+
if (unlikely(cmd->sid == SVGA3D_INVALID_ID)) {
VMW_DEBUG_USER("Invalid surface id.\n");
return -EINVAL;
@@ -2529,6 +2666,9 @@ static int vmw_cmd_dx_set_so_targets(str
return -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
num = (cmd->header.size - sizeof(cmd->body)) / sizeof(SVGA3dSoTarget);
if (num > SVGA3D_DX_MAX_SOTARGETS) {
@@ -2582,6 +2722,9 @@ static int vmw_cmd_dx_so_define(struct v
if (IS_ERR_OR_NULL(res))
return res ? PTR_ERR(res) : -EINVAL;
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(*cmd) - sizeof(*header)))
+ return -EINVAL;
+
ret = vmw_cotable_notify(res, cmd->defined_id);
return ret;
@@ -2617,6 +2760,9 @@ static int vmw_cmd_dx_check_subresource(
offsetof(typeof(*cmd), sid));
cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->sid)))
+ return -EINVAL;
+
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->sid, NULL);
@@ -2658,6 +2804,9 @@ static int vmw_cmd_dx_view_remove(struct
struct vmw_resource *view;
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node)
return -EINVAL;
@@ -2695,6 +2844,9 @@ static int vmw_cmd_dx_define_shader(stru
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node)
return -EINVAL;
@@ -2726,6 +2878,9 @@ static int vmw_cmd_dx_destroy_shader(str
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node)
return -EINVAL;
@@ -2752,6 +2907,9 @@ static int vmw_cmd_dx_bind_shader(struct
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (cmd->body.cid != SVGA3D_INVALID_ID) {
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_context,
VMW_RES_DIRTY_SET,
@@ -2803,6 +2961,9 @@ static int vmw_cmd_dx_genmips(struct vmw
struct vmw_resource *view;
struct vmw_res_cache_entry *rcache;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
view = vmw_view_id_val_add(sw_context, vmw_view_sr,
cmd->body.shaderResourceViewId);
if (IS_ERR(view))
@@ -2836,6 +2997,9 @@ static int vmw_cmd_dx_transfer_from_buff
container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
VMW_RES_DIRTY_NONE, user_surface_converter,
&cmd->body.srcSid, NULL);
@@ -2861,6 +3025,9 @@ static int vmw_cmd_intra_surface_copy(st
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdIntraSurfaceCopy) =
container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!(dev_priv->capabilities2 & SVGA_CAP2_INTRA_SURFACE_COPY))
return -EINVAL;
@@ -2909,6 +3076,9 @@ static int vmw_cmd_clear_uav_uint(struct
} *cmd = container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -2928,6 +3098,9 @@ static int vmw_cmd_clear_uav_float(struc
} *cmd = container_of(header, typeof(*cmd), header);
struct vmw_resource *ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -2949,6 +3122,9 @@ static int vmw_cmd_set_uav(struct vmw_pr
sizeof(SVGA3dUAViewId);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -2981,6 +3157,9 @@ static int vmw_cmd_set_cs_uav(struct vmw
sizeof(SVGA3dUAViewId);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3013,6 +3192,9 @@ static int vmw_cmd_dx_define_streamoutpu
} *cmd = container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3044,6 +3226,9 @@ static int vmw_cmd_dx_destroy_streamoutp
SVGA3dCmdDXDestroyStreamOutput body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node) {
DRM_ERROR("DX Context not set.\n");
return -EINVAL;
@@ -3081,6 +3266,9 @@ static int vmw_cmd_dx_bind_streamoutput(
} *cmd = container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3123,6 +3311,9 @@ static int vmw_cmd_dx_set_streamoutput(s
} *cmd = container_of(header, typeof(*cmd), header);
int ret;
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!ctx_node) {
DRM_ERROR("DX Context not set.\n");
return -EINVAL;
@@ -3175,6 +3366,9 @@ static int vmw_cmd_indexed_instanced_ind
SVGA3dCmdDXDrawIndexedInstancedIndirect body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3192,6 +3386,9 @@ static int vmw_cmd_instanced_indirect(st
SVGA3dCmdDXDrawInstancedIndirect body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
@@ -3209,6 +3406,9 @@ static int vmw_cmd_dispatch_indirect(str
SVGA3dCmdDXDispatchIndirect body;
} *cmd = container_of(header, typeof(*cmd), header);
+ if (!vmw_cmd_body_fits(header, sizeof(cmd->body)))
+ return -EINVAL;
+
if (!has_sm5_context(dev_priv))
return -EINVAL;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 387/703] drm/vmwgfx: validate GB-only cursor command limits
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (383 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 386/703] drm/vmwgfx: validate command body sizes before parsing Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 388/703] drm/vmwgfx: validate the framebuffer selected for cursor updates Greg Kroah-Hartman
` (22 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yunfeng Li, Zack Rusin,
Maaz Mombasawala
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit 6baeb251d709d5f31f2a0ae89ca5ca054d0e04e7 upstream.
Guest-backed devices without cursor MOB support define cursor images with
SVGA_CMD_DEFINE_ALPHA_CURSOR. SVGA_REG_CURSOR_MAX_DIMENSION belongs to the
cursor MOB register class and reads as zero on devices that do not expose
that class. Applying this register to GB-only cursors rejects every
nonempty image submitted by KMS clients, leaving Xorg without a hardware
cursor.
The submission transport also limits the command size. A 96x96 image fits
the 40 KiB FIFO image limit, but exceeds the 32 KiB command-buffer limit
and causes a device command error when submitted through that transport.
Validate GB-only images against SVGA_MAX_CURSOR_CMD_DIMENSION and
SVGA_MAX_CURSOR_CMD_BYTES. For command-buffer submission, also bound the
whole command by SVGA_CB_MAX_COMMAND_SIZE, including its header. Calculate
the image byte count in 64 bits and keep the register-based dimension and
MOB size checks for MOB cursors.
Fixes: d5ed8749168a ("drm/vmwgfx: enforce cursor size limits for MOB cursors")
Cc: stable@vger.kernel.org
Reported-by: Yunfeng Li <yunfeng.li.nb@gmail.com>
Closes: https://patch.msgid.link/20260830151619.2452307-1-yunfeng.li.nb@gmail.com
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-3-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
@@ -785,8 +785,27 @@ int vmw_cursor_plane_atomic_check(struct
"surface not suitable for cursor\n");
return -EINVAL;
}
- } else if (update_type == VMW_CURSOR_UPDATE_GB_ONLY ||
- update_type == VMW_CURSOR_UPDATE_MOB) {
+ } else if (update_type == VMW_CURSOR_UPDATE_GB_ONLY) {
+ u64 image_size = (u64)new_state->crtc_w *
+ new_state->crtc_h * sizeof(u32);
+ u32 max_size = SVGA_MAX_CURSOR_CMD_BYTES;
+
+ /* The command-buffer limit includes the define-cursor header. */
+ if (vmw->cman)
+ max_size = min_t(u32, max_size,
+ SVGA_CB_MAX_COMMAND_SIZE -
+ sizeof(struct vmw_svga_fifo_cmd_define_cursor));
+
+ if (!new_state->crtc_w || !new_state->crtc_h ||
+ new_state->crtc_w > SVGA_MAX_CURSOR_CMD_DIMENSION ||
+ new_state->crtc_h > SVGA_MAX_CURSOR_CMD_DIMENSION ||
+ image_size > max_size) {
+ drm_dbg_kms(&vmw->drm,
+ "Cursor dimensions (%u, %u) violate command limits\n",
+ new_state->crtc_w, new_state->crtc_h);
+ return -EINVAL;
+ }
+ } else if (update_type == VMW_CURSOR_UPDATE_MOB) {
u32 cursor_max_dim =
vmw_read(vmw, SVGA_REG_CURSOR_MAX_DIMENSION);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 388/703] drm/vmwgfx: validate the framebuffer selected for cursor updates
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (384 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 387/703] drm/vmwgfx: validate GB-only cursor command limits Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 389/703] drm/vmwgfx: close TOCTOU on guest_memory_bo in surface reference ioctl Greg Kroah-Hartman
` (21 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zack Rusin, Maaz Mombasawala,
fausten
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zack Rusin <zack.rusin@broadcom.com>
commit d6263d9bfa931dfc7e0dd922a6ee52b5535caa74 upstream.
Cursor atomic checks select an update path and look up surfaces through
vps->uo. That object is copied from the previous plane state and is only
replaced with the new framebuffer's object in prepare_fb(). Switching
between snooped surfaces and buffer objects therefore applies the old
framebuffer's cursor limits to the new image.
KMS clients can also submit a guest-backed surface without a backing BO.
The check accepts it, but the MOB update later copies from a NULL source.
Zero-sized MOB images pass the check as well, then fail preparation when
mapping zero pages, so TEST_ONLY accepts a commit that cannot succeed.
Resolve the user object directly from the selected framebuffer in both
validation and preparation. Apply the matching cursor limits, reject
zero dimensions and require a backing BO for GB-only and MOB images.
Recheck the backing BO in preparation before mapping it, while keeping
snooped surfaces independent of a BO mapping.
Fixes: 965544150d1c ("drm/vmwgfx: Refactor cursor handling")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-6-zack.rusin@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c | 59 +++++++++++++++++++--------
1 file changed, 42 insertions(+), 17 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
@@ -89,10 +89,26 @@ vmw_cursor_plane_update_legacy(struct vm
}
}
+static struct vmw_user_object
+vmw_cursor_plane_user_object(struct drm_framebuffer *fb)
+{
+ struct vmw_user_object uo = { 0 };
+
+ if (!fb)
+ return uo;
+
+ if (vmw_framebuffer_to_vfb(fb)->bo)
+ uo.buffer = vmw_framebuffer_to_vfbd(fb)->buffer;
+ else
+ uo = vmw_framebuffer_to_vfbs(fb)->uo;
+
+ return uo;
+}
+
static enum vmw_cursor_update_type
-vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
+vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_user_object *uo)
{
- struct vmw_surface *surface = vmw_user_object_surface(&vps->uo);
+ struct vmw_surface *surface = vmw_user_object_surface(uo);
if (surface && surface->snooper.image)
return VMW_CURSOR_UPDATE_LEGACY;
@@ -649,17 +665,10 @@ int vmw_cursor_plane_prepare_fb(struct d
if (!vmw_user_object_is_null(&vps->uo))
vmw_user_object_unref(&vps->uo);
- if (fb) {
- if (vmw_framebuffer_to_vfb(fb)->bo) {
- vps->uo.buffer = vmw_framebuffer_to_vfbd(fb)->buffer;
- vps->uo.surface = NULL;
- } else {
- memcpy(&vps->uo, &vmw_framebuffer_to_vfbs(fb)->uo, sizeof(vps->uo));
- }
- vmw_user_object_ref(&vps->uo);
- }
+ vps->uo = vmw_cursor_plane_user_object(fb);
+ vmw_user_object_ref(&vps->uo);
- vps->cursor.update_type = vmw_cursor_update_type(vmw, vps);
+ vps->cursor.update_type = vmw_cursor_update_type(vmw, &vps->uo);
switch (vps->cursor.update_type) {
case VMW_CURSOR_UPDATE_LEGACY:
surface = vmw_user_object_surface(&vps->uo);
@@ -669,6 +678,9 @@ int vmw_cursor_plane_prepare_fb(struct d
case VMW_CURSOR_UPDATE_GB_ONLY:
case VMW_CURSOR_UPDATE_MOB: {
bo = vmw_user_object_buffer(&vps->uo);
+ if (fb && !bo)
+ return -EINVAL;
+
if (bo) {
struct ttm_operation_ctx ctx = { false, false };
size_t size = (size_t)new_state->crtc_w *
@@ -751,7 +763,7 @@ int vmw_cursor_plane_atomic_check(struct
int ret = 0;
struct drm_crtc_state *crtc_state = NULL;
struct vmw_surface *surface = NULL;
- struct vmw_plane_state *vps = vmw_plane_state_to_vps(new_state);
+ struct vmw_user_object uo;
enum vmw_cursor_update_type update_type;
struct drm_framebuffer *fb = new_state->fb;
@@ -770,7 +782,21 @@ int vmw_cursor_plane_atomic_check(struct
if (!fb)
return 0;
- update_type = vmw_cursor_update_type(vmw, vps);
+ if (!new_state->crtc_w || !new_state->crtc_h) {
+ drm_dbg_kms(&vmw->drm,
+ "Cursor dimensions (%u, %u) must be nonzero\n",
+ new_state->crtc_w, new_state->crtc_h);
+ return -EINVAL;
+ }
+
+ /* The duplicated plane state's user object still belongs to the old FB. */
+ uo = vmw_cursor_plane_user_object(fb);
+ update_type = vmw_cursor_update_type(vmw, &uo);
+ if ((update_type == VMW_CURSOR_UPDATE_GB_ONLY ||
+ update_type == VMW_CURSOR_UPDATE_MOB) &&
+ !vmw_user_object_buffer(&uo))
+ return -EINVAL;
+
if (update_type == VMW_CURSOR_UPDATE_LEGACY) {
if (new_state->crtc_w != VMW_CURSOR_SNOOP_WIDTH ||
new_state->crtc_h != VMW_CURSOR_SNOOP_HEIGHT) {
@@ -779,7 +805,7 @@ int vmw_cursor_plane_atomic_check(struct
new_state->crtc_w, new_state->crtc_h);
return -EINVAL;
}
- surface = vmw_user_object_surface(&vps->uo);
+ surface = vmw_user_object_surface(&uo);
if (!surface || !surface->snooper.image) {
drm_warn(&vmw->drm,
"surface not suitable for cursor\n");
@@ -796,8 +822,7 @@ int vmw_cursor_plane_atomic_check(struct
SVGA_CB_MAX_COMMAND_SIZE -
sizeof(struct vmw_svga_fifo_cmd_define_cursor));
- if (!new_state->crtc_w || !new_state->crtc_h ||
- new_state->crtc_w > SVGA_MAX_CURSOR_CMD_DIMENSION ||
+ if (new_state->crtc_w > SVGA_MAX_CURSOR_CMD_DIMENSION ||
new_state->crtc_h > SVGA_MAX_CURSOR_CMD_DIMENSION ||
image_size > max_size) {
drm_dbg_kms(&vmw->drm,
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 389/703] drm/vmwgfx: close TOCTOU on guest_memory_bo in surface reference ioctl
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (385 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 388/703] drm/vmwgfx: validate the framebuffer selected for cursor updates Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 390/703] ALSA: pcm: oss: Restore params flag after failed reconfiguration Greg Kroah-Hartman
` (20 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Aldo Ariel Panzardo,
Zack Rusin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
commit 30131b82b062180183a09a97183a944fadab72ee upstream.
vmw_gb_surface_reference_internal() checks srf->res.guest_memory_bo
for NULL and reads its vma_node offset and base.size outside the
cmdbuf_mutex scope that protects the backup pointer.
A concurrent backup switch, e.g. from SVGA_3D_CMD_BIND_GB_SURFACE
via vmw_resource_unreserve(), drops its reference to the old buffer
and installs a new one under cmdbuf_mutex. The unlocked check in
the surface reference ioctl can see a transient NULL. The reads
after the unlock can return another buffer's offset and size; a
further switch can drop that buffer's last reference and free it
while the ioctl reads from it.
Move the NULL check inside the mutex, and read buffer_map_handle
and buffer_size while still holding it.
Fixes: a97e21923b42 ("drm/vmwgfx: Hook up guest-backed surfaces")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/20260808233347.209DD1F000E9@smtp.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patch.msgid.link/20261007212051.2574235-3-qwe.aldo@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1718,23 +1718,32 @@ vmw_gb_surface_reference_internal(struct
user_srf = container_of(base, struct vmw_user_surface, prime.base);
srf = &user_srf->srf;
+ metadata = &srf->metadata;
+
+ mutex_lock(&dev_priv->cmdbuf_mutex);
+
if (!srf->res.guest_memory_bo) {
+ mutex_unlock(&dev_priv->cmdbuf_mutex);
DRM_ERROR("Shared GB surface is missing a backup buffer.\n");
ret = -EINVAL;
goto out_bad_resource;
}
- metadata = &srf->metadata;
- mutex_lock(&dev_priv->cmdbuf_mutex); /* Protect res->backup */
ret = drm_gem_handle_create(file_priv, &srf->res.guest_memory_bo->tbo.base,
&backup_handle);
- mutex_unlock(&dev_priv->cmdbuf_mutex);
if (ret != 0) {
+ mutex_unlock(&dev_priv->cmdbuf_mutex);
drm_err(dev, "Wasn't able to create a backing handle for surface sid = %u.\n",
req->sid);
goto out_bad_resource;
}
+ rep->crep.buffer_map_handle =
+ drm_vma_node_offset_addr(&srf->res.guest_memory_bo->tbo.base.vma_node);
+ rep->crep.buffer_size = srf->res.guest_memory_bo->tbo.base.size;
+
+ mutex_unlock(&dev_priv->cmdbuf_mutex);
+
rep->creq.base.svga3d_flags = SVGA3D_FLAGS_LOWER_32(metadata->flags);
rep->creq.base.format = metadata->format;
rep->creq.base.mip_levels = metadata->mip_levels[0];
@@ -1747,9 +1756,6 @@ vmw_gb_surface_reference_internal(struct
rep->crep.handle = user_srf->prime.base.handle;
rep->crep.backup_size = srf->res.guest_memory_size;
rep->crep.buffer_handle = backup_handle;
- rep->crep.buffer_map_handle =
- drm_vma_node_offset_addr(&srf->res.guest_memory_bo->tbo.base.vma_node);
- rep->crep.buffer_size = srf->res.guest_memory_bo->tbo.base.size;
rep->creq.version = drm_vmw_gb_surface_v1;
rep->creq.svga3d_flags_upper_32_bits =
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 390/703] ALSA: pcm: oss: Restore params flag after failed reconfiguration
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (386 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 389/703] drm/vmwgfx: close TOCTOU on guest_memory_bo in surface reference ioctl Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 391/703] ACPI: CPPC: Reject EPP registers narrower than 8 bits Greg Kroah-Hartman
` (19 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ye Weihua, Takashi Iwai
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Weihua <yeweihua4@huawei.com>
commit bc3d6817c5325e76578cdd75e9c08bdadc5f73c4 upstream.
snd_pcm_runtime_buffer_set_silence() may fail with -EBUSY when a
concurrent PCM transfer is accessing the buffer. The error path
releases runtime->oss.buffer and clears the plugins, but leaves
runtime->oss.params cleared as well. A subsequent small read/write
then skips the reconfiguration and dereferences the released buffer:
Unable to handle kernel NULL pointer dereference at virtual address
0000000000000000
pc : __arch_copy_from_user+0x78/0x23c
lr : snd_pcm_oss_write+0x10c/0x340 [snd_pcm_oss]
Restore runtime->oss.params on the error path so that the next OSS
operation reconfigures and reallocates the buffer.
Fixes: 47c27c9c9c72 ("ALSA: pcm: Improve the fix for race of buffer access at PCM OSS layer")
Cc: stable@vger.kernel.org
Signed-off-by: Ye Weihua <yeweihua4@huawei.com>
Link: https://patch.msgid.link/20261116064850.3540576-1-yeweihua4@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/core/oss/pcm_oss.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1082,8 +1082,10 @@ static int snd_pcm_oss_change_params_loc
err = 0;
failure:
- if (err)
+ if (err) {
+ runtime->oss.params = 1;
snd_pcm_oss_release_buffers(substream);
+ }
kfree(sw_params);
kfree(params);
kfree(sparams);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 391/703] ACPI: CPPC: Reject EPP registers narrower than 8 bits
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (387 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 390/703] ALSA: pcm: oss: Restore params flag after failed reconfiguration Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 392/703] ARC: io: work around GCC PR127718 in __raw_write{w,l}() Greg Kroah-Hartman
` (18 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Loehle,
Mario Limonciello (AMD), Rafael J. Wysocki
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <christian.loehle@arm.com>
commit 7aca8e31a8fbf2ceffb487cec67ae300b95fa8b1 upstream.
The EPP interfaces use an 8-bit preference, but ACPI permits narrower
fields. With a 4- or 6-bit SystemMemory field, writing 128 succeeds but
stores zero, requesting maximum performance instead.
Reject a present EPP register narrower than eight bits during _CPC probe.
Use the existing error path to release previously acquired resources and
leave the CPU's CPPC descriptor unpublished. Keep absent EPP entries and
registers at least eight bits wide on their existing paths.
Fail the whole probe instead of disabling only EPP. This also makes
amd-pstate's acpi_cpc_valid() check reject the platform before registering
its MSR or shared-memory driver. No affected hardware is known or
expected and the specification is expected to no longer permit these
in the future [1].
Fixes: 922607a2b462 ("cpufreq: CPPC: Add support for autonomous selection")
Link: https://github.com/tianocore/edk2/issues/10838 [1]
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Cc: All applicable <stable@vger.kernel.org>
[ rjw: Changelog tweak ]
Link: https://patch.msgid.link/20261113130411.1433174-1-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/acpi/cppc_acpi.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -809,6 +809,15 @@ int acpi_cppc_processor_probe(struct acp
gas_t = (struct cpc_reg *)
cpc_obj->buffer.pointer;
+ /* EPP interfaces require the full 0-255 preference range. */
+ if (i - 2 == ENERGY_PERF && gas_t->bit_width < 8 &&
+ !IS_NULL_REG(gas_t)) {
+ pr_debug("CPU%d: EPP register width %u is not supported\n",
+ pr->id, gas_t->bit_width);
+ ret = -EOPNOTSUPP;
+ goto out_free;
+ }
+
/*
* The PCC Subspace index is encoded inside
* the CPC table entries. The same PCC index
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 392/703] ARC: io: work around GCC PR127718 in __raw_write{w,l}()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (388 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 391/703] ACPI: CPPC: Reject EPP registers narrower than 8 bits Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 393/703] arm64/mm: fix destructor for unconstructed hotplug page tables Greg Kroah-Hartman
` (17 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Vineet Gupta
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <vgupta@kernel.org>
commit 603b4fd69b4e77770761ea03451e2164186f8590 upstream.
The __raw_write{w,l}() accessors use inline asm with an "m" operand for
the store destination. GCC's ARC backend lets "m" match any legitimate
address, including the register-indexed [b,c] forms that only loads
support: stores only have [reg], [reg,s9] and [limm] addressing. With
newer GCC (late-combine in GCC 15, combine in GCC 16), a writew() with a
scaled, non-constant offset gets
stw.as r2,[r0,r1]
which the assembler rejects:
Error: inappropriate arguments for opcode 'stw'
With GCC 16 this breaks even hsdk_defconfig (drivers/net/pcs/
pcs-xpcs-plat.c) and axs101_defconfig. allyesconfig additionally trips
in drivers/pinctrl/renesas/pinctrl-rza2.c and drivers/video/fbdev/
s3c-fb.c.
Work around it by passing the address in a register and using a fixed
[%1] address in the asm template, so the compiler can't pick an
addressing mode that stores don't support. This is the minimal fix.
The next patch drops the inline asm altogether.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127718
Cc: stable@vger.kernel.org
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arc/include/asm/io.h | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -133,10 +133,14 @@ static inline void __raw_writeb(u8 b, vo
#define __raw_writew __raw_writew
static inline void __raw_writew(u16 s, volatile void __iomem *addr)
{
+ /*
+ * Not an "m" operand: GCC can pick a register-indexed address for it,
+ * which ST doesn't support (GCC PR target/127718).
+ */
__asm__ __volatile__(
- " stw%U1 %0, %1 \n"
+ " stw %0, [%1] \n"
:
- : "r" (s), "m" (*(volatile u16 __force *)addr)
+ : "r" (s), "r" (addr)
: "memory");
}
@@ -144,10 +148,11 @@ static inline void __raw_writew(u16 s, v
#define __raw_writel __raw_writel
static inline void __raw_writel(u32 w, volatile void __iomem *addr)
{
+ /* See __raw_writew() above for why this doesn't use an "m" operand. */
__asm__ __volatile__(
- " st%U1 %0, %1 \n"
+ " st %0, [%1] \n"
:
- : "r" (w), "m" (*(volatile u32 __force *)addr)
+ : "r" (w), "r" (addr)
: "memory");
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 393/703] arm64/mm: fix destructor for unconstructed hotplug page tables
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (389 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 392/703] ARC: io: work around GCC PR127718 in __raw_write{w,l}() Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 394/703] arm64: cpufeature: Remove Neoverse-V3/AE from the BBML3 allow list Greg Kroah-Hartman
` (16 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Muchun Song, Andrew Morton,
Kevin Brodsky, David Hildenbrand (Arm), Anshuman Khandual,
Catalin Marinas, Oscar Salvador, Dave Hansen, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Björn Töpel,
Will Deacon, Mark Rutland, Alexander Gordeev, Alistair Popple
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muchun Song <muchun.song@linux.dev>
commit 26601a6c80c52c5336cd02b3379710077aeafc4a upstream.
Commit c594b83457cc ("arm64: mm: call pagetable dtor when freeing
hot-removed page tables") made free_hotplug_pgtable_page()
unconditionally run the page-table destructor. This matches page tables
allocated by the arm64 mapping code, which runs the corresponding
constructors.
However, arm64 also uses the generic sparse-vmemmap population code.
Runtime intermediate page tables allocated by that code do not run a
page-table constructor. Freeing one during memory hot-remove therefore
runs a destructor without a matching constructor and corrupts
NR_PAGETABLE accounting.
Free intermediate page-table pages through pagetable_free(). It runs the
destructor only for constructor-backed pages and then releases the page
through the page-table freeing path.
Link: https://lore.kernel.org/20261023063428.3658761-5-songmuchun@bytedance.com
Fixes: c594b83457cc ("arm64: mm: call pagetable dtor when freeing hot-removed page tables")
Signed-off-by: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Björn Töpel <bjorn@rivosinc.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/mm/mmu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1459,8 +1459,7 @@ static void free_hotplug_page_range(stru
static void free_hotplug_pgtable_page(struct page *page)
{
- pagetable_dtor(page_ptdesc(page));
- free_hotplug_page_range(page, PAGE_SIZE, NULL);
+ pagetable_free(page_ptdesc(page));
}
static bool pgtable_range_aligned(unsigned long start, unsigned long end,
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 394/703] arm64: cpufeature: Remove Neoverse-V3/AE from the BBML3 allow list
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (390 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 393/703] arm64/mm: fix destructor for unconstructed hotplug page tables Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 395/703] arm64: kexec: use a typed entry to fix kCFI oops Greg Kroah-Hartman
` (15 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ryan Roberts, Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Roberts <ryan.roberts@arm.com>
commit 4f9280c8db69bc807c6c6c616f1b9853ca9144c7 upstream.
Neoverse-V3 and Neoverse-V3AE erratum 3053180 can cause a load or store
to livelock when mapping size changes without break-before-make or when
contiguous hints are programmed inconsistently.
The erratum was previously reported as fixed in r0p2. On that basis,
commit 5aa4b625762e ("arm64: Add BBM Level 2 cpu feature") allowed
Neoverse-V3 from r0p2, and commit 8fca3852e33d ("arm64: cpufeature: add
Neoverse-V3AE to BBML2 allow list") did the same for Neoverse-V3AE.
The updated SDENs, MP168 v11 for Neoverse-V3 and MP172 v12 for
Neoverse-V3AE, dated 9 June 2026, list r0p0, r0p1 and r0p2 as affected
and the erratum as open. There is no fixed revision on which to base
either allow-list entry.
Remove both entries so these CPUs observe break-before-make, and record
the workaround in the silicon errata registry.
Fixes: 5aa4b625762e ("arm64: Add BBM Level 2 cpu feature")
Fixes: 8fca3852e33d ("arm64: cpufeature: add Neoverse-V3AE to BBML2 allow list")
Cc: stable@vger.kernel.org
Link: https://support.arm.com/documentation/109231/11-0/?lang=en
Link: https://support.arm.com/documentation/109704/12-0/?lang=en
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Documentation/arch/arm64/silicon-errata.rst | 4 ++++
arch/arm64/kernel/cpufeature.c | 2 --
2 files changed, 4 insertions(+), 2 deletions(-)
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -238,10 +238,14 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V2 | #4193787 | ARM64_ERRATUM_4118414 |
+----------------+-----------------+-----------------+-----------------------------+
+| ARM | Neoverse-V3 | #3053180 | N/A |
++----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V3 | #3312417 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V3 | #4193784 | ARM64_ERRATUM_4118414 |
+----------------+-----------------+-----------------+-----------------------------+
+| ARM | Neoverse-V3AE | #3053180 | N/A |
++----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V3AE | #3312417 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Neoverse-V3AE | #4193784 | ARM64_ERRATUM_4118414 |
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -2140,8 +2140,6 @@ bool cpu_supports_bbml2_noabort(void)
*/
static const struct midr_range supports_bbml2_noabort_list[] = {
MIDR_REV_RANGE(MIDR_CORTEX_X4, 0, 3, 0xf),
- MIDR_REV_RANGE(MIDR_NEOVERSE_V3, 0, 2, 0xf),
- MIDR_REV_RANGE(MIDR_NEOVERSE_V3AE, 0, 2, 0xf),
MIDR_ALL_VERSIONS(MIDR_NVIDIA_OLYMPUS),
MIDR_ALL_VERSIONS(MIDR_AMPERE1),
MIDR_ALL_VERSIONS(MIDR_AMPERE1A),
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 395/703] arm64: kexec: use a typed entry to fix kCFI oops
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (391 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 394/703] arm64: cpufeature: Remove Neoverse-V3/AE from the BBML3 allow list Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 396/703] ASoC: amd: acp: fix PDM ring buffer address on ACP7.x resume Greg Kroah-Hartman
` (14 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kees Cook, Ben Cressey,
Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Cressey <ben@cressey.dev>
commit b059e957d07b3cab92eef4656988244043f5769a upstream.
An arm64 Linux kernel built with CONFIG_CFI=y oopses after "Bye!" on
every kexec that relocates the image. Crash images load in place and are
not affected. The oops reproduces under QEMU:
Unable to handle kernel paging request at virtual address 00000000544bfffc
pc : machine_kexec+0x104/0x274
Code: d5182008 d5033fdf aa1303e0 f9418a68 (b85fc110)
b85fc110 is "ldur w16, [x8, #-4]", the kCFI check's load of the type
hash in front of the callee. Commit efc2d0f20a9d ("arm64: kexec: keep
MMU enabled during kexec relocation") made machine_kexec() call the
control page's copy of arm64_relocate_new_kernel() indirectly, while
TTBR0 maps only that page. The copy starts at the page's first byte, so
the load faults. SYM_CODE_START() also gives the routine no hash.
SYM_TYPED_FUNC_START() emits the hash inside .kexec_relocate.text, and
machine_kexec_post_load() already copies that whole section, at most
4 KiB, to the page's start, so the mapped page holds both hash and
entry.
The ASSERT from commit dc4824faa265 ("arm64: avoid executing padding
bytes during kexec / hibernation") kept the entry first, since C
branched to the page's start. Relax it, so the entry need only be in the
section.
Fix by typing the routine with SYM_TYPED_FUNC_START() and a C prototype,
and entering the copy at the symbol's offset in the section.
The code is Kees Cook's, as posted in review, with two comments and the
ASSERT message reworded.
An LLM diagnosed the oops.
Fixes: efc2d0f20a9d ("arm64: kexec: keep MMU enabled during kexec relocation")
Cc: stable@vger.kernel.org
Suggested-by: Kees Cook <kees@kernel.org>
Link: https://lore.kernel.org/linux-arm-kernel/202609241804.BB23BF10@keescook/
Signed-off-by: Ben Cressey <ben@cressey.dev>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/include/asm/kexec.h | 2 ++
arch/arm64/kernel/machine_kexec.c | 7 +++++--
arch/arm64/kernel/relocate_kernel.S | 11 +++++++----
arch/arm64/kernel/vmlinux.lds.S | 5 +++--
4 files changed, 17 insertions(+), 8 deletions(-)
--- a/arch/arm64/include/asm/kexec.h
+++ b/arch/arm64/include/asm/kexec.h
@@ -100,6 +100,8 @@ void cpu_soft_restart(unsigned long el2_
unsigned long arg0, unsigned long arg1,
unsigned long arg2);
+void arm64_relocate_new_kernel(struct kimage *kimage);
+
int machine_kexec_post_load(struct kimage *image);
#define machine_kexec_post_load machine_kexec_post_load
#endif
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -136,9 +136,12 @@ int machine_kexec_post_load(struct kimag
kimage->arch.ttbr1 = __pa(trans_pgd);
kimage->arch.zero_page = __pa_symbol(empty_zero_page);
+ /* Copy the whole section: a kCFI hash may precede the entry point */
reloc_size = __relocate_new_kernel_end - __relocate_new_kernel_start;
memcpy(reloc_code, __relocate_new_kernel_start, reloc_size);
- kimage->arch.kern_reloc = __pa(reloc_code);
+ kimage->arch.kern_reloc = __pa(reloc_code) +
+ ((unsigned long)arm64_relocate_new_kernel -
+ (unsigned long)__relocate_new_kernel_start);
rc = trans_pgd_idmap_page(&info, &kimage->arch.ttbr0,
&kimage->arch.t0sz, reloc_code);
if (rc)
@@ -193,7 +196,7 @@ void machine_kexec(struct kimage *kimage
restart(is_hyp_nvhe(), kimage->start, kimage->arch.dtb_mem,
0, 0);
} else {
- void (*kernel_reloc)(struct kimage *kimage);
+ typeof(arm64_relocate_new_kernel) *kernel_reloc;
if (is_hyp_nvhe())
__hyp_set_vectors(kimage->arch.el2_vectors);
--- a/arch/arm64/kernel/relocate_kernel.S
+++ b/arch/arm64/kernel/relocate_kernel.S
@@ -8,6 +8,7 @@
* Pasha Tatashin <pasha.tatashin@soleen.com>
*/
+#include <linux/cfi_types.h>
#include <linux/kexec.h>
#include <linux/linkage.h>
@@ -32,11 +33,13 @@
* new image to its final location. To assure that the
* arm64_relocate_new_kernel routine which does that copy is not overwritten,
* all code and data needed by arm64_relocate_new_kernel must be between the
- * symbols arm64_relocate_new_kernel and arm64_relocate_new_kernel_end. The
- * machine_kexec() routine will copy arm64_relocate_new_kernel to the kexec
+ * symbols __relocate_new_kernel_start and __relocate_new_kernel_end. The
+ * machine_kexec_post_load() routine will copy that whole region to the kexec
* safe memory that has been set up to be preserved during the copy operation.
+ *
+ * Called indirectly by machine_kexec(), this routine needs a kCFI type hash.
*/
-SYM_CODE_START(arm64_relocate_new_kernel)
+SYM_TYPED_FUNC_START(arm64_relocate_new_kernel)
/*
* The kimage structure isn't allocated specially and may be clobbered
* during relocation. We must load any values we need from it prior to
@@ -97,4 +100,4 @@ SYM_CODE_START(arm64_relocate_new_kernel
mov x2, xzr
mov x3, xzr
br x28 /* Jumps from el1 */
-SYM_CODE_END(arm64_relocate_new_kernel)
+SYM_FUNC_END(arm64_relocate_new_kernel)
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -406,6 +406,7 @@ ASSERT(swapper_pg_dir - tramp_pg_dir ==
ASSERT(__relocate_new_kernel_end - __relocate_new_kernel_start <= SZ_4K,
"kexec relocation code is bigger than 4 KiB")
ASSERT(KEXEC_CONTROL_PAGE_SIZE >= SZ_4K, "KEXEC_CONTROL_PAGE_SIZE is broken")
-ASSERT(__relocate_new_kernel_start == arm64_relocate_new_kernel,
- "kexec control page does not start with arm64_relocate_new_kernel")
+ASSERT(arm64_relocate_new_kernel >= __relocate_new_kernel_start &&
+ arm64_relocate_new_kernel < __relocate_new_kernel_end,
+ "kexec relocation code does not contain arm64_relocate_new_kernel")
#endif
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 396/703] ASoC: amd: acp: fix PDM ring buffer address on ACP7.x resume
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (392 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 395/703] arm64: kexec: use a typed entry to fix kCFI oops Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 397/703] ASoC: qcom: audioreach: only disconnect the route a mixer control owns Greg Kroah-Hartman
` (13 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Nicholas E. Andrade, Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas E. Andrade <sdnick484@gmail.com>
commit a3d8527ed469a31aeeb02c5e52ed89de410e46e6 upstream.
On ACP7.x the DMIC ring buffer lives at ACP7x_DMIC_MEM_WINDOW_START,
and acp_dmic_prepare() programs ACP_WOV_RX_RINGBUFADDR accordingly.
The system resume path (acp70_pcm_resume() -> restore_acp_pdm_params()
-> set_acp_pdm_ring_buffer()) however still uses the pre-ACP7.x
calculation, stream->reg_offset + MEM_WINDOW_START (0x6080000).
That window is not backed by the PTEs config_acp_dma() writes for the
DMIC stream (scratch offset 0x6000, i.e. window 0x4C00000), so after
resume the ATU translates DMIC DMA through uninitialised SRAM and the
ACP writes to random IOVAs. With the IOMMU enabled, a capture stream
held open across s2idle produces a continuous stream of faults until
it is closed, and captures nothing useful:
snd_acp_pci 0000:c4:00.5: AMD-Vi: Event logged [IO_PAGE_FAULT
domain=0x0018 address=0x1ddeee9942398e20 flags=0x0030]
Commit 3ee257aba1d5 ("ASoC: amd: acp: Audio is not resuming after
s0ix") fixed the same problem for the I2S restore path in
set_acp_i2s_dma_fifo() but left the PDM path unchanged. Select the
ACP7.x window there too, matching acp_dmic_prepare().
Tested on a Lenovo ThinkPad P14s Gen 6 AMD (ACP rev 0x71, kernel
7.3.1) by holding
arecord -D hw:CARD=acppdmmach,DEV=0 -f S32_LE -r 48000 -c 2
open across s2idle: before the fix, IO_PAGE_FAULTs after every resume
and no audio; after, no faults and audio captured correctly after
resume.
The bug was diagnosed and the fix drafted with the help of an AI
coding assistant (Claude); the analysis, change and testing were
reviewed and verified by the submitter on the hardware above.
Fixes: f6f7d25b1103 ("ASoC: amd: acp: Add pte configuration for ACP7.0 platform")
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas E. Andrade <sdnick484@gmail.com>
Link: https://patch.msgid.link/20261109-for-next-v1-1-54a06f391bda@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/amd/acp/acp-legacy-common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/sound/soc/amd/acp/acp-legacy-common.c
+++ b/sound/soc/amd/acp/acp-legacy-common.c
@@ -154,7 +154,10 @@ static void set_acp_pdm_ring_buffer(stru
period_bytes = frames_to_bytes(runtime, runtime->period_size);
pdm_size = frames_to_bytes(runtime, runtime->buffer_size);
- physical_addr = stream->reg_offset + MEM_WINDOW_START;
+ if (chip->acp_rev >= ACP70_PCI_ID)
+ physical_addr = ACP7x_DMIC_MEM_WINDOW_START;
+ else
+ physical_addr = stream->reg_offset + MEM_WINDOW_START;
/* Init ACP PDM Ring buffer */
writel(physical_addr, chip->base + ACP_WOV_RX_RINGBUFADDR);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 397/703] ASoC: qcom: audioreach: only disconnect the route a mixer control owns
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (393 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 396/703] ASoC: amd: acp: fix PDM ring buffer address on ACP7.x resume Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 398/703] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer Greg Kroah-Hartman
` (12 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Marc Herrero, Srinivas Kandagatla,
Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Herrero <marcht@proton.me>
commit 562b2cc2aa88e039790248b5f1014c4850a7e528 upstream.
Each AudioReach virtual mixer route control ("<BE> Audio Mixer <FE>")
connects a front-end stream graph to a back-end device graph by storing
the source module in the device graph's audioreach_graph_info. Writing 0
to any of these controls clears that link unconditionally, even when the
device graph is connected to a different front end.
When two front ends can feed the same back end the result therefore
depends on write order. On QCS6490 (Radxa Dragon Q6A):
- alsactl restore writes 'DISPLAY_PORT_RX_0 Audio Mixer MultiMedia2' = 1
and then 'DISPLAY_PORT_RX_0 Audio Mixer MultiMedia1' = 0, which leaves
DisplayPort disconnected although the saved state has it connected;
- the UCM HDMI enable sequence writes
'RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia2' = 0, which disconnects
MultiMedia1 from the headphones. A PCM started on MultiMedia1 after
that never advances (hw_ptr stays at 0).
Make audioreach_connect_sub_graphs() only clear the link when it belongs
to the control being cleared, using the same test as
audioreach_is_vmixer_connected() does for get(). The DAPM mixer state is
still updated for every write, so DAPM keeps tracking each route control
as before.
Fixes: e4977b91cff8 ("ASoC: qdsp6: audioreach: Simplify handing FE and BE graph connections")
Cc: stable@vger.kernel.org
Signed-off-by: Marc Herrero <marcht@proton.me>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20261116-q6apm-fixes-v2-2-ea89fb43316a@proton.me
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/qcom/qdsp6/topology.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -1137,7 +1137,9 @@ static void audioreach_connect_sub_graph
info->dst_mod_inst_id = m2->module_instance_id;
info->dst_mod_ip_port_id = 2;
- } else {
+ } else if (info->src_mod_inst_id == m1->module_instance_id &&
+ info->dst_mod_inst_id == m2->module_instance_id) {
+ /* only drop the link this control made, not another FE's */
info->src_mod_inst_id = 0;
info->src_mod_op_port_id = 0;
info->dst_mod_inst_id = 0;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 398/703] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (394 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 397/703] ASoC: qcom: audioreach: only disconnect the route a mixer control owns Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 399/703] ASoC: qcom: q6asm-dai: " Greg Kroah-Hartman
` (11 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Julius Bairaktaris,
Srinivas Kandagatla, Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julius Bairaktaris <julius@bairaktaris.de>
commit 3857bc06e5a40c5ebb62917147375a811f010aa0 upstream.
q6apm_dai_compr_open() allocates a fixed 8 MiB DMA buffer, but
q6apm_dai_compr_set_params() takes the ring size from the fragment size
and count that userspace passes to SNDRV_COMPRESS_SET_PARAMS without
checking it against that buffer. The compress core checks the geometry
against the runtime buffer only for drivers without a copy callback.
q6apm_compr_copy() places each write() at the stream position modulo the
ring size, so a ring larger than the DMA buffer lets write() copy user
data past its end, and after SNDRV_COMPRESS_NEXT_TRACK the copy starts at
the next multiple of the fragment size.
Reject a ring larger than the DMA buffer.
Fixes: c317d148a2b0 ("ASoC: q6dsp: q6apm-dai: Add mmap and copy compress DAI callbacks")
Cc: stable@vger.kernel.org
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20261111080624.244291-2-julius@bairaktaris.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/qcom/qdsp6/q6apm-dai.c | 3 +++
1 file changed, 3 insertions(+)
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -663,6 +663,9 @@ static int q6apm_dai_compr_set_params(st
if (!pdata)
return -EINVAL;
+ if (runtime->buffer_size > prtd->dma_buffer.bytes)
+ return -EINVAL;
+
prtd->periods = runtime->fragments;
prtd->pcm_count = runtime->fragment_size;
prtd->pcm_size = runtime->fragments * runtime->fragment_size;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 399/703] ASoC: qcom: q6asm-dai: reject compress rings larger than the DMA buffer
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (395 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 398/703] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 400/703] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks Greg Kroah-Hartman
` (10 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Julius Bairaktaris, Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julius Bairaktaris <julius@bairaktaris.de>
commit 4c15e549b7ad03183d10826da91e9ddc207a02cd upstream.
q6asm_dai_compr_open() allocates a fixed 8 MiB DMA buffer, but
q6asm_dai_compr_set_params() takes the ring size from the fragment size
and count that userspace passes to SNDRV_COMPRESS_SET_PARAMS without
checking it against that buffer. The compress core checks the geometry
against the runtime buffer only for drivers without a copy callback.
q6asm_compr_copy() places each write() at the stream position modulo the
ring size, so a ring larger than the DMA buffer lets write() copy user
data past its end, and after SNDRV_COMPRESS_NEXT_TRACK the copy starts at
the next multiple of the fragment size.
Reject a ring larger than the DMA buffer.
Fixes: a08cd56a4524 ("ASoC: q6asm-dai: add support to copy callback")
Cc: stable@vger.kernel.org
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://patch.msgid.link/20261111080624.244291-3-julius@bairaktaris.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/qcom/qdsp6/q6asm-dai.c | 3 +++
1 file changed, 3 insertions(+)
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -886,6 +886,9 @@ static int q6asm_dai_compr_set_params(st
return -EINVAL;
}
+ if (runtime->buffer_size > prtd->dma_buffer.bytes)
+ return -EINVAL;
+
prtd->periods = runtime->fragments;
prtd->pcm_count = runtime->fragment_size;
prtd->pcm_size = runtime->fragments * runtime->fragment_size;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 400/703] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (396 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 399/703] ASoC: qcom: q6asm-dai: " Greg Kroah-Hartman
@ 2026-12-04 10:04 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 401/703] ASoC: wm8962: Fix broken headset button caused by wrong guard constant Greg Kroah-Hartman
` (9 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:04 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, yzddMr6, Srinivas Kandagatla,
Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: yzddMr6 <yzddmr6@gmail.com>
commit bd6e011c8121c909daf51c78b56bb3bf7f467889 upstream.
The clk ops of the q6dsp clock controller look up struct q6dsp_cc with
dev_get_drvdata(), but q6dsp_clock_dev_probe() sets the driver data only
after it has registered the clocks and added the OF clock provider. A
consumer that gets and prepares one of the clocks in between
dereferences a NULL pointer.
fw_devlink does not keep consumers out of that window. The q6prm and
q6afe clock controllers are described below the ADSP remoteproc node,
and their devices are only created once the ADSP has booted and its
GPR/APR services have come up, long after the remoteproc device has
bound. fw_devlink therefore makes the remoteproc device the supplier of
their consumers. A consumer such as the LPASS LPI pinctrl then just
defers until of_clk_get() succeeds, and its retry from the deferred
probe worker can run while the clock controller is still in its probe.
That happened once on a Xiaomi Pad 8 Pro (SM8750). While the LPI pinctrl
probe registered its GPIO chip, gpiolib read a GPIO direction, which
runtime resumed the device and prepared its q6prm vote clocks through
pm_clk. The prepare op then faulted with a NULL pointer dereference at
virtual address 0x350 (trimmed):
pc : clk_vote_q6dsp_block+0x24/0x58 [snd_q6dsp_common]
lr : clk_core_prepare+0x7c/0x298
Call trace:
clk_vote_q6dsp_block+0x24/0x58 [snd_q6dsp_common] (P)
clk_core_prepare+0x7c/0x298
clk_prepare+0x28/0x44
pm_clk_resume+0x10c/0x188
pm_generic_runtime_resume+0x2c/0x44
...
__pm_runtime_resume+0x50/0x94
...
lpi_gpio_get_direction+0x4c/0x8c [pinctrl_lpass_lpi]
gpiochip_add_data_with_key+0x7b0/0x10dc
devm_gpiochip_add_data_with_key+0x38/0x8c
lpi_pinctrl_probe+0x2b8/0x320 [pinctrl_lpass_lpi]
...
deferred_probe_work_func+0x88/0xc0
0x350 is the offset of desc in struct q6dsp_cc; the driver data pointer
it was loaded from was NULL. The oops left the clk prepare_lock held,
which blocks every later clk_prepare(), and the system did not finish
booting.
On mainline the window is short, but it includes a wait for prepare_lock
in clk_core_reparent_orphans(), which of_clk_add_hw_provider() calls
right after listing the provider. The kernel that hit this had
out-of-tree changes to drivers/clk/clk.c that do more work at that
point, which makes the window wider.
Both q6afe-clocks and q6prm-clocks use q6dsp_clock_dev_probe(). Set the
driver data before the first clock is registered.
The oops was analysed and the fix written with the help of an AI coding
assistant.
Fixes: 9ab71ac37240 ("ASoC: qdsp6: q6afe-clocks: move audio-clocks to common file")
Cc: stable@vger.kernel.org
Signed-off-by: yzddMr6 <yzddmr6@gmail.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20261115-upstream-q6dsp-clk-drvdata-v1-1-4d7dbea52e52@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
@@ -146,6 +146,12 @@ int q6dsp_clock_dev_probe(struct platfor
cc->dev = dev;
q6dsp_clks = desc->clks;
+ /*
+ * The clk ops look up cc through the driver data, so set it before
+ * any of the clocks can be prepared.
+ */
+ dev_set_drvdata(dev, cc);
+
for (i = 0; i < desc->num_clks; i++) {
unsigned int id = q6dsp_clks[i].clk_id;
struct clk_init_data init = {
@@ -174,12 +180,6 @@ int q6dsp_clock_dev_probe(struct platfor
return ret;
}
- ret = devm_of_clk_add_hw_provider(dev, q6dsp_of_clk_hw_get, cc);
- if (ret)
- return ret;
-
- dev_set_drvdata(dev, cc);
-
- return 0;
+ return devm_of_clk_add_hw_provider(dev, q6dsp_of_clk_hw_get, cc);
}
EXPORT_SYMBOL_GPL(q6dsp_clock_dev_probe);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 401/703] ASoC: wm8962: Fix broken headset button caused by wrong guard constant
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (397 preceding siblings ...)
2026-12-04 10:04 ` [PATCH 6.18 400/703] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 402/703] ata: libata-core: Add max sector quirk to INTEL SSDSCKKB240G8 Greg Kroah-Hartman
` (8 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chen Yuxi, Charles Keepax,
Sebastian Krzyszkowiak, Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yuxi <chenyuxi19@huawei.com>
commit fd3b0fc97ea72d027359e7603a1224703cec1864 upstream.
Commit e59075211902 ("ASoC: wm8962: Don't report a microphone if
it's shorted to ground on plug") guards the mic short report by
testing wm8962->mic_status against WM8962_MICDET_STS. But mic_status
stores the reported jack status, composed of SND_JACK_MICROPHONE and
SND_JACK_BTN_0, which never has WM8962_MICDET_STS set. The guard is
therefore always true, so every mic short event reports nothing.
Pressing the button on a TRRS headset shorts the mic pin to ground,
which used to be reported as SND_JACK_BTN_0. After that commit the
button press is silently dropped, breaking the headset button on all
wm8962 boards using the mic detect path.
Test mic_status against SND_JACK_MICROPHONE instead, restoring the
intended behaviour: suppress the report only when no microphone was
previously detected, i.e. a TRS plug in a TRRS socket.
Fixes: e59075211902 ("ASoC: wm8962: Don't report a microphone if it's shorted to ground on plug")
Cc: stable@vger.kernel.org
Signed-off-by: Chen Yuxi <chenyuxi19@huawei.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Link: https://patch.msgid.link/20261117070516.3861828-1-chenyuxi19@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/codecs/wm8962.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3083,7 +3083,7 @@ static void wm8962_mic_work(struct work_
/* Don't report a microphone if it's shorted right after
* plugging in, as this may be a TRS plug in a TRRS socket.
*/
- if (!(wm8962->mic_status & WM8962_MICDET_STS))
+ if (!(wm8962->mic_status & SND_JACK_MICROPHONE))
status = 0;
}
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 402/703] ata: libata-core: Add max sector quirk to INTEL SSDSCKKB240G8
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (398 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 401/703] ASoC: wm8962: Fix broken headset button caused by wrong guard constant Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 403/703] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT Greg Kroah-Hartman
` (7 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Justinien Bouron, Gunnar Kudrjavets,
Damien Le Moal, Niklas Cassel
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justinien Bouron <jbouron@amazon.com>
commit a12cc63129380a5364e787d92b30a3257f66c250 upstream.
INTEL SSDSCKKB240G8 with firmware version XC311102 runs into FPDMA
timeout errors when queue/max_sectors_kb is set to
BLK_DEF_MAX_SECTORS_CAP = 4096KiB / 8192 sectors. Similar to model
SSDSC2KG480G8, the issue disappears when setting this max size to 8191
sectors, thus apply the same quirk.
Firmware version X5A1ME59 for SSDSCKKB240G8 is un-affected by this bug
thus keep the quirk specific to firmware XC311102.
Fixes: 9b8b84879d4a ("block: Increase BLK_DEF_MAX_SECTORS_CAP")
Signed-off-by: Justinien Bouron <jbouron@amazon.com>
Reviewed-by: Gunnar Kudrjavets <gunnarku@amazon.com>
Cc: stable@vger.kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261116205430.44305-1-jbouron@amazon.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/ata/libata-core.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4131,6 +4131,7 @@ static const struct ata_dev_quirk_value
{ "LITEON EP1-*", NULL, 1024 },
{ "DELLBOSS VD", "MV.R00-0", 8191 },
{ "INTEL SSDSC2KG480G8", "XCV10120", 8191 },
+ { "INTEL SSDSCKKB240G8", "XC311102", 8191 },
{ },
};
@@ -4401,6 +4402,8 @@ static const struct ata_dev_quirks_entry
ATA_QUIRK_MAX_SEC },
{ "INTEL*SSDSC2CT*", NULL, ATA_QUIRK_ZERO_AFTER_TRIM |
ATA_QUIRK_NO_FUA },
+ { "INTEL SSDSCKKB240G8", "XC311102", ATA_QUIRK_ZERO_AFTER_TRIM |
+ ATA_QUIRK_MAX_SEC },
{ "INTEL*SSD*", NULL, ATA_QUIRK_ZERO_AFTER_TRIM },
{ "SSD*INTEL*", NULL, ATA_QUIRK_ZERO_AFTER_TRIM },
{ "Samsung*SSD*", NULL, ATA_QUIRK_ZERO_AFTER_TRIM },
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 403/703] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (399 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 402/703] ata: libata-core: Add max sector quirk to INTEL SSDSCKKB240G8 Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 405/703] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets Greg Kroah-Hartman
` (6 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
commit e2954988bb987c1432806379f602573d2388df93 upstream.
ata_scsi_security_inout_xlat() tests the INC_512 bit with cdb[4] & 7.
INC_512 is bit 7 of byte 4 of the SECURITY PROTOCOL IN and SECURITY
PROTOCOL OUT CDBs (SPC-6, tables 280 and 282), and bits 6:0 of that
byte are reserved.
Test bit 7 instead.
Fixes: 818831c8b22f ("libata: implement SECURITY PROTOCOL IN/OUT")
Cc: stable@vger.kernel.org
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261116191008.2954277-2-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/ata/libata-scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4473,7 +4473,7 @@ static unsigned int ata_scsi_security_in
return 1;
}
- if (cdb[4] & 7) { /* INC_512 */
+ if (cdb[4] & 0x80) { /* INC_512 */
if (len > 0xffff) {
ata_scsi_set_invalid_field(qc->dev, scmd, 6, 0);
return 1;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 405/703] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (400 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 403/703] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 414/703] EDAC/i5000: Fix slot number passed to determine_mtr() Greg Kroah-Hartman
` (5 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Luiz Augusto von Dentz
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
commit 45a25a1bfd267d9e420119a48e5291d7882395df upstream.
qca_controller_memdump() frees qca_memdump when a memdump packet with a
non-zero sequence number arrives while QCA_MEMDUMP_COLLECTION is not
set, but leaves qca->qca_memdump pointing at the freed object.
The next run of the work reads the stale pointer into its local
variable, skips the allocation and uses the freed memory. Another
packet with a non-zero sequence number frees it a second time, and a
packet with sequence number 0 writes ram_dump_size, current_seq_no and
received_dump into it.
The original code cleared the pointer here; the assignment was dropped
when the condition was changed to test QCA_MEMDUMP_COLLECTION. All
other places that free the structure clear the pointer.
A controller that sends two memdump events without a leading sequence
number 0 can trigger a use-after-free or double free of a kmalloc
object.
Found by LLM-assisted source review.
Fixes: 06d3fdfcdf5c ("Bluetooth: hci_qca: Add qcom devcoredump support")
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/bluetooth/hci_qca.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1130,6 +1130,7 @@ static void qca_controller_memdump(struc
if (!test_bit(QCA_MEMDUMP_COLLECTION, &qca->flags)) {
bt_dev_err(hu->hdev, "QCA: Discarding other packets");
kfree(qca_memdump);
+ qca->qca_memdump = NULL;
kfree_skb(skb);
mutex_unlock(&qca->hci_memdump_lock);
return;
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 414/703] EDAC/i5000: Fix slot number passed to determine_mtr()
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (401 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 405/703] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 415/703] fault-inject: fix boot failure with fault injection boot parameters Greg Kroah-Hartman
` (4 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aristeu Rozanski, Andrew Luebke,
Borislav Petkov (AMD)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aristeu Rozanski <aris@redhat.com>
commit a088b092a8962db62327690ae2d0d68827e81229 upstream.
When the logic mapping branch/slot/channel was reworked back in
64e1fdaf55d6 ("i5000_edac: Fix the logic that retrieves memory information")
i5000_init_csrows() was not updated and kept passing twice the number
of slots to determine_mtr(), which leads to accessing past the end of
i5000_pvt.b1_mtr[]. This was found by KASAN.
Fixes: 64e1fdaf55d6 ("i5000_edac: Fix the logic that retrieves memory information")
Signed-off-by: Aristeu Rozanski <aris@redhat.com>
Signed-off-by: Andrew Luebke <andrew.luebke@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Andrew Luebke <andrew.luebke@gmail.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20220921181009.oxytvicy6sry6it7@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/edac/i5000_edac.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1250,14 +1250,12 @@ static int i5000_init_csrows(struct mem_
struct i5000_pvt *pvt;
struct dimm_info *dimm;
int empty;
- int max_csrows;
int mtr;
int csrow_megs;
int channel;
int slot;
pvt = mci->pvt_info;
- max_csrows = pvt->maxdimmperch * 2;
empty = 1; /* Assume NO memory */
@@ -1268,7 +1266,7 @@ static int i5000_init_csrows(struct mem_
* to map the dimms. A good cleanup would be to remove this array,
* and do a loop here with branch, channel, slot
*/
- for (slot = 0; slot < max_csrows; slot++) {
+ for (slot = 0; slot < pvt->maxdimmperch; slot++) {
for (channel = 0; channel < pvt->maxch; channel++) {
mtr = determine_mtr(pvt, slot, channel);
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 415/703] fault-inject: fix boot failure with fault injection boot parameters
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (402 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 414/703] EDAC/i5000: Fix slot number passed to determine_mtr() Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 416/703] fgraph: Allocate shadow stacks inline with GFP_NOWAIT Greg Kroah-Hartman
` (3 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sang-Heon Jeon, Andrew Morton,
Akinobu Mita
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sang-Heon Jeon <ekffu200098@gmail.com>
commit 27538caf7f72ce93be9c352148dba4f2274cf300 upstream.
Since commit e9bc360b105c ("fault-inject: use prandom where
cryptographically secure randomness is not needed"), setup_fault_attr()
calls prandom_init_once(), which calls kmalloc() and schedule_work().
But setup_fault_attr() can be called from __setup handlers before slab and
workqueues are initialized, so any fault injection boot parameter leads to
boot failure.
So use DO_ONCE_LITE() instead.
Link: https://lore.kernel.org/20261105160209.1504867-1-ekffu200098@gmail.com
Fixes: e9bc360b105c ("fault-inject: use prandom where cryptographically secure randomness is not needed")
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/fault-inject.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
lib/fault-inject.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index 02916ef2761c..9182d457baf5 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/once_lite.h>
#include <linux/prandom.h>
#include <linux/debugfs.h>
#include <linux/sched.h>
@@ -50,7 +51,12 @@ int setup_fault_attr(struct fault_attr *attr, char *str)
return 0;
}
- prandom_init_once(&fault_rnd_state);
+ /*
+ * __setup handlers run before slab and workqueues are initialized,
+ * but prandom_init_once() calls kmalloc() and schedule_work(). So use
+ * DO_ONCE_LITE() instead.
+ */
+ DO_ONCE_LITE(prandom_seed_full_state, &fault_rnd_state);
attr->probability = probability;
attr->interval = interval;
--
2.56.1
^ permalink raw reply related [flat|nested] 409+ messages in thread
* [PATCH 6.18 416/703] fgraph: Allocate shadow stacks inline with GFP_NOWAIT
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (403 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 415/703] fault-inject: fix boot failure with fault injection boot parameters Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 417/703] fgraph: Do not mark index 0 in every shadow stack frame Greg Kroah-Hartman
` (2 subsequent siblings)
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Zijlstra, Vineet Gupta,
Andrii Nakryiko, Masami Hiramatsu (Google), Steven Rostedt
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineet Gupta <vineet.gupta@linux.dev>
commit 700e5c063fd765fd09c1007ec8a927bddd82798b upstream.
When ftrace graphing is turned on, all tasks in the system missing
return stack page are assigned one. This is done in a simplistic
multi-sweep loop of FTRACE_RETSTACK_ALLOC_SIZE (currently 32) tasks
at a time as follows:
start_graph_tracing()
do {
alloc_retstack_tasklist
} while (-EAGAIN);
alloc_retstack_tasklist()
alloc x32 # GFP_KERNEL, may sleep
rcu_read_lock() # preempt off
for_each_process_thread walk N_total, no cond_resched
t->ret_stack = new_page
rcu_read_unlock() # preempt enable but no explicit yield
Each successive iteration of loop invokes for_each_process_thread()
which doesn't support cursor based resume and always restarts from the
init_task. Thus each successive loop needs to skip the tasks assigned
ret_stack in prior sweeps and thus take longer and longer to find the
candidate 32 tasks. And while the loop end calls rcu unlock,
and re-enables preemption briefly, there is no explicit yield.
The total number of iterations turn out to be
N_total * N_null / (2 * FTRACE_RETSTACK_ALLOC_SIZE)
where N_total is the number of threads on the system and N_null the number
of those whose ret_stack is still NULL. After boot with no fgraph user that
is every thread.
This is not a tracing-only path. Since commit 4346ba160409 ("fprobe:
Rewrite fprobe on function-graph tracer") fprobe is built on fgraph,
so an ordinary kprobe_multi BPF attach that flips ftrace_graph_active
from 0 to 1 pays the whole cost inside one bpf() syscall. Commit
2c67dc457bc6 ("tracing: fprobe: optimization for entry only case")
narrows that to return and session probes but does not remove it.
A host running hundreds of thousands of threads, with the current batch
size of 32, turns the ftrace_graph_active 0 -> 1 transition into a
multi-second, and eventually multi-minute, operation which showed up as
RCU stall and softlockup_panic on heavily loaded Meta Fleet machines
with preemption disabled.
rcu: INFO: rcu_sched self-detected stall on CPU
rcu: 0-....: (20718 ticks this GP) (t=21000 jiffies g=913 q=8 ncpus=8)
CPU: 0 UID: 0 PID: 160141 Comm: bpftrace
___slab_alloc+0x549/0xa20
kmem_cache_alloc_noprof+0x16c/0x340
register_ftrace_graph+0x3d7/0x6c0
register_fprobe_ips+0x2d5/0x310
bpf_kprobe_multi_link_attach+0x218/0x7e0
__sys_bpf+0x267a/0x27a0
Fix this by allocating inline with GFP_NOWAIT instead of pre-allocating
a fixed batch. GFP_NOWAIT does not sleep, so it is legal inside the RCU
read-side critical section.
A single sweep now serves every task, so the walk becomes O(N) rather
than O(N_total * N_null), and the retry loop is no longer the normal
path.
The pre-allocated array remains as the fallback when GFP_NOWAIT fails.
The runs below never needed it, so it was exercised with failslab
injection: at a 100% failure rate every task falls back and -EAGAIN
retries ~1560 times for 50000 threads, with no stall or splat.
smp_store_release() is a drop-in replacement for the smp_wmb() and
plain store it replaces.
Measured on a 60-core Sapphire Rapids machine running a PREEMPT_LAZY
kernel (CONFIG_PREEMPT_DYNAMIC=y, mode lazy), timing the write that
drives the ftrace_graph_active 0 -> 1 transition. Threads are spawned
while fgraph is inactive so every one of them has ret_stack == NULL,
and the loop was instrumented to count sweeps:
threads before after
sweeps time sweeps time
100000 3126 15.3 s 1 0.019 s
200000 6253 59.1 s 1 0.047 s
400000 12503 227.8 s 1 0.092 s
The sweep count is 1 throughout. Time now scales linearly with the
thread count at roughly 230 ns per task, which is the allocation and
initialisation of one shadow stack.
Fixes: f201ae2356c7 ("tracing/function-return-tracer: store return stack into task_struct and allocate it dynamically")
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
Tested-by: Vineet Gupta <vineet.gupta@linux.dev>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261021174406.2891598-2-vineet.gupta@linux.dev
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/fgraph.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -1044,13 +1044,16 @@ void ftrace_stub_graph(struct ftrace_gra
trace_func_graph_ret_t ftrace_graph_return = ftrace_stub_graph;
trace_func_graph_ent_t ftrace_graph_entry = ftrace_graph_entry_stub;
-/* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */
+/*
+ * Loop thru all the tasks in the system and assign ret_stack.
+ * The @ret_stack_list is a small pre-allocated fallback, in case
+ * the GFP_NOWAIT allocations here fail.
+ */
static int alloc_retstack_tasklist(unsigned long **ret_stack_list)
{
- int i;
- int ret = 0;
int start = 0, end = FTRACE_RETSTACK_ALLOC_SIZE;
struct task_struct *g, *t;
+ int i, ret = 0;
if (WARN_ON_ONCE(!fgraph_stack_cachep))
return -ENOMEM;
@@ -1067,20 +1070,26 @@ static int alloc_retstack_tasklist(unsig
rcu_read_lock();
for_each_process_thread(g, t) {
- if (start == end) {
- ret = -EAGAIN;
- goto unlock;
- }
+ unsigned long *rs;
+
+ if (t->ret_stack)
+ continue;
- if (t->ret_stack == NULL) {
- atomic_set(&t->trace_overrun, 0);
- ret_stack_init_task_vars(ret_stack_list[start]);
- t->curr_ret_stack = 0;
- t->curr_ret_depth = -1;
- /* Make sure the tasks see the 0 first: */
- smp_wmb();
- t->ret_stack = ret_stack_list[start++];
+ rs = kmem_cache_alloc(fgraph_stack_cachep, GFP_NOWAIT);
+ if (!rs) {
+ if (start == end) {
+ ret = -EAGAIN;
+ goto unlock;
+ }
+ rs = ret_stack_list[start++];
}
+
+ atomic_set(&t->trace_overrun, 0);
+ ret_stack_init_task_vars(rs);
+ t->curr_ret_stack = 0;
+ t->curr_ret_depth = -1;
+ /* Make sure the tasks see the 0 first: */
+ smp_store_release(&t->ret_stack, rs);
}
unlock:
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 417/703] fgraph: Do not mark index 0 in every shadow stack frame
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (404 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 416/703] fgraph: Allocate shadow stacks inline with GFP_NOWAIT Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 418/703] fscrypt: Initialize ->ci_master_key before publication Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 419/703] fbdev: fm2fb: Fix iomem access Greg Kroah-Hartman
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Breno Leitao, Steven Rostedt
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <leitao@debian.org>
commit 65f42f1fa03829e0ab1473369461a7aabf525cb2 upstream.
We are seeing this warning on an arm64 host:
WARNING: kernel/trace/fprobe.c:676 at fprobe_return+0x260/0x2c8, CPU#16: FuncSched/3281330
Call trace:
fprobe_return+0x260/0x2c8 (P)
ftrace_return_to_handler+0x2bc/0x5a8
return_to_handler+0x20/0x48
futex_wait+0xa4/0x218
do_futex+0xb4/0x1d0
__arm64_sys_futex+0x15c/0x278
The theory is that function_graph_enter_regs() sets BIT(0) in the bitmap
of every frame, a leftover of an old tail-call check, while the return
path calls the retfunc of every set bit.
A reproducer on linux-next supports the theory. On a fresh boot, with no
other fgraph user yet:
cd /sys/kernel/tracing
echo 'f:fpexit vfs_read%return' >> dynamic_events
echo 1 > events/fprobes/fpexit/enable # fprobe_graph_ops: index 0
echo vfs_write > set_ftrace_filter
echo function_graph > current_tracer # function_graph: index 1
echo x > /dev/null # WARN on vfs_write return
Removing the bit was agreed in the review of the series that added it
[0], but the line stayed. Drop it now.
[0] https://lore.kernel.org/all/20240527093436.7060d358a64cc2ea3213b07b@kernel.org/
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261112-fgraph-bit0-v1-1-695ad14f4b1e@debian.org
Fixes: 7aa1eaef9f42 ("function_graph: Allow multiple users to attach to function graph")
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/fgraph.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -706,11 +706,7 @@ int function_graph_enter_regs(unsigned l
if (!bitmap)
goto out_ret;
- /*
- * Since this function uses fgraph_idx = 0 as a tail-call checking
- * flag, set that bit always.
- */
- set_bitmap(current, offset, bitmap | BIT(0));
+ set_bitmap(current, offset, bitmap);
ftrace_test_recursion_unlock(bit);
return 0;
out_ret:
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 418/703] fscrypt: Initialize ->ci_master_key before publication
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (405 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 417/703] fgraph: Do not mark index 0 in every shadow stack frame Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 419/703] fbdev: fm2fb: Fix iomem access Greg Kroah-Hartman
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ada Smith, Eric Biggers
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
commit 2de253924266eeedb798fb662173726c90b0cf04 upstream.
fscrypt_prepare_setflags() assumes that if the key for an inode with a
v2 encryption policy has been set up, then ->ci_master_key is non-NULL.
This is a reasonable assumption, but it does not take into account the
very short gap in fscrypt_setup_encryption_info() between the inode's
fscrypt_inode_info being set and ->ci_master_key being initialized.
Thus, a NULL pointer dereference was possible.
Fix this by closing the gap: make fscrypt_setup_encryption_info()
initialize ->ci_master_key before publication. If it loses the cmpxchg
race afterwards, set it back to NULL so that put_crypt_info() continues
to have the same behavior.
Fixes: b1c0ec3599f4 ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl")
Cc: stable@vger.kernel.org
Reported-by: Ada Smith <adasmithgt@gmail.com>
Link: https://patch.msgid.link/20261110212011.35487-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/crypto/keysetup.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/fs/crypto/keysetup.c
+++ b/fs/crypto/keysetup.c
@@ -653,6 +653,13 @@ fscrypt_setup_encryption_info(struct ino
goto out;
/*
+ * Preemptively initialize ->ci_master_key, even though we don't know
+ * whether we'll win the race below yet, because if we do win the race
+ * then other tasks can see it right away and need ->ci_master_key.
+ */
+ crypt_info->ci_master_key = mk;
+
+ /*
* For existing inodes, multiple tasks may race to set the inode's
* fscrypt info pointer. So use cmpxchg_release(). This pairs with the
* smp_load_acquire() in fscrypt_get_inode_info(). I.e., publish the
@@ -665,7 +672,6 @@ fscrypt_setup_encryption_info(struct ino
* crypt_info. Now link it into the master key's inode list.
*/
if (mk) {
- crypt_info->ci_master_key = mk;
refcount_inc(&mk->mk_active_refs);
spin_lock(&mk->mk_decrypted_inodes_lock);
list_add(&crypt_info->ci_master_key_link,
@@ -673,6 +679,12 @@ fscrypt_setup_encryption_info(struct ino
spin_unlock(&mk->mk_decrypted_inodes_lock);
}
crypt_info = NULL;
+ } else {
+ /*
+ * Lost the race, so we won't be taking an active reference to
+ * the master key. Clear ->ci_master_key accordingly.
+ */
+ crypt_info->ci_master_key = NULL;
}
res = 0;
out:
^ permalink raw reply [flat|nested] 409+ messages in thread
* [PATCH 6.18 419/703] fbdev: fm2fb: Fix iomem access
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
` (406 preceding siblings ...)
2026-12-04 10:05 ` [PATCH 6.18 418/703] fscrypt: Initialize ->ci_master_key before publication Greg Kroah-Hartman
@ 2026-12-04 10:05 ` Greg Kroah-Hartman
407 siblings, 0 replies; 409+ messages in thread
From: Greg Kroah-Hartman @ 2026-12-04 10:05 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Steffen A. Mork, Helge Deller
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen A. Mork <linux-dev@morknet.de>
commit 7d4a8a804cd1a3bcaa1a9a38e87517ead3130ca1 upstream.
This driver has not been tested for at least twenty years. In the meantime,
the frame buffer API has been updated. This patch addresses this issue and
makes the driver functional again.
Signed-off-by: Steffen A. Mork <linux-dev@morknet.de>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/fbdev/fm2fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/video/fbdev/fm2fb.c
+++ b/drivers/video/fbdev/fm2fb.c
@@ -257,7 +257,7 @@ static int fm2fb_probe(struct zorro_dev
strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II");
/* make EBU color bars on display */
- ptr = (unsigned long *)fb_fix.smem_start;
+ ptr = (unsigned long *)info->screen_base;
for (y = 0; y < 576; y++) {
for (x = 0; x < 96; x++) *ptr++ = 0xffffff;/* white */
for (x = 0; x < 96; x++) *ptr++ = 0xffff00;/* yellow */
^ permalink raw reply [flat|nested] 409+ messages in thread
end of thread, other threads:[~2026-12-04 11:05 UTC | newest]
Thread overview: 409+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 9:58 [PATCH 6.18 000/703] 6.18.67-rc1 review Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 001/703] drm/gem-dma: Support dedicated DMA device for allocation and mapping Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 002/703] mpls: add seqcount to protect the platform_label{,s} pair Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 003/703] netlink: do not free nlk->groups while lockless readers can use it Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 004/703] net: init shinfo->gso_segs from qdisc_pkt_len_init() Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 005/703] net: pull headers in qdisc_pkt_len_segs_init() Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 006/703] xfrm: Dont clobber inner headers when already set Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 007/703] net: harden qdisc_pkt_len_segs_init() against malicious GSO packets Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 008/703] net: reject a negative TCP header offset in qdisc_pkt_len_segs_init() Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 009/703] sctp: validate cookie AUTH state before use Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 010/703] net/sched: codel: bound the dropping loop per dequeue call Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 011/703] net: flush skb_defer_nodes in dev_cpu_dead() Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 012/703] ext4: teach ext4_meta_trans_blocks() about number of allocated extents Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 013/703] ext4: fix transaction overflow during writeback Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 014/703] bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call() Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 015/703] bpf: Reject programs with inlined helpers if JIT is not available Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 016/703] bpf: Disallow interpreter fallback for arena-related insns Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 017/703] bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 018/703] mm/mmzone: read each zoneref slot once when filtering by nodemask Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 019/703] mm/page_alloc: dont increase highatomic reserve after pcp alloc Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 020/703] mm/page_alloc: use existing highatomic reserves on the buddy fastpath Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 021/703] xprtrdma: serialize unmap_sync with xprt_disconnect Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 022/703] gve: Fix race between stats query and queue reconfig Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 023/703] gve: Block invalid ring sizes when device options are 0 Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 024/703] net: wait for in-flight device unregistrations before netns dismantle Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 025/703] ksmbd: pin parent dentries in SMB2 CREATE ACL path Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 026/703] ksmbd: refuse to read a handle that is not open for reading Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 027/703] tracing/probes: Fix BTF bitfield parsing and out-of-bounds buffer write Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 028/703] comedi: comedi_bond: Fix leak of opened device references Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 029/703] rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 030/703] 8021q: use RCU for egress QoS mappings Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 031/703] 8021q: delete cleared " Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 032/703] Bluetooth: btusb: fix use-after-free in force_poll_sync Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 033/703] tools/bootconfig: Close only opened braces in compact output Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 034/703] ipv6: Remove IPV6_ADDRFORM Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 035/703] sched_ext: Read exit_kind before flushing in scx_flush_disable_work() Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 036/703] iio: proximity: sx9360: fix sampling frequency write and available range Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 037/703] kprobes: Switch ftrace ops when adding probe with post_handler Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 038/703] KEYS: Expand key->{datalen,quotalen} to unsigned int Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 039/703] keys: keyctl_pkey: replace BUG with return -EOPNOTSUPP Greg Kroah-Hartman
2026-12-04 9:58 ` [PATCH 6.18 040/703] KEYS: Protect pkey method checks against type removal Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 041/703] btrfs: reject refs=0 subvolume without DEAD in SUBVOL_SYNC_WAIT Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 042/703] tcp: move __reqsk_free() out of line Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 043/703] tcp: free saved_syn after an RCU grace period Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 044/703] cgroup/cpuset: Correctly set isolated_cpus when switching partition state Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 045/703] arm64: suspend: rely on daif helpers to handle PMR Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 046/703] arm64: suspend: Only track cpuidle context for idle tasks Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 047/703] cpufreq: Avoid redundant target() calls for unchanged limits Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 048/703] cpufreq: Force passing target frequency to driver during resume Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 049/703] pNFS: avoid repeatedly cancelling I/O for the same lseg Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 050/703] watchdog: rz: Discard pm_runtime_put() return values Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 051/703] watchdog: rzv2h: Use pm_runtime_put_sync() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 052/703] watchdog: rzv2h: Drop runtime PM handling from WDTDCR init Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 053/703] hwmon: (nct6775) Handle dual use registers Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 054/703] s390/dasd: Fix typo immediatly -> immediately Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 055/703] s390/dasd: Re-initialize RCD buffer with "V1.0" before every start Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 056/703] sched/core: Do not touch SMT siblings that have not joined the core yet Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 057/703] ksmbd: skip metadata-only opens in sharing checks Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 058/703] wifi: mac80211_hwsim: ignore non-generic netlink releases Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 059/703] gpio: mvebu: name regmaps to fix debugfs collisions Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 060/703] gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 061/703] gpio: keep the chip reference when deferred setup fails Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 062/703] cpufreq: Fix updates of cached resolved frequency and index Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 063/703] mm/page_alloc: retry allocations that raced with a zonelist rebuild Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 064/703] mm/hugetlb: retry the pool walk when the zonelist is rebuilt Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 065/703] page_alloc: allow migration of smaller hugepages during contig_alloc Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 066/703] mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 067/703] mm: page_isolation: introduce page_is_unmovable() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 068/703] mm/memory_hotplug: fix possible race in scan_movable_pages() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 069/703] mm: page_isolation: do not take slab pages for free Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 070/703] mm: rejig pageblock mask definitions Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 071/703] mm/page_alloc: remove the zone_spans_pfn() check from get_pfnblock_bitmap_bitidx() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 072/703] Bluetooth: L2CAP: Only accept LE responses to outstanding requests Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 073/703] spi: tegra210-quad: Refactor error handling into helper functions Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 074/703] spi: tegra210-quad: Check hardware status on timeout Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 075/703] spi: tegra210-quad: Unmap DMA buffers on transfer timeout Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 076/703] sched_ext: Fix ops.enqueue/dispatch() calls before ops.cpu_online() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 077/703] Bluetooth: l2cap: defer conn param update to avoid conn->lock/hdev->lock inversion Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 078/703] Revert "mm/hugetlb_vmemmap: fix incorrect vmemmap restore in rollback" Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 079/703] dm cache: validate the discard block size before narrowing Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 080/703] dm: fix use-after-free when dm_get_device() widens the open mode Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 081/703] iio: adc: ad7923: add the AD7927 to the SPI ID table Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 082/703] iio: temperature: hid-sensor-temperature: Use per-instance callbacks Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 083/703] ACPI: PM: Avoid initializing power management for absent devices Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 084/703] Revert "ALSA: hda/realtek: Fix silent speaker on Higole F9B" Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 085/703] ovl: refactor ovl_lookup() Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 086/703] ovl: do not read the flags of a put upper dentry in lookup Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 087/703] ovl: fix leak of lowerdata redirect on ovl_get_inode() failure Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 088/703] ovl: do not check the deferred lowerdata redirect on index lookup Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 089/703] ovl: follow lower to lowerdata redirects from any lower layer Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 090/703] ovl: bump the impure dir version when linking a file with origin Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 091/703] smb: client: hold server ref while queueing reconnect work Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 092/703] smb: client: dont write back through O_DIRECT handles Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 093/703] smb: client: dont fail writeback preparation if the task is dying Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 094/703] usb: typec: ucsi: acpi: Assume UCSI 1.0 on HP ZBook 8 G2i 14 Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 095/703] usb: dwc3: Always deassert xilinx resets Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 096/703] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 097/703] w1: w1_therm: lock the list of slaves for the bulk read Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 098/703] usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 099/703] iio: humidity: hid-sensor-humidity: Use per-instance callbacks Greg Kroah-Hartman
2026-12-04 9:59 ` [PATCH 6.18 100/703] iio: proximity: Remove redundant dev_err()/dev_err_probe() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 101/703] iio: proximity: hx9023s: Allocate trigger before requesting IRQ Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 102/703] ipvs: read flags and seqs in master atomically Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 103/703] ipvs: honor the overload state and do not enter it forever Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 104/703] drm/ast: Handle framebuffer from dma-buf Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 105/703] iio: common: fix spelling mistakes in comments Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 106/703] iio: inv_sensors: convert to kernel types Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 107/703] iio: inv_sensors: better timestamp alignment when using watermark Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 108/703] iio: inv_sensors: improve period measurement by using a longer delay Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 109/703] iio: inv_sensors: prevent timestamps going back in time in transitions Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 110/703] iio: inv_sensors: fix estimated value larger than interrupt timestamp Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 111/703] iio: inv_sensors: do not compute period estimation when updating odr Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 112/703] Revert "wifi: ath10k: Stop unanswered temperature reads" Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 113/703] tpm: Call cmd_ready/go_idle for each command transmission Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 114/703] firmware: arm_scmi: Update ARM_SCMI_HAVE_TRANSPORT rationale Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 115/703] firmware: arm_ffa: Compare notify_id when looking up notifier callbacks Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 116/703] firmware: smccc: Provide stubs for HAVE_ARM_SMCCC_DISCOVERY=n Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 117/703] irqchip/gic-v3: Select HAVE_ARM_SMCCC_DISCOVERY only on arm64 Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 118/703] HID: vivaldi: Extract feature report value directly in vivaldi_feature_mapping() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 119/703] HID: vivaldi: avoid redundant feature report reads per usage Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 120/703] firmware: arm_scmi: imx: Validate MISC control response size Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 121/703] firmware: arm_scmi: Unregister notifier on enable failure Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 122/703] firmware: arm_scmi: Free mailbox state on mapping failure Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 123/703] soundwire: qcom: disable the interrupt before gating the clock Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 124/703] memory: tegra: Shut down Tegra210 EMC timers before teardown Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 125/703] memory: tegra: fix device_node leak in tegra186_mc_probe_device() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 126/703] irqchip/gic-v4: Clear the domain and fwnode pointers after freeing them Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 127/703] irqchip/gic-v4: Unwind what its_alloc_vcpu_irqs() allocated on failure Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 128/703] reset: scmi: Set the device for the reset controller Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 129/703] irqchip/gic-v4: Use a separate lockdep class for vPE doorbell IRQs Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 130/703] reset: spacemit: Fix the RCPU2 PWM reset registers Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 131/703] drm/msm/gem: Fix VM_BIND range check Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 132/703] drm/msm: Remove abuse of drm_exec internals Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 133/703] drm/msm/gem: Disallow nr_bos for VM_BIND contexts Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 134/703] drm/msm/gem: Decrement loop idx if handle lookup fails Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 135/703] drm/msm/gem: Clear nr_ops in lookup_ops() failure path Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 136/703] drm/msm: Fix a lock leak in msm_ioctl_gem_info_set_metadata() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 137/703] selftests: drivers/s390x: Select uvdevice tests using the target architecture Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 138/703] phy: ingenic: fix unbalanced regulator disable in exit Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 140/703] phy: ti: pipe3: Fix clock resource leak on probe errors Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 141/703] phy: ti-pipe3: Fix EPROBE_DEFER handling for clock resources Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 143/703] ksmbd: sign the last response of a compound that ends early Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 144/703] wifi: iwlwifi: mvm: correctly check the API version Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 145/703] scsi: lpfc: Fix race conditions in ELS retry handling Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 146/703] scsi: ch: Remove the minor from ch_index_idr after device_destroy() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 147/703] phy: rockchip: snps-pcie3: Raise the SRAM init timeout Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 148/703] Bluetooth: mgmt: Fix read_index_list() buffer overflow Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 149/703] Bluetooth: hci_core: Take req_sync lock in hci_power_on() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 150/703] Bluetooth: hci_sync: Lock the lookup in hci_disable_ext_adv_instance_sync() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 151/703] Bluetooth: hci_sync: Hold hdev->lock in hci_schedule_adv_instance_sync() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 152/703] Bluetooth: SMP: Serialize link key updates from smp_notify_keys() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 153/703] Bluetooth: SMP: Check smp_data before using SMP_DEV() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 154/703] Bluetooth: SMP: Dont create the BR/EDR channel while unregistered Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 155/703] Bluetooth: hci_event: Validate sent command length in LE Set Ext Adv Enable Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 156/703] s390/cert_store: Check key_lookup() return code in invalidate_keyring_keys() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 157/703] s390/cert_store: Fix cs_keyring reference leak in fill_cs_keyring() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 158/703] s390/cert_store: Fix potential use-after-free caused by find_cs_keyring() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 159/703] s390/cert_store: Remove unnecessary static specifier in create_cs_keyring() Greg Kroah-Hartman
2026-12-04 10:00 ` [PATCH 6.18 160/703] s390/cert_store: Fix error handling of get_user_session_keyring() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 161/703] s390/cert_store: Fix keyring refcount handling in get_user_session_keyring() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 162/703] s390/cert_store: Do not search the process keyrings for the cert_store keyring Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 163/703] s390/cert_store: Validate hash length in check_certificate_valid() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 164/703] s390/cert_store: Fix max_vcxe_length output in pr_dbf_vcssb() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 165/703] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 166/703] s390/cert_store: Initialize ism array in query_diag320_subcodes() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 167/703] Bluetooth: mgmt: Reject zero multi advertising rotation duration Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 168/703] Bluetooth: L2CAP: Dont use uninitialized EFS in l2cap_parse_conf_rsp() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 169/703] Bluetooth: mgmt: Fix mesh transmission locking and lifetime Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 170/703] Bluetooth: MGMT: Fix use-after-free in mgmt_powering_down() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 171/703] Bluetooth: MSFT: Protect the event prefix with hdev->lock Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 172/703] Bluetooth: hci_debugfs: Fix racy toggling of debugfs controlled flags Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 173/703] Bluetooth: hci_core: Hold hdev->lock when removing advertisement monitors Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 174/703] Bluetooth: MSFT: Free the response of the monitor commands Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 175/703] Bluetooth: hci_core: Dont fail removing a monitor unknown to the controller Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 176/703] HID: magicmouse: disable the multitouch work on removal Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 177/703] HID: sensor-hub: Synchronize callback removal with raw events Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 178/703] HID: sensor: custom: Set owner for misc device Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 179/703] HID: sensor: custom: Disable sensor before hub close on removal Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 180/703] xsk: reject TX checksum requests that overflow skb->csum_start Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 181/703] fbnic: Wait for in-flight PTP timestamps before treating Tx as idle Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 182/703] cxgb4: allocate the full ethtool filter location array Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 183/703] net: bcm4908_enet: fix the TX ring wrap Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 184/703] net: bcm4908_enet: drop a TX frame whose DMA mapping failed Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 185/703] net: bcm4908_enet: release the TX ring on stop Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 186/703] net: bcm4908_enet: unmap the buffer of a dropped RX frame Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 187/703] net: bcm4908_enet: unmap RX buffers on stop with their mapped size Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 188/703] net: bcm4908_enet: publish the buffer address before OWN Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 189/703] net: bcm4908_enet: order the TX ring index accesses Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 190/703] scsi: pm8001: Offset hardware queue index for MSI-X pre-vector Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 191/703] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 192/703] tcp: initialize ir_rmt_addr and ir_loc_addr in cookie_v6_check() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 193/703] tcp: accecn: initialize AccECN fields in syncookie path Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 194/703] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 195/703] dmaengine: idxd: Free the minor number when cdev setup fails Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 196/703] dmaengine: rcar-dmac: Fix PM usage counter imbalance Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 197/703] dmaengine: rcar-dmac: Add missing dma_descriptor_unmap() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 198/703] usb: gadget: f_hid: fix report_list entries leak Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 199/703] usb: gadget: f_hid: fix race between userspace report update and GET_REPORT response Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 200/703] usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 201/703] HID: sensor: custom: Fix state lifetime during removal Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 202/703] HID: sensor: custom: Serialize misc device reads Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 203/703] HID: sensor: custom: Register enable attribute after misc device Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 204/703] HID: sensor-hub: Remove clients before stopping hardware Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 205/703] HID: letsketch: skip string descriptors the firmware does not implement Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 206/703] hid: intel-thc-hid: Select SGL_ALLOC Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 207/703] HID: Intel-thc-hid: Fix REGMAP dependency Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 208/703] HID: nintendo: release the player ID when LED setup fails Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 209/703] usb: cdns3: report endpoint reset timeout Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 210/703] Bluetooth: MSFT: Record the filter state on Command Disallowed Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 211/703] Bluetooth: MSFT: Only enable the advertisement filter with monitors Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 212/703] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 213/703] ALSA: pcm: Fix potential ABBA deadlock at snd_pcm_action_nonatomic() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 214/703] ALSA: usb-audio: Ignore trailing whitespace in quirk_flags Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 215/703] af_packet: avoid waiting for TPACKET_V3 copies at retirement Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 216/703] ipv6, calipso: fix data-race in calipso_cache_add() bucketsize check Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 217/703] net: marvell: prestera: disable port before changing its MAC mode Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 218/703] net/mlx5e: Release FIB event work flows before dropping RTNL Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 219/703] net: clear skb->mac_len in skb_unset_mac_header() Greg Kroah-Hartman
2026-12-04 10:01 ` [PATCH 6.18 220/703] net/mlx5: HWS, Handle NULL in vport destination action creation Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 221/703] net/mlx5: DR, Fix out-of-bounds write when sync to HW fails Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 222/703] eth: fbnic: skip disabled Tx rings when setting the queue NAPI Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 223/703] eth: fbnic: skip freed Tx rings in fbnic_get_ts_stats() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 224/703] scsi: ufs-mediatek: Restore the M-PHY power state when va09 disable fails Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 225/703] net: qrtr: ns: keep notifying local servers after a failed send Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 226/703] riscv: efi: Map runtime MMIO with device attributes Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 227/703] net: do not run out of frags in alloc_skb_with_frags() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 228/703] net/mlx5: E-Switch, skip vport change work for disabled vports Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 229/703] ice: use global queue index in TC to-queue offload Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 230/703] ice: allow reading the last byte of the NVM and Shadow RAM regions Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 231/703] ALSA: hda: intel: Release i915 power also when delayed probe fails Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 232/703] tools/bootconfig: Use the registered global tracing parameter names Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 233/703] tracing/fprobe: Do not let KASAN check the $stackN read Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 234/703] tun: complete the zerocopy buffer of packets consumed by XDP Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 235/703] tools: gpio-hammer: Accept the maximum number of line offsets Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 236/703] tools: gpio: Preserve device listing errors in lsgpio Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 237/703] tools: gpio: Return success after monitoring requested events Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 238/703] s390/cert_store: Allocate keyring with link restriction Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 239/703] s390/cert_store: Only allow the kernel to create cert_store_key keys Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 240/703] chardev: GPIO common access methods: repair non-kernel-doc comment Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 241/703] tun: flush uc and mc addresses in TUNSETLINK Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 242/703] btrfs: send: fix missing hole punching during incremental send Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 243/703] btrfs: send: fix invalid access to inline extents in clone_range() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 244/703] btrfs: wait for a grace period before freeing a new device Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 245/703] ASoC: fsl_asrc_m2m: fix out-of-bounds write when draining the output FIFO Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 246/703] ASoC: fsl_asrc: fix pair ownership on repeated or failed hw_params Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 247/703] ASoC: fsl_easrc: fix context ownership on repeated hw_params Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 248/703] ASoC: fsl_asrc_m2m: allow only one task at a time per stream Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 249/703] cpufreq: intel_pstate: Use mutex guard for driver locking Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 250/703] cpufreq: intel_pstate: Refresh cpuinfo.max_freq when a CPU goes online Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 251/703] btrfs: remove devid kobject when deleting a missing device Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 252/703] btrfs: pre-flush reflink source before taking inode locks Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 253/703] btrfs: downgrade the reflink source inode lock for tree walking Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 254/703] btrfs: fix race between concurrent sync direct IO writes Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 255/703] btrfs: zstd: fix UAF due to race between putting workspace and reclaim Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 256/703] ASoC: SOF: control: reject out-of-range enum values Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 257/703] btrfs: fiemap: deal with inline extent in fiemap_find_last_extent_offset() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 258/703] btrfs: fix double release of space when cloning compressed inline extent Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 259/703] btrfs: abort transaction on failure to update inode after hole punching Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 260/703] btrfs: fix blocking allocation for nowait encoded reads of inline extents Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 261/703] io_uring/uring_cmd: avoid double indirect call in task work dispatch Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 262/703] btrfs: fix incorrect task accounting on error during io_uring read Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 263/703] btrfs: fix delayed inode count leak after failure to delete inode ref Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 264/703] jbd2: set JBD2_LOADED under j_state_lock Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 265/703] bpf: Let the bpf_fastcall boundary cover the longest pattern Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 266/703] net: sock_reuseport: Check program type on the migration path Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 267/703] cgroup/rstat: disable preemption in css_rstat_updated() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 268/703] x86/efi: Disregard the INITRD and MEMATTR config tables after kexec Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 269/703] efi/tpm: Allocate the event log from EFI loader data again Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 270/703] cpufreq: intel_pstate: Use dedicated lock in set_power_ctl_ee_state() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 271/703] drm/xe/hwmon: Unregister hwmon before the device is unplugged Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 272/703] arm64: dts: st: add PSCI idle state to STM32MP25 CPU domains Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 273/703] arm64: dts: st: add PSCI idle state to STM32MP23 " Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 274/703] arm64: dts: st: mark STM32MP23 timer as stopping in suspend Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 275/703] ftrace: Fix lost recursion records in ftrace_record_recursion() Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 276/703] ASoC: aw88166: fix backup restoring the RE value instead of saving it Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 277/703] workqueue: Skip redundant unbound updates during CPU bringup Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 278/703] eth: bnxt_en: restore Rx coalescing after re-allocating the completion ring Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 279/703] eth: bnxt_en: restore Tx " Greg Kroah-Hartman
2026-12-04 10:02 ` [PATCH 6.18 280/703] net: dsa: b53: initialize the jumbo frame size register offset Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 281/703] net: dsa: b53: fix the SRAB grant timeout check Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 282/703] net: dsa: b53: clear stale state when creating an ARL entry Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 283/703] net: dsa: b53: use the correct override register 2 Gbps bit Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 284/703] net: dsa: b53: fix mirror port encoding on BCM5325 and BCM5365 Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 285/703] net: dsa: b53: fix mirror destination and source state tracking Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 286/703] net: bcmasp: avoid refcount drain on probe Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 287/703] net: bcmgenet: keep DIM from getting stuck after close or suspend Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 288/703] net: bcmgenet: accumulate the DIM packet and byte counters Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 289/703] net: bcmgenet: reset the Rx discard count with the ring Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 290/703] net: systemport: restart DIM from the default profile on start Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 291/703] net: systemport: accumulate the DIM packet and byte counters Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 292/703] ipv4: fix conntrack defrag forwarding after ip_frag_reinit() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 293/703] tun: bound the NAPI receive queue Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 294/703] bpf: net_sched: Defer bpf_kfree_skb() to irq_work with irqs off Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 295/703] bpf: clear list node owner and unlink before drop Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 296/703] bpf: Save irq flags on the stack when freeing a list head or rb root Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 297/703] gpiolib: fix inverted trace values in gpiod_get_array_value() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 298/703] net: dsa: felix: fix NULL pointer dereference in felix_port_enable() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 299/703] ipv6: mcast: do not pass uninitialized bytes to dev_mc_add() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 300/703] tcp: Dont clear saddr before ->put_port() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 301/703] bpf: Do not allow bpf_d_path() by an id of another BTF Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 302/703] bpf: Keep the names in front of a number in delegate options Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 303/703] bpf: Do not trust the neighbour of tp_btf/neigh_create Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 304/703] bpf: Add the symbol of a prog before its id Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 305/703] bpf: Do not fill jited line info for a hidden subprog Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 306/703] bpf: Fix NULL dereference in XDP redirect from async callbacks Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 307/703] bpf: Check the attach type when a cgroup link gets another program Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 308/703] bpf: Refuse mmap() of a part of an arena Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 309/703] bpf: Fix reads past an enum in prints of BTF data Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 310/703] bpf: Give syscall programs without CAP_PERFMON the base helpers only Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 311/703] bpf: Limit reads of variables of the kernel Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 312/703] bpf: dont skip other information if xlated_prog_insns is skipped Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 313/703] bpf: Require CAP_PERFMON for dumps of xlated insns Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 314/703] bpf: Zero bpf_list_head in copies of map values Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 315/703] bpf: Require CAP_PERFMON to read pinned maps with special fields Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 316/703] bpf: Clear the data that bpf_msg_push_data() adds Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 317/703] bpf: Fail loads from a network header that was not set Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 318/703] bpf: Clear family and port of a short address for cgroup sockaddr hooks Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 319/703] bpf: Take a neighbour of the L3 master in bpf_redirect_neigh() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 320/703] bpf: Keep the MAC header in bpf_skb_change_tail() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 321/703] bpf, sockmap: Hold the psock of the work in sk_psock_backlog() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 322/703] tcp: fix negative sk_forward_alloc after MSG_ZEROCOPY append Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 323/703] net: dpaa2-eth: fix objtool warning and logic bug Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 324/703] tg3: Dont fail probe if 31-bit coherent DMA mask is unsupported Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 325/703] tg3: Skip management FW version when APE firmware is not ready Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 326/703] tg3: Fix heap overflow in unbuffered NVRAM write path Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 327/703] net: dsa: tag_brcm: fix link-local detection with a prepended tag Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 328/703] perf: Prevent duplicate sigtrap task work enqueue Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 329/703] perf: Fix sigtrap for software events Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 330/703] perf: Fix sigtrap vs fast-switch Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 331/703] gpio: davinci: use controller-specific MMIO for BINTEN Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 332/703] gpio: mvebu: validate ngpios before use Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 333/703] ASoC: aw88399: fix register used to disable I2S TX Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 334/703] bpf: Reject kernel threads in bpf_task_work_schedule() Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 335/703] bpf, sockmap: Clear the redirect target after the stream parser runs Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 336/703] block: fix BLKSECDISCARD zero-length range causing page cache invalidation Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 337/703] drm/gud: avoid divide error in gud_stats_debugfs Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 338/703] drm/i915/display: Flush the fbdev frontbuffer Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 339/703] drm/i915/dp_aux: Take the TypeC port lock after the PPS lock Greg Kroah-Hartman
2026-12-04 10:03 ` [PATCH 6.18 340/703] drm/i915/pps: Hold a TypeC link reference for PPS VDD Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 341/703] drm/i915/pps: Reset PPS state after TypeC port init on resume Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 342/703] drm/i915/ptl+: Add TypeC HPD pin selection for port B Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 343/703] drm/meson: encoder_dsi: load ENCL gamma table while ENCL is disabled Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 344/703] drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit) (attempt 2) Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 345/703] drm/nouveau/gsp: only handle GSP interrupts routed to the host Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 346/703] drm/nouveau: do not return early from a synchronous VM_BIND Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 347/703] drm/radeon: Bound GPIO I2C table entry count from VBIOS Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 348/703] drm/radeon: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 349/703] drm/vblank: timer: Do not block within critical section Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 350/703] drm/xe/guc: Treat CT-disabled TLB invalidation as cancelled Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 351/703] drm/xe/query: Use ordered clock reads for engine cycles cpu_delta Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 352/703] accel/rocket: number the cores by devicetree position, not bind order Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 353/703] drm/amd/pm: send smu8 sclk level indices, not the level mask Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 354/703] drm/amdgpu/gfx_v9_0: Add gfxoff quirk for Lenovo Picasso 318F Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 355/703] drm/amd/display: Fix logger leak on perf trace allocation failure Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 356/703] drm/amdgpu: Allow cancelling a requested NPS mode Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 357/703] drm/amdgpu: enable MGCG/FGCG/PERF_CLK for GC 11.0.2 Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 358/703] drm/amdgpu: Fix UserQ slot availability checks Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 359/703] drm/amdgpu: Fix VCE buffer size check for DPB and input surface Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 360/703] drm/amdgpu: only unregister the ATPX handler if we registered it Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 361/703] drm/amdkfd: Acquire cwsr buffer during CRIU resume Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 362/703] drm/amdkfd: check CRIU SVM priv data bounds before allocating Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 363/703] drm/amdkfd: Dont reuse a VRAM page that is still referenced Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 364/703] drm/amdkfd: keep the DMA addresses of a range intact if splitting fails Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 365/703] drm/amdkfd: wait for the queue quiesce in concurrent SVM evictions Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 366/703] drm/vc4: Fix firmware reference leak in vc4_hvs_bind() Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 367/703] drm/vc4: Hold a runtime PM reference while allocating the binner BO Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 368/703] drm/vc4: Check for a validated shader before reading its thread mode Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 369/703] drm/vc4: Clear the slice caches before resetting a stalled GPU Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 370/703] drm/vc4: Drop BO usecnt before releasing the old FB Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 371/703] drm/vc4: Fix off-by-one in the shader record BO handle check Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 372/703] drm/vc4: Start shader code at varying offsets in its BO Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 373/703] drm/vc4: Complete async page flips from an ordered workqueue Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 374/703] drm/vmwgfx: avoid underflow when stripping short GuestInfo replies Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 375/703] drm/vmwgfx: bound MKSSTAT lengths before rounding to pages Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 376/703] drm/vmwgfx: do not hand the embedded sg_table to the PRIME core Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 377/703] drm/vmwgfx: Erase the detached resource entry on resource release Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 378/703] drm/vmwgfx: fix NULL pointer dereference in vmw_validation_bo_fence() Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 379/703] drm/vmwgfx: include legacy hotspots in GB-only cursor images Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 380/703] drm/vmwgfx: keep cursor mappings and pins with each plane state Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 381/703] drm/vmwgfx: log missing primary planes only once Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 382/703] drm/vmwgfx: log MOB limits outside the manager spinlock Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 383/703] drm/vmwgfx: reserve cursor MOBs before unpinning them Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 384/703] drm/vmwgfx: reserve dumb buffers while detaching their surfaces Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 385/703] drm/vmwgfx: return an error when a shared GB surface has no backup buffer Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 386/703] drm/vmwgfx: validate command body sizes before parsing Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 387/703] drm/vmwgfx: validate GB-only cursor command limits Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 388/703] drm/vmwgfx: validate the framebuffer selected for cursor updates Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 389/703] drm/vmwgfx: close TOCTOU on guest_memory_bo in surface reference ioctl Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 390/703] ALSA: pcm: oss: Restore params flag after failed reconfiguration Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 391/703] ACPI: CPPC: Reject EPP registers narrower than 8 bits Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 392/703] ARC: io: work around GCC PR127718 in __raw_write{w,l}() Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 393/703] arm64/mm: fix destructor for unconstructed hotplug page tables Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 394/703] arm64: cpufeature: Remove Neoverse-V3/AE from the BBML3 allow list Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 395/703] arm64: kexec: use a typed entry to fix kCFI oops Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 396/703] ASoC: amd: acp: fix PDM ring buffer address on ACP7.x resume Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 397/703] ASoC: qcom: audioreach: only disconnect the route a mixer control owns Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 398/703] ASoC: qcom: q6apm-dai: reject compress rings larger than the DMA buffer Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 399/703] ASoC: qcom: q6asm-dai: " Greg Kroah-Hartman
2026-12-04 10:04 ` [PATCH 6.18 400/703] ASoC: qcom: q6dsp-lpass-clocks: Set driver data before registering clocks Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 401/703] ASoC: wm8962: Fix broken headset button caused by wrong guard constant Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 402/703] ata: libata-core: Add max sector quirk to INTEL SSDSCKKB240G8 Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 403/703] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 405/703] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 414/703] EDAC/i5000: Fix slot number passed to determine_mtr() Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 415/703] fault-inject: fix boot failure with fault injection boot parameters Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 416/703] fgraph: Allocate shadow stacks inline with GFP_NOWAIT Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 417/703] fgraph: Do not mark index 0 in every shadow stack frame Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 418/703] fscrypt: Initialize ->ci_master_key before publication Greg Kroah-Hartman
2026-12-04 10:05 ` [PATCH 6.18 419/703] fbdev: fm2fb: Fix iomem access Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox