* [PATCH 6.18 000/990] 6.18.66-rc1 review
@ 2026-11-25 14:22 Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 001/990] netfilter: nft_ct: expectation timeouts are passed in milliseconds Greg Kroah-Hartman
` (852 more replies)
0 siblings, 853 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 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.66 release.
There are 990 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 Fri, 27 Nov 2026 14:36:57 +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.66-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.66-rc1
Damien Riégel <damien.riegel@silabs.com>
greybus: raw: fix use-after-free if write is called after disconnect
Karl Mehltretter <kmehltretter@gmail.com>
mtd: core: avoid double-free of OTP NVMEM device
Kuniyuki Iwashima <kuniyu@google.com>
tcp: Set unhashed_state in inet_twsk_hashdance_schedule().
Andrea Mayer <andrea.mayer@uniroma2.it>
seg6: ensure packet data is writable before modifying SRH and IPv6 DA
Yuya Kusakabe <yuya.kusakabe@gmail.com>
net: ipv6: keep room for the mac header in dst_dev_overhead()
Cen Zhang (Microsoft Security FORGE Labs) <blbllhy@gmail.com>
xfrm: hold net_device reference under RCU in bundle creation
Nikolay Aleksandrov <razor@blackwall.org>
net: bridge: vlan: fix bugs caused by switchdev deletion errors
Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Don't disable GuCRC in suspend path
Riana Tauro <riana.tauro@intel.com>
drm/xe/xe_survivability: Remove unused index
Baochen Qiang <baochen.qiang@oss.qualcomm.com>
wifi: ath12k: fix EHT TX MCS limitation due to wrong 20 MHz-only parsing
Vinay Belgaumkar <vinay.belgaumkar@intel.com>
perf: Fix null pointer access in is_include_guest_event()
Christian Brauner <brauner@kernel.org>
9p: free the session after a grace period
Stefano Garzarella <sgarzare@redhat.com>
9p: fix privport option setting wrong RDMA field
Pierre Barre <pierre@barre.sh>
9p: fix access mode flags being ORed instead of replaced
Sasha Levin <sashal@kernel.org>
9p: fix memory leak in v9fs_init_fs_context error path
Luiz Capitulino (Red Hat) <luiz.capitulino@linux.dev>
powerpc/watchdog: disable watchdog when watchdog_thresh=0
Hyunwoo Kim <imv4bel@gmail.com>
tcp: fix NULL pointer dereference when restarting a Fast Open listener
Mani Tofigh <mt4022@columbia.edu>
nvme: fix deadlock on nvme_subsystems_lock in nvme_init_subsystem()
Henry Martin <bsdhenrymartin@gmail.com>
sctp: fix skb_over_panic when adding addresses with a pending delete of another family
Karol Wachowski <karol.wachowski@linux.intel.com>
accel/ivpu: Defer recovery until probe completes
Hyunjung Ko <hj351016@gmail.com>
gpio: mpsse: reject bulk-in endpoints smaller than 3 bytes
Mani Tofigh <mt4022@columbia.edu>
blk-mq: take quiesce_lock when removing a queue from the tag set
Theodor Arsenij Larionov Trichkine <theodorlarionov@gmail.com>
fou: reserve headroom before pushing the encap header
Karl Mehltretter <kmehltretter@gmail.com>
iio: trigger: Return an error when the trigger has no free irq
Changyul Lee <lcy8047@gmail.com>
iio: trigger: free the trigger ID after device_del()
Salah Triki <salah.triki@gmail.com>
iio: temperature: mlx90614: Fix dual channel probe condition check
Arnav Kapoor <kapoorarnav43@gmail.com>
iio: proximity: sx9500: ignore event config writes that don't change state
Arnav Kapoor <kapoorarnav43@gmail.com>
iio: proximity: sx9324: fix out-of-bounds read of scan period table
Viral Patel <viral8854@gmail.com>
iio: magnetometer: tlv493d: fix magnetic field scale
Shashank Mohan Jain <jain.sm@gmail.com>
iio: magnetometer: mmc35240: leave cache-only mode before the cache sync
Alexander Sarmanow <as@discnull.de>
iio: light: vcnl4035: Fix reversed ALS mode bit
Jan Remes <jan.remes@mycroftmind.com>
iio: light: tsl2591: don't divide by zero
Jiale Yao <yaojiale02@163.com>
iio: imu: kmx61: reject duplicate event disable
Arnav Kapoor <kapoorarnav43@gmail.com>
iio: imu: inv_mpu6050: fix swapped accel and gyro startup times
Arnav Kapoor <kapoorarnav43@gmail.com>
iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change
Vidhu Sarwal <vidhu.linux@gmail.com>
iio: humidity: am2315: fix negative temperature decoding
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
iio: hid-sensors: fix fractional part for unit exponents -7 and -8
Maximilian Czirr <maxx-cz@web.de>
iio: hid-sensor: Fix scale for magnetic north heading
Jiale Yao <yaojiale02@163.com>
iio: gyro: bmg160: reject duplicate event disable
Baek Kyu, Kim <pocj8ur4in@gmail.com>
iio: dac: mcp4725: Update the cached DAC value only on success
Arnav Kapoor <kapoorarnav43@gmail.com>
iio: common: scmi_sensors: fix truncating 64-bit divisions
Nikhil Gautam <nikhilgtr@gmail.com>
iio: atlas-ezo: Fix humidity channel read support
Andrea Amer <and.amer@gmail.com>
iio: afe: rescale: expose offset if rescaler or source has one
Yu-Hsiang Tseng <asas1asas200@gmail.com>
iio: acpi: Accept comma separated values in ROTM strings
Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
iio: accel: kxsd9: Fix potential use-after-free on removal
Alexis Bouzigues <BouziguesAlexis@JohnDeere.com>
iio: accel: adxl313: add missing buffer selections in Kconfig
Billy Tsai <billy_tsai@aspeedtech.com>
dt-bindings: iio: adc: Add syscon property for multi-SCU SoCs
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: serialise MCR accesses
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: fix potential use-after-free on disconnect
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: fix potential fifo corruption
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: move initial termios update to open()
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: fix potential NULL-deref at open
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: fix potential close() use-after-free
Johan Hovold <johan@kernel.org>
USB: serial: io_edgeport: fix NULL-deref on early status
Johan Hovold <johan@kernel.org>
USB: serial: upd78f0730: fix NULL-deref on hangup
Tristan Madani <tristan@talencesecurity.com>
USB: serial: sierra: validate URB length in instat callback
Hui Peng <benquike@gmail.com>
USB: serial: garmin_gps: validate packet data length in nat_receive()
Jesse Zhang <Jesse.Zhang@amd.com>
drm/amdgpu: fix the error handling of amdgpu_vm_init_entities()
Jesse Zhang <Jesse.Zhang@amd.com>
drm/amdkfd: skip GPUs without a VM when checkpointing the BO mappings
Josef Bacik <josef@toxicpanda.com>
w1: w1_therm: leave the slaves of other families alone
Josef Bacik <josef@toxicpanda.com>
w1: use the bus mutex for the "rw" file
Josef Bacik <josef@toxicpanda.com>
w1: remove the master's files before taking its locks
Josef Bacik <josef@toxicpanda.com>
w1: netlink: drop the slave after the bus is unlocked
Josef Bacik <josef@toxicpanda.com>
w1: ds28e04: use the bus mutex to talk on the bus
Josef Bacik <josef@toxicpanda.com>
w1: ds2805: use the bus mutex to talk on the bus
Josef Bacik <josef@toxicpanda.com>
w1: ds2482: set the strong pull-up with its byte
Josef Bacik <josef@toxicpanda.com>
w1: don't hold list_mutex while a slave is torn down
Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
usb: dwc3: xilinx: fix system suspend and resume PHY handling
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Wait for End Transfer completion on ep disable
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Track a timed out End Transfer
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Reset endpoint flags on controller start
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Reject requests to a disabled endpoint
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Recover from End Transfer timeout
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints
Thinh Nguyen <Thinh.Nguyen@synopsys.com>
usb: dwc3: gadget: Clear delayed stop on End Transfer completion
Krystian Kaniewski <krystianmkaniewski@gmail.com>
usb: gadget: u_serial: pin ports while TTYs are installed
Brian Ellis <brianellis@gotenna.com>
usb: gadget: u_serial: fix NULL deref in gs_close() after failed open
Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty
Sonali Pradhan <sonalipradhan@google.com>
usb: gadget: f_midi: fix UAF race during IN request handling
Yu Zhang <yuz08559@gmail.com>
usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF
Xu Rao <raoxu@uniontech.com>
usb: xhci: disable the correct slot on alloc_dev failure
Uttkarsh Aggarwal <uttkarsh.aggarwal@oss.qualcomm.com>
usb: typec: ucsi: Set ucsi->connector before enabling notifications
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
usb: usbtest: prevent divide by zero in simple_io() with zero length
Olivier Kaloudoff <olivier.kaloudoff@gmail.com>
usb: uas: ignore UAS for ASMT135x bridges (174c:55aa)
Chaz Bailey <charles.s.bailey@gmail.com>
usb: typec: nb7vpq904m: Set client data in probe to avoid crash on remove
Joonhoe Kim <26rote@gmail.com>
usb: typec: mux: fsa4480: Keep the USB 2.0 switch on in DP-only modes
Josef Bacik <josef@toxicpanda.com>
USB: serial: oti6858: fix the teardown order in close
Johan Hovold <johan@kernel.org>
USB: serial: garmin_gps: fix deadlock on reset request
Rishabh Jain <rishabh.jain1198@gmail.com>
usb: pci-quirks: always assert xHCI OS ownership
Johan Hovold <johan@kernel.org>
USB: cdc-acm: fix NULL-deref on hangup
Jiri Slaby (SUSE) <jirislaby@kernel.org>
tty: fix misapplied compat_ptr() in tty_compat_ioctl()
Josef Bacik <josef@toxicpanda.com>
serial: samsung: put the previous baud clock
Josef Bacik <josef@toxicpanda.com>
serial: samsung: don't leak the tty on an RX IRQ
Josef Bacik <josef@toxicpanda.com>
serial: rda: free the interrupt on shutdown
Josef Bacik <josef@toxicpanda.com>
serial: core: respect runtime PM when sending x_char
Josef Bacik <josef@toxicpanda.com>
serial: 8250_lpss: don't divide by 0 above 6.25 Mbaud
Josef Bacik <josef@toxicpanda.com>
misc: vmw_vmci: wait for callbacks in event unsubscribe
Jiale Yao <yaojiale02@163.com>
misc: ibmvmc: initialize HMC state before device registration
Guangshuo Li <lgs201920130244@gmail.com>
misc: bcm-vk: fix DMA allocation memory leak
Josef Bacik <josef@toxicpanda.com>
iio: sx9310: use the data of the I2C table
Josef Bacik <josef@toxicpanda.com>
iio: hid-sensors: fix a division by zero
Josef Bacik <josef@toxicpanda.com>
iio: addac: ad74413r: fix the values of set_multiple
Josef Bacik <josef@toxicpanda.com>
iio: adc: check the result of ad_sd_init()
Josef Bacik <josef@toxicpanda.com>
iio: accel: adxl380: don't stay in standby on -EINVAL
Josef Bacik <josef@toxicpanda.com>
comedi: vmk80xx: report failed transfers of the K8061
Josef Bacik <josef@toxicpanda.com>
comedi: ni_tio: Fix overflow of the clock period
Josef Bacik <josef@toxicpanda.com>
comedi: ni_660x: don't poll without a DMA channel
Josef Bacik <josef@toxicpanda.com>
comedi: addi_apci_1500: fix clearing of the gate enable
Chris Mason <mason@kernel.org>
vt: serialise the producers of the flip buffer
Mikulas Patocka <mpatocka@redhat.com>
dm-thin: fix parsing of feature arguments
Mikulas Patocka <mpatocka@redhat.com>
dm-thin: fix leak if __set_snapshot_details fails
Mikulas Patocka <mpatocka@redhat.com>
dm-thin: fix data corruption if discard races with regular I/O
Li Youhong <liyouhong@kylinos.cn>
dm-raid: fix use-after-free in raid_dtr()
Jay Vadayath <jay@artiphishell.com>
dm-raid: bound array_position before indexing failed_devices
Mikulas Patocka <mpatocka@redhat.com>
dm-integrity: don't attempt to commit journal on disabled device
Sinan Polat <sinan86polat@gmail.com>
dm-integrity: don't recalculate with HMAC because of a dirty bitmap
Josef Schlehofer <pepe.schlehofer@gmail.com>
dm-crypt: defer async write submission to write thread
xietangxin <xietangxin@h-partners.com>
dm-crypt: reject integrity_key_size with non-authenc AEAD ciphers
Mikulas Patocka <mpatocka@redhat.com>
dm-cache: fix ending a cursor that never began
Mikulas Patocka <mpatocka@redhat.com>
dm-cache: fix NULL pointer dereference on open failure
Kyrylo Biryuk <illofspeed@gmail.com>
dm zoned: do not reclaim a random zone into another random zone
Kyrylo Biryuk <illofspeed@gmail.com>
dm zoned: back off when reclaim cannot make progress
Chen Cheng <chencheng@fnnas.com>
dm snapshot: fix discard writing into the next COW chunk
Chen Cheng <chencheng@fnnas.com>
dm snapshot: split discards on chunk boundaries
wuyuehong <wuyuehong@cmss.chinamobile.com>
dm snapshot: fix discard_granularity unit in snapshot_io_hints
Mikulas Patocka <mpatocka@redhat.com>
dm persistent data: don't leak bufio buffer if find_leaf fails
Mikulas Patocka <mpatocka@redhat.com>
dm persistent data: don't ignore writeback errors
Mikulas Patocka <mpatocka@redhat.com>
dm persistent data: test return value of node_copy
Weijiang Zhou <weijiang.zhou@unisoc.com>
dm-verity: don't restart or panic on errors during system shutdown
Mikulas Patocka <mpatocka@redhat.com>
dm-sysfs: fix misbehavior if kobject_init_and_add fails
guolingxing <guolingxing@tju.edu.cn>
dm-pcache: do not advance dirty_tail after backing flush failure
Yingjie Wang <1075151112@qq.com>
dm thin: avoid wrapping no_space_timeout
Yingjie Wang <x-professor@outlook.com>
dm mpath: cap queue_if_no_path_timeout_secs
shao.mingyin@zte.com.cn <shao.mingyin@zte.com.cn>
dm mpath: fix buffer overflow in parse_hw_handler()
Zhao Feng <zhaofeng2@cmss.chinamobile.com>
dm crypt: fix use of uninitialized percpu_counter in ctr error path
Edward Adam Davis <eadavis@sina.com>
dm cache: reject kcopyd client destory if it setup failed
Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
dm: Reject table setup after queue or disk teardown
Mark Bundschuh <mkbund@amazon.com>
dm: fix infinite loop in dm_blk_do_report_zones()
Daejun Park <daejun7.park@samsung.com>
dm: fail a REQ_PREFLUSH bio with data when its preflush fails
Yaohan Li <shunsheng1218@gmail.com>
dm: avoid double-dropping the zone reset submission reference
shao.mingyin@zte.com.cn <shao.mingyin@zte.com.cn>
dm log userspace: drop the device reference on error
liuyong <pkfxxxing@gmail.com>
smb: client: validate descriptor headers before query result allocation
Joseph Qi <joseph.qi@linux.alibaba.com>
smb: client: skip NULL channel in __cifs_put_smb_ses()
Paulo Alcantara <pc@manguebit.org>
smb: client: retry writes that couldn't be issued due to a reconnect
Paulo Alcantara <pc@manguebit.org>
smb: client: issue writes from a worker if the task is dying
Joseph Qi <joseph.qi@linux.alibaba.com>
smb: client: hold the inode across cifs_oplock_break()
Paulo Alcantara <pc@manguebit.org>
smb: client: flush deferred handles of other names before a hard link open
Fredric Cover <fredric.cover.lkernel@gmail.com>
smb: client: fix out-of-bounds read in dfs_parse_target_referral()
Andrey Misiurov <andrey.misyrov@gmail.com>
smb: client: fix OOB write when compounding SMB2_IOCTL with encryption
Fredric Cover <fredric.cover.lkernel@gmail.com>
smb: client: fix double conversion of DFS path in setup_dfs_ref()
Paulo Alcantara <pc@manguebit.org>
smb: client: don't block dying tasks waiting for writeback on fsync
Paulo Alcantara <pc@manguebit.org>
smb: client: don't block dying tasks waiting for writeback on close
liuyong <pkfxxxing@gmail.com>
smb: client: compare owner and group SIDs using their encoded lengths
Yifan Zhang <yfzhang23@stu.pku.edu.cn>
smb: client: bound invalid NTLMSSP signature diagnostic
Amir Goldstein <amir73il@gmail.com>
ovl: do not allow nfs_export with data-only layers
Giuseppe Scrivano <giuseppe@scrivano.org>
ovl: return EIO if the lowerdata is missing
Amir Goldstein <amir73il@gmail.com>
ovl: report the requested redirect_dir mode in conflicting options
Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
ovl: reject different lower idmaps on the same fs
Giuseppe Scrivano <giuseppe@scrivano.org>
ovl: do not always clear absolute_redirect
Yu Zhang <yuz08559@gmail.com>
gpio: virtuser: remove the debugfs files before freeing the line data
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpio: virtuser: fix interrupt leak and UAF
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpio: sodaville: fix use-after-free bug when registering the irqchip
Cunhao Lu <1579567540@qq.com>
gpio: rockchip: Fix debounce arithmetic for GPIO v2
Guangshuo Li <lgs201920130244@gmail.com>
gpio: brcmstb: fix UAF after IRQ domain setup failure
Billy Tsai <billy_tsai@aspeedtech.com>
gpio: aspeed: Preserve the pending G7 interrupt status on control writes
Billy Tsai <billy_tsai@aspeedtech.com>
gpio: aspeed: Clear only the acked line's G4 interrupt status
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: bound pending OCB station allocations
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: bound pending IBSS station allocations
Johannes Berg <johannes.berg@intel.com>
wifi: mac80211: fix use-after-free on TTLM disconnect
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: restore dormant links when link updates fail
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: reject invalid EHT guard intervals in airtime estimates
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: recheck the OCB station limit before insertion
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: recheck the IBSS station limit before insertion
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: recheck injected headers after removing FCS
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: drain link readers before stopping removed links
Zhao Li <enderaoelyther@gmail.com>
wifi: mac80211: fix use-after-free when MLO link setup is rolled back
Wahid Khan <wahidzk0091@gmail.com>
wifi: cfg80211: don't truncate the merged MBSSID profile length
Zhao Li <enderaoelyther@gmail.com>
wifi: cfg80211: preserve mesh A-MSDU lengths when adding mesh headers
Zhao Li <enderaoelyther@gmail.com>
wifi: cfg80211: release rejected nontransmitted BSS reference
Mehmet Fide <mehmet.fide@screeningeagle.com>
wifi: ath9k_htc: do not start ANI before the first channel is set
Benoit Masson <yahoo@perenite.com>
wifi: ath12k: assign device id from the WSI index
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/probes: Reject array count on non-dereference string sources
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/probes: Fix user-space dereference string array store type
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/probes: Fix missing BTF kind checks in char pointer/array helpers
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/probes: Enable newly appended probe when target event is enabled
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/probes: Check enabled and busy state before unlinking sibling probes
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/eprobe: Disallow attaching eprobes to fprobe events
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/eprobe: Fix 1-byte signed field fetch in get_event_field()
Masami Hiramatsu (Google) <mhiramat@kernel.org>
tracing/uprobes: Fix memory leak of tail in __trace_uprobe_create()
Paolo Bertinetti <paolobertinetti200f4@proton.me>
tracing/perf: Clear stop state in perf_trace_add()
Tao Cui <cuitao@kylinos.cn>
LoongArch: KVM: Reject repeated PCH-PIC CTRL_INIT
Tao Cui <cuitao@kylinos.cn>
LoongArch: KVM: Propagate real error code in kvm_pch_pic_create()
Mike Rapoport (Microsoft) <rppt@kernel.org>
LoongArch: Restore KFENCE pages through DMW on resume
Jinjie Ruan <ruanjinjie@huawei.com>
LoongArch: kexec_file: Fix elf_headers memory leak in retry loop
Jinjie Ruan <ruanjinjie@huawei.com>
LoongArch: kexec_file: Fix a modified cmdline leak
Weiming Shi <bestswngs@gmail.com>
sctp: reset stored flag for each association
Tim Budding <tim.budding@gmail.com>
sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED
Tim Budding <tim.budding@gmail.com>
sctp: fix I-FORWARD-TSN handling of fragments on other streams
Andrey Misiurov <andrey.misyrov@gmail.com>
sctp: fix ASCONF address change on single-homed hosts
Kyle Zeng <kylebot@openai.com>
sctp: avoid requeueing pending control chunks
Tim Budding <tim.budding@gmail.com>
sctp: abort unordered partial delivery when its message is skipped
Andrea Parri <parri.andrea@gmail.com>
sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler()
Andrea Parri <parri.andrea@gmail.com>
sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE
Andrea Parri <parri.andrea@gmail.com>
sched/deadline: Fix spurious -EPERM for migration-disabled tasks
Stefan Haberland <sth@linux.ibm.com>
s390/dasd: Don't trust userspace-supplied result field in format check
Stefan Haberland <sth@linux.ibm.com>
s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path
Stanislav Aleksandrov <lightofmysoul@gmail.com>
hwmon: (max31760) Report 0 RPM before the first fan speed measurement
Stanislav Aleksandrov <lightofmysoul@gmail.com>
hwmon: (max31760) Leave standby mode at probe
Stanislav Aleksandrov <lightofmysoul@gmail.com>
hwmon: (max31760) Fix the local temperature limit registers
Sudeep Holla <sudeep.holla@kernel.org>
hwmon: (scmi) Check channel config allocation
Pablo Mazzini <pmazzini@gmail.com>
hwmon: (sy7636a) fix negative temperatures
Felix Radensky <fradensky@nvidia.com>
hwmon: (pmbus/mp2975) Get vout fault limits dynamically
Guenter Roeck <linux@roeck-us.net>
hwmon: (gpio-fan) Fix runtime PM imbalance in probe and teardown
Rupesh Majhi <zoone.rupert@gmail.com>
hwmon: (aht10) Fix update_interval overflow on 64-bit
Yehyeong Lee <yhlee@isslab.korea.ac.kr>
xen/pvcalls: destroy the per-socket workqueue on release
Yehyeong Lee <yhlee@isslab.korea.ac.kr>
xen/pvcalls: unwind pvcalls_new_active_socket() step by step
Qihang <q.h.hack.winter@gmail.com>
xen/privcmd: fix double free when an irqfd is shut down twice
Andrey Misiurov <andrey.misyrov@gmail.com>
xen/gntdev: fix deadlock between map ioctl and mmap
Hengyu Liang <hengyul@cs.unc.edu>
x86/video: Preserve the default VGA fallback for legacy modes
Dave Hansen <dave.hansen@linux.intel.com>
x86/mm: Ensure write visibility during LDT installation
Jason Andryuk <jason.andryuk@amd.com>
x86/CPU/AMD: Don't print reset reason in VMs
Zhao Feng <zhaofeng2@cmss.chinamobile.com>
watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog
Vishwaroop A <va@nvidia.com>
spi: tegra210-quad: Track DMA mapping state
Hyunjung Ko <hj351016@gmail.com>
tpm: flush timeout work outside buffer_mutex to avoid deadlock
Guanglei Zhu <zhugl3@xiaopeng.com>
tpm: eventlog: check the payload size before reading tag events
Eric Biggers <ebiggers@kernel.org>
tpm: Check return value of crypto_kpp_set_secret()
Takashi Iwai <tiwai@suse.de>
tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path
Avi Weiss <thnkslprpt@gmail.com>
timekeeping: Refresh auxiliary base before offset validation
Hungyu Lin <dennylin0707@gmail.com>
timekeeping: Read getboottime64() offsets under the sequence counter
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: Fix TCP-with-TLS transport class identification
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
software node: only let the owner release a managed node
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: Cache post-resolution target frequency in __resolve_freq()
Li Zhaoxin <lizhaoxin04@baidu.com>
cpufreq: intel_pstate: Use rdmsrq_safe() to read MSR_MISC_PWR_MGMT
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: intel_pstate: Clear last written P-state value on suspend
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: Improve suspend-resume synchronization
Li RongQing <lirongqing@baidu.com>
cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io()
Mark Brown <broonie@kernel.org>
arm64: suspend: Save GCS state over suspend
Mark Brown <broonie@kernel.org>
arm64: suspend: Save POR_EL0 over suspend
Zhao Gongyi <zhaogongyi@bytedance.com>
arm64: ptrace: don't warn on missing siginfo in a group-stop
Jinjie Ruan <ruanjinjie@huawei.com>
arm64: kexec_file: Do not use CMA for images with a non-zero text_offset
Beata Michalska <beata.michalska@arm.com>
arm64: errata: Add Cortex-A715/A720 AMU core counter workaround
Mark Brown <broonie@kernel.org>
arm64/gcs: Ignore attempts to change GCS mode during signal return
Cheng Yongkang <teel4res@gmail.com>
fs/splice: clamp an over-reported write_iter result
Cheng Yongkang <teel4res@gmail.com>
fs/proc: fix the write length returned by proc_sys_call_handler()
HyeongJun An <sammiee5311@gmail.com>
fs/adfs: bound directory entry name length in adfs_fplus_getnext()
Christian Brauner <brauner@kernel.org>
dcache: let d_invalidate() wait for a d_set_mounted() in flight
Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
crypto: essiv - fix use-after-free in AEAD path
Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
crypto: caam - reject overlong RSA CRT parameters
Ridong Chen <chenridong@xiaomi.com>
cgroup/cpuset: Don't revive invalid partition without active CPU on hotplug
Zhao Li <enderaoelyther@gmail.com>
Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
Baoli Zhang <baoli.zhang@linux.intel.com>
ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PM: runtime: Update last_busy in rpm_resume() for active devices
Paolo Bertinetti <paolobertinetti200f4@proton.me>
perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()
Phat Dinh <phatdt1116@gmail.com>
perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit
Joas Antonio dos Santos <joasantonio108@gmail.com>
openvswitch: advance by the real header length in get_ipv6_ext_hdrs()
Tim Menninger <tmenninger@everpuredata.com>
NFSv4: Prevent indefinite waits for out-of-order OPEN stateids
Jamal Hadi Salim <jhs@mojatatu.com>
net/sched: act_ife: require a full Ethernet header on egress
Jamal Hadi Salim <jhs@mojatatu.com>
net/sched: act_ife: encode configured zero metadata values
Jamal Hadi Salim <jhs@mojatatu.com>
net/sched: sch_teql: reject qdiscs from another network namespace
Paulo Alcantara <pc@manguebit.org>
netfs: don't hang a read whose retry is abandoned
Paulo Alcantara <pc@manguebit.org>
netfs: keep the prepare_read errno when abandoning read retries
Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
netfs: preserve prepare_write errno on reissue
Michail Andreas Michalopoulos <mike.michalo@gmail.com>
netfilter: flowtable: extend ct timeout of offloaded GRE flows
Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
netfilter: xt_recent: do not call remove_proc_entry() under recent_lock
Zihan Xi <zihanx@nebusec.ai>
netfilter: nf_dup: preserve guard across NFQUEUE reinjection
Eric Dumazet <edumazet@kernel.org>
net: gro: invalidate frag0 after a pull
Eric Dumazet <edumazet@kernel.org>
net: gro: do not undo remote checksum offload on merged packets
Kyle Zeng <kylebot@openai.com>
net: gro: avoid parsing headers from shared fragments
Andrea Parri <parri.andrea@gmail.com>
hv_sock: Report no unread data before a channel is available
Erni Sri Satya Vennela <ernis@linux.microsoft.com>
hv_netvsc: Stop PPI parsing on invalid metadata
Joas Antonio dos Santos <joasantonio108@gmail.com>
gtp: free the skb after handling an echo response
Chengfeng Ye <nicoyip.dev@gmail.com>
ipvs: fix protocol data lifetime during namespace teardown
Chengfeng Ye <nicoyip.dev@gmail.com>
ipvs: Defer application parent freeing until after RCU readers
Yingjie Wang <1075151112@qq.com>
ipv6: reject routes without an inet6_dev
Xia Yan <yanxia@cmss.chinamobile.com>
ipv6: fix cached route reuse for control messages
Daniël Trujillo <datrujillo@nvidia.com>
ipv4: fib_trie: prevent speculative out-of-bounds child access
Kyle Zeng <kylebot@openai.com>
ipv4: keep XFRM headers out of corked skb lengths
Kyle Zeng <kylebot@openai.com>
mptcp: reject DATA_ACKs against a reversed send interval
Zixuan Chai <petalzu987@gmail.com>
seg6: validate state in netfilter continuations
Hyunwoo Kim <imv4bel@gmail.com>
tcp: fix request_sock use-after-free during Fast Open accept()
Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
tcp: fix authentication bypass via unsupported TCP auth options
Hyunwoo Kim <imv4bel@gmail.com>
tcp: do not coalesce segments after FIN
Rishikesh Jethwani <rjethwani@purestorage.com>
tls: only install push_pending_record for a TX context
Hungyu Lin <dennylin0707@gmail.com>
tsacct: Keep task begin times stable across suspend
Jerome Mohm <jrmmhm.kernel@eldare.de>
vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore
Rongzheng Wang <testwrzwrz@gmail.com>
xsk: defer software checksum until the skb is complete
YuanZhe Liu <25031212351@stu.xidian.edu.cn>
net: usb: lan78xx: let unregister_netdev() stop phylink
James Clark <jjc@jclark.com>
net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
net: mana: report RX checksum offload for IPv6
Jens Axboe <axboe@kernel.dk>
net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls
Tapio Reijonen <tapio.reijonen@vaisala.com>
net: dsa: microchip: initialize the IRQ access mutex
Jun Yang <junvyyang@tencent.com>
net: bridge: use one headroom snapshot for ND replies
Mahanta Jambigi <mjambigi@linux.ibm.com>
net/smc: fix link group ownership in handshake abort
Mahanta Jambigi <mjambigi@linux.ibm.com>
net/smc: fix lgr/lnk lifetime vs diag reader race
Kyle Zeng <kylebot@openai.com>
net/rds: Do not unpin a page after a failed atomic pin
Jiabin Deng <dengjiabin2023@gmail.com>
net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported
Breno Leitao <leitao@debian.org>
net/mlx5e: Fix queue stats access to queues without stats
Davidlohr Bueso <dave@stgolabs.net>
mctp: accept MSG_CMSG_COMPAT in recvmsg
Kyle Zeng <kylebot@openai.com>
macsec: reject frames that decapsulate into runt Ethernet frames
Jean-Paul Sergent <jpsergent@gmail.com>
net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp
Hungyu Lin <dennylin0707@gmail.com>
coda: honor the append state of each write
Mani Tofigh <mt4022@columbia.edu>
btrfs: fix bio counter and bioc leak when async checksumming fails
Josef Bacik <josef@toxicpanda.com>
mm/page_alloc: clear ->private of deferred free pages
Gregory Price (Meta) <gourry@gourry.net>
mm/page_alloc: snapshot the preferred zone against shrink rebuilds
Gregory Price (Meta) <gourry@gourry.net>
mm/page_alloc: detect zonelist rebuilds from memory hot-add
Josef Bacik <josef@toxicpanda.com>
mm/page_alloc: keep the pagesets of an empty zone
Gregory Price (Meta) <gourry@gourry.net>
mm/page_alloc: don't undo another isolation in alloc_contig_range
Josef Bacik <josef@toxicpanda.com>
mm/memory_hotplug: resize zones under their seqlock
Gregory Price (Meta) <gourry@gourry.net>
mm/mempolicy: read the zoneref slot once in mempolicy_slab_node()
Josef Bacik <josef@toxicpanda.com>
mm: page_frag: refill the cache for large fragments
Josef Bacik <josef@toxicpanda.com>
mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone
Gregory Price (Meta) <gourry@gourry.net>
mm/mmzone: read the zoneref slot once in zonelist_zone()
Christian Brauner <brauner@kernel.org>
libfs: make i_rwsem the lock of the offset tree
Avi Weiss <thnkslprpt@gmail.com>
splice, net: avoid MSG_MORE when the bvec array fills
Christian Brauner <brauner@kernel.org>
fs: fix the SEEK_CUR f_lock condition
Christian Brauner <brauner@kernel.org>
aio: don't let exit_aio() return before complete() is done
Mani Tofigh <mt4022@columbia.edu>
eventpoll: wake the next waiter when a woken waiter is killed
Chen Linxuan <me@black-desk.cn>
pidfd: restrict task access ioctls to the caller's pid namespace
Chris Mason <mason@kernel.org>
backing-file: pass RWF_NOAPPEND to synchronous writes
Shashank Mohan Jain <jain.sm@gmail.com>
errseq: don't let errseq_check_and_advance() hide later errors
Igor Velkov <iav@iav.lv>
mmc: meson-gx: name the limit of the CMD_CFG timeout field
Igor Velkov <iav@iav.lv>
mmc: meson-gx: report the longest busy wait the controller can do
Igor Velkov <iav@iav.lv>
mmc: meson-gx: honour the busy timeout for R1b commands
Igor Velkov <iav@iav.lv>
mmc: meson-gx: report busy from DAT0 alone
Ian Ray <ian.ray@gehealthcare.com>
mmc: sdhci-esdhc-imx: map unsupported driver type to Type B
Runyu Xiao <runyu.xiao@seu.edu.cn>
mmc: omap: synchronize clock timer before disabling fclk
Anfernee Cao <anferneemelokc5@gmail.com>
mmc: mmci: fix DMA channel leak when mmc_add_host() fails
Anfernee Cao <anferneemelokc5@gmail.com>
mmc: sunxi: fix clock and runtime PM leaks on probe failure
Olivier Louvignes <olivier@mgcrea.io>
mmc: jz4740: Remove the host before resetting the controller
Masami Hiramatsu (Google) <mhiramat@kernel.org>
kprobes: Validate re-registration earlier in register_kretprobe()
Masami Hiramatsu (Google) <mhiramat@kernel.org>
kprobes: Fix double free and NULL deref in unregister_kretprobes()
Masami Hiramatsu (Google) <mhiramat@kernel.org>
kprobes: Fix error return and slot leak in __register_kprobe()
Steven Rostedt <rostedt@goodmis.org>
tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
Jaewon Jung <jaewon8868@gmail.com>
selftests/ftrace: Add missing spaces after ! in probe syntax tests
Andrew Davison <andy@dvsn.net>
ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set
Gichoon Han <gichoon.han@samsung.com>
ALSA: usb-audio: Drop capture packets with bogus actual_length
Angel J <iamanaws@httpd.dev>
ALSA: hda/realtek: Fix the Dell XPS 8940 headset microphone
Sergei Nizovtsev <snizovtsev@cloudlinux.com>
ALSA: caiaq: Kill EP1 URB before unregistering the input device
Zhiqi Zhang <zhiqizhangg@gmail.com>
bootconfig: Allow keys with the maximum supported depth
Jarkko Sakkinen <jarkko@kernel.org>
KEYS: Verify the key identity in __key_unlink_begin
Jarkko Sakkinen <jarkko@kernel.org>
KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE
David Carlier <devnexen@gmail.com>
tracing/eprobe: Install the trigger for every instance that enables the eprobe
Hao Li <hao.li@linux.dev>
mm/slub: refill prefilled sheaves from the barn
Pauli Virtanen <pav@iki.fi>
Bluetooth: 6lowpan: avoid concurrent peer_del() in bt_6lowpan_disconnect
Nickolai Zeldovich <nickolai@csail.mit.edu>
pidfs: do not report fields that do not fit into the caller's struct
Josef Bacik <josef@toxicpanda.com>
blk-mq-dma: initialize the dma state for P2P, too
Jacob Keller <jacob.e.keller@intel.com>
ice: use reference counting and SRCU for PTP port access
Kuniyuki Iwashima <kuniyu@google.com>
ipv6: Protect multiple routes insertion by table lock.
Chuck Lever <chuck.lever@oracle.com>
tls: Honor O_NONBLOCK in tls_sw_splice_read()
Josef Bacik <josef@toxicpanda.com>
block: don't enter reclaim under rq_qos_mutex
Namjae Jeon <linkinjeon@kernel.org>
ksmbd: return complete and aligned stream information
Rishikesh Jethwani <rjethwani@purestorage.com>
tls: keep TX and RX hardware offload on the same device
Dudu Lu <phx0fer@gmail.com>
net-sysfs: reject a one-entry RPS flow table
Junbin Zhang <sprooc69@gmail.com>
sched_ext: Reject rq-lock-taking kfuncs in tracing programs
Denis Kulikov <dar1knessx@gmail.com>
ksmbd: use the resolved share path for the share root
Waiman Long <longman@redhat.com>
cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent
Waiman Long <longman@redhat.com>
cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask()
Waiman Long <longman@redhat.com>
cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier()
Waiman Long <longman@redhat.com>
cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict()
Waiman Long <longman@redhat.com>
cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask()
Waiman Long <longman@redhat.com>
cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition
Pooyan Azad <pooyan.azadparvar@gmail.com>
zram: fix short reads from block_state
Ian Rogers <irogers@google.com>
perf lock contention: Filter events before creating lock_stat
Ajanesh Lal <ajaneshlal3@gmail.com>
ALSA: hda/realtek: Add mute and mic-mute LEDs for HP ENVY 16 (103c:8be5)
Namjae Jeon <linkinjeon@kernel.org>
ksmbd: fix durable reconnects for root shares
Namjae Jeon <linkinjeon@kernel.org>
ksmbd: cache the resolved share path for durable reconnects
Namjae Jeon <linkinjeon@kernel.org>
ksmbd: disconnect on invalid encryption transform flags
Chi Zhiling <chizhiling@kylinos.cn>
exfat: take bitmap_lock at the start of exfat_alloc_cluster()
Chi Zhiling <chizhiling@kylinos.cn>
exfat: fix used_clusters accounting during cluster allocation
Eric Dumazet <edumazet@kernel.org>
ip6mr: clear skb->cb[] in reg_vif_xmit()
James Hilliard <james.hilliard1@gmail.com>
xsk: freeze deferred pool teardown without blocking unregister
Serhat Kumral <serhatkumral1@gmail.com>
RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler
Waiman Long <longman@redhat.com>
cgroup/cpuset: Properly disabling partition when partition state switching fails
Waiman Long <longman@redhat.com>
cgroup/cpuset: Do housekeeping check before converting invalid partition to valid
Waiman Long <longman@redhat.com>
cgroup/cpuset: Consider all the exclusive CPUs when doing housekeeping check
Waiman Long <longman@redhat.com>
cgroup/cpuset: Consolidate isolated_cpus_can_update() into prstate_housekeeping_conflict()
Waiman Long <longman@redhat.com>
cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier()
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
netfilter: flowtable: reset transport header after nf_flow_encap_pop()
Woojin Ji <random6.xyz@gmail.com>
bpf: Zero-extend the index in inlined bpf_get_func_arg()
Sasha Levin <sashal@kernel.org>
locking/atomic: arc, hexagon, openrisc: Define arch_cmpxchg_local()
Josef Bacik <josef@toxicpanda.com>
bpf: Don't take a dynptr argument for a local dynptr
Josef Bacik <josef@toxicpanda.com>
bpf: Let bpf_dynptr_write() mark a global function
Josef Bacik <josef@toxicpanda.com>
bpf: Free what map_free() unlinks for sleepable readers
Josef Bacik <josef@toxicpanda.com>
bpf: Assume no bounds for a writable tp with tail calls
Josef Bacik <josef@toxicpanda.com>
bpf: Assume no bounds for buffers behind a tail call
Josef Bacik <josef@toxicpanda.com>
bpf: Count sleepable callbacks as sleepable map users
Josef Bacik <josef@toxicpanda.com>
bpf: Keep a program until its bpf_wq callback has ended
Josef Bacik <josef@toxicpanda.com>
bpf: Don't hand out a linked element as extra element
Ivan Vecera <ivecera@redhat.com>
dpll: zl3073x: make embedded sync follow the output carrier frequency
Ju Nan <junan76@163.com>
pinctrl: stm32: Fix the unit of the hwspinlock timeout
Pengpeng Hou <hppiscas@163.com>
irqchip/mst-intc: Validate the DT interrupt range
Kevin Dewald <kevin@simpleble.org>
Bluetooth: hci_event: Fix LE link drop on remote features command status
Ravindra <ravindra@intel.com>
Bluetooth: btintel_pcie: fix PM flow for S0ix, S3 and S4
Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Bluetooth: btintel_pcie: remove duplicate BTINTEL_PCIE_MAGIC_NUM definition
Selvin Xavier <selvin.xavier@broadcom.com>
RDMA/bnxt_re: Unpublish QP table before freeing it
Abhishek Mohapatra <abhishek.mohapatra@broadcom.com>
RDMA/bnxt_re: Use kvzalloc for QP table allocation
Vikas Gupta <vikas.gupta@broadcom.com>
bnge: skip dev_addr when building the VNIC unicast list
Jiale Yao <yaojiale02@163.com>
wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup
Aaradhana Sahu <aaradhana.sahu@oss.qualcomm.com>
wifi: ath12k: Fix NAPI resource leaks in AHB external IRQ paths
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: align real_num_tx_queues to mqprio configuration
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: set real_num_tx_queues to max(offset + count)
Adrián Larumbe <adrian.larumbe@collabora.com>
drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove
Kaifeng Wang <kaifengw@google.com>
net: devmem: check uid and netns in net_devmem_get_binding()
Linus Walleij <linusw@kernel.org>
dmaengine: ste_dma40: Preserve the LCPA I/O address space
Jacob Moroni <jmoroni@google.com>
RDMA/core: Clear driver_udata before destroying objects in rdma_core
Quanye Yang <quanyeyang@proton.me>
RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq
Maksim Krasutski <krasutskimaksim@gmail.com>
ALSA: hda/realtek: Fix mute LEDs on HP ENVY 17-cr1xxx
Dave Jiang <dave.jiang@intel.com>
cxl/port: Attach endpoints to a dport under the lock that pins it
Marek Szyprowski <m.szyprowski@samsung.com>
dma-direct: Restore arch_dma_alloc() for the DMA_ATTR_NO_KERNEL_MAPPING case
Johannes Berg <johannes.berg@intel.com>
wifi: nl80211: reject zero RNR/MBSSID elements
Vineeth Karumanchi <vineeth.karumanchi@amd.com>
net: macb: configure ENST registers for all queues
Takashi Iwai <tiwai@suse.de>
ALSA: aloop: Avoid a bad mixure of guard() and goto
Takashi Iwai <tiwai@suse.de>
ALSA: pcmtest: Fix leak at probe error
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path
Dmitry Morgun <d.morgun@ispras.ru>
fs/ntfs3: check return values in indx_delete_entry()
Melissa Wen <mwen@igalia.com>
drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class
Felix Fietkau <nbd@nbd.name>
wifi: mt76: mt7921: fix of_node reference leaks in regd update
Felix Fietkau <nbd@nbd.name>
wifi: mt76: mt7996: free the WTBL index if a link allocation fails
Linus Walleij <linusw@kernel.org>
dmaengine: ste_dma40: Recover coalesced cyclic callbacks
Linus Walleij <linusw@kernel.org>
dmaengine: ste_dma40: Fix cyclic transfer residue
Qing Ming <a0yami@mailbox.org>
dlm: validate node weights before building member array
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
drm/msm/a5xx: don't read the GPMU registers on GPUs without a GPMU
Nicolin Chen <nicolinc@nvidia.com>
iommu/arm-smmu-v3: Don't rb_erase() a never-inserted stream node
Niklas Cassel <cassel@kernel.org>
scsi: scsi_debug: Enforce physical block alignment of zoned writes
Yuan Chen <chenyuan@kylinos.cn>
bpf: Roll back freplace link state when bpf_arch_text_poke() fails
Lance Yang <lance.yang@linux.dev>
mm/memory_hotplug: fix missing rollback in __add_pages()
Nathan Chancellor <nathan@kernel.org>
serial: 8250_mid: Add missing module namespace import for SERIAL_8250
Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: Fix UAC2 mixer unit request handling
Ian Rogers <irogers@google.com>
perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events
Venkat Rao Bagalkote <venkat88@linux.ibm.com>
powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard
Abhishek Dubey <adubey@linux.ibm.com>
powerpc/bpf: Move out dummy_tramp_addr after Long branch stub
Selvin Xavier <selvin.xavier@broadcom.com>
RDMA/bnxt_re: Serialize dcb_wq access against async notifier
Yishai Hadas <yishaih@nvidia.com>
RDMA/mlx5: Set QP event handler before firmware QPC insertion
Yishai Hadas <yishaih@nvidia.com>
RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access
Danish Khateeb <danishkhateeb03@gmail.com>
tools/nolibc: fix readdir_r() with 64-bit directory offsets
Daniel Borkmann <daniel@iogearbox.net>
bpf: Rebase the exception callback subprog when dead subprogs are removed
Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
arm64: dts: qcom: lemans-evk: fix SerDes PHY regulator supplies
Sudeep Holla <sudeep.holla@kernel.org>
ACPI: PCC: Free channel on OpRegion deactivation
Pardeep Kaur <pardeep.kaur@oss.qualcomm.com>
wifi: ath12k: fix out-of-bounds access on TX stats arrays
Kang Yang <kang.yang@oss.qualcomm.com>
wifi: ath12k: fix skb leak on monitor PPDU ID wraparound
Kang Yang <kang.yang@oss.qualcomm.com>
wifi: ath12k: place dp_mon_mpdu on stack in mon dst reap loop
Kang Yang <kang.yang@oss.qualcomm.com>
wifi: ath12k: fix stale tail_msdu pointer returned from mpdu_pop
Kang Yang <kang.yang@oss.qualcomm.com>
wifi: ath12k: free pending MSDUs on duplicate mon link descriptor
Kang Yang <kang.yang@oss.qualcomm.com>
wifi: ath12k: fix skb leak on paddr mismatch in wifi7 mon RX pop
Abel Vesa <abel.vesa@oss.qualcomm.com>
arm64: dts: qcom: x1-asus-vivobook-s15: Mark the EC reset gpio as reserved
Ian Rogers <irogers@google.com>
perf machine: Add session back pointer to fix out of bounds read
Michael J. Ruhl <michael.j.ruhl@intel.com>
platform/x86/intel/pmt: complete pcidev to device update
Joanne Koong <joannelkoong@gmail.com>
fuse: zero the correct range on a short read reply
Hao Sun <sunhao.th@gmail.com>
bpf: Fix uninit read for helper mem args on partially spilled slots
Hao Sun <sunhao.th@gmail.com>
bpf: Fix uninit read for non-fetch atomics on partially spilled slots
Alexei Starovoitov <ast@kernel.org>
bpf: Don't converge a loop on an iterator that was created anew
Alexei Starovoitov <ast@kernel.org>
bpf: Fix overflow of jump offset in may_goto expansion
Alexei Starovoitov <ast@kernel.org>
bpf: Adjust pc-relative insn copied into its own patch
Alexei Starovoitov <ast@kernel.org>
bpf, x86: Fix timed may_goto with private stack
bui duc phuc <phucduc.bui@gmail.com>
ASoC: mediatek: mt8188: fix clk leak on error in audsys_clk_register
Puranjay Mohan <puranjay@kernel.org>
bpf: Look at frame 0 when telling async callback entries apart
Kumar Kartikeya Dwivedi <memxor@gmail.com>
bpf: Check fastcall stack contract once for all stack accesses
Lizhi Hou <lizhi.hou@amd.com>
accel/amdxdna: Preallocate hardware context schedulers
Charles Keepax <ckeepax@opensource.cirrus.com>
mfd: cs42l43: Move cancel_work_sync() into remove
Yuan Chen <chenyuan@kylinos.cn>
bpf: Keep target extended until its last freplace link detaches
Tate Whiteberg <whiteberg@arista.com>
serial: 8250_mid: wait for LSR tx empty before setting termios
Tate Whiteberg <whiteberg@arista.com>
serial: 8250: export and rename wait_for_xmitr()
Ahsan Atta <ahsan.atta@intel.com>
crypto: qat - hold cfg->lock when accessing config sections
Kim Wooseok <5mghybrid@khu.ac.kr>
wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors
Kim Wooseok <5mghybrid@khu.ac.kr>
wifi: rtl8xxxu: unwind incomplete receive startup
Adrian Hunter <adrian.hunter@intel.com>
i3c: mipi-i3c-hci: Process multiple IBIs per interrupt
Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
drm/connector: hdmi: Handle reset() state allocation failure
Ian Rogers <irogers@google.com>
perf dso: Separate libbfd and cmd addr2line caches to fix confusion
Vitaliy Sochnev <sochnev.v.74@gmail.com>
thermal/drivers/airoha: Request the EN7581 IRQ after zone registration
Guixin Liu <kanie@linux.alibaba.com>
cxl/region: Unregister the pmem region when the bridge is unbound
Guixin Liu <kanie@linux.alibaba.com>
cxl/cdat: Fix uninitialized stack use in bandwidth gathering
Lizhi Hou <lizhi.hou@amd.com>
accel/amdxdna: Fix race between unmap and free BO
Pengpeng Hou <pengpeng@iscas.ac.cn>
phy: samsung: usbdrd: propagate GS101 PIPE3 lock failures
Lizhi Hou <lizhi.hou@amd.com>
accel/amdxdna: Fix unsafe use of handle_mm_fault()
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI: glue: Rearrange acpi_bind_one() to avoid breakage
Thomas Huth <thuth@redhat.com>
crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data
Eric Dumazet <edumazet@google.com>
sit: charge ip_tunnel_prl_entry allocations to memcg
Kang Yang <kang.yang@oss.qualcomm.com>
wifi: ath12k: preserve PPDU state across monitor status buffers
Baochen Qiang <baochen.qiang@oss.qualcomm.com>
wifi: ath12k: fix truncated TX buffer DMA address in MSDU ext descriptor
Golla Nagendra <nagendra.golla@amd.com>
dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v alloc failure
Golla Nagendra <nagendra.golla@amd.com>
dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure
Matt Turner <mattst88@gmail.com>
perf thread: Fix live-session detection in thread__e_machine()
Dave Jiang <dave.jiang@intel.com>
ACPI: APEI: GHES: Validate memory error section length before payload access
Jingbo Xu <jefflexu@linux.alibaba.com>
fuse: don't bump attr_version for async direct read completion
Lizhi Hou <lizhi.hou@amd.com>
accel/amdxdna: Fix unexpected wait when flushing notifier_wq
Davidlohr Bueso <dave@stgolabs.net>
cxl/test: Map mock device nodes to an online node
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
drm/panthor: Revisit reqs_lock handling in flush/reset paths
Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
nvme-tcp: fix use-after-free in nvme_tcp_free_ctrl()
Guixin Liu <kanie@linux.alibaba.com>
nvme-tcp: Validate the queue state under the queue lock in the address attribute
Salvatore Dipietro <dipiets@amazon.it>
mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations
Josef Bacik <josef@toxicpanda.com>
mm/userfaultfd: wake all waiters on unregister
Cunhao Lu <1579567540@qq.com>
can: skb: make echo skb freeing safe in any IRQ context
Vidya Srinivas <vidya.srinivas@intel.com>
drm/i915/display: Disable pipe joiner on WCL
Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
inet: frags: prevent acceptance of partially authenticated reassembly
Kevin Wang <kevin.wang@amd.com>
drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7
Ming Lei <tom.leiming@gmail.com>
ublk: let STOP_DEV cancel the server's commands before its release
Jianping Li <jianping.li@oss.qualcomm.com>
misc: fastrpc: Allocate entire reserved memory for Audio PD in probe
Abhishek Dubey <adubey@linux.ibm.com>
powerpc/bpf: fix alignment of long branch trampoline address
Sean Young <sean@mess.org>
media: rc: Add missing locking for keymap
Sean Young <sean@mess.org>
media: rc: Replace open coded krealloc() for keymap
Chuck Lever <chuck.lever@oracle.com>
NFSD: Destroy a recalled delegation the client does not hold
Vernon Yang <yanglincheng@kylinos.cn>
mm: khugepaged: fix folio is used after pte_unmap_unlock()
Harald Freudenberger <freude@linux.ibm.com>
s390/zcrypt: Guard domain index uses against speculative bypass
Harald Freudenberger <freude@linux.ibm.com>
s390/zcrypt: Explicitly use a card variable in _zcrypt_send_cprb
Harald Freudenberger <freude@linux.ibm.com>
s390/zcrypt: Fix and improve zcrypt reply message verification checks
Harald Freudenberger <freude@linux.ibm.com>
s390/zcrypt: Make apfs a real unsigned int field
Jan Beulich <jbeulich@suse.com>
Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages()
Jude Gyimah <jude.gyimah87@gmail.com>
ALSA: aw2-alsa: select SND_PCM
Guixiong Wei <weiguixiong@bytedance.com>
KEYS: do not let an unmatched key decide the search result
Manuel Ebner <manuelebnerli@mailbox.org>
docs, kprobes: Fix bracket
Wenwen Fu <wenwfu@qti.qualcomm.com>
tracing: skip boot kprobe setup when no events were requested
Eric Dumazet <edumazet@kernel.org>
nsh: limit recursion in nsh_gso_segment()
Chuck Lever <chuck.lever@oracle.com>
selftests: tls: Skip the zero_len tests when TLS is unavailable
Iustin Stolniceanu <iustin.stolniceanu@analog.com>
net: phy: c45: select BASE-T1 type for the forced speed
Cosmin Ratiu <cratiu@nvidia.com>
net/mlx5e: IPsec, don't match upper proto selectors in crypto offload TX
Jiahao Xu <xujiahao@cmss.chinamobile.com>
net: usb: cdc_ncm: don't underflow the NDP room check
Wenbo Sun <sunwenbo@cmss.chinamobile.com>
amt: use ipv6_hdr() in amt_mldv1_leave_handler()
Wenbo Sun <sunwenbo@cmss.chinamobile.com>
af_unix: Inherit SO_INQ in unix_stream_connect()
Jori Koolstra <jkoolstra@xs4all.nl>
net: af_unix: useful handling of LSM denials on SCM_RIGHTS
Jori Koolstra <jkoolstra@xs4all.nl>
net: scm: move scm_detach_fds() from common path to scm_recv_unix()
Kuniyuki Iwashima <kuniyu@google.com>
tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
Eric Dumazet <edumazet@kernel.org>
net: virtio: fix UDP tunnel GSO header of VLAN tagged packets
Uri Dar <udar@nvidia.com>
net/mlx5: Lag, Return error when enabling MPESW without LAG support
Antonio Quartulli <antonio@mandelbit.com>
udp_tunnel: don't treat IPv4 sockets bound to an address as wildcard
Junyoung Jang <graypanda.inzag@gmail.com>
igmp: use the joined device when leaving a multicast group
Gustavo Sousa <gustavo.sousa@intel.com>
drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule
Matt Roper <matthew.d.roper@intel.com>
drm/xe/wa_oob: Consolidate some OOB rules
Matt Roper <matthew.d.roper@intel.com>
drm/xe/pvc: Drop pre-prod workarounds
Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Add a wrapper for SLPC set/unset params
Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Decouple GuC RC code from xe_guc_pc
Matt Roper <matthew.d.roper@intel.com>
drm/xe/guc_pc: Use scope-based cleanup
Matt Roper <matthew.d.roper@intel.com>
drm/xe/forcewake: Add scope-based cleanup for forcewake
Sk Anirban <sk.anirban@intel.com>
drm/xe/guc: Eliminate RPe caching for SLPC parameter handling
Shekhar Chauhan <shekhar.chauhan@intel.com>
drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05
Alexandre Cassen <acassen@corp.free.fr>
net/mlx5: HWS, fix flow meter release on FTE update
Ofri Zangi <ofriz@xsightlabs.com>
tls: fix async encryption race on weakly ordered architectures
Kalpesh Solanki <skalpesh942@gmail.com>
tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK
Avi Weiss <thnkslprpt@gmail.com>
net: ena: avoid RX copybreak for multi-descriptor packets
Breno Leitao <leitao@debian.org>
net: ena: Keep the RX buffer mapped if skb allocation fails
Omar Ramadan <omar@blockcast.net>
amt: tear down every amt device on an unregistering lower
Chris Mason <mason@kernel.org>
tcp: Drop any segments if DEFER_CONNECT is set.
LiangCheng Wang <zaq14760@gmail.com>
ASoC: max98090: keep the MIC boost across mic input power-up
Kavitha Daula <kavi@edera.dev>
xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync()
Pengpeng Hou <hppiscas@163.com>
drm/bridge: sii902x: validate I2S data lane values
Kyle Zeng <kylebot@openai.com>
udp: check frag_list IP family before using skb_segment_list()
Anandu Padinhare <Anandu.Padinhare@electrifex.com>
net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path
Eric Dumazet <edumazet@kernel.org>
net: gro: compare skb->protocol in gro_list_prepare()
Eric Dumazet <edumazet@kernel.org>
udp: do not use a cross-family sk_rx_dst in early demux
Eric Dumazet <edumazet@kernel.org>
tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF
Kuniyuki Iwashima <kuniyu@google.com>
tcp: Do not allow buggy transitions between ehash and lhash2.
Eric Dumazet <edumazet@kernel.org>
fou: gue: check IP version of held packets for direct IP encapsulation
Cosmin Ratiu <cratiu@nvidia.com>
net/mlx5e: Serialize TC and IPsec offload exclusion counters
Cosmin Ratiu <cratiu@nvidia.com>
net/mlx5e: Fix ipsec core device access during profile changes
Cosmin Ratiu <cratiu@nvidia.com>
net/mlx5e: Release IPsec root table reference on RX setup failure
Chris Mason <mason@kernel.org>
net: skbuff: uncharge trimmed zerocopy frags on error
Yuho Choi <oss.patchbox@gmail.com>
ptp: kvm: x86: Leak clock_pair page if changing its encryption fails
Chase Hiltz <me@chasehil.tz>
ipv4: route: don't blackhole in-use routes when retiring fnhe routes
Ivan Vecera <ivecera@redhat.com>
dpll: notify about a reference sync pair only if it was added
Changyul Lee <lcy8047@gmail.com>
net/mlx5: macsec: Don't remove fs_id when adding a rule fails
Alexander Duyck <alexanderduyck@fb.com>
net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Wait for the outbound flush to complete on mailbox teardown
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Suspend phylink after taking the datapath down in ndo_stop
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Disable PTP completions during the Tx force-flush
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Fix service task races with ndo_stop and PM suspend
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Add logic to track PMD state via MAC/PCS signals
Alexander Duyck <alexanderduyck@fb.com>
fbnic: Rename PCS IRQ to MAC IRQ as it is actually a MAC interrupt
Umang Pokhriyal <umangpokhriyall@gmail.com>
tun: delete the flow entries of the moved queue on detach
Olga Kornievskaia <okorniev@redhat.com>
NFSv4: wake blocking lock waiters when a delegated lock is released
Eric Dumazet <edumazet@kernel.org>
bonding: fix slave_cnt leak on XDP enslave failure
Denis V. Lunev <den@openvz.org>
ovl: release the upperdir/workdir in-use locks before the umount sync
Christian Brauner <brauner@kernel.org>
ovl: allow idmapping overlay mounts
Tianyi Gao <tianyi@cloudflare.com>
net: fix mac_len of skbs copied by generic XDP
Mehmet Fide <mehmet.fide@screeningeagle.com>
wifi: mac80211: abort chanswitch when leaving an IBSS
Johannes Berg <johannes.berg@intel.com>
wifi: mac80211: mesh: don't linearize SKBs unnecessarily
Kyle Zeng <kylebot@openai.com>
ipvlan: make outbound skb headers writable
Kyle Zeng <kylebot@openai.com>
net: require a full socket in sock_confirm_neigh()
Kyle Zeng <kylebot@openai.com>
net: protect negative destination advice with RCU
Mark Bloch <mbloch@nvidia.com>
net/mlx5: Lag, free steering resources on LAG destroy failure
Carolina Jubran <cjubran@nvidia.com>
net/mlx5: Use only loaded devices for PTP clock operations
Li RongQing <lirongqing@baidu.com>
team: fix promisc/allmulti leak in team_port_add error path
Nikola Z. Ivanov <zlatistiv@gmail.com>
team: Add matching error label for failed action
Yaroslav Dudkov <aroslavdudkov622@gmail.com>
ipv6: ignore link state in gateway check
Gal Pressman <gal@nvidia.com>
net/mlx5: Bridge, fix bogus MDB offload errors
Kuniyuki Iwashima <kuniyu@google.com>
af_unix: Remove gc_in_progress check in unix_peek_fpl().
Kuniyuki Iwashima <kuniyu@google.com>
af_unix: Convert unsigned long to u64 for GC.
Francesco Valla <francesco@valla.it>
spi: virtio: move teardown to .remove()
Jiayuan Chen <jiayuan.chen@linux.dev>
net: raw: fix ICMP unreachable sent when receive queue is full
Stefano Munari <stefanomunari.sm@gmail.com>
net: usb: lan78xx: resume phylink on non-reset USB resume
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
idpf: free stashed XSk Rx frame when releasing the queue
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
ice: xsk: free stashed Rx frame when cleaning the ring
Chenguang Zhao <zhaochenguang@kylinos.cn>
i40e: xsk: fix multi-buffer XDP_PASS skb construction
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
libeth: xsk: do not free in-flight frags on XDP_TX completion
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
ice: xsk: do not free in-flight frags on XDP_TX completion
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
ice: xsk: fix leaking Rx buffers in multi-buffer path
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
i40e: xsk: fix xsk_buff_add_frag() error handling in Rx
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
xsk: fix list corruption in xsk_buff_add_frag()
Kyle Zeng <kylebot@openai.com>
net: skbuff: preserve fclone lifetime when freeing stolen heads
Mark Korenberg <socketpair@gmail.com>
ublk: publish a new device by its id only once it is set up
Mike Snitzer <snitzer@kernel.org>
NFS/localio: hold the client across an asynchronous LOCALIO probe
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: Balance queue accounting when relocating a task
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: Balance switch queue length on transport removal
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: preserve transport security policy when cloning clients
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: preserve timeout policy when cloning clients
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: preserve fatal network errors during RPC binding
Avi Weiss <thnkslprpt@gmail.com>
SUNRPC: wake poll waiters when an empty pipe is unlinked
Avi Weiss <thnkslprpt@gmail.com>
NFS: restore directory index when resuming readdir
Avi Weiss <thnkslprpt@gmail.com>
NFS: Fix inverted cross-directory rename check
Avi Weiss <thnkslprpt@gmail.com>
NFS: update ctime for atime-only UTIME_NOW requests
Jeff Layton <jlayton@kernel.org>
nfs: fix utimensat() for atime with delegated timestamps
Avi Weiss <thnkslprpt@gmail.com>
NFS: honor UTIME_NOW atime with explicit mtime
Avi Weiss <thnkslprpt@gmail.com>
NFSv4.1: retain MDS I/O until both thresholds are met
Eric Dumazet <edumazet@kernel.org>
tcp: rate limit receive queue collapsing
Eric Dumazet <edumazet@google.com>
tcp: move tp->bytes_acked to tcp_sock_write_tx group
Eric Dumazet <edumazet@google.com>
tcp: move tp->first_tx_mstamp and tp->delivered_mstamp to tcp_sock_write_tx
Eric Dumazet <edumazet@google.com>
tcp: move tp->segs_in and tp->segs_out to tcp_sock_write_txrx group
Eric Dumazet <edumazet@google.com>
tcp: move tp->delivered and tp->delivered_ce to tcp_sock_write_tx group
Ilpo Järvinen <ij@kernel.org>
tcp: try to avoid safer when ACKs are thinned
Cheng Yongkang <teel4res@gmail.com>
btrfs: handle zero num_stripes in btrfs_chunk_item_size()
Filipe Manana <fdmanana@suse.com>
btrfs: zstd: prevent leak of workspace below maximum level
Johannes Thumshirn <johannes.thumshirn@wdc.com>
btrfs: zoned: fix lockdep splat on mount
Johannes Thumshirn <johannes.thumshirn@wdc.com>
btrfs: zoned: don't wait for ordered extents in do_zone_finish()
Johannes Thumshirn <johannes.thumshirn@wdc.com>
btrfs: zoned: requeue block group if zone reset bails out
Johannes Thumshirn <johannes.thumshirn@wdc.com>
btrfs: zoned: fix possible UAF in wait_eb_writebacks()
Johannes Thumshirn <johannes.thumshirn@wdc.com>
btrfs: zoned: only change active zone counter on successful (de)activation
Samuel Leyva <samuelslg03idk@gmail.com>
ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output
Vijendar Mukunda <Vijendar.Mukunda@amd.com>
ASoC: SOF: amd: guard adata->sdw dereferences with NULL check in IRQ handler
Vijendar Mukunda <Vijendar.Mukunda@amd.com>
ASoC: amd: ps: guard adata->sdw dereferences with NULL check in IRQ handler
Tyler Baker <tyler.baker@oss.qualcomm.com>
ASoC: qcom: x1e80100: recreate the headset jack on card rebind
Hongyang Zhao <hongyang.zhao@thundersoft.com>
ASoC: qcom: common: Add generic headset jack helpers
Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>
ASoC: qcom: common: add DAI-node TDM slot helpers
Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
ASoC: qcom: common: validate cpu dai id during parsing
Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids
Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
ASoC: qcom: sdw: remove redundant code
Tyler Baker <tyler.baker@oss.qualcomm.com>
ASoC: soc-core: copy the DAI link names into the card
Dmitry Torokhov <dmitry.torokhov@gmail.com>
gpiolib: of: return -ENOENT from of_gpio_count() stub
Dmitry Torokhov <dmitry.torokhov@gmail.com>
gpiolib: fix fast-path cancellation in gpiod_get_array()
Dmitry Torokhov <dmitry.torokhov@gmail.com>
gpiolib: fix GPIO descriptor leak in gpiod_get_array()
Badal Nilawar <badal.nilawar@intel.com>
drm/xe/xe_late_bind_fw: Fix firmware leak on missing manifest entry
Vinay Belgaumkar <vinay.belgaumkar@intel.com>
drm/xe: Toggle the D3Cold enable flag at runtime resume
Arvind Yadav <arvind.yadav@intel.com>
drm/xe: Rebind BOs evicted before the first LR queue
Raag Jadav <raag.jadav@intel.com>
drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM
Mallesh Koujalagi <mallesh.koujalagi@intel.com>
drm/xe/xe_survivability: Simplify runtime survivability error handling
Riana Tauro <riana.tauro@intel.com>
drm/xe/xe_survivability: Redesign survivability mode
Rodrigo Vivi <rodrigo.vivi@intel.com>
drm/xe: Fix build with DRM_XE=y and CONFIGFS_FS=m
Helen Koike <koike@igalia.com>
drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for pre-Xe2
Nitin Gote <nitin.r.gote@intel.com>
drm/xe/tuning: Restrict Anyhit NULL-query tuning to render engines
Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
drm/xe: Prevent VF memory IRQ from accessing a torn-down engine
Greg Thelen <gthelen@google.com>
kho: check fdt_phys in is_kho_boot()
Pasha Tatashin <pasha.tatashin@soleen.com>
liveupdate: kho: move to kernel/liveupdate
Yifan Zhang <yfzhang23@stu.pku.edu.cn>
tracing/probes: bound symstr stores to reserved length
Shao Mingyin <shao.mingyin@zte.com.cn>
ata: libata-scsi: set the field pointer when rejecting CDL
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: do not accept subpage code FFh in MODE SELECT
Niklas Cassel <cassel@kernel.org>
ata: libata-scsi: fix MODE SELECT handling of data after the mode page
Alexei Starovoitov <ast@kernel.org>
ipv6: Check the Home Address option again before its address is used
Eric Dumazet <edumazet@kernel.org>
calipso: do not charge request socket options to the listener
Or Har-Toov <ohartoov@nvidia.com>
net/mlx5e: Add missing Ethernet multicast octets to vport_rx_bytes sum
Anil Kaushik <anilkaushikwireless@gmail.com>
netlink: Do not call the unbind callback with the table locked
Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
net/mlx5e: IPoIB, Fix QPN lookup race
Kyle Pepper <cochcoder@proton.me>
Bluetooth: reject invalid LE supervision timeout relationships
Christian Loehle <christian.loehle@arm.com>
cpufreq: Serialize global boost updates
Christian Loehle <christian.loehle@arm.com>
cpufreq: Preserve global boost state on failed updates
Lifeng Zheng <zhenglifeng1@huawei.com>
cpufreq: Return -EOPNOTSUPP if no policy supports boost
Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails
Benjamin Segall <bsegall@google.com>
perf: Fix racy update of cpc->hrtimer_interval
Sandipan Das <sandipan.das@amd.com>
perf/x86/amd/uncore: Avoid context migration from non-owners
Peter Zijlstra <peterz@infradead.org>
locking/osq: Fix unlink queue corruption
Peter Zijlstra <peterz@infradead.org>
locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering
Thomas Fourier <fourier.thomas@gmail.com>
net/mlx5e: TC, Fix double free of branch in failure
Ridge Lomont <cyridge@proton.me>
x86/kcfi: Don't emit KCFI_REFERENCE() in modules
Eric Dumazet <edumazet@kernel.org>
tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND
Hui Su <sh_def@163.com>
sched/topology: Balance cluster static-key updates
Hui Su <sh_def@163.com>
sched/pelt: Fix u32 truncation of the PELT period count
Ravi Bangoria <ravi.bangoria@amd.com>
perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR
Kan Liang <kan.liang@linux.intel.com>
perf: Add sampling support for SIMD registers
Kan Liang <kan.liang@linux.intel.com>
perf: Move and enhance has_extended_regs() for arch-specific use
Dapeng Mi <dapeng1.mi@linux.intel.com>
perf: Eliminate duplicate arch-specific function definitions
Kan Liang <kan.liang@linux.intel.com>
perf: Add APIs to create/release mediated guest vPMUs
James Clark <james.clark@linaro.org>
perf: Add perf_event_attr::config4
Siddharth Chintamaneni <sidchintamaneni@gmail.com>
fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek()
Jeff Layton <jlayton@kernel.org>
statx: don't leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask
Hungyu Lin <dennylin0707@gmail.com>
vfs: preserve subsecond timestamps at filesystem time limits
Andrea Parri <parri.andrea@gmail.com>
iov_iter: take an unsigned long segment count in import_iovec()
Abbott Liu <liuwenliang@huawei.com>
initrd: flush deferred fput() before mounting root
Christian Brauner <brauner@kernel.org>
libfs: end offset readdir at positions past DIR_OFFSET_EOD
Christian Brauner <brauner@kernel.org>
libfs: walk offset directories in offset order
Al Viro <viro@zeniv.linux.org.uk>
introduce a flag for explicitly marking persistently pinned dentries
Florian Fainelli <f.fainelli@gmail.com>
MIPS: SB1250: Validate and update IRQ affinity
Florian Fainelli <f.fainelli@gmail.com>
MIPS: Cobalt: Include legacy IDE ports in the PCI I/O window
Florian Fainelli <f.fainelli@gmail.com>
MIPS: Alchemy: Save the Ethernet address before reusing PROM memory
Imre Kaloz <kaloz@kernel.org>
MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC
Rosen Penev <rosenp@gmail.com>
MIPS: Avoid dead code/data elimination when using recordmcount
Eric Dumazet <edumazet@kernel.org>
tcp: ipv6: free ireq->ipv6_opt after an RCU grace period
Long Zhao <longzhao@ambarella.com>
gpio: regmap: free the irqchip if adding the irq domain fails
Linus Walleij <linusw@kernel.org>
gpio: regmap: Support sparsed fixed direction
Florian Westphal <fw@strlen.de>
netfilter: nat: zero newrange before filling it in
Pablo Neira Ayuso <pablo@netfilter.org>
netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload
Joas Antonio dos Santos <joasantonio108@gmail.com>
netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport()
Fernando Fernandez Mancera <fmancera@suse.de>
netfilter: x_tables: check target name before accessing verdict
Laveesh Bansal <laveeshb@laveeshbansal.com>
netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag()
Xingyuan Mo <hdthky0@gmail.com>
netfilter: nft_set_rbtree: check catchall_sync return before queue_done
Qingfang Deng <qingfang.deng@linux.dev>
tcp: initialize send sequence numbers before deferring TFO
Cheng Yongkang <teel4res@gmail.com>
net: bridge: disable MRP ports before the FDB flush in del_nbp()
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: set XDP metadata length on the page_pool RX path
Timur Stukan <timur.stukan.linux@gmail.com>
bonding: fix missing down path on speed/duplex failure after FAIL->UP
Jakub Kicinski <kuba@kernel.org>
net: bonding: don't recurse on the slave's netdev ops lock
Jakub Kicinski <kuba@kernel.org>
net: ethtool: add netif_get_link_ksettings() for correct ops-locked use
Kyle Zeng <kylebot@openai.com>
ip6mr: Serialize multicast router socket ownership
Timur Stukan <timur.stukan.linux@gmail.com>
bonding: 3ad: don't set BOND_LINK_FAIL on a slave that is not up
Colton Pawielski <colton.pawielski@gmail.com>
net: 8139cp: keep Rx masked while NAPI is scheduled
Richard Fitzgerald <rf@opensource.cirrus.com>
ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down()
Michał Kopeć <michal.kopec@3mdeb.com>
ALSA: hda/core: Stop capability walk on empty capability header
Munique Feitoza <muniquefeitoz4@gmail.com>
drm/nouveau: Fix CE channel creation on pre-Kepler GPUs
Rosen Penev <rosenp@gmail.com>
drm/nouveau/fifo: map Kepler video engine contexts non-privileged
Frederic Konrad <fkonrad@amd.com>
spi: cadence-quadspi: Fix race between DMA completion and transfer start
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Bluetooth: Fix not updating of hdev->commands[] after reset
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: restore the NSP IMP port 2 Gbps mode
Florian Fainelli <florian.fainelli@broadcom.com>
net: ethernet: bgmac: preserve forced 2.5 Gbps link speed
Stanislavs Nilovs <valorcool@gmail.com>
Bluetooth: qca: Disable SoC debug logging for WCN3950
Zhao Li <enderaoelyther@gmail.com>
Bluetooth: L2CAP: Clear request identifiers on incoming LE connections
Zijun Hu <zijun.hu@oss.qualcomm.com>
Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path
Richard Fitzgerald <rf@opensource.cirrus.com>
ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add()
Sasha Levin <sashal@kernel.org>
ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()
Sasha Levin <sashal@kernel.org>
ACPI: scan: Print the offline failure message in acpi_bus_offline()
Richard Fitzgerald <rf@opensource.cirrus.com>
firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path
Mario Limonciello <mario.limonciello@amd.com>
drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence
Eric Dumazet <edumazet@kernel.org>
tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack()
Kuniyuki Iwashima <kuniyu@google.com>
ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow().
Kuniyuki Iwashima <kuniyu@google.com>
ipv6: Flush exception route while replacing nexthop.
Zhou Minqiang <zhouminqiang2@huawei.com>
PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove
Avi Weiss <thnkslprpt@gmail.com>
net: skbuff: reject zero MPLS TTL before decrementing
Christian Loehle <christian.loehle@arm.com>
cpufreq: Hold the policy write lock when changing boost state
Guillaume Nault <gnault@redhat.com>
tcp: Fix dup-ack detection on non-SACK bidirectional data transfer.
Hungyu Lin <dennylin0707@gmail.com>
isofs: handle Rock Ridge long-form dates before 1900
James Clark <jjc@jclark.com>
net: ethernet: ti: am65-cpts: adjust perout genf following ptp changes
Jude Gyimah <jude.gyimah87@gmail.com>
ASoC: rockchip_spdif: select REGMAP_MMIO
Sugar Zhang <sugar.zhang@rock-chips.com>
ASoC: rockchip: spdif: Fill IEC958 CS info per params
Sugar Zhang <sugar.zhang@rock-chips.com>
ASoC: rockchip: spdif: Add support for format S32_LE
Sugar Zhang <sugar.zhang@rock-chips.com>
ASoC: rockchip: spdif: Add support for set mclk rate
Jude Gyimah <jude.gyimah87@gmail.com>
ASoC: rockchip_sai: select REGMAP_MMIO
Jude Gyimah <jude.gyimah87@gmail.com>
ASoC: rockchip_pdm: select REGMAP_MMIO
Jude Gyimah <jude.gyimah87@gmail.com>
ASoC: rockchip_i2s_tdm: select REGMAP_MMIO
Jude Gyimah <jude.gyimah87@gmail.com>
ASoC: rockchip_i2s: select REGMAP_MMIO
Chris Mason <mason@kernel.org>
nvmet-rdma: disconnect a queue on device removal
Chris Mason <mason@kernel.org>
nvmet-rdma: queue the release work under the mutex
Chris Mason <mason@kernel.org>
nvmet-rdma: take a device off the list last
Josef Bacik <josef@toxicpanda.com>
nvmet-tcp: limit the connections accepted per work run
Chris Mason <mason@kernel.org>
nvmet-rdma: disconnect only established queues
Josef Bacik <josef@toxicpanda.com>
nvmet-auth: keep the old keys if the new ones fail
Hannes Reinecke <hare@kernel.org>
nvmet-auth: Do not print DH-HMAC-CHAP secrets
Chris Leech <cleech@redhat.com>
nvme-auth: Hash DH shared secret to create session key
Eric Biggers <ebiggers@kernel.org>
nvme-auth: common: use crypto library in nvme_auth_augmented_challenge()
Eric Biggers <ebiggers@kernel.org>
nvme-auth: common: add HMAC helper functions
Eric Biggers <ebiggers@kernel.org>
nvme-auth: common: add KUnit tests for TLS key derivation
Eric Biggers <ebiggers@kernel.org>
nvme-auth: use proper argument types
Eric Biggers <ebiggers@kernel.org>
nvme-auth: add NVME_AUTH_MAX_DIGEST_SIZE constant
Josef Bacik <josef@toxicpanda.com>
nvmet-tcp: ask for the TLS record type on every receive
Josef Bacik <josef@toxicpanda.com>
nvme-loop: delete the controller if a reset fails
Maurizio Lombardi <mlombard@redhat.com>
nvmet-loop: do not alloc admin tag set during reset
Alexander Goodkind <alex@goodkind.io>
net: ethernet: mediatek: preserve sibling PPE bindings
Florian Fainelli <florian.fainelli@broadcom.com>
net: dsa: b53: Enable IGMP and MLD control packet CPU copies
James Fantin-Hardesty <james.fantin-hardesty@seagate.com>
nvmet: fix arbitration burst field mask
Kyle Zeng <kylebot@openai.com>
tcp: wait for TIME_WAIT teardown before freeing per-netns ehash
Niklas Cassel <cassel@kernel.org>
null_blk: don't finish zones to set them read-only or offline
Niklas Cassel <cassel@kernel.org>
null_blk: fix opening closed zones at the active zone limit
Nguyen Dinh Phi <phind.uet@gmail.com>
vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT
Shao Mingyin <shao.mingyin@zte.com.cn>
zloop: reject mismatched conventional zone files on restore
Shao Mingyin <shao.mingyin@zte.com.cn>
zloop: fix the error code in the blk_mq_alloc_disk message
Avi Weiss <thnkslprpt@gmail.com>
block: report the correct discard alignment in sysfs
Zizhi Wo <wozizhi@huawei.com>
block: partitions: reject GPT entries with starting_lba > ending_lba
Shao Mingyin <shao.mingyin@zte.com.cn>
virtio-blk: Fix zone append sector reporting in batched completion
Jianan Huang <jnhuang95@gmail.com>
blk-mq: reset queue state on scheduler teardown
Yu Kuai <yukuai@fnnas.com>
blk-mq: add a new queue sysfs attribute async_depth
Yu Kuai <yukuai@fnnas.com>
block: convert nr_requests to unsigned int
John Ogness <john.ogness@linutronix.de>
printk: Avoid multiple unregistration in unregister_console_locked()
Josef Bacik <josef@toxicpanda.com>
ext2: only flush DIRSYNC directories on every change
Jia Jia <physicalmtea@gmail.com>
vhost-scsi: fix page reference leak in misaligned I/O fallback
Mingbing Zhai <zhaimingbing@cmss.chinamobile.com>
virtio_balloon: initialize wakeup_lock before virtqueues are set up
Linfeng Sun <linfeng.sun.dev@gmail.com>
vhost-vdpa: initialize state before publishing cdev
Linfeng Sun <linfeng.sun.dev@gmail.com>
vhost: reject backend enable without a kick file
Linfeng Sun <linfeng.sun.dev@gmail.com>
vhost-scsi: reject delayed virtqueue setup
sungbyeongchan <tjdqudcks0424@naver.com>
virtio_ring: use shadow flags when detaching split descriptors
Jason Wang <jasowang@redhat.com>
virtio_ring: factor out split indirect detaching logic
zhangdongchuan@eswincomputing.com <zhangdongchuan@eswincomputing.com>
virtio_ring: code cleanup in detach_buf_split
Linfeng Sun <linfeng.sun.dev@gmail.com>
vhost-scsi: validate event queue descriptor direction
Shuai Zhang <shuai.zhang@oss.qualcomm.com>
power: sequencing: qcom-wcn: increase WCN7850 power-up delay
Eric Dumazet <edumazet@kernel.org>
xfrm: iptfs: fix skb leak on error in __input_process_payload()
Jia Jia <physicalmtea@gmail.com>
vhost-scsi: do not count PI bytes in the data length
Eric Dumazet <edumazet@kernel.org>
soreuseport: annotate data-races around reuse->socks[] and num_socks
Yifan Zhang <yfzhang23@stu.pku.edu.cn>
ksmbd: require NUL-terminated EA names
Aaditya Kansal <aadityakansal390@gmail.com>
ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server
Bart Van Assche <bvanassche@acm.org>
mctp i3c: Fix locking in an error path
Danish Khateeb <danishkhateeb03@gmail.com>
selftests/mm: merge: keep the far mremap() targets in the carveout
Kevin Dewald <kevin@simpleble.org>
Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery
Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Bluetooth: validate retained LE Set CIG Parameters command length
Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Bluetooth: validate retained LE Create CIS command length
Cen Zhang <zzzccc427@gmail.com>
Bluetooth: hci_core: Initialize advertising RPA work only once
Kevin Dewald <kevin@simpleble.org>
Bluetooth: MGMT: Clear disabled connection parameters when loading none
Cen Zhang <zzzccc427@gmail.com>
Bluetooth: hci_sync: Copy the resolving-list IRK under RCU
Cen Zhang <zzzccc427@gmail.com>
Bluetooth: hci_core: Keep link-key filtering inside RCU
Ismail Tarim <ismailtarim7@gmail.com>
Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init()
Tobias Wilken <tooangel@tooangel.de>
Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping
Cen Zhang <zzzccc427@gmail.com>
Bluetooth: hci_sync: Protect resolving-list lookups
Cen Zhang <zzzccc427@gmail.com>
Bluetooth: hci_sync: Copy the LE accept list under hdev->lock
Chris Lu <chris.lu@mediatek.com>
Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD
Chris Lu <chris.lu@mediatek.com>
Bluetooth: btmtk: bound the ISO payload length by the controller's MTU
Chris Lu <chris.lu@mediatek.com>
Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding
Kevin Dewald <kevin@simpleble.org>
Bluetooth: hci_event: Clear explicit connect state on LE connection
Catherine L <catherine.l@intel.com>
Bluetooth: btintel: fix buffer over-read in fw payload
Akhil Arul <akhilarul324@gmail.com>
Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained
Binbin Deng <18983559317@163.com>
Bluetooth: hci_core: Initialize LTK before publication
Binbin Deng <18983559317@163.com>
Bluetooth: hci_core: Initialize link key before publication
Binbin Deng <18983559317@163.com>
Bluetooth: hci_core: Initialize IRK before publication
Jerome Brunet <jbrunet@baylibre.com>
ASoC: meson: axg-fifo: request the irq with the clock enabled
Baochen Qiang <baochen.qiang@oss.qualcomm.com>
wifi: ath12k: don't advertise EHT-MCS15 to firmware unless we support it
Muna Sinada <muna.sinada@oss.qualcomm.com>
wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc
Muna Sinada <muna.sinada@oss.qualcomm.com>
wifi: ath12k: add EHT rate handling to existing set rate functions
Muna Sinada <muna.sinada@oss.qualcomm.com>
wifi: ath12k: generalize GI and LTF fixed rate functions
Bryam Vargas <hexlabsecurity@proton.me>
net/iucv: take a private, writable frame before rewriting it in place
Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
gpio: mpc8xxx: Fix potential use-after-free of IRQ domain
Daniel Machon <daniel.machon@microchip.com>
net: sparx5/lan969x: release the in-flight slot of a stale TX skb
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
regulator: qcom_spmi: don't take a sleeping lock in the SAW IPI
Yuho Choi <oss.patchbox@gmail.com>
virtio_blk: Reset device on probe error paths after DRIVER_OK
Jia Jia <physicalmtea@gmail.com>
vduse: avoid infinite loop when no affinity CPU is online
Sergii Ushakov <sergiiushakov@google.com>
virtio-blk: clamp max_segments to virtqueue ring size
Yu Zhang <yuz08559@gmail.com>
vhost-vdpa: drop the parent's vq callback before the call fd is released
Linfeng Sun <linfeng.sun.dev@gmail.com>
vhost: reject invalid IOTLB update permissions
Xiang Mei <xmei5@asu.edu>
vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit()
Maoxia <2312891301@qq.com>
virtio_pci: add missing newline to the pmcsr error message
Linfeng Sun <linfeng.sun.dev@gmail.com>
vhost: fix dirty logging for in-order used ring entries
Jia Jia <physicalmtea@gmail.com>
vhost-scsi: do not relock event vq mutex on send_evt fallback
Jia Jia <physicalmtea@gmail.com>
vhost-scsi: preserve event ordering
Linfeng Sun <linfeng.sun.dev@gmail.com>
vdpa: invalidate DMA mappings before releasing memory
Linfeng Sun <linfeng.sun.dev@gmail.com>
vdpa_sim: serialize IOTLB updates with dataplane access
Karl Mehltretter <kmehltretter@gmail.com>
virtio-spi: Fix virtio_spi_config kernel-doc
Alex Austin <alex.austin@amd.com>
sfc: ptp: avoid racing PPS timestamp updates
Alex Austin <alex.austin@amd.com>
sfc: ptp: serialize host and MC synchronization transactions
Alex Austin <alex.austin@amd.com>
sfc: ptp: drop the stale frequency reset in efx_ptp_start()
Vladimir Zapolskiy <vz@kernel.org>
drm/panel: visionox-r66451: Wait longer after the panel reset
Vladimir Zapolskiy <vz@kernel.org>
drm/panel: visionox-r66451: Send the brightness value MSB first
Daniel Machon <daniel.machon@microchip.com>
net: lan966x: don't free XDP buffers in fdma tx clear with budget 0
Giuseppe Piscitelli <ooonea@gmail.com>
ata: libata-core: Check device support before querying power state
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: fix XDP RX buffer DMA sync length
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: fix VLAN tag stripping on short and non-linear RX frames
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: copy XDP metadata in AF_XDP zero-copy RX
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: drop multi-buffer frames in XDP mode
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
net: stmmac: drop split frames on AF_XDP zero-copy RX
James Hilliard <james.hilliard1@gmail.com>
net: stmmac: take ownership of saved RX state at poll entry
Niklas Cassel <cassel@kernel.org>
ata: libata-eh: Retry non-NCQ commands when their sense data asks for it
Igor Pylypiv <ipylypiv@google.com>
ata: libata-sata: allow re-enabling NCQ with the same queue_depth
Eric Dumazet <edumazet@kernel.org>
tcp: do not let tcp_collapse() drive sk_forward_alloc negative
Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
ipv6: fix fib6 walker UAF on NLM_F_REPLACE
Vlad Poenaru <vlad.wing@gmail.com>
bnxt_en: Don't keep MSI-X vectors added before FW reserves them
Joas Antonio dos Santos <joasantonio108@gmail.com>
net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period
Yuqiang Sun <izaiahsun@gmail.com>
bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom
Rosen Penev <rosenp@gmail.com>
spi: acpi: only look up the IRQ of confirmed SPI devices
Alban Bedel <alban.bedel@lht.dlh.de>
spi: Fix ACPI SPI resources using relative path
Chris Mason <mason@kernel.org>
bpf: Check the offset in bpf_skb_generic_{push,pop}()
Chris Mason <mason@kernel.org>
bpf: Move the transport header with the moved headers
Alexei Starovoitov <ast@kernel.org>
bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol
Alexei Starovoitov <ast@kernel.org>
bpf: Reset skb->cb after an lwt prog pushes an IP header
Alexei Starovoitov <ast@kernel.org>
bpf: Don't leave a stale MAC header in bpf_lwt_push_ip_encap()
Chris Mason <mason@kernel.org>
bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh()
Alexei Starovoitov <ast@kernel.org>
bpf: Don't look for the SRH again in the End.BPF helpers
Chris Mason <mason@kernel.org>
bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh()
Chris Mason <mason@kernel.org>
bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6
Alexei Starovoitov <ast@kernel.org>
bpf: Don't let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS
Chris Mason <mason@kernel.org>
bpf, cgroup: Keep the skb network offset signed
Chris Mason <mason@kernel.org>
bpf: Require prog fd or capability for cgroup detach
Alexei Starovoitov <ast@kernel.org>
bpf: Remove the WARN from arena_get_unmapped_area()
Alexei Starovoitov <ast@kernel.org>
bpf: Refuse an arena mmap() longer than max_entries pages
Alexei Starovoitov <ast@kernel.org>
bpf: Refuse to map an arena at address 0
Alexei Starovoitov <ast@kernel.org>
bpf: Clamp the trace length before the skip test in stackid_init()
Jiri Olsa <jolsa@kernel.org>
bpf: Avoid changing callchain in bpf_get_stackid_pe
Josef Bacik <josef@toxicpanda.com>
bpf: Clamp the trace length in __bpf_get_stack() again
Jiri Olsa <jolsa@kernel.org>
bpf: Avoid changing callchain in bpf_get_stack_pe
Hongjian Dai <daihongjian@kylinsec.com.cn>
spi: pic32-sqi: fail transfer when the BD ring is exhausted
Fernando Fernandez Mancera <fmancera@suse.de>
netfilter: nft_reject: prevent unbounded recursion in output hooks
Sasha Levin <sashal@kernel.org>
ALSA: memalloc: Free the new pages when WC DMA mapping fails
Thomas Fourier <fourier.thomas@gmail.com>
net: ipa: Fix double free of the interrupt structure on config error
Tung Nguyen <tung.quang.nguyen@est.tech>
tipc: reject attaching bearer of different media to the same occupied device
Jia Jia <physicalmtea@gmail.com>
scsi: target: Validate REGISTER AND MOVE TransportID length
Fernando Fernandez Mancera <fmancera@suse.de>
net/smc: fix limit_smc_hs sysctl on big-endian architecture
James Hilliard <james.hilliard1@gmail.com>
ptp: vclock: preserve missing hardware timestamps
James Hilliard <james.hilliard1@gmail.com>
ptp: vclock: serialize extended samples with counter updates
James Hilliard <james.hilliard1@gmail.com>
ptp: vclock: propagate physical clock sampling errors
James Hilliard <james.hilliard1@gmail.com>
ptp: unwind partially completed virtual clock creation
James Hilliard <james.hilliard1@gmail.com>
ptp: drain virtual clock sysfs operations before unregistering children
Zhi-Jun You <hujy652@gmail.com>
net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
Zhi-Jun You <hujy652@gmail.com>
net: ethernet: mtk_wed: free up rings during detach
Zhi-Jun You <hujy652@gmail.com>
net: ethernet: mtk_wed: fix reset condition for rx wdma
Zhi-Jun You <hujy652@gmail.com>
net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3
Puranjay Mohan <puranjay@kernel.org>
bpf: Drop percpu_counter from the htab element count
Thomas Fourier <fourier.thomas@gmail.com>
btrfs: zoned: fix double free of bitmaps on clone failure
Filipe Manana <fdmanana@suse.com>
btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing
Filipe Manana <fdmanana@suse.com>
btrfs: fix fiemap merging compressed extents
guolingxing <guolingxing@tju.edu.cn>
btrfs: verity: propagate orphan insertion errors when enabling verity
Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
bpf: Fix jited line info off by the CFI preamble
Avi Weiss <thnkslprpt@gmail.com>
gpio: omap: Propagate runtime PM failures in probe and request
Michal Wilczynski <m.wilczynski@samsung.com>
drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Andrea Mayer <andrea.mayer@uniroma2.it>
seg6: fix transport header for inner IPv4 with IP options
P Praneesh <praneesh.p@oss.qualcomm.com>
wifi: ath12k: fix IRQ disable imbalance in AHB ext interrupt handler
Filippo Falezza <effeffe99@gmail.com>
wifi: ath10k: Stop unanswered temperature reads
Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
9p: do not store the create fid on special files
Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
9p: fall back to the normal open path for non-regular files
Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
9p: fix kernel-doc warning for enum p9_session_flags
Remi Pommarel <repk@triplefau.lt>
9p: Add mount option for negative dentry cache retention
Remi Pommarel <repk@triplefau.lt>
9p: Cache negative dentries for lookup performance
Barret Rhoden <brho@google.com>
9p: treat read return values of 0 as EOF
Remi Pommarel <repk@triplefau.lt>
9p: Enable symlink caching in page cache
Matthew Whitehead <tedheadster@gmail.com>
scsi: aha1542: Remove unneeded scsi_dma_unmap() call
Giuseppe Piscitelli <ooonea@gmail.com>
scsi: scsi_debug: Drain target cleanup before module exit
Imre Kaloz <kaloz@kernel.org>
scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts
Mehmet Fide <mehmet.fide@screeningeagle.com>
wifi: ath9k_htc: start ANI when an AP interface begins to beacon
Avi Weiss <thnkslprpt@gmail.com>
fsnotify: preserve 64-bit pre-content ranges
Cosmin Ratiu <cratiu@nvidia.com>
wifi: wext: Limit notifier event flushes to the device's netns
Deepanshu Kartikey <kartikey406@gmail.com>
batman-adv: avoid WARN_ON for orig_ifinfo allocation failure
Shubham Antil <shubham@octane.security>
xfrm: zero-initialise km_event in the replay-notify path
Haobin Wu <853555@gmail.com>
9p: skip intermediate directory entry name copy in p9dirent_read()
Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx
Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
net/9p/usbg: fix descriptor cleanup use-after-free
Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
9p: use fc->net_ns for network namespace in RDMA and socket transports
David Laight <david.laight.linux@gmail.com>
net/9p: Replace strlen() strcpy() pair with strscpy()
Eric Sandeen <sandeen@redhat.com>
9p: convert to the new mount API
Eric Sandeen <sandeen@redhat.com>
9p: create a v9fs_context structure to hold parsed options
Eric Sandeen <sandeen@redhat.com>
net/9p: move structures and macros to header files
Eric Sandeen <sandeen@redhat.com>
fs/fs_parse: add back fsparam_u32hex
Bitterblue Smith <rtl8821cerfe2@gmail.com>
wifi: rtw89: usb: Avoid crash with dynamically added device ID
Feng Ning <feng@innora.ai>
staging: media: atomisp: use array3_size() for overflow-safe allocation
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: destroy force-feedback device on input unregistration
Bernard Pidoux <bernard.f6bvp@gmail.com>
bpqether: keep a bpq device in step with its Ethernet device
Bernard Pidoux <bernard.f6bvp@gmail.com>
bpqether: set both addresses or none in SIOCSBPQETHADDR
Bernard Pidoux <bernard.f6bvp@gmail.com>
bpqether: reserve the Ethernet device's own header room on transmit
Bryan Cochrane <bcochrane@google.com>
bnxt_en: Take RTNL before netif_close() when aborting FW reset
Mikhail Malyshev <mike.malyshev@gmail.com>
io_uring/io-wq: apply the current cpuset to new workers
Siddharth Chintamaneni <sidchintamaneni@gmail.com>
io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select()
Cheng Yongkang <teel4res@gmail.com>
io_uring/rsrc: keep the old file when a file update fails
Cheng Yongkang <teel4res@gmail.com>
io_uring/timeout: don't rearm a multishot timeout on cancel
Yang Xiuwei <yangxiuwei@kylinos.cn>
io_uring/rw: fail soft links on IOPOLL short or error IO
Yang Xiuwei <yangxiuwei@kylinos.cn>
io_uring/futex: fail soft links when cancelling a wait
Yang Xiuwei <yangxiuwei@kylinos.cn>
io_uring: fail soft links on negative IOU_COMPLETE results
Cinq Prairie <notprairie@gmail.com>
io_uring/napi: don't end the single NAPI busy poll early on need_resched()
Hui Peng <benquike@gmail.com>
udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat()
Jan Kara <jack@suse.cz>
udf: validate VAT inode size for old VAT format
Lance Yang <lance.yang@linux.dev>
mm/ksm: fix userfaultfd protection during merge and unmerge
Bernard Pidoux <bernard.f6bvp@gmail.com>
netrom: give the sysctl timer limits in milliseconds
Bernard Pidoux <bernard.f6bvp@gmail.com>
netrom: keep T1 running after answering a NAK
Bernard Pidoux <bernard.f6bvp@gmail.com>
ax25: end a REJ recovery count once frames are acknowledged
Bernard Pidoux <bernard.f6bvp@gmail.com>
rose: reset a call when a DATA packet arrives out of sequence
Bernard Pidoux <bernard.f6bvp@gmail.com>
ax25: drop a message being reassembled when a new one starts
Bernard Pidoux <bernard.f6bvp@gmail.com>
netrom: send the unacknowledged frames again when T1 or T4 expires
Sasha Levin <sashal@kernel.org>
Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts"
Melbin K Mathew <mlbnkm1@gmail.com>
fbdev: serialize mode sysfs access with lock_fb_info()
Melbin K Mathew <mlbnkm1@gmail.com>
fbdev: clear fb_info->mode before deleting a videomode
Melbin K Mathew <mlbnkm1@gmail.com>
fbdev: bound mode sysfs output to the sysfs buffer
Long Li <leo.lilong@huawei.com>
xfs: only assert new size for datafork during truncate extents
Gabriele Monaco <gmonaco@redhat.com>
sched/deadline: Fix server stopping with runnable tasks
Peter Zijlstra <peterz@infradead.org>
sched: Provide idle_rq() helper
Peter Zijlstra <peterz@infradead.org>
sched/deadline: Fix dl_server stop condition
Peter Zijlstra <peterz@infradead.org>
sched/deadline: Fix dl_server time accounting
Antheas Kapenekakis <lkml@antheas.dev>
ALSA: hda/tas2781: Prevent throwing away custom calibration addresses
Vladimir Petrzhikovskii <vladimir@dfb.sh>
virtio_net: check RX buffer length before DMA sync
Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI: platform: Use acpi_bus_get_primary_device()
Zizhi Wo <wozizhi@huawei.com>
fs: aio: reject partial mremap to avoid Null-pointer-dereference error
Krittikun Wongnin <krittikunwongnin@gmail.com>
ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[]
Hakan Abay <hakan.abay84@gmail.com>
ACPI: PM: Add unused power resource quirk for Casper Excalibur G900
Matthias Dittrich <dittrich.m@gmx.net>
ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250)
Xiaoyao Li <xiaoyao.li@intel.com>
KVM: TDX: Enable Bus Lock VM exit
Baokun Li <libaokun@linux.alibaba.com>
writeback: use a per-sb counter to drain inode wb switches at umount
Ilya Dryomov <idryomov@gmail.com>
libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing
Ilya Dryomov <idryomov@gmail.com>
libceph: add support for CEPH_CRYPTO_AES256KRB5
Ilya Dryomov <idryomov@gmail.com>
libceph: introduce ceph_crypto_key_prepare()
Ilya Dryomov <idryomov@gmail.com>
libceph: generalize ceph_x_encrypt_offset() and ceph_x_encrypt_buflen()
Sergey Lebedev <lsa.uz@pm.me>
soundwire: dmi-quirks: drop the ghost RT1320 on the Surface Pro 11 (Intel)
Charles Keepax <ckeepax@opensource.cirrus.com>
soundwire: dmi-quirks: Disable ghost Realtek on Lenovo Pro 9
Sataporn Saijai <excursively@gmail.com>
soundwire: dmi-quirks: add Lenovo Yoga Slim 7i 14IPH11
Eric Dumazet <edumazet@kernel.org>
net: virtio: validate outer protocol of UDP tunnel GSO packets
Eric Dumazet <edumazet@kernel.org>
tun: clear stale skb->protocol of NAPI frags skbs
Eric Dumazet <edumazet@kernel.org>
net: always dissect GSO packets in __virtio_net_hdr_to_skb()
Johannes Weiner <hannes@cmpxchg.org>
mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES
Pengpeng Hou <hppiscas@163.com>
irqchip/sifive-plic: Avoid signed shift in interrupt enable mask
KP Singh <kpsingh@kernel.org>
bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature
Pablo Neira Ayuso <pablo@netfilter.org>
netfilter: nft_ct: move custom expectation support to helper
Florian Westphal <fw@strlen.de>
netfilter: nft_ct: expectation timeouts are passed in milliseconds
-------------
Diffstat:
Documentation/arch/arm64/gcs.rst | 13 +-
Documentation/arch/arm64/silicon-errata.rst | 4 +
Documentation/block/ublk.rst | 7 +
Documentation/core-api/kho/concepts.rst | 2 +-
.../bindings/iio/adc/aspeed,ast2600-adc.yaml | 17 +
.../bindings/sound/qcom,q6dsp-lpass-ports.yaml | 5 +-
Documentation/filesystems/9p.rst | 7 +-
Documentation/gpu/xe/xe_firmware.rst | 3 +
.../networking/net_cachelines/tcp_sock.rst | 12 +-
Documentation/networking/tls-offload.rst | 16 +-
Documentation/trace/kprobes.rst | 2 +-
MAINTAINERS | 2 +-
Makefile | 4 +-
arch/alpha/include/uapi/asm/socket.h | 2 +
arch/arc/include/asm/cmpxchg.h | 4 +
arch/arm/kernel/perf_regs.c | 6 -
arch/arm64/Kconfig | 32 ++
arch/arm64/boot/dts/qcom/lemans-evk.dts | 3 +-
.../boot/dts/qcom/x1e80100-asus-vivobook-s15.dts | 1 +
arch/arm64/include/asm/suspend.h | 2 +-
arch/arm64/kernel/cpu_errata.c | 20 +
arch/arm64/kernel/cpufeature.c | 3 +-
arch/arm64/kernel/kexec_image.c | 7 +
arch/arm64/kernel/perf_regs.c | 6 -
arch/arm64/kernel/ptrace.c | 8 +-
arch/arm64/kernel/signal.c | 22 +-
arch/arm64/kernel/topology.c | 3 +-
arch/arm64/mm/proc.S | 20 +
arch/arm64/tools/cpucaps | 1 +
arch/csky/kernel/perf_regs.c | 6 -
arch/hexagon/include/asm/cmpxchg.h | 6 +
arch/loongarch/kernel/machine_kexec.c | 2 +
arch/loongarch/kernel/machine_kexec_file.c | 4 +
arch/loongarch/kernel/perf_regs.c | 6 -
arch/loongarch/kvm/intc/pch_pic.c | 17 +-
arch/loongarch/power/hibernate.c | 6 +
arch/mips/Kconfig | 2 +-
arch/mips/alchemy/common/prom.c | 23 +-
arch/mips/cobalt/pci.c | 11 +-
arch/mips/cobalt/setup.c | 4 +-
arch/mips/configs/ip30_defconfig | 9 +-
arch/mips/include/asm/mach-cobalt/cobalt.h | 1 +
arch/mips/include/uapi/asm/socket.h | 2 +
arch/mips/kernel/perf_regs.c | 6 -
arch/mips/sibyte/sb1250/irq.c | 3 +
arch/openrisc/include/asm/cmpxchg.h | 2 +
arch/parisc/include/uapi/asm/socket.h | 2 +
arch/parisc/kernel/perf_regs.c | 6 -
arch/powerpc/include/asm/interrupt.h | 5 +-
arch/powerpc/kernel/watchdog.c | 3 +
arch/powerpc/net/bpf_jit.h | 7 +-
arch/powerpc/net/bpf_jit_comp.c | 62 ++-
arch/powerpc/net/bpf_jit_comp32.c | 7 +-
arch/powerpc/net/bpf_jit_comp64.c | 7 +-
arch/riscv/kernel/perf_regs.c | 6 -
arch/sparc/include/uapi/asm/socket.h | 2 +
arch/um/drivers/vector_transports.c | 1 +
arch/x86/events/amd/ibs.c | 50 ++
arch/x86/events/amd/uncore.c | 2 +-
arch/x86/kernel/cpu/amd.c | 3 +-
arch/x86/kernel/ldt.c | 12 +-
arch/x86/kernel/perf_regs.c | 6 -
arch/x86/kvm/Kconfig | 1 +
arch/x86/kvm/vmx/tdx.c | 24 +-
arch/x86/net/bpf_jit_comp.c | 12 +
arch/x86/net/bpf_timed_may_goto.S | 10 +-
arch/x86/video/video-common.c | 2 +-
block/blk-cgroup.c | 13 +-
block/blk-core.c | 1 +
block/blk-iocost.c | 5 +-
block/blk-iolatency.c | 3 +-
block/blk-mq-dma.c | 2 +
block/blk-mq-sched.c | 6 +-
block/blk-mq.c | 9 +
block/blk-sysfs.c | 42 ++
block/blk-throttle.c | 3 +-
block/elevator.c | 1 +
block/genhd.c | 2 +-
block/partitions/efi.c | 1 +
crypto/essiv.c | 2 +-
drivers/accel/amdxdna/aie2_ctx.c | 117 ++--
drivers/accel/amdxdna/aie2_pci.c | 9 +-
drivers/accel/amdxdna/aie2_pci.h | 6 +-
drivers/accel/amdxdna/amdxdna_gem.c | 225 +++++---
drivers/accel/amdxdna/amdxdna_gem.h | 2 +-
drivers/accel/ivpu/ivpu_pm.c | 9 +-
drivers/acpi/acpi_pcc.c | 13 +
drivers/acpi/acpi_platform.c | 16 +-
drivers/acpi/apei/ghes.c | 41 ++
drivers/acpi/glue.c | 58 +-
drivers/acpi/power.c | 38 ++
drivers/acpi/scan.c | 108 +++-
drivers/ata/libata-core.c | 8 +-
drivers/ata/libata-eh.c | 16 +-
drivers/ata/libata-sata.c | 2 +-
drivers/ata/libata-scsi.c | 178 ++++---
drivers/base/power/runtime.c | 8 +-
drivers/base/swnode.c | 7 +-
drivers/block/null_blk/zoned.c | 48 +-
drivers/block/ublk_drv.c | 105 +++-
drivers/block/virtio_blk.c | 69 ++-
drivers/block/zloop.c | 5 +-
drivers/block/zram/zram_drv.c | 115 ++--
drivers/bluetooth/btintel.c | 24 +-
drivers/bluetooth/btintel_pcie.c | 47 +-
drivers/bluetooth/btintel_pcie.h | 2 -
drivers/bluetooth/btmtk.c | 49 +-
drivers/bluetooth/btqca.c | 1 +
drivers/bluetooth/hci_qca.c | 5 +
drivers/char/tpm/eventlog/acpi.c | 4 +-
drivers/char/tpm/eventlog/tpm1.c | 7 +
drivers/char/tpm/tpm-dev-common.c | 12 +-
drivers/char/tpm/tpm2-sessions.c | 4 +-
drivers/comedi/drivers/addi_apci_1500.c | 2 +-
drivers/comedi/drivers/ni_660x.c | 3 +-
drivers/comedi/drivers/ni_tio.c | 2 +-
drivers/comedi/drivers/vmk80xx.c | 25 +-
drivers/cpufreq/acpi-cpufreq.c | 9 +-
drivers/cpufreq/cpufreq.c | 110 +++-
drivers/cpufreq/intel_pstate.c | 18 +-
drivers/crypto/caam/caampkc.c | 75 ++-
drivers/crypto/inside-secure/safexcel_hash.c | 3 +
drivers/crypto/intel/qat/qat_common/adf_cfg.c | 49 +-
drivers/cxl/core/cdat.c | 8 +-
drivers/cxl/core/port.c | 121 +++--
drivers/cxl/core/region.c | 6 +-
drivers/dma/ste_dma40.c | 179 ++++++-
drivers/dma/ste_dma40_ll.c | 8 +-
drivers/dma/ste_dma40_ll.h | 2 +-
drivers/dma/xilinx/zynqmp_dma.c | 19 +-
drivers/dpll/dpll_core.c | 3 +-
drivers/dpll/zl3073x/dpll.c | 56 +-
drivers/dpll/zl3073x/out.h | 40 ++
drivers/firmware/cirrus/cs_dsp.c | 6 +
drivers/gpio/gpio-aspeed.c | 19 +-
drivers/gpio/gpio-brcmstb.c | 1 +
drivers/gpio/gpio-mpc8xxx.c | 22 +-
drivers/gpio/gpio-mpsse.c | 4 +
drivers/gpio/gpio-omap.c | 13 +-
drivers/gpio/gpio-regmap.c | 42 +-
drivers/gpio/gpio-rockchip.c | 15 +-
drivers/gpio/gpio-sodaville.c | 9 +-
drivers/gpio/gpio-virtuser.c | 85 ++-
drivers/gpio/gpiolib-of.h | 2 +-
drivers/gpio/gpiolib.c | 35 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +-
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 56 +-
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 20 +-
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 193 +++++--
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 193 +++++--
drivers/gpu/drm/bridge/sii902x.c | 8 +-
drivers/gpu/drm/drm_connector.c | 5 +-
drivers/gpu/drm/i915/display/intel_dp.c | 4 +-
drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 49 +-
drivers/gpu/drm/nouveau/nouveau_drm.c | 7 +-
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | 13 +
.../gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c | 20 -
drivers/gpu/drm/panel/panel-visionox-r66451.c | 4 +-
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +
drivers/gpu/drm/panthor/panthor_gpu.c | 61 +--
drivers/gpu/drm/xe/Makefile | 1 +
drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 3 +
drivers/gpu/drm/xe/xe_configfs.h | 2 +-
drivers/gpu/drm/xe/xe_force_wake.c | 7 +
drivers/gpu/drm/xe/xe_force_wake.h | 40 ++
drivers/gpu/drm/xe/xe_gt.c | 3 +-
drivers/gpu/drm/xe/xe_guc.c | 8 +-
drivers/gpu/drm/xe/xe_guc_pc.c | 227 +++-----
drivers/gpu/drm/xe/xe_guc_pc.h | 6 +-
drivers/gpu/drm/xe/xe_guc_pc_types.h | 2 -
drivers/gpu/drm/xe/xe_guc_rc.c | 131 +++++
drivers/gpu/drm/xe/xe_guc_rc.h | 16 +
drivers/gpu/drm/xe/xe_hw_engine.c | 17 +-
drivers/gpu/drm/xe/xe_hw_error.c | 7 +-
drivers/gpu/drm/xe/xe_irq.c | 3 +
drivers/gpu/drm/xe/xe_late_bind_fw.c | 15 +-
drivers/gpu/drm/xe/xe_lrc.c | 8 +-
drivers/gpu/drm/xe/xe_memirq.c | 3 +
drivers/gpu/drm/xe/xe_oa.c | 22 +-
drivers/gpu/drm/xe/xe_oa_types.h | 3 -
drivers/gpu/drm/xe/xe_pci.c | 5 +
drivers/gpu/drm/xe/xe_survivability_mode.c | 247 +++++----
drivers/gpu/drm/xe/xe_survivability_mode.h | 2 +-
drivers/gpu/drm/xe/xe_survivability_mode_types.h | 22 +-
drivers/gpu/drm/xe/xe_tuning.c | 2 +-
drivers/gpu/drm/xe/xe_uc.c | 10 +-
drivers/gpu/drm/xe/xe_uc.h | 1 -
drivers/gpu/drm/xe/xe_vm.c | 9 +-
drivers/gpu/drm/xe/xe_wa.c | 16 +-
drivers/gpu/drm/xe/xe_wa_oob.rules | 33 +-
drivers/hwmon/aht10.c | 2 +-
drivers/hwmon/gpio-fan.c | 24 +-
drivers/hwmon/max31760.c | 12 +-
drivers/hwmon/pmbus/mp2975.c | 207 ++++----
drivers/hwmon/scmi-hwmon.c | 12 +-
drivers/hwmon/sy7636a-hwmon.c | 2 +-
drivers/i3c/master/mipi-i3c-hci/dma.c | 40 +-
drivers/iio/accel/Kconfig | 2 +
drivers/iio/accel/adxl380.c | 11 +-
drivers/iio/accel/kxsd9.c | 2 +-
drivers/iio/adc/ad7780.c | 4 +-
drivers/iio/adc/ad7791.c | 4 +-
drivers/iio/adc/ad7793.c | 4 +-
drivers/iio/adc/max11205.c | 4 +-
drivers/iio/addac/ad74413r.c | 2 +-
drivers/iio/afe/iio-rescale.c | 3 +-
drivers/iio/chemical/atlas-ezo-sensor.c | 3 -
.../iio/common/hid-sensors/hid-sensor-attributes.c | 14 +-
drivers/iio/common/scmi_sensors/scmi_iio.c | 27 +-
drivers/iio/dac/mcp4725.c | 2 +
drivers/iio/gyro/bmg160_core.c | 2 +-
drivers/iio/humidity/am2315.c | 12 +-
drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c | 24 +-
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 97 +++-
drivers/iio/imu/kmx61.c | 2 +-
drivers/iio/industrialio-acpi.c | 9 +
drivers/iio/industrialio-trigger.c | 4 +-
drivers/iio/light/tsl2591.c | 32 +-
drivers/iio/light/vcnl4035.c | 4 +-
drivers/iio/magnetometer/mmc35240.c | 3 +-
drivers/iio/magnetometer/tlv493d.c | 6 +-
drivers/iio/proximity/sx9310.c | 2 +-
drivers/iio/proximity/sx9324.c | 13 +-
drivers/iio/proximity/sx9500.c | 6 +
drivers/iio/temperature/mlx90614.c | 2 +-
drivers/infiniband/core/rdma_core.c | 2 +
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 4 +
drivers/infiniband/hw/bnxt_re/main.c | 26 +-
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 4 +
drivers/infiniband/hw/bnxt_re/qplib_res.c | 14 +-
drivers/infiniband/hw/mlx5/fs.c | 3 +
drivers/infiniband/hw/mlx5/qp.c | 22 +-
drivers/infiniband/hw/mlx5/qpc.c | 10 +
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 6 +-
drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | 3 +-
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 45 +-
drivers/input/ff-core.c | 2 +-
drivers/input/ff-memless.c | 10 +-
drivers/input/input.c | 2 +
drivers/iommu/amd/init.c | 1 +
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 +-
drivers/irqchip/irq-mst-intc.c | 3 +
drivers/irqchip/irq-sifive-plic.c | 2 +-
drivers/md/dm-cache-metadata.c | 4 +-
drivers/md/dm-cache-target.c | 1 +
drivers/md/dm-crypt.c | 22 +-
drivers/md/dm-integrity.c | 30 +-
drivers/md/dm-log-userspace-base.c | 6 +-
drivers/md/dm-mpath.c | 6 +-
drivers/md/dm-pcache/backing_dev.c | 4 +-
drivers/md/dm-pcache/backing_dev.h | 2 +-
drivers/md/dm-pcache/cache_writeback.c | 28 +-
drivers/md/dm-raid.c | 5 +-
drivers/md/dm-snap.c | 18 +-
drivers/md/dm-sysfs.c | 17 +-
drivers/md/dm-thin-metadata.c | 5 +-
drivers/md/dm-thin.c | 7 +-
drivers/md/dm-verity-target.c | 27 +-
drivers/md/dm-zone.c | 2 +
drivers/md/dm-zoned-reclaim.c | 18 +-
drivers/md/dm.c | 19 +-
drivers/md/persistent-data/dm-btree-remove.c | 13 +-
drivers/md/persistent-data/dm-btree.c | 8 +-
drivers/md/persistent-data/dm-space-map-common.c | 9 +-
drivers/media/rc/rc-main.c | 125 +++--
drivers/mfd/cs42l43-i2c.c | 8 +
drivers/mfd/cs42l43-sdw.c | 10 +
drivers/mfd/cs42l43.c | 12 +-
drivers/mfd/cs42l43.h | 1 +
drivers/misc/bcm-vk/bcm_vk_sg.c | 43 +-
drivers/misc/fastrpc.c | 188 ++++---
drivers/misc/ibmvmc.c | 16 +-
drivers/misc/vmw_vmci/vmci_event.c | 7 +-
drivers/mmc/host/jz4740_mmc.c | 5 +-
drivers/mmc/host/meson-gx-mmc.c | 26 +-
drivers/mmc/host/mmci.c | 4 +-
drivers/mmc/host/omap.c | 4 +-
drivers/mmc/host/sdhci-esdhc-imx.c | 17 +
drivers/mmc/host/sunxi-mmc.c | 24 +-
drivers/mtd/mtdcore.c | 1 +
drivers/net/amt.c | 61 +--
drivers/net/bonding/bond_main.c | 108 ++--
drivers/net/can/dev/skb.c | 6 +-
drivers/net/dsa/b53/b53_common.c | 69 ++-
drivers/net/dsa/b53/b53_priv.h | 1 +
drivers/net/dsa/b53/b53_regs.h | 17 +
drivers/net/dsa/bcm_sf2.c | 5 +
drivers/net/dsa/microchip/ksz_common.c | 1 +
drivers/net/ethernet/amazon/ena/ena_netdev.c | 13 +-
drivers/net/ethernet/broadcom/bgmac-platform.c | 3 +-
drivers/net/ethernet/broadcom/bgmac.c | 8 +-
drivers/net/ethernet/broadcom/bnge/bnge_netdev.c | 27 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 55 +-
drivers/net/ethernet/cadence/macb.h | 2 -
drivers/net/ethernet/cadence/macb_main.c | 23 +-
drivers/net/ethernet/intel/i40e/i40e_xsk.c | 35 +-
drivers/net/ethernet/intel/ice/ice_adapter.c | 17 +-
drivers/net/ethernet/intel/ice/ice_adapter.h | 17 +-
drivers/net/ethernet/intel/ice/ice_ptp.c | 125 +++--
drivers/net/ethernet/intel/ice/ice_ptp.h | 4 +
drivers/net/ethernet/intel/ice/ice_xsk.c | 19 +-
drivers/net/ethernet/intel/idpf/xsk.c | 5 +
drivers/net/ethernet/mediatek/mtk_ppe.c | 5 +-
drivers/net/ethernet/mediatek/mtk_wed.c | 27 +-
.../net/ethernet/mellanox/mlx5/core/en/params.c | 5 +-
.../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 38 +-
.../mellanox/mlx5/core/en_accel/ipsec_fs.c | 65 +--
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 +-
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 19 +-
.../net/ethernet/mellanox/mlx5/core/esw/bridge.c | 21 +-
.../net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c | 15 +-
.../net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h | 6 +
.../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h | 2 +-
.../ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c | 26 +-
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 +-
.../net/ethernet/mellanox/mlx5/core/lag/mpesw.c | 2 +-
.../net/ethernet/mellanox/mlx5/core/lib/clock.c | 248 ++++++---
.../net/ethernet/mellanox/mlx5/core/lib/clock.h | 2 +
.../ethernet/mellanox/mlx5/core/lib/macsec_fs.c | 41 +-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 +
.../mellanox/mlx5/core/steering/hws/fs_hws.c | 8 +-
.../mellanox/mlx5/core/steering/hws/fs_hws.h | 2 +-
drivers/net/ethernet/meta/fbnic/fbnic.h | 10 +-
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 7 +
drivers/net/ethernet/meta/fbnic/fbnic_fw.c | 16 +
drivers/net/ethernet/meta/fbnic/fbnic_irq.c | 34 +-
drivers/net/ethernet/meta/fbnic/fbnic_mac.c | 81 ++-
drivers/net/ethernet/meta/fbnic/fbnic_mac.h | 40 +-
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 8 +-
drivers/net/ethernet/meta/fbnic/fbnic_netdev.h | 2 +-
drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 42 +-
drivers/net/ethernet/meta/fbnic/fbnic_phylink.c | 102 +++-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 10 +-
.../net/ethernet/microchip/lan966x/lan966x_fdma.c | 6 +
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 10 +-
drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +-
drivers/net/ethernet/realtek/8139cp.c | 8 +-
drivers/net/ethernet/sfc/ptp.c | 108 ++--
drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 +
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 11 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 260 +++++----
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 17 +-
drivers/net/ethernet/ti/am65-cpts.c | 67 ++-
drivers/net/gtp.c | 22 +-
drivers/net/hamradio/bpqether.c | 62 ++-
drivers/net/hyperv/rndis_filter.c | 6 +-
drivers/net/ipa/ipa_interrupt.c | 12 +-
drivers/net/ipvlan/ipvlan_core.c | 6 +-
drivers/net/macsec.c | 15 +-
drivers/net/mctp/mctp-i3c.c | 3 +-
drivers/net/phy/phy-c45.c | 46 +-
drivers/net/team/team_core.c | 12 +-
drivers/net/tun.c | 42 +-
drivers/net/tun_vnet.h | 5 +-
drivers/net/usb/cdc_ncm.c | 4 +-
drivers/net/usb/lan78xx.c | 21 +-
drivers/net/virtio_net.c | 51 +-
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/ath/ath12k/ahb.c | 52 +-
drivers/net/wireless/ath/ath12k/core.c | 6 +-
drivers/net/wireless/ath/ath12k/dp_mon.c | 60 ++-
drivers/net/wireless/ath/ath12k/dp_tx.c | 15 +-
drivers/net/wireless/ath/ath12k/mac.c | 430 ++++++++++++---
drivers/net/wireless/ath/ath12k/mac.h | 16 +-
drivers/net/wireless/ath/ath12k/wmi.h | 12 +-
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 8 +-
drivers/net/wireless/mediatek/mt76/mt7921/init.c | 31 +-
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 7 +-
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 4 +-
drivers/net/wireless/realtek/rtl8xxxu/core.c | 140 +++--
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +-
drivers/net/wireless/realtek/rtw89/rtw8851bu.c | 8 +-
drivers/net/wireless/realtek/rtw89/rtw8852bu.c | 8 +-
drivers/net/wireless/realtek/rtw89/usb.c | 5 +-
drivers/net/wireless/realtek/rtw89/usb.h | 3 +-
drivers/nvme/common/.kunitconfig | 6 +
drivers/nvme/common/Kconfig | 10 +
drivers/nvme/common/Makefile | 2 +
drivers/nvme/common/auth.c | 291 ++++++----
drivers/nvme/common/tests/auth_kunit.c | 175 ++++++
drivers/nvme/host/auth.c | 22 +-
drivers/nvme/host/core.c | 4 +
drivers/nvme/host/tcp.c | 54 +-
drivers/nvme/target/Kconfig | 9 +
drivers/nvme/target/admin-cmd.c | 4 +-
drivers/nvme/target/auth.c | 98 ++--
drivers/nvme/target/loop.c | 34 +-
drivers/nvme/target/nvmet.h | 2 +-
drivers/nvme/target/rdma.c | 55 +-
drivers/nvme/target/tcp.c | 13 +-
drivers/phy/samsung/phy-exynos5-usbdrd.c | 66 ++-
drivers/pinctrl/stm32/pinctrl-stm32.c | 12 +-
drivers/platform/x86/intel/pmt/class.c | 4 +-
drivers/platform/x86/intel/pmt/class.h | 3 +-
drivers/platform/x86/intel/pmt/discovery.c | 2 +-
drivers/power/sequencing/pwrseq-qcom-wcn.c | 2 +-
drivers/ptp/ptp_clock.c | 5 +
drivers/ptp/ptp_kvm_x86.c | 7 +-
drivers/ptp/ptp_private.h | 7 +-
drivers/ptp/ptp_sysfs.c | 18 +-
drivers/ptp/ptp_vclock.c | 123 +++--
drivers/regulator/Kconfig | 1 +
drivers/regulator/qcom_spmi-regulator.c | 35 +-
drivers/s390/block/dasd_eckd.c | 3 +-
drivers/s390/block/dasd_ioctl.c | 4 +-
drivers/s390/crypto/zcrypt_api.c | 41 +-
drivers/s390/crypto/zcrypt_error.h | 28 +-
drivers/s390/crypto/zcrypt_msgtype50.c | 95 +++-
drivers/s390/crypto/zcrypt_msgtype6.c | 208 ++++++--
drivers/s390/crypto/zcrypt_msgtype6.h | 4 +-
drivers/scsi/aha1542.c | 2 -
drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +-
drivers/scsi/scsi_debug.c | 12 +
drivers/soundwire/dmi-quirks.c | 42 ++
drivers/spi/spi-cadence-quadspi.c | 4 +-
drivers/spi/spi-pic32-sqi.c | 3 +-
drivers/spi/spi-tegra210-quad.c | 31 +-
drivers/spi/spi-virtio.c | 26 +-
drivers/spi/spi.c | 40 +-
drivers/staging/greybus/raw.c | 23 +-
.../staging/media/atomisp/pci/sh_css_param_dvs.c | 11 +-
.../media/atomisp/pci/sh_css_param_shading.c | 4 +-
drivers/staging/media/atomisp/pci/sh_css_params.c | 35 +-
drivers/target/target_core_pr.c | 9 +-
drivers/thermal/airoha_thermal.c | 25 +-
drivers/tty/serial/8250/8250.h | 1 +
drivers/tty/serial/8250/8250_lpss.c | 3 +
drivers/tty/serial/8250/8250_mid.c | 16 +-
drivers/tty/serial/8250/8250_port.c | 13 +-
drivers/tty/serial/rda-uart.c | 2 +
drivers/tty/serial/samsung_tty.c | 8 +-
drivers/tty/serial/serial_core.c | 25 +-
drivers/tty/serial/serial_port.c | 4 +-
drivers/tty/tty_io.c | 3 +-
drivers/tty/vt/keyboard.c | 6 +
drivers/tty/vt/vt.c | 2 +
drivers/usb/class/cdc-acm.c | 18 +-
drivers/usb/dwc3/core.h | 4 +-
drivers/usb/dwc3/dwc3-xilinx.c | 24 +-
drivers/usb/dwc3/ep0.c | 2 +-
drivers/usb/dwc3/gadget.c | 160 ++++--
drivers/usb/gadget/function/f_mass_storage.c | 8 +-
drivers/usb/gadget/function/f_midi.c | 4 +
drivers/usb/gadget/function/f_ncm.c | 7 +-
drivers/usb/gadget/function/storage_common.c | 7 +-
drivers/usb/gadget/function/storage_common.h | 3 +-
drivers/usb/gadget/function/u_serial.c | 170 ++++--
drivers/usb/host/pci-quirks.c | 13 +-
drivers/usb/host/xhci.c | 2 +-
drivers/usb/misc/usbtest.c | 3 +
drivers/usb/serial/garmin_gps.c | 31 +-
drivers/usb/serial/io_edgeport.c | 141 +++--
drivers/usb/serial/oti6858.c | 16 +-
drivers/usb/serial/sierra.c | 18 +-
drivers/usb/serial/upd78f0730.c | 13 +-
drivers/usb/storage/uas-detect.h | 8 +-
drivers/usb/typec/mux/fsa4480.c | 9 +-
drivers/usb/typec/mux/nb7vpq904m.c | 1 +
drivers/usb/typec/ucsi/ucsi.c | 10 +-
drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +-
drivers/vdpa/vdpa.c | 7 +-
drivers/vdpa/vdpa_sim/vdpa_sim.c | 7 +
drivers/vdpa/vdpa_user/vduse_dev.c | 15 +-
drivers/vhost/scsi.c | 61 ++-
drivers/vhost/test.c | 4 +
drivers/vhost/vdpa.c | 87 ++-
drivers/vhost/vhost.c | 33 +-
drivers/video/fbdev/core/fbmem.c | 5 +-
drivers/video/fbdev/core/fbsysfs.c | 59 ++-
drivers/virtio/virtio_balloon.c | 3 +-
drivers/virtio/virtio_pci_common.c | 2 +-
drivers/virtio/virtio_ring.c | 70 +--
drivers/w1/masters/ds2482.c | 36 +-
drivers/w1/slaves/w1_ds2805.c | 8 +-
drivers/w1/slaves/w1_ds28e04.c | 18 +-
drivers/w1/slaves/w1_therm.c | 37 +-
drivers/w1/w1.c | 21 +-
drivers/w1/w1_int.c | 8 +-
drivers/w1/w1_netlink.c | 8 +-
drivers/watchdog/npcm_wdt.c | 15 +-
drivers/xen/gntdev.c | 8 +-
drivers/xen/grant-table.c | 37 +-
drivers/xen/privcmd.c | 15 +
drivers/xen/pvcalls-back.c | 26 +-
fs/9p/fid.c | 11 +-
fs/9p/v9fs.c | 589 +++++++++++----------
fs/9p/v9fs.h | 58 +-
fs/9p/v9fs_vfs.h | 15 +
fs/9p/vfs_addr.c | 39 +-
fs/9p/vfs_dentry.c | 105 +++-
fs/9p/vfs_dir.c | 6 +-
fs/9p/vfs_inode.c | 28 +-
fs/9p/vfs_inode_dotl.c | 90 +++-
fs/9p/vfs_super.c | 135 +++--
fs/adfs/dir_fplus.c | 2 +
fs/aio.c | 7 +-
fs/backing-file.c | 7 +-
fs/btrfs/bio.c | 4 +
fs/btrfs/fiemap.c | 3 +-
fs/btrfs/scrub.c | 8 +-
fs/btrfs/verity.c | 2 +-
fs/btrfs/volumes.h | 5 +-
fs/btrfs/zoned.c | 81 ++-
fs/btrfs/zstd.c | 3 +-
fs/coda/file.c | 3 +-
fs/dcache.c | 46 +-
fs/dlm/config.c | 9 +-
fs/dlm/member.c | 17 +-
fs/eventpoll.c | 11 +-
fs/exfat/fatent.c | 20 +-
fs/ext2/dir.c | 3 +
fs/file.c | 10 +-
fs/fs-writeback.c | 97 ++--
fs/fuse/dev.c | 32 +-
fs/fuse/file.c | 2 +-
fs/fuse/notify.c | 2 +-
fs/inode.c | 3 +-
fs/isofs/util.c | 8 +-
fs/libfs.c | 133 ++---
fs/netfs/read_retry.c | 17 +-
fs/netfs/write_issue.c | 4 +-
fs/nfs/dir.c | 4 +-
fs/nfs/inode.c | 11 +-
fs/nfs/localio.c | 13 +-
fs/nfs/nfs4proc.c | 24 +-
fs/nfs/pnfs.c | 2 +-
fs/nfsd/nfs4state.c | 196 +++++--
fs/nfsd/state.h | 13 +-
fs/notify/fanotify/fanotify.h | 2 +-
fs/notify/fsnotify.c | 2 +-
fs/ntfs3/index.c | 10 +
fs/overlayfs/namei.c | 13 +-
fs/overlayfs/overlayfs.h | 11 +-
fs/overlayfs/ovl_entry.h | 2 +
fs/overlayfs/params.c | 58 +-
fs/overlayfs/super.c | 37 +-
fs/overlayfs/util.c | 12 +
fs/pidfs.c | 12 +
fs/proc/proc_sysctl.c | 5 +-
fs/read_write.c | 10 +-
fs/smb/client/cifsacl.c | 5 +-
fs/smb/client/cifsacl.h | 14 -
fs/smb/client/cifsfs.c | 13 +-
fs/smb/client/cifsglob.h | 1 +
fs/smb/client/connect.c | 3 +-
fs/smb/client/dfs.c | 12 +-
fs/smb/client/file.c | 100 +++-
fs/smb/client/sess.c | 4 +-
fs/smb/client/smb2pdu.c | 23 +-
fs/smb/server/mgmt/share_config.c | 43 +-
fs/smb/server/mgmt/share_config.h | 2 +
fs/smb/server/smb2pdu.c | 223 +++++---
fs/smb/server/vfs.c | 9 +-
fs/smb/server/vfs_cache.c | 16 +-
fs/splice.c | 11 +-
fs/stat.c | 6 +-
fs/udf/super.c | 19 +-
fs/userfaultfd.c | 22 +-
fs/xfs/xfs_inode.c | 3 +-
include/acpi/acpi_bus.h | 1 +
include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h | 12 +
include/linux/blk-mq.h | 3 +-
include/linux/blkdev.h | 3 +-
include/linux/bpf.h | 16 +-
include/linux/can/dev.h | 2 +-
include/linux/can/skb.h | 4 +-
include/linux/ceph/ceph_fs.h | 5 +-
include/linux/compiler.h | 7 +-
include/linux/cpufreq.h | 3 +
include/linux/dcache.h | 1 +
include/linux/ethtool.h | 2 +
include/linux/fs.h | 10 +-
include/linux/fs_parser.h | 2 +
include/linux/fsnotify.h | 4 +-
include/linux/fsnotify_backend.h | 6 +-
include/linux/gpio/regmap.h | 7 +
include/linux/key.h | 3 +
include/linux/mlx5/driver.h | 8 +-
include/linux/mmzone.h | 3 +-
include/linux/netdevice.h | 5 +
include/linux/netdevice_xmit.h | 4 +-
include/linux/nvme-auth.h | 44 +-
include/linux/nvme.h | 5 +
include/linux/perf_event.h | 34 ++
include/linux/perf_regs.h | 36 +-
include/linux/ptp_clock_kernel.h | 2 +-
include/linux/sched.h | 16 +-
include/linux/stat.h | 3 +
include/linux/tcp.h | 37 +-
include/linux/uio.h | 8 +-
include/linux/virtio_net.h | 245 +++++++--
include/media/rc-map.h | 2 -
include/net/9p/client.h | 102 +++-
include/net/9p/transport.h | 9 +-
include/net/af_unix.h | 1 +
include/net/bluetooth/hci_core.h | 15 +-
include/net/dst.h | 3 +-
include/net/dst_metadata.h | 2 +
include/net/gro.h | 18 +-
include/net/gso.h | 2 +-
include/net/inet_connection_sock.h | 1 +
include/net/inet_frag.h | 1 +
include/net/iw_handler.h | 8 +-
include/net/libeth/xsk.h | 10 +-
include/net/netfilter/nf_conntrack_helper.h | 1 +
include/net/netfilter/nf_dup_netdev.h | 35 --
include/net/netfilter/nf_queue.h | 1 +
include/net/netfilter/nf_recursion.h | 42 ++
include/net/scm.h | 13 +-
include/net/sock.h | 24 +-
include/net/tcp.h | 9 +
include/net/tcp_ao.h | 3 +-
include/net/xdp_sock_drv.h | 7 +-
include/net/xfrm.h | 17 +
include/net/xsk_buff_pool.h | 3 +
include/trace/events/huge_memory.h | 6 +-
include/trace/events/oom.h | 8 +-
include/uapi/asm-generic/socket.h | 2 +
include/uapi/linux/mdio.h | 13 +-
include/uapi/linux/perf_event.h | 51 +-
include/uapi/linux/virtio_spi.h | 2 +-
init/Kconfig | 6 +
init/do_mounts_rd.c | 5 +
io_uring/futex.c | 1 +
io_uring/io-wq.c | 44 +-
io_uring/io_uring.c | 8 +-
io_uring/io_uring.h | 1 +
io_uring/kbuf.c | 1 +
io_uring/napi.c | 31 +-
io_uring/rsrc.c | 7 +-
io_uring/rw.c | 4 +-
io_uring/timeout.c | 3 +-
kernel/Kconfig.kexec | 34 --
kernel/Makefile | 4 +-
kernel/bpf/arena.c | 10 +-
kernel/bpf/arraymap.c | 2 +-
kernel/bpf/bpf_local_storage.c | 2 +-
kernel/bpf/cgroup.c | 26 +-
kernel/bpf/core.c | 10 +-
kernel/bpf/hashtab.c | 86 ++-
kernel/bpf/helpers.c | 14 +-
kernel/bpf/stackmap.c | 102 ++--
kernel/bpf/syscall.c | 4 +-
kernel/bpf/trampoline.c | 19 +-
kernel/bpf/verifier.c | 210 ++++++--
kernel/cgroup/cpuset-internal.h | 5 +
kernel/cgroup/cpuset.c | 437 +++++++++------
kernel/dma/direct.c | 21 +-
kernel/events/core.c | 298 +++++++++--
kernel/events/hw_breakpoint.c | 3 +-
kernel/kprobes.c | 82 +--
kernel/liveupdate/Kconfig | 40 ++
kernel/liveupdate/Makefile | 5 +
kernel/{ => liveupdate}/kexec_handover.c | 6 +-
kernel/{ => liveupdate}/kexec_handover_debug.c | 0
kernel/{ => liveupdate}/kexec_handover_debugfs.c | 0
kernel/{ => liveupdate}/kexec_handover_internal.h | 0
kernel/locking/osq_lock.c | 62 ++-
kernel/printk/printk.c | 34 +-
kernel/sched/deadline.c | 89 +++-
kernel/sched/ext.c | 24 +-
kernel/sched/fair.c | 9 +-
kernel/sched/idle.c | 16 +-
kernel/sched/pelt.c | 2 +-
kernel/sched/sched.h | 25 +-
kernel/sched/syscalls.c | 40 +-
kernel/sched/topology.c | 16 +-
kernel/time/timekeeping.c | 9 +-
kernel/trace/trace_eprobe.c | 83 ++-
kernel/trace/trace_event_perf.c | 3 +-
kernel/trace/trace_fprobe.c | 22 +-
kernel/trace/trace_kprobe.c | 11 +-
kernel/trace/trace_probe.c | 20 +-
kernel/trace/trace_probe_tmpl.h | 14 +-
kernel/trace/trace_uprobe.c | 67 ++-
kernel/tsacct.c | 10 +-
lib/bootconfig.c | 2 +-
lib/errseq.c | 29 +-
lib/iov_iter.c | 6 +-
mm/internal.h | 11 +-
mm/khugepaged.c | 9 +-
mm/ksm.c | 4 +
mm/memory_hotplug.c | 49 +-
mm/mempolicy.c | 4 +-
mm/page_alloc.c | 83 ++-
mm/page_frag_cache.c | 21 +-
mm/shmem.c | 2 +-
mm/slub.c | 86 ++-
net/9p/client.c | 154 +-----
net/9p/mod.c | 2 +-
net/9p/protocol.c | 12 +-
net/9p/trans_fd.c | 144 +----
net/9p/trans_rdma.c | 133 +----
net/9p/trans_usbg.c | 14 +-
net/9p/trans_virtio.c | 8 +-
net/9p/trans_xen.c | 4 +-
net/ax25/ax25_in.c | 30 +-
net/ax25/ax25_std_in.c | 23 +-
net/batman-adv/bat_iv_ogm.c | 2 +-
net/bluetooth/6lowpan.c | 21 +-
net/bluetooth/hci_conn.c | 23 +-
net/bluetooth/hci_core.c | 66 ++-
net/bluetooth/hci_event.c | 68 ++-
net/bluetooth/hci_sync.c | 116 +++-
net/bluetooth/l2cap_core.c | 5 +-
net/bluetooth/l2cap_sock.c | 3 +-
net/bluetooth/mgmt.c | 45 +-
net/bridge/br_arp_nd_proxy.c | 6 +-
net/bridge/br_if.c | 6 +-
net/bridge/br_vlan.c | 31 +-
net/bridge/netfilter/nf_conntrack_bridge.c | 2 +-
net/ceph/Kconfig | 1 +
net/ceph/auth_x.c | 195 +++++--
net/ceph/auth_x_protocol.h | 38 ++
net/ceph/crypto.c | 269 ++++++++--
net/ceph/crypto.h | 21 +-
net/ceph/messenger_v2.c | 14 +-
net/compat.c | 4 +-
net/core/dev.c | 12 +
net/core/devmem.c | 7 +-
net/core/devmem.h | 5 +
net/core/filter.c | 103 +++-
net/core/gro.c | 31 +-
net/core/lwt_bpf.c | 55 +-
net/core/net-sysfs.c | 8 +
net/core/netdev-genl.c | 6 +-
net/core/scm.c | 40 +-
net/core/skbuff.c | 18 +-
net/core/sock_reuseport.c | 26 +-
net/ethtool/ioctl.c | 17 +-
net/ethtool/linkinfo.c | 4 +-
net/ethtool/linkmodes.c | 4 +-
net/ipv4/esp4_offload.c | 1 +
net/ipv4/fib_trie.c | 14 +-
net/ipv4/fou_core.c | 31 +-
net/ipv4/igmp.c | 2 +
net/ipv4/inet_connection_sock.c | 23 +-
net/ipv4/inet_fragment.c | 5 +
net/ipv4/inet_hashtables.c | 11 +
net/ipv4/inet_timewait_sock.c | 6 +-
net/ipv4/ip_fragment.c | 3 +-
net/ipv4/ip_output.c | 8 +-
net/ipv4/ip_tunnel.c | 6 +-
net/ipv4/netfilter/arp_tables.c | 5 +-
net/ipv4/netfilter/ip_tables.c | 5 +-
net/ipv4/netfilter/nf_reject_ipv4.c | 12 +
net/ipv4/raw.c | 15 +-
net/ipv4/route.c | 25 +-
net/ipv4/tcp.c | 23 +-
net/ipv4/tcp_fastopen.c | 2 +
net/ipv4/tcp_input.c | 98 +++-
net/ipv4/tcp_ipv4.c | 25 +-
net/ipv4/tcp_metrics.c | 3 +-
net/ipv4/tcp_minisocks.c | 2 +-
net/ipv4/udp.c | 5 +-
net/ipv4/udp_offload.c | 10 +-
net/ipv4/udp_tunnel_core.c | 6 +-
net/ipv6/calipso.c | 12 +-
net/ipv6/esp6_offload.c | 1 +
net/ipv6/exthdrs.c | 5 +-
net/ipv6/exthdrs_core.c | 7 +-
net/ipv6/icmp.c | 7 +-
net/ipv6/ip6_fib.c | 54 +-
net/ipv6/ip6_output.c | 13 +-
net/ipv6/ip6mr.c | 43 +-
net/ipv6/mip6.c | 9 +-
net/ipv6/netfilter/ip6_tables.c | 5 +-
net/ipv6/netfilter/nf_reject_ipv6.c | 13 +
net/ipv6/raw.c | 15 +-
net/ipv6/reassembly.c | 5 +-
net/ipv6/route.c | 32 +-
net/ipv6/seg6_iptunnel.c | 46 +-
net/ipv6/seg6_local.c | 264 +++++++--
net/ipv6/sit.c | 2 +-
net/ipv6/tcp_ipv6.c | 9 +-
net/ipv6/udp.c | 5 +-
net/iucv/af_iucv.c | 9 +
net/mac80211/airtime.c | 2 +
net/mac80211/ibss.c | 27 +-
net/mac80211/ieee80211_i.h | 3 +
net/mac80211/link.c | 13 +-
net/mac80211/mlme.c | 25 +-
net/mac80211/ocb.c | 23 +-
net/mac80211/rx.c | 7 +-
net/mac80211/tx.c | 6 +
net/mctp/af_mctp.c | 2 +-
net/mptcp/options.c | 12 +-
net/netfilter/ipvs/ip_vs_app.c | 2 +-
net/netfilter/ipvs/ip_vs_core.c | 12 +-
net/netfilter/nf_conntrack_helper.c | 20 +-
net/netfilter/nf_conntrack_sip.c | 4 +-
net/netfilter/nf_dup_netdev.c | 1 +
net/netfilter/nf_flow_table_core.c | 1 +
net/netfilter/nf_flow_table_ip.c | 2 +
net/netfilter/nf_nat_masquerade.c | 4 +-
net/netfilter/nf_queue.c | 1 +
net/netfilter/nf_tables_api.c | 21 +-
net/netfilter/nf_tables_offload.c | 3 +
net/netfilter/nfnetlink_queue.c | 17 +-
net/netfilter/nft_ct.c | 119 ++++-
net/netfilter/nft_fwd_netdev.c | 1 +
net/netfilter/nft_set_rbtree.c | 3 +-
net/netfilter/xt_NETMAP.c | 4 +-
net/netfilter/xt_recent.c | 7 +-
net/netlink/af_netlink.c | 3 +-
net/netrom/nr_out.c | 7 +-
net/netrom/nr_subr.c | 6 +-
net/netrom/nr_timer.c | 4 +
net/netrom/sysctl_net_netrom.c | 17 +-
net/nsh/nsh.c | 7 +
net/openvswitch/flow.c | 19 +-
net/rds/rdma.c | 5 +-
net/rose/rose_in.c | 21 +
net/sched/act_ife.c | 13 +-
net/sched/sch_teql.c | 9 +-
net/sctp/sm_make_chunk.c | 43 +-
net/sctp/sm_statefuns.c | 16 +-
net/sctp/socket.c | 2 +-
net/sctp/stream.c | 2 +
net/sctp/stream_interleave.c | 38 +-
net/smc/af_smc.c | 21 +-
net/smc/smc.h | 1 +
net/smc/smc_close.c | 14 +
net/smc/smc_core.c | 86 ++-
net/smc/smc_core.h | 6 +-
net/smc/smc_diag.c | 12 +-
net/smc/smc_sysctl.c | 6 +-
net/socket.c | 11 +-
net/sunrpc/clnt.c | 10 +-
net/sunrpc/rpc_pipe.c | 1 +
net/sunrpc/xprtsock.c | 2 +-
net/tipc/bearer.c | 33 ++
net/tls/tls_device.c | 24 +
net/tls/tls_sw.c | 25 +-
net/unix/af_unix.c | 15 +-
net/unix/garbage.c | 31 +-
net/vmw_vsock/af_vsock.c | 3 +-
net/vmw_vsock/hyperv_transport.c | 3 +
net/vmw_vsock/virtio_transport.c | 16 +-
net/wireless/core.c | 2 +-
net/wireless/nl80211.c | 9 +-
net/wireless/scan.c | 3 +-
net/wireless/util.c | 6 +-
net/wireless/wext-core.c | 33 +-
net/xdp/xsk.c | 28 +-
net/xdp/xsk_buff_pool.c | 46 +-
net/xfrm/xfrm_iptfs.c | 3 +-
net/xfrm/xfrm_policy.c | 20 +-
net/xfrm/xfrm_replay.c | 6 +-
security/keys/key.c | 10 +-
security/keys/keyctl.c | 2 -
security/keys/keyring.c | 25 +-
security/keys/request_key.c | 14 +-
sound/core/memalloc.c | 2 +-
sound/drivers/aloop.c | 11 +-
sound/drivers/pcmtest.c | 66 +--
sound/hda/codecs/realtek/alc269.c | 19 +-
sound/hda/codecs/realtek/alc882.c | 10 +
sound/hda/codecs/side-codecs/cs35l56_hda.c | 2 +
sound/hda/codecs/side-codecs/tas2781_hda.c | 4 +-
sound/hda/common/sysfs.c | 5 +-
sound/hda/core/controller.c | 10 +-
sound/pci/Kconfig | 1 +
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 16 +-
sound/soc/amd/ps/pci-ps.c | 32 +-
sound/soc/codecs/max98090.c | 22 +-
sound/soc/codecs/wm_adsp.c | 10 +
sound/soc/mediatek/mt8188/mt8188-audsys-clk.c | 12 +-
sound/soc/meson/axg-fifo.c | 30 +-
sound/soc/qcom/common.c | 222 +++++++-
sound/soc/qcom/common.h | 20 +
sound/soc/qcom/lpass.h | 3 +-
sound/soc/qcom/qdsp6/q6afe.h | 3 +-
sound/soc/qcom/qdsp6/q6apm.h | 3 +-
sound/soc/qcom/sc8280xp.c | 33 +-
sound/soc/qcom/sdw.c | 24 +-
sound/soc/qcom/sdw.h | 6 +-
sound/soc/qcom/sm8250.c | 33 +-
sound/soc/qcom/x1e80100.c | 41 +-
sound/soc/rockchip/Kconfig | 6 +
sound/soc/rockchip/rockchip_spdif.c | 97 +++-
sound/soc/rockchip/rockchip_spdif.h | 18 +-
sound/soc/soc-core.c | 16 +
sound/soc/sof/amd/acp.c | 32 +-
sound/soc/sof/ipc4-topology.c | 2 +-
sound/usb/caiaq/device.c | 11 +-
sound/usb/mixer.c | 23 +
sound/usb/mixer.h | 2 +
sound/usb/pcm.c | 6 +
tools/include/nolibc/dirent.h | 7 +-
tools/perf/builtin-lock.c | 61 ++-
tools/perf/tests/hists_cumulate.c | 2 +-
tools/perf/tests/hists_filter.c | 2 +-
tools/perf/tests/hists_link.c | 2 +-
tools/perf/tests/hists_output.c | 2 +-
tools/perf/tests/thread-maps-share.c | 2 +-
tools/perf/util/dso.c | 2 +
tools/perf/util/dso.h | 15 +
tools/perf/util/evlist.c | 6 +-
tools/perf/util/evsel.c | 59 ++-
tools/perf/util/evsel.h | 1 +
tools/perf/util/libbfd.c | 10 +-
tools/perf/util/machine.c | 4 +-
tools/perf/util/machine.h | 10 +-
tools/perf/util/session.c | 2 +-
tools/perf/util/srcline.c | 2 +
tools/perf/util/thread.c | 8 +-
tools/testing/cxl/test/cxl.c | 6 +-
.../selftests/bpf/prog_tests/kfunc_dynptr_param.c | 2 +-
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 29 +-
.../ftrace/test.d/dynevent/fprobe_syntax_errors.tc | 4 +-
.../ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 2 +-
.../ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 2 +-
tools/testing/selftests/mm/merge.c | 33 +-
.../tcp_bidir_fast_retransmit_nosack.pkt | 42 ++
tools/testing/selftests/net/tls.c | 3 +
924 files changed, 16070 insertions(+), 7084 deletions(-)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 001/990] netfilter: nft_ct: expectation timeouts are passed in milliseconds
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 002/990] netfilter: nft_ct: move custom expectation support to helper Greg Kroah-Hartman
` (851 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Westphal, Pablo Neira Ayuso,
Mark Bundschuh, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <fw@strlen.de>
[ Upstream commit 6fb421bd07f156cdf0cdede062d31f1c21def326 ]
Userspace passes '5000' in case user asks for 5 seconds.
Allowing for sub-second expectation lifetimes makes sense to me. so
fix up the kernel side instead of munging nft to send a value rounded
up to next second.
Also note that this violates nft convention of passing integers in
network byte order, but we can't change this anymore.
Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Stable-dep-of: 3679da4ad8be ("netfilter: nft_ct: move custom expectation support to helper")
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nft_ct.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index 11d99778216f1..4687fc244eaf9 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -1217,11 +1217,23 @@ struct nft_ct_expect_obj {
u32 timeout;
};
+static int nft_ct_expect_timeout_get(const struct nlattr *attr, u32 *val)
+{
+ unsigned long jiffies_val = msecs_to_jiffies(nla_get_u32(attr));
+
+ if (jiffies_val > UINT_MAX)
+ return -ERANGE;
+
+ *val = jiffies_val;
+ return 0;
+}
+
static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
const struct nlattr * const tb[],
struct nft_object *obj)
{
struct nft_ct_expect_obj *priv = nft_obj_data(obj);
+ int err;
if (!tb[NFTA_CT_EXPECT_L4PROTO] ||
!tb[NFTA_CT_EXPECT_DPORT] ||
@@ -1257,8 +1269,11 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
return -EOPNOTSUPP;
}
+ err = nft_ct_expect_timeout_get(tb[NFTA_CT_EXPECT_TIMEOUT], &priv->timeout);
+ if (err)
+ return err;
+
priv->dport = nla_get_be16(tb[NFTA_CT_EXPECT_DPORT]);
- priv->timeout = nla_get_u32(tb[NFTA_CT_EXPECT_TIMEOUT]);
priv->size = nla_get_u8(tb[NFTA_CT_EXPECT_SIZE]);
return nf_ct_netns_get(ctx->net, ctx->family);
@@ -1278,7 +1293,7 @@ static int nft_ct_expect_obj_dump(struct sk_buff *skb,
if (nla_put_be16(skb, NFTA_CT_EXPECT_L3PROTO, htons(priv->l3num)) ||
nla_put_u8(skb, NFTA_CT_EXPECT_L4PROTO, priv->l4proto) ||
nla_put_be16(skb, NFTA_CT_EXPECT_DPORT, priv->dport) ||
- nla_put_u32(skb, NFTA_CT_EXPECT_TIMEOUT, priv->timeout) ||
+ nla_put_u32(skb, NFTA_CT_EXPECT_TIMEOUT, jiffies_to_msecs(priv->timeout)) ||
nla_put_u8(skb, NFTA_CT_EXPECT_SIZE, priv->size))
return -1;
@@ -1328,7 +1343,7 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj,
&ct->tuplehash[!dir].tuple.src.u3,
&ct->tuplehash[!dir].tuple.dst.u3,
priv->l4proto, NULL, &priv->dport);
- exp->timeout += priv->timeout * HZ;
+ exp->timeout += priv->timeout;
if (nf_ct_expect_related(exp, 0) != 0)
regs->verdict.code = NF_DROP;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 002/990] netfilter: nft_ct: move custom expectation support to helper
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 001/990] netfilter: nft_ct: expectation timeouts are passed in milliseconds Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 003/990] bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature Greg Kroah-Hartman
` (850 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jaeyeong Lee, Pablo Neira Ayuso,
Mark Bundschuh, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <pablo@netfilter.org>
[ Upstream commit 3679da4ad8be84cddaf40bc307fef1fe13e051ff ]
Originally, the ct expectation support called nf_ct_helper_ext_add() for
confirmed conntracks, which is invalid, triggering a splat. This was
fixed by commit 1710eb913bdc ("netfilter: nft_ct: skip expectations for
confirmed conntrack") which restricted it to unconfirmed conntracks.
However, early insertion of expectations into the expectations list when
the conntrack is unconfirmed leads to stale entries pointing to the
wrong hlist_head through .pprev due to ct extension reallocation.
Commit 7c9664351980 ("netfilter: move nat hlist_head to nf_conn") moved
the nat hlist_head to nf_conn for this reason:
1. ...
2. When reallocation of extension area occurs we need to fixup the
bysource hash head via hlist_replace_rcu.
I'd rather not increase the size of the struct nf_conn for this feature
has very limited scope: only one expectation can be created at a time
given expect_clash() will make nf_ct_expect_related() reports EBUSY.
For this reason, relax nf_ct_expect_related() not to drop packets in
case expectation creation fails, therefore, expectation creation becomes
best effort.
To address this issue, add an internal ct helper and attach it to the
conntrack entry to streamline the custom ct expectation support with
existing ct helpers.
Expose a new nf_conntrack_helper_release() function to release the
internal helper that is allocated and attached to the conntrack entry to
create the custom expectations. The nft_ct module removal always waits
for rcu grace period, then the NULL helper callback is observed after
this.
This patch also restricts the creation of expectations to different
helpers other than this custom helper that is created for this type of
expectations.
Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
Reported-by: Jaeyeong Lee <iostreampy@proton.me>
Link: https://patch.msgid.link/20260715144755.00ea7dfcd9f@proton.me
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[ - ac46f3f35b6e ("netfilter: nf_conntrack_helper: add refcounting from
datapath") is not backported because it reworks helper lifetime
around a datapath ct_refcnt in 9 files, so one static nft_ct_expect
helper is unhelped at nft_ct module exit.
- d4beefc90a66 ("netfilter: nft_ct: support expectation creation for
natted flows") is not backported because it adds expectation support
for NATed flows, so the moved expectation code has no NAT
follow-master part.
- Context differs due to commit: 6031487d4e27 ]
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/netfilter/nf_conntrack_helper.h | 1 +
net/netfilter/nf_conntrack_helper.c | 20 ++--
net/netfilter/nft_ct.c | 100 +++++++++++++++-----
3 files changed, 89 insertions(+), 32 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 24cf3d2d97450..5b76fa57fd76c 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -105,6 +105,7 @@ void nf_ct_helper_init(struct nf_conntrack_helper *helper,
int nf_conntrack_helper_register(struct nf_conntrack_helper *);
void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
+void nf_conntrack_helper_release(struct nf_conntrack_helper *);
int nf_conntrack_helpers_register(struct nf_conntrack_helper *, unsigned int);
void nf_conntrack_helpers_unregister(struct nf_conntrack_helper *,
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 2cef826e20fb9..17538e3382dd1 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -425,6 +425,18 @@ static bool expect_iter_me(struct nf_conntrack_expect *exp, void *data)
return this == me;
}
+void nf_conntrack_helper_release(struct nf_conntrack_helper *me)
+{
+ nf_ct_expect_iterate_destroy(expect_iter_me, me);
+ nf_ct_iterate_destroy(unhelp, me);
+
+ /* nf_ct_iterate_destroy() does an unconditional synchronize_rcu() as
+ * last step, this ensures rcu readers of exp->helper are done.
+ * No need for another synchronize_rcu() here.
+ */
+}
+EXPORT_SYMBOL_GPL(nf_conntrack_helper_release);
+
void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
{
mutex_lock(&nf_ct_helper_mutex);
@@ -437,13 +449,7 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
*/
synchronize_rcu();
- nf_ct_expect_iterate_destroy(expect_iter_me, me);
- nf_ct_iterate_destroy(unhelp, me);
-
- /* nf_ct_iterate_destroy() does an unconditional synchronize_rcu() as
- * last step, this ensures rcu readers of exp->helper are done.
- * No need for another synchronize_rcu() here.
- */
+ nf_conntrack_helper_release(me);
}
EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index 4687fc244eaf9..87de920ead036 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -1228,6 +1228,65 @@ static int nft_ct_expect_timeout_get(const struct nlattr *attr, u32 *val)
return 0;
}
+struct nft_ct_expect_data {
+ struct nft_ct_expect_obj obj;
+ enum ip_conntrack_dir dir;
+};
+
+static int ct_expect_help(struct sk_buff *skb, unsigned int protoff,
+ struct nf_conn *ct, enum ip_conntrack_info ctinfo)
+{
+ enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
+ struct nft_ct_expect_data *expect_data;
+ struct nf_conntrack_expect *exp;
+ int ret = NF_ACCEPT;
+ u16 l3num;
+
+ if (nf_ct_is_confirmed(ct))
+ return NF_ACCEPT;
+
+ expect_data = nfct_help_data(ct);
+ if (!expect_data)
+ return NF_ACCEPT;
+
+ if (expect_data->dir != dir)
+ return NF_ACCEPT;
+
+ exp = nf_ct_expect_alloc(ct);
+ if (!exp)
+ return NF_DROP;
+
+ if (expect_data->obj.l3num == NFPROTO_INET)
+ l3num = nf_ct_l3num(ct);
+ else
+ l3num = expect_data->obj.l3num;
+
+ nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, l3num,
+ &ct->tuplehash[!dir].tuple.src.u3,
+ &ct->tuplehash[!dir].tuple.dst.u3,
+ expect_data->obj.l4proto, NULL, &expect_data->obj.dport);
+ exp->timeout += expect_data->obj.timeout;
+
+ if (nf_ct_expect_related(exp, 0) != 0)
+ ret = NF_ACCEPT;
+
+ nf_ct_expect_put(exp);
+
+ return ret;
+}
+
+static const struct nf_conntrack_expect_policy nft_ct_expect_helper_policy = {
+ .max_expected = NF_CT_EXPECT_MAX_CNT,
+};
+
+/* No need to register this helper, this is internal. */
+static struct nf_conntrack_helper nft_ct_expect_helper = {
+ .name = "nft_ct_expect",
+ .me = THIS_MODULE,
+ .expect_policy = &nft_ct_expect_helper_policy,
+ .help = ct_expect_help,
+};
+
static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
const struct nlattr * const tb[],
struct nft_object *obj)
@@ -1235,6 +1294,8 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
struct nft_ct_expect_obj *priv = nft_obj_data(obj);
int err;
+ NF_CT_HELPER_BUILD_BUG_ON(sizeof(struct nft_ct_expect_data));
+
if (!tb[NFTA_CT_EXPECT_L4PROTO] ||
!tb[NFTA_CT_EXPECT_DPORT] ||
!tb[NFTA_CT_EXPECT_TIMEOUT] ||
@@ -1280,7 +1341,7 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
}
static void nft_ct_expect_obj_destroy(const struct nft_ctx *ctx,
- struct nft_object *obj)
+ struct nft_object *obj)
{
nf_ct_netns_put(ctx->net, ctx->family);
}
@@ -1305,11 +1366,9 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj,
const struct nft_pktinfo *pkt)
{
const struct nft_ct_expect_obj *priv = nft_obj_data(obj);
- struct nf_conntrack_expect *exp;
+ struct nft_ct_expect_data *expect_data;
enum ip_conntrack_info ctinfo;
struct nf_conn_help *help;
- enum ip_conntrack_dir dir;
- u16 l3num = priv->l3num;
struct nf_conn *ct;
ct = nf_ct_get(pkt->skb, &ctinfo);
@@ -1317,38 +1376,28 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj,
regs->verdict.code = NFT_BREAK;
return;
}
- dir = CTINFO2DIR(ctinfo);
help = nfct_help(ct);
- if (!help)
- help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
- if (!help) {
- regs->verdict.code = NF_DROP;
- return;
- }
-
- if (help->expecting[NF_CT_EXPECT_CLASS_DEFAULT] >= priv->size) {
+ if (help) {
regs->verdict.code = NFT_BREAK;
return;
}
- if (l3num == NFPROTO_INET)
- l3num = nf_ct_l3num(ct);
- exp = nf_ct_expect_alloc(ct);
- if (exp == NULL) {
+ help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
+ if (!help) {
regs->verdict.code = NF_DROP;
return;
}
- nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, l3num,
- &ct->tuplehash[!dir].tuple.src.u3,
- &ct->tuplehash[!dir].tuple.dst.u3,
- priv->l4proto, NULL, &priv->dport);
- exp->timeout += priv->timeout;
- if (nf_ct_expect_related(exp, 0) != 0)
- regs->verdict.code = NF_DROP;
+ expect_data = nfct_help_data(ct);
+ if (!expect_data) {
+ regs->verdict.code = NFT_BREAK;
+ return;
+ }
+ expect_data->obj = *priv;
+ expect_data->dir = CTINFO2DIR(ctinfo);
- nf_ct_expect_put(exp);
+ rcu_assign_pointer(help->helper, &nft_ct_expect_helper);
}
static const struct nla_policy nft_ct_expect_policy[NFTA_CT_EXPECT_MAX + 1] = {
@@ -1428,6 +1477,7 @@ static void __exit nft_ct_module_exit(void)
nft_unregister_obj(&nft_ct_helper_obj_type);
nft_unregister_expr(&nft_notrack_type);
nft_unregister_expr(&nft_ct_type);
+ nf_conntrack_helper_release(&nft_ct_expect_helper);
}
module_init(nft_ct_module_init);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 003/990] bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 001/990] netfilter: nft_ct: expectation timeouts are passed in milliseconds Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 002/990] netfilter: nft_ct: move custom expectation support to helper Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 004/990] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask Greg Kroah-Hartman
` (849 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xianrui Dong, KP Singh, Amery Hung,
Song Liu, Daniel Borkmann, Kumar Kartikeya Dwivedi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: KP Singh <kpsingh@kernel.org>
[ Upstream commit 49b18315be4eecfc36b75f4aecb4d40a87d68a20 ]
__bpf_dynptr_data() can return NULL (FILE dynptrs, any non-contiguous
backing). bpf_verify_pkcs7_signature() forwards the pointer to
verify_pkcs7_signature() unchecked, causing a NULL deref in
asn1_ber_decoder() reachable from a sleepable BPF LSM at lsm.s/bpf.
NULL-check both pointers and reject with -EINVAL. Mirrors the guards
already in kernel/bpf/crypto.c.
Fixes: 865b0566d8f1 ("bpf: Add bpf_verify_pkcs7_signature() kfunc")
Reported-by: Xianrui Dong <dongxianrui1@gmail.com>
Signed-off-by: KP Singh <kpsingh@kernel.org>
Reviewed-by: Amery Hung <ameryhung@gmail.com>
Acked-by: Song Liu <song@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20260520024059.313468-1-kpsingh@kernel.org
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/helpers.c | 5 +++++
tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 31afbb74a0523..89cb7e38be764 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -3915,8 +3915,13 @@ __bpf_kfunc int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_p,
data_len = __bpf_dynptr_size(data_ptr);
data = __bpf_dynptr_data(data_ptr, data_len);
+ if (!data)
+ return -EINVAL;
+
sig_len = __bpf_dynptr_size(sig_ptr);
sig = __bpf_dynptr_data(sig_ptr, sig_len);
+ if (!sig)
+ return -EINVAL;
return verify_pkcs7_signature(data, data_len, sig, sig_len,
trusted_keyring->key,
diff --git a/tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c b/tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c
index 8cd298b78e44a..04aaf4c9cf5ee 100644
--- a/tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c
+++ b/tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c
@@ -14,7 +14,7 @@ static struct {
const char *prog_name;
int expected_runtime_err;
} kfunc_dynptr_tests[] = {
- {"dynptr_data_null", -EBADMSG},
+ {"dynptr_data_null", -EINVAL},
};
static bool kfunc_not_supported;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 004/990] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (2 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 003/990] bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 005/990] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES Greg Kroah-Hartman
` (848 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Thomas Gleixner,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 0f214e5bbee59d5952d3c061fd65ed9a1e175981 ]
__plic_toggle() builds a 32-bit interrupt enable mask using a signed
integer literal. A valid interrupt selecting bit 31 evaluates 1 << 31,
which shifts a signed int into its sign bit.
Use BIT(), matching the equivalent mask construction in plic_irq_eoi().
The resulting mask remains representable in u32 on both RV32 and RV64.
The issue was found by our static-analysis tool.
Fixes: 8237f8bc4f6e ("irqchip: add a SiFive PLIC driver")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: gpt 5
Link: https://patch.msgid.link/caplitmus-rv.v2.plic.87a8fc444de44e109889ba28703c76f3@163.com
[ sashal: Context adjusted because __plic_toggle() here takes an enable_base pointer rather than a handler; the single 1 << (hwirq % 32) to BIT(hwirq % 32) change is otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-sifive-plic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index ca70641982ed6..0995e1fdd5b47 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -97,7 +97,7 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type);
static void __plic_toggle(void __iomem *enable_base, int hwirq, int enable)
{
u32 __iomem *reg = enable_base + (hwirq / 32) * sizeof(u32);
- u32 hwirq_mask = 1 << (hwirq % 32);
+ u32 hwirq_mask = BIT(hwirq % 32);
if (enable)
writel(readl(reg) | hwirq_mask, reg);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 005/990] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (3 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 004/990] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 006/990] net: always dissect GSO packets in __virtio_net_hdr_to_skb() Greg Kroah-Hartman
` (847 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Johannes Weiner, Andrew Morton,
Balbir Singh, Vlastimil Babka (SUSE), Matthew Wilcox (Oracle),
Salvatore Dipietro, Christoph Hellwig, Dave Chinner, Matt Fleming,
Mel Gorman, Michal Hocko, Suren Baghdasaryan, Brendan Jackman,
Zi Yan, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <hannes@cmpxchg.org>
[ Upstream commit fe21f930d1e64d121191673076fc4ebe79fc82d5 ]
1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH
non-blocking allocations accesses reserves") stopped handing out reserve
access for ALLOC_NON_BLOCK on its own: the extra 25% below the min
watermark is now only granted on top of ALLOC_MIN_RESERVE. But the flag
was left in ALLOC_RESERVES, which produces something odd:
With the ALLOC_RESERVES match, __zone_watermark_unusable_free() doesn't
subtract the free highatomic pages for them. So in the slowpath, they get
to consume regular blocks below the min watermark by the number of free
highatomic pages. The highatomic reserve is capped at 1% of the zone,
which on any decently sized machine is a multiple of the min watermark:
GFP_NOWAIT can drain regular memory to zero.
The user-visible result is brutal hiccups during bursts of GFP_NOWAIT
allocations under memory pressure. This was found in review and
reproduced with a synthetic burst, not observed in production, but the
sequence of events is a realistic one: On a 32G box with an anonymous
working set, swap, and a filled 290M highatomic reserve, a GFP_NOWAIT
burst drove regular free memory in the 28G Normal zone (min=60M) to 28M,
0.8M and 0.6M in three runs. Swapout failed to allocate its swap table,
reclaim scanned 13M pages to reclaim 200k, page faults stalled for tens to
hundreds of milliseconds. The machine survives it, but not by design:
direct reclaimers eventually fail and start unreserving highatomic blocks,
until the allocation succeeds or the reserve is gone and the OOM killer
runs. That reserve exists for high-order atomic allocations; here it is
destroyed to bail out a GFP_NOWAIT consumer that was never entitled to the
memory.
Remove ALLOC_NON_BLOCK from ALLOC_RESERVES. With that, the GFP_NOWAIT
burst is stopped short at the min watermark. No direct reclaim, no
stalls, no failed allocations, and the highatomic reserve stays intact for
the requests it exists for.
__zone_watermark_ok() is unaffected, since everything it keys on
ALLOC_NON_BLOCK is already nested under ALLOC_MIN_RESERVE. Update the
flag comments accordingly: ALLOC_NON_BLOCK just means the caller can't
block; the reserve math belongs with ALLOC_MIN_RESERVE.
GFP_ATOMIC order-0 requests have a milder version of the same problem.
Through ALLOC_MIN_RESERVE they also count the free highatomic pages in
their watermark check, but rmqueue_buddy() serves them regular pages first
and only falls back to the reserve once those are gone. They can still
push regular free memory to 37.5% of min minus the free highatomic pages
before the reserve is touched. Unlike GFP_NOWAIT they are entitled to the
reserve, so this needs the watermark check and the freelist order reworked
together, and is left to a separate patch.
Link: https://lore.kernel.org/20261028171719.2043421-3-hannes@cmpxchg.org
Fixes: 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves")
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Balbir Singh <balbirs@nvidia.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Salvatore Dipietro <dipiets@amazon.it>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <dgc@kernel.org>
Cc: Matt Fleming <matt@readmodwrite.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Zi Yan <ziy@nvidia.com>
Cc: <stable@vger.kernel.org>
[ sashal: Applied the same three edits in mm/internal.h because mm/page_alloc.h does not exist in this tree, with slightly different surrounding flag context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/internal.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index 4a27dac7a42a8..7504592042b23 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1322,12 +1322,11 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone,
#define ALLOC_OOM ALLOC_NO_WATERMARKS
#endif
-#define ALLOC_NON_BLOCK 0x10 /* Caller cannot block. Allow access
- * to 25% of the min watermark or
- * 62.5% if __GFP_HIGH is set.
- */
+#define ALLOC_NON_BLOCK 0x10 /* Caller cannot block. */
#define ALLOC_MIN_RESERVE 0x20 /* __GFP_HIGH set. Allow access to 50%
- * of the min watermark.
+ * of the min watermark, or 62.5% if
+ * the caller cannot block either
+ * (ALLOC_NON_BLOCK).
*/
#define ALLOC_CPUSET 0x40 /* check for correct cpuset */
#define ALLOC_CMA 0x80 /* allow allocations from CMA areas */
@@ -1341,7 +1340,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone,
#define ALLOC_KSWAPD 0x800 /* allow waking of kswapd, __GFP_KSWAPD_RECLAIM set */
/* Flags that allow allocations below the min watermark. */
-#define ALLOC_RESERVES (ALLOC_NON_BLOCK|ALLOC_MIN_RESERVE|ALLOC_HIGHATOMIC|ALLOC_OOM)
+#define ALLOC_RESERVES (ALLOC_MIN_RESERVE|ALLOC_HIGHATOMIC|ALLOC_OOM)
/* Flags that mean GFP_ATOMIC */
#define ALLOC_MASK_ATOMIC (ALLOC_NON_BLOCK|ALLOC_MIN_RESERVE)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 006/990] net: always dissect GSO packets in __virtio_net_hdr_to_skb()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (4 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 005/990] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 007/990] tun: clear stale skb->protocol of NAPI frags skbs Greg Kroah-Hartman
` (846 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Weiming Shi, Eric Dumazet,
Willem de Bruijn, Michael S. Tsirkin, 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 44378d02c5aaae24b60a75fbbb539b4aa4db503d ]
Commit 9e8db5913264 ("net: avoid false positives in untrusted gso
validation") added a '&& skb->network_header' check before flow-dissecting
GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM in
__virtio_net_hdr_to_skb(), because some callers (such as tun_get_user(),
tun_xdp_one(), virtnet_receive_done(), and raw_verify_header()) called
virtio_net_hdr_*_to_skb() before initializing skb->network_header and
skb->dev.
Because __alloc_skb() and __build_skb_around() zero-initialize
skb->network_header to 0 (unlike mac_header and transport_header which
are initialized to ~0U), those four callers always had
skb->network_header == 0 and bypassed flow dissection in
__virtio_net_hdr_to_skb(). More generally, skb->network_header is an
offset from skb->head (where 0 is also a valid offset whenever
skb_headroom(skb) is 0), not a boolean flag.
Whenever the 'if (gso_type && skb->network_header)' branch was skipped,
the fallback 'else if (gso_type)' only pulled nh_min_len + thlen (40 bytes
for TCPv4) without dissecting the packet, without validating ip_proto or
n_proto, and without setting skb->transport_header.
If the packet has a malformed network header, it is not rejected and a
subsequent skb_probe_transport_header() also fails, leaving
skb->transport_header at ~0U (0xffff). Similarly, if an IPv4 packet
carries IP options (ihl > 5) or an IPv6 packet carries extension headers,
pulling only nh_min_len + thlen can leave the TCP header outside
skb->head. In both cases, tcp_hdrlen(skb) in skb_gso_transport_seglen()
reads out-of-bounds:
BUG: KASAN: slab-out-of-bounds in skb_gso_transport_seglen
Read of size 2 by task poc/133
skb_gso_transport_seglen (net/core/gso.c:155)
skb_gso_validate_mac_len (net/core/gso.c:270)
tbf_enqueue (net/sched/sch_tbf.c:260)
dev_qdisc_enqueue (net/core/dev.c:4227)
__dev_queue_xmit (net/core/dev.c:4884)
In addition, checking virtio_net_hdr_match_proto() only inside
'if (!skb->protocol)' before flow dissection both skipped validation when
skb->protocol was pre-set by the caller and rejected VLAN-tagged frames
whose outer L2 protocol is ETH_P_8021Q or ETH_P_8021AD.
Fix this by:
1. Initializing skb->dev and skb->network_header (plus skb->protocol for
IFF_TUN) before virtio_net_hdr_*_to_skb() in tun_get_user(),
tun_xdp_one(), virtnet_receive_done(), and raw_verify_header(). In
tun_get_user(), drop the redundant skb_reset_mac_header(skb) in the
IFF_TUN case since __virtio_net_hdr_to_skb() unconditionally resets
mac_header.
2. Removing '&& skb->network_header' and the unvalidated
'else if (gso_type)' fallback in __virtio_net_hdr_to_skb() so all GSO
packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are flow-dissected, have
their transport header pulled into linear data, and have
skb->transport_header set.
3. Moving the virtio_net_hdr_match_proto() check to after
skb_flow_dissect_flow_keys_basic(), validating keys.basic.n_proto
against hdr_gso_type.
Fixes: 9e8db5913264 ("net: avoid false positives in untrusted gso validation")
Fixes: d5be7f632bad ("net: validate untrusted gso packets without csum offload")
Fixes: 924a9bc362a5 ("net: check if protocol extracted by virtio_net_hdr_set_proto is correct")
Reported-by: Weiming Shi <bestswngs@gmail.com>
Closes: https://lore.kernel.org/netdev/20260927163117.746432-2-bestswngs@gmail.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Link: https://patch.msgid.link/20261001191140.2818991-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/um/drivers/vector_transports.c | 1 +
drivers/net/tun.c | 23 ++++++-----
drivers/net/virtio_net.c | 2 +
include/linux/virtio_net.h | 60 ++++++++++++-----------------
4 files changed, 42 insertions(+), 44 deletions(-)
diff --git a/arch/um/drivers/vector_transports.c b/arch/um/drivers/vector_transports.c
index 0794d23f07cbc..92a127b5d54cb 100644
--- a/arch/um/drivers/vector_transports.c
+++ b/arch/um/drivers/vector_transports.c
@@ -209,6 +209,7 @@ static int raw_verify_header(
if ((vheader->flags & VIRTIO_NET_HDR_F_DATA_VALID) > 0)
return 1;
+ skb_set_network_header(skb, ETH_HLEN);
virtio_net_hdr_to_skb(skb, vheader, virtio_legacy_is_little_endian());
return 0;
}
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index afb02752b257f..7ddb91ede4dad 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1824,12 +1824,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
}
}
- if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) {
- atomic_long_inc(&tun->rx_frame_errors);
- err = -EINVAL;
- goto free_skb;
- }
-
+ skb->dev = tun->dev;
switch (tun->flags & TUN_TYPE_MASK) {
case IFF_TUN:
if (tun->flags & IFF_NO_PI) {
@@ -1854,9 +1849,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
}
}
- skb_reset_mac_header(skb);
+ skb_reset_network_header(skb);
skb->protocol = pi.proto;
- skb->dev = tun->dev;
break;
case IFF_TAP:
if (!pskb_may_pull(skb, ETH_HLEN)) {
@@ -1864,10 +1858,19 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
drop_reason = SKB_DROP_REASON_HDR_TRUNC;
goto drop;
}
- skb->protocol = eth_type_trans(skb, tun->dev);
+ skb_set_network_header(skb, ETH_HLEN);
break;
}
+ if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) {
+ atomic_long_inc(&tun->rx_frame_errors);
+ err = -EINVAL;
+ goto free_skb;
+ }
+
+ if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP)
+ skb->protocol = eth_type_trans(skb, tun->dev);
+
/* copy skb_ubuf_info for callback when skb has no error */
if (zerocopy) {
skb_zcopy_init(skb, msg_control);
@@ -2481,6 +2484,8 @@ static int tun_xdp_one(struct tun_struct *tun,
features = tun_vnet_hdr_guest_features(READ_ONCE(tun->vnet_hdr_sz));
tnl_hdr = (struct virtio_net_hdr_v1_hash_tunnel *)gso;
+ skb->dev = tun->dev;
+ skb_set_network_header(skb, ETH_HLEN);
if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, tnl_hdr)) {
atomic_long_inc(&tun->rx_frame_errors);
kfree_skb(skb);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ea83313caf363..ca0d14df5d79f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2602,6 +2602,8 @@ static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue *
goto frame_err;
}
+ skb->dev = dev;
+ skb_set_network_header(skb, ETH_HLEN);
if (virtio_net_hdr_tnl_to_skb(skb, &hdr->tnl_hdr, vi->rx_tnl,
vi->rx_tnl_csum,
virtio_is_little_endian(vi->vdev))) {
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index c381b916c1b54..d6466f96cdd00 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -111,48 +111,38 @@ static inline int __virtio_net_hdr_to_skb(struct sk_buff *skb,
p_off = nh_min_len + thlen;
if (!pskb_may_pull(skb, p_off))
return -EINVAL;
- } else {
+ } else if (gso_type) {
/* gso packets without NEEDS_CSUM do not set transport_offset.
* probe and drop if does not match one of the above types.
*/
- if (gso_type && skb->network_header) {
- struct flow_keys_basic keys;
-
- if (!skb->protocol) {
- __be16 protocol = dev_parse_header_protocol(skb);
-
- if (!protocol)
- virtio_net_hdr_set_proto(skb, hdr);
- else if (!virtio_net_hdr_match_proto(protocol,
- hdr_gso_type))
- return -EINVAL;
- else
- skb->protocol = protocol;
- }
+ struct flow_keys_basic keys;
+
+ if (!skb->protocol) {
+ skb->protocol = dev_parse_header_protocol(skb);
+ if (!skb->protocol)
+ virtio_net_hdr_set_proto(skb, hdr);
+ }
retry:
- if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
- NULL, 0, 0, 0,
- 0)) {
- /* UFO does not specify ipv4 or 6: try both */
- if (gso_type & SKB_GSO_UDP &&
- skb->protocol == htons(ETH_P_IP)) {
- skb->protocol = htons(ETH_P_IPV6);
- goto retry;
- }
- return -EINVAL;
+ if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
+ NULL, 0, 0, 0,
+ 0)) {
+ /* UFO does not specify ipv4 or 6: try both */
+ if (gso_type & SKB_GSO_UDP &&
+ skb->protocol == htons(ETH_P_IP)) {
+ skb->protocol = htons(ETH_P_IPV6);
+ goto retry;
}
+ return -EINVAL;
+ }
- p_off = keys.control.thoff + thlen;
- if (!pskb_may_pull(skb, p_off) ||
- keys.basic.ip_proto != ip_proto)
- return -EINVAL;
+ p_off = keys.control.thoff + thlen;
+ if (!pskb_may_pull(skb, p_off) ||
+ keys.basic.ip_proto != ip_proto ||
+ !virtio_net_hdr_match_proto(keys.basic.n_proto,
+ hdr_gso_type))
+ return -EINVAL;
- skb_set_transport_header(skb, keys.control.thoff);
- } else if (gso_type) {
- p_off = nh_min_len + thlen;
- if (!pskb_may_pull(skb, p_off))
- return -EINVAL;
- }
+ skb_set_transport_header(skb, keys.control.thoff);
}
if (hdr_gso_type != VIRTIO_NET_HDR_GSO_NONE) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 007/990] tun: clear stale skb->protocol of NAPI frags skbs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (5 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 006/990] net: always dissect GSO packets in __virtio_net_hdr_to_skb() Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 008/990] net: virtio: validate outer protocol of UDP tunnel GSO packets Greg Kroah-Hartman
` (845 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Willem de Bruijn,
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 3287cd714a853d9443c4a743eca010aedcfbbcdd ]
With IFF_NAPI_FRAGS, tun_napi_alloc_frags() gets its skb from
napi_get_frags(). If GRO merged the previous frame with
GRO_MERGED_FREE, that skb was recycled by napi_reuse_skb(), which does
not reset skb->protocol set by napi_frags_skb() for the previous frame.
tun_get_user() calls tun_vnet_hdr_tnl_to_skb() before eth_type_trans(),
so the virtio header checks see the protocol of the previous frame:
GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are dissected with the
wrong protocol. A following change checks the outer protocol of UDP
tunnel GSO packets, which would then reject a valid frame when the two
ethertypes differ.
This needs GRO to hold packets across writes, and IFF_NAPI_FRAGS needs
CAP_NET_ADMIN.
Clear skb->protocol in tun_napi_alloc_frags(), like skbs allocated
by tun_alloc_skb() or build_skb(). eth_type_trans() sets it later.
Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179386753589.488856.11455181721004759454@kernel.org/
Suggested-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261110213628.3476051-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7ddb91ede4dad..20fbd2d60191b 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1419,6 +1419,12 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile,
if (!skb)
return ERR_PTR(-ENOMEM);
+ /* An skb recycled by napi_reuse_skb() keeps the protocol of a
+ * previous frame. eth_type_trans() sets it after the virtio
+ * header checks, which must not see a stale one.
+ */
+ skb->protocol = 0;
+
linear = iov_iter_single_seg_count(it);
err = __skb_grow(skb, linear);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 008/990] net: virtio: validate outer protocol of UDP tunnel GSO packets
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (6 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 007/990] tun: clear stale skb->protocol of NAPI frags skbs Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 009/990] soundwire: dmi-quirks: add Lenovo Yoga Slim 7i 14IPH11 Greg Kroah-Hartman
` (844 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hassan Sultan, Willem de Bruijn,
Michael S. Tsirkin, 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 73e08d50eb139e7329032c89a4cb105cf43ef278 ]
virtio_net_hdr_tnl_to_skb() trusts the virtio header to describe a
UDP tunnel over IPv4 or IPv6, but never checks that the frame actually
carries such outer headers. Because VIRTIO_NET_HDR_F_NEEDS_CSUM is
mandatory for tunnel GSO, __virtio_net_hdr_to_skb() skips the flow
dissector, so virtio_net_hdr_match_proto() is never applied either.
A guest (or a tap writer) can then inject a frame with an arbitrary
outer ethertype, for example ETH_P_NSH, with SKB_GSO_UDP_TUNNEL set.
The GSO stack then runs nsh_gso_segment() on top of the UDP tunnel
segmentation, which assumes a different header layout. The result is
segments with skb->data before skb->head, and a host crash in
skb_under_panic() as soon as a later layer pushes a header:
skbuff: skb_under_panic: ... put:4 ... dev:gretap1
kernel BUG at net/core/skbuff.c:215!
skb_push
__gre_xmit
gre_tap_xmit
...
tun_get_user
Validate the outer headers with the parsing helpers from Michael's
series "net: resolve uncommon partial checksums at ingress":
- locate the L3 header: Ethernet with optional VLAN tags, or the
network header set by the caller. skb->protocol is not trusted when
it disagrees with the frame.
- require the outer L3 protocol to match the declared tunnel type.
- require the outer UDP header exactly at outer_th_offset, after IPv4
options or IPv6 extension headers, and reject fragments.
Unlike the original helpers:
- the callers tell whether the frame starts with an Ethernet header,
with a new has_eth argument of virtio_net_hdr_tnl_to_skb(), instead
of using the device type. tun frames packets from its IFF_TAP and
IFF_TUN flags, and TUNSETLINK can set the device type to any value.
virtio_net and tun_xdp_one() always pass true, tun_get_user() passes
whether the device is IFF_TAP.
- ipv6_find_hdr() stops at an AH header, as Willem suggested in the
review of that series.
Fixes: a2fb4bc4e2a6 ("net: implement virtio helpers to handle UDP GSO tunneling.")
Reported-by: Hassan Sultan <hassansultan@google.com>
Suggested-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/netdev/93d0e37c99711bebdf60c120af03010455c2f2e2.1793276116.git.mst@redhat.com/
Co-developed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261110213628.3476051-4-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 9 +-
drivers/net/tun_vnet.h | 5 +-
drivers/net/virtio_net.c | 2 +-
include/linux/virtio_net.h | 169 +++++++++++++++++++++++++++++++++++++
4 files changed, 180 insertions(+), 5 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 20fbd2d60191b..51b598d53f5bf 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1868,7 +1868,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
break;
}
- if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) {
+ if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr,
+ (tun->flags & TUN_TYPE_MASK) == IFF_TAP)) {
atomic_long_inc(&tun->rx_frame_errors);
err = -EINVAL;
goto free_skb;
@@ -2492,7 +2493,11 @@ static int tun_xdp_one(struct tun_struct *tun,
tnl_hdr = (struct virtio_net_hdr_v1_hash_tunnel *)gso;
skb->dev = tun->dev;
skb_set_network_header(skb, ETH_HLEN);
- if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, tnl_hdr)) {
+ /* Frames always start with an Ethernet header here, as the
+ * eth_type_trans() call below expects.
+ */
+ if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, tnl_hdr,
+ true)) {
atomic_long_inc(&tun->rx_frame_errors);
kfree_skb(skb);
ret = -EINVAL;
diff --git a/drivers/net/tun_vnet.h b/drivers/net/tun_vnet.h
index fa5cab9d3e55c..7fff1ae89cacb 100644
--- a/drivers/net/tun_vnet.h
+++ b/drivers/net/tun_vnet.h
@@ -197,9 +197,10 @@ static inline netdev_features_t tun_vnet_hdr_guest_features(int vnet_hdr_sz)
static inline int
tun_vnet_hdr_tnl_to_skb(unsigned int flags, netdev_features_t features,
struct sk_buff *skb,
- const struct virtio_net_hdr_v1_hash_tunnel *hdr)
+ const struct virtio_net_hdr_v1_hash_tunnel *hdr,
+ bool has_eth)
{
- return virtio_net_hdr_tnl_to_skb(skb, hdr,
+ return virtio_net_hdr_tnl_to_skb(skb, hdr, has_eth,
features & NETIF_F_GSO_UDP_TUNNEL,
features & NETIF_F_GSO_UDP_TUNNEL_CSUM,
tun_vnet_is_little_endian(flags));
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ca0d14df5d79f..59da65040d047 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2604,7 +2604,7 @@ static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue *
skb->dev = dev;
skb_set_network_header(skb, ETH_HLEN);
- if (virtio_net_hdr_tnl_to_skb(skb, &hdr->tnl_hdr, vi->rx_tnl,
+ if (virtio_net_hdr_tnl_to_skb(skb, &hdr->tnl_hdr, true, vi->rx_tnl,
vi->rx_tnl_csum,
virtio_is_little_endian(vi->vdev))) {
net_warn_ratelimited("%s: bad gso: type: %x, size: %u, flags %x tunnel %d tnl csum %d\n",
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index d6466f96cdd00..b7b6b542f4763 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -5,7 +5,10 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
+#include <linux/netdevice.h>
#include <linux/udp.h>
+#include <net/ip.h>
+#include <net/ipv6.h>
#include <net/tcp.h>
#include <uapi/linux/tcp.h>
#include <uapi/linux/virtio_net.h>
@@ -48,6 +51,145 @@ static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
return 0;
}
+/* TODO: nothing virtio specific here, move to ip.h */
+
+/*
+ * Pull and minimally validate the IPv4 header at @nhoff.
+ * Returns the header and stores the transport header offset in
+ * @thoff, or NULL if truncated or malformed. The whole header,
+ * options included, is guaranteed linear on return.
+ */
+static inline struct iphdr *virtio_net_ip4_parse(struct sk_buff *skb,
+ unsigned int nhoff,
+ unsigned int *thoff)
+{
+ unsigned int ihl;
+ struct iphdr *iph;
+
+ if (!pskb_may_pull(skb, nhoff + sizeof(struct iphdr)))
+ return NULL;
+
+ iph = (struct iphdr *)(skb->data + nhoff);
+ if (iph->version != 4 ||
+ iph->ihl < sizeof(struct iphdr) / sizeof(u32))
+ return NULL;
+
+ ihl = iph->ihl * sizeof(u32);
+ *thoff = nhoff + ihl;
+ /* Pull the options as well: the transport header offset
+ * returned above must be within the linear data. iph goes
+ * stale across the pull.
+ */
+ if (!pskb_may_pull(skb, nhoff + ihl))
+ return NULL;
+
+ return (struct iphdr *)(skb->data + nhoff);
+}
+
+/* Where does the L3 header start, and what protocol is it?
+ * With @has_eth, the frame starts with an Ethernet header, possibly
+ * followed by VLAN tags. Otherwise the L3 header starts at the network
+ * header offset the caller set up.
+ *
+ * The caller knows how the frame will be parsed later: the device
+ * type does not tell, as tun can change it with TUNSETLINK.
+ */
+static inline bool
+virtio_net_l3_start(struct sk_buff *skb, bool has_eth, int *nhoff,
+ __be16 *proto)
+{
+ if (has_eth) {
+ __be16 h_proto;
+
+ if (!pskb_may_pull(skb, ETH_HLEN))
+ return false;
+ h_proto = eth_hdr(skb)->h_proto;
+ /* skb->protocol is a sender claim, and parts of the
+ * stack parse the packet per it: when it disagrees with
+ * the frame we do not know which view the packet will
+ * be parsed as, so do not validate.
+ */
+ if (skb->protocol && skb->protocol != h_proto)
+ return false;
+ *nhoff = ETH_HLEN;
+ *proto = h_proto;
+ if (eth_type_vlan(*proto)) {
+ *proto = __vlan_get_protocol(skb, *proto, nhoff);
+ if (!*proto)
+ return false;
+ }
+ } else {
+ const struct iphdr *iph;
+
+ *nhoff = skb_network_offset(skb);
+ /* An unset network header shows up as an offset
+ * outside of the packet.
+ */
+ if (*nhoff < 0 || (unsigned int)*nhoff >= skb->len)
+ return false;
+ /* No L2 header to cross-check with: take the protocol
+ * from the IP version at the network header.
+ */
+ if (!pskb_may_pull(skb, *nhoff + 1))
+ return false;
+ iph = (const struct iphdr *)(skb->data + *nhoff);
+ if (iph->version == 4)
+ *proto = htons(ETH_P_IP);
+ else if (iph->version == 6)
+ *proto = htons(ETH_P_IPV6);
+ else
+ return false;
+ if (skb->protocol && skb->protocol != *proto)
+ return false;
+ }
+ return true;
+}
+
+/* Walk the L3 header at @nhoff: where does its transport header
+ * start, and which protocol is it? Returns false if the header
+ * is truncated, malformed or fragmented.
+ */
+static inline bool
+virtio_net_l4_start(struct sk_buff *skb, unsigned int nhoff, __be16 proto,
+ unsigned int *thoff, int *ip_proto)
+{
+ if (proto == htons(ETH_P_IP)) {
+ const struct iphdr *iph = virtio_net_ip4_parse(skb, nhoff, thoff);
+
+ if (!iph || ip_is_fragment(iph))
+ return false;
+ *ip_proto = iph->protocol;
+ return true;
+ }
+
+ if (proto == htons(ETH_P_IPV6)) {
+ const struct ipv6hdr *iph;
+ int flags = IP6_FH_F_AUTH;
+
+ if (!pskb_may_pull(skb, nhoff + sizeof(*iph)))
+ return false;
+ iph = (const void *)(skb->data + nhoff);
+ if (iph->version != 6)
+ return false;
+ *thoff = nhoff + sizeof(*iph);
+ *ip_proto = iph->nexthdr;
+ if (*ip_proto != IPPROTO_TCP && *ip_proto != IPPROTO_UDP) {
+ *thoff = nhoff;
+ /* Find the transport header behind any
+ * extension headers. IP6_FH_F_AUTH stops
+ * the walk at AH, so frames with AH are rejected.
+ */
+ *ip_proto = ipv6_find_hdr(skb, thoff, -1, NULL,
+ &flags);
+ if (*ip_proto < 0 || flags & IP6_FH_F_FRAG)
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
static inline int __virtio_net_hdr_to_skb(struct sk_buff *skb,
const struct virtio_net_hdr *hdr,
bool little_endian, u8 hdr_gso_type)
@@ -282,9 +424,33 @@ static inline unsigned int virtio_l3min(bool is_ipv6)
return is_ipv6 ? sizeof(struct ipv6hdr) : sizeof(struct iphdr);
}
+/* Do the tunnel offsets match the outer headers in the frame?
+ * The L3 header the tunnel claims must be the one the frame
+ * carries, with UDP following it at @outer_th.
+ */
+static inline bool
+virtio_net_tnl_offsets_ok(struct sk_buff *skb, bool has_eth, bool outer_isv6,
+ unsigned int outer_th)
+{
+ int nhoff;
+ __be16 proto;
+ unsigned int thoff;
+ int ip_proto;
+
+ if (!virtio_net_l3_start(skb, has_eth, &nhoff, &proto))
+ return false;
+ if (outer_isv6 != (proto == htons(ETH_P_IPV6)))
+ return false;
+ if (!virtio_net_l4_start(skb, nhoff, proto, &thoff, &ip_proto))
+ return false;
+
+ return ip_proto == IPPROTO_UDP && outer_th == thoff;
+}
+
static inline int
virtio_net_hdr_tnl_to_skb(struct sk_buff *skb,
const struct virtio_net_hdr_v1_hash_tunnel *vhdr,
+ bool has_eth,
bool tnl_hdr_negotiated,
bool tnl_csum_negotiated,
bool little_endian)
@@ -338,6 +504,9 @@ virtio_net_hdr_tnl_to_skb(struct sk_buff *skb,
if (ret)
return ret;
+ if (!virtio_net_tnl_offsets_ok(skb, has_eth, outer_isv6, outer_th))
+ return -EINVAL;
+
/* In case of USO, the inner protocol is still unknown and
* `inner_isv6` is just a guess, additional parsing is needed.
* The previous validation ensures that accessing an ipv4 inner
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 009/990] soundwire: dmi-quirks: add Lenovo Yoga Slim 7i 14IPH11
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (7 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 008/990] net: virtio: validate outer protocol of UDP tunnel GSO packets Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 010/990] soundwire: dmi-quirks: Disable ghost Realtek on Lenovo Pro 9 Greg Kroah-Hartman
` (843 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sataporn Saijai, Bard Liao,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sataporn Saijai <excursively@gmail.com>
[ Upstream commit c3133906d5bda343bd5c1d8ad63074a14506ad72 ]
The Lenovo Yoga Slim 7i 14IPH11 (DMI product 83QM) declares an RT722 on
link 3 that is not actually present and never attaches, leaving the
machine with no audio. Since the address is already handled by the
ghost_realtek table, only the DMI match is needed.
Signed-off-by: Sataporn Saijai <excursively@gmail.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20260818182020.143096-1-excursively@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/soundwire/dmi-quirks.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/soundwire/dmi-quirks.c b/drivers/soundwire/dmi-quirks.c
index 768255dd12db6..e49325331b3df 100644
--- a/drivers/soundwire/dmi-quirks.c
+++ b/drivers/soundwire/dmi-quirks.c
@@ -214,6 +214,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = {
},
.driver_data = (void *)ghost_realtek,
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "83QM"),
+ },
+ .driver_data = (void *)ghost_realtek,
+ },
{
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 010/990] soundwire: dmi-quirks: Disable ghost Realtek on Lenovo Pro 9
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (8 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 009/990] soundwire: dmi-quirks: add Lenovo Yoga Slim 7i 14IPH11 Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 011/990] soundwire: dmi-quirks: drop the ghost RT1320 on the Surface Pro 11 (Intel) Greg Kroah-Hartman
` (842 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Charles Keepax, Vinod Koul,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <ckeepax@opensource.cirrus.com>
[ Upstream commit a6a867552a36e647cbd35aceae24754c9bcd3661 ]
The Lenovo Pro 9 also has a Realtek device in the ACPI that
doesn't exist in the physical hardware. This confuses the machine
driver into attempting to create DAI links for the device. Add a
quirk to remove this device.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260903102743.3782541-1-ckeepax@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/soundwire/dmi-quirks.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/soundwire/dmi-quirks.c b/drivers/soundwire/dmi-quirks.c
index e49325331b3df..72e59b50b6853 100644
--- a/drivers/soundwire/dmi-quirks.c
+++ b/drivers/soundwire/dmi-quirks.c
@@ -235,6 +235,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = {
},
.driver_data = (void *)ghost_realtek,
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "83U9"),
+ },
+ .driver_data = (void *)ghost_realtek,
+ },
{}
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 011/990] soundwire: dmi-quirks: drop the ghost RT1320 on the Surface Pro 11 (Intel)
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (9 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 010/990] soundwire: dmi-quirks: Disable ghost Realtek on Lenovo Pro 9 Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 012/990] libceph: generalize ceph_x_encrypt_offset() and ceph_x_encrypt_buflen() Greg Kroah-Hartman
` (841 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pierre-Louis Bossart, Bard Liao,
Sergey Lebedev, German Pablo Lindo, Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Lebedev <lsa.uz@pm.me>
[ Upstream commit d32e04c052342d7d1cc03f6ba4cbd135cd0112bc ]
The Microsoft Surface Pro 11 for Business (Intel, Lunar Lake) carries a
single physical RT1320 amplifier on link 0 and describes it twice:
SWRA _ADR 0x000030025D132000 SDCA class 0
SWRB _ADR 0x000030025D132001 SDCA class 1
Identical apart from the class id: same link, same manufacturer, part and
version, same unique id 0. The part reports class 1, so only SWRB
enumerates. SWRA never attaches on any boot or firmware version tested,
including the November 2025 bundle.
The ghost is not harmless. It consumes an amplifier index in
find_acpi_adr_device(), so the real part is named "rt1320-2" and the stock
sof-soundwire UCM profile enables switches on a device that is not there.
Its endpoints also reach create_sdw_dailink(), which builds DAI link names
from link id and function type alone; the ghost declares the same SmartMic
function as the real part, so the card fails to register at all:
sysfs: cannot create duplicate filename
'.../sof_sdw/SDW0-Capture-SmartMic'
kobject_add_internal failed for SDW0-Capture-SmartMic with -EEXIST
sof_sdw sof_sdw: probe with driver sof_sdw failed with error -12
Remap its _ADR to zero so sdw_acpi_find_slaves() never creates the
peripheral, which is how ghost devices are handled already - see
ghost_realtek and global_ghost_adr in this file. Both failures then
disappear, because neither path is reached.
Matched on DMI_PRODUCT_SKU rather than the product name. A later batch of
the same model could carry a different RT1320 version, which would change
the _ADR; keying on the SKU keeps this remap to the hardware it was
verified on, and follows dell_sku_0A3E above.
Link: https://lore.kernel.org/linux-sound/20260830151516.44629-1-lsa.uz@pm.me/
Suggested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Suggested-by: Bard Liao <bard.liao@intel.com>
Signed-off-by: Sergey Lebedev <lsa.uz@pm.me>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Tested-by: German Pablo Lindo <germanpapulindez@gmail.com>
Link: https://patch.msgid.link/20260913210849.6446-1-lsa.uz@pm.me
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/soundwire/dmi-quirks.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/soundwire/dmi-quirks.c b/drivers/soundwire/dmi-quirks.c
index 72e59b50b6853..f9183e0e63bfa 100644
--- a/drivers/soundwire/dmi-quirks.c
+++ b/drivers/soundwire/dmi-quirks.c
@@ -111,6 +111,25 @@ static const struct adr_remap ghost_realtek[] = {
{}
};
+/*
+ * The Microsoft Surface Pro 11 (Intel) describes its single physical RT1320
+ * amplifier twice on link 0, as two _ADR entries differing only in SDCA class
+ * id and sharing the same unique id. Only the class 1 entry enumerates; the
+ * class 0 entry is a ghost.
+ *
+ * Matched on the product SKU rather than the product name: a later batch of the
+ * same model could carry a different RT1320 version, which would change the
+ * _ADR. Keying on the SKU keeps this remap to the hardware it was verified on.
+ */
+static const struct adr_remap microsoft_sp11_intel[] = {
+ /* ghost rt1320 on link0 */
+ {
+ 0x000030025d132000ull,
+ 0x0000000000000000ull
+ },
+ {}
+};
+
static const struct dmi_system_id adr_remap_quirk_table[] = {
/* TGL devices */
{
@@ -242,6 +261,15 @@ static const struct dmi_system_id adr_remap_quirk_table[] = {
},
.driver_data = (void *)ghost_realtek,
},
+ /* LNL devices */
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU,
+ "Surface_Pro_11th_Edition_With_Intel_For_Business_2103")
+ },
+ .driver_data = (void *)microsoft_sp11_intel,
+ },
{}
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 012/990] libceph: generalize ceph_x_encrypt_offset() and ceph_x_encrypt_buflen()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (10 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 011/990] soundwire: dmi-quirks: drop the ghost RT1320 on the Surface Pro 11 (Intel) Greg Kroah-Hartman
@ 2026-11-25 14:22 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 013/990] libceph: introduce ceph_crypto_key_prepare() Greg Kroah-Hartman
` (840 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:22 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilya Dryomov, Jordan DESNOËS,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <idryomov@gmail.com>
commit 0ee8bccf7396d50726c9c8dd3135fb64a9fe8426 upstream.
- introduce the notion of a data offset for ceph_x_encrypt_offset()
to allow for e.g. confounder to be prepended before the encryption
header in the future. For CEPH_CRYPTO_AES, the data offset is 0
(i.e. nothing is prepended).
- adjust ceph_x_encrypt_buflen() accordingly and make it account for
PKCS#7 padding that is used by CEPH_CRYPTO_AES precisely instead of
just always adding 16.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
[ Jordan: resolve conflict with 821365487aa5 in __ceph_x_decrypt() ]
Signed-off-by: Jordan DESNOËS <jordan.desnoes@francetv.fr>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ceph/auth_x.c | 44 +++++++++++++++++++++++++++++---------------
net/ceph/crypto.c | 25 +++++++++++++++++++++++++
net/ceph/crypto.h | 2 ++
3 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index f805a813308fd..d1c7b78808279 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -44,23 +44,35 @@ static int ceph_x_should_authenticate(struct ceph_auth_client *ac)
return !!need;
}
-static int ceph_x_encrypt_offset(void)
+static int __ceph_x_encrypt_offset(const struct ceph_crypto_key *key)
{
- return sizeof(u32) + sizeof(struct ceph_x_encrypt_header);
+ return ceph_crypt_data_offset(key) +
+ sizeof(struct ceph_x_encrypt_header);
}
-static int ceph_x_encrypt_buflen(int ilen)
+static int ceph_x_encrypt_offset(const struct ceph_crypto_key *key)
{
- return ceph_x_encrypt_offset() + ilen + 16;
+ return sizeof(u32) + __ceph_x_encrypt_offset(key);
+}
+
+/*
+ * AES: ciphertext_len | hdr | data... | padding
+ */
+static int ceph_x_encrypt_buflen(const struct ceph_crypto_key *key,
+ int data_len)
+{
+ int encrypt_len = sizeof(struct ceph_x_encrypt_header) + data_len;
+ return sizeof(u32) + ceph_crypt_buflen(key, encrypt_len);
}
static int ceph_x_encrypt(struct ceph_crypto_key *secret, void *buf,
int buf_len, int plaintext_len)
{
- struct ceph_x_encrypt_header *hdr = buf + sizeof(u32);
+ struct ceph_x_encrypt_header *hdr;
int ciphertext_len;
int ret;
+ hdr = buf + sizeof(u32) + ceph_crypt_data_offset(secret);
hdr->struct_v = 1;
hdr->magic = cpu_to_le64(CEPHX_ENC_MAGIC);
@@ -77,7 +89,7 @@ static int ceph_x_encrypt(struct ceph_crypto_key *secret, void *buf,
static int __ceph_x_decrypt(struct ceph_crypto_key *secret, void *p,
int ciphertext_len)
{
- struct ceph_x_encrypt_header *hdr = p;
+ struct ceph_x_encrypt_header *hdr;
int plaintext_len;
int ret;
@@ -91,6 +103,7 @@ static int __ceph_x_decrypt(struct ceph_crypto_key *secret, void *p,
return -EINVAL;
}
+ hdr = p + ceph_crypt_data_offset(secret);
if (le64_to_cpu(hdr->magic) != CEPHX_ENC_MAGIC) {
pr_err("%s bad magic\n", __func__);
return -EINVAL;
@@ -198,7 +211,7 @@ static int process_one_ticket(struct ceph_auth_client *ac,
}
/* blob for me */
- dp = *p + ceph_x_encrypt_offset();
+ dp = *p + ceph_x_encrypt_offset(secret);
ret = ceph_x_decrypt(secret, p, end);
if (ret < 0)
goto out;
@@ -225,7 +238,7 @@ static int process_one_ticket(struct ceph_auth_client *ac,
ceph_decode_8_safe(p, end, is_enc, bad);
if (is_enc) {
/* encrypted */
- tp = *p + ceph_x_encrypt_offset();
+ tp = *p + ceph_x_encrypt_offset(&th->session_key);
ret = ceph_x_decrypt(&th->session_key, p, end);
if (ret < 0)
goto out;
@@ -317,7 +330,7 @@ static int encrypt_authorizer(struct ceph_x_authorizer *au,
p = (void *)(msg_a + 1) + le32_to_cpu(msg_a->ticket_blob.blob_len);
end = au->buf->vec.iov_base + au->buf->vec.iov_len;
- msg_b = p + ceph_x_encrypt_offset();
+ msg_b = p + ceph_x_encrypt_offset(&au->session_key);
msg_b->struct_v = 2;
msg_b->nonce = cpu_to_le64(au->nonce);
if (server_challenge) {
@@ -373,7 +386,7 @@ static int ceph_x_build_authorizer(struct ceph_auth_client *ac,
goto out_au;
maxlen = sizeof(*msg_a) + ticket_blob_len +
- ceph_x_encrypt_buflen(sizeof(*msg_b));
+ ceph_x_encrypt_buflen(&au->session_key, sizeof(*msg_b));
dout(" need len %d\n", maxlen);
if (au->buf && au->buf->alloc_len < maxlen) {
ceph_buffer_put(au->buf);
@@ -512,7 +525,7 @@ static int ceph_x_build_request(struct ceph_auth_client *ac,
struct ceph_x_authenticate *auth = (void *)(head + 1);
void *enc_buf = xi->auth_authorizer.enc_buf;
struct ceph_x_challenge_blob *blob = enc_buf +
- ceph_x_encrypt_offset();
+ ceph_x_encrypt_offset(&xi->secret);
u64 *u;
p = auth + 1;
@@ -639,7 +652,7 @@ static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id,
ceph_decode_need(p, end, len, e_inval);
dout("%s connection secret blob len %d\n", __func__, len);
if (len > 0) {
- dp = *p + ceph_x_encrypt_offset();
+ dp = *p + ceph_x_encrypt_offset(&th->session_key);
ret = ceph_x_decrypt(&th->session_key, p, *p + len);
if (ret < 0)
return ret;
@@ -816,7 +829,7 @@ static int decrypt_authorizer_challenge(struct ceph_crypto_key *secret,
return ret;
dout("%s decrypted %d bytes\n", __func__, ret);
- dp = challenge + sizeof(struct ceph_x_encrypt_header);
+ dp = challenge + __ceph_x_encrypt_offset(secret);
dend = dp + ret;
ceph_decode_skip_8(&dp, dend, e_inval); /* struct_v */
@@ -863,7 +876,7 @@ static int decrypt_authorizer_reply(struct ceph_crypto_key *secret,
u8 struct_v;
int ret;
- dp = *p + ceph_x_encrypt_offset();
+ dp = *p + ceph_x_encrypt_offset(secret);
ret = ceph_x_decrypt(secret, p, end);
if (ret < 0)
return ret;
@@ -986,7 +999,8 @@ static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
__le32 front_crc;
__le32 middle_crc;
__le32 data_crc;
- } __packed *sigblock = enc_buf + ceph_x_encrypt_offset();
+ } __packed *sigblock = enc_buf +
+ ceph_x_encrypt_offset(&au->session_key);
sigblock->len = cpu_to_le32(4*sizeof(u32));
sigblock->header_crc = msg->hdr.crc;
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 5601732cf4faa..2b98daffe9af7 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -285,6 +285,31 @@ int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
}
}
+int ceph_crypt_data_offset(const struct ceph_crypto_key *key)
+{
+ switch (key->type) {
+ case CEPH_CRYPTO_NONE:
+ case CEPH_CRYPTO_AES:
+ return 0;
+ default:
+ BUG();
+ }
+}
+
+int ceph_crypt_buflen(const struct ceph_crypto_key *key, int data_len)
+{
+ switch (key->type) {
+ case CEPH_CRYPTO_NONE:
+ return data_len;
+ case CEPH_CRYPTO_AES:
+ /* PKCS#7 padding at the end */
+ return data_len + AES_BLOCK_SIZE -
+ (data_len & (AES_BLOCK_SIZE - 1));
+ default:
+ BUG();
+ }
+}
+
static int ceph_key_preparse(struct key_preparsed_payload *prep)
{
struct ceph_crypto_key *ckey;
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h
index a20bad6d1e964..736ec6d2fbcb2 100644
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -28,6 +28,8 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
/* crypto.c */
int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
void *buf, int buf_len, int in_len, int *pout_len);
+int ceph_crypt_data_offset(const struct ceph_crypto_key *key);
+int ceph_crypt_buflen(const struct ceph_crypto_key *key, int data_len);
int ceph_crypto_init(void);
void ceph_crypto_shutdown(void);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 013/990] libceph: introduce ceph_crypto_key_prepare()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (11 preceding siblings ...)
2026-11-25 14:22 ` [PATCH 6.18 012/990] libceph: generalize ceph_x_encrypt_offset() and ceph_x_encrypt_buflen() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 014/990] libceph: add support for CEPH_CRYPTO_AES256KRB5 Greg Kroah-Hartman
` (839 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilya Dryomov, Jordan DESNOËS,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <idryomov@gmail.com>
commit 6cec0b61aacce4da5125b21c718189f0dc11eb51 upstream.
In preparation for bringing in a new encryption scheme/key type,
decouple decoding or cloning the key from allocating required crypto
API objects and setting them up. The rationale is that a) in some
cases a shallow clone is sufficient and b) ceph_crypto_key_prepare()
may grow additional parameters that would be inconvenient to provide
at the point the key is originally decoded.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Jordan DESNOËS <jordan.desnoes@francetv.fr>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ceph/auth_x.c | 26 +++++++++++++----
net/ceph/crypto.c | 71 +++++++++++++++++++++++------------------------
net/ceph/crypto.h | 1 +
3 files changed, 56 insertions(+), 42 deletions(-)
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index d1c7b78808279..a23e0e2b8011d 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -226,6 +226,10 @@ static int process_one_ticket(struct ceph_auth_client *ac,
if (ret)
goto out;
+ ret = ceph_crypto_key_prepare(&new_session_key);
+ if (ret)
+ goto out;
+
ceph_decode_need(&dp, dend, sizeof(struct ceph_timespec), bad);
ceph_decode_timespec64(&validity, dp);
dp += sizeof(struct ceph_timespec);
@@ -385,6 +389,10 @@ static int ceph_x_build_authorizer(struct ceph_auth_client *ac,
if (ret)
goto out_au;
+ ret = ceph_crypto_key_prepare(&au->session_key);
+ if (ret)
+ goto out_au;
+
maxlen = sizeof(*msg_a) + ticket_blob_len +
ceph_x_encrypt_buflen(&au->session_key, sizeof(*msg_b));
dout(" need len %d\n", maxlen);
@@ -1118,21 +1126,26 @@ int ceph_x_init(struct ceph_auth_client *ac)
int ret;
dout("ceph_x_init %p\n", ac);
- ret = -ENOMEM;
xi = kzalloc(sizeof(*xi), GFP_NOFS);
if (!xi)
- goto out;
+ return -ENOMEM;
ret = -EINVAL;
if (!ac->key) {
pr_err("no secret set (for auth_x protocol)\n");
- goto out_nomem;
+ goto err_xi;
}
ret = ceph_crypto_key_clone(&xi->secret, ac->key);
if (ret < 0) {
pr_err("cannot clone key: %d\n", ret);
- goto out_nomem;
+ goto err_xi;
+ }
+
+ ret = ceph_crypto_key_prepare(&xi->secret);
+ if (ret) {
+ pr_err("cannot prepare key: %d\n", ret);
+ goto err_secret;
}
xi->starting = true;
@@ -1143,8 +1156,9 @@ int ceph_x_init(struct ceph_auth_client *ac)
ac->ops = &ceph_x_ops;
return 0;
-out_nomem:
+err_secret:
+ ceph_crypto_key_destroy(&xi->secret);
+err_xi:
kfree(xi);
-out:
return ret;
}
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 2b98daffe9af7..3453dc3033156 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -16,65 +16,61 @@
#include <linux/ceph/decode.h>
#include "crypto.h"
-/*
- * Set ->key and ->tfm. The rest of the key should be filled in before
- * this function is called.
- */
-static int set_secret(struct ceph_crypto_key *key, void *buf)
+static int set_aes_tfm(struct ceph_crypto_key *key)
{
unsigned int noio_flag;
int ret;
- key->key = NULL;
- key->tfm = NULL;
-
- switch (key->type) {
- case CEPH_CRYPTO_NONE:
- return 0; /* nothing to do */
- case CEPH_CRYPTO_AES:
- break;
- default:
- return -ENOTSUPP;
- }
-
- key->key = kmemdup(buf, key->len, GFP_NOIO);
- if (!key->key) {
- ret = -ENOMEM;
- goto fail;
- }
-
- /* crypto_alloc_sync_skcipher() allocates with GFP_KERNEL */
noio_flag = memalloc_noio_save();
key->tfm = crypto_alloc_sync_skcipher("cbc(aes)", 0, 0);
memalloc_noio_restore(noio_flag);
if (IS_ERR(key->tfm)) {
ret = PTR_ERR(key->tfm);
key->tfm = NULL;
- goto fail;
+ return ret;
}
ret = crypto_sync_skcipher_setkey(key->tfm, key->key, key->len);
if (ret)
- goto fail;
+ return ret;
return 0;
+}
-fail:
- ceph_crypto_key_destroy(key);
- return ret;
+int ceph_crypto_key_prepare(struct ceph_crypto_key *key)
+{
+ switch (key->type) {
+ case CEPH_CRYPTO_NONE:
+ return 0; /* nothing to do */
+ case CEPH_CRYPTO_AES:
+ return set_aes_tfm(key);
+ default:
+ return -ENOTSUPP;
+ }
}
+/*
+ * @dst should be zeroed before this function is called.
+ */
int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
const struct ceph_crypto_key *src)
{
- memcpy(dst, src, sizeof(struct ceph_crypto_key));
- return set_secret(dst, src->key);
+ dst->type = src->type;
+ dst->created = src->created;
+ dst->len = src->len;
+
+ dst->key = kmemdup(src->key, src->len, GFP_NOIO);
+ if (!dst->key)
+ return -ENOMEM;
+
+ return 0;
}
+/*
+ * @key should be zeroed before this function is called.
+ */
int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end)
{
- int ret;
-
ceph_decode_need(p, end, 2*sizeof(u16) + sizeof(key->created), bad);
key->type = ceph_decode_16(p);
ceph_decode_copy(p, &key->created, sizeof(key->created));
@@ -85,10 +81,13 @@ int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end)
return -EINVAL;
}
- ret = set_secret(key, *p);
+ key->key = kmemdup(*p, key->len, GFP_NOIO);
+ if (!key->key)
+ return -ENOMEM;
+
memzero_explicit(*p, key->len);
*p += key->len;
- return ret;
+ return 0;
bad:
dout("failed to decode crypto key\n");
@@ -322,7 +321,7 @@ static int ceph_key_preparse(struct key_preparsed_payload *prep)
goto err;
ret = -ENOMEM;
- ckey = kmalloc(sizeof(*ckey), GFP_KERNEL);
+ ckey = kzalloc(sizeof(*ckey), GFP_KERNEL);
if (!ckey)
goto err;
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h
index 736ec6d2fbcb2..2b8f8f68ff7a8 100644
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -19,6 +19,7 @@ struct ceph_crypto_key {
struct crypto_sync_skcipher *tfm;
};
+int ceph_crypto_key_prepare(struct ceph_crypto_key *key);
int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
const struct ceph_crypto_key *src);
int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 014/990] libceph: add support for CEPH_CRYPTO_AES256KRB5
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (12 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 013/990] libceph: introduce ceph_crypto_key_prepare() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 015/990] libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing Greg Kroah-Hartman
` (838 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilya Dryomov, Jordan DESNOËS,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <idryomov@gmail.com>
commit b7cc142dbafeaf6c053284ca9121b9f70b6d6d06 upstream.
This is based on AES256-CTS-HMAC384-192 crypto algorithm per RFC 8009
(i.e. Kerberos 5, hence the name) with custom-defined key usage numbers.
The implementation allows a given key to have/be linked to between one
and three usage numbers.
The existing CEPH_CRYPTO_AES remains in place and unchanged. The
usage_slot parameter that needed to be added to ceph_crypt() and its
wrappers is simply ignored there.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
[ Jordan: resolve conflict with 821365487aa5 in __ceph_x_decrypt() ]
Signed-off-by: Jordan DESNOËS <jordan.desnoes@francetv.fr>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/ceph/ceph_fs.h | 5 +-
net/ceph/Kconfig | 1 +
net/ceph/auth_x.c | 88 ++++++++++++++------
net/ceph/auth_x_protocol.h | 38 +++++++++
net/ceph/crypto.c | 157 +++++++++++++++++++++++++++++++----
net/ceph/crypto.h | 16 +++-
6 files changed, 257 insertions(+), 48 deletions(-)
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 08e5dbe15ca44..69ac3e55a3fe8 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -89,8 +89,9 @@ struct ceph_dir_layout {
} __attribute__ ((packed));
/* crypto algorithms */
-#define CEPH_CRYPTO_NONE 0x0
-#define CEPH_CRYPTO_AES 0x1
+#define CEPH_CRYPTO_NONE 0x0
+#define CEPH_CRYPTO_AES 0x1
+#define CEPH_CRYPTO_AES256KRB5 0x2 /* AES256-CTS-HMAC384-192 */
#define CEPH_AES_IV "cephsageyudagreg"
diff --git a/net/ceph/Kconfig b/net/ceph/Kconfig
index ea60e3ef08343..7e2528cde4b94 100644
--- a/net/ceph/Kconfig
+++ b/net/ceph/Kconfig
@@ -6,6 +6,7 @@ config CEPH_LIB
select CRYPTO_AES
select CRYPTO_CBC
select CRYPTO_GCM
+ select CRYPTO_KRB5
select CRYPTO_LIB_SHA256
select CRYPTO
select KEYS
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index a23e0e2b8011d..966a38264254e 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -17,6 +17,22 @@
#include "auth_x.h"
#include "auth_x_protocol.h"
+static const u32 ticket_key_usages[] = {
+ CEPHX_KEY_USAGE_TICKET_SESSION_KEY,
+ CEPHX_KEY_USAGE_TICKET_BLOB,
+ CEPHX_KEY_USAGE_AUTH_CONNECTION_SECRET
+};
+
+static const u32 authorizer_key_usages[] = {
+ CEPHX_KEY_USAGE_AUTHORIZE,
+ CEPHX_KEY_USAGE_AUTHORIZE_CHALLENGE,
+ CEPHX_KEY_USAGE_AUTHORIZE_REPLY
+};
+
+static const u32 client_key_usages[] = {
+ CEPHX_KEY_USAGE_TICKET_SESSION_KEY
+};
+
static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed);
static int ceph_x_is_authenticated(struct ceph_auth_client *ac)
@@ -57,6 +73,7 @@ static int ceph_x_encrypt_offset(const struct ceph_crypto_key *key)
/*
* AES: ciphertext_len | hdr | data... | padding
+ * AES256KRB5: ciphertext_len | confounder | hdr | data... | hmac
*/
static int ceph_x_encrypt_buflen(const struct ceph_crypto_key *key,
int data_len)
@@ -65,19 +82,19 @@ static int ceph_x_encrypt_buflen(const struct ceph_crypto_key *key,
return sizeof(u32) + ceph_crypt_buflen(key, encrypt_len);
}
-static int ceph_x_encrypt(struct ceph_crypto_key *secret, void *buf,
- int buf_len, int plaintext_len)
+static int ceph_x_encrypt(const struct ceph_crypto_key *key, int usage_slot,
+ void *buf, int buf_len, int plaintext_len)
{
struct ceph_x_encrypt_header *hdr;
int ciphertext_len;
int ret;
- hdr = buf + sizeof(u32) + ceph_crypt_data_offset(secret);
+ hdr = buf + sizeof(u32) + ceph_crypt_data_offset(key);
hdr->struct_v = 1;
hdr->magic = cpu_to_le64(CEPHX_ENC_MAGIC);
- ret = ceph_crypt(secret, true, buf + sizeof(u32), buf_len - sizeof(u32),
- plaintext_len + sizeof(struct ceph_x_encrypt_header),
+ ret = ceph_crypt(key, usage_slot, true, buf + sizeof(u32),
+ buf_len - sizeof(u32), plaintext_len + sizeof(*hdr),
&ciphertext_len);
if (ret)
return ret;
@@ -86,15 +103,15 @@ static int ceph_x_encrypt(struct ceph_crypto_key *secret, void *buf,
return sizeof(u32) + ciphertext_len;
}
-static int __ceph_x_decrypt(struct ceph_crypto_key *secret, void *p,
- int ciphertext_len)
+static int __ceph_x_decrypt(const struct ceph_crypto_key *key, int usage_slot,
+ void *p, int ciphertext_len)
{
struct ceph_x_encrypt_header *hdr;
int plaintext_len;
int ret;
- ret = ceph_crypt(secret, false, p, ciphertext_len, ciphertext_len,
- &plaintext_len);
+ ret = ceph_crypt(key, usage_slot, false, p, ciphertext_len,
+ ciphertext_len, &plaintext_len);
if (ret)
return ret;
@@ -103,7 +120,7 @@ static int __ceph_x_decrypt(struct ceph_crypto_key *secret, void *p,
return -EINVAL;
}
- hdr = p + ceph_crypt_data_offset(secret);
+ hdr = p + ceph_crypt_data_offset(key);
if (le64_to_cpu(hdr->magic) != CEPHX_ENC_MAGIC) {
pr_err("%s bad magic\n", __func__);
return -EINVAL;
@@ -112,7 +129,8 @@ static int __ceph_x_decrypt(struct ceph_crypto_key *secret, void *p,
return plaintext_len - sizeof(*hdr);
}
-static int ceph_x_decrypt(struct ceph_crypto_key *secret, void **p, void *end)
+static int ceph_x_decrypt(const struct ceph_crypto_key *key, int usage_slot,
+ void **p, void *end)
{
int ciphertext_len;
int ret;
@@ -120,7 +138,7 @@ static int ceph_x_decrypt(struct ceph_crypto_key *secret, void **p, void *end)
ceph_decode_32_safe(p, end, ciphertext_len, e_inval);
ceph_decode_need(p, end, ciphertext_len, e_inval);
- ret = __ceph_x_decrypt(secret, *p, ciphertext_len);
+ ret = __ceph_x_decrypt(key, usage_slot, *p, ciphertext_len);
if (ret < 0)
return ret;
@@ -212,7 +230,9 @@ static int process_one_ticket(struct ceph_auth_client *ac,
/* blob for me */
dp = *p + ceph_x_encrypt_offset(secret);
- ret = ceph_x_decrypt(secret, p, end);
+ ret = ceph_x_decrypt(secret,
+ 0 /* CEPHX_KEY_USAGE_TICKET_SESSION_KEY */,
+ p, end);
if (ret < 0)
goto out;
dout(" decrypted %d bytes\n", ret);
@@ -226,7 +246,8 @@ static int process_one_ticket(struct ceph_auth_client *ac,
if (ret)
goto out;
- ret = ceph_crypto_key_prepare(&new_session_key);
+ ret = ceph_crypto_key_prepare(&new_session_key, ticket_key_usages,
+ ARRAY_SIZE(ticket_key_usages));
if (ret)
goto out;
@@ -243,7 +264,9 @@ static int process_one_ticket(struct ceph_auth_client *ac,
if (is_enc) {
/* encrypted */
tp = *p + ceph_x_encrypt_offset(&th->session_key);
- ret = ceph_x_decrypt(&th->session_key, p, end);
+ ret = ceph_x_decrypt(&th->session_key,
+ 1 /* CEPHX_KEY_USAGE_TICKET_BLOB */,
+ p, end);
if (ret < 0)
goto out;
dout(" encrypted ticket, decrypted %d bytes\n", ret);
@@ -346,7 +369,9 @@ static int encrypt_authorizer(struct ceph_x_authorizer *au,
msg_b->server_challenge_plus_one = 0;
}
- ret = ceph_x_encrypt(&au->session_key, p, end - p, sizeof(*msg_b));
+ ret = ceph_x_encrypt(&au->session_key,
+ 0 /* CEPHX_KEY_USAGE_AUTHORIZE */,
+ p, end - p, sizeof(*msg_b));
if (ret < 0)
return ret;
@@ -389,7 +414,8 @@ static int ceph_x_build_authorizer(struct ceph_auth_client *ac,
if (ret)
goto out_au;
- ret = ceph_crypto_key_prepare(&au->session_key);
+ ret = ceph_crypto_key_prepare(&au->session_key, authorizer_key_usages,
+ ARRAY_SIZE(authorizer_key_usages));
if (ret)
goto out_au;
@@ -547,7 +573,8 @@ static int ceph_x_build_request(struct ceph_auth_client *ac,
get_random_bytes(&auth->client_challenge, sizeof(u64));
blob->client_challenge = auth->client_challenge;
blob->server_challenge = cpu_to_le64(xi->server_challenge);
- ret = ceph_x_encrypt(&xi->secret, enc_buf, CEPHX_AU_ENC_BUF_LEN,
+ ret = ceph_x_encrypt(&xi->secret, 0 /* dummy */,
+ enc_buf, CEPHX_AU_ENC_BUF_LEN,
sizeof(*blob));
if (ret < 0)
return ret;
@@ -661,7 +688,9 @@ static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id,
dout("%s connection secret blob len %d\n", __func__, len);
if (len > 0) {
dp = *p + ceph_x_encrypt_offset(&th->session_key);
- ret = ceph_x_decrypt(&th->session_key, p, *p + len);
+ ret = ceph_x_decrypt(&th->session_key,
+ 2 /* CEPHX_KEY_USAGE_AUTH_CONNECTION_SECRET */,
+ p, *p + len);
if (ret < 0)
return ret;
@@ -832,7 +861,9 @@ static int decrypt_authorizer_challenge(struct ceph_crypto_key *secret,
int ret;
/* no leading len */
- ret = __ceph_x_decrypt(secret, challenge, challenge_len);
+ ret = __ceph_x_decrypt(secret,
+ 1 /* CEPHX_KEY_USAGE_AUTHORIZE_CHALLENGE */,
+ challenge, challenge_len);
if (ret < 0)
return ret;
@@ -885,7 +916,8 @@ static int decrypt_authorizer_reply(struct ceph_crypto_key *secret,
int ret;
dp = *p + ceph_x_encrypt_offset(secret);
- ret = ceph_x_decrypt(secret, p, end);
+ ret = ceph_x_decrypt(secret, 2 /* CEPHX_KEY_USAGE_AUTHORIZE_REPLY */,
+ p, end);
if (ret < 0)
return ret;
@@ -1016,8 +1048,9 @@ static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
sigblock->middle_crc = msg->footer.middle_crc;
sigblock->data_crc = msg->footer.data_crc;
- ret = ceph_x_encrypt(&au->session_key, enc_buf,
- CEPHX_AU_ENC_BUF_LEN, sizeof(*sigblock));
+ ret = ceph_x_encrypt(&au->session_key, 0 /* dummy */,
+ enc_buf, CEPHX_AU_ENC_BUF_LEN,
+ sizeof(*sigblock));
if (ret < 0)
return ret;
@@ -1048,9 +1081,9 @@ static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
sigblock->seq_lower_word = *(__le32 *)&msg->hdr.seq;
/* no leading len, no ceph_x_encrypt_header */
- ret = ceph_crypt(&au->session_key, true, enc_buf,
- CEPHX_AU_ENC_BUF_LEN, sizeof(*sigblock),
- &ciphertext_len);
+ ret = ceph_crypt(&au->session_key, 0 /* dummy */,
+ true, enc_buf, CEPHX_AU_ENC_BUF_LEN,
+ sizeof(*sigblock), &ciphertext_len);
if (ret)
return ret;
@@ -1142,7 +1175,8 @@ int ceph_x_init(struct ceph_auth_client *ac)
goto err_xi;
}
- ret = ceph_crypto_key_prepare(&xi->secret);
+ ret = ceph_crypto_key_prepare(&xi->secret, client_key_usages,
+ ARRAY_SIZE(client_key_usages));
if (ret) {
pr_err("cannot prepare key: %d\n", ret);
goto err_secret;
diff --git a/net/ceph/auth_x_protocol.h b/net/ceph/auth_x_protocol.h
index 9c60feeb1bcb6..d097b3651c99e 100644
--- a/net/ceph/auth_x_protocol.h
+++ b/net/ceph/auth_x_protocol.h
@@ -6,6 +6,44 @@
#define CEPHX_GET_PRINCIPAL_SESSION_KEY 0x0200
#define CEPHX_GET_ROTATING_KEY 0x0400
+/* Client <-> AuthMonitor */
+/*
+ * The AUTH session's connection secret: encrypted with the AUTH
+ * ticket session key
+ */
+#define CEPHX_KEY_USAGE_AUTH_CONNECTION_SECRET 0x03
+/*
+ * The ticket's blob for the client ("blob for me", contains the
+ * session key): encrypted with the client's secret key in case of
+ * the AUTH ticket and the AUTH ticket session key in case of other
+ * service tickets
+ */
+#define CEPHX_KEY_USAGE_TICKET_SESSION_KEY 0x04
+/*
+ * The ticket's blob for the service (ceph_x_ticket_blob): possibly
+ * encrypted with the old AUTH ticket session key in case of the AUTH
+ * ticket and not encrypted in case of other service tickets
+ */
+#define CEPHX_KEY_USAGE_TICKET_BLOB 0x05
+
+/* Client <-> Service */
+/*
+ * The client's authorization request (ceph_x_authorize_b):
+ * encrypted with the service ticket session key
+ */
+#define CEPHX_KEY_USAGE_AUTHORIZE 0x10
+/*
+ * The service's challenge (ceph_x_authorize_challenge):
+ * encrypted with the service ticket session key
+ */
+#define CEPHX_KEY_USAGE_AUTHORIZE_CHALLENGE 0x11
+/*
+ * The service's final reply (ceph_x_authorize_reply + the service
+ * session's connection secret): encrypted with the service ticket
+ * session key
+ */
+#define CEPHX_KEY_USAGE_AUTHORIZE_REPLY 0x12
+
/* common bits */
struct ceph_x_ticket_blob {
__u8 struct_v;
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 3453dc3033156..b54085d8d5f0f 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -7,6 +7,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <crypto/aes.h>
+#include <crypto/krb5.h>
#include <crypto/skcipher.h>
#include <linux/key-type.h>
#include <linux/sched/mm.h>
@@ -22,28 +23,68 @@ static int set_aes_tfm(struct ceph_crypto_key *key)
int ret;
noio_flag = memalloc_noio_save();
- key->tfm = crypto_alloc_sync_skcipher("cbc(aes)", 0, 0);
+ key->aes_tfm = crypto_alloc_sync_skcipher("cbc(aes)", 0, 0);
memalloc_noio_restore(noio_flag);
- if (IS_ERR(key->tfm)) {
- ret = PTR_ERR(key->tfm);
- key->tfm = NULL;
+ if (IS_ERR(key->aes_tfm)) {
+ ret = PTR_ERR(key->aes_tfm);
+ key->aes_tfm = NULL;
return ret;
}
- ret = crypto_sync_skcipher_setkey(key->tfm, key->key, key->len);
+ ret = crypto_sync_skcipher_setkey(key->aes_tfm, key->key, key->len);
if (ret)
return ret;
return 0;
}
-int ceph_crypto_key_prepare(struct ceph_crypto_key *key)
+static int set_krb5_tfms(struct ceph_crypto_key *key, const u32 *key_usages,
+ int key_usage_cnt)
+{
+ struct krb5_buffer TK = { .len = key->len, .data = key->key };
+ unsigned int noio_flag;
+ int ret = 0;
+ int i;
+
+ if (WARN_ON_ONCE(key_usage_cnt > ARRAY_SIZE(key->krb5_tfms)))
+ return -EINVAL;
+
+ key->krb5_type = crypto_krb5_find_enctype(
+ KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192);
+ if (!key->krb5_type)
+ return -ENOPKG;
+
+ /*
+ * Despite crypto_krb5_prepare_encryption() taking a gfp mask,
+ * crypto_alloc_aead() inside of it allocates with GFP_KERNEL.
+ */
+ noio_flag = memalloc_noio_save();
+ for (i = 0; i < key_usage_cnt; i++) {
+ key->krb5_tfms[i] = crypto_krb5_prepare_encryption(
+ key->krb5_type, &TK, key_usages[i],
+ GFP_NOIO);
+ if (IS_ERR(key->krb5_tfms[i])) {
+ ret = PTR_ERR(key->krb5_tfms[i]);
+ key->krb5_tfms[i] = NULL;
+ goto out_flag;
+ }
+ }
+
+out_flag:
+ memalloc_noio_restore(noio_flag);
+ return ret;
+}
+
+int ceph_crypto_key_prepare(struct ceph_crypto_key *key,
+ const u32 *key_usages, int key_usage_cnt)
{
switch (key->type) {
case CEPH_CRYPTO_NONE:
return 0; /* nothing to do */
case CEPH_CRYPTO_AES:
return set_aes_tfm(key);
+ case CEPH_CRYPTO_AES256KRB5:
+ return set_krb5_tfms(key, key_usages, key_usage_cnt);
default:
return -ENOTSUPP;
}
@@ -123,12 +164,25 @@ int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *inkey)
void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
{
- if (key) {
- kfree_sensitive(key->key);
- key->key = NULL;
- if (key->tfm) {
- crypto_free_sync_skcipher(key->tfm);
- key->tfm = NULL;
+ int i;
+
+ if (!key)
+ return;
+
+ kfree_sensitive(key->key);
+ key->key = NULL;
+
+ if (key->type == CEPH_CRYPTO_AES) {
+ if (key->aes_tfm) {
+ crypto_free_sync_skcipher(key->aes_tfm);
+ key->aes_tfm = NULL;
+ }
+ } else if (key->type == CEPH_CRYPTO_AES256KRB5) {
+ for (i = 0; i < ARRAY_SIZE(key->krb5_tfms); i++) {
+ if (key->krb5_tfms[i]) {
+ crypto_free_aead(key->krb5_tfms[i]);
+ key->krb5_tfms[i] = NULL;
+ }
}
}
}
@@ -208,7 +262,7 @@ static void teardown_sgtable(struct sg_table *sgt)
static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
void *buf, int buf_len, int in_len, int *pout_len)
{
- SYNC_SKCIPHER_REQUEST_ON_STACK(req, key->tfm);
+ SYNC_SKCIPHER_REQUEST_ON_STACK(req, key->aes_tfm);
struct sg_table sgt;
struct scatterlist prealloc_sg;
char iv[AES_BLOCK_SIZE] __aligned(8);
@@ -224,7 +278,7 @@ static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
return ret;
memcpy(iv, aes_iv, AES_BLOCK_SIZE);
- skcipher_request_set_sync_tfm(req, key->tfm);
+ skcipher_request_set_sync_tfm(req, key->aes_tfm);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, sgt.sgl, sgt.sgl, crypt_len, iv);
@@ -269,7 +323,68 @@ static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
return ret;
}
-int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
+static int ceph_krb5_encrypt(const struct ceph_crypto_key *key, int usage_slot,
+ void *buf, int buf_len, int in_len, int *pout_len)
+{
+ struct sg_table sgt;
+ struct scatterlist prealloc_sg;
+ int ret;
+
+ if (WARN_ON_ONCE(usage_slot >= ARRAY_SIZE(key->krb5_tfms)))
+ return -EINVAL;
+
+ ret = setup_sgtable(&sgt, &prealloc_sg, buf, buf_len);
+ if (ret)
+ return ret;
+
+ ret = crypto_krb5_encrypt(key->krb5_type, key->krb5_tfms[usage_slot],
+ sgt.sgl, sgt.nents, buf_len, AES_BLOCK_SIZE,
+ in_len, false);
+ if (ret < 0) {
+ pr_err("%s encrypt failed: %d\n", __func__, ret);
+ goto out_sgt;
+ }
+
+ *pout_len = ret;
+ ret = 0;
+
+out_sgt:
+ teardown_sgtable(&sgt);
+ return ret;
+}
+
+static int ceph_krb5_decrypt(const struct ceph_crypto_key *key, int usage_slot,
+ void *buf, int buf_len, int in_len, int *pout_len)
+{
+ struct sg_table sgt;
+ struct scatterlist prealloc_sg;
+ size_t data_off = 0;
+ size_t data_len = in_len;
+ int ret;
+
+ if (WARN_ON_ONCE(usage_slot >= ARRAY_SIZE(key->krb5_tfms)))
+ return -EINVAL;
+
+ ret = setup_sgtable(&sgt, &prealloc_sg, buf, in_len);
+ if (ret)
+ return ret;
+
+ ret = crypto_krb5_decrypt(key->krb5_type, key->krb5_tfms[usage_slot],
+ sgt.sgl, sgt.nents, &data_off, &data_len);
+ if (ret) {
+ pr_err("%s decrypt failed: %d\n", __func__, ret);
+ goto out_sgt;
+ }
+
+ WARN_ON(data_off != AES_BLOCK_SIZE);
+ *pout_len = data_len;
+
+out_sgt:
+ teardown_sgtable(&sgt);
+ return ret;
+}
+
+int ceph_crypt(const struct ceph_crypto_key *key, int usage_slot, bool encrypt,
void *buf, int buf_len, int in_len, int *pout_len)
{
switch (key->type) {
@@ -279,6 +394,12 @@ int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
case CEPH_CRYPTO_AES:
return ceph_aes_crypt(key, encrypt, buf, buf_len, in_len,
pout_len);
+ case CEPH_CRYPTO_AES256KRB5:
+ return encrypt ?
+ ceph_krb5_encrypt(key, usage_slot, buf, buf_len, in_len,
+ pout_len) :
+ ceph_krb5_decrypt(key, usage_slot, buf, buf_len, in_len,
+ pout_len);
default:
return -ENOTSUPP;
}
@@ -290,6 +411,9 @@ int ceph_crypt_data_offset(const struct ceph_crypto_key *key)
case CEPH_CRYPTO_NONE:
case CEPH_CRYPTO_AES:
return 0;
+ case CEPH_CRYPTO_AES256KRB5:
+ /* confounder */
+ return AES_BLOCK_SIZE;
default:
BUG();
}
@@ -304,6 +428,9 @@ int ceph_crypt_buflen(const struct ceph_crypto_key *key, int data_len)
/* PKCS#7 padding at the end */
return data_len + AES_BLOCK_SIZE -
(data_len & (AES_BLOCK_SIZE - 1));
+ case CEPH_CRYPTO_AES256KRB5:
+ /* confounder at the beginning and 192-bit HMAC at the end */
+ return AES_BLOCK_SIZE + data_len + 24;
default:
BUG();
}
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h
index 2b8f8f68ff7a8..2c37c54d0f560 100644
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -5,7 +5,7 @@
#include <linux/ceph/types.h>
#include <linux/ceph/buffer.h>
-#define CEPH_MAX_KEY_LEN 16
+#define CEPH_MAX_KEY_LEN 32
#define CEPH_MAX_CON_SECRET_LEN 64
/*
@@ -16,10 +16,18 @@ struct ceph_crypto_key {
struct ceph_timespec created;
int len;
void *key;
- struct crypto_sync_skcipher *tfm;
+
+ union {
+ struct crypto_sync_skcipher *aes_tfm;
+ struct {
+ const struct krb5_enctype *krb5_type;
+ struct crypto_aead *krb5_tfms[3];
+ };
+ };
};
-int ceph_crypto_key_prepare(struct ceph_crypto_key *key);
+int ceph_crypto_key_prepare(struct ceph_crypto_key *key,
+ const u32 *key_usages, int key_usage_cnt);
int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
const struct ceph_crypto_key *src);
int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
@@ -27,7 +35,7 @@ int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
/* crypto.c */
-int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
+int ceph_crypt(const struct ceph_crypto_key *key, int usage_slot, bool encrypt,
void *buf, int buf_len, int in_len, int *pout_len);
int ceph_crypt_data_offset(const struct ceph_crypto_key *key);
int ceph_crypt_buflen(const struct ceph_crypto_key *key, int data_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 015/990] libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (13 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 014/990] libceph: add support for CEPH_CRYPTO_AES256KRB5 Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 016/990] writeback: use a per-sb counter to drain inode wb switches at umount Greg Kroah-Hartman
` (837 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilya Dryomov, Jordan DESNOËS,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <idryomov@gmail.com>
commit 8356b4b1103b8c970648c94bab724aa30e42d869 upstream.
The existing approach where ceph_x_challenge_blob is encrypted with the
client's secret key and then the digest derived from the ciphertext is
used for the test doesn't work with CEPH_CRYPTO_AES256KRB5 because the
confounder randomizes the ciphertext: the client and the server get two
different ciphertexts and therefore two different digests.
msgr1 signatures are affected the same way: a digest derived from the
ciphertext for the message's "sigblock" is what becomes a signature and
the two sides disagree on the expected value.
For CEPH_CRYPTO_AES256KRB5 (and potential future encryption schemes),
switch to HMAC-SHA256 function keyed in the same way as the existing
encryption. For CEPH_CRYPTO_AES, everything is preserved as is.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Jordan DESNOËS <jordan.desnoes@francetv.fr>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ceph/auth_x.c | 59 ++++++++++++++++++++++++++++++-----------
net/ceph/crypto.c | 18 +++++++++++++
net/ceph/crypto.h | 4 +++
net/ceph/messenger_v2.c | 14 +++++-----
4 files changed, 72 insertions(+), 23 deletions(-)
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index 966a38264254e..9350e1a9daf8f 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -558,8 +558,7 @@ static int ceph_x_build_request(struct ceph_auth_client *ac,
if (need & CEPH_ENTITY_TYPE_AUTH) {
struct ceph_x_authenticate *auth = (void *)(head + 1);
void *enc_buf = xi->auth_authorizer.enc_buf;
- struct ceph_x_challenge_blob *blob = enc_buf +
- ceph_x_encrypt_offset(&xi->secret);
+ struct ceph_x_challenge_blob *blob;
u64 *u;
p = auth + 1;
@@ -569,15 +568,29 @@ static int ceph_x_build_request(struct ceph_auth_client *ac,
dout(" get_auth_session_key\n");
head->op = cpu_to_le16(CEPHX_GET_AUTH_SESSION_KEY);
- /* encrypt and hash */
+ if (xi->secret.type == CEPH_CRYPTO_AES) {
+ blob = enc_buf + ceph_x_encrypt_offset(&xi->secret);
+ } else {
+ BUILD_BUG_ON(SHA256_DIGEST_SIZE + sizeof(*blob) >
+ CEPHX_AU_ENC_BUF_LEN);
+ blob = enc_buf + SHA256_DIGEST_SIZE;
+ }
+
get_random_bytes(&auth->client_challenge, sizeof(u64));
blob->client_challenge = auth->client_challenge;
blob->server_challenge = cpu_to_le64(xi->server_challenge);
- ret = ceph_x_encrypt(&xi->secret, 0 /* dummy */,
- enc_buf, CEPHX_AU_ENC_BUF_LEN,
- sizeof(*blob));
- if (ret < 0)
- return ret;
+
+ if (xi->secret.type == CEPH_CRYPTO_AES) {
+ ret = ceph_x_encrypt(&xi->secret, 0 /* dummy */,
+ enc_buf, CEPHX_AU_ENC_BUF_LEN,
+ sizeof(*blob));
+ if (ret < 0)
+ return ret;
+ } else {
+ ceph_hmac_sha256(&xi->secret, blob, sizeof(*blob),
+ enc_buf);
+ ret = SHA256_DIGEST_SIZE;
+ }
auth->struct_v = 3; /* nautilus+ */
auth->key = 0;
@@ -1065,11 +1078,19 @@ static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
__le32 data_crc;
__le32 data_len;
__le32 seq_lower_word;
- } __packed *sigblock = enc_buf;
+ } __packed *sigblock;
struct {
__le64 a, b, c, d;
} __packed *penc = enc_buf;
- int ciphertext_len;
+
+ if (au->session_key.type == CEPH_CRYPTO_AES) {
+ /* no leading len, no ceph_x_encrypt_header */
+ sigblock = enc_buf;
+ } else {
+ BUILD_BUG_ON(SHA256_DIGEST_SIZE + sizeof(*sigblock) >
+ CEPHX_AU_ENC_BUF_LEN);
+ sigblock = enc_buf + SHA256_DIGEST_SIZE;
+ }
sigblock->header_crc = msg->hdr.crc;
sigblock->front_crc = msg->footer.front_crc;
@@ -1080,12 +1101,18 @@ static int calc_signature(struct ceph_x_authorizer *au, struct ceph_msg *msg,
sigblock->data_len = msg->hdr.data_len;
sigblock->seq_lower_word = *(__le32 *)&msg->hdr.seq;
- /* no leading len, no ceph_x_encrypt_header */
- ret = ceph_crypt(&au->session_key, 0 /* dummy */,
- true, enc_buf, CEPHX_AU_ENC_BUF_LEN,
- sizeof(*sigblock), &ciphertext_len);
- if (ret)
- return ret;
+ if (au->session_key.type == CEPH_CRYPTO_AES) {
+ int ciphertext_len; /* unused */
+
+ ret = ceph_crypt(&au->session_key, 0 /* dummy */,
+ true, enc_buf, CEPHX_AU_ENC_BUF_LEN,
+ sizeof(*sigblock), &ciphertext_len);
+ if (ret)
+ return ret;
+ } else {
+ ceph_hmac_sha256(&au->session_key, sigblock,
+ sizeof(*sigblock), enc_buf);
+ }
*psig = penc->a ^ penc->b ^ penc->c ^ penc->d;
}
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index b54085d8d5f0f..b2067ea6c38ad 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -84,6 +84,7 @@ int ceph_crypto_key_prepare(struct ceph_crypto_key *key,
case CEPH_CRYPTO_AES:
return set_aes_tfm(key);
case CEPH_CRYPTO_AES256KRB5:
+ hmac_sha256_preparekey(&key->hmac_key, key->key, key->len);
return set_krb5_tfms(key, key_usages, key_usage_cnt);
default:
return -ENOTSUPP;
@@ -178,6 +179,7 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
key->aes_tfm = NULL;
}
} else if (key->type == CEPH_CRYPTO_AES256KRB5) {
+ memzero_explicit(&key->hmac_key, sizeof(key->hmac_key));
for (i = 0; i < ARRAY_SIZE(key->krb5_tfms); i++) {
if (key->krb5_tfms[i]) {
crypto_free_aead(key->krb5_tfms[i]);
@@ -436,6 +438,22 @@ int ceph_crypt_buflen(const struct ceph_crypto_key *key, int data_len)
}
}
+void ceph_hmac_sha256(const struct ceph_crypto_key *key, const void *buf,
+ int buf_len, u8 hmac[SHA256_DIGEST_SIZE])
+{
+ switch (key->type) {
+ case CEPH_CRYPTO_NONE:
+ case CEPH_CRYPTO_AES:
+ memset(hmac, 0, SHA256_DIGEST_SIZE);
+ return;
+ case CEPH_CRYPTO_AES256KRB5:
+ hmac_sha256(&key->hmac_key, buf, buf_len, hmac);
+ return;
+ default:
+ BUG();
+ }
+}
+
static int ceph_key_preparse(struct key_preparsed_payload *prep)
{
struct ceph_crypto_key *ckey;
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h
index 2c37c54d0f560..3a2ade15abbcc 100644
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -2,6 +2,7 @@
#ifndef _FS_CEPH_CRYPTO_H
#define _FS_CEPH_CRYPTO_H
+#include <crypto/sha2.h>
#include <linux/ceph/types.h>
#include <linux/ceph/buffer.h>
@@ -20,6 +21,7 @@ struct ceph_crypto_key {
union {
struct crypto_sync_skcipher *aes_tfm;
struct {
+ struct hmac_sha256_key hmac_key;
const struct krb5_enctype *krb5_type;
struct crypto_aead *krb5_tfms[3];
};
@@ -39,6 +41,8 @@ int ceph_crypt(const struct ceph_crypto_key *key, int usage_slot, bool encrypt,
void *buf, int buf_len, int in_len, int *pout_len);
int ceph_crypt_data_offset(const struct ceph_crypto_key *key);
int ceph_crypt_buflen(const struct ceph_crypto_key *key, int data_len);
+void ceph_hmac_sha256(const struct ceph_crypto_key *key, const void *buf,
+ int buf_len, u8 hmac[SHA256_DIGEST_SIZE]);
int ceph_crypto_init(void);
void ceph_crypto_shutdown(void);
diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c
index 4bb238eb8606e..d5300c66258d9 100644
--- a/net/ceph/messenger_v2.c
+++ b/net/ceph/messenger_v2.c
@@ -778,9 +778,9 @@ static int setup_crypto(struct ceph_connection *con,
return 0; /* auth_x, secure mode */
}
-static void ceph_hmac_sha256(struct ceph_connection *con,
- const struct kvec *kvecs, int kvec_cnt,
- u8 hmac[SHA256_DIGEST_SIZE])
+static void con_hmac_sha256(struct ceph_connection *con,
+ const struct kvec *kvecs, int kvec_cnt,
+ u8 hmac[SHA256_DIGEST_SIZE])
{
struct hmac_sha256_ctx ctx;
int i;
@@ -1437,8 +1437,8 @@ static int prepare_auth_signature(struct ceph_connection *con)
if (!buf)
return -ENOMEM;
- ceph_hmac_sha256(con, con->v2.in_sign_kvecs, con->v2.in_sign_kvec_cnt,
- CTRL_BODY(buf));
+ con_hmac_sha256(con, con->v2.in_sign_kvecs, con->v2.in_sign_kvec_cnt,
+ CTRL_BODY(buf));
return prepare_control(con, FRAME_TAG_AUTH_SIGNATURE, buf,
SHA256_DIGEST_SIZE);
@@ -2441,8 +2441,8 @@ static int process_auth_signature(struct ceph_connection *con,
return -EINVAL;
}
- ceph_hmac_sha256(con, con->v2.out_sign_kvecs, con->v2.out_sign_kvec_cnt,
- hmac);
+ con_hmac_sha256(con, con->v2.out_sign_kvecs, con->v2.out_sign_kvec_cnt,
+ hmac);
ceph_decode_need(&p, end, SHA256_DIGEST_SIZE, bad);
if (crypto_memneq(p, hmac, SHA256_DIGEST_SIZE)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 016/990] writeback: use a per-sb counter to drain inode wb switches at umount
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (14 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 015/990] libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 017/990] KVM: TDX: Enable Bus Lock VM exit Greg Kroah-Hartman
` (836 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Brauner, Jan Kara,
Baokun Li, Tejun Heo, Eric Hagberg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <libaokun@linux.alibaba.com>
commit 31c1d19ead2c26a63859a2757d8b786765ba9cdd upstream.
Tracking in-flight inode wb switches with a single global counter
(isw_nr_in_flight) plus a synchronize_rcu() based wait in
cgroup_writeback_umount() forces every umount to take a global hit
whenever any other superblock on the system has wb switches in flight,
even if the superblock being unmounted has none of its own.
Replace the global synchronize_rcu()/flush_workqueue() pair with a
per-sb counter, s_isw_nr_in_flight, plus three small helpers:
- cgroup_writeback_pin(sb) - increment counter
- cgroup_writeback_unpin(sb) - decrement and wake drainer if last
- cgroup_writeback_drain(sb) - wait for counter to reach zero
The wiring is:
- inode_prepare_wbs_switch() pins before checking SB_ACTIVE and
grabbing the inode; failure paths unpin before returning. A
lockless SB_ACTIVE check at the top of the function lets us skip
the atomic_inc/smp_mb dance once SB_ACTIVE has been cleared (it
is monotonic and never set back).
- process_inode_switch_wbs() unpins after the matching iput().
- cgroup_writeback_umount() drains the per-sb counter via
wait_var_event().
The smp_mb() pair between inode_prepare_wbs_switch() and
cgroup_writeback_umount() keeps the SB_ACTIVE / counter ordering:
either the umounter sees a non-zero counter and waits, or the
switcher sees SB_ACTIVE cleared and aborts before grabbing the
inode.
The global isw_nr_in_flight is left in place, since it is still used
to throttle in-flight switches via WB_FRN_MAX_IN_FLIGHT.
The rcu_read_lock() extension in inode_switch_wbs() and
cleanup_offline_cgwb() that the race fix added is no longer needed
and is reverted; the synchronize_rcu() that the race fix added to
cgroup_writeback_umount() is dropped as well.
The following numbers were measured on a 16 vCPU QEMU guest with 4
background superblocks each churning "create memcg -> write 1 MiB ->
rmdir memcg" to keep the global isw_nr_in_flight non-zero. Latencies
are wall-clock around umount(8); only the target sb's umount is
measured.
Target sb runs its own cgwb churn:
p50 p95 p99 max
global synchronize_rcu() 67.6 ms 88.3 ms 88.3 ms 96.8 ms
per-sb counter (this) 7.9 ms 10.0 ms 10.0 ms 10.1 ms
Idle target umount latency under cross-sb cgwb-switch pressure:
p50 p95 p99 max
global synchronize_rcu() 62.7 ms 95.4 ms 108.1 ms 108.6 ms
per-sb counter (this) 5.3 ms 6.9 ms 7.4 ms 7.4 ms
no-pressure baseline 4.9 ms 5.9 ms 6.3 ms 6.7 ms
8 concurrent umounts of idle sbs under the same pressure:
p50 p95 max
global synchronize_rcu() 61.3 ms 99.5 ms 113.7 ms
per-sb counter (this) 8.1 ms 9.1 ms 9.5 ms
In-kernel cgroup_writeback_umount() time across the same run
(bpftrace, ~340 calls covering all scenarios):
global synchronize_rcu() 12371 ms total (~36 ms / call)
per-sb counter (this) 1.37 ms total ( ~4 us / call)
Suggested-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/177910456953.488929.2169908940676707307.b4-review@b4
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>
Link: https://patch.msgid.link/20260521095016.2791354-4-libaokun@linux.alibaba.com
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ ehagberg: Backported to 6.18.y. struct super_block lives in
include/linux/fs.h here, so add the field there. 6.18.y predates the
inode_state_read()/inode_state_set() accessors, so adjust context
accordingly. Also adjust context in cleanup_offline_cgwb() for
"writeback: keep cleanup_offline_cgwb()'s scan out of syncs".
No functional change from upstream. ]
Signed-off-by: Eric Hagberg <ehagberg@janestreet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fs-writeback.c | 97 ++++++++++++++++++++++------------------------
include/linux/fs.h | 8 ++++
2 files changed, 55 insertions(+), 50 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index a390cb6b14c6f..47bce548278c1 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -488,6 +488,23 @@ static bool inode_do_switch_wbs(struct inode *inode,
return switched;
}
+static inline void cgroup_writeback_pin(struct super_block *sb)
+{
+ atomic_inc(&sb->s_isw_nr_in_flight);
+}
+
+static inline void cgroup_writeback_unpin(struct super_block *sb)
+{
+ if (atomic_dec_and_test(&sb->s_isw_nr_in_flight))
+ wake_up_var(&sb->s_isw_nr_in_flight);
+}
+
+static inline void cgroup_writeback_drain(struct super_block *sb)
+{
+ wait_var_event(&sb->s_isw_nr_in_flight,
+ !atomic_read(&sb->s_isw_nr_in_flight));
+}
+
static void process_inode_switch_wbs(struct bdi_writeback *new_wb,
struct inode_switch_wbs_context *isw)
{
@@ -546,8 +563,12 @@ static void process_inode_switch_wbs(struct bdi_writeback *new_wb,
wb_put_many(old_wb, nr_switched);
}
- for (inodep = isw->inodes; *inodep; inodep++)
+ for (inodep = isw->inodes; *inodep; inodep++) {
+ struct super_block *sb = (*inodep)->i_sb;
+
iput(*inodep);
+ cgroup_writeback_unpin(sb);
+ }
wb_put(new_wb);
kfree(isw);
atomic_dec(&isw_nr_in_flight);
@@ -590,16 +611,19 @@ void inode_switch_wbs_work_fn(struct work_struct *work)
static bool inode_prepare_wbs_switch(struct inode *inode,
struct bdi_writeback *new_wb)
{
+ /* Avoid the atomic_inc/smp_mb dance once SB_ACTIVE is gone. */
+ if (!(inode->i_sb->s_flags & SB_ACTIVE))
+ return false;
+
/*
- * Paired with smp_mb() in cgroup_writeback_umount().
- * isw_nr_in_flight must be increased before checking SB_ACTIVE and
- * grabbing an inode, otherwise isw_nr_in_flight can be observed as 0
- * in cgroup_writeback_umount() and the isw_wq will be not flushed.
+ * Pairs with smp_mb() in cgroup_writeback_umount(): the umounter either
+ * sees a non-zero counter and waits, or we see SB_ACTIVE clear below.
*/
+ cgroup_writeback_pin(inode->i_sb);
smp_mb();
if (IS_DAX(inode))
- return false;
+ goto out_unpin;
/* while holding I_WB_SWITCH, no one else can update the association */
spin_lock(&inode->i_lock);
@@ -607,13 +631,17 @@ static bool inode_prepare_wbs_switch(struct inode *inode,
inode->i_state & (I_WB_SWITCH | I_FREEING | I_WILL_FREE) ||
inode_to_wb(inode) == new_wb) {
spin_unlock(&inode->i_lock);
- return false;
+ goto out_unpin;
}
inode->i_state |= I_WB_SWITCH;
__iget(inode);
spin_unlock(&inode->i_lock);
return true;
+
+out_unpin:
+ cgroup_writeback_unpin(inode->i_sb);
+ return false;
}
static void wb_queue_isw(struct bdi_writeback *wb,
@@ -652,19 +680,12 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
atomic_inc(&isw_nr_in_flight);
- /*
- * Paired with synchronize_rcu() in cgroup_writeback_umount():
- * holding rcu_read_lock across inode_prepare_wbs_switch()
- * (covering the SB_ACTIVE check and the inode grab) and
- * wb_queue_isw() ensures synchronize_rcu() cannot return until
- * the work is queued, so the subsequent flush_workqueue() will
- * wait for the switch.
- */
- rcu_read_lock();
/* find and pin the new wb */
+ rcu_read_lock();
memcg_css = css_from_id(new_wb_id, &memory_cgrp_subsys);
if (memcg_css && !css_tryget(memcg_css))
memcg_css = NULL;
+ rcu_read_unlock();
if (!memcg_css)
goto out_free;
@@ -680,11 +701,9 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
trace_inode_switch_wbs_queue(inode->i_wb, new_wb, 1);
wb_queue_isw(new_wb, isw);
- rcu_read_unlock();
return;
out_free:
- rcu_read_unlock();
atomic_dec(&isw_nr_in_flight);
if (new_wb)
wb_put(new_wb);
@@ -765,14 +784,6 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb)
* moved ones. Exclude syncs as process_inode_switch_wbs() does.
*/
down_read(&wb->bdi->wb_switch_rwsem);
- /*
- * Paired with synchronize_rcu() in cgroup_writeback_umount().
- * Holding rcu_read_lock across the SB_ACTIVE check, the inode grab
- * and wb_queue_isw() ensures synchronize_rcu() cannot return until
- * the work is queued, so the subsequent flush_workqueue() will wait
- * for the switch.
- */
- rcu_read_lock();
spin_lock(&wb->list_lock);
/*
* In addition to the inodes that have completed writeback, also switch
@@ -791,7 +802,6 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb)
/* no attached inodes? bail out */
if (nr == 0) {
- rcu_read_unlock();
atomic_dec(&isw_nr_in_flight);
wb_put(new_wb);
kfree(isw);
@@ -800,7 +810,6 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb)
trace_inode_switch_wbs_queue(wb, new_wb, nr);
wb_queue_isw(new_wb, isw);
- rcu_read_unlock();
return restart;
}
@@ -1228,39 +1237,27 @@ int cgroup_writeback_by_id(u64 bdi_id, int memcg_id,
}
/**
- * cgroup_writeback_umount - flush inode wb switches for umount
+ * cgroup_writeback_umount - wait for in-flight inode wb switches on @sb
* @sb: target super_block
*
- * This function is called when a super_block is about to be destroyed and
- * flushes in-flight inode wb switches. An inode wb switch goes through
- * RCU and then workqueue, so the two need to be flushed in order to ensure
- * that all previously scheduled switches are finished. As wb switches are
- * rare occurrences and synchronize_rcu() can take a while, perform
- * flushing iff wb switches are in flight.
+ * Wait until every inode wb switch that already passed the SB_ACTIVE
+ * check on this superblock has been completed by the worker. Since
+ * SB_ACTIVE is cleared before this is called, no new switches can start
+ * for @sb, so s_isw_nr_in_flight will monotonically drop to zero.
*/
void cgroup_writeback_umount(struct super_block *sb)
{
-
if (!(sb->s_bdi->capabilities & BDI_CAP_WRITEBACK))
return;
/*
- * SB_ACTIVE should be reliably cleared before checking
- * isw_nr_in_flight, see generic_shutdown_super().
+ * Pairs with smp_mb() in inode_prepare_wbs_switch(): we either observe
+ * a non-zero counter and wait, or the switcher sees SB_ACTIVE clear
+ * (cleared by generic_shutdown_super()) and bails before grabbing the
+ * inode.
*/
smp_mb();
-
- if (atomic_read(&isw_nr_in_flight)) {
- /*
- * Paired with rcu_read_lock() in inode_switch_wbs() and
- * cleanup_offline_cgwb(). synchronize_rcu() waits for any
- * in-flight switcher that already passed the SB_ACTIVE check
- * to finish queueing its work, so flush_workqueue() below
- * will then drain it.
- */
- synchronize_rcu();
- flush_workqueue(isw_wq);
- }
+ cgroup_writeback_drain(sb);
}
static int __init cgroup_writeback_init(void)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 09cbcfbf295f6..b83b5a0761904 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1660,6 +1660,14 @@ struct super_block {
spinlock_t s_inode_wblist_lock;
struct list_head s_inodes_wb; /* writeback inodes */
+
+#ifdef CONFIG_CGROUP_WRITEBACK
+ /*
+ * Number of in-flight inode wb switches for this sb. Drained by
+ * cgroup_writeback_umount() before tear-down.
+ */
+ atomic_t s_isw_nr_in_flight;
+#endif
} __randomize_layout;
static inline struct user_namespace *i_user_ns(const struct inode *inode)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 017/990] KVM: TDX: Enable Bus Lock VM exit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (15 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 016/990] writeback: use a per-sb counter to drain inode wb switches at umount Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 018/990] ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250) Greg Kroah-Hartman
` (835 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiaoyao Li, Nikolay Borisov,
Sean Christopherson, Sasha Levin, Chenyi Qiang
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaoyao Li <xiaoyao.li@intel.com>
[ Upstream commit 63d196e2e20429de5ba501f1b6059d9b93140007 ]
Enable Bus Lock VM exit functionality for TDX guests.
Bus Lock VM exit is an existing feature supported by KVM. Userspace can
enable Bus Lock VM exit through KVM_BUS_LOCK_DETECTION_EXIT when it's
reported as supported. However, KVM reports the support of this CAP
just based on the hardware capability but doesn't differentiate between
VMX and TDX. This leads to the issue that userspace can enable this cap
for TDX guests without getting an error, but the feature is not actually
enabled because KVM doesn't call the TDX module API to program the
relevant TD VMCS fields.
Enable Bus Lock VM exit for TDX guests by programming the
BUS_LOCK_DETECTION control in the TD VMCS and by adding the exit handler.
Note, there is no enumeration bit for this feature by TDX module because
all TDX modules support it and allow to set the TD VMCS as long as the
hardware supports the feature.
Fixes: 161d34609f9b ("KVM: TDX: Make TDX VM type supported")
Cc: stable@vger.kernel.org
Originally-by: Chenyi Qiang <chenyi.qiang@intel.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://patch.msgid.link/20260819094903.3060020-9-xiaoyao.li@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/kvm/vmx/tdx.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
index 43d6b20dfbb16..0a0fd87fd53e9 100644
--- a/arch/x86/kvm/vmx/tdx.c
+++ b/arch/x86/kvm/vmx/tdx.c
@@ -2058,7 +2058,7 @@ int tdx_complete_emulated_msr(struct kvm_vcpu *vcpu, int err)
}
-int tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath)
+static int __tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath)
{
struct vcpu_tdx *tdx = to_tdx(vcpu);
u64 vp_enter_ret = tdx->vp_enter_ret;
@@ -2159,6 +2159,8 @@ int tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath)
case EXIT_REASON_NOTIFY:
/* NMI blocking state is handled by TDX module */
return __vt_handle_notify(vcpu, vmx_get_exit_qual(vcpu));
+ case EXIT_REASON_BUS_LOCK:
+ return vt_handle_bus_lock_vmexit(vcpu);
default:
break;
}
@@ -2172,6 +2174,22 @@ int tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath)
return 0;
}
+int tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath)
+{
+ int ret = __tdx_handle_exit(vcpu, fastpath);
+
+ /* Exit to user space when bus lock was detected */
+ if (vmx_get_exit_reason(vcpu).bus_lock_detected) {
+ if (ret > 0) {
+ vcpu->run->exit_reason = KVM_EXIT_X86_BUS_LOCK;
+ ret = 0;
+ }
+
+ vcpu->run->flags |= KVM_RUN_X86_BUS_LOCK;
+ }
+ return ret;
+}
+
void tdx_get_exit_info(struct kvm_vcpu *vcpu, u32 *reason,
u64 *info1, u64 *info2, u32 *intr_info, u32 *error_code)
{
@@ -3167,6 +3185,10 @@ static int tdx_vcpu_init(struct kvm_vcpu *vcpu, struct kvm_tdx_cmd *cmd)
vcpu->kvm->arch.notify_window);
}
+ if (vcpu->kvm->arch.bus_lock_detection_enabled)
+ td_vmcs_setbit32(tdx, SECONDARY_VM_EXEC_CONTROL,
+ SECONDARY_EXEC_BUS_LOCK_DETECTION);
+
tdx->state = VCPU_TD_STATE_INITIALIZED;
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 018/990] ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250)
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (16 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 017/990] KVM: TDX: Enable Bus Lock VM exit Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 019/990] ACPI: PM: Add unused power resource quirk for Casper Excalibur G900 Greg Kroah-Hartman
` (834 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthias Dittrich, Rafael J. Wysocki,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Dittrich <dittrich.m@gmx.net>
[ Upstream commit a0039113053d4d3f629ea1b9cd74130ca597f14a ]
The Acer Swift 3 SF314-56G (with NVIDIA GeForce MX250) suffers from
the same ACPI power resource regression as the Thunderobot ZERO.
The power resource controlling the dGPU is incorrectly turned off
during initialization, causing the GPU to fall off the bus (D3cold).
This commit adds a DMI quirk to keep the power resource on for this
model, similar to the existing Thunderobot quirk.
Tested on Acer Swift 3 SF314-56G with NVIDIA MX250.
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221087
Signed-off-by: Matthias Dittrich <dittrich.m@gmx.net>
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/power.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 6d16740e1d70a..92cd9f963c6f5 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -1125,6 +1125,19 @@ static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "ZERO"),
}
+ },
+ {
+ /*
+ * Acer Swift 3 SF314-56G with NVIDIA MX250 suffers from the
+ * same ACPI power resource regression as the Thunderobot ZERO.
+ * The power resource controlling the dGPU is incorrectly turned off
+ * during initialization, causing the GPU to fall off the bus (D3cold).
+ */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Swift SF314-56G"),
+ }
+
},
{}
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 019/990] ACPI: PM: Add unused power resource quirk for Casper Excalibur G900
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (17 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 018/990] ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250) Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 020/990] ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[] Greg Kroah-Hartman
` (833 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hakan Abay, Rafael J. Wysocki,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hakan Abay <hakan.abay84@gmail.com>
[ Upstream commit 23ec17231cc6a83bb11d8660db5bfc5336f53a0e ]
On the Casper Excalibur G900, the NVIDIA discrete GPU and the second
NVMe device become inaccessible when unused ACPI power resources are
turned off during initialization.
The failure is similar to the THUNDEROBOT ZERO case addressed by
commit cd7ef20ba8c6 ("ACPI: PM: Add unused power resource quirk for THUNDEROBOT ZERO").
Without the quirk, the NVIDIA GPU and the second NVMe device are left
inaccessible in D3cold and attempts to transition them back to D0 fail.
Add a DMI quirk for the affected Casper Excalibur G900 with NLCC 001
mainboard to leave unused ACPI power resources on.
With the quirk applied, the second NVMe device remains accessible. The
NVIDIA GPU can enter D3cold while idle and subsequently return to D0
for accelerated rendering.
Link: https://bugs.kali.org/view.php?id=9891
Signed-off-by: Hakan Abay <hakan.abay84@gmail.com>
Link: https://patch.msgid.link/20261005174939.53873-1-hakan.abay84@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/power.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 92cd9f963c6f5..2c0c982602014 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -1139,6 +1139,18 @@ static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
}
},
+ {
+ /*
+ * CASPER EXCALIBUR G900 laptop: Keep unused ACPI power
+ * resources on to prevent the NVIDIA dGPU and NVMe #2
+ * from becoming inaccessible.
+ */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "CASPER BILGISAYAR SISTEMLERI"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "EXCALIBUR G900"),
+ DMI_MATCH(DMI_BOARD_NAME, "NLCC 001"),
+ },
+ },
{}
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 020/990] ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[]
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (18 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 019/990] ACPI: PM: Add unused power resource quirk for Casper Excalibur G900 Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 021/990] fs: aio: reject partial mremap to avoid Null-pointer-dereference error Greg Kroah-Hartman
` (832 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Krittikun Wongnin, Rafael J. Wysocki,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krittikun Wongnin <krittikunwongnin@gmail.com>
[ Upstream commit 8eb2754ef96d77d870d6b1ef1e0e8470c892b6b4 ]
On the Acer Aspire A515-53G (Whiskey Lake + NVIDIA GeForce MX230), the
dGPU behind root port RP05 (00:1c.4) falls off the bus during boot and
is unusable until the next power cycle:
nvidia 0000:02:00.0: Unable to change power state from D3cold to D0, device inaccessible
NVRM: The NVIDIA GPU 0000:02:00.0 ... has fallen off the bus
The firmware ships two SSDTs which both provide power management for
the dGPU:
- One SSDT defines \_SB.PCI0.RP05.PC01 together with
RP05._PR0/_PR2/_PR3 = { PC01 }.
- A second SSDT defines \_SB.PCI0.RP05.PCRP (_STA initially One,
_OFF calls \_SB.PCI0.HGOF, which puts the link into L2/L3 and drops
the dGPU power enable GPIO) and its own RP05._PR0/_PR2/_PR3/_S0W.
The latter fail to load:
ACPI BIOS Error (bug): Failure creating named object [\_SB.PCI0.RP05._PR0], AE_ALREADY_EXISTS
As a result PCRP is not referenced by any device and
acpi_turn_off_unused_power_resources() turns it off right after the
ACPI namespace scan. This cuts power to the dGPU, but PC01 still
believes it is on, so its _ON method is a no-op when the PCI core later
tries to bring the GPU back to D0.
Windows does not turn off unused power resources, so the dGPU works
there.
Add the machine to dmi_leave_unused_power_resources_on[], like the
THUNDEROBOT ZERO which has a similar SSDT bug. With this change the
dGPU stays on the bus and the nvidia driver binds. Runtime PM of the
dGPU is unaffected, as it is handled through PC01: with no driver
bound and power/control set to auto, RP05 reaches D3cold and the GPU
comes back to D0 on resume.
Link: https://lore.kernel.org/r/CADS-TgDQ1G8vrTQLJeQ3RTBVFTyMe0C+5p2=UBKS=EFCDFuaxw@mail.gmail.com/
Signed-off-by: Krittikun Wongnin <krittikunwongnin@gmail.com>
[ rjw: Subject and changelog tweaks ]
Link: https://patch.msgid.link/20261013074245.4327-1-krittikunwongnin@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/power.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 2c0c982602014..4a67e9afdd7fc 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -1151,6 +1151,19 @@ static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
DMI_MATCH(DMI_BOARD_NAME, "NLCC 001"),
},
},
+ {
+ /*
+ * Acer Aspire A515-53G: Two SSDTs both define power resources
+ * for the dGPU root port RP05 ('PC01' and 'PCRP'). Only PC01 ends
+ * up in RP05's _PR0/_PR3, so 'PCRP' is shut down on
+ * initialization, cutting power to the NVIDIA dGPU behind the
+ * back of 'PC01' and making the dGPU unavailable.
+ */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire A515-53G"),
+ },
+ },
{}
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 021/990] fs: aio: reject partial mremap to avoid Null-pointer-dereference error
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (19 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 020/990] ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[] Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 022/990] ACPI: platform: Use acpi_bus_get_primary_device() Greg Kroah-Hartman
` (831 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zizhi Wo, Jan Kara,
Christian Brauner, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <wozizhi@huawei.com>
[ Upstream commit 3adf7ae18bf42601246031002287c103a27df307 ]
[BUG]
Recently, our internal syzkaller testing uncovered a null pointer
dereference issue:
BUG: kernel NULL pointer dereference, address: 0000000000000000
...
[ 51.111664] filemap_read_folio+0x25/0xe0
[ 51.112410] filemap_fault+0xad7/0x1250
[ 51.113112] __do_fault+0x4b/0x460
[ 51.113699] do_pte_missing+0x5bc/0x1db0
[ 51.114250] ? __pte_offset_map+0x23/0x170
[ 51.114822] __handle_mm_fault+0x9f8/0x1680
...
Crash analysis showed the file involved was an AIO ring file. The
phenomenon triggered is the same as the issue described in [1].
[CAUSE]
Consider the following scenario: userspace sets up an AIO context via
io_setup(), which creates a VMA covering the entire ring buffer. Then
userspace calls mremap() with the AIO ring address as the source, a smaller
old_len (less than the full ring size), MREMAP_MAYMOVE set, and without
MREMAP_DONTUNMAP. The kernel will relocate the requested portion to a new
destination address.
During this move, __split_vma() splits the original AIO ring VMA. The
requested portion is unmapped from the source and re-established at the
destination, while the remainder stays at the original source address as
an orphan VMA. The aio_ring_mremap() callback fires on the new destination
VMA, updating ctx->mmap_base to the destination address. But the callback
is unaware that only a partial region was moved and that an orphan VMA
still exists at the source:
source(AIO):
+-------------------+---------------------+
| moved to dest | orphan VMA (AIO) |
+-------------------+---------------------+
A A+partial_len A+ctx->mmap_size
dest:
+-------------------+
| moved VMA (AIO) |
+-------------------+
B B+partial_len
Later, io_destroy() calls vm_munmap(ctx->mmap_base, ctx->mmap_size), which
unmaps the destination. This not only fails to unmap the orphan VMA at the
source, but also overshoots the destination VMA and may unmap unrelated
mappings adjacent to it! After put_aio_ring_file() calls truncate_setsize()
to remove all pages from the pagecache, any subsequent access to the orphan
VMA triggers filemap_fault(), which calls a_ops->read_folio(). Since aio
does not implement read_folio, this results in a NULL pointer dereference.
[FIX]
Note that expanding mremap (new_len > old_len) is already rejected because
AIO ring VMAs are created with VM_DONTEXPAND. The only problematic case is
a partial move where "old_len == new_len" but both are smaller than the
full ring size.
Fix this by checking in aio_ring_mremap() that the new VMA covers the
entire ring. This ensures the AIO ring is always moved as a whole,
preventing orphan VMAs and the subsequent crash.
[1]: https://lore.kernel.org/all/20260413010814.548568-1-wozizhi@huawei.com/
Signed-off-by: Zizhi Wo <wozizhi@huaweicloud.com>
Link: https://patch.msgid.link/20260418060634.3713620-1-wozizhi@huaweicloud.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/aio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/aio.c b/fs/aio.c
index e06fa57b05ca9..641cf69bc959b 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -369,7 +369,8 @@ static int aio_ring_mremap(struct vm_area_struct *vma)
ctx = rcu_dereference(table->table[i]);
if (ctx && ctx->aio_ring_file == file) {
- if (!atomic_read(&ctx->dead)) {
+ if (!atomic_read(&ctx->dead) &&
+ (ctx->mmap_size == (vma->vm_end - vma->vm_start))) {
ctx->user_id = ctx->mmap_base = vma->vm_start;
res = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 022/990] ACPI: platform: Use acpi_bus_get_primary_device()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (20 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 021/990] fs: aio: reject partial mremap to avoid Null-pointer-dereference error Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 023/990] virtio_net: check RX buffer length before DMA sync Greg Kroah-Hartman
` (830 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Andy Shevchenko,
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 a9ba4dd2f18bf3f439d9ef0d8f375f90360ba1bd ]
The acpi_get_first_physical_node() usage in acpi_platform_fill_resource()
and acpi_create_platform_device() is generally unsafe because in theory
the device returned by it may be freed at any time [1].
It is also inefficient because acpi_get_first_physical_node() is called
multiple times for the same argument which can be avoided.
Address these issues by using acpi_bus_get_primary_device() instead of
acpi_get_first_physical_node() and adjusting the code to call it just
once at the beginning of and acpi_create_platform_device() and drop
the device reference acquired by it upon the return from that function.
Fixes: 3b95bd160547 ("ACPI: introduce a function to find the first physical device")
Fixes: a252d881c558 ("ACPI / platform: Pay attention to parent device's resources")
Link: https://sashiko.dev/#/patchset/12955541.O9o76ZdvQC%40rafael.j.wysocki [1]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/3436112.aeNJFYEL58@rafael.j.wysocki
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/acpi_platform.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 62ab6d7f37212..49c2d6734de58 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -108,18 +108,15 @@ static unsigned int acpi_platform_adjust_resources(struct acpi_device *adev,
return count;
}
-static void acpi_platform_fill_resource(struct acpi_device *adev,
- const struct resource *src, struct resource *dest)
+static void acpi_platform_fill_resource(struct device *parent,
+ const struct resource *src,
+ struct resource *dest)
{
- struct device *parent;
-
*dest = *src;
-
/*
* If the device has parent we need to take its resources into
* account as well because this device might consume part of those.
*/
- parent = acpi_get_first_physical_node(acpi_dev_parent(adev));
if (parent && dev_is_pci(parent))
dest->parent = pci_find_resource(to_pci_dev(parent), dest);
}
@@ -147,7 +144,8 @@ static unsigned int acpi_platform_resource_count(struct acpi_resource *ares, voi
struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
const struct property_entry *properties)
{
- struct acpi_device *parent = acpi_dev_parent(adev);
+ struct acpi_device *p = acpi_dev_parent(adev);
+ struct device *parent __free(put_device) = acpi_bus_get_primary_device(p);
struct platform_device *pdev = NULL;
struct platform_device_info pdevinfo;
const struct acpi_device_id *match;
@@ -193,7 +191,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
rentry->res,
resources,
count);
- acpi_platform_fill_resource(adev, rentry->res,
+ acpi_platform_fill_resource(parent, rentry->res,
&resources[count++]);
}
acpi_dev_free_resource_list(&resource_list);
@@ -206,7 +204,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
* attached to it, that physical device should be the parent of the
* platform device we are about to create.
*/
- pdevinfo.parent = parent ? acpi_get_first_physical_node(parent) : NULL;
+ pdevinfo.parent = parent;
pdevinfo.name = dev_name(&adev->dev);
pdevinfo.id = PLATFORM_DEVID_NONE;
pdevinfo.res = resources;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 023/990] virtio_net: check RX buffer length before DMA sync
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (21 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 022/990] ACPI: platform: Use acpi_bus_get_primary_device() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 024/990] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses Greg Kroah-Hartman
` (829 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nikolai Kalinin,
Vladimir Petrzhikovskii, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Petrzhikovskii <vladimir@dfb.sh>
[ Upstream commit 29dfa436bc488056a84ee423ba82336db453e2a6 ]
An RX queue that uses the DMA API (rq->use_page_pool_dma, for example
with VIRTIO_F_ACCESS_PLATFORM) syncs each received buffer with
page_pool_dma_sync_for_cpu() using the length the device wrote to the
used ring, and checks that length against the posted buffer only after
the sync.
With SWIOTLB bouncing (swiotlb=force, or a confidential-computing
guest), the sync copies from the shared bounce buffer into the guest's
private page, so an oversized length also copies the bytes the device
wrote past the posted buffer over the neighbouring page pool fragments.
The later check drops the packet, but the copy has already happened. A
malicious device, such as a host the confidential guest does not
trust, can overwrite guest kernel memory next to an RX buffer with
bytes it chooses, which is enough to take an unprivileged guest
process to root.
Check the length before the sync in the per-fragment loops.
receive_buf() has to sync the header before the length check, because
the mergeable error path reads num_buffers from it, so limit that sync
to the posted length. A device that reports correct lengths sees no
change.
The driver has synced with the device's length since
commit 295525e29a5b ("virtio_net: merge dma operations when filling
mergeable buffers"), at first in virtnet_rq_unmap(). Commit 24fbd3967f3f
("virtio_net: add page_pool support for buffer allocation") moved the
sync to the page_pool call sites that this patch changes, so the patch
applies to v7.1 and later. Older kernels need a separate backport that
limits the sync in virtnet_rq_unmap().
Found by an LLM code review agent auditing users of the DMA API; the
fix and this changelog were also written with an LLM coding assistant
and reviewed by us. Reproduced in QEMU with swiotlb=force and
iommu_platform=on, a test-only device change that reports a used length
64 bytes past the posted buffer and writes a marker there, and a guest
kprobe module that reads the buffer after the sync: without this patch
the marker reaches the guest page for small and mergeable buffers; with
it the packets are dropped and counted in rx_length_errors. The
virtio_net selftest basic_features.sh passes with and without mergeable
buffers.
Fixes: 295525e29a5b ("virtio_net: merge dma operations when filling mergeable buffers")
Cc: stable@vger.kernel.org
Co-developed-by: Nikolai Kalinin <nikolai@kalinidze.me>
Signed-off-by: Nikolai Kalinin <nikolai@kalinidze.me>
Signed-off-by: Vladimir Petrzhikovskii <vladimir@dfb.sh>
Link: https://patch.msgid.link/20261110-b4-virtionet-rxlen-v2-1-6ec5aa0edf9f@dfb.sh
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ vladimir: 6.18.y has no page_pool RX buffers. The driver syncs small
and mergeable RX buffers in virtnet_rq_get_buf() with the length from
the used ring, before any length check. Limit that sync to the length
of the posted buffer; the existing checks then drop the packet. Tested
with the reproducer described above: without this patch the marker
reaches the guest page for small and mergeable buffers; with it the
sync stops at the posted length and the packets are counted in
rx_length_errors. ]
Signed-off-by: Vladimir Petrzhikovskii <vladimir@dfb.sh>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/virtio_net.c | 47 ++++++++++++++++++++++++++++++----------
1 file changed, 36 insertions(+), 11 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 59da65040d047..254f7ff304399 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -805,19 +805,32 @@ static unsigned int mergeable_ctx_to_truesize(void *mrg_ctx)
return (unsigned long)mrg_ctx & ((1 << MRG_CTX_HEADER_SHIFT) - 1);
}
-static int check_mergeable_len(struct net_device *dev, void *mrg_ctx,
- unsigned int len)
+/* Length of the mergeable buffer that add_recvbuf_mergeable() posted. */
+static unsigned int mergeable_ctx_to_buflen(void *mrg_ctx)
{
- unsigned int headroom, tailroom, room, truesize;
+ unsigned int headroom, tailroom, room;
- truesize = mergeable_ctx_to_truesize(mrg_ctx);
headroom = mergeable_ctx_to_headroom(mrg_ctx);
tailroom = headroom ? sizeof(struct skb_shared_info) : 0;
room = SKB_DATA_ALIGN(headroom + tailroom);
- if (len > truesize - room) {
- pr_debug("%s: rx error: len %u exceeds truesize %lu\n",
- dev->name, len, (unsigned long)(truesize - room));
+ return mergeable_ctx_to_truesize(mrg_ctx) - room;
+}
+
+/* Length of the small buffer that add_recvbuf_small() posts. */
+static unsigned int small_buflen(const struct virtnet_info *vi)
+{
+ return vi->hdr_len + GOOD_PACKET_LEN;
+}
+
+static int check_mergeable_len(struct net_device *dev, void *mrg_ctx,
+ unsigned int len)
+{
+ unsigned int buflen = mergeable_ctx_to_buflen(mrg_ctx);
+
+ if (len > buflen) {
+ pr_debug("%s: rx error: len %u exceeds buffer length %u\n",
+ dev->name, len, buflen);
DEV_STATS_INC(dev, rx_length_errors);
return -1;
}
@@ -974,13 +987,25 @@ static void virtnet_rq_unmap(struct receive_queue *rq, void *buf, u32 len)
static void *virtnet_rq_get_buf(struct receive_queue *rq, u32 *len, void **ctx)
{
struct virtnet_info *vi = rq->vq->vdev->priv;
+ void *buf_ctx;
+ u32 buflen;
void *buf;
BUG_ON(vi->big_packets && !vi->mergeable_rx_bufs);
- buf = virtqueue_get_buf_ctx(rq->vq, len, ctx);
- if (buf)
- virtnet_rq_unmap(rq, buf, *len);
+ buf = virtqueue_get_buf_ctx(rq->vq, len, &buf_ctx);
+ if (!buf)
+ return NULL;
+
+ /* The device chooses *len. Sync only the buffer that was posted, so
+ * that a larger *len cannot copy over the buffers next to it.
+ */
+ buflen = vi->mergeable_rx_bufs ? mergeable_ctx_to_buflen(buf_ctx) :
+ small_buflen(vi);
+ virtnet_rq_unmap(rq, buf, min(*len, buflen));
+
+ if (ctx)
+ *ctx = buf_ctx;
return buf;
}
@@ -2698,7 +2723,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
buf += VIRTNET_RX_PAD + xdp_headroom;
- virtnet_rq_init_one_sg(rq, buf, vi->hdr_len + GOOD_PACKET_LEN);
+ virtnet_rq_init_one_sg(rq, buf, small_buflen(vi));
err = virtqueue_add_inbuf_premapped(rq->vq, rq->sg, 1, buf, ctx, gfp);
if (err < 0) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 024/990] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (22 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 023/990] virtio_net: check RX buffer length before DMA sync Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 025/990] sched/deadline: Fix dl_server time accounting Greg Kroah-Hartman
` (828 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthew Schwartz,
Antheas Kapenekakis, Takashi Iwai, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antheas Kapenekakis <lkml@antheas.dev>
[ Upstream commit ba39a31448857da3b848174c9130b466b3ccddba ]
The V2 UEFI spec for per-device calibration data in TAS allows for
manufacturers to specify up to five custom calibration register
addresses and values to optimize per-device in factory.
A basic description of the spec is found in a comment in function
tas2781_apply_calib(). However, currently, for the condition of
p->dspbin_typ != TASDEV_BASIC, if custom calibration addresses have been
provided by the manufacturer, they are ignored and the ones listed in
firmware are used.
In case the manufacturer chose to change different registers other than
the default ones (r0, invr0, r0_low, pow, tlimit), this causes the
UEFI calibration data to scratch different registers and cause the
firmware to misbehave. This is true in the Xbox ROG Ally X, for one of
the firmwares, where it pops and has audio dropouts after the
calibration data is applied.
Therefore, add a new bool to indicate that UEFI supplied custom
calibration addresses, and if so, use them regardless of dspbin_typ.
Closes: https://lore.kernel.org/all/179122346529.6.9250312386131579603.1671009695@8alias.com/
Co-developed-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
Link: https://patch.msgid.link/20261102174052.1216670-1-lkml@antheas.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/codecs/side-codecs/tas2781_hda.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/hda/codecs/side-codecs/tas2781_hda.c b/sound/hda/codecs/side-codecs/tas2781_hda.c
index dc4e42fd88484..c44dfa2757b1a 100644
--- a/sound/hda/codecs/side-codecs/tas2781_hda.c
+++ b/sound/hda/codecs/side-codecs/tas2781_hda.c
@@ -89,6 +89,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
TASDEVICE_REG(0, 0x18, 0x7c),
};
unsigned int crc, oft, node_num;
+ bool custom_addr = false;
unsigned char *buf;
int i, j, k, l;
@@ -129,6 +130,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
for (j = 0, k = 0; j < node_num; j++) {
oft = j * 6 + 3;
if (tmp_val[oft] == TASDEV_UEFI_CALI_REG_ADDR_FLG) {
+ custom_addr = true;
for (i = 0; i < TASDEV_CALIB_N; i++) {
buf = &data[(oft + i + 1) * 4];
cali_reg[i] = TASDEVICE_REG(buf[1],
@@ -188,7 +190,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
}
}
- if (p->dspbin_typ == TASDEV_BASIC) {
+ if (custom_addr || p->dspbin_typ == TASDEV_BASIC) {
r->r0_reg = cali_reg[0];
r->invr0_reg = cali_reg[1];
r->r0_low_reg = cali_reg[2];
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 025/990] sched/deadline: Fix dl_server time accounting
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (23 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 024/990] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 026/990] sched/deadline: Fix dl_server stop condition Greg Kroah-Hartman
` (827 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, 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 e636ffb9e31b4f7dde7fef5358669266b9ce02ec ]
The dl_server time accounting code is a little odd. The normal scheduler
pattern is to update curr before doing something, such that the old state is
fully accounted before changing state.
Notably, the dl_server_timer() needs to propagate the current time accounting
since the current task could be ran by dl_server and thus this can affect
dl_se->runtime. Similarly for dl_server_start().
And since the (deferred) dl_server wants idle time accounted, rework
sched_idle_class time accounting to be more like all the others.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251020141130.GJ3245006@noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/deadline.c | 40 +++++++++++++++-------------------------
kernel/sched/fair.c | 9 ++-------
kernel/sched/idle.c | 16 +++++++++++++++-
kernel/sched/sched.h | 3 +--
4 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 0180758d90af8..cb048165ca537 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1171,8 +1171,12 @@ static enum hrtimer_restart dl_server_timer(struct hrtimer *timer, struct sched_
sched_clock_tick();
update_rq_clock(rq);
- if (!dl_se->dl_runtime)
- return HRTIMER_NORESTART;
+ /*
+ * Make sure current has propagated its pending runtime into
+ * any relevant server through calling dl_server_update() and
+ * friends.
+ */
+ rq->donor->sched_class->update_curr(rq);
if (dl_se->dl_defer_armed) {
/*
@@ -1548,35 +1552,16 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
* as time available for the fair server, avoiding a penalty for the
* rt scheduler that did not consumed that time.
*/
-void dl_server_update_idle_time(struct rq *rq, struct task_struct *p)
+void dl_server_update_idle(struct sched_dl_entity *dl_se, s64 delta_exec)
{
- s64 delta_exec;
-
- if (!rq->fair_server.dl_defer)
- return;
-
- /* no need to discount more */
- if (rq->fair_server.runtime < 0)
- return;
-
- delta_exec = rq_clock_task(rq) - p->se.exec_start;
- if (delta_exec < 0)
- return;
-
- rq->fair_server.runtime -= delta_exec;
-
- if (rq->fair_server.runtime < 0) {
- rq->fair_server.dl_defer_running = 0;
- rq->fair_server.runtime = 0;
- }
-
- p->se.exec_start = rq_clock_task(rq);
+ if (dl_se->dl_server_active && dl_se->dl_runtime && dl_se->dl_defer)
+ update_curr_dl_se(dl_se->rq, dl_se, delta_exec);
}
void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
{
/* 0 runtime = fair server disabled */
- if (dl_se->dl_runtime)
+ if (dl_se->dl_server_active && dl_se->dl_runtime)
update_curr_dl_se(dl_se->rq, dl_se, delta_exec);
}
@@ -1787,6 +1772,11 @@ void dl_server_start(struct sched_dl_entity *dl_se)
if (!dl_server(dl_se) || dl_se->dl_server_active)
return;
+ /*
+ * Update the current task to 'now'.
+ */
+ rq->donor->sched_class->update_curr(rq);
+
if (WARN_ON_ONCE(!cpu_online(cpu_of(rq))))
return;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a063e302fbf8e..4052ed6e1330c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1325,8 +1325,7 @@ static void update_curr(struct cfs_rq *cfs_rq)
* against fair_server such that it can account for this time
* and possibly avoid running this period.
*/
- if (dl_server_active(&rq->fair_server))
- dl_server_update(&rq->fair_server, delta_exec);
+ dl_server_update(&rq->fair_server, delta_exec);
}
account_cfs_rq_runtime(cfs_rq, delta_exec);
@@ -7176,12 +7175,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
h_nr_idle = 1;
}
- if (!rq_h_nr_queued && rq->cfs.h_nr_queued) {
- /* Account for idle runtime */
- if (!rq->nr_running)
- dl_server_update_idle_time(rq, rq->curr);
+ if (!rq_h_nr_queued && rq->cfs.h_nr_queued)
dl_server_start(&rq->fair_server);
- }
/* At this point se is NULL and we are at root level*/
add_nr_running(rq, 1);
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index d5607b2150ba4..5dd4d1de1864e 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -473,9 +473,11 @@ static void wakeup_preempt_idle(struct rq *rq, struct task_struct *p, int flags)
resched_curr(rq);
}
+static void update_curr_idle(struct rq *rq);
+
static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct task_struct *next)
{
- dl_server_update_idle_time(rq, prev);
+ update_curr_idle(rq);
scx_update_idle(rq, false, true);
}
@@ -523,6 +525,7 @@ dequeue_task_idle(struct rq *rq, struct task_struct *p, int flags)
*/
static void task_tick_idle(struct rq *rq, struct task_struct *curr, int queued)
{
+ update_curr_idle(rq);
}
static void switching_to_idle(struct rq *rq, struct task_struct *p)
@@ -538,6 +541,17 @@ prio_changed_idle(struct rq *rq, struct task_struct *p, int oldprio)
static void update_curr_idle(struct rq *rq)
{
+ struct sched_entity *se = &rq->idle->se;
+ u64 now = rq_clock_task(rq);
+ s64 delta_exec;
+
+ delta_exec = now - se->exec_start;
+ if (unlikely(delta_exec <= 0))
+ return;
+
+ se->exec_start = now;
+
+ dl_server_update_idle(&rq->fair_server, delta_exec);
}
/*
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 81ccbfbb81521..3a38b9a2c9bca 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -405,6 +405,7 @@ extern s64 dl_scaled_delta_exec(struct rq *rq, struct sched_dl_entity *dl_se, s6
* naturally thottled to once per period, avoiding high context switch
* workloads from spamming the hrtimer program/cancel paths.
*/
+extern void dl_server_update_idle(struct sched_dl_entity *dl_se, s64 delta_exec);
extern void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec);
extern void dl_server_start(struct sched_dl_entity *dl_se);
extern void dl_server_stop(struct sched_dl_entity *dl_se);
@@ -412,8 +413,6 @@ extern void dl_server_init(struct sched_dl_entity *dl_se, struct rq *rq,
dl_server_pick_f pick_task);
extern void sched_init_dl_servers(void);
-extern void dl_server_update_idle_time(struct rq *rq,
- struct task_struct *p);
extern void fair_server_init(struct rq *rq);
extern void __dl_server_attach_root(struct sched_dl_entity *dl_se, struct rq *rq);
extern int dl_server_apply_params(struct sched_dl_entity *dl_se,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 026/990] sched/deadline: Fix dl_server stop condition
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (24 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 025/990] sched/deadline: Fix dl_server time accounting Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 027/990] sched: Provide idle_rq() helper Greg Kroah-Hartman
` (826 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gabriele Monaco,
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 f5a538c07df26f5c601e41f7b9c7ade3e1e75803 ]
Gabriel reported that the dl_server doesn't stop as expected.
The problem was found to be the fact that idle time and fair runtime are
treated equally. Both will count towards dl_server runtime and push the
activation forwards when it is in the zero-laxity wait state.
Notably:
dl_server_update_idle()
update_curr_dl_se()
if (dl_defer && dl_throttled && dl_runtime_exceeded())
hrtimer_try_to_cancel(); // stop timer
replenish_dl_new_period()
deadline = now + dl_deadline; // fwd period
runtime = dl_runtime;
start_dl_timer(); // restart timer
And while we do want idle time accounted towards the *current* activation of
the dl_server -- after all, a fair task could've ran if we had any -- we don't
necessarily want idle time to cause or push forward an activation.
Introduce dl_defer_idle to make this distinction. It will be set once idle time
pushed the activation forward, once set idle time will only be allowed to
consume any runtime but not push the activation. This will then cause
dl_server_timer() to fire, which will stop the dl_server.
Any non-idle time accounting during this phase will clear dl_defer_idle, so
only a full period of idle will cause the dl_server to stop.
Reported-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251101000057.GA2184199@noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/sched.h | 15 +++++++++------
kernel/sched/deadline.c | 40 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 51b80e816fec7..cf5f57cd95104 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -681,20 +681,22 @@ struct sched_dl_entity {
*
* @dl_server tells if this is a server entity.
*
- * @dl_defer tells if this is a deferred or regular server. For
- * now only defer server exists.
- *
- * @dl_defer_armed tells if the deferrable server is waiting
- * for the replenishment timer to activate it.
- *
* @dl_server_active tells if the dlserver is active(started).
* dlserver is started on first cfs enqueue on an idle runqueue
* and is stopped when a dequeue results in 0 cfs tasks on the
* runqueue. In other words, dlserver is active only when cpu's
* runqueue has atleast one cfs task.
*
+ * @dl_defer tells if this is a deferred or regular server. For
+ * now only defer server exists.
+ *
+ * @dl_defer_armed tells if the deferrable server is waiting
+ * for the replenishment timer to activate it.
+ *
* @dl_defer_running tells if the deferrable server is actually
* running, skipping the defer phase.
+ *
+ * @dl_defer_idle tracks idle state
*/
unsigned int dl_throttled : 1;
unsigned int dl_yielded : 1;
@@ -705,6 +707,7 @@ struct sched_dl_entity {
unsigned int dl_defer : 1;
unsigned int dl_defer_armed : 1;
unsigned int dl_defer_running : 1;
+ unsigned int dl_defer_idle : 1;
/*
* Bandwidth enforcement timer. Each -deadline task has its
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index cb048165ca537..7064c8985b3db 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1178,6 +1178,11 @@ static enum hrtimer_restart dl_server_timer(struct hrtimer *timer, struct sched_
*/
rq->donor->sched_class->update_curr(rq);
+ if (dl_se->dl_defer_idle) {
+ dl_server_stop(dl_se);
+ return HRTIMER_NORESTART;
+ }
+
if (dl_se->dl_defer_armed) {
/*
* First check if the server could consume runtime in background.
@@ -1425,10 +1430,11 @@ s64 dl_scaled_delta_exec(struct rq *rq, struct sched_dl_entity *dl_se, s64 delta
}
static inline void
-update_stats_dequeue_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se,
- int flags);
+update_stats_dequeue_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se, int flags);
+
static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64 delta_exec)
{
+ bool idle = rq->curr == rq->idle;
s64 scaled_delta_exec;
if (unlikely(delta_exec <= 0)) {
@@ -1449,6 +1455,9 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
dl_se->runtime -= scaled_delta_exec;
+ if (dl_se->dl_defer_idle && !idle)
+ dl_se->dl_defer_idle = 0;
+
/*
* The fair server can consume its runtime while throttled (not queued/
* running as regular CFS).
@@ -1458,6 +1467,29 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
* starting a new period, pushing the activation.
*/
if (dl_se->dl_defer && dl_se->dl_throttled && dl_runtime_exceeded(dl_se)) {
+ /*
+ * Non-servers would never get time accounted while throttled.
+ */
+ WARN_ON_ONCE(!dl_server(dl_se));
+
+ /*
+ * While the server is marked idle, do not push out the
+ * activation further, instead wait for the period timer
+ * to lapse and stop the server.
+ */
+ if (dl_se->dl_defer_idle && idle) {
+ /*
+ * The timer is at the zero-laxity point, this means
+ * dl_server_stop() / dl_server_start() can happen
+ * while now < deadline. This means update_dl_entity()
+ * will not replenish. Additionally start_dl_timer()
+ * will be set for 'deadline - runtime'. Negative
+ * runtime will not do.
+ */
+ dl_se->runtime = 0;
+ return;
+ }
+
/*
* If the server was previously activated - the starving condition
* took place, it this point it went away because the fair scheduler
@@ -1470,6 +1502,9 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
replenish_dl_new_period(dl_se, dl_se->rq);
+ if (idle)
+ dl_se->dl_defer_idle = 1;
+
/*
* Not being able to start the timer seems problematic. If it could not
* be started for whatever reason, we need to "unthrottle" the DL server
@@ -1795,6 +1830,7 @@ void dl_server_stop(struct sched_dl_entity *dl_se)
hrtimer_try_to_cancel(&dl_se->dl_timer);
dl_se->dl_defer_armed = 0;
dl_se->dl_throttled = 0;
+ dl_se->dl_defer_idle = 0;
dl_se->dl_server_active = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 027/990] sched: Provide idle_rq() helper
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (25 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 026/990] sched/deadline: Fix dl_server stop condition Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 028/990] sched/deadline: Fix server stopping with runnable tasks Greg Kroah-Hartman
` (825 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, 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 1e0a2ba7afb1b60f02599093d84b72ce62ad11c0 ]
A fix for the dl_server 'requires' idle_cpu() usage, which made me
note that it and available_idle_cpu() are extern function calls.
And while idle_cpu() is used outside of kernel/sched/,
available_idle_cpu() is not.
This makes it hard to make idle_cpu() an inline helper, so provide
idle_rq() and implement idle_cpu() and available_idle_cpu() using
that.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/sched.h | 1 -
kernel/sched/sched.h | 22 ++++++++++++++++++++++
kernel/sched/syscalls.c | 30 +-----------------------------
3 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cf5f57cd95104..d3e1262da4354 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1915,7 +1915,6 @@ static inline int task_nice(const struct task_struct *p)
extern int can_nice(const struct task_struct *p, const int nice);
extern int task_curr(const struct task_struct *p);
extern int idle_cpu(int cpu);
-extern int available_idle_cpu(int cpu);
extern int sched_setscheduler(struct task_struct *, int, const struct sched_param *);
extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sched_param *);
extern void sched_set_fifo(struct task_struct *p);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 3a38b9a2c9bca..ad7b72317f0f2 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1361,6 +1361,28 @@ static inline u32 sched_rng(void)
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
#define raw_rq() raw_cpu_ptr(&runqueues)
+static inline bool idle_rq(struct rq *rq)
+{
+ return rq->curr == rq->idle && !rq->nr_running && !rq->ttwu_pending;
+}
+
+/**
+ * available_idle_cpu - is a given CPU idle for enqueuing work.
+ * @cpu: the CPU in question.
+ *
+ * Return: 1 if the CPU is currently idle. 0 otherwise.
+ */
+static inline bool available_idle_cpu(int cpu)
+{
+ if (!idle_rq(cpu_rq(cpu)))
+ return 0;
+
+ if (vcpu_is_preempted(cpu))
+ return 0;
+
+ return 1;
+}
+
#ifdef CONFIG_SCHED_PROXY_EXEC
static inline void rq_set_donor(struct rq *rq, struct task_struct *t)
{
diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
index b044a3aa4a0ad..1c48d7eefee7b 100644
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -190,35 +190,7 @@ int task_prio(const struct task_struct *p)
*/
int idle_cpu(int cpu)
{
- struct rq *rq = cpu_rq(cpu);
-
- if (rq->curr != rq->idle)
- return 0;
-
- if (rq->nr_running)
- return 0;
-
- if (rq->ttwu_pending)
- return 0;
-
- return 1;
-}
-
-/**
- * available_idle_cpu - is a given CPU idle for enqueuing work.
- * @cpu: the CPU in question.
- *
- * Return: 1 if the CPU is currently idle. 0 otherwise.
- */
-int available_idle_cpu(int cpu)
-{
- if (!idle_cpu(cpu))
- return 0;
-
- if (vcpu_is_preempted(cpu))
- return 0;
-
- return 1;
+ return idle_rq(cpu_rq(cpu));
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 028/990] sched/deadline: Fix server stopping with runnable tasks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (26 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 027/990] sched: Provide idle_rq() helper Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 029/990] xfs: only assert new size for datafork during truncate extents Greg Kroah-Hartman
` (824 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gabriele Monaco,
Peter Zijlstra (Intel), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <gmonaco@redhat.com>
[ Upstream commit ca1e8eede4fc68ce85a9fdce1a6c13ad64933318 ]
The deadline server can currently stop due to idle although fair tasks
are runnable. This happens essentially when:
* the server is set to idle, a task wakes up, the server stops
* a task wakes up, the server sets itself to idle and stops right away
Address both cases by clearing the server idle flag whenever a fair task
wakes up and accounting also for pending tasks in the definition of idle.
Fixes: f5a538c07df2 ("sched/deadline: Fix dl_server stop condition")
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260113085159.114226-3-gmonaco@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/deadline.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 7064c8985b3db..1c677016115a9 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1434,7 +1434,7 @@ update_stats_dequeue_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se, int
static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64 delta_exec)
{
- bool idle = rq->curr == rq->idle;
+ bool idle = idle_rq(rq);
s64 scaled_delta_exec;
if (unlikely(delta_exec <= 0)) {
@@ -1617,8 +1617,8 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
* | 8 | B:zero_laxity-wait | | |
* | | | <---+ |
* | +--------------------------------+ |
- * | | ^ ^ 2 |
- * | | 7 | 2 +--------------------+
+ * | | ^ ^ 2 |
+ * | | 7 | 2, 1 +----------------+
* | v |
* | +-------------+ |
* +-- | C:idle-wait | -+
@@ -1663,8 +1663,11 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
* dl_defer_idle = 0
*
*
- * [1] A->B, A->D
+ * [1] A->B, A->D, C->B
* dl_server_start()
+ * dl_defer_idle = 0;
+ * if (dl_server_active)
+ * return; // [B]
* dl_server_active = 1;
* enqueue_dl_entity()
* update_dl_entity(WAKEUP)
@@ -1779,6 +1782,7 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
* "B:zero_laxity-wait" -> "C:idle-wait" [label="7:dl_server_update_idle"]
* "B:zero_laxity-wait" -> "D:running" [label="3:dl_server_timer"]
* "C:idle-wait" -> "A:init" [label="8:dl_server_timer"]
+ * "C:idle-wait" -> "B:zero_laxity-wait" [label="1:dl_server_start"]
* "C:idle-wait" -> "B:zero_laxity-wait" [label="2:dl_server_update"]
* "C:idle-wait" -> "C:idle-wait" [label="7:dl_server_update_idle"]
* "D:running" -> "A:init" [label="4:pick_task_dl"]
@@ -1804,6 +1808,7 @@ void dl_server_start(struct sched_dl_entity *dl_se)
{
struct rq *rq = dl_se->rq;
+ dl_se->dl_defer_idle = 0;
if (!dl_server(dl_se) || dl_se->dl_server_active)
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 029/990] xfs: only assert new size for datafork during truncate extents
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (27 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 028/990] sched/deadline: Fix server stopping with runnable tasks Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 030/990] fbdev: bound mode sysfs output to the sysfs buffer Greg Kroah-Hartman
` (823 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Darrick J. Wong, Long Li,
Carlos Maiolino, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <leo.lilong@huawei.com>
[ Upstream commit e942498385bf80f4d6d075b47174035545eb6a2e ]
The assertion functions properly because we currently only truncate the
attr to a zero size. Any other new size of the attr is not preempted.
Make this assertion is specific to the datafork, preparing for
subsequent patches to truncate the attribute to a non-zero size.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Long Li <leo.lilong@huawei.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/xfs/xfs_inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 36b39539e561a..c5afc8997fb4e 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1048,7 +1048,8 @@ xfs_itruncate_extents_flags(
xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
if (icount_read(VFS_I(ip)))
xfs_assert_ilocked(ip, XFS_IOLOCK_EXCL);
- ASSERT(new_size <= XFS_ISIZE(ip));
+ if (whichfork == XFS_DATA_FORK)
+ ASSERT(new_size <= XFS_ISIZE(ip));
ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
ASSERT(ip->i_itemp != NULL);
ASSERT(ip->i_itemp->ili_lock_flags == 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 030/990] fbdev: bound mode sysfs output to the sysfs buffer
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (28 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 029/990] xfs: only assert new size for datafork during truncate extents Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 031/990] fbdev: clear fb_info->mode before deleting a videomode Greg Kroah-Hartman
` (822 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Melbin K Mathew, Helge Deller,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melbin K Mathew <mlbnkm1@gmail.com>
[ Upstream commit d15d51fb26e830af58f3f21964f1c09c239077ea ]
mode_string() uses snprintf() which can return a value larger than the
remaining buffer space. show_modes() accumulates the return value into i
without checking whether i has reached PAGE_SIZE, causing the offset to
advance past the sysfs buffer if the modelist is long enough.
Add a size parameter to mode_string() and use scnprintf() to return
only the bytes actually written. Add an early return when offset
already exceeds the buffer. In show_modes(), stop accumulating once
the buffer is full.
Cc: stable@vger.kernel.org # v7.1+
Signed-off-by: Melbin K Mathew <mlbnkm1@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/video/fbdev/core/fbsysfs.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c
index d363f94207c3e..49d886c2dd7c8 100644
--- a/drivers/video/fbdev/core/fbsysfs.c
+++ b/drivers/video/fbdev/core/fbsysfs.c
@@ -28,12 +28,15 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var)
return 0;
}
-static int mode_string(char *buf, unsigned int offset,
+static int mode_string(char *buf, size_t size, unsigned int offset,
const struct fb_videomode *mode)
{
char m = 'U';
char v = 'p';
+ if (offset >= size)
+ return 0;
+
if (mode->flag & FB_MODE_IS_DETAILED)
m = 'D';
if (mode->flag & FB_MODE_IS_VESA)
@@ -46,7 +49,7 @@ static int mode_string(char *buf, unsigned int offset,
if (mode->vmode & FB_VMODE_DOUBLE)
v = 'd';
- return snprintf(&buf[offset], PAGE_SIZE - offset, "%c:%dx%d%c-%d\n",
+ return scnprintf(&buf[offset], size - offset, "%c:%dx%d%c-%d\n",
m, mode->xres, mode->yres, v, mode->refresh);
}
@@ -65,7 +68,7 @@ static ssize_t store_mode(struct device *device, struct device_attribute *attr,
list_for_each_entry(modelist, &fb_info->modelist, list) {
mode = &modelist->mode;
- i = mode_string(mstr, 0, mode);
+ i = mode_string(mstr, sizeof(mstr), 0, mode);
if (strncmp(mstr, buf, max(count, i)) == 0) {
var = fb_info->var;
@@ -87,7 +90,7 @@ static ssize_t show_mode(struct device *device, struct device_attribute *attr,
if (!fb_info->mode)
return 0;
- return mode_string(buf, 0, fb_info->mode);
+ return mode_string(buf, PAGE_SIZE, 0, fb_info->mode);
}
static ssize_t store_modes(struct device *device,
@@ -137,7 +140,9 @@ static ssize_t show_modes(struct device *device, struct device_attribute *attr,
i = 0;
list_for_each_entry(modelist, &fb_info->modelist, list) {
mode = &modelist->mode;
- i += mode_string(buf, i, mode);
+ i += mode_string(buf, PAGE_SIZE, i, mode);
+ if (i >= PAGE_SIZE - 1)
+ break;
}
return i;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 031/990] fbdev: clear fb_info->mode before deleting a videomode
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (29 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 030/990] fbdev: bound mode sysfs output to the sysfs buffer Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 032/990] fbdev: serialize mode sysfs access with lock_fb_info() Greg Kroah-Hartman
` (821 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Melbin K Mathew, Helge Deller,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melbin K Mathew <mlbnkm1@gmail.com>
[ Upstream commit 95e647d2a5304a8fd11f1ba3c8502de700650131 ]
fb_set_var() can delete a mode from info->modelist when userspace
passes FB_ACTIVATE_INV_MODE through FBIOPUT_VSCREENINFO. The code
checks that the mode being deleted is not the current info->var and
that fbcon is not using it, but it does not check fb_info->mode.
fb_info->mode may still point into the modelist entry being deleted.
If the entry is freed, later mode sysfs reads through show_mode() can
dereference a stale pointer.
Clear fb_info->mode before calling fb_delete_videomode() when it
matches the mode being removed.
Cc: stable@vger.kernel.org # v7.1+
Signed-off-by: Melbin K Mathew <mlbnkm1@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/video/fbdev/core/fbmem.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 1533d43a0a0c9..8f9aa10453436 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -246,8 +246,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
ret = fb_mode_is_equal(&mode1, &mode2);
if (!ret) {
ret = fbcon_mode_deleted(info, &mode1);
- if (!ret)
+ if (!ret) {
+ if (info->mode && fb_mode_is_equal(info->mode, &mode1))
+ info->mode = NULL;
fb_delete_videomode(&mode1, &info->modelist);
+ }
}
return ret ? -EINVAL : 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 032/990] fbdev: serialize mode sysfs access with lock_fb_info()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (30 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 031/990] fbdev: clear fb_info->mode before deleting a videomode Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 033/990] Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts" Greg Kroah-Hartman
` (820 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Melbin K Mathew, Helge Deller,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melbin K Mathew <mlbnkm1@gmail.com>
[ Upstream commit 061db6b7a910b8378f3b2df64f8c0a3ddc6e85f2 ]
show_mode(), show_modes(), and store_mode() access fb_info->modelist
and fb_info->mode without holding lock_fb_info(). store_modes() takes
lock_fb_info() while replacing the modelist and freeing the old one.
A concurrent reader or writer can load a pointer to an old modelist
entry before store_modes() frees it, then dereference freed memory or
store a stale freed pointer in fb_info->mode.
Take lock_fb_info() in show_mode(), show_modes(), and store_mode() to
serialize with store_modes(). In show_mode(), copy the mode to the
stack and format after dropping the lock. In store_mode(), split
activate() into a _locked variant to avoid double-locking, and hold
the locks for the modelist walk, mode conversion, activation, and
fb_info->mode assignment together.
Cc: stable@vger.kernel.org # v7.1+
Signed-off-by: Melbin K Mathew <mlbnkm1@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/video/fbdev/core/fbsysfs.c | 46 ++++++++++++++++++++++++------
1 file changed, 38 insertions(+), 8 deletions(-)
diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c
index 49d886c2dd7c8..c32dd71a38e1c 100644
--- a/drivers/video/fbdev/core/fbsysfs.c
+++ b/drivers/video/fbdev/core/fbsysfs.c
@@ -13,19 +13,24 @@
#include "fb_internal.h"
#include "fbcon.h"
+static int activate_locked(struct fb_info *fb_info,
+ struct fb_var_screeninfo *var)
+{
+ var->activate |= FB_ACTIVATE_FORCE;
+ return fb_set_var_from_user(fb_info, var);
+}
+
static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var)
{
int err;
- var->activate |= FB_ACTIVATE_FORCE;
console_lock();
lock_fb_info(fb_info);
- err = fb_set_var_from_user(fb_info, var);
+ err = activate_locked(fb_info, var);
unlock_fb_info(fb_info);
console_unlock();
- if (err)
- return err;
- return 0;
+
+ return err;
}
static int mode_string(char *buf, size_t size, unsigned int offset,
@@ -66,6 +71,9 @@ static ssize_t store_mode(struct device *device, struct device_attribute *attr,
memset(&var, 0, sizeof(var));
+ console_lock();
+ lock_fb_info(fb_info);
+
list_for_each_entry(modelist, &fb_info->modelist, list) {
mode = &modelist->mode;
i = mode_string(mstr, sizeof(mstr), 0, mode);
@@ -73,12 +81,22 @@ static ssize_t store_mode(struct device *device, struct device_attribute *attr,
var = fb_info->var;
fb_videomode_to_var(&var, mode);
- if ((err = activate(fb_info, &var)))
+ err = activate_locked(fb_info, &var);
+ if (err) {
+ unlock_fb_info(fb_info);
+ console_unlock();
return err;
+ }
fb_info->mode = mode;
+ unlock_fb_info(fb_info);
+ console_unlock();
return count;
}
}
+
+ unlock_fb_info(fb_info);
+ console_unlock();
+
return -EINVAL;
}
@@ -86,11 +104,20 @@ static ssize_t show_mode(struct device *device, struct device_attribute *attr,
char *buf)
{
struct fb_info *fb_info = dev_get_drvdata(device);
+ struct fb_videomode mode;
+ bool have_mode = false;
- if (!fb_info->mode)
+ lock_fb_info(fb_info);
+ if (fb_info->mode) {
+ mode = *fb_info->mode;
+ have_mode = true;
+ }
+ unlock_fb_info(fb_info);
+
+ if (!have_mode)
return 0;
- return mode_string(buf, PAGE_SIZE, 0, fb_info->mode);
+ return mode_string(buf, PAGE_SIZE, 0, &mode);
}
static ssize_t store_modes(struct device *device,
@@ -138,12 +165,15 @@ static ssize_t show_modes(struct device *device, struct device_attribute *attr,
const struct fb_videomode *mode;
i = 0;
+ lock_fb_info(fb_info);
list_for_each_entry(modelist, &fb_info->modelist, list) {
mode = &modelist->mode;
i += mode_string(buf, PAGE_SIZE, i, mode);
if (i >= PAGE_SIZE - 1)
break;
}
+ unlock_fb_info(fb_info);
+
return i;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 033/990] Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts"
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (31 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 032/990] fbdev: serialize mode sysfs access with lock_fb_info() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 034/990] netrom: send the unacknowledged frames again when T1 or T4 expires Greg Kroah-Hartman
` (819 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 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 15465d681517c6180e709d749c50fba34c4ef419.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../drm/nouveau/nvkm/subdev/devinit/gf100.c | 20 -------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
index 186e09ea0cb10..5368e705e7fd6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
@@ -27,7 +27,6 @@
#include <subdev/bios/init.h>
#include <subdev/bios/pll.h>
#include <subdev/clk/pll.h>
-#include <subdev/vga.h>
int
gf100_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)
@@ -100,25 +99,6 @@ gf100_devinit_preinit(struct nvkm_devinit *base)
* can use it as a reliable way to know whether we should run devinit.
*/
base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0);
-
- /*
- * However some VBIOS init sequences miss this bit. So fall back to
- * the nv50 method of checking if the bit is not set. Running the
- * VBIOS multiple times may have detrimental effects.
- */
- if (base->post) {
- u64 disable = nvkm_devinit_disable(base);
- /* magic to detect whether or not x86 vbios code has
- * executed the devinit scripts to initialise the
- * board. only works if there's a display engine.
- */
- if (!(disable & (1ULL << NVKM_ENGINE_DISP))) {
- if (nvkm_rdvgac(device, 0, 0x00) ||
- nvkm_rdvgac(device, 0, 0x1a)) {
- base->post = false;
- }
- }
- }
}
static const struct nvkm_devinit_func
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 034/990] netrom: send the unacknowledged frames again when T1 or T4 expires
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (32 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 033/990] Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts" Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 035/990] ax25: drop a message being reassembled when a new one starts Greg Kroah-Hartman
` (818 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
When T1 expires in state 3, nr_t1timer_expiry() moves the frames of the
ack queue back to the write queue with nr_requeue_frames(), but does not
call nr_kick(). nr_kick() only runs when a frame comes in from the peer
or when the application writes, so if the peer stays silent (one way
transfer, last frame or its acknowledgment lost) nothing is sent
again: after N2 expiries the circuit is cleared with ETIMEDOUT without
a single retransmission. The comment above nr_requeue_frames() says the
frames are "picked up by nr_kick called from the timer", but no timer
calls it.
T4 has the same gap: when the peer's busy condition times out, the
frames held back while it was choked stay queued until something else
calls nr_kick().
Call nr_kick() after nr_requeue_frames() in the T1 expiry, and after
clearing NR_COND_PEER_RX_BUSY in the T4 expiry. nr_kick() already does
nothing outside state 3 or while the peer is busy, and sends from V(A)
once the ack queue is empty, so the T1 retransmission resends the
window from the first unacknowledged frame. The N2 count and the time
at which the circuit is cleared are unchanged.
Tested in two QEMU guests (6.12.94, KASAN and lockdep) linked over a
serial mkiss port: the guest under test runs netrom with T1 = 5 s,
N2 = 3 and T4 = 3 s; the other guest plays a NET/ROM node from user
space with an AX.25 socket and acknowledges nothing.
- three frames written on a circuit: before, each was sent once and
the circuit was cleared 20.7 s later; after, the three are sent
again at 5.4, 10.5 and 15.6 s and the circuit is still cleared
20.7 s later;
- the peer acknowledges the first frame with CHOKE, then a second
frame is written: before, it was never sent; after, it goes out when
T4 expires (3.1 s after the CHOKE), then again on T1.
No kernel report in either run.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit d07ed33f39eca24db1f1b15e00ef7c4447408a0d)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netrom/nr_subr.c | 6 +++---
net/netrom/nr_timer.c | 4 ++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c
index c3bbd5880850b..144d9c5ea5b17 100644
--- a/net/netrom/nr_subr.c
+++ b/net/netrom/nr_subr.c
@@ -61,9 +61,9 @@ void nr_frames_acked(struct sock *sk, unsigned short nr)
}
/*
- * Requeue all the un-ack-ed frames on the output queue to be picked
- * up by nr_kick called from the timer. This arrangement handles the
- * possibility of an empty output queue.
+ * Requeue all the un-ack-ed frames on the output queue to be sent
+ * again by nr_kick(), which the T1 timer calls next. This arrangement
+ * handles the possibility of an empty output queue.
*/
void nr_requeue_frames(struct sock *sk)
{
diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c
index b3a62b1f3a09e..0be44b88f8948 100644
--- a/net/netrom/nr_timer.c
+++ b/net/netrom/nr_timer.c
@@ -171,6 +171,8 @@ static void nr_t4timer_expiry(struct timer_list *t)
bh_lock_sock(sk);
nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY;
+ /* the peer is assumed ready again: send what was held back */
+ nr_kick(sk);
bh_unlock_sock(sk);
sock_put(sk);
}
@@ -238,6 +240,8 @@ static void nr_t1timer_expiry(struct timer_list *t)
} else {
nr->n2count++;
nr_requeue_frames(sk);
+ /* nothing else sends them if the peer stays silent */
+ nr_kick(sk);
}
break;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 035/990] ax25: drop a message being reassembled when a new one starts
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (33 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 034/990] netrom: send the unacknowledged frames again when T1 or T4 expires Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 036/990] rose: reset a call when a DATA packet arrives out of sequence Greg Kroah-Hartman
` (817 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
ax25_rx_fragment() only accepts, while a message is being reassembled
(fragno != 0), the segment numbered fragno - 1. A new first segment, or
a segment with another number, falls through to "return 0" and is
freed, but fragno keeps its value. Since every first segment is then
refused, and no segment can ever match fragno - 1 again, every later
segmented message of the connection is thrown away, until the
connection is closed. The I frames carrying them have already been
acknowledged, so the sender has no way to know.
This happens whenever the peer gives up a message half way, for
instance a station on an older kernel that interleaves the segments of
two messages, or one that fails to allocate a segment in the middle of
a message.
When a segment does not continue the message being reassembled, purge
the queue and reset fragno and fraglen. A first segment then starts a
new message; any other segment is dropped as before.
Tested in two QEMU guests (6.12.94, KASAN and lockdep) linked over a
serial mkiss port; one guest builds the segments itself on an AX.25
socket with AX25_PIDINCL and sends: a 2 segment message, the first
segment of a 3 segment message and nothing more, a 2 segment message,
a 3 segment message without its second segment, a 2 segment message and
an unsegmented one. Before, the receiver got the first message and the
unsegmented one only; after, it gets the three complete segmented
messages and the unsegmented one. No kernel report.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit bb9180c5adfc874ec340caca45b5f3f4d448fcf8)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ax25/ax25_in.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index fd8669e5b7313..068f0c6c54cef 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -87,16 +87,26 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
return 1;
}
}
- } else {
- /* First fragment received */
- if (*skb->data & AX25_SEG_FIRST) {
- skb_queue_purge(&ax25->frag_queue);
- ax25->fragno = *skb->data & AX25_SEG_REM;
- skb_pull(skb, 1); /* skip fragno */
- ax25->fraglen = skb->len;
- skb_queue_tail(&ax25->frag_queue, skb);
- return 1;
- }
+
+ /*
+ * A new first segment, or a segment out of order: the message
+ * being reassembled can no longer be completed. Drop it, or
+ * fragno would never come back to 0 and every later segmented
+ * message of this connection would be thrown away as well.
+ */
+ skb_queue_purge(&ax25->frag_queue);
+ ax25->fragno = 0;
+ ax25->fraglen = 0;
+ }
+
+ /* First fragment received */
+ if (*skb->data & AX25_SEG_FIRST) {
+ skb_queue_purge(&ax25->frag_queue);
+ ax25->fragno = *skb->data & AX25_SEG_REM;
+ skb_pull(skb, 1); /* skip fragno */
+ ax25->fraglen = skb->len;
+ skb_queue_tail(&ax25->frag_queue, skb);
+ return 1;
}
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 036/990] rose: reset a call when a DATA packet arrives out of sequence
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (34 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 035/990] ax25: drop a message being reassembled when a new one starts Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 037/990] ax25: end a REJ recovery count once frames are acknowledged Greg Kroah-Hartman
` (816 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
In state 3, rose_state3_machine() drops a DATA packet whose N(S) is not
the expected V(R) and says nothing about it: the packet is not queued,
and at most an RR with the unchanged N(R) goes out later. ROSE never
sends a DATA packet again, so once a packet has been lost on the way (a
relay dropped it, or a link was reset under it), every following packet
is dropped as well, the window of the sender fills up and the call
hangs until one side clears it.
X.25 resets the call when P(S) is not the one expected. Do the same:
acknowledge what arrived in sequence with rose_enquiry_response(), so
that the sender frees those packets, then send RESET REQUEST and go to
state 4, as the other error cases of this function already do. On the
RESET, the sender sends again the packets it still holds, from N(S) 0.
Tested in two QEMU guests (6.12.94, KASAN and lockdep) linked over a
serial mkiss port. The calling guest runs a rose module changed for the
bench only to drop the third DATA packet it sends, keeping it on its
ack queue as if a relay had lost it; it writes d0 to d5 on the call.
Before, the called guest received d0 and d1, and the caller still had
3840 bytes queued 25 s later; after, the called guest received d0 to d5
in order, without duplicates, and the caller's queue was empty. No
kernel report.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit e15162d237ddecc2c1215f49b76f4cba06bbc2c8)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/rose/rose_in.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c
index befb4c55e4597..b58f3b2700a69 100644
--- a/net/rose/rose_in.c
+++ b/net/rose/rose_in.c
@@ -194,6 +194,27 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety
if (atomic_read(&sk->sk_rmem_alloc) >
(sk->sk_rcvbuf >> 1))
rose->condition |= ROSE_COND_OWN_RX_BUSY;
+ } else {
+ /*
+ * A DATA packet was lost on the way: a relay dropped
+ * it, or a link was reset under it. ROSE never sends a
+ * DATA packet again, so the window of the sender would
+ * stay full and the call would hang. Acknowledge what
+ * arrived in sequence, then reset the call (X.25:
+ * invalid P(S)); the sender then sends its
+ * unacknowledged packets again.
+ */
+ rose_enquiry_response(sk);
+ rose_write_internal(sk, ROSE_RESET_REQUEST);
+ rose->condition = 0x00;
+ rose->vs = 0;
+ rose->vr = 0;
+ rose->va = 0;
+ rose->vl = 0;
+ rose->state = ROSE_STATE_4;
+ rose_start_t2timer(sk);
+ rose_stop_idletimer(sk);
+ break;
}
/*
* If the window is full, ack the frame, else start the
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 037/990] ax25: end a REJ recovery count once frames are acknowledged
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (35 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 036/990] rose: reset a call when a DATA packet arrives out of sequence Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 038/990] netrom: keep T1 running after answering a NAK Greg Kroah-Hartman
` (815 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
Commit a3aa611e37d4 ("ax25: bound REJ-driven fast retransmits with the
existing N2 counter") counts REJ-driven retransmits in n2count and
relies on an I frame received in sequence to reset it. A station that
only sends, such as a BBS forwarding mail, never receives I frames:
the peer acknowledges with RR. After a single REJ, n2count then stays
above zero for the rest of the connection, with two effects:
- ax25_calculate_rtt() no longer updates the round trip time (it
requires n2count == 0), and with the default linear backoff
ax25_calculate_t1() keeps T1 at (2 + 2 * n2count) * rtt instead of
2 * rtt;
- isolated REJs, even hours apart, add up, and the N2-th one sends
a healthy link into the state 4 enquiry.
An RR, RNR or REJ whose N(R) acknowledges new frames shows the link
is getting data through, so reset n2count when it moves V(A). A REJ
storm that makes no progress keeps the same N(R) and is still bounded
by N2. The reset is done after the acknowledgment is processed, so
the round trip of retransmitted frames is still not measured.
Fixes: a3aa611e37d4 ("ax25: bound REJ-driven fast retransmits with the existing N2 counter")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit 6f10bf991bc130b56339200965d87512b443954a)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ax25/ax25_std_in.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/net/ax25/ax25_std_in.c b/net/ax25/ax25_std_in.c
index d0269ece4fc58..92d89d4df0f83 100644
--- a/net/ax25/ax25_std_in.c
+++ b/net/ax25/ax25_std_in.c
@@ -190,7 +190,12 @@ static int ax25_std_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frame
if (type == AX25_COMMAND && pf)
ax25_std_enquiry_response(ax25);
if (ax25_validate_nr(ax25, nr)) {
+ int progress = nr != ax25->va;
+
ax25_check_iframes_acked(ax25, nr);
+ /* Frames got through: end any REJ recovery count. */
+ if (progress)
+ ax25->n2count = 0;
} else {
ax25_std_nr_error_recovery(ax25);
ax25->state = AX25_STATE_1;
@@ -202,8 +207,17 @@ static int ax25_std_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frame
if (type == AX25_COMMAND && pf)
ax25_std_enquiry_response(ax25);
if (ax25_validate_nr(ax25, nr)) {
+ int progress = nr != ax25->va;
+
ax25_frames_acked(ax25, nr);
ax25_calculate_rtt(ax25);
+ /*
+ * Only REJs that make no progress count towards N2:
+ * a REJ whose N(R) acknowledges new frames shows the
+ * link is getting data through.
+ */
+ if (progress)
+ ax25->n2count = 0;
/*
* REJ triggers an immediate go-back-N retransmit,
* deliberately bypassing the T1/N2 backoff that
@@ -224,10 +238,11 @@ static int ax25_std_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frame
* once N2 of them have failed to make it through,
* fall back to the normal paced state 4 enquiry
* (which will genuinely give up and disconnect after
- * N2 further tries if the link stays bad). A single
- * frame accepted in sequence resets the counter (see
- * the AX25_I case below), so an isolated REJ during
- * otherwise healthy traffic never gets close to N2.
+ * N2 further tries if the link stays bad). A frame
+ * accepted in sequence (see the AX25_I case below) or
+ * an RR/RNR/REJ that acknowledges new frames resets
+ * the counter, so an isolated REJ during otherwise
+ * healthy traffic never gets close to N2.
*/
if (ax25->n2count == ax25->n2) {
ax25->n2count = 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 038/990] netrom: keep T1 running after answering a NAK
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (36 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 037/990] ax25: end a REJ recovery count once frames are acknowledged Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 039/990] netrom: give the sysctl timer limits in milliseconds Greg Kroah-Hartman
` (814 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
When an INFO or INFOACK frame carries the NAK flag, nr_send_nak_frame()
sends the frame at V(A) again and then stops T1, although that frame,
and any sent after it, are still waiting for an acknowledgment.
If this copy is lost too, no timer is left: nothing is sent again, and
the circuit is not cleared after N2 tries either. It stays stuck until
the peer sends something or the idle timer, if set, closes it.
Restart T1 instead, as nr_check_iframes_acked() does when part of the
window is acknowledged.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit e18a382a74b93a3c0ab52e0fedc8343d9d4facc9)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netrom/nr_out.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c
index 150cb4263d314..1c6b4386c86b4 100644
--- a/net/netrom/nr_out.c
+++ b/net/netrom/nr_out.c
@@ -135,7 +135,12 @@ void nr_send_nak_frame(struct sock *sk)
nr->condition &= ~NR_COND_ACK_PENDING;
nr->vl = nr->vr;
- nr_stop_t1timer(sk);
+ /*
+ * The frame just sent again, and any sent after it, still wait for
+ * an acknowledgment: keep T1 running so that losing this copy too
+ * is noticed.
+ */
+ nr_start_t1timer(sk);
}
void nr_kick(struct sock *sk)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 039/990] netrom: give the sysctl timer limits in milliseconds
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (37 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 038/990] netrom: keep T1 running after answering a NAK Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 040/990] mm/ksm: fix userfaultfd protection during merge and unmerge Greg Kroah-Hartman
` (813 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
Since commit 4d8937d0b113 ("[NETROM]: Eleminate HZ from NET/ROM kernel
interfaces") the NET/ROM timer sysctls hold milliseconds, converted
with msecs_to_jiffies() where they are used, but their limits were left
in jiffies: 5 * HZ to 600 * HZ for the transport timeout, 1 * HZ to
60 * HZ for the acknowledge delay, 1 * HZ to 1000 * HZ for the busy
delay, up to 65535 * HZ for the no activity timeout. They only match
with HZ=1000.
With HZ=100 the largest transport timeout that can be written is 60 s
while the default is 120 s, and the largest busy delay is 100 s while
the default is 180 s: once changed, a default can no longer be put
back. The smallest transport timeout accepted is 0.5 s instead of 5 s.
With HZ=250 the acknowledge delay is limited to 15 s instead of 60 s.
Seen on a Raspberry Pi node (HZ=100): writing back the current values
120000 to transport_timeout and 180000 to transport_busy_delay fails
with EINVAL, and 60000 is accepted.
Give the limits in milliseconds, as was done for ROSE. With HZ=1000
nothing changes.
Fixes: 4d8937d0b113 ("[NETROM]: Eleminate HZ from NET/ROM kernel interfaces")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit e59d8b990552be401ace7750a4617ffa07c86637)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netrom/sysctl_net_netrom.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c
index 7dc0fa628f2e7..bccc165a4a2ec 100644
--- a/net/netrom/sysctl_net_netrom.c
+++ b/net/netrom/sysctl_net_netrom.c
@@ -15,16 +15,17 @@
static int min_quality[] = {0}, max_quality[] = {255};
static int min_obs[] = {0}, max_obs[] = {255};
static int min_ttl[] = {0}, max_ttl[] = {255};
-static int min_t1[] = {5 * HZ};
-static int max_t1[] = {600 * HZ};
+/* The timers are given in milliseconds */
+static int min_t1[] = {5 * MSEC_PER_SEC};
+static int max_t1[] = {600 * MSEC_PER_SEC};
static int min_n2[] = {2}, max_n2[] = {127};
-static int min_t2[] = {1 * HZ};
-static int max_t2[] = {60 * HZ};
-static int min_t4[] = {1 * HZ};
-static int max_t4[] = {1000 * HZ};
+static int min_t2[] = {1 * MSEC_PER_SEC};
+static int max_t2[] = {60 * MSEC_PER_SEC};
+static int min_t4[] = {1 * MSEC_PER_SEC};
+static int max_t4[] = {1000 * MSEC_PER_SEC};
static int min_window[] = {1}, max_window[] = {127};
-static int min_idle[] = {0 * HZ};
-static int max_idle[] = {65535 * HZ};
+static int min_idle[] = {0 * MSEC_PER_SEC};
+static int max_idle[] = {65535 * MSEC_PER_SEC};
static int min_route[] = {0}, max_route[] = {1};
static int min_fails[] = {1}, max_fails[] = {10};
static int min_reset[] = {0}, max_reset[] = {1};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 040/990] mm/ksm: fix userfaultfd protection during merge and unmerge
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (38 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 039/990] netrom: give the sysctl timer limits in milliseconds Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 041/990] udf: validate VAT inode size for old VAT format Greg Kroah-Hartman
` (812 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Samarth Narang, Lance Yang,
Andrew Morton, Lorenzo Stoakes (ARM), Kiryl Shutsemau (Meta),
David Hildenbrand (Arm), Mel Gorman, Chengming Zhou,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jérôme Glisse,
Andrea Arcangeli, Peter Xu, Bobby Powers, Brian Geffon,
Denis Plotnikov, Doug Gilbert, Hugh Dickins, Johannes Weiner,
Martin Cracauer, Marty McFadden, Maya Gokhale, Pavel Emelyanov,
Rik van Riel, Shaohua Li, James Houghton, Jonathan Corbet,
Paolo Bonzini, Sean Christopherson, SJ Park, Zi Yan,
Mohammed EL Kadiri, Sasha Levin, Xu Xin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lance Yang <lance.yang@linux.dev>
[ Upstream commit 990d6c2194a938a19a8cf94c6cfd75171345089b ]
KSM loses userfaultfd protection when replace_page() builds a new PTE from
vma->vm_page_prot. Dropping its uffd bit lets a subsequent write go
through ordinary COW instead of userfaultfd write protection handling.
For RWP, a merged page also becomes readable without faulting.
Keeping the uffd bit and restoring PAGE_NONE fixes merging, but we also
have to handle unmerging. An existing KSM page can be protected with RWP
before MADV_UNMERGEABLE, so unmerging already needs fixing independently
of preserving RWP during merging.
Unsharing replaces a shared page with a private one and should leave
userfaultfd protection in place, as do_wp_page() already does for write
protection. Currently, an unshare fault reaches do_uffd_rwp() before it
can proceed to do_wp_page().
- With synchronous RWP, handle_userfault() returns VM_FAULT_SIGBUS.
break_ksm() then reports success with a KSM page still merged.
- With asynchronous RWP, protection is cleared before unsharing.
Preserve the uffd bit when merging, and restore PAGE_NONE for RWP. Let
FAULT_FLAG_UNSHARE skip RWP fault handling and keep PAGE_NONE on each
private copy as well. Unsharing can then complete with RWP still armed
for a subsequent access.
Link: https://lore.kernel.org/20261026130054.91461-1-lance.yang@linux.dev
Link: https://lore.kernel.org/all/20261019010934.697895-1-samarth.colleges@gmail.com/
Link: https://lore.kernel.org/all/20261020055518.36087-1-lance.yang@linux.dev/
Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
Fixes: 2d427bb01639 ("mm/userfaultfd: add RWP fault delivery and expose UFFDIO_REGISTER_MODE_RWP")
Signed-off-by: Samarth Narang <samarth.colleges@gmail.com>
Signed-off-by: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Co-developed-by: Samarth Narang <samarth.colleges@gmail.com>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Xu Xin <xu.xin@linux.dev>"
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Bobby Powers <bobbypowers@gmail.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Denis Plotnikov <dplotnikov@virtuozzo.com>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Martin Cracauer <cracauer@cons.org>
Cc: Marty McFadden <mcfadden8@llnl.gov>
Cc: Maya Gokhale <gokhale2@llnl.gov>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Shaohua Li <shli@fb.com>
Cc: James Houghton <jthoughton@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: SJ Park <sj@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Mohammed EL Kadiri <med08elkadiri@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/ksm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/ksm.c b/mm/ksm.c
index 78dc717633818..e6ddd74397b02 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1419,6 +1419,10 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
if (pte_soft_dirty(orig_pte))
newpte = pte_mksoft_dirty(newpte);
+ /* Preserve uffd-wp when replacing the page. */
+ if (pte_uffd_wp(orig_pte))
+ newpte = pte_mkuffd_wp(newpte);
+
flush_cache_page(vma, addr, pte_pfn(ptep_get(ptep)));
/*
* No need to notify as we are replacing a read only page with another
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 041/990] udf: validate VAT inode size for old VAT format
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (39 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 040/990] mm/ksm: fix userfaultfd protection during merge and unmerge Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 042/990] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat() Greg Kroah-Hartman
` (811 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Kara, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <jack@suse.cz>
[ Upstream commit 5163e6ee1ea744d412fe516235bfd9cab15141dc ]
Validate VAT inode is large enough to contain at least the header for
pre-2.00 UDF media format.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/udf/super.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 8d3d758714da2..ea9cd593ffbbb 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1319,6 +1319,11 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
if (map->s_partition_type == UDF_VIRTUAL_MAP15) {
map->s_type_specific.s_virtual.s_start_offset = 0;
+ if (sbi->s_vat_inode->i_size < 36) {
+ udf_err(sb, "Too short VAT inode size %lld\n",
+ sbi->s_vat_inode->i_size);
+ return -EFSCORRUPTED;
+ }
map->s_type_specific.s_virtual.s_num_entries =
(sbi->s_vat_inode->i_size - 36) >> 2;
} else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 042/990] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (40 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 041/990] udf: validate VAT inode size for old VAT format Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 043/990] io_uring/napi: dont end the single NAPI busy poll early on need_resched() Greg Kroah-Hartman
` (810 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hui Peng, Jan Kara, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <benquike@gmail.com>
[ Upstream commit 49f771d14578733a350c45e34e1bc6ad14f56952 ]
In udf_load_vat() (fs/udf/super.c), validate that vat20->lengthHeader is
at least sizeof(struct virtualAllocationTable20) and does not exceed the
mapped buffer or VAT inode size so computing the VAT table pointer and
entry count cannot underflow or read out of bounds.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://patch.msgid.link/20260919222600.3793513-1-benquike@gmail.com
Signed-off-by: Hui Peng <benquike@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/udf/super.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index ea9cd593ffbbb..09905f6c9ee1c 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1328,6 +1328,12 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
(sbi->s_vat_inode->i_size - 36) >> 2;
} else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
vati = UDF_I(sbi->s_vat_inode);
+ if (sbi->s_vat_inode->i_size <
+ sizeof(struct virtualAllocationTable20)) {
+ udf_err(sb, "Too short VAT inode size %lld\n",
+ sbi->s_vat_inode->i_size);
+ return -EFSCORRUPTED;
+ }
if (vati->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
int err = 0;
@@ -1345,8 +1351,12 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
map->s_type_specific.s_virtual.s_start_offset =
le16_to_cpu(vat20->lengthHeader);
- if (map->s_type_specific.s_virtual.s_start_offset
- > sbi->s_vat_inode->i_size) {
+ if (map->s_type_specific.s_virtual.s_start_offset <
+ sizeof(struct virtualAllocationTable20) ||
+ map->s_type_specific.s_virtual.s_start_offset >
+ sb->s_blocksize ||
+ map->s_type_specific.s_virtual.s_start_offset >
+ sbi->s_vat_inode->i_size) {
udf_err(sb, "Corrupted VAT header length %u (VAT inode size %lld)\n",
map->s_type_specific.s_virtual.s_start_offset,
sbi->s_vat_inode->i_size);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 043/990] io_uring/napi: dont end the single NAPI busy poll early on need_resched()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (41 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 042/990] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 044/990] io_uring: fail soft links on negative IOU_COMPLETE results Greg Kroah-Hartman
` (809 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cinq Prairie, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cinq Prairie <notprairie@gmail.com>
Commit 39c7210e970200f8b17de3767c73efe64173a95f upstream.
With a single registered NAPI, io_napi_blocking_busy_loop() hands
io_napi_busy_loop_should_end() to napi_busy_loop_rcu() as loop_end and
runs its own loop once, relying on __napi_busy_loop() to spin until
that predicate fires. napi_busy_loop_rcu() sets NAPI_F_END_ON_RESCHED,
so __napi_busy_loop() also returns on the first need_resched(). io_uring
treats the return as the end of the busy poll period and sleeps in
schedule_hrtimeout() for the rest of the wait timeout.
With two or more NAPIs the inner loop is single-shot and io_uring's own
loop runs until its predicate is met, so busy_poll_to is honoured. The
same registration therefore behaves differently for one NAPI than for
several.
Make the busy poll deadline absolute, stored in io_wait_queue, so that
io_napi_busy_loop_should_end() no longer depends on the start_time the
napi loop snapshots on every entry. The single NAPI loop can then be
re-entered after an early need_resched() exit if there is budget left,
and the loop condition drops the "run once" special case. The fast path
that holds the NAPI across polls is kept.
Measured on io_uring-7.4 at 9c207aa58e54, x86-64, HZ=1000,
PREEMPT_DYNAMIC (lazy), no CPU isolation, low RX traffic, r8169 with one
RX queue, prefer_busy_poll, busy_poll_to = wait timeout = 10 ms.
"waker" is a SCHED_FIFO task pinned to the polling CPU waking every 1 ms:
1 NAPI, waker, before: busy 0.5-1.5 ms per 10 ms wait, ~0.8M polls/s
1 NAPI, waker, after: busy 10 ms per 10 ms wait, ~16.2M polls/s
1 NAPI, idle, before: busy 10 ms per 10 ms wait, ~15.3M polls/s
1 NAPI, idle, after: busy 10 ms per 10 ms wait, ~16.2M polls/s
2 NAPIs, waker, before: busy 10 ms per 10 ms wait, ~7.2M polls/s
2 NAPIs, waker, after: busy 10 ms per 10 ms wait, ~7.1M polls/s
The held-NAPI fast path polls about twice as often as the single-shot
path used for several NAPIs, which is why it is kept.
Fixes: 8d0c12a80cde ("io-uring: add napi busy poll support")
Cc: stable@vger.kernel.org
Signed-off-by: Cinq Prairie <notprairie@gmail.com>
Link: https://patch.msgid.link/20261027204840.7823-1-notprairie@gmail.com
[axboe: trim comments, drop __always_unused]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/io_uring.h | 1 +
io_uring/napi.c | 31 ++++++++++++++-----------------
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 922bdf68aec8c..4f1d20d28f727 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -113,6 +113,7 @@ struct io_wait_queue {
#ifdef CONFIG_NET_RX_BUSY_POLL
ktime_t napi_busy_poll_dt;
+ ktime_t napi_busy_poll_end;
bool napi_prefer_busy_poll;
#endif
};
diff --git a/io_uring/napi.c b/io_uring/napi.c
index 45180b172bec7..46f5854f05efa 100644
--- a/io_uring/napi.c
+++ b/io_uring/napi.c
@@ -128,19 +128,15 @@ static inline void io_napi_remove_stale(struct io_ring_ctx *ctx, bool is_stale)
__io_napi_remove_stale(ctx);
}
-static inline bool io_napi_busy_loop_timeout(ktime_t start_time,
- ktime_t bp)
+static inline bool io_napi_busy_loop_timeout(struct io_wait_queue *iowq)
{
- if (bp) {
- ktime_t end_time = ktime_add(start_time, bp);
- ktime_t now = net_to_ktime(busy_loop_current_time());
-
- return ktime_after(now, end_time);
- }
-
- return true;
+ if (!iowq->napi_busy_poll_dt)
+ return true;
+ return ktime_after(net_to_ktime(busy_loop_current_time()),
+ iowq->napi_busy_poll_end);
}
+/* Uses an absolute deadline, so the napi loop can be re-entered */
static bool io_napi_busy_loop_should_end(void *data,
unsigned long start_time)
{
@@ -150,8 +146,7 @@ static bool io_napi_busy_loop_should_end(void *data,
return true;
if (io_should_wake(iowq) || io_has_work(iowq->ctx))
return true;
- if (io_napi_busy_loop_timeout(net_to_ktime(start_time),
- iowq->napi_busy_poll_dt))
+ if (io_napi_busy_loop_timeout(iowq))
return true;
return false;
@@ -204,13 +199,16 @@ __io_napi_do_busy_loop(struct io_ring_ctx *ctx,
static void io_napi_blocking_busy_loop(struct io_ring_ctx *ctx,
struct io_wait_queue *iowq)
{
- unsigned long start_time = busy_loop_current_time();
+ ktime_t now = net_to_ktime(busy_loop_current_time());
bool (*loop_end)(void *, unsigned long) = NULL;
void *loop_end_arg = NULL;
bool is_stale = false;
- /* Singular lists use a different napi loop end check function and are
- * only executed once.
+ iowq->napi_busy_poll_end = ktime_add(now, iowq->napi_busy_poll_dt);
+
+ /*
+ * A single NAPI is held by __napi_busy_loop() for the whole spin. It
+ * may return early on need_resched(), loop until our own deadline.
*/
if (list_is_singular(&ctx->napi_list)) {
loop_end = io_napi_busy_loop_should_end;
@@ -221,8 +219,7 @@ static void io_napi_blocking_busy_loop(struct io_ring_ctx *ctx,
do {
is_stale = __io_napi_do_busy_loop(ctx, loop_end,
loop_end_arg);
- } while (!io_napi_busy_loop_should_end(iowq, start_time) &&
- !loop_end_arg);
+ } while (!io_napi_busy_loop_should_end(iowq, 0));
}
io_napi_remove_stale(ctx, is_stale);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 044/990] io_uring: fail soft links on negative IOU_COMPLETE results
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (42 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 043/990] io_uring/napi: dont end the single NAPI busy poll early on need_resched() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 045/990] io_uring/futex: fail soft links when cancelling a wait Greg Kroah-Hartman
` (808 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yang Xiuwei, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
Commit 9ed19503a7b34e1ffb2b81236843204c473b0ae0 upstream.
Handlers such as fsync return IOU_COMPLETE with a negative cqe.res.
The old io_req_complete() path called req_set_fail() for res < 0.
After completions moved into the core, that check was dropped,
so IOSQE_IO_LINK dependents kept running after the head failed.
Fixes: 97b388d70b53 ("io_uring: handle completions in the core")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Link: https://patch.msgid.link/20261114041123.109163-1-yangxiuwei@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/io_uring.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 4a9f3a0fe5062..df5f33a0f937b 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1971,9 +1971,11 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
ret = __io_issue_sqe(req, issue_flags, def);
if (ret == IOU_COMPLETE) {
- /* not all handlers take care of the internal restart codes */
- if (unlikely(req->cqe.res <= -ERESTARTSYS))
- req->cqe.res = io_fixup_restart_res(req->cqe.res);
+ if (unlikely(req->cqe.res < 0)) {
+ if (req->cqe.res <= -ERESTARTSYS)
+ req->cqe.res = io_fixup_restart_res(req->cqe.res);
+ req_set_fail(req);
+ }
if (issue_flags & IO_URING_F_COMPLETE_DEFER)
io_req_complete_defer(req);
else
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 045/990] io_uring/futex: fail soft links when cancelling a wait
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (43 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 044/990] io_uring: fail soft links on negative IOU_COMPLETE results Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 046/990] io_uring/rw: fail soft links on IOPOLL short or error IO Greg Kroah-Hartman
` (807 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yang Xiuwei, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
Commit 9a7cbe50dd95594d6fb3c57b8454ace58d8d8d0a upstream.
__io_futex_cancel() completes the request with -ECANCELED but does
not call req_set_fail(). IOSQE_IO_LINK dependents then still run.
Fixes: 194bb58c6090 ("io_uring: add support for futex wake and wait")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Link: https://patch.msgid.link/20261114072246.741950-2-yangxiuwei@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/futex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/io_uring/futex.c b/io_uring/futex.c
index 6f756de08705d..5986ce2a121e0 100644
--- a/io_uring/futex.c
+++ b/io_uring/futex.c
@@ -104,6 +104,7 @@ static bool __io_futex_cancel(struct io_kiocb *req)
}
hlist_del_init(&req->hash_node);
+ req_set_fail(req);
io_req_set_res(req, -ECANCELED, 0);
io_req_task_work_add(req);
return true;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 046/990] io_uring/rw: fail soft links on IOPOLL short or error IO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (44 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 045/990] io_uring/futex: fail soft links when cancelling a wait Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 047/990] io_uring/timeout: dont rearm a multishot timeout on cancel Greg Kroah-Hartman
` (806 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yang Xiuwei, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
Commit 4d3db66c5363dcf42c3d43ebaea330ac2d1888bb upstream.
io_complete_rw_iopoll() updates cqe.res when the transfer does not
match the requested length, but it does not call req_set_fail().
Soft linked requests then still run after a short or failed IOPOLL
read or write.
Fixes: b66ceaf324b3 ("io_uring: move iopoll reissue into regular IO path")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Link: https://patch.msgid.link/20261114072246.741950-3-yangxiuwei@kylinos.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/rw.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index f46d08bbe9d88..48ef87b4697bb 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -618,8 +618,10 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res)
if (res == -EAGAIN && io_rw_should_reissue(req))
req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE;
- else if (unlikely(final_res != req->cqe.res))
+ else if (unlikely(final_res != req->cqe.res)) {
+ req_set_fail(req);
req->cqe.res = final_res;
+ }
/* order with io_iopoll_complete() checking ->iopoll_completed */
smp_store_release(&req->iopoll_completed, 1);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 047/990] io_uring/timeout: dont rearm a multishot timeout on cancel
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (45 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 046/990] io_uring/rw: fail soft links on IOPOLL short or error IO Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 048/990] io_uring/rsrc: keep the old file when a file update fails Greg Kroah-Hartman
` (805 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cheng Yongkang, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
Commit 97d4a585db2b91d855f957be0a9f126068c5be93 upstream.
io_timeout_complete() does not check tw.cancel. When it runs from
io_cancel_local_task_work(), a multishot timeout that has not reached
its count still posts an IORING_CQE_F_MORE completion and rearms its
timer. With a zero interval the timer expires again right away and
queues new task work, so the drain keeps running it until posting a
CQE fails.
Normally the CQ fills up quickly and the request then completes. But
if userspace moves the CQ head far ahead of the tail, for example to
cq.tail + 0x7fffffff, posting keeps succeeding and ring teardown is
delayed for a long time.
Don't post another CQE or rearm the timer when tw.cancel is set, so
the request completes through io_req_task_complete(), like the poll and
linked timeout task work does when cancelled.
Fixes: ea97f6c8558e ("io_uring: add support for multishot timeouts")
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/20261116044519.281756-1-teel4res@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/timeout.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/io_uring/timeout.c b/io_uring/timeout.c
index 2637c8bb61a08..36c8f3dae27a5 100644
--- a/io_uring/timeout.c
+++ b/io_uring/timeout.c
@@ -76,7 +76,8 @@ static void io_timeout_complete(struct io_tw_req tw_req, io_tw_token_t tw)
struct io_ring_ctx *ctx = req->ctx;
if (!io_timeout_finish(timeout, data)) {
- if (io_req_post_cqe(req, -ETIME, IORING_CQE_F_MORE)) {
+ if (!tw.cancel &&
+ io_req_post_cqe(req, -ETIME, IORING_CQE_F_MORE)) {
/* re-arm timer */
raw_spin_lock_irq(&ctx->timeout_lock);
list_add(&timeout->list, ctx->timeout_list.prev);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 048/990] io_uring/rsrc: keep the old file when a file update fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (46 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 047/990] io_uring/timeout: dont rearm a multishot timeout on cancel Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 049/990] io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select() Greg Kroah-Hartman
` (804 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cheng Yongkang, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
Commit e5a346e4309d720c47fe8331a00068608fad47dd upstream.
__io_sqe_files_update() resets the slot before it calls fget() on the
new fd. If fget() fails, the fd is an io_uring file, or the node
allocation fails, the update stops and reports that entry as not done,
but the old file has already been removed. Later requests that use the
slot fail with -EBADF, and if the old file was registered with a tag,
its tag CQE is posted as if it had been removed on purpose.
Reset the slot only after the new file has been checked and its node
allocated, as io_install_fixed_file() does. Removal with fd == -1 still
resets the slot right away.
Fixes: c3a31e605620 ("io_uring: add support for IORING_REGISTER_FILES_UPDATE")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/20261116044531.281978-1-teel4res@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[axboe: 6.18 doesn't clamp the slot index with array_index_nospec() in
this function]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/rsrc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 7170b3f001d41..36a9bc279e74e 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -237,9 +237,6 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
continue;
i = up->offset + done;
- if (io_reset_rsrc_node(ctx, &ctx->file_table.data, i))
- io_file_bitmap_clear(&ctx->file_table, i);
-
if (fd != -1) {
struct file *file = fget(fd);
struct io_rsrc_node *node;
@@ -262,11 +259,15 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
fput(file);
break;
}
+ if (io_reset_rsrc_node(ctx, &ctx->file_table.data, i))
+ io_file_bitmap_clear(&ctx->file_table, i);
ctx->file_table.data.nodes[i] = node;
if (tag)
node->tag = tag;
io_fixed_file_set(node, file);
io_file_bitmap_set(&ctx->file_table, i);
+ } else if (io_reset_rsrc_node(ctx, &ctx->file_table.data, i)) {
+ io_file_bitmap_clear(&ctx->file_table, i);
}
}
return done ? done : err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 049/990] io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (47 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 048/990] io_uring/rsrc: keep the old file when a file update fails Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 050/990] io_uring/io-wq: apply the current cpuset to new workers Greg Kroah-Hartman
` (803 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Siddharth Chintamaneni, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Commit b7322810d1870ccc0d293ad383d94ef583d5057b upstream.
io_buffers_select() passes &arg->out_len to io_provided_buffers_select()
on the legacy provided-buffer path. Because callers initialize
arg->max_len (from sqe->len) while leaving arg->out_len as 0,
io_provided_buffers_select() sees *len == 0 and always selects the full
buffer size buf->len, ignoring the user-specified sqe->len limit.
Initialize arg->out_len = arg->max_len before calling
io_provided_buffers_select().
Fixes: 35c8711c8fc4 ("io_uring/kbuf: add helpers for getting/peeking multiple buffers")
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Link: https://patch.msgid.link/20261116193146.65315-1-sidchintamaneni@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/kbuf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index c091c3c462e18..6659f56e91fc6 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -355,6 +355,7 @@ int io_buffers_select(struct io_kiocb *req, struct buf_sel_arg *arg,
req->flags |= REQ_F_BUF_MORE;
}
} else {
+ arg->out_len = arg->max_len;
ret = io_provided_buffers_select(req, &arg->out_len, sel->buf_list, arg->iovs);
}
out_unlock:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 050/990] io_uring/io-wq: apply the current cpuset to new workers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (48 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 049/990] io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 051/990] bnxt_en: Take RTNL before netif_close() when aborting FW reset Greg Kroah-Hartman
` (802 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mikhail Malyshev, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Malyshev <mike.malyshev@gmail.com>
Commit 0659e44ce739ecd856164c75a5325b7959a2921d upstream.
Since commit 84eacf177faa ("io_uring/io-wq: inherit cpuset of cgroup in
io worker"), io_wq_create() copies the cpuset of the creating task into
wq->cpu_mask, and io_init_new_worker() gives each new worker that copy.
A cpuset change, or a move of the task to another cgroup, updates the
workers that exist but not the copy, so workers started later run on
the CPUs the cgroup had when the io-wq was created, which may since
have been given to other tasks. Workers come and go for the life of the
io-wq, and a worker that cpuset moved is also retired at its next idle
timeout and replaced on the old CPUs.
Keep wq->cpu_mask for the affinity of the io-wq itself, all CPUs or the
mask set with IORING_REGISTER_IOWQ_AFF, and intersect it with the cpuset
of the worker when the worker starts, falling back to the cpuset if the
two do not intersect, as __set_cpus_allowed_ptr() does. Use the same
mask in the idle exit test, and go back to all CPUs when the registered
affinity is removed.
Fixes: 84eacf177faa ("io_uring/io-wq: inherit cpuset of cgroup in io worker")
Cc: stable@vger.kernel.org
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
Link: https://patch.msgid.link/20261111162705.1150983-1-mike.malyshev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/io-wq.c | 44 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index fd53297af26ec..0d74e365d54a1 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -731,6 +731,34 @@ static bool io_worker_retire(struct io_wq_acct *acct, struct io_worker *worker)
return false;
}
+/*
+ * The CPUs a worker of @wq runs on: those of the io-wq affinity that the
+ * worker's cpuset allows, or the cpuset if they have none in common, as the
+ * scheduler does with a task's requested affinity when its cpuset changes.
+ * Read the cpuset each time: it can change while the io-wq exists.
+ */
+static void io_wq_worker_cpus(struct io_wq *wq, struct task_struct *tsk,
+ struct cpumask *cpus)
+{
+ cpuset_cpus_allowed(tsk, cpus);
+ if (cpumask_intersects(cpus, wq->cpu_mask))
+ cpumask_and(cpus, cpus, wq->cpu_mask);
+}
+
+/* Is the current worker on a CPU that a new worker would not get? */
+static bool io_wq_worker_off_cpus(struct io_wq *wq)
+{
+ cpumask_var_t cpus;
+ bool off;
+
+ if (!alloc_cpumask_var(&cpus, GFP_KERNEL))
+ return false;
+ io_wq_worker_cpus(wq, current, cpus);
+ off = !cpumask_test_cpu(raw_smp_processor_id(), cpus);
+ free_cpumask_var(cpus);
+ return off;
+}
+
static int io_wq_worker(void *data)
{
struct io_worker *worker = data;
@@ -809,8 +837,7 @@ static int io_wq_worker(void *data)
}
if (!ret) {
last_timeout = true;
- exit_mask = !cpumask_test_cpu(raw_smp_processor_id(),
- wq->cpu_mask);
+ exit_mask = io_wq_worker_off_cpus(wq);
}
}
@@ -860,9 +887,16 @@ void io_wq_worker_sleeping(struct task_struct *tsk)
static void io_init_new_worker(struct io_wq *wq, struct io_wq_acct *acct, struct io_worker *worker,
struct task_struct *tsk)
{
+ cpumask_var_t cpus;
+
tsk->worker_private = worker;
worker->task = tsk;
- set_cpus_allowed_ptr(tsk, wq->cpu_mask);
+ /* Without a mask, the worker keeps its creator's CPUs. */
+ if (alloc_cpumask_var(&cpus, GFP_KERNEL)) {
+ io_wq_worker_cpus(wq, tsk, cpus);
+ set_cpus_allowed_ptr(tsk, cpus);
+ free_cpumask_var(cpus);
+ }
raw_spin_lock(&acct->workers_lock);
hlist_nulls_add_head_rcu(&worker->nulls_node, &acct->free_list);
@@ -1361,7 +1395,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
if (!alloc_cpumask_var(&wq->cpu_mask, GFP_KERNEL))
goto err;
- cpuset_cpus_allowed(data->task, wq->cpu_mask);
+ cpumask_copy(wq->cpu_mask, cpu_possible_mask);
wq->acct[IO_WQ_ACCT_BOUND].max_workers = bounded;
wq->acct[IO_WQ_ACCT_UNBOUND].max_workers =
task_rlimit(current, RLIMIT_NPROC);
@@ -1545,7 +1579,7 @@ int io_wq_cpu_affinity(struct io_uring_task *tctx, cpumask_var_t mask)
else
ret = -EINVAL;
} else {
- cpumask_copy(tctx->io_wq->cpu_mask, allowed_mask);
+ cpumask_copy(tctx->io_wq->cpu_mask, cpu_possible_mask);
}
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 051/990] bnxt_en: Take RTNL before netif_close() when aborting FW reset
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (49 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 050/990] io_uring/io-wq: apply the current cpuset to new workers Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 052/990] bpqether: reserve the Ethernet devices own header room on transmit Greg Kroah-Hartman
` (801 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bryan Cochrane, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan Cochrane <bcochrane@google.com>
commit bf83b257423bb557b970df3d7ece32fbd85f3bd4 upstream.
netif_close() must be called with RTNL held in addition to the netdev
instance lock: __dev_close_many() asserts it, and the NETDEV_GOING_DOWN
and NETDEV_DOWN notifier chains it runs rely on it for serialization.
Commit 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
replaced rtnl_lock() with netdev_lock() in bnxt_fw_reset_task() and
bnxt_fw_reset(). That is sufficient for the paths that only tear the
NIC down internally with __bnxt_close_nic(), but the abort paths close
the netdev via bnxt_fw_reset_abort() -> netif_close(), and the error
path in bnxt_fw_reset() calls netif_close() directly. Those now run
without RTNL and trigger a WARN_ONCE() cascade when a firmware reset is
aborted:
RTNL: assertion failed at net/core/dev.c (1740)
WARNING: net/core/dev.c:1740 at __dev_close_many+0x1be/0x1f0
Workqueue: bnxt_pf_wq bnxt_fw_reset_task [bnxt_en]
Call Trace:
netif_close_many+0xb5/0x190
netif_close+0xa2/0xd0
bnxt_fw_reset_task.cold+0x8d/0x213 [bnxt_en]
process_one_work+0x19d/0x3a0
worker_thread+0x1af/0x320
kthread+0xe3/0x120
followed by the same assertion from call_netdevice_notifiers_info(),
fib_rules_event(), inetdev_event(), rtnl_fill_ifinfo(),
devlink_compat_phys_port_name_get() and ip_mc_down().
This was observed on a machine in real use with a BCM57504 (4 PFs,
FW 236.1.153.0) running v7.1.6: the firmware crashed, announced a
"Fatal firmware reset event" and then failed to come back within the
advertised max wait, so bnxt_fw_reset_task() aborted the reset on all
ports:
bnxt_en 0000:c1:00.1 eno16905np1: Firmware reset aborted
bnxt_en 0000:c1:00.1 eno16905np1: fw_health_status 0x448100
Take RTNL (before the netdev instance lock, matching the OPENING state
which already uses rtnl_trylock()) in the fw_reset_abort path of
bnxt_fw_reset_task() and route the POLL_VF abort through that same
path.
In bnxt_fw_reset(), only a PF can reach the bnxt_get_registered_vfs()
error path that calls netif_close(), so take RTNL up front via
bnxt_rtnl_lock_sp() when BNXT_PF(bp) is true and keep bnxt_lock_sp() on
VFs. That avoids dropping the instance lock mid-reset (which would
expose a transient BNXT_STATE_IN_FW_RESET and let a concurrent devlink
health recover set BNXT_STATE_IN_SP_TASK), avoids racing with
bnxt_sriov_configure() updating active_vfs outside RTNL, and keeps VFs
from contending on RTNL during recovery while PFs already run on the
single-threaded bnxt_pf_wq.
The bug was found by inspecting the kernel log of the affected machine
and the driver source; the fix was prepared with the help of an AI
coding assistant (Gemini based) and reviewed by the submitter. It is
build tested (allmodconfig with W=1, plus the same change on top of
v7.1.6 built as a module for the affected BCM57504 host). The aborted
reset path itself only runs when the firmware fails to return from a
reset, which could not be reproduced on demand.
Fixes: 004b5008016a ("eth: bnxt: remove most dependencies on RTNL")
Cc: stable@vger.kernel.org
Signed-off-by: Bryan Cochrane <bcochrane@google.com>
Link: https://patch.msgid.link/20261110044235.204386-1-bcochrane@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ bcochrane: backport to 6.18.y: 6.18 lacks bnxt_lock_sp() and
bnxt_unlock_sp(), so keep the existing inline BNXT_STATE_IN_SP_TASK +
netdev_lock()/netdev_unlock() on the VF branch of bnxt_fw_reset()
while using the existing bnxt_rtnl_lock_sp() / bnxt_rtnl_unlock_sp()
on PFs. ]
Signed-off-by: Bryan Cochrane <bcochrane@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 414da981a3e5b..51c144584d240 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -14567,8 +14567,12 @@ static int bnxt_get_registered_vfs(struct bnxt *bp)
void bnxt_fw_reset(struct bnxt *bp)
{
bnxt_ulp_stop(bp);
- clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
- netdev_lock(bp->dev);
+ if (BNXT_PF(bp)) {
+ bnxt_rtnl_lock_sp(bp);
+ } else {
+ clear_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
+ netdev_lock(bp->dev);
+ }
if (test_bit(BNXT_STATE_OPEN, &bp->state) &&
!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
@@ -14614,8 +14618,12 @@ void bnxt_fw_reset(struct bnxt *bp)
bnxt_queue_fw_reset_work(bp, tmo);
}
fw_reset_exit:
- set_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
- netdev_unlock(bp->dev);
+ if (BNXT_PF(bp)) {
+ bnxt_rtnl_unlock_sp(bp);
+ } else {
+ set_bit(BNXT_STATE_IN_SP_TASK, &bp->state);
+ netdev_unlock(bp->dev);
+ }
}
static void bnxt_chk_missed_irq(struct bnxt *bp)
@@ -15268,9 +15276,8 @@ static void bnxt_fw_reset_task(struct work_struct *work)
bp->fw_reset_timestamp = jiffies;
netdev_lock(bp->dev);
if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
- bnxt_fw_reset_abort(bp, rc);
netdev_unlock(bp->dev);
- goto ulp_start;
+ goto fw_reset_abort;
}
bnxt_fw_reset_close(bp);
if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) {
@@ -15403,9 +15410,11 @@ static void bnxt_fw_reset_task(struct work_struct *work)
netdev_err(bp->dev, "fw_health_status 0x%x\n", sts);
}
fw_reset_abort:
+ rtnl_lock();
netdev_lock(bp->dev);
bnxt_fw_reset_abort(bp, rc);
netdev_unlock(bp->dev);
+ rtnl_unlock();
ulp_start:
if (!rc)
bnxt_ulp_start(bp);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 052/990] bpqether: reserve the Ethernet devices own header room on transmit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (50 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 051/990] bnxt_en: Take RTNL before netif_close() when aborting FW reset Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 053/990] bpqether: set both addresses or none in SIOCSBPQETHADDR Greg Kroah-Hartman
` (800 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
bpq_xmit() makes sure the frame has AX25_BPQ_HEADER_LEN (16) bytes of
headroom, then pushes the two length bytes and lets dev_hard_header()
of the underlying device build the link layer header. That covers a
plain Ethernet header, but not a longer one.
A VLAN device on top of an Ethernet device that cannot insert the tag
in hardware, with reorder_hdr turned off, pushes an 18 byte header
(VLAN tag, then the Ethernet header). A UI frame sent from an AX.25
datagram socket with 8 digipeaters reaches bpq_xmit() with 17 bytes of
headroom once the KISS byte is dropped: skb_cow() leaves it alone, 15
bytes remain after the length bytes, and eth_header() underflows the
skb:
skbuff: skb_under_panic: ... len:101 put:14 ... dev:eth0.5
kernel BUG at net/core/skbuff.c:209!
Call Trace:
eth_header
vlan_dev_hard_header
dev_hard_start_xmit
__dev_queue_xmit
ax25_sendmsg
__sys_sendto
No privilege is needed to open and bind such a socket, so any local
user can crash a host that runs bpqether over this kind of VLAN.
Look up the Ethernet device first and ask skb_cow() for
LL_RESERVED_SPACE() of that device plus the two length bytes.
Tested in a QEMU guest (6.12.94, KASAN) with bpq devices on eth0, on
eth0.6 (reorder_hdr on) and on eth0.5 (reorder_hdr off), eth0 being a
virtio-net port without VLAN tag insertion: UI frames with 0, 7 and 8
digipeaters on each. Before the change the 8 digipeater frame on
eth0.5 panicked the guest with 15 bytes of headroom left; after it,
79 bytes are left and all frames are sent, with no kernel report.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit 6b7e0767b46d918b5c8a5a2fbb8a9c8a2531d698)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/hamradio/bpqether.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index f30616d915fd3..1adb56a5d4b86 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -237,12 +237,24 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
skb_pull(skb, 1); /* Drop KISS byte */
size = skb->len;
+ bpq = netdev_priv(dev);
+
+ orig_dev = dev;
+ dev = bpq_get_ether_dev(dev);
+ if (!dev) {
+ orig_dev->stats.tx_dropped++;
+ kfree_skb(skb);
+ return NETDEV_TX_OK;
+ }
+
/*
* We're about to mess with the skb which may still shared with the
* generic networking code so unshare and ensure it's got enough
- * space for the BPQ headers.
+ * space for the length bytes and for the link layer header of the
+ * Ethernet device. That header can be longer than an Ethernet
+ * header, e.g. on a VLAN device that inserts the tag itself.
*/
- if (skb_cow(skb, AX25_BPQ_HEADER_LEN)) {
+ if (skb_cow(skb, LL_RESERVED_SPACE(dev) + 2)) {
if (net_ratelimit())
pr_err("bpqether: out of memory\n");
kfree_skb(skb);
@@ -255,15 +267,6 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
*ptr++ = (size + 5) % 256;
*ptr++ = (size + 5) / 256;
- bpq = netdev_priv(dev);
-
- orig_dev = dev;
- if ((dev = bpq_get_ether_dev(dev)) == NULL) {
- orig_dev->stats.tx_dropped++;
- kfree_skb(skb);
- return NETDEV_TX_OK;
- }
-
skb->protocol = ax25_type_trans(skb, dev);
skb_reset_network_header(skb);
dev_hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 053/990] bpqether: set both addresses or none in SIOCSBPQETHADDR
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (51 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 052/990] bpqether: reserve the Ethernet devices own header room on transmit Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 054/990] bpqether: keep a bpq device in step with its Ethernet device Greg Kroah-Hartman
` (799 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
SIOCSBPQETHADDR copies the destination address straight into the
device, then the accepted source address. When the second copy faults,
the ioctl returns -EFAULT but the destination address has already been
changed, and copy_from_user() has zero-filled the part of the accepted
address it could not read.
With the accepted address left as 00:00:00:00:00:00, bpq_rcv() drops
every frame whose source is not that address: the device silently
stops receiving although the ioctl reported a failure.
Copy the whole struct bpq_ethaddr to the stack first and only update
the device once it has been read in full.
Tested in a QEMU guest (6.12.94, KASAN) by placing the struct so that
its accept field falls in an unmapped page. Before the change
/proc/net/bpqether showed the new destination and an accepted address
of 00:00:00:00:00:00 after the -EFAULT; after it, both addresses are
unchanged, and a valid call still sets them.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit 431bb7f4a7d347ccda32319aa346346664858289)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/hamradio/bpqether.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 1adb56a5d4b86..fb32be106e222 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -299,8 +299,8 @@ static int bpq_set_mac_address(struct net_device *dev, void *addr)
static int bpq_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
void __user *data, int cmd)
{
- struct bpq_ethaddr __user *ethaddr = data;
struct bpqdev *bpq = netdev_priv(dev);
+ struct bpq_ethaddr ethaddr;
struct bpq_req req;
if (!capable(CAP_NET_ADMIN))
@@ -320,10 +320,10 @@ static int bpq_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
break;
case SIOCSBPQETHADDR:
- if (copy_from_user(bpq->dest_addr, ethaddr->destination, ETH_ALEN))
- return -EFAULT;
- if (copy_from_user(bpq->acpt_addr, ethaddr->accept, ETH_ALEN))
+ if (copy_from_user(ðaddr, data, sizeof(ethaddr)))
return -EFAULT;
+ memcpy(bpq->dest_addr, ethaddr.destination, ETH_ALEN);
+ memcpy(bpq->acpt_addr, ethaddr.accept, ETH_ALEN);
break;
default:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 054/990] bpqether: keep a bpq device in step with its Ethernet device
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (52 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 053/990] bpqether: set both addresses or none in SIOCSBPQETHADDR Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 055/990] Input: destroy force-feedback device on input unregistration Greg Kroah-Hartman
` (798 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bernard Pidoux, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
When the Ethernet device goes down, bpq_device_event() closes the bpq
device on top of it. Two things are left over:
- bpq_open() does not look at the Ethernet device, so the bpq device
can be brought up again while the Ethernet device is still down.
Every frame sent then counts in the bpq device's tx_packets while
the Ethernet device drops it.
- when the Ethernet device comes back up, the bpq device stays down
and the AX.25 port has to be brought up again by hand.
Refuse to open a bpq device whose Ethernet device is not running, with
-ENETDOWN. Remember that a bpq device was closed because its Ethernet
device went down, and open it again on NETDEV_UP. A bpq device that
was already down, e.g. closed by the administrator, is left alone.
Tested in a QEMU guest (6.12.94, KASAN) with e1000 ports:
- bpq2 brought up with eth2 down: accepted before, and 5 frames
counted in tx_packets of bpq2 while eth2 dropped them; -ENETDOWN
after, nothing counted;
- eth3 down then up: bpq3 stayed down before, is up again after;
- bpq1 closed by hand, then eth1 down and up: bpq1 stays down,
before and after.
No kernel report in either case.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Bernard Pidoux <bernard.f6bvp@gmail.com>
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit 888935e9c7aa8d8de66dd76111ef0875f8c90663)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/hamradio/bpqether.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index fb32be106e222..202bdfc15cc61 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -104,6 +104,7 @@ struct bpqdev {
struct net_device *axdev; /* bpq device (bpq#) */
char dest_addr[6]; /* ether destination address */
char acpt_addr[6]; /* accept ether frames from this address only */
+ bool reopen; /* closed because the ether device went down */
};
static LIST_HEAD(bpq_devices);
@@ -338,6 +339,11 @@ static int bpq_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
*/
static int bpq_open(struct net_device *dev)
{
+ struct bpqdev *bpq = netdev_priv(dev);
+
+ if (!netif_running(bpq->ethdev))
+ return -ENETDOWN;
+
netif_start_queue(dev);
return 0;
}
@@ -513,6 +519,8 @@ static int bpq_device_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+ struct net_device *axdev;
+ struct bpqdev *bpq;
if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE;
@@ -521,14 +529,27 @@ static int bpq_device_event(struct notifier_block *this,
return NOTIFY_DONE;
switch (event) {
- case NETDEV_UP: /* new ethernet device -> new BPQ interface */
- if (bpq_get_ax25_dev(dev) == NULL)
+ case NETDEV_UP:
+ axdev = bpq_get_ax25_dev(dev);
+ if (!axdev) { /* new ethernet device -> new BPQ interface */
bpq_new_device(dev);
+ break;
+ }
+ /* reopen a BPQ interface closed when the device went down */
+ bpq = netdev_priv(axdev);
+ if (bpq->reopen) {
+ bpq->reopen = false;
+ dev_open(axdev, NULL);
+ }
break;
case NETDEV_DOWN: /* ethernet device closed -> close BPQ interface */
- if ((dev = bpq_get_ax25_dev(dev)) != NULL)
- dev_close(dev);
+ axdev = bpq_get_ax25_dev(dev);
+ if (axdev && netif_running(axdev)) {
+ dev_close(axdev);
+ bpq = netdev_priv(axdev);
+ bpq->reopen = true;
+ }
break;
case NETDEV_UNREGISTER: /* ethernet device removed -> free BPQ interface */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 055/990] Input: destroy force-feedback device on input unregistration
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (53 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 054/990] bpqether: keep a bpq device in step with its Ethernet device Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 056/990] staging: media: atomisp: use array3_size() for overflow-safe allocation Greg Kroah-Hartman
` (797 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gideon Heinz, Dmitry Torokhov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ Upstream commit 2ae35f090d029d2d8491b0a7f98a04c5c05d0a44 ]
When an input device is unregistered while userspace holds an open file
descriptor to its event node, input_dev_release() is deferred until the
last file descriptor is closed. Because input_ff_destroy() was only
called from input_dev_release(), force-feedback teardown (ff->destroy
and freeing ff->private) could run after the parent driver had already
unbound, freed its device state, or even been unloaded via rmmod,
causing use-after-free errors or page faults in unmapped module text.
Commit ef166ce08801 ("Input: stop force-feedback timer when
unregistering input devices") added a separate ff->stop callback for
ff-memless, but left ff->destroy invoked from input_dev_release().
Once __input_unregister_device() has disconnected all input handlers
(which flushes effects, closes the device, and marks evdev dead) and
deleted the device from sysfs, nothing accesses dev->ff anymore. Call
input_ff_destroy() directly in __input_unregister_device() so that
ff->destroy() always runs synchronously while the driver and its module
are still active, and remove the now-redundant ff->stop callback. Keep
input_ff_destroy() in input_dev_release() (where it is a no-op once
dev->ff is NULL) to handle input_free_device() on devices that were
never registered.
Fixes: 509ca1a93836 ("Input: implement new force feedback interface")
Reported-by: Gideon Heinz <gideonheinz02@gmail.com>
Closes: https://lore.kernel.org/r/CAPb1+K2BxnfQ7VUQ15td5f9pVhn-ARSM9EjfOU8WuW72o+cvPg@mail.gmail.com
Tested-by: Gideon Heinz <gideonheinz02@gmail.com>
Link: https://patch.msgid.link/2f722967b6db0692d4dd4164aff39b62@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ sashal: omitted the ff->stop removals because that callback doesn't exist here, and ml_ff_destroy() now uses timer_shutdown_sync() instead of timer_delete_sync() to make up for it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/input/ff-core.c | 2 +-
drivers/input/ff-memless.c | 10 +---------
drivers/input/input.c | 2 ++
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
index 66f7ffe8c7e05..34fb744ec50c4 100644
--- a/drivers/input/ff-core.c
+++ b/drivers/input/ff-core.c
@@ -339,7 +339,7 @@ EXPORT_SYMBOL_GPL(input_ff_create);
*
* This function is only needed in error path as input core will
* automatically free force feedback structures when device is
- * destroyed.
+ * unregistered or destroyed.
*/
void input_ff_destroy(struct input_dev *dev)
{
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index e0c1c61aae713..ba910b08ceb96 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -483,15 +483,7 @@ static void ml_ff_destroy(struct ff_device *ff)
{
struct ml_device *ml = ff->private;
- /*
- * Even though we stop all playing effects when tearing down
- * an input device (via input_device_flush() that calls into
- * input_ff_flush() that stops and erases all effects), we
- * do not actually stop the timer, and therefore we should
- * do it here.
- */
- timer_delete_sync(&ml->timer);
-
+ timer_shutdown_sync(&ml->timer);
kfree(ml->private);
}
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 9907dd9ec880a..8df346f1ca42c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2196,6 +2196,8 @@ static void __input_unregister_device(struct input_dev *dev)
}
device_del(&dev->dev);
+
+ input_ff_destroy(dev);
}
static void devm_input_device_unregister(struct device *dev, void *res)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 056/990] staging: media: atomisp: use array3_size() for overflow-safe allocation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (54 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 055/990] Input: destroy force-feedback device on input unregistration Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 057/990] wifi: rtw89: usb: Avoid crash with dynamically added device ID Greg Kroah-Hartman
` (796 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Feng Ning, Sakari Ailus, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Feng Ning <feng@innora.ai>
commit d178c7ca8fefc28115d35b94c3b1f4d653e34182 upstream.
Replace open-coded width * height * sizeof() multiplications with
array3_size() to prevent integer overflow in buffer allocations.
The atomisp driver computes DVS, morphing table, shading table and
statistics buffer sizes using unchecked arithmetic. When dimensions
are attacker-controlled or simply large, the product can silently wrap,
causing kvmalloc() to allocate an undersized buffer.
array3_size() saturates to SIZE_MAX on overflow, so kvmalloc() returns
NULL instead of succeeding with too few bytes.
Signed-off-by: Feng Ning <feng@innora.ai>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../media/atomisp/pci/sh_css_param_dvs.c | 11 +++---
.../media/atomisp/pci/sh_css_param_shading.c | 4 ++-
.../staging/media/atomisp/pci/sh_css_params.c | 35 +++++++++++--------
3 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
index 7fa4aab35b061..19c82464b6867 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c
@@ -4,6 +4,7 @@
* Copyright (c) 2015, Intel Corporation.
*/
+#include <linux/overflow.h>
#include "sh_css_param_dvs.h"
#include <assert_support.h>
#include <type_support.h>
@@ -49,7 +50,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
}
/* Generate Y buffers */
- dvs_config->xcoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->xcoords_y = kvmalloc(array3_size(width_y, height_y, sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_y) {
IA_CSS_ERROR("out of memory");
@@ -57,7 +58,7 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
goto exit;
}
- dvs_config->ycoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->ycoords_y = kvmalloc(array3_size(width_y, height_y, sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_y) {
IA_CSS_ERROR("out of memory");
@@ -68,7 +69,8 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
/* Generate UV buffers */
IA_CSS_LOG("UV W %d H %d", width_uv, height_uv);
- dvs_config->xcoords_uv = kvmalloc(width_uv * height_uv * sizeof(uint32_t),
+ dvs_config->xcoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_uv) {
IA_CSS_ERROR("out of memory");
@@ -76,7 +78,8 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res,
goto exit;
}
- dvs_config->ycoords_uv = kvmalloc(width_uv * height_uv * sizeof(uint32_t),
+ dvs_config->ycoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_uv) {
IA_CSS_ERROR("out of memory");
diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c
index 513e272f2fdc0..cbe703f0f7bef 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c
@@ -4,6 +4,7 @@
* Copyright (c) 2015, Intel Corporation.
*/
+#include <linux/overflow.h>
#include <linux/math.h>
#include <linux/slab.h>
@@ -339,7 +340,8 @@ ia_css_shading_table_alloc(
me->fraction_bits = 0;
for (i = 0; i < IA_CSS_SC_NUM_COLORS; i++) {
me->data[i] =
- kvmalloc(width * height * sizeof(*me->data[0]),
+ kvmalloc(array3_size(width, height,
+ sizeof(*me->data[0])),
GFP_KERNEL);
if (!me->data[i]) {
unsigned int j;
diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index 11d62313c9086..dda55369b5bb4 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -4,6 +4,7 @@
* Copyright (c) 2015, Intel Corporation.
*/
+#include <linux/overflow.h>
#include <linux/math.h>
#include "gdc_device.h" /* gdc_lut_store(), ... */
@@ -1381,11 +1382,11 @@ struct ia_css_morph_table *ia_css_morph_table_allocate(
}
for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) {
- me->coordinates_x[i] = kvmalloc(height * width *
- sizeof(*me->coordinates_x[i]),
+ me->coordinates_x[i] = kvmalloc(array3_size(height, width,
+ sizeof(*me->coordinates_x[i])),
GFP_KERNEL);
- me->coordinates_y[i] = kvmalloc(height * width *
- sizeof(*me->coordinates_y[i]),
+ me->coordinates_y[i] = kvmalloc(array3_size(height, width,
+ sizeof(*me->coordinates_y[i])),
GFP_KERNEL);
if ((!me->coordinates_x[i]) ||
@@ -4206,13 +4207,17 @@ ia_css_dvs_statistics_allocate(const struct ia_css_dvs_grid_info *grid)
goto err;
me->grid = *grid;
- me->hor_proj = kvmalloc(grid->height * IA_CSS_DVS_NUM_COEF_TYPES *
- sizeof(*me->hor_proj), GFP_KERNEL);
+ me->hor_proj = kvmalloc(array3_size(grid->height,
+ IA_CSS_DVS_NUM_COEF_TYPES,
+ sizeof(*me->hor_proj)),
+ GFP_KERNEL);
if (!me->hor_proj)
goto err;
- me->ver_proj = kvmalloc(grid->width * IA_CSS_DVS_NUM_COEF_TYPES *
- sizeof(*me->ver_proj), GFP_KERNEL);
+ me->ver_proj = kvmalloc(array3_size(grid->width,
+ IA_CSS_DVS_NUM_COEF_TYPES,
+ sizeof(*me->ver_proj)),
+ GFP_KERNEL);
if (!me->ver_proj)
goto err;
@@ -4479,24 +4484,26 @@ ia_css_dvs2_6axis_config_allocate(const struct ia_css_stream *stream)
params->pipe_dvs_6axis_config[IA_CSS_PIPE_ID_VIDEO]->height_uv;
IA_CSS_LOG("table Y: W %d H %d", width_y, height_y);
IA_CSS_LOG("table UV: W %d H %d", width_uv, height_uv);
- dvs_config->xcoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->xcoords_y = kvmalloc(array3_size(width_y, height_y,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_y)
goto err;
- dvs_config->ycoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t),
+ dvs_config->ycoords_y = kvmalloc(array3_size(width_y, height_y,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_y)
goto err;
- dvs_config->xcoords_uv = kvmalloc(width_uv * height_uv *
- sizeof(uint32_t),
+ dvs_config->xcoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->xcoords_uv)
goto err;
- dvs_config->ycoords_uv = kvmalloc(width_uv * height_uv *
- sizeof(uint32_t),
+ dvs_config->ycoords_uv = kvmalloc(array3_size(width_uv, height_uv,
+ sizeof(uint32_t)),
GFP_KERNEL);
if (!dvs_config->ycoords_uv)
goto err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 057/990] wifi: rtw89: usb: Avoid crash with dynamically added device ID
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (55 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 056/990] staging: media: atomisp: use array3_size() for overflow-safe allocation Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 058/990] fs/fs_parse: add back fsparam_u32hex Greg Kroah-Hartman
` (795 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bitterblue Smith, Ping-Ke Shih,
Josef Schlehofer, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
[ Upstream commit b1827227176821af9bba0cb643728d23328f3660 ]
Adding a device ID via sysfs causes a crash when the device is plugged
in, because the driver_info pointer is null.
Check for null driver_info in rtw89_usb_probe() and add a wrapper in
each driver to pass it a reasonable default value.
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/7a537b2e-67d2-40fb-8ef2-fcbc7bbc93af@gmail.com
[ Dropped the hunks for rtw8852au.c, rtw8852cu.c and rtw8922au.c,
these drivers are not in 6.18. ]
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/realtek/rtw89/rtw8851bu.c | 8 +++++++-
drivers/net/wireless/realtek/rtw89/rtw8852bu.c | 8 +++++++-
drivers/net/wireless/realtek/rtw89/usb.c | 5 ++++-
drivers/net/wireless/realtek/rtw89/usb.h | 3 ++-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851bu.c b/drivers/net/wireless/realtek/rtw89/rtw8851bu.c
index 10fcfade6151e..f9078923bbaa1 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851bu.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851bu.c
@@ -32,10 +32,16 @@ static const struct usb_device_id rtw_8851bu_id_table[] = {
};
MODULE_DEVICE_TABLE(usb, rtw_8851bu_id_table);
+static int rtw8851bu_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ return rtw89_usb_probe(intf, id, &rtw89_8851bu_info);
+}
+
static struct usb_driver rtw_8851bu_driver = {
.name = KBUILD_MODNAME,
.id_table = rtw_8851bu_id_table,
- .probe = rtw89_usb_probe,
+ .probe = rtw8851bu_probe,
.disconnect = rtw89_usb_disconnect,
};
module_usb_driver(rtw_8851bu_driver);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852bu.c b/drivers/net/wireless/realtek/rtw89/rtw8852bu.c
index add5987110b33..fbeb3f5b7375d 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852bu.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852bu.c
@@ -46,10 +46,16 @@ static const struct usb_device_id rtw_8852bu_id_table[] = {
};
MODULE_DEVICE_TABLE(usb, rtw_8852bu_id_table);
+static int rtw8852bu_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ return rtw89_usb_probe(intf, id, &rtw89_8852bu_info);
+}
+
static struct usb_driver rtw_8852bu_driver = {
.name = KBUILD_MODNAME,
.id_table = rtw_8852bu_id_table,
- .probe = rtw89_usb_probe,
+ .probe = rtw8852bu_probe,
.disconnect = rtw89_usb_disconnect,
};
module_usb_driver(rtw_8852bu_driver);
diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index 512a46dd9d06a..faf1e471e3040 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -931,7 +931,8 @@ static void rtw89_usb_intf_deinit(struct rtw89_dev *rtwdev,
}
int rtw89_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
+ const struct usb_device_id *id,
+ const struct rtw89_driver_info *default_info)
{
const struct rtw89_driver_info *info;
struct rtw89_dev *rtwdev;
@@ -939,6 +940,8 @@ int rtw89_usb_probe(struct usb_interface *intf,
int ret;
info = (const struct rtw89_driver_info *)id->driver_info;
+ if (!info)
+ info = default_info;
rtwdev = rtw89_alloc_ieee80211_hw(&intf->dev,
sizeof(struct rtw89_usb),
diff --git a/drivers/net/wireless/realtek/rtw89/usb.h b/drivers/net/wireless/realtek/rtw89/usb.h
index c1b4bfa209795..fe0f86dc7794f 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.h
+++ b/drivers/net/wireless/realtek/rtw89/usb.h
@@ -59,7 +59,8 @@ static inline struct rtw89_usb *rtw89_usb_priv(struct rtw89_dev *rtwdev)
}
int rtw89_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id);
+ const struct usb_device_id *id,
+ const struct rtw89_driver_info *default_info);
void rtw89_usb_disconnect(struct usb_interface *intf);
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 058/990] fs/fs_parse: add back fsparam_u32hex
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (56 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 057/990] wifi: rtw89: usb: Avoid crash with dynamically added device ID Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 059/990] net/9p: move structures and macros to header files Greg Kroah-Hartman
` (794 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Sandeen, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <sandeen@redhat.com>
[ Upstream commit 695f2ca1b4247724576d57eae7b74b90dc69ba3c ]
296b67059 removed fsparam_u32hex because there were no callers
(yet) and it didn't build due to using the nonexistent symbol
fs_param_is_u32_hex.
fs/9p will need this parser, so add it back with the appropriate
fix (use fs_param_is_u32).
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Message-ID: <20251010214222.1347785-2-sandeen@redhat.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/fs_parser.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/fs_parser.h b/include/linux/fs_parser.h
index 5a0e897cae807..5e8a3b5460331 100644
--- a/include/linux/fs_parser.h
+++ b/include/linux/fs_parser.h
@@ -120,6 +120,8 @@ static inline bool fs_validate_description(const char *name,
#define fsparam_u32(NAME, OPT) __fsparam(fs_param_is_u32, NAME, OPT, 0, NULL)
#define fsparam_u32oct(NAME, OPT) \
__fsparam(fs_param_is_u32, NAME, OPT, 0, (void *)8)
+#define fsparam_u32hex(NAME, OPT) \
+ __fsparam(fs_param_is_u32, NAME, OPT, 0, (void *)16)
#define fsparam_s32(NAME, OPT) __fsparam(fs_param_is_s32, NAME, OPT, 0, NULL)
#define fsparam_u64(NAME, OPT) __fsparam(fs_param_is_u64, NAME, OPT, 0, NULL)
#define fsparam_enum(NAME, OPT, array) __fsparam(fs_param_is_enum, NAME, OPT, 0, array)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 059/990] net/9p: move structures and macros to header files
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (57 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 058/990] fs/fs_parse: add back fsparam_u32hex Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 060/990] 9p: create a v9fs_context structure to hold parsed options Greg Kroah-Hartman
` (793 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Sandeen, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <sandeen@redhat.com>
[ Upstream commit c44393d84149d6fc91d94fa39321c9657e91b388 ]
With the new mount API all option parsing will need to happen
in fs/v9fs.c, so move some existing data structures and macros
to header files to facilitate this. Rename some to reflect
the transport they are used for (rdma, fd, etc), for clarity.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Message-ID: <20251010214222.1347785-3-sandeen@redhat.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/9p/client.h | 6 ++++++
include/net/9p/transport.h | 39 ++++++++++++++++++++++++++++++++++++++
net/9p/client.c | 6 ------
net/9p/trans_fd.c | 20 ++-----------------
net/9p/trans_rdma.c | 25 ++----------------------
5 files changed, 49 insertions(+), 47 deletions(-)
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4f785098c67a1..2d46f8017bd57 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -16,6 +16,12 @@
/* Number of requests per row */
#define P9_ROW_MAXTAG 255
+/* DEFAULT MSIZE = 32 pages worth of payload + P9_HDRSZ +
+ * room for write (16 extra) or read (11 extra) operands.
+ */
+
+#define DEFAULT_MSIZE ((128 * 1024) + P9_IOHDRSZ)
+
/** enum p9_proto_versions - 9P protocol versions
* @p9_proto_legacy: 9P Legacy mode, pre-9P2000.u
* @p9_proto_2000u: 9P2000.u extension
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 766ec07c95999..88702953b1ef2 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -14,6 +14,45 @@
#define P9_DEF_MIN_RESVPORT (665U)
#define P9_DEF_MAX_RESVPORT (1023U)
+#define P9_FD_PORT 564
+
+#define P9_RDMA_PORT 5640
+#define P9_RDMA_SQ_DEPTH 32
+#define P9_RDMA_RQ_DEPTH 32
+#define P9_RDMA_TIMEOUT 30000 /* 30 seconds */
+
+/**
+ * struct p9_fd_opts - per-transport options for fd transport
+ * @rfd: file descriptor for reading (trans=fd)
+ * @wfd: file descriptor for writing (trans=fd)
+ * @port: port to connect to (trans=tcp)
+ * @privport: port is privileged
+ */
+
+struct p9_fd_opts {
+ int rfd;
+ int wfd;
+ u16 port;
+ bool privport;
+};
+
+/**
+ * struct p9_rdma_opts - Collection of mount options for rdma transport
+ * @port: port of connection
+ * @privport: Whether a privileged port may be used
+ * @sq_depth: The requested depth of the SQ. This really doesn't need
+ * to be any deeper than the number of threads used in the client
+ * @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
+ * @timeout: Time to wait in msecs for CM events
+ */
+struct p9_rdma_opts {
+ short port;
+ bool privport;
+ int sq_depth;
+ int rq_depth;
+ long timeout;
+};
+
/**
* struct p9_trans_module - transport module interface
* @list: used to maintain a list of currently available transports
diff --git a/net/9p/client.c b/net/9p/client.c
index 75aac636b20e7..8d4547d4b4872 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -29,12 +29,6 @@
#define CREATE_TRACE_POINTS
#include <trace/events/9p.h>
-/* DEFAULT MSIZE = 32 pages worth of payload + P9_HDRSZ +
- * room for write (16 extra) or read (11 extra) operands.
- */
-
-#define DEFAULT_MSIZE ((128 * 1024) + P9_IOHDRSZ)
-
/* Client Option Parsing (code inspired by NFS code)
* - a little lazy - parse all client options
*/
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index a516745f732f7..fdaebb549aa8f 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -31,28 +31,12 @@
#include <linux/syscalls.h> /* killme */
-#define P9_PORT 564
#define MAX_SOCK_BUF (1024*1024)
#define MAXPOLLWADDR 2
static struct p9_trans_module p9_tcp_trans;
static struct p9_trans_module p9_fd_trans;
-/**
- * struct p9_fd_opts - per-transport options
- * @rfd: file descriptor for reading (trans=fd)
- * @wfd: file descriptor for writing (trans=fd)
- * @port: port to connect to (trans=tcp)
- * @privport: port is privileged
- */
-
-struct p9_fd_opts {
- int rfd;
- int wfd;
- u16 port;
- bool privport;
-};
-
/*
* Option Parsing (code inspired by NFS code)
* - a little lazy - parse all fd-transport options
@@ -742,7 +726,7 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt)
{
if (clnt->trans_mod == &p9_tcp_trans) {
- if (clnt->trans_opts.tcp.port != P9_PORT)
+ if (clnt->trans_opts.tcp.port != P9_FD_PORT)
seq_printf(m, ",port=%u", clnt->trans_opts.tcp.port);
} else if (clnt->trans_mod == &p9_fd_trans) {
if (clnt->trans_opts.fd.rfd != ~0)
@@ -768,7 +752,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
int option;
char *options, *tmp_options;
- opts->port = P9_PORT;
+ opts->port = P9_FD_PORT;
opts->rfd = ~0;
opts->wfd = ~0;
opts->privport = false;
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index d9f53f1da2c21..92b166a4a1e52 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -32,14 +32,10 @@
#include <rdma/ib_verbs.h>
#include <rdma/rdma_cm.h>
-#define P9_PORT 5640
-#define P9_RDMA_SQ_DEPTH 32
-#define P9_RDMA_RQ_DEPTH 32
#define P9_RDMA_SEND_SGE 4
#define P9_RDMA_RECV_SGE 4
#define P9_RDMA_IRD 0
#define P9_RDMA_ORD 0
-#define P9_RDMA_TIMEOUT 30000 /* 30 seconds */
#define P9_RDMA_MAXSIZE (1024*1024) /* 1MB */
/**
@@ -110,23 +106,6 @@ struct p9_rdma_context {
};
};
-/**
- * struct p9_rdma_opts - Collection of mount options
- * @port: port of connection
- * @privport: Whether a privileged port may be used
- * @sq_depth: The requested depth of the SQ. This really doesn't need
- * to be any deeper than the number of threads used in the client
- * @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
- * @timeout: Time to wait in msecs for CM events
- */
-struct p9_rdma_opts {
- short port;
- bool privport;
- int sq_depth;
- int rq_depth;
- long timeout;
-};
-
/*
* Option Parsing (code inspired by NFS code)
*/
@@ -151,7 +130,7 @@ static int p9_rdma_show_options(struct seq_file *m, struct p9_client *clnt)
{
struct p9_trans_rdma *rdma = clnt->trans;
- if (rdma->port != P9_PORT)
+ if (rdma->port != P9_RDMA_PORT)
seq_printf(m, ",port=%u", rdma->port);
if (rdma->sq_depth != P9_RDMA_SQ_DEPTH)
seq_printf(m, ",sq=%u", rdma->sq_depth);
@@ -178,7 +157,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
int option;
char *options, *tmp_options;
- opts->port = P9_PORT;
+ opts->port = P9_RDMA_PORT;
opts->sq_depth = P9_RDMA_SQ_DEPTH;
opts->rq_depth = P9_RDMA_RQ_DEPTH;
opts->timeout = P9_RDMA_TIMEOUT;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 060/990] 9p: create a v9fs_context structure to hold parsed options
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (58 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 059/990] net/9p: move structures and macros to header files Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 061/990] 9p: convert to the new mount API Greg Kroah-Hartman
` (792 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Sandeen, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <sandeen@redhat.com>
[ Upstream commit 075e8bd4127f007910fc302ad5c3c471d0be4799 ]
This patch creates a new v9fs_context structure which includes
new p9_session_opts and p9_client_opts structures, as well as
re-using the existing p9_fd_opts and p9_rdma_opts to store options
during parsing. The new structure will be used in the next
commit to pass all parsed options to the appropriate transports.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Message-ID: <20251010214222.1347785-4-sandeen@redhat.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/9p/client.h | 90 ++++++++++++++++++++++++++++++++++++++
include/net/9p/transport.h | 32 --------------
2 files changed, 90 insertions(+), 32 deletions(-)
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 2d46f8017bd57..cc18443f7d516 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -132,6 +132,96 @@ struct p9_client {
char name[__NEW_UTS_LEN + 1];
};
+/**
+ * struct p9_fd_opts - holds client options during parsing
+ * @msize: maximum data size negotiated by protocol
+ * @prot-Oversion: 9P protocol version to use
+ * @trans_mod: module API instantiated with this client
+ *
+ * These parsed options get transferred into client in
+ * apply_client_options()
+ */
+struct p9_client_opts {
+ unsigned int msize;
+ unsigned char proto_version;
+ struct p9_trans_module *trans_mod;
+};
+
+/**
+ * struct p9_fd_opts - per-transport options for fd transport
+ * @rfd: file descriptor for reading (trans=fd)
+ * @wfd: file descriptor for writing (trans=fd)
+ * @port: port to connect to (trans=tcp)
+ * @privport: port is privileged
+ */
+struct p9_fd_opts {
+ int rfd;
+ int wfd;
+ u16 port;
+ bool privport;
+};
+
+/**
+ * struct p9_rdma_opts - Collection of mount options for rdma transport
+ * @port: port of connection
+ * @privport: Whether a privileged port may be used
+ * @sq_depth: The requested depth of the SQ. This really doesn't need
+ * to be any deeper than the number of threads used in the client
+ * @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
+ * @timeout: Time to wait in msecs for CM events
+ */
+struct p9_rdma_opts {
+ short port;
+ bool privport;
+ int sq_depth;
+ int rq_depth;
+ long timeout;
+};
+
+/**
+ * struct p9_session_opts - holds parsed options for v9fs_session_info
+ * @flags: session options of type &p9_session_flags
+ * @nodev: set to 1 to disable device mapping
+ * @debug: debug level
+ * @afid: authentication handle
+ * @cache: cache mode of type &p9_cache_bits
+ * @cachetag: the tag of the cache associated with this session
+ * @uname: string user name to mount hierarchy as
+ * @aname: mount specifier for remote hierarchy
+ * @dfltuid: default numeric userid to mount hierarchy as
+ * @dfltgid: default numeric groupid to mount hierarchy as
+ * @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy
+ * @session_lock_timeout: retry interval for blocking locks
+ *
+ * This strucure holds options which are parsed and will be transferred
+ * to the v9fs_session_info structure when mounted, and therefore largely
+ * duplicates struct v9fs_session_info.
+ */
+struct p9_session_opts {
+ unsigned int flags;
+ unsigned char nodev;
+ unsigned short debug;
+ unsigned int afid;
+ unsigned int cache;
+#ifdef CONFIG_9P_FSCACHE
+ char *cachetag;
+#endif
+ char *uname;
+ char *aname;
+ kuid_t dfltuid;
+ kgid_t dfltgid;
+ kuid_t uid;
+ long session_lock_timeout;
+};
+
+/* Used by mount API to store parsed mount options */
+struct v9fs_context {
+ struct p9_client_opts client_opts;
+ struct p9_fd_opts fd_opts;
+ struct p9_rdma_opts rdma_opts;
+ struct p9_session_opts session_opts;
+};
+
/**
* struct p9_fid - file system entity handle
* @clnt: back pointer to instantiating &p9_client
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 88702953b1ef2..ebbb4b50ee205 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -21,38 +21,6 @@
#define P9_RDMA_RQ_DEPTH 32
#define P9_RDMA_TIMEOUT 30000 /* 30 seconds */
-/**
- * struct p9_fd_opts - per-transport options for fd transport
- * @rfd: file descriptor for reading (trans=fd)
- * @wfd: file descriptor for writing (trans=fd)
- * @port: port to connect to (trans=tcp)
- * @privport: port is privileged
- */
-
-struct p9_fd_opts {
- int rfd;
- int wfd;
- u16 port;
- bool privport;
-};
-
-/**
- * struct p9_rdma_opts - Collection of mount options for rdma transport
- * @port: port of connection
- * @privport: Whether a privileged port may be used
- * @sq_depth: The requested depth of the SQ. This really doesn't need
- * to be any deeper than the number of threads used in the client
- * @rq_depth: The depth of the RQ. Should be greater than or equal to SQ depth
- * @timeout: Time to wait in msecs for CM events
- */
-struct p9_rdma_opts {
- short port;
- bool privport;
- int sq_depth;
- int rq_depth;
- long timeout;
-};
-
/**
* struct p9_trans_module - transport module interface
* @list: used to maintain a list of currently available transports
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 061/990] 9p: convert to the new mount API
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (59 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 060/990] 9p: create a v9fs_context structure to hold parsed options Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 062/990] net/9p: Replace strlen() strcpy() pair with strscpy() Greg Kroah-Hartman
` (791 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Sandeen, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <sandeen@redhat.com>
[ Upstream commit 1f3e4142c0eb178089ea0cbc97506a061470ad27 ]
Convert 9p to the new mount API. This patch consolidates all parsing
into fs/9p/v9fs.c, which stores all results into a filesystem context
which can be passed to the various transports as needed.
Some of the parsing helper functions such as get_cache_mode() have been
eliminated in favor of using the new mount API's enum param type,
for simplicity.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Message-ID: <20251010214222.1347785-5-sandeen@redhat.com>
[ Dominique: handled source explicitly as per follow-up discussion ]
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/v9fs.c | 552 +++++++++++++++++++------------------
fs/9p/v9fs.h | 7 +-
fs/9p/vfs_super.c | 130 ++++++---
include/net/9p/client.h | 2 +-
include/net/9p/transport.h | 2 +-
net/9p/client.c | 148 +---------
net/9p/mod.c | 2 +-
net/9p/trans_fd.c | 109 +-------
net/9p/trans_rdma.c | 108 +-------
net/9p/trans_usbg.c | 4 +-
net/9p/trans_virtio.c | 8 +-
net/9p/trans_xen.c | 4 +-
12 files changed, 424 insertions(+), 652 deletions(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 20dc6a03826a3..60bbe6f6e9b84 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -13,7 +13,8 @@
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/cred.h>
-#include <linux/parser.h>
+#include <linux/fs_parser.h>
+#include <linux/fs_context.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
#include <linux/sysfs.h>
@@ -34,6 +35,10 @@ struct kmem_cache *v9fs_inode_cache;
*/
enum {
+ /* Mount-point source, we need to handle this explicitly because
+ * the code below accepts unknown args and the vfs layer only handles
+ * source if we rejected it as EINVAL */
+ Opt_source,
/* Options that take integer arguments */
Opt_debug, Opt_dfltuid, Opt_dfltgid, Opt_afid,
/* String options */
@@ -44,55 +49,81 @@ enum {
Opt_access, Opt_posixacl,
/* Lock timeout option */
Opt_locktimeout,
- /* Error token */
- Opt_err
+
+ /* Client options */
+ Opt_msize, Opt_trans, Opt_legacy, Opt_version,
+
+ /* fd transport options */
+ /* Options that take integer arguments */
+ Opt_rfdno, Opt_wfdno,
+ /* Options that take no arguments */
+
+ /* rdma transport options */
+ /* Options that take integer arguments */
+ Opt_rq_depth, Opt_sq_depth, Opt_timeout,
+
+ /* Options for both fd and rdma transports */
+ Opt_port, Opt_privport,
};
-static const match_table_t tokens = {
- {Opt_debug, "debug=%x"},
- {Opt_dfltuid, "dfltuid=%u"},
- {Opt_dfltgid, "dfltgid=%u"},
- {Opt_afid, "afid=%u"},
- {Opt_uname, "uname=%s"},
- {Opt_remotename, "aname=%s"},
- {Opt_nodevmap, "nodevmap"},
- {Opt_noxattr, "noxattr"},
- {Opt_directio, "directio"},
- {Opt_ignoreqv, "ignoreqv"},
- {Opt_cache, "cache=%s"},
- {Opt_cachetag, "cachetag=%s"},
- {Opt_access, "access=%s"},
- {Opt_posixacl, "posixacl"},
- {Opt_locktimeout, "locktimeout=%u"},
- {Opt_err, NULL}
+static const struct constant_table p9_versions[] = {
+ { "9p2000", p9_proto_legacy },
+ { "9p2000.u", p9_proto_2000u },
+ { "9p2000.L", p9_proto_2000L },
+ {}
};
-/* Interpret mount options for cache mode */
-static int get_cache_mode(char *s)
-{
- int version = -EINVAL;
-
- if (!strcmp(s, "loose")) {
- version = CACHE_SC_LOOSE;
- p9_debug(P9_DEBUG_9P, "Cache mode: loose\n");
- } else if (!strcmp(s, "fscache")) {
- version = CACHE_SC_FSCACHE;
- p9_debug(P9_DEBUG_9P, "Cache mode: fscache\n");
- } else if (!strcmp(s, "mmap")) {
- version = CACHE_SC_MMAP;
- p9_debug(P9_DEBUG_9P, "Cache mode: mmap\n");
- } else if (!strcmp(s, "readahead")) {
- version = CACHE_SC_READAHEAD;
- p9_debug(P9_DEBUG_9P, "Cache mode: readahead\n");
- } else if (!strcmp(s, "none")) {
- version = CACHE_SC_NONE;
- p9_debug(P9_DEBUG_9P, "Cache mode: none\n");
- } else if (kstrtoint(s, 0, &version) != 0) {
- version = -EINVAL;
- pr_info("Unknown Cache mode or invalid value %s\n", s);
- }
- return version;
-}
+static const struct constant_table p9_cache_mode[] = {
+ { "loose", CACHE_SC_LOOSE },
+ { "fscache", CACHE_SC_FSCACHE },
+ { "mmap", CACHE_SC_MMAP },
+ { "readahead", CACHE_SC_READAHEAD },
+ { "none", CACHE_SC_NONE },
+ {}
+};
+
+/*
+ * This structure contains all parameters used for the core code,
+ * the client, and all the transports.
+ */
+const struct fs_parameter_spec v9fs_param_spec[] = {
+ fsparam_string ("source", Opt_source),
+ fsparam_u32hex ("debug", Opt_debug),
+ fsparam_uid ("dfltuid", Opt_dfltuid),
+ fsparam_gid ("dfltgid", Opt_dfltgid),
+ fsparam_u32 ("afid", Opt_afid),
+ fsparam_string ("uname", Opt_uname),
+ fsparam_string ("aname", Opt_remotename),
+ fsparam_flag ("nodevmap", Opt_nodevmap),
+ fsparam_flag ("noxattr", Opt_noxattr),
+ fsparam_flag ("directio", Opt_directio),
+ fsparam_flag ("ignoreqv", Opt_ignoreqv),
+ fsparam_enum ("cache", Opt_cache, p9_cache_mode),
+ fsparam_string ("cachetag", Opt_cachetag),
+ fsparam_string ("access", Opt_access),
+ fsparam_flag ("posixacl", Opt_posixacl),
+ fsparam_u32 ("locktimeout", Opt_locktimeout),
+
+ /* client options */
+ fsparam_u32 ("msize", Opt_msize),
+ fsparam_flag ("noextend", Opt_legacy),
+ fsparam_string ("trans", Opt_trans),
+ fsparam_enum ("version", Opt_version, p9_versions),
+
+ /* fd transport options */
+ fsparam_u32 ("rfdno", Opt_rfdno),
+ fsparam_u32 ("wfdno", Opt_wfdno),
+
+ /* rdma transport options */
+ fsparam_u32 ("sq", Opt_sq_depth),
+ fsparam_u32 ("rq", Opt_rq_depth),
+ fsparam_u32 ("timeout", Opt_timeout),
+
+ /* fd and rdma transprt options */
+ fsparam_u32 ("port", Opt_port),
+ fsparam_flag ("privport", Opt_privport),
+ {}
+};
/*
* Display the mount options in /proc/mounts.
@@ -154,267 +185,252 @@ int v9fs_show_options(struct seq_file *m, struct dentry *root)
}
/**
- * v9fs_parse_options - parse mount options into session structure
- * @v9ses: existing v9fs session information
- * @opts: The mount option string
+ * v9fs_parse_param - parse a mount option into the filesystem context
+ * @fc: the filesystem context
+ * @param: the parameter to parse
*
* Return 0 upon success, -ERRNO upon failure.
*/
-
-static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
+int v9fs_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
- char *options, *tmp_options;
- substring_t args[MAX_OPT_ARGS];
- char *p;
- int option = 0;
+ struct v9fs_context *ctx = fc->fs_private;
+ struct fs_parse_result result;
char *s;
- int ret = 0;
-
- /* setup defaults */
- v9ses->afid = ~0;
- v9ses->debug = 0;
- v9ses->cache = CACHE_NONE;
-#ifdef CONFIG_9P_FSCACHE
- v9ses->cachetag = NULL;
-#endif
- v9ses->session_lock_timeout = P9_LOCK_TIMEOUT;
-
- if (!opts)
- return 0;
+ int r;
+ int opt;
+ struct p9_client_opts *clnt = &ctx->client_opts;
+ struct p9_fd_opts *fd_opts = &ctx->fd_opts;
+ struct p9_rdma_opts *rdma_opts = &ctx->rdma_opts;
+ struct p9_session_opts *session_opts = &ctx->session_opts;
+
+ opt = fs_parse(fc, v9fs_param_spec, param, &result);
+ if (opt < 0) {
+ /*
+ * We might like to report bad mount options here, but
+ * traditionally 9p has ignored unknown mount options
+ */
+ if (opt == -ENOPARAM)
+ return 0;
- tmp_options = kstrdup(opts, GFP_KERNEL);
- if (!tmp_options) {
- ret = -ENOMEM;
- goto fail_option_alloc;
+ return opt;
}
- options = tmp_options;
-
- while ((p = strsep(&options, ",")) != NULL) {
- int token, r;
-
- if (!*p)
- continue;
-
- token = match_token(p, tokens, args);
- switch (token) {
- case Opt_debug:
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- } else {
- v9ses->debug = option;
+
+ switch (opt) {
+ case Opt_source:
+ if (fc->source) {
+ pr_info("p9: multiple sources not supported\n");
+ return -EINVAL;
+ }
+ fc->source = param->string;
+ param->string = NULL;
+ break;
+ case Opt_debug:
+ session_opts->debug = result.uint_32;
#ifdef CONFIG_NET_9P_DEBUG
- p9_debug_level = option;
+ p9_debug_level = result.uint_32;
#endif
- }
- break;
-
- case Opt_dfltuid:
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- continue;
- }
- v9ses->dfltuid = make_kuid(current_user_ns(), option);
- if (!uid_valid(v9ses->dfltuid)) {
- p9_debug(P9_DEBUG_ERROR,
- "uid field, but not a uid?\n");
- ret = -EINVAL;
- }
- break;
- case Opt_dfltgid:
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- continue;
- }
- v9ses->dfltgid = make_kgid(current_user_ns(), option);
- if (!gid_valid(v9ses->dfltgid)) {
- p9_debug(P9_DEBUG_ERROR,
- "gid field, but not a gid?\n");
- ret = -EINVAL;
- }
- break;
- case Opt_afid:
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- } else {
- v9ses->afid = option;
- }
- break;
- case Opt_uname:
- kfree(v9ses->uname);
- v9ses->uname = match_strdup(&args[0]);
- if (!v9ses->uname) {
- ret = -ENOMEM;
- goto free_and_return;
- }
- break;
- case Opt_remotename:
- kfree(v9ses->aname);
- v9ses->aname = match_strdup(&args[0]);
- if (!v9ses->aname) {
- ret = -ENOMEM;
- goto free_and_return;
- }
- break;
- case Opt_nodevmap:
- v9ses->nodev = 1;
- break;
- case Opt_noxattr:
- v9ses->flags |= V9FS_NO_XATTR;
- break;
- case Opt_directio:
- v9ses->flags |= V9FS_DIRECT_IO;
- break;
- case Opt_ignoreqv:
- v9ses->flags |= V9FS_IGNORE_QV;
- break;
- case Opt_cachetag:
+ break;
+
+ case Opt_dfltuid:
+ session_opts->dfltuid = result.uid;
+ break;
+ case Opt_dfltgid:
+ session_opts->dfltgid = result.gid;
+ break;
+ case Opt_afid:
+ session_opts->afid = result.uint_32;
+ break;
+ case Opt_uname:
+ kfree(session_opts->uname);
+ session_opts->uname = param->string;
+ param->string = NULL;
+ break;
+ case Opt_remotename:
+ kfree(session_opts->aname);
+ session_opts->aname = param->string;
+ param->string = NULL;
+ break;
+ case Opt_nodevmap:
+ session_opts->nodev = 1;
+ break;
+ case Opt_noxattr:
+ session_opts->flags |= V9FS_NO_XATTR;
+ break;
+ case Opt_directio:
+ session_opts->flags |= V9FS_DIRECT_IO;
+ break;
+ case Opt_ignoreqv:
+ session_opts->flags |= V9FS_IGNORE_QV;
+ break;
+ case Opt_cachetag:
#ifdef CONFIG_9P_FSCACHE
- kfree(v9ses->cachetag);
- v9ses->cachetag = match_strdup(&args[0]);
- if (!v9ses->cachetag) {
- ret = -ENOMEM;
- goto free_and_return;
- }
+ kfree(session_opts->cachetag);
+ session_opts->cachetag = param->string;
+ param->string = NULL;
#endif
- break;
- case Opt_cache:
- s = match_strdup(&args[0]);
- if (!s) {
- ret = -ENOMEM;
- p9_debug(P9_DEBUG_ERROR,
- "problem allocating copy of cache arg\n");
- goto free_and_return;
- }
- r = get_cache_mode(s);
- if (r < 0)
- ret = r;
- else
- v9ses->cache = r;
-
- kfree(s);
- break;
-
- case Opt_access:
- s = match_strdup(&args[0]);
- if (!s) {
- ret = -ENOMEM;
- p9_debug(P9_DEBUG_ERROR,
- "problem allocating copy of access arg\n");
- goto free_and_return;
+ break;
+ case Opt_cache:
+ session_opts->cache = result.uint_32;
+ p9_debug(P9_DEBUG_9P, "Cache mode: %s\n", param->string);
+ break;
+ case Opt_access:
+ s = param->string;
+ session_opts->flags &= ~V9FS_ACCESS_MASK;
+ if (strcmp(s, "user") == 0) {
+ session_opts->flags |= V9FS_ACCESS_USER;
+ } else if (strcmp(s, "any") == 0) {
+ session_opts->flags |= V9FS_ACCESS_ANY;
+ } else if (strcmp(s, "client") == 0) {
+ session_opts->flags |= V9FS_ACCESS_CLIENT;
+ } else {
+ uid_t uid;
+
+ session_opts->flags |= V9FS_ACCESS_SINGLE;
+ r = kstrtouint(s, 10, &uid);
+ if (r) {
+ pr_info("Unknown access argument %s: %d\n",
+ param->string, r);
+ return r;
}
-
- v9ses->flags &= ~V9FS_ACCESS_MASK;
- if (strcmp(s, "user") == 0)
- v9ses->flags |= V9FS_ACCESS_USER;
- else if (strcmp(s, "any") == 0)
- v9ses->flags |= V9FS_ACCESS_ANY;
- else if (strcmp(s, "client") == 0) {
- v9ses->flags |= V9FS_ACCESS_CLIENT;
- } else {
- uid_t uid;
-
- v9ses->flags |= V9FS_ACCESS_SINGLE;
- r = kstrtouint(s, 10, &uid);
- if (r) {
- ret = r;
- pr_info("Unknown access argument %s: %d\n",
- s, r);
- kfree(s);
- continue;
- }
- v9ses->uid = make_kuid(current_user_ns(), uid);
- if (!uid_valid(v9ses->uid)) {
- ret = -EINVAL;
- pr_info("Unknown uid %s\n", s);
- }
+ session_opts->uid = make_kuid(current_user_ns(), uid);
+ if (!uid_valid(session_opts->uid)) {
+ pr_info("Unknown uid %s\n", s);
+ return -EINVAL;
}
+ }
+ break;
- kfree(s);
- break;
-
- case Opt_posixacl:
+ case Opt_posixacl:
#ifdef CONFIG_9P_FS_POSIX_ACL
- v9ses->flags |= V9FS_POSIX_ACL;
+ session_opts->flags |= V9FS_POSIX_ACL;
#else
- p9_debug(P9_DEBUG_ERROR,
- "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
+ p9_debug(P9_DEBUG_ERROR,
+ "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
#endif
- break;
-
- case Opt_locktimeout:
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- continue;
- }
- if (option < 1) {
- p9_debug(P9_DEBUG_ERROR,
- "locktimeout must be a greater than zero integer.\n");
- ret = -EINVAL;
- continue;
- }
- v9ses->session_lock_timeout = (long)option * HZ;
- break;
+ break;
+
+ case Opt_locktimeout:
+ if (result.uint_32 < 1) {
+ p9_debug(P9_DEBUG_ERROR,
+ "locktimeout must be a greater than zero integer.\n");
+ return -EINVAL;
+ }
+ session_opts->session_lock_timeout = (long)result.uint_32 * HZ;
+ break;
- default:
- continue;
+ /* Options for client */
+ case Opt_msize:
+ if (result.uint_32 < 4096) {
+ p9_debug(P9_DEBUG_ERROR, "msize should be at least 4k\n");
+ return -EINVAL;
+ }
+ if (result.uint_32 > INT_MAX) {
+ p9_debug(P9_DEBUG_ERROR, "msize too big\n");
+ return -EINVAL;
}
+ clnt->msize = result.uint_32;
+ break;
+ case Opt_trans:
+ v9fs_put_trans(clnt->trans_mod);
+ clnt->trans_mod = v9fs_get_trans_by_name(param->string);
+ if (!clnt->trans_mod) {
+ pr_info("Could not find request transport: %s\n",
+ param->string);
+ return -EINVAL;
+ }
+ break;
+ case Opt_legacy:
+ clnt->proto_version = p9_proto_legacy;
+ break;
+ case Opt_version:
+ clnt->proto_version = result.uint_32;
+ p9_debug(P9_DEBUG_9P, "Protocol version: %s\n", param->string);
+ break;
+ /* Options for fd transport */
+ case Opt_rfdno:
+ fd_opts->rfd = result.uint_32;
+ break;
+ case Opt_wfdno:
+ fd_opts->wfd = result.uint_32;
+ break;
+ /* Options for rdma transport */
+ case Opt_sq_depth:
+ rdma_opts->sq_depth = result.uint_32;
+ break;
+ case Opt_rq_depth:
+ rdma_opts->rq_depth = result.uint_32;
+ break;
+ case Opt_timeout:
+ rdma_opts->timeout = result.uint_32;
+ break;
+ /* Options for both fd and rdma transports */
+ case Opt_port:
+ fd_opts->port = result.uint_32;
+ rdma_opts->port = result.uint_32;
+ break;
+ case Opt_privport:
+ fd_opts->privport = true;
+ rdma_opts->port = true;
+ break;
}
-free_and_return:
- kfree(tmp_options);
-fail_option_alloc:
- return ret;
+ return 0;
+}
+
+static void v9fs_apply_options(struct v9fs_session_info *v9ses,
+ struct fs_context *fc)
+{
+ struct v9fs_context *ctx = fc->fs_private;
+
+ v9ses->debug = ctx->session_opts.debug;
+ v9ses->dfltuid = ctx->session_opts.dfltuid;
+ v9ses->dfltgid = ctx->session_opts.dfltgid;
+ v9ses->afid = ctx->session_opts.afid;
+ v9ses->uname = ctx->session_opts.uname;
+ ctx->session_opts.uname = NULL;
+ v9ses->aname = ctx->session_opts.aname;
+ ctx->session_opts.aname = NULL;
+ v9ses->nodev = ctx->session_opts.nodev;
+ /*
+ * Note that we must |= flags here as session_init already
+ * set basic flags. This adds in flags from parsed options.
+ */
+ v9ses->flags |= ctx->session_opts.flags;
+#ifdef CONFIG_9P_FSCACHE
+ v9ses->cachetag = ctx->session_opts.cachetag;
+ ctx->session_opts.cachetag = NULL;
+#endif
+ v9ses->cache = ctx->session_opts.cache;
+ v9ses->uid = ctx->session_opts.uid;
+ v9ses->session_lock_timeout = ctx->session_opts.session_lock_timeout;
}
/**
* v9fs_session_init - initialize session
* @v9ses: session information structure
- * @dev_name: device being mounted
- * @data: options
+ * @fc: the filesystem mount context
*
*/
struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
- const char *dev_name, char *data)
+ struct fs_context *fc)
{
struct p9_fid *fid;
int rc = -ENOMEM;
- v9ses->uname = kstrdup(V9FS_DEFUSER, GFP_KERNEL);
- if (!v9ses->uname)
- goto err_names;
-
- v9ses->aname = kstrdup(V9FS_DEFANAME, GFP_KERNEL);
- if (!v9ses->aname)
- goto err_names;
init_rwsem(&v9ses->rename_sem);
- v9ses->uid = INVALID_UID;
- v9ses->dfltuid = V9FS_DEFUID;
- v9ses->dfltgid = V9FS_DEFGID;
-
- v9ses->clnt = p9_client_create(dev_name, data);
+ v9ses->clnt = p9_client_create(fc);
if (IS_ERR(v9ses->clnt)) {
rc = PTR_ERR(v9ses->clnt);
p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n");
goto err_names;
}
+ /*
+ * Initialize flags on the real v9ses. v9fs_apply_options below
+ * will |= the additional flags from parsed options.
+ */
v9ses->flags = V9FS_ACCESS_USER;
if (p9_is_proto_dotl(v9ses->clnt)) {
@@ -424,9 +440,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
v9ses->flags |= V9FS_PROTO_2000U;
}
- rc = v9fs_parse_options(v9ses, data);
- if (rc < 0)
- goto err_clnt;
+ v9fs_apply_options(v9ses, fc);
v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ;
@@ -472,7 +486,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
#ifdef CONFIG_9P_FSCACHE
/* register the session for caching */
if (v9ses->cache & CACHE_FSCACHE) {
- rc = v9fs_cache_session_get_cookie(v9ses, dev_name);
+ rc = v9fs_cache_session_get_cookie(v9ses, fc->source);
if (rc < 0)
goto err_clnt;
}
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index f28bc763847ae..6a12445d38582 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -10,6 +10,9 @@
#include <linux/backing-dev.h>
#include <linux/netfs.h>
+#include <linux/fs_parser.h>
+#include <net/9p/client.h>
+#include <net/9p/transport.h>
/**
* enum p9_session_flags - option flags for each 9P session
@@ -163,11 +166,13 @@ static inline struct fscache_volume *v9fs_session_cache(struct v9fs_session_info
#endif
}
+extern const struct fs_parameter_spec v9fs_param_spec[];
+extern int v9fs_parse_param(struct fs_context *fc, struct fs_parameter *param);
extern int v9fs_show_options(struct seq_file *m, struct dentry *root);
struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
- const char *dev_name, char *data);
+ struct fs_context *fc);
extern void v9fs_session_close(struct v9fs_session_info *v9ses);
extern void v9fs_session_cancel(struct v9fs_session_info *v9ses);
extern void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses);
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 1581ebac5bb42..315336de6f02a 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -19,6 +19,7 @@
#include <linux/statfs.h>
#include <linux/magic.h>
#include <linux/fscache.h>
+#include <linux/fs_context.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>
@@ -30,32 +31,10 @@
static const struct super_operations v9fs_super_ops, v9fs_super_ops_dotl;
-/**
- * v9fs_set_super - set the superblock
- * @s: super block
- * @data: file system specific data
- *
- */
-
-static int v9fs_set_super(struct super_block *s, void *data)
-{
- s->s_fs_info = data;
- return set_anon_super(s, data);
-}
-
-/**
- * v9fs_fill_super - populate superblock with info
- * @sb: superblock
- * @v9ses: session information
- * @flags: flags propagated from v9fs_mount()
- *
- */
-
-static int
-v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
- int flags)
+static int v9fs_fill_super(struct super_block *sb)
{
int ret;
+ struct v9fs_session_info *v9ses = v9ses = sb->s_fs_info;
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
@@ -95,16 +74,12 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
}
/**
- * v9fs_mount - mount a superblock
- * @fs_type: file system type
- * @flags: mount flags
- * @dev_name: device name that was mounted
- * @data: mount options
+ * v9fs_get_tree - create the mountable root and superblock
+ * @fc: the filesystem context
*
*/
-static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
- const char *dev_name, void *data)
+static int v9fs_get_tree(struct fs_context *fc)
{
struct super_block *sb = NULL;
struct inode *inode = NULL;
@@ -117,20 +92,21 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
if (!v9ses)
- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;
- fid = v9fs_session_init(v9ses, dev_name, data);
+ fid = v9fs_session_init(v9ses, fc);
if (IS_ERR(fid)) {
retval = PTR_ERR(fid);
goto free_session;
}
- sb = sget(fs_type, NULL, v9fs_set_super, flags, v9ses);
+ fc->s_fs_info = v9ses;
+ sb = sget_fc(fc, NULL, set_anon_super_fc);
if (IS_ERR(sb)) {
retval = PTR_ERR(sb);
goto clunk_fid;
}
- retval = v9fs_fill_super(sb, v9ses, flags);
+ retval = v9fs_fill_super(sb);
if (retval)
goto release_sb;
@@ -159,14 +135,15 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
v9fs_fid_add(root, &fid);
p9_debug(P9_DEBUG_VFS, " simple set mount, return 0\n");
- return dget(sb->s_root);
+ fc->root = dget(sb->s_root);
+ return 0;
clunk_fid:
p9_fid_put(fid);
v9fs_session_close(v9ses);
free_session:
kfree(v9ses);
- return ERR_PTR(retval);
+ return retval;
release_sb:
/*
@@ -177,7 +154,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
*/
p9_fid_put(fid);
deactivate_locked_super(sb);
- return ERR_PTR(retval);
+ return retval;
}
/**
@@ -303,11 +280,86 @@ static const struct super_operations v9fs_super_ops_dotl = {
.write_inode = v9fs_write_inode_dotl,
};
+static void v9fs_free_fc(struct fs_context *fc)
+{
+ struct v9fs_context *ctx = fc->fs_private;
+
+ if (!ctx)
+ return;
+
+ /* These should be NULL by now but guard against leaks */
+ kfree(ctx->session_opts.uname);
+ kfree(ctx->session_opts.aname);
+#ifdef CONFIG_9P_FSCACHE
+ kfree(ctx->session_opts.cachetag);
+#endif
+ if (ctx->client_opts.trans_mod)
+ v9fs_put_trans(ctx->client_opts.trans_mod);
+ kfree(ctx);
+}
+
+static const struct fs_context_operations v9fs_context_ops = {
+ .parse_param = v9fs_parse_param,
+ .get_tree = v9fs_get_tree,
+ .free = v9fs_free_fc,
+};
+
+static int v9fs_init_fs_context(struct fs_context *fc)
+{
+ struct v9fs_context *ctx;
+
+ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+ if (!ctx)
+ return -ENOMEM;
+
+ /* initialize core options */
+ ctx->session_opts.afid = ~0;
+ ctx->session_opts.cache = CACHE_NONE;
+ ctx->session_opts.session_lock_timeout = P9_LOCK_TIMEOUT;
+ ctx->session_opts.uname = kstrdup(V9FS_DEFUSER, GFP_KERNEL);
+ if (!ctx->session_opts.uname)
+ goto error;
+
+ ctx->session_opts.aname = kstrdup(V9FS_DEFANAME, GFP_KERNEL);
+ if (!ctx->session_opts.aname)
+ goto error;
+
+ ctx->session_opts.uid = INVALID_UID;
+ ctx->session_opts.dfltuid = V9FS_DEFUID;
+ ctx->session_opts.dfltgid = V9FS_DEFGID;
+
+ /* initialize client options */
+ ctx->client_opts.proto_version = p9_proto_2000L;
+ ctx->client_opts.msize = DEFAULT_MSIZE;
+
+ /* initialize fd transport options */
+ ctx->fd_opts.port = P9_FD_PORT;
+ ctx->fd_opts.rfd = ~0;
+ ctx->fd_opts.wfd = ~0;
+ ctx->fd_opts.privport = false;
+
+ /* initialize rdma transport options */
+ ctx->rdma_opts.port = P9_RDMA_PORT;
+ ctx->rdma_opts.sq_depth = P9_RDMA_SQ_DEPTH;
+ ctx->rdma_opts.rq_depth = P9_RDMA_RQ_DEPTH;
+ ctx->rdma_opts.timeout = P9_RDMA_TIMEOUT;
+ ctx->rdma_opts.privport = false;
+
+ fc->ops = &v9fs_context_ops;
+ fc->fs_private = ctx;
+
+ return 0;
+error:
+ fc->need_free = 1;
+ return -ENOMEM;
+}
+
struct file_system_type v9fs_fs_type = {
.name = "9p",
- .mount = v9fs_mount,
.kill_sb = v9fs_kill_super,
.owner = THIS_MODULE,
.fs_flags = FS_RENAME_DOES_D_MOVE,
+ .init_fs_context = v9fs_init_fs_context,
+ .parameters = v9fs_param_spec,
};
MODULE_ALIAS_FS("9p");
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index cc18443f7d516..838a94218b593 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -279,7 +279,7 @@ int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid,
const char *name);
int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name,
struct p9_fid *newdirfid, const char *new_name);
-struct p9_client *p9_client_create(const char *dev_name, char *options);
+struct p9_client *p9_client_create(struct fs_context *fc);
void p9_client_destroy(struct p9_client *clnt);
void p9_client_disconnect(struct p9_client *clnt);
void p9_client_begin_disconnect(struct p9_client *clnt);
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index ebbb4b50ee205..e53f312191b6e 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -53,7 +53,7 @@ struct p9_trans_module {
int def; /* this transport should be default */
struct module *owner;
int (*create)(struct p9_client *client,
- const char *devname, char *args);
+ struct fs_context *fc);
void (*close)(struct p9_client *client);
int (*request)(struct p9_client *client, struct p9_req_t *req);
int (*cancel)(struct p9_client *client, struct p9_req_t *req);
diff --git a/net/9p/client.c b/net/9p/client.c
index 8d4547d4b4872..5d0ed3e5797f9 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -20,8 +20,8 @@
#include <linux/uio.h>
#include <linux/netfs.h>
#include <net/9p/9p.h>
-#include <linux/parser.h>
#include <linux/seq_file.h>
+#include <linux/fs_context.h>
#include <net/9p/client.h>
#include <net/9p/transport.h>
#include "protocol.h"
@@ -33,22 +33,6 @@
* - a little lazy - parse all client options
*/
-enum {
- Opt_msize,
- Opt_trans,
- Opt_legacy,
- Opt_version,
- Opt_err,
-};
-
-static const match_table_t tokens = {
- {Opt_msize, "msize=%u"},
- {Opt_legacy, "noextend"},
- {Opt_trans, "trans=%s"},
- {Opt_version, "version=%s"},
- {Opt_err, NULL},
-};
-
inline int p9_is_proto_dotl(struct p9_client *clnt)
{
return clnt->proto_version == p9_proto_2000L;
@@ -97,124 +81,16 @@ static int safe_errno(int err)
return err;
}
-/* Interpret mount option for protocol version */
-static int get_protocol_version(char *s)
+static int apply_client_options(struct p9_client *clnt, struct fs_context *fc)
{
- int version = -EINVAL;
-
- if (!strcmp(s, "9p2000")) {
- version = p9_proto_legacy;
- p9_debug(P9_DEBUG_9P, "Protocol version: Legacy\n");
- } else if (!strcmp(s, "9p2000.u")) {
- version = p9_proto_2000u;
- p9_debug(P9_DEBUG_9P, "Protocol version: 9P2000.u\n");
- } else if (!strcmp(s, "9p2000.L")) {
- version = p9_proto_2000L;
- p9_debug(P9_DEBUG_9P, "Protocol version: 9P2000.L\n");
- } else {
- pr_info("Unknown protocol version %s\n", s);
- }
+ struct v9fs_context *ctx = fc->fs_private;
- return version;
-}
-
-/**
- * parse_opts - parse mount options into client structure
- * @opts: options string passed from mount
- * @clnt: existing v9fs client information
- *
- * Return 0 upon success, -ERRNO upon failure
- */
-
-static int parse_opts(char *opts, struct p9_client *clnt)
-{
- char *options, *tmp_options;
- char *p;
- substring_t args[MAX_OPT_ARGS];
- int option;
- char *s;
- int ret = 0;
-
- clnt->proto_version = p9_proto_2000L;
- clnt->msize = DEFAULT_MSIZE;
-
- if (!opts)
- return 0;
+ clnt->msize = ctx->client_opts.msize;
+ clnt->trans_mod = ctx->client_opts.trans_mod;
+ ctx->client_opts.trans_mod = NULL;
+ clnt->proto_version = ctx->client_opts.proto_version;
- tmp_options = kstrdup(opts, GFP_KERNEL);
- if (!tmp_options)
- return -ENOMEM;
- options = tmp_options;
-
- while ((p = strsep(&options, ",")) != NULL) {
- int token, r;
-
- if (!*p)
- continue;
- token = match_token(p, tokens, args);
- switch (token) {
- case Opt_msize:
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- continue;
- }
- if (option < 4096) {
- p9_debug(P9_DEBUG_ERROR,
- "msize should be at least 4k\n");
- ret = -EINVAL;
- continue;
- }
- clnt->msize = option;
- break;
- case Opt_trans:
- s = match_strdup(&args[0]);
- if (!s) {
- ret = -ENOMEM;
- p9_debug(P9_DEBUG_ERROR,
- "problem allocating copy of trans arg\n");
- goto free_and_return;
- }
-
- v9fs_put_trans(clnt->trans_mod);
- clnt->trans_mod = v9fs_get_trans_by_name(s);
- if (!clnt->trans_mod) {
- pr_info("Could not find request transport: %s\n",
- s);
- ret = -EINVAL;
- }
- kfree(s);
- break;
- case Opt_legacy:
- clnt->proto_version = p9_proto_legacy;
- break;
- case Opt_version:
- s = match_strdup(&args[0]);
- if (!s) {
- ret = -ENOMEM;
- p9_debug(P9_DEBUG_ERROR,
- "problem allocating copy of version arg\n");
- goto free_and_return;
- }
- r = get_protocol_version(s);
- if (r < 0)
- ret = r;
- else
- clnt->proto_version = r;
- kfree(s);
- break;
- default:
- continue;
- }
- }
-
-free_and_return:
- if (ret)
- v9fs_put_trans(clnt->trans_mod);
- kfree(tmp_options);
- return ret;
+ return 0;
}
static int p9_fcall_init(struct p9_client *c, struct p9_fcall *fc,
@@ -970,7 +846,7 @@ static int p9_client_version(struct p9_client *c)
return err;
}
-struct p9_client *p9_client_create(const char *dev_name, char *options)
+struct p9_client *p9_client_create(struct fs_context *fc)
{
int err;
static atomic_t seqno = ATOMIC_INIT(0);
@@ -993,8 +869,8 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
idr_init(&clnt->fids);
idr_init(&clnt->reqs);
- err = parse_opts(options, clnt);
- if (err < 0)
+ err = apply_client_options(clnt, fc);
+ if (err)
goto free_client;
if (!clnt->trans_mod)
@@ -1010,7 +886,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
p9_debug(P9_DEBUG_MUX, "clnt %p trans %p msize %d protocol %d\n",
clnt, clnt->trans_mod, clnt->msize, clnt->proto_version);
- err = clnt->trans_mod->create(clnt, dev_name, options);
+ err = clnt->trans_mod->create(clnt, fc);
if (err)
goto put_trans;
diff --git a/net/9p/mod.c b/net/9p/mod.c
index 55576c1866fa6..85160b52da556 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -16,7 +16,6 @@
#include <linux/moduleparam.h>
#include <net/9p/9p.h>
#include <linux/fs.h>
-#include <linux/parser.h>
#include <net/9p/client.h>
#include <net/9p/transport.h>
#include <linux/list.h>
@@ -171,6 +170,7 @@ void v9fs_put_trans(struct p9_trans_module *m)
if (m)
module_put(m->owner);
}
+EXPORT_SYMBOL(v9fs_put_trans);
/**
* init_p9 - Initialize module
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index fdaebb549aa8f..8a03e62992508 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -22,7 +22,7 @@
#include <linux/uaccess.h>
#include <linux/inet.h>
#include <linux/file.h>
-#include <linux/parser.h>
+#include <linux/fs_context.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
#include <net/9p/9p.h>
@@ -37,26 +37,6 @@
static struct p9_trans_module p9_tcp_trans;
static struct p9_trans_module p9_fd_trans;
-/*
- * Option Parsing (code inspired by NFS code)
- * - a little lazy - parse all fd-transport options
- */
-
-enum {
- /* Options that take integer arguments */
- Opt_port, Opt_rfdno, Opt_wfdno, Opt_err,
- /* Options that take no arguments */
- Opt_privport,
-};
-
-static const match_table_t tokens = {
- {Opt_port, "port=%u"},
- {Opt_rfdno, "rfdno=%u"},
- {Opt_wfdno, "wfdno=%u"},
- {Opt_privport, "privport"},
- {Opt_err, NULL},
-};
-
enum {
Rworksched = 1, /* read work scheduled or running */
Rpending = 2, /* can read */
@@ -737,73 +717,6 @@ static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt)
return 0;
}
-/**
- * parse_opts - parse mount options into p9_fd_opts structure
- * @params: options string passed from mount
- * @opts: fd transport-specific structure to parse options into
- *
- * Returns 0 upon success, -ERRNO upon failure
- */
-
-static int parse_opts(char *params, struct p9_fd_opts *opts)
-{
- char *p;
- substring_t args[MAX_OPT_ARGS];
- int option;
- char *options, *tmp_options;
-
- opts->port = P9_FD_PORT;
- opts->rfd = ~0;
- opts->wfd = ~0;
- opts->privport = false;
-
- if (!params)
- return 0;
-
- tmp_options = kstrdup(params, GFP_KERNEL);
- if (!tmp_options) {
- p9_debug(P9_DEBUG_ERROR,
- "failed to allocate copy of option string\n");
- return -ENOMEM;
- }
- options = tmp_options;
-
- while ((p = strsep(&options, ",")) != NULL) {
- int token;
- int r;
- if (!*p)
- continue;
- token = match_token(p, tokens, args);
- if ((token != Opt_err) && (token != Opt_privport)) {
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- continue;
- }
- }
- switch (token) {
- case Opt_port:
- opts->port = option;
- break;
- case Opt_rfdno:
- opts->rfd = option;
- break;
- case Opt_wfdno:
- opts->wfd = option;
- break;
- case Opt_privport:
- opts->privport = true;
- break;
- default:
- continue;
- }
- }
-
- kfree(tmp_options);
- return 0;
-}
-
static int p9_fd_open(struct p9_client *client, int rfd, int wfd)
{
struct p9_trans_fd *ts = kzalloc(sizeof(struct p9_trans_fd),
@@ -958,17 +871,18 @@ static int p9_bind_privport(struct socket *sock)
}
static int
-p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
+p9_fd_create_tcp(struct p9_client *client, struct fs_context *fc)
{
+ const char *addr = fc->source;
+ struct v9fs_context *ctx = fc->fs_private;
int err;
char port_str[6];
struct socket *csocket;
struct sockaddr_storage stor = { 0 };
struct p9_fd_opts opts;
- err = parse_opts(args, &opts);
- if (err < 0)
- return err;
+ /* opts are already parsed in context */
+ opts = ctx->fd_opts;
if (!addr)
return -EINVAL;
@@ -1015,8 +929,9 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
}
static int
-p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
+p9_fd_create_unix(struct p9_client *client, struct fs_context *fc)
{
+ const char *addr = fc->source;
int err;
struct socket *csocket;
struct sockaddr_un sun_server;
@@ -1055,14 +970,12 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args)
}
static int
-p9_fd_create(struct p9_client *client, const char *addr, char *args)
+p9_fd_create(struct p9_client *client, struct fs_context *fc)
{
+ struct v9fs_context *ctx = fc->fs_private;
+ struct p9_fd_opts opts = ctx->fd_opts;
int err;
- struct p9_fd_opts opts;
- err = parse_opts(args, &opts);
- if (err < 0)
- return err;
client->trans_opts.fd.rfd = opts.rfd;
client->trans_opts.fd.wfd = opts.wfd;
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 92b166a4a1e52..4a779b3a56987 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -22,7 +22,7 @@
#include <linux/uaccess.h>
#include <linux/inet.h>
#include <linux/file.h>
-#include <linux/parser.h>
+#include <linux/fs_context.h>
#include <linux/semaphore.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
@@ -106,26 +106,6 @@ struct p9_rdma_context {
};
};
-/*
- * Option Parsing (code inspired by NFS code)
- */
-enum {
- /* Options that take integer arguments */
- Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout,
- /* Options that take no argument */
- Opt_privport,
- Opt_err,
-};
-
-static match_table_t tokens = {
- {Opt_port, "port=%u"},
- {Opt_sq_depth, "sq=%u"},
- {Opt_rq_depth, "rq=%u"},
- {Opt_timeout, "timeout=%u"},
- {Opt_privport, "privport"},
- {Opt_err, NULL},
-};
-
static int p9_rdma_show_options(struct seq_file *m, struct p9_client *clnt)
{
struct p9_trans_rdma *rdma = clnt->trans;
@@ -143,77 +123,6 @@ static int p9_rdma_show_options(struct seq_file *m, struct p9_client *clnt)
return 0;
}
-/**
- * parse_opts - parse mount options into rdma options structure
- * @params: options string passed from mount
- * @opts: rdma transport-specific structure to parse options into
- *
- * Returns 0 upon success, -ERRNO upon failure
- */
-static int parse_opts(char *params, struct p9_rdma_opts *opts)
-{
- char *p;
- substring_t args[MAX_OPT_ARGS];
- int option;
- char *options, *tmp_options;
-
- opts->port = P9_RDMA_PORT;
- opts->sq_depth = P9_RDMA_SQ_DEPTH;
- opts->rq_depth = P9_RDMA_RQ_DEPTH;
- opts->timeout = P9_RDMA_TIMEOUT;
- opts->privport = false;
-
- if (!params)
- return 0;
-
- tmp_options = kstrdup(params, GFP_KERNEL);
- if (!tmp_options) {
- p9_debug(P9_DEBUG_ERROR,
- "failed to allocate copy of option string\n");
- return -ENOMEM;
- }
- options = tmp_options;
-
- while ((p = strsep(&options, ",")) != NULL) {
- int token;
- int r;
- if (!*p)
- continue;
- token = match_token(p, tokens, args);
- if ((token != Opt_err) && (token != Opt_privport)) {
- r = match_int(&args[0], &option);
- if (r < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- continue;
- }
- }
- switch (token) {
- case Opt_port:
- opts->port = option;
- break;
- case Opt_sq_depth:
- opts->sq_depth = option;
- break;
- case Opt_rq_depth:
- opts->rq_depth = option;
- break;
- case Opt_timeout:
- opts->timeout = option;
- break;
- case Opt_privport:
- opts->privport = true;
- break;
- default:
- continue;
- }
- }
- /* RQ must be at least as large as the SQ */
- opts->rq_depth = max(opts->rq_depth, opts->sq_depth);
- kfree(tmp_options);
- return 0;
-}
-
static int
p9_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
{
@@ -622,14 +531,15 @@ static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma)
/**
* rdma_create_trans - Transport method for creating a transport instance
* @client: client instance
- * @addr: IP address string
- * @args: Mount options string
+ * @fc: The filesystem context
*/
static int
-rdma_create_trans(struct p9_client *client, const char *addr, char *args)
+rdma_create_trans(struct p9_client *client, struct fs_context *fc)
{
+ const char *addr = fc->source;
+ struct v9fs_context *ctx = fc->fs_private;
+ struct p9_rdma_opts opts = ctx->rdma_opts;
int err;
- struct p9_rdma_opts opts;
struct p9_trans_rdma *rdma;
struct rdma_conn_param conn_param;
struct ib_qp_init_attr qp_attr;
@@ -637,10 +547,8 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args)
if (addr == NULL)
return -EINVAL;
- /* Parse the transport specific mount options */
- err = parse_opts(args, &opts);
- if (err < 0)
- return err;
+ /* options are already parsed, in the fs context */
+ opts = ctx->rdma_opts;
/* Create and initialize the RDMA transport structure */
rdma = alloc_rdma(&opts);
diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
index 938e3130ab81a..dd5d833f2c827 100644
--- a/net/9p/trans_usbg.c
+++ b/net/9p/trans_usbg.c
@@ -27,6 +27,7 @@
#include <linux/cleanup.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/fs_context.h>
#include <linux/usb/composite.h>
#include <linux/usb/func_utils.h>
@@ -392,8 +393,9 @@ enable_usb9pfs(struct usb_composite_dev *cdev, struct f_usb9pfs *usb9pfs)
return ret;
}
-static int p9_usbg_create(struct p9_client *client, const char *devname, char *args)
+static int p9_usbg_create(struct p9_client *client, struct fs_context *fc)
{
+ const char *devname = fc->source;
struct f_usb9pfs_dev *dev;
struct f_usb9pfs *usb9pfs;
int ret = -ENOENT;
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index d1a680f699115..6c2a134e7d85c 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -26,7 +26,7 @@
#include <linux/highmem.h>
#include <linux/slab.h>
#include <net/9p/9p.h>
-#include <linux/parser.h>
+#include <linux/fs_context.h>
#include <net/9p/client.h>
#include <net/9p/transport.h>
#include <linux/scatterlist.h>
@@ -684,8 +684,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
/**
* p9_virtio_create - allocate a new virtio channel
* @client: client instance invoking this transport
- * @devname: string identifying the channel to connect to (unused)
- * @args: args passed from sys_mount() for per-transport options (unused)
+ * @fc: the filesystem context
*
* This sets up a transport channel for 9p communication. Right now
* we only match the first available channel, but eventually we could look up
@@ -696,8 +695,9 @@ static int p9_virtio_probe(struct virtio_device *vdev)
*/
static int
-p9_virtio_create(struct p9_client *client, const char *devname, char *args)
+p9_virtio_create(struct p9_client *client, struct fs_context *fc)
{
+ const char *devname = fc->source;
struct virtio_chan *chan;
int ret = -ENOENT;
int found = 0;
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index ef9bac5f4a24a..95f314f0285ef 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/spinlock.h>
+#include <linux/fs_context.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>
#include <net/9p/transport.h>
@@ -66,8 +67,9 @@ static int p9_xen_cancel(struct p9_client *client, struct p9_req_t *req)
return 1;
}
-static int p9_xen_create(struct p9_client *client, const char *addr, char *args)
+static int p9_xen_create(struct p9_client *client, struct fs_context *fc)
{
+ const char *addr = fc->source;
struct xen_9pfs_front_priv *priv;
if (addr == NULL)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 062/990] net/9p: Replace strlen() strcpy() pair with strscpy()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (60 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 061/990] 9p: convert to the new mount API Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 063/990] 9p: use fc->net_ns for network namespace in RDMA and socket transports Greg Kroah-Hartman
` (790 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Laight <david.laight.linux@gmail.com>
[ Upstream commit cc8b15a2c435bd1caf19741ba85286846a115764 ]
Use the result of strscpy() for the overflow check.
Signed-off-by: David Laight <david.laight.linux@gmail.com>
Message-ID: <20260606202744.5113-3-david.laight.linux@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/9p/trans_fd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 8a03e62992508..f31b2a81ef8bd 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -941,14 +941,12 @@ p9_fd_create_unix(struct p9_client *client, struct fs_context *fc)
if (!addr || !strlen(addr))
return -EINVAL;
- if (strlen(addr) >= UNIX_PATH_MAX) {
+ sun_server.sun_family = PF_UNIX;
+ if (strscpy(sun_server.sun_path, addr) < 0) {
pr_err("%s (%d): address too long: %s\n",
__func__, task_pid_nr(current), addr);
return -ENAMETOOLONG;
}
-
- sun_server.sun_family = PF_UNIX;
- strcpy(sun_server.sun_path, addr);
err = __sock_create(current->nsproxy->net_ns, PF_UNIX,
SOCK_STREAM, 0, &csocket, 1);
if (err < 0) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 063/990] 9p: use fc->net_ns for network namespace in RDMA and socket transports
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (61 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 062/990] net/9p: Replace strlen() strcpy() pair with strscpy() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 064/990] net/9p/usbg: fix descriptor cleanup use-after-free Greg Kroah-Hartman
` (789 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yizhou Zhao, Yuxiang Yang, Ao Wang,
Xuewei Feng, Qi Li, Ke Xu, Dominique Martinet, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
[ Upstream commit 37dce65a0b4356d7ec289a5d09cece5db241c302 ]
The 9p RDMA transport currently passes &init_net to rdma_create_id().
As a result, RDMA address resolution and connection setup are performed
in the initial network namespace, even when the mount is initiated from
a non-initial network namespace.
This differs from the socket-based 9p transports, which create sockets
in current->nsproxy->net_ns. Use fc->net_ns for both the RDMA and
socket transports instead, so that transport setup follows the VFS
mount namespace context rather than depending on the calling process's
current namespace.
This avoids surprising behaviour where a 9p RDMA mount from a container
or other non-initial network namespace may use the host namespace for
RDMA CM operations.
Fixes: fa20105e09e9 ("IB/cma: Add support for network namespaces")
Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Reported-by: Ao Wang <wangao@seu.edu.cn>
Reported-by: Xuewei Feng <fengxw06@126.com>
Reported-by: Qi Li <qli01@tsinghua.edu.cn>
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Suggested-by: Dominique Martinet <asmadeus@codewreck.org>
Assisted-by: GLM:GLM-5.1
Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Message-ID: <20260529090625.78761-1-zhaoyz24@mails.tsinghua.edu.cn>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/9p/trans_fd.c | 11 +++++------
net/9p/trans_rdma.c | 2 +-
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index f31b2a81ef8bd..780d4ee397f86 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -888,8 +888,8 @@ p9_fd_create_tcp(struct p9_client *client, struct fs_context *fc)
return -EINVAL;
sprintf(port_str, "%u", opts.port);
- err = inet_pton_with_scope(current->nsproxy->net_ns, AF_UNSPEC, addr,
- port_str, &stor);
+ err = inet_pton_with_scope(fc->net_ns, AF_UNSPEC, addr, port_str,
+ &stor);
if (err < 0)
return err;
@@ -897,8 +897,8 @@ p9_fd_create_tcp(struct p9_client *client, struct fs_context *fc)
client->trans_opts.tcp.port = opts.port;
client->trans_opts.tcp.privport = opts.privport;
- err = __sock_create(current->nsproxy->net_ns, stor.ss_family,
- SOCK_STREAM, IPPROTO_TCP, &csocket, 1);
+ err = __sock_create(fc->net_ns, stor.ss_family, SOCK_STREAM,
+ IPPROTO_TCP, &csocket, 1);
if (err) {
pr_err("%s (%d): problem creating socket\n",
__func__, task_pid_nr(current));
@@ -947,8 +947,7 @@ p9_fd_create_unix(struct p9_client *client, struct fs_context *fc)
__func__, task_pid_nr(current), addr);
return -ENAMETOOLONG;
}
- err = __sock_create(current->nsproxy->net_ns, PF_UNIX,
- SOCK_STREAM, 0, &csocket, 1);
+ err = __sock_create(fc->net_ns, PF_UNIX, SOCK_STREAM, 0, &csocket, 1);
if (err < 0) {
pr_err("%s (%d): problem creating socket\n",
__func__, task_pid_nr(current));
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 4a779b3a56987..e5c5575849d62 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -556,7 +556,7 @@ rdma_create_trans(struct p9_client *client, struct fs_context *fc)
return -ENOMEM;
/* Create the RDMA CM ID */
- rdma->cm_id = rdma_create_id(&init_net, p9_cm_event_handler, client,
+ rdma->cm_id = rdma_create_id(fc->net_ns, p9_cm_event_handler, client,
RDMA_PS_TCP, IB_QPT_RC);
if (IS_ERR(rdma->cm_id))
goto error;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 064/990] net/9p/usbg: fix descriptor cleanup use-after-free
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (62 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 063/990] 9p: use fc->net_ns for network namespace in RDMA and socket transports Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 065/990] net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx Greg Kroah-Hartman
` (788 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yizhou Zhao, Yuxiang Yang, Ao Wang,
Xuewei Feng, Qi Li, Ke Xu, Chengfeng Ye, Michael Grzeschik,
Dominique Martinet, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
[ Upstream commit 0955472fff1e9f9e410a0300136924ebc8bd7a16 ]
usb9pfs_free_func() frees the f_usb9pfs object before calling
usb_free_all_descriptors(). The usb_function passed to the latter is
embedded in the freed object, so removing the function from a gadget
dereferences freed memory.
The failing teardown sequence is:
configfs unlink
usb9pfs_free_func()
kfree(usb9pfs)
usb_free_all_descriptors(f)
dereference the embedded usb_function
KASAN reported:
BUG: KASAN: slab-use-after-free in usb_free_all_descriptors+0x138/0x190
Read of size 8 at addr ffff888106a73088 by task poc/95
Call Trace:
usb_free_all_descriptors+0x138/0x190
config_usb_cfg_unlink+0x1f0/0x2f0
configfs_unlink+0x321/0x6f0
Free the descriptors before freeing their containing object.
Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport")
Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Reported-by: Ao Wang <wangao@seu.edu.cn>
Reported-by: Xuewei Feng <fengxw06@126.com>
Reported-by: Qi Li <qli01@tsinghua.edu.cn>
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Assisted-by: GLM:GLM-5.1
Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Co-developed-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Acked-by: Michael Grzeschik <mgr@kernel.org>
Message-ID: <20260529081817.77898-1-zhaoyz24@mails.tsinghua.edu.cn>
Message-ID: <20260731150414.3135662-1-nicoyip.dev@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/9p/trans_usbg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
index dd5d833f2c827..1592b99ae00c7 100644
--- a/net/9p/trans_usbg.c
+++ b/net/9p/trans_usbg.c
@@ -753,8 +753,6 @@ static void usb9pfs_free_func(struct usb_function *f)
struct f_usb9pfs *usb9pfs = func_to_usb9pfs(f);
struct f_usb9pfs_opts *opts;
- kfree(usb9pfs);
-
opts = container_of(f->fi, struct f_usb9pfs_opts, func_inst);
mutex_lock(&opts->lock);
@@ -762,6 +760,8 @@ static void usb9pfs_free_func(struct usb_function *f)
mutex_unlock(&opts->lock);
usb_free_all_descriptors(f);
+
+ kfree(usb9pfs);
}
static int usb9pfs_set_alt(struct usb_function *f,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 065/990] net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (63 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 064/990] net/9p/usbg: fix descriptor cleanup use-after-free Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 066/990] 9p: skip intermediate directory entry name copy in p9dirent_read() Greg Kroah-Hartman
` (787 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yizhou Zhao, Yuxiang Yang, Ao Wang,
Xuewei Feng, Qi Li, Ke Xu, Michael Grzeschik, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
[ Upstream commit 5c69297356bf6d04d8222f52717c6c4aa73e5d2c ]
When p9_usbg_close() is called, it invokes usb9pfs_clear_tx() but does
not clear usb9pfs->client nor usb9pfs->in_req->context afterwards.
The 9p client core (p9_client_destroy) calls close() and then
kfree(clnt), so after p9_usbg_close returns the client struct is freed.
If the USB gadget is later disabled (e.g., host disconnect),
usb9pfs_disable calls usb9pfs_clear_tx again, which passes the dangling
usb9pfs->client pointer to p9_client_cb. Inside p9_client_cb,
p9_req_put(c, req) dereferences the freed client to access its reqs IDR,
causing a use-after-free.
Additionally, usb9pfs_clear_tx does not clear usb9pfs->in_req->context
after calling p9_client_cb, so a second invocation finds a stale request
pointer and attempts double-completion, further compounding the UAF risk.
Fix by:
1. Clearing usb9pfs->in_req->context to NULL in usb9pfs_clear_tx()
before checking usb9pfs->client, so that even if the client is gone
the stale request pointer is consumed and cannot cause
double-completion.
2. Adding a NULL check on usb9pfs->client in usb9pfs_clear_tx() to skip
p9_client_cb() when the client has already been destroyed.
3. Setting usb9pfs->client = NULL in p9_usbg_close() after calling
usb9pfs_clear_tx(), to prevent any subsequent call from dereferencing
the freed client pointer.
Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport")
Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Reported-by: Ao Wang <wangao@seu.edu.cn>
Reported-by: Xuewei Feng <fengxw06@126.com>
Reported-by: Qi Li <qli01@tsinghua.edu.cn>
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Assisted-by: GLM:GLM-5.1
Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Message-ID: <20260529081026.77732-1-zhaoyz24@mails.tsinghua.edu.cn>
Acked-by: Michael Grzeschik <mgr@kernel.org>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/9p/trans_usbg.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
index 1592b99ae00c7..79735bbe739ac 100644
--- a/net/9p/trans_usbg.c
+++ b/net/9p/trans_usbg.c
@@ -460,6 +460,11 @@ static void usb9pfs_clear_tx(struct f_usb9pfs *usb9pfs)
if (!req || !client)
return;
+ usb9pfs->in_req->context = NULL;
+
+ if (!usb9pfs->client)
+ return;
+
if (!req->t_err)
req->t_err = -ECONNRESET;
@@ -483,6 +488,7 @@ static void p9_usbg_close(struct p9_client *client)
client->status = Disconnected;
usb9pfs_clear_tx(usb9pfs);
+ usb9pfs->client = NULL;
opts = container_of(usb9pfs->function.fi,
struct f_usb9pfs_opts, func_inst);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 066/990] 9p: skip intermediate directory entry name copy in p9dirent_read()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (64 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 065/990] net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 067/990] xfrm: zero-initialise km_event in the replay-notify path Greg Kroah-Hartman
` (786 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haobin Wu, Christian Schoenebeck,
Dominique Martinet, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haobin Wu <853555@gmail.com>
[ Upstream commit 8bb0279930cc90975f03bad4d83282613e5f57fa ]
v9fs_dir_readdir_dotl() decodes each entry of a Rreaddir reply with
p9dirent_read(), which parses it through p9pdu_readf("Qqbs"). The 's'
conversion in p9pdu_vreadf() already allocates a NUL-terminated copy
of the name from the wire buffer; p9dirent_read() then strscpy()s that
copy into the fixed 256-byte p9_dirent::d_name and frees the original.
The wire format carries the name length in 16 bits, so a name longer
than 255 bytes is valid on the wire and may well be valid on the
server's filesystem, but it makes strscpy() return -E2BIG.
v9fs_dir_readdir_dotl() turns that into -EIO and aborts getdents64(),
so every entry after the long one disappears from the listing.
Drop the second copy: keep the string allocated by p9pdu_vreadf() in
p9_dirent and let v9fs_dir_readdir_dotl(), its only user, free it once
dir_emit() has consumed it. p9_dirent is a short-lived stack object, so
the string's lifetime does not change.
Note that the VFS only rejects names of PATH_MAX bytes or more in
verify_dirent_name(), so after this change a name between NAME_MAX and
PATH_MAX is returned by getdents64() even though any later lookup on it
fails with -ENAMETOOLONG. The next patch skips such entries.
Fixes: 7751bdb3a095 ("9p: readdir implementation for 9p2000.L")
Closes: https://github.com/microsoft/WSL/issues/41192
Signed-off-by: Haobin Wu <853555@gmail.com>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Message-ID: <20260918024851.51229-2-853555@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_dir.c | 6 +++++-
include/net/9p/client.h | 2 +-
net/9p/protocol.c | 12 ++----------
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 323f85352f6a4..733ec42258bc6 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -196,8 +196,12 @@ static int v9fs_dir_readdir_dotl(struct file *file, struct dir_context *ctx)
if (!dir_emit(ctx, curdirent.d_name,
strlen(curdirent.d_name),
QID2INO(&curdirent.qid),
- curdirent.d_type))
+ curdirent.d_type)) {
+ kfree(curdirent.d_name);
return 0;
+ }
+
+ kfree(curdirent.d_name);
ctx->pos = curdirent.d_off;
rdir->head += err;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 838a94218b593..9f3079c6f3867 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -268,7 +268,7 @@ struct p9_dirent {
struct p9_qid qid;
u64 d_off;
unsigned char d_type;
- char d_name[256];
+ char *d_name;
};
struct iov_iter;
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 0e6603b1ec906..0a97b4de243ab 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -771,7 +771,7 @@ int p9dirent_read(struct p9_client *clnt, char *buf, int len,
{
struct p9_fcall fake_pdu;
int ret;
- char *nameptr;
+ char *nameptr = NULL;
fake_pdu.size = len;
fake_pdu.capacity = len;
@@ -786,15 +786,7 @@ int p9dirent_read(struct p9_client *clnt, char *buf, int len,
return ret;
}
- ret = strscpy(dirent->d_name, nameptr, sizeof(dirent->d_name));
- if (ret < 0) {
- p9_debug(P9_DEBUG_ERROR,
- "On the wire dirent name too long: %s\n",
- nameptr);
- kfree(nameptr);
- return ret;
- }
- kfree(nameptr);
+ dirent->d_name = nameptr;
return fake_pdu.offset;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 067/990] xfrm: zero-initialise km_event in the replay-notify path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (65 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 066/990] 9p: skip intermediate directory entry name copy in p9dirent_read() Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 068/990] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure Greg Kroah-Hartman
` (785 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giovanni Vignone, Shubham Antil,
Steffen Klassert, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shubham Antil <shubham@octane.security>
[ Upstream commit e35a12dffd5da67b6ca12bd23eebdd0570592205 ]
xfrm_replay_notify(), xfrm_replay_notify_bmp() and
xfrm_replay_notify_esn() declare a struct km_event on the stack and
initialise only its .event and .data.aevent fields, leaving .seq and
.portid uninitialised. build_aevent() then builds the XFRM_MSG_NEWAE
message with those fields:
nlmsg_put(skb, c->portid, c->seq, ...)
so the netlink header of a replay event carries uninitialised stack
values rather than defined ones. This was confirmed at runtime rather
than by inspection alone: the .seq and .portid carried in that header
hold values that nothing in the replay path assigns.
The request-driven paths set these header fields from the requester
(xfrm_get_ae() / xfrm_new_ae()); only the kernel-originated replay path
leaves them unset. Zero-initialise the event so the header fields are 0,
the correct value for a kernel-originated notification.
Fixes: f8cd54884e67 ("[IPSEC]: Sync series - core changes")
Reported-by: Giovanni Vignone <gio@octane.security>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Shubham Antil <shubham@octane.security>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xfrm/xfrm_replay.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index dbdf8a39dffee..9394953247ab9 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -40,7 +40,7 @@ static void xfrm_replay_notify_esn(struct xfrm_state *x, int event);
void xfrm_replay_notify(struct xfrm_state *x, int event)
{
- struct km_event c;
+ struct km_event c = {};
/* we send notify messages in case
* 1. we updated on of the sequence numbers, and the seqno difference
* is at least x->replay_maxdiff, in this case we also update the
@@ -304,7 +304,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
{
- struct km_event c;
+ struct km_event c = {};
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
@@ -356,7 +356,7 @@ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event)
static void xfrm_replay_notify_esn(struct xfrm_state *x, int event)
{
u32 seq_diff, oseq_diff;
- struct km_event c;
+ struct km_event c = {};
struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 068/990] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (66 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 067/990] xfrm: zero-initialise km_event in the replay-notify path Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 069/990] wifi: wext: Limit notifier event flushes to the devices netns Greg Kroah-Hartman
` (784 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+a079f084653164a652d1,
Deepanshu Kartikey, Sven Eckelmann, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <kartikey406@gmail.com>
[ Upstream commit dfa953ba5366b0a80c303700dab2bbcbdc5c27e9 ]
batadv_orig_ifinfo_new() returns NULL only when its GFP_ATOMIC
allocation fails, which is a normal runtime condition and not a bug.
batadv_v_ogm_forward() already handles this the same way, simply
checking for NULL without a WARN_ON.
Do the same in batadv_iv_ogm_update_seqnos() to avoid a spurious
WARN_ON splat when the allocation fails (e.g. under fault injection).
Fixes: 7351a4822d42 ("batman-adv: split out router from orig_node")
Reported-by: syzbot+a079f084653164a652d1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a079f084653164a652d1
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/batman-adv/bat_iv_ogm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 38320f6a1dd1f..26f2795fbc183 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1298,7 +1298,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
return BATADV_NO_DUP;
orig_ifinfo = batadv_orig_ifinfo_new(orig_node, if_outgoing);
- if (WARN_ON(!orig_ifinfo)) {
+ if (!orig_ifinfo) {
batadv_orig_node_put(orig_node);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 069/990] wifi: wext: Limit notifier event flushes to the devices netns
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (67 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 068/990] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 070/990] fsnotify: preserve 64-bit pre-content ranges Greg Kroah-Hartman
` (783 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cosmin Ratiu, Johannes Berg,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <cratiu@nvidia.com>
[ Upstream commit 48c0045366bec142d053f7cf76fb9dd7127cd231 ]
With mlx5 netdev instance locking enabled, registering an IPoIB netdev
calls the WEXT notifier while holding the instance mutex. Its call to
wireless_nlevent_flush() takes net_rwsem to walk every namespace,
completing the following lockdep dependency cycle:
netdev instance mutex -> net_rwsem (read) -> GID table mutex
-> event_handler_rwsem (read) -> netdev instance mutex
RoCE GID enumeration takes the GID table mutex under net_rwsem. GID
updates dispatch events under the table mutex, taking event_handler_rwsem.
The IPoIB event handler takes the netdev instance mutex in
ipoib_queue_work() to traverse child interfaces.
The all-namespace walk originated in the single global worker servicing
per-namespace WEXT queues. The ordering fixes later reused that routine
in netdevice notifiers to prevent delayed WEXT RTM_NEWLINK messages from
following RTM_DELLINK or reporting stale interface flags. A notifier only
needs to drain the affected device's namespace; there is no reason for it
to walk and flush all namespaces.
Pass dev_net(dev) from both notifier callers and make the flush helper
operate on that namespace. Keep the all-namespace walk and net_rwsem in
the existing worker. This removes the instance-mutex -> net_rwsem
dependency while retaining synchronous flushing from the notifiers.
It may seem strange that the fix for a lock cycle across multiple
subsystems lies in a completely unrelated part of the code, but this
seemed the most justified lock cycle edge to break.
Fixes: 8f7b00307bf1 ("net/mlx5e: Convert mlx5 netdevs to instance locking")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Link: https://patch.msgid.link/20261021144111.611840-1-cratiu@nvidia.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/iw_handler.h | 8 +++++---
net/wireless/core.c | 2 +-
net/wireless/wext-core.c | 33 +++++++++++++++++----------------
3 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index b80e474cb0aa9..632618d9ff937 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -201,6 +201,8 @@
#include <linux/wireless.h> /* IOCTL user space API */
#include <linux/if_ether.h>
+struct net;
+
/***************************** VERSION *****************************/
/*
* This constant is used to know which version of the driver API is
@@ -411,10 +413,10 @@ struct iw_spy_data {
void wireless_send_event(struct net_device *dev, unsigned int cmd,
union iwreq_data *wrqu, const char *extra);
#ifdef CONFIG_WEXT_CORE
-/* flush all previous wext events - if work is done from netdev notifiers */
-void wireless_nlevent_flush(void);
+/* Flush previous wext events in this netns from netdev notifiers. */
+void wireless_nlevent_flush(struct net *net);
#else
-static inline void wireless_nlevent_flush(void) {}
+static inline void wireless_nlevent_flush(struct net *net) {}
#endif
/* We may need a function to send a stream of events to user space.
diff --git a/net/wireless/core.c b/net/wireless/core.c
index c7d4498682549..0661c432b4e58 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1762,7 +1762,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
return NOTIFY_DONE;
}
- wireless_nlevent_flush();
+ wireless_nlevent_flush(dev_net(dev));
return NOTIFY_OK;
}
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index 7b8e94214b072..7de96c3ffda8c 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -343,32 +343,28 @@ static const int compat_event_type_size[] = {
/* IW event code */
-void wireless_nlevent_flush(void)
+void wireless_nlevent_flush(struct net *net)
{
struct sk_buff *skb;
- struct net *net;
- down_read(&net_rwsem);
- for_each_net(net) {
- while ((skb = skb_dequeue(&net->wext_nlevents)))
- rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
- GFP_KERNEL);
- }
- up_read(&net_rwsem);
+ while ((skb = skb_dequeue(&net->wext_nlevents)))
+ rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_KERNEL);
}
EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
static int wext_netdev_notifier_call(struct notifier_block *nb,
unsigned long state, void *ptr)
{
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+
/*
- * When a netdev changes state in any way, flush all pending messages
- * to avoid them going out in a strange order, e.g. RTM_NEWLINK after
- * RTM_DELLINK, or with IFF_UP after without IFF_UP during dev_close()
- * or similar - all of which could otherwise happen due to delays from
- * schedule_work().
+ * When a netdev changes state in any way, flush all pending messages in
+ * its network namespace to avoid them going out in a strange order,
+ * e.g. RTM_NEWLINK after RTM_DELLINK, or with IFF_UP after without
+ * IFF_UP during dev_close() or similar - all of which could otherwise
+ * happen due to delays from schedule_work().
*/
- wireless_nlevent_flush();
+ wireless_nlevent_flush(dev_net(dev));
return NOTIFY_OK;
}
@@ -411,7 +407,12 @@ subsys_initcall(wireless_nlevent_init);
/* Process events generated by the wireless layer or the driver. */
static void wireless_nlevent_process(struct work_struct *work)
{
- wireless_nlevent_flush();
+ struct net *net;
+
+ down_read(&net_rwsem);
+ for_each_net(net)
+ wireless_nlevent_flush(net);
+ up_read(&net_rwsem);
}
static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 070/990] fsnotify: preserve 64-bit pre-content ranges
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (68 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 069/990] wifi: wext: Limit notifier event flushes to the devices netns Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 071/990] wifi: ath9k_htc: start ANI when an AP interface begins to beacon Greg Kroah-Hartman
` (782 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Jan Kara, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 1dcf2be94b9be2d366a0d2b70c2b1c7ebccf1443 ]
vfs_fallocate() and remap_verify_area() pass 64-bit lengths to
fsnotify_file_area_perm(), which truncates them to size_t on
32-bit systems.
Use 64 bit (unsigned) types throughout the entire pre-content
notification chain to keep the full range. The userspace range
field is already 64-bits.
Fixes: 9740d17162de ("fsnotify: pass optional file access range in pre-content event")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Link: https://patch.msgid.link/20261015175701.3674449-1-thnkslprpt@gmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/notify/fanotify/fanotify.h | 2 +-
fs/notify/fsnotify.c | 2 +-
include/linux/fsnotify.h | 4 ++--
include/linux/fsnotify_backend.h | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 775f55080dd4d..aa19675452d7b 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -443,7 +443,7 @@ struct fanotify_perm_event {
struct fanotify_event fae;
struct path path;
loff_t pos; /* FANOTIFY_NO_RANGE if unavailable */
- size_t count;
+ u64 count;
u32 response; /* userspace answer to the event */
unsigned short state; /* state of the event */
unsigned short watchdog_cnt; /* already scanned by watchdog? */
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index cae0adce6d47a..f081bfba4dd92 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -210,7 +210,7 @@ static inline __u32 fsnotify_object_watched(struct inode *inode, __u32 mnt_mask,
/* Report pre-content event with optional range info */
int fsnotify_pre_content(const struct path *path, const loff_t *ppos,
- size_t count)
+ u64 count)
{
struct file_range range;
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 28a9cb13fbfa3..c4461411dc55e 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -135,7 +135,7 @@ int fsnotify_open_perm_and_set_mode(struct file *file);
* fsnotify_file_area_perm - permission hook before access to file range
*/
static inline int fsnotify_file_area_perm(struct file *file, int perm_mask,
- const loff_t *ppos, size_t count)
+ const loff_t *ppos, u64 count)
{
/*
* filesystem may be modified in the context of permission events
@@ -213,7 +213,7 @@ static inline int fsnotify_open_perm_and_set_mode(struct file *file)
}
static inline int fsnotify_file_area_perm(struct file *file, int perm_mask,
- const loff_t *ppos, size_t count)
+ const loff_t *ppos, u64 count)
{
return 0;
}
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index d67a893d75fa6..042f0e7f159d1 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -322,7 +322,7 @@ struct fs_error_report {
struct file_range {
const struct path *path;
loff_t pos;
- size_t count;
+ u64 count;
};
static inline const struct path *file_range_path(const struct file_range *range)
@@ -922,12 +922,12 @@ static inline void fsnotify_init_event(struct fsnotify_event *event)
INIT_LIST_HEAD(&event->list);
}
int fsnotify_pre_content(const struct path *path, const loff_t *ppos,
- size_t count);
+ u64 count);
#else
static inline int fsnotify_pre_content(const struct path *path,
- const loff_t *ppos, size_t count)
+ const loff_t *ppos, u64 count)
{
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 071/990] wifi: ath9k_htc: start ANI when an AP interface begins to beacon
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (69 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 070/990] fsnotify: preserve 64-bit pre-content ranges Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 072/990] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts Greg Kroah-Hartman
` (781 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mehmet Fide,
Toke Høiland-Jørgensen, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
[ Upstream commit 5c1b202d67a212c87e7389aaa093ce77828fa98f ]
ath9k_htc_vif_reconfig() re-arms ANI after a channel change when an AP
interface beacons. mac80211 configures the channel before it enables
the beacon, so during a normal AP start that never triggers, and the
start from add_interface that the previous patch removed was cancelled
by the same channel configuration: with hostapd, ANI and the periodic
calibration it drives did not run in AP mode until a later channel
change.
Start ANI when the beacon is enabled. The channel and its calibration
data are in place by then, which is the state vif_reconfig() re-arms
it in, and remove_interface() already stops it with the last AP
interface.
Fixes: a236254c35f0 ("ath9k_htc: Add ANI for AP mode")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20261005072209.4101009-3-mehmet.fide@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 0d6272ac0dac8..611d17202eba2 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1554,6 +1554,9 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
ath9k_htc_set_tsfadjust(priv, vif);
priv->cur_beacon_conf.enable_beacon = 1;
ath9k_htc_beacon_config(priv, vif);
+ if (priv->ah->opmode == NL80211_IFTYPE_AP &&
+ !test_bit(ATH_OP_ANI_RUN, &common->op_flags))
+ ath9k_htc_start_ani(priv);
}
if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->enable_beacon) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 072/990] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (70 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 071/990] wifi: ath9k_htc: start ANI when an AP interface begins to beacon Greg Kroah-Hartman
@ 2026-11-25 14:23 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 073/990] scsi: scsi_debug: Drain target cleanup before module exit Greg Kroah-Hartman
` (780 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:23 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Imre Kaloz,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <kaloz@kernel.org>
[ Upstream commit 9a2690eb4bbea8d7fbc3dfe478fca75fe956abb4 ]
The REQUEST SENSE length was taken from sg->len after the AHC_DMA_LAST_SEG
flag was or-ed in and the value converted to little-endian, so the 8-bit
field is 0x80 on big-endian hosts and the target is asked for 128 bytes
into a 32-byte buffer. Use the buffer size, as aic79xx does. On an SGI O2
with a Fujitsu MAX3147NC, the sense data of its CHECK CONDITIONs during
probe was lost.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
Link: https://patch.msgid.link/20261013094253.2956-1-kaloz@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index d747d0b72a13a..989e8c9bda4ac 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -1097,7 +1097,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
sc->byte2 = SCB_GET_LUN(scb) << 5;
sc->unused[0] = 0;
sc->unused[1] = 0;
- sc->length = sg->len;
+ sc->length = ahc_get_sense_bufsize(ahc, scb);
sc->control = 0;
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 073/990] scsi: scsi_debug: Drain target cleanup before module exit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (71 preceding siblings ...)
2026-11-25 14:23 ` [PATCH 6.18 072/990] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 074/990] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Greg Kroah-Hartman
` (779 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giuseppe Piscitelli,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giuseppe Piscitelli <ooonea@gmail.com>
[ Upstream commit 34c99ce2993971712d89010a948d2f650687b796 ]
Target destruction queues cleanup in an exclusive async domain. The module
loader's async_synchronize_full() does not wait for exclusive domains. Wait
for target cleanup after removing the hosts and before removing the debugfs
root and returning from module exit.
Fixes: b402a0dce64a ("scsi: scsi_debug: Fix create target debugfs failure")
Signed-off-by: Giuseppe Piscitelli <ooonea@gmail.com>
Link: https://patch.msgid.link/20261026202342.668361-1-ooonea@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index ebb651a6d7c06..524e0fa457a83 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -8713,6 +8713,7 @@ static void __exit scsi_debug_exit(void)
sdebug_erase_all_stores(false);
xa_destroy(per_store_ap);
+ async_synchronize_full_domain(&sdebug_async_domain);
debugfs_remove(sdebug_debugfs_root);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 074/990] scsi: aha1542: Remove unneeded scsi_dma_unmap() call
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (72 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 073/990] scsi: scsi_debug: Drain target cleanup before module exit Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 075/990] 9p: Enable symlink caching in page cache Greg Kroah-Hartman
` (778 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Laurence Oberman, Matthew Whitehead,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Whitehead <tedheadster@gmail.com>
[ Upstream commit 9ec6671b137de06f0345962fb8091466b7d56a96 ]
aha1542 never DMA maps the command's scatterlist. Data is bounced
through a per-command buffer allocated with dma_alloc_coherent() in
aha1542_init_cmd_priv(), the adapter is programmed with
acmd->data_buffer_handle, and the payload is copied to and from the
request segments in aha1542_queuecommand() and aha1542_free_cmd().
The scsi_dma_unmap() call left in aha1542_free_cmd() therefore unmaps
a scatterlist that was never mapped. With CONFIG_DMA_API_DEBUG enabled
this results in:
device driver tries to free DMA memory it has not allocated
[device address=0x0000000000000000] [size=0 bytes]
Remove the call.
Verified by testing on real hardware.
Fixes: 2f2fef022c3e ("aha1542: use a local bounce buffer")
Suggested-by: Laurence Oberman <loberman@redhat.com>
Assisted-by: LLM
Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Link: https://patch.msgid.link/20260929144528.7061-1-tedheadster@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/aha1542.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 371e8300f0291..8760556de568d 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -271,8 +271,6 @@ static void aha1542_free_cmd(struct scsi_cmnd *cmd)
buf += bv.bv_len;
}
}
-
- scsi_dma_unmap(cmd);
}
static irqreturn_t aha1542_interrupt(int irq, void *dev_id)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 075/990] 9p: Enable symlink caching in page cache
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (73 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 074/990] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 076/990] 9p: treat read return values of 0 as EOF Greg Kroah-Hartman
` (777 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Remi Pommarel, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <repk@triplefau.lt>
[ Upstream commit 712da38d134b6681946368dd5c9400b43eb772b0 ]
Currently, when cache=loose is enabled, file reads are cached in the
page cache, but symlink reads are not. This patch allows the results
of p9_client_readlink() to be stored in the page cache, eliminating
the need for repeated 9P transactions on subsequent symlink accesses.
This change improves performance for workloads that involve frequent
symlink resolution.
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Message-ID: <982462d17c0c0d2856763266a25eb04d080c1dbb.1779355927.git.repk@triplefau.lt>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: a3a6212c7d67 ("9p: treat read return values of 0 as EOF")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_addr.c | 38 ++++++++++++++++++++++++++---
fs/9p/vfs_inode.c | 6 +++--
fs/9p/vfs_inode_dotl.c | 54 ++++++++++++++++++++++++++++++++++++++----
3 files changed, 88 insertions(+), 10 deletions(-)
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 6bf5973445b66..0a77ce5d11767 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -97,11 +97,34 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq)
{
struct netfs_io_request *rreq = subreq->rreq;
struct p9_fid *fid = rreq->netfs_priv;
+ char *target;
unsigned long long pos = subreq->start + subreq->transferred;
- int total, err;
-
- total = p9_client_read(fid, pos, &subreq->io_iter, &err);
+ int total = 0, err, len, n;
+
+ if (S_ISLNK(rreq->inode->i_mode)) {
+ /* p9_client_readlink() must not be called for legacy protocols
+ * 9p2000 or 9p2000.u.
+ */
+ BUG_ON(!p9_is_proto_dotl(fid->clnt));
+ if (WARN_ON_ONCE(pos)) {
+ /* reading a link at a non null offset should
+ * not happen
+ */
+ err = -EIO;
+ goto fill_subreq;
+ }
+ err = p9_client_readlink(fid, &target);
+ if (err != 0)
+ goto fill_subreq;
+ len = strlen(target);
+ n = copy_to_iter(target, len, &subreq->io_iter);
+ kfree(target);
+ total = n;
+ } else {
+ total = p9_client_read(fid, pos, &subreq->io_iter, &err);
+ }
+fill_subreq:
/* if we just extended the file size, any portion not in
* cache won't be on server and is zeroes */
if (subreq->rreq->origin != NETFS_UNBUFFERED_READ &&
@@ -126,6 +149,7 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq)
static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
{
struct p9_fid *fid;
+ struct dentry *dentry;
bool writing = (rreq->origin == NETFS_READ_FOR_WRITE ||
rreq->origin == NETFS_WRITETHROUGH ||
rreq->origin == NETFS_UNBUFFERED_WRITE ||
@@ -142,6 +166,14 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file)
if (!fid)
goto no_fid;
p9_fid_get(fid);
+ } else if (S_ISLNK(rreq->inode->i_mode)) {
+ dentry = d_find_any_alias(rreq->inode);
+ if (!dentry)
+ goto no_fid;
+ fid = v9fs_fid_lookup(dentry);
+ dput(dentry);
+ if (IS_ERR(fid))
+ goto no_fid;
} else {
fid = v9fs_fid_find_inode(rreq->inode, writing, INVALID_UID, true);
if (!fid)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 34fda75c77607..7af14775dffaf 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -302,10 +302,12 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
goto error;
}
- if (v9fs_proto_dotl(v9ses))
+ if (v9fs_proto_dotl(v9ses)) {
inode->i_op = &v9fs_symlink_inode_operations_dotl;
- else
+ inode_nohighmem(inode);
+ } else {
inode->i_op = &v9fs_symlink_inode_operations;
+ }
break;
case S_IFDIR:
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index cbc72a17b01a8..72aca3106d76f 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -686,9 +686,11 @@ v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir,
int err;
kgid_t gid;
const unsigned char *name;
+ struct v9fs_session_info *v9ses;
struct p9_qid qid;
struct p9_fid *dfid;
struct p9_fid *fid = NULL;
+ struct inode *inode;
name = dentry->d_name.name;
p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname);
@@ -712,6 +714,26 @@ v9fs_vfs_symlink_dotl(struct mnt_idmap *idmap, struct inode *dir,
v9fs_invalidate_inode_attr(dir);
+ /* instantiate inode and assign the unopened fid to the dentry */
+ fid = p9_client_walk(dfid, 1, &name, 1);
+ if (IS_ERR(fid)) {
+ err = PTR_ERR(fid);
+ p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
+ err);
+ goto error;
+ }
+
+ v9ses = v9fs_inode2v9ses(dir);
+ inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+ if (IS_ERR(inode)) {
+ err = PTR_ERR(inode);
+ p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
+ err);
+ goto error;
+ }
+ v9fs_fid_add(dentry, &fid);
+ d_instantiate(dentry, inode);
+ err = 0;
error:
p9_fid_put(fid);
p9_fid_put(dfid);
@@ -853,16 +875,18 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
}
/**
- * v9fs_vfs_get_link_dotl - follow a symlink path
+ * v9fs_vfs_get_link_nocache_dotl - Resolve a symlink directly.
+ *
+ * To be used when symlink caching is not enabled.
+ *
* @dentry: dentry for symlink
* @inode: inode for symlink
* @done: destructor for return value
*/
-
static const char *
-v9fs_vfs_get_link_dotl(struct dentry *dentry,
- struct inode *inode,
- struct delayed_call *done)
+v9fs_vfs_get_link_nocache_dotl(struct dentry *dentry,
+ struct inode *inode,
+ struct delayed_call *done)
{
struct p9_fid *fid;
char *target;
@@ -884,6 +908,26 @@ v9fs_vfs_get_link_dotl(struct dentry *dentry,
return target;
}
+/**
+ * v9fs_vfs_get_link_dotl - follow a symlink path
+ * @dentry: dentry for symlink
+ * @inode: inode for symlink
+ * @done: destructor for return value
+ */
+static const char *
+v9fs_vfs_get_link_dotl(struct dentry *dentry,
+ struct inode *inode,
+ struct delayed_call *done)
+{
+ struct v9fs_session_info *v9ses;
+
+ v9ses = v9fs_inode2v9ses(inode);
+ if (v9ses->cache & (CACHE_META|CACHE_LOOSE))
+ return page_get_link(dentry, inode, done);
+
+ return v9fs_vfs_get_link_nocache_dotl(dentry, inode, done);
+}
+
int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
{
struct p9_stat_dotl *st;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 076/990] 9p: treat read return values of 0 as EOF
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (74 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 075/990] 9p: Enable symlink caching in page cache Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 077/990] 9p: Cache negative dentries for lookup performance Greg Kroah-Hartman
` (776 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Barret Rhoden, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barret Rhoden <brho@google.com>
[ Upstream commit a3a6212c7d67baebebd0e4c2cf2ae1b75eb9231e ]
If your 9p server shares a synthetic file system such as sysfs, the file
size from stat often disagrees with the actual file size.
Treat non-error reads of 0 as EOF, except in the case where the request
was for 0 bytes.
Tested:
git@github.com:hugelgupf/p9.git, served "/" on 10.0.2.2
bash-5.3# mount -t 9p -o trans=tcp,port=12345,cache=none 10.0.2.2 /tmp/foo
bash-5.3# cat /tmp/foo/sys/devices/system/cpu/online
0-47
Fixes: eb497943fa21 ("9p: Convert to using the netfs helper lib to do reads and caching")
Signed-off-by: Barret Rhoden <brho@google.com>
Message-ID: <20260702090941.1298188-1-brho@google.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_addr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 0a77ce5d11767..de2b1f8cdc0e6 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -100,6 +100,7 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq)
char *target;
unsigned long long pos = subreq->start + subreq->transferred;
int total = 0, err, len, n;
+ size_t to_read = iov_iter_count(&subreq->io_iter);
if (S_ISLNK(rreq->inode->i_mode)) {
/* p9_client_readlink() must not be called for legacy protocols
@@ -132,6 +133,8 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq)
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
if (pos + total >= i_size_read(rreq->inode))
__set_bit(NETFS_SREQ_HIT_EOF, &subreq->flags);
+ if (!err && !total && to_read)
+ __set_bit(NETFS_SREQ_HIT_EOF, &subreq->flags);
if (!err && total) {
subreq->transferred += total;
__set_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 077/990] 9p: Cache negative dentries for lookup performance
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (75 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 076/990] 9p: treat read return values of 0 as EOF Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 078/990] 9p: Add mount option for negative dentry cache retention Greg Kroah-Hartman
` (775 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Remi Pommarel, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <repk@triplefau.lt>
[ Upstream commit f00e6c1d282578b077b87b88f42e701bc40f2fff ]
Not caching negative dentries can result in poor performance for
workloads that repeatedly look up non-existent paths. Each such
lookup triggers a full 9P transaction with the server, adding
unnecessary overhead.
A typical example is source compilation, where multiple cc1 processes
are spawned and repeatedly search for the same missing header files
over and over again.
This change enables caching of negative dentries, so that lookups for
known non-existent paths do not require a full 9P transaction. The
cached negative dentries are retained for a configurable duration
(expressed in milliseconds), as specified by the ndentry_timeout
field in struct v9fs_session_info. If set to -1, negative dentries
are cached indefinitely.
This optimization reduces lookup overhead and improves performance for
workloads involving frequent access to non-existent paths.
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Message-ID: <e542317dd03bbadb5249abd3ea6aecfdca692c19.1779355927.git.repk@triplefau.lt>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: d037e9c1b40c ("9p: fix kernel-doc warning for enum p9_session_flags")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/fid.c | 11 +++--
fs/9p/v9fs.c | 1 +
fs/9p/v9fs.h | 5 ++
fs/9p/v9fs_vfs.h | 15 ++++++
fs/9p/vfs_dentry.c | 105 ++++++++++++++++++++++++++++++++++------
fs/9p/vfs_inode.c | 12 +++--
fs/9p/vfs_super.c | 1 +
include/net/9p/client.h | 2 +
8 files changed, 128 insertions(+), 24 deletions(-)
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index f84412290a30c..76242d450aa7c 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -20,7 +20,9 @@
static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid)
{
- hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata);
+ struct v9fs_dentry *v9fs_dentry = to_v9fs_dentry(dentry);
+
+ hlist_add_head(&fid->dlist, &v9fs_dentry->head);
}
@@ -112,6 +114,7 @@ void v9fs_open_fid_add(struct inode *inode, struct p9_fid **pfid)
static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
{
+ struct v9fs_dentry *v9fs_dentry = to_v9fs_dentry(dentry);
struct p9_fid *fid, *ret;
p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p) uid %d any %d\n",
@@ -119,11 +122,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
any);
ret = NULL;
/* we'll recheck under lock if there's anything to look in */
- if (dentry->d_fsdata) {
- struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata;
-
+ if (!hlist_empty(&v9fs_dentry->head)) {
spin_lock(&dentry->d_lock);
- hlist_for_each_entry(fid, h, dlist) {
+ hlist_for_each_entry(fid, &v9fs_dentry->head, dlist) {
if (any || uid_eq(fid->uid, uid)) {
ret = fid;
p9_fid_get(ret);
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 60bbe6f6e9b84..a2a01a2ac1fb1 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -403,6 +403,7 @@ static void v9fs_apply_options(struct v9fs_session_info *v9ses,
v9ses->cache = ctx->session_opts.cache;
v9ses->uid = ctx->session_opts.uid;
v9ses->session_lock_timeout = ctx->session_opts.session_lock_timeout;
+ v9ses->ndentry_timeout_ms = ctx->session_opts.ndentry_timeout_ms;
}
/**
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 6a12445d38582..e630c5111d749 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -91,6 +91,7 @@ enum p9_cache_bits {
* @debug: debug level
* @afid: authentication handle
* @cache: cache mode of type &p9_cache_bits
+ * @ndentry_timeout: Negative dentry lookup cache retention time in ms
* @cachetag: the tag of the cache associated with this session
* @fscache: session cookie associated with FS-Cache
* @uname: string user name to mount hierarchy as
@@ -101,6 +102,7 @@ enum p9_cache_bits {
* @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy
* @clnt: reference to 9P network client instantiated for this session
* @slist: reference to list of registered 9p sessions
+ * @ndentry_timeout_ms: Negative dentry caching retention time
*
* This structure holds state for each session instance established during
* a sys_mount() .
@@ -116,6 +118,7 @@ struct v9fs_session_info {
unsigned short debug;
unsigned int afid;
unsigned int cache;
+ unsigned int ndentry_timeout_ms;
#ifdef CONFIG_9P_FSCACHE
char *cachetag;
struct fscache_volume *fscache;
@@ -133,6 +136,8 @@ struct v9fs_session_info {
long session_lock_timeout; /* retry interval for blocking locks */
};
+#define NDENTRY_TIMEOUT_NEVER (-1U)
+
/* cache_validity flags */
#define V9FS_INO_INVALID_ATTR 0x01
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index d3aefbec4de6e..83c2335f438da 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -28,6 +28,19 @@
/* flags for v9fs_stat2inode() & v9fs_stat2inode_dotl() */
#define V9FS_STAT2INODE_KEEP_ISIZE 1
+/**
+ * struct v9fs_dentry - v9fs specific dentry data
+ * @head: List of fid associated with this dentry
+ * @expire_time: Lookup cache expiration time for negative dentries
+ * @rcu: used by kfree_rcu to schedule clean up job
+ */
+struct v9fs_dentry {
+ struct hlist_head head;
+ u64 expire_time;
+ struct rcu_head rcu;
+};
+#define to_v9fs_dentry(d) ((struct v9fs_dentry *)((d)->d_fsdata))
+
extern struct file_system_type v9fs_fs_type;
extern const struct address_space_operations v9fs_addr_operations;
extern const struct file_operations v9fs_file_operations;
@@ -35,6 +48,8 @@ extern const struct file_operations v9fs_file_operations_dotl;
extern const struct file_operations v9fs_dir_operations;
extern const struct file_operations v9fs_dir_operations_dotl;
extern const struct dentry_operations v9fs_dentry_operations;
+extern void v9fs_ndentry_refresh_timeout(struct dentry *dentry);
+extern void v9fs_dentry_fid_remove(struct dentry *dentry);
extern const struct dentry_operations v9fs_cached_dentry_operations;
extern struct kmem_cache *v9fs_inode_cache;
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index c1acbc98465de..a14821c1206f3 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -23,6 +23,46 @@
#include "v9fs_vfs.h"
#include "fid.h"
+/**
+ * v9fs_ndentry_is_expired - Check if negative dentry lookup has expired
+ *
+ * This should be called to know if a negative dentry should be removed from
+ * cache.
+ *
+ * @dentry: dentry in question
+ *
+ */
+static bool v9fs_ndentry_is_expired(struct dentry const *dentry)
+{
+ struct v9fs_session_info *v9ses = v9fs_dentry2v9ses(dentry);
+ struct v9fs_dentry *v9fs_dentry = to_v9fs_dentry(dentry);
+
+ if (v9ses->ndentry_timeout_ms == NDENTRY_TIMEOUT_NEVER)
+ return false;
+
+ return time_before_eq64(v9fs_dentry->expire_time, get_jiffies_64());
+}
+
+/**
+ * v9fs_ndentry_refresh_timeout - Refresh negative dentry lookup cache timeout
+ *
+ * This should be called when a look up yields a negative entry.
+ *
+ * @dentry: dentry in question
+ *
+ */
+void v9fs_ndentry_refresh_timeout(struct dentry *dentry)
+{
+ struct v9fs_session_info *v9ses = v9fs_dentry2v9ses(dentry);
+ struct v9fs_dentry *v9fs_dentry = to_v9fs_dentry(dentry);
+
+ if (v9ses->ndentry_timeout_ms == NDENTRY_TIMEOUT_NEVER)
+ return;
+
+ v9fs_dentry->expire_time = get_jiffies_64() +
+ msecs_to_jiffies(v9ses->ndentry_timeout_ms);
+}
+
/**
* v9fs_cached_dentry_delete - called when dentry refcount equals 0
* @dentry: dentry in question
@@ -33,20 +73,15 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry)
p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n",
dentry, dentry);
- /* Don't cache negative dentries */
- if (d_really_is_negative(dentry))
- return 1;
- return 0;
-}
+ if (!d_really_is_negative(dentry))
+ return 0;
-/**
- * v9fs_dentry_release - called when dentry is going to be freed
- * @dentry: dentry that is being release
- *
- */
+ return v9fs_ndentry_is_expired(dentry);
+}
-static void v9fs_dentry_release(struct dentry *dentry)
+static void __v9fs_dentry_fid_remove(struct dentry *dentry)
{
+ struct v9fs_dentry *v9fs_dentry = to_v9fs_dentry(dentry);
struct hlist_node *p, *n;
struct hlist_head head;
@@ -54,13 +89,54 @@ static void v9fs_dentry_release(struct dentry *dentry)
dentry, dentry);
spin_lock(&dentry->d_lock);
- hlist_move_list((struct hlist_head *)&dentry->d_fsdata, &head);
+ hlist_move_list(&v9fs_dentry->head, &head);
spin_unlock(&dentry->d_lock);
hlist_for_each_safe(p, n, &head)
p9_fid_put(hlist_entry(p, struct p9_fid, dlist));
}
+/**
+ * v9fs_dentry_fid_remove - Release all dentry's fids
+ * @dentry: dentry in question
+ *
+ */
+void v9fs_dentry_fid_remove(struct dentry *dentry)
+{
+ __v9fs_dentry_fid_remove(dentry);
+}
+
+/**
+ * v9fs_dentry_init - Initialize v9fs dentry data
+ * @dentry: dentry in question
+ *
+ */
+static int v9fs_dentry_init(struct dentry *dentry)
+{
+ struct v9fs_dentry *v9fs_dentry = kzalloc(sizeof(*v9fs_dentry),
+ GFP_KERNEL);
+
+ if (!v9fs_dentry)
+ return -ENOMEM;
+
+ INIT_HLIST_HEAD(&v9fs_dentry->head);
+ dentry->d_fsdata = (void *)v9fs_dentry;
+ return 0;
+}
+
+/**
+ * v9fs_dentry_release - called when dentry is going to be freed
+ * @dentry: dentry that is being released
+ *
+ */
+static void v9fs_dentry_release(struct dentry *dentry)
+{
+ struct v9fs_dentry *v9fs_dentry = to_v9fs_dentry(dentry);
+
+ __v9fs_dentry_fid_remove(dentry);
+ kfree_rcu(v9fs_dentry, rcu);
+}
+
static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
{
struct p9_fid *fid;
@@ -72,7 +148,7 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
inode = d_inode(dentry);
if (!inode)
- goto out_valid;
+ return !v9fs_ndentry_is_expired(dentry);
v9inode = V9FS_I(inode);
if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) {
@@ -113,7 +189,6 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
return retval;
}
}
-out_valid:
p9_debug(P9_DEBUG_VFS, "dentry: %pd (%p) is valid\n", dentry, dentry);
return 1;
}
@@ -140,12 +215,14 @@ const struct dentry_operations v9fs_cached_dentry_operations = {
.d_revalidate = v9fs_lookup_revalidate,
.d_weak_revalidate = __v9fs_lookup_revalidate,
.d_delete = v9fs_cached_dentry_delete,
+ .d_init = v9fs_dentry_init,
.d_release = v9fs_dentry_release,
.d_unalias_trylock = v9fs_dentry_unalias_trylock,
.d_unalias_unlock = v9fs_dentry_unalias_unlock,
};
const struct dentry_operations v9fs_dentry_operations = {
+ .d_init = v9fs_dentry_init,
.d_release = v9fs_dentry_release,
.d_unalias_trylock = v9fs_dentry_unalias_trylock,
.d_unalias_unlock = v9fs_dentry_unalias_unlock,
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 7af14775dffaf..11fbb8686b87d 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -568,7 +568,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
/* invalidate all fids associated with dentry */
/* NOTE: This will not include open fids */
- dentry->d_op->d_release(dentry);
+ v9fs_dentry_fid_remove(dentry);
}
return retval;
}
@@ -744,14 +744,16 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
name = dentry->d_name.name;
fid = p9_client_walk(dfid, 1, &name, 1);
p9_fid_put(dfid);
- if (fid == ERR_PTR(-ENOENT))
+ if (fid == ERR_PTR(-ENOENT)) {
inode = NULL;
- else if (IS_ERR(fid))
+ v9fs_ndentry_refresh_timeout(dentry);
+ } else if (IS_ERR(fid)) {
inode = ERR_CAST(fid);
- else if (v9ses->cache & (CACHE_META|CACHE_LOOSE))
+ } else if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) {
inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
- else
+ } else {
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
+ }
/*
* If we had a rename on the server and a parallel lookup
* for the new name, then make sure we instantiate with
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 315336de6f02a..fde1872662d2f 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -327,6 +327,7 @@ static int v9fs_init_fs_context(struct fs_context *fc)
ctx->session_opts.uid = INVALID_UID;
ctx->session_opts.dfltuid = V9FS_DEFUID;
ctx->session_opts.dfltgid = V9FS_DEFGID;
+ ctx->session_opts.ndentry_timeout_ms = 0;
/* initialize client options */
ctx->client_opts.proto_version = p9_proto_2000L;
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 9f3079c6f3867..0a1de81c8cd8b 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -192,6 +192,7 @@ struct p9_rdma_opts {
* @dfltgid: default numeric groupid to mount hierarchy as
* @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy
* @session_lock_timeout: retry interval for blocking locks
+ * @ndentry_timeout_ms: Negative dentry lookup cache retention time in ms
*
* This strucure holds options which are parsed and will be transferred
* to the v9fs_session_info structure when mounted, and therefore largely
@@ -203,6 +204,7 @@ struct p9_session_opts {
unsigned short debug;
unsigned int afid;
unsigned int cache;
+ unsigned int ndentry_timeout_ms;
#ifdef CONFIG_9P_FSCACHE
char *cachetag;
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 078/990] 9p: Add mount option for negative dentry cache retention
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (76 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 077/990] 9p: Cache negative dentries for lookup performance Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 079/990] 9p: fix kernel-doc warning for enum p9_session_flags Greg Kroah-Hartman
` (774 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Remi Pommarel, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <repk@triplefau.lt>
[ Upstream commit 5670a84b5cda6b82016282accfd61ef36aceafbf ]
Introduce a new mount option, negtimeout, for v9fs that allows users
to specify how long negative dentries are retained in the cache. The
retention time can be set in milliseconds (e.g. negtimeout=10000 for
a 10secs retention time) or a negative value (e.g. negtimeout=-1) to
keep negative entries until the buffer cache management removes them.
For consistency reasons, this option should only be used in exclusive
or read-only mount scenarios, aligning with the cache=loose usage.
Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Message-ID: <b2d66500aa5a2f6540347c4aa46a4be10dd01bc6.1779355927.git.repk@triplefau.lt>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Stable-dep-of: d037e9c1b40c ("9p: fix kernel-doc warning for enum p9_session_flags")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/filesystems/9p.rst | 5 +++++
fs/9p/v9fs.c | 16 +++++++++++++++-
fs/9p/v9fs.h | 23 +++++++++++++----------
3 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/Documentation/filesystems/9p.rst b/Documentation/filesystems/9p.rst
index be3504ca034a8..b014c7aabba4e 100644
--- a/Documentation/filesystems/9p.rst
+++ b/Documentation/filesystems/9p.rst
@@ -238,6 +238,11 @@ Options
cachetag cache tag to use the specified persistent cache.
cache tags for existing cache sessions can be listed at
/sys/fs/9p/caches. (applies only to cache=fscache)
+
+ negtimeout the duration (in milliseconds) that negative dentries (paths
+ that do not actually exist) are retained in the cache. If
+ set to a negative value, those entries are kept indefinitely
+ until evicted by the buffer cache management system
============= ===============================================================
Behavior
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index a2a01a2ac1fb1..4301e01b21c2e 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -40,7 +40,7 @@ enum {
* source if we rejected it as EINVAL */
Opt_source,
/* Options that take integer arguments */
- Opt_debug, Opt_dfltuid, Opt_dfltgid, Opt_afid,
+ Opt_debug, Opt_dfltuid, Opt_dfltgid, Opt_afid, Opt_negtimeout,
/* String options */
Opt_uname, Opt_remotename, Opt_cache, Opt_cachetag,
/* Options that take no arguments */
@@ -103,6 +103,7 @@ const struct fs_parameter_spec v9fs_param_spec[] = {
fsparam_string ("access", Opt_access),
fsparam_flag ("posixacl", Opt_posixacl),
fsparam_u32 ("locktimeout", Opt_locktimeout),
+ fsparam_s32 ("negtimeout", Opt_negtimeout),
/* client options */
fsparam_u32 ("msize", Opt_msize),
@@ -142,6 +143,9 @@ int v9fs_show_options(struct seq_file *m, struct dentry *root)
from_kgid_munged(&init_user_ns, v9ses->dfltgid));
if (v9ses->afid != ~0)
seq_printf(m, ",afid=%u", v9ses->afid);
+ if (v9ses->flags & V9FS_NDENTRY_TIMEOUT_SET)
+ seq_printf(m, ",negtimeout=%d",
+ (int)v9ses->ndentry_timeout_ms);
if (strcmp(v9ses->uname, V9FS_DEFUSER) != 0)
seq_printf(m, ",uname=%s", v9ses->uname);
if (strcmp(v9ses->aname, V9FS_DEFANAME) != 0)
@@ -318,6 +322,16 @@ int v9fs_parse_param(struct fs_context *fc, struct fs_parameter *param)
session_opts->session_lock_timeout = (long)result.uint_32 * HZ;
break;
+ case Opt_negtimeout:
+ session_opts->flags |= V9FS_NDENTRY_TIMEOUT_SET;
+ if (result.int_32 < 0) {
+ session_opts->ndentry_timeout_ms =
+ NDENTRY_TIMEOUT_NEVER;
+ } else {
+ session_opts->ndentry_timeout_ms = result.int_32;
+ }
+ break;
+
/* Options for client */
case Opt_msize:
if (result.uint_32 < 4096) {
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index e630c5111d749..a462bcbfc7da4 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -24,6 +24,8 @@
* @V9FS_ACCESS_ANY: use a single attach for all users
* @V9FS_ACCESS_MASK: bit mask of different ACCESS options
* @V9FS_POSIX_ACL: POSIX ACLs are enforced
+ * @V9FS_NDENTRY_TIMEOUT_SET: Has negative dentry timeout retention time been
+ * overridden by negtimeout mount option
*
* Session flags reflect options selected by users at mount time
*/
@@ -34,16 +36,17 @@
#define V9FS_ACL_MASK V9FS_POSIX_ACL
enum p9_session_flags {
- V9FS_PROTO_2000U = 0x01,
- V9FS_PROTO_2000L = 0x02,
- V9FS_ACCESS_SINGLE = 0x04,
- V9FS_ACCESS_USER = 0x08,
- V9FS_ACCESS_CLIENT = 0x10,
- V9FS_POSIX_ACL = 0x20,
- V9FS_NO_XATTR = 0x40,
- V9FS_IGNORE_QV = 0x80, /* ignore qid.version for cache hints */
- V9FS_DIRECT_IO = 0x100,
- V9FS_SYNC = 0x200
+ V9FS_PROTO_2000U = 0x01,
+ V9FS_PROTO_2000L = 0x02,
+ V9FS_ACCESS_SINGLE = 0x04,
+ V9FS_ACCESS_USER = 0x08,
+ V9FS_ACCESS_CLIENT = 0x10,
+ V9FS_POSIX_ACL = 0x20,
+ V9FS_NO_XATTR = 0x40,
+ V9FS_IGNORE_QV = 0x80, /* ignore qid.version for cache hints */
+ V9FS_DIRECT_IO = 0x100,
+ V9FS_SYNC = 0x200,
+ V9FS_NDENTRY_TIMEOUT_SET = 0x400,
};
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 079/990] 9p: fix kernel-doc warning for enum p9_session_flags
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (77 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 078/990] 9p: Add mount option for negative dentry cache retention Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 080/990] 9p: fall back to the normal open path for non-regular files Greg Kroah-Hartman
` (773 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Omokefe Emmanuel Onanaroghene,
Dominique Martinet, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
[ Upstream commit d037e9c1b40c28eb57ea10947141cad3781b91a7 ]
kernel-doc cannot parse enum p9_session_flags, since its documentation
comment is followed by #define lines instead of the enum declaration:
fs/9p/v9fs.h:31 : error: Cannot parse enum!
Move the three #define lines below the enum whose values they are
derived from, and give V9FS_ACCESS_ANY and V9FS_ACCESS_MASK their own
kernel-doc comments with the descriptions they had in the enum comment.
Also document the four enum members that had no description, using the
corresponding mount option wording from
Documentation/filesystems/9p.rst.
Fixes: 76381a42e4a5 ("fs/9p: Add access = client option to opt in acl evaluation.")
Assisted-by: LLM
Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
Message-ID: <20261002035837.39703-1-emmaonana18@gmail.com>
[Dominique: slight reword, also fixed typo in Doc/ for access=client]
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/filesystems/9p.rst | 2 +-
fs/9p/v9fs.h | 26 ++++++++++++++++++--------
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/Documentation/filesystems/9p.rst b/Documentation/filesystems/9p.rst
index b014c7aabba4e..e80dae4dd62be 100644
--- a/Documentation/filesystems/9p.rst
+++ b/Documentation/filesystems/9p.rst
@@ -231,7 +231,7 @@ Options
any
v9fs does single attach and performs all
operations as one user
- clien
+ client
ACL based access check on the 9p client
side for access validation
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index a462bcbfc7da4..ea3cfdf2580f3 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -21,20 +21,16 @@
* @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy
* @V9FS_ACCESS_USER: a new attach will be issued for every user (default)
* @V9FS_ACCESS_CLIENT: Just like user, but access check is performed on client.
- * @V9FS_ACCESS_ANY: use a single attach for all users
- * @V9FS_ACCESS_MASK: bit mask of different ACCESS options
* @V9FS_POSIX_ACL: POSIX ACLs are enforced
+ * @V9FS_NO_XATTR: do not offer xattr functions on this mount
+ * @V9FS_IGNORE_QV: ignore qid.version==0 as a marker to disable data cache
+ * @V9FS_DIRECT_IO: disable data read/write cache
+ * @V9FS_SYNC: disable data write cache
* @V9FS_NDENTRY_TIMEOUT_SET: Has negative dentry timeout retention time been
* overridden by negtimeout mount option
*
* Session flags reflect options selected by users at mount time
*/
-#define V9FS_ACCESS_ANY (V9FS_ACCESS_SINGLE | \
- V9FS_ACCESS_USER | \
- V9FS_ACCESS_CLIENT)
-#define V9FS_ACCESS_MASK V9FS_ACCESS_ANY
-#define V9FS_ACL_MASK V9FS_POSIX_ACL
-
enum p9_session_flags {
V9FS_PROTO_2000U = 0x01,
V9FS_PROTO_2000L = 0x02,
@@ -49,6 +45,20 @@ enum p9_session_flags {
V9FS_NDENTRY_TIMEOUT_SET = 0x400,
};
+/**
+ * V9FS_ACCESS_ANY - use a single attach for all users
+ */
+#define V9FS_ACCESS_ANY (V9FS_ACCESS_SINGLE | \
+ V9FS_ACCESS_USER | \
+ V9FS_ACCESS_CLIENT)
+
+/**
+ * V9FS_ACCESS_MASK - bit mask of different ACCESS options
+ */
+#define V9FS_ACCESS_MASK V9FS_ACCESS_ANY
+
+#define V9FS_ACL_MASK V9FS_POSIX_ACL
+
/**
* enum p9_cache_shortcuts - human readable cache preferences
* @CACHE_SC_NONE: disable all caches
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 080/990] 9p: fall back to the normal open path for non-regular files
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (78 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 079/990] 9p: fix kernel-doc warning for enum p9_session_flags Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 081/990] 9p: do not store the create fid on special files Greg Kroah-Hartman
` (772 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuanfu Xie, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
[ Upstream commit ff1baa01a6e1f24741f7428119e6f3a61b995604 ]
v9fs_vfs_atomic_open() and v9fs_vfs_atomic_open_dotl() call
finish_open(file, dentry, generic_file_open) regardless of the file
type the server reported for the created dentry. The supplied
callback replaces f_op->open in do_dentry_open(), so blkdev_open()
never runs for a server-reported device node: an open() with O_CREAT
succeeds with f_op = def_blk_fops while f_mapping still points at the
9p inode, because the bdev mapping swap only happens inside
blkdev_open(). The block file methods then derive their block_device
from that inode with I_BDEV(); the loads land at the tail of a
656-byte v9fs_inode_cache object (offsets +624 and +632), which KASAN
reports as slab-out-of-bounds, and the garbage they read is then
dereferenced, so the first read(), write(), ioctl() or close() ends
in a NULL pointer write and a panic. In the ioctl(BLKGETSIZE64)
variant the value read this way is returned to userspace.
The server controls the file type reported for the create, so a
malicious server can crash the client this way. KASAN report of the
read() variant, on a build of linux-stable 2709dd5ae32f:
BUG: KASAN: slab-out-of-bounds in blkdev_read_iter+0x3cd/0x440
Read of size 8 at addr ffff88800828ceb0 by task repro/1
Call Trace:
<TASK>
dump_stack_lvl+0x7b/0xa0
print_report+0xd0/0x630
kasan_report+0xe5/0x120
blkdev_read_iter+0x3cd/0x440
vfs_read+0x718/0xa50
ksys_read+0x10f/0x200
do_syscall_64+0xdd/0x4a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>
The buggy address belongs to the object at ffff88800828cc40
which belongs to the cache v9fs_inode_cache of size 656
The buggy address is located 624 bytes inside of
allocated 656-byte region [ffff88800828cc40, ffff88800828ced0)
A plain open() without O_CREAT is not affected: it runs blkdev_open()
and either maps the device correctly or fails with -ENXIO for an rdev
with no registered device. When the created inode is not a regular
file, clunk the fid the create opened. The unopened fid is already
on the dentry. Set FMODE_CREATED and return finish_no_open(file, NULL)
so the VFS keeps its dentry reference and calls the inode's ->open.
Regular files still use finish_open() with generic_file_open.
Fixes: be12af3ef5e6 ("getting rid of 'opened' argument of ->atomic_open() - part 1")
Signed-off-by: Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
Message-ID: <908FC420-EC1F-46FC-8526-698F646961A8@stu.pku.edu.cn>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_inode.c | 10 ++++++++++
fs/9p/vfs_inode_dotl.c | 12 ++++++++++++
2 files changed, 22 insertions(+)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 11fbb8686b87d..32a2b45743f03 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -811,6 +811,16 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
v9fs_invalidate_inode_attr(dir);
inode = d_inode(dentry);
v9inode = V9FS_I(inode);
+ if (!S_ISREG(inode->i_mode)) {
+ /*
+ * Not a regular file. v9fs_create() already stored the
+ * unopened fid on the dentry. Clunk the opened fid from
+ * the create and let the VFS call ->open.
+ */
+ p9_fid_put(fid);
+ file->f_mode |= FMODE_CREATED;
+ return finish_no_open(file, NULL);
+ }
err = finish_open(file, dentry, generic_file_open);
if (unlikely(err)) {
p9_fid_put(fid);
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 72aca3106d76f..f154b7a45d4f9 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -313,6 +313,18 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
v9fs_fid_add(dentry, &fid);
d_instantiate(dentry, inode);
+ if (!S_ISREG(inode->i_mode)) {
+ /*
+ * Not a regular file. The unopened fid is already on the
+ * dentry. Clunk the opened create fid and let the VFS call
+ * ->open.
+ */
+ p9_fid_put(ofid);
+ ofid = NULL;
+ file->f_mode |= FMODE_CREATED;
+ err = finish_no_open(file, NULL);
+ goto out;
+ }
/* Since we are opening a file, assign the open fid to the file */
err = finish_open(file, dentry, generic_file_open);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 081/990] 9p: do not store the create fid on special files
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (79 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 080/990] 9p: fall back to the normal open path for non-regular files Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 082/990] wifi: ath10k: Stop unanswered temperature reads Greg Kroah-Hartman
` (771 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuanfu Xie, Dominique Martinet,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
[ Upstream commit 56894cadf21c34abbba7f74b8f5d78dabf69dd39 ]
v9fs_vfs_atomic_open_dotl() always stores the create fid in
file->private_data after finish_open(). FIFO and device inodes
already have type-specific file_operations that own that field.
Overwriting it with the fid makes later read/write/close treat the
p9_fid as a pipe_inode_info, which corrupts the fid and can use it
after it has been clunked. The non-dotl atomic_open path does not
assign the fid this way.
Only attach the fid for regular files and directories. Special
files do not need the create fid; leave it for the existing
p9_fid_put() on the out path so it is clunked before return.
KASAN report, linux-stable 4982d3552a3b:
BUG: KASAN: slab-use-after-free in anon_pipe_prefill_and_lock+0x376/0x3f0
Read of size 4 at addr ffff88800ab30538 by task repro/1
Call Trace:
<TASK>
anon_pipe_prefill_and_lock+0x376/0x3f0
anon_pipe_write+0x127/0x1600
fifo_pipe_write+0x24/0x300
vfs_write+0x659/0xd00
ksys_write+0x10f/0x200
do_syscall_64+0xdd/0x4a0
</TASK>
Fixes: 30d904947459 ("kill struct opendata")
Signed-off-by: Yuanfu Xie <yuanfuxie@stu.pku.edu.cn>
Message-ID: <92377346-29E9-46D3-96F5-AABA8A64CD57@stu.pku.edu.cn>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/9p/vfs_inode_dotl.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index f154b7a45d4f9..4240b3588c537 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -329,16 +329,24 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
err = finish_open(file, dentry, generic_file_open);
if (err)
goto out;
- file->private_data = ofid;
+ /*
+ * Special files have type-specific fops that own
+ * file->private_data. The create fid is unused
+ * there: leave it for p9_fid_put() on the out
+ * path so it is clunked before we return.
+ */
+ if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
+ file->private_data = ofid;
#ifdef CONFIG_9P_FSCACHE
- if (v9ses->cache & CACHE_FSCACHE) {
- struct v9fs_inode *v9inode = V9FS_I(inode);
- fscache_use_cookie(v9fs_inode_cookie(v9inode),
- file->f_mode & FMODE_WRITE);
- }
+ if (v9ses->cache & CACHE_FSCACHE) {
+ struct v9fs_inode *v9inode = V9FS_I(inode);
+ fscache_use_cookie(v9fs_inode_cookie(v9inode),
+ file->f_mode & FMODE_WRITE);
+ }
#endif
- v9fs_fid_add_modes(ofid, v9ses->flags, v9ses->cache, flags);
- v9fs_open_fid_add(inode, &ofid);
+ v9fs_fid_add_modes(ofid, v9ses->flags, v9ses->cache, flags);
+ v9fs_open_fid_add(inode, &ofid);
+ }
file->f_mode |= FMODE_CREATED;
out:
p9_fid_put(dfid);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 082/990] wifi: ath10k: Stop unanswered temperature reads
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (80 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 081/990] 9p: do not store the create fid on special files Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 083/990] wifi: ath12k: fix IRQ disable imbalance in AHB ext interrupt handler Greg Kroah-Hartman
` (770 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Filippo Falezza, Loic Poulain,
Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filippo Falezza <effeffe99@gmail.com>
[ Upstream commit 2a87e367c62856b87a90f745c6b7d2eb91e0c51f ]
Reading the ath10k hwmon temperature sends WMI_PDEV_GET_TEMPERATURE and
waits up to 5 s (ATH10K_THERMAL_SYNC_TIMEOUT_HZ) for the reply event,
holding conf_mutex. Not all firmware answers: the WCN3990 firmware
WLAN.HL.3.3.1-00694-QCAHLSWMTPLZ-1 on a Motorola Moto G 5G Plus
codename nairo (SM7250) never sends the event, so every read of
temp1_input stalls for 5 s, logs
ath10k_snoc 18800000.wifi: failed to synchronize thermal read
and returns -ETIMEDOUT. Tools that read all hwmon sensors, such as
lm-sensors, hang for 5 s on every run, and configuration changes of the
interface wait for conf_mutex in the meantime.
Whether the firmware answers cannot be told from the chip: firmware that
answers and firmware that does not both advertise
WMI_SERVICE_THERM_THROT, and WCN3990 firmware differs between devices.
Instead, remember that the running firmware did not answer, and return
-EOPNOTSUPP right away on later reads. Forget it when the firmware
starts, so that a restarted or updated firmware is asked again.
The first read after each firmware start still takes 5 s when the
firmware does not answer. Reads on firmware that answers are unchanged.
Fixes: e98199a8c27f ("ath10k: enable QCA6174/QCA9377 to read the chip temperature")
Signed-off-by: Filippo Falezza <effeffe99@gmail.com>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-ath10k-temperature-v2-1-0793e80d73bc@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.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, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 9ae3595fb6986..f57105ad09759 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2986,6 +2986,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
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)) {
diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c
index 8b15ec07b1071..9b81f9ae58d74 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -75,6 +75,12 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
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) {
@@ -90,7 +96,8 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
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\n");
+ ath10k_warn(ar, "failed to synchronize thermal read, not asking again until the firmware restarts\n");
+ ar->thermal.broken = true;
ret = -ETIMEDOUT;
goto out;
}
diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h
index 1f4de9fbf2b30..d1fb5b958c37c 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -19,6 +19,8 @@ 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
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 083/990] wifi: ath12k: fix IRQ disable imbalance in AHB ext interrupt handler
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (81 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 082/990] wifi: ath10k: Stop unanswered temperature reads Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 084/990] seg6: fix transport header for inner IPv4 with IP options Greg Kroah-Hartman
` (769 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, P Praneesh, Karthikeyan Periyasamy,
Baochen Qiang, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: P Praneesh <praneesh.p@oss.qualcomm.com>
[ Upstream commit 216dd4fc57435726506e250ba2483f31ddc3c01b ]
On AHB platforms such as IPQ5332, IRQ group 3 maps multiple hardware
rings to a single NAPI instance. Each ring is assigned its own IRQ
line, but all IRQs in the group share one napi struct and one poll
function.
When two IRQs from the same group fire simultaneously on different
CPUs, both handlers call ath12k_ahb_ext_grp_disable(), which invokes
disable_irq_nosync() for every IRQ in the group. This increments the
interrupt controller's disable reference count for each IRQ twice. The
single NAPI poll that runs calls ath12k_ahb_ext_grp_enable() once,
decrementing each count from 2 to 1. Because the count never reaches 0,
all IRQs in the group remain permanently masked by the interrupt
controller.
With no further interrupts, TX completions stop being reaped from the
WBM release ring. The pending TX descriptor count grows until the WBM
idle link descriptor pool is exhausted. Once full, TX ring allocation
fails and no new packets including management frames can be enqueued.
This causes stations to disassociate with reason 34 (DISASSOC_LOW_ACK)
and ath12k_mac_flush() to time out:
"failed to flush transmit queue, data pkts req N pending N"
where N equals ATH12K_NUM_POOL_TX_DESC(ab).
Fix this by using napi_schedule_prep() to atomically test-and-set
NAPI_STATE_SCHED before disabling IRQs. Only the first CPU to win the
atomic operation disables the group and calls __napi_schedule(). Any
concurrent handler that loses the race skips the disable entirely,
keeping the reference count balanced. Guard the enable_irq() call in
the poll routine with the return value of napi_complete_done() to
prevent an unbalanced enable if the NAPI instance was re-scheduled
before the poll completed.
Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.7-00587-QCAHKSWPL_SILICONZ-1
Fixes: 6cee30f0da75 ("wifi: ath12k: add AHB driver support for IPQ5332")
Signed-off-by: P Praneesh <praneesh.p@oss.qualcomm.com>
Reviewed-by: Karthikeyan Periyasamy <karthikeyan.periyasamy@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20261015084445.3045925-1-praneesh.p@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/ahb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index af68d5cd6a9d7..1a1195951a140 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -537,8 +537,8 @@ static int ath12k_ahb_ext_grp_napi_poll(struct napi_struct *napi, int budget)
work_done = ath12k_dp_service_srng(ab, irq_grp, budget);
if (work_done < budget) {
- napi_complete_done(napi, work_done);
- ath12k_ahb_ext_grp_enable(irq_grp);
+ if (likely(napi_complete_done(napi, work_done)))
+ ath12k_ahb_ext_grp_enable(irq_grp);
}
if (work_done > budget)
@@ -554,9 +554,10 @@ static irqreturn_t ath12k_ahb_ext_interrupt_handler(int irq, void *arg)
/* last interrupt received for this group */
irq_grp->timestamp = jiffies;
- ath12k_ahb_ext_grp_disable(irq_grp);
-
- napi_schedule(&irq_grp->napi);
+ if (napi_schedule_prep(&irq_grp->napi)) {
+ ath12k_ahb_ext_grp_disable(irq_grp);
+ __napi_schedule(&irq_grp->napi);
+ }
return IRQ_HANDLED;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 084/990] seg6: fix transport header for inner IPv4 with IP options
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (82 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 083/990] wifi: ath12k: fix IRQ disable imbalance in AHB ext interrupt handler Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 085/990] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes Greg Kroah-Hartman
` (768 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hazley Samsudin, David Ahern,
Hangbin Liu, Andrea Mayer, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Mayer <andrea.mayer@uniroma2.it>
[ Upstream commit 5838f10563d58afca6711edb5e4eda968ca181d9 ]
The End.DT4, End.DT46 (its IPv4 path only) and End.DX4 behaviors set the
transport header of the decapsulated IPv4 packet at a fixed 20 bytes, the
size of an IPv4 header without options. They do not validate the header
length either. With options, the transport header points at the first
option byte. The effects include:
- ping -R sends an echo request with a 60-byte IPv4 header to a local
address through an End.DT4 or an End.DX4 SID. Since icmp_rcv()
computes the ICMP checksum from the first option byte, the request
fails the check and is counted in IcmpInCsumErrors.
- A UDP datagram can reach a port that an iptables rule drops. The rule
checks the UDP header after the full IPv4 header, while the socket
lookup reads it at the fixed 20-byte offset.
- With an inbound AH state, ah_input() reads the AH header at the fixed
20-byte offset, but copies the IPv4 header over it with the length in
the IHL field. A packet shorter than that length can make ah_input()
write past the end of the data, into skb_shared_info when the skb has
no tailroom.
Validate the inner IPv4 header length with the new helper
seg6_validate_iphdr_len() and set the transport header at that length. A
packet that is not IPv4, whose header length field is below 5, or whose
header is truncated, is dropped with a drop reason. The fix is limited to
the header length, which the transport header relies on. Other checks done
on IPv4 input, such as the header checksum, the total length and the IP
options, are not addressed here.
Found by code inspection while reviewing commit 44930446dde4 ("ipv6: seg6:
clear IPv4 control block on IPIP decapsulation"), as a pre-existing issue
that Sashiko also reported on v2 of that patch. Without this patch, a
bpftrace probe on ah_input() shows the reporter's reproducer packet
written into skb_shared_info. With it, that packet is dropped before
ah_input(), ping -R no longer fails the ICMP checksum, the UDP datagram
reaches its real port, and the SRv6 selftests still pass. These effects
reproduce on an unmodified kernel, without error injection.
Fixes: 891ef8dd2a8d ("ipv6: sr: implement additional seg6local actions")
Fixes: 664d6f86868b ("seg6: add support for the SRv6 End.DT4 behavior")
Reported-by: Hazley Samsudin <hazleycryilis@gmail.com>
Closes: https://lore.kernel.org/netdev/20260809221915.2ffc1ecd0f445fcb70270e31@uniroma2.it/
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Link: https://patch.msgid.link/20261028171511.35-1-andrea.mayer@uniroma2.it
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/seg6_local.c | 69 +++++++++++++++++++++++++++++++++----------
1 file changed, 53 insertions(+), 16 deletions(-)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 67eeb27ee43a8..df928fed6676e 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -149,9 +149,7 @@ struct seg6_end_dt_info {
int vrf_ifindex;
int vrf_table;
- /* tunneled packet family (IPv4 or IPv6).
- * Protocol and header length are inferred from family.
- */
+ /* tunneled packet family (IPv4 or IPv6) */
u16 family;
};
@@ -972,6 +970,40 @@ static int input_action_end_dx6(struct sk_buff *skb,
return -EINVAL;
}
+/* Validate the length of the IPv4 header at skb->data (which must point to
+ * the network header) and report that length, options included.
+ * Only the version, the header length and the presence of the whole header
+ * are checked.
+ * The length is written only when SKB_NOT_DROPPED_YET is returned.
+ *
+ * skb pointers may change: after this call, the caller must evaluate again
+ * any pointer into the packet data.
+ */
+static enum skb_drop_reason
+seg6_validate_iphdr_len(struct sk_buff *skb, int *hdrlen)
+{
+ enum skb_drop_reason reason;
+ const struct iphdr *iph;
+ int len;
+
+ reason = pskb_may_pull_reason(skb, sizeof(struct iphdr));
+ if (reason)
+ return reason;
+
+ iph = ip_hdr(skb);
+ if (iph->version != 4 || iph->ihl < 5)
+ return SKB_DROP_REASON_IP_INHDR;
+
+ len = ip_hdrlen(skb);
+
+ reason = pskb_may_pull_reason(skb, len);
+ if (reason)
+ return reason;
+
+ *hdrlen = len;
+ return SKB_NOT_DROPPED_YET;
+}
+
static int input_action_end_dx4_finish(struct net *net, struct sock *sk,
struct sk_buff *skb)
{
@@ -1001,14 +1033,18 @@ static int input_action_end_dx4_finish(struct net *net, struct sock *sk,
static int input_action_end_dx4(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
{
+ SKB_DR(reason);
+ int hdrlen;
+
if (!decap_and_validate(skb, IPPROTO_IPIP))
goto drop;
- if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+ reason = seg6_validate_iphdr_len(skb, &hdrlen);
+ if (reason)
goto drop;
skb->protocol = htons(ETH_P_IP);
- skb_set_transport_header(skb, sizeof(struct iphdr));
+ skb_set_transport_header(skb, hdrlen);
nf_reset_ct(skb);
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
@@ -1018,7 +1054,7 @@ static int input_action_end_dx4(struct sk_buff *skb,
return input_action_end_dx4_finish(dev_net(skb->dev), NULL, skb);
drop:
- kfree_skb(skb);
+ kfree_skb_reason(skb, reason);
return -EINVAL;
}
@@ -1153,16 +1189,24 @@ static struct sk_buff *end_dt_vrf_core(struct sk_buff *skb,
struct seg6_end_dt_info *info = &slwt->dt_info;
struct net_device *vrf;
__be16 protocol;
+ SKB_DR(reason);
int hdrlen;
vrf = end_dt_get_vrf_rcu(skb, info);
if (unlikely(!vrf))
goto drop;
+ if (unlikely(info->family != AF_UNSPEC && info->family != family)) {
+ pr_warn_once("seg6local: SRv6 End.DT* family mismatch");
+ goto drop;
+ }
+
switch (family) {
case AF_INET:
protocol = htons(ETH_P_IP);
- hdrlen = sizeof(struct iphdr);
+ reason = seg6_validate_iphdr_len(skb, &hdrlen);
+ if (unlikely(reason))
+ goto drop;
break;
case AF_INET6:
protocol = htons(ETH_P_IPV6);
@@ -1174,11 +1218,6 @@ static struct sk_buff *end_dt_vrf_core(struct sk_buff *skb,
goto drop;
}
- if (unlikely(info->family != AF_UNSPEC && info->family != family)) {
- pr_warn_once("seg6local: SRv6 End.DT* family mismatch");
- goto drop;
- }
-
skb->protocol = protocol;
skb_dst_drop(skb);
@@ -1189,7 +1228,7 @@ static struct sk_buff *end_dt_vrf_core(struct sk_buff *skb,
return end_dt_vrf_rcv(skb, family, vrf);
drop:
- kfree_skb(skb);
+ kfree_skb_reason(skb, reason);
return ERR_PTR(-EINVAL);
}
@@ -1202,9 +1241,7 @@ static int input_action_end_dt4(struct sk_buff *skb,
if (!decap_and_validate(skb, IPPROTO_IPIP))
goto drop;
- if (!pskb_may_pull(skb, sizeof(struct iphdr)))
- goto drop;
-
+ /* end_dt_vrf_core() validates the inner IPv4 header length */
skb = end_dt_vrf_core(skb, slwt, AF_INET);
if (!skb)
/* packet has been processed and consumed by the VRF */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 085/990] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (83 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 084/990] seg6: fix transport header for inner IPv4 with IP options Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 086/990] gpio: omap: Propagate runtime PM failures in probe and request Greg Kroah-Hartman
` (767 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Matt Coster,
Luigi Santivetti, Michal Wilczynski, Alessio Belle, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wilczynski <m.wilczynski@samsung.com>
[ Upstream commit 6c6200ffebf9766fd5d9293002298ea371c261c1 ]
Sparse (W=1) builds fail because `SIZE_CHECK(struct rogue_fwif_hwrtdata,
384)` expects 384 bytes, but the compiler generates a 336-byte
structure.
This is due to an alignment conflict: the inner member `cleanup_state`
requires 64-byte alignment, but the outer struct is explicitly marked
`__aligned(8)`.
While a non-sparse build implicitly pads the size to a multiple of 64, a
sparse build strictly respects the 8-byte outer alignment, resulting in
a size mismatch.
Fix this by aligning the entire structure to 64 bytes, which resolves
the contradiction and forces the correct 384 byte size on all builds.
Fixes: a26f067feac1 ("drm/imagination: Add FWIF headers")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512131851.1WNXk3BC-lkp@intel.com/
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20261029-fix_imagination-v4-1-689745dd52ef@samsung.com
Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
index 5d590c4c25663..2f8daa93c9e68 100644
--- a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
+++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
@@ -2174,7 +2174,7 @@ struct rogue_fwif_hwrtdata {
bool geom_caches_need_zeroing __aligned(4);
struct rogue_fwif_cleanup_ctl cleanup_state __aligned(64);
-} __aligned(8);
+} __aligned(64);
/*
******************************************************************************
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 086/990] gpio: omap: Propagate runtime PM failures in probe and request
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (84 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 085/990] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 087/990] bpf: Fix jited line info off by the CFI preamble Greg Kroah-Hartman
` (766 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 05be1a99d6d68b24cbe24a191e1af67c70193ac3 ]
pm_runtime_get_sync() can fail when the OMAP PM domain cannot
resume a GPIO controller, but omap_gpio_probe() and
omap_gpio_request() ignore its return value.
Consequently, probe can register a GPIO controller despite a failed
resume, while a GPIO request can report success and modify GPIO
state even though runtime-PM acquisition failed.
Use pm_runtime_resume_and_get() in both paths and propagate
resume errors. On probe failure, disable runtime PM and unprepare
the debounce clock when applicable.
Reproduced both failures on QEMU N800 by injecting -EIO from the
OMAP PM-domain resume callback. The original driver continues
probe and accepts the GPIO request - while the patched driver
rejects both operations with -EIO. Normal GPIO controller
registration continues to work without fault injection.
Fixes: 77640aabd755 ("OMAP: GPIO: Implement GPIO as a platform device")
Fixes: 55b93c32520d ("gpio/omap: use pm-runtime framework")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Link: https://patch.msgid.link/20261029103626.1527919-2-thnkslprpt@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-omap.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 8693544304fa8..2ebef18c37abe 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -814,8 +814,11 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset)
{
struct gpio_bank *bank = gpiochip_get_data(chip);
unsigned long flags;
+ int ret;
- pm_runtime_get_sync(chip->parent);
+ ret = pm_runtime_resume_and_get(chip->parent);
+ if (ret < 0)
+ return ret;
raw_spin_lock_irqsave(&bank->lock, flags);
omap_enable_gpio_module(bank, offset);
@@ -1469,7 +1472,13 @@ static int omap_gpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, bank);
pm_runtime_enable(dev);
- pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0) {
+ pm_runtime_disable(dev);
+ if (bank->dbck_flag)
+ clk_unprepare(bank->dbck);
+ return ret;
+ }
if (bank->is_mpuio)
omap_mpuio_init(bank);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 087/990] bpf: Fix jited line info off by the CFI preamble
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (85 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 086/990] gpio: omap: Propagate runtime PM failures in probe and request Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 088/990] btrfs: verity: propagate orphan insertion errors when enabling verity Greg Kroah-Hartman
` (765 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Alexei Starovoitov,
Jose Fernandez (Anthropic), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
[ Upstream commit 3e4279dc5144a5afcda101df23792b13e94c3859 ]
With CONFIG_CFI=y, every jited line info entry after a function's
first is cfi_get_offset() bytes too high on x86-64, riscv64 and arm64,
so tools that use it show the wrong source line.
The JITs count the insn_to_jit_off[] offsets from the start of the
image. Since the CFI commits below, prog->bpf_func starts
cfi_get_offset() bytes into the image, and bpf_prog_fill_jited_linfo()
adds the offsets to prog->bpf_func. s390 corrects its offsets before
the call, the other three JITs do not.
Subtract cfi_get_offset() once in bpf_prog_fill_jited_linfo() and drop
the s390 correction. jited_linfo[0] stays prog->bpf_func, the
function's ksym address. Without CONFIG_CFI, cfi_get_offset() is 0 and
nothing changes.
Fixes: 4f9087f16651 ("x86/cfi,bpf: Fix BPF JIT call")
Fixes: e63985ecd226 ("bpf, riscv64/cfi: Support kCFI + BPF on riscv64")
Fixes: 710618c760c0 ("arm64/cfi,bpf: Support kCFI + BPF on arm64")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261030-b4-arm64-bpf-linfo-cfi-v2-1-4eac83435d4b@linux.dev
Closes: https://lore.kernel.org/all/20260904014748.C04AA1F000E9@smtp.kernel.org/
Closes: https://lore.kernel.org/all/DLNXZ2WK7TPD.2RZBUNRS4FA4L@gmail.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 346588a32a854..bbd0f1ebd2d3c 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -206,7 +206,9 @@ void bpf_prog_jit_attempt_done(struct bpf_prog *prog)
* here is relative to the prog itself instead of the main prog.
* This array has one entry for each xlated bpf insn.
*
- * jited_off is the byte off to the end of the jited insn.
+ * jited_off is the byte off to the end of the jited insn, counted from
+ * the start of the jited image, which is cfi_get_offset() bytes before
+ * prog->bpf_func.
*
* Hence, with
* insn_start:
@@ -220,7 +222,7 @@ void bpf_prog_jit_attempt_done(struct bpf_prog *prog)
*
* For i > linfo_idx,
*
- * jited_linfo[i] = prog->bpf_func +
+ * jited_linfo[i] = prog->bpf_func - cfi_get_offset() +
* insn_to_jit_off[linfo[i].insn_off - insn_start - 1]
*/
void bpf_prog_fill_jited_linfo(struct bpf_prog *prog,
@@ -248,7 +250,7 @@ void bpf_prog_fill_jited_linfo(struct bpf_prog *prog,
/* The verifier ensures that linfo[i].insn_off is
* strictly increasing
*/
- jited_linfo[i] = prog->bpf_func +
+ jited_linfo[i] = prog->bpf_func - cfi_get_offset() +
insn_to_jit_off[linfo[i].insn_off - insn_start - 1];
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 088/990] btrfs: verity: propagate orphan insertion errors when enabling verity
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (86 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 087/990] bpf: Fix jited line info off by the CFI preamble Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 089/990] btrfs: fix fiemap merging compressed extents Greg Kroah-Hartman
` (764 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, guolingxing, Qu Wenruo, David Sterba,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: guolingxing <guolingxing@tju.edu.cn>
[ Upstream commit 45a686dff6b91c3667cd8188d3a02c69f62f4d00 ]
btrfs_begin_enable_verity() ignores the return value of
btrfs_orphan_add() and unconditionally returns 0. If orphan insertion
fails, btrfs_orphan_add() aborts the transaction, but the generic
fs-verity code still proceeds with Merkle tree construction because
the begin_enable_verity callback reported success.
Return the error so that fs-verity stops immediately instead of
continuing after the initialization failure.
The transaction is already aborted by btrfs_orphan_add() and the
handle is released by btrfs_end_transaction(), so no additional
cleanup is needed.
Fixes: 705242538ff3 ("btrfs: verity metadata orphan items")
Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/verity.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
index bb2d2fc47ee91..0a8df39e82e49 100644
--- a/fs/btrfs/verity.c
+++ b/fs/btrfs/verity.c
@@ -609,7 +609,7 @@ static int btrfs_begin_enable_verity(struct file *filp)
set_bit(BTRFS_INODE_VERITY_IN_PROGRESS, &inode->runtime_flags);
btrfs_end_transaction(trans);
- return 0;
+ return ret;
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 089/990] btrfs: fix fiemap merging compressed extents
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (87 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 088/990] btrfs: verity: propagate orphan insertion errors when enabling verity Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 090/990] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing Greg Kroah-Hartman
` (763 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 980fbbd041ac2538fdbe7cfda4253dfc28fdcad1 ]
Compressed extents are never supposed to be merged by the fiemap code and
reported as a single extent, as each extent's content comes from a
different compression stream and has its own header and context.
We currently rely on checking the logical and physical address adjacency
to prevent merging compressed extents but that is broken. Consider the
following reproducer which explains why the merging happens:
$ cat test.sh
#!/bin/bash
DEV=/dev/sdi
MNT=/mnt/sdi
mkfs.btrfs -s 4K -f $DEV
mount -o compress $DEV $MNT
# Do a write that compresses to a single 4K extent and represents the
# maximum compressed chunk size (128K).
xfs_io -f -c "pwrite 0 128K" $MNT/foo
# Sync to flush delalloc and allocate the 4K extent.
sync -f $MNT
# Now allocate a 124K extent in some other file, which will be adjacent
# (to the right) of the 4K extent previously allocated.
xfs_io -f -c "falloc 0 124K" $MNT/filler
# Do another write to the main file at its current EOF that is
# compressible and fits in a 4K extent.
xfs_io -c "pwrite 128K 128K" $MNT/foo
# Sync to flush delalloc and allocate the 4K extent.
sync -f $MNT
# Run fiemap which should report 2 encoded extents, each with a
# logical size of 128K.
xfs_io -c "fiemap -v" $MNT/foo
umount $MNT
Running this, fiemap will report a single extent:
$ ./test.sh
(...)
/mnt/sdi/foo:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..511]: 26624..27135 512 0x9
Fix this by never attempting to merge extents if the flags contain
FIEMAP_EXTENT_ENCODED.
Fixes: 4751832da990 ("btrfs: fiemap: Cache and merge fiemap extent before submit it to user")
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/fiemap.c b/fs/btrfs/fiemap.c
index 30a0f66c9c9ef..5fb7342a616d1 100644
--- a/fs/btrfs/fiemap.c
+++ b/fs/btrfs/fiemap.c
@@ -228,7 +228,8 @@ static int emit_fiemap_extent(struct fiemap_extent_info *fieinfo,
*
* 3) Share same flags
*/
- if (cache->offset + cache->len == offset &&
+ if (!(flags & FIEMAP_EXTENT_ENCODED) &&
+ cache->offset + cache->len == offset &&
cache->phys + cache->len == phys &&
cache->flags == flags) {
cache->len += len;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 090/990] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (88 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 089/990] btrfs: fix fiemap merging compressed extents Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 091/990] btrfs: zoned: fix double free of bitmaps on clone failure Greg Kroah-Hartman
` (762 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 bda65e5115fe66ee0d8cf4ade11807f9fca4f0e1 ]
When scrub finishes, it does a wakeup on the fs_info->scrub_pause_wait
wait queue and then sets dev->scrub_sctx to NULL. On the other hand the
scrub cancel code (btrfs_scrub_cancel_dev()) waits on that wait queue
for dev->scrub_sctx to be NULL. So this means if btrfs_scrub_cancel_dev()
is called right when scrub is finishing and sees the wakeup before the
NULL is assigned to dev->scrub_sctx by btrfs_scrub_dev(), it hangs.
Fix this by doing the wakeup in btrfs_scrub_dev() after setting
dev->scrub_sctx to NULL.
Fixes: a2de733c78fa ("btrfs: scrub")
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/scrub.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index fdf37653907c7..a924eeb7a6618 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -3174,7 +3174,6 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
memalloc_nofs_restore(nofs_flag);
atomic_dec(&fs_info->scrubs_running);
- wake_up(&fs_info->scrub_pause_wait);
if (progress)
memcpy(progress, &sctx->stat, sizeof(*progress));
@@ -3187,6 +3186,13 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
dev->scrub_ctx = NULL;
mutex_unlock(&fs_info->scrub_lock);
+ /*
+ * We have set dev->scrub_ctx to NULL, now do the wakeup as a concurrent
+ * scrub cancel (btrfs_scrub_cancel_dev()) waits for dev->scrub_ctx to
+ * be set to NULL.
+ */
+ wake_up(&fs_info->scrub_pause_wait);
+
scrub_workers_put(fs_info);
scrub_put_ctx(sctx);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 091/990] btrfs: zoned: fix double free of bitmaps on clone failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (89 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 090/990] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 092/990] bpf: Drop percpu_counter from the htab element count Greg Kroah-Hartman
` (761 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Johannes Thumshirn, Thomas Fourier,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <fourier.thomas@gmail.com>
[ Upstream commit 8c66a6aa59a5df1d672d72b7cd379d897ff73200 ]
btrfs_clone_dev_zone_info() duplicates the original orig_dev->zone_info
with kmemdup(), which also copies the seq_zones, empty_zones and
active_zones pointers. The clone then replaces them one by one with
fresh bitmaps. If one of the allocations fails, the error path frees all
three pointers, including those not yet replaced, which still point to
the bitmaps owned by the original device.
Clear the three pointers right after kmemdup() so the error path only frees
what this function allocated.
Fixes: 21e61ec6d0bb ("btrfs: zoned: clone zoned device info when cloning a device")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 88559307bac7d..69ede4e4d0c20 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -642,6 +642,11 @@ struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *o
if (!zone_info)
return NULL;
+ /* Don't let the error path free the bitmaps still owned by @orig_dev. */
+ zone_info->seq_zones = NULL;
+ zone_info->empty_zones = NULL;
+ zone_info->active_zones = NULL;
+
zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
if (!zone_info->seq_zones)
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 092/990] bpf: Drop percpu_counter from the htab element count
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (90 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 091/990] btrfs: zoned: fix double free of bitmaps on clone failure Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 093/990] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Greg Kroah-Hartman
` (760 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Puranjay Mohan,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <puranjay@kernel.org>
[ Upstream commit 1cd28b5354ab77c727ed87255bf289a87178b415 ]
The element count of a large non-preallocated hash map is a
percpu_counter, whose slow path takes fbc->lock with
raw_spin_lock_irqsave(). That is not safe against BPF programs that run
while the lock is held or contended: NMI programs and, as
queued_spin_lock_slowpath() calls trace_contention_end() with the lock
already held, programs attached to the contention_end tracepoint. If such
a program updates the same map it spins on the lock its own CPU holds:
WARNING: possible recursive locking detected
cend/250 is trying to acquire lock:
(key#5){....}-{2:2}, at: _raw_spin_lock_irqsave+0x18/0x30
but task is already holding lock:
(key#5){....}-{2:2}, at: _raw_spin_lock_irqsave+0x18/0x30
percpu_counter_add_batch+0xd8/0x160
alloc_htab_elem+0x408/0x480
htab_map_update_elem+0x1e8/0x6a0
bpf_prog_7a29a1ae68aedf07_cend+0x14c/0x1f8
__bpf_trace_contention_end+0x14/0x20
queued_spin_lock_slowpath+0x2e8/0x468
percpu_counter_add_batch+0xd8/0x160
alloc_htab_elem+0x408/0x480
htab_map_update_elem+0x1e8/0x6a0
is_map_full() is affected too, as __percpu_counter_compare() falls back
to percpu_counter_sum(), which takes the same lock.
map.elem_count already is a lockless per-cpu count of the same elements.
Make htab->count follow it in steps of PERCPU_COUNTER_BATCH and let
is_map_full() sum elem_count once count is within nr_cpu_ids * batch of
max_entries. Each cpu's elem_count is ahead of count by less than the
batch, so that is exact, in NMI as well.
Fixes: 86fe28f7692d ("bpf: Optimize element count in non-preallocated hash map.")
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261021185117.650403-1-puranjay@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 2 ++
kernel/bpf/hashtab.c | 64 ++++++++++++++++++--------------------------
2 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index d840ec32d95ba..fc5af5a7f6a21 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2546,6 +2546,8 @@ static inline void bpf_map_dec_elem_count(struct bpf_map *map)
this_cpu_dec(*map->elem_count);
}
+s64 bpf_map_sum_elem_count(const struct bpf_map *map);
+
extern int sysctl_unprivileged_bpf_disabled;
bool bpf_token_capable(const struct bpf_token *token, int cap);
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index 23c9e54f92e17..ffc534384f84d 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -96,10 +96,10 @@ struct bpf_htab {
struct bpf_lru lru;
};
struct htab_elem *__percpu *extra_elems;
- /* number of elements in non-preallocated hashtable are kept
- * in either pcount or count
+ /* number of elements in non-preallocated hashtable. With
+ * use_percpu_counter it only follows map.elem_count in steps of
+ * PERCPU_COUNTER_BATCH, see is_map_full()
*/
- struct percpu_counter pcount;
atomic_t count;
bool use_percpu_counter;
u32 n_buckets; /* number of hash buckets */
@@ -628,29 +628,20 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr)
htab_init_buckets(htab);
-/* compute_batch_value() computes batch value as num_online_cpus() * 2
- * and __percpu_counter_compare() needs
- * htab->max_entries - cur_number_of_elems to be more than batch * num_online_cpus()
- * for percpu_counter to be faster than atomic_t. In practice the average bpf
- * hash map size is 10k, which means that a system with 64 cpus will fill
- * hashmap to 20% of 10k before percpu_counter becomes ineffective. Therefore
- * define our own batch count as 32 then 10k hash map can be filled up to 80%:
+/* is_map_full() needs htab->max_entries - cur_number_of_elems to be more than
+ * batch * nr_cpu_ids for the percpu counter to be faster than atomic_t. In
+ * practice the average bpf hash map size is 10k. With batch count of 32 a 10k
+ * hash map on a system with 64 cpus can be filled up to 80%:
* 10k - 8k > 32 _batch_ * 64 _cpus_
- * and __percpu_counter_compare() will still be fast. At that point hash map
+ * and is_map_full() will still be fast. At that point hash map
* collisions will dominate its performance anyway. Assume that hash map filled
* to 50+% isn't going to be O(1) and use the following formula to choose
- * between percpu_counter and atomic_t.
+ * between the percpu counter and atomic_t. The batch has to be a power of 2.
*/
#define PERCPU_COUNTER_BATCH 32
- if (attr->max_entries / 2 > num_online_cpus() * PERCPU_COUNTER_BATCH)
+ if (attr->max_entries / 2 > nr_cpu_ids * PERCPU_COUNTER_BATCH)
htab->use_percpu_counter = true;
- if (htab->use_percpu_counter) {
- err = percpu_counter_init(&htab->pcount, 0, GFP_KERNEL);
- if (err)
- goto free_map_locked;
- }
-
if (prealloc) {
err = prealloc_init(htab);
if (err)
@@ -678,8 +669,6 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr)
free_prealloc:
prealloc_destroy(htab);
free_map_locked:
- if (htab->use_percpu_counter)
- percpu_counter_destroy(&htab->pcount);
bpf_map_area_free(htab->buckets);
bpf_mem_alloc_destroy(&htab->pcpu_ma);
bpf_mem_alloc_destroy(&htab->ma);
@@ -988,30 +977,33 @@ static void htab_put_fd_value(struct bpf_htab *htab, struct htab_elem *l)
static bool is_map_full(struct bpf_htab *htab)
{
- if (htab->use_percpu_counter)
- return __percpu_counter_compare(&htab->pcount, htab->map.max_entries,
- PERCPU_COUNTER_BATCH) >= 0;
- return atomic_read(&htab->count) >= htab->map.max_entries;
+ s64 count = atomic_read(&htab->count);
+
+ /* each cpu's elem_count is ahead of count by less than the batch */
+ if (htab->use_percpu_counter &&
+ count + nr_cpu_ids * PERCPU_COUNTER_BATCH >= htab->map.max_entries)
+ count = bpf_map_sum_elem_count(&htab->map);
+ return count >= htab->map.max_entries;
}
static void inc_elem_count(struct bpf_htab *htab)
{
- bpf_map_inc_elem_count(&htab->map);
+ s64 cnt = this_cpu_inc_return(*htab->map.elem_count);
- if (htab->use_percpu_counter)
- percpu_counter_add_batch(&htab->pcount, 1, PERCPU_COUNTER_BATCH);
- else
+ if (!htab->use_percpu_counter)
atomic_inc(&htab->count);
+ else if (!(cnt & (PERCPU_COUNTER_BATCH - 1)))
+ atomic_add(PERCPU_COUNTER_BATCH, &htab->count);
}
static void dec_elem_count(struct bpf_htab *htab)
{
- bpf_map_dec_elem_count(&htab->map);
+ s64 cnt = this_cpu_dec_return(*htab->map.elem_count);
- if (htab->use_percpu_counter)
- percpu_counter_add_batch(&htab->pcount, -1, PERCPU_COUNTER_BATCH);
- else
+ if (!htab->use_percpu_counter)
atomic_dec(&htab->count);
+ else if (!((cnt + 1) & (PERCPU_COUNTER_BATCH - 1)))
+ atomic_sub(PERCPU_COUNTER_BATCH, &htab->count);
}
@@ -1641,8 +1633,6 @@ static void htab_map_free(struct bpf_map *map)
bpf_map_area_free(htab->buckets);
bpf_mem_alloc_destroy(&htab->pcpu_ma);
bpf_mem_alloc_destroy(&htab->ma);
- if (htab->use_percpu_counter)
- percpu_counter_destroy(&htab->pcount);
bpf_map_area_free(htab);
}
@@ -2342,9 +2332,7 @@ static u64 htab_map_mem_usage(const struct bpf_map *map)
} else {
#define LLIST_NODE_SZ sizeof(struct llist_node)
- num_entries = htab->use_percpu_counter ?
- percpu_counter_sum(&htab->pcount) :
- atomic_read(&htab->count);
+ num_entries = bpf_map_sum_elem_count(map);
usage += (htab->elem_size + LLIST_NODE_SZ) * num_entries;
if (percpu) {
usage += (LLIST_NODE_SZ + sizeof(void *)) * num_entries;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 093/990] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (91 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 092/990] bpf: Drop percpu_counter from the htab element count Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 094/990] net: ethernet: mtk_wed: fix reset condition for rx wdma Greg Kroah-Hartman
` (759 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Zhi-Jun You, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <hujy652@gmail.com>
[ Upstream commit cb50f16f37fc3429085c454ee5978e05732d10ba ]
Currently WED v3 tx wdma ring, ring reset happens in a separate code
block unconditionally.
Moreover, v3 has double the size of wdma_desc and has different init
values. mtk_wed_ring_reset doens't deal with that and would corrupt the
wdma_desc.
Fix this by skipping mtk_wed_ring_reset in mtk_wdma_tx_ring_setup for
WED v3.
Fixes: e2f64db13aa1 ("net: ethernet: mtk_wed: introduce WED support for MT7988")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260711112128.971-1-hujy652@gmail.com?part=1
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
Link: https://patch.msgid.link/20261026-wedfix-v6-1-a52f6b15d2fc@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index fdb487e5d46e1..04a8da8cb3c51 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -1938,7 +1938,7 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev, int idx, int size,
wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_CPU_IDX, 0);
wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_DMA_IDX, 0);
- if (reset)
+ if (!mtk_wed_is_v3_or_greater(dev->hw) && reset)
mtk_wed_ring_reset(wdma, MTK_WED_WDMA_RING_SIZE, true);
if (!idx) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 094/990] net: ethernet: mtk_wed: fix reset condition for rx wdma
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (92 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 093/990] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 095/990] net: ethernet: mtk_wed: free up rings during detach Greg Kroah-Hartman
` (758 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Zhi-Jun You, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <hujy652@gmail.com>
[ Upstream commit 7180a42d8e616f919dcff4b90a13b9a5ecea665b ]
In mtk_wdma_rx_reset, currently only resets the CPU index of the rings
that doesn't have a descriptor. This is wrong because no descriptor
means the ring is not configured.
Also mtk_wed_start makes sure that all rx_wdma rings are set up this
would lead to no ring getting their CPU index reset.
Fix this by inverting the reset condition so allocated rings will be
reset.
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260724172040.1653-1-hujy652%40gmail.com
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
Link: https://patch.msgid.link/20261026-wedfix-v6-2-a52f6b15d2fc@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 04a8da8cb3c51..202ab2f34d56a 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -257,7 +257,7 @@ mtk_wdma_rx_reset(struct mtk_wed_device *dev)
wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++) {
- if (dev->rx_wdma[i].desc)
+ if (!dev->rx_wdma[i].desc)
continue;
wdma_w32(dev,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 095/990] net: ethernet: mtk_wed: free up rings during detach
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (93 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 094/990] net: ethernet: mtk_wed: fix reset condition for rx wdma Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 096/990] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Greg Kroah-Hartman
` (757 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Zhi-Jun You, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <hujy652@gmail.com>
[ Upstream commit 5b8d12512cbd3495dbd8c38e8047bb5d716f0f3f ]
During __mtk_wed_detach, rx_ring and tx_wdma aren't freed up.
Fix this by add them to mtk_wed_free_rx_rings.
This patch is pulled from mtk-openwrt-feeds to address Sashiko's review
and edit to rely on ring->desc instead of an extra flag.
Link: https://github.com/mediatek/mtk-openwrt-feeds/blob/main/25.12/files/target/linux/mediatek/patches-6.12/999-wed-04-Fix-reinsert-wifi-module-cause-memory-leak-issue.patch
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/message/179000700034.2160803.10594281691384015089%40kernel.org
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
Link: https://patch.msgid.link/20261026-wedfix-v6-3-a52f6b15d2fc@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 202ab2f34d56a..e81a62c6029c2 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -949,6 +949,14 @@ mtk_wed_free_ring(struct mtk_wed_device *dev, struct mtk_wed_ring *ring)
static void
mtk_wed_free_rx_rings(struct mtk_wed_device *dev)
{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(dev->rx_ring); i++)
+ mtk_wed_free_ring(dev, &dev->rx_ring[i]);
+
+ for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
+ mtk_wed_free_ring(dev, &dev->tx_wdma[i]);
+
mtk_wed_free_rx_buffer(dev);
mtk_wed_free_ring(dev, &dev->rro.ring);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 096/990] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (94 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 095/990] net: ethernet: mtk_wed: free up rings during detach Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 097/990] ptp: drain virtual clock sysfs operations before unregistering children Greg Kroah-Hartman
` (756 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhi-Jun You, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhi-Jun You <hujy652@gmail.com>
[ Upstream commit dd6efae5529107cc8db277eaeaff5c5f15e6bc15 ]
WDMA_RING_TX(0) is required to set MTK_WED_WDMA_RING_TX for WED RX
but on a non-DBDC MT7986 it is never setup because idx is 1.
Setting MTK_WED_WDMA_RING_TX with WDMA_RING_TX(1) is not feasible because
WED still tries to send through WDMA_RING_TX(0). This is verified with
register dump.
Fix this by calling mtk_wed_wdma_tx_ring_setup if wed is v2 and
rx_ring[0] is not allocated and reset tx_wdma[0] if it's already
allocated also add error messages and bail when mtk_wed_start fails.
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
Link: https://patch.msgid.link/20261026-wedfix-v6-4-a52f6b15d2fc@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index e81a62c6029c2..03829017dc49e 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -2345,7 +2345,20 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++)
if (!dev->rx_wdma[i].desc)
- mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
+ if (mtk_wed_wdma_rx_ring_setup(dev, i, 16, false)) {
+ dev_err(dev->hw->dev, "wdma rx ring %d setup failed\n", i);
+ return;
+ }
+
+ /*
+ * non-DBDC MT7986 allocates only rx_ring[1] and tx_wdma[1] during setup
+ * but tx_wdma[0] is also needed for WED to function.
+ */
+ if (mtk_wed_is_v2(dev->hw) && !dev->rx_ring[0].desc)
+ if (mtk_wed_wdma_tx_ring_setup(dev, 0, MTK_WED_WDMA_RING_SIZE, !!dev->tx_wdma[0].desc)) {
+ dev_err(dev->hw->dev, "wdma tx ring 0 setup failed\n");
+ return;
+ }
if (dev->wlan.hw_rro) {
for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 097/990] ptp: drain virtual clock sysfs operations before unregistering children
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (95 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 096/990] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 098/990] ptp: unwind partially completed virtual clock creation Greg Kroah-Hartman
` (755 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vadim Fedorenko, James Hilliard,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit 0e4a135aebc7686286d87e286499ce55e5bd5aad ]
Parent clock removal walks its virtual clocks before removing the
n_vclocks sysfs attribute. The mutex taken by ptp_vclock_in_use() is
released before that walk, so a concurrent sysfs deletion can pick the
same child and unregister and free its ptp_vclock a second time. A
reference held by the device iterator does not protect that separately
allocated virtual clock.
Remove n_vclocks before walking the children. Removing the attribute
prevents new stores and drains stores already running, without holding
n_vclocks_mux across a callback that needs that mutex. Skip virtual
clocks, which do not have this attribute.
This race was found by code inspection of virtual-clock registration
failure cleanup and parent removal.
Fixes: bfcbb76b0f59 ("ptp: unregister virtual clocks when unregistering physical clock.")
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-1-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_clock.c | 5 +++++
drivers/ptp/ptp_private.h | 1 +
drivers/ptp/ptp_sysfs.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index ef020599b7711..8b27c749aebea 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -494,6 +494,11 @@ static int unregister_vclock(struct device *dev, void *data)
int ptp_clock_unregister(struct ptp_clock *ptp)
{
+ /*
+ * Stop and drain virtual-clock creation and deletion before walking the
+ * children. Do not hold n_vclocks_mux while waiting for sysfs callbacks.
+ */
+ ptp_vclock_remove_sysfs(ptp);
if (ptp_vclock_in_use(ptp)) {
device_for_each_child(&ptp->dev, NULL, unregister_vclock);
}
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index db4039d642b41..ec8633126d6b8 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -169,6 +169,7 @@ extern const struct attribute_group *ptp_groups[];
int ptp_populate_pin_groups(struct ptp_clock *ptp);
void ptp_cleanup_pin_groups(struct ptp_clock *ptp);
+void ptp_vclock_remove_sysfs(struct ptp_clock *ptp);
struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock);
void ptp_vclock_unregister(struct ptp_vclock *vclock);
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 0d4b081daf639..998de4be08ebd 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -267,6 +267,12 @@ static ssize_t n_vclocks_store(struct device *dev,
}
static DEVICE_ATTR_RW(n_vclocks);
+void ptp_vclock_remove_sysfs(struct ptp_clock *ptp)
+{
+ if (!ptp->is_virtual_clock)
+ device_remove_file(&ptp->dev, &dev_attr_n_vclocks);
+}
+
static ssize_t max_vclocks_show(struct device *dev,
struct device_attribute *attr, char *page)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 098/990] ptp: unwind partially completed virtual clock creation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (96 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 097/990] ptp: drain virtual clock sysfs operations before unregistering children Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 099/990] ptp: vclock: propagate physical clock sampling errors Greg Kroah-Hartman
` (754 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit 3dea778260e3dddf30651a6913d87a42861346a2 ]
n_vclocks_store() publishes the new clock count only after every child
has been registered. If a later registration fails, it returns without
unregistering the children already created by that request. Those clocks
are left out of n_vclocks, and a subsequent request can overwrite their
index entries without removing them.
Unregister the newly created children in reverse order and clear their
index entries on failure. Leave the previously installed clocks and
their count unchanged. The n_vclocks mutex serializes this rollback with
other sysfs changes, and parent removal drains the store before walking
the children.
This was found by code inspection while adding initial PHC sample error
handling to virtual clock registration.
Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-2-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_sysfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 998de4be08ebd..b07274b67294a 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -229,7 +229,7 @@ static ssize_t n_vclocks_store(struct device *dev,
for (i = 0; i < num - ptp->n_vclocks; i++) {
vclock = ptp_vclock_register(ptp);
if (!vclock)
- goto out;
+ goto err_register;
*(ptp->vclock_index + ptp->n_vclocks + i) =
vclock->clock->index;
@@ -261,6 +261,12 @@ static ssize_t n_vclocks_store(struct device *dev,
mutex_unlock(&ptp->n_vclocks_mux);
return count;
+err_register:
+ num = i;
+ if (num)
+ device_for_each_child_reverse(dev, &num, unregister_vclock);
+ for (num = 0; num < i; num++)
+ ptp->vclock_index[ptp->n_vclocks + num] = -1;
out:
mutex_unlock(&ptp->n_vclocks_mux);
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 099/990] ptp: vclock: propagate physical clock sampling errors
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (97 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 098/990] ptp: unwind partially completed virtual clock creation Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 100/990] ptp: vclock: serialize extended samples with counter updates Greg Kroah-Hartman
` (753 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit d1bdfdafd663dd00b01d43eb3391f87718f2a09d ]
The cyclecounter read callback cannot report errors. ptp_vclock_read()
ignores the return from the physical clock and consumes its output even
if the read failed. A zero sample followed by the real counter can add
an extra 32-bit wrap to virtual time. This was found by code inspection
of reset-time PHC access and the virtual clock callers.
Sample the parent before calling timecounter_read() or timecounter_init()
and have the cyclecounter callback return the cached successful sample.
On failure, leave the counter and frequency adjustment unchanged and
return the PHC error to the caller.
Retry the first failed refresh after 10 ms instead of waiting another two
seconds. With the existing 32-bit nanosecond mask, timecounter_cyc2time()
can interpret a fresh timestamp as being in the past once the last
successful refresh is about 2.147 seconds old. An isolated read failure
should not deliberately defer the next attempt until that sample is four
seconds old.
Double the retry delay after consecutive failures, up to the normal
two-second refresh interval, and reset it after a successful refresh.
Each virtual clock has its own worker, and a failed parent read can involve
bus traffic and error logging. Backoff limits that repeated work during a
persistent failure while retaining a prompt first retry.
Limit each retry delay to the next regular refresh deadline. Otherwise,
backoff can skip the next two-second refresh opportunity and lose a full
counter wrap even when the parent has recovered before that refresh was
due. Advance the deadline when an attempt reaches it without resetting the
backoff, so sustained failures still settle at the normal refresh interval.
Keep the retry state private to each clock's auxiliary worker.
Take the initial sample and initialize the counter before publishing the
clock. Return an error pointer from registration and propagate its errno
through n_vclocks, including when the initial sample fails. Queue the first
refresh immediately after registration so registration latency is not
followed by another full refresh interval.
Keep the existing cyclecounter mask and scaling. These scheduling changes
do not guarantee timely samples: prolonged read failures or worker delays
can still exceed the half-wrap conversion window, and a gap of about
4.295 seconds between successful samples can lose a full counter wrap.
Do not assume that getcycles64() exposes a full-width nanosecond counter.
Fixes: 5d43f951b1ac ("ptp: add ptp virtual clock driver framework")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-3-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_private.h | 6 ++-
drivers/ptp/ptp_sysfs.c | 4 +-
drivers/ptp/ptp_vclock.c | 89 ++++++++++++++++++++++++++++++---------
3 files changed, 76 insertions(+), 23 deletions(-)
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
index ec8633126d6b8..99e7eb241336e 100644
--- a/drivers/ptp/ptp_private.h
+++ b/drivers/ptp/ptp_private.h
@@ -81,7 +81,11 @@ struct ptp_vclock {
struct hlist_node vclock_hash_node;
struct cyclecounter cc;
struct timecounter tc;
- struct mutex lock; /* protects tc/cc */
+ u64 cycles;
+ struct mutex lock; /* protects tc/cc and the cached sample */
+ /* Owned by the auxiliary worker. */
+ unsigned long retry_delay;
+ unsigned long refresh_deadline;
};
/*
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index b07274b67294a..de073b21f1f72 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -228,8 +228,10 @@ static ssize_t n_vclocks_store(struct device *dev,
if (num > ptp->n_vclocks) {
for (i = 0; i < num - ptp->n_vclocks; i++) {
vclock = ptp_vclock_register(ptp);
- if (!vclock)
+ if (IS_ERR(vclock)) {
+ err = PTR_ERR(vclock);
goto err_register;
+ }
*(ptp->vclock_index + ptp->n_vclocks + i) =
vclock->clock->index;
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index 295a64bdd846f..96efbadc0baef 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -4,6 +4,7 @@
*
* Copyright 2021 NXP
*/
+#include <linux/jiffies.h>
#include <linux/slab.h>
#include <linux/hashtable.h>
#include "ptp_private.h"
@@ -13,6 +14,7 @@
#define PTP_VCLOCK_FADJ_SHIFT 9
#define PTP_VCLOCK_FADJ_DENOMINATOR 15625ULL
#define PTP_VCLOCK_REFRESH_INTERVAL (HZ * 2)
+#define PTP_VCLOCK_RETRY_INTERVAL msecs_to_jiffies(10)
/* protects vclock_hash addition/deletion */
static DEFINE_SPINLOCK(vclock_hash_lock);
@@ -42,21 +44,39 @@ static void ptp_vclock_hash_del(struct ptp_vclock *vclock)
synchronize_srcu(&vclock_srcu);
}
+/* The caller holds vclock->lock, or has not published the clock yet. */
+static int ptp_vclock_sample(struct ptp_vclock *vclock)
+{
+ struct ptp_clock *ptp = vclock->pclock;
+ struct timespec64 ts;
+ int err;
+
+ err = ptp->info->getcycles64(ptp->info, &ts);
+ if (!err)
+ vclock->cycles = timespec64_to_ns(&ts);
+
+ return err;
+}
+
static int ptp_vclock_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{
struct ptp_vclock *vclock = info_to_vclock(ptp);
s64 adj;
+ int err;
adj = (s64)scaled_ppm << PTP_VCLOCK_FADJ_SHIFT;
adj = div_s64(adj, PTP_VCLOCK_FADJ_DENOMINATOR);
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- timecounter_read(&vclock->tc);
- vclock->cc.mult = PTP_VCLOCK_CC_MULT + adj;
+ err = ptp_vclock_sample(vclock);
+ if (!err) {
+ timecounter_read(&vclock->tc);
+ vclock->cc.mult = PTP_VCLOCK_CC_MULT + adj;
+ }
mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static int ptp_vclock_adjtime(struct ptp_clock_info *ptp, s64 delta)
@@ -75,15 +95,16 @@ static int ptp_vclock_gettime(struct ptp_clock_info *ptp,
struct timespec64 *ts)
{
struct ptp_vclock *vclock = info_to_vclock(ptp);
- u64 ns;
+ int err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- ns = timecounter_read(&vclock->tc);
+ err = ptp_vclock_sample(vclock);
+ if (!err)
+ *ts = ns_to_timespec64(timecounter_read(&vclock->tc));
mutex_unlock(&vclock->lock);
- *ts = ns_to_timespec64(ns);
- return 0;
+ return err;
}
static int ptp_vclock_gettimex(struct ptp_clock_info *ptp,
@@ -115,13 +136,16 @@ static int ptp_vclock_settime(struct ptp_clock_info *ptp,
{
struct ptp_vclock *vclock = info_to_vclock(ptp);
u64 ns = timespec64_to_ns(ts);
+ int err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- timecounter_init(&vclock->tc, &vclock->cc, ns);
+ err = ptp_vclock_sample(vclock);
+ if (!err)
+ timecounter_init(&vclock->tc, &vclock->cc, ns);
mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static int ptp_vclock_getcrosststamp(struct ptp_clock_info *ptp,
@@ -151,8 +175,24 @@ static long ptp_vclock_refresh(struct ptp_clock_info *ptp)
struct ptp_vclock *vclock = info_to_vclock(ptp);
struct timespec64 ts;
- ptp_vclock_gettime(&vclock->info, &ts);
+ /* Retry transient failures promptly, but back off during long outages. */
+ if (ptp_vclock_gettime(&vclock->info, &ts)) {
+ unsigned long now = jiffies;
+
+ /* Retries must not postpone the next regular refresh attempt. */
+ if (!vclock->retry_delay || time_after_eq(now, vclock->refresh_deadline))
+ vclock->refresh_deadline = now + PTP_VCLOCK_REFRESH_INTERVAL;
+
+ if (!vclock->retry_delay)
+ vclock->retry_delay = PTP_VCLOCK_RETRY_INTERVAL;
+ else
+ vclock->retry_delay = min_t(unsigned long,
+ vclock->retry_delay * 2,
+ PTP_VCLOCK_REFRESH_INTERVAL);
+ return min(vclock->retry_delay, vclock->refresh_deadline - now);
+ }
+ vclock->retry_delay = 0;
return PTP_VCLOCK_REFRESH_INTERVAL;
}
@@ -174,12 +214,9 @@ static const struct ptp_clock_info ptp_vclock_info = {
static u64 ptp_vclock_read(struct cyclecounter *cc)
{
struct ptp_vclock *vclock = cc_to_vclock(cc);
- struct ptp_clock *ptp = vclock->pclock;
- struct timespec64 ts = {};
-
- ptp->info->getcycles64(ptp->info, &ts);
- return timespec64_to_ns(&ts);
+ /* The cyclecounter callback cannot report a failed PHC read. */
+ return vclock->cycles;
}
static const struct cyclecounter ptp_vclock_cc = {
@@ -192,10 +229,11 @@ static const struct cyclecounter ptp_vclock_cc = {
struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock)
{
struct ptp_vclock *vclock;
+ int err;
vclock = kzalloc(sizeof(*vclock), GFP_KERNEL);
if (!vclock)
- return NULL;
+ return ERR_PTR(-ENOMEM);
vclock->pclock = pclock;
vclock->info = ptp_vclock_info;
@@ -214,20 +252,29 @@ struct ptp_vclock *ptp_vclock_register(struct ptp_clock *pclock)
mutex_init(&vclock->lock);
+ err = ptp_vclock_sample(vclock);
+ if (err)
+ goto free_vclock;
+ timecounter_init(&vclock->tc, &vclock->cc, 0);
+
vclock->clock = ptp_clock_register(&vclock->info, &pclock->dev);
- if (IS_ERR_OR_NULL(vclock->clock)) {
- kfree(vclock);
- return NULL;
+ if (IS_ERR(vclock->clock)) {
+ err = PTR_ERR(vclock->clock);
+ goto free_vclock;
}
ptp_vclock_set_subclass(vclock->clock);
- timecounter_init(&vclock->tc, &vclock->cc, 0);
- ptp_schedule_worker(vclock->clock, PTP_VCLOCK_REFRESH_INTERVAL);
+ /* The initial sample predates registration; refresh without more delay. */
+ ptp_schedule_worker(vclock->clock, 0);
ptp_vclock_hash_add(vclock);
return vclock;
+
+free_vclock:
+ kfree(vclock);
+ return ERR_PTR(err);
}
void ptp_vclock_unregister(struct ptp_vclock *vclock)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 100/990] ptp: vclock: serialize extended samples with counter updates
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (98 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 099/990] ptp: vclock: propagate physical clock sampling errors Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 101/990] ptp: vclock: preserve missing hardware timestamps Greg Kroah-Hartman
` (752 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit d3fcce5afe3bb62e8f7a2efb29e43da4fe4ae1f3 ]
The extended and cross-timestamp callbacks sample the physical clock
before taking the virtual clock mutex. A concurrent frequency adjustment
can advance the timecounter and change its multiplier in between, so the
older sample is converted using a different frequency than the one in
effect when it was taken.
Take the mutex before sampling and keep it held through the conversion.
Retain timecounter_cyc2time() and its existing conversion window. A PHC
sample need not advance the counter: for example, e1000e explicitly
allows non-monotonic SYSTIM readings. Treating a slightly older sample
as a forward delta would instead advance virtual time by nearly a full
counter wrap.
This race was found by code inspection of the virtual clock sampling
paths.
Fixes: f0067ebfc42b ("ptp: add gettimex64() to virtual clocks.")
Fixes: 21fad63084c2 ("ptp: add getcrosststamp() to virtual clocks.")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-4-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_vclock.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index 96efbadc0baef..1a75a5b9bc058 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -115,20 +115,18 @@ static int ptp_vclock_gettimex(struct ptp_clock_info *ptp,
struct ptp_clock *pptp = vclock->pclock;
struct timespec64 pts;
int err;
- u64 ns;
-
- err = pptp->info->getcyclesx64(pptp->info, &pts, sts);
- if (err)
- return err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- ns = timecounter_cyc2time(&vclock->tc, timespec64_to_ns(&pts));
- mutex_unlock(&vclock->lock);
+ err = pptp->info->getcyclesx64(pptp->info, &pts, sts);
+ if (!err) {
+ u64 ns = timecounter_cyc2time(&vclock->tc, timespec64_to_ns(&pts));
- *ts = ns_to_timespec64(ns);
+ *ts = ns_to_timespec64(ns);
+ }
+ mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static int ptp_vclock_settime(struct ptp_clock_info *ptp,
@@ -154,20 +152,18 @@ static int ptp_vclock_getcrosststamp(struct ptp_clock_info *ptp,
struct ptp_vclock *vclock = info_to_vclock(ptp);
struct ptp_clock *pptp = vclock->pclock;
int err;
- u64 ns;
-
- err = pptp->info->getcrosscycles(pptp->info, xtstamp);
- if (err)
- return err;
if (mutex_lock_interruptible(&vclock->lock))
return -EINTR;
- ns = timecounter_cyc2time(&vclock->tc, ktime_to_ns(xtstamp->device));
- mutex_unlock(&vclock->lock);
+ err = pptp->info->getcrosscycles(pptp->info, xtstamp);
+ if (!err) {
+ u64 ns = timecounter_cyc2time(&vclock->tc, ktime_to_ns(xtstamp->device));
- xtstamp->device = ns_to_ktime(ns);
+ xtstamp->device = ns_to_ktime(ns);
+ }
+ mutex_unlock(&vclock->lock);
- return 0;
+ return err;
}
static long ptp_vclock_refresh(struct ptp_clock_info *ptp)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 101/990] ptp: vclock: preserve missing hardware timestamps
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (99 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 100/990] ptp: vclock: serialize extended samples with counter updates Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 102/990] net/smc: fix limit_smc_hs sysctl on big-endian architecture Greg Kroah-Hartman
` (751 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vadim Fedorenko, James Hilliard,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit 63787dfd1b5ae720cc30dab5e66c8e4d81ff7391 ]
Socket timestamp delivery converts hardware timestamps to a bound
virtual clock before checking whether a hardware timestamp is present.
A zero timestamp means that the packet has no hardware timestamp, but
timecounter_cyc2time() can turn that zero into a nonzero virtual time.
The socket then reports a hardware timestamp which was never supplied.
Return zero without conversion when the input timestamp is absent.
This also covers skb_get_tx_timestamp(), which checks for an absent
timestamp after the same conversion.
This was identified during review of virtual clock sampling changes.
Fixes: d7c088265588 ("net: socket: support hardware timestamp conversion to PHC bound")
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-5-e705612541f1@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_vclock.c | 2 ++
include/linux/ptp_clock_kernel.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index 1a75a5b9bc058..0ecd63eb729a4 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -326,6 +326,8 @@ ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index)
u64 ns;
ns = ktime_to_ns(*hwtstamp);
+ if (!ns)
+ return 0;
srcu_idx = srcu_read_lock(&vclock_srcu);
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 884364596dd32..d199ac4ec1c8f 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -495,7 +495,7 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index);
* @hwtstamp: timestamp
* @vclock_index: phc index of ptp vclock.
*
- * Returns: converted timestamp, or 0 on error.
+ * Returns: converted timestamp, or 0 if @hwtstamp is zero or on error.
*/
ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index);
#else
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 102/990] net/smc: fix limit_smc_hs sysctl on big-endian architecture
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (100 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 101/990] ptp: vclock: preserve missing hardware timestamps Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 103/990] scsi: target: Validate REGISTER AND MOVE TransportID length Greg Kroah-Hartman
` (750 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Fernando Fernandez Mancera,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <fmancera@suse.de>
[ Upstream commit 162cf592b577cccf04515100563e819d9eba5c4a ]
net->smc.limit_smc_hs is a bool, but its sysctl entry uses
proc_dointvec_minmax() with .maxlen = sizeof(int), so the handler
accesses four bytes at the address of a one-byte field.
On little-endian this works with the extra bytes being written in struct
padding. On big-endian (tested on s390x) the bool sits at the most
significant byte of the int therefore the bool stays false and the "1"
goes into padding. The sysctl reads back 1 but SMC sockets created
afterwards see limit_smc_hs as disabled.
Fix this by using proc_dobool() handler and adjust the maxlen to the
right value.
Fixes: f8406a2fd279 ("net/smc: add sysctl for smc_limit_hs")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20261028225350.3753-1-fmancera@suse.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/smc/smc_sysctl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/smc/smc_sysctl.c b/net/smc/smc_sysctl.c
index 2fab6456f7654..7da98bd5287ae 100644
--- a/net/smc/smc_sysctl.c
+++ b/net/smc/smc_sysctl.c
@@ -93,11 +93,9 @@ static struct ctl_table smc_table[] = {
{
.procname = "limit_smc_hs",
.data = &init_net.smc.limit_smc_hs,
- .maxlen = sizeof(int),
+ .maxlen = sizeof(bool),
.mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
+ .proc_handler = proc_dobool,
},
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 103/990] scsi: target: Validate REGISTER AND MOVE TransportID length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (101 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 102/990] net/smc: fix limit_smc_hs sysctl on big-endian architecture Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 104/990] tipc: reject attaching bearer of different media to the same occupied device Greg Kroah-Hartman
` (749 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Martin K. Petersen (Oracle),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit 5d5913710c81eed6fa275b6a24773059d9dbfdfa ]
REGISTER AND MOVE has a 24-byte parameter-list header followed by a
TransportID. A 24-byte parameter list with a zero TransportID length
passes the existing tid_len + 24 check, then the handler reads buf[24] for
the TransportID protocol identifier, one byte past the received parameter
list.
A TransportID is at least 24 bytes. Reject shorter TransportIDs and
compare the declared length with the bytes following the header before
reading buf[24].
A malformed PR OUT sent through vhost-scsi triggered this read on a KASAN
kernel. The command is now rejected with INVALID PARAMETER LIST before
buf[24] is accessed.
Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Link: https://patch.msgid.link/20261021094334.198599-1-physicalmtea@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/target/target_core_pr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index f18085d8345f5..24b240786f88a 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -3220,10 +3220,11 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
transport_kunmap_data_sg(cmd);
buf = NULL;
- if ((tid_len + 24) != cmd->data_length) {
- pr_err("SPC-3 PR: Illegal tid_len: %u + 24 byte header"
- " does not equal CDB data_length: %u\n", tid_len,
- cmd->data_length);
+ /* TransportID is at least 24 bytes. buf[24] is its first byte. */
+ if (tid_len < 24 ||
+ tid_len != cmd->data_length - 24) {
+ pr_err("SPC-3 PR: Illegal tid_len: %u for data_length: %u\n",
+ tid_len, cmd->data_length);
ret = TCM_INVALID_PARAMETER_LIST;
goto out_put_pr_reg;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 104/990] tipc: reject attaching bearer of different media to the same occupied device
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (102 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 103/990] scsi: target: Validate REGISTER AND MOVE TransportID length Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 105/990] net: ipa: Fix double free of the interrupt structure on config error Greg Kroah-Hartman
` (748 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiakai Xu, Tung Nguyen,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tung Nguyen <tung.quang.nguyen@est.tech>
[ Upstream commit 0a0257228be902ff09608bcaf19ae7c6d58b028f ]
Currently, two bearers of different media types can be added to the
same device (e.g., "eth:eth0" and "ib:eth0") via tipc command:
tipc bearer enable media eth dev eth0
tipc bearer enable media ib dev eth0
For each command execution, tipc_enable_l2_media() is called:
tipc_enable_l2_media()
dev_get_by_name()
dev_hold()
As a result, device->dev_refcnt is incremented twice, but the second
bearer replaces the first one. This causes a leak in device->dev_refcnt.
Fix this by rejecting a bearer with a different media type when the
device is already occupied.
Fixes: cb30a63384bc ("tipc: refactor function tipc_enable_bearer()")
Reported-by: Jiakai Xu <xujiakai24@mails.ucas.ac.cn>
Closes: http://lore.kernel.org/netdev/20260918013509.1853952-1-xujiakai24@mails.ucas.ac.cn/
Signed-off-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/20261029030522.8306-1-tung.quang.nguyen@est.tech
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tipc/bearer.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 24dcb8aa32330..e057d0c6786c4 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -285,17 +285,50 @@ static int tipc_enable_bearer(struct net *net, const char *name,
bearer_id = MAX_BEARERS;
i = MAX_BEARERS;
while (i-- != 0) {
+ struct net_device *dev;
+
b = rtnl_dereference(tn->bearer_list[i]);
if (!b) {
bearer_id = i;
continue;
}
if (!strcmp(name, b->name)) {
+duplicate:
errstr = "already enabled";
NL_SET_ERR_MSG(extack, "Already enabled");
goto rejected;
}
+ /* udp media can be used together with any media */
+ if (b->media->type_id == TIPC_MEDIA_TYPE_UDP ||
+ m->type_id == TIPC_MEDIA_TYPE_UDP)
+ goto priority;
+
+ dev = __dev_get_by_name(net, b_names.if_name);
+
+ if (!dev) {
+ res = -ENODEV;
+ errstr = "no device for the media";
+ NL_SET_ERR_MSG(extack, "No device for the media");
+ goto rejected;
+ }
+
+ if (rtnl_dereference(b->media_ptr) == dev) {
+ char *dev_name = strchr((const char *)b->name, ':') + 1;
+
+ /* Not allow altname of occupied device */
+ if (strcmp(dev_name, b_names.if_name) &&
+ b->media->type_id == m->type_id)
+ goto duplicate;
+
+ /* Not allow eth and ib to attach to the same device */
+ errstr = "same dev for different media";
+ NL_SET_ERR_MSG(extack,
+ "Same dev for different media");
+ goto rejected;
+ }
+
+priority:
if (b->priority == prio &&
(++with_this_prio > 2)) {
pr_warn("Bearer <%s>: already 2 bearers with priority %u\n",
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 105/990] net: ipa: Fix double free of the interrupt structure on config error
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (103 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 104/990] tipc: reject attaching bearer of different media to the same occupied device Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 106/990] ALSA: memalloc: Free the new pages when WC DMA mapping fails Greg Kroah-Hartman
` (747 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Fourier, Alex Elder,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <fourier.thomas@gmail.com>
[ Upstream commit cb284914e749388eef402938bdb3115fe1f6d337 ]
Since ipa_interrupt_init() allocates struct ipa_interrupt in ipa_probe(),
the structure is owned by ipa_probe() and released with
ipa_interrupt_exit() on its error paths and in ipa_remove(). The error
path of ipa_interrupt_config() still frees it with kfree(). If
ipa_interrupt_config() fails (called from ipa_config() via ipa_setup()),
ipa_probe() unwinds through err_interrupt_exit, which frees the same
structure again.
Drop the kfree() from ipa_interrupt_config(); it should only undo what it
set up itself. Drop the leftover initialization and cleanup of
ipa->interrupt now managed in ipa_proble() and ipa_remove() of ipa_main.c.
Fixes: ad1be80d7582 ("net: ipa: introduce ipa_interrupt_init()")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Reviewed-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20261029082100.17722-2-fourier.thomas@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ipa/ipa_interrupt.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c
index 245a069970556..dc5315ce31d32 100644
--- a/drivers/net/ipa/ipa_interrupt.c
+++ b/drivers/net/ipa/ipa_interrupt.c
@@ -261,10 +261,8 @@ int ipa_interrupt_config(struct ipa *ipa)
interrupt->enabled = 0;
interrupt->suspend_enabled = bitmap_zalloc(ipa->endpoint_count,
GFP_KERNEL);
- if (!interrupt->suspend_enabled) {
- ret = -ENOMEM;
- goto err_kfree;
- }
+ if (!interrupt->suspend_enabled)
+ return -ENOMEM;
/* Disable IPA interrupt types */
reg = ipa_reg(ipa, IPA_IRQ_EN);
@@ -290,8 +288,6 @@ int ipa_interrupt_config(struct ipa *ipa)
goto err_disable_wakeup;
}
- ipa->interrupt = interrupt;
-
return 0;
err_disable_wakeup:
@@ -300,8 +296,6 @@ int ipa_interrupt_config(struct ipa *ipa)
free_irq(interrupt->irq, interrupt);
err_free_bitmap:
bitmap_free(interrupt->suspend_enabled);
-err_kfree:
- kfree(interrupt);
return ret;
}
@@ -312,8 +306,6 @@ void ipa_interrupt_deconfig(struct ipa *ipa)
struct ipa_interrupt *interrupt = ipa->interrupt;
struct device *dev = ipa->dev;
- ipa->interrupt = NULL;
-
dev_pm_clear_wake_irq(dev);
(void)device_init_wakeup(dev, false);
free_irq(interrupt->irq, interrupt);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 106/990] ALSA: memalloc: Free the new pages when WC DMA mapping fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (104 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 105/990] net: ipa: Fix double free of the interrupt structure on config error Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 107/990] netfilter: nft_reject: prevent unbounded recursion in output hooks Greg Kroah-Hartman
` (746 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sasha Levin, Takashi Iwai
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 016fe9695e6dc1322ddfe8c7dbc7b973483b4a24 ]
snd_dma_wc_alloc() keeps the newly allocated pages in a local variable,
and snd_dma_alloc_dir_pages() stores them in dmab->area only after
->alloc() returns. If dma_map_single() fails, the error path passes
dmab->area to do_free_pages() instead, and that is still NULL at this
point for the usual callers.
The pages are then leaked with their write-combining attribute still
set, set_memory_wb() warns about the zero address, and for buffers
larger than a page free_pages_exact() goes on to free the struct pages
of the bogus addresses 4096, 8192 and so on. With CONFIG_DEBUG_VM that
hits the VM_BUG_ON() in free_pages():
kernel BUG at mm/page_alloc.c:5600!
RIP: 0010:free_pages_exact+0xcb/0xd0
Call Trace:
snd_dma_wc_alloc+0x14f/0x160 [snd_pcm]
snd_dma_alloc_dir_pages+0x4f/0x80 [snd_pcm]
This was reproduced on an x86 guest without swiotlb by allocating
SNDRV_DMA_TYPE_DEV_WC buffers for a device with a 24-bit streaming DMA
mask, so that dma_map_single() fails.
Free the pages that were just allocated.
Fixes: c880a5146642 ("ALSA: memalloc: Use proper DMA mapping API for x86 WC buffer allocations")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Link: https://patch.msgid.link/20261028144441.992127-1-sashal@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/core/memalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index b3853583d2ae1..e2887c9a24631 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -506,7 +506,7 @@ static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size)
return NULL;
dmab->addr = dma_map_single(dmab->dev.dev, p, size, DMA_BIDIRECTIONAL);
if (dma_mapping_error(dmab->dev.dev, dmab->addr)) {
- do_free_pages(dmab->area, size, true);
+ do_free_pages(p, size, true);
return NULL;
}
return p;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 107/990] netfilter: nft_reject: prevent unbounded recursion in output hooks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (105 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 106/990] ALSA: memalloc: Free the new pages when WC DMA mapping fails Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 108/990] spi: pic32-sqi: fail transfer when the BD ring is exhausted Greg Kroah-Hartman
` (745 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yu Junzhe,
Fernando Fernandez Mancera, Pablo Neira Ayuso, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <fmancera@suse.de>
[ Upstream commit d6c18cadfc6c7a88e9e07e0a1b5ead37c0ddf866 ]
nftables payload-mangling rules can rewrite packet contents (such as TCP
flags) before they are evaluated by reject targets. This defeats the
content-based loop guards, allowing unbounded hook recursion that leads
to kernel stack exhaustion and panics.
Fix this by extracting the per-CPU xmit recursion limit previously used
by the netdev duplication/forwarding paths into a shared header, and
apply it to the inet and inet6 reject transmit functions. It disables BH
while transmitting the skb to address a possible migration to different
CPU leading to imbalanced decrementation of the recursion counters.
Note that the dev_queue_xmit() path used when CONFIG_BRIDGE_NETFILTER is
enabled does not require this recursion guard. In that scenario, the
generated reset packet is transmitted directly at Layer 2. Because the
packet egresses from a different hook, it cannot synchronously loop. In
addition nf_send_unreach() and nf_send_unreach6() are safe as the ICMP
transmit functions are protected against recursion by the
icmp_xmit_lock() and icmpv6_xmit_lock() guards.
Reported-by: Yu Junzhe <junzheyu1@gmail.com>
Closes: https://lore.kernel.org/netfilter-devel/20260921061320.543-1-junzheyu1@gmail.com/
Fixes: bee11dc78fc8 ("netfilter: nft_reject: support for IPv6 and TCP reset")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/netdevice_xmit.h | 4 +--
include/net/netfilter/nf_dup_netdev.h | 35 ----------------------
include/net/netfilter/nf_recursion.h | 42 +++++++++++++++++++++++++++
net/ipv4/netfilter/nf_reject_ipv4.c | 12 ++++++++
net/ipv6/netfilter/nf_reject_ipv6.c | 13 +++++++++
net/netfilter/nf_dup_netdev.c | 1 +
net/netfilter/nft_fwd_netdev.c | 1 +
7 files changed, 71 insertions(+), 37 deletions(-)
create mode 100644 include/net/netfilter/nf_recursion.h
diff --git a/include/linux/netdevice_xmit.h b/include/linux/netdevice_xmit.h
index 813a19122ebbb..b4ce469cee740 100644
--- a/include/linux/netdevice_xmit.h
+++ b/include/linux/netdevice_xmit.h
@@ -11,8 +11,8 @@ struct netdev_xmit {
#if IS_ENABLED(CONFIG_NET_ACT_MIRRED)
u8 sched_mirred_nest;
#endif
-#if IS_ENABLED(CONFIG_NF_DUP_NETDEV)
- u8 nf_dup_skb_recursion;
+#if IS_ENABLED(CONFIG_NETFILTER)
+ u8 nf_xmit_skb_recursion;
#endif
};
diff --git a/include/net/netfilter/nf_dup_netdev.h b/include/net/netfilter/nf_dup_netdev.h
index f6b05bd80c3fe..a394112646144 100644
--- a/include/net/netfilter/nf_dup_netdev.h
+++ b/include/net/netfilter/nf_dup_netdev.h
@@ -9,41 +9,6 @@
void nf_dup_netdev_egress(const struct nft_pktinfo *pkt, int oif);
void nf_fwd_netdev_egress(const struct nft_pktinfo *pkt, int oif);
-#define NF_RECURSION_LIMIT 2
-
-#ifndef CONFIG_PREEMPT_RT
-static inline bool nf_dev_xmit_recursion(void)
-{
- return unlikely(__this_cpu_read(softnet_data.xmit.nf_dup_skb_recursion) >
- NF_RECURSION_LIMIT);
-}
-
-static inline void nf_dev_xmit_recursion_inc(void)
-{
- __this_cpu_inc(softnet_data.xmit.nf_dup_skb_recursion);
-}
-
-static inline void nf_dev_xmit_recursion_dec(void)
-{
- __this_cpu_dec(softnet_data.xmit.nf_dup_skb_recursion);
-}
-#else
-static inline bool nf_dev_xmit_recursion(void)
-{
- return unlikely(current->net_xmit.nf_dup_skb_recursion > NF_RECURSION_LIMIT);
-}
-
-static inline void nf_dev_xmit_recursion_inc(void)
-{
- current->net_xmit.nf_dup_skb_recursion++;
-}
-
-static inline void nf_dev_xmit_recursion_dec(void)
-{
- current->net_xmit.nf_dup_skb_recursion--;
-}
-#endif
-
struct nft_offload_ctx;
struct nft_flow_rule;
diff --git a/include/net/netfilter/nf_recursion.h b/include/net/netfilter/nf_recursion.h
new file mode 100644
index 0000000000000..1ac65f7793f19
--- /dev/null
+++ b/include/net/netfilter/nf_recursion.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _NF_RECURSION_H_
+#define _NF_RECURSION_H_
+
+#include <linux/netdevice.h>
+
+#define NF_RECURSION_LIMIT 2
+
+#ifndef CONFIG_PREEMPT_RT
+static inline bool nf_dev_xmit_recursion(void)
+{
+ return unlikely(__this_cpu_read(softnet_data.xmit.nf_xmit_skb_recursion) >
+ NF_RECURSION_LIMIT);
+}
+
+static inline void nf_dev_xmit_recursion_inc(void)
+{
+ __this_cpu_inc(softnet_data.xmit.nf_xmit_skb_recursion);
+}
+
+static inline void nf_dev_xmit_recursion_dec(void)
+{
+ __this_cpu_dec(softnet_data.xmit.nf_xmit_skb_recursion);
+}
+#else
+static inline bool nf_dev_xmit_recursion(void)
+{
+ return unlikely(current->net_xmit.nf_xmit_skb_recursion > NF_RECURSION_LIMIT);
+}
+
+static inline void nf_dev_xmit_recursion_inc(void)
+{
+ current->net_xmit.nf_xmit_skb_recursion++;
+}
+
+static inline void nf_dev_xmit_recursion_dec(void)
+{
+ current->net_xmit.nf_xmit_skb_recursion--;
+}
+#endif
+
+#endif /* _NF_RECURSION_H_ */
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c
index 7cb33af671e26..4082fa184af8b 100644
--- a/net/ipv4/netfilter/nf_reject_ipv4.c
+++ b/net/ipv4/netfilter/nf_reject_ipv4.c
@@ -10,6 +10,7 @@
#include <net/dst.h>
#include <net/dst_metadata.h>
#include <net/netfilter/ipv4/nf_reject.h>
+#include <net/netfilter/nf_recursion.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_bridge.h>
@@ -336,7 +337,18 @@ void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb,
dev_queue_xmit(nskb);
} else
#endif
+ {
+ local_bh_disable();
+ if (nf_dev_xmit_recursion()) {
+ local_bh_enable();
+ goto free_nskb;
+ }
+
+ nf_dev_xmit_recursion_inc();
ip_local_out(net, nskb->sk, nskb);
+ nf_dev_xmit_recursion_dec();
+ local_bh_enable();
+ }
return;
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
index 5e08d8529cc88..7c94641845175 100644
--- a/net/ipv6/netfilter/nf_reject_ipv6.c
+++ b/net/ipv6/netfilter/nf_reject_ipv6.c
@@ -10,6 +10,7 @@
#include <net/ip6_checksum.h>
#include <net/dst_metadata.h>
#include <net/netfilter/ipv6/nf_reject.h>
+#include <net/netfilter/nf_recursion.h>
#include <linux/netfilter_ipv6.h>
#include <linux/netfilter_bridge.h>
@@ -409,7 +410,19 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb,
dev_queue_xmit(nskb);
} else
#endif
+ {
+ local_bh_disable();
+ if (nf_dev_xmit_recursion()) {
+ local_bh_enable();
+ kfree_skb(nskb);
+ return;
+ }
+
+ nf_dev_xmit_recursion_inc();
ip6_local_out(net, sk, nskb);
+ nf_dev_xmit_recursion_dec();
+ local_bh_enable();
+ }
}
EXPORT_SYMBOL_GPL(nf_send_reset6);
diff --git a/net/netfilter/nf_dup_netdev.c b/net/netfilter/nf_dup_netdev.c
index 02d1880bab6b3..c47508b54ba9c 100644
--- a/net/netfilter/nf_dup_netdev.c
+++ b/net/netfilter/nf_dup_netdev.c
@@ -12,6 +12,7 @@
#include <net/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables_offload.h>
#include <net/netfilter/nf_dup_netdev.h>
+#include <net/netfilter/nf_recursion.h>
static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
enum nf_dev_hooks hook)
diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c
index eceab479bd8c4..84ae30cd208b7 100644
--- a/net/netfilter/nft_fwd_netdev.c
+++ b/net/netfilter/nft_fwd_netdev.c
@@ -14,6 +14,7 @@
#include <net/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables_offload.h>
#include <net/netfilter/nf_dup_netdev.h>
+#include <net/netfilter/nf_recursion.h>
#include <net/neighbour.h>
#include <net/ip.h>
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 108/990] spi: pic32-sqi: fail transfer when the BD ring is exhausted
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (106 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 107/990] netfilter: nft_reject: prevent unbounded recursion in output hooks Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 109/990] bpf: Avoid changing callchain in bpf_get_stack_pe Greg Kroah-Hartman
` (744 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hongjian Dai, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongjian Dai <daihongjian@kylinsec.com.cn>
[ Upstream commit 2066970324a1439e5a2e08c4599098367f8f82cc ]
pic32_sqi_one_transfer() silently stopped programming buffer descriptors
when ring_desc_get() returned NULL and still returned success. The caller
then marked the last programmed descriptor as the end of the list and
started the DMA engine, so the hardware transferred only a prefix of the
requested data while the message completed with status 0.
The ring holds PESQI_BD_COUNT (256) descriptors of at most
PESQI_BD_BUF_LEN_MAX (256) bytes each, so messages larger than 64 KiB (or
with enough SG entries) can exhaust it. Since the driver sets no
max_message_size/max_transfer_size, the SPI core does not prevent this.
Return -ENOMEM instead, and set msg->status so the failure reaches the
caller rather than being silently truncated.
Fixes: 3270ac230f66 ("spi: pic32-sqi: add SPI driver for PIC32 SQI controller.")
Signed-off-by: Hongjian Dai <daihongjian@kylinsec.com.cn>
Link: https://patch.msgid.link/F5276982A630220B+20261017075545.95854-1-daihongjian@kylinsec.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-pic32-sqi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c
index a6b5a0ed99c9e..6061e425d09c5 100644
--- a/drivers/spi/spi-pic32-sqi.c
+++ b/drivers/spi/spi-pic32-sqi.c
@@ -297,7 +297,7 @@ static int pic32_sqi_one_transfer(struct pic32_sqi *sqi,
/* get ring descriptor */
rdesc = ring_desc_get(sqi);
if (!rdesc)
- break;
+ return -ENOMEM;
bd = rdesc->bd;
@@ -387,6 +387,7 @@ static int pic32_sqi_one_message(struct spi_controller *host,
ret = pic32_sqi_one_transfer(sqi, msg, xfer);
if (ret) {
dev_err(&spi->dev, "xfer %p err\n", xfer);
+ msg->status = ret;
goto xfer_out;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 109/990] bpf: Avoid changing callchain in bpf_get_stack_pe
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (107 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 108/990] spi: pic32-sqi: fail transfer when the BD ring is exhausted Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 110/990] bpf: Clamp the trace length in __bpf_get_stack() again Greg Kroah-Hartman
` (743 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiri Olsa, Andrii Nakryiko,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <jolsa@kernel.org>
[ Upstream commit 347c1d722e3ea4ffa2850585f5c76c6e551eac83 ]
There's no need to modify the trace object bpf_get_stack_pe, we just
need to pass the needed callchain length in separate argument.
This way we can have callchain pointers const and remove the trace->nr
modification and restoration.
Assisted-by: Codex:GPT-5.5
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260803210149.296496-12-jolsa@kernel.org
Stable-dep-of: 007fd460798b ("bpf: Clamp the trace length in __bpf_get_stack() again")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/stackmap.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 02b6b0e9cb6ce..2749985910855 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -541,7 +541,7 @@ const struct bpf_func_proto bpf_get_stackid_proto = {
.arg3_type = ARG_ANYTHING,
};
-static __u64 count_kernel_ip(struct perf_callchain_entry *trace)
+static __u64 count_kernel_ip(const struct perf_callchain_entry *trace)
{
__u64 nr_kernel = 0;
@@ -621,15 +621,15 @@ const struct bpf_func_proto bpf_get_stackid_proto_pe = {
.arg3_type = ARG_ANYTHING,
};
-static u32 callchain_store(struct perf_callchain_entry *trace, void *buf,
- u32 elem_size, u64 flags)
+static u32 callchain_store(const struct perf_callchain_entry *trace, u32 trace_nr,
+ void *buf, u32 elem_size, u64 flags)
{
bool user_build_id = flags & BPF_F_USER_BUILD_ID;
u32 skip = flags & BPF_F_SKIP_FIELD_MASK;
- u32 trace_nr, copy_len;
- u64 *ips;
+ const u64 *ips;
+ u32 copy_len;
- trace_nr = trace->nr - skip;
+ trace_nr = trace_nr - skip;
copy_len = trace_nr * elem_size;
ips = trace->ip + skip;
@@ -713,7 +713,7 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
goto err_fault;
}
- trace_nr = callchain_store(trace, buf, elem_size, flags);
+ trace_nr = callchain_store(trace, trace->nr, buf, elem_size, flags);
/* trace should not be dereferenced after this point */
if (may_fault)
@@ -817,8 +817,8 @@ const struct bpf_func_proto bpf_get_task_stack_sleepable_proto = {
.arg4_type = ARG_ANYTHING,
};
-static int __bpf_get_stack_pe(struct perf_callchain_entry *trace, void *buf, u32 size,
- u64 flags)
+static int __bpf_get_stack_pe(const struct perf_callchain_entry *trace, u32 trace_nr,
+ void *buf, u32 size, u64 flags)
{
bool user_build_id = flags & BPF_F_USER_BUILD_ID;
u64 skip = flags & BPF_F_SKIP_FIELD_MASK;
@@ -834,12 +834,12 @@ static int __bpf_get_stack_pe(struct perf_callchain_entry *trace, void *buf, u32
return -EINVAL;
max_depth = stack_map_calculate_max_depth(size, elem_size, flags);
- trace->nr = min_t(u32, trace->nr, max_depth);
+ trace_nr = min_t(u32, trace_nr, max_depth);
- if (trace->nr < skip)
+ if (trace_nr < skip)
return -EFAULT;
- nr_trace = callchain_store(trace, buf, elem_size, flags);
+ nr_trace = callchain_store(trace, trace_nr, buf, elem_size, flags);
return callchain_finalize(buf, size, nr_trace, elem_size, flags, false /* !may_fault */);
}
@@ -847,8 +847,8 @@ BPF_CALL_4(bpf_get_stack_pe, struct bpf_perf_event_data_kern *, ctx,
void *, buf, u32, size, u64, flags)
{
struct pt_regs *regs = (struct pt_regs *)(ctx->regs);
+ const struct perf_callchain_entry *trace;
struct perf_event *event = ctx->event;
- struct perf_callchain_entry *trace;
bool kernel, user;
int err = -EINVAL;
__u64 nr_kernel;
@@ -871,13 +871,7 @@ BPF_CALL_4(bpf_get_stack_pe, struct bpf_perf_event_data_kern *, ctx,
nr_kernel = count_kernel_ip(trace);
if (kernel) {
- __u64 nr = trace->nr;
-
- trace->nr = nr_kernel;
- err = __bpf_get_stack_pe(trace, buf, size, flags);
-
- /* restore nr */
- trace->nr = nr;
+ err = __bpf_get_stack_pe(trace, nr_kernel, buf, size, flags);
} else { /* user */
u64 skip = flags & BPF_F_SKIP_FIELD_MASK;
@@ -885,7 +879,7 @@ BPF_CALL_4(bpf_get_stack_pe, struct bpf_perf_event_data_kern *, ctx,
if (skip > BPF_F_SKIP_FIELD_MASK)
goto clear;
flags = (flags & ~BPF_F_SKIP_FIELD_MASK) | skip;
- err = __bpf_get_stack_pe(trace, buf, size, flags);
+ err = __bpf_get_stack_pe(trace, trace->nr, buf, size, flags);
}
clear:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 110/990] bpf: Clamp the trace length in __bpf_get_stack() again
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (108 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 109/990] bpf: Avoid changing callchain in bpf_get_stack_pe Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 111/990] bpf: Avoid changing callchain in bpf_get_stackid_pe Greg Kroah-Hartman
` (742 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 007fd460798be9af7d4874734f934afa47742f29 ]
get_perf_callchain() and get_callchain_entry_for_task() store a trace in a
per-CPU entry, one per context. They release the entry before they return
it. Thus a second user in the same context can write to the entry while the
first user reads it. preempt_disable() stops only other tasks.
__bpf_get_stack() requests at most max_depth frames. This is skip plus the
frames that fit in the buffer, but not more than perf_event_max_stack.
Since the commit below, it copies 'trace->nr - skip' frames with no limit.
But a second user can store a longer trace. The unwinders of PowerPC add
context markers that max_depth does not limit. In both cases the copy
writes after the end of the buffer.
Read trace->nr one time. Clamp the value to max_depth before the skip test,
as __bpf_get_stack_pe() does. Thus when max_depth is less than skip, the
helper returns -EFAULT, and 'trace_nr - skip' does not underflow. The
copied frames can still be those of the second user.
Fixes: e17d62fedd10 ("bpf: Refactor stack map trace depth calculation into helper function")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-2-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/stackmap.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 2749985910855..f56333c9a8053 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -706,14 +706,20 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
crosstask, false);
}
- if (unlikely(!trace) || trace->nr < skip) {
- if (may_fault)
- rcu_read_unlock();
- preempt_enable();
- goto err_fault;
- }
+ if (unlikely(!trace))
+ goto err_unlock;
+
+ /*
+ * trace->nr can be above max_depth. The per-CPU entry is released
+ * already: a tracing program or an NMI which takes a callchain in the
+ * same context before the copy below reuses it. And the unwinders of
+ * PowerPC store context markers on top of max_depth.
+ */
+ trace_nr = min_t(u32, READ_ONCE(trace->nr), max_depth);
+ if (trace_nr < skip)
+ goto err_unlock;
- trace_nr = callchain_store(trace, trace->nr, buf, elem_size, flags);
+ trace_nr = callchain_store(trace, trace_nr, buf, elem_size, flags);
/* trace should not be dereferenced after this point */
if (may_fault)
@@ -722,6 +728,10 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
return callchain_finalize(buf, size, trace_nr, elem_size, flags, may_fault);
+err_unlock:
+ if (may_fault)
+ rcu_read_unlock();
+ preempt_enable();
err_fault:
err = -EFAULT;
clear:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 111/990] bpf: Avoid changing callchain in bpf_get_stackid_pe
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (109 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 110/990] bpf: Clamp the trace length in __bpf_get_stack() again Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 112/990] bpf: Clamp the trace length before the skip test in stackid_init() Greg Kroah-Hartman
` (741 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jiri Olsa, Andrii Nakryiko,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <jolsa@kernel.org>
[ Upstream commit a74594607a0b310c1533e713b9097cc1cbbb85bf ]
There's no need to modify the trace object bpf_get_stackid_pe, we just
need to pass the needed callchain length in separate argument.
This way we can have callchain pointers const and remove the trace->nr
modification and restoration.
Assisted-by: Codex:GPT-5.5
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260803210149.296496-13-jolsa@kernel.org
Stable-dep-of: a08ba2ab79df ("bpf: Clamp the trace length before the skip test in stackid_init()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/stackmap.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index f56333c9a8053..128c8d61070e4 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -386,7 +386,7 @@ get_callchain_entry_for_task(struct task_struct *task, u32 max_depth)
struct stackid {
struct stack_map_bucket *bucket;
- u64 *ips;
+ const u64 *ips;
u32 nr;
u32 len;
u32 hash;
@@ -395,21 +395,21 @@ struct stackid {
};
static int stackid_init(struct stackid *stackid, struct bpf_map *map,
- struct perf_callchain_entry *trace, u64 flags)
+ const struct perf_callchain_entry *trace, u32 trace_nr, u64 flags)
{
struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);
u32 skip = flags & BPF_F_SKIP_FIELD_MASK;
u32 max_depth;
- if (trace->nr <= skip)
+ if (trace_nr <= skip)
/* skipping more than usable stack trace */
return -EFAULT;
max_depth = stack_map_calculate_max_depth(map->value_size, stack_map_data_size(map), flags);
- stackid->nr = min_t(u32, trace->nr - skip, max_depth - skip);
+ stackid->nr = min_t(u32, trace_nr - skip, max_depth - skip);
stackid->len = stackid->nr * sizeof(u64);
stackid->ips = trace->ip + skip;
- stackid->hash = jhash2((u32 *)stackid->ips, stackid->len / sizeof(u32), 0);
+ stackid->hash = jhash2((const u32 *)stackid->ips, stackid->len / sizeof(u32), 0);
stackid->id = stackid->hash & (smap->n_buckets - 1);
stackid->bucket = READ_ONCE(smap->buckets[stackid->id]);
stackid->hash_matches = stackid->bucket && stackid->bucket->hash == stackid->hash;
@@ -417,11 +417,12 @@ static int stackid_init(struct stackid *stackid, struct bpf_map *map,
}
static int stackid_fastpath(struct stackid *stackid, struct bpf_map *map,
- struct perf_callchain_entry *trace, u64 flags)
+ const struct perf_callchain_entry *trace, u32 trace_nr,
+ u64 flags)
{
int err;
- err = stackid_init(stackid, map, trace, flags);
+ err = stackid_init(stackid, map, trace, trace_nr, flags);
if (err)
return err;
@@ -520,7 +521,7 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map,
/* couldn't fetch the stack trace */
return -EFAULT;
- err = stackid_fastpath(&stackid, map, trace, flags);
+ err = stackid_fastpath(&stackid, map, trace, trace->nr, flags);
if (err != -ENOENT)
return err;
@@ -556,12 +557,13 @@ static __u64 count_kernel_ip(const struct perf_callchain_entry *trace)
BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx,
struct bpf_map *, map, u64, flags)
{
+ const struct perf_callchain_entry *trace;
struct perf_event *event = ctx->event;
struct stack_map_bucket *new_bucket;
- struct perf_callchain_entry *trace;
struct stackid stackid;
bool kernel, user;
__u64 nr_kernel;
+ u32 trace_nr;
int ret;
/* perf_sample_data doesn't have callchain, use bpf_get_stackid */
@@ -581,13 +583,13 @@ BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx,
return -EFAULT;
nr_kernel = count_kernel_ip(trace);
- __u64 nr = trace->nr; /* save original */
if (kernel) {
- trace->nr = nr_kernel;
+ trace_nr = nr_kernel;
} else { /* user */
u64 skip = flags & BPF_F_SKIP_FIELD_MASK;
+ trace_nr = trace->nr;
skip += nr_kernel;
if (skip > BPF_F_SKIP_FIELD_MASK)
return -EFAULT;
@@ -595,21 +597,14 @@ BPF_CALL_3(bpf_get_stackid_pe, struct bpf_perf_event_data_kern *, ctx,
flags = (flags & ~BPF_F_SKIP_FIELD_MASK) | skip;
}
- ret = stackid_fastpath(&stackid, map, trace, flags);
+ ret = stackid_fastpath(&stackid, map, trace, trace_nr, flags);
if (ret != -ENOENT)
- goto out;
+ return ret;
new_bucket = stackid_new_bucket(&stackid, map);
- if (new_bucket) {
- trace->nr = nr;
+ if (new_bucket)
return stackid_install(&stackid, map, new_bucket, flags);
- }
- ret = -ENOMEM;
-
-out:
- /* restore nr */
- trace->nr = nr;
- return ret;
+ return -ENOMEM;
}
const struct bpf_func_proto bpf_get_stackid_proto_pe = {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 112/990] bpf: Clamp the trace length before the skip test in stackid_init()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (110 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 111/990] bpf: Avoid changing callchain in bpf_get_stackid_pe Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 113/990] bpf: Refuse to map an arena at address 0 Greg Kroah-Hartman
` (740 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 a08ba2ab79dffd92c32d3f2dadfc7eba03625a2b ]
stackid_init() gives a bucket of the stack map
min(trace_nr - skip, max_depth - skip) trace entries. Here max_depth is the
size of a bucket plus skip, but at most perf_event_max_stack. Context
markers can make trace_nr larger than that, so the skip test can pass when
max_depth < skip. Then 'max_depth - skip' wraps, and the kernel can write
after the bucket.
Clamp trace_nr to max_depth before the skip test, as __bpf_get_stack_pe()
does. The result changes only when skip >= max_depth. Then it is -EFAULT.
Until now skip == max_depth could give the id of an empty trace.
get_perf_callchain() releases the trace, so an NMI can change trace->nr.
Use READ_ONCE() in bpf_get_stackid(), so the compiler reads it one time.
Fixes: 23f852daa4ba ("bpf: Fix stackmap overflow check in __bpf_get_stackid()")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-3-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/stackmap.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 128c8d61070e4..aa87e8d2d7d2e 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -401,12 +401,14 @@ static int stackid_init(struct stackid *stackid, struct bpf_map *map,
u32 skip = flags & BPF_F_SKIP_FIELD_MASK;
u32 max_depth;
+ max_depth = stack_map_calculate_max_depth(map->value_size, stack_map_data_size(map), flags);
+ /* trace_nr can be above max_depth and max_depth below skip: clamp first */
+ trace_nr = min_t(u32, trace_nr, max_depth);
if (trace_nr <= skip)
/* skipping more than usable stack trace */
return -EFAULT;
- max_depth = stack_map_calculate_max_depth(map->value_size, stack_map_data_size(map), flags);
- stackid->nr = min_t(u32, trace_nr - skip, max_depth - skip);
+ stackid->nr = trace_nr - skip;
stackid->len = stackid->nr * sizeof(u64);
stackid->ips = trace->ip + skip;
stackid->hash = jhash2((const u32 *)stackid->ips, stackid->len / sizeof(u32), 0);
@@ -521,7 +523,8 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map,
/* couldn't fetch the stack trace */
return -EFAULT;
- err = stackid_fastpath(&stackid, map, trace, trace->nr, flags);
+ /* the entry is released already, an NMI can change trace->nr */
+ err = stackid_fastpath(&stackid, map, trace, READ_ONCE(trace->nr), flags);
if (err != -ENOENT)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 113/990] bpf: Refuse to map an arena at address 0
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (111 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 112/990] bpf: Clamp the trace length before the skip test in stackid_init() Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 114/990] bpf: Refuse an arena mmap() longer than max_entries pages Greg Kroah-Hartman
` (739 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 ca580b034380fa9a69cc973637d1859ec4f5b344 ]
The first mmap() of an arena sets user_vm_start and user_vm_end. Each
subsequent mmap() must use the same range. The value 0 in user_vm_start
means that the range is not set, but a mapping can start at address 0. Then
arena_map_mmap() does not check vm_start and sets user_vm_start again. The
range tree counts pages from user_vm_start. With a new user_vm_start it
reports allocated pages as free, and apply_range_set_cb() fails with
-EBUSY.
An arena at address 0 is not useful, because the verifier rejects all progs
that refer to it. Return -EINVAL from arena_get_unmapped_area(). It runs
before mmap() removes the old mappings in the range.
Fixes: 317460317a02 ("bpf: Introduce bpf_arena.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-4-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/arena.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
index 51227c8d2b1e4..d1f0a7222d941 100644
--- a/kernel/bpf/arena.c
+++ b/kernel/bpf/arena.c
@@ -349,6 +349,9 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long ad
ret = mm_get_unmapped_area(current->mm, filp, addr, len * 2, 0, flags);
if (IS_ERR_VALUE(ret))
return ret;
+ if (!ret)
+ /* user_vm_start == 0 means that the user range is not set yet */
+ return -EINVAL;
if ((ret >> 32) == ((ret + len - 1) >> 32))
return ret;
if (WARN_ON_ONCE(arena->user_vm_start))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 114/990] bpf: Refuse an arena mmap() longer than max_entries pages
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (112 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 113/990] bpf: Refuse to map an arena at address 0 Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 115/990] bpf: Remove the WARN from arena_get_unmapped_area() Greg Kroah-Hartman
` (738 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 1e01345b87f13c354687360cb81ed2a521ff2b13 ]
arena_map_alloc() puts max_entries free pages in the range tree of an
arena. But the arena kfuncs check their arguments against user_vm_start and
user_vm_end. Without map_extra, arena_map_mmap() takes both from the first
vma. This vma can be up to 4 GiB long. Then arena_free_pages() also marks
pages as free that were never in the range tree. Thus max_entries does not
limit the memory of the arena, but these pages are inside kern_vm.
Refuse an mmap() longer than max_entries pages with -E2BIG. With map_extra
this limit exists already. libbpf always maps max_entries pages. Replace
both SZ_4G checks with this limit, because it is at most 4 GiB.
Fixes: 317460317a02 ("bpf: Introduce bpf_arena.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-6-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/arena.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
index d1f0a7222d941..b3c70596c576e 100644
--- a/kernel/bpf/arena.c
+++ b/kernel/bpf/arena.c
@@ -333,7 +333,7 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long ad
if (pgoff)
return -EINVAL;
- if (len > SZ_4G)
+ if (len > (u64)map->max_entries * PAGE_SIZE)
return -E2BIG;
/* if user_vm_start was specified at arena creation time */
@@ -381,7 +381,7 @@ static int arena_map_mmap(struct bpf_map *map, struct vm_area_struct *vma)
return -EBUSY;
/* Earlier checks should prevent this */
- if (WARN_ON_ONCE(vma->vm_end - vma->vm_start > SZ_4G || vma->vm_pgoff))
+ if (WARN_ON_ONCE(vma_pages(vma) > map->max_entries || vma->vm_pgoff))
return -EFAULT;
if (remember_vma(arena, vma))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 115/990] bpf: Remove the WARN from arena_get_unmapped_area()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (113 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 114/990] bpf: Refuse an arena mmap() longer than max_entries pages Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 116/990] bpf: Require prog fd or capability for cgroup detach Greg Kroah-Hartman
` (737 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 15dedd4b259289bffb8a5485b81722fdaebac71a ]
The user range of an arena must not cross a 4 GiB boundary. Thus
arena_get_unmapped_area() asks the mm for 2 * len bytes and rounds the
result up if necessary. If user_vm_start is not 0, addr must be equal to
it. A WARN_ON_ONCE() assumes that the mm returns addr. But addr is only a
hint without MAP_FIXED, and the mm can return a different range that
crosses a boundary. This is not a kernel bug.
Remove the WARN_ON_ONCE() and its -EFAULT. arena_map_mmap() already
compares vm_start with user_vm_start under arena->lock. If the rounded
result is user_vm_start, mmap() succeeds. If not, it returns -EBUSY.
Fixes: 317460317a02 ("bpf: Introduce bpf_arena.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-7-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/arena.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
index b3c70596c576e..3d3bad292bad0 100644
--- a/kernel/bpf/arena.c
+++ b/kernel/bpf/arena.c
@@ -354,9 +354,6 @@ static unsigned long arena_get_unmapped_area(struct file *filp, unsigned long ad
return -EINVAL;
if ((ret >> 32) == ((ret + len - 1) >> 32))
return ret;
- if (WARN_ON_ONCE(arena->user_vm_start))
- /* checks at map creation time should prevent this */
- return -EFAULT;
return round_up(ret, SZ_4G);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 116/990] bpf: Require prog fd or capability for cgroup detach
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (114 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 115/990] bpf: Remove the WARN from arena_get_unmapped_area() Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 117/990] bpf, cgroup: Keep the skb network offset signed Greg Kroah-Hartman
` (736 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 2962329f7c86fc51c177d4049c0f15a95ebd270c ]
Since the commit below a cgroup prog detach does not require CAP_NET_ADMIN.
The fd of the attached prog gives the permission instead. But the detach
requires this fd only with BPF_F_ALLOW_MULTI. Without this flag a cgroup
has only one prog per attach type. Then find_detach_entry() returns this
prog and does not compare it with the prog of the caller. Thus the kernel
detaches this prog for a caller with neither the fd nor a capability.
Compare the two progs. If they are different, require CAP_NET_ADMIN or
CAP_SYS_ADMIN in the initial user namespace. The error is -EPERM. A detach
from tcx or netkit without a prog fd already requires these capabilities.
With BPF_F_ALLOW_MULTI nothing changes.
Without these capabilities, a caller of bpf_prog_detach() of libbpf must
now use bpf_prog_detach2() with the fd of the attached prog.
Fixes: 2c78ee898d8f ("bpf: Implement CAP_BPF")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-14-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/cgroup.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index c652ba01bc8bd..9223d76774f21 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -1125,9 +1125,14 @@ static struct bpf_prog_list *find_detach_entry(struct hlist_head *progs,
return ERR_PTR(-ENOENT);
/* to maintain backward compatibility NONE and OVERRIDE cgroups
- * allow detaching with invalid FD (prog==NULL) in legacy mode
+ * allow detaching with invalid FD (prog==NULL) in legacy mode.
+ * Without the FD of the attached program the caller needs
+ * CAP_NET_ADMIN or CAP_SYS_ADMIN in the initial user namespace.
*/
- return hlist_entry(progs->first, typeof(*pl), node);
+ pl = hlist_entry(progs->first, typeof(*pl), node);
+ if (pl->prog != prog && !bpf_net_capable())
+ return ERR_PTR(-EPERM);
+ return pl;
}
if (!prog && !link)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 117/990] bpf, cgroup: Keep the skb network offset signed
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (115 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 116/990] bpf: Require prog fd or capability for cgroup detach Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 118/990] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS Greg Kroah-Hartman
` (735 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 3f9780d62dd1112ca15b5ae73568d29d42ccc950 ]
cgroup_skb progs see a packet from its network header. While they run,
__cgroup_bpf_run_filter_skb() moves skb->data there. It assumes that the
network header is not after skb->data. It negates skb_network_offset(skb)
and pushes skb->data by this offset. The offset is an unsigned int.
But ip6mr_cache_report() and bpf_lwt_xmit_reroute() can pass an skb that
has data before the network header. Then the offset wraps. On a 64-bit
kernel skb->data is then far below skb->head.
skb->len has 32 bits and wraps to the correct value, thus only skb->data is
wrong. A read of packet data faults or gets other memory.
Keep the offset in an int. Pull skb->data when the network header is after
it. Otherwise push it, as today.
Fixes: 3007098494be ("cgroup: add support for eBPF programs")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-15-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/cgroup.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index 9223d76774f21..14521bd99c7a8 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -1630,7 +1630,7 @@ int __cgroup_bpf_run_filter_skb(struct sock *sk,
struct sk_buff *skb,
enum cgroup_bpf_attach_type atype)
{
- unsigned int offset = -skb_network_offset(skb);
+ int offset = skb_network_offset(skb);
struct sock *save_sk;
void *saved_data_end;
struct cgroup *cgrp;
@@ -1642,7 +1642,15 @@ int __cgroup_bpf_run_filter_skb(struct sock *sk,
cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data);
save_sk = skb->sk;
skb->sk = sk;
- __skb_push(skb, offset);
+
+ /*
+ * The program sees the packet from its network header on, on
+ * whichever side of skb->data that header lies.
+ */
+ if (offset > 0)
+ __skb_pull(skb, offset);
+ else
+ __skb_push(skb, -offset);
/* compute pointers for the bpf prog */
bpf_compute_and_save_data_end(skb, &saved_data_end);
@@ -1684,7 +1692,10 @@ int __cgroup_bpf_run_filter_skb(struct sock *sk,
ret = -EFAULT;
}
bpf_restore_data_end(skb, saved_data_end);
- __skb_pull(skb, offset);
+ if (offset > 0)
+ __skb_push(skb, offset);
+ else
+ __skb_pull(skb, -offset);
skb->sk = save_sk;
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 118/990] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (116 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 117/990] bpf, cgroup: Keep the skb network offset signed Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 119/990] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6 Greg Kroah-Hartman
` (734 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 6d8118937ba477e03fa2e94e9bd9abac7291a2a2 ]
When bpf_skb_adjust_room() shrinks a TCP GSO skb, it adds the number of
removed bytes to gso_size. gso_size has 16 bits, and nothing checks the
sum. Thus gso_size can wrap to 0 or to a small size, or it can be
GSO_BY_FRAGS. GSO_BY_FRAGS is not a size. It tells skb_segment() to read
the length of each segment from the frag_list. If the TCP GSO skb has no
frag_list, skb_segment() dereferences a NULL pointer.
Return -ENOTSUPP and do not change the skb if the sum is GSO_BY_FRAGS or
larger. With BPF_F_ADJ_ROOM_FIXED_GSO the helper does not change gso_size,
so it shrinks the skb as before.
Fixes: 2be7e212d541 ("bpf: add bpf_skb_adjust_room helper")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-16-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 8f92e2bf85517..9463c10d0c907 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3701,6 +3701,14 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff,
return -ENOTSUPP;
}
+ /*
+ * The MSS is raised by len_diff. It has 16 bits, and GSO_BY_FRAGS is
+ * not a size.
+ */
+ if (skb_is_gso(skb) && !(flags & BPF_F_ADJ_ROOM_FIXED_GSO) &&
+ skb_shinfo(skb)->gso_size + len_diff >= GSO_BY_FRAGS)
+ return -ENOTSUPP;
+
ret = skb_unclone(skb, GFP_ATOMIC);
if (unlikely(ret < 0))
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 119/990] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (117 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 118/990] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 120/990] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
` (733 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 58e39f8d58b141b96c030008a20dde9d625ec997 ]
The mode BPF_LWT_ENCAP_SEG6 of bpf_lwt_push_encap() pushes an IPv6 header
and an SRH, and it replaces the dst. The SRH says that IPv6 follows, and
skb->protocol does not change. Thus the mode assumes an IPv6 packet, but an
lwt_in prog also runs for IPv4 packets. After the prog, bpf_input() calls
orig_input() of the old dst. This IPv4 handler reads the pushed headers as
IPv4. It can write after the packet data, and the kernel crashes.
after the push orig_input() expects
--------------------- --------------------
skb->protocol ETH_P_IP ETH_P_IP
dst rt6_info rtable
packet | IPv6 | SRH | IPv4 | | IPv4 |
The mode BPF_LWT_ENCAP_SEG6_INLINE returns -EBADMSG for non-IPv6 packets.
Apply this check to both modes. End.BPF does not change, because
seg6_local_input() drops non-IPv6 packets.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-17-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 9463c10d0c907..2df3e5cfc3fcd 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6611,11 +6611,15 @@ static int bpf_push_seg6_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len
if (!seg6_validate_srh(srh, len, false))
return -EINVAL;
+ /*
+ * The encap mode names IPv6 as the inner protocol, and neither mode
+ * updates skb->protocol.
+ */
+ if (skb->protocol != htons(ETH_P_IPV6))
+ return -EBADMSG;
+
switch (type) {
case BPF_LWT_ENCAP_SEG6_INLINE:
- if (skb->protocol != htons(ETH_P_IPV6))
- return -EBADMSG;
-
err = seg6_do_srh_inline(skb, srh);
break;
case BPF_LWT_ENCAP_SEG6:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 120/990] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (118 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 119/990] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6 Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 121/990] bpf: Dont look for the SRH again in the End.BPF helpers Greg Kroah-Hartman
` (732 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit ac159f39b252971141c49b68a27de0b637debfad ]
bpf_lwt_seg6_adjust_srh() lets an End.BPF prog change the size of the TLVs
in the SRH. The helper keeps the SRH length in srh_state->hdrlen, in bytes
and without the first 8 bytes. Later seg6_bpf_has_valid_srh() writes it to
srh->hdrlen, an 8-bit field in units of 8 bytes. But srh_state->hdrlen has
no upper limit, and the cast to u8 can truncate it. After that,
seg6_validate_srh() gets the SRH length from srh->hdrlen, and thus it can
accept the SRH. Then srh->hdrlen is too small, and a parser reads TLVs as
the subsequent header.
Return -EFAULT when the new srh_state->hdrlen is larger than 2040, the
largest length that srh->hdrlen can hold. To replace a TLV in the largest
SRH, a prog can no longer add bytes first. It must remove bytes first.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-19-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/filter.c b/net/core/filter.c
index 2df3e5cfc3fcd..a40e3641ec9b4 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6863,6 +6863,9 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
return -EFAULT;
if (unlikely(len < 0 && (void *)((char *)ptr - len) > srh_end))
return -EFAULT;
+ /* The length field of the SRH has 8 bits, in units of 8 bytes. */
+ if (unlikely(len > (U8_MAX << 3) - srh_state->hdrlen))
+ return -EFAULT;
if (len > 0) {
ret = skb_cow_head(skb, len);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 121/990] bpf: Dont look for the SRH again in the End.BPF helpers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (119 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 120/990] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 122/990] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
` (731 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 45bcc58d576705d2c001332766e10313f1c55bad ]
A packet can have two SRHs. Thus input_action_end_bpf() uses
IP6_FH_F_SKIP_RH to skip routing headers with segments_left 0. The helpers
bpf_lwt_seg6_store_bytes() and bpf_lwt_seg6_adjust_srh() can reallocate the
head of the skb. Thus they look for the SRH again, but without this flag.
+------------------------+ <- the helpers: srh_state->srh
| SRH 1, segments_left 0 |
+------------------------+ <- input_action_end_bpf(): srh_state->srh
| SRH 2 | and srh_state->hdrlen
+------------------------+
Then the helpers check offset against the wrong limits. If a helper changes
TLVs, seg6_bpf_has_valid_srh() writes the length of SRH 2 to SRH 1.
Neither helper changes the offset of the SRH from skb->data. Calculate the
new address from this offset. To add IP6_FH_F_SKIP_RH is not sufficient,
because advance_nextseg() can set segments_left of SRH 2 to 0. The helper
bpf_lwt_seg6_action() can change the headers and still looks for the SRH.
Fixes: fbbc5bc2ab8c ("seg6: ignore routing header with segments left equal to 0")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-20-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index a40e3641ec9b4..50245c98d8aee 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6708,12 +6708,13 @@ BPF_CALL_4(bpf_lwt_seg6_store_bytes, struct sk_buff *, skb, u32, offset,
this_cpu_ptr(&seg6_bpf_srh_states);
struct ipv6_sr_hdr *srh = srh_state->srh;
void *srh_tlvs, *srh_end, *ptr;
- int srhoff = 0;
+ int srhoff;
lockdep_assert_held(&srh_state->bh_lock);
if (srh == NULL)
return -EINVAL;
+ srhoff = (unsigned char *)srh - skb->data;
srh_tlvs = (void *)((char *)srh + ((srh->first_segment + 1) << 4));
srh_end = (void *)((char *)srh + sizeof(*srh) + srh_state->hdrlen);
@@ -6726,8 +6727,7 @@ BPF_CALL_4(bpf_lwt_seg6_store_bytes, struct sk_buff *, skb, u32, offset,
if (unlikely(bpf_try_make_writable(skb, offset + len)))
return -EFAULT;
- if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, NULL) < 0)
- return -EINVAL;
+ /* The head may have moved. */
srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
memcpy(skb->data + offset, from, len);
@@ -6846,13 +6846,14 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
struct ipv6_sr_hdr *srh = srh_state->srh;
void *srh_end, *srh_tlvs, *ptr;
struct ipv6hdr *hdr;
- int srhoff = 0;
+ int srhoff;
int ret;
lockdep_assert_held(&srh_state->bh_lock);
if (unlikely(srh == NULL))
return -EINVAL;
+ srhoff = (unsigned char *)srh - skb->data;
srh_tlvs = (void *)((unsigned char *)srh + sizeof(*srh) +
((srh->first_segment + 1) << 4));
srh_end = (void *)((unsigned char *)srh + sizeof(*srh) +
@@ -6884,8 +6885,7 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
hdr = (struct ipv6hdr *)skb->data;
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
- if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, NULL) < 0)
- return -EINVAL;
+ /* The bytes in front of offset have moved together with skb->data. */
srh_state->srh = (struct ipv6_sr_hdr *)(skb->data + srhoff);
srh_state->hdrlen += len;
srh_state->valid = false;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 122/990] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (120 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 121/990] bpf: Dont look for the SRH again in the End.BPF helpers Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 123/990] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap() Greg Kroah-Hartman
` (730 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 0fcb3f11a93d740e7f9ae1aeb48fe4d25838be18 ]
bpf_skb_net_hdr_push() and bpf_skb_net_hdr_pop() change skb->data and
skb->mac_header by len. That is correct in a tc prog, where skb->data is
the MAC header. But bpf_lwt_seg6_adjust_srh() calls them in an End.BPF
prog, where skb->data is the network header. The MAC header does not move:
before push | free | MAC header | IPv6 | SRH | payload
^ head ^ mac_header ^ data
today | free | MAC h| IPv6 | SRH + len | payload
^ head ^ mac_header ^ data
this patch | free | MAC header | IPv6 | SRH + len | payload
^ head ^ mac_header ^ data
Users of skb_mac_header() get incorrect bytes until __dev_queue_xmit() sets
skb->mac_header again. skb_cow_head() reserves only len bytes. Thus the
16-bit offset skb->mac_header can wrap. A push also changes the "not set"
value. In both cases skb_mac_header() points after the skb.
Move the MAC header too. Pass len + skb->mac_len to skb_cow_head(). Keep
the "not set" value. The second Fixes tag is for this case. Since that
commit an End.BPF prog can get an skb with skb->mac_header not set.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Fixes: 20a081b7984c ("seg6: add VRF support for SRv6 End.DT6 behavior")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-21-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 50245c98d8aee..84d5d7e456889 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6843,6 +6843,7 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
{
struct seg6_bpf_srh_state *srh_state =
this_cpu_ptr(&seg6_bpf_srh_states);
+ bool mac_set = skb_mac_header_was_set(skb);
struct ipv6_sr_hdr *srh = srh_state->srh;
void *srh_end, *srh_tlvs, *ptr;
struct ipv6hdr *hdr;
@@ -6868,20 +6869,38 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
if (unlikely(len > (U8_MAX << 3) - srh_state->hdrlen))
return -EFAULT;
+ /*
+ * skb->data is the network header here. The MAC header is in front of
+ * it, so bpf_skb_net_hdr_push() and bpf_skb_net_hdr_pop() do not move
+ * it with the other headers.
+ */
if (len > 0) {
- ret = skb_cow_head(skb, len);
+ ret = skb_cow_head(skb, len + skb->mac_len);
if (unlikely(ret < 0))
return ret;
+ /* The push can write over the MAC header, so move it first. */
+ if (mac_set)
+ memmove(skb->data - len - skb->mac_len,
+ skb_mac_header(skb), skb->mac_len);
ret = bpf_skb_net_hdr_push(skb, offset, len);
} else {
ret = bpf_skb_net_hdr_pop(skb, offset, -1 * len);
+ /* The pop has added -len to skb->mac_header. */
+ if (likely(!ret) && mac_set)
+ memmove(skb->data - skb->mac_len,
+ skb_mac_header(skb) + len, skb->mac_len);
}
bpf_compute_data_pointers(skb);
if (unlikely(ret < 0))
return ret;
+ if (mac_set)
+ skb_set_mac_header(skb, -skb->mac_len);
+ else
+ skb_unset_mac_header(skb);
+
hdr = (struct ipv6hdr *)skb->data;
hdr->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 123/990] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (121 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 122/990] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 124/990] bpf: Reset skb->cb after an lwt prog pushes an IP header Greg Kroah-Hartman
` (729 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 701ffd202b9e32942c8cfc065c9fe76ceaccc302 ]
With BPF_LWT_ENCAP_IP, bpf_lwt_push_encap() pushes a new IP header. The new
header overwrites the MAC header of a received skb. But skb->mac_header
continues to point to the same bytes. Code that reads the MAC header after
the push, for example netfilter, gets bytes of the new header.
before the push | MAC header | old IP | payload
^ mac_header ^ network_header
today | new header | old IP | payload
network_header ^ ^ mac_header
this patch, lwt_in | MAC header | new header | old IP | payload
^ mac_header ^ network_header
this patch, lwt_xmit | new header | old IP | payload
network_header ^ mac_header is not set
For lwt_in, move the MAC header in front of the new header before the
memcpy(), as __seg6_do_srh_encap() does. skb_cow_head() already reserves
len + skb->mac_len bytes.
For lwt_xmit, the output path makes a new MAC header. Thus mark
skb->mac_header as not set. This is the state of a locally generated skb.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-22-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 953237bca36b6..7e011fd3a60ff 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -645,6 +645,14 @@ int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len, bool ingress)
if (ingress)
skb_postpush_rcsum(skb, iph, len);
skb_reset_network_header(skb);
+ /*
+ * The new header goes over the MAC header. On ingress move it first.
+ * On egress the packet gets a new one, so forget the old one.
+ */
+ if (ingress)
+ skb_mac_header_rebuild(skb);
+ else
+ skb_unset_mac_header(skb);
if (is_udp_tunnel) {
size_t iph_sz = ipv4 ? iph->ihl * 4 : sizeof(struct ipv6hdr);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 124/990] bpf: Reset skb->cb after an lwt prog pushes an IP header
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (122 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 123/990] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap() Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 125/990] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol Greg Kroah-Hartman
` (728 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiang Mei, Daniel Borkmann,
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 b3ad42f6183286ab376389a5d26edf7ee3bdba27 ]
IPCB(skb)->opt holds the offsets from the network header to the IPv4
options. But bpf_lwt_push_ip_encap() moves the network header and does not
change IPCB(skb). Then ip_forward_options() and __ip_options_echo() use the
old offsets on the pushed header. Thus the kernel corrupts the skb and the
stack. If the family changes, the kernel also reads IP6CB(skb) as
IPCB(skb), or the reverse. With CONFIG_IPV6_MIP6, it reads IPSKB_FORWARDED
as frag_max_size and adds a needless fragment header.
Reset skb->cb after the prog. bpf_lwt_push_ip_encap() cannot do it, because
bpf_prog_run_save_cb() can restore skb->cb. For IPv4 in IPv4, clear
IPCB(skb)->opt as ip_tunnel_xmit() does. If the family changes, clear the
cb of the new family but keep iif, because ip6_forward() gets the input
device from it. Behind a VRF, skb->skb_iif is the VRF device and cannot
replace iif. Do nothing for IPv6 in IPv6, as in seg6_do_srh_encap().
Do the reset in bpf_input() only after a push. Without a push,
ip_forward_options() needs the offsets. Do it in bpf_xmit() before each
reroute, because an lwt_xmit prog can also change the options. Thus after a
reroute without a push, ip_options_fragment() leaves the options in all
fragments, and ICMP errors echo none. After BPF_OK or BPF_REDIRECT the skb
goes to a device, thus bpf_xmit() does no reset. The inner IPv4 checksum
can still be wrong after ip_rcv_options() changes an option.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Reported-by: Xiang Mei <xmei5@asu.edu>
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-23-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 7e011fd3a60ff..f215978d10a3b 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -86,6 +86,32 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,
return ret;
}
+/*
+ * skb->cb still describes the IP header that was the first one before the
+ * prog ran. The option offsets in IPCB(skb)->opt are wrong for a pushed
+ * header, and a header of the other family needs the other layout. iif
+ * stays: behind a VRF skb->skb_iif is the L3 master and not the port.
+ * bpf_lwt_push_encap() cannot do this, because bpf_prog_run_save_cb() can
+ * restore skb->cb after the prog.
+ */
+static void bpf_lwt_reset_cb(struct sk_buff *skb, __be16 proto)
+{
+ int iif;
+
+ if (skb->protocol == proto) {
+ if (proto == htons(ETH_P_IP))
+ memset(&IPCB(skb)->opt, 0, sizeof(IPCB(skb)->opt));
+ } else if (skb->protocol == htons(ETH_P_IP)) {
+ iif = IP6CB(skb)->iif;
+ memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
+ IPCB(skb)->iif = iif;
+ } else {
+ iif = IPCB(skb)->iif;
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
+ IP6CB(skb)->iif = iif;
+ }
+}
+
static int bpf_lwt_input_reroute(struct sk_buff *skb)
{
enum skb_drop_reason reason;
@@ -120,6 +146,8 @@ static int bpf_lwt_input_reroute(struct sk_buff *skb)
static int bpf_input(struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
+ __be16 proto = skb->protocol;
+ unsigned int len = skb->len;
struct bpf_lwt *bpf;
int ret;
@@ -128,6 +156,9 @@ static int bpf_input(struct sk_buff *skb)
ret = run_lwt_bpf(skb, &bpf->in, dst, NO_REDIRECT);
if (ret < 0)
return ret;
+ /* An lwt_in prog can change the length only with a push. */
+ if (skb->len != len)
+ bpf_lwt_reset_cb(skb, proto);
if (ret == BPF_LWT_REROUTE)
return bpf_lwt_input_reroute(skb);
}
@@ -307,6 +338,8 @@ static int bpf_xmit(struct sk_buff *skb)
case BPF_REDIRECT:
return LWTUNNEL_XMIT_DONE;
case BPF_LWT_REROUTE:
+ /* An lwt_xmit prog can also write to the options. */
+ bpf_lwt_reset_cb(skb, proto);
return bpf_lwt_xmit_reroute(skb);
default:
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 125/990] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (123 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 124/990] bpf: Reset skb->cb after an lwt prog pushes an IP header Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 126/990] bpf: Move the transport header with the moved headers Greg Kroah-Hartman
` (727 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 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 d9618a6196953718f7470de5d2e84121bed063f7 ]
When an lwt_in prog returns BPF_OK, bpf_input() calls orig_input(), the
input handler of the route. This handler is for one IP version and needs a
dst of the same family. But BPF_LWT_ENCAP_IP lets the prog push a header of
the other IP version and thus change skb->protocol. Then the handler reads
and changes a header of the other IP version. The push of an SRH also
replaces the dst, because seg6_lookup_nexthop() puts an rt6_info into the
skb. Then ip_forward() uses the rt6_info as a struct rtable.
Drop the skb with -EINVAL when skb->protocol changes, as bpf_xmit() does.
Drop it also when the family of the dst changes, because skb->protocol does
not always show this change. Today no such skb leaves as the prog made it.
A prog works as before if it returns BPF_LWT_REROUTE, or if it pushes an
SRH on an IPv6 route.
The commit in the first Fixes tag lets a prog change skb->protocol. The
commit in the second tag adds the check to bpf_xmit() only.
Fixes: 52f278774e79 ("bpf: implement BPF_LWT_ENCAP_IP mode in bpf_lwt_push_encap")
Fixes: 3bd0b15281af ("bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-24-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index f215978d10a3b..982599bb41c97 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -161,6 +161,16 @@ static int bpf_input(struct sk_buff *skb)
bpf_lwt_reset_cb(skb, proto);
if (ret == BPF_LWT_REROUTE)
return bpf_lwt_input_reroute(skb);
+ /*
+ * orig_input() is for the old protocol only, see bpf_xmit().
+ * It also needs a dst of the old family. BPF_LWT_ENCAP_SEG6
+ * puts an IPv6 dst into the skb.
+ */
+ if (skb->protocol != proto ||
+ skb_dst(skb)->ops->family != dst->ops->family) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
}
if (unlikely(!dst->lwtstate->orig_input)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 126/990] bpf: Move the transport header with the moved headers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (124 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 125/990] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 127/990] bpf: Check the offset in bpf_skb_generic_{push,pop}() Greg Kroah-Hartman
` (726 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit a9d08fe60fa728ce0e3a99085241e8e790fb14c6 ]
bpf_skb_net_hdr_pop() removes len bytes at offset off.
bpf_skb_net_hdr_push() does the opposite.
skb->data off
before | A | removed | B |
after | A | B |
skb->data off
mac_header and network_header move with A. transport_header moves only when
it is equal to network_header. inner_transport_header never moves. This is
correct only for a header in B. In bpf_lwt_seg6_adjust_srh()
transport_header is in A. bpf_skb_adjust_room() can remove both transport
headers. With an incorrect header offset, the stack can drop the skb or
read outside of it.
Also move transport_header with A when it is in A. Set it to offset off
when it is in the removed bytes. In BPF_ADJ_ROOM_MAC mode it is then equal
to network_header. Do not unset it, because skb_gso_validate_mac_len() uses
it without a check. After a removal, set inner_transport_header to off when
it is not in B and skb->encapsulation is set. A has only outer headers.
Fixes: fe94cc290f53 ("bpf: Add IPv6 Segment Routing helpers")
Fixes: 868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-26-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 84d5d7e456889..503ca33402840 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3363,9 +3363,25 @@ static int bpf_skb_generic_pop(struct sk_buff *skb, u32 off, u32 len)
return 0;
}
+/*
+ * bpf_skb_net_hdr_push() inserts bytes at @off, bpf_skb_net_hdr_pop() removes
+ * bytes at @off. Both move the bytes in front of @off together with skb->data,
+ * and leave the rest of the packet where it is. Return true if the transport
+ * header is in the part that moves. A transport header that is equal to the
+ * network header stays equal to it.
+ */
+static bool bpf_skb_trans_hdr_moves(const struct sk_buff *skb, u32 off)
+{
+ if (skb->transport_header == skb->network_header)
+ return true;
+
+ return skb_transport_header_was_set(skb) &&
+ (u32)skb_transport_offset(skb) < off;
+}
+
static int bpf_skb_net_hdr_push(struct sk_buff *skb, u32 off, u32 len)
{
- bool trans_same = skb->transport_header == skb->network_header;
+ bool trans_moves = bpf_skb_trans_hdr_moves(skb, off);
int ret;
/* There's no need for __skb_push()/__skb_pull() pair to
@@ -3376,8 +3392,8 @@ static int bpf_skb_net_hdr_push(struct sk_buff *skb, u32 off, u32 len)
if (likely(!ret)) {
skb->mac_header -= len;
skb->network_header -= len;
- if (trans_same)
- skb->transport_header = skb->network_header;
+ if (trans_moves)
+ skb->transport_header -= len;
}
return ret;
@@ -3385,7 +3401,7 @@ static int bpf_skb_net_hdr_push(struct sk_buff *skb, u32 off, u32 len)
static int bpf_skb_net_hdr_pop(struct sk_buff *skb, u32 off, u32 len)
{
- bool trans_same = skb->transport_header == skb->network_header;
+ bool trans_moves = bpf_skb_trans_hdr_moves(skb, off);
int ret;
/* Same here, __skb_push()/__skb_pull() pair not needed. */
@@ -3393,8 +3409,17 @@ static int bpf_skb_net_hdr_pop(struct sk_buff *skb, u32 off, u32 len)
if (likely(!ret)) {
skb->mac_header += len;
skb->network_header += len;
- if (trans_same)
- skb->transport_header = skb->network_header;
+ if (trans_moves) {
+ skb->transport_header += len;
+ } else if (skb_transport_header_was_set(skb) &&
+ skb_transport_offset(skb) < (int)off) {
+ /* It was in the removed bytes or before skb->data. */
+ skb_set_transport_header(skb, off);
+ }
+ /* Do not leave the inner transport header in front of @off. */
+ if (skb->encapsulation &&
+ skb_inner_transport_offset(skb) < (int)off)
+ skb_set_inner_transport_header(skb, off);
}
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 127/990] bpf: Check the offset in bpf_skb_generic_{push,pop}()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (125 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 126/990] bpf: Move the transport header with the moved headers Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 128/990] spi: Fix ACPI SPI resources using relative path Greg Kroah-Hartman
` (725 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit ee36c9aa44ef300cd651074bd97552b229337f85 ]
To make room for len bytes at offset off, bpf_skb_generic_push() moves the
first off bytes and clears len bytes after them. It assumes that the first
off bytes are in the linear part. But in bpf_skb_adjust_room() off can be
the end of the IP header, and this header can be in a frag. Then the
function reads and writes after skb->tail, and can damage skb_shared_info.
bpf_skb_generic_pop() checks off + len, but this u32 sum can wrap to a
small value. bpf_skb_adjust_room() and bpf_skb_change_proto() calculate off
from skb_mac_header_len(). This length is a very large u32 when
network_header < mac_header. Then the check can pass, and memmove() reads
and writes far outside the skb.
Return -ENOMEM from both functions, like the present check, when
off > skb->len. Thus the sum cannot wrap. In bpf_skb_generic_push() also
pull the first off bytes into the linear part. Now bpf_skb_adjust_room()
fails when a prog grows an skb that ends before off. network_header stays
wrong.
Fixes: 6578171a7ff0 ("bpf: add bpf_skb_change_proto helper")
Fixes: 2be7e212d541 ("bpf: add bpf_skb_adjust_room helper")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101190535.1454146-28-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/filter.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 503ca33402840..c6677657656c9 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3330,6 +3330,10 @@ static void bpf_skb_change_protocol(struct sk_buff *skb, u16 proto)
static int bpf_skb_generic_push(struct sk_buff *skb, u32 off, u32 len)
{
+ /* The bytes in front of @off are moved with skb->data. */
+ if (unlikely(off > skb->len || !pskb_may_pull(skb, off)))
+ return -ENOMEM;
+
/* Caller already did skb_cow() with meta_len+len as headroom,
* so no need to do it here.
*/
@@ -3350,9 +3354,10 @@ static int bpf_skb_generic_pop(struct sk_buff *skb, u32 off, u32 len)
void *old_data;
/* skb_ensure_writable() is not needed here, as we're
- * already working on an uncloned skb.
+ * already working on an uncloned skb. The first test
+ * keeps off + len from wrapping.
*/
- if (unlikely(!pskb_may_pull(skb, off + len)))
+ if (unlikely(off > skb->len || !pskb_may_pull(skb, off + len)))
return -ENOMEM;
old_data = skb->data;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 128/990] spi: Fix ACPI SPI resources using relative path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (126 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 127/990] bpf: Check the offset in bpf_skb_generic_{push,pop}() Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 129/990] spi: acpi: only look up the IRQ of confirmed SPI devices Greg Kroah-Hartman
` (724 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alban Bedel, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alban Bedel <alban.bedel@lht.dlh.de>
[ Upstream commit 4825287f6d2346e9273f35a928d1ef40e68bc58b ]
ACPI resources can use relative path when pointing to other
resources. This didn't work with SPISerialBus resources because the
device defining the resource was not passed to acpi_get_handle().
Pass the ACPI device handle through the lookup context to also allow
for relative paths.
Signed-off-by: Alban Bedel <alban.bedel@lht.dlh.de>
Link: https://patch.msgid.link/20261001153507.2011806-1-alban.bedel@lht.dlh.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 2d0953ab69d3 ("spi: acpi: only look up the IRQ of confirmed SPI devices")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b8db8f5fd285d..b447907fba508 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2601,6 +2601,7 @@ EXPORT_SYMBOL_GPL(spi_new_ancillary_device);
#ifdef CONFIG_ACPI
struct acpi_spi_lookup {
struct spi_controller *ctlr;
+ acpi_handle device_handle;
u32 max_speed_hz;
u32 mode;
int irq;
@@ -2695,7 +2696,7 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
if (lookup->index != -1 && lookup->n++ != lookup->index)
return 1;
- status = acpi_get_handle(NULL,
+ status = acpi_get_handle(lookup->device_handle,
sb->resource_source.string_ptr,
&parent_handle);
@@ -2787,6 +2788,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
return ERR_PTR(-EINVAL);
lookup.ctlr = ctlr;
+ lookup.device_handle = acpi_device_handle(adev);
lookup.irq = -1;
lookup.index = index;
lookup.n = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 129/990] spi: acpi: only look up the IRQ of confirmed SPI devices
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (127 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 128/990] spi: Fix ACPI SPI resources using relative path Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 130/990] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom Greg Kroah-Hartman
` (723 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rosen Penev, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 2d0953ab69d316589624b0517fdce01f8e630bf0 ]
When an SPI controller is registered, acpi_register_spi_device() is
called for every present ACPI device in the namespace and
acpi_spi_device_alloc() walks each device's _CRS. While doing so,
acpi_spi_add_resource() converts the first interrupt resource it finds,
even for devices that have no SpiSerialBus resource at all and are
discarded right afterwards. Converting an interrupt resource registers
its GSI, so this maps IRQs for arbitrary unrelated ACPI devices.
On a Dell Precision M4800 (Lynx Point, 24-pin IOAPIC) the DSDT reports
Haswell-ULT LPSS child devices (\_SB.PCI0.I2C0.ACD0 and
\_SB.PCI0.SDHC.WI01) as present with interrupts on GSI 37 and 38.
Registering the intel-spi controller then results in:
ERROR: Unable to locate IOAPIC for GSI 37
ERROR: Unable to locate IOAPIC for GSI 38
Do what the I2C core does and only parse the interrupt resource once the
device has been identified as an SPI device on this controller.
Fixes: 4c3c59544f33 ("spi/acpi: enumerate all SPI slaves in the namespace")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20261101200155.15740-1-rosenp@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b447907fba508..b678e202b384b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2604,7 +2604,6 @@ struct acpi_spi_lookup {
acpi_handle device_handle;
u32 max_speed_hz;
u32 mode;
- int irq;
u8 bits_per_word;
u8 chip_select;
int n;
@@ -2747,17 +2746,25 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data)
if (sb->device_polarity == ACPI_SPI_ACTIVE_HIGH)
lookup->mode |= SPI_CS_HIGH;
}
- } else if (lookup->irq < 0) {
- struct resource r;
-
- if (acpi_dev_resource_interrupt(ares, 0, &r))
- lookup->irq = r.start;
}
/* Always tell the ACPI core to skip this resource */
return 1;
}
+static int acpi_spi_add_irq_resource(struct acpi_resource *ares, void *data)
+{
+ int *irq = data;
+ struct resource r;
+
+ if (*irq < 0 && ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS &&
+ acpi_dev_resource_interrupt(ares, 0, &r))
+ *irq = r.start;
+
+ /* Always tell the ACPI core to skip this resource */
+ return 1;
+}
+
/**
* acpi_spi_device_alloc - Allocate a spi device, and fill it in with ACPI information
* @ctlr: controller to which the spi device belongs
@@ -2782,6 +2789,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
struct list_head resource_list;
struct acpi_spi_lookup lookup = {};
struct spi_device *spi;
+ int irq = -1;
int ret;
if (!ctlr && index == -1)
@@ -2789,7 +2797,6 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
lookup.ctlr = ctlr;
lookup.device_handle = acpi_device_handle(adev);
- lookup.irq = -1;
lookup.index = index;
lookup.n = 0;
@@ -2812,6 +2819,19 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
if (!lookup.max_speed_hz)
return ERR_PTR(-ENODEV);
+ /*
+ * Only look up the IRQ once we know this is an SPI device for us.
+ * Parsing an interrupt resource maps its GSI, which must not be done
+ * for every unrelated ACPI device walked during enumeration.
+ */
+ INIT_LIST_HEAD(&resource_list);
+ ret = acpi_dev_get_resources(adev, &resource_list,
+ acpi_spi_add_irq_resource, &irq);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
+ acpi_dev_free_resource_list(&resource_list);
+
spi = spi_alloc_device(lookup.ctlr);
if (!spi) {
dev_err(&lookup.ctlr->dev, "failed to allocate SPI device for %s\n",
@@ -2824,7 +2844,7 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
ACPI_COMPANION_SET(&spi->dev, adev);
spi->max_speed_hz = lookup.max_speed_hz;
spi->mode |= lookup.mode;
- spi->irq = lookup.irq;
+ spi->irq = irq;
spi->bits_per_word = lookup.bits_per_word;
/*
* By default spi->chip_select[0] will hold the physical CS number,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 130/990] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (128 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 129/990] spi: acpi: only look up the IRQ of confirmed SPI devices Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 131/990] net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period Greg Kroah-Hartman
` (722 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuqiang Sun, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuqiang Sun <izaiahsun@gmail.com>
[ Upstream commit 5e96760b25fdedbbf9312827f1f237d6b18b03e8 ]
When an LWT xmit program returns BPF_OK, bpf_xmit() makes sure that
the skb still has room for the link layer header. If
pskb_expand_head() fails there, bpf_xmit() returns -ENOMEM without
freeing the skb. Its callers, lwtunnel_xmit() and then
ip_finish_output2() or ip6_finish_output2(), take any return value
other than LWTUNNEL_XMIT_CONTINUE to mean that the skb has been
consumed, so nothing frees it.
Each such failure leaks the skb, together with what it holds: its dst
and its charge to the sending socket, so the socket is never freed
either. The other error paths of bpf_xmit() (BPF_DROP, an illegal
return code, a changed protocol, a failed reroute) all free the skb.
Free it here too.
The leak was found with kbound, a static analysis prototype for
ownership mismatches at kernel interfaces, on v7.2.12; it is present in
mainline.
Build-tested with x86_64 and arm64 allmodconfig (W=1, sparse): no new
warnings. Run-tested on QEMU (x86_64, KVM) with KASAN: a route through a
dummy device with an LWT xmit program that pushes one byte with
bpf_skb_change_head(), so the headroom check has to expand the head, and
failslab limited to allocations under bpf_xmit(). Each of 10 pings then
fails with ENOMEM. Without this patch each leaves a raw socket behind
(RAW slab objects 6 -> 16); with it none does (6 -> 6), and nothing else
is reported. Without injection both kernels go from 6 to 6.
Fixes: 3a0af8fd61f9 ("bpf: BPF for lightweight tunnel infrastructure")
Signed-off-by: Yuqiang Sun <izaiahsun@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261101182343.17991-1-izaiahsun@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/lwt_bpf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 982599bb41c97..6d29da9f5460b 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -341,8 +341,10 @@ static int bpf_xmit(struct sk_buff *skb)
* made before LWT xmit.
*/
ret = xmit_check_headroom(skb, hroom);
- if (unlikely(ret))
+ if (unlikely(ret)) {
+ kfree_skb(skb);
return ret;
+ }
return LWTUNNEL_XMIT_CONTINUE;
case BPF_REDIRECT:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 131/990] net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (129 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 130/990] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 132/990] bnxt_en: Dont keep MSI-X vectors added before FW reserves them Greg Kroah-Hartman
` (721 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Simon Horman, Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
[ Upstream commit 902407bc588575af0ceae5de4f635fe1e024f258 ]
macsec_fs_id_del() removes a struct mlx5_fs_id from its rhashtable with
rhashtable_remove_fast() and then frees it with kfree() right away.
The TX (SCI) table is read locklessly from the transmit path:
mlx5e_macsec_handle_tx_skb() and mlx5e_macsec_tx_build_eseg() call
mlx5_macsec_fs_get_fs_id_from_hashtable(), which does
rhashtable_lookup() under rcu_read_lock() and then reads
mlx5_fs_id->id. A transmit that looked the entry up just before it was
removed reads freed memory.
Before commit d4ece08f4b1d ("net/mlx5: Maintain fs_id xarray per MACsec
device inside macsec steering") the SCI table held struct
mlx5e_macsec_sa directly, and mlx5e_macsec_del_txsa() freed it with
kfree_rcu_mightsleep(). That commit moved the table into macsec_fs.c
with the new struct mlx5_fs_id, but frees it with a plain kfree().
Add an rcu_head to struct mlx5_fs_id and free it with kfree_rcu().
The same issue was flagged by the Sashiko AI review as a pre-existing
problem while reviewing the HW-GRO for PSP series.
Fixes: d4ece08f4b1d ("net/mlx5: Maintain fs_id xarray per MACsec device inside macsec steering")
Link: https://lore.kernel.org/all/20260909065542.4B80D1F00ACA@smtp.kernel.org/
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Assisted-by: Yaga Agent HackerSec Claude:claude-opus-5-5
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
index e6be2f01daf4c..f6d09e4509e55 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
@@ -94,6 +94,7 @@ struct mlx5_fs_id {
refcount_t refcnt;
sci_t sci;
struct rhash_head hash;
+ struct rcu_head rcu;
};
struct mlx5_macsec_device {
@@ -684,7 +685,7 @@ static void macsec_fs_id_del(struct list_head *macsec_devices_list, u32 fs_id,
xa_erase(fs_id_xa, fs_id);
- kfree(fs_id_found);
+ kfree_rcu(fs_id_found, rcu);
if (macsec_fs_is_macsec_device_empty(macsec_device)) {
list_del(&macsec_device->macsec_devices_list_entry);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 132/990] bnxt_en: Dont keep MSI-X vectors added before FW reserves them
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (130 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 131/990] net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period Greg Kroah-Hartman
@ 2026-11-25 14:24 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 133/990] ipv6: fix fib6 walker UAF on NLM_F_REPLACE Greg Kroah-Hartman
` (720 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:24 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrew Preece, Vlad Poenaru,
Michael Chan, Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Poenaru <vlad.wing@gmail.com>
[ Upstream commit af449230bd8de936d6e4f759240e787b9aad7cc0 ]
When dynamic MSI-X is supported, bnxt_check_rings() grows the MSI-X
vectors with bnxt_change_msix() once FW says the new rings would fit,
and keeps them. FW only reserves the extra IRQs later, when
bnxt_reserve_rings() calls __bnxt_reserve_rings(). The MSI-X table
entries beyond the function's reserved IRQs are not backed until then:
the MSI message written when the new vectors are activated is lost, and
the entries read back as zero. After FW reserves them they are live but
still zero, so the NQ rings bound to them signal address 0 and every
completion on those rings is lost. The next ring change (for example
ethtool -G) then times out freeing each of those rings and the TX
watchdog fires:
bnxt_en 0002:01:00.0 eth0: Resp cmpl intr err msg: 0x51
bnxt_en 0002:01:00.0 eth0: hwrm_ring_free type 1 failed. rc:fffffff0 err:0
...
bnxt_en 0002:01:00.0 eth0: NETDEV WATCHDOG: CPU: 17: transmit queue 18 timed out 5716 ms
On x86 this is hidden: GENERIC_IRQ_RESERVATION_MODE makes the PCI MSI
domains MSI_FLAG_MUST_REACTIVATE, so the message is composed and written
again when the IRQ is requested, after FW has reserved the vector.
Since commit 0d6a7c417983 ("irqchip/gic-v3-its: Enable dynamic MSI-X
allocation"), arm64 GICv3 systems take the dynamic path as well, but
write the message only once, at allocation. On an NVIDIA Grace system
with a BCM57508, raising the channel count from 18 to 32 left MSI-X
entries 18-31 all zero, and the 14 rings using them lost their
interrupts.
Keep the allocation in bnxt_check_rings() as a check that enough vectors
are available, but free the new vectors again right away when FW manages
IRQ reservations (BNXT_NEW_RM). bnxt_reserve_rings() then allocates
them after __bnxt_reserve_rings() has reserved them. Without
BNXT_NEW_RM there is no IRQ reservation and bnxt_reserve_rings() does
not grow the vectors, so keep the current behaviour there.
In bnxt_reserve_rings(), size that allocation from the rings FW actually
reserved (bnxt_get_num_msix()) instead of the count computed before the
reservation, so that a partial grant does not activate unreserved
entries either, at least while no RoCE driver is registered.
The allocation can now fail after FW has committed the reservation. A
later open would then find nothing to reserve and return before growing
the vectors, and bnxt_request_irq() would use irq_tbl[] entries past
bp->total_irqs, which still hold the freed virqs. Grow the vectors in
that case as well, and clear irq_tbl[].vector when trimming.
Fixes: 2d51eb0bd81c ("bnxt_en: Add MSIX check in bnxt_check_rings()")
Reported-by: Andrew Preece <apreece@meta.com>
Closes: https://lore.kernel.org/all/20261022193620.2152038-1-vlad.wing@gmail.com/
Signed-off-by: Vlad Poenaru <vlad.wing@gmail.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 34 ++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 51c144584d240..2b1567616f51b 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -11374,6 +11374,7 @@ static int bnxt_change_msix(struct bnxt *bp, int total)
map.index = i - 1;
map.virq = bp->irq_tbl[i - 1].vector;
pci_msix_free_irq(bp->pdev, map);
+ bp->irq_tbl[i - 1].vector = 0;
bp->total_irqs--;
}
return bp->total_irqs;
@@ -11551,8 +11552,23 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
int irqs_required;
int rc;
- if (!bnxt_need_reserve_rings(bp))
+ if (!bnxt_need_reserve_rings(bp)) {
+ /* FW may already hold the reservation from an earlier
+ * reservation that was not followed by growing the dynamic
+ * MSI-X vectors, e.g. because the allocation failed.
+ */
+ if (irq_re_init && BNXT_NEW_RM(bp) && bp->irq_tbl &&
+ pci_msix_can_alloc_dyn(bp->pdev)) {
+ irqs_required = bnxt_get_num_msix(bp);
+ if (irqs_required > bp->total_irqs &&
+ bnxt_change_msix(bp, irqs_required) != irqs_required) {
+ netdev_err(bp->dev, "Unable to allocate %d MSIX vectors, maximum available %d\n",
+ irqs_required, bp->total_irqs);
+ return -ENOSPC;
+ }
+ }
return 0;
+ }
if (BNXT_NEW_RM(bp) && !bnxt_ulp_registered(edev)) {
int ulp_msix = bnxt_get_avail_msix(bp, bp->ulp_num_msix_want);
@@ -11578,6 +11594,10 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
rc = bnxt_init_int_mode(bp);
bnxt_ulp_irq_restart(bp, rc);
} else if (irq_change && !rc) {
+ /* Size the vectors from what FW actually reserved, which
+ * can be less than what was requested.
+ */
+ irqs_required = bnxt_get_num_msix(bp);
if (bnxt_change_msix(bp, irqs_required) != irqs_required)
rc = -ENOSPC;
}
@@ -14875,6 +14895,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
hwr.cp = min_t(int, hwr.cp, bnxt_get_max_func_irqs(bp));
}
if (hwr.cp > bp->total_irqs) {
+ int old_total = bp->total_irqs;
int total_msix = bnxt_change_msix(bp, hwr.cp);
if (total_msix < hwr.cp) {
@@ -14882,6 +14903,17 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
hwr.cp, total_msix);
rc = -ENOSPC;
}
+ /* FW has not reserved the new vectors yet, and writes to
+ * MSI-X table entries beyond the reserved IRQs don't
+ * stick (seen on BCM57508). Free them again;
+ * bnxt_reserve_rings() allocates them after
+ * __bnxt_reserve_rings(). Without the new resource
+ * manager there is no IRQ reservation and
+ * bnxt_reserve_rings() does not grow the vectors, so
+ * keep them.
+ */
+ if (BNXT_NEW_RM(bp))
+ bnxt_change_msix(bp, old_total);
}
}
return rc;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 133/990] ipv6: fix fib6 walker UAF on NLM_F_REPLACE
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (131 preceding siblings ...)
2026-11-25 14:24 ` [PATCH 6.18 132/990] bnxt_en: Dont keep MSI-X vectors added before FW reserves them Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 134/990] tcp: do not let tcp_collapse() drive sk_forward_alloc negative Greg Kroah-Hartman
` (719 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, AutonomousCodeSecurity,
Cen Zhang (Microsoft), Ido Schimmel, Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
[ Upstream commit 23fec4bd76904e9df7a8cc0a81ceb14c36971da4 ]
fib6_walker uses w->leaf to remember the next fib6_info to dump, so an
RTM_GETROUTE dump can continue there on the next recvmsg(). This
assumes that whoever removes a route from the tree also updates the
walkers pointing at it. fib6_del_route() does: it moves w->leaf to
the next route. The NLM_F_REPLACE branch of fib6_add_rt2node() does
not: it removes the old route, fib6_add() frees it, and w->leaf keeps
pointing at the freed object.
The fn_sernum version check in fib6_dump_table() normally protects
against resuming on a stale w->leaf, but it can be bypassed:
ip6_link_failure() resets fn_sernum to -1 when the default route
fails, which an unprivileged user in a user+net namespace can cause:
1) link failure fn_sernum = -1
2) dump pauses on route R
3) replace R fn_sernum changed, R freed
4) link failure fn_sernum = -1
5) dump resumes -1 == -1, reads freed R <- UAF
BUG: KASAN: slab-use-after-free in rt6_fill_node+0x1c22/0x2cd0
Read of size 4 at addr ff11000011fa0064 by task poc/101
rt6_fill_node <- rt6_dump_route
Fix by adjusting walkers separately for replacement and deletion.
For replacement, add fib6_walkers_replace_leaf() points w->leaf
at the new route. For deletion and ECMP sibling removal,
fib6_walkers_skip_rt() calls fib6_walkers_replace_leaf() with the
next route. Reset w->skip_in_node when updating w->leaf, and set
w->state to FWS_U when no next route remains.
Fixes: 4a287eba2de3 ("IPv6 routing, NLM_F_* flag support: REPLACE and EXCL flags support, warn about missing CREATE flag")
Cc: AutonomousCodeSecurity@microsoft.com
Signed-off-by: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/ip6_fib.c | 50 ++++++++++++++++++++++++++++++++++------------
1 file changed, 37 insertions(+), 13 deletions(-)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 9fc2d2677b747..962d01b9954e4 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -89,6 +89,40 @@ static void fib6_walker_unlink(struct net *net, struct fib6_walker *w)
write_unlock_bh(&net->ipv6.fib6_walker_lock);
}
+/* @old is leaving the tree. Walkers resting on it continue from @new, or
+ * climb to the parent node when there is no @new. Called with tb6_lock
+ * held.
+ */
+static void fib6_walkers_replace_leaf(struct net *net, struct fib6_info *old,
+ struct fib6_info *new)
+{
+ struct fib6_walker *w;
+
+ read_lock(&net->ipv6.fib6_walker_lock);
+ FOR_WALKERS(net, w) {
+ if (w->state == FWS_C && w->leaf == old) {
+ pr_debug("walker %p adjusted by unlink of %p\n", w, old);
+ w->leaf = new;
+ w->skip_in_node = 0;
+ if (!new)
+ w->state = FWS_U;
+ }
+ }
+ read_unlock(&net->ipv6.fib6_walker_lock);
+}
+
+/* @rt is removed from its node: walkers resting on it continue from the
+ * next route of the node.
+ */
+static void fib6_walkers_skip_rt(struct net *net, struct fib6_info *rt)
+{
+ struct fib6_info *next;
+
+ next = rcu_dereference_protected(rt->fib6_next,
+ lockdep_is_held(&rt->fib6_table->tb6_lock));
+ fib6_walkers_replace_leaf(net, rt, next);
+}
+
static int fib6_new_sernum(struct net *net)
{
int new, old = atomic_read(&net->ipv6.fib6_sernum);
@@ -1306,6 +1340,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
rcu_assign_pointer(rt->fib6_node, fn);
rt->fib6_next = iter->fib6_next;
rcu_assign_pointer(*ins, rt);
+ fib6_walkers_replace_leaf(info->nl_net, iter, rt);
if (!info->skip_notify)
inet6_rt_notify(RTM_NEWROUTE, rt, info, NLM_F_REPLACE);
if (!(fn->fn_flags & RTN_RTINFO)) {
@@ -1327,6 +1362,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
if (iter->fib6_metric > rt->fib6_metric)
break;
if (rt6_qualify_for_ecmp(iter)) {
+ fib6_walkers_skip_rt(info->nl_net, iter);
*ins = iter->fib6_next;
iter->fib6_node = NULL;
list_add(&iter->purge_link, purge_list);
@@ -1967,7 +2003,6 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
struct fib6_info __rcu **rtp, struct nl_info *info)
{
struct fib6_info *leaf, *replace_rt = NULL;
- struct fib6_walker *w;
struct fib6_info *rt = rcu_dereference_protected(*rtp,
lockdep_is_held(&table->tb6_lock));
struct net *net = info->nl_net;
@@ -2018,18 +2053,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
rt6_multipath_rebalance(next_sibling);
}
- /* Adjust walkers */
- read_lock(&net->ipv6.fib6_walker_lock);
- FOR_WALKERS(net, w) {
- if (w->state == FWS_C && w->leaf == rt) {
- pr_debug("walker %p adjusted by delroute\n", w);
- w->leaf = rcu_dereference_protected(rt->fib6_next,
- lockdep_is_held(&table->tb6_lock));
- if (!w->leaf)
- w->state = FWS_U;
- }
- }
- read_unlock(&net->ipv6.fib6_walker_lock);
+ fib6_walkers_skip_rt(net, rt);
/* If it was last route, call fib6_repair_tree() to:
* 1. For root node, put back null_entry as how the table was created.
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 134/990] tcp: do not let tcp_collapse() drive sk_forward_alloc negative
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (132 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 133/990] ipv6: fix fib6 walker UAF on NLM_F_REPLACE Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 135/990] ata: libata-sata: allow re-enabling NCQ with the same queue_depth Greg Kroah-Hartman
` (718 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Kuniyuki Iwashima,
Octavian Purdila, Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
[ Upstream commit 031c403d13e5046750e2abebd4e770631e7c4627 ]
tcp_collapse() charges each newly allocated skb with skb_set_owner_r()
before the skbs it replaces are freed, without scheduling memory first.
Since sk_mem_uncharge() reclaims eagerly, sk->sk_forward_alloc has no
cushion and can become negative. This can be durable when the collapsed
skbs had a high payload/truesize ratio or were partially read, because
the new skbs can have a bigger total truesize than the old ones.
A negative sk_forward_alloc then confuses tcp_wmem_schedule(), which
can return a negative length to tcp_sendmsg_locked(), triggering
a WARN_ON_ONCE(bytes > INT_MAX) in check_copy_size().
Call sk_forced_mem_schedule() before charging nskb.
Fixes: 4890b686f408 ("net: keep sk->sk_forward_alloc as small as possible")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Octavian Purdila <tavip@google.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_input.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 28db1353445bf..5d8da3c23e2c8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5646,6 +5646,10 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, struct rb_root *root,
__skb_queue_before(list, skb, nskb);
else
__skb_queue_tail(&tmp, nskb); /* defer rbtree insertion */
+ /* nskb is charged before the skbs it replaces are freed.
+ * Make sure sk->sk_forward_alloc can not become negative.
+ */
+ sk_forced_mem_schedule(sk, nskb->truesize);
skb_set_owner_r(nskb, sk);
mptcp_skb_ext_move(nskb, skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 135/990] ata: libata-sata: allow re-enabling NCQ with the same queue_depth
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (133 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 134/990] tcp: do not let tcp_collapse() drive sk_forward_alloc negative Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 136/990] ata: libata-eh: Retry non-NCQ commands when their sense data asks for it Greg Kroah-Hartman
` (717 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Pylypiv, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <ipylypiv@google.com>
[ Upstream commit d7c5cc8cc21c1264cce07feb4a51be158688280e ]
When ata_eh_speed_down() disables NCQ due to excessive errors, it sets
ATA_DFLAG_NCQ_OFF without changing sdev->queue_depth. Userspace can
re-enable NCQ by writing a queue depth > 1 to the sysfs queue_depth
attribute, which invokes ata_change_queue_depth() to clear
ATA_DFLAG_NCQ_OFF.
However, ata_change_queue_depth() returns early if the requested
queue_depth is equal to sdev->queue_depth before clearing
ATA_DFLAG_NCQ_OFF. As a result, writing a different queue depth > 1
re-enables NCQ, whereas writing the current sdev->queue_depth value
leaves ATA_DFLAG_NCQ_OFF set.
Since ata_change_queue_depth() already checks whether queue_depth equals
sdev->queue_depth before calling scsi_change_queue_depth(), remove the
early check so that writing the current queue_depth > 1 clears
ATA_DFLAG_NCQ_OFF and re-enables NCQ.
Fixes: 45623d33bfc0 ("ata: libata-sata: Improve ata_change_queue_depth()")
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20261029184445.1615717-1-ipylypiv@google.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-sata.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 9b374e8f99384..9eb28dab46195 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -1287,7 +1287,7 @@ int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev,
spin_lock_irqsave(ap->lock, flags);
dev = ata_scsi_find_dev(ap, sdev);
- if (!dev || queue_depth < 1 || queue_depth == sdev->queue_depth) {
+ if (!dev || queue_depth < 1) {
spin_unlock_irqrestore(ap->lock, flags);
return sdev->queue_depth;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 136/990] ata: libata-eh: Retry non-NCQ commands when their sense data asks for it
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (134 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 135/990] ata: libata-sata: allow re-enabling NCQ with the same queue_depth Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 137/990] net: stmmac: take ownership of saved RX state at poll entry Greg Kroah-Hartman
` (716 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Pylypiv, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 597be4104c4045d73979c05307fa5fc778d1dbde ]
When a failed command has valid sense data, ata_eh_analyze_tf() asks
scsi_check_sense() whether the command should be retried, and sets
ATA_QCFLAG_RETRY if it should. ata_eh_link_autopsy() then clears
AC_ERR_DEV and AC_ERR_OTHER from qc->err_mask, relying on that decision.
For an NCQ command, qc->err_mask still has AC_ERR_NCQ, so
ata_eh_finish() honors ATA_QCFLAG_RETRY. For a non-NCQ command, whose
sense data comes from REQUEST SENSE DATA EXT, qc->err_mask is now zero,
and ata_eh_finish() completes the command with scmd->retries set to
scmd->allowed, without looking at ATA_QCFLAG_RETRY. Such a command is
thus never retried, even when its sense data asks for a retry, e.g. a
transient error reported as ABORTED COMMAND.
Make ata_eh_finish() honor ATA_QCFLAG_RETRY for commands with valid
sense data. ata_eh_qc_retry() cannot be used for this: as qc->err_mask
is zero, it increments scmd->allowed, so every retry would allow one
more, and a persistent error would be retried forever. Instead,
complete the command without touching scmd->allowed or scmd->retries,
so that the SCSI midlayer retries it at most scmd->allowed times, like
any other failed command.
Fixes: 3852e3738266 ("libata: evaluate SCSI sense code")
Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
Link: https://lore.kernel.org/r/20261030090047.407906-2-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-eh.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 9d35b4f8d3929..1e5946c0a7434 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -4061,8 +4061,20 @@ void ata_eh_finish(struct ata_port *ap)
ata_eh_qc_complete(qc);
}
} else {
- if (qc->flags & ATA_QCFLAG_SENSE_VALID ||
- qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD) {
+ if (qc->flags & ATA_QCFLAG_SENSE_VALID &&
+ qc->flags & ATA_QCFLAG_RETRY) {
+ /*
+ * The sense data asks for a retry, see
+ * ata_eh_analyze_tf(). ata_eh_link_autopsy()
+ * cleared qc->err_mask, so ata_eh_qc_retry()
+ * would increment scmd->allowed. Leave
+ * scmd->allowed alone, so that upper layer
+ * only retries the command if it has not
+ * already been retried too many times.
+ */
+ __ata_eh_qc_complete(qc);
+ } else if (qc->flags & ATA_QCFLAG_SENSE_VALID ||
+ qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD) {
ata_eh_qc_complete(qc);
} else {
/* feed zero TF to sense generation */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 137/990] net: stmmac: take ownership of saved RX state at poll entry
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (135 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 136/990] ata: libata-eh: Retry non-NCQ commands when their sense data asks for it Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 138/990] net: stmmac: drop split frames on AF_XDP zero-copy RX Greg Kroah-Hartman
` (715 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard, Nicolai Buchwitz,
Lorenzo Bianconi, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit 26219e9402c22181f021034f127a8e278d40545f ]
When a saved partial packet completes with a poll budget of one, the
old loop can leave state_saved and state.skb pointing at an skb that
has already been delivered or freed. The next poll then reuses that
pointer, causing a use-after-free or double free.
Take the saved state at poll entry and clear the stored ownership
immediately. Save it again only if the packet remains incomplete,
including when the next descriptor is still DMA-owned.
Track the frame-in-progress flag independently of the status read from
the next descriptor. The old code keyed the save on the status of the
last descriptor looked at, so a loop stopped at a DMA-owned descriptor
(rx status not yet valid) could drop the saved error/length bookkeeping
in stmmac_rx_zc().
Drop the saved state both when the queue parameters are reset and when
the ring is destroyed. stmmac_reset_rx_queue() is reached from
__stmmac_open(), stmmac_xdp_open(), stmmac_resume() and
stmmac_enable_rx_queue(); without draining it there, a partial frame
saved before suspend (or before a queue is disabled and re-enabled)
survives while cur_rx and dirty_rx are rewound to zero. On the resume
path the ring is only re-armed in place: stmmac_clear_descriptors()
sets the ownership bits and stmmac_init_dma_engine() restores the tail
pointer, but the RX buffer addresses are not reprogrammed. The first
poll would then resume the stale skb against a ring position that no
longer matches the descriptors it was built from.
__free_dma_rx_desc_resources() releases it on teardown.
Apply the same state handling to stmmac_rx_zc(), which also leaves
state_saved set when a saved frame finishes at the budget boundary.
That path saves only error and length bookkeeping, not an skb pointer.
Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Co-developed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-1-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 72 +++++++++++--------
1 file changed, 42 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 98e6d2cc544ce..67606fd618494 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1939,6 +1939,9 @@ static void __free_dma_rx_desc_resources(struct stmmac_priv *priv,
else
dma_free_rx_skbufs(priv, dma_conf, queue);
+ dev_kfree_skb_any(rx_q->state.skb);
+ rx_q->state.skb = NULL;
+ rx_q->state_saved = false;
rx_q->buf_alloc_num = 0;
rx_q->xsk_pool = NULL;
@@ -5324,12 +5327,12 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
unsigned int count = 0, error = 0, len = 0;
int dirty = stmmac_rx_dirty(priv, queue);
unsigned int next_entry = rx_q->cur_rx;
+ bool in_progress = rx_q->state_saved;
u32 rx_errors = 0, rx_dropped = 0;
unsigned int desc_size;
struct bpf_prog *prog;
bool failure = false;
int xdp_status = 0;
- int status = 0;
if (netif_msg_rx_status(priv)) {
void *rx_head;
@@ -5346,23 +5349,25 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
stmmac_display_ring(priv, rx_head, priv->dma_conf.dma_rx_size, true,
rx_q->dma_rx_phy, desc_size);
}
+
+ if (rx_q->state_saved) {
+ error = rx_q->state.error;
+ len = rx_q->state.len;
+ rx_q->state_saved = false;
+ }
+
while (count < limit) {
struct stmmac_rx_buffer *buf;
struct stmmac_xdp_buff *ctx;
unsigned int buf1_len = 0;
struct dma_desc *np, *p;
- int entry;
+ int entry, status;
int res;
- if (!count && rx_q->state_saved) {
- error = rx_q->state.error;
- len = rx_q->state.len;
- } else {
- rx_q->state_saved = false;
+ if (!in_progress) {
error = 0;
len = 0;
}
-
read_again:
if (count >= limit)
break;
@@ -5407,6 +5412,8 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
if (!buf->xdp)
break;
+ in_progress = status & rx_not_ls;
+
if (priv->extend_desc) {
/* Read the extended status after the own bit */
dma_rmb();
@@ -5483,7 +5490,7 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
count++;
}
- if (status & rx_not_ls) {
+ if (in_progress) {
rx_q->state_saved = true;
rx_q->state.error = error;
rx_q->state.len = len;
@@ -5525,9 +5532,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
struct stmmac_channel *ch = &priv->channel[queue];
unsigned int count = 0, error = 0, len = 0;
- int status = 0, coe = priv->hw->rx_csum;
unsigned int next_entry = rx_q->cur_rx;
+ bool in_progress = rx_q->state_saved;
enum dma_data_direction dma_dir;
+ int coe = priv->hw->rx_csum;
unsigned int desc_size;
struct sk_buff *skb = NULL;
struct stmmac_xdp_buff ctx;
@@ -5553,25 +5561,28 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
stmmac_display_ring(priv, rx_head, priv->dma_conf.dma_rx_size, true,
rx_q->dma_rx_phy, desc_size);
}
+
+ if (rx_q->state_saved) {
+ skb = rx_q->state.skb;
+ error = rx_q->state.error;
+ len = rx_q->state.len;
+ rx_q->state.skb = NULL;
+ rx_q->state_saved = false;
+ }
+
while (count < limit) {
unsigned int buf1_len = 0, buf2_len = 0;
enum pkt_hash_types hash_type;
struct stmmac_rx_buffer *buf;
struct dma_desc *np, *p;
- int entry;
+ int entry, status;
u32 hash;
- if (!count && rx_q->state_saved) {
- skb = rx_q->state.skb;
- error = rx_q->state.error;
- len = rx_q->state.len;
- } else {
- rx_q->state_saved = false;
+ if (!in_progress) {
skb = NULL;
error = 0;
len = 0;
}
-
read_again:
if (count >= limit)
break;
@@ -5606,6 +5617,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
prefetch(np);
+ in_progress = status & rx_not_ls;
+
if (priv->extend_desc) {
/* Read the extended status after the own bit */
dma_rmb();
@@ -5623,11 +5636,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
if (unlikely(error && (status & rx_not_ls)))
goto read_again;
+
if (unlikely(error)) {
dev_kfree_skb(skb);
- skb = NULL;
- count++;
- continue;
+ goto next;
}
/* Buffer is good. Go on. */
@@ -5701,9 +5713,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
STMMAC_XDP_REDIRECT)) {
xdp_status |= xdp_res;
buf->page = NULL;
- skb = NULL;
- count++;
- continue;
+ goto next;
}
}
}
@@ -5760,10 +5770,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
/* Remove FCS if needed */
if (!fcs_stripped && pskb_trim(skb, len)) {
dev_kfree_skb_any(skb);
- skb = NULL;
rx_dropped++;
- count++;
- continue;
+ goto next;
}
stmmac_get_rx_hwtstamp(priv, p, np, skb);
@@ -5788,14 +5796,15 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
skb_record_rx_queue(skb, queue);
napi_gro_receive(&ch->rx_napi, skb);
- skb = NULL;
-
rx_packets++;
rx_bytes += len;
+next:
+ in_progress = false;
+ skb = NULL;
count++;
}
- if (status & rx_not_ls || skb) {
+ if (in_progress || skb) {
rx_q->state_saved = true;
rx_q->state.skb = skb;
rx_q->state.error = error;
@@ -7948,6 +7957,9 @@ static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue)
{
struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
+ dev_kfree_skb_any(rx_q->state.skb);
+ rx_q->state.skb = NULL;
+ rx_q->state_saved = false;
rx_q->cur_rx = 0;
rx_q->dirty_rx = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 138/990] net: stmmac: drop split frames on AF_XDP zero-copy RX
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (136 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 137/990] net: stmmac: take ownership of saved RX state at poll entry Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 139/990] net: stmmac: drop multi-buffer frames in XDP mode Greg Kroah-Hartman
` (714 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Lorenzo Bianconi,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 834ec95308320cbd8c162d86788ab95cc3fd6bf8 ]
stmmac_rx_zc() assumes a 1:1 mapping between a received frame and an
XSK pool buffer and drops any frame that spans more than one RX
descriptor:
/* XSK pool expects RX frame 1:1 mapped to XSK buffer */
if (likely(status & rx_not_ls)) {
xsk_buff_free(buf->xdp);
buf->xdp = NULL;
dirty++;
count++;
goto read_again;
}
The non-last descriptors are freed and dropped, but the frame is not
marked as errored. When the poll reaches the last descriptor of the
same frame, error is still 0, so the fragment is handled as a complete
frame: it is passed to the XDP program, copied into an skb on XDP_PASS,
or converted for XDP_TX. The tail starts in the middle of the original
payload at a predictable offset and, parsed as a fresh frame (len == 0),
stmmac_rx_buf1_len() reports the full dma_buf_sz length for it even
though the DMA engine only wrote the tail remainder into that buffer, so
the reads extend past the received bytes and can reach beyond the end of
the XSK pool buffer. GMAC4 always enables jumbo frames (GMAC_CONFIG_JE
in GMAC_CORE_INIT), so an on-link peer can trigger such a split even
when the interface MTU is left at 1500.
Set error when the 1:1 mapping check drops a descriptor, so the
remaining descriptors of the frame - including the last one - are
drained and released with xsk_buff_free() instead of being processed as
a new frame. Account every freed buffer with dirty and count the
dropped frame once in the poll budget / rx_pkt_n. The direct 1:1
mapping drop also increments rx_dropped.
Use a bit test instead of an equality test for discard_frame.
Commit 644b8437ccef9e ("net: stmmac: dwmac4: report Rx checksum errors
in status") made dwmac4_wrback_get_rx_status() set discard_frame on
RDES3_ERROR_SUMMARY and OR in csum_none on RDES1_IP_HDR_ERROR or
RDES1_IP_PAYLOAD_ERROR, so it can return discard_frame | csum_none.
The old "status == discard_frame" test missed that value and delivered
frames with CRC, overflow, watchdog or giant errors to the stack in
stmmac_rx() - or to XDP/XSK in stmmac_rx_zc() - when they also failed
the IP checksum. The change therefore affects the regular RX path, not
only zero-copy. The bit test is also required for the
discard_frame | rx_not_ls value returned for non-last legacy
descriptors below.
Normalize the legacy normal and enhanced descriptor callbacks to report
rx_not_ls together with discard_frame for non-last descriptors. This
allows both stmmac_rx_zc() and stmmac_rx() to drain split frames on
dwmac100 and dwmac1000 instead of reparsing the final fragment as a new
packet.
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Fixes: 644b8437ccef9e ("net: stmmac: dwmac4: report Rx checksum errors in status")
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-2-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/stmicro/stmmac/enh_desc.c | 2 +-
.../net/ethernet/stmicro/stmmac/norm_desc.c | 2 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++++++++++-------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 963579518405c..9833db1fed0c4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -210,7 +210,7 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
x->rx_length++;
- return discard_frame;
+ return discard_frame | rx_not_ls;
}
if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) {
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 68a7cfcb1d8f3..c08846da03eb7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -77,7 +77,7 @@ static int ndesc_get_rx_status(struct stmmac_extra_stats *x,
if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
x->rx_length++;
- return discard_frame;
+ return discard_frame | rx_not_ls;
}
if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 67606fd618494..022d308bb95f6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5421,18 +5421,21 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
&rx_q->dma_erx[entry],
status);
}
- if (unlikely(status == discard_frame)) {
- xsk_buff_free(buf->xdp);
- buf->xdp = NULL;
- dirty++;
+
+ if (unlikely(!error && (status & discard_frame))) {
error = 1;
if (!priv->hwts_rx_en)
rx_errors++;
}
- if (unlikely(error && (status & rx_not_ls)))
- goto read_again;
if (unlikely(error)) {
+ xsk_buff_free(buf->xdp);
+ buf->xdp = NULL;
+ dirty++;
+
+ if (status & rx_not_ls)
+ goto read_again;
+
count++;
continue;
}
@@ -5441,8 +5444,9 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
if (likely(status & rx_not_ls)) {
xsk_buff_free(buf->xdp);
buf->xdp = NULL;
+ rx_dropped++;
+ error = 1;
dirty++;
- count++;
goto read_again;
}
@@ -5626,7 +5630,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
&rx_q->dma_erx[entry],
status);
}
- if (unlikely(status == discard_frame)) {
+
+ if (unlikely(status & discard_frame)) {
page_pool_put_page(rx_q->page_pool, buf->page, 0, true);
buf->page = NULL;
error = 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 139/990] net: stmmac: drop multi-buffer frames in XDP mode
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (137 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 138/990] net: stmmac: drop split frames on AF_XDP zero-copy RX Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 140/990] net: stmmac: copy XDP metadata in AF_XDP zero-copy RX Greg Kroah-Hartman
` (713 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Lorenzo Bianconi,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 52ffd771e0029c5ad0504b1b4a8b7f932b65eea3 ]
stmmac_rx() runs the XDP program once per descriptor buffer and uses
skb == NULL as the only marker for the start of a frame. A frame larger
than one buffer is split by the hardware across several descriptors;
GMAC4 enables jumbo frames unconditionally (GMAC_CONFIG_JE in
GMAC_CORE_INIT), so an on-link peer can deliver such a frame even when
the interface MTU is left at 1500.
When an XDP verdict ends a non-last descriptor, skb is cleared and the
next descriptor of the same hardware frame is parsed as a new frame.
For XDP_CONSUMED this happens via read_again with len preserved, so
stmmac_rx_buf1_len() then returns min(dma_buf_sz, plen - len) for the
last descriptor, which can be as small as 0-3 bytes. buf1_len -=
ETH_FCS_LEN underflows and xdp_prepare_buff() puts data_end far past
data; on XDP_PASS this produces an skb whose length is close to 4G that
reaches the network stack (skb->tail and skb->len are 32-bit and wrap
below skb->end, so skb_over_panic() does not fire). A 4+ byte tail is
instead offered to the XDP program and delivered as a standalone
mid-payload Ethernet frame on XDP_PASS. XDP_TX/XDP_REDIRECT instead
falls through to the next iteration, resetting the running length, so
the tail is re-parsed as a full-size new frame.
The same fault exists when a single descriptor uses its second buffer:
buffer2 is now handed to the hardware for non-SPH frames on GMAC4/XGMAC,
so a frame up to 2 * dma_buf_sz can land on a single descriptor while the
XDP program still only sees the first buffer. XDP_TX then transmits a
truncated frame, and XDP_PASS appends the second buffer only after the
program has already run over the first one.
XDP does not support scatter-gather frames until the multi-buffer
rework, so drop the whole frame instead. When a non-last descriptor is
seen while an XDP program is attached, mark the frame as errored and
drain the remaining descriptors, including the last. A descriptor that
uses its second buffer is dropped directly before the program runs as
well; in XDP mode it is necessarily the last descriptor of the frame,
so it does not need the error marker. Removing the re-parse lets both
XDP verdict branches simply complete the packet via next.
The buffers consumed by the discard path are no longer returned to the
page pool, and the new SG and second-buffer drops do not return them
either. They stay in rx_q->buf_pool[] and stmmac_rx_refill() reuses them
in place, allocating only when a slot is empty. This is safe because the
drop checks run before the buffer is synced for CPU access or
prefetched. The discard-path change and the in-place reuse apply with or
without an XDP program attached.
The !error guard on the discard check also changes the accounting for
errored multi-descriptor frames on dwmac100/dwmac1000: rx_errors is
incremented once per frame instead of once per descriptor. This too is
independent of XDP mode.
Note: the subsequent "net: stmmac: rework stmmac_rx to support XDP rx
multi-buff" accumulates the whole frame into a single xdp_buff and
supersedes this patch; the fix is kept so the net portion of the series
stands on its own.
Fixes: 5fabb01207a2 ("net: stmmac: Add initial XDP support")
Fixes: 88095728511e ("net: stmmac: fix rx Scatter-Gather support")
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-3-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 35 ++++++++++---------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 022d308bb95f6..a79332f92be79 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5631,18 +5631,23 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
status);
}
- if (unlikely(status & discard_frame)) {
- page_pool_put_page(rx_q->page_pool, buf->page, 0, true);
- buf->page = NULL;
+ if (unlikely(!error && (status & discard_frame))) {
error = 1;
if (!priv->hwts_rx_en)
rx_errors++;
}
- if (unlikely(error && (status & rx_not_ls)))
- goto read_again;
+ /* We do not support SG in XDP mode */
+ if (unlikely(!error && (status & rx_not_ls) &&
+ stmmac_xdp_is_enabled(priv))) {
+ rx_dropped++;
+ error = 1;
+ }
if (unlikely(error)) {
+ if (status & rx_not_ls)
+ goto read_again;
+
dev_kfree_skb(skb);
goto next;
}
@@ -5654,6 +5659,14 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
buf2_len = stmmac_rx_buf2_len(priv, p, status, len);
len += buf2_len;
+ /* Drop the packet if it is split over buf1 and buf2 on a
+ * single descriptor if the interface is running in XDP mode.
+ */
+ if (unlikely(stmmac_xdp_is_enabled(priv) && buf2_len)) {
+ rx_dropped++;
+ goto next;
+ }
+
/* ACS is disabled; strip manually. */
if (likely(!(status & rx_not_ls)))
len -= ETH_FCS_LEN;
@@ -5703,17 +5716,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
sync_len, true);
buf->page = NULL;
rx_dropped++;
-
- /* Clear skb as it was set as
- * status by XDP program.
- */
- skb = NULL;
-
- if (unlikely((status & rx_not_ls)))
- goto read_again;
-
- count++;
- continue;
+ goto next;
} else if (xdp_res & (STMMAC_XDP_TX |
STMMAC_XDP_REDIRECT)) {
xdp_status |= xdp_res;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 140/990] net: stmmac: copy XDP metadata in AF_XDP zero-copy RX
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (138 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 139/990] net: stmmac: drop multi-buffer frames in XDP mode Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 141/990] net: stmmac: fix VLAN tag stripping on short and non-linear RX frames Greg Kroah-Hartman
` (712 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 41d78e9ac0984f0e9577e5312e62400b5a6760c8 ]
stmmac_construct_skb_zc() reserves headroom for the XDP metadata and
records the length reported by the XDP program, but only copies the
packet data starting at xdp->data. The bytes in
[xdp->data_meta, xdp->data) are never copied into the new skb, so the
skb advertises metadata that is not there: after eth_type_trans()
anchors mac_header, data_meta points at uninitialized headroom instead
of what the program wrote.
Copy the metadata together with the packet data starting at
xdp->data_meta, leaving skb->data at the start of the frame and the
metadata immediately before it, and record its length. This keeps
data_meta valid for the stack and TC BPF after eth_type_trans() anchors
mac_header.
Fixes: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-4-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a79332f92be79..4d5e3ec64dfa5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5201,7 +5201,8 @@ static struct sk_buff *stmmac_construct_skb_zc(struct stmmac_channel *ch,
return NULL;
skb_reserve(skb, xdp->data - xdp->data_hard_start);
- memcpy(__skb_put(skb, datasize), xdp->data, datasize);
+ __skb_put(skb, datasize);
+ memcpy(skb->data - metasize, xdp->data_meta, datasize + metasize);
if (metasize)
skb_metadata_set(skb, metasize);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 141/990] net: stmmac: fix VLAN tag stripping on short and non-linear RX frames
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (139 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 140/990] net: stmmac: copy XDP metadata in AF_XDP zero-copy RX Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 142/990] net: stmmac: fix XDP RX buffer DMA sync length Greg Kroah-Hartman
` (711 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Lorenzo Bianconi,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 68bdbffcae08699af5c16f7a2ec61a5489b78dbe ]
stmmac_rx_vlan() reads the VLAN header straight from skb->data and
removes it with skb_pull(), assuming the header is fully present in the
linear part of the skb. XDP can change the frame length and head layout
before the tag is stripped.
An XDP program can use bpf_xdp_adjust_tail() to shrink a frame to as
little as ETH_HLEN while bytes 12-13 still contain a VLAN ethertype. The
driver then reads h_vlan_TCI past skb->len and pops the tag, leaving less
than ETH_HLEN in the skb. eth_type_trans() cannot pull the MAC header, so
a malformed skb is passed up. The TCI is also read from the wrong place
when the tag is not fully in the linear head, e.g. when it spans into a
frag.
Read h_vlan_proto after pulling ETH_HLEN into the linear part, and check
it together with the device features. Only if the tag is actually going
to be popped, pull VLAN_ETH_HLEN and re-derive the header pointer
afterwards, as pskb_may_pull() may reallocate the skb head. Return an
error so the callers can drop a frame that claims a VLAN tag but cannot
provide the full header. This also drops and counts frames shorter than
ETH_HLEN in rx_dropped, even when VLAN RX offload is disabled;
bpf_xdp_adjust_head() and bpf_xdp_adjust_tail() cannot produce such a
frame, so it only affects a runt that reaches the driver, and dropping it
is safer than handing it to eth_type_trans().
Also move the XDP metadata written with bpf_xdp_adjust_meta() together
with the MAC header when the tag is popped, so data_meta still points at
the metadata after eth_type_trans() anchors mac_header, instead of at the
first bytes of the destination MAC.
Fixes: 5fabb01207a2 ("net: stmmac: Add initial XDP support")
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-5-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 48 +++++++++++++------
1 file changed, 33 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4d5e3ec64dfa5..123f2415e745e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4832,22 +4832,35 @@ static netdev_features_t stmmac_features_check(struct sk_buff *skb,
return vlan_features_check(skb, features);
}
-static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
+static int stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
{
- struct vlan_ethhdr *veth = skb_vlan_eth_hdr(skb);
- __be16 vlan_proto = veth->h_vlan_proto;
- u16 vlanid;
+ struct vlan_ethhdr *veth;
- if ((vlan_proto == htons(ETH_P_8021Q) &&
+ if (!pskb_may_pull(skb, ETH_HLEN))
+ return -EINVAL;
+
+ veth = skb_vlan_eth_hdr(skb);
+ if ((veth->h_vlan_proto == htons(ETH_P_8021Q) &&
dev->features & NETIF_F_HW_VLAN_CTAG_RX) ||
- (vlan_proto == htons(ETH_P_8021AD) &&
+ (veth->h_vlan_proto == htons(ETH_P_8021AD) &&
dev->features & NETIF_F_HW_VLAN_STAG_RX)) {
+ __be16 vlan_proto = veth->h_vlan_proto;
+ u8 meta_len = skb_metadata_len(skb);
+ u16 vlanid;
+
/* pop the vlan tag */
+ if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+ return -EINVAL;
+
+ veth = skb_vlan_eth_hdr(skb);
vlanid = ntohs(veth->h_vlan_TCI);
- memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2);
+ memmove(skb->data - meta_len + VLAN_HLEN,
+ skb->data - meta_len, meta_len + ETH_ALEN * 2);
skb_pull(skb, VLAN_HLEN);
__vlan_hwaccel_put_tag(skb, vlan_proto, vlanid);
}
+
+ return 0;
}
/**
@@ -5228,12 +5241,15 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
}
stmmac_get_rx_hwtstamp(priv, p, np, skb);
- if (priv->hw->hw_vlan_en)
+ if (priv->hw->hw_vlan_en) {
/* MAC level stripping. */
stmmac_rx_hw_vlan(priv, priv->hw, p, skb);
- else
- /* Driver level stripping. */
- stmmac_rx_vlan(priv->dev, skb);
+ } else if (stmmac_rx_vlan(priv->dev, skb)) {
+ dev_kfree_skb_any(skb);
+ priv->xstats.rx_dropped++;
+ return;
+ }
+
skb->protocol = eth_type_trans(skb, priv->dev);
if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb))
@@ -5785,12 +5801,14 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
stmmac_get_rx_hwtstamp(priv, p, np, skb);
- if (priv->hw->hw_vlan_en)
+ if (priv->hw->hw_vlan_en) {
/* MAC level stripping. */
stmmac_rx_hw_vlan(priv, priv->hw, p, skb);
- else
- /* Driver level stripping. */
- stmmac_rx_vlan(priv->dev, skb);
+ } else if (stmmac_rx_vlan(priv->dev, skb)) {
+ dev_kfree_skb_any(skb);
+ rx_dropped++;
+ goto next;
+ }
skb->protocol = eth_type_trans(skb, priv->dev);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 142/990] net: stmmac: fix XDP RX buffer DMA sync length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (140 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 141/990] net: stmmac: fix VLAN tag stripping on short and non-linear RX frames Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 143/990] ata: libata-core: Check device support before querying power state Greg Kroah-Hartman
` (710 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 363ff816277d4c7064514b160e655bed1dfb3ed8 ]
stmmac_rx() bounded the DMA sync length by the largest data_end seen
before and after the XDP program and passed it to page_pool_put_page()
on the XDP_CONSUMED path. bpf_xdp_adjust_tail() zeroes the grown area,
which dirties the CPU cache, but a later negative adjust only moves
data_end back. If the program grows and then shrinks the tail, both
endpoints miss the zeroed range, so those dirty cache lines are not
written back before the page is reused.
The length was also wrong since commit 88095728511e ("net: stmmac: fix
rx Scatter-Gather support") moved the page_pool DMA window to offset 0
and set max_len to dma_buf_sz + page_offset: the driver still
subtracted buf->page_offset, so it synced [base, data_end - page_offset)
instead of [base, data_end).
On a non-coherent platform those dirty lines can be evicted after the
device has DMA'd the next frame into the recycled page and corrupt it.
Sync the whole page_pool DMA window on the XDP_CONSUMED path with
page_pool_recycle_direct(), as the PASS path and page_pool allocation
already do. The device only writes [page_offset, page_offset +
dma_buf_sz), so syncing [base, base + max_len) covers every cache line
it can touch, regardless of how the program adjusted the packet.
Fixes: be8b38a722e6 ("net: stmmac: Add support for XDP_TX action")
Fixes: 88095728511e ("net: stmmac: fix rx Scatter-Gather support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-stmmac-xdp-fixes-v2-6-10eae8a093a8@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 123f2415e745e..2e7b146895ba8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5689,8 +5689,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
len -= ETH_FCS_LEN;
if (!skb) {
- unsigned int pre_len, sync_len;
-
/* Each frame starts here: reset the FCS handling */
fcs_stripped = false;
@@ -5708,29 +5706,18 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
xdp_prepare_buff(&ctx.xdp, page_address(buf->page),
buf->page_offset, buf1_len, true);
- pre_len = ctx.xdp.data_end - ctx.xdp.data_hard_start -
- buf->page_offset;
-
ctx.priv = priv;
ctx.desc = p;
ctx.ndesc = np;
skb = stmmac_xdp_run_prog(priv, &ctx.xdp);
- /* Due xdp_adjust_tail: DMA sync for_device
- * cover max len CPU touch
- */
- sync_len = ctx.xdp.data_end - ctx.xdp.data_hard_start -
- buf->page_offset;
- sync_len = max(sync_len, pre_len);
-
/* For Not XDP_PASS verdict */
if (IS_ERR(skb)) {
unsigned int xdp_res = -PTR_ERR(skb);
if (xdp_res & STMMAC_XDP_CONSUMED) {
- page_pool_put_page(rx_q->page_pool,
- virt_to_head_page(ctx.xdp.data),
- sync_len, true);
+ page_pool_recycle_direct(rx_q->page_pool,
+ virt_to_head_page(ctx.xdp.data));
buf->page = NULL;
rx_dropped++;
goto next;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 143/990] ata: libata-core: Check device support before querying power state
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (141 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 142/990] net: stmmac: fix XDP RX buffer DMA sync length Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 144/990] net: lan966x: dont free XDP buffers in fdma tx clear with budget 0 Greg Kroah-Hartman
` (709 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giuseppe Piscitelli, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giuseppe Piscitelli <ooonea@gmail.com>
[ Upstream commit ec585ac78742527f80495dd8f451dcda7e9e7f59 ]
The standby path queries the power state before checking whether the
device accepts ATA power-management commands. This sends CHECK POWER MODE
to ATAPI devices, including the QEMU DVD-ROM, which rejects it.
Run the existing taskfile initialization and device-class check first,
as the active-power path already does.
Fixes: 9cec467d0502 ("ata: libata-core: Do not call ata_dev_power_set_standby() twice")
Signed-off-by: Giuseppe Piscitelli <ooonea@gmail.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20261026202513.669084-1-ooonea@gmail.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 29394d18e7e83..209bd48ee8615 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2046,6 +2046,10 @@ void ata_dev_power_set_standby(struct ata_device *dev)
struct ata_taskfile tf;
unsigned int err_mask;
+ /* Issue STANDBY IMMEDIATE command only if supported by the device */
+ if (!ata_dev_power_init_tf(dev, &tf, false))
+ return;
+
/* If the device is already sleeping or in standby, do nothing. */
if ((dev->flags & ATA_DFLAG_SLEEPING) ||
!ata_dev_power_is_active(dev))
@@ -2064,10 +2068,6 @@ void ata_dev_power_set_standby(struct ata_device *dev)
system_entering_hibernation())
return;
- /* Issue STANDBY IMMEDIATE command only if supported by the device */
- if (!ata_dev_power_init_tf(dev, &tf, false))
- return;
-
ata_dev_notice(dev, "Entering standby power mode\n");
err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 144/990] net: lan966x: dont free XDP buffers in fdma tx clear with budget 0
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (142 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 143/990] ata: libata-core: Check device support before querying power state Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 145/990] drm/panel: visionox-r66451: Send the brightness value MSB first Greg Kroah-Hartman
` (708 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Machon, Simon Horman,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Machon <daniel.machon@microchip.com>
[ Upstream commit 263a5514cb9535380734b5e300b298f82570eb57 ]
lan966x_fdma_tx_clear_buf() runs from the NAPI poll and frees the
buffers of completed tx DCBs with napi_consume_skb(),
page_pool_recycle_direct() and xdp_return_frame_bulk().
netpoll calls the NAPI poll with a budget of 0 and hardirqs disabled.
With a budget of 0, a driver cannot call any XDP or page pool API.
Before this patch, the XDP_TX pages and ndo_xdp_xmit frames are freed
regardless of the budget. With netconsole on the port that owns the
FDMA NAPI, such a buffer is freed with hardirqs disabled, and
__page_pool_put_page() warns via lockdep_assert_no_hardirq().
Leave the XDP buffers of completed DCBs in place when the budget is 0,
and free them in the next NAPI poll. napi_consume_skb() already handles
a budget of 0, so skbs are still freed.
Found by an AI code review agent. Reproduced on a lan9668 board with a
modified kernel that runs the NAPI poll with a budget of 0 and hardirqs
disabled. With the fix the warning is gone.
Fixes: 19c6f534f636 ("net: lan966x: Add support for XDP_TX")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029-lan966x-fdma-tx-clear-budget-v1-1-38c52d7aab8c@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
index 11a341fc45779..6dad3c019f01c 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
@@ -354,6 +354,12 @@ static void lan966x_fdma_tx_clear_buf(struct lan966x *lan966x, int weight)
if (!fdma_db_is_done(db))
continue;
+ /* XDP and page pool APIs can't be used with a budget of 0.
+ * Leave these buffers for the next NAPI poll.
+ */
+ if (!weight && !dcb_buf->use_skb)
+ continue;
+
dcb_buf->dev->stats.tx_packets++;
dcb_buf->dev->stats.tx_bytes += dcb_buf->len;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 145/990] drm/panel: visionox-r66451: Send the brightness value MSB first
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (143 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 144/990] net: lan966x: dont free XDP buffers in fdma tx clear with budget 0 Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 146/990] drm/panel: visionox-r66451: Wait longer after the panel reset Greg Kroah-Hartman
` (707 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vladimir Zapolskiy, Neil Armstrong,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Zapolskiy <vz@kernel.org>
[ Upstream commit 00fe6be187ffde738fdb71ea7deb671fc939e583 ]
The panel expects to get two bytes of the DCS Set Display Brightness
command with the most significant byte first, and it uses the lower
12 bits of the value, use mipi_dsi_dcs_set_display_brightness_large()
to correct the programmed brightness values.
Tested on the SM8350-HDK display card, the display brightness increases
gradually with:
for v in $(seq 16 16 4095); do sleep 0.1; \
echo $v > /sys/class/backlight/ae94000.dsi.0/brightness; \
done
while without the change the display is dark during all writes.
Fixes: a6dfab2738fc ("drm/panel: Add driver for Visionox r66451 panel")
Signed-off-by: Vladimir Zapolskiy <vz@kernel.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20261101212458.2431191-2-vz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/panel/panel-visionox-r66451.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-visionox-r66451.c b/drivers/gpu/drm/panel/panel-visionox-r66451.c
index 690cccedd438f..0ce5c670dbb9b 100644
--- a/drivers/gpu/drm/panel/panel-visionox-r66451.c
+++ b/drivers/gpu/drm/panel/panel-visionox-r66451.c
@@ -227,7 +227,7 @@ static int visionox_r66451_bl_update_status(struct backlight_device *bl)
struct mipi_dsi_device *dsi = bl_get_data(bl);
u16 brightness = backlight_get_brightness(bl);
- return mipi_dsi_dcs_set_display_brightness(dsi, brightness);
+ return mipi_dsi_dcs_set_display_brightness_large(dsi, brightness);
}
static const struct backlight_ops visionox_r66451_bl_ops = {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 146/990] drm/panel: visionox-r66451: Wait longer after the panel reset
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (144 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 145/990] drm/panel: visionox-r66451: Send the brightness value MSB first Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 147/990] sfc: ptp: drop the stale frequency reset in efx_ptp_start() Greg Kroah-Hartman
` (706 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vladimir Zapolskiy, Neil Armstrong,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Zapolskiy <vz@kernel.org>
[ Upstream commit b4b2778d5e175b166e4a27e5df5d61da468ad004 ]
The initialization sequence is sent 10ms after the panel reset is
deasserted, however on the SM8350-HDK display card the panel does not
answer a DCS read at that time, as a result the panel initialization
commands are lost, and the panel does not exit sleep mode and the display
stays black. With the first command sent about 15ms after the reset
the panel comes up reliably, so wait 20ms after deasserting the reset.
Fixes: a6dfab2738fc ("drm/panel: Add driver for Visionox r66451 panel")
Signed-off-by: Vladimir Zapolskiy <vz@kernel.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20261101212458.2431191-3-vz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/panel/panel-visionox-r66451.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-visionox-r66451.c b/drivers/gpu/drm/panel/panel-visionox-r66451.c
index 0ce5c670dbb9b..d2cbc60af1179 100644
--- a/drivers/gpu/drm/panel/panel-visionox-r66451.c
+++ b/drivers/gpu/drm/panel/panel-visionox-r66451.c
@@ -36,7 +36,7 @@ static void visionox_r66451_reset(struct visionox_r66451 *ctx)
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
usleep_range(10000, 10100);
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
- usleep_range(10000, 10100);
+ usleep_range(20000, 21000);
}
static int visionox_r66451_on(struct visionox_r66451 *ctx)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 147/990] sfc: ptp: drop the stale frequency reset in efx_ptp_start()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (145 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 146/990] drm/panel: visionox-r66451: Wait longer after the panel reset Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 148/990] sfc: ptp: serialize host and MC synchronization transactions Greg Kroah-Hartman
` (705 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Alex Austin, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <alex.austin@amd.com>
[ Upstream commit 21d4917cfc8b6837c44d8aa186941a6a16ec17a0 ]
FW does not touch the clock frequency state on MC_CMD_PTP_OP_DISABLE or
MC_CMD_PTP_OP_ENABLE, so the driver doesn't need to either. Doing so
just desyncs the driver's cached current_adjfreq from what FW still has
programmed.
Resetting current_adjfreq to 0 here means the first efx_phc_adjtime()
call after efx_ptp_start() reprograms the NIC's clock frequency to 0,
since efx_phc_adjtime() always sends current_adjfreq to FW alongside
the time step. efx_ptp_start() runs on every SIOCSHWTSTAMP mode change,
on ifup, and on the reset_required path in efx_ptp_worker(), so each of
those silently drops any frequency correction the PTP servo had already
applied.
efx_ptp_start() is also reached from reset recovery, but that is fine:
on an FLR or PCIe reset FW does not touch the NIC clock, and on a full
MC reboot the clock is reset to 1970, so a stale current_adjfreq from
before the reset is hardly consequential - especially as it is bound to
MAX_PPB, 1000000 ppb.
Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@amd.com>
Link: https://patch.msgid.link/20261026123023.3566549-2-alex.austin@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sfc/ptp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 4c7222bf26bec..dbd7281f44b3e 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -1446,7 +1446,6 @@ static int efx_ptp_start(struct efx_nic *efx)
goto fail;
ptp->evt_frag_idx = 0;
- ptp->current_adjfreq = 0;
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 148/990] sfc: ptp: serialize host and MC synchronization transactions
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (146 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 147/990] sfc: ptp: drop the stale frequency reset in efx_ptp_start() Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 149/990] sfc: ptp: avoid racing PPS timestamp updates Greg Kroah-Hartman
` (704 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alex Austin, Alejandro Lucero,
Pieter Jansen van Vuuren, Edward Cree, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <alex.austin@amd.com>
[ Upstream commit f707347b33feebdd67633bccea52f96807c18d6e ]
efx_ptp_synchronize() clears the MC-ready DMA flag before
efx_mcdi_rpc_start() acquires the MCDI interface, and processes results
into ptp->timeset[] after efx_mcdi_rpc_finish() has released it. The PPS
worker and the hwtstamp enable path can therefore clobber each other's
handshake flag and timesets.
Hold a PHC mutex across the whole transaction and over the clock
operations, so efx_phc_settime() reads and adjusts atomically and
current_adjfreq is consistently read and written under one lock. Also
bail out when efx_mcdi_rpc_start() fails rather than finishing an RPC
that was never acquired.
Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@amd.com>
Reviewed-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Acked-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://patch.msgid.link/20261026123023.3566549-3-alex.austin@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sfc/ptp.c | 81 +++++++++++++++++++++++-----------
1 file changed, 55 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index dbd7281f44b3e..f8a88133b15b1 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -36,6 +36,7 @@
#include <linux/errno.h>
#include <linux/ktime.h>
#include <linux/module.h>
+#include <linux/mutex.h>
#include <linux/pps_kernel.h>
#include <linux/ptp_clock_kernel.h>
#include "net_driver.h"
@@ -272,6 +273,8 @@ struct efx_ptp_rxfilter {
* frequency adjustment into a fixed point fractional nanosecond format.
* @current_adjfreq: Current ppb adjustment.
* @phc_clock: Pointer to registered phc device (if primary function)
+ * @phc_lock: Serializes PHC commands and synchronization, and protects
+ * @current_adjfreq
* @phc_clock_info: Registration structure for phc device
* @pps_work: pps work task for handling pps events
* @pps_workwq: pps work queue
@@ -331,6 +334,7 @@ struct efx_ptp_data {
unsigned int adjfreq_ppb_shift;
s64 current_adjfreq;
struct ptp_clock *phc_clock;
+ struct mutex phc_lock;
struct ptp_clock_info phc_clock_info;
struct work_struct pps_work;
struct workqueue_struct *pps_workwq;
@@ -1008,7 +1012,14 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
return 0;
}
-/* Synchronize times between the host and the MC */
+/* Synchronize times between the host and the MC.
+ *
+ * The MC serializes PTP requests, so MC_CMD_PTP_OP_ADJUST cannot be applied
+ * while MC_CMD_PTP_OP_SYNCHRONIZE is collecting timesets. This holds across
+ * functions of a controller, which share the clock but adjust it only through
+ * the function that registered it, so a secondary function can capture here
+ * without serializing against the primary.
+ */
static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
{
struct efx_ptp_data *ptp = efx->ptp_data;
@@ -1027,11 +1038,14 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
MCDI_SET_QWORD(synch_buf, PTP_IN_SYNCHRONIZE_START_ADDR,
ptp->start.dma_addr);
+ mutex_lock(&ptp->phc_lock);
+
/* Clear flag that signals MC ready */
WRITE_ONCE(*start, 0);
rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
- EFX_WARN_ON_ONCE_PARANOID(rc);
+ if (rc)
+ goto out;
/* Wait for start from MCDI (or timeout) */
timeout = jiffies + msecs_to_jiffies(MAX_SYNCHRONISE_WAIT_MS);
@@ -1062,11 +1076,13 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
++ptp->no_time_syncs;
}
+out:
/* Increment the bad syncs counter if the synchronize fails, whatever
* the reason.
*/
if (rc != 0)
++ptp->bad_syncs;
+ mutex_unlock(&ptp->phc_lock);
return rc;
}
@@ -1569,6 +1585,7 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
if (!efx->ptp_data)
return -ENOMEM;
+ mutex_init(&ptp->phc_lock);
ptp->efx = efx;
ptp->channel = channel;
@@ -1640,6 +1657,7 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
efx_nic_free_buffer(efx, &ptp->start);
fail1:
+ mutex_destroy(&ptp->phc_lock);
kfree(efx->ptp_data);
efx->ptp_data = NULL;
@@ -1694,6 +1712,7 @@ void efx_ptp_remove(struct efx_nic *efx)
destroy_workqueue(efx->ptp_data->workwq);
efx_nic_free_buffer(efx, &efx->ptp_data->start);
+ mutex_destroy(&efx->ptp_data->phc_lock);
kfree(efx->ptp_data);
efx->ptp_data = NULL;
}
@@ -2105,23 +2124,23 @@ static int efx_phc_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
MCDI_SET_QWORD(inadj, PTP_IN_ADJUST_FREQ, adjustment_ns);
MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_SECONDS, 0);
MCDI_SET_DWORD(inadj, PTP_IN_ADJUST_NANOSECONDS, 0);
+ mutex_lock(&ptp_data->phc_lock);
rc = efx_mcdi_rpc(efx, MC_CMD_PTP, inadj, sizeof(inadj),
NULL, 0, NULL);
- if (rc != 0)
- return rc;
-
- ptp_data->current_adjfreq = adjustment_ns;
- return 0;
+ if (!rc)
+ ptp_data->current_adjfreq = adjustment_ns;
+ mutex_unlock(&ptp_data->phc_lock);
+ return rc;
}
-static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
+static int _efx_phc_adjtime(struct efx_ptp_data *ptp_data, s64 delta)
+ __must_hold(&ptp_data->phc_lock)
{
- u32 nic_major, nic_minor;
- struct efx_ptp_data *ptp_data = container_of(ptp,
- struct efx_ptp_data,
- phc_clock_info);
- struct efx_nic *efx = ptp_data->efx;
MCDI_DECLARE_BUF(inbuf, MC_CMD_PTP_IN_ADJUST_LEN);
+ struct efx_nic *efx = ptp_data->efx;
+ u32 nic_major, nic_minor;
+
+ lockdep_assert_held(&ptp_data->phc_lock);
efx->ptp_data->ns_to_nic_time(delta, &nic_major, &nic_minor);
@@ -2134,6 +2153,18 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
NULL, 0, NULL);
}
+static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
+{
+ struct efx_ptp_data *ptp_data = container_of(ptp, struct efx_ptp_data,
+ phc_clock_info);
+ int rc;
+
+ mutex_lock(&ptp_data->phc_lock);
+ rc = _efx_phc_adjtime(ptp_data, delta);
+ mutex_unlock(&ptp_data->phc_lock);
+ return rc;
+}
+
static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
struct efx_ptp_data *ptp_data = container_of(ptp,
@@ -2165,23 +2196,21 @@ static int efx_phc_settime(struct ptp_clock_info *ptp,
{
/* Get the current NIC time, efx_phc_gettime.
* Subtract from the desired time to get the offset
- * call efx_phc_adjtime with the offset
+ * call _efx_phc_adjtime with the offset
*/
+ struct efx_ptp_data *ptp_data = container_of(ptp, struct efx_ptp_data,
+ phc_clock_info);
+ struct timespec64 time_now, delta;
int rc;
- struct timespec64 time_now;
- struct timespec64 delta;
+ mutex_lock(&ptp_data->phc_lock);
rc = efx_phc_gettime(ptp, &time_now);
- if (rc != 0)
- return rc;
-
- delta = timespec64_sub(*e_ts, time_now);
-
- rc = efx_phc_adjtime(ptp, timespec64_to_ns(&delta));
- if (rc != 0)
- return rc;
-
- return 0;
+ if (!rc) {
+ delta = timespec64_sub(*e_ts, time_now);
+ rc = _efx_phc_adjtime(ptp_data, timespec64_to_ns(&delta));
+ }
+ mutex_unlock(&ptp_data->phc_lock);
+ return rc;
}
static int efx_phc_enable(struct ptp_clock_info *ptp,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 149/990] sfc: ptp: avoid racing PPS timestamp updates
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (147 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 148/990] sfc: ptp: serialize host and MC synchronization transactions Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 150/990] virtio-spi: Fix virtio_spi_config kernel-doc Greg Kroah-Hartman
` (703 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alex Austin, Alejandro Lucero,
Pieter Jansen van Vuuren, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <alex.austin@amd.com>
[ Upstream commit 23d23e6c6517d0fea4f64340a23e33c89f82c03c ]
efx_ptp_pps_worker() can race with SIOCHWTSTAMP via
efx_ptp_change_mode(). After the worker completes synchronization, the
ioctl can start another synchronization and update host_time_pps while
the worker copies it into the PPS event. This can report a partially
updated timestamp. Serializing synchronization transactions alone does
not protect this copy, which happens after phc_lock is released.
Return the timestamp through the caller's own pps_event_time rather
than the shared field in efx_ptp_data, so the worker reads storage no
one else can write.
Fixes: 7c236c43b838 ("sfc: Add support for IEEE-1588 PTP")
Signed-off-by: Alex Austin <alex.austin@amd.com>
Reviewed-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Link: https://patch.msgid.link/20261026123023.3566549-4-alex.austin@amd.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/sfc/ptp.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index f8a88133b15b1..66a5342660a8e 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -268,7 +268,6 @@ struct efx_ptp_rxfilter {
* @evt_frag_idx: Current fragment number
* @evt_code: Last event code
* @start: Address at which MC indicates ready for synchronisation
- * @host_time_pps: Host time at last PPS
* @adjfreq_ppb_shift: Shift required to convert scaled parts-per-billion
* frequency adjustment into a fixed point fractional nanosecond format.
* @current_adjfreq: Current ppb adjustment.
@@ -330,7 +329,6 @@ struct efx_ptp_data {
int evt_frag_idx;
int evt_code;
struct efx_buffer start;
- struct pps_event_time host_time_pps;
unsigned int adjfreq_ppb_shift;
s64 current_adjfreq;
struct ptp_clock *phc_clock;
@@ -912,7 +910,8 @@ static void efx_ptp_read_timeset(MCDI_DECLARE_STRUCT_PTR(data),
static int
efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
size_t response_length,
- const struct pps_event_time *last_time)
+ const struct pps_event_time *last_time,
+ struct pps_event_time *host_time_pps)
{
unsigned number_readings =
MCDI_VAR_ARRAY_LEN(response_length,
@@ -990,6 +989,10 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
"PTP bad synchronisation seconds\n");
return -EAGAIN;
}
+
+ if (!host_time_pps)
+ return 0;
+
delta.tv_sec = (last_sec - start_sec) & 1;
delta.tv_nsec =
last_time->ts_real.tv_nsec -
@@ -1006,8 +1009,8 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
delta.tv_nsec += ktime_to_timespec64(mc_time).tv_nsec;
/* Set PPS timestamp to match NIC top of second */
- ptp->host_time_pps = *last_time;
- pps_sub_ts(&ptp->host_time_pps, delta);
+ *host_time_pps = *last_time;
+ pps_sub_ts(host_time_pps, delta);
return 0;
}
@@ -1020,7 +1023,8 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
* the function that registered it, so a secondary function can capture here
* without serializing against the primary.
*/
-static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
+static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings,
+ struct pps_event_time *host_time_pps)
{
struct efx_ptp_data *ptp = efx->ptp_data;
MCDI_DECLARE_BUF(synch_buf, MC_CMD_PTP_OUT_SYNCHRONIZE_LENMAX);
@@ -1069,7 +1073,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
&response_length);
if (rc == 0) {
rc = efx_ptp_process_times(efx, synch_buf, response_length,
- &last_time);
+ &last_time, host_time_pps);
if (rc == 0)
++ptp->good_syncs;
else
@@ -1501,14 +1505,15 @@ static void efx_ptp_pps_worker(struct work_struct *work)
{
struct efx_ptp_data *ptp =
container_of(work, struct efx_ptp_data, pps_work);
+ struct pps_event_time host_time_pps = {};
struct efx_nic *efx = ptp->efx;
struct ptp_clock_event ptp_evt;
- if (efx_ptp_synchronize(efx, PTP_SYNC_ATTEMPTS))
+ if (efx_ptp_synchronize(efx, PTP_SYNC_ATTEMPTS, &host_time_pps))
return;
ptp_evt.type = PTP_CLOCK_PPSUSR;
- ptp_evt.pps_times = ptp->host_time_pps;
+ ptp_evt.pps_times = host_time_pps;
ptp_clock_event(ptp->phc_clock, &ptp_evt);
}
@@ -1844,7 +1849,8 @@ int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
rc = efx_ptp_start(efx);
if (rc == 0) {
rc = efx_ptp_synchronize(efx,
- PTP_SYNC_ATTEMPTS * 2);
+ PTP_SYNC_ATTEMPTS * 2,
+ NULL);
if (rc != 0)
efx_ptp_stop(efx);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 150/990] virtio-spi: Fix virtio_spi_config kernel-doc
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (148 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 149/990] sfc: ptp: avoid racing PPS timestamp updates Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 151/990] vdpa_sim: serialize IOTLB updates with dataplane access Greg Kroah-Hartman
` (702 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Karl Mehltretter, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <kmehltretter@gmail.com>
[ Upstream commit 62b0a9b11e94a4bc7f67c89348d0619cba82b54b ]
struct virtio_spi_config contains max_cs_inactive_ns, but its
kernel-doc describes max_cs_incative_ns. This leaves the real member
undescribed and adds a nonexistent member to the generated
documentation.
Correct the spelling.
Fixes: 6a1f3390fafe ("virtio-spi: Add virtio-spi.h")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260909064938.90995-1-kmehltretter@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/uapi/linux/virtio_spi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/virtio_spi.h b/include/uapi/linux/virtio_spi.h
index 8ab3c970cdd31..459c2276c938c 100644
--- a/include/uapi/linux/virtio_spi.h
+++ b/include/uapi/linux/virtio_spi.h
@@ -73,7 +73,7 @@
* @max_cs_hold_ns: the maximum delay supported before chipselect is deasserted,
* in ns unit, 0 means delay is not supported to introduce before chipselect
* is deasserted.
- * @max_cs_incative_ns: maximum delay supported after chipselect is deasserted,
+ * @max_cs_inactive_ns: maximum delay supported after chipselect is deasserted,
* in ns unit, 0 means delay is not supported to introduce after chipselect is
* deasserted.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 151/990] vdpa_sim: serialize IOTLB updates with dataplane access
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (149 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 150/990] virtio-spi: Fix virtio_spi_config kernel-doc Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 152/990] vdpa: invalidate DMA mappings before releasing memory Greg Kroah-Hartman
` (701 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit 8517ed4429a2eefd002dce00ea46e23e6714350b ]
The simulator translates IOTLB entries into iovecs or bvecs under
iommu_lock, then drops the lock before copying data. A concurrent DMA
unmap can delete the mapping and release its pinned backing pages while
the copy is still in progress, leading to a UAF in _copy_from_iter().
Use the existing simulator mutex to serialize DMA map changes with the
full backend work function. Also make vhost-vdpa stop device access before
unpinning the backing pages. Otherwise, waiting in the simulator DMA unmap
callback happens after the pages have already been released and cannot
protect their lifetime.
Keep iommu_lock for the IOTLB table itself and avoid adding a second
long-lived lock to the simulator.
I found this bug myself, though the patch was written with AI assistance.
Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
Assisted-by: OpenAI-Codex:GPT-5
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20260911-fix-vdpa-iotlb-lifetime-v3-1-8766d371748e@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++++
drivers/vhost/vdpa.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index 44055778b6940..50a28e35d185a 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -716,6 +716,7 @@ static int vdpasim_dma_map(struct vdpa_device *vdpa, unsigned int asid,
if (asid >= vdpasim->dev_attr.nas)
return -EINVAL;
+ mutex_lock(&vdpasim->mutex);
spin_lock(&vdpasim->iommu_lock);
if (vdpasim->iommu_pt[asid]) {
vhost_iotlb_reset(&vdpasim->iommu[asid]);
@@ -724,6 +725,7 @@ static int vdpasim_dma_map(struct vdpa_device *vdpa, unsigned int asid,
ret = vhost_iotlb_add_range_ctx(&vdpasim->iommu[asid], iova,
iova + size - 1, pa, perm, opaque);
spin_unlock(&vdpasim->iommu_lock);
+ mutex_unlock(&vdpasim->mutex);
return ret;
}
@@ -736,6 +738,7 @@ static int vdpasim_dma_unmap(struct vdpa_device *vdpa, unsigned int asid,
if (asid >= vdpasim->dev_attr.nas)
return -EINVAL;
+ mutex_lock(&vdpasim->mutex);
spin_lock(&vdpasim->iommu_lock);
if (vdpasim->iommu_pt[asid]) {
vhost_iotlb_reset(&vdpasim->iommu[asid]);
@@ -743,6 +746,7 @@ static int vdpasim_dma_unmap(struct vdpa_device *vdpa, unsigned int asid,
}
vhost_iotlb_del_range(&vdpasim->iommu[asid], iova, iova + size - 1);
spin_unlock(&vdpasim->iommu_lock);
+ mutex_unlock(&vdpasim->mutex);
return 0;
}
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index e4ddaf0e5abc6..62c2ea705b38b 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -974,6 +974,8 @@ static void vhost_vdpa_pa_unmap(struct vhost_vdpa *v, struct vhost_iotlb *iotlb,
unsigned long pfn, pinned;
while ((map = vhost_iotlb_itree_first(iotlb, start, last)) != NULL) {
+ /* Stop device access before releasing the pinned pages. */
+ vhost_vdpa_general_unmap(v, map, asid);
pinned = PFN_DOWN(map->size);
for (pfn = PFN_DOWN(map->addr);
pinned > 0; pfn++, pinned--) {
@@ -983,7 +985,6 @@ static void vhost_vdpa_pa_unmap(struct vhost_vdpa *v, struct vhost_iotlb *iotlb,
unpin_user_page(page);
}
atomic64_sub(PFN_DOWN(map->size), &dev->mm->pinned_vm);
- vhost_vdpa_general_unmap(v, map, asid);
vhost_iotlb_map_free(iotlb, map);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 152/990] vdpa: invalidate DMA mappings before releasing memory
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (150 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 151/990] vdpa_sim: serialize IOTLB updates with dataplane access Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 153/990] vhost-scsi: preserve event ordering Greg Kroah-Hartman
` (700 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit acbf36deb53d9e14e4768bf58883795a8232aa5b ]
vdpa can release pinned pages and file references before the device stops
using the corresponding mappings, allowing stale DMA to corrupt memory.
Invalidate mappings before dropping their backing references. For set_map
backends, publish an IOTLB without the invalidated range and keep the old
references if that fails. Do this immediately even within a batch.
Serialize vdpa_sim set_map updates with its worker so publishing a new map
cannot race an active transfer. Abort mlx5 map replacement when resumable
virtqueues cannot be suspended, since changing the memory region while
those queues remain active would preserve the same stale DMA window. Reject
zero-sized and wrapping invalidations before calculating their inclusive
range end.
I found this bug myself, though the patch was written with AI assistance.
Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Assisted-by: OpenAI-Codex:GPT-5
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20260911-fix-vdpa-iotlb-lifetime-v3-2-8766d371748e@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++-
drivers/vdpa/vdpa_sim/vdpa_sim.c | 3 +++
drivers/vhost/vdpa.c | 40 ++++++++++++++++++++++++-------
3 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index c49167d760a62..6cf55ce8ad4a8 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -3048,7 +3048,15 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
bool teardown = !is_resumable(ndev);
int err;
- suspend_vqs(ndev, 0, ndev->cur_num_vqs);
+ if ((mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) && !mvdev->suspended) {
+ err = suspend_vqs(ndev, 0, ndev->cur_num_vqs);
+ if (err && !teardown) {
+ for (int i = 0; i < ndev->cur_num_vqs; i++)
+ resume_vqs(ndev, i, 1);
+ mlx5_vdpa_put_mr(mvdev, new_mr);
+ return err;
+ }
+ }
if (teardown) {
err = save_channels_info(ndev);
if (err) {
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index 50a28e35d185a..aeed6bab3e174 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -641,6 +641,7 @@ static int vdpasim_set_map(struct vdpa_device *vdpa, unsigned int asid,
if (asid >= vdpasim->dev_attr.nas)
return -EINVAL;
+ mutex_lock(&vdpasim->mutex);
spin_lock(&vdpasim->iommu_lock);
iommu = &vdpasim->iommu[asid];
@@ -655,11 +656,13 @@ static int vdpasim_set_map(struct vdpa_device *vdpa, unsigned int asid,
goto err;
}
spin_unlock(&vdpasim->iommu_lock);
+ mutex_unlock(&vdpasim->mutex);
return 0;
err:
vhost_iotlb_reset(iommu);
spin_unlock(&vdpasim->iommu_lock);
+ mutex_unlock(&vdpasim->mutex);
return ret;
}
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 62c2ea705b38b..eeb57c832d740 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -996,10 +996,10 @@ static void vhost_vdpa_va_unmap(struct vhost_vdpa *v, struct vhost_iotlb *iotlb,
struct vdpa_map_file *map_file;
while ((map = vhost_iotlb_itree_first(iotlb, start, last)) != NULL) {
+ vhost_vdpa_general_unmap(v, map, asid);
map_file = (struct vdpa_map_file *)map->opaque;
fput(map_file->file);
kfree(map_file);
- vhost_vdpa_general_unmap(v, map, asid);
vhost_iotlb_map_free(iotlb, map);
}
}
@@ -1073,21 +1073,39 @@ static int vhost_vdpa_map(struct vhost_vdpa *v, struct vhost_iotlb *iotlb,
return 0;
}
-static void vhost_vdpa_unmap(struct vhost_vdpa *v,
- struct vhost_iotlb *iotlb,
- u64 iova, u64 size)
+static int vhost_vdpa_unmap(struct vhost_vdpa *v,
+ struct vhost_iotlb *iotlb,
+ u64 iova, u64 size)
{
struct vdpa_device *vdpa = v->vdpa;
const struct vdpa_config_ops *ops = vdpa->config;
+ struct vhost_iotlb_map *map;
+ struct vhost_iotlb new_iotlb;
u32 asid = iotlb_to_asid(iotlb);
+ u64 last = iova + size - 1;
+ int ret;
- vhost_vdpa_iotlb_unmap(v, iotlb, iova, iova + size - 1, asid);
+ if (ops->set_map && !ops->dma_map) {
+ vhost_iotlb_init(&new_iotlb, iotlb->limit, iotlb->flags);
+ list_for_each_entry(map, &iotlb->list, link) {
+ if (map->start <= last && map->last >= iova)
+ continue;
+ ret = vhost_iotlb_add_range_ctx(&new_iotlb, map->start,
+ map->last, map->addr,
+ map->perm, map->opaque);
+ if (ret)
+ goto reset;
+ }
- if (ops->set_map) {
- if (!v->in_batch)
- ops->set_map(vdpa, asid, iotlb);
+ ret = ops->set_map(vdpa, asid, &new_iotlb);
+reset:
+ vhost_iotlb_reset(&new_iotlb);
+ if (ret)
+ return ret;
}
+ vhost_vdpa_iotlb_unmap(v, iotlb, iova, last, asid);
+ return 0;
}
static int vhost_vdpa_va_map(struct vhost_vdpa *v,
@@ -1337,7 +1355,11 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev, u32 asid,
r = vhost_vdpa_process_iotlb_update(v, iotlb, msg);
break;
case VHOST_IOTLB_INVALIDATE:
- vhost_vdpa_unmap(v, iotlb, msg->iova, msg->size);
+ if (!msg->size || msg->iova > U64_MAX - msg->size + 1) {
+ r = -EINVAL;
+ break;
+ }
+ r = vhost_vdpa_unmap(v, iotlb, msg->iova, msg->size);
break;
case VHOST_IOTLB_BATCH_BEGIN:
v->batch_asid = asid;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 153/990] vhost-scsi: preserve event ordering
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (151 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 152/990] vdpa: invalidate DMA mappings before releasing memory Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 154/990] vhost-scsi: do not relock event vq mutex on send_evt fallback Greg Kroah-Hartman
` (699 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Mike Christie,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit a9a428115b7d8aa45e12e41899f90f60551bfa82 ]
vhost_scsi_send_evt() uses llist_add(), so pending events are LIFO.
vhost_scsi_complete_events() walks the detached list directly.
This can deliver a later hotplug or hotunplug event before an earlier
one.
Reverse the detached list before processing it.
This keeps delivery in enqueue order.
Fixes: a6c9af87363c ("tcm_vhost: Add hotplug/hotunplug support")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260915094244.7900-2-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index fac400b25dad7..4e078d439836a 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -636,7 +636,7 @@ static void vhost_scsi_complete_events(struct vhost_scsi *vs, bool drop)
struct llist_node *llnode;
mutex_lock(&vq->mutex);
- llnode = llist_del_all(&vs->vs_event_list);
+ llnode = llist_reverse_order(llist_del_all(&vs->vs_event_list));
llist_for_each_entry_safe(evt, t, llnode, list) {
if (!drop)
vhost_scsi_do_evt_work(vs, evt);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 154/990] vhost-scsi: do not relock event vq mutex on send_evt fallback
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (152 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 153/990] vhost-scsi: preserve event ordering Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 155/990] vhost: fix dirty logging for in-order used ring entries Greg Kroah-Hartman
` (698 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Mike Christie,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit a016d03a9cfe29aeeba438f32f8e8f63291e3275 ]
vhost_scsi_send_evt() is called with the event virtqueue mutex held.
If the worker is gone, the fallback currently calls
vhost_scsi_complete_events(), which tries to acquire the same mutex again
and deadlocks the caller.
Split event completion into a helper for callers that already hold the
mutex and a locking wrapper for the event worker. Use the helper on the
fallback path.
Link: https://lore.kernel.org/all/20260905005352.1E5B01F00A3D@smtp.kernel.org/
Fixes: b1b2ce58ed23 ("vhost-scsi: Handle vhost_vq_work_queue failures for events")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260915094244.7900-3-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 4e078d439836a..d39dc7d215c09 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -629,19 +629,26 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
vhost_scsi_log_write(vq, vq_log, log_num);
}
-static void vhost_scsi_complete_events(struct vhost_scsi *vs, bool drop)
+/* Caller must hold the event virtqueue mutex. */
+static void __vhost_scsi_complete_events(struct vhost_scsi *vs, bool drop)
{
- struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
struct vhost_scsi_evt *evt, *t;
struct llist_node *llnode;
- mutex_lock(&vq->mutex);
llnode = llist_reverse_order(llist_del_all(&vs->vs_event_list));
llist_for_each_entry_safe(evt, t, llnode, list) {
if (!drop)
vhost_scsi_do_evt_work(vs, evt);
vhost_scsi_free_evt(vs, evt);
}
+}
+
+static void vhost_scsi_complete_events(struct vhost_scsi *vs, bool drop)
+{
+ struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
+
+ mutex_lock(&vq->mutex);
+ __vhost_scsi_complete_events(vs, drop);
mutex_unlock(&vq->mutex);
}
@@ -1835,7 +1842,7 @@ vhost_scsi_send_evt(struct vhost_scsi *vs, struct vhost_virtqueue *vq,
llist_add(&evt->list, &vs->vs_event_list);
if (!vhost_vq_work_queue(vq, &vs->vs_event_work))
- vhost_scsi_complete_events(vs, true);
+ __vhost_scsi_complete_events(vs, true);
}
static void vhost_scsi_evt_handle_kick(struct vhost_work *work)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 155/990] vhost: fix dirty logging for in-order used ring entries
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (153 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 154/990] vhost-scsi: do not relock event vq mutex on send_evt fallback Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 156/990] virtio_pci: add missing newline to the pmcsr error message Greg Kroah-Hartman
` (697 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit bfcde6b64769bc168037b8bd882de4def4b2b3f4 ]
With VIRTIO_F_IN_ORDER, one used ring element can represent multiple
buffers, so vhost_add_used_n_in_order() can write consecutive elements to
nonadjacent slots. Dirty logging combines the initial slot with a length
based on the final position, which can miss written elements or log past
the end of the ring.
Replay nheads[] after the write barrier and log the written slots,
coalescing adjacent elements and splitting at gaps and wraps.
Fixes: 67a873df0c41 ("vhost: basic in order support")
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20260912-fix-log_write-v1-1-72c23db01268@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/vhost.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 78cee55cedf85..87079382c9714 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -3136,7 +3136,6 @@ static int vhost_add_used_n_in_order(struct vhost_virtqueue *vq,
return -EINVAL;
start = vq->last_used_idx & (vq->num - 1);
- used = vq->used->ring + start;
for (i = 0; i < count; i++) {
if (vhost_put_used(vq, &heads[i], start, 1)) {
@@ -3149,14 +3148,31 @@ static int vhost_add_used_n_in_order(struct vhost_virtqueue *vq,
}
if (unlikely(vq->log_used)) {
+ unsigned int log_count = 0;
+ int log_start = 0, next;
+
/* Make sure data is seen before log. */
smp_wmb();
- /* Log used ring entry write. */
- log_used(vq, ((void __user *)used - (void __user *)vq->used),
- (vq->num - start) * sizeof *used);
- if (start + count > vq->num)
- log_used(vq, 0,
- (start + count - vq->num) * sizeof *used);
+ /* Log contiguous runs of used ring entries that were written. */
+ start = vq->last_used_idx & (vq->num - 1);
+ for (i = 0; i < count; i++) {
+ if (!log_count)
+ log_start = start;
+ log_count++;
+
+ next = start + nheads[i];
+ if (next >= vq->num)
+ next -= vq->num;
+ if (i + 1 == count || next != start + 1) {
+ used = vq->used->ring + log_start;
+ log_used(vq,
+ ((void __user *)used -
+ (void __user *)vq->used),
+ log_count * sizeof(*used));
+ log_count = 0;
+ }
+ start = next;
+ }
}
old = vq->last_used_idx;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 156/990] virtio_pci: add missing newline to the pmcsr error message
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (154 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 155/990] vhost: fix dirty logging for in-order used ring entries Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 157/990] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit() Greg Kroah-Hartman
` (696 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Maoxia, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoxia <2312891301@qq.com>
[ Upstream commit 104d58a6d2592898fbb6989732600b07d543a8e5 ]
The error message emitted when the PCI power management control
register cannot be read is not newline-terminated, so the next kernel
message is appended to it on the same line.
Add the missing '\n'.
Fixes: dff4fa0e5785 ("virtio: Add support for no-reset virtio PCI PM")
Signed-off-by: Maoxia <2312891301@qq.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <tencent_031B923A83E0DEE884BD05D49030890C0406@qq.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/virtio/virtio_pci_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index 64806d042dbb2..9d4f0f0d70879 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -636,7 +636,7 @@ static bool vp_supports_pm_no_reset(struct device *dev)
pci_read_config_word(pci_dev, pci_dev->pm_cap + PCI_PM_CTRL, &pmcsr);
if (PCI_POSSIBLE_ERROR(pmcsr)) {
- dev_err(dev, "Unable to query pmcsr");
+ dev_err(dev, "Unable to query pmcsr\n");
return false;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 157/990] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (155 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 156/990] virtio_pci: add missing newline to the pmcsr error message Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 158/990] vhost: reject invalid IOTLB update permissions Greg Kroah-Hartman
` (695 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, co+6dcbccedc9ec6452, Xiang Mei,
Michael S. Tsirkin, Paul Moses, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Mei <xmei5@asu.edu>
[ Upstream commit 1f8824fe7f6eaaf2355404db08d3cd05a28aa576 ]
genlmsg_reply() consumes the reply skb on every outcome: netlink_unicast()
frees it whether it queues it, drops it, or bails out early.
vdpa_nl_cmd_dev_config_get_doit() lets its return value fall through to the
shared error label, which calls nlmsg_free(msg) again and double-frees the
sk_buff on any reply failure. The failure is reachable unprivileged:
VDPA_CMD_DEV_CONFIG_GET carries no GENL_ADMIN_PERM, so batching several
requests into one sendto() on a socket with a shrunken SO_RCVBUF fills the
receive queue, and netlink_attachskb() then takes its MSG_DONTWAIT path,
freeing the skb and returning -EAGAIN.
Set msg to NULL once genlmsg_reply() has consumed it so the shared exit
path frees the skb only on the early error gotos that still own it;
nlmsg_free(NULL) is a no-op.
BUG: KASAN: slab-use-after-free in sk_skb_reason_drop (net/core/skbuff.c:1220)
Read of size 4 at addr ffff88800d99d49c by task exploit/147
Call Trace:
sk_skb_reason_drop (net/core/skbuff.c:1220)
vdpa_nl_cmd_dev_config_get_doit (drivers/vdpa/vdpa.c:1324)
genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114)
genl_rcv_msg (net/netlink/genetlink.c:1194)
netlink_rcv_skb (net/netlink/af_netlink.c:2556)
genl_rcv (net/netlink/genetlink.c:1218)
netlink_unicast (net/netlink/af_netlink.c:1345)
netlink_sendmsg (net/netlink/af_netlink.c:1900)
__sys_sendto (net/socket.c:2281)
__x64_sys_sendto (net/socket.c:2284)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The buggy address belongs to the object at ffff88800d99d3c0
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 220 bytes inside of
freed 232-byte region [ffff88800d99d3c0, ffff88800d99d4a8)
Fixes: ad69dd0bf26b ("vdpa: Introduce query of device config layout")
Reported-by: co+6dcbccedc9ec6452@bugs.sh
Closes: https://lore.kernel.org/all/ILTHcT8oe1HP47sY25JVxssvKmkCTjYlX9Hs%40bugs.sh/
Assisted-by: Claude:claude-opus-5
Signed-off-by: Xiang Mei <xmei5@asu.edu>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Paul Moses <p@1g4.org>
Message-ID: <20260912215401.126194-1-xmei5@asu.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vdpa/vdpa.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index caf0ee5d6856c..3d25238873afb 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1314,15 +1314,16 @@ static int vdpa_nl_cmd_dev_config_get_doit(struct sk_buff *skb, struct genl_info
}
err = vdpa_dev_config_fill(vdev, msg, info->snd_portid, info->snd_seq,
0, info->extack);
- if (!err)
+ if (!err) {
err = genlmsg_reply(msg, info);
+ msg = NULL;
+ }
mdev_err:
put_device(dev);
dev_err:
up_read(&vdpa_dev_lock);
- if (err)
- nlmsg_free(msg);
+ nlmsg_free(msg);
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 158/990] vhost: reject invalid IOTLB update permissions
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (156 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 157/990] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit() Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 159/990] vhost-vdpa: drop the parents vq callback before the call fd is released Greg Kroah-Hartman
` (694 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit b179f21d2d8a60ede29a00472bffdefb0284ef39 ]
vhost_chr_write_iter() validates the type and size of an IOTLB update, but
does not validate its permission field. An invalid permission can therefore
reach perm_to_iommu_flags() and trigger its warning in vhost_vdpa_map().
Reject IOTLB UPDATE messages whose permission field is empty or contains
bits outside VHOST_ACCESS_RW before dispatching them to a backend.
Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260913-fix-vhost_chr_write_iter-v1-1-76bf1f436cfe@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/vhost.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 87079382c9714..f8fc0c1a10009 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1734,7 +1734,8 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
goto done;
}
- if (msg.type == VHOST_IOTLB_UPDATE && msg.size == 0) {
+ if (msg.type == VHOST_IOTLB_UPDATE &&
+ (!msg.size || !msg.perm || (msg.perm & ~VHOST_ACCESS_RW))) {
ret = -EINVAL;
goto done;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 159/990] vhost-vdpa: drop the parents vq callback before the call fd is released
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (157 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 158/990] vhost: reject invalid IOTLB update permissions Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 160/990] virtio-blk: clamp max_segments to virtqueue ring size Greg Kroah-Hartman
` (693 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yu Zhang, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhang <yuz08559@gmail.com>
[ Upstream commit c9c1c1b7b31fc8b9a5d6c04f5f0ae647d081a39d ]
VHOST_SET_VRING_CALL releases the previous call eventfd inside
vhost_vring_ioctl() -- it swaps the new context into vq->call_ctx.ctx
and then eventfd_ctx_put()s the old one, which is a synchronous
kfree(). The parent vdpa device is only told about the change
afterwards, when vhost_vdpa_vring_ioctl() reaches ops->set_vq_cb().
Parent drivers cache the pointer handed to them in
vdpa_callback::trigger and do not take a reference on it, so
throughout that window the parent holds a dangling eventfd_ctx and may
signal it. The documentation added with the field describes what
signalling it means but says nothing about how long it stays valid.
This is the same hazard that "vhost_vdpa: assign irq bypass producer
token correctly" addressed for the irq bypass producer token, by
moving vhost_vdpa_unsetup_vq_irq() ahead of the vhost_vring_ioctl()
call. The producer token was only one of the two consumers of that
pointer; the one the parent keeps via ->set_vq_cb() was left behind
the free.
With VDUSE the window is directly reachable from userspace, because
the device emulation daemon can inject an interrupt at any time from a
different fd, and neither side shares a lock with the other: VDUSE
takes vq->irq_lock, vhost takes vhost_dev.mutex + vq->mutex.
BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x76/0xe0
Write of size 4 at addr ffff8881084e8788 by task vduse_uaf/2987
_raw_spin_lock_irqsave+0x76/0xe0
eventfd_signal_mask+0x69/0x120
vduse_dev_ioctl+0x337/0x1a60 <- vduse_vq_signal_irqfd(), inlined
__x64_sys_ioctl+0x120/0x170 <- VDUSE_VQ_INJECT_IRQ
Allocated by task 2986:
do_eventfd+0x50/0x200
__x64_sys_eventfd2+0x2e/0x40
kmalloc-64, freed 64-byte region [ffff8881084e8780, ffff8881084e87c0)
One thread loops VHOST_SET_VRING_CALL on /dev/vhost-vdpa-N with a
fresh eventfd and then unbinds it, while another loops
VDUSE_VQ_INJECT_IRQ on /dev/vduse/<name>. This reproduces in 5 out of
5 ten-second runs on v7.1.6 and 3 out of 3 on v7.2-rc6. With the patch
there are no reports in 3 out of 3 runs on either, while the same
workload still gets ~30000 interrupts per run delivered into live
eventfds, so the path is still being exercised.
Tell the parent to drop the callback before vhost_vring_ioctl() can
free the eventfd, mirroring what is already done for the bypass
producer, and restore it if the ioctl fails -- on failure the swap
never happened, the old context is still installed, and leaving the
parent without a callback would silently drop that vq's interrupts.
Clearing the callback only stops a parent from starting to use the
context; a handler that already loaded it can still be running. For
parents with a real interrupt, wait for it with synchronize_irq() on
the vq's irq. VDUSE does not implement get_vq_irq, so that case stays
covered by the teardown above.
Fixes: 5e68470f4e80 ("vdpa: Add eventfd for the vdpa callback")
Signed-off-by: Yu Zhang <yuz08559@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260918040436.47982-1-yuz08559@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/vdpa.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index eeb57c832d740..665739ba03f8e 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -765,13 +765,46 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
if (ops->get_status(vdpa) &
VIRTIO_CONFIG_S_DRIVER_OK)
vhost_vdpa_unsetup_vq_irq(v, idx);
+ /*
+ * The parent caches call_ctx.ctx in cb.trigger without
+ * holding a reference, so it has to stop using it
+ * before vhost_vring_ioctl() drops the last one.
+ */
+ cb.callback = NULL;
+ cb.private = NULL;
+ cb.trigger = NULL;
+ ops->set_vq_cb(vdpa, idx, &cb);
+
+ /*
+ * A parent interrupt handler that loaded the callback
+ * before that store can still be running, so wait for
+ * it to finish with the context too.
+ */
+ if (ops->get_vq_irq) {
+ int irq = ops->get_vq_irq(vdpa, idx);
+
+ if (irq >= 0)
+ synchronize_irq(irq);
+ }
}
break;
}
r = vhost_vring_ioctl(&v->vdev, cmd, argp);
- if (r)
+ if (r) {
+ /*
+ * A failure here means the swap never happened and the old
+ * context is still installed, so give the parent back the
+ * callback that was torn down above.
+ */
+ if (cmd == VHOST_SET_VRING_CALL && vq->call_ctx.ctx) {
+ cb.callback = vhost_vdpa_virtqueue_cb;
+ cb.private = vq;
+ cb.trigger = vq->call_ctx.ctx;
+ ops->set_vq_cb(vdpa, idx, &cb);
+ }
return r;
+ }
switch (cmd) {
case VHOST_SET_VRING_ADDR:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 160/990] virtio-blk: clamp max_segments to virtqueue ring size
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (158 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 159/990] vhost-vdpa: drop the parents vq callback before the call fd is released Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 161/990] vduse: avoid infinite loop when no affinity CPU is online Greg Kroah-Hartman
` (692 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stjepan Poljak, Sergii Ushakov,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergii Ushakov <sergiiushakov@google.com>
[ Upstream commit 434d2bc41bd0c0ac576d4d259bd9f2ab49071174 ]
In virtblk_add_req(), each request consumes 2 extra descriptors (out_hdr
and in_hdr) in addition to the data scatter-gather segments.
When a hypervisor (e.g. QNX Hypervisor) advertises VIRTIO_BLK_F_SEG_MAX
with seg_max = 1024 alongside a 1024-entry split ring (vring.num = 1024)
and VIRTIO_RING_F_INDIRECT_DESC disabled, lim->max_segments is set to
1024. When the block layer submits requests with 1023 or 1024 data
segments, total_sg reaches 1025 or 1026. This exceeds vring.num (1024),
causing virtqueue_add_split() to return -ENOSPC and permanently wedge
the blk-mq queue.
Furthermore, the Virtio specification (2.7.5.3.1) requires that a
descriptor chain never exceed the Queue Size, and virtqueue_add_split()
falls back to direct descriptors if indirect table allocation fails.
Fix this by:
1. Rejecting queues with ring_size < 3 at probe, or
ring_size < (queue_max_segments + 2) during resume/reset recovery in
init_vq().
2. Unconditionally clamping sg_elems to (ring_size - 2) across all
virtqueues in virtblk_read_limits().
Reported-by: Stjepan Poljak <stjepan.poljak@gmail.com>
Fixes: 0864b79a1533 ("virtio: block: dynamic maximum segments")
Signed-off-by: Sergii Ushakov <sergiiushakov@google.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260918135120.1261150-1-sergiiushakov@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/virtio_blk.c | 44 +++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index feb4dab8eac7b..6cfad73bf47df 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1020,6 +1020,30 @@ static int init_vq(struct virtio_blk *vblk)
goto out;
for (i = 0; i < num_vqs; i++) {
+ unsigned int ring_size = virtqueue_get_vring_size(vqs[i]);
+ /*
+ * Each request consumes 2 extra descriptors (out_hdr and
+ * in_hdr) in addition to the data segments.
+ *
+ * At initial probe (!vblk->disk), each virtqueue must fit at
+ * least 1 data segment + 2 header descriptors (3).
+ * On resume/recovery (vblk->disk), each virtqueue must fit the
+ * existing queue_max_segments() + 2 header descriptors.
+ */
+ unsigned int min_ring_size = 3;
+
+ if (vblk->disk)
+ min_ring_size = queue_max_segments(vblk->disk->queue) + 2;
+
+ if (ring_size < min_ring_size) {
+ dev_err(&vdev->dev,
+ "virtqueue %u ring size %u is smaller than minimum %u\n",
+ i, ring_size, min_ring_size);
+ vdev->config->del_vqs(vdev);
+ err = -EINVAL;
+ goto out;
+ }
+
spin_lock_init(&vblk->vqs[i].lock);
vblk->vqs[i].vq = vqs[i];
}
@@ -1247,7 +1271,7 @@ static int virtblk_read_limits(struct virtio_blk *vblk,
u16 min_io_size;
u8 physical_block_exp, alignment_offset;
size_t max_dma_size;
- int err;
+ int err, i;
/* We need to know how many segments before we allocate. */
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SEG_MAX,
@@ -1261,6 +1285,23 @@ static int virtblk_read_limits(struct virtio_blk *vblk,
/* Prevent integer overflows and honor max vq size */
sg_elems = min_t(u32, sg_elems, VIRTIO_BLK_MAX_SG_ELEMS - 2);
+ /*
+ * virtblk_add_req() uses separate outgoing and incoming header
+ * descriptors (out_hdr and in_hdr), consuming 2 extra descriptors
+ * per request in addition to the data segments.
+ *
+ * Per virtio specification (2.7.5.3.1), a driver MUST NOT create a
+ * descriptor chain longer than the Queue Size of the device.
+ *
+ * Clamp max_segments to (ring_size - 2) across all virtqueues so
+ * that a request never exceeds the ring size of any queue.
+ */
+ for (i = 0; i < vblk->num_vqs; i++) {
+ u32 ring_size = virtqueue_get_vring_size(vblk->vqs[i].vq);
+
+ sg_elems = min_t(u32, sg_elems, ring_size - 2);
+ }
+
/* We can handle whatever the host told us to handle. */
lim->max_segments = sg_elems;
@@ -1460,6 +1501,7 @@ static int virtblk_probe(struct virtio_device *vdev)
mutex_init(&vblk->vdev_mutex);
vblk->vdev = vdev;
+ vblk->disk = NULL;
INIT_WORK(&vblk->config_work, virtblk_config_changed_work);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 161/990] vduse: avoid infinite loop when no affinity CPU is online
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (159 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 160/990] virtio-blk: clamp max_segments to virtqueue ring size Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 162/990] virtio_blk: Reset device on probe error paths after DRIVER_OK Greg Kroah-Hartman
` (691 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit cf0a5805d43236e308f14188f9737ddcf83fb53a ]
If all CPUs in vq->irq_affinity are offline, cpumask_next() walks to the
end of the mask, and the loop then resets the cursor to IRQ_UNBOUND and
restarts the scan. When VDUSE_VQ_INJECT_IRQ is issued, the intersection of
vq->irq_affinity and cpu_online_mask is empty, so the caller busy-loops in
kernel context on its current CPU (e.g. CPU2).
Replace the while loop in vduse_vq_update_effective_cpu() with
cpumask_next_and_wrap() to find the intersection of vq->irq_affinity and
cpu_online_mask in a single wrapped scan. If the intersection is empty, set
curr_cpu to IRQ_UNBOUND and let the existing unbound workqueue handle
injection, avoiding repeated rescans when all CPUs in the affinity are
offline. Use cpus_read_lock()/cpus_read_unlock() to keep the selected CPU
online.
Fixes: 28f6288eb63d ("vduse: Support set_vq_affinity callback")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260919083933.104437-1-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index f9547ede71be7..d68858acc5d9c 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/cdev.h>
#include <linux/device.h>
+#include <linux/cpu.h>
#include <linux/eventfd.h>
#include <linux/slab.h>
#include <linux/wait.h>
@@ -1239,14 +1240,10 @@ static void vduse_vq_update_effective_cpu(struct vduse_virtqueue *vq)
{
int curr_cpu = vq->irq_effective_cpu;
- while (true) {
- curr_cpu = cpumask_next(curr_cpu, &vq->irq_affinity);
- if (cpu_online(curr_cpu))
- break;
-
- if (curr_cpu >= nr_cpu_ids)
- curr_cpu = IRQ_UNBOUND;
- }
+ curr_cpu = cpumask_next_and_wrap(curr_cpu, &vq->irq_affinity,
+ cpu_online_mask);
+ if (curr_cpu >= nr_cpu_ids)
+ curr_cpu = IRQ_UNBOUND;
vq->irq_effective_cpu = curr_cpu;
}
@@ -1427,10 +1424,12 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
ret = 0;
index = array_index_nospec(index, dev->vq_num);
if (!vduse_vq_signal_irqfd(dev->vqs[index])) {
+ cpus_read_lock();
vduse_vq_update_effective_cpu(dev->vqs[index]);
ret = vduse_dev_queue_irq_work(dev,
&dev->vqs[index]->inject,
dev->vqs[index]->irq_effective_cpu);
+ cpus_read_unlock();
}
break;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 162/990] virtio_blk: Reset device on probe error paths after DRIVER_OK
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (160 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 161/990] vduse: avoid infinite loop when no affinity CPU is online Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 163/990] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI Greg Kroah-Hartman
` (690 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuho Choi, Stefan Hajnoczi,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <oss.patchbox@gmail.com>
[ Upstream commit f4f6e9a9cb349003d333f0776de94f12ac95b8d2 ]
virtblk_probe() marks the device ready before revalidating zones and
adding the disk, and either of those can fail. The out_cleanup_disk path
they take goes on to delete the virtqueues, but nothing tells the device
to stop first, so it is still live when the rings are freed.
Reset the device at out_cleanup_disk, which is only reachable after
virtio_device_ready(). virtblk_remove() and virtblk_freeze_priv() both
reset before deleting the virtqueues for the same reason.
Fixes: dbb301f91fc8 ("virtio_blk: add error handling support for add_disk()")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260922211207.523999-1-oss.patchbox@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/virtio_blk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6cfad73bf47df..29317945a7c00 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1583,6 +1583,7 @@ static int virtblk_probe(struct virtio_device *vdev)
return 0;
out_cleanup_disk:
+ virtio_reset_device(vdev);
put_disk(vblk->disk);
out_free_tags:
blk_mq_free_tag_set(&vblk->tag_set);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 163/990] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (161 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 162/990] virtio_blk: Reset device on probe error paths after DRIVER_OK Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 164/990] net: sparx5/lan969x: release the in-flight slot of a stale TX skb Greg Kroah-Hartman
` (689 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Baryshkov, Konrad Dybcio,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
[ Upstream commit 053c50a7052549aab0d310ad505947db3e211592 ]
The SAW voltage change runs on CPU 0 from an IPI, but it reaches the SAW
registers through the syscon regmap, which is protected by a spinlock_t.
That is a sleeping lock on PREEMPT_RT, and lockdep complains as soon as
VDD_APCC actually changes voltage:
BUG: Invalid wait context
...
regmap_lock_spinlock+0x18/0x30
regmap_read+0x3c/0x78
spmi_saw_set_vdd+0x50/0x1ac
__flush_smp_call_function_queue+0x1ac/0x334
Map the SAW with a regmap of our own that uses a raw spinlock, and fail
the probe when that cannot be done instead of carrying an error pointer
around as the SAW regmap.
Fixes: 0caecaa87202 ("regulator: qcom_spmi: Add support for SAW")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20261019-fix-qcom-saw-v1-3-9c7ba3fc2493@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/regulator/Kconfig | 1 +
drivers/regulator/qcom_spmi-regulator.c | 35 +++++++++++++++++++------
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index d84f3d054c59d..a504a20f994fa 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1149,6 +1149,7 @@ config REGULATOR_QCOM_SMD_RPM
config REGULATOR_QCOM_SPMI
tristate "Qualcomm SPMI regulator driver"
depends on SPMI || COMPILE_TEST
+ select REGMAP_MMIO
help
If you say yes to this option, support will be included for the
regulators found in Qualcomm SPMI PMICs.
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index c1a41ce70b363..a04ddb1eac940 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -12,13 +12,13 @@
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/ktime.h>
#include <linux/regulator/driver.h>
#include <linux/regmap.h>
#include <linux/list.h>
-#include <linux/mfd/syscon.h>
#include <linux/io.h>
/* Pin control enable input pins. */
@@ -1335,6 +1335,14 @@ static irqreturn_t spmi_regulator_vs_ocp_isr(int irq, void *data)
static struct regmap *saw_regmap;
+static const struct regmap_config saw_regmap_config = {
+ .name = "saw",
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .use_raw_spinlock = true,
+};
+
static void spmi_saw_set_vdd(void *data)
{
u32 vctl, data3, avs_ctl, pmic_sts;
@@ -2504,7 +2512,8 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)
const char *name;
struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node;
- struct device_node *syscon, *reg_node;
+ struct device_node *saw, *reg_node;
+ void __iomem *saw_base;
struct property *reg_prop;
int ret, lenp;
struct list_head *vreg_list;
@@ -2523,12 +2532,22 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)
if (!reg)
return -ENODEV;
- syscon = of_parse_phandle(node, "qcom,saw-reg", 0);
- if (syscon) {
- saw_regmap = syscon_node_to_regmap(syscon);
- of_node_put(syscon);
- if (IS_ERR(saw_regmap))
- dev_err(dev, "ERROR reading SAW regmap\n");
+ saw = of_parse_phandle(node, "qcom,saw-reg", 0);
+ if (saw) {
+ saw_base = devm_of_iomap(dev, saw, 0, NULL);
+ of_node_put(saw);
+ if (IS_ERR(saw_base))
+ return dev_err_probe(dev, PTR_ERR(saw_base),
+ "failed to map the SAW\n");
+
+ saw_regmap = devm_regmap_init_mmio(dev, saw_base,
+ &saw_regmap_config);
+ if (IS_ERR(saw_regmap)) {
+ ret = PTR_ERR(saw_regmap);
+ saw_regmap = NULL;
+ return dev_err_probe(dev, ret,
+ "failed to set the SAW regmap up\n");
+ }
}
for (; reg->name; reg++) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 164/990] net: sparx5/lan969x: release the in-flight slot of a stale TX skb
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (162 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 163/990] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 165/990] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain Greg Kroah-Hartman
` (688 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Machon, Simon Horman,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Machon <daniel.machon@microchip.com>
[ Upstream commit 873363ac591a1774aa3ced84f7ea3d93a3eb9b07 ]
sparx5_ptp_txtstamp_request() counts every two step TX skb waiting for
its timestamp in sparx5->ptp_skbs, and refuses new ones once
SPARX5_MAX_PTP_ID are in flight. sparx5_ptp_txtstamp_old_release()
frees the skbs that have waited longer than SPARX5_PTP_TIMEOUT.
Before this patch, old_release() does not decrement ptp_skbs, so every
skb whose timestamp never arrives, for example because the switch
discarded the frame, keeps its slot forever. Once SPARX5_MAX_PTP_ID
slots are lost, two step frames fail to transmit on every port of the
switch.
Return the number of released skbs from old_release() and subtract it
from ptp_skbs in txtstamp_request(), under the ptp_ts_id_lock it already
takes.
This fixes the accounting only. A port's stale skbs are still aged out
only when that port sends a two step frame, so a port that stops sending
them keeps its stale skbs, and their slots, until it sends one again.
That behaviour is unchanged by this patch.
Found by an AI code review agent. Reproduced on a lan9696 board with a
modified kernel that drops the TX timestamps of two step frames, after
which two step timestamping stopped working on the port. With the fix,
timestamping keeps working on that board and on a sparx5 PCB135 board.
Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029-sparx5-ptp-stale-tx-slot-v1-1-ec15f391bbb7@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
index 2826e48af1033..9f61692b243b7 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
@@ -204,9 +204,10 @@ static void sparx5_ptp_classify(struct sparx5_port *port, struct sk_buff *skb,
*rew_op = IFH_REW_OP_TWO_STEP_PTP;
}
-static void sparx5_ptp_txtstamp_old_release(struct sparx5_port *port)
+static unsigned int sparx5_ptp_txtstamp_old_release(struct sparx5_port *port)
{
struct sk_buff *skb, *skb_tmp;
+ unsigned int purged = 0;
unsigned long flags;
spin_lock_irqsave(&port->tx_skbs.lock, flags);
@@ -217,8 +218,11 @@ static void sparx5_ptp_txtstamp_old_release(struct sparx5_port *port)
__skb_unlink(skb, &port->tx_skbs);
dev_kfree_skb_any(skb);
+ purged++;
}
spin_unlock_irqrestore(&port->tx_skbs.lock, flags);
+
+ return purged;
}
int sparx5_ptp_txtstamp_request(struct sparx5_port *port,
@@ -226,6 +230,7 @@ int sparx5_ptp_txtstamp_request(struct sparx5_port *port,
{
struct sparx5 *sparx5 = port->sparx5;
u8 rew_op, pdu_type, pdu_w16_offset;
+ unsigned int purged;
unsigned long flags;
sparx5_ptp_classify(port, skb, &rew_op, &pdu_type, &pdu_w16_offset);
@@ -236,9 +241,10 @@ int sparx5_ptp_txtstamp_request(struct sparx5_port *port,
if (rew_op != IFH_REW_OP_TWO_STEP_PTP)
return 0;
- sparx5_ptp_txtstamp_old_release(port);
+ purged = sparx5_ptp_txtstamp_old_release(port);
spin_lock_irqsave(&sparx5->ptp_ts_id_lock, flags);
+ sparx5->ptp_skbs -= purged;
if (sparx5->ptp_skbs == SPARX5_MAX_PTP_ID) {
spin_unlock_irqrestore(&sparx5->ptp_ts_id_lock, flags);
return -EBUSY;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 165/990] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (163 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 164/990] net: sparx5/lan969x: release the in-flight slot of a stale TX skb Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 166/990] net/iucv: take a private, writable frame before rewriting it in place Greg Kroah-Hartman
` (687 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Bartosz Golaszewski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
[ Upstream commit 9e4b35c95fede87bad36f68b7ff1eae94ea6b910 ]
GPIO chip cleanup can call the to_irq callback while releasing requested
GPIOs. Removing the IRQ domain first leaves that callback using a freed
domain, both on removal and after an IRQ request failure.
Register domain cleanup before GPIO chip registration so devres removes
the chip before freeing the domain.
This issue was found by our static analysis tool under development.
Fixes: 257e10752c13 ("gpio: mpc8xxx: Use of_mm_gpiochip_remove")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
Link: https://patch.msgid.link/a4fec7fe970d6fc9135b488f57ba7e145b809359.1793377433.git.liguangshuo@mail.sdu.edu.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-mpc8xxx.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index bfe828734ee1b..4a5636de08dbd 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -320,6 +320,14 @@ static const struct of_device_id mpc8xxx_gpio_ids[] = {
{}
};
+static void mpc8xxx_irq_domain_remove(void *data)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = data;
+
+ if (mpc8xxx_gc->irq)
+ irq_domain_remove(mpc8xxx_gc->irq);
+}
+
static int mpc8xxx_probe(struct platform_device *pdev)
{
const struct mpc8xxx_gpio_devtype *devtype = NULL;
@@ -406,6 +414,11 @@ static int mpc8xxx_probe(struct platform_device *pdev)
mpc8xxx_gc->regs + GPIO_DIR);
}
+ /* GPIO chip cleanup still needs the IRQ domain. */
+ ret = devm_add_action_or_reset(dev, mpc8xxx_irq_domain_remove, mpc8xxx_gc);
+ if (ret)
+ return ret;
+
ret = devm_gpiochip_add_data(dev, gc, mpc8xxx_gc);
if (ret) {
dev_err(dev,
@@ -438,7 +451,7 @@ static int mpc8xxx_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "failed to devm_request_irq(%d), ret = %d\n",
mpc8xxx_gc->irqn, ret);
- goto err;
+ return ret;
}
ret = devm_device_init_wakeup(dev);
@@ -446,19 +459,14 @@ static int mpc8xxx_probe(struct platform_device *pdev)
return dev_err_probe(dev, ret, "Failed to init wakeup\n");
return 0;
-err:
- irq_domain_remove(mpc8xxx_gc->irq);
- return ret;
}
static void mpc8xxx_remove(struct platform_device *pdev)
{
struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
- if (mpc8xxx_gc->irq) {
+ if (mpc8xxx_gc->irq)
irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
- irq_domain_remove(mpc8xxx_gc->irq);
- }
}
static int mpc8xxx_suspend(struct device *dev)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 166/990] net/iucv: take a private, writable frame before rewriting it in place
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (164 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 165/990] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 167/990] wifi: ath12k: generalize GI and LTF fixed rate functions Greg Kroah-Hartman
` (686 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bryam Vargas, Simon Horman,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryam Vargas <hexlabsecurity@proton.me>
[ Upstream commit f38bce9af9e2a3cced7d303a1476f21c1f42bcb7 ]
afiucv_hs_rcv() rewrites the frame in place -- EBCASC() on four name
fields, then afiucv_swap_src_dest() swaps them and pushes an Ethernet
header -- and can hand the same skb to dev_queue_xmit(), without making
it private first, so a packet socket that also gets the frame reads the
rewritten names. An ETH_P_ALL tap runs first and leaves af_iucv a
cloned skb; a socket opened for ETH_P_AF_IUCV sits on a ptype_specific
list, walked after ptype_base[], so deliver_skb() takes a reference and
af_iucv runs on an skb that is shared but not cloned.
Unshare, then cow, in that order: skb_cow() can reach
pskb_expand_head(), which has BUG_ON(skb_shared()). skb_cow() tests
skb_cloned(), which is what a rewrite of the data needs; skb_cow_head()
tests only the header. Asking for ETH_HLEN also covers the unchecked
push in afiucv_swap_src_dest(); on the ordinary path eth_type_trans()
has already pulled that much, so it only compares.
Fixes: 3881ac441f64 ("af_iucv: add HiperSockets transport")
Closes: https://sashiko.dev/#/patchset/20260813-b4-disp-60433a46-v1-1-509e1200533e@proton.me?part=1
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261028-b4-disp-1edbbc34-v3-1-13495411f5b9@proton.me
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/iucv/af_iucv.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 3472bdde31af4..a8601a8782409 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -2072,11 +2072,20 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev,
int err = NET_RX_SUCCESS;
char nullstring[8];
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (!skb)
+ return NET_RX_SUCCESS;
+
if (!pskb_may_pull(skb, sizeof(*trans_hdr))) {
kfree_skb(skb);
return NET_RX_SUCCESS;
}
+ if (skb_cow(skb, ETH_HLEN)) {
+ kfree_skb(skb);
+ return NET_RX_SUCCESS;
+ }
+
trans_hdr = iucv_trans_hdr(skb);
EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName));
EBCASC(trans_hdr->destUserID, sizeof(trans_hdr->destUserID));
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 167/990] wifi: ath12k: generalize GI and LTF fixed rate functions
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (165 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 166/990] net/iucv: take a private, writable frame before rewriting it in place Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 168/990] wifi: ath12k: add EHT rate handling to existing set " Greg Kroah-Hartman
` (685 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Muna Sinada,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muna Sinada <muna.sinada@oss.qualcomm.com>
[ Upstream commit 770bff79424beec2edb8e7cc63b0e8d1b1a927a3 ]
Currently, functions in mac.c for setting GI and LTF rates are
specifically for HE rates.
Remove any mention of "HE" in such functions in order to allow for
other modes to utilize the functions. The intention is to prepare for
the addition of EHT GI and LTF fixed rate settings.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Muna Sinada <muna.sinada@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20251024001928.257356-2-muna.sinada@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Stable-dep-of: 83d689bbe8f9 ("wifi: ath12k: don't advertise EHT-MCS15 to firmware unless we support it")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/mac.c | 77 ++++++++++++++-------------
drivers/net/wireless/ath/ath12k/mac.h | 14 ++++-
drivers/net/wireless/ath/ath12k/wmi.h | 12 ++---
3 files changed, 60 insertions(+), 43 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index e10a3366cd845..af6163169364f 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -12043,55 +12043,57 @@ ath12k_mac_get_single_legacy_rate(struct ath12k *ar,
}
static int
-ath12k_mac_set_fixed_rate_gi_ltf(struct ath12k_link_vif *arvif, u8 he_gi, u8 he_ltf)
+ath12k_mac_set_fixed_rate_gi_ltf(struct ath12k_link_vif *arvif, u8 gi, u8 ltf)
{
struct ath12k *ar = arvif->ar;
- int ret;
+ int param, ret;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
/* 0.8 = 0, 1.6 = 2 and 3.2 = 3. */
- if (he_gi && he_gi != 0xFF)
- he_gi += 1;
+ if (gi && gi != 0xFF)
+ gi += 1;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- WMI_VDEV_PARAM_SGI, he_gi);
+ WMI_VDEV_PARAM_SGI, gi);
if (ret) {
- ath12k_warn(ar->ab, "failed to set HE GI:%d, error:%d\n",
- he_gi, ret);
+ ath12k_warn(ar->ab, "failed to set GI:%d, error:%d\n",
+ gi, ret);
return ret;
}
/* start from 1 */
- if (he_ltf != 0xFF)
- he_ltf += 1;
+ if (ltf != 0xFF)
+ ltf += 1;
+
+ param = WMI_VDEV_PARAM_HE_LTF;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- WMI_VDEV_PARAM_HE_LTF, he_ltf);
+ param, ltf);
if (ret) {
- ath12k_warn(ar->ab, "failed to set HE LTF:%d, error:%d\n",
- he_ltf, ret);
+ ath12k_warn(ar->ab, "failed to set LTF:%d, error:%d\n",
+ ltf, ret);
return ret;
}
return 0;
}
static int
-ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 he_gi, u8 he_ltf)
+ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 gi, u8 ltf)
{
struct ath12k *ar = arvif->ar;
int ret;
- u32 he_ar_gi_ltf;
+ u32 ar_gi_ltf;
- if (he_gi != 0xFF) {
- switch (he_gi) {
- case NL80211_RATE_INFO_HE_GI_0_8:
- he_gi = WMI_AUTORATE_800NS_GI;
+ if (gi != 0xFF) {
+ switch (gi) {
+ case ATH12K_RATE_INFO_GI_0_8:
+ gi = WMI_AUTORATE_800NS_GI;
break;
- case NL80211_RATE_INFO_HE_GI_1_6:
- he_gi = WMI_AUTORATE_1600NS_GI;
+ case ATH12K_RATE_INFO_GI_1_6:
+ gi = WMI_AUTORATE_1600NS_GI;
break;
- case NL80211_RATE_INFO_HE_GI_3_2:
- he_gi = WMI_AUTORATE_3200NS_GI;
+ case ATH12K_RATE_INFO_GI_3_2:
+ gi = WMI_AUTORATE_3200NS_GI;
break;
default:
ath12k_warn(ar->ab, "Invalid GI\n");
@@ -12099,16 +12101,16 @@ ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 he_gi, u8 he_
}
}
- if (he_ltf != 0xFF) {
- switch (he_ltf) {
- case NL80211_RATE_INFO_HE_1XLTF:
- he_ltf = WMI_HE_AUTORATE_LTF_1X;
+ if (ltf != 0xFF) {
+ switch (ltf) {
+ case ATH12K_RATE_INFO_1XLTF:
+ ltf = WMI_AUTORATE_LTF_1X;
break;
- case NL80211_RATE_INFO_HE_2XLTF:
- he_ltf = WMI_HE_AUTORATE_LTF_2X;
+ case ATH12K_RATE_INFO_2XLTF:
+ ltf = WMI_AUTORATE_LTF_2X;
break;
- case NL80211_RATE_INFO_HE_4XLTF:
- he_ltf = WMI_HE_AUTORATE_LTF_4X;
+ case ATH12K_RATE_INFO_4XLTF:
+ ltf = WMI_AUTORATE_LTF_4X;
break;
default:
ath12k_warn(ar->ab, "Invalid LTF\n");
@@ -12116,15 +12118,15 @@ ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 he_gi, u8 he_
}
}
- he_ar_gi_ltf = he_gi | he_ltf;
+ ar_gi_ltf = gi | ltf;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
WMI_VDEV_PARAM_AUTORATE_MISC_CFG,
- he_ar_gi_ltf);
+ ar_gi_ltf);
if (ret) {
ath12k_warn(ar->ab,
- "failed to set HE autorate GI:%u, LTF:%u params, error:%d\n",
- he_gi, he_ltf, ret);
+ "failed to set autorate GI:%u, LTF:%u params, error:%d\n",
+ gi, ltf, ret);
return ret;
}
@@ -12149,10 +12151,10 @@ static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
{
struct ieee80211_bss_conf *link_conf;
struct ath12k *ar = arvif->ar;
+ bool he_support, gi_ltf_set = false;
u32 vdev_param;
u32 param_value;
int ret;
- bool he_support;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
@@ -12206,7 +12208,10 @@ static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
ret = ath12k_mac_set_auto_rate_gi_ltf(arvif, he_gi, he_ltf);
if (ret)
return ret;
- } else {
+ gi_ltf_set = true;
+ }
+
+ if (!gi_ltf_set) {
vdev_param = WMI_VDEV_PARAM_SGI;
param_value = ath12k_mac_nlgi_to_wmigi(sgi);
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
diff --git a/drivers/net/wireless/ath/ath12k/mac.h b/drivers/net/wireless/ath/ath12k/mac.h
index c05af40bd7a20..1f689e367c8a1 100644
--- a/drivers/net/wireless/ath/ath12k/mac.h
+++ b/drivers/net/wireless/ath/ath12k/mac.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#ifndef ATH12K_MAC_H
@@ -84,6 +84,18 @@ enum ath12k_supported_bw {
ATH12K_BW_320 = 4,
};
+enum ath12k_gi {
+ ATH12K_RATE_INFO_GI_0_8,
+ ATH12K_RATE_INFO_GI_1_6,
+ ATH12K_RATE_INFO_GI_3_2,
+};
+
+enum ath12k_ltf {
+ ATH12K_RATE_INFO_1XLTF,
+ ATH12K_RATE_INFO_2XLTF,
+ ATH12K_RATE_INFO_4XLTF,
+};
+
struct ath12k_mac_get_any_chanctx_conf_arg {
struct ath12k *ar;
struct ieee80211_chanctx_conf *chanctx_conf;
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 6468d9738639e..fdb17363a65cc 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -223,15 +223,15 @@ enum WMI_HOST_WLAN_BAND {
};
/* Parameters used for WMI_VDEV_PARAM_AUTORATE_MISC_CFG command.
- * Used only for HE auto rate mode.
+ * Used for HE and EHT auto rate mode.
*/
enum {
- /* HE LTF related configuration */
- WMI_HE_AUTORATE_LTF_1X = BIT(0),
- WMI_HE_AUTORATE_LTF_2X = BIT(1),
- WMI_HE_AUTORATE_LTF_4X = BIT(2),
+ /* LTF related configuration */
+ WMI_AUTORATE_LTF_1X = BIT(0),
+ WMI_AUTORATE_LTF_2X = BIT(1),
+ WMI_AUTORATE_LTF_4X = BIT(2),
- /* HE GI related configuration */
+ /* GI related configuration */
WMI_AUTORATE_400NS_GI = BIT(8),
WMI_AUTORATE_800NS_GI = BIT(9),
WMI_AUTORATE_1600NS_GI = BIT(10),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 168/990] wifi: ath12k: add EHT rate handling to existing set rate functions
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (166 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 167/990] wifi: ath12k: generalize GI and LTF fixed rate functions Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 169/990] wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc Greg Kroah-Hartman
` (684 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aloka Dixit, Muna Sinada,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muna Sinada <muna.sinada@oss.qualcomm.com>
[ Upstream commit ec1d9b79be5df30f1998f37a49bf14d34ecd6c50 ]
Add EHT rate handling to the existing rate functions that validate,
prepare and set rates.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Co-developed-by: Aloka Dixit <aloka.dixit@oss.qualcomm.com>
Signed-off-by: Aloka Dixit <aloka.dixit@oss.qualcomm.com>
Signed-off-by: Muna Sinada <muna.sinada@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20251024001928.257356-3-muna.sinada@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Stable-dep-of: 83d689bbe8f9 ("wifi: ath12k: don't advertise EHT-MCS15 to firmware unless we support it")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/mac.c | 215 +++++++++++++++++++++-----
1 file changed, 173 insertions(+), 42 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index af6163169364f..99d80a0aafe4a 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -533,6 +533,18 @@ ath12k_mac_max_he_nss(const u16 he_mcs_mask[NL80211_HE_NSS_MAX])
return 1;
}
+static u32
+ath12k_mac_max_eht_nss(const u16 eht_mcs_mask[NL80211_EHT_NSS_MAX])
+{
+ int nss;
+
+ for (nss = NL80211_EHT_NSS_MAX - 1; nss >= 0; nss--)
+ if (eht_mcs_mask[nss])
+ return nss + 1;
+
+ return 1;
+}
+
static u8 ath12k_parse_mpdudensity(u8 mpdudensity)
{
/* From IEEE Std 802.11-2020 defined values for "Minimum MPDU Start Spacing":
@@ -3102,37 +3114,50 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
WARN_ON(phymode == MODE_UNKNOWN);
}
+#define ATH12K_EHT_MCS_7_ENABLED 0x00FF
+#define ATH12K_EHT_MCS_9_ENABLED 0x0300
+#define ATH12K_EHT_MCS_11_ENABLED 0x0C00
+#define ATH12K_EHT_MCS_13_ENABLED 0x3000
+
static void ath12k_mac_set_eht_mcs(u8 rx_tx_mcs7, u8 rx_tx_mcs9,
u8 rx_tx_mcs11, u8 rx_tx_mcs13,
- u32 *rx_mcs, u32 *tx_mcs)
-{
- *rx_mcs = 0;
- u32p_replace_bits(rx_mcs,
- u8_get_bits(rx_tx_mcs7, IEEE80211_EHT_MCS_NSS_RX),
- WMI_EHT_MCS_NSS_0_7);
- u32p_replace_bits(rx_mcs,
- u8_get_bits(rx_tx_mcs9, IEEE80211_EHT_MCS_NSS_RX),
- WMI_EHT_MCS_NSS_8_9);
- u32p_replace_bits(rx_mcs,
- u8_get_bits(rx_tx_mcs11, IEEE80211_EHT_MCS_NSS_RX),
- WMI_EHT_MCS_NSS_10_11);
- u32p_replace_bits(rx_mcs,
- u8_get_bits(rx_tx_mcs13, IEEE80211_EHT_MCS_NSS_RX),
- WMI_EHT_MCS_NSS_12_13);
-
- *tx_mcs = 0;
- u32p_replace_bits(tx_mcs,
- u8_get_bits(rx_tx_mcs7, IEEE80211_EHT_MCS_NSS_TX),
- WMI_EHT_MCS_NSS_0_7);
- u32p_replace_bits(tx_mcs,
- u8_get_bits(rx_tx_mcs9, IEEE80211_EHT_MCS_NSS_TX),
- WMI_EHT_MCS_NSS_8_9);
- u32p_replace_bits(tx_mcs,
- u8_get_bits(rx_tx_mcs11, IEEE80211_EHT_MCS_NSS_TX),
- WMI_EHT_MCS_NSS_10_11);
- u32p_replace_bits(tx_mcs,
- u8_get_bits(rx_tx_mcs13, IEEE80211_EHT_MCS_NSS_TX),
- WMI_EHT_MCS_NSS_12_13);
+ u32 *rx_mcs, u32 *tx_mcs,
+ const u16 eht_mcs_limit[NL80211_EHT_NSS_MAX])
+{
+ int nss;
+ u8 mcs_7 = 0, mcs_9 = 0, mcs_11 = 0, mcs_13 = 0;
+ u8 peer_mcs_7, peer_mcs_9, peer_mcs_11, peer_mcs_13;
+
+ for (nss = 0; nss < NL80211_EHT_NSS_MAX; nss++) {
+ if (eht_mcs_limit[nss] & ATH12K_EHT_MCS_7_ENABLED)
+ mcs_7++;
+ if (eht_mcs_limit[nss] & ATH12K_EHT_MCS_9_ENABLED)
+ mcs_9++;
+ if (eht_mcs_limit[nss] & ATH12K_EHT_MCS_11_ENABLED)
+ mcs_11++;
+ if (eht_mcs_limit[nss] & ATH12K_EHT_MCS_13_ENABLED)
+ mcs_13++;
+ }
+
+ peer_mcs_7 = u8_get_bits(rx_tx_mcs7, IEEE80211_EHT_MCS_NSS_RX);
+ peer_mcs_9 = u8_get_bits(rx_tx_mcs9, IEEE80211_EHT_MCS_NSS_RX);
+ peer_mcs_11 = u8_get_bits(rx_tx_mcs11, IEEE80211_EHT_MCS_NSS_RX);
+ peer_mcs_13 = u8_get_bits(rx_tx_mcs13, IEEE80211_EHT_MCS_NSS_RX);
+
+ *rx_mcs = u32_encode_bits(min(peer_mcs_7, mcs_7), WMI_EHT_MCS_NSS_0_7) |
+ u32_encode_bits(min(peer_mcs_9, mcs_9), WMI_EHT_MCS_NSS_8_9) |
+ u32_encode_bits(min(peer_mcs_11, mcs_11), WMI_EHT_MCS_NSS_10_11) |
+ u32_encode_bits(min(peer_mcs_13, mcs_13), WMI_EHT_MCS_NSS_12_13);
+
+ peer_mcs_7 = u8_get_bits(rx_tx_mcs7, IEEE80211_EHT_MCS_NSS_TX);
+ peer_mcs_9 = u8_get_bits(rx_tx_mcs9, IEEE80211_EHT_MCS_NSS_TX);
+ peer_mcs_11 = u8_get_bits(rx_tx_mcs11, IEEE80211_EHT_MCS_NSS_TX);
+ peer_mcs_13 = u8_get_bits(rx_tx_mcs13, IEEE80211_EHT_MCS_NSS_TX);
+
+ *tx_mcs = u32_encode_bits(min(peer_mcs_7, mcs_7), WMI_EHT_MCS_NSS_0_7) |
+ u32_encode_bits(min(peer_mcs_9, mcs_9), WMI_EHT_MCS_NSS_8_9) |
+ u32_encode_bits(min(peer_mcs_11, mcs_11), WMI_EHT_MCS_NSS_10_11) |
+ u32_encode_bits(min(peer_mcs_13, mcs_13), WMI_EHT_MCS_NSS_12_13);
}
static void ath12k_mac_set_eht_ppe_threshold(const u8 *ppe_thres,
@@ -3171,13 +3196,17 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
struct ath12k_wmi_peer_assoc_arg *arg)
{
struct ieee80211_sta *sta = ath12k_ahsta_to_sta(arsta->ahsta);
+ struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif);
const struct ieee80211_eht_mcs_nss_supp_20mhz_only *bw_20;
const struct ieee80211_eht_mcs_nss_supp_bw *bw;
const struct ieee80211_sta_eht_cap *eht_cap;
const struct ieee80211_sta_he_cap *he_cap;
struct ieee80211_link_sta *link_sta;
struct ieee80211_bss_conf *link_conf;
+ struct cfg80211_chan_def def;
+ enum nl80211_band band;
u32 *rx_mcs, *tx_mcs;
+ u16 *eht_mcs_mask;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
@@ -3199,6 +3228,12 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
if (!he_cap->has_he || !eht_cap->has_eht)
return;
+ if (WARN_ON(ath12k_mac_vif_link_chan(vif, arvif->link_id, &def)))
+ return;
+
+ band = def.chan->band;
+ eht_mcs_mask = arvif->bitrate_mask.control[band].eht_mcs;
+
arg->eht_flag = true;
if ((eht_cap->eht_cap_elem.phy_cap_info[5] &
@@ -3223,7 +3258,8 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
bw->rx_tx_mcs11_max_nss,
bw->rx_tx_mcs13_max_nss,
&rx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_320],
- &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_320]);
+ &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_320],
+ eht_mcs_mask);
arg->peer_eht_mcs_count++;
fallthrough;
case IEEE80211_STA_RX_BW_160:
@@ -3233,7 +3269,8 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
bw->rx_tx_mcs11_max_nss,
bw->rx_tx_mcs13_max_nss,
&rx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_160],
- &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_160]);
+ &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_160],
+ eht_mcs_mask);
arg->peer_eht_mcs_count++;
fallthrough;
default:
@@ -3249,7 +3286,8 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
bw_20->rx_tx_mcs11_max_nss,
bw_20->rx_tx_mcs13_max_nss,
&rx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_80],
- &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_80]);
+ &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_80],
+ eht_mcs_mask);
} else {
bw = &eht_cap->eht_mcs_nss_supp.bw._80;
ath12k_mac_set_eht_mcs(bw->rx_tx_mcs9_max_nss,
@@ -3257,7 +3295,8 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
bw->rx_tx_mcs11_max_nss,
bw->rx_tx_mcs13_max_nss,
&rx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_80],
- &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_80]);
+ &tx_mcs[WMI_EHTCAP_TXRX_MCS_NSS_IDX_80],
+ eht_mcs_mask);
}
arg->peer_eht_mcs_count++;
@@ -3875,6 +3914,8 @@ static void ath12k_mac_init_arvif(struct ath12k_vif *ahvif,
sizeof(arvif->bitrate_mask.control[i].vht_mcs));
memset(arvif->bitrate_mask.control[i].he_mcs, 0xff,
sizeof(arvif->bitrate_mask.control[i].he_mcs));
+ memset(arvif->bitrate_mask.control[i].eht_mcs, 0xff,
+ sizeof(arvif->bitrate_mask.control[i].eht_mcs));
}
/* Handle MLO related assignments */
@@ -5722,6 +5763,20 @@ ath12k_mac_bitrate_mask_num_he_rates(struct ath12k *ar,
return num_rates;
}
+static int
+ath12k_mac_bitrate_mask_num_eht_rates(struct ath12k *ar,
+ enum nl80211_band band,
+ const struct cfg80211_bitrate_mask *mask)
+{
+ int num_rates = 0;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(mask->control[band].eht_mcs); i++)
+ num_rates += hweight16(mask->control[band].eht_mcs[i]);
+
+ return num_rates;
+}
+
static int
ath12k_mac_set_peer_vht_fixed_rate(struct ath12k_link_vif *arvif,
struct ath12k_link_sta *arsta,
@@ -11925,6 +11980,9 @@ ath12k_mac_has_single_legacy_rate(struct ath12k *ar,
if (ath12k_mac_bitrate_mask_num_he_rates(ar, band, mask))
return false;
+ if (ath12k_mac_bitrate_mask_num_eht_rates(ar, band, mask))
+ return false;
+
return num_rates == 1;
}
@@ -11947,11 +12005,15 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
{
struct ieee80211_supported_band *sband = &ar->mac.sbands[band];
u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map);
+ const struct ieee80211_sband_iftype_data *data;
const struct ieee80211_sta_he_cap *he_cap;
u16 he_mcs_map = 0;
+ u16 eht_mcs_map = 0;
u8 ht_nss_mask = 0;
u8 vht_nss_mask = 0;
u8 he_nss_mask = 0;
+ u8 eht_nss_mask = 0;
+ u8 mcs_nss_len;
int i;
/* No need to consider legacy here. Basic rates are always present
@@ -11995,7 +12057,60 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
return false;
}
- if (ht_nss_mask != vht_nss_mask || ht_nss_mask != he_nss_mask)
+ data = ieee80211_get_sband_iftype_data(sband, vif->type);
+
+ mcs_nss_len = ieee80211_eht_mcs_nss_size(&data->he_cap.he_cap_elem,
+ &data->eht_cap.eht_cap_elem,
+ false);
+ if (mcs_nss_len == 4) {
+ /* 20 MHz only STA case */
+ const struct ieee80211_eht_mcs_nss_supp_20mhz_only *eht_mcs_nss =
+ &data->eht_cap.eht_mcs_nss_supp.only_20mhz;
+ if (eht_mcs_nss->rx_tx_mcs13_max_nss)
+ eht_mcs_map = 0x1fff;
+ else if (eht_mcs_nss->rx_tx_mcs11_max_nss)
+ eht_mcs_map = 0x07ff;
+ else if (eht_mcs_nss->rx_tx_mcs9_max_nss)
+ eht_mcs_map = 0x01ff;
+ else
+ eht_mcs_map = 0x007f;
+ } else {
+ const struct ieee80211_eht_mcs_nss_supp_bw *eht_mcs_nss;
+
+ switch (mcs_nss_len) {
+ case 9:
+ eht_mcs_nss = &data->eht_cap.eht_mcs_nss_supp.bw._320;
+ break;
+ case 6:
+ eht_mcs_nss = &data->eht_cap.eht_mcs_nss_supp.bw._160;
+ break;
+ case 3:
+ eht_mcs_nss = &data->eht_cap.eht_mcs_nss_supp.bw._80;
+ break;
+ default:
+ return false;
+ }
+
+ if (eht_mcs_nss->rx_tx_mcs13_max_nss)
+ eht_mcs_map = 0x1fff;
+ else if (eht_mcs_nss->rx_tx_mcs11_max_nss)
+ eht_mcs_map = 0x7ff;
+ else
+ eht_mcs_map = 0x1ff;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(mask->control[band].eht_mcs); i++) {
+ if (mask->control[band].eht_mcs[i] == 0)
+ continue;
+
+ if (mask->control[band].eht_mcs[i] < eht_mcs_map)
+ eht_nss_mask |= BIT(i);
+ else
+ return false;
+ }
+
+ if (ht_nss_mask != vht_nss_mask || ht_nss_mask != he_nss_mask ||
+ ht_nss_mask != eht_nss_mask)
return false;
if (ht_nss_mask == 0)
@@ -12147,11 +12262,12 @@ static u32 ath12k_mac_nlgi_to_wmigi(enum nl80211_txrate_gi gi)
static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
u32 rate, u8 nss, u8 sgi, u8 ldpc,
- u8 he_gi, u8 he_ltf, bool he_fixed_rate)
+ u8 he_gi, u8 he_ltf, bool he_fixed_rate,
+ bool eht_fixed_rate)
{
struct ieee80211_bss_conf *link_conf;
struct ath12k *ar = arvif->ar;
- bool he_support, gi_ltf_set = false;
+ bool he_support, eht_support, gi_ltf_set = false;
u32 vdev_param;
u32 param_value;
int ret;
@@ -12163,6 +12279,7 @@ static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
return -EINVAL;
he_support = link_conf->he_support;
+ eht_support = link_conf->eht_support;
ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
"mac set rate params vdev %i rate 0x%02x nss 0x%02x sgi 0x%02x ldpc 0x%02x\n",
@@ -12172,7 +12289,10 @@ static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
"he_gi 0x%02x he_ltf 0x%02x he_fixed_rate %d\n", he_gi,
he_ltf, he_fixed_rate);
- if (!he_support) {
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "eht_fixed_rate %d\n",
+ eht_fixed_rate);
+
+ if (!he_support && !eht_support) {
vdev_param = WMI_VDEV_PARAM_FIXED_RATE;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
vdev_param, rate);
@@ -12330,15 +12450,16 @@ ath12k_mac_validate_fixed_rate_settings(struct ath12k *ar, enum nl80211_band ban
const struct cfg80211_bitrate_mask *mask,
unsigned int link_id)
{
- bool he_fixed_rate = false, vht_fixed_rate = false;
- const u16 *vht_mcs_mask, *he_mcs_mask;
+ bool eht_fixed_rate = false, he_fixed_rate = false, vht_fixed_rate = false;
+ const u16 *vht_mcs_mask, *he_mcs_mask, *eht_mcs_mask;
struct ieee80211_link_sta *link_sta;
struct ath12k_peer *peer, *tmp;
- u8 vht_nss, he_nss;
+ u8 vht_nss, he_nss, eht_nss;
int ret = true;
vht_mcs_mask = mask->control[band].vht_mcs;
he_mcs_mask = mask->control[band].he_mcs;
+ eht_mcs_mask = mask->control[band].eht_mcs;
if (ath12k_mac_bitrate_mask_num_vht_rates(ar, band, mask) == 1)
vht_fixed_rate = true;
@@ -12346,11 +12467,15 @@ ath12k_mac_validate_fixed_rate_settings(struct ath12k *ar, enum nl80211_band ban
if (ath12k_mac_bitrate_mask_num_he_rates(ar, band, mask) == 1)
he_fixed_rate = true;
- if (!vht_fixed_rate && !he_fixed_rate)
+ if (ath12k_mac_bitrate_mask_num_eht_rates(ar, band, mask) == 1)
+ eht_fixed_rate = true;
+
+ if (!vht_fixed_rate && !he_fixed_rate && !eht_fixed_rate)
return true;
vht_nss = ath12k_mac_max_vht_nss(vht_mcs_mask);
he_nss = ath12k_mac_max_he_nss(he_mcs_mask);
+ eht_nss = ath12k_mac_max_eht_nss(eht_mcs_mask);
rcu_read_lock();
spin_lock_bh(&ar->ab->base_lock);
@@ -12372,6 +12497,11 @@ ath12k_mac_validate_fixed_rate_settings(struct ath12k *ar, enum nl80211_band ban
ret = false;
goto exit;
}
+ if (eht_fixed_rate && (!link_sta->eht_cap.has_eht ||
+ link_sta->rx_nss < eht_nss)) {
+ ret = false;
+ goto exit;
+ }
}
}
exit:
@@ -12403,6 +12533,7 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
int ret;
int num_rates;
bool he_fixed_rate = false;
+ bool eht_fixed_rate = false;
lockdep_assert_wiphy(hw->wiphy);
@@ -12527,7 +12658,7 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
}
ret = ath12k_mac_set_rate_params(arvif, rate, nss, sgi, ldpc, he_gi,
- he_ltf, he_fixed_rate);
+ he_ltf, he_fixed_rate, eht_fixed_rate);
if (ret) {
ath12k_warn(ar->ab, "failed to set rate params on vdev %i: %d\n",
arvif->vdev_id, ret);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 169/990] wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (167 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 168/990] wifi: ath12k: add EHT rate handling to existing set " Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 170/990] wifi: ath12k: dont advertise EHT-MCS15 to firmware unless we support it Greg Kroah-Hartman
` (683 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vishal Kumar, Aloka Dixit,
Muna Sinada, Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muna Sinada <muna.sinada@oss.qualcomm.com>
[ Upstream commit 6c95151e2e776462de6b6fd9e577865e8b32203e ]
Add EHT MCS/NSS rate functionality to peer association. As part of
ath12k_peer_assoc_h_eht() add the calculation of EHT MCS/NSS using
intersection of link_sta and phy capability.
ath12k_mac_max_eht_mcs_nss() function is utilized when comparing the
max NSS of link STA and phy capability since in split phy case, phy
supports max NSS of 2 for 5G band.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Co-developed-by: Vishal Kumar <quic_visk@quicinc.com>
Signed-off-by: Vishal Kumar <quic_visk@quicinc.com>
Co-developed-by: Aloka Dixit <aloka.dixit@oss.qualcomm.com>
Signed-off-by: Aloka Dixit <aloka.dixit@oss.qualcomm.com>
Signed-off-by: Muna Sinada <muna.sinada@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20251024001928.257356-4-muna.sinada@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Stable-dep-of: 83d689bbe8f9 ("wifi: ath12k: don't advertise EHT-MCS15 to firmware unless we support it")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/mac.c | 110 ++++++++++++++++++++++++--
1 file changed, 103 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 99d80a0aafe4a..94e5af15cd618 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -545,6 +545,18 @@ ath12k_mac_max_eht_nss(const u16 eht_mcs_mask[NL80211_EHT_NSS_MAX])
return 1;
}
+static u32
+ath12k_mac_max_eht_mcs_nss(const u8 *eht_mcs, int eht_mcs_set_size)
+{
+ int i;
+ u8 nss = 0;
+
+ for (i = 0; i < eht_mcs_set_size; i++)
+ nss = max(nss, u8_get_bits(eht_mcs[i], IEEE80211_EHT_MCS_NSS_RX));
+
+ return nss;
+}
+
static u8 ath12k_parse_mpdudensity(u8 mpdudensity)
{
/* From IEEE Std 802.11-2020 defined values for "Minimum MPDU Start Spacing":
@@ -3016,6 +3028,18 @@ static enum wmi_phy_mode ath12k_mac_get_phymode_eht(struct ath12k *ar,
return MODE_UNKNOWN;
}
+static bool
+ath12k_peer_assoc_h_eht_masked(const u16 eht_mcs_mask[NL80211_EHT_NSS_MAX])
+{
+ int nss;
+
+ for (nss = 0; nss < NL80211_EHT_NSS_MAX; nss++)
+ if (eht_mcs_mask[nss])
+ return false;
+
+ return true;
+}
+
static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
struct ath12k_link_vif *arvif,
struct ath12k_link_sta *arsta,
@@ -3027,6 +3051,7 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
const u16 *he_mcs_mask;
+ const u16 *eht_mcs_mask;
enum wmi_phy_mode phymode = MODE_UNKNOWN;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
@@ -3041,6 +3066,7 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;
+ eht_mcs_mask = arvif->bitrate_mask.control[band].eht_mcs;
link_sta = ath12k_mac_get_link_sta(arsta);
if (!link_sta) {
@@ -3051,7 +3077,8 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
switch (band) {
case NL80211_BAND_2GHZ:
- if (link_sta->eht_cap.has_eht) {
+ if (link_sta->eht_cap.has_eht &&
+ !ath12k_peer_assoc_h_eht_masked(eht_mcs_mask)) {
if (link_sta->bandwidth == IEEE80211_STA_RX_BW_40)
phymode = MODE_11BE_EHT40_2G;
else
@@ -3197,16 +3224,21 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
{
struct ieee80211_sta *sta = ath12k_ahsta_to_sta(arsta->ahsta);
struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif);
+ const struct ieee80211_eht_mcs_nss_supp *own_eht_mcs_nss_supp;
const struct ieee80211_eht_mcs_nss_supp_20mhz_only *bw_20;
+ const struct ieee80211_sta_eht_cap *eht_cap, *own_eht_cap;
+ const struct ieee80211_sband_iftype_data *iftd;
const struct ieee80211_eht_mcs_nss_supp_bw *bw;
- const struct ieee80211_sta_eht_cap *eht_cap;
const struct ieee80211_sta_he_cap *he_cap;
struct ieee80211_link_sta *link_sta;
struct ieee80211_bss_conf *link_conf;
struct cfg80211_chan_def def;
+ bool user_rate_valid = true;
enum nl80211_band band;
+ int eht_nss, nss_idx;
u32 *rx_mcs, *tx_mcs;
u16 *eht_mcs_mask;
+ u8 max_nss = 0;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
@@ -3234,6 +3266,16 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
band = def.chan->band;
eht_mcs_mask = arvif->bitrate_mask.control[band].eht_mcs;
+ iftd = ieee80211_get_sband_iftype_data(&ar->mac.sbands[band], vif->type);
+ if (!iftd) {
+ ath12k_warn(ar->ab,
+ "unable to access iftype_data in struct ieee80211_supported_band\n");
+ return;
+ }
+
+ own_eht_cap = &iftd->eht_cap;
+ own_eht_mcs_nss_supp = &own_eht_cap->eht_mcs_nss_supp;
+
arg->eht_flag = true;
if ((eht_cap->eht_cap_elem.phy_cap_info[5] &
@@ -3250,6 +3292,28 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
rx_mcs = arg->peer_eht_rx_mcs_set;
tx_mcs = arg->peer_eht_tx_mcs_set;
+ eht_nss = ath12k_mac_max_eht_mcs_nss((void *)own_eht_mcs_nss_supp,
+ sizeof(*own_eht_mcs_nss_supp));
+ if (eht_nss > link_sta->rx_nss) {
+ user_rate_valid = false;
+ for (nss_idx = (link_sta->rx_nss - 1); nss_idx >= 0; nss_idx--) {
+ if (eht_mcs_mask[nss_idx]) {
+ user_rate_valid = true;
+ break;
+ }
+ }
+ }
+
+ if (!user_rate_valid) {
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "Setting eht range MCS value to peer supported nss %d for peer %pM\n",
+ link_sta->rx_nss, arsta->addr);
+ eht_mcs_mask[link_sta->rx_nss - 1] = eht_mcs_mask[eht_nss - 1];
+ }
+
+ bw_20 = &eht_cap->eht_mcs_nss_supp.only_20mhz;
+ bw = &eht_cap->eht_mcs_nss_supp.bw._80;
+
switch (link_sta->bandwidth) {
case IEEE80211_STA_RX_BW_320:
bw = &eht_cap->eht_mcs_nss_supp.bw._320;
@@ -3274,11 +3338,8 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
arg->peer_eht_mcs_count++;
fallthrough;
default:
- if ((he_cap->he_cap_elem.phy_cap_info[0] &
- (IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G |
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G |
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)) == 0) {
+ if (!(link_sta->he_cap.he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL)) {
bw_20 = &eht_cap->eht_mcs_nss_supp.only_20mhz;
ath12k_mac_set_eht_mcs(bw_20->rx_tx_mcs7_max_nss,
@@ -3305,6 +3366,41 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
arg->punct_bitmap = ~arvif->punct_bitmap;
arg->eht_disable_mcs15 = link_conf->eht_disable_mcs15;
+
+ if (!(link_sta->he_cap.he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL)) {
+ if (bw_20->rx_tx_mcs13_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw_20->rx_tx_mcs13_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ if (bw_20->rx_tx_mcs11_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw_20->rx_tx_mcs11_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ if (bw_20->rx_tx_mcs9_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw_20->rx_tx_mcs9_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ if (bw_20->rx_tx_mcs7_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw_20->rx_tx_mcs7_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ } else {
+ if (bw->rx_tx_mcs13_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw->rx_tx_mcs13_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ if (bw->rx_tx_mcs11_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw->rx_tx_mcs11_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ if (bw->rx_tx_mcs9_max_nss)
+ max_nss = max(max_nss, u8_get_bits(bw->rx_tx_mcs9_max_nss,
+ IEEE80211_EHT_MCS_NSS_RX));
+ }
+
+ max_nss = min(max_nss, (uint8_t)eht_nss);
+
+ arg->peer_nss = min(link_sta->rx_nss, max_nss);
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac eht peer %pM nss %d mcs cnt %d ru_punct_bitmap 0x%x\n",
+ arsta->addr, arg->peer_nss, arg->peer_eht_mcs_count,
+ arg->punct_bitmap);
}
static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 170/990] wifi: ath12k: dont advertise EHT-MCS15 to firmware unless we support it
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (168 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 169/990] wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 171/990] ASoC: meson: axg-fifo: request the irq with the clock enabled Greg Kroah-Hartman
` (682 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vladimir Petrzhikovskii,
Baochen Qiang, Vasanthakumar Thiagarajan, Jeff Johnson,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
[ Upstream commit 83d689bbe8f90ce39961bcc3a64f2ca2ec184019 ]
ath12k_peer_assoc_h_eht() copies the peer's EHT PHY capabilities into
the WMI peer assoc command as is, including the EHT-MCS15 support bits.
Firmware rate control enables EHT-MCS15 for TX whenever those bits are
set, without checking whether the local PHY supports MCS15.
Currently WCN7850 firmware does not support EHT-MCS15 for TX and does
not advertise it in its own EHT PHY capabilities. When connected to an
AP that advertises MCS15 support, rate control may still select
EHT-MCS15, and every PPDU at that rate is aborted by the PHY before it
goes on the air. TX then stops for minutes while the association stays
up, and frames sit in the queue until the firmware releases them as aged.
Keep only the peer's MCS15 support bits that we also support ourselves
to fix it. Chips that support MCS15 are not affected.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 17bbb8aa74fd ("wifi: ath12k: prepare EHT peer assoc parameters")
Reported-by: Vladimir Petrzhikovskii <vladimir@dfb.sh>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222136
Tested-by: Vladimir Petrzhikovskii <vladimir@dfb.sh>
Signed-off-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20261029-ath12k-mcs15-v1-1-3bcfab101f00@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/mac.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 94e5af15cd618..c3f761cc35558 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -3239,6 +3239,7 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
u32 *rx_mcs, *tx_mcs;
u16 *eht_mcs_mask;
u8 max_nss = 0;
+ u8 mcs15;
lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
@@ -3289,6 +3290,16 @@ static void ath12k_peer_assoc_h_eht(struct ath12k *ar,
memcpy(arg->peer_eht_cap_phy, eht_cap->eht_cap_elem.phy_cap_info,
sizeof(eht_cap->eht_cap_elem.phy_cap_info));
+ /*
+ * Firmware rate control enables EHT-MCS15 based only on the peer's
+ * MCS15 support bits, so keep only the ones we support ourselves.
+ */
+ mcs15 = u8_get_bits(eht_cap->eht_cap_elem.phy_cap_info[6] &
+ own_eht_cap->eht_cap_elem.phy_cap_info[6],
+ IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK);
+ u8p_replace_bits(&((u8 *)arg->peer_eht_cap_phy)[6], mcs15,
+ IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK);
+
rx_mcs = arg->peer_eht_rx_mcs_set;
tx_mcs = arg->peer_eht_tx_mcs_set;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 171/990] ASoC: meson: axg-fifo: request the irq with the clock enabled
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (169 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 170/990] wifi: ath12k: dont advertise EHT-MCS15 to firmware unless we support it Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 172/990] Bluetooth: hci_core: Initialize IRK before publication Greg Kroah-Hartman
` (681 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jerome Brunet, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <jbrunet@baylibre.com>
[ Upstream commit 82fa7bfab6b961a03d6575348334e0ec15fdc712 ]
The fifo irq handler accesses registers which need pclk, but the irq is
requested before pclk is enabled on open and freed after it is disabled
on close.
Request the irq after enabling pclk and masking the fifo irqs.
Free it before disabling pclk.
Fixes: 6dc4fa179fb8 ("ASoC: meson: add axg fifo base driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-30e88a8a-f33a-40f0-92aa-9ea62c5b7299
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://patch.msgid.link/20261030-asoc-axg-fifo-irq-clock-v1-1-f8c170ac8b0d@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/meson/axg-fifo.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c
index 75909196b7698..edf43b7fb5cf5 100644
--- a/sound/soc/meson/axg-fifo.c
+++ b/sound/soc/meson/axg-fifo.c
@@ -244,17 +244,10 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
if (ret)
return ret;
- /* Use the threaded irq handler only with non-atomic links */
- ret = request_threaded_irq(fifo->irq, NULL,
- axg_fifo_pcm_irq_block,
- IRQF_ONESHOT, dev_name(dev), ss);
- if (ret)
- return ret;
-
/* Enable pclk to access registers and clock the fifo ip */
ret = clk_prepare_enable(fifo->pclk);
if (ret)
- goto free_irq;
+ return ret;
/* Setup status2 so it reports the memory pointer */
regmap_update_bits(fifo->map, FIFO_CTRL1,
@@ -271,17 +264,24 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
/* Clear any pending interrupt */
axg_fifo_ack_irq(fifo, FIFO_INT_MASK);
+ /* Use the threaded irq handler only with non-atomic links */
+ ret = request_threaded_irq(fifo->irq, NULL,
+ axg_fifo_pcm_irq_block,
+ IRQF_ONESHOT, dev_name(dev), ss);
+ if (ret)
+ goto free_clk;
+
/* Take memory arbitror out of reset */
ret = reset_control_deassert(fifo->arb);
if (ret)
- goto free_clk;
+ goto free_irq;
return 0;
-free_clk:
- clk_disable_unprepare(fifo->pclk);
free_irq:
free_irq(fifo->irq, ss);
+free_clk:
+ clk_disable_unprepare(fifo->pclk);
return ret;
}
EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);
@@ -295,12 +295,12 @@ int axg_fifo_pcm_close(struct snd_soc_component *component,
/* Put the memory arbitror back in reset */
ret = reset_control_assert(fifo->arb);
- /* Disable fifo ip and register access */
- clk_disable_unprepare(fifo->pclk);
-
/* remove IRQ */
free_irq(fifo->irq, ss);
+ /* Disable fifo ip and register access */
+ clk_disable_unprepare(fifo->pclk);
+
return ret;
}
EXPORT_SYMBOL_GPL(axg_fifo_pcm_close);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 172/990] Bluetooth: hci_core: Initialize IRK before publication
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (170 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 171/990] ASoC: meson: axg-fifo: request the irq with the clock enabled Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 173/990] Bluetooth: hci_core: Initialize link key " Greg Kroah-Hartman
` (680 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Binbin Deng, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit f0cf5a24cefeb629876bd15d668ff062c8655e28 ]
hci_add_irk() initializes the identity address and address type of a newly
allocated IRK, publishes it on hdev->identity_resolving_keys, and only then
initializes its value and RPA. RCU readers such as hci_find_irk_by_rpa()
and the debugfs identity_resolving_keys_show() can traverse the new entry
during that window and see a zero or partially initialized IRK.
The race is reachable by racing an IRK addition with another CPU resolving
or dumping IRKs. In particular, userspace can issue MGMT_OP_LOAD_IRKS
while another process reads the corresponding debugfs file or triggers RPA
resolution.
Initialize the IRK value and RPA before publishing a newly allocated IRK.
Existing IRKs remain published and continue to be updated in place.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: adae20cb2d20 ("Bluetooth: Convert IRK list to RCU")
Assisted-by: GLM-5.3 coccinelle
Signed-off-by: Binbin Deng <18983559317@163.com>
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 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index bb5bbeefcc67e..78c4be8e7109e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1351,9 +1351,10 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
u8 addr_type, u8 val[16], bdaddr_t *rpa)
{
- struct smp_irk *irk;
+ struct smp_irk *irk, *old_irk;
- irk = hci_find_irk_by_addr(hdev, bdaddr, addr_type);
+ old_irk = hci_find_irk_by_addr(hdev, bdaddr, addr_type);
+ irk = old_irk;
if (!irk) {
irk = kzalloc(sizeof(*irk), GFP_KERNEL);
if (!irk)
@@ -1362,12 +1363,14 @@ struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
bacpy(&irk->bdaddr, bdaddr);
irk->addr_type = addr_type;
- list_add_rcu(&irk->list, &hdev->identity_resolving_keys);
}
memcpy(irk->val, val, 16);
bacpy(&irk->rpa, rpa);
+ if (!old_irk)
+ list_add_rcu(&irk->list, &hdev->identity_resolving_keys);
+
return irk;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 173/990] Bluetooth: hci_core: Initialize link key before publication
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (171 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 172/990] Bluetooth: hci_core: Initialize IRK before publication Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 174/990] Bluetooth: hci_core: Initialize LTK " Greg Kroah-Hartman
` (679 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Binbin Deng, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit ae9c8df1ffb84560ac01cbdc26cfb19027f4d25f ]
hci_add_link_key() allocates a new link key with kzalloc(), inserts it into
hdev->link_keys with list_add_rcu(), and only then initializes its address,
value, type, and PIN length. RCU readers such as hci_find_link_key()
and the debugfs link_keys_show() do not take hci_dev_lock, so they can
traverse the new entry during that initialization window and observe
a zero or partially initialized key.
This can be triggered by racing a link-key update with another CPU looking
up or dumping keys. In particular, userspace can issue
MGMT_OP_LOAD_LINK_KEYS while another process reads the corresponding
debugfs file.
Complete all fields of a newly allocated key before publishing it with
list_add_rcu(). Existing keys remain visible and keep their current
in-place update behavior.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: 0378b5977013 ("Bluetooth: Convert link keys list to use RCU")
Signed-off-by: Binbin Deng <18983559317@163.com>
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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 78c4be8e7109e..70f7e4da66f33 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1288,7 +1288,6 @@ struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
key = kzalloc(sizeof(*key), GFP_KERNEL);
if (!key)
return NULL;
- list_add_rcu(&key->list, &hdev->link_keys);
}
BT_DBG("%s key for %pMR type %u", hdev->name, bdaddr, type);
@@ -1312,6 +1311,9 @@ struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
else
key->type = type;
+ if (!old_key)
+ list_add_rcu(&key->list, &hdev->link_keys);
+
if (persistent)
*persistent = hci_persistent_key(hdev, conn, type,
old_key_type);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 174/990] Bluetooth: hci_core: Initialize LTK before publication
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (172 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 173/990] Bluetooth: hci_core: Initialize link key " Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 175/990] Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained Greg Kroah-Hartman
` (678 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Binbin Deng, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <18983559317@163.com>
[ Upstream commit 4335849380aa1081ee9a1c2b934cbdda0961fa57 ]
hci_add_ltk() publishes a newly allocated LTK on hdev->long_term_keys
before initializing its address, type, value, authentication state,
encryption size, EDIV, and random value. hci_find_ltk() and the debugfs
long_term_keys_show() traverse this list under RCU and can therefore see
a zero or partially initialized key before those stores complete.
The race is reachable by racing an LTK addition with another CPU looking
up or dumping long-term keys. For example, userspace can issue
MGMT_OP_LOAD_LONG_TERM_KEYS while another process reads the corresponding
debugfs file.
Initialize all fields of a new LTK before list_add_rcu() makes it visible
to RCU readers. Existing LTKs remain published and continue to be updated
in place.
Found during a static-analysis-assisted audit: candidate sites were
surfaced by a Coccinelle rule, and the reader/writer paths were
confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was
not observed at runtime; it is identified by code inspection only.
Fixes: 970d0f1b2803 ("Bluetooth: Convert LTK list to RCU")
Assisted-by: GLM-5.3 coccinelle
Signed-off-by: Binbin Deng <18983559317@163.com>
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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 70f7e4da66f33..49788a7bdba29 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1335,7 +1335,6 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
key = kzalloc(sizeof(*key), GFP_KERNEL);
if (!key)
return NULL;
- list_add_rcu(&key->list, &hdev->long_term_keys);
}
bacpy(&key->bdaddr, bdaddr);
@@ -1347,6 +1346,9 @@ struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
key->enc_size = enc_size;
key->type = type;
+ if (!old_key)
+ list_add_rcu(&key->list, &hdev->long_term_keys);
+
return key;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 175/990] Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (173 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 174/990] Bluetooth: hci_core: Initialize LTK " Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 176/990] Bluetooth: btintel: fix buffer over-read in fw payload Greg Kroah-Hartman
` (677 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+2344fb8002f3ef5b1712,
Akhil Arul, Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil Arul <akhilarul324@gmail.com>
[ Upstream commit 19b4e5701712f74d005cc66a36374559e8dfd281 ]
hci_recv_frame() drops a frame unless HCI_UP or HCI_INIT is set, but the
check is not synchronized with hci_dev_close_sync(). A driver can pass
the check, then close clears HCI_UP, flushes rx_work and starts
drain_workqueue(), and the late queue_work() of rx_work hits the
draining workqueue:
workqueue: cannot queue hci_rx_work on wq hci0
WARNING: kernel/workqueue.c:2352 at __queue_work+0x2c0/0x780
Call Trace:
queue_work_on+0xb2/0xc0
hci_recv_frame+0x18f/0x330
vhci_write+0x174/0x240
vfs_write+0x271/0x680
ksys_write+0x7c/0x110
Skipping the queue_work() while HCI_CMD_DRAIN_WORKQUEUE is set, as done
for tx_work, does not work for rx_work: the flag covers the whole close,
and events still have to be received in that window, for the commands
sent by hdev->shutdown() and for the reset done with
HCI_QUIRK_RESET_ON_CLOSE.
Run hci_recv_frame() under rcu_read_lock() and wait with
synchronize_rcu() once HCI_UP has been cleared, so that every caller
which still saw HCI_UP has queued its work before the workqueue is
drained, and later callers drop the frame.
HCI_INIT does not reopen that window. Apart from the
HCI_QUIRK_RESET_ON_CLOSE reset, which runs after drain_workqueue() has
returned, it is only set by hci_dev_init_sync() during open, and open
and close are serialized by hci_req_sync_lock. So once the grace period
has ended, nothing can pass the check and queue rx_work until the drain
is over.
Tested in qemu with the syzbot C reproducer, one run per boot: the
warning showed up on 12 of 30 boots before and on none of 42 boots after.
Bringing a vhci controller up and down 50 times behaves the same with
and without this change.
Fixes: 76727c02c1e1 ("Bluetooth: Call drain_workqueue() before resetting state")
Reported-by: syzbot+2344fb8002f3ef5b1712@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2344fb8002f3ef5b1712
Signed-off-by: Akhil Arul <akhilarul324@gmail.com>
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 | 9 +++++++++
net/bluetooth/hci_sync.c | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 49788a7bdba29..e4caf79c2d7c3 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2940,8 +2940,14 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
u8 dev_pkt_type;
+ /* Pairs with synchronize_rcu() in hci_dev_close_sync(), so rx_work is
+ * not queued once the workqueue is being drained.
+ */
+ rcu_read_lock();
+
if (!hdev || (!test_bit(HCI_UP, &hdev->flags)
&& !test_bit(HCI_INIT, &hdev->flags))) {
+ rcu_read_unlock();
kfree_skb(skb);
return -ENXIO;
}
@@ -2976,6 +2982,7 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
case HCI_DRV_PKT:
break;
default:
+ rcu_read_unlock();
kfree_skb(skb);
return -EINVAL;
}
@@ -2989,6 +2996,8 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
skb_queue_tail(&hdev->rx_q, skb);
queue_work(hdev->workqueue, &hdev->rx_work);
+ rcu_read_unlock();
+
return 0;
}
EXPORT_SYMBOL(hci_recv_frame);
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6967da50aef05..5be062fdeb967 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5503,6 +5503,11 @@ int hci_dev_close_sync(struct hci_dev *hdev)
return err;
}
+ /* Wait for hci_recv_frame() callers that still saw HCI_UP, so that
+ * none of them queues rx_work while the workqueue is drained below.
+ */
+ synchronize_rcu();
+
hci_leds_update_powered(hdev, false);
/* Flush RX and TX works */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 176/990] Bluetooth: btintel: fix buffer over-read in fw payload
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (174 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 175/990] Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 177/990] Bluetooth: hci_event: Clear explicit connect state on LE connection Greg Kroah-Hartman
` (676 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Catherine L, Kiran K,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catherine L <catherine.l@intel.com>
[ Upstream commit f92b7bca985205082c86140d0bd7c86c5be00efc ]
The firmware decoder cast fw_ptr + frag_len to struct
hci_command_hdr and read cmd->plen before confirming the
header and payload still fit in the remaining firmware
buffer.
Add explicit bounds checks before each dereference:
1. Reject if the command header is not fully contained
in remain.
2. Reject if the full command including payload exceeds
remain.
3. Log the offending fragment length and remaining size
before returning -EINVAL.
Fixes: fbbe83c52bc0d ("Bluetooth: btintel: Create common function for firmware download")
Signed-off-by: Catherine L <catherine.l@intel.com>
Tested-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.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index f56a4ebd26ed8..86c3b319ae2a7 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -1089,7 +1089,29 @@ static int btintel_download_firmware_payload(struct hci_dev *hdev,
err = -EINVAL;
while (fw_ptr - fw->data < fw->size) {
- struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len);
+ struct hci_command_hdr *cmd;
+ size_t remain = fw->size - (fw_ptr - fw->data);
+
+ /* Ensure the header fits before dereferencing */
+ if (frag_len + sizeof(*cmd) > remain) {
+ bt_dev_err(hdev,
+ "Firmware buffer overrun at header (frag_len %u, need %zu, remain %zu)",
+ frag_len, frag_len + sizeof(*cmd), remain);
+ err = -EINVAL;
+ goto done;
+ }
+
+ cmd = (void *)(fw_ptr + frag_len);
+
+ /* Ensure the full command (header + payload) fits before use */
+ if (frag_len + sizeof(*cmd) + cmd->plen > remain) {
+ bt_dev_err(hdev,
+ "Firmware buffer overrun at payload (frag_len %u, plen %u, need %zu, remain %zu)",
+ frag_len, cmd->plen,
+ frag_len + sizeof(*cmd) + cmd->plen, remain);
+ err = -EINVAL;
+ goto done;
+ }
frag_len += sizeof(*cmd) + cmd->plen;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 177/990] Bluetooth: hci_event: Clear explicit connect state on LE connection
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (175 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 176/990] Bluetooth: btintel: fix buffer over-read in fw payload Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 178/990] Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding Greg Kroah-Hartman
` (675 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Dewald, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Dewald <kevin@simpleble.org>
[ Upstream commit f5cd268af1c6f87fb3847e98274e22b8c6324aa4 ]
Since commit 6cd29ec6ae5e ("Bluetooth: hci_sync: Wait for proper events
when connecting LE"), create_le_conn_complete() only runs once the LE
Connection Complete event has been handled, and le_conn_complete_evt()
has already removed the connection parameters from pend_le_conns by
then. hci_connect_le_scan_cleanup() looks the parameters up in
pend_le_conns, so after a successful connection it no longer clears
explicit_connect, nor deletes the parameters that were only created for
the explicit connect.
The parameters of every device connected through an explicit connect,
such as an L2CAP or ATT connect or MGMT Pair Device, are thus left with
explicit_connect set. MGMT Remove Device for all devices then keeps
them as HCI_AUTO_CONN_EXPLICIT instead of freeing them, and if the
device was set to auto-connect and is disconnected, they also stay on
pend_le_conns: the kernel keeps scanning for the device and connects to
it as soon as it advertises, although no one asked for it any more.
Do the cleanup in le_conn_complete_evt() instead, where the explicit
connect request is fulfilled: clear explicit_connect, delete the
parameters if they only existed for it, and put report parameters back
on pend_le_reports. Auto-connect parameters are added back to
pend_le_conns on disconnection, as before. Update the comment in
hci_explicit_conn_params_set() that names hci_connect_le_scan_cleanup()
as the only place deleting them.
Fixes: 6cd29ec6ae5e ("Bluetooth: hci_sync: Wait for proper events when connecting LE")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Kevin Dewald <kevin@simpleble.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_conn.c | 5 +++--
net/bluetooth/hci_event.c | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 32cabe83351ac..f7645dc0ad2ae 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1488,8 +1488,9 @@ static int hci_explicit_conn_params_set(struct hci_dev *hdev,
if (!params)
return -ENOMEM;
- /* If we created new params, mark them to be deleted in
- * hci_connect_le_scan_cleanup. It's different case than
+ /* If we created new params, mark them to be deleted once the
+ * explicit connect is done, see le_conn_complete_evt() and
+ * hci_connect_le_scan_cleanup(). It's different case than
* existing disabled params, those will stay after cleanup.
*/
params->auto_connect = HCI_AUTO_CONN_EXPLICIT;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 572f195f09c13..4be09dd9d9597 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5870,6 +5870,28 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status,
hci_conn_put(params->conn);
params->conn = NULL;
}
+
+ /* An explicit connect request is complete once connected, so
+ * clean it up here: hci_connect_le_scan_cleanup() no longer
+ * finds the params since they have just been removed from
+ * pend_le_conns.
+ */
+ if (params->explicit_connect) {
+ params->explicit_connect = false;
+
+ switch (params->auto_connect) {
+ case HCI_AUTO_CONN_EXPLICIT:
+ hci_conn_params_del(hdev, &conn->dst,
+ conn->dst_type);
+ break;
+ case HCI_AUTO_CONN_REPORT:
+ hci_pend_le_list_add(params,
+ &hdev->pend_le_reports);
+ break;
+ default:
+ break;
+ }
+ }
}
unlock:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 178/990] Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (176 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 177/990] Bluetooth: hci_event: Clear explicit connect state on LE connection Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 179/990] Bluetooth: btmtk: bound the ISO payload length by the controllers MTU Greg Kroah-Hartman
` (674 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hao Qin, Wenlong Tian, Chris Lu,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lu <chris.lu@mediatek.com>
[ Upstream commit 8524c3588fbb9d5c1b876e6f908c42926845650d ]
The ISO interrupt IN endpoint delivers a fixed-size transfer that holds
one HCI ISO packet and zero-fills the remainder. That padding belongs to
the transfer rather than to the stream, so it has to be dropped instead of
reported to the host.
btmtk_recv_isopkt() keeps parsing it: the zero bytes read as an ISO header
with handle 0 and a Data_Total_Length of zero, and each one is passed to
hci_recv_frame() as a complete frame. A single transfer yields a long run
of them, which is what fills the HCI log with malformed ISO packets, and
iso_recv() drops the SDU it is reassembling whenever handle 0 belongs to a
live CIS/BIS.
A zero Data_Total_Length carries no ISO Data Load, so such a packet is
never part of the stream. Check for the zero-filled remainder before
starting to parse the next frame, rather than after assembling a 4-byte
header: a remainder shorter than HCI_ISO_HDR_SIZE would otherwise be held
across calls as a partial header, corrupting the next transfer's framing.
This also means a fully zero-filled remainder no longer costs an skb
allocation that gets immediately freed. Reaching a zero Data_Total_Length
any other way is then a genuine error, not padding.
This was observed on MT7925, but btmtk_recv_isopkt() is shared by every
MediaTek USB controller that supports ISO data.
Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Co-developed-by: Hao Qin <hao.qin@mediatek.com>
Signed-off-by: Hao Qin <hao.qin@mediatek.com>
Co-developed-by: Wenlong Tian <ot_wenlong.tian@mediatek.com>
Signed-off-by: Wenlong Tian <ot_wenlong.tian@mediatek.com>
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btmtk.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 961a47a9c8c43..51b55eceba5f1 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -7,6 +7,7 @@
#include <linux/usb.h>
#include <linux/iopoll.h>
#include <linux/overflow.h>
+#include <linux/string.h>
#include <linux/unaligned.h>
#include <net/bluetooth/bluetooth.h>
@@ -1176,6 +1177,14 @@ static int btmtk_recv_isopkt(struct hci_dev *hdev, void *buffer, int count)
int len;
if (!skb) {
+ /* Drop the endpoint's zero-filled padding before
+ * allocating an skb for it; a zero Data_Total_Length
+ * check below would miss a padding remainder
+ * shorter than an ISO header.
+ */
+ if (mem_is_zero(buffer, count))
+ break;
+
skb = bt_skb_alloc(HCI_MAX_ISO_SIZE, GFP_ATOMIC);
if (!skb) {
err = -ENOMEM;
@@ -1199,6 +1208,17 @@ static int btmtk_recv_isopkt(struct hci_dev *hdev, void *buffer, int count)
/* Complete ISO header */
hci_skb_expect(skb) = __le16_to_cpu(dlen);
+ if (!hci_skb_expect(skb)) {
+ /* Zero padding was ruled out above, so a
+ * zero Data_Total_Length here is invalid.
+ */
+ kfree_skb(skb);
+ skb = NULL;
+
+ err = -EILSEQ;
+ break;
+ }
+
if (skb_tailroom(skb) < hci_skb_expect(skb)) {
kfree_skb(skb);
skb = NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 179/990] Bluetooth: btmtk: bound the ISO payload length by the controllers MTU
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (177 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 178/990] Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 180/990] Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD Greg Kroah-Hartman
` (673 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hao Qin, Wenlong Tian, Chris Lu,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lu <chris.lu@mediatek.com>
[ Upstream commit d015faf684129a276f2137ad2e11c6c985294648 ]
btmtk_recv_isopkt() bounds the Data_Total_Length reported by the
controller with skb_tailroom(skb) < hci_skb_expect(skb). That keeps the
reassembly inside the skb, but it enforces no protocol limit: the head
allocation is rounded up to the next kmalloc bucket and skb_tailroom()
reports what the bucket can hold rather than what was requested, which is
several hundred bytes more. An oversized length therefore passes, and the
parser keeps pulling bytes out of the following transfers to fill it,
swallowing the real ISO packets they carry until the frame is handed to
hci_recv_frame().
The controller reports the largest ISO_Data_Packet_Length it will send in
LE Read Buffer Size [v2], which hci_cc_le_read_buffer_size_v2() keeps in
hdev->iso_mtu. Once that is available, bound the length by it and size the
receive skb to hold that much plus the 4-byte header. HCI_MAX_ISO_SIZE is
kept only as a fallback for the window before the command completes.
Keep the skb_tailroom() test as well, because a fragment started before
hdev->iso_mtu was populated sits in an skb sized for the fallback.
Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Co-developed-by: Hao Qin <hao.qin@mediatek.com>
Signed-off-by: Hao Qin <hao.qin@mediatek.com>
Co-developed-by: Wenlong Tian <ot_wenlong.tian@mediatek.com>
Signed-off-by: Wenlong Tian <ot_wenlong.tian@mediatek.com>
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btmtk.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 51b55eceba5f1..1518b93f4676d 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -1168,8 +1168,15 @@ static int btmtk_recv_isopkt(struct hci_dev *hdev, void *buffer, int count)
struct btmtk_data *btmtk_data = hci_get_priv(hdev);
struct sk_buff *skb;
unsigned long flags;
+ unsigned int iso_mtu;
int err = 0;
+ /* The controller reports the largest Data_Total_Length it will send in
+ * LE Read Buffer Size [v2]. Fall back to HCI_MAX_ISO_SIZE while that
+ * command has not completed yet.
+ */
+ iso_mtu = hdev->iso_mtu ? hdev->iso_mtu : HCI_MAX_ISO_SIZE;
+
spin_lock_irqsave(&btmtk_data->isorxlock, flags);
skb = btmtk_data->isopkt_skb;
@@ -1185,7 +1192,8 @@ static int btmtk_recv_isopkt(struct hci_dev *hdev, void *buffer, int count)
if (mem_is_zero(buffer, count))
break;
- skb = bt_skb_alloc(HCI_MAX_ISO_SIZE, GFP_ATOMIC);
+ skb = bt_skb_alloc(HCI_ISO_HDR_SIZE + iso_mtu,
+ GFP_ATOMIC);
if (!skb) {
err = -ENOMEM;
break;
@@ -1219,7 +1227,13 @@ static int btmtk_recv_isopkt(struct hci_dev *hdev, void *buffer, int count)
break;
}
- if (skb_tailroom(skb) < hci_skb_expect(skb)) {
+ /* Reject a length the controller said it would never
+ * send. The skb_tailroom() test is kept because a
+ * fragment started before hdev->iso_mtu was populated
+ * sits in a smaller skb than iso_mtu now allows.
+ */
+ if (hci_skb_expect(skb) > iso_mtu ||
+ skb_tailroom(skb) < hci_skb_expect(skb)) {
kfree_skb(skb);
skb = NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 180/990] Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (178 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 179/990] Bluetooth: btmtk: bound the ISO payload length by the controllers MTU Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 181/990] Bluetooth: hci_sync: Copy the LE accept list under hdev->lock Greg Kroah-Hartman
` (672 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Lu, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Lu <chris.lu@mediatek.com>
[ Upstream commit 855c9a54608f1e94f4c52afe3790def30534155a ]
The ISO data transfer size is spelled out twice: as a raw byte pair in the
vendor command sent by btmtk_usb_isointf_init(), and as MTK_ISO_THRESHOLD
for the padding in btmtk_isopkt_pad(). Build the command payload from the
macro so the size is stated once, and update the setting for current
MediaTek controllers.
Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btmtk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 1518b93f4676d..5863b63f5d3f0 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -25,7 +25,7 @@
#define MTK_SEC_MAP_NEED_SEND_SIZE 52
/* It is for mt79xx iso data transmission setting */
-#define MTK_ISO_THRESHOLD 264
+#define MTK_ISO_THRESHOLD 342
struct btmtk_patch_header {
u8 datetime[16];
@@ -1352,7 +1352,7 @@ static int btmtk_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
static int btmtk_usb_isointf_init(struct hci_dev *hdev)
{
struct btmtk_data *btmtk_data = hci_get_priv(hdev);
- u8 iso_param[2] = { 0x08, 0x01 };
+ __le16 iso_param = cpu_to_le16(MTK_ISO_THRESHOLD);
struct sk_buff *skb;
int err;
@@ -1367,7 +1367,7 @@ static int btmtk_usb_isointf_init(struct hci_dev *hdev)
return err;
}
- skb = __hci_cmd_sync(hdev, 0xfd98, sizeof(iso_param), iso_param,
+ skb = __hci_cmd_sync(hdev, 0xfd98, sizeof(iso_param), &iso_param,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Failed to apply iso setting (%ld)", PTR_ERR(skb));
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 181/990] Bluetooth: hci_sync: Copy the LE accept list under hdev->lock
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (179 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 180/990] Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 182/990] Bluetooth: hci_sync: Protect resolving-list lookups Greg Kroah-Hartman
` (671 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 674006912777747170ad70d7727804ad4f2d047f ]
The LE accept-list mirror consists of bdaddr_list entries that are
added, removed and freed under hdev->lock. The ordinary branch of
hci_update_accept_list_sync() traverses this list without that lock.
The request worker's req_lock does not serialize raw HCI completions,
and the RCU sections protect connection and pending-action lookups,
not the accept-list nodes.
Changing connectability can reach this iterator through
set_connectable_sync(), hci_update_connectable_sync(),
hci_update_passive_scan_sync() and hci_passive_scan_sync(). With a
populated mirror, a privileged raw HCI sender can issue
HCI_OP_LE_CLEAR_ACCEPT_LIST while request work is reconciling it:
Request work HCI event work
select b and successor t
hci_cc_le_clear_accept_list()
hci_dev_lock(hdev)
hci_bdaddr_list_clear()
unlink nodes and kfree(b)
hci_dev_unlock(hdev)
read b->bdaddr_type
The clear completion can therefore free the selected node before its
field read, or the saved successor before the iterator advances.
KASAN reported a one-byte read of bdaddr_type from the freed node.
Copy each entry's address and type under hdev->lock and reconcile the
private array instead. Release the mutex before issuing synchronous
commands, since their completion handlers also acquire it. Free the
copy after iteration and use the existing error path to disable
accept-list filtering if allocation fails.
This change has not been runtime-tested.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in hci_passive_scan_sync+0x1cc4/0x1f80
Read of size 1 at addr ffff888105ee6c56 by task kworker/u17:1/499
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_passive_scan_sync+0x1cc4/0x1f80
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_passive_scan_sync+0x1cc4/0x1f80
kasan_report+0xe0/0x110
? hci_passive_scan_sync+0x1cc4/0x1f80
hci_passive_scan_sync+0x1cc4/0x1f80
? pmbd_gate_site_armed+0x31/0x1c0
? __pfx_hci_passive_scan_sync+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? pmbd_probe_hit_cookie+0x10/0x1c0
? __pfx_pmbd_probe_hit_cookie+0x10/0x10
? hci_update_passive_scan_sync+0x43f/0x9e0
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x280
hci_update_passive_scan_sync+0x473/0x9e0
hci_update_connectable_sync+0x13c/0x250
set_connectable_sync+0x39/0xb0
hci_cmd_sync_work+0x1b3/0x450
? srso_alias_return_thunk+0x5/0xfbef5
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 511:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_bdaddr_list_add+0x179/0x390
hci_cc_le_add_to_accept_list+0x189/0x2d0
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
Freed by task 511:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
kfree+0x307/0x580
hci_bdaddr_list_clear+0x134/0x230
hci_cc_le_clear_accept_list+0x80/0x1f0
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
The buggy address belongs to the object at ffff888105ee6c40
which
belongs to the cache kmalloc-32 of size 32
The buggy address is located 22 bytes inside of
freed
32-byte region [ffff888105ee6c40,
ffff888105ee6c60)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000
index:0xffff888105ee69c0 pfn:0x105ee6
flags: 0x200000000000200(workingset|node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000200 ffff888100042780 ffffea0004187150
ffffea00042534d0
raw: ffff888105ee69c0 000000000040003f 00000000f5000000
0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888105ee6b00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
ffff888105ee6b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
>ffff888105ee6c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
^
ffff888105ee6c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
ffff888105ee6d00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
==================================================================
Fixes: e8907f76544f ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3")
Assisted-by: LLM
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
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 | 53 ++++++++++++++++++++++++++++++++--------
1 file changed, 43 insertions(+), 10 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 5be062fdeb967..7403fff7d7855 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2906,6 +2906,31 @@ static struct conn_params *conn_params_copy(struct list_head *list, size_t *n)
return p;
}
+static struct conn_params *le_accept_list_copy(struct hci_dev *hdev,
+ size_t *n)
+{
+ struct bdaddr_list *entry;
+ struct conn_params *params;
+ size_t i = 0;
+
+ hci_dev_lock(hdev);
+
+ *n = list_count_nodes(&hdev->le_accept_list);
+ params = kvzalloc_objs(struct conn_params, *n);
+ if (!params)
+ goto unlock;
+
+ list_for_each_entry(entry, &hdev->le_accept_list, list) {
+ bacpy(¶ms[i].addr, &entry->bdaddr);
+ params[i].addr_type = entry->bdaddr_type;
+ i++;
+ }
+
+unlock:
+ hci_dev_unlock(hdev);
+ return params;
+}
+
/* Clear LE Accept List */
static int hci_le_clear_accept_list_sync(struct hci_dev *hdev)
{
@@ -2936,7 +2961,6 @@ static int hci_le_clear_accept_list_sync(struct hci_dev *hdev)
static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
{
struct conn_params *params;
- struct bdaddr_list *b, *t;
u8 num_entries = 0;
bool pend_conn, pend_report;
u8 filter_policy;
@@ -3001,20 +3025,27 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
* report. If not present in either list, then remove it from
* the controller.
*/
- list_for_each_entry_safe(b, t, &hdev->le_accept_list, list) {
+ params = le_accept_list_copy(hdev, &n);
+ if (!params) {
+ err = -ENOMEM;
+ goto done;
+ }
+
+ for (i = 0; i < n; i++) {
rcu_read_lock();
- if (hci_conn_hash_lookup_le(hdev, &b->bdaddr, b->bdaddr_type)) {
+ if (hci_conn_hash_lookup_le(hdev, ¶ms[i].addr,
+ params[i].addr_type)) {
rcu_read_unlock();
continue;
}
pend_conn = hci_pend_le_action_lookup(&hdev->pend_le_conns,
- &b->bdaddr,
- b->bdaddr_type);
- pend_report = hci_pend_le_action_lookup(&hdev->pend_le_reports,
- &b->bdaddr,
- b->bdaddr_type);
+ ¶ms[i].addr,
+ params[i].addr_type);
+ pend_report = hci_pend_le_action_lookup(
+ &hdev->pend_le_reports, ¶ms[i].addr,
+ params[i].addr_type);
rcu_read_unlock();
@@ -3022,14 +3053,16 @@ static u8 hci_update_accept_list_sync(struct hci_dev *hdev)
* remove it from the acceptlist.
*/
if (!pend_conn && !pend_report) {
- hci_le_del_accept_list_sync(hdev, &b->bdaddr,
- b->bdaddr_type);
+ hci_le_del_accept_list_sync(hdev, ¶ms[i].addr,
+ params[i].addr_type);
continue;
}
num_entries++;
}
+ kvfree(params);
+
/* Since all no longer valid accept list entries have been
* removed, walk through the list of pending connections
* and ensure that any new device gets programmed into
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 182/990] Bluetooth: hci_sync: Protect resolving-list lookups
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (180 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 181/990] Bluetooth: hci_sync: Copy the LE accept list under hdev->lock Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 183/990] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping Greg Kroah-Hartman
` (670 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit f05bd61a3213613de7848c8df2865492d5225023 ]
The host resolving list is updated under hdev->lock, and each
bdaddr_list_with_irk entry must remain alive throughout a lookup.
hci_le_del_resolve_list_sync() and hci_le_add_resolve_list_sync()
traverse that list without taking the lock.
On an LE privacy-capable controller with a programmed entry, passive
scan reconciliation can reach hci_le_del_resolve_list_sync() while a
privileged HCI_RAW client sends LE Clear Resolving List. The raw
command does not take req_lock, and its successful completion runs
on the controller workqueue independently of request work:
Request work Raw HCI / event work
hci_le_del_resolve_list_sync()
lookup loads a list node
hci_sock_sendmsg()
queue LE Clear Resolving List
hci_cc_le_clear_resolv_list()
take hdev->lock
unlink and free the node
release hdev->lock
read the node's address/type
The clear can free the node after the lookup loads it and before its
address/type read, causing a use-after-free. The report below shows
this access with the delete helper on the faulting stack. The add
helper uses the same unprotected lookup.
Take hdev->lock around each resolving-list membership lookup and
retain only a boolean result. This serializes traversal with clear
completion and keeps entry pointers inside the protected section.
Release the lock before issuing a synchronous HCI command, whose
completion also needs the lock.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in
hci_bdaddr_list_lookup_with_irk+0x106/0x120
Read of size 1 at addr ffff88810b036e16 by task kworker/u17:0/495
CPU: 2 UID: 0 PID: 495 Comm: kworker/u17:0 Not tainted
7.2.0-rc6-pmb-bt-functional-v1+ #3 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix,
1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_bdaddr_list_lookup_with_irk+0x106/0x120
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_bdaddr_list_lookup_with_irk+0x106/0x120
kasan_report+0xe0/0x110
? hci_bdaddr_list_lookup_with_irk+0x106/0x120
hci_bdaddr_list_lookup_with_irk+0x106/0x120
hci_le_del_resolve_list_sync.isra.0+0xd6/0x3f0
? __pfx_hci_le_del_resolve_list_sync.isra.0+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
hci_le_del_accept_list_sync.isra.0+0x11c/0x290
? __pfx_hci_le_del_accept_list_sync.isra.0+0x10/0x10
? hci_passive_scan_sync+0x551/0x1e80
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x280
hci_passive_scan_sync+0x71c/0x1e80
? __pfx_hci_passive_scan_sync+0x10/0x10
? find_held_lock+0x2b/0x80
? hci_lookup_le_connect+0xe1/0x3c0
? srso_alias_return_thunk+0x5/0xfbef5
? find_held_lock+0x2b/0x80
? hci_update_passive_scan_sync+0x437/0x950
? srso_alias_return_thunk+0x5/0xfbef5
? lock_release+0xc8/0x280
hci_update_passive_scan_sync+0x461/0x950
hci_cmd_sync_work+0x1b3/0x450
? srso_alias_return_thunk+0x5/0xfbef5
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 495:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_bdaddr_list_add_with_irk+0x183/0x3e0
hci_cc_le_add_to_resolv_list+0x18c/0x240
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
Freed by task 497:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
kfree+0x307/0x580
hci_bdaddr_list_clear+0x134/0x230
hci_cc_le_clear_resolv_list+0x13d/0x240
hci_cmd_complete_evt+0x373/0xab0
hci_event_packet+0x4e8/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
The buggy address belongs to the object at ffff88810b036e00
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 22 bytes inside of
freed 64-byte region [ffff88810b036e00, ffff88810b036e40)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
pfn:0x10b036
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100
dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000
0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88810b036d00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
ffff88810b036d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88810b036e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88810b036e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810b036f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Disabling lock debugging due to kernel taint
Fixes: e8907f76544f ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3")
Assisted-by: LLM
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
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 | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 7403fff7d7855..9ba61c1bcd129 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2469,15 +2469,17 @@ static int hci_le_del_resolve_list_sync(struct hci_dev *hdev,
bdaddr_t *bdaddr, u8 bdaddr_type)
{
struct hci_cp_le_del_from_resolv_list cp;
- struct bdaddr_list_with_irk *entry;
+ bool exists;
if (!ll_privacy_capable(hdev))
return 0;
/* Check if the IRK has been programmed */
- entry = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list, bdaddr,
- bdaddr_type);
- if (!entry)
+ hci_dev_lock(hdev);
+ exists = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list,
+ bdaddr, bdaddr_type);
+ hci_dev_unlock(hdev);
+ if (!exists)
return 0;
cp.bdaddr_type = bdaddr_type;
@@ -2533,8 +2535,8 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
{
struct hci_cp_le_add_to_resolv_list cp;
struct smp_irk *irk;
- struct bdaddr_list_with_irk *entry;
struct hci_conn_params *p;
+ bool exists;
if (!ll_privacy_capable(hdev))
return 0;
@@ -2557,10 +2559,11 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
return 0;
/* Check if the IK has _not_ been programmed yet. */
- entry = hci_bdaddr_list_lookup_with_irk(&hdev->le_resolv_list,
- ¶ms->addr,
- params->addr_type);
- if (entry)
+ hci_dev_lock(hdev);
+ exists = hci_bdaddr_list_lookup_with_irk(
+ &hdev->le_resolv_list, ¶ms->addr, params->addr_type);
+ hci_dev_unlock(hdev);
+ if (exists)
return 0;
cp.bdaddr_type = params->addr_type;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 183/990] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (181 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 182/990] Bluetooth: hci_sync: Protect resolving-list lookups Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 184/990] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Greg Kroah-Hartman
` (669 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shuai Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
[ Upstream commit c0bb764fc082672678d371c375597a6a9f614cf9 ]
The kernel sets HCI_AUTO_OFF when a controller is first registered and
starts a 2-second timer. On slower boots bluetoothd and the HCI_AUTO_OFF
timer can race: hci_power_off() is already queued while bluetoothd is
still in the middle of its adapter setup sequence. hci_cmd_sync_clear()
then cancels any pending mgmt commands with -ECANCELED, including the
MGMT_OP_REMOVE_ADV_MONITOR sent by reset_adv_monitors() early in the
setup sequence.
When auto_off=1, hci_dev_close_sync() skips __mgmt_power_off() entirely,
so there is no fallback path to reply to the cancelled commands.
mgmt_remove_adv_monitor_complete() silently returns on -ECANCELED, leaving
the command with no reply. Since bluez's mgmt queue is strictly serialised,
this stalls all subsequent commands indefinitely, leaving bluetoothd unable
to register the adapter.
Fix by mapping -ECANCELED to MGMT_STATUS_CANCELLED in mgmt_errno_status()
and replying to the cancelled command in mgmt_remove_adv_monitor_complete()
instead of returning early.
Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Stable-dep-of: 7eac80614300 ("Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5058fa2ed9a9b..6e49f77c363f8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -304,6 +304,8 @@ static u8 mgmt_errno_status(int err)
return MGMT_STATUS_ALREADY_CONNECTED;
case -ENOTCONN:
return MGMT_STATUS_DISCONNECTED;
+ case -ECANCELED:
+ return MGMT_STATUS_CANCELLED;
}
return MGMT_STATUS_FAILED;
@@ -5614,8 +5616,18 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
struct mgmt_pending_cmd *cmd = data;
struct mgmt_cp_remove_adv_monitor *cp;
- if (status == -ECANCELED)
+ /* Reply to a cancelled command so bluetoothd's serialised mgmt queue
+ * is not blocked.
+ */
+ if (status == -ECANCELED) {
+ cp = cmd->param;
+ rp.monitor_handle = cp->monitor_handle;
+
+ mgmt_cmd_complete(cmd->sk, cmd->hdev->id, cmd->opcode,
+ mgmt_status(status), &rp, sizeof(rp));
+ mgmt_pending_free(cmd);
return;
+ }
hci_dev_lock(hdev);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 184/990] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (182 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 183/990] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 185/990] Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init() Greg Kroah-Hartman
` (668 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tobias Wilken,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Wilken <tooangel@tooangel.de>
[ Upstream commit 7eac80614300563470cffabf4df2b63616787ee7 ]
Since MGMT_OP_SET_POWERED runs through hci_cmd_sync, powering on a
controller that is blocked by rfkill fails with -ERFKILL from
hci_dev_open_sync(), and mgmt_set_powered_complete() reports it with
mgmt_status(err). mgmt_errno_status() has no case for -ERFKILL, so
userspace gets MGMT_STATUS_FAILED instead of MGMT_STATUS_RFKILLED.
Before that conversion, power on went through hci_power_on(), whose
error path mgmt_set_powered_failed() still maps -ERFKILL to
MGMT_STATUS_RFKILLED. bluetoothd relies on that status: for
RFKILLED it sets the adapter PowerState to "off-blocked" and returns
org.bluez.Error.Blocked for the Powered property, for any other status
it returns org.bluez.Error.Failed.
With the controller soft blocked, "bluetoothctl power on" printed
"Failed to set power on: org.bluez.Error.Failed" and btmon showed
"Set Powered (0x0005) Status: Failed (0x03)". With this change it
prints org.bluez.Error.Blocked and btmon shows "Status: RFKilled
(0x12)".
Map -ERFKILL to MGMT_STATUS_RFKILLED in mgmt_errno_status().
Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED")
Assisted-by: LLM
Signed-off-by: Tobias Wilken <tooangel@tooangel.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/mgmt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 6e49f77c363f8..484243146f10e 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -306,6 +306,8 @@ static u8 mgmt_errno_status(int err)
return MGMT_STATUS_DISCONNECTED;
case -ECANCELED:
return MGMT_STATUS_CANCELLED;
+ case -ERFKILL:
+ return MGMT_STATUS_RFKILLED;
}
return MGMT_STATUS_FAILED;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 185/990] Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (183 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 184/990] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 186/990] Bluetooth: hci_core: Keep link-key filtering inside RCU Greg Kroah-Hartman
` (667 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ismail Tarim, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ismail Tarim <ismailtarim7@gmail.com>
[ Upstream commit 3b70dd827b27bfadd89e7b1a2d422b04da38797c ]
btmtk_usb_isointf_init() submits the ISO interrupt IN URB and then
sends the vendor command 0xfd98. If that command fails, the function
returns an error without killing the URB it has just submitted. The
caller then leaves BTMTK_ISOPKT_RUNNING clear, so the driver treats the
ISO path as inactive while its RX URB is still in flight, and
btmtk_usb_suspend() skips killing it. Kill the anchored URBs on this
path, as the URB submission failure path already does.
The return value of __set_mtk_intr_interface() is also ignored: a
failure to select the ISO alternate setting or to find its endpoints
is logged, but the function goes on to submit the URB. Return the
error instead.
Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Signed-off-by: Ismail Tarim <ismailtarim7@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btmtk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 5863b63f5d3f0..50e0ff30e8db2 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -1358,7 +1358,9 @@ static int btmtk_usb_isointf_init(struct hci_dev *hdev)
spin_lock_init(&btmtk_data->isorxlock);
- __set_mtk_intr_interface(hdev);
+ err = __set_mtk_intr_interface(hdev);
+ if (err < 0)
+ return err;
err = btmtk_submit_intr_urb(hdev, GFP_KERNEL);
if (err < 0) {
@@ -1370,6 +1372,7 @@ static int btmtk_usb_isointf_init(struct hci_dev *hdev)
skb = __hci_cmd_sync(hdev, 0xfd98, sizeof(iso_param), &iso_param,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
+ usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
bt_dev_err(hdev, "Failed to apply iso setting (%ld)", PTR_ERR(skb));
return PTR_ERR(skb);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 186/990] Bluetooth: hci_core: Keep link-key filtering inside RCU
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (184 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 185/990] Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init() Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 187/990] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU Greg Kroah-Hartman
` (666 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 281ddc4e01ab54cab07995f2a1b72cf81bf90eb5 ]
hci_find_link_key() must keep the matching link key allocated while it
checks the key against the blocked-key list. It currently leaves the
key-list RCU read-side section before passing k->val to
hci_is_blocked_key(). That helper's own RCU section protects the
blocked-key list, but it cannot keep an unlinked link key from being
reclaimed.
The SMP receive path calls the finder without hdev->lock: Secure
Connections key distribution over BR/EDR reaches it through
smp_distribute_keys() and sc_generate_ltk(). With a stored peer link
key and a link-key entry in the blocked-key list,
MGMT_OP_LOAD_LINK_KEYS can free the selected key before the comparison:
HCI RX worker (SMP) Management / RCU reclamation
hci_find_link_key()
rcu_read_lock()
select k
rcu_read_unlock()
load_link_keys()
hci_dev_lock(hdev)
hci_link_keys_clear(hdev)
list_del_rcu(), kfree_rcu()
hci_dev_unlock(hdev)
grace period ends, k is freed
hci_is_blocked_key(hdev, ..., k->val)
memcmp() reads the freed key
Keep the RCU read-side section active through the blocked-key
comparison and the warning that prints k->bdaddr, and release it before
returning on both matched-key paths. hci_find_ltk() already handles its
blocked-key check this way.
KASAN reported this on a test kernel whose scheduling hook paused the
receive worker after the lookup until the key had been freed.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in hci_is_blocked_key+0x2db/0x300
Read of size 1 at addr ffff88810b5f89a7 by task kworker/u17:0/502
CPU: 1 UID: 0 PID: 502 Comm: kworker/u17:0 Not tainted 7.2.0-rc6-pmb-bt-functional-v1+ #5 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: hci1 hci_rx_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_is_blocked_key+0x2db/0x300
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_is_blocked_key+0x2db/0x300
kasan_report+0xe0/0x110
? hci_is_blocked_key+0x2db/0x300
hci_is_blocked_key+0x2db/0x300
hci_find_link_key+0x12e/0x400
smp_distribute_keys+0x1830/0x2950
? trace_hardirqs_on+0x18/0x160
? srso_alias_return_thunk+0x5/0xfbef5
? queue_delayed_work_on+0xb3/0xf0
? __pfx_smp_distribute_keys+0x10/0x10
? __pfx_smp_send_cmd.isra.0+0x10/0x10
? __cancel_work+0x1b0/0x290
? __entry_text_end+0x1020f7/0x1020f9
? lockdep_hardirqs_on_prepare+0xea/0x1a0
? srso_alias_return_thunk+0x5/0xfbef5
? __asan_memset+0x23/0x50
? smp_recv_cb+0x12c7/0x8d80
? srso_alias_return_thunk+0x5/0xfbef5
smp_recv_cb+0x12c7/0x8d80
? __pfx_smp_recv_cb+0x10/0x10
? __pfx___might_resched+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? stack_depot_save_flags+0x29/0x9a0
? srso_alias_return_thunk+0x5/0xfbef5
? __mutex_lock+0x182c/0x2590
? kasan_save_stack+0x42/0x60
? l2cap_recv_frame+0x9ef/0x8830
? __kasan_slab_free+0x5f/0x80
? kmem_cache_free+0x242/0x580
? kfree_skbmem+0x15e/0x1d0
? sk_skb_reason_drop+0x12f/0x490
? hci_event_packet+0x556/0xc70
? hci_rx_work+0x367/0xf00
? process_one_work+0x908/0x19c0
? worker_thread+0x65c/0xe40
? __pfx___mutex_lock+0x10/0x10
? __lock_acquire+0x466/0x2260
? __pfx_l2cap_chan_hold_unless_zero+0x10/0x10
? l2cap_recv_frame+0x13cc/0x8830
? __pfx_smp_recv_cb+0x10/0x10
l2cap_recv_frame+0x13cc/0x8830
? srso_alias_return_thunk+0x5/0xfbef5
? __mutex_lock+0x182c/0x2590
? __pfx_l2cap_recv_frame+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? find_held_lock+0x2b/0x80
? l2cap_recv_acldata+0x1eb/0x10e0
? __pfx___mutex_lock+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __mutex_unlock_slowpath+0x147/0x920
? __pfx_l2cap_conn_hold_unless_zero+0x10/0x10
? __pfx_hci_conn_enter_active_mode+0x10/0x10
? l2cap_recv_acldata+0x13d/0x10e0
? srso_alias_return_thunk+0x5/0xfbef5
l2cap_recv_acldata+0xe9f/0x10e0
? srso_alias_return_thunk+0x5/0xfbef5
hci_rx_work+0x5a6/0xf00
? srso_alias_return_thunk+0x5/0xfbef5
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 504:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_add_link_key+0x474/0x840
hci_link_key_notify_evt+0x492/0xce0
hci_event_packet+0x894/0xc70
hci_rx_work+0x367/0xf00
process_one_work+0x908/0x19c0
worker_thread+0x65c/0xe40
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
Freed by task 29:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
__rcu_free_sheaf_prepare+0x65/0x2a0
rcu_free_sheaf_nobarn+0x1d/0x50
rcu_core+0x661/0x1d10
handle_softirqs+0x201/0x930
run_ksoftirqd+0x33/0x60
smpboot_thread_fn+0x3bd/0x9a0
kthread+0x34f/0x460
ret_from_fork+0x659/0x940
ret_from_fork_asm+0x1a/0x30
The buggy address belongs to the object at ffff88810b5f8980
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 39 bytes inside of
freed 64-byte region [ffff88810b5f8980, ffff88810b5f89c0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b5f8
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88810b5f8880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810b5f8900: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
>ffff88810b5f8980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88810b5f8a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810b5f8a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Fixes: 600a87490ff9 ("Bluetooth: Implementation of MGMT_OP_SET_BLOCKED_KEYS.")
Assisted-by: LLM
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
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, 2 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e4caf79c2d7c3..c9b8fa9a2e88a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1111,17 +1111,16 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
rcu_read_lock();
list_for_each_entry_rcu(k, &hdev->link_keys, list) {
if (bacmp(bdaddr, &k->bdaddr) == 0) {
- rcu_read_unlock();
-
if (hci_is_blocked_key(hdev,
HCI_BLOCKED_KEY_TYPE_LINKKEY,
k->val)) {
bt_dev_warn_ratelimited(hdev,
"Link key blocked for %pMR",
&k->bdaddr);
- return NULL;
+ k = NULL;
}
+ rcu_read_unlock();
return k;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 187/990] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (185 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 186/990] Bluetooth: hci_core: Keep link-key filtering inside RCU Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 188/990] Bluetooth: MGMT: Clear disabled connection parameters when loading none Greg Kroah-Hartman
` (665 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit 9ff737119177a6c1ce6083ef8c0fc06355f11869 ]
hci_le_add_resolve_list_sync() copies the peer IRK into the LE Add
Device To Resolving List command after hci_find_irk_by_addr() has
returned. The finder ends its RCU read-side section before returning
the borrowed entry, and neither the request worker nor
interleave_scan_work() holds hdev->lock here. The resolving-list
membership check between the lookup and the copy takes hdev->lock and
may sleep on it, which widens the window.
When LL privacy programs a peer with address resolution enabled,
MGMT_OP_LOAD_IRKS can free its IRK before the copy:
Request worker Management / RCU reclamation
hci_le_add_resolve_list_sync()
irk = hci_find_irk_by_addr()
load_irks()
hci_dev_lock(hdev)
hci_smp_irks_clear(hdev)
list_del_rcu(), kfree_rcu()
hci_dev_unlock(hdev)
grace period ends, irk is freed
resolving-list membership check
memcpy(cp.peer_irk, irk->val, 16)
Copy the IRK value in an RCU read-side section right after the lookup,
as hci_le_set_privacy_mode_sync() does for the identity address. The
section ends before hdev->lock is taken and before the synchronous HCI
command is sent.
KASAN reported this on a test kernel with scheduling hooks, whose
frames appear in the trace. The report predates the hdev->lock taken
by the membership check.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in hci_le_add_resolve_list_sync+0x8d9/0x910
Read of size 16 at addr ffff88810d21452d by task kworker/u17:0/504
CPU: 2 UID: 0 PID: 504 Comm: kworker/u17:0 Not tainted 7.2.0-rc6-pmb-bt-functional-v1+ #2 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: hci0 interleave_scan_work
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? hci_le_add_resolve_list_sync+0x8d9/0x910
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? hci_le_add_resolve_list_sync+0x8d9/0x910
kasan_report+0xe0/0x110
? hci_le_add_resolve_list_sync+0x8d9/0x910
hci_le_add_resolve_list_sync+0x8d9/0x910
? __pfx_hci_le_add_resolve_list_sync+0x10/0x10
? pmbd_probe_hit_cookie+0xe7/0x1c0
? srso_alias_return_thunk+0x5/0xfbef5
? pmbd_probe_hit_cookie+0xee/0x1c0
? __pfx_pmbd_probe_hit_cookie+0x10/0x10
hci_le_add_accept_list_sync+0x18e/0x820
? conn_params_copy+0x36e/0x650
? __pfx_hci_le_add_accept_list_sync+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? conn_params_copy+0x3a0/0x650
hci_passive_scan_sync+0x95f/0x1f10
? __pfx_hci_passive_scan_sync+0x10/0x10
? debug_object_deactivate+0x2f8/0x3c0
? pwq_dec_nr_in_flight+0x880/0xdf0
? srso_alias_return_thunk+0x5/0xfbef5
? lock_acquire+0x17b/0x2f0
? process_one_work+0x895/0x19c0
interleave_scan_work+0x11b/0x470
process_one_work+0x908/0x19c0
? __pfx_process_one_work+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? lock_is_held_type+0x8f/0x100
? srso_alias_return_thunk+0x5/0xfbef5
worker_thread+0x65c/0xe40
? __pfx_worker_thread+0x10/0x10
kthread+0x34f/0x460
? srso_alias_return_thunk+0x5/0xfbef5
? __pfx_kthread+0x10/0x10
ret_from_fork+0x659/0x940
? __pfx_ret_from_fork+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __switch_to+0x74f/0xf80
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 535:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
hci_add_irk+0xb6/0x220
load_irks+0x5f9/0x840
hci_sock_sendmsg+0x128b/0x22e0
__sys_sendto+0x425/0x470
__x64_sys_sendto+0xe5/0x1c0
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 0:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
__rcu_free_sheaf_prepare+0x65/0x2a0
rcu_free_sheaf+0x1f/0xe0
rcu_core+0x661/0x1d10
handle_softirqs+0x201/0x930
__irq_exit_rcu+0x110/0x1e0
irq_exit_rcu+0xe/0x20
sysvec_apic_timer_interrupt+0x6c/0x80
asm_sysvec_apic_timer_interrupt+0x1a/0x20
The buggy address belongs to the object at ffff88810d214500
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 45 bytes inside of
freed 64-byte region [ffff88810d214500, ffff88810d214540)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10d214
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88810d214400: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810d214480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88810d214500: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88810d214580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88810d214600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
Fixes: e8907f76544f ("Bluetooth: hci_sync: Make use of hci_cmd_sync_queue set 3")
Assisted-by: LLM
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
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 | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 9ba61c1bcd129..e5f29558f1468 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2554,9 +2554,17 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
} else if (!(params->flags & HCI_CONN_FLAG_ADDRESS_RESOLUTION))
return 0;
+ rcu_read_lock();
+
irk = hci_find_irk_by_addr(hdev, ¶ms->addr, params->addr_type);
- if (!irk)
+ if (!irk) {
+ rcu_read_unlock();
return 0;
+ }
+
+ memcpy(cp.peer_irk, irk->val, 16);
+
+ rcu_read_unlock();
/* Check if the IK has _not_ been programmed yet. */
hci_dev_lock(hdev);
@@ -2568,7 +2576,6 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,
cp.bdaddr_type = params->addr_type;
bacpy(&cp.bdaddr, ¶ms->addr);
- memcpy(cp.peer_irk, irk->val, 16);
/* Default privacy mode is always Network */
params->privacy_mode = HCI_NETWORK_PRIVACY;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 188/990] Bluetooth: MGMT: Clear disabled connection parameters when loading none
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (186 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 187/990] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 189/990] Bluetooth: hci_core: Initialize advertising RPA work only once Greg Kroah-Hartman
` (664 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Dewald, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Dewald <kevin@simpleble.org>
[ Upstream commit d90f24dc389b9a7524aaac109021d1530fa180f0 ]
Load Connection Parameters only clears the disabled connection
parameters when it loads more than one entry, so that loading a single
entry can update the parameters of one device without dropping the
others. Loading no entries does not clear them either, though, which is
what bluetoothd does when it starts without stored connection
parameters.
Pair Device adds disabled connection parameters for the device it pairs
with, so these now survive bluetoothd restarts, and new connections to
the device keep using the parameters they were created with instead of
the defaults set since, e.g. the connection interval from main.conf.
Clear the disabled connection parameters unless a single entry is
loaded, as was done for any number of entries before.
Fixes: 0ece498c27d8 ("Bluetooth: MGMT: Make MGMT_OP_LOAD_CONN_PARAM update existing connection")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Kevin Dewald <kevin@simpleble.org>
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, 5 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 484243146f10e..8d18e94fe8c05 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -8165,7 +8165,11 @@ static int load_conn_param(struct sock *sk, struct hci_dev *hdev, void *data,
hci_dev_lock(hdev);
- if (param_count > 1)
+ /* A single entry may be an update for one device, so keep the other
+ * disabled parameters then, but clear them otherwise, including when
+ * no entries are loaded.
+ */
+ if (param_count != 1)
hci_conn_params_clear_disabled(hdev);
for (i = 0; i < param_count; i++) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 189/990] Bluetooth: hci_core: Initialize advertising RPA work only once
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (187 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 188/990] Bluetooth: MGMT: Clear disabled connection parameters when loading none Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 190/990] Bluetooth: validate retained LE Create CIS command length Greg Kroah-Hartman
` (663 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cen Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <zzzccc427@gmail.com>
[ Upstream commit a7c5c18b7cc30dcd2a9ae5a0fb38378d3998417e ]
hci_add_adv_instance() also updates existing instances and calls
INIT_DELAYED_WORK() on their rpa_expired_cb every time, even when the
work is pending or running. cancel_delayed_work_sync() then no longer
finds the work, so hci_remove_adv_instance() can free the instance
under it:
hdev->workqueue MGMT_OP_ADD_EXT_ADV_PARAMS
adv_instance_rpa_expired()
hci_dev_lock(hdev)
hci_add_adv_instance()
INIT_DELAYED_WORK()
mgmt_pending_new() fails
hci_remove_adv_instance()
cancel_delayed_work_sync()
returns without waiting
kfree(adv)
hci_dev_unlock(hdev)
adv->rpa_expired = true
The work has been initialized on every update since it was added.
Initialize it only when the instance is allocated.
KASAN report as below:
BUG: KASAN: slab-use-after-free in adv_instance_rpa_expired+0x139/0x160
Write of size 1 at addr ffff888108d84b2e by task kworker/u17:0/504
Workqueue: hci0 adv_instance_rpa_expired
Call Trace:
adv_instance_rpa_expired+0x139/0x160
Allocated by task 560:
hci_add_adv_instance+0x68d/0x9d0
add_ext_adv_params+0x4d4/0xb60
hci_sock_sendmsg+0x128b/0x22e0
Freed by task 594:
kfree+0x307/0x580
hci_remove_adv_instance+0x230/0x540
add_ext_adv_params+0xa43/0xb60
hci_sock_sendmsg+0x128b/0x22e0
Last potentially related work creation:
insert_work+0x37/0x210
__queue_work+0xaba/0x1270
call_timer_fn+0x171/0x500
The buggy address belongs to the object at ffff888108d84800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 814 bytes inside of
freed 1024-byte region [ffff888108d84800, ffff888108d84c00)
Fixes: a73c046a2869 ("Bluetooth: Implement Set ADV set random address")
Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
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, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c9b8fa9a2e88a..c19a9fa19e7d3 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1736,6 +1736,9 @@ struct adv_info *hci_add_adv_instance(struct hci_dev *hdev, u8 instance,
if (!adv)
return ERR_PTR(-ENOMEM);
+ INIT_DELAYED_WORK(&adv->rpa_expired_cb,
+ adv_instance_rpa_expired);
+
adv->pending = true;
adv->instance = instance;
@@ -1772,8 +1775,6 @@ struct adv_info *hci_add_adv_instance(struct hci_dev *hdev, u8 instance,
else
adv->duration = duration;
- INIT_DELAYED_WORK(&adv->rpa_expired_cb, adv_instance_rpa_expired);
-
BT_DBG("%s for %dMR", hdev->name, instance);
return adv;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 190/990] Bluetooth: validate retained LE Create CIS command length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (188 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 189/990] Bluetooth: hci_core: Initialize advertising RPA work only once Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 191/990] Bluetooth: validate retained LE Set CIG Parameters " Greg Kroah-Hartman
` (662 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yifan Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
[ Upstream commit 1eb52f35fc8fb06ab7f2973fff29cba81f96b947 ]
hci_cs_le_create_cis() retrieves the parameters of the previously sent
command without their length. It then trusts num_cis and walks the
flexible cis[] array when a controller reports a failed command.
A five-byte HCI command containing only num_cis can therefore make the
handler read beyond the command skb. KASAN reports:
BUG: KASAN: slab-out-of-bounds in hci_cs_le_create_cis
Read of size 2
hci_cs_le_create_cis
hci_cmd_status_evt
hci_event_packet
Add a length-returning saved-command helper and require the fixed header
and complete CIS array before walking it.
The reproducer no longer triggers a KASAN report with this change.
Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Closes: https://lore.kernel.org/linux-bluetooth/179317462624.87574.6271582002629080499@stu.pku.edu.cn/
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
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_core.c | 18 ++++++++++++++----
net/bluetooth/hci_event.c | 7 ++++++-
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index c416f7f2af6aa..37b3dc2b4c945 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -2330,6 +2330,8 @@ void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
void hci_send_iso(struct hci_conn *conn, struct sk_buff *skb);
void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
+void *hci_sent_cmd_data_len(struct hci_dev *hdev, __u16 opcode,
+ size_t *len);
void *hci_recv_event_data(struct hci_dev *hdev, __u8 event);
u32 hci_conn_get_phy(struct hci_conn *conn);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c19a9fa19e7d3..54a8942a022ec 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3175,7 +3175,8 @@ int __hci_cmd_send(struct hci_dev *hdev, u16 opcode, u32 plen,
EXPORT_SYMBOL(__hci_cmd_send);
/* Get data from the previously sent command */
-static void *hci_cmd_data(struct sk_buff *skb, __u16 opcode)
+static void *hci_cmd_data(struct sk_buff *skb, __u16 opcode,
+ size_t *len)
{
struct hci_command_hdr *hdr;
@@ -3187,23 +3188,32 @@ static void *hci_cmd_data(struct sk_buff *skb, __u16 opcode)
if (hdr->opcode != cpu_to_le16(opcode))
return NULL;
+ if (len)
+ *len = skb->len - HCI_COMMAND_HDR_SIZE;
+
return skb->data + HCI_COMMAND_HDR_SIZE;
}
/* Get data from the previously sent command */
-void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode)
+void *hci_sent_cmd_data_len(struct hci_dev *hdev, __u16 opcode, size_t *len)
{
void *data;
/* Check if opcode matches last sent command */
- data = hci_cmd_data(hdev->sent_cmd, opcode);
+ data = hci_cmd_data(hdev->sent_cmd, opcode, len);
if (!data)
/* Check if opcode matches last request */
- data = hci_cmd_data(hdev->req_skb, opcode);
+ data = hci_cmd_data(hdev->req_skb, opcode, len);
return data;
}
+/* Get data from the previously sent command */
+void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode)
+{
+ return hci_sent_cmd_data_len(hdev, opcode, NULL);
+}
+
/* Get data from last received event */
void *hci_recv_event_data(struct hci_dev *hdev, __u8 event)
{
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4be09dd9d9597..1897663dfbdb2 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4303,6 +4303,7 @@ static void hci_cs_le_create_cis(struct hci_dev *hdev, u8 status)
{
struct hci_cp_le_create_cis *cp;
bool pending = false;
+ size_t len;
int i;
bt_dev_dbg(hdev, "status 0x%2.2x", status);
@@ -4310,10 +4311,14 @@ static void hci_cs_le_create_cis(struct hci_dev *hdev, u8 status)
if (!status)
return;
- cp = hci_sent_cmd_data(hdev, HCI_OP_LE_CREATE_CIS);
+ cp = hci_sent_cmd_data_len(hdev, HCI_OP_LE_CREATE_CIS, &len);
if (!cp)
return;
+ if (len < sizeof(*cp) ||
+ len < struct_size(cp, cis, cp->num_cis))
+ return;
+
hci_dev_lock(hdev);
/* Remove connection if command failed */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 191/990] Bluetooth: validate retained LE Set CIG Parameters command length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (189 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 190/990] Bluetooth: validate retained LE Create CIS command length Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 192/990] Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery Greg Kroah-Hartman
` (661 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yifan Zhang, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
[ Upstream commit ed4d302af778b9e2ead28134a2196c09a4ad248a ]
hci_cc_le_set_cig_params() validates the controller response but not the
parameters of the previously sent command. A short command can claim a
large num_cis without containing the corresponding cis[] array. A
complete successful response then makes the handler read beyond the
command skb while looking up each CIS ID.
KASAN reports:
BUG: KASAN: slab-out-of-bounds in hci_cc_le_set_cig_params
Read of size 1
hci_cc_le_set_cig_params
hci_cmd_complete_evt
hci_event_packet
Obtain the retained parameter length and require both the fixed header and
the complete CIS array before using the command data.
The reproducer no longer triggers a KASAN report with this change.
Fixes: 71e9588435c3 ("Bluetooth: ISO: use correct CIS order in Set CIG Parameters event")
Closes: https://lore.kernel.org/linux-bluetooth/179317463153.87610.8996555110609321376@stu.pku.edu.cn/
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
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 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 1897663dfbdb2..af7f1de7d657d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3853,13 +3853,16 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data,
struct hci_conn *conn;
u8 status = rp->status;
bool pending = false;
+ size_t len;
int i;
bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
- cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_CIG_PARAMS);
+ cp = hci_sent_cmd_data_len(hdev, HCI_OP_LE_SET_CIG_PARAMS, &len);
if (!rp->status &&
- (!cp || rp->num_handles != cp->num_cis ||
+ (!cp || len < sizeof(*cp) ||
+ len < struct_size(cp, cis, cp->num_cis) ||
+ rp->num_handles != cp->num_cis ||
rp->cig_id != cp->cig_id ||
skb->len < array_size(rp->num_handles, sizeof(*rp->handle)))) {
bt_dev_err(hdev, "unexpected Set CIG Parameters response data");
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 192/990] Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (190 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 191/990] Bluetooth: validate retained LE Set CIG Parameters " Greg Kroah-Hartman
@ 2026-11-25 14:25 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 193/990] selftests/mm: merge: keep the far mremap() targets in the carveout Greg Kroah-Hartman
` (660 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:25 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Dewald, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Dewald <kevin@simpleble.org>
[ Upstream commit 60b10121db602a43ada3dbc39792bbf93d25991b ]
Stop Discovery moves the discovery to DISCOVERY_STOPPING, and
stop_discovery_complete() only moves it on to DISCOVERY_STOPPED when
stopping succeeded. When it fails, for example because LE Set Scan
Enable times out, nothing moves the discovery out of
DISCOVERY_STOPPING: Stop Discovery is rejected, as the discovery is not
active anymore, and the LE scan timeout was cancelled before the scan
was disabled. Until the controller is powered off, every Start
Discovery then fails with Busy, and hci_update_passive_scan_sync()
skips background scanning, so devices set to auto-connect are not
connected anymore.
Move the discovery back to DISCOVERY_FINDING when stopping it failed
while its inquiry or active LE scan is still running, so that it can be
stopped again. Only change the state while the discovery is still
stopping, as Inquiry Cancel may already have stopped it, for example
when only the passive scan could not be disabled, and a new Start
Discovery may have followed. Do this under hci_dev_lock(), like the
command completions that change these flags, and before replying, so
that a client acting on the reply sees the new state. Only cancel the
LE scan timeout once the scan is disabled, so that the discovery still
ends on its own, except when suspending, where it is still cancelled
first.
A timed out LE Set Scan Enable can still complete afterwards, which
cancels the timeout as well, so also stop the discovery when its scan
is disabled while the timeout is pending, or while the timeout work
waits for the lock.
Fixes: 0e05bba6f6f8 ("Bluetooth: Update stop_discovery to use HCI request")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Kevin Dewald <kevin@simpleble.org>
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 | 12 +++++++++++-
net/bluetooth/hci_sync.c | 26 +++++++++++++++++++++++---
net/bluetooth/mgmt.c | 23 ++++++++++++++++++++---
3 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index af7f1de7d657d..8b9b27f2d8916 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1770,6 +1770,8 @@ static void store_pending_adv_report(struct hci_dev *hdev, bdaddr_t *bdaddr,
static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
{
+ bool timeout_pending;
+
hci_dev_lock(hdev);
switch (enable) {
@@ -1799,10 +1801,18 @@ static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
/* Cancel this timer so that we don't try to disable scanning
* when it's already disabled.
*/
- cancel_delayed_work(&hdev->le_scan_disable);
+ timeout_pending = cancel_delayed_work(&hdev->le_scan_disable);
hci_dev_clear_flag(hdev, HCI_LE_SCAN);
+ /* The scan of a discovery was disabled before its timeout,
+ * for example by a Stop Discovery that timed out and still
+ * completed, so nothing else would end the discovery.
+ */
+ if (timeout_pending &&
+ hdev->discovery.state == DISCOVERY_FINDING)
+ hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+
if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED &&
hci_test_quirk(hdev, HCI_QUIRK_SIMULTANEOUS_DISCOVERY) &&
!test_bit(HCI_INQUIRY, &hdev->flags) &&
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index e5f29558f1468..ba5add3292e33 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -376,8 +376,18 @@ static void le_scan_disable(struct work_struct *work)
bt_dev_dbg(hdev, "");
hci_dev_lock(hdev);
- if (!hci_dev_test_flag(hdev, HCI_LE_SCAN))
+ if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
+ /* The scan of a discovery can be disabled while this work
+ * waits for the lock, for example by a Stop Discovery that
+ * timed out and still completed, so end the discovery as
+ * le_set_scan_enable_complete() does when it cancels this
+ * work.
+ */
+ if (hdev->discovery.state == DISCOVERY_FINDING)
+ goto discov_stopped;
+
goto _return;
+ }
status = hci_cmd_sync_queue(hdev, scan_disable_sync, NULL, NULL);
if (status) {
@@ -5762,11 +5772,15 @@ int hci_stop_discovery_sync(struct hci_dev *hdev)
}
if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
- cancel_delayed_work(&hdev->le_scan_disable);
-
err = hci_scan_disable_sync(hdev);
if (err)
return err;
+
+ /* Only cancel the LE scan timeout once the scan is
+ * disabled, so that the discovery still ends if
+ * stopping it failed.
+ */
+ cancel_delayed_work(&hdev->le_scan_disable);
}
} else {
@@ -6401,6 +6415,12 @@ static int hci_pause_discovery_sync(struct hci_dev *hdev)
return 0;
hci_discovery_set_state(hdev, DISCOVERY_STOPPING);
+
+ /* Cancel the LE scan timeout first, so that it does not run while
+ * suspended if the scan cannot be disabled.
+ */
+ cancel_delayed_work(&hdev->le_scan_disable);
+
err = hci_stop_discovery_sync(hdev);
if (err)
return err;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 8d18e94fe8c05..b16b70a3cab61 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6242,12 +6242,29 @@ static void stop_discovery_complete(struct hci_dev *hdev, void *data, int err)
bt_dev_dbg(hdev, "err %d", err);
+ hci_dev_lock(hdev);
+
+ /* Change the state before replying, so that a client acting on the
+ * reply sees it, and only while the discovery is still stopping, as
+ * Inquiry Cancel may already have stopped it and a new Start Discovery
+ * may have followed. Go back to DISCOVERY_FINDING when stopping failed
+ * while the inquiry or the active LE scan of the discovery is still
+ * running, so that it can be stopped again.
+ */
+ if (hdev->discovery.state == DISCOVERY_STOPPING) {
+ if (err && (test_bit(HCI_INQUIRY, &hdev->flags) ||
+ (hci_dev_test_flag(hdev, HCI_LE_SCAN) &&
+ hdev->le_scan_type == LE_SCAN_ACTIVE)))
+ hci_discovery_set_state(hdev, DISCOVERY_FINDING);
+ else
+ hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+ }
+
+ hci_dev_unlock(hdev);
+
mgmt_cmd_complete(cmd->sk, cmd->hdev->id, cmd->opcode, mgmt_status(err),
cmd->param, 1);
mgmt_pending_free(cmd);
-
- if (!err)
- hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
}
static int stop_discovery_sync(struct hci_dev *hdev, void *data)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 193/990] selftests/mm: merge: keep the far mremap() targets in the carveout
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (191 preceding siblings ...)
2026-11-25 14:25 ` [PATCH 6.18 192/990] Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 194/990] mctp i3c: Fix locking in an error path Greg Kroah-Hartman
` (659 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Danish Khateeb, Andrew Morton,
Lorenzo Stoakes (ARM), Gregory Price (Meta), Liam R. Howlett,
Vlastimil Babka, Jann Horn, Pedro Falcato, David Hildenbrand,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Shuah Khan,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <danishkhateeb03@gmail.com>
[ Upstream commit 332c1bd17422c1aa59e18513042e56ea5aac4051 ]
The merge tests map their areas at fixed addresses within a 30-page
PROT_NONE carveout. Several mremap() tests move an area 1000 or 2000
pages away to separate it from the others, but those targets are outside
the carveout, and MREMAP_FIXED unmaps whatever is mapped there.
Under virtme-ng, the shared libraries are packed right above the
carveout and the dynamic linker starts about 4 MiB above it. The moves
then replace part of its text with an anonymous mapping, and the test
crashes in its next lazily bound call:
merge[6980]: segfault at 7f7ebb3c1e60 ip 00007f7ebb3c1e60 sp 00007ffd35fbaec8 error 14
Two to four of the mremap() tests then fail with "Test terminated
unexpectedly by signal 11", depending on the exact layout. On a host
where libc is mapped at a 2 MiB aligned address, the targets happen to
land above the dynamic linker and the tests pass.
Since the areas are all within the first 30 pages, moving one by 30
pages is enough to keep it apart from the others. Add FAR_PAGES for
that distance, move areas by FAR_PAGES or 2 * FAR_PAGES pages, and make
the carveout 3 * FAR_PAGES pages so that it covers every target.
Link: https://lore.kernel.org/20261022121837.28723-1-danishkhateeb03@gmail.com
Fixes: 4e25f85b9f85 ("tools/testing/selftests: add mremap() unfaulted/faulted test cases")
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/mm/merge.c | 33 ++++++++++++++++--------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/tools/testing/selftests/mm/merge.c b/tools/testing/selftests/mm/merge.c
index 10b686102b79d..65c30632795ec 100644
--- a/tools/testing/selftests/mm/merge.c
+++ b/tools/testing/selftests/mm/merge.c
@@ -22,9 +22,12 @@ FIXTURE(merge)
struct procmap_fd procmap;
};
+#define FAR_PAGES 30
+#define CARVEOUT_PAGES (3 * FAR_PAGES)
+
static char *map_carveout(unsigned int page_size)
{
- return mmap(NULL, 30 * page_size, PROT_NONE,
+ return mmap(NULL, CARVEOUT_PAGES * page_size, PROT_NONE,
MAP_ANON | MAP_PRIVATE, -1, 0);
}
@@ -60,7 +63,7 @@ FIXTURE_SETUP(merge)
FIXTURE_TEARDOWN(merge)
{
- ASSERT_EQ(munmap(self->carveout, 30 * self->page_size), 0);
+ ASSERT_EQ(munmap(self->carveout, CARVEOUT_PAGES * self->page_size), 0);
/* May fail for parent of forked process. */
close_procmap(&self->procmap);
/*
@@ -102,7 +105,7 @@ FIXTURE_SETUP(merge_with_fork)
FIXTURE_TEARDOWN(merge_with_fork)
{
- ASSERT_EQ(munmap(self->carveout, 30 * self->page_size), 0);
+ ASSERT_EQ(munmap(self->carveout, CARVEOUT_PAGES * self->page_size), 0);
ASSERT_EQ(close_procmap(&self->procmap), 0);
/* See above. */
prctl(PR_SET_MEMORY_MERGE, 0, 0, 0, 0);
@@ -647,7 +650,7 @@ TEST_F(merge, mremap_unfaulted_to_faulted)
/* Offset ptr2 further away. */
ptr2 = sys_mremap(ptr2, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + FAR_PAGES * page_size);
ASSERT_NE(ptr2, MAP_FAILED);
/*
@@ -708,7 +711,7 @@ TEST_F(merge, mremap_unfaulted_behind_faulted)
/* Offset ptr2 further away. */
ptr2 = sys_mremap(ptr2, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + FAR_PAGES * page_size);
ASSERT_NE(ptr2, MAP_FAILED);
/*
@@ -772,12 +775,12 @@ TEST_F(merge, mremap_unfaulted_between_faulted)
/* Offset ptr3 further away. */
ptr3 = sys_mremap(ptr3, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + page_size * 2000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + 2 * FAR_PAGES * page_size);
ASSERT_NE(ptr3, MAP_FAILED);
/* Offset ptr2 further away. */
ptr2 = sys_mremap(ptr2, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + FAR_PAGES * page_size);
ASSERT_NE(ptr2, MAP_FAILED);
/*
@@ -857,13 +860,13 @@ TEST_F(merge, mremap_unfaulted_between_faulted_unfaulted)
/* Offset ptr3 further away. */
ptr3 = sys_mremap(ptr3, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + page_size * 2000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + 2 * FAR_PAGES * page_size);
ASSERT_NE(ptr3, MAP_FAILED);
/* Offset ptr2 further away. */
ptr2 = sys_mremap(ptr2, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + FAR_PAGES * page_size);
ASSERT_NE(ptr2, MAP_FAILED);
/*
@@ -1022,11 +1025,11 @@ TEST_F(merge, mremap_correct_placed_faulted)
*/
ptr3 = &ptr[10 * page_size];
ptr3 = sys_mremap(ptr3, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + page_size * 2000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + 2 * FAR_PAGES * page_size);
ASSERT_NE(ptr3, MAP_FAILED);
ptr2 = &ptr[5 * page_size];
ptr2 = sys_mremap(ptr2, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + FAR_PAGES * page_size);
ASSERT_NE(ptr2, MAP_FAILED);
/*
@@ -1062,7 +1065,7 @@ TEST_F(merge, mremap_correct_placed_faulted)
* ptr2 \ ptr \ ptr3
*/
ptr = sys_mremap(ptr, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr + FAR_PAGES * page_size);
ASSERT_NE(ptr, MAP_FAILED);
/*
@@ -1097,7 +1100,7 @@ TEST_F(merge, mremap_correct_placed_faulted)
* ptr2 \ ptr \ ptr3
*/
ptr = sys_mremap(ptr, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr + FAR_PAGES * page_size);
ASSERT_NE(ptr, MAP_FAILED);
/*
@@ -1155,7 +1158,7 @@ TEST_F(merge, mremap_correct_placed_faulted)
* ptr ptr3 \ ptr2
*/
ptr2 = sys_mremap(ptr2, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr2 + FAR_PAGES * page_size);
ASSERT_NE(ptr2, MAP_FAILED);
/*
@@ -1190,7 +1193,7 @@ TEST_F(merge, mremap_correct_placed_faulted)
* ptr \ ptr3
*/
ptr3 = sys_mremap(ptr3, 5 * page_size, 5 * page_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + page_size * 1000);
+ MREMAP_MAYMOVE | MREMAP_FIXED, ptr3 + FAR_PAGES * page_size);
ASSERT_NE(ptr3, MAP_FAILED);
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 194/990] mctp i3c: Fix locking in an error path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (192 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 193/990] selftests/mm: merge: keep the far mremap() targets in the carveout Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 195/990] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server Greg Kroah-Hartman
` (658 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leo Yang, Paolo Abeni, Jeremy Kerr,
Matt Johnston, netdev, Bart Van Assche, 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 750eb5ab457e62e221a9c8521e2274f14c85b387 ]
If netdev_alloc_skb() fails, mctp_i3c_read() jumps to a label that
unlocks mi->lock although that mutex has not been locked yet. Fix this
by returning -ENOMEM directly. This bug has been detected by the Clang
thread-safety analyzer.
Cc: Leo Yang <Leo-Yang@quantatw.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: netdev@vger.kernel.org
Fixes: 2d2d4f60ed26 ("mctp i3c: fix MCTP I3C driver multi-thread issue")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Matt Johnston <matt@codeconstruct.com.au>
Link: https://patch.msgid.link/71e0a880ffe7a83237e501b07884bf54343e76ca.1793296780.git.bvanassche@acm.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/mctp/mctp-i3c.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
index 1d9d0c1418ebd..22376ea460f12 100644
--- a/drivers/net/mctp/mctp-i3c.c
+++ b/drivers/net/mctp/mctp-i3c.c
@@ -111,8 +111,7 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)
mi->mrl + sizeof(struct mctp_i3c_internal_hdr));
if (!skb) {
stats->rx_dropped++;
- rc = -ENOMEM;
- goto err;
+ return -ENOMEM;
}
skb->protocol = htons(ETH_P_MCTP);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 195/990] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (193 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 194/990] mctp i3c: Fix locking in an error path Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 196/990] ksmbd: require NUL-terminated EA names Greg Kroah-Hartman
` (657 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aaditya Kansal, Namjae Jeon,
Steve French, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaditya Kansal <aadityakansal390@gmail.com>
[ Upstream commit e4442b2e95baf0901830c924d0a197b100aca970 ]
Add STATUS_INFO_LENGTH_MISMATCH mapping to EMSGSIZE.
Currently, STATUS_INFO_LENGTH_MISMATCH has no mapping to any error code,
making it difficult to distinguish between invalid parameters and length
mismatch.
Map STATUS_INFO_LENGTH_MISMATCH to EMSGSIZE while keeping the EINVAL for
invalid parameters. Although the buf_len check only checks for buf_size
being less than required, there was no error code for lower buf_size.
Hence, EMSGSIZE is used.
Signed-off-by: Aaditya Kansal <aadityakansal390@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: e49296d51ccb ("ksmbd: require NUL-terminated EA names")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 94a18e0ee9c20..56dc2134d8bac 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -6769,7 +6769,6 @@ static int set_file_mode_info(struct ksmbd_file *fp,
* @share: ksmbd_share_config pointer
*
* Return: 0 on success, otherwise error
- * TODO: need to implement an error handling for STATUS_INFO_LENGTH_MISMATCH
*/
static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
struct smb2_set_info_req *req,
@@ -6782,14 +6781,14 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_BASIC_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_basic_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_basic_info(fp, (struct smb2_file_basic_info *)buffer, share);
}
case FILE_ALLOCATION_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_alloc_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_allocation_info(work, fp,
(struct smb2_file_alloc_info *)buffer);
@@ -6797,7 +6796,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_END_OF_FILE_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_eof_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_end_of_file_info(work, fp,
(struct smb2_file_eof_info *)buffer);
@@ -6805,7 +6804,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_RENAME_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_rename_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_rename_info(work, fp,
(struct smb2_file_rename_info *)buffer,
@@ -6816,7 +6815,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
struct smb2_file_link_info *file_info;
if (buf_len < sizeof(struct smb2_file_link_info))
- return -EINVAL;
+ return -EMSGSIZE;
file_info = (struct smb2_file_link_info *)buffer;
if (file_info->ReplaceIfExists && !(fp->daccess & FILE_DELETE_LE)) {
@@ -6831,7 +6830,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_DISPOSITION_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_disposition_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_disposition_info(work, fp,
(struct smb2_file_disposition_info *)buffer);
@@ -6845,7 +6844,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
}
if (buf_len < sizeof(struct smb2_ea_info))
- return -EINVAL;
+ return -EMSGSIZE;
return smb2_set_ea((struct smb2_ea_info *)buffer,
buf_len, &fp->filp->f_path, true);
@@ -6853,14 +6852,14 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
case FILE_POSITION_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_pos_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_position_info(fp, (struct smb2_file_pos_info *)buffer);
}
case FILE_MODE_INFORMATION:
{
if (buf_len < sizeof(struct smb2_file_mode_info))
- return -EINVAL;
+ return -EMSGSIZE;
return set_file_mode_info(fp, (struct smb2_file_mode_info *)buffer);
}
@@ -6968,6 +6967,8 @@ int smb2_set_info(struct ksmbd_work *work)
rsp->hdr.Status = STATUS_ACCESS_DENIED;
else if (rc == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ else if (rc == -EMSGSIZE)
+ rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
else if (rc == -ESHARE)
rsp->hdr.Status = STATUS_SHARING_VIOLATION;
else if (rc == -ENOENT)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 196/990] ksmbd: require NUL-terminated EA names
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (194 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 195/990] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 197/990] soreuseport: annotate data-races around reuse->socks[] and num_socks Greg Kroah-Hartman
` (656 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Yifan Zhang,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
[ Upstream commit e49296d51ccbf2ad0ed0484db1382f1d7217bd6e ]
smb2_set_ea() verifies that the byte reserved for the declared EA-name
terminator lies inside the request, but it does not verify that the byte is
zero. With SMB debug logging enabled, the name is passed to %s and the
diagnostic reads beyond the request allocation.
KASAN reports:
BUG: KASAN: slab-out-of-bounds in string
Read of size 1
string
vsnprintf
_printk
smb2_set_ea
smb2_set_info
Reject an EA entry whose declared terminator byte is nonzero. Return
-EBADMSG for the malformed buffer, and map that error to
STATUS_EA_LIST_INCONSISTENT for both SET_INFO and CREATE.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Suggested-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 56dc2134d8bac..53094243d456b 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -2453,6 +2453,11 @@ static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
if (!eabuf->EaNameLength)
goto next;
+ if (eabuf->name[eabuf->EaNameLength]) {
+ rc = -EBADMSG;
+ break;
+ }
+
ksmbd_debug(SMB,
"name : <%s>, name_len : %u, value_len : %u, next : %u\n",
eabuf->name, eabuf->EaNameLength,
@@ -3935,6 +3940,8 @@ int smb2_open(struct ksmbd_work *work)
if (rc) {
if (rc == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ else if (rc == -EBADMSG)
+ rsp->hdr.Status = STATUS_EA_LIST_INCONSISTENT;
else if (rc == -EOPNOTSUPP)
rsp->hdr.Status = STATUS_NOT_SUPPORTED;
else if (rc == -EACCES || rc == -ESTALE || rc == -EXDEV) {
@@ -6967,6 +6974,8 @@ int smb2_set_info(struct ksmbd_work *work)
rsp->hdr.Status = STATUS_ACCESS_DENIED;
else if (rc == -EINVAL)
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+ else if (rc == -EBADMSG)
+ rsp->hdr.Status = STATUS_EA_LIST_INCONSISTENT;
else if (rc == -EMSGSIZE)
rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
else if (rc == -ESHARE)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 197/990] soreuseport: annotate data-races around reuse->socks[] and num_socks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (195 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 196/990] ksmbd: require NUL-terminated EA names Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 198/990] vhost-scsi: do not count PI bytes in the data length Greg Kroah-Hartman
` (655 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Eric Dumazet,
Jiayuan Chen, 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 213d491308b99d026514c93980cf8dd572226b1b ]
reuseport_select_sock() and reuseport_migrate_sock() read
reuse->num_socks and reuse->socks[] locklessly under RCU, while
writers holding reuseport_lock can change them.
Readers snapshot num_socks once, then index socks[] with it.
Meanwhile, writers can perform several operations, storing into
slots below the reader's stale count:
- __reuseport_detach_sock() moves the last socket into slot i.
- __reuseport_add_sock() then writes the new socket at the
(now smaller) num_socks index.
- reuseport_stop_listen_sock() calls __reuseport_detach_sock()
then __reuseport_add_closed_sock(), which writes slot
max_socks - num_closed_socks - 1. This can be the slot a reader
still considers part of the listener region when the array is full.
- __reuseport_detach_closed_sock() can then rewrite that slot.
All pointers stored in socks[] remain valid for the RCU grace period,
but without annotations the compiler is allowed to tear or reload
these accesses. For instance, reuseport_select_sock_by_hash() could
reload reuse->socks[i] between the sk_state/sk_incoming_cpu checks
and the return, returning a socket that did not pass them.
Use WRITE_ONCE() for all socks[] stores done while the array is
visible to readers, and for num_socks updates (readers already use
READ_ONCE()). Use READ_ONCE() in the two lockless readers.
Fixes: ef456144da8e ("soreuseport: define reuseport groups")
Link: https://lore.kernel.org/netdev/20260902071900.395567-1-ruanjinjie@huawei.com/
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261030120956.3026324-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock_reuseport.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
index 4211710393a8a..d4b7caf86eee3 100644
--- a/net/core/sock_reuseport.c
+++ b/net/core/sock_reuseport.c
@@ -124,10 +124,10 @@ static int reuseport_sock_index(struct sock *sk,
static void __reuseport_add_sock(struct sock *sk,
struct sock_reuseport *reuse)
{
- reuse->socks[reuse->num_socks] = sk;
+ WRITE_ONCE(reuse->socks[reuse->num_socks], sk);
/* paired with smp_rmb() in reuseport_(select|migrate)_sock() */
smp_wmb();
- reuse->num_socks++;
+ WRITE_ONCE(reuse->num_socks, reuse->num_socks + 1);
reuseport_get_incoming_cpu(sk, reuse);
}
@@ -139,8 +139,8 @@ static bool __reuseport_detach_sock(struct sock *sk,
if (i == -1)
return false;
- reuse->socks[i] = reuse->socks[reuse->num_socks - 1];
- reuse->num_socks--;
+ WRITE_ONCE(reuse->socks[i], reuse->socks[reuse->num_socks - 1]);
+ WRITE_ONCE(reuse->num_socks, reuse->num_socks - 1);
reuseport_put_incoming_cpu(sk, reuse);
return true;
@@ -149,7 +149,7 @@ static bool __reuseport_detach_sock(struct sock *sk,
static void __reuseport_add_closed_sock(struct sock *sk,
struct sock_reuseport *reuse)
{
- reuse->socks[reuse->max_socks - reuse->num_closed_socks - 1] = sk;
+ WRITE_ONCE(reuse->socks[reuse->max_socks - reuse->num_closed_socks - 1], sk);
/* paired with READ_ONCE() in inet_csk_bind_conflict() */
WRITE_ONCE(reuse->num_closed_socks, reuse->num_closed_socks + 1);
reuseport_get_incoming_cpu(sk, reuse);
@@ -163,7 +163,8 @@ static bool __reuseport_detach_closed_sock(struct sock *sk,
if (i == -1)
return false;
- reuse->socks[i] = reuse->socks[reuse->max_socks - reuse->num_closed_socks];
+ WRITE_ONCE(reuse->socks[i],
+ reuse->socks[reuse->max_socks - reuse->num_closed_socks]);
/* paired with READ_ONCE() in inet_csk_bind_conflict() */
WRITE_ONCE(reuse->num_closed_socks, reuse->num_closed_socks - 1);
reuseport_put_incoming_cpu(sk, reuse);
@@ -521,7 +522,7 @@ static struct sock *run_bpf_filter(struct sock_reuseport *reuse, u16 socks,
if (index >= socks)
return NULL;
- return reuse->socks[index];
+ return READ_ONCE(reuse->socks[index]);
}
static struct sock *reuseport_select_sock_by_hash(struct sock_reuseport *reuse,
@@ -532,7 +533,7 @@ static struct sock *reuseport_select_sock_by_hash(struct sock_reuseport *reuse,
i = j = reciprocal_scale(hash, num_socks);
do {
- struct sock *sk = reuse->socks[i];
+ struct sock *sk = READ_ONCE(reuse->socks[i]);
if (sk->sk_state != TCP_ESTABLISHED) {
/* Paired with WRITE_ONCE() in __reuseport_(get|put)_incoming_cpu(). */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 198/990] vhost-scsi: do not count PI bytes in the data length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (196 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 197/990] soreuseport: annotate data-races around reuse->socks[] and num_socks Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 199/990] xfrm: iptfs: fix skb leak on error in __input_process_payload() Greg Kroah-Hartman
` (654 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit 1f5bc40e33d8b3e5e3b89047956099b0c19f1d3d ]
vhost_scsi_handle_vq() moves pi_bytesout or pi_bytesin into the
protection sgl and subtracts those bytes from exp_data_len. The length
passed to TCM is still exp_data_len + prot_bytes.
prot_bytes comes from virtio_scsi_cmd_req_pi. With
VIRTIO_SCSI_F_T10_PI negotiated, vhost reads that header and does not
check that the CDB is a READ or WRITE. sbc_check_prot() replaces
data_length from the CDB only when the protect field is non-zero.
target_cmd_size_check() leaves a write's data_length unchanged when the
CDB size is smaller, so a command that does not get that replacement
keeps a data_length larger than the data sgl.
The KASAN report is a MODE SELECT whose header had pi_bytesout set.
The data sgl held only the parameter list. spc_emulate_modeselect()
walked data_length and read the next physical page.
Pass the data sgl length. Protected READ and WRITE still take their
length from the CDB in sbc_check_prot().
KASAN reports:
BUG: KASAN: use-after-free in spc_emulate_modeselect+0x145/0x380 [target_core_mod]
Read of size 1
spc_emulate_modeselect
__target_execute_cmd
target_execute_cmd
vhost_scsi_write_pending
transport_generic_new_cmd
__target_submit
target_queued_submit_work
process_one_work
worker_thread
kthread
ret_from_fork
ret_from_fork_asm
Fixes: 9f977ef7b671 ("vhost-scsi: Include prot_bytes into expected data transfer length")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261012103954.136698-1-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index d39dc7d215c09..4c2964dcb78c8 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1516,9 +1516,17 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
* vhost_scsi_queue_data_in() and vhost_scsi_queue_status()
*/
cmd->tvc_vq_desc = vc.head;
+ /*
+ * vhost_scsi_mapal() maps the PI bytes into cmd->prot_table.
+ * It maps the remaining exp_data_len bytes into cmd->table,
+ * which is the data SGL passed to the target core. Its
+ * expected length must therefore exclude prot_bytes.
+ *
+ * sbc_check_prot() derives the data length for protected READ
+ * and WRITE commands from the CDB.
+ */
vhost_scsi_target_queue_cmd(nexus, cmd, cdb, lun, task_attr,
- data_direction,
- exp_data_len + prot_bytes);
+ data_direction, exp_data_len);
ret = 0;
err:
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 199/990] xfrm: iptfs: fix skb leak on error in __input_process_payload()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (197 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 198/990] vhost-scsi: do not count PI bytes in the data length Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 200/990] power: sequencing: qcom-wcn: increase WCN7850 power-up delay Greg Kroah-Hartman
` (653 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+a3f21220cbbb6e14ee2e,
Eric Dumazet, Steffen Klassert, 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 64e45ed926cdd017c9816c8006d9117a7194c7e9 ]
syzbot reported a memory leak of the received skb (and its sec_path
extension) in the IP-TFS receive path.
__input_process_payload() parses the inner packets of an IP-TFS payload
and queues them on @sublist, which is only sent after the parsing loop.
Three error paths inside the loop (skb_copy_seq_read() failure, invalid
inner IPv4 header length, unknown IP version) jump to the "done" label,
which is placed after the code sending @sublist.
Any skb already queued on @sublist is then neither delivered nor freed.
This includes skbs added by iptfs_reassem_cont() before the call, newly
allocated inner packets, and, since the received skb can be reused for
the first inner packet, the received skb itself.
Move the "done" label before the trim/send code, so that inner packets
parsed before the error are delivered as on the normal exit path. The
received skb is then still freed (or consumed) as before when it was
not reused.
Fixes: 6c82d2433671 ("xfrm: iptfs: add basic receive packet (tunnel egress) handling")
Reported-by: syzbot+a3f21220cbbb6e14ee2e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6ae4102e.9c6421ad.36baac.0005.GAE@google.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Link: https://patch.msgid.link/20261030083358.2653599-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xfrm/xfrm_iptfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
index 4d3489acb099a..9a539618cb8fd 100644
--- a/net/xfrm/xfrm_iptfs.c
+++ b/net/xfrm/xfrm_iptfs.c
@@ -1183,6 +1183,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,
/* this should not happen from the above code */
XFRM_INC_STATS(net, LINUX_MIB_XFRMINIPTFSERROR);
+done:
if (first_skb && first_iplen && !defer && !first_skb_partial) {
/* first_skb is queued b/c !defer and not partial */
if (pskb_trim(first_skb, first_iplen)) {
@@ -1199,7 +1200,7 @@ static bool __input_process_payload(struct xfrm_state *x, u32 data,
if (xfrm_input(skb, 0, 0, -2))
kfree_skb(skb);
}
-done:
+
skb = skbseq->root_skb;
skb_abort_seq_read(skbseq);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 200/990] power: sequencing: qcom-wcn: increase WCN7850 power-up delay
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (198 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 199/990] xfrm: iptfs: fix skb leak on error in __input_process_payload() Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 201/990] vhost-scsi: validate event queue descriptor direction Greg Kroah-Hartman
` (652 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cheng Jiang, Shuai Zhang,
Dmitry Baryshkov, Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
[ Upstream commit bd60a639b621453fe37b780df4b6d3a13f981f13 ]
When the WCN7850 is powered up from the Bluetooth side first, i.e.
BT_EN is asserted while WLAN_EN is still low, the chip starts from a
cold state and is not ready to accept the first HCI command 50 ms after
BT_EN goes high. The first command (0xfc00, read QCA version) is lost,
hci_qca does not resend it and fails after the 2 s command timeout:
Bluetooth: hci0: Reading QCA version information failed (-110)
When WLAN is powered first, 50 ms is sufficient, so the failure only
shows up in the BT-first ordering. Measured on the affected board by
which enable pin rose first:
pwup_delay_ms BT-first boots with -110
50 9 9
75 23 0
100 21 0
300 20 0
Raise the power-up delay of WCN7850 to 100 ms. The delay is shared by
the Bluetooth and WLAN targets, so WLAN power-up also waits 50 ms
longer.
Fixes: 2f1630f437df ("power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets")
Signed-off-by: Cheng Jiang <cheng.jiang@oss.qualcomm.com>
Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20261102094800.3225454-1-shuai.zhang@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/power/sequencing/pwrseq-qcom-wcn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/sequencing/pwrseq-qcom-wcn.c b/drivers/power/sequencing/pwrseq-qcom-wcn.c
index 663d9a5370653..4720cf0ffb664 100644
--- a/drivers/power/sequencing/pwrseq-qcom-wcn.c
+++ b/drivers/power/sequencing/pwrseq-qcom-wcn.c
@@ -324,7 +324,7 @@ static const char *const pwrseq_wcn7850_vregs[] = {
static const struct pwrseq_qcom_wcn_pdata pwrseq_wcn7850_of_data = {
.vregs = pwrseq_wcn7850_vregs,
.num_vregs = ARRAY_SIZE(pwrseq_wcn7850_vregs),
- .pwup_delay_ms = 50,
+ .pwup_delay_ms = 100,
.targets = pwrseq_qcom_wcn_targets,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 201/990] vhost-scsi: validate event queue descriptor direction
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (199 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 200/990] power: sequencing: qcom-wcn: increase WCN7850 power-up delay Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 202/990] virtio_ring: code cleanup in detach_buf_split Greg Kroah-Hartman
` (651 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jia Jia, Linfeng Sun,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit 3d8c5b714c186d08c8fe8c8cfd1f9b89525ab067 ]
vhost_get_vq_desc() returns the number of device readable (output) and
device writable (input) iovec segments. A guest can submit an eventq
descriptor chain that fills vq->iov with output segments, setting out
to ARRAY_SIZE(vq->iov) and in to zero.
When the host later queues a vhost-scsi event, vhost_scsi_do_evt_work()
uses out as the index of the first input segment. This accesses one element
beyond vq->iov and triggers an array-index-out-of-bounds report. With
panic_on_warn enabled, the report panics the host.
The event queue accepts device writable buffers only. Reject chains that
contain output segments or lack an input segment before using out as an
index. The input check prevents the out-of-bounds access, while the output
check validates the eventq descriptor direction.
I found the descriptor direction issue myself, though the patch was
written with AI assistance. The out-of-bounds read with an
output-only chain was separately reported by Jia Jia.
Fixes: a6c9af87363c ("tcm_vhost: Add hotplug/hotunplug support")
Reported-by: Jia Jia <physicalmtea@gmail.com>
Assisted-by: OpenAI-Codex:GPT-5
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20261009-fix-arrary-index-out-of-bounds-in-vhost_scsi_complete_events-v2-1-1f7689a54735@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 4c2964dcb78c8..ba5e454ef2667 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -607,6 +607,16 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
return;
}
+ /*
+ * Eventq buffers are device-writable only. A nonzero in count
+ * guarantees that out is within the bounds of vq->iov.
+ */
+ if (unlikely(out || !in)) {
+ vq_err(vq, "Invalid event buffer: out %u, in %u\n", out, in);
+ vs->vs_events_missed = true;
+ return;
+ }
+
if ((vq->iov[out].iov_len != sizeof(struct virtio_scsi_event))) {
vq_err(vq, "Expecting virtio_scsi_event, got %zu bytes\n",
vq->iov[out].iov_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 202/990] virtio_ring: code cleanup in detach_buf_split
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (200 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 201/990] vhost-scsi: validate event queue descriptor direction Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 203/990] virtio_ring: factor out split indirect detaching logic Greg Kroah-Hartman
` (650 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, zhangdongchuan, Jason Wang,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhangdongchuan@eswincomputing.com <zhangdongchuan@eswincomputing.com>
[ Upstream commit 4b7bf8d5503287ed3bd661207b9d061999ac494e ]
Since the return value of vring_unmap_one_split() is exactly
vq->split.desc_extra[i].next, 'i = vq->split.desc_extra[i].next' is
redundant. Assign vring_unmap_one_split() to i instead.
Since vq->split.desc_extra is assigned to extra, use extra[i].next
instead of vq->split.desc_extra[i].next to improve readability.
No change in functionality.
Signed-off-by: zhangdongchuan <zhangdongchuan@eswincomputing.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <202511261140162936986@eswincomputing.com>
Stable-dep-of: e498eb93f961 ("virtio_ring: use shadow flags when detaching split descriptors")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/virtio/virtio_ring.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 5c0139f3b9811..c51a6fc187f26 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -764,13 +764,12 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
i = head;
while (vq->split.vring.desc[i].flags & nextflag) {
- vring_unmap_one_split(vq, &extra[i]);
- i = vq->split.desc_extra[i].next;
+ i = vring_unmap_one_split(vq, &extra[i]);
vq->vq.num_free++;
}
vring_unmap_one_split(vq, &extra[i]);
- vq->split.desc_extra[i].next = vq->free_head;
+ extra[i].next = vq->free_head;
vq->free_head = head;
/* Plus final descriptor */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 203/990] virtio_ring: factor out split indirect detaching logic
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (201 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 202/990] virtio_ring: code cleanup in detach_buf_split Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 204/990] virtio_ring: use shadow flags when detaching split descriptors Greg Kroah-Hartman
` (649 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eugenio Pérez, Xuan Zhuo,
Jason Wang, Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <jasowang@redhat.com>
[ Upstream commit 9dc6b944f16c0904331903ba0ec36e558e1a3537 ]
Factor out the split indirect descriptor detaching logic in order to
allow it to be reused by the in order support.
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20251230064649.55597-18-jasowang@redhat.com>
Stable-dep-of: e498eb93f961 ("virtio_ring: use shadow flags when detaching split descriptors")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/virtio/virtio_ring.c | 62 ++++++++++++++++++++----------------
1 file changed, 34 insertions(+), 28 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index c51a6fc187f26..09b9b6a17f5f0 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -748,11 +748,41 @@ static bool virtqueue_kick_prepare_split(struct virtqueue *_vq)
return needs_kick;
}
+static void detach_indirect_split(struct vring_virtqueue *vq,
+ unsigned int head)
+{
+ struct vring_desc_extra *extra = vq->split.desc_extra;
+ struct vring_desc *indir_desc = vq->split.desc_state[head].indir_desc;
+ unsigned int j;
+ u32 len, num;
+
+ /* Free the indirect table, if any, now that it's unmapped. */
+ if (!indir_desc)
+ return;
+ len = vq->split.desc_extra[head].len;
+
+ BUG_ON(!(vq->split.desc_extra[head].flags &
+ VRING_DESC_F_INDIRECT));
+ BUG_ON(len == 0 || len % sizeof(struct vring_desc));
+
+ num = len / sizeof(struct vring_desc);
+
+ extra = (struct vring_desc_extra *)&indir_desc[num];
+
+ if (vq->use_map_api) {
+ for (j = 0; j < num; j++)
+ vring_unmap_one_split(vq, &extra[j]);
+ }
+
+ kfree(indir_desc);
+ vq->split.desc_state[head].indir_desc = NULL;
+}
+
static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
void **ctx)
{
struct vring_desc_extra *extra;
- unsigned int i, j;
+ unsigned int i;
__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
/* Clear data ptr. */
@@ -775,34 +805,10 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
/* Plus final descriptor */
vq->vq.num_free++;
- if (vq->indirect) {
- struct vring_desc *indir_desc =
- vq->split.desc_state[head].indir_desc;
- u32 len, num;
-
- /* Free the indirect table, if any, now that it's unmapped. */
- if (!indir_desc)
- return;
- len = vq->split.desc_extra[head].len;
-
- BUG_ON(!(vq->split.desc_extra[head].flags &
- VRING_DESC_F_INDIRECT));
- BUG_ON(len == 0 || len % sizeof(struct vring_desc));
-
- num = len / sizeof(struct vring_desc);
-
- extra = (struct vring_desc_extra *)&indir_desc[num];
-
- if (vq->use_map_api) {
- for (j = 0; j < num; j++)
- vring_unmap_one_split(vq, &extra[j]);
- }
-
- kfree(indir_desc);
- vq->split.desc_state[head].indir_desc = NULL;
- } else if (ctx) {
+ if (vq->indirect)
+ detach_indirect_split(vq, head);
+ else if (ctx)
*ctx = vq->split.desc_state[head].indir_desc;
- }
}
static bool more_used_split(const struct vring_virtqueue *vq)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 204/990] virtio_ring: use shadow flags when detaching split descriptors
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (202 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 203/990] virtio_ring: factor out split indirect detaching logic Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 205/990] vhost-scsi: reject delayed virtqueue setup Greg Kroah-Hartman
` (648 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michael S. Tsirkin, sungbyeongchan,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: sungbyeongchan <tjdqudcks0424@naver.com>
[ Upstream commit e498eb93f961db1a1dfdabd373500f0d4019c9a4 ]
Split virtqueues save descriptor flags and next indexes in desc_extra
before publishing descriptors to the device. The detach path uses the
shadow next index, but decides whether to continue by rereading the NEXT
flag from the shared descriptor.
Use the shadow flags for the continuation decision as well. This keeps
all detach metadata in the same driver-owned snapshot and avoids an
unnecessary shared-ring read.
Fixes: 72b5e8958738 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Assisted-by: LLM
Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261008050423.32221-1-tjdqudcks0424@naver.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/virtio/virtio_ring.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 09b9b6a17f5f0..089a3dc2e626f 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -783,7 +783,6 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
{
struct vring_desc_extra *extra;
unsigned int i;
- __virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
/* Clear data ptr. */
vq->split.desc_state[head].data = NULL;
@@ -793,7 +792,7 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
/* Put back on free list: unmap first-level descriptors and find end */
i = head;
- while (vq->split.vring.desc[i].flags & nextflag) {
+ while (extra[i].flags & VRING_DESC_F_NEXT) {
i = vring_unmap_one_split(vq, &extra[i]);
vq->vq.num_free++;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 205/990] vhost-scsi: reject delayed virtqueue setup
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (203 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 204/990] virtio_ring: use shadow flags when detaching split descriptors Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 206/990] vhost: reject backend enable without a kick file Greg Kroah-Hartman
` (647 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit a543346b96a174fcee6812ac2764acc8dc993358 ]
vhost_scsi_set_endpoint() allocates command pools only for I/O
virtqueues that are already set up, but publishes the backend for every
virtqueue. Userspace can complete a skipped queue after attaching the
endpoint, then kick it with scsi_tags uninitialized and trigger the
alloc_hint warning in sbitmap_get().
Delayed virtqueue setup is not supported. Leave skipped I/O virtqueues
inactive and reject changes to the vring size or addresses while an
endpoint is attached. Userspace must clear the endpoint before changing
the vring configuration.
I found this bug myself, though the patch was written with AI assistance.
Fixes: 25b98b64e284 ("vhost scsi: alloc cmds per vq instead of session")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261010-fix-warning-in-sbitmap_get-v3-1-33de562d1359@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index ba5e454ef2667..cec46ed853572 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -2109,6 +2109,9 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
for (i = 0; i < vs->dev.nvqs; i++) {
vq = &vs->vqs[i].vq;
+ if (i >= VHOST_SCSI_VQ_IO && !vs->vqs[i].scsi_cmds)
+ continue;
+
mutex_lock(&vq->mutex);
vhost_vq_set_backend(vq, vs_tpg);
vhost_vq_init_access(vq);
@@ -2478,10 +2481,16 @@ vhost_scsi_ioctl(struct file *f,
default:
mutex_lock(&vs->dev.mutex);
r = vhost_dev_ioctl(&vs->dev, ioctl, argp);
- if (r == -ENOIOCTLCMD)
- r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
- else
+ if (r == -ENOIOCTLCMD) {
+ if (vs->vs_tpg &&
+ (ioctl == VHOST_SET_VRING_NUM ||
+ ioctl == VHOST_SET_VRING_ADDR))
+ r = -EBUSY;
+ else
+ r = vhost_vring_ioctl(&vs->dev, ioctl, argp);
+ } else {
vhost_scsi_flush(vs);
+ }
mutex_unlock(&vs->dev.mutex);
return r;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 206/990] vhost: reject backend enable without a kick file
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (204 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 205/990] vhost-scsi: reject delayed virtqueue setup Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 207/990] vhost-vdpa: initialize state before publishing cdev Greg Kroah-Hartman
` (646 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit 509f6bd229e94fc39506e01be692c4aa22338b49 ]
Enabling a backend without VHOST_SET_VRING_KICK dereferences a NULL
vq->kick in vhost_poll_start(). Reject the request with -EINVAL.
Fixes: 264ee5aa81ec ("tools/virtio: Add --reset")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261011-fix-null-pointer-in-vhost_test_set_backend-v1-1-60b2f12d64c6@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index 42c955a5b2111..997f869284377 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -281,6 +281,10 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd)
r = -EFAULT;
goto err_vq;
}
+ if (enable && !vq->kick) {
+ r = -EINVAL;
+ goto err_vq;
+ }
if (!enable) {
vhost_poll_stop(&vq->poll);
backend = vhost_vq_get_backend(vq);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 207/990] vhost-vdpa: initialize state before publishing cdev
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (205 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 206/990] vhost: reject backend enable without a kick file Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 208/990] virtio_balloon: initialize wakeup_lock before virtqueues are set up Greg Kroah-Hartman
` (645 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linfeng Sun, Michael S. Tsirkin,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linfeng Sun <linfeng.sun.dev@gmail.com>
[ Upstream commit 4b03d1e7f13613af708441a061556de99891a516 ]
Initialize the completion and as hash buckets before cdev_device_add()
makes the device accessible.
Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261011-fix-null-pointer-in-vhost_vdpa_release-v2-1-66ba929971ce@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/vdpa.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 665739ba03f8e..9014ee30861ff 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1705,7 +1705,7 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa)
return minor;
}
- atomic_set(&v->opened, 0);
+ atomic_set(&v->opened, 1);
spin_lock_init(&v->config_lock);
v->minor = minor;
v->vdpa = vdpa;
@@ -1729,16 +1729,17 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa)
cdev_init(&v->cdev, &vhost_vdpa_fops);
v->cdev.owner = THIS_MODULE;
+ init_completion(&v->completion);
+ for (i = 0; i < VHOST_VDPA_IOTLB_BUCKETS; i++)
+ INIT_HLIST_HEAD(&v->as[i]);
r = cdev_device_add(&v->cdev, &v->dev);
if (r)
goto err;
- init_completion(&v->completion);
vdpa_set_drvdata(vdpa, v);
- for (i = 0; i < VHOST_VDPA_IOTLB_BUCKETS; i++)
- INIT_HLIST_HEAD(&v->as[i]);
+ atomic_set_release(&v->opened, 0);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 208/990] virtio_balloon: initialize wakeup_lock before virtqueues are set up
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (206 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 207/990] vhost-vdpa: initialize state before publishing cdev Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 209/990] vhost-scsi: fix page reference leak in misaligned I/O fallback Greg Kroah-Hartman
` (644 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+13df72e0dc4be5c62215,
Mingbing Zhai, Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingbing Zhai <zhaimingbing@cmss.chinamobile.com>
[ Upstream commit 161aa708b02cc997a51701c342f3cebade0b5164 ]
Since c578123e63da ("virtio_balloon: Treat stats requests as wakeup
events") the stats_request() virtqueue callback takes vb->wakeup_lock
via start_wakeup_event(). init_vqs() registers that callback and even
primes and kicks the stats queue, so the lock is reachable from irq
context as soon as init_vqs() returns, long before the driver sets
DRIVER_OK: vring_interrupt() dispatches to the callback without any
DRIVER_OK check unless CONFIG_VIRTIO_HARDEN_NOTIFICATION is set, and
that option depends on BROKEN. syzbot hit it from a threaded irq:
INFO: trying to register non-static key in stats_request
...
assign_lock_key
register_lock_class
lock_acquire
rt_spin_lock
start_wakeup_event drivers/virtio/virtio_balloon.c:150 [inline]
stats_request drivers/virtio/virtio_balloon.c:435
The lock is only initialized near the end of virtballoon_probe(),
after init_vqs() and several steps that can still fail and unwind
through del_vqs(), where a racing interrupt still finds the callback
registered. Until then it is whatever kzalloc() left in vb: lockdep
complains about the unregistered lock class, and wakeup_signal_mask
and processing_wakeup_event get updated from irq context while probe
is still running.
The rt_spin_lock() in the report is just spin_lock() on PREEMPT_RT;
any PROVE_LOCKING build takes the same path.
stop_update_lock(), which the same callback also acquires, is already
initialized before init_vqs(); do the same for wakeup_lock.
Fixes: c578123e63da ("virtio_balloon: Treat stats requests as wakeup events")
Reported-by: syzbot+13df72e0dc4be5c62215@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=13df72e0dc4be5c62215
Signed-off-by: Mingbing Zhai <zhaimingbing@cmss.chinamobile.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261016025429.901-1-zhaimingbing@cmss.chinamobile.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/virtio/virtio_balloon.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 0386e7b459bb1..cf53c1cf674b3 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -963,6 +963,7 @@ static int virtballoon_probe(struct virtio_device *vdev)
INIT_WORK(&vb->update_balloon_stats_work, update_balloon_stats_func);
INIT_WORK(&vb->update_balloon_size_work, update_balloon_size_func);
spin_lock_init(&vb->stop_update_lock);
+ spin_lock_init(&vb->wakeup_lock);
mutex_init(&vb->balloon_lock);
init_waitqueue_head(&vb->acked);
vb->vdev = vdev;
@@ -1068,8 +1069,6 @@ static int virtballoon_probe(struct virtio_device *vdev)
goto out_unregister_oom;
}
- spin_lock_init(&vb->wakeup_lock);
-
/*
* The virtio balloon itself can't wake up the device, but it is
* responsible for processing wakeup events passed up from the transport
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 209/990] vhost-scsi: fix page reference leak in misaligned I/O fallback
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (207 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 208/990] virtio_balloon: initialize wakeup_lock before virtqueues are set up Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 210/990] ext2: only flush DIRSYNC directories on every change Greg Kroah-Hartman
` (643 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Christie, Jia Jia,
Michael S. Tsirkin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Jia <physicalmtea@gmail.com>
[ Upstream commit 058fc59326af3350c6e830858e56d2aeecabe0a2 ]
iov_iter_get_pages2() returns a byte count that excludes the offset into
the first page, but also returns a reference to that page in pages[].
On the misaligned-I/O fallback, vhost_scsi_revert_map_iov_to_sgl() puts
pages already added to the SG list. The cleanup loop starts at
pages[npages], but accounts for its first page as PAGE_SIZE bytes
rather than PAGE_SIZE - offset. If the remaining data starts at a
non-zero offset, it can finish one page early and leave a page reference
behind.
Use PAGE_SIZE - offset for the first remaining page and clear offset for
later pages, as in the mapping loop. Without this, each affected request
leaks one page reference.
Fixes: bca939d5bcd0 ("vhost-scsi: Dynamically allocate scatterlists")
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261023104035.6686-1-physicalmtea@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/vhost/scsi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index cec46ed853572..e1ea548a651b5 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -869,11 +869,16 @@ vhost_scsi_map_to_sgl(struct vhost_scsi_cmd *cmd,
vhost_scsi_revert_map_iov_to_sgl(iter, *sgl, sg);
iov_iter_revert(iter, bytes);
+ /*
+ * pages[npages] is the first page not added to the SG list.
+ * The remaining data starts at offset in that page.
+ */
while (bytes) {
- n = min_t(unsigned int, PAGE_SIZE, bytes);
+ n = min_t(unsigned int, PAGE_SIZE - offset, bytes);
put_page(pages[npages++]);
bytes -= n;
+ offset = 0;
}
return -EINVAL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 210/990] ext2: only flush DIRSYNC directories on every change
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (208 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 209/990] vhost-scsi: fix page reference leak in misaligned I/O fallback Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 211/990] printk: Avoid multiple unregistration in unregister_console_locked() Greg Kroah-Hartman
` (642 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Josef Bacik, Jan Kara, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 3f57fc2c49ed05ccfc56e4dc9eda41be95925bbd ]
Every change of an ext2 directory is written to disk before the system call
returns, whether the directory is DIRSYNC or not: its pages with
filemap_write_and_wait() and its inode with sync_inode_metadata().
Writes which reach the device for 2000 files, and 200 directories, in a
directory without DIRSYNC, with the flusher turned off:
create rename unlink mkdir
before 4000 8000 4000 800
after 0 0 0 0
In a directory with chattr +D the numbers are those of "before", before and
after.
commit bc943f4872a7 ("ext2: Don't flush page immediately for DIRSYNC
directories") moved the flush from ext2_commit_chunk() to the new
ext2_handle_dirsync(). The IS_DIRSYNC() check which was around it didn't
move along.
Fix by putting the check into ext2_handle_dirsync().
Fixes: bc943f4872a7 ("ext2: Don't flush page immediately for DIRSYNC directories")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261027-b4-ext2-dirsync-v1-1-3dcd012d518d@toxicpanda.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ext2/dir.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index b07b3b369710c..3143983f31284 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -441,6 +441,9 @@ static int ext2_handle_dirsync(struct inode *dir)
{
int err;
+ if (!IS_DIRSYNC(dir))
+ return 0;
+
err = filemap_write_and_wait(dir->i_mapping);
if (!err)
err = sync_inode_metadata(dir, 1);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 211/990] printk: Avoid multiple unregistration in unregister_console_locked()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (209 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 210/990] ext2: only flush DIRSYNC directories on every change Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 212/990] block: convert nr_requests to unsigned int Greg Kroah-Hartman
` (641 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, John Ogness, Petr Mladek,
Derek Barbosa, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Ogness <john.ogness@linutronix.de>
[ Upstream commit 8a7f26aa072a4e63bc3b1adfe649546709db722e ]
unregister_console_locked() is called from within
hlist_for_each_entry_safe(console_list) loops. This would be safe if
unregister_console_locked() only unregistered the specified console. After
all, that is what the _safe variant is for.
However, unregister_console_locked() calls printk_kthreads_check_locked(),
which can unregister _multiple_ consoles if kthreads fail to start. This
could lead to hlist_for_each_entry_safe() use-after-free scenarios because
not only was the list entry removed, but possibly the following entry as
well (the @n temporary storage of the next entry).
Move the call to printk_kthreads_check_locked() outside of
unregister_console_locked(). Add comments to both functions to clarify
if they are safe to be used in hlist_for_each_entry_safe(console_list)
loops.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/lkml/87ik31iz4x.fsf@jogness.linutronix.de
Fixes: 76f258bf3f2a ("printk: nbcon: Introduce printer kthreads")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Derek Barbosa <debarbos@redhat.com>
Link: https://patch.msgid.link/20261030135802.663893-1-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/printk/printk.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index d555d05ffa8d4..124e7790f8447 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3747,6 +3747,13 @@ static struct syscore printk_syscore = {
* If appropriate, start nbcon kthreads and set @printk_kthreads_running.
* If any kthreads fail to start, those consoles are unregistered.
*
+ * Called after consoles are registered or unregistered.
+ *
+ * This MUST NOT be called within an hlist_for_each_entry_safe(console_list)
+ * loop because it can unregister multiple consoles if any kthreads fail to
+ * start. That would lead to use-after-free scenarios within the
+ * hlist_for_each_entry_safe(console_list) loop of the caller.
+ *
* Must be called under console_list_lock().
*/
static void printk_kthreads_check_locked(void)
@@ -4188,7 +4195,20 @@ void register_console(struct console *newcon)
}
EXPORT_SYMBOL(register_console);
-/* Must be called under console_list_lock(). */
+/*
+ * Unregister the specified console.
+ *
+ * This can be called safely from within an
+ * hlist_for_each_entry_safe(console_list) loop because it unregisters
+ * _only_ the specified console.
+ *
+ * Afterwards the caller should call printk_kthreads_check_locked() since
+ * unregistering a console may require printer threads to start/stop. Note
+ * that printk_kthreads_check_locked() cannot be called safely from within
+ * an hlist_for_each_entry_safe(console_list) loop.
+ *
+ * Must be called under console_list_lock().
+ */
static int unregister_console_locked(struct console *console)
{
bool use_device_lock = (console->flags & CON_NBCON) && console->write_atomic;
@@ -4280,9 +4300,6 @@ static int unregister_console_locked(struct console *console)
if (console->exit)
res = console->exit(console);
- /* Changed console list, may require printer threads to start/stop. */
- printk_kthreads_check_locked();
-
return res;
}
@@ -4291,7 +4308,12 @@ int unregister_console(struct console *console)
int res;
console_list_lock();
+
res = unregister_console_locked(console);
+
+ /* Changed console list, may require printer threads to start/stop. */
+ printk_kthreads_check_locked();
+
console_list_unlock();
return res;
}
@@ -4415,6 +4437,10 @@ static int __init printk_late_init(void)
unregister_console_locked(con);
}
}
+
+ /* Changed console list, may require printer threads to start/stop. */
+ printk_kthreads_check_locked();
+
console_list_unlock();
ret = cpuhp_setup_state_nocalls(CPUHP_PRINTK_DEAD, "printk:dead", NULL,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 212/990] block: convert nr_requests to unsigned int
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (210 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 211/990] printk: Avoid multiple unregistration in unregister_console_locked() Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 213/990] blk-mq: add a new queue sysfs attribute async_depth Greg Kroah-Hartman
` (640 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yu Kuai, Nilay Shroff,
Hannes Reinecke, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <yukuai@fnnas.com>
[ Upstream commit 9fc7900b14727d39457bd3724f26e6e3faca3efd ]
This value represents the number of requests for elevator tags, or drivers
tags if elevator is none. The max value for elevator tags is 2048, and
in drivers at most 16 bits is used for tag.
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 3a9892bca4dd ("blk-mq: reset queue state on scheduler teardown")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/blkdev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0299d62886ed1..5d073a96324aa 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -545,7 +545,7 @@ struct request_queue {
/*
* queue settings
*/
- unsigned long nr_requests; /* Max # of requests */
+ unsigned int nr_requests; /* Max # of requests */
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
struct blk_crypto_profile *crypto_profile;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 213/990] blk-mq: add a new queue sysfs attribute async_depth
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (211 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 212/990] block: convert nr_requests to unsigned int Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 214/990] blk-mq: reset queue state on scheduler teardown Greg Kroah-Hartman
` (639 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yu Kuai, Nilay Shroff, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <yukuai@fnnas.com>
[ Upstream commit f98afe4f31bb8b07fea318606c08030c2049587e ]
Add a new field async_depth to request_queue and related APIs, this is
currently not used, following patches will convert elevators to use
this instead of internal async_depth.
Signed-off-by: Yu Kuai <yukuai@fnnas.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 3a9892bca4dd ("blk-mq: reset queue state on scheduler teardown")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-core.c | 1 +
block/blk-mq.c | 6 ++++++
block/blk-sysfs.c | 42 ++++++++++++++++++++++++++++++++++++++++++
block/elevator.c | 1 +
include/linux/blkdev.h | 1 +
5 files changed, 51 insertions(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index c2300b201d4ff..0eba4243ebfd8 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -463,6 +463,7 @@ struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id)
fs_reclaim_release(GFP_KERNEL);
q->nr_requests = BLKDEV_DEFAULT_RQ;
+ q->async_depth = BLKDEV_DEFAULT_RQ;
return q;
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 7bdc9b1d7b746..530be27759c0e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4704,6 +4704,7 @@ int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
spin_lock_init(&q->requeue_lock);
q->nr_requests = set->queue_depth;
+ q->async_depth = set->queue_depth;
blk_mq_init_cpu_queues(q, set->nr_hw_queues);
blk_mq_map_swqueue(q);
@@ -5083,6 +5084,11 @@ struct elevator_tags *blk_mq_update_nr_requests(struct request_queue *q,
q->elevator->et = et;
}
+ /*
+ * Preserve relative value, both nr and async_depth are at most 16 bit
+ * value, no need to worry about overflow.
+ */
+ q->async_depth = max(q->async_depth * nr / q->nr_requests, 1);
q->nr_requests = nr;
if (q->elevator && q->elevator->type->ops.depth_updated)
q->elevator->type->ops.depth_updated(q);
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index af12526d866a9..2b251460db45b 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -133,6 +133,46 @@ queue_requests_store(struct gendisk *disk, const char *page, size_t count)
return ret;
}
+static ssize_t queue_async_depth_show(struct gendisk *disk, char *page)
+{
+ guard(mutex)(&disk->queue->elevator_lock);
+
+ return queue_var_show(disk->queue->async_depth, page);
+}
+
+static ssize_t
+queue_async_depth_store(struct gendisk *disk, const char *page, size_t count)
+{
+ struct request_queue *q = disk->queue;
+ unsigned int memflags;
+ unsigned long nr;
+ int ret;
+
+ if (!queue_is_mq(q))
+ return -EINVAL;
+
+ ret = queue_var_store(&nr, page, count);
+ if (ret < 0)
+ return ret;
+
+ if (nr == 0)
+ return -EINVAL;
+
+ memflags = blk_mq_freeze_queue(q);
+ scoped_guard(mutex, &q->elevator_lock) {
+ if (q->elevator) {
+ q->async_depth = min(q->nr_requests, nr);
+ if (q->elevator->type->ops.depth_updated)
+ q->elevator->type->ops.depth_updated(q);
+ } else {
+ ret = -EINVAL;
+ }
+ }
+ blk_mq_unfreeze_queue(q, memflags);
+
+ return ret;
+}
+
static ssize_t queue_ra_show(struct gendisk *disk, char *page)
{
ssize_t ret;
@@ -538,6 +578,7 @@ static struct queue_sysfs_entry _prefix##_entry = { \
}
QUEUE_RW_ENTRY(queue_requests, "nr_requests");
+QUEUE_RW_ENTRY(queue_async_depth, "async_depth");
QUEUE_RW_ENTRY(queue_ra, "read_ahead_kb");
QUEUE_LIM_RW_ENTRY(queue_max_sectors, "max_sectors_kb");
QUEUE_LIM_RO_ENTRY(queue_max_hw_sectors, "max_hw_sectors_kb");
@@ -760,6 +801,7 @@ static struct attribute *blk_mq_queue_attrs[] = {
*/
&elv_iosched_entry.attr,
&queue_requests_entry.attr,
+ &queue_async_depth_entry.attr,
#ifdef CONFIG_BLK_WBT
&queue_wb_lat_entry.attr,
#endif
diff --git a/block/elevator.c b/block/elevator.c
index 7a97998cd8bd7..3bcd37c2aa340 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -589,6 +589,7 @@ static int elevator_switch(struct request_queue *q, struct elv_change_ctx *ctx)
blk_queue_flag_clear(QUEUE_FLAG_SQ_SCHED, q);
q->elevator = NULL;
q->nr_requests = q->tag_set->queue_depth;
+ q->async_depth = q->tag_set->queue_depth;
}
blk_add_trace_msg(q, "elv switch: %s", ctx->name);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5d073a96324aa..620093f1e5449 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -546,6 +546,7 @@ struct request_queue {
* queue settings
*/
unsigned int nr_requests; /* Max # of requests */
+ unsigned int async_depth; /* Max # of async requests */
#ifdef CONFIG_BLK_INLINE_ENCRYPTION
struct blk_crypto_profile *crypto_profile;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 214/990] blk-mq: reset queue state on scheduler teardown
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (212 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 213/990] blk-mq: add a new queue sysfs attribute async_depth Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 215/990] virtio-blk: Fix zone append sector reporting in batched completion Greg Kroah-Hartman
` (638 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jianan Huang, Christoph Hellwig,
Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianan Huang <jnhuang95@gmail.com>
[ Upstream commit 3a9892bca4dd0182db61702e131cad569b1d71e6 ]
We observed I/O timeouts with requests stalled in per-CPU software
queues.
The affected queue had no elevator, but QUEUE_FLAG_SQ_SCHED remained
set. A failed elevator switch can leave this state when falling back to
none without clearing the flag. With empty hctx dispatch lists, a
queue-wide restart on CPU4 would skip requests pending in ctx5/ctx7:
CPU4: blk_mq_run_hw_queues(q)
sq_hctx = hctx4
hctx4: no pending requests -> selected
hctx5: 9 reads in ctx5 -> skipped
hctx7: 3 writes in ctx7 -> skipped
The pending requests may remain undispatched until another event runs
their hardware queues.
Clear the flag and restore nr_requests and async_depth to the driver
queue depth in the common scheduler teardown path, covering both
scheduler exit and failed initialization.
Fixes: 4d337cebcb1c ("blk-mq: avoid to touch q->elevator without any protection")
Assisted-by: LLM
Signed-off-by: Jianan Huang <jnhuang95@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261023092611.116795-1-jnhuang95@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-mq-sched.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 128f2be9d4207..d18175ffa1b18 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -374,7 +374,7 @@ bool blk_mq_sched_try_insert_merge(struct request_queue *q, struct request *rq,
}
EXPORT_SYMBOL_GPL(blk_mq_sched_try_insert_merge);
-/* called in queue's release handler, tagset has gone away */
+/* Clear scheduler tags and reset queue state. */
static void blk_mq_sched_tags_teardown(struct request_queue *q, unsigned int flags)
{
struct blk_mq_hw_ctx *hctx;
@@ -385,6 +385,10 @@ static void blk_mq_sched_tags_teardown(struct request_queue *q, unsigned int fla
if (blk_mq_is_shared_tags(flags))
q->sched_shared_tags = NULL;
+
+ blk_queue_flag_clear(QUEUE_FLAG_SQ_SCHED, q);
+ q->nr_requests = q->tag_set->queue_depth;
+ q->async_depth = q->tag_set->queue_depth;
}
void blk_mq_sched_reg_debugfs(struct request_queue *q)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 215/990] virtio-blk: Fix zone append sector reporting in batched completion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (213 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 214/990] blk-mq: reset queue state on scheduler teardown Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 216/990] block: partitions: reject GPT entries with starting_lba > ending_lba Greg Kroah-Hartman
` (637 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Michael S. Tsirkin,
Stefan Hajnoczi, Christoph Hellwig, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shao Mingyin <shao.mingyin@zte.com.cn>
[ Upstream commit 08a6572441a4e646c96c2b8d8ead9eea0e458332 ]
For zone append, the block layer copies req->__sector back into the
bio in blk_zone_append_update_request_bio(), so the driver must update
req->__sector with the sector reported by the device.
virtblk_request_done() does that, but the batched completion path used
by virtblk_poll() only unmaps and cleans up the requests before calling
blk_mq_end_request_batch().
A zone append completed through polling therefore keeps the sector that
was assigned at submission time, and the file system or application sees
the wrong LBA for the written data.
Move the sector update into a helper and call it from both completion
paths.
Fixes: 95bfec41bd3d ("virtio-blk: add support for zoned block devices")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/202610261955196384aSLGuy3_0MiTvlYXVdiC@zte.com.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/virtio_blk.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 29317945a7c00..8ee96de512395 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -331,18 +331,25 @@ static inline u8 virtblk_vbr_status(struct virtblk_req *vbr)
return *((u8 *)&vbr->in_hdr + vbr->in_hdr_len - 1);
}
+static inline void virtblk_update_zone_append_sector(struct request *req,
+ struct virtblk_req *vbr)
+{
+ struct virtio_blk *vblk = req->mq_hctx->queue->queuedata;
+
+ if (req_op(req) == REQ_OP_ZONE_APPEND)
+ req->__sector = virtio64_to_cpu(vblk->vdev,
+ vbr->in_hdr.zone_append.sector);
+}
+
static inline void virtblk_request_done(struct request *req)
{
struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
blk_status_t status = virtblk_result(virtblk_vbr_status(vbr));
- struct virtio_blk *vblk = req->mq_hctx->queue->queuedata;
virtblk_unmap_data(req, vbr);
virtblk_cleanup_cmd(req);
- if (req_op(req) == REQ_OP_ZONE_APPEND)
- req->__sector = virtio64_to_cpu(vblk->vdev,
- vbr->in_hdr.zone_append.sector);
+ virtblk_update_zone_append_sector(req, vbr);
blk_mq_end_request(req, status);
}
@@ -1213,8 +1220,11 @@ static void virtblk_complete_batch(struct io_comp_batch *iob)
struct request *req;
rq_list_for_each(&iob->req_list, req) {
- virtblk_unmap_data(req, blk_mq_rq_to_pdu(req));
+ struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
+
+ virtblk_unmap_data(req, vbr);
virtblk_cleanup_cmd(req);
+ virtblk_update_zone_append_sector(req, vbr);
}
blk_mq_end_request_batch(iob);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 216/990] block: partitions: reject GPT entries with starting_lba > ending_lba
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (214 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 215/990] virtio-blk: Fix zone append sector reporting in batched completion Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 217/990] block: report the correct discard alignment in sysfs Greg Kroah-Hartman
` (636 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zizhi Wo, Christoph Hellwig,
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 7e3801d12ebabaa3db6e2685ccc80b6e6f6d1ff7 ]
A GPT entry whose starting_lba is greater than its ending_lba is accepted,
and the kernel creates a partition with a bogus size. The bogus sector
count defeats the end-of-device check, so I/O through that partition is not
confined to it and can access sectors outside the partition on the same
disk.
is_pte_valid() only rejects an entry when its type is NULL or when
starting_lba or ending_lba is greater than lastlba; it never checks that
starting_lba <= ending_lba. For a reversed entry both field checks still
pass, but efi_partition() computes size = ending_lba - starting_lba + 1 in
u64, which underflows to a huge value. That value also wraps in the
end-of-device check in blk_add_partition() (from + size) and does not fit
the signed i_size, which turns negative.
Reject entries with starting_lba > ending_lba in is_pte_valid(), matching
the head-level check against last_usable_lba < first_usable_lba.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261102080442.3775061-1-wozizhi@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/partitions/efi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 7acba66eed481..d88321f6400ab 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -461,6 +461,7 @@ static inline int
is_pte_valid(const gpt_entry *pte, const u64 lastlba)
{
if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) ||
+ le64_to_cpu(pte->starting_lba) > le64_to_cpu(pte->ending_lba) ||
le64_to_cpu(pte->starting_lba) > lastlba ||
le64_to_cpu(pte->ending_lba) > lastlba)
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 217/990] block: report the correct discard alignment in sysfs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (215 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 216/990] block: partitions: reject GPT entries with starting_lba > ending_lba Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 218/990] zloop: fix the error code in the blk_mq_alloc_disk message Greg Kroah-Hartman
` (635 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Christoph Hellwig,
Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 2516f0413f8704a7370ef8a2eeae26c9bc438978 ]
disk_discard_alignment_show() reports the physical I/O alignment offset
instead of the discard alignment. Devices can specify these offsets
independently, so the discard_alignment sysfs attribute can report the
wrong value.
Use bdev_discard_alignment() for the whole-disk attribute, as is already
done for partitions.
Fixes: 4e1462ffe899 ("block: remove queue_discard_alignment")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261031102023.3644494-2-thnkslprpt@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/genhd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/genhd.c b/block/genhd.c
index 6ba0e22ce9dff..2bba931bd10aa 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1146,7 +1146,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
{
struct gendisk *disk = dev_to_disk(dev);
- return sysfs_emit(buf, "%d\n", bdev_alignment_offset(disk->part0));
+ return sysfs_emit(buf, "%u\n", bdev_discard_alignment(disk->part0));
}
static ssize_t diskseq_show(struct device *dev,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 218/990] zloop: fix the error code in the blk_mq_alloc_disk message
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (216 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 217/990] block: report the correct discard alignment in sysfs Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 219/990] zloop: reject mismatched conventional zone files on restore Greg Kroah-Hartman
` (634 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Christoph Hellwig,
Damien Le Moal, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shao Mingyin <shao.mingyin@zte.com.cn>
[ Upstream commit 703f6aee8d8d1cb6227af56169be6b1dc4d3c4d5 ]
When blk_mq_alloc_disk() fails, "ret" still holds the zero returned by the
preceding blk_mq_alloc_tag_set() call, so the error message always reports
"err=0". Save PTR_ERR(zlo->disk) in "ret" before printing it, like the
blk_mq_alloc_tag_set() and add_disk() failure paths do.
Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://patch.msgid.link/20261031221737569WQ3bg8y80Ht7JdTCWwlkL@zte.com.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/zloop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index 9986cfff47d6d..a49170a6565a2 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -1024,8 +1024,8 @@ static int zloop_ctl_add(struct zloop_options *opts)
zlo->disk = blk_mq_alloc_disk(&zlo->tag_set, &lim, zlo);
if (IS_ERR(zlo->disk)) {
- pr_err("blk_mq_alloc_disk failed (err=%d)\n", ret);
ret = PTR_ERR(zlo->disk);
+ pr_err("blk_mq_alloc_disk failed (err=%d)\n", ret);
goto out_cleanup_tags;
}
zlo->disk->flags = GENHD_FL_NO_PART;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 219/990] zloop: reject mismatched conventional zone files on restore
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (217 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 218/990] zloop: fix the error code in the blk_mq_alloc_disk message Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 220/990] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT Greg Kroah-Hartman
` (633 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Christoph Hellwig,
Damien Le Moal, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shao Mingyin <shao.mingyin@zte.com.cn>
[ Upstream commit 09c2e203e0ea8b68e7c9500401fa0ab60baf1a9d ]
When restoring a zloop device, zloop_init_zone() checks that the size of
each conventional zone file matches the configured zone size. The check
prints an error and then jumps to out_fput, which releases the zone file
and returns the value left in "ret" by the preceding vfs_getattr() call,
that is, zero. zloop_ctl_add() therefore treats the zone as initialized
and continues with a zone->file pointer that was already released; any
I/O to that zone then dereferences it.
Return -EINVAL, like the sequential zone path does for the same kind of
inconsistency.
While at it, print the zone size that is actually compared instead of the
zone capacity, which may be smaller and only made the message confusing.
Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://patch.msgid.link/20261031221610676B5VoVcwMgkoDNVZH2bVDO@zte.com.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/zloop.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zloop.c b/drivers/block/zloop.c
index a49170a6565a2..8c80231c0873c 100644
--- a/drivers/block/zloop.c
+++ b/drivers/block/zloop.c
@@ -865,7 +865,8 @@ static int zloop_init_zone(struct zloop_device *zlo, struct zloop_options *opts,
if (restore && file_sectors != zlo->zone_size) {
pr_err("Invalid conventional zone %u file size (%llu sectors != %llu)\n",
- zone_no, file_sectors, zlo->zone_capacity);
+ zone_no, file_sectors, zlo->zone_size);
+ ret = -EINVAL;
goto out_fput;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 220/990] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (218 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 219/990] zloop: reject mismatched conventional zone files on restore Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 221/990] null_blk: fix opening closed zones at the active zone limit Greg Kroah-Hartman
` (632 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nguyen Dinh Phi, Stefano Garzarella,
Bobby Eshleman, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyen Dinh Phi <phind.uet@gmail.com>
[ Upstream commit c0ef6144b4d60afb90bc6d8db3ffdac043cd6ffc ]
The timeval validation checks tv_usec < USEC_PER_SEC but not
tv_usec >= 0, so a negative tv_usec makes the timeout computation
wrap into a bogus value, later tripping "schedule_timeout: wrong
timeout value" instead of being rejected.
Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Link: https://patch.msgid.link/20261030064428.73930-1-phind.uet@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/vmw_vsock/af_vsock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 999b18f2d17f1..391ac6d2435b6 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1986,7 +1986,8 @@ static int vsock_connectible_setsockopt(struct socket *sock,
optname == SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD);
if (err)
break;
- if (tv.tv_sec >= 0 && tv.tv_usec < USEC_PER_SEC &&
+ if (tv.tv_sec >= 0 && tv.tv_usec >= 0 &&
+ tv.tv_usec < USEC_PER_SEC &&
tv.tv_sec < (MAX_SCHEDULE_TIMEOUT / HZ - 1)) {
vsk->connect_timeout = tv.tv_sec * HZ +
DIV_ROUND_UP((unsigned long)tv.tv_usec, (USEC_PER_SEC / HZ));
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 221/990] null_blk: fix opening closed zones at the active zone limit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (219 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 220/990] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 222/990] null_blk: dont finish zones to set them read-only or offline Greg Kroah-Hartman
` (631 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 6f2b59737bf9cf3623719857ac149f0d431db109 ]
When the open zone limit is reached, null_check_open() closes an
implicitly open zone only if the active zone limit is not reached.
Closing an implicitly open zone does not change the number of active
zones, so this check is wrong. For an empty zone, the active zone limit
was already checked by null_check_zone_resources(). For a closed zone,
the check makes writing to, opening or finishing the zone fail with
BLK_STS_ZONE_OPEN_RESOURCE at the active zone limit, whereas ZBC-3
(4.5.3.2.7.2) and NVMe ZNS (2.1.1.4.1) require closing an implicitly
open zone instead.
Remove the check, and update the comment above
null_check_zone_resources() accordingly.
Fixes: dc4d137ee3b7 ("null_blk: add support for max open/active zone limit for zoned devices")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20261022092158.2248831-6-cassel@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/null_blk/zoned.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index 48d0f30694c73..cbeaec5a0a1eb 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -311,10 +311,8 @@ static blk_status_t null_check_open(struct nullb_device *dev)
return BLK_STS_OK;
if (dev->nr_zones_imp_open) {
- if (null_check_active(dev) == BLK_STS_OK) {
- null_close_imp_open_zone(dev);
- return BLK_STS_OK;
- }
+ null_close_imp_open_zone(dev);
+ return BLK_STS_OK;
}
return BLK_STS_ZONE_OPEN_RESOURCE;
@@ -330,8 +328,11 @@ static blk_status_t null_check_open(struct nullb_device *dev)
*
* ZBC states that an implicit open zone shall be closed only if there is not
* room within the open limit. However, with the addition of an active limit,
- * it is not certain that closing an implicit open zone will allow a new zone
- * to be opened, since we might already be at the active limit capacity.
+ * it is not certain that closing an implicit open zone will allow an empty
+ * zone to be opened, since we might already be at the active limit capacity.
+ * Therefore, the active limit is checked first for an empty zone. A closed
+ * zone already holds an active zone resource, so only the open limit has to
+ * be checked for a closed zone.
*/
static blk_status_t null_check_zone_resources(struct nullb_device *dev,
struct nullb_zone *zone)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 222/990] null_blk: dont finish zones to set them read-only or offline
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (220 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 221/990] null_blk: fix opening closed zones at the active zone limit Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 223/990] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash Greg Kroah-Hartman
` (630 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 973bf587d79f061beffdd392e77012a07f25fcd6 ]
null_set_zone_cond() calls null_finish_zone() to release the zone
resources held by a zone before setting it read-only or offline.
For an empty or closed zone, null_finish_zone() first runs the zone
resource checks, which can close an unrelated implicitly open zone, or
fail. As the error is ignored, a failure for a closed zone leaks
nr_zones_closed, permanently lowering the effective active zone limit.
Setting a zone read-only or offline requires no zone resources, so
release the zone resources held by the zone directly instead, using a
new helper, null_release_zone_resources().
Fixes: d3a5738849e0 ("null_blk: support read-only and offline zone conditions")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20261022092158.2248831-7-cassel@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/null_blk/zoned.c | 35 +++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c
index cbeaec5a0a1eb..ed0f066c7f78f 100644
--- a/drivers/block/null_blk/zoned.c
+++ b/drivers/block/null_blk/zoned.c
@@ -743,6 +743,33 @@ blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_op op,
}
}
+/*
+ * Release the zone resources held by a zone, before changing the condition of
+ * the zone to a condition that does not hold any zone resources.
+ */
+static void null_release_zone_resources(struct nullb_device *dev,
+ struct nullb_zone *zone)
+{
+ if (!dev->need_zone_res_mgmt)
+ return;
+
+ spin_lock(&dev->zone_res_lock);
+ switch (zone->cond) {
+ case BLK_ZONE_COND_IMP_OPEN:
+ dev->nr_zones_imp_open--;
+ break;
+ case BLK_ZONE_COND_EXP_OPEN:
+ dev->nr_zones_exp_open--;
+ break;
+ case BLK_ZONE_COND_CLOSED:
+ dev->nr_zones_closed--;
+ break;
+ default:
+ break;
+ }
+ spin_unlock(&dev->zone_res_lock);
+}
+
/*
* Set a zone in the read-only or offline condition.
*/
@@ -759,8 +786,8 @@ static void null_set_zone_cond(struct nullb_device *dev,
* If the read-only condition is requested again to zones already in
* read-only condition, restore back normal empty condition. Do the same
* if the offline condition is requested for offline zones. Otherwise,
- * set the specified zone condition to the zones. Finish the zones
- * beforehand to free up zone resources.
+ * set the specified zone condition to the zones. Release the zone
+ * resources held by the zones beforehand.
*/
if (zone->cond == cond) {
zone->cond = BLK_ZONE_COND_EMPTY;
@@ -768,9 +795,7 @@ static void null_set_zone_cond(struct nullb_device *dev,
if (dev->memory_backed)
null_handle_discard(dev, zone->start, zone->len);
} else {
- if (zone->cond != BLK_ZONE_COND_READONLY &&
- zone->cond != BLK_ZONE_COND_OFFLINE)
- null_finish_zone(dev, zone);
+ null_release_zone_resources(dev, zone);
zone->cond = cond;
zone->wp = NULL_ZONE_INVALID_WP;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 223/990] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (221 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 222/990] null_blk: dont finish zones to set them read-only or offline Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 224/990] nvmet: fix arbitration burst field mask Greg Kroah-Hartman
` (629 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jiayuan Chen, Kuniyuki Iwashima, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 647b81ddefc6364290e67bf33c89d54971f8995e ]
inet_twsk_kill() removes a TIME_WAIT socket from the established hash
before it finishes using the ehash lock, hashinfo and bind tables, and
before it drops the death-row reference. A running timer can therefore
unhash its socket before inet_twsk_purge() reaches it. The purge cannot
synchronize with that timer, and tcp_sk_exit_batch() can free the
private ehash and hashinfo while inet_twsk_kill() is still using them.
An unprivileged reproducer using user and network namespaces, a private
TCP ehash and a FIN_WAIT2 timer triggers a KASAN slab-use-after-free in
inet_twsk_kill(). The allocation and free stacks point to
inet_pernet_hashinfo_alloc() and inet_pernet_hashinfo_free().
Wait for an RCU grace period after purging the whole batch, if one
netns in the batch uses a private ehash. TIME_WAIT removal runs with
bottom halves disabled, so this also waits for removers that were
already invisible to the purge. Keep the wait under
tcp_exit_batch_mutex, before freeing any private hashinfo.
The same window exists with the shared tcp_hashinfo. There, the
hashinfo memory stays valid, but tcp_sk_exit_batch() can decrement
tcp_death_row.tw_refcount from 2 to 1 before inet_twsk_kill() drops its
own reference. This triggers the WARN_ON_ONCE() in tcp_sk_exit_batch(),
then a refcount_t "decrement hit 0" warning from inet_twsk_kill().
Adding a grace period for the shared case would be costly on busy
hosts. It is not needed: struct net is freed by a later cleanup_net(),
after the synchronize_rcu() in ops_undo_list(), so inet_twsk_kill()
can safely drop the last tw_refcount reference itself.
Use refcount_dec_if_one() and only warn if tw_refcount is not 1
after a grace period.
Fixes: d1e5e6408b30 ("tcp: Introduce optional per-netns ehash.")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
[edumazet: only call synchronize_net() if one netns in the batch uses a private ehash,
use refcount_dec_if_one() to avoid a false WARN with the shared ehash]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261030075843.2567707-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_ipv4.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b5517f9af5465..fa5437b405207 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -3700,6 +3700,7 @@ static int __net_init tcp_sk_init(struct net *net)
static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
{
+ bool synced = false;
struct net *net;
/* make sure concurrent calls to tcp_sk_exit_batch from net_cleanup_work
@@ -3714,9 +3715,27 @@ static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
tcp_twsk_purge(net_exit_list);
+ /* inet_twsk_kill() unhashes a twsk before it is done with ehash
+ * and bhash, and before it drops its tw_refcount reference,
+ * so tcp_twsk_purge() can miss it. Such callers run with BH
+ * disabled: wait for them before freeing a private ehash.
+ */
+ list_for_each_entry(net, net_exit_list, exit_list) {
+ if (net->ipv4.tcp_death_row.hashinfo->pernet) {
+ synchronize_net();
+ synced = true;
+ break;
+ }
+ }
+
list_for_each_entry(net, net_exit_list, exit_list) {
inet_pernet_hashinfo_free(net->ipv4.tcp_death_row.hashinfo);
- WARN_ON_ONCE(!refcount_dec_and_test(&net->ipv4.tcp_death_row.tw_refcount));
+ /* Without a grace period, a concurrent inet_twsk_kill() might
+ * still hold a tw_refcount reference. Let it drop it: struct net
+ * is freed by a later cleanup_net(), after an RCU grace period.
+ */
+ if (!refcount_dec_if_one(&net->ipv4.tcp_death_row.tw_refcount))
+ WARN_ON_ONCE(synced);
tcp_fastopen_ctx_destroy(net);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 224/990] nvmet: fix arbitration burst field mask
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (222 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 223/990] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 225/990] net: dsa: b53: Enable IGMP and MLD control packet CPU copies Greg Kroah-Hartman
` (628 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Damien Le Moal,
James Fantin-Hardesty, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Fantin-Hardesty <james.fantin-hardesty@seagate.com>
[ Upstream commit 6976a9b8dc71bb3b6e5dd563e35510461bea29d4 ]
The Arbitration Burst (AB) field of the Arbitration feature is
CDW11 bits 2:0 (NVMe Base Specification 2.1, Feature 01h), but
nvmet incorrectly masks it with 0x3. Use 0x7 for both set and get.
Fixes: a0ed77d4c9a7 ("nvmet: Implement arbitration feature support")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: James Fantin-Hardesty <james.fantin-hardesty@seagate.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/admin-cmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 007029eaca39b..c8c7961beadb4 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -1341,7 +1341,7 @@ static u16 nvmet_set_feat_arbitration(struct nvmet_req *req)
.hpw = (cdw11 >> 24) & 0xff,
.mpw = (cdw11 >> 16) & 0xff,
.lpw = (cdw11 >> 8) & 0xff,
- .ab = cdw11 & 0x3,
+ .ab = cdw11 & 0x7,
};
if (!ctrl->ops->set_feature) {
@@ -1496,7 +1496,7 @@ static u16 nvmet_get_feat_arbitration(struct nvmet_req *req)
((u32)arb.hpw << 24) |
((u32)arb.mpw << 16) |
((u32)arb.lpw << 8) |
- (arb.ab & 0x3));
+ (arb.ab & 0x7));
return NVME_SC_SUCCESS;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 225/990] net: dsa: b53: Enable IGMP and MLD control packet CPU copies
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (223 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 224/990] nvmet: fix arbitration burst field mask Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 226/990] net: ethernet: mediatek: preserve sibling PPE bindings Greg Kroah-Hartman
` (627 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 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 3362cb822ea750399a15b741713181fd8560bd17 ]
IGMPv2 reports and MLDv1 reports are addressed to the multicast group
itself. Once the first listener is installed in the ARL table, subsequent
reports can follow that entry without reaching the CPU. The bridge then
fails to learn additional listeners, although static MDB forwarding works.
Enable the high-level protocol classifiers so that IGMP and MLD control
packets are copied to the CPU independently of the multicast ARL lookup.
Retain normal L2 forwarding by clearing the CPU-only forwarding modes,
and preserve unrelated protocol-control fields.
Handle the BCM5395's 16-bit register and different classifier fields
separately from the 32-bit layout on the BCM531xx, BCM5301x and newer
integrated RoboSwitch families, including BCM7445, BCM7278 and BCM4908.
Export the helper and call it from bcm_sf2_sw_setup() as well, since SF2
uses its own setup operation instead of b53_setup(). This also restores
the classifiers after the switch reset on resume. Leave older devices
with different IGMP controls untouched, and propagate register access
failures during setup.
The SF2 setup integration and BCM4908 chip gate were updated with
assistance from OpenAI Codex in response to review feedback.
Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20261028235100.3892374-2-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 57 ++++++++++++++++++++++++++++++++
drivers/net/dsa/b53/b53_priv.h | 1 +
drivers/net/dsa/b53/b53_regs.h | 17 ++++++++++
drivers/net/dsa/bcm_sf2.c | 5 +++
4 files changed, 80 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 508b46237011d..af73a9f70773d 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -816,6 +816,59 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
}
EXPORT_SYMBOL(b53_brcm_hdr_setup);
+int b53_enable_mcast_snooping(struct b53_device *dev)
+{
+ u16 val16;
+ u32 val;
+ int ret;
+
+ /* Older switches use different IGMP controls, not HL_PRTC_CTRL. */
+ if (is5325(dev) || is5365(dev) || dev->chip_id == BCM5389_DEVICE_ID ||
+ is5397_98(dev) || is63xx(dev))
+ return 0;
+
+ /* IGMPv2 and MLDv1 reports use the group's destination MAC. Once
+ * the first listener is offloaded, ordinary multicast forwarding
+ * can keep subsequent reports from reaching the bridge CPU.
+ */
+
+ /* BCM5395 has a narrower register and a single IGMP classifier.
+ * Its ICMPv6 classifier also covers MLD.
+ */
+ if (dev->chip_id == BCM5395_DEVICE_ID) {
+ ret = b53_read16(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL, &val16);
+ if (ret)
+ return ret;
+
+ val16 |= HL_PRTC_IGMP_IP_EN_5395 | HL_PRTC_ICMPV6_EN;
+ /* Zero forwarding modes copy control traffic to the CPU
+ * independently of the ARL lookup, retaining L2 forwarding.
+ */
+ val16 &= ~(HL_PRTC_IGMP_FWD_MODE_5395 |
+ HL_PRTC_ICMPV6_FWD_MODE);
+
+ return b53_write16(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL,
+ val16);
+ }
+
+ ret = b53_read32(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL, &val);
+ if (ret)
+ return ret;
+
+ val |= HL_PRTC_IGMP_RPTLVE_EN | HL_PRTC_IGMP_QRY_EN |
+ HL_PRTC_IGMP_UKN_EN | HL_PRTC_MLD_RPTDONE_EN |
+ HL_PRTC_MLD_QRY_EN;
+ /* Zero forwarding modes copy control traffic to the CPU
+ * independently of the ARL lookup, retaining L2 forwarding.
+ */
+ val &= ~(HL_PRTC_IGMP_RPTLVE_FWD_MODE | HL_PRTC_IGMP_QRY_FWD_MODE |
+ HL_PRTC_IGMP_UKN_FWD_MODE | HL_PRTC_MLD_RPTDONE_FWD_MODE |
+ HL_PRTC_MLD_QRY_FWD_MODE);
+
+ return b53_write32(dev, B53_MGMT_PAGE, B53_HL_PRTC_CTRL, val);
+}
+EXPORT_SYMBOL(b53_enable_mcast_snooping);
+
static void b53_enable_cpu_port(struct b53_device *dev, int port)
{
u8 port_ctrl;
@@ -1316,6 +1369,10 @@ static int b53_setup(struct dsa_switch *ds)
b53_disable_port(ds, port);
}
+ ret = b53_enable_mcast_snooping(dev);
+ if (ret)
+ return ret;
+
return b53_setup_devlink_resources(ds);
}
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index bd6849e5bb939..dce06110deb8b 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -490,6 +490,7 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
/* Exported functions towards other drivers */
void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
int b53_configure_vlan(struct dsa_switch *ds);
+int b53_enable_mcast_snooping(struct b53_device *dev);
void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
uint8_t *data);
void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index b6fe7d207a2c1..a9414851ea287 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -270,6 +270,23 @@
/* Revision ID register (8 bit) */
#define B53_REV_ID 0x40
+/* High-level protocol control (16 bit on BCM5395, otherwise 32 bit) */
+#define B53_HL_PRTC_CTRL 0x50
+#define HL_PRTC_ICMPV6_EN BIT(4)
+#define HL_PRTC_ICMPV6_FWD_MODE BIT(5)
+#define HL_PRTC_IGMP_IP_EN_5395 BIT(6)
+#define HL_PRTC_IGMP_FWD_MODE_5395 BIT(8)
+#define HL_PRTC_IGMP_RPTLVE_EN BIT(9)
+#define HL_PRTC_IGMP_RPTLVE_FWD_MODE BIT(10)
+#define HL_PRTC_IGMP_QRY_EN BIT(11)
+#define HL_PRTC_IGMP_QRY_FWD_MODE BIT(12)
+#define HL_PRTC_IGMP_UKN_EN BIT(13)
+#define HL_PRTC_IGMP_UKN_FWD_MODE BIT(14)
+#define HL_PRTC_MLD_RPTDONE_EN BIT(15)
+#define HL_PRTC_MLD_RPTDONE_FWD_MODE BIT(16)
+#define HL_PRTC_MLD_QRY_EN BIT(17)
+#define HL_PRTC_MLD_QRY_FWD_MODE BIT(18)
+
/* Broadcom header RX control (16 bit) */
#define B53_BRCM_HDR_RX_DIS 0x60
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index de3efa3ce9a75..f3b56ea87b07b 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1059,6 +1059,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
unsigned int port;
+ int ret;
/* Enable all valid ports and disable those unused */
for (port = 0; port < priv->hw_params.num_ports; port++) {
@@ -1074,6 +1075,10 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
b53_configure_vlan(ds);
bcm_sf2_enable_acb(ds);
+ ret = b53_enable_mcast_snooping(priv->dev);
+ if (ret)
+ return ret;
+
return b53_setup_devlink_resources(ds);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 226/990] net: ethernet: mediatek: preserve sibling PPE bindings
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (224 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 225/990] net: dsa: b53: Enable IGMP and MLD control packet CPU copies Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 227/990] nvmet-loop: do not alloc admin tag set during reset Greg Kroah-Hartman
` (626 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Goodkind, Simon Horman,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Goodkind <alex@goodkind.io>
[ Upstream commit 34cc22a9ce6ae0228dcd09a57df23aea62e22b04 ]
__mtk_ppe_check_skb() clears entry->hash for flows bound to other
hardware slots in the same software hash bucket. mtk_flow_offload_stats()
then skips their hardware counter updates. L2 cleanup also frees sibling
subflows without invalidating their hardware rules.
Restrict both cleanup paths to entries assigned to the inspected slot.
Two UDP trials reproduced the counter failure on a GL-MT3000/MT7981
running unmodified OpenWrt 25.12.5 with Linux 6.12.94:
1. Start a UDP connection.
2. Add a control connection in a different hash bucket.
3. Add a connection in the first connection's hash bucket.
AI code review of the original patch identified the cleanup problem
in L2 subflows.
Full ARM64 builds with allmodconfig and allyesconfig passed before
and after the patch using GCC 14.2.0 and W=1, without new warnings.
The builds used CONFIG_WERROR=n because the unmodified ARM64 kernel
already emits warnings. Hardware testing has not run for this revision.
Fixes: c4f033d9e03e ("net: ethernet: mtk_eth_soc: rework hardware flow table management")
Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
Link: https://github.com/openwrt/openwrt/pull/26107
Signed-off-by: Alexander Goodkind <alex@goodkind.io>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261030010517.45639-1-alex@goodkind.io
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index bb01a7355932a..fc1362cd821cd 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -754,8 +754,7 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
hlist_for_each_entry_safe(entry, n, head, list) {
if (entry->type == MTK_FLOW_TYPE_L2_SUBFLOW) {
- if (unlikely(FIELD_GET(MTK_FOE_IB1_STATE, hwe->ib1) ==
- MTK_FOE_STATE_BIND))
+ if (entry->hash != hash)
continue;
entry->hash = 0xffff;
@@ -764,7 +763,7 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
}
if (found || !mtk_flow_entry_match(ppe->eth, entry, hwe)) {
- if (entry->hash != 0xffff)
+ if (entry->hash == hash)
entry->hash = 0xffff;
continue;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 227/990] nvmet-loop: do not alloc admin tag set during reset
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (225 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 226/990] net: ethernet: mediatek: preserve sibling PPE bindings Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 228/990] nvme-loop: delete the controller if a reset fails Greg Kroah-Hartman
` (625 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Wagner, Sagi Grimberg,
Christoph Hellwig, Hannes Reinecke, Maurizio Lombardi,
Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <mlombard@redhat.com>
[ Upstream commit 233bbeb4a47cbead8c0471c0b8daec141033eae4 ]
Currently, resetting a loopback controller unconditionally invokes
nvme_alloc_admin_tag_set() inside nvme_loop_configure_admin_queue().
Doing so drops the old queue and allocates a new one. Consequently,
this reverts the admin queue's timeout (q->rq_timeout) back to the
module default (NVME_ADMIN_TIMEOUT), completely wiping out any custom
timeout values the user may have configured via sysfs and potentially
racing against the sysfs nvme_admin_timeout_store() function
that may dereference the admin_q pointer during the RESETTING state.
Decouple the admin tag set lifecycle from the admin queue
configuration and destruction paths, which are executed during resets;
Specifically:
* Move nvme_alloc_admin_tag_set() into nvme_loop_create_ctrl() so it
is only allocated once during the initial controller creation.
* Defer the destruction of the admin tag set to
nvme_loop_delete_ctrl_host() and the terminal error-handling
paths of nvme_loop_reset_ctrl_work() and
nvme_loop_create_ctrl().
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: bc2170d36586 ("nvme-loop: delete the controller if a reset fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/loop.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index 13bb80582b578..c096953194a00 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -272,7 +272,6 @@ static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl)
nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
nvmet_cq_put(&ctrl->queues[0].nvme_cq);
- nvme_remove_admin_tag_set(&ctrl->ctrl);
}
static void nvme_loop_free_ctrl(struct nvme_ctrl *nctrl)
@@ -373,25 +372,18 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
}
ctrl->ctrl.queue_count = 1;
- error = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set,
- &nvme_loop_admin_mq_ops,
- sizeof(struct nvme_loop_iod) +
- NVME_INLINE_SG_CNT * sizeof(struct scatterlist));
- if (error)
- goto out_free_sq;
-
/* reset stopped state for the fresh admin queue */
clear_bit(NVME_CTRL_ADMIN_Q_STOPPED, &ctrl->ctrl.flags);
error = nvmf_connect_admin_queue(&ctrl->ctrl);
if (error)
- goto out_cleanup_tagset;
+ goto out_free_sq;
set_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
error = nvme_enable_ctrl(&ctrl->ctrl);
if (error)
- goto out_cleanup_tagset;
+ goto out_free_sq;
ctrl->ctrl.max_hw_sectors =
(NVME_LOOP_MAX_SEGMENTS - 1) << PAGE_SECTORS_SHIFT;
@@ -400,14 +392,12 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
error = nvme_init_ctrl_finish(&ctrl->ctrl, false);
if (error)
- goto out_cleanup_tagset;
+ goto out_free_sq;
return 0;
-out_cleanup_tagset:
- clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
- nvme_remove_admin_tag_set(&ctrl->ctrl);
out_free_sq:
+ clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
nvmet_cq_put(&ctrl->queues[0].nvme_cq);
return error;
@@ -432,6 +422,7 @@ static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl)
static void nvme_loop_delete_ctrl_host(struct nvme_ctrl *ctrl)
{
nvme_loop_shutdown_ctrl(to_loop_ctrl(ctrl));
+ nvme_remove_admin_tag_set(ctrl);
}
static void nvme_loop_delete_ctrl(struct nvmet_ctrl *nctrl)
@@ -494,6 +485,7 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work)
nvme_cancel_admin_tagset(&ctrl->ctrl);
nvme_loop_destroy_admin_queue(ctrl);
out_disable:
+ nvme_remove_admin_tag_set(&ctrl->ctrl);
dev_warn(ctrl->ctrl.device, "Removing after reset failure\n");
nvme_uninit_ctrl(&ctrl->ctrl);
}
@@ -595,10 +587,17 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,
if (!ctrl->queues)
goto out_uninit_ctrl;
- ret = nvme_loop_configure_admin_queue(ctrl);
+ ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set,
+ &nvme_loop_admin_mq_ops,
+ sizeof(struct nvme_loop_iod) +
+ NVME_INLINE_SG_CNT * sizeof(struct scatterlist));
if (ret)
goto out_free_queues;
+ ret = nvme_loop_configure_admin_queue(ctrl);
+ if (ret)
+ goto out_remove_admin_tagset;
+
if (opts->queue_size > ctrl->ctrl.maxcmd) {
/* warn if maxcmd is lower than queue_size */
dev_warn(ctrl->ctrl.device,
@@ -634,6 +633,8 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,
nvme_quiesce_admin_queue(&ctrl->ctrl);
nvme_cancel_admin_tagset(&ctrl->ctrl);
nvme_loop_destroy_admin_queue(ctrl);
+out_remove_admin_tagset:
+ nvme_remove_admin_tag_set(&ctrl->ctrl);
out_free_queues:
kfree(ctrl->queues);
out_uninit_ctrl:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 228/990] nvme-loop: delete the controller if a reset fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (226 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 227/990] nvmet-loop: do not alloc admin tag set during reset Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 229/990] nvmet-tcp: ask for the TLS record type on every receive Greg Kroah-Hartman
` (624 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Josef Bacik, Jens Axboe, Keith Busch,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit bc2170d365861d29dce20f982093873baad09804 ]
If the reconnect of a reset fails, nvme_loop_reset_ctrl_work() tears the
controller down by hand with nvme_uninit_ctrl(). Since that was split
from nvme_stop_ctrl() it no longer removes the namespaces, which hold
references to the controller. A reset while the target no longer accepts
the host (allow_any_host 0) is enough to get there: a sysfs reset hangs
in kernfs_drain(), an ioctl reset leaves a controller stuck in
CONNECTING with its block devices, the cntlid can't be reused, and
module unload deletes the controller a second time and hits a
use-after-free.
Do what the other fabrics drivers do and call nvme_delete_ctrl(). The
delete path quiesces the admin queue and only unquiesces it if the queue
is live, which it isn't after a failed reset, so unquiesce it
unconditionally before destroying it so a stuck request can't block the
freeze.
Fixes: d09f2b45f346 ("nvme: split nvme_uninit_ctrl into stop and uninit")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/loop.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index c096953194a00..ed1c48472e017 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -422,6 +422,8 @@ static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl)
static void nvme_loop_delete_ctrl_host(struct nvme_ctrl *ctrl)
{
nvme_loop_shutdown_ctrl(to_loop_ctrl(ctrl));
+ /* Left quiesced if a failed reset has left no admin queue behind */
+ nvme_unquiesce_admin_queue(ctrl);
nvme_remove_admin_tag_set(ctrl);
}
@@ -485,9 +487,8 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work)
nvme_cancel_admin_tagset(&ctrl->ctrl);
nvme_loop_destroy_admin_queue(ctrl);
out_disable:
- nvme_remove_admin_tag_set(&ctrl->ctrl);
dev_warn(ctrl->ctrl.device, "Removing after reset failure\n");
- nvme_uninit_ctrl(&ctrl->ctrl);
+ nvme_delete_ctrl(&ctrl->ctrl);
}
static const struct nvme_ctrl_ops nvme_loop_ctrl_ops = {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 229/990] nvmet-tcp: ask for the TLS record type on every receive
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (227 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 228/990] nvme-loop: delete the controller if a reset fails Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 230/990] nvme-auth: add NVME_AUTH_MAX_DIGEST_SIZE constant Greg Kroah-Hartman
` (623 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Hannes Reinecke, Josef Bacik, Jens Axboe,
Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 77f72de389e3774dc95d7cd03a98a73e47013abd ]
nvmet_tcp_alloc_cmd() points recv_msg.msg_control at recv_cbuf once.
The first receive that stores a record type there advances msg_control
and leaves msg_controllen at 0 for the lifetime of the command. From
then on nvmet_tcp_try_recv_data() sees the record type of that first
receive: if it was an alert, all later data is dropped as alerts and the
queue stalls, if it was data, a later alert can't be reported and
tls_sw_recvmsg() fails with -EIO.
Set up the control buffer before each receive, like the other receive
paths do.
Fixes: a1c5dd8355b1 ("nvmet-tcp: control messages for recvmsg()")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/tcp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 6f8d5c268a221..c059a671a1d59 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1324,6 +1324,11 @@ static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue)
int len, ret;
while (msg_data_left(&cmd->recv_msg)) {
+ if (queue->tls_pskid) {
+ /* The last receive has used it up */
+ cmd->recv_msg.msg_control = cmd->recv_cbuf;
+ cmd->recv_msg.msg_controllen = sizeof(cmd->recv_cbuf);
+ }
len = sock_recvmsg(cmd->queue->sock, &cmd->recv_msg,
cmd->recv_msg.msg_flags);
if (len <= 0)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 230/990] nvme-auth: add NVME_AUTH_MAX_DIGEST_SIZE constant
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (228 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 229/990] nvmet-tcp: ask for the TLS record type on every receive Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 231/990] nvme-auth: use proper argument types Greg Kroah-Hartman
` (622 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ard Biesheuvel, Christoph Hellwig,
Hannes Reinecke, Eric Biggers, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
[ Upstream commit 9100a28c8bb4270744942cf834efcd80f1acda7d ]
Define a NVME_AUTH_MAX_DIGEST_SIZE constant and use it in the
appropriate places.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/common/auth.c | 6 ++----
drivers/nvme/host/auth.c | 6 +++---
include/linux/nvme.h | 5 +++++
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index 1f51fbebd9fac..aab06fc8ac774 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -15,8 +15,6 @@
#include <linux/nvme.h>
#include <linux/nvme-auth.h>
-#define HKDF_MAX_HASHLEN 64
-
static u32 nvme_dhchap_seqnum;
static DEFINE_MUTEX(nvme_dhchap_mutex);
@@ -769,7 +767,7 @@ int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
struct crypto_shash *hmac_tfm;
const char *hmac_name;
const char *label = "nvme-tls-psk";
- static const char default_salt[HKDF_MAX_HASHLEN];
+ static const char default_salt[NVME_AUTH_MAX_DIGEST_SIZE];
size_t prk_len;
const char *ctx;
unsigned char *prk, *tls_key;
@@ -798,7 +796,7 @@ int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
goto out_free_shash;
}
- if (WARN_ON(prk_len > HKDF_MAX_HASHLEN)) {
+ if (WARN_ON(prk_len > NVME_AUTH_MAX_DIGEST_SIZE)) {
ret = -EINVAL;
goto out_free_prk;
}
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index 38506314248f6..044f6cc6493bf 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -39,9 +39,9 @@ struct nvme_dhchap_queue_context {
u8 hash_id;
u8 sc_c;
size_t hash_len;
- u8 c1[64];
- u8 c2[64];
- u8 response[64];
+ u8 c1[NVME_AUTH_MAX_DIGEST_SIZE];
+ u8 c2[NVME_AUTH_MAX_DIGEST_SIZE];
+ u8 response[NVME_AUTH_MAX_DIGEST_SIZE];
u8 *ctrl_key;
u8 *host_key;
u8 *sess_key;
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 2a5d2d941d845..8aa83abc78638 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1837,6 +1837,11 @@ enum {
NVME_AUTH_HASH_INVALID = 0xff,
};
+/* Maximum digest size for any NVME_AUTH_HASH_* value */
+enum {
+ NVME_AUTH_MAX_DIGEST_SIZE = 64,
+};
+
/* Defined Diffie-Hellman group identifiers for DH-HMAC-CHAP authentication */
enum {
NVME_AUTH_DHGROUP_NULL = 0x00,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 231/990] nvme-auth: use proper argument types
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (229 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 230/990] nvme-auth: add NVME_AUTH_MAX_DIGEST_SIZE constant Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 232/990] nvme-auth: common: add KUnit tests for TLS key derivation Greg Kroah-Hartman
` (621 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ard Biesheuvel, Christoph Hellwig,
Hannes Reinecke, Eric Biggers, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
[ Upstream commit bf0e2567a639c455110f9be5db8c92032175e222 ]
For input parameters, use pointer to const. This makes it easier to
understand which parameters are inputs and which are outputs.
In addition, consistently use char for strings and u8 for binary. This
makes it easier to understand what is a string and what is binary data.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/common/auth.c | 47 ++++++++++++++++++++-----------------
drivers/nvme/host/auth.c | 3 ++-
drivers/nvme/target/auth.c | 5 ++--
drivers/nvme/target/nvmet.h | 2 +-
include/linux/nvme-auth.h | 26 ++++++++++----------
5 files changed, 44 insertions(+), 39 deletions(-)
diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index aab06fc8ac774..854711bff7f9a 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -159,11 +159,10 @@ u32 nvme_auth_key_struct_size(u32 key_len)
}
EXPORT_SYMBOL_GPL(nvme_auth_key_struct_size);
-struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
- u8 key_hash)
+struct nvme_dhchap_key *nvme_auth_extract_key(const char *secret, u8 key_hash)
{
struct nvme_dhchap_key *key;
- unsigned char *p;
+ const char *p;
u32 crc;
int ret, key_len;
size_t allocated_len = strlen(secret);
@@ -181,14 +180,14 @@ struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
pr_debug("base64 key decoding error %d\n",
key_len);
ret = key_len;
- goto out_free_secret;
+ goto out_free_key;
}
if (key_len != 36 && key_len != 52 &&
key_len != 68) {
pr_err("Invalid key len %d\n", key_len);
ret = -EINVAL;
- goto out_free_secret;
+ goto out_free_key;
}
/* The last four bytes is the CRC in little-endian format */
@@ -203,12 +202,12 @@ struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
pr_err("key crc mismatch (key %08x, crc %08x)\n",
get_unaligned_le32(key->key + key_len), crc);
ret = -EKEYREJECTED;
- goto out_free_secret;
+ goto out_free_key;
}
key->len = key_len;
key->hash = key_hash;
return key;
-out_free_secret:
+out_free_key:
nvme_auth_free_key(key);
return ERR_PTR(ret);
}
@@ -236,7 +235,7 @@ void nvme_auth_free_key(struct nvme_dhchap_key *key)
EXPORT_SYMBOL_GPL(nvme_auth_free_key);
struct nvme_dhchap_key *nvme_auth_transform_key(
- struct nvme_dhchap_key *key, char *nqn)
+ const struct nvme_dhchap_key *key, const char *nqn)
{
const char *hmac_name;
struct crypto_shash *key_tfm;
@@ -302,7 +301,8 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
}
EXPORT_SYMBOL_GPL(nvme_auth_transform_key);
-static int nvme_auth_hash_skey(int hmac_id, u8 *skey, size_t skey_len, u8 *hkey)
+static int nvme_auth_hash_skey(int hmac_id, const u8 *skey, size_t skey_len,
+ u8 *hkey)
{
const char *digest_name;
struct crypto_shash *tfm;
@@ -327,8 +327,8 @@ static int nvme_auth_hash_skey(int hmac_id, u8 *skey, size_t skey_len, u8 *hkey)
return ret;
}
-int nvme_auth_augmented_challenge(u8 hmac_id, u8 *skey, size_t skey_len,
- u8 *challenge, u8 *aug, size_t hlen)
+int nvme_auth_augmented_challenge(u8 hmac_id, const u8 *skey, size_t skey_len,
+ const u8 *challenge, u8 *aug, size_t hlen)
{
struct crypto_shash *tfm;
u8 *hashed_key;
@@ -409,7 +409,7 @@ int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
EXPORT_SYMBOL_GPL(nvme_auth_gen_pubkey);
int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
- u8 *ctrl_key, size_t ctrl_key_len,
+ const u8 *ctrl_key, size_t ctrl_key_len,
u8 *sess_key, size_t sess_key_len)
{
struct kpp_request *req;
@@ -436,7 +436,7 @@ int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
}
EXPORT_SYMBOL_GPL(nvme_auth_gen_shared_secret);
-int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key)
+int nvme_auth_generate_key(const char *secret, struct nvme_dhchap_key **ret_key)
{
struct nvme_dhchap_key *key;
u8 key_hash;
@@ -484,8 +484,9 @@ EXPORT_SYMBOL_GPL(nvme_auth_generate_key);
* Returns 0 on success with a valid generated PSK pointer in @ret_psk and
* the length of @ret_psk in @ret_len, or a negative error number otherwise.
*/
-int nvme_auth_generate_psk(u8 hmac_id, u8 *skey, size_t skey_len,
- u8 *c1, u8 *c2, size_t hash_len, u8 **ret_psk, size_t *ret_len)
+int nvme_auth_generate_psk(u8 hmac_id, const u8 *skey, size_t skey_len,
+ const u8 *c1, const u8 *c2, size_t hash_len,
+ u8 **ret_psk, size_t *ret_len)
{
struct crypto_shash *tfm;
SHASH_DESC_ON_STACK(shash, tfm);
@@ -582,12 +583,14 @@ EXPORT_SYMBOL_GPL(nvme_auth_generate_psk);
* Returns 0 on success with a valid digest pointer in @ret_digest, or a
* negative error number on failure.
*/
-int nvme_auth_generate_digest(u8 hmac_id, u8 *psk, size_t psk_len,
- char *subsysnqn, char *hostnqn, u8 **ret_digest)
+int nvme_auth_generate_digest(u8 hmac_id, const u8 *psk, size_t psk_len,
+ const char *subsysnqn, const char *hostnqn,
+ char **ret_digest)
{
struct crypto_shash *tfm;
SHASH_DESC_ON_STACK(shash, tfm);
- u8 *digest, *enc;
+ u8 *digest;
+ char *enc;
const char *hmac_name;
size_t digest_len, hmac_len;
int ret;
@@ -761,16 +764,16 @@ static int hkdf_expand_label(struct crypto_shash *hmac_tfm,
* Returns 0 on success with a valid psk pointer in @ret_psk or a negative
* error number otherwise.
*/
-int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
- u8 *psk_digest, u8 **ret_psk)
+int nvme_auth_derive_tls_psk(int hmac_id, const u8 *psk, size_t psk_len,
+ const char *psk_digest, u8 **ret_psk)
{
struct crypto_shash *hmac_tfm;
const char *hmac_name;
const char *label = "nvme-tls-psk";
- static const char default_salt[NVME_AUTH_MAX_DIGEST_SIZE];
+ static const u8 default_salt[NVME_AUTH_MAX_DIGEST_SIZE];
size_t prk_len;
const char *ctx;
- unsigned char *prk, *tls_key;
+ u8 *prk, *tls_key;
int ret;
hmac_name = nvme_auth_hmac_name(hmac_id);
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index 044f6cc6493bf..d0c3679acdc19 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -722,7 +722,8 @@ EXPORT_SYMBOL_GPL(nvme_auth_revoke_tls_key);
static int nvme_auth_secure_concat(struct nvme_ctrl *ctrl,
struct nvme_dhchap_queue_context *chap)
{
- u8 *psk, *digest, *tls_psk;
+ u8 *psk, *tls_psk;
+ char *digest;
struct key *tls_key;
size_t psk_len;
int ret = 0;
diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index eb2b6c7a80838..99f16b1a7e886 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -539,7 +539,7 @@ int nvmet_auth_ctrl_exponential(struct nvmet_req *req,
}
int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
- u8 *pkey, int pkey_size)
+ const u8 *pkey, int pkey_size)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
int ret;
@@ -565,7 +565,8 @@ int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
void nvmet_auth_insert_psk(struct nvmet_sq *sq)
{
int hash_len = nvme_auth_hmac_hash_len(sq->ctrl->shash_id);
- u8 *psk, *digest, *tls_psk;
+ u8 *psk, *tls_psk;
+ char *digest;
size_t psk_len;
int ret;
#ifdef CONFIG_NVME_TARGET_TCP_TLS
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 9abf67fae1882..232768f1b24f1 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -932,7 +932,7 @@ static inline bool nvmet_has_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq)
int nvmet_auth_ctrl_exponential(struct nvmet_req *req,
u8 *buf, int buf_size);
int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
- u8 *buf, int buf_size);
+ const u8 *pkey, int pkey_size);
void nvmet_auth_insert_psk(struct nvmet_sq *sq);
#else
static inline u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl,
diff --git a/include/linux/nvme-auth.h b/include/linux/nvme-auth.h
index 60e069a6757ff..a4b248c24ccf6 100644
--- a/include/linux/nvme-auth.h
+++ b/include/linux/nvme-auth.h
@@ -25,27 +25,27 @@ size_t nvme_auth_hmac_hash_len(u8 hmac_id);
u8 nvme_auth_hmac_id(const char *hmac_name);
u32 nvme_auth_key_struct_size(u32 key_len);
-struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret,
- u8 key_hash);
+struct nvme_dhchap_key *nvme_auth_extract_key(const char *secret, u8 key_hash);
void nvme_auth_free_key(struct nvme_dhchap_key *key);
struct nvme_dhchap_key *nvme_auth_alloc_key(u32 len, u8 hash);
struct nvme_dhchap_key *nvme_auth_transform_key(
- struct nvme_dhchap_key *key, char *nqn);
-int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key);
-int nvme_auth_augmented_challenge(u8 hmac_id, u8 *skey, size_t skey_len,
- u8 *challenge, u8 *aug, size_t hlen);
+ const struct nvme_dhchap_key *key, const char *nqn);
+int nvme_auth_generate_key(const char *secret, struct nvme_dhchap_key **ret_key);
+int nvme_auth_augmented_challenge(u8 hmac_id, const u8 *skey, size_t skey_len,
+ const u8 *challenge, u8 *aug, size_t hlen);
int nvme_auth_gen_privkey(struct crypto_kpp *dh_tfm, u8 dh_gid);
int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
u8 *host_key, size_t host_key_len);
int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
- u8 *ctrl_key, size_t ctrl_key_len,
+ const u8 *ctrl_key, size_t ctrl_key_len,
u8 *sess_key, size_t sess_key_len);
-int nvme_auth_generate_psk(u8 hmac_id, u8 *skey, size_t skey_len,
- u8 *c1, u8 *c2, size_t hash_len,
+int nvme_auth_generate_psk(u8 hmac_id, const u8 *skey, size_t skey_len,
+ const u8 *c1, const u8 *c2, size_t hash_len,
u8 **ret_psk, size_t *ret_len);
-int nvme_auth_generate_digest(u8 hmac_id, u8 *psk, size_t psk_len,
- char *subsysnqn, char *hostnqn, u8 **ret_digest);
-int nvme_auth_derive_tls_psk(int hmac_id, u8 *psk, size_t psk_len,
- u8 *psk_digest, u8 **ret_psk);
+int nvme_auth_generate_digest(u8 hmac_id, const u8 *psk, size_t psk_len,
+ const char *subsysnqn, const char *hostnqn,
+ char **ret_digest);
+int nvme_auth_derive_tls_psk(int hmac_id, const u8 *psk, size_t psk_len,
+ const char *psk_digest, u8 **ret_psk);
#endif /* _NVME_AUTH_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 232/990] nvme-auth: common: add KUnit tests for TLS key derivation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (230 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 231/990] nvme-auth: use proper argument types Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 233/990] nvme-auth: common: add HMAC helper functions Greg Kroah-Hartman
` (620 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ard Biesheuvel, Christoph Hellwig,
Eric Biggers, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
[ Upstream commit f990ad67f0febc51274adb604d5bdeab0d06d024 ]
Unit-test the sequence of function calls that derive tls_psk, so that we
can be more confident that changes in the implementation don't break it.
Since the NVMe specification doesn't seem to include any test vectors
for this (nor does its description of the algorithm seem to match what
was actually implemented, for that matter), I just set the expected
values to the values that the code currently produces. In the case
of SHA-512, nvme_auth_generate_digest() currently returns -EINVAL, so
for now the test tests for that too. If it is later determined that
some other behavior is needed, the test can be updated accordingly.
Tested with:
tools/testing/kunit/kunit.py run --kunitconfig drivers/nvme/common/
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/common/.kunitconfig | 6 +
drivers/nvme/common/Kconfig | 8 ++
drivers/nvme/common/Makefile | 2 +
drivers/nvme/common/tests/auth_kunit.c | 175 +++++++++++++++++++++++++
4 files changed, 191 insertions(+)
create mode 100644 drivers/nvme/common/.kunitconfig
create mode 100644 drivers/nvme/common/tests/auth_kunit.c
diff --git a/drivers/nvme/common/.kunitconfig b/drivers/nvme/common/.kunitconfig
new file mode 100644
index 0000000000000..60a038dc9423d
--- /dev/null
+++ b/drivers/nvme/common/.kunitconfig
@@ -0,0 +1,6 @@
+CONFIG_KUNIT=y
+CONFIG_PCI=y
+CONFIG_BLOCK=y
+CONFIG_BLK_DEV_NVME=y
+CONFIG_NVME_HOST_AUTH=y
+CONFIG_NVME_AUTH_KUNIT_TEST=y
diff --git a/drivers/nvme/common/Kconfig b/drivers/nvme/common/Kconfig
index da963e4f3f1f8..d19988c13af5f 100644
--- a/drivers/nvme/common/Kconfig
+++ b/drivers/nvme/common/Kconfig
@@ -13,3 +13,11 @@ config NVME_AUTH
select CRYPTO_DH
select CRYPTO_DH_RFC7919_GROUPS
select CRYPTO_HKDF
+
+config NVME_AUTH_KUNIT_TEST
+ tristate "KUnit tests for NVMe authentication" if !KUNIT_ALL_TESTS
+ depends on KUNIT && NVME_AUTH
+ default KUNIT_ALL_TESTS
+ help
+ Enable KUnit tests for some of the common code for NVMe over Fabrics
+ In-Band Authentication.
diff --git a/drivers/nvme/common/Makefile b/drivers/nvme/common/Makefile
index 681514cf2e2f5..fd9d01a609463 100644
--- a/drivers/nvme/common/Makefile
+++ b/drivers/nvme/common/Makefile
@@ -7,3 +7,5 @@ obj-$(CONFIG_NVME_KEYRING) += nvme-keyring.o
nvme-auth-y += auth.o
nvme-keyring-y += keyring.o
+
+obj-$(CONFIG_NVME_AUTH_KUNIT_TEST) += tests/auth_kunit.o
diff --git a/drivers/nvme/common/tests/auth_kunit.c b/drivers/nvme/common/tests/auth_kunit.c
new file mode 100644
index 0000000000000..28b8dd1e3b186
--- /dev/null
+++ b/drivers/nvme/common/tests/auth_kunit.c
@@ -0,0 +1,175 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Unit tests for NVMe authentication functions
+ *
+ * Copyright 2026 Google LLC
+ */
+
+#include <crypto/sha2.h>
+#include <kunit/test.h>
+#include <linux/nvme.h>
+#include <linux/nvme-auth.h>
+#include <linux/slab.h>
+
+struct nvme_auth_test_values {
+ u8 hmac_id;
+ size_t hash_len;
+ u8 expected_psk[NVME_AUTH_MAX_DIGEST_SIZE];
+ char *expected_psk_digest;
+ u8 expected_tls_psk[NVME_AUTH_MAX_DIGEST_SIZE];
+};
+
+static void kfree_action(void *ptr)
+{
+ kfree(ptr);
+}
+
+static void kunit_add_kfree_action(struct kunit *test, void *ptr)
+{
+ KUNIT_ASSERT_EQ(test, 0,
+ kunit_add_action_or_reset(test, kfree_action, ptr));
+}
+
+/*
+ * Test the derivation of a TLS PSK from the initial skey. The vals parameter
+ * gives the expected value of tls_psk as well as the intermediate values psk
+ * and psk_digest. The inputs are implicitly the fixed values set below.
+ */
+static void
+test_nvme_auth_derive_tls_psk(struct kunit *test,
+ const struct nvme_auth_test_values *vals)
+{
+ const u8 hmac_id = vals->hmac_id;
+ const size_t hash_len = vals->hash_len;
+ const size_t skey_len = hash_len;
+ u8 skey[NVME_AUTH_MAX_DIGEST_SIZE];
+ u8 c1[NVME_AUTH_MAX_DIGEST_SIZE];
+ u8 c2[NVME_AUTH_MAX_DIGEST_SIZE];
+ const char *subsysnqn = "subsysnqn";
+ const char *hostnqn = "hostnqn";
+ u8 *psk = NULL, *tls_psk = NULL;
+ char *psk_digest = NULL;
+ size_t psk_len;
+ int ret;
+
+ for (int i = 0; i < NVME_AUTH_MAX_DIGEST_SIZE; i++) {
+ skey[i] = 'A' + i;
+ c1[i] = i;
+ c2[i] = 0xff - i;
+ }
+
+ ret = nvme_auth_generate_psk(hmac_id, skey, skey_len, c1, c2, hash_len,
+ &psk, &psk_len);
+ kunit_add_kfree_action(test, psk);
+ KUNIT_ASSERT_EQ(test, 0, ret);
+ KUNIT_ASSERT_EQ(test, hash_len, psk_len);
+ KUNIT_ASSERT_MEMEQ(test, vals->expected_psk, psk, psk_len);
+
+ ret = nvme_auth_generate_digest(hmac_id, psk, psk_len, subsysnqn,
+ hostnqn, &psk_digest);
+ kunit_add_kfree_action(test, psk_digest);
+ if (vals->expected_psk_digest == NULL) {
+ /*
+ * Algorithm has an ID assigned but is not supported by
+ * nvme_auth_generate_digest().
+ */
+ KUNIT_ASSERT_EQ(test, -EINVAL, ret);
+ return;
+ }
+ KUNIT_ASSERT_EQ(test, 0, ret);
+ KUNIT_ASSERT_STREQ(test, vals->expected_psk_digest, psk_digest);
+
+ ret = nvme_auth_derive_tls_psk(hmac_id, psk, psk_len, psk_digest,
+ &tls_psk);
+ kunit_add_kfree_action(test, tls_psk);
+ KUNIT_ASSERT_EQ(test, 0, ret);
+ KUNIT_ASSERT_MEMEQ(test, vals->expected_tls_psk, tls_psk, psk_len);
+}
+
+static void test_nvme_auth_derive_tls_psk_hmac_sha256(struct kunit *test)
+{
+ static const struct nvme_auth_test_values vals = {
+ .hmac_id = NVME_AUTH_HASH_SHA256,
+ .hash_len = SHA256_DIGEST_SIZE,
+ .expected_psk = {
+ 0x17, 0x33, 0xc5, 0x9f, 0xa7, 0xf4, 0x8f, 0xcf,
+ 0x37, 0xf5, 0xf2, 0x6f, 0xc4, 0xff, 0x02, 0x68,
+ 0xad, 0x4f, 0x78, 0xe0, 0x30, 0xf4, 0xf3, 0xb0,
+ 0xbf, 0xd1, 0xd4, 0x7e, 0x7b, 0xb1, 0x44, 0x7a,
+ },
+ .expected_psk_digest = "OldoKuTfKddMuyCznAZojkWD7P4D9/AtzDzLimtOxqI=",
+ .expected_tls_psk = {
+ 0x3c, 0x17, 0xda, 0x62, 0x84, 0x74, 0xa0, 0x4d,
+ 0x22, 0x47, 0xc4, 0xca, 0xb4, 0x79, 0x68, 0xc9,
+ 0x15, 0x38, 0x81, 0x93, 0xf7, 0xc0, 0x71, 0xbd,
+ 0x94, 0x89, 0xcc, 0x36, 0x66, 0xcd, 0x7c, 0xc8,
+ },
+ };
+
+ test_nvme_auth_derive_tls_psk(test, &vals);
+}
+
+static void test_nvme_auth_derive_tls_psk_hmac_sha384(struct kunit *test)
+{
+ static const struct nvme_auth_test_values vals = {
+ .hmac_id = NVME_AUTH_HASH_SHA384,
+ .hash_len = SHA384_DIGEST_SIZE,
+ .expected_psk = {
+ 0xf1, 0x4b, 0x2d, 0xd3, 0x23, 0x4c, 0x45, 0x96,
+ 0x94, 0xd3, 0xbc, 0x63, 0xf8, 0x96, 0x8b, 0xd6,
+ 0xb3, 0x7c, 0x2c, 0x6d, 0xe8, 0x49, 0xe2, 0x2e,
+ 0x11, 0x87, 0x49, 0x00, 0x1c, 0xe4, 0xbb, 0xe8,
+ 0x64, 0x0b, 0x9e, 0x3a, 0x74, 0x8c, 0xb1, 0x1c,
+ 0xe4, 0xb1, 0xd7, 0x1d, 0x35, 0x9c, 0xce, 0x39,
+ },
+ .expected_psk_digest = "cffMWk8TSS7HOQebjgYEIkrPrjWPV4JE5cdPB8WhEvY4JBW5YynKyv66XscN4A9n",
+ .expected_tls_psk = {
+ 0x27, 0x74, 0x75, 0x32, 0x33, 0x53, 0x7b, 0x3f,
+ 0xa5, 0x0e, 0xb7, 0xd1, 0x6a, 0x8e, 0x43, 0x45,
+ 0x7d, 0x85, 0xf4, 0x90, 0x6c, 0x00, 0x5b, 0x22,
+ 0x36, 0x61, 0x6c, 0x5d, 0x80, 0x93, 0x9d, 0x08,
+ 0x98, 0xff, 0xf1, 0x5b, 0xb8, 0xb7, 0x71, 0x19,
+ 0xd2, 0xbe, 0x0a, 0xac, 0x42, 0x3e, 0x75, 0x90,
+ },
+ };
+
+ test_nvme_auth_derive_tls_psk(test, &vals);
+}
+
+static void test_nvme_auth_derive_tls_psk_hmac_sha512(struct kunit *test)
+{
+ static const struct nvme_auth_test_values vals = {
+ .hmac_id = NVME_AUTH_HASH_SHA512,
+ .hash_len = SHA512_DIGEST_SIZE,
+ .expected_psk = {
+ 0x9c, 0x9f, 0x08, 0x9a, 0x61, 0x8b, 0x47, 0xd2,
+ 0xd7, 0x5f, 0x4b, 0x6c, 0x28, 0x07, 0x04, 0x24,
+ 0x48, 0x7b, 0x44, 0x5d, 0xd9, 0x6e, 0x70, 0xc4,
+ 0xc0, 0x9b, 0x55, 0xe8, 0xb6, 0x00, 0x01, 0x52,
+ 0xa3, 0x36, 0x3c, 0x34, 0x54, 0x04, 0x3f, 0x38,
+ 0xf0, 0xb8, 0x50, 0x36, 0xde, 0xd4, 0x06, 0x55,
+ 0x35, 0x0a, 0xa8, 0x7b, 0x8b, 0x6a, 0x28, 0x2b,
+ 0x5c, 0x1a, 0xca, 0xe1, 0x62, 0x33, 0xdd, 0x5b,
+ },
+ /* nvme_auth_generate_digest() doesn't support SHA-512 yet. */
+ .expected_psk_digest = NULL,
+ };
+
+ test_nvme_auth_derive_tls_psk(test, &vals);
+}
+
+static struct kunit_case nvme_auth_test_cases[] = {
+ KUNIT_CASE(test_nvme_auth_derive_tls_psk_hmac_sha256),
+ KUNIT_CASE(test_nvme_auth_derive_tls_psk_hmac_sha384),
+ KUNIT_CASE(test_nvme_auth_derive_tls_psk_hmac_sha512),
+ {},
+};
+
+static struct kunit_suite nvme_auth_test_suite = {
+ .name = "nvme-auth",
+ .test_cases = nvme_auth_test_cases,
+};
+kunit_test_suite(nvme_auth_test_suite);
+
+MODULE_DESCRIPTION("Unit tests for NVMe authentication functions");
+MODULE_LICENSE("GPL");
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 233/990] nvme-auth: common: add HMAC helper functions
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (231 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 232/990] nvme-auth: common: add KUnit tests for TLS key derivation Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 234/990] nvme-auth: common: use crypto library in nvme_auth_augmented_challenge() Greg Kroah-Hartman
` (619 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ard Biesheuvel, Christoph Hellwig,
Hannes Reinecke, Eric Biggers, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
[ Upstream commit 4263ca1cae5cebc09ba95375c4a8927bf4b39d49 ]
Add some helper functions for computing HMAC-SHA256, HMAC-SHA384, or
HMAC-SHA512 values using the crypto library instead of crypto_shash.
These will enable some significant simplifications and performance
improvements in nvme-auth.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/common/Kconfig | 2 ++
drivers/nvme/common/auth.c | 66 +++++++++++++++++++++++++++++++++++++
include/linux/nvme-auth.h | 14 ++++++++
3 files changed, 82 insertions(+)
diff --git a/drivers/nvme/common/Kconfig b/drivers/nvme/common/Kconfig
index d19988c13af5f..1ec507d1f9b5f 100644
--- a/drivers/nvme/common/Kconfig
+++ b/drivers/nvme/common/Kconfig
@@ -13,6 +13,8 @@ config NVME_AUTH
select CRYPTO_DH
select CRYPTO_DH_RFC7919_GROUPS
select CRYPTO_HKDF
+ select CRYPTO_LIB_SHA256
+ select CRYPTO_LIB_SHA512
config NVME_AUTH_KUNIT_TEST
tristate "KUnit tests for NVMe authentication" if !KUNIT_ALL_TESTS
diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index 854711bff7f9a..a8e205b0411bf 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -12,6 +12,7 @@
#include <crypto/hash.h>
#include <crypto/dh.h>
#include <crypto/hkdf.h>
+#include <crypto/sha2.h>
#include <linux/nvme.h>
#include <linux/nvme-auth.h>
@@ -234,6 +235,71 @@ void nvme_auth_free_key(struct nvme_dhchap_key *key)
}
EXPORT_SYMBOL_GPL(nvme_auth_free_key);
+/*
+ * Start computing an HMAC value, given the algorithm ID and raw key.
+ *
+ * The context should be zeroized at the end of its lifetime. The caller can do
+ * that implicitly by calling nvme_auth_hmac_final(), or explicitly (needed when
+ * a context is abandoned without finalizing it) by calling memzero_explicit().
+ */
+int nvme_auth_hmac_init(struct nvme_auth_hmac_ctx *hmac, u8 hmac_id,
+ const u8 *key, size_t key_len)
+{
+ hmac->hmac_id = hmac_id;
+ switch (hmac_id) {
+ case NVME_AUTH_HASH_SHA256:
+ hmac_sha256_init_usingrawkey(&hmac->sha256, key, key_len);
+ return 0;
+ case NVME_AUTH_HASH_SHA384:
+ hmac_sha384_init_usingrawkey(&hmac->sha384, key, key_len);
+ return 0;
+ case NVME_AUTH_HASH_SHA512:
+ hmac_sha512_init_usingrawkey(&hmac->sha512, key, key_len);
+ return 0;
+ }
+ pr_warn("%s: invalid hash algorithm %d\n", __func__, hmac_id);
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(nvme_auth_hmac_init);
+
+void nvme_auth_hmac_update(struct nvme_auth_hmac_ctx *hmac, const u8 *data,
+ size_t data_len)
+{
+ switch (hmac->hmac_id) {
+ case NVME_AUTH_HASH_SHA256:
+ hmac_sha256_update(&hmac->sha256, data, data_len);
+ return;
+ case NVME_AUTH_HASH_SHA384:
+ hmac_sha384_update(&hmac->sha384, data, data_len);
+ return;
+ case NVME_AUTH_HASH_SHA512:
+ hmac_sha512_update(&hmac->sha512, data, data_len);
+ return;
+ }
+ /* Unreachable because nvme_auth_hmac_init() validated hmac_id */
+ WARN_ON_ONCE(1);
+}
+EXPORT_SYMBOL_GPL(nvme_auth_hmac_update);
+
+/* Finish computing an HMAC value. Note that this zeroizes the HMAC context. */
+void nvme_auth_hmac_final(struct nvme_auth_hmac_ctx *hmac, u8 *out)
+{
+ switch (hmac->hmac_id) {
+ case NVME_AUTH_HASH_SHA256:
+ hmac_sha256_final(&hmac->sha256, out);
+ return;
+ case NVME_AUTH_HASH_SHA384:
+ hmac_sha384_final(&hmac->sha384, out);
+ return;
+ case NVME_AUTH_HASH_SHA512:
+ hmac_sha512_final(&hmac->sha512, out);
+ return;
+ }
+ /* Unreachable because nvme_auth_hmac_init() validated hmac_id */
+ WARN_ON_ONCE(1);
+}
+EXPORT_SYMBOL_GPL(nvme_auth_hmac_final);
+
struct nvme_dhchap_key *nvme_auth_transform_key(
const struct nvme_dhchap_key *key, const char *nqn)
{
diff --git a/include/linux/nvme-auth.h b/include/linux/nvme-auth.h
index a4b248c24ccf6..4f9a6599077cc 100644
--- a/include/linux/nvme-auth.h
+++ b/include/linux/nvme-auth.h
@@ -7,6 +7,7 @@
#define _NVME_AUTH_H
#include <crypto/kpp.h>
+#include <crypto/sha2.h>
struct nvme_dhchap_key {
size_t len;
@@ -23,6 +24,19 @@ const char *nvme_auth_hmac_name(u8 hmac_id);
const char *nvme_auth_digest_name(u8 hmac_id);
size_t nvme_auth_hmac_hash_len(u8 hmac_id);
u8 nvme_auth_hmac_id(const char *hmac_name);
+struct nvme_auth_hmac_ctx {
+ u8 hmac_id;
+ union {
+ struct hmac_sha256_ctx sha256;
+ struct hmac_sha384_ctx sha384;
+ struct hmac_sha512_ctx sha512;
+ };
+};
+int nvme_auth_hmac_init(struct nvme_auth_hmac_ctx *hmac, u8 hmac_id,
+ const u8 *key, size_t key_len);
+void nvme_auth_hmac_update(struct nvme_auth_hmac_ctx *hmac, const u8 *data,
+ size_t data_len);
+void nvme_auth_hmac_final(struct nvme_auth_hmac_ctx *hmac, u8 *out);
u32 nvme_auth_key_struct_size(u32 key_len);
struct nvme_dhchap_key *nvme_auth_extract_key(const char *secret, u8 key_hash);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 234/990] nvme-auth: common: use crypto library in nvme_auth_augmented_challenge()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (232 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 233/990] nvme-auth: common: add HMAC helper functions Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 235/990] nvme-auth: Hash DH shared secret to create session key Greg Kroah-Hartman
` (618 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ard Biesheuvel, Christoph Hellwig,
Hannes Reinecke, Eric Biggers, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
[ Upstream commit a67d096fe9761e3e503f40643228bca6d69c7c4e ]
For the hash and HMAC computations in nvme_auth_augmented_challenge(),
use the crypto library instead of crypto_shash. This is simpler,
faster, and more reliable. Notably, this eliminates two crypto
transformation object allocations for every call, which was very slow.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/common/auth.c | 96 ++++++++++++++------------------------
1 file changed, 36 insertions(+), 60 deletions(-)
diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index a8e205b0411bf..28e3de1584611 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -300,6 +300,37 @@ void nvme_auth_hmac_final(struct nvme_auth_hmac_ctx *hmac, u8 *out)
}
EXPORT_SYMBOL_GPL(nvme_auth_hmac_final);
+static int nvme_auth_hmac(u8 hmac_id, const u8 *key, size_t key_len,
+ const u8 *data, size_t data_len, u8 *out)
+{
+ struct nvme_auth_hmac_ctx hmac;
+ int ret;
+
+ ret = nvme_auth_hmac_init(&hmac, hmac_id, key, key_len);
+ if (ret == 0) {
+ nvme_auth_hmac_update(&hmac, data, data_len);
+ nvme_auth_hmac_final(&hmac, out);
+ }
+ return ret;
+}
+
+static int nvme_auth_hash(u8 hmac_id, const u8 *data, size_t data_len, u8 *out)
+{
+ switch (hmac_id) {
+ case NVME_AUTH_HASH_SHA256:
+ sha256(data, data_len, out);
+ return 0;
+ case NVME_AUTH_HASH_SHA384:
+ sha384(data, data_len, out);
+ return 0;
+ case NVME_AUTH_HASH_SHA512:
+ sha512(data, data_len, out);
+ return 0;
+ }
+ pr_warn("%s: invalid hash algorithm %d\n", __func__, hmac_id);
+ return -EINVAL;
+}
+
struct nvme_dhchap_key *nvme_auth_transform_key(
const struct nvme_dhchap_key *key, const char *nqn)
{
@@ -367,72 +398,17 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
}
EXPORT_SYMBOL_GPL(nvme_auth_transform_key);
-static int nvme_auth_hash_skey(int hmac_id, const u8 *skey, size_t skey_len,
- u8 *hkey)
-{
- const char *digest_name;
- struct crypto_shash *tfm;
- int ret;
-
- digest_name = nvme_auth_digest_name(hmac_id);
- if (!digest_name) {
- pr_debug("%s: failed to get digest for %d\n", __func__,
- hmac_id);
- return -EINVAL;
- }
- tfm = crypto_alloc_shash(digest_name, 0, 0);
- if (IS_ERR(tfm))
- return -ENOMEM;
-
- ret = crypto_shash_tfm_digest(tfm, skey, skey_len, hkey);
- if (ret < 0)
- pr_debug("%s: Failed to hash digest len %zu\n", __func__,
- skey_len);
-
- crypto_free_shash(tfm);
- return ret;
-}
-
int nvme_auth_augmented_challenge(u8 hmac_id, const u8 *skey, size_t skey_len,
const u8 *challenge, u8 *aug, size_t hlen)
{
- struct crypto_shash *tfm;
- u8 *hashed_key;
- const char *hmac_name;
+ u8 hashed_key[NVME_AUTH_MAX_DIGEST_SIZE];
int ret;
- hashed_key = kmalloc(hlen, GFP_KERNEL);
- if (!hashed_key)
- return -ENOMEM;
-
- ret = nvme_auth_hash_skey(hmac_id, skey,
- skey_len, hashed_key);
- if (ret < 0)
- goto out_free_key;
-
- hmac_name = nvme_auth_hmac_name(hmac_id);
- if (!hmac_name) {
- pr_warn("%s: invalid hash algorithm %d\n",
- __func__, hmac_id);
- ret = -EINVAL;
- goto out_free_key;
- }
-
- tfm = crypto_alloc_shash(hmac_name, 0, 0);
- if (IS_ERR(tfm)) {
- ret = PTR_ERR(tfm);
- goto out_free_key;
- }
-
- ret = crypto_shash_setkey(tfm, hashed_key, hlen);
+ ret = nvme_auth_hash(hmac_id, skey, skey_len, hashed_key);
if (ret)
- goto out_free_hash;
-
- ret = crypto_shash_tfm_digest(tfm, challenge, hlen, aug);
-out_free_hash:
- crypto_free_shash(tfm);
-out_free_key:
- kfree_sensitive(hashed_key);
+ return ret;
+ ret = nvme_auth_hmac(hmac_id, hashed_key, hlen, challenge, hlen, aug);
+ memzero_explicit(hashed_key, sizeof(hashed_key));
return ret;
}
EXPORT_SYMBOL_GPL(nvme_auth_augmented_challenge);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 235/990] nvme-auth: Hash DH shared secret to create session key
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (233 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 234/990] nvme-auth: common: use crypto library in nvme_auth_augmented_challenge() Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 236/990] nvmet-auth: Do not print DH-HMAC-CHAP secrets Greg Kroah-Hartman
` (617 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hannes Reinecke, Eric Biggers,
Chris Leech, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Leech <cleech@redhat.com>
[ Upstream commit bd7b7ce96db4487bb77692a85ee4489fd2c395df ]
The NVMe Base Specification 8.3.5.5.9 states that the session key Ks
shall be computed from the ephemeral DH key by applying the hash
function selected by the HashID parameter.
The current implementation stores the raw DH shared secret as the
session key without hashing it. This causes redundant hash operations:
1. Augmented challenge computation (section 8.3.5.5.4) requires
Ca = HMAC(H(g^xy mod p), C). The code compensates by hashing the
unhashed session key in nvme_auth_augmented_challenge() to produce
the correct result.
2. PSK generation (section 8.3.5.5.9) requires PSK = HMAC(Ks, C1 || C2)
where Ks should already be H(g^xy mod p). As the DH shared secret
is always larger than the HMAC block size, HMAC internally hashes
it before use, accidentally producing the correct result.
When using secure channel concatenation with bidirectional
authentication, this results in hashing the DH value three times: twice
for augmented challenge calculations and once during PSK generation.
Fix this by:
- Modifying nvme_auth_gen_shared_secret() to hash the DH shared secret
once after computation: Ks = H(g^xy mod p)
- Removing the hash operation from nvme_auth_augmented_challenge()
as the session key is now already hashed
- Updating session key buffer size from DH key size to hash output size
- Adding specification references in comments
This avoid storing the raw DH shared secret and reduces the number of
hash operations from three to one when using secure channel
concatenation.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/common/auth.c | 94 ++++++++++++++++++++++++++++++--------
drivers/nvme/host/auth.c | 13 +++---
drivers/nvme/target/auth.c | 15 +++---
include/linux/nvme-auth.h | 6 +--
4 files changed, 92 insertions(+), 36 deletions(-)
diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index 28e3de1584611..1fdceba737f7d 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -398,18 +398,29 @@ struct nvme_dhchap_key *nvme_auth_transform_key(
}
EXPORT_SYMBOL_GPL(nvme_auth_transform_key);
+/**
+ * nvme_auth_augmented_challenge() - Compute the augmented DH-HMAC-CHAP challenge
+ * @hmac_id: Hash algorithm identifier
+ * @skey: Session key
+ * @skey_len: Length of @skey
+ * @challenge: Challenge value
+ * @aug: Output buffer for the augmented challenge
+ * @hlen: Hash output length (length of @challenge and @aug)
+ *
+ * NVMe base specification 8.3.5.5.4: The augmented challenge is computed
+ * applying the HMAC function using the hash function H() selected by the
+ * HashID parameter ... with the hash of the ephemeral DH key ... as HMAC key
+ * to the challenge C (i.e., Ca = HMAC(H(g^xy mod p), C)).
+ *
+ * As the session key skey is already H(g^xy mod p) per section 8.3.5.5.9, use
+ * it directly as the HMAC key without additional hashing.
+ *
+ * Return: 0 on success, negative errno on failure.
+ */
int nvme_auth_augmented_challenge(u8 hmac_id, const u8 *skey, size_t skey_len,
const u8 *challenge, u8 *aug, size_t hlen)
{
- u8 hashed_key[NVME_AUTH_MAX_DIGEST_SIZE];
- int ret;
-
- ret = nvme_auth_hash(hmac_id, skey, skey_len, hashed_key);
- if (ret)
- return ret;
- ret = nvme_auth_hmac(hmac_id, hashed_key, hlen, challenge, hlen, aug);
- memzero_explicit(hashed_key, sizeof(hashed_key));
- return ret;
+ return nvme_auth_hmac(hmac_id, skey, skey_len, challenge, hlen, aug);
}
EXPORT_SYMBOL_GPL(nvme_auth_augmented_challenge);
@@ -450,33 +461,76 @@ int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
}
EXPORT_SYMBOL_GPL(nvme_auth_gen_pubkey);
-int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
- const u8 *ctrl_key, size_t ctrl_key_len,
- u8 *sess_key, size_t sess_key_len)
+/**
+ * nvme_auth_gen_session_key() - Generate an ephemeral session key
+ * @dh_tfm: Diffie-Hellman transform with local private key already set
+ * @public_key: Peer's public key
+ * @public_key_len: Length of @public_key
+ * @sess_key: Output buffer for the session key
+ * @sess_key_len: Size of @sess_key buffer
+ * @hash_id: Hash algorithm identifier
+ *
+ * NVMe base specification 8.3.5.5.9: The session key Ks shall be computed from
+ * the ephemeral DH key (i.e., g^xy mod p) ... by applying the hash function
+ * H() selected by the HashID parameter ... (i.e., Ks = H(g^xy mod p)).
+ *
+ * Return: 0 on success, negative errno on failure.
+ */
+int nvme_auth_gen_session_key(struct crypto_kpp *dh_tfm,
+ const u8 *public_key, size_t public_key_len,
+ u8 *sess_key, size_t sess_key_len, u8 hash_id)
{
struct kpp_request *req;
struct crypto_wait wait;
struct scatterlist src, dst;
+ u8 *dh_secret;
+ size_t dh_secret_len, hash_len;
int ret;
- req = kpp_request_alloc(dh_tfm, GFP_KERNEL);
- if (!req)
+ hash_len = nvme_auth_hmac_hash_len(hash_id);
+ if (!hash_len) {
+ pr_warn("%s: invalid hash algorithm %d\n", __func__, hash_id);
+ return -EINVAL;
+ }
+
+ if (sess_key_len != hash_len) {
+ pr_warn("%s: sess_key buffer missized (%zu != %zu)\n",
+ __func__, sess_key_len, hash_len);
+ return -EINVAL;
+ }
+
+ dh_secret_len = crypto_kpp_maxsize(dh_tfm);
+ dh_secret = kzalloc(dh_secret_len, GFP_KERNEL);
+ if (!dh_secret)
return -ENOMEM;
+ req = kpp_request_alloc(dh_tfm, GFP_KERNEL);
+ if (!req) {
+ ret = -ENOMEM;
+ goto out_free_secret;
+ }
+
crypto_init_wait(&wait);
- sg_init_one(&src, ctrl_key, ctrl_key_len);
- kpp_request_set_input(req, &src, ctrl_key_len);
- sg_init_one(&dst, sess_key, sess_key_len);
- kpp_request_set_output(req, &dst, sess_key_len);
+ sg_init_one(&src, public_key, public_key_len);
+ kpp_request_set_input(req, &src, public_key_len);
+ sg_init_one(&dst, dh_secret, dh_secret_len);
+ kpp_request_set_output(req, &dst, dh_secret_len);
kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
crypto_req_done, &wait);
ret = crypto_wait_req(crypto_kpp_compute_shared_secret(req), &wait);
-
kpp_request_free(req);
+
+ if (ret)
+ goto out_free_secret;
+
+ ret = nvme_auth_hash(hash_id, dh_secret, dh_secret_len, sess_key);
+
+out_free_secret:
+ kfree_sensitive(dh_secret);
return ret;
}
-EXPORT_SYMBOL_GPL(nvme_auth_gen_shared_secret);
+EXPORT_SYMBOL_GPL(nvme_auth_gen_session_key);
int nvme_auth_generate_key(const char *secret, struct nvme_dhchap_key **ret_key)
{
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index d0c3679acdc19..a64ca50e925fa 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -652,7 +652,7 @@ static int nvme_auth_dhchap_exponential(struct nvme_ctrl *ctrl,
}
gen_sesskey:
- chap->sess_key_len = chap->host_key_len;
+ chap->sess_key_len = chap->hash_len;
chap->sess_key = kmalloc(chap->sess_key_len, GFP_KERNEL);
if (!chap->sess_key) {
chap->sess_key_len = 0;
@@ -660,16 +660,17 @@ static int nvme_auth_dhchap_exponential(struct nvme_ctrl *ctrl,
return -ENOMEM;
}
- ret = nvme_auth_gen_shared_secret(chap->dh_tfm,
- chap->ctrl_key, chap->ctrl_key_len,
- chap->sess_key, chap->sess_key_len);
+ ret = nvme_auth_gen_session_key(chap->dh_tfm,
+ chap->ctrl_key, chap->ctrl_key_len,
+ chap->sess_key, chap->sess_key_len,
+ chap->hash_id);
if (ret) {
dev_dbg(ctrl->device,
- "failed to generate shared secret, error %d\n", ret);
+ "failed to generate session key, error %d\n", ret);
chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD;
return ret;
}
- dev_dbg(ctrl->device, "shared secret %*ph\n",
+ dev_dbg(ctrl->device, "session key %*ph\n",
(int)chap->sess_key_len, chap->sess_key);
return 0;
}
diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index 99f16b1a7e886..d36cb3c0fd11d 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -544,18 +544,19 @@ int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
struct nvmet_ctrl *ctrl = req->sq->ctrl;
int ret;
- req->sq->dhchap_skey_len = ctrl->dh_keysize;
+ req->sq->dhchap_skey_len = nvme_auth_hmac_hash_len(ctrl->shash_id);
req->sq->dhchap_skey = kzalloc(req->sq->dhchap_skey_len, GFP_KERNEL);
if (!req->sq->dhchap_skey)
return -ENOMEM;
- ret = nvme_auth_gen_shared_secret(ctrl->dh_tfm,
- pkey, pkey_size,
- req->sq->dhchap_skey,
- req->sq->dhchap_skey_len);
+ ret = nvme_auth_gen_session_key(ctrl->dh_tfm,
+ pkey, pkey_size,
+ req->sq->dhchap_skey,
+ req->sq->dhchap_skey_len,
+ ctrl->shash_id);
if (ret)
- pr_debug("failed to compute shared secret, err %d\n", ret);
+ pr_debug("failed to compute session key, err %d\n", ret);
else
- pr_debug("%s: shared secret %*ph\n", __func__,
+ pr_debug("%s: session key %*ph\n", __func__,
(int)req->sq->dhchap_skey_len,
req->sq->dhchap_skey);
diff --git a/include/linux/nvme-auth.h b/include/linux/nvme-auth.h
index 4f9a6599077cc..ef6d0b79e6a0e 100644
--- a/include/linux/nvme-auth.h
+++ b/include/linux/nvme-auth.h
@@ -50,9 +50,9 @@ int nvme_auth_augmented_challenge(u8 hmac_id, const u8 *skey, size_t skey_len,
int nvme_auth_gen_privkey(struct crypto_kpp *dh_tfm, u8 dh_gid);
int nvme_auth_gen_pubkey(struct crypto_kpp *dh_tfm,
u8 *host_key, size_t host_key_len);
-int nvme_auth_gen_shared_secret(struct crypto_kpp *dh_tfm,
- const u8 *ctrl_key, size_t ctrl_key_len,
- u8 *sess_key, size_t sess_key_len);
+int nvme_auth_gen_session_key(struct crypto_kpp *dh_tfm,
+ const u8 *public_key, size_t public_key_len,
+ u8 *sess_key, size_t sess_key_len, u8 hash_id);
int nvme_auth_generate_psk(u8 hmac_id, const u8 *skey, size_t skey_len,
const u8 *c1, const u8 *c2, size_t hash_len,
u8 **ret_psk, size_t *ret_len);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 236/990] nvmet-auth: Do not print DH-HMAC-CHAP secrets
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (234 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 235/990] nvme-auth: Hash DH shared secret to create session key Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 237/990] nvmet-auth: keep the old keys if the new ones fail Greg Kroah-Hartman
` (616 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sagi Grimberg, Hannes Reinecke,
Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <hare@kernel.org>
[ Upstream commit a891962ae5e48fb5476c23631df759482e62ab16 ]
>From a security standpoint we should not allow to print out the DH-HMAC-CHAP
secrets, but at the same time having them is useful for debugging
authentication failures.
So add a Kconfig option NVME_TARGET_AUTH_DEBUG to only enable debugging
if explictly requested at build time.
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 41ad4af45ac9 ("nvmet-auth: keep the old keys if the new ones fail")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/Kconfig | 9 +++++++++
drivers/nvme/target/auth.c | 13 ++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/nvme/target/Kconfig b/drivers/nvme/target/Kconfig
index 4904097dfd490..69bde270115e2 100644
--- a/drivers/nvme/target/Kconfig
+++ b/drivers/nvme/target/Kconfig
@@ -117,6 +117,15 @@ config NVME_TARGET_AUTH
If unsure, say N.
+config NVME_TARGET_AUTH_DEBUG
+ bool "NVMe over Fabrics In-band Authentication debug messages"
+ depends on NVME_TARGET_AUTH
+ help
+ This enables additional debug messages including the generated
+ DH-HMAC-CHAP secrets to help debugging authentication failures.
+
+ If unsure, say N.
+
config NVME_TARGET_PCI_EPF
tristate "NVMe PCI Endpoint Function target support"
depends on NVME_TARGET && PCI_ENDPOINT
diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index d36cb3c0fd11d..1cb821a18532f 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -154,7 +154,6 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
goto out_unlock;
list_for_each_entry(p, &ctrl->subsys->hosts, entry) {
- pr_debug("check %s\n", nvmet_host_name(p->host));
if (strcmp(nvmet_host_name(p->host), ctrl->hostnqn))
continue;
host = p->host;
@@ -199,11 +198,12 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
ctrl->host_key = NULL;
goto out_free_hash;
}
+#ifdef CONFIG_NVME_TARGET_AUTH_DEBUG
pr_debug("%s: using hash %s key %*ph\n", __func__,
ctrl->host_key->hash > 0 ?
nvme_auth_hmac_name(ctrl->host_key->hash) : "none",
(int)ctrl->host_key->len, ctrl->host_key->key);
-
+#endif
nvme_auth_free_key(ctrl->ctrl_key);
if (!host->dhchap_ctrl_secret) {
ctrl->ctrl_key = NULL;
@@ -217,11 +217,12 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
ctrl->ctrl_key = NULL;
goto out_free_hash;
}
+#ifdef CONFIG_NVME_TARGET_AUTH_DEBUG
pr_debug("%s: using ctrl hash %s key %*ph\n", __func__,
ctrl->ctrl_key->hash > 0 ?
nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none",
(int)ctrl->ctrl_key->len, ctrl->ctrl_key->key);
-
+#endif
out_free_hash:
if (ret) {
if (ctrl->host_key) {
@@ -355,7 +356,6 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
if (ret)
goto out;
}
-
pr_debug("ctrl %d qid %d host response seq %u transaction %d\n",
ctrl->cntlid, req->sq->qid, req->sq->dhchap_s1,
req->sq->dhchap_tid);
@@ -531,8 +531,10 @@ int nvmet_auth_ctrl_exponential(struct nvmet_req *req,
ret = -EINVAL;
} else {
memcpy(buf, ctrl->dh_key, buf_size);
+#ifdef CONFIG_NVME_TARGET_AUTH_DEBUG
pr_debug("%s: ctrl %d public key %*ph\n", __func__,
ctrl->cntlid, (int)buf_size, buf);
+#endif
}
return ret;
@@ -555,11 +557,12 @@ int nvmet_auth_ctrl_sesskey(struct nvmet_req *req,
ctrl->shash_id);
if (ret)
pr_debug("failed to compute session key, err %d\n", ret);
+#ifdef CONFIG_NVME_TARGET_AUTH_DEBUG
else
pr_debug("%s: session key %*ph\n", __func__,
(int)req->sq->dhchap_skey_len,
req->sq->dhchap_skey);
-
+#endif
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 237/990] nvmet-auth: keep the old keys if the new ones fail
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (235 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 236/990] nvmet-auth: Do not print DH-HMAC-CHAP secrets Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 238/990] nvmet-rdma: disconnect only established queues Greg Kroah-Hartman
` (615 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hannes Reinecke, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni, Hannes Reinecke, Josef Bacik,
Jens Axboe, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 41ad4af45ac90259c652135b24539a08a92a7491 ]
AUTH_Negotiate on the admin queue has nvmet_setup_auth() reload the
host's keys, and it frees the old host key first. If decoding the new
secret fails, or an allocation does, the controller is left without a
host key, which means no authentication at all: nvmet_check_auth_status()
passes everything and I/O queue Connects no longer ask for it. configfs
accepts any string starting with "DHHC-1:" and a digit, so one typo
while changing a secret opens the namespaces to any connected admin
queue.
Decode the new keys first and only then replace the old ones.
Fixes: db1312dd9548 ("nvmet: implement basic In-Band Authentication")
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/auth.c | 69 ++++++++++++++++----------------------
1 file changed, 28 insertions(+), 41 deletions(-)
diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c
index 1cb821a18532f..1ad1754a95516 100644
--- a/drivers/nvme/target/auth.c
+++ b/drivers/nvme/target/auth.c
@@ -145,6 +145,7 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
int ret = 0;
struct nvmet_host_link *p;
struct nvmet_host *host = NULL;
+ struct nvme_dhchap_key *host_key, *ctrl_key = NULL;
down_read(&nvmet_config_sem);
if (nvmet_is_disc_subsys(ctrl->subsys))
@@ -182,55 +183,41 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset)
goto out_unlock;
}
- if (host->dhchap_hash_id == ctrl->shash_id) {
- pr_debug("Re-use existing hash ID %d\n",
- ctrl->shash_id);
- } else {
- ctrl->shash_id = host->dhchap_hash_id;
- }
-
- /* Skip the 'DHHC-1:XX:' prefix */
- nvme_auth_free_key(ctrl->host_key);
- ctrl->host_key = nvme_auth_extract_key(host->dhchap_secret + 10,
- host->dhchap_key_hash);
- if (IS_ERR(ctrl->host_key)) {
+ /*
+ * Skip the 'DHHC-1:XX:' prefix. Keep the old keys until the new ones
+ * are there: a controller without a host key needs no authentication.
+ */
+ host_key = nvme_auth_extract_key(host->dhchap_secret + 10,
+ host->dhchap_key_hash);
+ if (IS_ERR(host_key)) {
ret = NVME_AUTH_DHCHAP_FAILURE_NOT_USABLE;
- ctrl->host_key = NULL;
- goto out_free_hash;
+ goto out_unlock;
}
+ if (host->dhchap_ctrl_secret) {
+ ctrl_key = nvme_auth_extract_key(host->dhchap_ctrl_secret + 10,
+ host->dhchap_ctrl_key_hash);
+ if (IS_ERR(ctrl_key)) {
+ nvme_auth_free_key(host_key);
+ ret = NVME_AUTH_DHCHAP_FAILURE_NOT_USABLE;
+ goto out_unlock;
+ }
+ }
+ nvme_auth_free_key(ctrl->host_key);
+ ctrl->host_key = host_key;
+ nvme_auth_free_key(ctrl->ctrl_key);
+ ctrl->ctrl_key = ctrl_key;
+ ctrl->shash_id = host->dhchap_hash_id;
#ifdef CONFIG_NVME_TARGET_AUTH_DEBUG
pr_debug("%s: using hash %s key %*ph\n", __func__,
ctrl->host_key->hash > 0 ?
nvme_auth_hmac_name(ctrl->host_key->hash) : "none",
(int)ctrl->host_key->len, ctrl->host_key->key);
+ if (ctrl->ctrl_key)
+ pr_debug("%s: using ctrl hash %s key %*ph\n", __func__,
+ ctrl->ctrl_key->hash > 0 ?
+ nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none",
+ (int)ctrl->ctrl_key->len, ctrl->ctrl_key->key);
#endif
- nvme_auth_free_key(ctrl->ctrl_key);
- if (!host->dhchap_ctrl_secret) {
- ctrl->ctrl_key = NULL;
- goto out_unlock;
- }
-
- ctrl->ctrl_key = nvme_auth_extract_key(host->dhchap_ctrl_secret + 10,
- host->dhchap_ctrl_key_hash);
- if (IS_ERR(ctrl->ctrl_key)) {
- ret = NVME_AUTH_DHCHAP_FAILURE_NOT_USABLE;
- ctrl->ctrl_key = NULL;
- goto out_free_hash;
- }
-#ifdef CONFIG_NVME_TARGET_AUTH_DEBUG
- pr_debug("%s: using ctrl hash %s key %*ph\n", __func__,
- ctrl->ctrl_key->hash > 0 ?
- nvme_auth_hmac_name(ctrl->ctrl_key->hash) : "none",
- (int)ctrl->ctrl_key->len, ctrl->ctrl_key->key);
-#endif
-out_free_hash:
- if (ret) {
- if (ctrl->host_key) {
- nvme_auth_free_key(ctrl->host_key);
- ctrl->host_key = NULL;
- }
- ctrl->shash_id = 0;
- }
out_unlock:
up_read(&nvmet_config_sem);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 238/990] nvmet-rdma: disconnect only established queues
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (236 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 237/990] nvmet-auth: keep the old keys if the new ones fail Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 239/990] nvmet-tcp: limit the connections accepted per work run Greg Kroah-Hartman
` (614 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 000a9f4492abad6008682b55571ddc31941963e3 ]
Over iWARP, rdma_disconnect() sleeps in iw_cm_disconnect() until the
ESTABLISHED event of the connection has been handled, and iw_cm handles
all events of all connections one at a time on iw_cm_wq.
nvmet_rdma_destroy_port_queues(), nvmet_rdma_remove_one() and
nvmet_rdma_delete_ctrl() walk the queue list with
nvmet_rdma_queue_mutex held and call rdma_disconnect() for each, while
nvmet_rdma_cm_handler() takes the same mutex. If the walk sleeps on a
queue whose ESTABLISHED is queued behind another queue's event, both
are stuck and iWARP connection handling is dead until reboot. A peer
sets that up by connecting in a loop, or over siw by asking for MPA
peer-to-peer mode and then staying silent, which delays ESTABLISHED
indefinitely.
Only call rdma_disconnect() for a queue in NVMET_RDMA_Q_LIVE, which the
handler sets when it gets ESTABLISHED. A queue that never got there is
left to the release work: ib_drain_qp() moves the QP to the error
state, which ends the connection, and rdma_destroy_id() tells the peer.
Over IB and RoCE the skipped call did nothing more than that.
Fixes: f1d4ef7d8883 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Fixes: fcf73a804c7d ("nvmet-rdma: fix use-after-free when a port is removed")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 20e574a4eac64..338933d15b38e 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1691,7 +1691,7 @@ static void nvmet_rdma_queue_established(struct nvmet_rdma_queue *queue)
static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
{
- bool disconnect = false;
+ bool disconnect = false, live = false;
unsigned long flags;
pr_debug("cm_id= %p queue->state= %d\n", queue->cm_id, queue->state);
@@ -1710,6 +1710,7 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
}
fallthrough;
case NVMET_RDMA_Q_LIVE:
+ live = queue->state == NVMET_RDMA_Q_LIVE;
queue->state = NVMET_RDMA_Q_DISCONNECTING;
disconnect = true;
break;
@@ -1719,7 +1720,17 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
spin_unlock_irqrestore(&queue->state_lock, flags);
if (disconnect) {
- rdma_disconnect(queue->cm_id);
+ /*
+ * Over iWARP rdma_disconnect() sleeps until the CM has handled
+ * the ESTABLISHED event of this connection. The CM handles the
+ * events of all connections one at a time, and our handler
+ * takes nvmet_rdma_queue_mutex, which callers of this function
+ * hold. So a queue that has not seen the event is left to the
+ * release work: ib_drain_qp() moves the queue pair to the error
+ * state, which ends the connection.
+ */
+ if (live)
+ rdma_disconnect(queue->cm_id);
queue_work(nvmet_wq, &queue->release_work);
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 239/990] nvmet-tcp: limit the connections accepted per work run
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (237 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 238/990] nvmet-rdma: disconnect only established queues Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 240/990] nvmet-rdma: take a device off the list last Greg Kroah-Hartman
` (613 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Hannes Reinecke, Josef Bacik, Jens Axboe,
Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit a029f1b2fb13e6ac6e1c2f27fba1d80b6e7cac51 ]
nvmet_tcp_accept_work() loops until there's nothing left to accept, and
anyone opening and closing connections fast enough keeps it running
indefinitely, since tearing down a dead connection takes long enough for
more to arrive. Whoever flushes nvmet_wq waits for it: removing any
other port of the target does in nvmet_port_release(), and so does
unloading the rdma and fc modules.
Accept a bounded number of connections per run and requeue the work. A
flush doesn't wait for work queued behind it.
Fixes: 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/tcp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index c059a671a1d59..72e928c38aa2a 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -102,6 +102,7 @@ MODULE_PARM_DESC(tls_handshake_timeout,
#define NVMET_TCP_RECV_BUDGET 8
#define NVMET_TCP_SEND_BUDGET 8
#define NVMET_TCP_IO_WORK_BUDGET 64
+#define NVMET_TCP_ACCEPT_BUDGET 16
enum nvmet_tcp_send_state {
NVMET_TCP_SEND_DATA_PDU,
@@ -2095,9 +2096,9 @@ static void nvmet_tcp_accept_work(struct work_struct *w)
struct nvmet_tcp_port *port =
container_of(w, struct nvmet_tcp_port, accept_work);
struct socket *newsock;
- int ret;
+ int ret, i;
- while (true) {
+ for (i = 0; i < NVMET_TCP_ACCEPT_BUDGET; i++) {
ret = kernel_accept(port->sock, &newsock, O_NONBLOCK);
if (ret < 0) {
if (ret != -EAGAIN)
@@ -2106,6 +2107,9 @@ static void nvmet_tcp_accept_work(struct work_struct *w)
}
nvmet_tcp_alloc_queue(port, newsock);
}
+
+ /* There may be more. Come to an end for those who flush nvmet_wq. */
+ queue_work(nvmet_wq, &port->accept_work);
}
static void nvmet_tcp_listen_data_ready(struct sock *sk)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 240/990] nvmet-rdma: take a device off the list last
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (238 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 239/990] nvmet-tcp: limit the connections accepted per work run Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 241/990] nvmet-rdma: queue the release work under the mutex Greg Kroah-Hartman
` (612 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 86ae3841aea4e29d7ac08d5614ca3823dc8dfbc9 ]
nvmet_rdma_remove_one() disconnects the queues of a device and flushes
nvmet-wq, but since commit a3dd7d0022c3 it returns right away if the
device isn't on device_list. nvmet_rdma_free_dev(), run by the release
work of the last queue, takes the device off that list first and frees
the SRQs and the PD afterwards. A device removal in between finds
nothing on the list, returns, and the RDMA core frees the device under
ib_dealloc_pd().
Free the SRQs and the PD first and unlist the device last, so the
remove callback finds it and its flush waits for the release work.
Fixes: a3dd7d0022c3 ("nvmet-rdma: Don't flush system_wq by default during remove_one")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 338933d15b38e..816ad550d1fc8 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1197,13 +1197,18 @@ static void nvmet_rdma_free_dev(struct kref *ref)
struct nvmet_rdma_device *ndev =
container_of(ref, struct nvmet_rdma_device, ref);
+ nvmet_rdma_destroy_srqs(ndev);
+ ib_dealloc_pd(ndev->pd);
+
+ /*
+ * Only delete from the device list once all RDMA resources are torn
+ * down because nvmet_rdma_remove_one waits for the release work only
+ * if the device still is on the list.
+ */
mutex_lock(&device_list_mutex);
list_del(&ndev->entry);
mutex_unlock(&device_list_mutex);
- nvmet_rdma_destroy_srqs(ndev);
- ib_dealloc_pd(ndev->pd);
-
kfree(ndev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 241/990] nvmet-rdma: queue the release work under the mutex
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (239 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 240/990] nvmet-rdma: take a device off the list last Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 242/990] nvmet-rdma: disconnect a queue on device removal Greg Kroah-Hartman
` (611 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 80095787f776967361cca76357f19e5445e0cd75 ]
nvmet_rdma_remove_one() takes the queue mutex, unlists each queue of
the device and queues its release work, then flushes nvmet-wq. So a
queue that still holds objects on the device must either be on the
list or have its release work queued. nvmet_rdma_queue_disconnect()
breaks that: it unlists the queue under the mutex, drops it, and only
then calls __nvmet_rdma_queue_disconnect() to queue the work. A device
removal in that window finds nothing to wait for, and the release work
then destroys the QP and CQ share on a freed device.
Queue the work before dropping the mutex, as nvmet_rdma_remove_one()
itself does. That's safe now that rdma_disconnect() no longer sleeps on
an iWARP event that needs the same mutex.
Fixes: f1d4ef7d8883 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 816ad550d1fc8..58fc89b22c98c 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1742,17 +1742,17 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
static void nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
{
- bool disconnect = false;
-
+ /*
+ * Queue the release work with &nvmet_rdma_queue_mutex held, so that
+ * nvmet_rdma_remove_one() either finds the queue on the list or the
+ * work has already been queued.
+ */
mutex_lock(&nvmet_rdma_queue_mutex);
if (!list_empty(&queue->queue_list)) {
list_del_init(&queue->queue_list);
- disconnect = true;
+ __nvmet_rdma_queue_disconnect(queue);
}
mutex_unlock(&nvmet_rdma_queue_mutex);
-
- if (disconnect)
- __nvmet_rdma_queue_disconnect(queue);
}
static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 242/990] nvmet-rdma: disconnect a queue on device removal
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (240 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 241/990] nvmet-rdma: queue the release work under the mutex Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 243/990] ASoC: rockchip_i2s: select REGMAP_MMIO Greg Kroah-Hartman
` (610 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, Chris Mason, Jens Axboe, Keith Busch,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit a4387799d4228866dc1746b466cd17e1c638d050 ]
cma_remove_one() sends DEVICE_REMOVAL to the owner of every cm_id on
the device and then waits, without timeout, until they're all
destroyed. nvmet_rdma_device_removal() does nothing for a queue cm_id
and leaves the queues to nvmet_rdma_remove_one(), which only works if
that runs first. As a module it does, nvmet-rdma registers after
rdma_cm. Built in, both register at the same initcall level and
drivers/Makefile lists nvme/ ahead of infiniband/, so cma_remove_one()
runs first and waits for cm_ids that only the later callback would
destroy. Since the RDMA CM drops all later events for a cm_id once it
has sent DEVICE_REMOVAL, a peer closing its connection doesn't help
either. One connection from anyone who can reach the port hangs "rdma
link delete" until something else ends the queue.
Call nvmet_rdma_queue_disconnect() for the queue. It unlists the queue
and queues the release work, which destroys the cm_id. Don't wait for
it, rdma_destroy_id() waits for the handler to return, which was the
deadlock before commit f1d4ef7d8883.
Fixes: f1d4ef7d8883 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/target/rdma.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 58fc89b22c98c..7cbba255de206 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1779,10 +1779,13 @@ static void nvmet_rdma_queue_connect_fail(struct rdma_cm_id *cm_id,
* queue cm_id and/or a device bound listener cm_id (where in this
* case queue will be null).
*
- * We registered an ib_client to handle device removal for queues,
- * so we only need to handle the listening port cm_ids. In this case
- * we nullify the priv to prevent double cm_id destruction and destroying
- * the cm_id implicitly by returning a non-zero rc to the callout.
+ * The RDMA CM waits until each cm_id of the device is destroyed, so a queue
+ * has to go now. Our ib_client also removes the queues, but it cannot be
+ * relied on here: built in, it is called after the RDMA CM's client.
+ *
+ * For a listening port cm_id we nullify the priv to prevent double cm_id
+ * destruction and destroying the cm_id implicitly by returning a non-zero
+ * rc to the callout.
*/
static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
struct nvmet_rdma_queue *queue)
@@ -1790,11 +1793,7 @@ static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,
struct nvmet_rdma_port *port;
if (queue) {
- /*
- * This is a queue cm_id. we have registered
- * an ib_client to handle queues removal
- * so don't interfere and just return.
- */
+ nvmet_rdma_queue_disconnect(queue);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 243/990] ASoC: rockchip_i2s: select REGMAP_MMIO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (241 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 242/990] nvmet-rdma: disconnect a queue on device removal Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 244/990] ASoC: rockchip_i2s_tdm: " Greg Kroah-Hartman
` (609 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit 1c57404bf9bad3e05d5686d91c208bf4e2b733d8 ]
rockchip_i2s calls __devm_regmap_init_mmio_clk, which
drivers/base/regmap/regmap-mmio.c provides under REGMAP_MMIO.
rockchip_i2s.c:(.text+0x418): undefined reference to
`__devm_regmap_init_mmio_clk'
The driver can be built into vmlinux while REGMAP_MMIO is a module, in
which case the symbol is not there at link time.
Select rather than depend on: REGMAP_MMIO has no prompt of its own and is
only ever enabled by a select, so a depends on would leave
SND_SOC_ROCKCHIP_I2S unselectable.
Reproduced on v7.3, x86_64, with CONFIG_SND_SOC_ROCKCHIP_I2S=y and
CONFIG_REGMAP_MMIO=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: 4495c89fcf26 ("ASoC: add driver for Rockchip RK3xxx I2S controller")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261103132537.3717496-2-jude.gyimah87@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index bd210fafe9fea..e09325aaba534 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -5,6 +5,7 @@ menu "Rockchip"
config SND_SOC_ROCKCHIP_I2S
tristate "Rockchip I2S Device Driver"
+ select REGMAP_MMIO
select SND_SOC_GENERIC_DMAENGINE_PCM
help
Say Y or M if you want to add support for I2S driver for
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 244/990] ASoC: rockchip_i2s_tdm: select REGMAP_MMIO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (242 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 243/990] ASoC: rockchip_i2s: select REGMAP_MMIO Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 245/990] ASoC: rockchip_pdm: " Greg Kroah-Hartman
` (608 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit b8284f2b73f8de157be52b48d9968645f4ad6f7c ]
rockchip_i2s_tdm calls __devm_regmap_init_mmio_clk, which
drivers/base/regmap/regmap-mmio.c provides under REGMAP_MMIO.
rockchip_i2s_tdm.c:1304:(.text+0x14b1b6): undefined reference to
`__devm_regmap_init_mmio_clk'
The driver can be built into vmlinux while REGMAP_MMIO is a module, in
which case the symbol is not there at link time.
Select rather than depend on: REGMAP_MMIO has no prompt of its own and is
only ever enabled by a select, so a depends on would leave
SND_SOC_ROCKCHIP_I2S_TDM unselectable.
Reproduced on v7.3, x86_64, with CONFIG_SND_SOC_ROCKCHIP_I2S_TDM=y and
CONFIG_REGMAP_MMIO=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: 081068fd6414 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261103132537.3717496-3-jude.gyimah87@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index e09325aaba534..4df880cc4b319 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -14,6 +14,7 @@ config SND_SOC_ROCKCHIP_I2S
config SND_SOC_ROCKCHIP_I2S_TDM
tristate "Rockchip I2S/TDM Device Driver"
+ select REGMAP_MMIO
select SND_SOC_GENERIC_DMAENGINE_PCM
help
Say Y or M if you want to add support for the I2S/TDM driver for
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 245/990] ASoC: rockchip_pdm: select REGMAP_MMIO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (243 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 244/990] ASoC: rockchip_i2s_tdm: " Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 246/990] ASoC: rockchip_sai: " Greg Kroah-Hartman
` (607 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit 420c7918a61b97b8cd99e402e7e5a857edb097ee ]
rockchip_pdm calls __devm_regmap_init_mmio_clk, which
drivers/base/regmap/regmap-mmio.c provides under REGMAP_MMIO.
rockchip_pdm.c:(.text+0xef4): undefined reference to
`__devm_regmap_init_mmio_clk'
The driver can be built into vmlinux while REGMAP_MMIO is a module, in
which case the symbol is not there at link time.
Select rather than depend on: REGMAP_MMIO has no prompt of its own and is
only ever enabled by a select, so a depends on would leave
SND_SOC_ROCKCHIP_PDM unselectable.
Reproduced on v7.3, x86_64, with CONFIG_SND_SOC_ROCKCHIP_PDM=y and
CONFIG_REGMAP_MMIO=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: fc05a5b22253 ("ASoC: rockchip: add support for pdm controller")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261103132537.3717496-4-jude.gyimah87@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index 4df880cc4b319..e96d1a95bb10c 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -25,6 +25,7 @@ config SND_SOC_ROCKCHIP_I2S_TDM
config SND_SOC_ROCKCHIP_PDM
tristate "Rockchip PDM Controller Driver"
+ select REGMAP_MMIO
select SND_SOC_GENERIC_DMAENGINE_PCM
select RATIONAL
help
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 246/990] ASoC: rockchip_sai: select REGMAP_MMIO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (244 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 245/990] ASoC: rockchip_pdm: " Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 247/990] ASoC: rockchip: spdif: Add support for set mclk rate Greg Kroah-Hartman
` (606 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit 829904994e7a54fa89cf550e50dbcd58a09602eb ]
rockchip_sai calls __devm_regmap_init_mmio_clk, which
drivers/base/regmap/regmap-mmio.c provides under REGMAP_MMIO.
rockchip_sai.c:1424:(.text+0x153060): undefined reference to
`__devm_regmap_init_mmio_clk'
The driver can be built into vmlinux while REGMAP_MMIO is a module, in
which case the symbol is not there at link time.
Select rather than depend on: REGMAP_MMIO has no prompt of its own and is
only ever enabled by a select, so a depends on would leave
SND_SOC_ROCKCHIP_SAI unselectable.
Reproduced on v7.3, x86_64, with CONFIG_SND_SOC_ROCKCHIP_SAI=y and
CONFIG_REGMAP_MMIO=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: cc78d1eaabad ("ASoC: rockchip: add Serial Audio Interface (SAI) driver")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261103132537.3717496-5-jude.gyimah87@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index e96d1a95bb10c..625390ee4ad6f 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -35,6 +35,7 @@ config SND_SOC_ROCKCHIP_PDM
config SND_SOC_ROCKCHIP_SAI
tristate "Rockchip SAI Controller Driver"
+ select REGMAP_MMIO
select SND_SOC_GENERIC_DMAENGINE_PCM
help
Say Y or M if you want to add support for the Rockchip Serial Audio
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 247/990] ASoC: rockchip: spdif: Add support for set mclk rate
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (245 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 246/990] ASoC: rockchip_sai: " Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 248/990] ASoC: rockchip: spdif: Add support for format S32_LE Greg Kroah-Hartman
` (605 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sugar Zhang, Sebastian Reichel,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sugar Zhang <sugar.zhang@rock-chips.com>
[ Upstream commit 298082783a0d6d07109f8ce09ab410a1de12876d ]
Allow setting the mclk rate from the machine driver.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://patch.msgid.link/20260203-rockchip-spdif-cleanup-and-bsp-sync-v2-7-4412016cf577@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 67a7e2073909 ("ASoC: rockchip_spdif: select REGMAP_MMIO")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/rockchip_spdif.c | 34 +++++++++++++++++++----------
sound/soc/rockchip/rockchip_spdif.h | 2 +-
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index 7a15f680de2fe..cf6935dc40f2b 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -110,12 +110,15 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct rk_spdif_dev *spdif = snd_soc_dai_get_drvdata(dai);
+ unsigned int mclk_rate = clk_get_rate(spdif->mclk);
unsigned int val = SPDIF_CFGR_HALFWORD_ENABLE;
- int srate, mclk;
+ int bmc, div;
int ret;
- srate = params_rate(params);
- mclk = srate * 128;
+ /* bmc = 128fs */
+ bmc = 128 * params_rate(params);
+ div = DIV_ROUND_CLOSEST(mclk_rate, bmc);
+ val |= SPDIF_CFGR_CLK_DIV(div);
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
@@ -131,14 +134,6 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- /* Set clock and calculate divider */
- ret = clk_set_rate(spdif->mclk, mclk);
- if (ret != 0) {
- dev_err(spdif->dev, "Failed to set module clock rate: %d\n",
- ret);
- return ret;
- }
-
ret = regmap_update_bits(spdif->regmap, SPDIF_CFGR,
SPDIF_CFGR_CLK_DIV_MASK |
SPDIF_CFGR_HALFWORD_ENABLE |
@@ -201,7 +196,24 @@ static int rk_spdif_dai_probe(struct snd_soc_dai *dai)
return 0;
}
+static int rk_spdif_set_sysclk(struct snd_soc_dai *dai,
+ int clk_id, unsigned int freq, int dir)
+{
+ struct rk_spdif_dev *spdif = snd_soc_dai_get_drvdata(dai);
+ int ret;
+
+ if (!freq)
+ return 0;
+
+ ret = clk_set_rate(spdif->mclk, freq);
+ if (ret)
+ dev_err(spdif->dev, "Failed to set mclk: %d\n", ret);
+
+ return ret;
+}
+
static const struct snd_soc_dai_ops rk_spdif_dai_ops = {
+ .set_sysclk = rk_spdif_set_sysclk,
.probe = rk_spdif_dai_probe,
.hw_params = rk_spdif_hw_params,
.trigger = rk_spdif_trigger,
diff --git a/sound/soc/rockchip/rockchip_spdif.h b/sound/soc/rockchip/rockchip_spdif.h
index d8be9aae5b195..fcc28b6c4f586 100644
--- a/sound/soc/rockchip/rockchip_spdif.h
+++ b/sound/soc/rockchip/rockchip_spdif.h
@@ -15,7 +15,7 @@
*/
#define SPDIF_CFGR_CLK_DIV_SHIFT (16)
#define SPDIF_CFGR_CLK_DIV_MASK (0xff << SPDIF_CFGR_CLK_DIV_SHIFT)
-#define SPDIF_CFGR_CLK_DIV(x) (x << SPDIF_CFGR_CLK_DIV_SHIFT)
+#define SPDIF_CFGR_CLK_DIV(x) ((x-1) << SPDIF_CFGR_CLK_DIV_SHIFT)
#define SPDIF_CFGR_HALFWORD_SHIFT 2
#define SPDIF_CFGR_HALFWORD_DISABLE (0 << SPDIF_CFGR_HALFWORD_SHIFT)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 248/990] ASoC: rockchip: spdif: Add support for format S32_LE
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (246 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 247/990] ASoC: rockchip: spdif: Add support for set mclk rate Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 249/990] ASoC: rockchip: spdif: Fill IEC958 CS info per params Greg Kroah-Hartman
` (604 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zohn Ni, Sugar Zhang,
Sebastian Reichel, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sugar Zhang <sugar.zhang@rock-chips.com>
[ Upstream commit c43ec509019842c0b836e858dc486c216b51b087 ]
Treat 32 bit sample width as if it was 24 bits using only the
24 most significant bits.
[I've merged the channel-swapping fix from Zohn Ni into Sugar Zhang's
patch introducing the problem in the first place]
Co-developed-by: Zohn Ni <zohn.ni@rock-chips.com>
Signed-off-by: Zohn Ni <zohn.ni@rock-chips.com>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://patch.msgid.link/20260203-rockchip-spdif-cleanup-and-bsp-sync-v2-8-4412016cf577@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 67a7e2073909 ("ASoC: rockchip_spdif: select REGMAP_MMIO")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/rockchip_spdif.c | 22 ++++++++++++++++++++--
sound/soc/rockchip/rockchip_spdif.h | 8 ++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index cf6935dc40f2b..7acc6408a5245 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -123,21 +123,38 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream,
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
val |= SPDIF_CFGR_VDW_16;
+ val |= SPDIF_CFGR_ADJ_RIGHT_J;
break;
case SNDRV_PCM_FORMAT_S20_3LE:
val |= SPDIF_CFGR_VDW_20;
+ val |= SPDIF_CFGR_ADJ_RIGHT_J;
break;
case SNDRV_PCM_FORMAT_S24_LE:
val |= SPDIF_CFGR_VDW_24;
+ val |= SPDIF_CFGR_ADJ_RIGHT_J;
+ break;
+ case SNDRV_PCM_FORMAT_S32_LE:
+ val |= SPDIF_CFGR_VDW_24;
+ val |= SPDIF_CFGR_ADJ_LEFT_J;
break;
default:
return -EINVAL;
}
+ /*
+ * clear MCLK domain logic before setting Fmclk and Fsdo to ensure
+ * that switching between S16_LE and S32_LE audio does not result
+ * in accidential channels swap.
+ */
+ regmap_update_bits(spdif->regmap, SPDIF_CFGR, SPDIF_CFGR_CLR_MASK,
+ SPDIF_CFGR_CLR_EN);
+ udelay(1);
+
ret = regmap_update_bits(spdif->regmap, SPDIF_CFGR,
SPDIF_CFGR_CLK_DIV_MASK |
SPDIF_CFGR_HALFWORD_ENABLE |
- SDPIF_CFGR_VDW_MASK, val);
+ SDPIF_CFGR_VDW_MASK |
+ SPDIF_CFGR_ADJ_MASK, val);
return ret;
}
@@ -231,7 +248,8 @@ static struct snd_soc_dai_driver rk_spdif_dai = {
SNDRV_PCM_RATE_192000),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S20_3LE |
- SNDRV_PCM_FMTBIT_S24_LE),
+ SNDRV_PCM_FMTBIT_S24_LE |
+ SNDRV_PCM_FMTBIT_S32_LE),
},
.ops = &rk_spdif_dai_ops,
};
diff --git a/sound/soc/rockchip/rockchip_spdif.h b/sound/soc/rockchip/rockchip_spdif.h
index fcc28b6c4f586..acf64986a2e09 100644
--- a/sound/soc/rockchip/rockchip_spdif.h
+++ b/sound/soc/rockchip/rockchip_spdif.h
@@ -17,6 +17,14 @@
#define SPDIF_CFGR_CLK_DIV_MASK (0xff << SPDIF_CFGR_CLK_DIV_SHIFT)
#define SPDIF_CFGR_CLK_DIV(x) ((x-1) << SPDIF_CFGR_CLK_DIV_SHIFT)
+#define SPDIF_CFGR_CLR_MASK BIT(7)
+#define SPDIF_CFGR_CLR_EN BIT(7)
+#define SPDIF_CFGR_CLR_DIS 0
+
+#define SPDIF_CFGR_ADJ_MASK BIT(3)
+#define SPDIF_CFGR_ADJ_LEFT_J BIT(3)
+#define SPDIF_CFGR_ADJ_RIGHT_J 0
+
#define SPDIF_CFGR_HALFWORD_SHIFT 2
#define SPDIF_CFGR_HALFWORD_DISABLE (0 << SPDIF_CFGR_HALFWORD_SHIFT)
#define SPDIF_CFGR_HALFWORD_ENABLE (1 << SPDIF_CFGR_HALFWORD_SHIFT)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 249/990] ASoC: rockchip: spdif: Fill IEC958 CS info per params
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (247 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 248/990] ASoC: rockchip: spdif: Add support for format S32_LE Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 250/990] ASoC: rockchip_spdif: select REGMAP_MMIO Greg Kroah-Hartman
` (603 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sugar Zhang, Sebastian Reichel,
Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sugar Zhang <sugar.zhang@rock-chips.com>
[ Upstream commit 07a791020be9b190d4a57b5ee823ede1e98df493 ]
Add support to fill IEC958 channel status information.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://patch.msgid.link/20260203-rockchip-spdif-cleanup-and-bsp-sync-v2-9-4412016cf577@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 67a7e2073909 ("ASoC: rockchip_spdif: select REGMAP_MMIO")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/Kconfig | 1 +
sound/soc/rockchip/rockchip_spdif.c | 45 ++++++++++++++++++++++++++---
sound/soc/rockchip/rockchip_spdif.h | 8 +++++
3 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index 625390ee4ad6f..aba9a518d3b26 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -45,6 +45,7 @@ config SND_SOC_ROCKCHIP_SAI
config SND_SOC_ROCKCHIP_SPDIF
tristate "Rockchip SPDIF Device Driver"
+ select SND_PCM_IEC958
select SND_SOC_GENERIC_DMAENGINE_PCM
help
Say Y or M if you want to add support for SPDIF driver for
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index 7acc6408a5245..be84b226827e7 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -16,6 +16,7 @@
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <sound/pcm_params.h>
+#include <sound/pcm_iec958.h>
#include <sound/dmaengine_pcm.h>
#include "rockchip_spdif.h"
@@ -27,7 +28,25 @@ enum rk_spdif_type {
RK_SPDIF_RK3366,
};
-#define RK3288_GRF_SOC_CON2 0x24c
+/*
+ * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+ * CS0: | Mode | d | c | b | a |
+ * CS1: | Category Code |
+ * CS2: | Channel Number | Source Number |
+ * CS3: | Clock Accuracy | Sample Freq |
+ * CS4: | Ori Sample Freq | Word Length |
+ * CS5: | | CGMS-A |
+ * CS6~CS23: Reserved
+ *
+ * a: use of channel status block
+ * b: linear PCM identification: 0 for lpcm, 1 for nlpcm
+ * c: copyright information
+ * d: additional format information
+ */
+#define CS_BYTE 6
+#define CS_FRAME(c) ((c) << 16 | (c))
+
+#define RK3288_GRF_SOC_CON2 0x24c
struct rk_spdif_dev {
struct device *dev;
@@ -112,8 +131,20 @@ static int rk_spdif_hw_params(struct snd_pcm_substream *substream,
struct rk_spdif_dev *spdif = snd_soc_dai_get_drvdata(dai);
unsigned int mclk_rate = clk_get_rate(spdif->mclk);
unsigned int val = SPDIF_CFGR_HALFWORD_ENABLE;
- int bmc, div;
- int ret;
+ int bmc, div, ret, i;
+ u16 *fc;
+ u8 cs[CS_BYTE];
+
+ ret = snd_pcm_create_iec958_consumer_hw_params(params, cs, sizeof(cs));
+ if (ret < 0)
+ return ret;
+
+ fc = (u16 *)cs;
+ for (i = 0; i < CS_BYTE / 2; i++)
+ regmap_write(spdif->regmap, SPDIF_CHNSRn(i), CS_FRAME(fc[i]));
+
+ regmap_update_bits(spdif->regmap, SPDIF_CFGR, SPDIF_CFGR_CSE_MASK,
+ SPDIF_CFGR_CSE_EN);
/* bmc = 128fs */
bmc = 128 * params_rate(params);
@@ -267,6 +298,9 @@ static bool rk_spdif_wr_reg(struct device *dev, unsigned int reg)
case SPDIF_INTCR:
case SPDIF_XFER:
case SPDIF_SMPDR:
+ case SPDIF_VLDFRn(0) ... SPDIF_VLDFRn(11):
+ case SPDIF_USRDRn(0) ... SPDIF_USRDRn(11):
+ case SPDIF_CHNSRn(0) ... SPDIF_CHNSRn(11):
return true;
default:
return false;
@@ -282,6 +316,9 @@ static bool rk_spdif_rd_reg(struct device *dev, unsigned int reg)
case SPDIF_INTSR:
case SPDIF_XFER:
case SPDIF_SMPDR:
+ case SPDIF_VLDFRn(0) ... SPDIF_VLDFRn(11):
+ case SPDIF_USRDRn(0) ... SPDIF_USRDRn(11):
+ case SPDIF_CHNSRn(0) ... SPDIF_CHNSRn(11):
return true;
default:
return false;
@@ -304,7 +341,7 @@ static const struct regmap_config rk_spdif_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
- .max_register = SPDIF_SMPDR,
+ .max_register = SPDIF_VERSION,
.writeable_reg = rk_spdif_wr_reg,
.readable_reg = rk_spdif_rd_reg,
.volatile_reg = rk_spdif_volatile_reg,
diff --git a/sound/soc/rockchip/rockchip_spdif.h b/sound/soc/rockchip/rockchip_spdif.h
index acf64986a2e09..b837b1f8d57f3 100644
--- a/sound/soc/rockchip/rockchip_spdif.h
+++ b/sound/soc/rockchip/rockchip_spdif.h
@@ -21,6 +21,10 @@
#define SPDIF_CFGR_CLR_EN BIT(7)
#define SPDIF_CFGR_CLR_DIS 0
+#define SPDIF_CFGR_CSE_MASK BIT(6)
+#define SPDIF_CFGR_CSE_EN BIT(6)
+#define SPDIF_CFGR_CSE_DIS 0
+
#define SPDIF_CFGR_ADJ_MASK BIT(3)
#define SPDIF_CFGR_ADJ_LEFT_J BIT(3)
#define SPDIF_CFGR_ADJ_RIGHT_J 0
@@ -64,5 +68,9 @@
#define SPDIF_INTSR (0x0010)
#define SPDIF_XFER (0x0018)
#define SPDIF_SMPDR (0x0020)
+#define SPDIF_VLDFRn(x) (0x0060 + (x) * 4)
+#define SPDIF_USRDRn(x) (0x0090 + (x) * 4)
+#define SPDIF_CHNSRn(x) (0x00c0 + (x) * 4)
+#define SPDIF_VERSION (0x01c0)
#endif /* _ROCKCHIP_SPDIF_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 250/990] ASoC: rockchip_spdif: select REGMAP_MMIO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (248 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 249/990] ASoC: rockchip: spdif: Fill IEC958 CS info per params Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 251/990] net: ethernet: ti: am65-cpts: adjust perout genf following ptp changes Greg Kroah-Hartman
` (602 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit 67a7e2073909e948c3cbd86c28d17e86c2958dd6 ]
rockchip_spdif calls __devm_regmap_init_mmio_clk, which
drivers/base/regmap/regmap-mmio.c provides under REGMAP_MMIO.
rockchip_spdif.c:(.text+0xf67): undefined reference to
`__devm_regmap_init_mmio_clk'
The driver can be built into vmlinux while REGMAP_MMIO is a module, in
which case the symbol is not there at link time.
Select rather than depend on: REGMAP_MMIO has no prompt of its own and is
only ever enabled by a select, so a depends on would leave
SND_SOC_ROCKCHIP_SPDIF unselectable.
Reproduced on v7.3, x86_64, with CONFIG_SND_SOC_ROCKCHIP_SPDIF=y and
CONFIG_REGMAP_MMIO=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: f874b80e1571 ("ASoC: rockchip: Add rockchip SPDIF transceiver driver")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261103132537.3717496-6-jude.gyimah87@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/rockchip/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
index aba9a518d3b26..0e5110125c140 100644
--- a/sound/soc/rockchip/Kconfig
+++ b/sound/soc/rockchip/Kconfig
@@ -45,6 +45,7 @@ config SND_SOC_ROCKCHIP_SAI
config SND_SOC_ROCKCHIP_SPDIF
tristate "Rockchip SPDIF Device Driver"
+ select REGMAP_MMIO
select SND_PCM_IEC958
select SND_SOC_GENERIC_DMAENGINE_PCM
help
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 251/990] net: ethernet: ti: am65-cpts: adjust perout genf following ptp changes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (249 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 250/990] ASoC: rockchip_spdif: select REGMAP_MMIO Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 252/990] isofs: handle Rock Ridge long-form dates before 1900 Greg Kroah-Hartman
` (601 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Clark, Jacob Keller,
Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <jjc@jclark.com>
[ Upstream commit 3f1054a0cb09552dd54db024694f74747f9f1d49 ]
A periodic output requested by PTP_PEROUT_REQUEST2 drifts away from
the PHC as soon as the PHC frequency is adjusted, for example by ptp4l
or ts2phc: at +10 ppm each edge is 10 us later than the one before.
The GenF that generates the output counts its period in ref_clk
cycles, which the PPM correction of the CPTS clock does not reach;
each GenF has its own PPM registers. am65_cpts_ptp_adjfine() programs
them only for the GenF used for PPS, and am65_cpts_perout_enable_hw()
starts every GenF with them cleared, so a GenF used for a periodic
output is never corrected.
Commit eb9233ce6751 ("net: ethernet: ti: am65-cpts: adjust pps following
ptp changes") added the correction for the PPS GenF, and
commit 7849c42da2ca ("net: ethernet: ti: am65-cpts: adjust estf following
ptp changes") passed the same values to the ESTFs.
In am65_cpts_ptp_adjfine(), update every enabled GenF the way the PPS
GenF was updated: read its control register, set or clear the PPM
direction bit and write it back with the PPM value. The PPS GenF and the
ESTFs get exactly the values they got before. In
am65_cpts_perout_enable_hw(), start a GenF with the current correction
instead of none; this applies to the PPS GenF too.
Tested on a BeagleY-AI (J722S) with the GENF0 output looped back to
the HW1_TS_PUSH input (EXTTS 0). With the PHC frequency adjusted by
+10 ppm before the periodic output is started, the edges drift 10 us
per second against the PHC without this patch (290 us after 29 s);
with it, they stay 20 to 23 ns after the PHC second. This also works
if the frequency is adjusted after the periodic output has started.
Fixes: f6bd59526ca5 ("net: ethernet: ti: introduce am654 common platform time sync driver")
Signed-off-by: James Clark <jjc@jclark.com>
Reviewed-by: Jacob Keller <Jacob.e.keller@intel.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/ti/am65-cpts.c | 67 +++++++++++++++++++----------
1 file changed, 45 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/ti/am65-cpts.c b/drivers/net/ethernet/ti/am65-cpts.c
index 73adb822bc075..e87bb01f9aed2 100644
--- a/drivers/net/ethernet/ti/am65-cpts.c
+++ b/drivers/net/ethernet/ti/am65-cpts.c
@@ -176,6 +176,9 @@ struct am65_cpts {
struct mutex ptp_clk_lock; /* PHC access sync */
u64 timestamp;
u32 genf_enable;
+ bool genf_neg_adj;
+ u32 genf_ppm_hi;
+ u32 genf_ppm_low;
u32 hw_ts_enable;
u32 estf_enable;
struct sk_buff_head txq;
@@ -436,9 +439,11 @@ static int am65_cpts_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{
struct am65_cpts *cpts = container_of(ptp, struct am65_cpts, ptp_info);
u32 estf_ctrl_val = 0, estf_ppm_hi = 0, estf_ppm_low = 0;
+ u32 genf_ctrl_val[AM65_CPTS_GENF_MAX_NUM];
+ u32 genf_ppm_hi, genf_ppm_low;
s32 ppb = scaled_ppm_to_ppb(scaled_ppm);
int pps_index = cpts->pps_genf_idx;
- u64 adj_period, pps_adj_period;
+ u64 adj_period, genf_adj_period;
u32 ctrl_val, ppm_hi, ppm_low;
unsigned long flags;
int neg_adj = 0, i;
@@ -470,20 +475,33 @@ static int am65_cpts_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
ppm_hi = upper_32_bits(adj_period) & 0x3FF;
ppm_low = lower_32_bits(adj_period);
+ /* GenF PPM will do correction using cpts refclk tick which is
+ * (cpts->ts_add_val + 1) ns, so GenF length PPM adj period
+ * need to be corrected.
+ */
+ genf_adj_period = adj_period * (cpts->ts_add_val + 1);
+ genf_ppm_hi = upper_32_bits(genf_adj_period) & 0x3FF;
+ genf_ppm_low = lower_32_bits(genf_adj_period);
+ cpts->genf_neg_adj = neg_adj;
+ cpts->genf_ppm_hi = genf_ppm_hi;
+ cpts->genf_ppm_low = genf_ppm_low;
+
+ for (i = 0; i < AM65_CPTS_GENF_MAX_NUM; i++) {
+ if (cpts->genf_enable & BIT(i)) {
+ genf_ctrl_val[i] = am65_cpts_read32(cpts,
+ genf[i].control);
+ if (neg_adj)
+ genf_ctrl_val[i] &= ~BIT(1);
+ else
+ genf_ctrl_val[i] |= BIT(1);
+ }
+ }
+
if (cpts->pps_enabled) {
- estf_ctrl_val = am65_cpts_read32(cpts, genf[pps_index].control);
- if (neg_adj)
- estf_ctrl_val &= ~BIT(1);
- else
- estf_ctrl_val |= BIT(1);
-
- /* GenF PPM will do correction using cpts refclk tick which is
- * (cpts->ts_add_val + 1) ns, so GenF length PPM adj period
- * need to be corrected.
- */
- pps_adj_period = adj_period * (cpts->ts_add_val + 1);
- estf_ppm_hi = upper_32_bits(pps_adj_period) & 0x3FF;
- estf_ppm_low = lower_32_bits(pps_adj_period);
+ /* am65_cpts_perout_enable_hw() sets pps_index in genf_enable */
+ estf_ctrl_val = genf_ctrl_val[pps_index];
+ estf_ppm_hi = genf_ppm_hi;
+ estf_ppm_low = genf_ppm_low;
}
spin_lock_irqsave(&cpts->lock, flags);
@@ -500,10 +518,13 @@ static int am65_cpts_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
am65_cpts_write32(cpts, ppm_hi, ts_ppm_hi);
am65_cpts_write32(cpts, ppm_low, ts_ppm_low);
- if (cpts->pps_enabled) {
- am65_cpts_write32(cpts, estf_ctrl_val, genf[pps_index].control);
- am65_cpts_write32(cpts, estf_ppm_hi, genf[pps_index].ppm_hi);
- am65_cpts_write32(cpts, estf_ppm_low, genf[pps_index].ppm_low);
+ for (i = 0; i < AM65_CPTS_GENF_MAX_NUM; i++) {
+ if (cpts->genf_enable & BIT(i)) {
+ am65_cpts_write32(cpts, genf_ctrl_val[i],
+ genf[i].control);
+ am65_cpts_write32(cpts, genf_ppm_hi, genf[i].ppm_hi);
+ am65_cpts_write32(cpts, genf_ppm_low, genf[i].ppm_low);
+ }
}
for (i = 0; i < AM65_CPTS_ESTF_MAX_NUM; i++) {
@@ -513,7 +534,6 @@ static int am65_cpts_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
am65_cpts_write32(cpts, estf_ppm_low, estf[i].ppm_low);
}
}
- /* All GenF/EstF can be updated here the same way */
spin_unlock_irqrestore(&cpts->lock, flags);
mutex_unlock(&cpts->ptp_clk_lock);
@@ -679,9 +699,12 @@ static void am65_cpts_perout_enable_hw(struct am65_cpts *cpts,
val = lower_32_bits(cycles);
am65_cpts_write32(cpts, val, genf[req->index].length);
- am65_cpts_write32(cpts, 0, genf[req->index].control);
- am65_cpts_write32(cpts, 0, genf[req->index].ppm_hi);
- am65_cpts_write32(cpts, 0, genf[req->index].ppm_low);
+ am65_cpts_write32(cpts, cpts->genf_neg_adj ? 0 : BIT(1),
+ genf[req->index].control);
+ am65_cpts_write32(cpts, cpts->genf_ppm_hi,
+ genf[req->index].ppm_hi);
+ am65_cpts_write32(cpts, cpts->genf_ppm_low,
+ genf[req->index].ppm_low);
cpts->genf_enable |= BIT(req->index);
} else {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 252/990] isofs: handle Rock Ridge long-form dates before 1900
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (250 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 251/990] net: ethernet: ti: am65-cpts: adjust perout genf following ptp changes Greg Kroah-Hartman
@ 2026-11-25 14:26 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 253/990] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer Greg Kroah-Hartman
` (600 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:26 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hungyu Lin, Jan Kara, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
[ Upstream commit 0cbfc16fe49629f5c1fc3628405661c2b938ec61 ]
iso_date() stores the year relative to 1900 and rejects negative values.
Rock Ridge LONG_FORM timestamps encode calendar years from 1 to 9999,
so valid years before 1900 are returned as seconds since the Unix epoch
equal to zero instead of their recorded dates. For example, an 1899
timestamp on an image produced by xorriso is reported as 1970 by stat,
and cp -p preserves that incorrect time.
Use the calendar year for both timestamp formats and pass it directly
to mktime64(). Keep the epoch fallback for year zero, while allowing
valid long-form years before 1900. Short-form dates are unchanged.
Fixes: 5ea45f54c8d6 ("isofs: fix Y2038 and Y2156 issues in Rock Ridge TF entry")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Link: https://patch.msgid.link/20261029004902.76944-1-dennylin0707@gmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/isofs/util.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/isofs/util.c b/fs/isofs/util.c
index 42f479da0b282..6f9a90e58a890 100644
--- a/fs/isofs/util.c
+++ b/fs/isofs/util.c
@@ -25,7 +25,7 @@ struct timespec64 iso_date(u8 *p, int flags)
year = (p[0] - '0') * 1000 +
(p[1] - '0') * 100 +
(p[2] - '0') * 10 +
- (p[3] - '0') - 1900;
+ (p[3] - '0');
month = ((p[4] - '0') * 10 + (p[5] - '0'));
day = ((p[6] - '0') * 10 + (p[7] - '0'));
hour = ((p[8] - '0') * 10 + (p[9] - '0'));
@@ -34,7 +34,7 @@ struct timespec64 iso_date(u8 *p, int flags)
ts.tv_nsec = ((p[14] - '0') * 10 + (p[15] - '0')) * 10000000;
tz = p[16];
} else {
- year = p[0];
+ year = p[0] + 1900;
month = p[1];
day = p[2];
hour = p[3];
@@ -45,10 +45,10 @@ struct timespec64 iso_date(u8 *p, int flags)
tz = flags & ISO_DATE_HIGH_SIERRA ? 0 : p[6];
}
- if (year < 0) {
+ if (year < 1) {
ts.tv_sec = 0;
} else {
- ts.tv_sec = mktime64(year+1900, month, day, hour, minute, second);
+ ts.tv_sec = mktime64(year, month, day, hour, minute, second);
/* sign extend */
if (tz & 0x80)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 253/990] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer.
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (251 preceding siblings ...)
2026-11-25 14:26 ` [PATCH 6.18 252/990] isofs: handle Rock Ridge long-form dates before 1900 Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 254/990] cpufreq: Hold the policy write lock when changing boost state Greg Kroah-Hartman
` (599 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tom Williams, Guillaume Nault,
Kuniyuki Iwashima, Neal Cardwell, Eric Dumazet, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <gnault@redhat.com>
[ Upstream commit 11140c51df12e594d6bf2c8d2af5dec63b0219ac ]
When receiving a pure ack from a peer that also sends data, we can
have SEG.SEQ > SND.WL1, even though the segment contains no data. This
makes tcp_may_update_window() return true (because of the
"after(ack_seq, tp->snd_wl1)" condition), and tcp_ack_update_window()
then adds FLAG_WIN_UPDATE to the segment set of flags, even when
there's no window update.
Since FLAG_WIN_UPDATE prevents the segment from being considered as
dup-ack (as it's part of FLAG_NOT_DUP), this can inhibit fast
retransmit on non-SACK connections, making recovery very slow as it
now entirely relies on RTO.
The "DUPLICATE ACKNOWLEDGMENT" definition of RFC 5681, section 2,
says that lack of window update is a necessary condition for a dup ack:
"(e) the advertised window in the incoming acknowledgment equals the
advertised window in the last incoming acknowledgment.". Spurious
window updates can thus prevent dup ack detection and, in the end, fast
retransmit.
Avoid this scenario by setting FLAG_WIN_UPDATE only when a window
update actually occurs. Pure acks with SEG.SEQ > SND.WL1 can now
be detected as dup-ack and trigger fast retransmission.
Also, stop setting FLAG_WIN_UPDATE in tcp_ack()'s header prediction
path. One of the conditions for header prediction to happen is that
received segments don't trigger a window update. This flag update was
thus wrong to begin with. Now that tcp_ack_update_window() sets
FLAG_WIN_UPDATE only if a window update actually occurred, we need the
header prediction path to stop reporting spurious window updates too.
Otherwise BPF programs would get inconsistent window update information
(CA_ACK_WIN_UPDATE) between fast an slow paths.
Finally, add FLAG_SND_UNA_ADVANCED to the definition of FLAG_NOT_DUP.
This is necessary for the case where an incoming segment acknowledges
less than a full segment of the retransmit queue. Such segments were
not considered dubious by tcp_ack_is_dubious() because of the spurious
FLAG_WIN_UPDATE flag, which prevented the segment from being seen as a
duplicate ack. Now that FLAG_WIN_UPDATE doesn't cover this scenario
anymore, we need another way to mark these acks as non-duplicate.
Adding FLAG_SND_UNA_ADVANCED to FLAG_NOT_DUP is the natural way of
doing this, since, by definition, a segment advancing SND.UNA, even by
a small amount, cannot be a duplicate ack.
A side effect of this patch is that repeated zero window acks received
from peer can now be considered duplicate acks (because of the the
"|| !win" condition in tcp_may_update_window()). Therefore, they can
now trigger fast retransmission and fast recovery, including congestion
window reduction, when the peer is stalled. This is RFC compliant and
shouldn't have any negative effect.
Add packetdrill selftest. Before this patch, the 1001:2001 segment was
retransmitted upon RTO, now it's sent right after reception of the
third duplicate ack.
Thanks to Tom Williams for the investigation help and initial
reproducer.
Reported-by: Tom Williams <Tom.D.Williams@MorganStanley.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/6426d558e45fc6ab724c40af62e4a8793215dd8a.1793219189.git.gnault@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_input.c | 6 +--
.../tcp_bidir_fast_retransmit_nosack.pkt | 42 +++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 5d8da3c23e2c8..5e73232873fab 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -107,7 +107,8 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE;
#define FLAG_TS_PROGRESS 0x40000 /* Positive timestamp delta */
#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
-#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
+#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED| \
+ FLAG_SND_UNA_ADVANCED)
#define FLAG_CA_ALERT (FLAG_DATA_SACKED|FLAG_ECE|FLAG_DSACKING_ACK)
#define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED)
@@ -3741,11 +3742,11 @@ static int tcp_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32
nwin <<= tp->rx_opt.snd_wscale;
if (tcp_may_update_window(tp, ack, ack_seq, nwin)) {
- flag |= FLAG_WIN_UPDATE;
tcp_update_wl(tp, ack_seq);
if (tp->snd_wnd != nwin) {
tp->snd_wnd = nwin;
+ flag |= FLAG_WIN_UPDATE;
/* Note, it is the only place, where
* fast path is recovered for sending TCP.
@@ -4093,7 +4094,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
*/
tcp_update_wl(tp, ack_seq);
tcp_snd_una_update(tp, ack);
- flag |= FLAG_WIN_UPDATE;
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPACKS);
} else {
diff --git a/tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt b/tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt
new file mode 100644
index 0000000000000..5c66b7171d229
--- /dev/null
+++ b/tools/testing/selftests/net/packetdrill/tcp_bidir_fast_retransmit_nosack.pkt
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Verify that non-SACK connections properly detect duplicate acks when mixed
+// with other data segments from peer.
+
+`./defaults.sh`
+
+ 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
+ +0...0 connect(4, ..., ...) = 0
+
+ // Three-way handshake, SACK not supported by peer
+ +0 > S 0:0(0) <mss 1460,sackOK,TS val 0 ecr 0,nop,wscale 8>
+ +0 < S. 0:0(0) ack 1 win 65535 <mss 1000>
+ +0 > . 1:1(0) ack 1
+
+ // Send 1000 bytes, peer acks everything
+ +0 send(4, ..., 1000, 0) = 1000
+ +0 > P. 1:1001(1000) ack 1
+ +0 < . 1:1(0) ack 1001 win 65535
+
+ // Send 4000 more bytes
+ +0 send(4, ..., 4000, 0) = 4000
+ +0 > P. 1001:5001(4000) ack 1
+
+ // Receive first dup-ack (considering segment 1001-2001 was lost)
+ +0 < . 1:1(0) ack 1001 win 65535
+
+ // Receive unrelated data segment from peer and ack it
+ +0 < P. 1:11(10) ack 1001 win 65535
+ +0 > . 5001:5001(0) ack 11
+
+ // Receive second dup-ack
+ +0 < . 11:11(0) ack 1001 win 65535
+
+ // Receive another data segment from peer and ack it
+ +0 < P. 11:21(10) ack 1001 win 65535
+ +0 > . 5001:5001(0) ack 21
+
+ // Receive third dup-ack, which should trigger fast retransmit (without
+ // waiting for RTO)
+ +0 < . 21:21(0) ack 1001 win 65535
+ +0 > . 1001:2001(1000) ack 21
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 254/990] cpufreq: Hold the policy write lock when changing boost state
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (252 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 253/990] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 255/990] net: skbuff: reject zero MPLS TTL before decrementing Greg Kroah-Hartman
` (598 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Loehle, Rafael J. Wysocki,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <christian.loehle@arm.com>
[ Upstream commit e6f50e602e373583423654ec000cad8b8d08f7bc ]
The per-policy boost sysfs handler calls policy_set_boost() under
policy->rwsem, but the global boost handler and cpufreq_online() do not.
Consequently, global and per-policy boost changes can concurrently
update policy->boost_enabled, invoke the driver callback and update the
boost frequency QoS request. The driver callbacks also access policy
state, e.g. CPPC updates cpuinfo.max_freq that assumes policy->rw_sem
held.
Take policy->rwsem around policy_set_boost() in both unlocked
callers. Keep locking at the call sites because the per-policy sysfs
handler already holds the lock.
Fixes: 218a06a79d9a ("cpufreq: Support per-policy performance boost")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/be3739f8-e668-4711-912c-91459d77ed35@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index ec577a20567b1..002afd47d2d59 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -597,6 +597,8 @@ static int policy_set_boost(struct cpufreq_policy *policy, bool enable)
{
int ret;
+ lockdep_assert_held_write(&policy->rwsem);
+
if (policy->boost_enabled == enable)
return 0;
@@ -1631,6 +1633,8 @@ static int cpufreq_online(unsigned int cpu)
*/
if (cpufreq_driver->set_boost && policy->boost_supported &&
(new_policy || !cpufreq_boost_enabled())) {
+ guard(cpufreq_policy_write)(policy);
+
ret = policy_set_boost(policy, cpufreq_boost_enabled());
if (ret) {
/* If the set_boost fails, the online operation is not affected */
@@ -2821,6 +2825,8 @@ static int cpufreq_boost_trigger_state(int state)
if (!policy->boost_supported)
continue;
+ guard(cpufreq_policy_write)(policy);
+
ret = policy_set_boost(policy, state);
if (ret)
goto err_reset_state;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 255/990] net: skbuff: reject zero MPLS TTL before decrementing
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (253 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 254/990] cpufreq: Hold the policy write lock when changing boost state Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 256/990] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove Greg Kroah-Hartman
` (597 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Xia Yan, Simon Horman,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 24614e72df484ad50ecba98aaa88c7df2448c122 ]
skb_mpls_dec_ttl() decrements the u8 TTL before checking whether it
expired. An incoming TTL of zero wraps to 255, causing the TC MPLS
dec_ttl action to pass an expired packet instead of dropping it.
Reject a zero TTL before the decrement while preserving the existing
behavior for TTL one and valid TTL values.
Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261031114135.3784868-2-thnkslprpt@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index e28802a46fd29..f1b0045667124 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -6713,7 +6713,7 @@ int skb_mpls_dec_ttl(struct sk_buff *skb)
lse = be32_to_cpu(mpls_hdr(skb)->label_stack_entry);
ttl = (lse & MPLS_LS_TTL_MASK) >> MPLS_LS_TTL_SHIFT;
- if (!--ttl)
+ if (!ttl || !--ttl)
return -EINVAL;
lse &= ~MPLS_LS_TTL_MASK;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 256/990] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (254 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 255/990] net: skbuff: reject zero MPLS TTL before decrementing Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 257/990] ipv6: Flush exception route while replacing nexthop Greg Kroah-Hartman
` (596 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhou Minqiang, Rafael J. Wysocki,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhou Minqiang <zhouminqiang2@huawei.com>
[ Upstream commit 1f65b45f0f16e1c80a68a5757c9556f78bb39f19 ]
When a WQ_MEM_RECLAIM workqueue (e.g. iscsi_ctrl) triggers device removal
via device_del -> pm_runtime_remove, the unconditional flush_work inside
pm_runtime_remove can trigger a check_flush_dependency warning:
CPU1: pm_wq worker CPU2: iscsi_ctrl wq
-------- --------
pm_runtime_work(starget) pm_runtime_remove(starget)
spin_lock_irq(&starget->lock) __pm_runtime_disable(starget, false)
request_pending = false spin_lock_irq(&starget->lock)
(blocked, CPU1 holds the lock)
rpm_suspend(starget, RPM_NOWAIT)
status = RPM_SUSPENDING
rpm_callback(cb, starget)
spin_unlock_irq(&starget->lock)
(acquires lock)
disable_depth 0→1
__pm_runtime_barrier():
request_pending == false
→ skip cancel_work_sync
status == RPM_SUSPENDING
→ enter wait_queue, sleep
spin_unlock_irq(&starget->lock)
cb(starget) → 0
spin_lock_irq(&starget->lock)
status = RPM_SUSPENDED
wake_up_all(&wait_queue)
(woken up, waiting for lock)
spin_unlock(&starget->lock) spin_lock_irq(&starget->lock)
status == RPM_SUSPENDED
spin_lock(&parent->lock) → exit wait_queue
rpm_idle(parent, RPM_ASYNC) barrier returns
spin_unlock(&parent->lock) flush_work(&starget->work)
spin_lock(&starget->lock) __flush_work(from_cancel=false)
spin_unlock_irq(&starget->lock) check_flush_dependency()
← WARNING!
Replace flush_work with cancel_work_sync in pm_runtime_remove.
cancel_work_sync internally calls __flush_work with from_cancel=true,
which causes check_flush_dependency to return early before the warning.
This preserves the use-after-free fix from commit 29ab76827761
("PM: runtime: Fix a race condition related to device removal")
without the warning.
Fixes: 29ab76827761 ("PM: runtime: Fix a race condition related to device removal")
Signed-off-by: Zhou Minqiang <zhouminqiang2@huawei.com>
Link: https://patch.msgid.link/20261104115641.2682786-1-zhouminqiang2@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/base/power/runtime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 04f620e340b3d..5842cd58040cf 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1900,7 +1900,7 @@ void pm_runtime_reinit(struct device *dev)
void pm_runtime_remove(struct device *dev)
{
__pm_runtime_disable(dev, false);
- flush_work(&dev->power.work);
+ cancel_work_sync(&dev->power.work);
pm_runtime_reinit(dev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 257/990] ipv6: Flush exception route while replacing nexthop.
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (255 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 256/990] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 258/990] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow() Greg Kroah-Hartman
` (595 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jason Zhang, Kuniyuki Iwashima,
Ido Schimmel, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 9401b428b5d4dfe1fd5752973fd02b4e9cd05536 ]
The following creates a cyclic reference between IPv6 route
and nexthop:
1. create a nexthop A
2. create a nexthop group w/ A
3. create an IPv6 route with the nexthop group
4. create an exception route w/ A
5. replace A with a new nexthop B in the nexthop group
6. remove the IPv6 route
7. replace B with A in the nexthop group
8. remove the nexthop group
Then, removing a device tied to the route gets stuck and
triggers the splat below. [0]
At 5., fib6_nh_release_dsts() is called, but it does not
flush exception routes, so the nexthop A continues to grab
the IPv6 route reference.
nh_A->rt6i_exception_bucket[] -> rt6_ex->rt6i->from
At 6., fib6_purge_rt() calls rt6_flush_exceptions(), but it
only purges exceptions tied to nexthop B. Also, the route is
unlinked from the nexthop group by list_del_init(&rt->nh_list).
-> f6i->nh -> nhg->nh_entries[]
At 8., __remove_nexthop_fib() cannot find the IPv6 route, and
remove_nexthop_group() calls list_del_init(&nhge->nh_list) to
unlink the group from the nexthop A's nhe->grp_list.
nhg->nh_entries[] -> nh_A -> ... -> f6i
Here, the nexthop A is reachable from net->nexthop.devhash[],
but remove_nexthop_from_groups() cannot find the nexthop group,
leaking the whole chain.
Let's call fib6_nh_flush_exceptions() in fib6_nh_release_dsts().
[0]:
unregister_netdevice: waiting for gre6 to become free. Usage count = 4
ref_tracker: netdev@000000009652f190 has 1/3 users at
dst_alloc+0x14b/0x490
ip6_rt_cache_alloc+0x27b/0x670
__ip6_rt_update_pmtu+0x572/0x850
ip6_tnl_xmit+0x8c5/0x1b70
__gre6_xmit+0x7af/0xaa0
ip6gre_tunnel_xmit+0x685/0xdc0
dev_hard_start_xmit+0x204/0x5a0
__dev_queue_xmit+0xe8a/0x2550
ip6_finish_output+0x232/0x570
ip6_output+0x226/0x3b0
ip6_send_skb+0x133/0x250
rawv6_push_pending_frames+0x503/0x6f0
rawv6_sendmsg+0xdf0/0x1310
sock_sendmsg_nosec+0xde/0x130
__sys_sendto+0x27f/0x320
__x64_sys_sendto+0xd9/0xf0
Fixes: 7bf4796dd099 ("nexthops: add support for replace")
Reported-by: Jason Zhang <jdz@google.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261101064418.2055158-2-kuniyu@google.com
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/route.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index af376b9568e2f..c11cf3c65c9f7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3733,9 +3733,10 @@ void fib6_nh_release(struct fib6_nh *fib6_nh)
{
struct rt6_exception_bucket *bucket;
+ fib6_nh_release_dsts(fib6_nh);
+
rcu_read_lock();
- fib6_nh_flush_exceptions(fib6_nh, NULL);
bucket = fib6_nh_get_excptn_bucket(fib6_nh, NULL);
if (bucket) {
rcu_assign_pointer(fib6_nh->rt6i_exception_bucket, NULL);
@@ -3744,7 +3745,6 @@ void fib6_nh_release(struct fib6_nh *fib6_nh)
rcu_read_unlock();
- fib6_nh_release_dsts(fib6_nh);
free_percpu(fib6_nh->rt6i_pcpu);
fib_nh_common_release(&fib6_nh->nh_common);
@@ -3754,6 +3754,8 @@ void fib6_nh_release_dsts(struct fib6_nh *fib6_nh)
{
int cpu;
+ fib6_nh_flush_exceptions(fib6_nh, NULL);
+
if (!fib6_nh->rt6i_pcpu)
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 258/990] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow().
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (256 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 257/990] ipv6: Flush exception route while replacing nexthop Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 259/990] tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack() Greg Kroah-Hartman
` (594 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jason Zhang, Kuniyuki Iwashima,
Ido Schimmel, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <kuniyu@google.com>
[ Upstream commit 4019af3afd72864ec6abbfde2d76e416a64456c2 ]
Since the cited commit, ip_route_input_slow() could call
rt_dst_alloc() with vrf in the local_input: path.
If res->fi != NULL and one of the following is true,
- a non-zero itag from fib_validate_source_reason()
(realms/classid)
- RTN_BROADCAST with BC_FORWARDING enabled
do_cache is set to false.
Then, the route is not added to rt_uncached_list, so the
route cannot be removed from rt_flush_dev().
If the route is cached in sk->sk_rx_dst, removing the
vrf device gets stuck. [0]
Let's call rt_add_uncached_list() if !do_cache in
ip_route_input_slow().
[0]:
unregister_netdevice: waiting for vrf0 to become free. Usage count = 2
ref_tracker: netdev@000000008b304ac4 has 1/1 users at
dst_alloc+0x14b/0x490
ip_route_input_rcu+0x1540/0x2530
ip_route_input_noref+0x5a/0x90
ip_rcv_finish_core+0x4b0/0x1140
ip_rcv_finish+0xe6/0x190
ip_rcv+0x6c/0x130
__netif_receive_skb+0x121/0x300
process_backlog+0x2df/0x5e0
__napi_poll+0x8c/0x380
net_rx_action+0x43c/0xab0
handle_softirqs+0x19f/0x520
do_softirq+0x46/0x60
__local_bh_enable_ip+0x79/0x80
__dev_queue_xmit+0x1b0e/0x24c0
ip_finish_output2+0x8b2/0xcd0
ip_output+0xf2/0x1e0
Fixes: f5a0aab84b74 ("net: ipv4: dst for local input routes should use l3mdev if relevant")
Reported-by: Jason Zhang <jdz@google.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261101064418.2055158-4-kuniyu@google.com
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/route.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index e6276896f3ad4..489d3b2cb612b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2485,6 +2485,8 @@ ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
if (unlikely(!rt_cache_route(nhc, rth)))
rt_add_uncached_list(rth);
+ } else {
+ rt_add_uncached_list(rth);
}
skb_dst_set(skb, &rth->dst);
reason = SKB_NOT_DROPPED_YET;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 259/990] tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (257 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 258/990] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 260/990] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence Greg Kroah-Hartman
` (593 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anvik Loitongbam, Yingjie Wang,
Eric Dumazet, Jiayuan Chen, Neal Cardwell, Kuniyuki Iwashima,
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 8e069fd3fd396b89af417e50b359bc9892dd41cd ]
When IPV6_FL_F_REFLECT is set on a listener, or the
net.ipv6.flowlabel_reflect sysctl has FLOWLABEL_REFLECT_ESTABLISHED,
tcp_v6_send_synack() reflects the flowlabel of the SYN packet,
reading it from the skb stored in ireq->pktopts.
Since commit 079096f103fa ("tcp/dccp: install syn_recv requests
into ehash table"), request sockets are processed without holding
the listener lock. A cpu can then process a retransmitted SYN for a
request socket, and send a SYNACK from tcp_check_req(), while another
cpu receives the ACK completing the 3WHS. tcp_v6_syn_recv_sock()
consumes ireq->pktopts when it wins the hashdance, and the first cpu
reads a freed skb:
BUG: KASAN: slab-use-after-free in tcp_v6_send_synack (include/linux/skbuff.h:3152 include/linux/ipv6.h:110 net/ipv6/tcp_ipv6.c:582)
Read of size 8 at addr ffff88802b08b608 by task poc-ipv6-pktopt/5076
Call Trace:
<IRQ>
tcp_v6_send_synack (include/linux/skbuff.h:3152 include/linux/ipv6.h:110 net/ipv6/tcp_ipv6.c:582)
tcp_rtx_synack (net/ipv4/tcp_output.c:4719)
tcp_check_req (net/ipv4/tcp_minisocks.c:762)
tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1826)
ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:479)
ip6_input_finish (net/ipv6/ip6_input.c:534)
ip6_input (include/linux/netfilter.h:325 include/linux/netfilter.h:319 net/ipv6/ip6_input.c:545)
ipv6_rcv (include/net/dst.h:481 net/ipv6/ip6_input.c:119 include/linux/netfilter.h:325 include/linux/netfilter.h:319 net/ipv6/ip6_input.c:351)
Freed by task 5074 on cpu 0 at 15.412249s:
kmem_cache_free (include/linux/kasan.h:235 mm/slub.c:2780 mm/slub.c:6630 mm/slub.c:6757)
tcp_v6_syn_recv_sock (net/ipv6/tcp_ipv6.c:1528)
tcp_check_req (net/ipv4/tcp_minisocks.c:934)
tcp_v6_rcv (net/ipv6/tcp_ipv6.c:1826)
ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:479)
ip6_input_finish (net/ipv6/ip6_input.c:534)
Request socket migration has the same issue: reqsk_migrate_reset()
transfers ireq->pktopts to the clone, which can be freed while
another cpu holding a reference on the old request socket is still
sending a SYNACK.
The SYNACK timer itself is not an issue, because
inet_csk_reqsk_queue_drop() calls timer_delete_sync().
Save the flowlabel of the SYN in the request socket instead, so that
tcp_v6_send_synack() no longer needs ireq->pktopts.
As a side effect, the flowlabel is also reflected for SYN packets
reusing a TIME_WAIT socket, as ireq->pktopts is not set in this case.
Fixes: e994b2f0fb92 ("tcp: do not lock listener to process SYN packets")
Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
Fixes: c905dee62232 ("tcp: Migrate TCP_NEW_SYN_RECV requests at retransmitting SYN+ACKs.")
Reported-by: Anvik Loitongbam <permissiontogallop@gmail.com>
Reported-by: Yingjie Wang <x-professor@outlook.com>
Closes: https://lore.kernel.org/netdev/82c31e4d5043f3dbd11b44177cfba779d335aae3.1793599929.git.x-professor@outlook.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261102075441.3771550-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/tcp.h | 3 +++
net/ipv6/tcp_ipv6.c | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8e1266cf8ef69..c718516bcbee3 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -179,6 +179,9 @@ struct tcp_request_sock {
u8 ao_rcv_next;
bool used_tcp_ao;
#endif
+#if IS_ENABLED(CONFIG_IPV6)
+ __be32 syn_flowlabel;
+#endif
};
static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 027413fe37a41..fade3907b05da 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -554,8 +554,8 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
&ireq->ir_v6_rmt_addr);
fl6->daddr = ireq->ir_v6_rmt_addr;
- if (inet6_test_bit(REPFLOW, sk) && ireq->pktopts)
- fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts));
+ if (inet6_test_bit(REPFLOW, sk))
+ fl6->flowlabel = tcp_rsk(req)->syn_flowlabel;
tclass = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) ?
(tcp_rsk(req)->syn_tos & ~INET_ECN_MASK) |
@@ -808,6 +808,7 @@ static void tcp_v6_init_req(struct request_sock *req,
ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
ireq->ir_rmt_addr = LOOPBACK4_IPV6;
ireq->ir_loc_addr = LOOPBACK4_IPV6;
+ tcp_rsk(req)->syn_flowlabel = ip6_flowlabel(ipv6_hdr(skb));
/* So that link locals have meaning */
if ((!sk_listener->sk_bound_dev_if || l3_slave) &&
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 260/990] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (258 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 259/990] tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 261/990] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path Greg Kroah-Hartman
` (592 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nathan Blomquist, Alex Deucher,
Mario Limonciello, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <mario.limonciello@amd.com>
[ Upstream commit a26ec190925733dd205507493e936e59dbcd2b19 ]
On Navi1x/Sienna Cichlid with runtime PM, when the audio function is
enabled, BACO entry and exit are delegated to PMFW by sending
SMU_MSG_ArmD3 instead of going through smu_v11_0_baco_set_state().
Unlike the v13/v14/v15 helpers, smu_v11_0_baco_set_armd3_sequence()
does not update smu_baco->state, so the driver keeps reporting
SMU_BACO_STATE_EXIT while the ASIC is armed for / sitting in BACO.
At runtime resume amdgpu_device_baco_exit() checks
amdgpu_device_supports_baco(), which ends up in
smu_v11_0_get_bamaco_support(). Since the state never reads ENTER, the
"already in BACO" shortcut is skipped and the live BACO feature bit is
consulted instead. PMFW clears that bit once ArmD3(BACO) is armed, so
the check reports "supported but not enabled", the exit fails with
-ENOTSUPP and the ULPS ArmD3 message is never sent. The runtime resume
caller ignores the error, and a later secondary bus reset leaves the
device unreachable. This shows up on a Navi 23 being handed from amdgpu
to vfio-pci:
baco_enter: in_runpm=1 audio_enabled=1 armd3=1 baco_state=1 ret=0
bamaco: state=1 ... feat supported=1 enabled=0 in_runpm=1
baco_exit: supports=0 ...
runtime resume: baco_exit ret=-524
Update smu_baco->state in the helper, mirroring the v13 implementation,
so the capability check short-circuits while in BACO.
Reported-by: Nathan Blomquist <nblomquist@gmail.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/6076
Tested-by: Nathan Blomquist <nblomquist@gmail.com>
Fixes: 13d75eadfa1a ("drm/amd/pm: correct the runpm handling for BACO supported ASIC")
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patch.msgid.link/20261103141457.2558235-1-mario.limonciello@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit d515b2694eab5b35533c7fb7af5bddff53ff60d3)
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 20 ++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 48bf000f12e5c..42a4ba9965081 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1559,7 +1559,25 @@ int smu_v11_0_set_azalia_d3_pme(struct smu_context *smu)
int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu,
enum smu_baco_seq baco_seq)
{
- return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ArmD3, baco_seq, NULL);
+ struct smu_baco_context *smu_baco = &smu->smu_baco;
+ int ret;
+
+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ArmD3, baco_seq, NULL);
+ if (ret)
+ return ret;
+
+ /*
+ * PMFW owns the BACO transition once armed, so keep the driver's view
+ * in sync. Otherwise smu_v11_0_get_bamaco_support() falls back to the
+ * live BACO feature bit, which PMFW clears when armed, and the runtime
+ * resume wrongly concludes BACO is unsupported and skips the exit.
+ */
+ if (baco_seq == BACO_SEQ_BAMACO || baco_seq == BACO_SEQ_BACO)
+ smu_baco->state = SMU_BACO_STATE_ENTER;
+ else
+ smu_baco->state = SMU_BACO_STATE_EXIT;
+
+ return 0;
}
int smu_v11_0_get_bamaco_support(struct smu_context *smu)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 261/990] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (259 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 260/990] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 262/990] ACPI: scan: Print the offline failure message in acpi_bus_offline() Greg Kroah-Hartman
` (591 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <rf@opensource.cirrus.com>
[ Upstream commit 39d31f76ad1b12f1b5e6ef4c15f89e6b3c3f603a ]
If cs_dsp_power_up() fails on or after cs_dsp_load() mark the controls
disabled and free the alg regions.
Fixes: f6bc909e7673c ("firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20261104152402.1153795-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/firmware/cirrus/cs_dsp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 15710c97f9fb0..0e20f72cfdfcf 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -2745,6 +2745,7 @@ int cs_dsp_power_up(struct cs_dsp *dsp,
const struct firmware *coeff_firmware, const char *coeff_filename,
const char *fw_name)
{
+ struct cs_dsp_coeff_ctl *ctl;
int ret;
mutex_lock(&dsp->pwr_lock);
@@ -2789,6 +2790,11 @@ int cs_dsp_power_up(struct cs_dsp *dsp,
return 0;
err_ena:
+ list_for_each_entry(ctl, &dsp->ctl_list, list)
+ ctl->enabled = 0;
+
+ cs_dsp_free_alg_regions(dsp);
+
if (dsp->ops->disable_core)
dsp->ops->disable_core(dsp);
err_mem:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 262/990] ACPI: scan: Print the offline failure message in acpi_bus_offline()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (260 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 261/990] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 263/990] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online() Greg Kroah-Hartman
` (590 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Sasha Levin,
Rafael J. Wysocki
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b9ea1e921c2721546f53270cffdc6866e20576dd ]
When a physical node of an ACPI device being hot-removed cannot be
offlined, acpi_bus_offline() passes the physical device back to
acpi_scan_try_to_offline() through ret_p and the latter prints
"Offline failed." for it after the namespace walk. By then
physical_node_lock is not held anymore, so the device may have been
unbound from its ACPI companion and freed in the meantime.
Print the message in acpi_bus_offline() when device_offline() fails in
the second pass, while physical_node_lock keeps the device bound to its
ACPI companion and so the reference taken by acpi_bind_one() is still
held. acpi_scan_try_to_offline() only needs to know that something
could not be offlined, so pass the ACPI device back through ret_p
instead, like in the "Offline disabled." case.
Fixes: 303bfdb1a14d ("ACPI / scan: Add second pass of companion offlining to hot-remove code")
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Link: https://patch.msgid.link/20261029034507.2721580-2-sashal@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/scan.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 3893e44005f40..e4bca03a4e476 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -165,8 +165,9 @@ static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
if (ret >= 0) {
pn->put_online = !ret;
} else {
- *ret_p = pn->dev;
+ *ret_p = &device->dev;
if (second_pass) {
+ dev_warn(pn->dev, "Offline failed.\n");
status = AE_ERROR;
break;
}
@@ -235,7 +236,6 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
(void **)&errdev);
if (errdev) {
- dev_warn(errdev, "Offline failed.\n");
acpi_bus_online(handle, 0, NULL, NULL);
acpi_walk_namespace(ACPI_TYPE_ANY, handle,
ACPI_UINT32_MAX, acpi_bus_online,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 263/990] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (261 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 262/990] ACPI: scan: Print the offline failure message in acpi_bus_offline() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 264/990] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add() Greg Kroah-Hartman
` (589 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+cea7285bc17b76ffe39f,
syzbot+a265816368571f78ab88, Sasha Levin, Rafael J. Wysocki
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 17654aa629cba9a70e31cc1b7226a4fc1a1c801a ]
acpi_bus_offline() and acpi_bus_online() hold the physical_node_lock of
the ACPI device being hot-removed while they call device_offline() and
device_online() for its physical nodes. Offlining a CPU this way takes
cpu_add_remove_lock and the CPU hotplug lock under physical_node_lock,
and lockdep connects that to the uevent attribute of platform devices,
whose store method takes physical_node_lock in
acpi_primary_dev_companion():
physical_node_lock (acpi_bus_offline())
-> cpu_add_remove_lock -> cpu_hotplug_lock
-> cpuhp_state-down (mce_cpu_pre_down() unregistering a device)
-> device_links_lock (device_links_purge())
-> kn->active of a uevent attribute (device link unregistration)
-> physical_node_lock (uevent_store() -> acpi_companion_match())
syzbot has reported this cycle twice. The uevent attribute waited for in
the link unregistration is the device link's, not a platform device's,
and the physical_node_lock taken at the end is that of the platform
device's ACPI companion, not of the processor being ejected, so lockdep
only connects them because they share lock classes and this is unlikely
to deadlock. However, lockdep turns itself off after reporting it.
It can be reproduced in a QEMU guest by writing to the uevent attribute
of an ACPI-enumerated platform device, reading the uevent attribute of a
device link while the link is removed, offlining a CPU and ejecting one
through sysfs.
physical_node_lock protects the list of physical nodes. Since
acpi_unbind_one() blocks on it, holding it also keeps device_offline()
and device_online() from running in parallel with whatever happens to a
device after it has been unbound from its ACPI companion, but that is not
necessary: a reference to each device is held while the lock is dropped,
and the removal of the devices that can actually be taken offline here
(CPUs, memory blocks and containers) is serialized by the device hotplug
lock or acpi_scan_lock, both of which acpi_device_hotplug() holds
throughout.
So drop physical_node_lock around device_offline() and device_online().
Mark the nodes to offline with a new offline_pending flag, hold a
reference to each device while the lock is dropped, and look its node up
again afterwards to record whether it needs to be put back online,
because it may have been unbound in the meantime. Physical nodes added
while the lock is not held are not offlined by the current pass, which is
no different from adding them right after it.
Since acpi_container_offline() no longer runs under the container's
physical_node_lock, the nesting annotation added to
acpi_scan_is_offline() by commit 4c533c801d1c ("ACPI / scan: Annotate
physical_node_lock in acpi_scan_is_offline()") is not needed anymore, so
drop it.
Fixes: 683058e315f0 ("ACPI / hotplug: Use device offline/online for graceful hot-removal")
Reported-by: syzbot+cea7285bc17b76ffe39f@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6ae18ed0.6200f071.51519.0f60.GAE@google.com
Reported-by: syzbot+a265816368571f78ab88@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6adf293a.67317f00.38c4bc.00af.GAE@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Link: https://patch.msgid.link/20261029034507.2721580-3-sashal@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/scan.c | 106 +++++++++++++++++++++++++++++++++-------
include/acpi/acpi_bus.h | 1 +
2 files changed, 88 insertions(+), 19 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index e4bca03a4e476..ab8382c812e8f 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -114,11 +114,7 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
bool offline = true;
char *envp[] = { "EVENT=offline", NULL };
- /*
- * acpi_container_offline() calls this for all of the container's
- * children under the container's physical_node_lock lock.
- */
- mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
+ mutex_lock(&adev->physical_node_lock);
list_for_each_entry(pn, &adev->physical_node_list, node)
if (device_supports_offline(pn->dev) && !pn->dev->offline) {
@@ -133,6 +129,59 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent)
return offline;
}
+static struct acpi_device_physical_node *
+acpi_find_physical_node(struct acpi_device *adev, struct device *dev)
+{
+ struct acpi_device_physical_node *pn;
+
+ lockdep_assert_held(&adev->physical_node_lock);
+
+ list_for_each_entry(pn, &adev->physical_node_list, node)
+ if (pn->dev == dev)
+ return pn;
+
+ return NULL;
+}
+
+static struct device *acpi_next_offline_pending(struct acpi_device *adev)
+{
+ struct acpi_device_physical_node *pn;
+
+ lockdep_assert_held(&adev->physical_node_lock);
+
+ /*
+ * Find the first physical node that is still to be offlined, clear its
+ * offline_pending flag and return its device with a reference held.
+ */
+ list_for_each_entry(pn, &adev->physical_node_list, node)
+ if (pn->offline_pending) {
+ pn->offline_pending = false;
+ return get_device(pn->dev);
+ }
+
+ return NULL;
+}
+
+static struct device *acpi_next_put_online(struct acpi_device *adev)
+{
+ struct acpi_device_physical_node *pn;
+
+ lockdep_assert_held(&adev->physical_node_lock);
+
+ /*
+ * Find the first physical node that has been offlined by
+ * acpi_bus_offline(), clear its put_online flag and return its device
+ * with a reference held.
+ */
+ list_for_each_entry(pn, &adev->physical_node_list, node)
+ if (pn->put_online) {
+ pn->put_online = false;
+ return get_device(pn->dev);
+ }
+
+ return NULL;
+}
+
static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
void **ret_p)
{
@@ -140,6 +189,7 @@ static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
struct acpi_device_physical_node *pn;
bool second_pass = (bool)data;
acpi_status status = AE_OK;
+ struct device *dev;
if (!device)
return AE_OK;
@@ -152,26 +202,43 @@ static acpi_status acpi_bus_offline(acpi_handle handle, u32 lvl, void *data,
mutex_lock(&device->physical_node_lock);
list_for_each_entry(pn, &device->physical_node_list, node) {
- int ret;
-
if (second_pass) {
/* Skip devices offlined by the first pass. */
- if (pn->put_online)
- continue;
+ pn->offline_pending = !pn->put_online;
} else {
+ pn->offline_pending = true;
pn->put_online = false;
}
- ret = device_offline(pn->dev);
+ }
+
+ /*
+ * Drop physical_node_lock around device_offline(), because the latter
+ * acquires locks, like the CPU hotplug ones, that must not nest under
+ * it.
+ */
+ while ((dev = acpi_next_offline_pending(device))) {
+ int ret;
+
+ mutex_unlock(&device->physical_node_lock);
+ ret = device_offline(dev);
+ mutex_lock(&device->physical_node_lock);
+
if (ret >= 0) {
- pn->put_online = !ret;
+ /* The device may have been unbound in the meantime. */
+ pn = acpi_find_physical_node(device, dev);
+ if (pn)
+ pn->put_online = !ret;
} else {
*ret_p = &device->dev;
if (second_pass) {
- dev_warn(pn->dev, "Offline failed.\n");
+ dev_warn(dev, "Offline failed.\n");
status = AE_ERROR;
- break;
}
}
+
+ put_device(dev);
+ if (ACPI_FAILURE(status))
+ break;
}
mutex_unlock(&device->physical_node_lock);
@@ -183,18 +250,19 @@ static acpi_status acpi_bus_online(acpi_handle handle, u32 lvl, void *data,
void **ret_p)
{
struct acpi_device *device = acpi_fetch_acpi_dev(handle);
- struct acpi_device_physical_node *pn;
+ struct device *dev;
if (!device)
return AE_OK;
mutex_lock(&device->physical_node_lock);
- list_for_each_entry(pn, &device->physical_node_list, node)
- if (pn->put_online) {
- device_online(pn->dev);
- pn->put_online = false;
- }
+ while ((dev = acpi_next_put_online(device))) {
+ mutex_unlock(&device->physical_node_lock);
+ device_online(dev);
+ mutex_lock(&device->physical_node_lock);
+ put_device(dev);
+ }
mutex_unlock(&device->physical_node_lock);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index d6b449c6ecd3a..f568089194ab2 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -363,6 +363,7 @@ struct acpi_device_physical_node {
struct device *dev;
unsigned int node_id;
bool put_online:1;
+ bool offline_pending:1;
};
struct acpi_device_properties {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 264/990] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (262 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 263/990] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 265/990] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path Greg Kroah-Hartman
` (588 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <rf@opensource.cirrus.com>
[ Upstream commit 4d07af76ca41cc1a03240cd3b5f44dc428856214 ]
Check that avail does not become < 1 in wm_adsp_control_add(). This
prevents overflows during subsequent operations.
The main aim is to trap a negative value in avail, but a zero length
would mean that the control ends up without a name, so 1 is the smallest
valid value.
Fixes: b7ede5af62ab6 ("ASoC: wm_adsp: Take prefix into account in control name length")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20261104133322.1085061-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wm_adsp.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 751a3c25e4f0b..7c1c2ba7a0f6f 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -44,6 +44,9 @@
#define adsp_dbg(_dsp, fmt, ...) \
dev_dbg(_dsp->cs_dsp.dev, "%s: " fmt, _dsp->cs_dsp.name, ##__VA_ARGS__)
+#define adsp_warn_once(_dsp, fmt, ...) \
+ dev_warn_once(_dsp->cs_dsp.dev, "%s: " fmt, _dsp->cs_dsp.name, ##__VA_ARGS__)
+
#define compr_err(_obj, fmt, ...) \
adsp_err(_obj->dsp, "%s: " fmt, _obj->name ? _obj->name : "legacy", \
##__VA_ARGS__)
@@ -619,6 +622,13 @@ int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
if (dsp->component->name_prefix)
avail -= strlen(dsp->component->name_prefix) + 1;
+ if (avail < 1) {
+ adsp_warn_once(dsp,
+ "%.*s: ALSA prefix too long: control not created\n",
+ cs_ctl->subname_len, cs_ctl->subname);
+ return -EINVAL;
+ }
+
/* Truncate the subname from the start if it is too long */
if (cs_ctl->subname_len > avail)
skip = cs_ctl->subname_len - avail;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 265/990] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (263 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 264/990] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 266/990] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections Greg Kroah-Hartman
` (587 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zijun Hu, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <zijun.hu@oss.qualcomm.com>
[ Upstream commit 3efdadae3a252b14ca1f62b16e31a9aa7c5d30cf ]
Correct (Input|Output)_Transport_Unit_Size based on Core spec v6.3,
Vol 4, Part E, 7.1.45:
"The Host shall set the Input_Transport_Unit_Size and
Output_Transport_Unit_Size to be equal. For HCI Host transport
the Host shall set them to 0."
Fixes: b2af264ad3af ("Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_conn.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index f7645dc0ad2ae..29e13da009505 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -330,8 +330,10 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data)
cp.out_pcm_sample_payload_msb_pos = 0;
cp.in_data_path = conn->codec.data_path;
cp.out_data_path = conn->codec.data_path;
- cp.in_transport_unit_size = 1;
- cp.out_transport_unit_size = 1;
+ if (conn->codec.data_path) {
+ cp.in_transport_unit_size = 1;
+ cp.out_transport_unit_size = 1;
+ }
break;
case BT_CODEC_TRANSPARENT:
@@ -356,8 +358,10 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data)
cp.out_pcm_sample_payload_msb_pos = 0;
cp.in_data_path = conn->codec.data_path;
cp.out_data_path = conn->codec.data_path;
- cp.in_transport_unit_size = 1;
- cp.out_transport_unit_size = 1;
+ if (conn->codec.data_path) {
+ cp.in_transport_unit_size = 1;
+ cp.out_transport_unit_size = 1;
+ }
break;
case BT_CODEC_CVSD:
@@ -387,8 +391,10 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data)
cp.out_pcm_sample_payload_msb_pos = 0;
cp.in_data_path = conn->codec.data_path;
cp.out_data_path = conn->codec.data_path;
- cp.in_transport_unit_size = 16;
- cp.out_transport_unit_size = 16;
+ if (conn->codec.data_path) {
+ cp.in_transport_unit_size = 16;
+ cp.out_transport_unit_size = 16;
+ }
break;
default:
goto unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 266/990] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (264 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 265/990] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 267/990] Bluetooth: qca: Disable SoC debug logging for WCN3950 Greg Kroah-Hartman
` (586 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 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 15a80cc8263abd50132a05d1b06824de8e28abcb ]
Incoming LE and ECRED channels retain the peer's request identifier
after an immediate response. The deferred LE response also leaves the
identifier set, unlike the deferred ECRED response.
A later ECRED request can reuse that identifier and include an unrelated
channel in its shared-response handling. That walk matches on the
identifier alone, so an LE channel is selected too. If the old channel is
closing, the checks can refuse the new connection. The check at request
receipt rejects it with L2CAP_CR_LE_INVALID_PARAMS; the check before a
deferred response returns L2CAP_CR_LE_AUTHORIZATION.
Store the identifier only when deferring the response, and clear it
after sending the deferred LE response. Keep deferred ECRED identifiers
until the shared response is sent, since a partially accepted group
still needs them.
AI assistance was used.
Fixes: 27e2d4c8d28b ("Bluetooth: Add basic LE L2CAP connect request receiving support")
Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
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, 3 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 2df5d25bfee60..eef49a65084b4 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3914,6 +3914,7 @@ void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan)
l2cap_send_cmd(conn, chan->ident, L2CAP_LE_CONN_RSP, sizeof(rsp),
&rsp);
+ chan->ident = 0;
}
static void l2cap_ecred_list_defer(struct l2cap_chan *chan, void *data)
@@ -5162,10 +5163,10 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
__set_chan_timer(chan, chan->ops->get_sndtimeo(chan));
- chan->ident = cmd->ident;
chan->mode = L2CAP_MODE_LE_FLOWCTL;
if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) {
+ chan->ident = cmd->ident;
l2cap_state_change(chan, BT_CONNECT2);
/* The following result value is actually not defined
* for LE CoC but we use it to let the function know
@@ -5395,10 +5396,10 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,
__set_chan_timer(chan, chan->ops->get_sndtimeo(chan));
- chan->ident = cmd->ident;
chan->mode = L2CAP_MODE_EXT_FLOWCTL;
if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) {
+ chan->ident = cmd->ident;
l2cap_state_change(chan, BT_CONNECT2);
defer = true;
chan->ops->defer(chan);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 267/990] Bluetooth: qca: Disable SoC debug logging for WCN3950
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (265 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 266/990] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 268/990] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed Greg Kroah-Hartman
` (585 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stanislavs Nilovs,
Bartosz Golaszewski, Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislavs Nilovs <valorcool@gmail.com>
[ Upstream commit d97b618b6675516d63d55b8f31ee6cb3b164bd6b ]
Added WCN3950 module to the switch-case to disable SoC debug packets.
Fixes: 590deccf4c06 ("Bluetooth: hci_qca: Disable SoC debug logging for WCN3991")
Signed-off-by: Stanislavs Nilovs <valorcool@gmail.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btqca.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 4215522e62a2c..ba0b8869b3f6e 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -948,6 +948,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
switch (soc_type) {
case QCA_QCA2066:
case QCA_QCA6390:
+ case QCA_WCN3950:
case QCA_WCN3991:
case QCA_WCN6750:
case QCA_WCN6855:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 268/990] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (266 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 267/990] Bluetooth: qca: Disable SoC debug logging for WCN3950 Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 269/990] net: dsa: b53: restore the NSP IMP port 2 Gbps mode Greg Kroah-Hartman
` (584 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Simon Horman,
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 d4f3d2c04624854d27aa948cd7bfc9d946faaac5 ]
Northstar and Northstar Plus use a 2.5 Gbps internal link between the
AMAC and the switch. BGMAC_FEAT_FORCE_SPEED_2500 makes bgmac_miiconfig()
configure that speed, but bgmac_adjust_link() subsequently replaces it
with the synthetic fixed PHY's 1 Gbps speed.
Use the forced speed when processing link changes so the MAC remains at
2.5 Gbps. Together with configuring the switch IMP port for its 2 Gbps
mode, this eliminates the output queue discards that caused approximately
1000 TCP retransmissions per second during an iperf3 transmit test.
Restrict the platform forced-speed flag to Northstar Plus using the SoC
compatible, since Hurricane2 shares the AMAC compatible. Other platform
AMACs without a phy-handle must continue following the fixed PHY speed.
The BCMA path already selects the flag only for the Northstar family.
Fixes: f6a95a24957a ("net: ethernet: bgmac: Add platform device support")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029211540.4123250-2-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bgmac-platform.c | 3 ++-
drivers/net/ethernet/broadcom/bgmac.c | 8 ++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 4e266ce41180b..4880b18904812 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -243,7 +243,8 @@ static int bgmac_probe(struct platform_device *pdev)
bgmac->phy_connect = platform_phy_connect;
} else {
bgmac->phy_connect = bgmac_phy_connect_direct;
- bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
+ if (of_machine_is_compatible("brcm,nsp"))
+ bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
}
return bgmac_enet_probe(bgmac);
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index b3f0ecc583fd5..409155fe8df0d 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1428,11 +1428,15 @@ void bgmac_adjust_link(struct net_device *net_dev)
{
struct bgmac *bgmac = netdev_priv(net_dev);
struct phy_device *phy_dev = net_dev->phydev;
+ int speed = phy_dev->speed;
bool update = false;
+ if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500)
+ speed = SPEED_2500;
+
if (phy_dev->link) {
- if (phy_dev->speed != bgmac->mac_speed) {
- bgmac->mac_speed = phy_dev->speed;
+ if (speed != bgmac->mac_speed) {
+ bgmac->mac_speed = speed;
update = true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 269/990] net: dsa: b53: restore the NSP IMP port 2 Gbps mode
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (267 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 268/990] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 270/990] Bluetooth: Fix not updating of hdev->commands[] after reset Greg Kroah-Hartman
` (583 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Simon Horman,
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 41af38324341df9d769641d6485abb67fd5209ed ]
The Northstar Plus IMP port uses the switch's proprietary 2 Gbps mode for
its internal link to the AMAC. Its fixed-link description reports 1 Gbps,
so applying that speed clears PORT_OVERRIDE_SPEED_2000M and leaves the two
ends of the internal link configured at different speeds.
Force the 2 Gbps mode and flow control for BCM5301x and NSP CPU ports. The
mismatch caused switch output queue discards on both copper and SerDes
ports, with one discard for every TCP retransmission. With both ends
restored to their high-speed modes, iperf3 reports no retransmissions.
Fixes: b6a8a5477fe9 ("net: dsa: b53: fix resetting speed and pause on forced link")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261029211540.4123250-3-florian.fainelli@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/dsa/b53/b53_common.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index af73a9f70773d..137bc55b86d6b 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1702,9 +1702,15 @@ static void b53_phylink_mac_link_up(struct phylink_config *config,
}
if (mode == MLO_AN_FIXED) {
- /* Force flow control on BCM5301x's CPU port */
- if (is5301x(dev) && dsa_is_cpu_port(ds, port))
- tx_pause = rx_pause = true;
+ /* Force flow control and 2Gbits/sec on BCM5301x and NSP CPU
+ * ports
+ */
+ if ((is5301x(dev) || dev->chip_id == BCM58XX_DEVICE_ID) &&
+ dsa_is_cpu_port(ds, port)) {
+ tx_pause = true;
+ rx_pause = true;
+ speed = 2000;
+ }
b53_force_port_config(dev, port, speed, duplex,
tx_pause, rx_pause);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 270/990] Bluetooth: Fix not updating of hdev->commands[] after reset
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (268 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 269/990] net: dsa: b53: restore the NSP IMP port 2 Gbps mode Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 271/990] spi: cadence-quadspi: Fix race between DMA completion and transfer start Greg Kroah-Hartman
` (582 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, 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 e00aa1a33f81a5e25b510f569ab9cb9f97eb41b9 ]
Read Local Supported Commands was only read once during the INIT/SETUP
flow, but the supported commands bits may change at runtime, for
example after a firmware change applied with vendor commands, so update
hdev->commands[] every time the response is received.
Fixes: 6a070e6e81ad ("Bluetooth: Store supported commands only during setup procedure")
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 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 8b9b27f2d8916..3e487963eaff9 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -792,9 +792,7 @@ static u8 hci_cc_read_local_commands(struct hci_dev *hdev, void *data,
if (rp->status)
return rp->status;
- if (hci_dev_test_flag(hdev, HCI_SETUP) ||
- hci_dev_test_flag(hdev, HCI_CONFIG))
- memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
+ memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
return rp->status;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 271/990] spi: cadence-quadspi: Fix race between DMA completion and transfer start
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (269 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 270/990] Bluetooth: Fix not updating of hdev->commands[] after reset Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 272/990] drm/nouveau/fifo: map Kepler video engine contexts non-privileged Greg Kroah-Hartman
` (581 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Frederic Konrad, Srikanth Boyapally,
Radhey Shyam Pandey, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Konrad <fkonrad@amd.com>
[ Upstream commit 059518f775baecc9803fc97787bd0b17558f8047 ]
In cqspi_versal_indirect_read_dma(), the DMA transfer is started by
writing CQSPI_REG_INDIRECTRD_START_MASK to the indirect read control
register. Under certain timing conditions, the DMA completion interrupt
may be triggered and complete the transfer before the completion
structure is reinitialized.
This creates a race where the completion event is lost, causing
wait_for_completion_timeout() to time out even though the transfer has
already completed, resulting in errors such as:
spi-nor spi0.0: CS0: operation failed with -110
Fix this by reinitializing the completion structure before starting the
DMA transfer, ensuring that any completion event generated after the
transfer begins is correctly observed.
Fixes: 1a6f854f7daa ("spi: cadence-quadspi: Add Xilinx Versal external DMA support")
Signed-off-by: Frederic Konrad <fkonrad@amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Link: https://patch.msgid.link/20261104071958.2405117-1-radhey.shyam.pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-cadence-quadspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 441426bc232ef..f74abed42eab9 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -957,11 +957,11 @@ static int cqspi_versal_indirect_read_dma(struct cqspi_flash_pdata *f_pdata,
writel(CQSPI_REG_VERSAL_DMA_DST_CTRL_VAL,
reg_base + CQSPI_REG_VERSAL_DMA_DST_CTRL);
+ reinit_completion(&cqspi->transfer_complete);
+
writel(CQSPI_REG_INDIRECTRD_START_MASK,
reg_base + CQSPI_REG_INDIRECTRD);
- reinit_completion(&cqspi->transfer_complete);
-
if (!wait_for_completion_timeout(&cqspi->transfer_complete,
msecs_to_jiffies(max_t(size_t, bytes_to_dma, 500)))) {
ret = -ETIMEDOUT;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 272/990] drm/nouveau/fifo: map Kepler video engine contexts non-privileged
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (270 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 271/990] spi: cadence-quadspi: Fix race between DMA completion and transfer start Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 273/990] drm/nouveau: Fix CE channel creation on pre-Kepler GPUs Greg Kroah-Hartman
` (580 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rosen Penev, Dave Airlie,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 0820004c342af7ca1b01d0b21e0d5d99ad5c10eb ]
Since the engine context rework, gk104_ectx_ctor() maps every engine
context into the channel's VMM as a privileged page. The MSVLD,
MSPDEC and MSPPP falcons on Kepler fetch their context with
non-privileged requests, so the first method sent to any of them
faults and the channel is killed:
fifo: fault 00 [READ] at 0000000001050000 engine 10 [MSVLD] client 0d [HUB/MSVLD] reason 05 [PRIV_VIOLATION] on channel 9
fifo: fault 00 [READ] at 0000000001051000 engine 14 [MSPDEC] client 0b [HUB/MSPDEC] reason 05 [PRIV_VIOLATION] on channel 10
fifo: fault 00 [READ] at 0000000001052000 engine 11 [MSPPP] client 0c [HUB/MSPPP] reason 05 [PRIV_VIOLATION] on channel 11
Before the rework, gk104_fifo_gpfifo_engine_ctor() mapped engine
contexts without the privileged bit. Restore that for the three video
engines, and keep the privileged mapping for everything else.
Fixes: 8ab849d6dd4c ("drm/nouveau/fifo: add new engine context handling")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patch.msgid.link/20261103221529.585436-1-rosenp@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
index 5655eda52a7b5..912eb6c3a13d4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
@@ -180,6 +180,19 @@ gk104_ectx_ctor(struct nvkm_engn *engn, struct nvkm_vctx *vctx)
struct gf100_vmm_map_v0 args = { .priv = 1 };
int ret;
+ /* The video falcons access their context with non-privileged
+ * requests, and fault with PRIV_VIOLATION on a privileged mapping.
+ */
+ switch (engn->engine->subdev.type) {
+ case NVKM_ENGINE_MSVLD:
+ case NVKM_ENGINE_MSPDEC:
+ case NVKM_ENGINE_MSPPP:
+ args.priv = 0;
+ break;
+ default:
+ break;
+ }
+
ret = nvkm_vmm_get(vctx->vmm, 12, vctx->inst->size, &vctx->vma);
if (ret)
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 273/990] drm/nouveau: Fix CE channel creation on pre-Kepler GPUs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (271 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 272/990] drm/nouveau/fifo: map Kepler video engine contexts non-privileged Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 274/990] ALSA: hda/core: Stop capability walk on empty capability header Greg Kroah-Hartman
` (579 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Munique Feitoza, Dave Airlie,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Munique Feitoza <muniquefeitoz4@gmail.com>
[ Upstream commit a2b7b707d75e605d31fb3d85a6b27f8bb2a01413 ]
Commit 04e0481526e3 ("nouveau/dmem: Fix privileged error in copy engine
channel") changed nouveau_accel_ce_init() to unconditionally request a
privileged channel (priv = true) when calling nouveau_channel_new().
However, privileged channels (func->ramfc->priv) are only supported on
Kepler (gk104_chan_ramfc) and newer FIFO implementations. On pre-Kepler
GPUs that expose a Copy Engine runlist, func->ramfc->priv is false,
which causes nvkm_chan_new_() to reject the channel creation with
-EINVAL:
nouveau 0000:01:00.0: DRM: failed to create ce channel, -22
Only request a privileged CE channel when device->info.family >=
NV_DEVICE_INFO_V0_KEPLER.
Fixes: 04e0481526e3 ("nouveau/dmem: Fix privileged error in copy engine channel")
Signed-off-by: Munique Feitoza <muniquefeitoz4@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patch.msgid.link/20261030202809.28723-1-muniquefeitoz4@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/nouveau/nouveau_drm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index d05da2db94a44..d4fe0e4f07985 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -336,6 +336,7 @@ static void
nouveau_accel_ce_init(struct nouveau_drm *drm)
{
struct nvif_device *device = &drm->client.device;
+ bool priv;
u64 runm;
int ret = 0;
@@ -348,7 +349,11 @@ nouveau_accel_ce_init(struct nouveau_drm *drm)
return;
}
- ret = nouveau_channel_new(&drm->client, true, runm, NvDmaFB, NvDmaTT, &drm->cechan);
+ /* priv copy engine only works on kepler and newer. */
+ priv = device->info.family >= NV_DEVICE_INFO_V0_KEPLER;
+
+ ret = nouveau_channel_new(&drm->client, priv, runm, NvDmaFB, NvDmaTT,
+ &drm->cechan);
if (ret)
NV_ERROR(drm, "failed to create ce channel, %d\n", ret);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 274/990] ALSA: hda/core: Stop capability walk on empty capability header
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (272 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 273/990] drm/nouveau: Fix CE channel creation on pre-Kepler GPUs Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 275/990] ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down() Greg Kroah-Hartman
` (578 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michał Kopeć, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Kopeć <michal.kopec@3mdeb.com>
[ Upstream commit f65c917397c77daeb7e6d0893ebe89107ddd5692 ]
snd_hdac_bus_parse_capabilities() walks the controller's linked
capability list starting at LLCH. On some platforms one of the entries
reads back as all zeros. Such a header does not describe a capability,
but the walk still treats it as one: it falls into the default case and
reports an error, printing the raw register value instead of the
capability ID:
snd_hda_intel 0000:00:1f.3: Unknown capability 0
The walk then stops anyway, because the next pointer of a zero header
is 0, so the message is only noise.
Treat an all-zero header as the end of the list, the same way a failed
read (-1) is already handled, and log it at debug level only. Also
print the capability ID in hex for a genuinely unknown capability,
instead of the full header value.
Fixes: 0b00a5615dc4 ("ALSA: hdac_ext: add hdac extended controller")
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
Link: https://patch.msgid.link/20261102114939.2182131-1-michal.kopec@3mdeb.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/core/controller.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/sound/hda/core/controller.c b/sound/hda/core/controller.c
index a7c00ad801170..fd09b4b18fd84 100644
--- a/sound/hda/core/controller.c
+++ b/sound/hda/core/controller.c
@@ -426,6 +426,13 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
break;
}
+ /* An all-zero header means no capability is present here */
+ if (!cur_cap) {
+ dev_dbg(bus->dev, "Empty capability header at offset 0x%x\n",
+ offset);
+ break;
+ }
+
switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
case AZX_ML_CAP_ID:
dev_dbg(bus->dev, "Found ML capability\n");
@@ -456,7 +463,8 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
break;
default:
- dev_err(bus->dev, "Unknown capability %d\n", cur_cap);
+ dev_err(bus->dev, "Unknown capability ID 0x%x\n",
+ (cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
cur_cap = 0;
break;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 275/990] ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (273 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 274/990] ALSA: hda/core: Stop capability walk on empty capability header Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 276/990] net: 8139cp: keep Rx masked while NAPI is scheduled Greg Kroah-Hartman
` (577 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Richard Fitzgerald, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <rf@opensource.cirrus.com>
[ Upstream commit 8c63987ac7fe605c337edbf9052cf97e2a415558 ]
In cs35l56_hda_unbind() call cs_dsp_stop() before cs_dsp_power_down()
if cs_dsp is in a running state.
cs35l56_hda_runtime_resume() calls cs_dsp_run() if cs_dsp_power_up() has
previously run successfully. If cs35l56_hda_unbind() is then called while
in this runtime-resumed state cs_dsp will be running. The code wasn't
checking for this and was calling cs_dsp_power_down() while still in a
running state, which is illegal. This is currently fairly harmless for
the cs35l56 driver. But it doesn't comply with the API, so potentially
could break with any future changes that expect the correct API use.
Fixes: fb78d73dde2d4 ("ALSA: hda/cs35l56: Call cs_dsp_power_down() before calling cs_dsp_remove()")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20261104122337.1072468-1-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/codecs/side-codecs/cs35l56_hda.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/hda/codecs/side-codecs/cs35l56_hda.c b/sound/hda/codecs/side-codecs/cs35l56_hda.c
index baf286bf7ec83..b55391fed61ac 100644
--- a/sound/hda/codecs/side-codecs/cs35l56_hda.c
+++ b/sound/hda/codecs/side-codecs/cs35l56_hda.c
@@ -738,6 +738,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
cs_dsp_cleanup_debugfs(&cs35l56->cs_dsp);
debugfs_remove_recursive(cs35l56->debugfs_root);
#endif
+ if (cs35l56->cs_dsp.running)
+ cs_dsp_stop(&cs35l56->cs_dsp);
if (cs35l56->base.fw_patched)
cs_dsp_power_down(&cs35l56->cs_dsp);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 276/990] net: 8139cp: keep Rx masked while NAPI is scheduled
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (274 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 275/990] ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 277/990] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up Greg Kroah-Hartman
` (576 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Colton Pawielski, Daniel Machon,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colton Pawielski <colton.pawielski@gmail.com>
[ Upstream commit 547b1ae5ec50b7d81b05b4219e0db7e56279d65f ]
cp_rx_poll() calls napi_complete_done() and only then takes cp->lock
with interrupts disabled to unmask the Rx interrupts. An interrupt
that is not masked while polling (TxOK, TxErr, ...) can arrive in
between. cp_interrupt() then sees the Rx status bits, which are still
set, finds NAPI no longer scheduled, masks Rx and schedules NAPI again.
cp_rx_poll() then carries on and unmasks Rx anyway.
>From that point Rx interrupts are enabled while NAPI is scheduled:
cp_interrupt() leaves the Rx bits for the poll routine, does not mask
them because napi_schedule_prep() fails, and the level-triggered
interrupt fires again as soon as it returns. On an SH7751 LANDISK
under combined Tx/Rx load this interrupt storm was captured with a RAM
trace right before the board locked up hard.
Mask Rx in cp_interrupt() whenever Rx status is pending, not only when
NAPI gets scheduled. If the race leaves Rx unmasked, the next interrupt
masks it again, and the pending poll unmasks it when it completes.
Fixes: ab1e7e1d2666 ("8139cp: use napi_complete_done()")
Signed-off-by: Colton Pawielski <colton.pawielski@gmail.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20261031-b4-8139cp-napi-v2-1-5824797c0fe6@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/realtek/8139cp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 9016527e229ac..8f81dc7deef1e 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -600,11 +600,11 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
goto out_unlock;
}
- if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
- if (napi_schedule_prep(&cp->napi)) {
- cpw16_f(IntrMask, cp_norx_intr_mask);
+ if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr)) {
+ cpw16_f(IntrMask, cp_norx_intr_mask);
+ if (napi_schedule_prep(&cp->napi))
__napi_schedule(&cp->napi);
- }
+ }
if (status & (TxOK | TxErr | TxEmpty | SWInt))
cp_tx(cp);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 277/990] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (275 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 276/990] net: 8139cp: keep Rx masked while NAPI is scheduled Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 278/990] ip6mr: Serialize multicast router socket ownership Greg Kroah-Hartman
` (575 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Timur Stukan, Hangbin Liu,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Stukan <timur.stukan.linux@gmail.com>
[ Upstream commit 9a65b9c2a97594bcaaf393329807653eff895bbf ]
In 802.3ad mode, when bond_update_speed_duplex() fails on NETDEV_UP or
NETDEV_CHANGE, bond_slave_netdev_event() sets the slave link to FAIL if
the slave has ever been up (last_link_up != 0), and to DOWN otherwise,
so that miimon can set it right once speed/duplex are valid.
last_link_up is never cleared, so a slave that is currently DOWN but
was up before is set to FAIL as well. miimon then treats it as a slave
that is still in use and takes it through the full down path again:
the link failure count is incremented, "link status definitely down"
is logged and the 802.3ad port is disabled a second time, although the
slave has not been up since it went down.
Reproduced in 802.3ad mode with miimon=100 by setting a slave down and
up again. On NETDEV_UP the speed is still unknown, so the notifier sets
FAIL, and the next miimon pass sees no carrier and proposes DOWN:
ip link add bond0 type bond mode 802.3ad miimon 100 lacp_rate 1
ip link set enp0s3 down
ip link set enp0s4 down
ip link set enp0s3 master bond0
ip link set enp0s4 master bond0
ip link set enp0s3 up
ip link set enp0s4 up
ip link set bond0 up
# wait for LACP to settle
ip link set enp0s3 down
ip link set enp0s3 up
procfs then shows "Link Failure Count: 2" in enp0s3 slave part. Also in
dmesg wrote twice: "link status definitely down, disabling slave".
Fix this by setting FAIL only for a slave that is currently UP and
leaving other states alone. An up slave that loses speed/duplex still
goes through FAIL as before, and DOWN/BACK slaves are left to miimon,
as in the other modes.
Fixes: ea53abfab960 ("bonding/802.3ad: fix link_failure_count tracking")
Signed-off-by: Timur Stukan <timur.stukan.linux@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20261101145653.63648-1-timur.stukan.linux@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/bonding/bond_main.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2e9e1b4d74da9..7066059ff3e28 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3964,18 +3964,13 @@ static int bond_slave_netdev_event(unsigned long event,
case NETDEV_CHANGE:
/* For 802.3ad mode only:
* Getting invalid Speed/Duplex values here will put slave
- * in weird state. Mark it as link-fail if the link was
- * previously up or link-down if it hasn't yet come up, and
- * let link-monitoring (miimon) set it right when correct
- * speeds/duplex are available.
+ * in weird state. Mark an up slave as link-fail and let
+ * miimon set it right when correct speed/duplex are available.
*/
if (bond_update_speed_duplex(slave) &&
- BOND_MODE(bond) == BOND_MODE_8023AD) {
- if (slave->last_link_up)
- slave->link = BOND_LINK_FAIL;
- else
- slave->link = BOND_LINK_DOWN;
- }
+ BOND_MODE(bond) == BOND_MODE_8023AD &&
+ slave->link == BOND_LINK_UP)
+ slave->link = BOND_LINK_FAIL;
if (BOND_MODE(bond) == BOND_MODE_8023AD)
bond_3ad_adapter_speed_duplex_changed(slave);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 278/990] ip6mr: Serialize multicast router socket ownership
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (276 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 277/990] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 279/990] net: ethtool: add netif_get_link_ksettings() for correct ops-locked use Greg Kroah-Hartman
` (574 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Ido Schimmel, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit c6b41de4dd9f2d6856d8d8d292348f7961034152 ]
MRT6_TABLE checks whether the socket owns its current table before
acquiring RTNL. MRT6_INIT also looks up its table before taking RTNL.
Consequently, concurrent TABLE and INIT calls can initialize the old
table and then change the socket's selected table. Another INIT can
register the same socket in the new table.
rawv6_close() calls ip6mr_sk_done(), which clears only the first table
owned by the socket. After the socket's RCU-delayed free, the other
table retains a dangling mroute_sk pointer. A subsequent multicast cache
report passes that pointer to sock_queue_rcv_skb_reason(). This produces
a KASAN slab-use-after-free in sk_filter_trim_cap().
Look up the selected table in ip6mr_sk_init() after acquiring RTNL.
Likewise, re-read the current table and check its owner under RTNL in
MRT6_TABLE before updating the selection. This preserves the single-table
ownership invariant shared with ip6mr_sk_done(), without changing the
locking of the other multicast socket options.
Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261030042221.73996-1-kylebot@openai.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/ip6mr.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index f61035619cac7..53837248498a6 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1580,12 +1580,20 @@ static void mroute_clean_tables(struct mr_table *mrt, int flags)
}
}
-static int ip6mr_sk_init(struct mr_table *mrt, struct sock *sk)
+static int ip6mr_sk_init(struct sock *sk)
{
- int err = 0;
struct net *net = sock_net(sk);
+ struct mr_table *mrt;
+ int err = 0;
rtnl_lock();
+ mrt = __ip6mr_get_table(net,
+ raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
+ if (!mrt) {
+ err = -ENOENT;
+ goto out_unlock;
+ }
+
spin_lock(&mrt_lock);
if (rtnl_dereference(mrt->mroute_sk)) {
err = -EADDRINUSE;
@@ -1601,6 +1609,7 @@ static int ip6mr_sk_init(struct mr_table *mrt, struct sock *sk)
NETCONFA_MC_FORWARDING,
NETCONFA_IFINDEX_ALL,
net->ipv6.devconf_all);
+out_unlock:
rtnl_unlock();
return err;
@@ -1699,7 +1708,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
if (optlen < sizeof(int))
return -EINVAL;
- return ip6mr_sk_init(mrt, sk);
+ return ip6mr_sk_init(sk);
case MRT6_DONE:
return ip6mr_sk_done(sk);
@@ -1820,16 +1829,21 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, sockptr_t optval,
/* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */
if (v != RT_TABLE_DEFAULT && v >= 100000000)
return -EINVAL;
- if (sk == rcu_access_pointer(mrt->mroute_sk))
- return -EBUSY;
-
rtnl_lock();
ret = 0;
- mrt = ip6mr_new_table(net, v);
- if (IS_ERR(mrt))
- ret = PTR_ERR(mrt);
- else
- raw6_sk(sk)->ip6mr_table = v;
+ mrt = __ip6mr_get_table(net,
+ raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
+ if (!mrt) {
+ ret = -ENOENT;
+ } else if (sk == rtnl_dereference(mrt->mroute_sk)) {
+ ret = -EBUSY;
+ } else {
+ mrt = ip6mr_new_table(net, v);
+ if (IS_ERR(mrt))
+ ret = PTR_ERR(mrt);
+ else
+ raw6_sk(sk)->ip6mr_table = v;
+ }
rtnl_unlock();
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 279/990] net: ethtool: add netif_get_link_ksettings() for correct ops-locked use
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (277 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 278/990] ip6mr: Serialize multicast router socket ownership Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 280/990] net: bonding: dont recurse on the slaves netdev ops lock Greg Kroah-Hartman
` (573 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maxime Chevallier,
Stanislav Fomichev, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit f32fe1d79a18592b96342a0016cd62cf9601a054 ]
__ethtool_get_link_ksettings() is exported and called from sysfs
and many drivers. It invokes ethtool_ops->get_link_ksettings
so by our own docs it should be holding netdev lock for ops locked
devices. Looks like commit 2bcf4772e45a ("net: ethtool:
try to protect all callback with netdev instance lock")
missed adding the ops lock here.
There's a number of callers we need to fix up so let's add the
netif_get_link_ksettings() helper first, without any actual
locking changes (this commit is a nop).
Not treating this as a fix because I don't think any driver cares
at this point, but if we want to remove the rtnl_lock protection
this will become critical.
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260603012840.2254293-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: a76ab5e733b4 ("bonding: fix missing down path on speed/duplex failure after FAIL->UP")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/ethtool.h | 2 ++
net/ethtool/ioctl.c | 17 ++++++++++++++---
net/ethtool/linkinfo.c | 4 ++--
net/ethtool/linkmodes.c | 4 ++--
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 5c9162193d269..8c850fb53530b 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -285,6 +285,8 @@ struct ethtool_link_ksettings {
extern int
__ethtool_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *link_ksettings);
+int netif_get_link_ksettings(struct net_device *dev,
+ struct ethtool_link_ksettings *link_ksettings);
struct ethtool_keee {
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 9431e305b2333..cb5d910844589 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -435,10 +435,10 @@ struct ethtool_link_usettings {
};
/* Internal kernel helper to query a device ethtool_link_settings. */
-int __ethtool_get_link_ksettings(struct net_device *dev,
- struct ethtool_link_ksettings *link_ksettings)
+int netif_get_link_ksettings(struct net_device *dev,
+ struct ethtool_link_ksettings *link_ksettings)
{
- ASSERT_RTNL();
+ /* once callers fixed - assert ops locked */
if (!dev->ethtool_ops->get_link_ksettings)
return -EOPNOTSUPP;
@@ -449,6 +449,17 @@ int __ethtool_get_link_ksettings(struct net_device *dev,
memset(link_ksettings, 0, sizeof(*link_ksettings));
return dev->ethtool_ops->get_link_ksettings(dev, link_ksettings);
}
+EXPORT_SYMBOL(netif_get_link_ksettings);
+
+/* Convenience helper for callers that hold only rtnl_lock(). */
+int __ethtool_get_link_ksettings(struct net_device *dev,
+ struct ethtool_link_ksettings *link_ksettings)
+{
+ ASSERT_RTNL();
+
+ /* once callers fixed - take the ops lock around this call */
+ return netif_get_link_ksettings(dev, link_ksettings);
+}
EXPORT_SYMBOL(__ethtool_get_link_ksettings);
/* convert ethtool_link_usettings in user space to a kernel internal
diff --git a/net/ethtool/linkinfo.c b/net/ethtool/linkinfo.c
index 30b8ce2751594..2d729acdaf031 100644
--- a/net/ethtool/linkinfo.c
+++ b/net/ethtool/linkinfo.c
@@ -34,7 +34,7 @@ static int linkinfo_prepare_data(const struct ethnl_req_info *req_base,
ret = ethnl_ops_begin(dev);
if (ret < 0)
return ret;
- ret = __ethtool_get_link_ksettings(dev, &data->ksettings);
+ ret = netif_get_link_ksettings(dev, &data->ksettings);
if (ret < 0)
GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
ethnl_ops_complete(dev);
@@ -104,7 +104,7 @@ ethnl_set_linkinfo(struct ethnl_req_info *req_info, struct genl_info *info)
bool mod = false;
int ret;
- ret = __ethtool_get_link_ksettings(dev, &ksettings);
+ ret = netif_get_link_ksettings(dev, &ksettings);
if (ret < 0) {
GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
return ret;
diff --git a/net/ethtool/linkmodes.c b/net/ethtool/linkmodes.c
index 259cd9ef1f2a1..4ce4f29d2a7a0 100644
--- a/net/ethtool/linkmodes.c
+++ b/net/ethtool/linkmodes.c
@@ -39,7 +39,7 @@ static int linkmodes_prepare_data(const struct ethnl_req_info *req_base,
if (ret < 0)
return ret;
- ret = __ethtool_get_link_ksettings(dev, &data->ksettings);
+ ret = netif_get_link_ksettings(dev, &data->ksettings);
if (ret < 0) {
GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
goto out;
@@ -324,7 +324,7 @@ ethnl_set_linkmodes(struct ethnl_req_info *req_info, struct genl_info *info)
bool mod = false;
int ret;
- ret = __ethtool_get_link_ksettings(dev, &ksettings);
+ ret = netif_get_link_ksettings(dev, &ksettings);
if (ret < 0) {
GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 280/990] net: bonding: dont recurse on the slaves netdev ops lock
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (278 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 279/990] net: ethtool: add netif_get_link_ksettings() for correct ops-locked use Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 281/990] bonding: fix missing down path on speed/duplex failure after FAIL->UP Greg Kroah-Hartman
` (572 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolai Buchwitz, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <kuba@kernel.org>
[ Upstream commit 107b097790e903651385a96dd96f9be158702730 ]
bond_update_speed_duplex() calls __ethtool_get_link_ksettings() on
the slave, which will soon take the slave's ops lock. One of its
callers already holds it and the other three don't, so the function
would either deadlock or run unprotected depending on the path.
Make the helper expect the slave's ops lock held and switch to
netif_get_link_ksettings(). Wrap the three call sites that don't
already hold it:
* bond_enslave() (rtnl held; core drops the lower's ops lock
around ->ndo_add_slave).
* bond_miimon_commit() (rtnl_trylock'd from the mii workqueue).
* bond_ethtool_get_link_ksettings() (rtnl held via ethtool layer,
bond device itself is not ops locked).
The call site which does already hold the ops lock is
bond_slave_netdev_event() via NETDEV_UP / NETDEV_CHANGE notifiers,
so it stays as-is.
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260603012840.2254293-6-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: a76ab5e733b4 ("bonding: fix missing down path on speed/duplex failure after FAIL->UP")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/bonding/bond_main.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7066059ff3e28..4e6a4350a6590 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -789,6 +789,10 @@ int bond_set_carrier(struct bonding *bond)
* values are invalid, set speed and duplex to -1,
* and return. Return 1 if speed or duplex settings are
* UNKNOWN; 0 otherwise.
+ *
+ * Caller must hold the slave's netdev ops lock. The notifier path
+ * (bond_netdev_event NETDEV_CHANGE/UP) reaches us with the slave's ops
+ * lock held; other call sites take it explicitly.
*/
static int bond_update_speed_duplex(struct slave *slave)
{
@@ -796,7 +800,7 @@ static int bond_update_speed_duplex(struct slave *slave)
struct ethtool_link_ksettings ecmd;
int res;
- res = __ethtool_get_link_ksettings(slave_dev, &ecmd);
+ res = netif_get_link_ksettings(slave_dev, &ecmd);
if (res < 0)
goto speed_duplex_unknown;
if (ecmd.base.speed == 0 || ecmd.base.speed == ((__u32)-1))
@@ -2114,8 +2118,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
new_slave->delay = 0;
new_slave->link_failure_count = 0;
- if (bond_update_speed_duplex(new_slave) &&
- bond_needs_speed_duplex(bond))
+ netdev_lock_ops(slave_dev);
+ res = bond_update_speed_duplex(new_slave);
+ netdev_unlock_ops(slave_dev);
+ if (res && bond_needs_speed_duplex(bond))
new_slave->link = BOND_LINK_DOWN;
new_slave->last_rx = jiffies -
@@ -2780,6 +2786,7 @@ static void bond_miimon_commit(struct bonding *bond)
struct slave *slave, *primary, *active;
bool do_failover = false;
struct list_head *iter;
+ int err;
ASSERT_RTNL();
@@ -2798,8 +2805,10 @@ static void bond_miimon_commit(struct bonding *bond)
continue;
case BOND_LINK_UP:
- if (bond_update_speed_duplex(slave) &&
- bond_needs_speed_duplex(bond)) {
+ netdev_lock_ops(slave->dev);
+ err = bond_update_speed_duplex(slave);
+ netdev_unlock_ops(slave->dev);
+ if (err && bond_needs_speed_duplex(bond)) {
slave->link = BOND_LINK_DOWN;
if (net_ratelimit())
slave_warn(bond->dev, slave->dev,
@@ -5857,7 +5866,9 @@ static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
*/
bond_for_each_slave(bond, slave, iter) {
if (bond_slave_can_tx(slave)) {
+ netdev_lock_ops(slave->dev);
bond_update_speed_duplex(slave);
+ netdev_unlock_ops(slave->dev);
if (slave->speed != SPEED_UNKNOWN) {
if (BOND_MODE(bond) == BOND_MODE_BROADCAST)
speed = bond_mode_bcast_speed(slave,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 281/990] bonding: fix missing down path on speed/duplex failure after FAIL->UP
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (279 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 280/990] net: bonding: dont recurse on the slaves netdev ops lock Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 282/990] net: stmmac: set XDP metadata length on the page_pool RX path Greg Kroah-Hartman
` (571 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Timur Stukan, Hangbin Liu,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Stukan <timur.stukan.linux@gmail.com>
[ Upstream commit a76ab5e733b41dede6f238a691eefb4374f99f79 ]
In bond_miimon_commit(), when a slave is proposed as BOND_LINK_UP but
bond_update_speed_duplex() fails in bonding mode that needs speed/duplex
(802.3ad, tlb, alb), the slave is set to BOND_LINK_DOWN directly. This
bypasses bond_set_slave_link_state(), bond_miimon_link_change() and
failover.
This is fine for slave that coming from BOND_LINK_BACK, which was never
brought up and is not in use. But since commit 1899bb325149 ("bonding:
fix state transition issue in link monitoring") the commit phase also
handles BOND_LINK_FAIL -> BOND_LINK_UP which means a slave that is still
in use and may be curr_active_slave.
If the link recovers within downdelay and goes down again before the
commit phase reads speed/duplex, the slave is silently marked down while
remaining the active slave in worst cases. In alb/tlb the bond MAC stays
on the dead port, no failover happens and TLB/RLB state is not cleaned,
so the bond stops passing traffic until that link comes back even though
other slaves are up. A non-active slave is affected too, in alb, RLB
clients assigned to it are not reassigned and become unreachable.
Reproduced in tlb and alb mode with miimon=100 and downdelay=10000 by
flapping a slave within downdelay and dropping it again before commit
(a longer delay was added between inspect and commit to make window
wider and easier to test):
bond0: (slave enp0s3): link status down for interface, disabling it in 10000 ms
bond0: (slave enp0s3): link status up again after 3400 ms
bond0: (slave enp0s3): failed to get link speed/duplex
procfs then shows the active slave with "MII Status: down" and "Link
Failure Count: 0", and all traffic is lost.
Fix this by dropping the loop in bond_mii_monitor() that applied all
proposed link states before bond_miimon_commit(). bond_miimon_commit()
now applies each state itself: UP after the speed/duplex check, as it
already did, DOWN in the down path, and FAIL/BACK directly. So when the
speed/duplex check runs, slave->link still holds the previous state. If
the check fails for a slave that is FAIL or UP, take it through the
regular down path, including failover. DOWN and BACK slaves were
never brought up and are still just reverted to DOWN. The down path is
moved into bond_miimon_slave_down() so both callers share it.
After the fix:
bond0: (slave enp0s3): failed to get link speed/duplex
bond0: (slave enp0s3): link status definitely down, disabling slave
bond0: (slave enp0s4): making interface the new active one
Fixes: 1899bb325149 ("bonding: fix state transition issue in link monitoring")
Signed-off-by: Timur Stukan <timur.stukan.linux@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20261101150240.66292-1-timur.stukan.linux@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/bonding/bond_main.c | 63 +++++++++++++++++++--------------
1 file changed, 37 insertions(+), 26 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4e6a4350a6590..ca2ea493c81a3 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2781,6 +2781,27 @@ static void bond_miimon_link_change(struct bonding *bond,
}
}
+static bool bond_miimon_slave_down(struct bonding *bond,
+ struct slave *slave)
+{
+ if (slave->link_failure_count < UINT_MAX)
+ slave->link_failure_count++;
+
+ bond_set_slave_link_state(slave, BOND_LINK_DOWN,
+ BOND_SLAVE_NOTIFY_NOW);
+
+ if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
+ BOND_MODE(bond) == BOND_MODE_8023AD)
+ bond_set_slave_inactive_flags(slave,
+ BOND_SLAVE_NOTIFY_NOW);
+
+ slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n");
+
+ bond_miimon_link_change(bond, slave, BOND_LINK_DOWN);
+
+ return slave == rcu_access_pointer(bond->curr_active_slave);
+}
+
static void bond_miimon_commit(struct bonding *bond)
{
struct slave *slave, *primary, *active;
@@ -2809,10 +2830,22 @@ static void bond_miimon_commit(struct bonding *bond)
err = bond_update_speed_duplex(slave);
netdev_unlock_ops(slave->dev);
if (err && bond_needs_speed_duplex(bond)) {
- slave->link = BOND_LINK_DOWN;
if (net_ratelimit())
slave_warn(bond->dev, slave->dev,
"failed to get link speed/duplex\n");
+ /* Coming from FAIL/UP, the slave may still be
+ * in use and may be curr_active_slave, so take
+ * it through the full down path. Coming from
+ * DOWN/BACK, it was never brought up, so just
+ * revert it to DOWN.
+ */
+ if (slave->link == BOND_LINK_FAIL ||
+ slave->link == BOND_LINK_UP) {
+ if (bond_miimon_slave_down(bond, slave))
+ do_failover = true;
+ continue;
+ }
+ slave->link = BOND_LINK_DOWN;
continue;
}
bond_set_slave_link_state(slave, BOND_LINK_UP,
@@ -2841,28 +2874,13 @@ static void bond_miimon_commit(struct bonding *bond)
continue;
case BOND_LINK_DOWN:
- if (slave->link_failure_count < UINT_MAX)
- slave->link_failure_count++;
-
- bond_set_slave_link_state(slave, BOND_LINK_DOWN,
- BOND_SLAVE_NOTIFY_NOW);
-
- if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
- BOND_MODE(bond) == BOND_MODE_8023AD)
- bond_set_slave_inactive_flags(slave,
- BOND_SLAVE_NOTIFY_NOW);
-
- slave_info(bond->dev, slave->dev, "link status definitely down, disabling slave\n");
-
- bond_miimon_link_change(bond, slave, BOND_LINK_DOWN);
-
- if (slave == rcu_access_pointer(bond->curr_active_slave))
+ if (bond_miimon_slave_down(bond, slave))
do_failover = true;
-
continue;
case BOND_LINK_FAIL:
case BOND_LINK_BACK:
+ bond_commit_link_state(slave, BOND_SLAVE_NOTIFY_LATER);
slave_dbg(bond->dev, slave->dev, "link_new_state %d on slave\n",
slave->link_new_state);
continue;
@@ -2896,8 +2914,6 @@ static void bond_mii_monitor(struct work_struct *work)
{
struct bonding *bond = container_of(work, struct bonding,
mii_work.work);
- struct list_head *iter;
- struct slave *slave;
unsigned long delay;
bool commit;
@@ -2919,13 +2935,8 @@ static void bond_mii_monitor(struct work_struct *work)
goto re_arm;
}
- if (commit) {
- bond_for_each_slave(bond, slave, iter) {
- bond_commit_link_state(slave,
- BOND_SLAVE_NOTIFY_LATER);
- }
+ if (commit)
bond_miimon_commit(bond);
- }
if (bond->send_peer_notif)
bond_peer_notify_may_events(bond, true);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 282/990] net: stmmac: set XDP metadata length on the page_pool RX path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (280 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 281/990] bonding: fix missing down path on speed/duplex failure after FAIL->UP Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 283/990] net: bridge: disable MRP ports before the FDB flush in del_nbp() Greg Kroah-Hartman
` (570 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Daniel Machon,
Nicolai Buchwitz, Maxime Chevallier, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 6d9b7c85af57305ec2bd5907124478867edcc60b ]
stmmac_rx() initializes the XDP buffer with the metadata area valid, so
an XDP program can reserve metadata with bpf_xdp_adjust_meta() and write
it in [xdp->data_meta, xdp->data), for example to export the RX hardware
timestamp obtained from the metadata kfunc. When such a frame is passed
to the stack, the skb is built in place around the same page with
napi_build_skb(), but skb_metadata_set() is never called.
napi_build_skb() clears skb_shared_info up to dataref, which includes
meta_len, so skb_metadata_len() stays zero. The stack and TC BPF then see
an empty metadata range even though the bytes are present in the skb
headroom. The AF_XDP zero-copy path already records the length in
stmmac_construct_skb_zc().
Record the metadata length after reserving the headroom and adding the
frame data. No copy is needed because the skb is built over the buffer the
XDP program wrote to. With the length recorded, the software VLAN
stripping path can move the metadata together with the MAC header, as it
already does for zero-copy frames.
Fixes: e3f9c3e34840 ("net: stmmac: add Rx HWTS metadata to XDP receive pkt")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20261102-stmmac_meatada_pp_path-v1-1-d93cc4f9a864@oss.qualcomm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2e7b146895ba8..0e78c1d2fcf1d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5731,7 +5731,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
}
if (!skb) {
- unsigned int head_pad_len;
+ unsigned int metasize;
/* XDP program may expand or reduce tail */
buf1_len = ctx.xdp.data_end - ctx.xdp.data;
@@ -5748,10 +5748,14 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
}
/* XDP program may adjust header */
- head_pad_len = ctx.xdp.data - ctx.xdp.data_hard_start;
- skb_reserve(skb, head_pad_len);
+ skb_reserve(skb,
+ ctx.xdp.data - ctx.xdp.data_hard_start);
skb_put(skb, buf1_len);
skb_mark_for_recycle(skb);
+
+ metasize = ctx.xdp.data - ctx.xdp.data_meta;
+ if (metasize)
+ skb_metadata_set(skb, metasize);
buf->page = NULL;
} else if (buf1_len) {
dma_sync_single_for_cpu(priv->device, buf->addr,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 283/990] net: bridge: disable MRP ports before the FDB flush in del_nbp()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (281 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 282/990] net: stmmac: set XDP metadata length on the page_pool RX path Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 284/990] tcp: initialize send sequence numbers before deferring TFO Greg Kroah-Hartman
` (569 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ido Schimmel, Cheng Yongkang,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
[ Upstream commit 37dfd0efbfffc20a57e41c2eb349ac49b1ca1ff8 ]
del_nbp() flushes the port's FDB entries before it unregisters the RX
handler. For a normal port, br_stp_disable_port() moves the port to
BR_STATE_DISABLED before this cleanup.
That does not hold for an MRP ring port. br_set_state() ignores state
changes while BR_MRP_AWARE_BIT is set, so br_stp_disable_port() leaves
the port state alone. br_mrp_port_del() then restores forwarding when
the bridge is up before clearing the bit. A frame received between
br_fdb_cleanup_by_dst() and netdev_rx_handler_unregister() can therefore
create a new FDB entry referencing the dying port. Nothing removes that
entry before destroy_nbp_rcu() frees the port, so a later frame to the
learned MAC can be forwarded through the freed port.
Remove the MRP and CFM instances before disabling the port, so that
br_stp_disable_port() actually transitions it to BR_STATE_DISABLED.
With CONFIG_BRIDGE_VLAN_FILTERING=y, synchronize_net() in
nbp_vlan_group_unpublish() also drains receive paths that could still
learn with the old state before the final FDB cleanup.
Found through an LLM-assisted source code analysis workflow and
reproduced on net with KASAN and CONFIG_BRIDGE_VLAN_FILTERING=y in QEMU.
A diagnostic switchdev module accepts MRP objects and delays the
NETDEV_CHANGEUPPER callback for 1.5 s, holding del_nbp() after the FDB
cleanup and before RX handler removal. The reproducer floods the MRP
port with rotating source MACs, waits for the port's RCU callback
through the module's rcu_barrier(), then sends frames to those MACs
from another port. The unpatched kernel reports:
BUG: KASAN: slab-use-after-free in br_forward+0xb1/0x820
Call Trace:
<IRQ>
br_forward+0xb1/0x820
br_handle_frame_finish+0x148b/0x1e50
br_handle_frame+0x90a/0x15c0
With this patch, three runs of six cycles each reach the delay without
a KASAN report.
Fixes: 6536993371fa ("bridge: mrp: Integrate MRP into the bridge")
Suggested-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/netdev/20261012123051.GA714215@shredder/
Closes: https://lore.kernel.org/netdev/20261022090431.3641707-1-teel4res@gmail.com/
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261101044840.1595584-1-1020691186@qq.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bridge/br_if.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 5bcd1acc5da9b..63d9e28c0eda7 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -339,13 +339,13 @@ static void del_nbp(struct net_bridge_port *p)
nbp_delete_promisc(p);
+ br_mrp_port_del(br, p);
+ br_cfm_port_del(br, p);
+
spin_lock_bh(&br->lock);
br_stp_disable_port(p);
spin_unlock_bh(&br->lock);
- br_mrp_port_del(br, p);
- br_cfm_port_del(br, p);
-
br_ifinfo_notify(RTM_DELLINK, NULL, p);
list_del_rcu(&p->list);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 284/990] tcp: initialize send sequence numbers before deferring TFO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (282 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 283/990] net: bridge: disable MRP ports before the FDB flush in del_nbp() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 285/990] netfilter: nft_set_rbtree: check catchall_sync return before queue_done Greg Kroah-Hartman
` (568 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qingfang Deng, Eric Dumazet,
Kuniyuki Iwashima, Neal Cardwell, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qingfang Deng <qingfang.deng@linux.dev>
[ Upstream commit 57889a8f6d49fc153aa0017d13086ab736567f8a ]
TCP_FASTOPEN_CONNECT can return from connect() before tcp_connect_init()
when a cached cookie or cookieless Fast Open allows deferring the SYN.
At this point write_seq contains the initial sequence number, while
snd_una and snd_nxt have not been initialized to that sequence number.
Consequently, inet_diag and /proc/net/tcp{,6} report the initial
sequence number as the send queue length despite no SYN or payload being
queued.
Initialize snd_una and snd_nxt to write_seq before marking the
connection as deferred. Both sequence-based queue lengths then remain
zero until the first write starts the connection and runs
tcp_connect_init().
Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support")
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Link: https://patch.msgid.link/20261102035943.9700-1-qingfang.deng@linux.dev
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_fastopen.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index dbd97df1b442f..1b0f367f9dfc8 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -456,6 +456,8 @@ bool tcp_fastopen_defer_connect(struct sock *sk, int *err)
if (tp->fastopen_connect && !tp->fastopen_req) {
if (tcp_fastopen_cookie_check(sk, &mss, &cookie)) {
+ WRITE_ONCE(tp->snd_una, tp->write_seq);
+ WRITE_ONCE(tp->snd_nxt, tp->write_seq);
inet_set_bit(DEFER_CONNECT, sk);
return true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 285/990] netfilter: nft_set_rbtree: check catchall_sync return before queue_done
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (283 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 284/990] tcp: initialize send sequence numbers before deferring TFO Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 286/990] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag() Greg Kroah-Hartman
` (567 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xingyuan Mo, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xingyuan Mo <hdthky0@gmail.com>
[ Upstream commit 1cec19d70bc282a8e7f7c42697d44046f60dc506 ]
nft_rbtree_gc_queue() passes the result of nft_trans_gc_catchall_sync()
straight to nft_trans_gc_queue_sync_done(). When the catchall path flushes
a full GC batch and nft_trans_gc_alloc() fails, catchall_sync returns
NULL and queue_sync_done dereferences trans->net (NULL+0x10). Guard the
call like the pipapo GC path already does.
Fixes: 7d259f021aaa ("netfilter: nft_set_rbtree: prefer sync gc to async worker")
Assisted-by: opencode:deepseek-v4
Signed-off-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nft_set_rbtree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index 1270b472e3334..c00ac231ccda0 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -958,7 +958,8 @@ static void nft_rbtree_gc_queue(struct nft_set *set)
}
gc = nft_trans_gc_catchall_sync(gc);
- nft_trans_gc_queue_sync_done(gc);
+ if (gc)
+ nft_trans_gc_queue_sync_done(gc);
}
static u64 nft_rbtree_privsize(const struct nlattr * const nla[],
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 286/990] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (284 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 285/990] netfilter: nft_set_rbtree: check catchall_sync return before queue_done Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 287/990] netfilter: x_tables: check target name before accessing verdict Greg Kroah-Hartman
` (566 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Laveesh Bansal, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laveesh Bansal <laveeshb@laveeshbansal.com>
[ Upstream commit 683ff28ab18accb25268741a724645eee839d41a ]
nf_ct_bridge_refrag() warns when skb->protocol is neither IPv4 nor IPv6.
A vlan filtering bridge can get there with a vlan ethertype: if the
protocol of the tag of a frame differs from the vlan_protocol of the
bridge, br_allowed_ingress() moves the tag back into the packet after
NF_BR_PRE_ROUTING, where bridge conntrack has already defragmented it.
Anyone who can send fragments into a port of such a bridge can trigger the
warning, which takes the machine down with panic_on_warn. The packet is
dropped either way, so only warn on kernels built with CONFIG_DEBUG_NET.
This only avoids the warning. Such fragmented packets are still dropped.
syzbot reported the warning. It keeps triggering on CONFIG_DEBUG_NET
kernels until the vlan tag is handled, which is left for a follow-up:
https://syzkaller.appspot.com/bug?extid=a8ba738fe2db6b4bb27f
Fixes: 3c171f496ef5 ("netfilter: bridge: add connection tracking system")
Assisted-by: LLM
Signed-off-by: Laveesh Bansal <laveeshb@laveeshbansal.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bridge/netfilter/nf_conntrack_bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c
index b17962672ebfc..e7603a144538c 100644
--- a/net/bridge/netfilter/nf_conntrack_bridge.c
+++ b/net/bridge/netfilter/nf_conntrack_bridge.c
@@ -359,7 +359,7 @@ nf_ct_bridge_refrag(struct sk_buff *skb, const struct nf_hook_state *state,
nf_br_ip6_fragment(state->net, state->sk, skb, &data, output);
break;
default:
- WARN_ON_ONCE(1);
+ DEBUG_NET_WARN_ON_ONCE(1);
return NF_DROP;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 287/990] netfilter: x_tables: check target name before accessing verdict
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (285 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 286/990] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 288/990] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Greg Kroah-Hartman
` (565 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, VEGA, Fernando Fernandez Mancera,
Pablo Neira Ayuso, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <fmancera@suse.de>
[ Upstream commit 364b200285bb2cc518e3c5efe6591951c05b8e01 ]
Non-standard targets may contain only struct xt_entry_target.
mark_source_chains() nevertheless reads the target as an
xt_standard_target before checking its name, potentially reading four
bytes beyond a header-only target.
Check that the target is standard before reading its verdict.
Non-standard targets remain handled as fallthrough rules.
See the following KASAN trace:
BUG: KASAN: slab-out-of-bounds in translate_table+0x1660/0x1a40 [ip6_tables]
Read of size 4 at addr ffff88800ed56ff8 by task rep/432
Call Trace:
kasan_report+0xfa/0x120
translate_table+0x1660/0x1a40 [ip6_tables]
do_ip6t_set_ctl+0x667/0xa76 [ip6_tables]
nf_setsockopt+0x77/0xd0
do_sock_setsockopt+0x118/0x490
__sys_setsockopt+0xe4/0x160
__x64_sys_setsockopt+0xbd/0x190
do_syscall_64+0xde/0x4f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Allocated by task 432:
kasan_save_stack+0x2f/0x50
__kasan_kmalloc+0x7f/0x90
__kvmalloc_node_noprof+0x1b1/0x5c0
xt_alloc_table_info+0x3c/0xa0
do_ip6t_set_ctl+0x5ee/0xa76 [ip6_tables]
nf_setsockopt+0x77/0xd0
do_sock_setsockopt+0x118/0x490
__sys_setsockopt+0xe4/0x160
__x64_sys_setsockopt+0xbd/0x190
do_syscall_64+0xde/0x4f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: VEGA <vega@nebusec.ai>
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/netfilter/arp_tables.c | 5 +++--
net/ipv4/netfilter/ip_tables.c | 5 +++--
net/ipv6/netfilter/ip6_tables.c | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 0ea513bf77fb6..197d1dfa07d61 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -372,11 +372,12 @@ static int mark_source_chains(const struct xt_table_info *newinfo,
e->counters.pcnt = pos;
pos += size;
} else {
- int newpos = t->verdict;
+ int newpos;
if (strcmp(t->target.u.user.name,
XT_STANDARD_TARGET) == 0 &&
- newpos >= 0) {
+ t->verdict >= 0) {
+ newpos = t->verdict;
/* This a jump; chase it. */
if (!xt_find_jump_offset(offsets, newpos,
newinfo->number))
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index ca8ff0ae6cdb9..b7749048e1461 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -422,11 +422,12 @@ mark_source_chains(const struct xt_table_info *newinfo,
e->counters.pcnt = pos;
pos += size;
} else {
- int newpos = t->verdict;
+ int newpos;
if (strcmp(t->target.u.user.name,
XT_STANDARD_TARGET) == 0 &&
- newpos >= 0) {
+ t->verdict >= 0) {
+ newpos = t->verdict;
/* This a jump; chase it. */
if (!xt_find_jump_offset(offsets, newpos,
newinfo->number))
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 22db263682bda..9353e9105f4ac 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -440,11 +440,12 @@ mark_source_chains(const struct xt_table_info *newinfo,
e->counters.pcnt = pos;
pos += size;
} else {
- int newpos = t->verdict;
+ int newpos;
if (strcmp(t->target.u.user.name,
XT_STANDARD_TARGET) == 0 &&
- newpos >= 0) {
+ t->verdict >= 0) {
+ newpos = t->verdict;
/* This a jump; chase it. */
if (!xt_find_jump_offset(offsets, newpos,
newinfo->number))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 288/990] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (286 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 287/990] netfilter: x_tables: check target name before accessing verdict Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 289/990] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload Greg Kroah-Hartman
` (564 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Fernando Fernandez Mancera, Pablo Neira Ayuso, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
[ Upstream commit 7af52bda65c0bbbf40894aa3df36ac1bb5697984 ]
ct_sip_parse_transport() compares the value of the "transport=" header
parameter against "TCP"/"UDP" with strncasecmp(..., 3), but it never
checks that the parsed value is at least 3 bytes long.
ct_sip_parse_param() returns matchlen = end - start, where end is the
next ';' or, when there is no ';', the end of the payload buffer
(limit = dptr + datalen). If the "transport=" value is only 1 or 2
bytes long and runs exactly to the end of the payload (e.g. a REGISTER
request whose Contact header ends in ";transport=T" with no trailing
CRLF), matchlen is less than 3 while strncasecmp() still reads up to 3
bytes, reading 1-2 bytes past the end of the linearized skb data.
Add a matchlen check before the comparison, mirroring the
sdp_media_type() pattern a few lines below, so short values cannot reach
strncasecmp().
The bug was found by LLM-assisted manual review of the SIP helper's
parsers and confirmed with a userspace ASan harness built from the
verbatim parser functions, which reports a heap-buffer-overflow read of
size 2 in strncasecmp() called from ct_sip_parse_transport().
Fixes: ea45f12a2766d ("[NETFILTER]: nf_conntrack_sip: parse SIP headers properly")
Link: https://patch.msgid.link/20260815133104.50369-1-joasantonio108@gmail.com/
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_conntrack_sip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 449a6e53feae4..12b8c7fcca640 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -707,9 +707,9 @@ static int ct_sip_parse_transport(struct nf_conn *ct, const char *dptr,
if (ct_sip_parse_param(ct, dptr, dataoff, datalen, "transport=",
&matchoff, &matchlen)) {
- if (!strncasecmp(dptr + matchoff, "TCP", strlen("TCP")))
+ if (matchlen >= 3 && !strncasecmp(dptr + matchoff, "TCP", 3))
*proto = IPPROTO_TCP;
- else if (!strncasecmp(dptr + matchoff, "UDP", strlen("UDP")))
+ else if (matchlen >= 3 && !strncasecmp(dptr + matchoff, "UDP", 3))
*proto = IPPROTO_UDP;
else
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 289/990] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (287 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 288/990] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 290/990] netfilter: nat: zero newrange before filling it in Greg Kroah-Hartman
` (563 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xingyuan Mo, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <pablo@netfilter.org>
[ Upstream commit e95b3be75ae0652d40a48a210f0cf5197b3b3783 ]
Allocate flow rule object after transaction has been allocation and rule
deactivation has been performed, otherwise memleak is possible. Let the
transaction unwind the existing rule deactivation from the abort path,
this needs to update nft_flow_rule_destroy() to skip release if
flow_rule is null.
While at this, remove check for non-null flow_rule in newrule error path
now that nft_flow_rule_destroy() is skipped if flow_rule is null.
Fixes: 63b48c73ff56 ("netfilter: nf_tables_offload: undo updates if transaction fails")
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Link: https://patch.msgid.link/20261028062204.1079089-1-hdthky0@gmail.com/
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_tables_api.c | 21 +++++++++------------
net/netfilter/nf_tables_offload.c | 3 +++
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 76876761698eb..a248dc75c5a0a 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -754,16 +754,6 @@ static int nft_delrule(struct nft_ctx *ctx, struct nft_rule *rule)
if (trans == NULL)
return -ENOMEM;
- if (ctx->chain->flags & NFT_CHAIN_HW_OFFLOAD) {
- flow = nft_flow_rule_create(ctx->net, rule);
- if (IS_ERR(flow)) {
- nft_trans_destroy(trans);
- return PTR_ERR(flow);
- }
-
- nft_trans_flow_rule(trans) = flow;
- }
-
err = nf_tables_delrule_deactivate(ctx, rule);
if (err < 0) {
nft_trans_destroy(trans);
@@ -771,6 +761,14 @@ static int nft_delrule(struct nft_ctx *ctx, struct nft_rule *rule)
}
nft_rule_expr_deactivate(ctx, rule, NFT_TRANS_PREPARE);
+ if (ctx->chain->flags & NFT_CHAIN_HW_OFFLOAD) {
+ flow = nft_flow_rule_create(ctx->net, rule);
+ if (IS_ERR(flow))
+ return PTR_ERR(flow);
+
+ nft_trans_flow_rule(trans) = flow;
+ }
+
return 0;
}
@@ -4527,8 +4525,7 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
err_destroy_flow_rule:
nft_use_dec_restore(&chain->use);
err_destroy_flow:
- if (flow)
- nft_flow_rule_destroy(flow);
+ nft_flow_rule_destroy(flow);
err_release_rule:
nft_rule_expr_deactivate(&ctx, rule, NFT_TRANS_PREPARE_ERROR);
nf_tables_rule_destroy(&ctx, rule);
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
index 933a17d0f2513..853094a300c24 100644
--- a/net/netfilter/nf_tables_offload.c
+++ b/net/netfilter/nf_tables_offload.c
@@ -148,6 +148,9 @@ void nft_flow_rule_destroy(struct nft_flow_rule *flow)
struct flow_action_entry *entry;
int i;
+ if (!flow)
+ return;
+
flow_action_for_each(i, entry, &flow->rule->action) {
switch (entry->id) {
case FLOW_ACTION_REDIRECT:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 290/990] netfilter: nat: zero newrange before filling it in
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (288 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 289/990] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 291/990] gpio: regmap: Support sparsed fixed direction Greg Kroah-Hartman
` (562 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Westphal, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <fw@strlen.de>
[ Upstream commit d1bb235aa409a4e5aeba6c748d953d948625b1e9 ]
nf_nat_masquerade_ipv4(), nf_nat_masquerade_ipv6(), netmap_tg4() and
netmap_tg6() each build a stack-local struct nf_nat_range2 from the
caller-supplied range, inheriting range->flags unmodified. Two of them
only memset() the min_addr/max_addr members, the other two don't
memset() anything at all, so newrange.base_proto is left as stack
garbage.
If the inherited flags include NF_NAT_RANGE_PROTO_OFFSET,
nf_nat_l4proto_unique_tuple() reads range->base_proto.all to compute
the NAT port offset. Neither the NETMAP nor the MASQUERADE targets
mask the flags field in their checkentry callback, so this
uninitialized stack value can end up feeding the NAT port selection.
The per-member memset()s are not enough: they have to enumerate every
field that must be cleared, and base_proto was missed when
NF_NAT_RANGE_PROTO_OFFSET/base_proto was added to the struct. memset()
the whole struct instead, so every member is covered regardless of
which ones get explicitly assigned afterwards.
There are other places that miss this, but those hardcode .flags so
nat core won't read from the uninitialized fields.
C99 initializers would be preferrable, but this is a more intrusive
change. Lets followup in nf-next and convert others as well.
This is an LLM finding.
Fixes: 2eb0f624b709 ("netfilter: add NAT support for shifted portmap ranges")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_nat_masquerade.c | 4 ++--
net/netfilter/xt_NETMAP.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nf_nat_masquerade.c b/net/netfilter/nf_nat_masquerade.c
index 1a506b0c6511a..2506aace39bcf 100644
--- a/net/netfilter/nf_nat_masquerade.c
+++ b/net/netfilter/nf_nat_masquerade.c
@@ -62,8 +62,7 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum,
nat->masq_index = out->ifindex;
/* Transfer from original range. */
- memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
- memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr.ip = newsrc;
newrange.max_addr.ip = newsrc;
@@ -259,6 +258,7 @@ nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
if (nat)
nat->masq_index = out->ifindex;
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr.in6 = src;
newrange.max_addr.in6 = src;
diff --git a/net/netfilter/xt_NETMAP.c b/net/netfilter/xt_NETMAP.c
index cb2ee80d84fa8..591a6af6c61fa 100644
--- a/net/netfilter/xt_NETMAP.c
+++ b/net/netfilter/xt_NETMAP.c
@@ -42,6 +42,7 @@ netmap_tg6(struct sk_buff *skb, const struct xt_action_param *par)
netmask.ip6[i];
}
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = range->flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr = new_addr;
newrange.max_addr = new_addr;
@@ -89,8 +90,7 @@ netmap_tg4(struct sk_buff *skb, const struct xt_action_param *par)
new_ip = ip_hdr(skb)->saddr & ~netmask;
new_ip |= mr->range[0].min_ip & netmask;
- memset(&newrange.min_addr, 0, sizeof(newrange.min_addr));
- memset(&newrange.max_addr, 0, sizeof(newrange.max_addr));
+ memset(&newrange, 0, sizeof(newrange));
newrange.flags = mr->range[0].flags | NF_NAT_RANGE_MAP_IPS;
newrange.min_addr.ip = new_ip;
newrange.max_addr.ip = new_ip;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 291/990] gpio: regmap: Support sparsed fixed direction
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (289 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 290/990] netfilter: nat: zero newrange before filling it in Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 292/990] gpio: regmap: free the irqchip if adding the irq domain fails Greg Kroah-Hartman
` (561 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alex Elder, Linus Walleij,
Michael Walle, Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 68d801eabda5219dcc25c9de98d3bbdb5b51b0a5 ]
On some regmapped GPIOs apparently only a sparser selection of the lines
(not all) are actually fixed direction.
Support this situation by adding an optional bitmap indicating which
GPIOs are actually fixed direction and which are not.
Link: https://lore.kernel.org/linux-gpio/20260501155421.3329862-10-elder@riscstar.com/
Tested-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20260511-regmap-gpio-sparse-fixed-dir-v3-1-1429ec453be7@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Stable-dep-of: 80415a6ff295 ("gpio: regmap: free the irqchip if adding the irq domain fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-regmap.c | 37 +++++++++++++++++++++++++++++++++----
include/linux/gpio/regmap.h | 7 +++++++
2 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index c64805dcb9f88..4f83027ab2032 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -31,6 +31,7 @@ struct gpio_regmap {
unsigned int reg_clr_base;
unsigned int reg_dir_in_base;
unsigned int reg_dir_out_base;
+ unsigned long *fixed_direction_mask;
unsigned long *fixed_direction_output;
#ifdef CONFIG_REGMAP_IRQ
@@ -128,6 +129,20 @@ static int gpio_regmap_set_with_clear(struct gpio_chip *chip,
return regmap_write(gpio->regmap, reg, mask);
}
+static bool gpio_regmap_fixed_direction(struct gpio_regmap *gpio,
+ unsigned int offset)
+{
+ if (!gpio->fixed_direction_output)
+ return false;
+
+ /* In this case only some GPIOs are fixed as input/output */
+ if (gpio->fixed_direction_mask &&
+ !test_bit(offset, gpio->fixed_direction_mask))
+ return false;
+
+ return true;
+}
+
static int gpio_regmap_get_direction(struct gpio_chip *chip,
unsigned int offset)
{
@@ -135,7 +150,7 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip,
unsigned int base, val, reg, mask;
int invert, ret;
- if (gpio->fixed_direction_output) {
+ if (gpio_regmap_fixed_direction(gpio, offset)) {
if (test_bit(offset, gpio->fixed_direction_output))
return GPIO_LINE_DIRECTION_OUT;
else
@@ -292,12 +307,23 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
goto err_free_gpio;
}
+ if (config->fixed_direction_mask) {
+ gpio->fixed_direction_mask = bitmap_alloc(chip->ngpio,
+ GFP_KERNEL);
+ if (!gpio->fixed_direction_mask) {
+ ret = -ENOMEM;
+ goto err_free_gpio;
+ }
+ bitmap_copy(gpio->fixed_direction_mask,
+ config->fixed_direction_mask, chip->ngpio);
+ }
+
if (config->fixed_direction_output) {
gpio->fixed_direction_output = bitmap_alloc(chip->ngpio,
GFP_KERNEL);
if (!gpio->fixed_direction_output) {
ret = -ENOMEM;
- goto err_free_gpio;
+ goto err_free_bitmap_dirmask;
}
bitmap_copy(gpio->fixed_direction_output,
config->fixed_direction_output, chip->ngpio);
@@ -319,7 +345,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
ret = gpiochip_add_data(chip, gpio);
if (ret < 0)
- goto err_free_bitmap;
+ goto err_free_bitmap_output;
#ifdef CONFIG_REGMAP_IRQ
if (config->regmap_irq_chip) {
@@ -345,8 +371,10 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
err_remove_gpiochip:
gpiochip_remove(chip);
-err_free_bitmap:
+err_free_bitmap_output:
bitmap_free(gpio->fixed_direction_output);
+err_free_bitmap_dirmask:
+ bitmap_free(gpio->fixed_direction_mask);
err_free_gpio:
kfree(gpio);
return ERR_PTR(ret);
@@ -366,6 +394,7 @@ void gpio_regmap_unregister(struct gpio_regmap *gpio)
gpiochip_remove(&gpio->gpio_chip);
bitmap_free(gpio->fixed_direction_output);
+ bitmap_free(gpio->fixed_direction_mask);
kfree(gpio);
}
EXPORT_SYMBOL_GPL(gpio_regmap_unregister);
diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index 87983a5f3681e..a23e1c2b933a1 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -38,6 +38,12 @@ struct regmap;
* offset to a register/bitmask pair. If not
* given the default gpio_regmap_simple_xlate()
* is used.
+ * @fixed_direction_mask:
+ * (Optional) Bitmap representing the GPIO lines that
+ * make use of the @fixed_direction_output list to
+ * enforce direction of the GPIO. If this is NULL
+ * and @fixed_direction_output is defined, ALL GPIOs
+ * are assumed to be fixed direction (out or in).
* @fixed_direction_output:
* (Optional) Bitmap representing the fixed direction of
* the GPIO lines. Useful when there are GPIO lines with a
@@ -89,6 +95,7 @@ struct gpio_regmap_config {
int reg_stride;
int ngpio_per_reg;
struct irq_domain *irq_domain;
+ unsigned long *fixed_direction_mask;
unsigned long *fixed_direction_output;
#ifdef CONFIG_REGMAP_IRQ
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 292/990] gpio: regmap: free the irqchip if adding the irq domain fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (290 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 291/990] gpio: regmap: Support sparsed fixed direction Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 293/990] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period Greg Kroah-Hartman
` (560 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michael Walle, Long Zhao,
Linus Walleij, Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Zhao <longzhao@ambarella.com>
[ Upstream commit 80415a6ff295b03dab98ef55598c72be66945d82 ]
gpio_regmap_register() creates a regmap irqchip and then calls
gpiochip_irqchip_add_domain(). If that call fails, the error path
only removes the gpiochip, so the irqchip and its domain leak.
Free the irqchip there when this function allocated it. An external
irq domain is not affected: irq_chip_data stays NULL and the caller
owns that domain.
Fixes: 553b75d4bfe9 ("gpio: regmap: Allow to allocate regmap-irq device")
Cc: Michael Walle <mwalle@kernel.org>
Signed-off-by: Long Zhao <longzhao@ambarella.com>
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261103-gpio-regmap-irqchip-leak-v1-1-d038a20840f7@ambarella.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpio-regmap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 4f83027ab2032..066a5be7f8e93 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -371,6 +371,11 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
err_remove_gpiochip:
gpiochip_remove(chip);
+
+#ifdef CONFIG_REGMAP_IRQ
+ if (gpio->irq_chip_data)
+ regmap_del_irq_chip(gpio->regmap_irq_line, gpio->irq_chip_data);
+#endif
err_free_bitmap_output:
bitmap_free(gpio->fixed_direction_output);
err_free_bitmap_dirmask:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 293/990] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (291 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 292/990] gpio: regmap: free the irqchip if adding the irq domain fails Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 294/990] MIPS: Avoid dead code/data elimination when using recordmcount Greg Kroah-Hartman
` (559 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Eric Dumazet, Hangbin Liu,
Jiayuan Chen, Kuniyuki Iwashima, Linkui Xiao, 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 fafbc4051123d5459ea6950899cec08ed946e278 ]
ireq->ipv6_opt is only set by calipso_req_setattr(), when a CALIPSO
NetLabel mapping is configured.
Request socket migration (net.ipv4.tcp_migrate_req=1, or a
BPF_SK_REUSEPORT_SELECT_OR_MIGRATE program) clones the request
socket with inet_reqsk_clone(), so that the old request socket and
its clone share the same ipv6_opt, then reqsk_migrate_reset() clears
the pointer in the old one.
Another cpu holding a reference on the old request socket can still
be using these options, sending a SYNACK from tcp_v6_send_synack()
or creating a child in tcp_v6_syn_recv_sock(), when the clone
is freed. tcp_v6_reqsk_destructor() frees ipv6_opt with a plain
kfree(), leading to a use-after-free.
Both readers already run under RCU, like their IPv4 counterparts.
Use kfree_rcu() in tcp_v6_reqsk_destructor(), as commit e3f33b0a1d89
("ipv4: free inet_opt and ireq_opt after an RCU grace period") did
for ireq_opt.
Fixes: c905dee62232 ("tcp: Migrate TCP_NEW_SYN_RECV requests at retransmitting SYN+ACKs.")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179369559062.488856.15441115725436277776@kernel.org/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Tested-by: Linkui Xiao <xiaolinkui@kylinos.cn>
Link: https://patch.msgid.link/20261103090011.4128420-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/tcp_ipv6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index fade3907b05da..b07e8d22edcfb 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -583,7 +583,7 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst,
static void tcp_v6_reqsk_destructor(struct request_sock *req)
{
- kfree(inet_rsk(req)->ipv6_opt);
+ kfree_rcu(inet_rsk(req)->ipv6_opt, rcu);
consume_skb(inet_rsk(req)->pktopts);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 294/990] MIPS: Avoid dead code/data elimination when using recordmcount
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (292 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 293/990] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 295/990] MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC Greg Kroah-Hartman
` (558 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rosen Penev, Thomas Bogendoerfer,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <rosenp@gmail.com>
[ Upstream commit 255d9dbd936f7db8b963e82429f6e57cd9d48999 ]
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION builds with -ffunction-sections,
placing every function in its own section. recordmcount refuses to use
weak symbols as section bases, as a strong definition could override
them, so a weak function alone in its section, such as the generic
pcibios_fixup_bus() stub, breaks the build:
Cannot find symbol for section 88: .text.pcibios_fixup_bus.
drivers/pci/probe.o: failed
MIPS always records mcount locations with recordmcount, so this hits
any config with the function tracer and dead code elimination enabled,
e.g. malta_defconfig built with LLVM=1.
Only offer dead code elimination when recordmcount is not used, as
powerpc does since commit f8b2336f15f3 ("powerpc: Avoid dead code/data
elimination when using recordmcount"). In practice this makes it
unavailable together with the function tracer on MIPS.
Fixes: c0436b503591 ("MIPS: Enable dead code elimination")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fadaeafae98e8..cefaa55ff8bd8 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -81,7 +81,7 @@ config MIPS
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KPROBES
select HAVE_KRETPROBES
- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !FTRACE_MCOUNT_USE_RECORDMCOUNT
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_PAGE_SIZE_4KB if !CPU_LOONGSON2EF && !CPU_LOONGSON64
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 295/990] MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (293 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 294/990] MIPS: Avoid dead code/data elimination when using recordmcount Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 296/990] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory Greg Kroah-Hartman
` (557 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Imre Kaloz, Thomas Bogendoerfer,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Kaloz <kaloz@kernel.org>
[ Upstream commit c9c0d267002029a5bf97ee50e6b11b4d16808aca ]
The Bridge probe reads its part number from the 1-wire PROM and defers
until the SGI 1-wire master and DS250x slave are present, so without
them there is no PCI bus and no serial console.
The IP30 RTC is a DS1685-family part, but the defconfig, derived from
ip27_defconfig, has the M48T35 driver, so there is no RTC.
Enable the 1-wire drivers and select the DS1685 family.
Also drop four lines that savedefconfig removes, as CRYPTO_CAMELLIA,
CRYPTO_CTS and CRYPTO_HMAC are selected built-in and IPV6_SIT=m is the
default.
Fixes: bb2d63500b5c ("MIPS: config: Add ip30_defconfig")
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/configs/ip30_defconfig | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/mips/configs/ip30_defconfig b/arch/mips/configs/ip30_defconfig
index 718f3060d9fa8..4f3fa1d49cd43 100644
--- a/arch/mips/configs/ip30_defconfig
+++ b/arch/mips/configs/ip30_defconfig
@@ -40,7 +40,6 @@ CONFIG_INET6_AH=m
CONFIG_INET6_ESP=m
CONFIG_INET6_IPCOMP=m
CONFIG_IPV6_MIP6=m
-CONFIG_IPV6_SIT=m
CONFIG_IPV6_SIT_6RD=y
CONFIG_IPV6_TUNNEL=m
CONFIG_IPV6_MULTIPLE_TABLES=y
@@ -130,11 +129,14 @@ CONFIG_SERIAL_8250_IOC3=y
CONFIG_NOZOMI=m
CONFIG_HW_RANDOM_TIMERIOMEM=m
# CONFIG_PTP_1588_CLOCK is not set
+CONFIG_W1=y
+CONFIG_W1_MASTER_SGI=y
+CONFIG_W1_SLAVE_DS250X=y
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_SGI_MFD_IOC3=y
CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_M48T35=y
+CONFIG_RTC_DRV_DS1685_FAMILY=y
CONFIG_UIO=y
CONFIG_UIO_AEC=m
CONFIG_UIO_SERCOS3=m
@@ -163,17 +165,14 @@ CONFIG_NFS_FS=y
CONFIG_SECURITYFS=y
CONFIG_CRYPTO_CRYPTD=m
CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_CAMELLIA=m
CONFIG_CRYPTO_CAST5=m
CONFIG_CRYPTO_CAST6=m
CONFIG_CRYPTO_FCRYPT=m
CONFIG_CRYPTO_SERPENT=m
CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_CTS=m
CONFIG_CRYPTO_LRW=m
CONFIG_CRYPTO_PCBC=m
CONFIG_CRYPTO_XTS=m
-CONFIG_CRYPTO_HMAC=y
CONFIG_CRYPTO_MD4=m
CONFIG_CRYPTO_RMD160=m
CONFIG_CRYPTO_WP512=m
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 296/990] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (294 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 295/990] MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 297/990] MIPS: Cobalt: Include legacy IDE ports in the PCI I/O window Greg Kroah-Hartman
` (556 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Thomas Bogendoerfer, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <f.fainelli@gmail.com>
[ Upstream commit 792ac17faa0503448f3ef85b49f16456ac54ab84 ]
Alchemy keeps pointers into the firmware environment and looks up ethaddr
when initializing the Ethernet devices. By that point, memory allocation
can have overwritten the environment, causing prom_getenv() to pass an
invalid pointer to strchr() and panic during boot.
On the MTX-1, the struct page layout change in 9ddb3c14afba reduces struct
page from 40 to 32 bytes and exposes this unreserved firmware memory.
Bisection and boot tests confirmed that the parent boots while the change
reproduces the panic.
Parse the Ethernet address during prom_init(), before registering RAM
with memblock, and keep the six bytes in kernel-owned init data. Return
the saved address during device initialization, preserving the existing
YAMON formats and command-line fallback without reserving a fixed
low-memory region.
Fixes: b93ddc4f9156 ("mips: Reserve memory for the kernel image resources")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/alchemy/common/prom.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c
index 20d30f6265cdc..c4aefeb788715 100644
--- a/arch/mips/alchemy/common/prom.c
+++ b/arch/mips/alchemy/common/prom.c
@@ -46,6 +46,11 @@ int prom_argc;
char **prom_argv;
char **prom_envp;
+static char prom_ethaddr[6] __initdata;
+static bool prom_ethaddr_valid __initdata;
+
+static void __init prom_init_ethernet_addr(void);
+
void __init prom_init_cmdline(void)
{
int i;
@@ -95,6 +100,9 @@ void __init prom_init(void)
if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
memsize = SZ_64M; /* minimum memsize is 64MB RAM */
+ /* Save the MAC before the allocator can reuse the PROM environment. */
+ prom_init_ethernet_addr();
+
memblock_add(0, memsize);
}
@@ -125,7 +133,7 @@ static inline void str2eaddr(unsigned char *ea, unsigned char *str)
}
}
-int __init prom_get_ethernet_addr(char *ethernet_addr)
+static void __init prom_init_ethernet_addr(void)
{
char *ethaddr_str;
@@ -135,12 +143,21 @@ int __init prom_get_ethernet_addr(char *ethernet_addr)
/* Check command line */
ethaddr_str = strstr(arcs_cmdline, "ethaddr=");
if (!ethaddr_str)
- return -1;
+ return;
ethaddr_str += strlen("ethaddr=");
}
- str2eaddr(ethernet_addr, ethaddr_str);
+ str2eaddr(prom_ethaddr, ethaddr_str);
+ prom_ethaddr_valid = true;
+}
+
+int __init prom_get_ethernet_addr(char *ethernet_addr)
+{
+ if (!prom_ethaddr_valid)
+ return -1;
+
+ memcpy(ethernet_addr, prom_ethaddr, sizeof(prom_ethaddr));
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 297/990] MIPS: Cobalt: Include legacy IDE ports in the PCI I/O window
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (295 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 296/990] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 298/990] MIPS: SB1250: Validate and update IRQ affinity Greg Kroah-Hartman
` (555 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli, Maciej W. Rozycki,
Thomas Bogendoerfer, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <f.fainelli@gmail.com>
[ Upstream commit ff209a7294988aac52b2522b1d0d7349da4541ec ]
The Cobalt PCI I/O window starts at 0x1000, excluding the VIA IDE
controller's fixed compatibility-mode ports at 0x170, 0x1f0, 0x376 and
0x3f6. Since pcibios_enable_device() was converted to
pci_enable_resources(), these unclaimed resources cause pata_via to
fail to probe with -EINVAL.
Start the PCI I/O window at zero to cover the southbridge legacy ports,
retaining 0x1000 as the allocation minimum via PCIBIOS_MIN_IO. Register
the PCI controller from plat_mem_setup(), before the VIA reservations
and i8259 initialization, so the legacy resources do not conflict with
the host bridge window and prevent PCI bus scanning.
Keep the VIA resource reservations in plat_mem_setup() after the PCI
controller registration and use insert_resource() to nest them beneath
the PCI window. The i8259 and RTC resources are also claimed beneath it.
Boot-tested on a Qube2 with a MIPS64 kernel. All seven PCI functions
enumerate, both tulip devices bind, and pata_via initializes both ATA
hosts and detects the ST380012A 80 GB disk. All 18 boot checks pass,
including a read-only disk test and Ethernet ping.
Fixes: ae81aad5c2e1 ("MIPS: PCI: Use pci_enable_resources()")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/cobalt/pci.c | 11 +++++------
arch/mips/cobalt/setup.c | 4 +++-
arch/mips/include/asm/mach-cobalt/cobalt.h | 1 +
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/mips/cobalt/pci.c b/arch/mips/cobalt/pci.c
index 85ec9cc31d666..29fd052766b2a 100644
--- a/arch/mips/cobalt/pci.c
+++ b/arch/mips/cobalt/pci.c
@@ -14,6 +14,8 @@
#include <asm/gt64120.h>
+#include <cobalt.h>
+
extern struct pci_ops gt64xxx_pci0_ops;
static struct resource cobalt_mem_resource = {
@@ -24,7 +26,7 @@ static struct resource cobalt_mem_resource = {
};
static struct resource cobalt_io_resource = {
- .start = 0x1000,
+ .start = 0,
.end = 0xffffffUL,
.name = "PCI I/O",
.flags = IORESOURCE_IO,
@@ -38,11 +40,8 @@ static struct pci_controller cobalt_pci_controller = {
.io_map_base = CKSEG1ADDR(GT_DEF_PCI0_IO_BASE),
};
-static int __init cobalt_pci_init(void)
+void __init cobalt_pci_init(void)
{
+ PCIBIOS_MIN_IO = 0x1000;
register_pci_controller(&cobalt_pci_controller);
-
- return 0;
}
-
-arch_initcall(cobalt_pci_init);
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index 9a266bf783399..502acc92969b8 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -83,9 +83,11 @@ void __init plat_mem_setup(void)
/* I/O port resource */
ioport_resource.end = 0x01ffffff;
+ cobalt_pci_init();
+
/* These resources have been reserved by VIA SuperI/O chip. */
for (i = 0; i < ARRAY_SIZE(cobalt_reserved_resources); i++)
- request_resource(&ioport_resource, cobalt_reserved_resources + i);
+ insert_resource(&ioport_resource, cobalt_reserved_resources + i);
}
/*
diff --git a/arch/mips/include/asm/mach-cobalt/cobalt.h b/arch/mips/include/asm/mach-cobalt/cobalt.h
index 97f9d5e9446d2..c7a8607cd651a 100644
--- a/arch/mips/include/asm/mach-cobalt/cobalt.h
+++ b/arch/mips/include/asm/mach-cobalt/cobalt.h
@@ -19,6 +19,7 @@ extern int cobalt_board_id;
#define COBALT_BRD_ID_QUBE2 0x5
#define COBALT_BRD_ID_RAQ2 0x6
+void cobalt_pci_init(void);
void cobalt_machine_halt(void);
void cobalt_machine_restart(char *command);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 298/990] MIPS: SB1250: Validate and update IRQ affinity
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (296 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 297/990] MIPS: Cobalt: Include legacy IDE ports in the PCI I/O window Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 299/990] introduce a flag for explicitly marking persistently pinned dentries Greg Kroah-Hartman
` (554 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Florian Fainelli,
Thomas Bogendoerfer, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <f.fainelli@gmail.com>
[ Upstream commit 456c965ca46c59a4a241c755e6565fd883a522f4 ]
sb1250_set_affinity() selects the first online CPU in the requested
affinity mask without checking whether such a CPU exists. If the
intersection is empty, the resulting CPU index is invalid and must
not be passed to cpu_logical_map().
Reject affinity masks containing no online CPU with -EINVAL before
accessing the CPU mapping or interrupt mapper registers.
Also update the effective affinity mask to reflect the single logical
CPU selected as the interrupt target.
Fixes: 421d1563c662 ("mips: Validate online cpus in irq_set_affinity() callbacks")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/sibyte/sb1250/irq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 2f08ad267a11e..d7a656cd7ec0c 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -76,6 +76,8 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask,
unsigned long flags;
i = cpumask_first_and(mask, cpu_online_mask);
+ if (i >= nr_cpu_ids)
+ return -EINVAL;
/* Convert logical CPU to physical CPU */
cpu = cpu_logical_map(i);
@@ -103,6 +105,7 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask,
____raw_writeq(cur_ints, IOADDR(A_IMR_MAPPER(cpu) +
R_IMR_INTERRUPT_MASK));
}
+ irq_data_update_effective_affinity(d, cpumask_of(i));
raw_spin_unlock_irqrestore(&sb1250_imr_lock, flags);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 299/990] introduce a flag for explicitly marking persistently pinned dentries
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (297 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 298/990] MIPS: SB1250: Validate and update IRQ affinity Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 300/990] libfs: walk offset directories in offset order Greg Kroah-Hartman
` (553 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Al Viro, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <viro@zeniv.linux.org.uk>
[ Upstream commit 8a210cacf5dc2a6210ee42aeca5cd03b2400876f ]
Some filesystems use a kinda-sorta controlled dentry refcount leak to pin
dentries of created objects in dcache (and undo it when removing those).
Reference is grabbed and not released, but it's not actually _stored_
anywhere. That works, but it's hard to follow and verify; among other
things, we have no way to tell _which_ of the increments is intended
to be an unpaired one. Worse, on removal we need to decide whether
the reference had already been dropped, which can be non-trivial if
that removal is on umount and we need to figure out if this dentry is
pinned due to e.g. unlink() not done. Usually that is handled by using
kill_litter_super() as ->kill_sb(), but there are open-coded special
cases of the same (consider e.g. /proc/self).
Things get simpler if we introduce a new dentry flag (DCACHE_PERSISTENT)
marking those "leaked" dentries. Having it set claims responsibility
for +1 in refcount.
The end result this series is aiming for:
* get these unbalanced dget() and dput() replaced with new primitives that
would, in addition to adjusting refcount, set and clear persistency flag.
* instead of having kill_litter_super() mess with removing the remaining
"leaked" references (e.g. for all tmpfs files that hadn't been removed
prior to umount), have the regular shrink_dcache_for_umount() strip
DCACHE_PERSISTENT of all dentries, dropping the corresponding
reference if it had been set. After that kill_litter_super() becomes
an equivalent of kill_anon_super().
Doing that in a single step is not feasible - it would affect too many places
in too many filesystems. It has to be split into a series.
Here we
* introduce the new flag
* teach shrink_dcache_for_umount() to handle it (i.e. remove
and drop refcount on anything that survives to umount with that flag
still set)
* teach kill_litter_super() that anything with that flag does
*not* need to be unpinned.
Next commits will add primitives for maintaing that flag and convert the
common helpers to those. After that - a long series of per-filesystem
patches converting to those primitives.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Stable-dep-of: 309f7a5585ae ("libfs: walk offset directories in offset order")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/dcache.c | 27 ++++++++++++++++++++++-----
include/linux/dcache.h | 1 +
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 77792a9e86737..467095024991b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1526,6 +1526,15 @@ static enum d_walk_ret select_collect(void *_data, struct dentry *dentry)
return ret;
}
+static enum d_walk_ret select_collect_umount(void *_data, struct dentry *dentry)
+{
+ if (dentry->d_flags & DCACHE_PERSISTENT) {
+ dentry->d_flags &= ~DCACHE_PERSISTENT;
+ dentry->d_lockref.count--;
+ }
+ return select_collect(_data, dentry);
+}
+
static enum d_walk_ret select_collect2(void *_data, struct dentry *dentry)
{
struct select_data *data = _data;
@@ -1554,18 +1563,20 @@ static enum d_walk_ret select_collect2(void *_data, struct dentry *dentry)
}
/**
- * shrink_dcache_parent - prune dcache
+ * shrink_dcache_tree - prune dcache
* @parent: parent of entries to prune
+ * @for_umount: true if we want to unpin the persistent ones
*
* Prune the dcache to remove unused children of the parent dentry.
*/
-void shrink_dcache_parent(struct dentry *parent)
+static void shrink_dcache_tree(struct dentry *parent, bool for_umount)
{
for (;;) {
struct select_data data = {.start = parent};
INIT_LIST_HEAD(&data.dispose);
- d_walk(parent, &data, select_collect);
+ d_walk(parent, &data,
+ for_umount ? select_collect_umount : select_collect);
if (!list_empty(&data.dispose)) {
shrink_dentry_list(&data.dispose);
@@ -1590,6 +1601,11 @@ void shrink_dcache_parent(struct dentry *parent)
shrink_dentry_list(&data.dispose);
}
}
+
+void shrink_dcache_parent(struct dentry *parent)
+{
+ shrink_dcache_tree(parent, false);
+}
EXPORT_SYMBOL(shrink_dcache_parent);
static enum d_walk_ret umount_check(void *_data, struct dentry *dentry)
@@ -1616,7 +1632,7 @@ static enum d_walk_ret umount_check(void *_data, struct dentry *dentry)
static void do_one_tree(struct dentry *dentry)
{
- shrink_dcache_parent(dentry);
+ shrink_dcache_tree(dentry, true);
d_walk(dentry, dentry, umount_check);
d_drop(dentry);
dput(dentry);
@@ -3130,7 +3146,8 @@ static enum d_walk_ret d_genocide_kill(void *data, struct dentry *dentry)
{
struct dentry *root = data;
if (dentry != root) {
- if (d_unhashed(dentry) || !dentry->d_inode)
+ if (d_unhashed(dentry) || !dentry->d_inode ||
+ dentry->d_flags & DCACHE_PERSISTENT)
return D_WALK_SKIP;
if (!(dentry->d_flags & DCACHE_GENOCIDE)) {
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c83e02b943894..94b58655322a0 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -225,6 +225,7 @@ enum dentry_flags {
DCACHE_PAR_LOOKUP = BIT(24), /* being looked up (with parent locked shared) */
DCACHE_DENTRY_CURSOR = BIT(25),
DCACHE_NORCU = BIT(26), /* No RCU delay for freeing */
+ DCACHE_PERSISTENT = BIT(27)
};
#define DCACHE_MANAGED_DENTRY \
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 300/990] libfs: walk offset directories in offset order
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (298 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 299/990] introduce a flag for explicitly marking persistently pinned dentries Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 301/990] libfs: end offset readdir at positions past DIR_OFFSET_EOD Greg Kroah-Hartman
` (552 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nickolai Zeldovich, Chuck Lever,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit 309f7a5585aeaf77d3d7c27304ac97e515447dac ]
offset_iterate_dir() walks d_children from the head and only uses the
maple tree to map ctx->pos back to a dentry when a getdents64() call
resumes. offset_dir_lookup() finds the entry at ctx->pos, or the one
with the next lower offset if it is gone, and the list walk continues
from there.
That only works if list order and offset order agree and quite often
they don't. A rename over an existing name gives the moved dentry the
offset of the name it replaced but __d_move() puts it at the head of
d_children. RENAME_EXCHANGE does the same to both dentries. And once
the cyclic offset allocator wraps new entries get low offsets at the
head of the list.
So if the entry at ctx->pos is unlinked between two getdents64() calls
we resume at the entry with the next lower offset and that one can sit
anywhere in the list:
(1) If it sits further down the list everything in between is skipped.
Create y, t, a, b and rename b over t. The list is now t(4) a(5)
y(3). Stop the listing at t and unlink t. The next call resumes at
y and a is never returned although nobody touched it.
(2) If there is no lower entry we restart at the head and return the
whole directory again. Nickolai reported this for the simple case
of unlinking the oldest entry while a listing is about to reach it.
Ending the walk there instead turns this into (1): create a, b, c,
rename c over a, stop the listing at the renamed entry, unlink it,
and b is lost.
Instead of the list let's walk the maple tree itself in descending
offset order. Then ctx->pos really means that everything above it has
been emitted and resuming at the highest offset at or below it is right
no matter where the dentry sits in d_children. Entries created or
renamed to a new name after the listing started get an offset above
ctx->pos and aren't returned, same as with the list walk which never
went back to the head. So a readdir loop that renames or creates an
entry for each one it reads still terminates.
The maple tree can't change under us as all modifications happen with
the directory's i_rwsem held exclusive and offset_readdir() holds it
shared. That also covers the dentries in the tree. They are all
persistent and only unlink, rmdir and rename remove or rename them. And
since the previous patch i_rwsem is the lock of the tree. So keep a
single ma_state across the walk and emit directly from the dentry
without taking rcu_read_lock(), a reference or d_lock.
This also makes the walk cheaper than the list walk was. With a million
entries on tmpfs a getdents64() listing goes from 146ms to 114ms. With
four processes listing the directory at the same time it goes from
470ms to 113ms per listing as they don't bounce the parent's d_lock and
the dentries' lockrefs between them anymore.
base v2 this
1M entries, getdents64 32k buffer (ms) 146 127 114
1M entries, getdents64 1k buffer (ms) 184 156 141
1M entries, getdents64 128b buffer (ms) 429 364 335
1M entries, ls -f (s) 0.259 0.239 0.228
1M entries, LC_ALL=C ls (s) 0.482 0.467 0.455
1M entries, 4 parallel listers (ms) 470 125 113
18 entries, rewind and list (ns) 4107 3594 3323
250k of 1M left, getdents64 32k (ms) 58.8 57.8 53.8
250k of 1M left, getdents64 128b (ms) 128 114 108
Fixes: b9b588f22a0c ("libfs: Use d_children list to iterate simple_offset directories")
Fixes: f70681e9e606 ("libfs: Fix duplicate directory entry in offset_dir_lookup")
Reported-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Link: https://patch.msgid.link/20261018024549.798968-1-nickolai@csail.mit.edu
Link: https://patch.msgid.link/20261101-work-libfs-offset_readdir-v2-2-c621125b56d1@kernel.org
Reviewed-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/libfs.c | 85 ++++++++++++++----------------------------------------
1 file changed, 22 insertions(+), 63 deletions(-)
diff --git a/fs/libfs.c b/fs/libfs.c
index 52f00bfc8f7ba..cb37a117c8e5c 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -283,6 +283,12 @@ void simple_offset_init(struct offset_ctx *octx)
* @octx: directory offset ctx to be updated
* @dentry: new dentry being added
*
+ * The offset map holds no reference to @dentry. Once positive, @dentry
+ * must be pinned with d_make_persistent() for as long as it is in the
+ * map, and entries may only be added, removed or renamed with the
+ * directory's i_rwsem held exclusive: offset_readdir() emits straight
+ * from the map under the shared lock.
+ *
* Returns zero on success. @octx and the dentry's offset are updated.
* Otherwise, a negative errno value is returned.
*/
@@ -447,51 +453,6 @@ static loff_t offset_dir_llseek(struct file *file, loff_t offset, int whence)
return vfs_setpos(file, offset, LONG_MAX);
}
-static struct dentry *find_positive_dentry(struct dentry *parent,
- struct dentry *dentry,
- bool next)
-{
- struct dentry *found = NULL;
-
- spin_lock(&parent->d_lock);
- if (next)
- dentry = d_next_sibling(dentry);
- else if (!dentry)
- dentry = d_first_child(parent);
- hlist_for_each_entry_from(dentry, d_sib) {
- if (!simple_positive(dentry))
- continue;
- spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
- if (simple_positive(dentry))
- found = dget_dlock(dentry);
- spin_unlock(&dentry->d_lock);
- if (likely(found))
- break;
- }
- spin_unlock(&parent->d_lock);
- return found;
-}
-
-static noinline_for_stack struct dentry *
-offset_dir_lookup(struct dentry *parent, loff_t offset)
-{
- struct inode *inode = d_inode(parent);
- struct offset_ctx *octx = inode->i_op->get_offset_ctx(inode);
- struct dentry *child, *found = NULL;
-
- MA_STATE(mas, &octx->mt, offset, offset);
-
- if (offset == DIR_OFFSET_FIRST)
- found = find_positive_dentry(parent, NULL, false);
- else {
- rcu_read_lock();
- child = mas_find_rev(&mas, DIR_OFFSET_MIN);
- found = find_positive_dentry(parent, child, false);
- rcu_read_unlock();
- }
- return found;
-}
-
static bool offset_dir_emit(struct dir_context *ctx, struct dentry *dentry)
{
struct inode *inode = d_inode(dentry);
@@ -500,32 +461,30 @@ static bool offset_dir_emit(struct dir_context *ctx, struct dentry *dentry)
inode->i_ino, fs_umode_to_dtype(inode->i_mode));
}
+/*
+ * Emit entries in descending offset order. The directory's i_rwsem is the
+ * lock of the offset tree and the persistent dentries in it only change
+ * with it held exclusive. We hold it shared, so @mas stays valid across
+ * dir_emit() and the dentries need no references.
+ */
static void offset_iterate_dir(struct file *file, struct dir_context *ctx)
{
- struct dentry *dir = file->f_path.dentry;
+ struct inode *inode = file_inode(file);
+ struct offset_ctx *octx = inode->i_op->get_offset_ctx(inode);
+ loff_t start = ctx->pos == DIR_OFFSET_FIRST ? DIR_OFFSET_MAX : ctx->pos;
struct dentry *dentry;
- dentry = offset_dir_lookup(dir, ctx->pos);
- if (!dentry)
- goto out_eod;
- while (true) {
- struct dentry *next;
+ MA_STATE(mas, &octx->mt, start, start);
+ for (;;) {
+ dentry = mas_find_rev(&mas, DIR_OFFSET_MIN);
+ if (!dentry)
+ break;
+ VFS_WARN_ON_ONCE(!(dentry->d_flags & DCACHE_PERSISTENT));
ctx->pos = dentry2offset(dentry);
if (!offset_dir_emit(ctx, dentry))
- break;
-
- next = find_positive_dentry(dir, dentry, true);
- dput(dentry);
-
- if (!next)
- goto out_eod;
- dentry = next;
+ return;
}
- dput(dentry);
- return;
-
-out_eod:
ctx->pos = DIR_OFFSET_EOD;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 301/990] libfs: end offset readdir at positions past DIR_OFFSET_EOD
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (299 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 300/990] libfs: walk offset directories in offset order Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 302/990] initrd: flush deferred fput() before mounting root Greg Kroah-Hartman
` (551 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit 45eb9737058fa78a73f17a5da55c8cb482c6d5bb ]
offset_dir_llseek() takes any position up to LONG_MAX but
offset_readdir() only skips the walk for DIR_OFFSET_EOD itself. For a
position past it mas_find_rev() starts the walk at the highest offset
in the directory. So an lseek() past the end makes the next
getdents64() return the whole directory again.
Before commit b9b588f22a0c ("libfs: Use d_children list to iterate
simple_offset directories") the walk went up from the position and
found nothing past the end, and dcache_readdir() returns nothing there
either. So only walk for positions below DIR_OFFSET_EOD.
Fixes: b9b588f22a0c ("libfs: Use d_children list to iterate simple_offset directories")
Link: https://patch.msgid.link/20261101-work-libfs-offset_readdir-v2-3-c621125b56d1@kernel.org
Reviewed-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/libfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/libfs.c b/fs/libfs.c
index cb37a117c8e5c..f210c0c642459 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -519,7 +519,7 @@ static int offset_readdir(struct file *file, struct dir_context *ctx)
if (!dir_emit_dots(file, ctx))
return 0;
- if (ctx->pos != DIR_OFFSET_EOD)
+ if (ctx->pos < DIR_OFFSET_EOD)
offset_iterate_dir(file, ctx);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 302/990] initrd: flush deferred fput() before mounting root
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (300 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 301/990] libfs: end offset readdir at positions past DIR_OFFSET_EOD Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 303/990] iov_iter: take an unsigned long segment count in import_iovec() Greg Kroah-Hartman
` (550 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Abbott Liu,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abbott Liu <liuwenliang@huawei.com>
[ Upstream commit 807c1d7125a2b3ca5705a803aa2e19f9d53d1ea3 ]
Booting an old-style initrd, i.e. a filesystem image instead of a cpio
archive, with "root=/dev/ram rootfstype=squashfs" can fail to mount the
root filesystem:
RAMDISK: squashfs filesystem found at block 0
RAMDISK: Loading 68449KiB [1 disk] into ram disk... done.
No filesystem could mount root, tried:
squashfs
Kernel panic - not syncing: VFS: Unable to mount root fs on
"/dev/ram" or unknown-block(1,0)
rd_load_image() copies the image into /dev/ram with kernel_write() and
then drops the file with fput(). The data only reaches the ramdisk once
the final __fput() releases the block device and bdev_release() calls
sync_blockdev(). But that __fput() is deferred. Since commit
343f4c49f243 ("kthread: Don't allocate kthread_struct for init and
umh") init is a user mode task, so the __fput() is queued as task work
and only runs once init returns to userspace, i.e. long after
mount_root(). Before that it ran as delayed fput work at least a jiffy
later, which doesn't help either.
Whether the mount survives this depends on the block size. Squashfs
calls sb_min_blocksize() first and set_blocksize() syncs and drops the
page cache when the requested block size differs from the current one.
That hides the problem for most configurations. With
CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y and 4K pages both block sizes are 4K
because set_init_blocksize() gives a page-aligned ramdisk a PAGE_SIZE
block size on the first open. So set_blocksize() does nothing and
squashfs reads the superblock with bios that bypass the page cache. brd
has no page for that range yet and returns zeroes, so the magic check
fails and the mount returns -EINVAL. With rootfstype= naming a single
filesystem there is nothing left to retry and mount_root_generic()
panics.
Fixing this in squashfs would be the wrong end. Most block-backed
filesystems read their superblock or their file data with bios that
bypass the block device page cache, so they are exposed to the same
race, just less loudly.
So flush the deferred fput() in rd_load_image() right after dropping the
ramdisk file, the same way mount_root_generic() already does before it
retries with another filesystem type. All deferred closes at this point
belong to files the boot itself created.
Verified on arm64 QEMU with an openEuler Embedded rootfs image packed as
squashfs.
Fixes: 93e72b3c612a ("squashfs: migrate from ll_rw_block usage to BIO")
Signed-off-by: Abbott Liu <liuwenliang@huawei.com>
Link: https://patch.msgid.link/20260930084632.2965573-1-liuwenliang@huawei.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
init/do_mounts_rd.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 19d9f33dcacf8..fb7897d879b06 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -268,6 +268,11 @@ int __init rd_load_image(char *from)
fput(in_file);
noclose_input:
fput(out_file);
+ /*
+ * The image only reaches the ramdisk when the deferred __fput()
+ * syncs the block device. Flush it before mount_root() reads it.
+ */
+ init_flush_fput();
out:
kfree(buf);
init_unlink("/dev/ram");
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 303/990] iov_iter: take an unsigned long segment count in import_iovec()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (301 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 302/990] initrd: flush deferred fput() before mounting root Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 304/990] vfs: preserve subsecond timestamps at filesystem time limits Greg Kroah-Hartman
` (549 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Parri, Jan Kara,
Christian Brauner (Amutable), 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 965e5e451146a19f69523fbcbc73d07e401a3775 ]
readv(), writev() and their positional variants, process_vm_readv(),
process_vm_writev(), vmsplice(), process_madvise(), vectored aio and
the btrfs encoded I/O ioctls all take a full-width segment count, and
all of them hand it to import_iovec() or __import_iovec(). Those take
an unsigned int count, so on 64-bit kernels the upper 32 bits are
dropped before iovec_from_user() checks the count against UIO_MAXIOV.
A count of 0x100000001 is therefore imported as one segment: writev()
on a pipe writes a byte and readv() reads it back, instead of both
failing with EINVAL. A count of 0x100000000 returns 0 as an empty
vector.
import_iovec() was added with an unsigned int count, but the helper it
wrapped, rw_copy_check_uvector(), took an unsigned long, as does
iovec_from_user() today. Until v4.1, readv(), writev(), preadv(),
pwritev(), process_vm_readv(), process_vm_writev() and vectored aio
therefore failed these counts with EINVAL, as did vmsplice() until
v4.18.
Widen nr_segs in both import helpers so the UIO_MAXIOV check sees the
count the caller passed. Callers with 32-bit counts are unaffected.
AI assistance was used to find the bug, develop the fix, and run the
reproducers.
Fixes: bc917be81059 ("saner iov_iter initialization primitives")
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Link: https://patch.msgid.link/20261026180619.4147910-1-parri.andrea@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/uio.h | 8 ++++----
lib/iov_iter.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 5b127043a1519..5678520f0bfb6 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -362,11 +362,11 @@ struct iovec *iovec_from_user(const struct iovec __user *uvector,
unsigned long nr_segs, unsigned long fast_segs,
struct iovec *fast_iov, bool compat);
ssize_t import_iovec(int type, const struct iovec __user *uvec,
- unsigned nr_segs, unsigned fast_segs, struct iovec **iovp,
- struct iov_iter *i);
+ unsigned long nr_segs, unsigned int fast_segs,
+ struct iovec **iovp, struct iov_iter *i);
ssize_t __import_iovec(int type, const struct iovec __user *uvec,
- unsigned nr_segs, unsigned fast_segs, struct iovec **iovp,
- struct iov_iter *i, bool compat);
+ unsigned long nr_segs, unsigned int fast_segs,
+ struct iovec **iovp, struct iov_iter *i, bool compat);
int import_ubuf(int type, void __user *buf, size_t len, struct iov_iter *i);
static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index b2eb629497a92..a9918931055a8 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1354,8 +1354,8 @@ static ssize_t __import_iovec_ubuf(int type, const struct iovec __user *uvec,
}
ssize_t __import_iovec(int type, const struct iovec __user *uvec,
- unsigned nr_segs, unsigned fast_segs, struct iovec **iovp,
- struct iov_iter *i, bool compat)
+ unsigned long nr_segs, unsigned int fast_segs,
+ struct iovec **iovp, struct iov_iter *i, bool compat)
{
ssize_t total_len = 0;
unsigned long seg;
@@ -1426,7 +1426,7 @@ ssize_t __import_iovec(int type, const struct iovec __user *uvec,
* Return: Negative error code on error, bytes imported on success
*/
ssize_t import_iovec(int type, const struct iovec __user *uvec,
- unsigned nr_segs, unsigned fast_segs,
+ unsigned long nr_segs, unsigned int fast_segs,
struct iovec **iovp, struct iov_iter *i)
{
return __import_iovec(type, uvec, nr_segs, fast_segs, iovp, i,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 304/990] vfs: preserve subsecond timestamps at filesystem time limits
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (302 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 303/990] iov_iter: take an unsigned long segment count in import_iovec() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 305/990] statx: dont leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask Greg Kroah-Hartman
` (548 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hungyu Lin, Jeff Layton,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
[ Upstream commit 55a0c91000646b008261e3b1e15d1e774f3026e4 ]
timestamp_truncate() clears tv_nsec whenever the clamped seconds equal
either filesystem time limit. This also drops the fractional part of
timestamps whose seconds were already within the supported range.
For example, setting a JFS mtime to 0.123456789 produces 0.000000000,
although the filesystem can store the requested value. Utilities such
as touch and cp -p consequently lose valid subsecond timestamps when
preserving these endpoint values. Timestamps strictly between the
filesystem limits are unaffected.
Only clear tv_nsec when clamping actually changes tv_sec. Continue to
truncate in-range nanoseconds to the filesystem's timestamp granularity,
including when the seconds equal either endpoint.
Ben Hutchings suggested comparing clamped and original seconds in the
2019 utimes review. That caller was switched to timestamp_truncate(),
but the helper retained its endpoint equality check.
Link: https://lore.kernel.org/lkml/12c095e595836a7ff7f2c7b2a32cb5544dd29b55.camel@codethink.co.uk/
Fixes: 50e17c000c46 ("vfs: Add timestamp_truncate() api")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Link: https://patch.msgid.link/20261101113815.52911-1-dennylin0707@gmail.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/inode.c b/fs/inode.c
index b60111fad771a..a5333c9ff761d 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2741,9 +2741,10 @@ struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode)
{
struct super_block *sb = inode->i_sb;
unsigned int gran = sb->s_time_gran;
+ time64_t seconds = t.tv_sec;
t.tv_sec = clamp(t.tv_sec, sb->s_time_min, sb->s_time_max);
- if (unlikely(t.tv_sec == sb->s_time_max || t.tv_sec == sb->s_time_min))
+ if (unlikely(t.tv_sec != seconds))
t.tv_nsec = 0;
/* Avoid division in the common cases 1 ns and 1 s. */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 305/990] statx: dont leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (303 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 304/990] vfs: preserve subsecond timestamps at filesystem time limits Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 306/990] fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek() Greg Kroah-Hartman
` (547 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jan Kara, Jeff Layton,
Christoph Hellwig, Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <jlayton@kernel.org>
[ Upstream commit 925d238324c79bcb75ad0add1d1b9d31d5f48115 ]
STATX_ATTR_CHANGE_MONOTONIC is kernel-internal. cp_statx() strips it
from stx_attributes but copies attributes_mask verbatim, so it leaks to
userland on filesystems that advertise it (nfs, ceph), e.g.
stx_attributes_mask = 0x8000000000303000 on NFS.
Add a new mask constant and apply it to both fields.
Fixes: a1175d6b1bda ("vfs: plumb i_version handling into struct kstat")
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20261103-statx-v2-1-8b09aa8118ab@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/stat.c | 6 +++---
include/linux/stat.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/stat.c b/fs/stat.c
index 3bc049f0bc3dd..484b61ccc1152 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -718,8 +718,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
/* STATX_CHANGE_COOKIE is kernel-only for now */
tmp.stx_mask = stat->result_mask & ~STATX_CHANGE_COOKIE;
tmp.stx_blksize = stat->blksize;
- /* STATX_ATTR_CHANGE_MONOTONIC is kernel-only for now */
- tmp.stx_attributes = stat->attributes & ~STATX_ATTR_CHANGE_MONOTONIC;
+ tmp.stx_attributes = stat->attributes & ~STATX_ATTR_INTERNAL_MASK;
tmp.stx_nlink = stat->nlink;
tmp.stx_uid = from_kuid_munged(current_user_ns(), stat->uid);
tmp.stx_gid = from_kgid_munged(current_user_ns(), stat->gid);
@@ -727,7 +726,8 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
tmp.stx_ino = stat->ino;
tmp.stx_size = stat->size;
tmp.stx_blocks = stat->blocks;
- tmp.stx_attributes_mask = stat->attributes_mask;
+ tmp.stx_attributes_mask = stat->attributes_mask &
+ ~STATX_ATTR_INTERNAL_MASK;
tmp.stx_atime.tv_sec = stat->atime.tv_sec;
tmp.stx_atime.tv_nsec = stat->atime.tv_nsec;
tmp.stx_btime.tv_sec = stat->btime.tv_sec;
diff --git a/include/linux/stat.h b/include/linux/stat.h
index e3d00e7bb26d9..3f4364808b7f0 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -69,4 +69,7 @@ struct kstat {
/* file attribute values */
#define STATX_ATTR_CHANGE_MONOTONIC 0x8000000000000000ULL /* version monotonically increases */
+/* mask of STATX_ATTR_* bits that is private to the kernel */
+#define STATX_ATTR_INTERNAL_MASK (STATX_ATTR_CHANGE_MONOTONIC)
+
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 306/990] fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (304 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 305/990] statx: dont leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 307/990] perf: Add perf_event_attr::config4 Greg Kroah-Hartman
` (546 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Siddharth Chintamaneni, Jan Kara,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
[ Upstream commit 7a5783cfac71b3c12e7fb1c2894dd4538d57d513 ]
In default_llseek(), the range checks for SEEK_DATA and SEEK_HOLE compare
the signed loff_t offset directly against inode->i_size:
if (offset >= inode->i_size) {
retval = -ENXIO;
goto out;
}
When a negative offset is supplied to SEEK_HOLE (e.g. lseek(fd, -10,
SEEK_HOLE) on a sysctl file in /proc/sys), the signed comparison evaluates
to false and execution proceeds to:
offset = inode->i_size;
This overwrites the negative offset with a non-negative value before the
final `if (offset >= 0 || unsigned_offsets(file))` check, causing
default_llseek() to update file->f_pos and return inode->i_size instead of
failing with -ENXIO. Similarly, for SEEK_DATA on a file with
FOP_UNSIGNED_OFFSET, a negative offset bypasses the range check and
succeeds via unsigned_offsets(file).
Read the inode size once via i_size_read(inode) after acquiring the inode
lock and compare (unsigned long long)offset >= eof for both SEEK_DATA and
SEEK_HOLE, matching must_set_pos().
Fixes: 982d816581ee ("fs: add SEEK_HOLE and SEEK_DATA flags")
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
Link: https://patch.msgid.link/20261101060049.81441-2-sidchintamaneni@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/read_write.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c
index 011fe55c94cdb..96528614d4f33 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -331,13 +331,15 @@ loff_t default_llseek(struct file *file, loff_t offset, int whence)
{
struct inode *inode = file_inode(file);
loff_t retval;
+ loff_t eof;
retval = inode_lock_killable(inode);
if (retval)
return retval;
+ eof = i_size_read(inode);
switch (whence) {
case SEEK_END:
- offset += i_size_read(inode);
+ offset += eof;
break;
case SEEK_CUR:
if (offset == 0) {
@@ -352,7 +354,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int whence)
* long as offset isn't at the end of the file then the
* offset is data.
*/
- if (offset >= inode->i_size) {
+ if ((unsigned long long)offset >= eof) {
retval = -ENXIO;
goto out;
}
@@ -363,11 +365,11 @@ loff_t default_llseek(struct file *file, loff_t offset, int whence)
* as long as offset isn't i_size or larger, return
* i_size.
*/
- if (offset >= inode->i_size) {
+ if ((unsigned long long)offset >= eof) {
retval = -ENXIO;
goto out;
}
- offset = inode->i_size;
+ offset = eof;
break;
}
retval = -EINVAL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 307/990] perf: Add perf_event_attr::config4
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (305 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 306/990] fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek() Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 308/990] perf: Add APIs to create/release mediated guest vPMUs Greg Kroah-Hartman
` (545 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leo Yan, Ian Rogers,
Peter Zijlstra (Intel), James Clark, Will Deacon, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <james.clark@linaro.org>
[ Upstream commit cbbfba4847b8a5299d36e002bf864b21bb83295d ]
Arm FEAT_SPE_FDS adds the ability to filter on the data source of a
packet using another 64-bits of event filtering control. As the existing
perf_event_attr::configN fields are all used up for SPE PMU, an
additional field is needed. Add a new 'config4' field.
Reviewed-by: Leo Yan <leo.yan@arm.com>
Tested-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: James Clark <james.clark@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
Stable-dep-of: b61c12527223 ("perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/uapi/linux/perf_event.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 78a362b800277..0d0ed85ad8cb3 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -382,6 +382,7 @@ enum perf_event_read_format {
#define PERF_ATTR_SIZE_VER6 120 /* Add: aux_sample_size */
#define PERF_ATTR_SIZE_VER7 128 /* Add: sig_data */
#define PERF_ATTR_SIZE_VER8 136 /* Add: config3 */
+#define PERF_ATTR_SIZE_VER9 144 /* add: config4 */
/*
* 'struct perf_event_attr' contains various attributes that define
@@ -543,6 +544,7 @@ struct perf_event_attr {
__u64 sig_data;
__u64 config3; /* extension of config2 */
+ __u64 config4; /* extension of config3 */
};
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 308/990] perf: Add APIs to create/release mediated guest vPMUs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (306 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 307/990] perf: Add perf_event_attr::config4 Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 309/990] perf: Eliminate duplicate arch-specific function definitions Greg Kroah-Hartman
` (544 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sean Christopherson, Kan Liang,
Mingwei Zhang, Peter Zijlstra (Intel), Xudong Hao, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <kan.liang@linux.intel.com>
[ Upstream commit eff95e170275d9e80b968f335cd03d0ac250d2d1 ]
Currently, exposing PMU capabilities to a KVM guest is done by emulating
guest PMCs via host perf events, i.e. by having KVM be "just" another user
of perf. As a result, the guest and host are effectively competing for
resources, and emulating guest accesses to vPMU resources requires
expensive actions (expensive relative to the native instruction). The
overhead and resource competition results in degraded guest performance
and ultimately very poor vPMU accuracy.
To address the issues with the perf-emulated vPMU, introduce a "mediated
vPMU", where the data plane (PMCs and enable/disable knobs) is exposed
directly to the guest, but the control plane (event selectors and access
to fixed counters) is managed by KVM (via MSR interceptions). To allow
host perf usage of the PMU to (partially) co-exist with KVM/guest usage
of the PMU, KVM and perf will coordinate to a world switch between host
perf context and guest vPMU context near VM-Enter/VM-Exit.
Add two exported APIs, perf_{create,release}_mediated_pmu(), to allow KVM
to create and release a mediated PMU instance (per VM). Because host perf
context will be deactivated while the guest is running, mediated PMU usage
will be mutually exclusive with perf analysis of the guest, i.e. perf
events that do NOT exclude the guest will not behave as expected.
To avoid silent failure of !exclude_guest perf events, disallow creating a
mediated PMU if there are active !exclude_guest events, and on the perf
side, disallowing creating new !exclude_guest perf events while there is
at least one active mediated PMU.
Exempt PMU resources that do not support mediated PMU usage, i.e. that are
outside the scope/view of KVM's vPMU and will not be swapped out while the
guest is running.
Guard mediated PMU with a new kconfig to help readers identify code paths
that are unique to mediated PMU support, and to allow for adding arch-
specific hooks without stubs. KVM x86 is expected to be the only KVM
architecture to support a mediated PMU in the near future (e.g. arm64 is
trending toward a partitioned PMU implementation), and KVM x86 will select
PERF_GUEST_MEDIATED_PMU unconditionally, i.e. won't need stubs.
Immediately select PERF_GUEST_MEDIATED_PMU when KVM x86 is enabled so that
all paths are compile tested. Full KVM support is on its way...
[sean: add kconfig and WARNing, rewrite changelog, swizzle patch ordering]
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Mingwei Zhang <mizhang@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Xudong Hao <xudong.hao@intel.com>
Link: https://patch.msgid.link/20251206001720.468579-5-seanjc@google.com
Stable-dep-of: b61c12527223 ("perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/kvm/Kconfig | 1 +
include/linux/perf_event.h | 6 +++
init/Kconfig | 4 ++
kernel/events/core.c | 82 ++++++++++++++++++++++++++++++++++++++
4 files changed, 93 insertions(+)
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 278f08194ec87..d916bd766c94d 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -37,6 +37,7 @@ config KVM_X86
select SCHED_INFO
select PERF_EVENTS
select GUEST_PERF_EVENTS
+ select PERF_GUEST_MEDIATED_PMU
select HAVE_KVM_MSI
select HAVE_KVM_CPU_RELAX_INTERCEPT
select HAVE_KVM_NO_POLL
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c8acdb026c627..5fb17c4f52f12 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -305,6 +305,7 @@ struct perf_event_pmu_context;
#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100
#define PERF_PMU_CAP_AUX_PAUSE 0x0200
#define PERF_PMU_CAP_AUX_PREFER_LARGE 0x0400
+#define PERF_PMU_CAP_MEDIATED_VPMU 0x0800
/**
* pmu::scope
@@ -1915,6 +1916,11 @@ extern int perf_event_account_interrupt(struct perf_event *event);
extern int perf_event_period(struct perf_event *event, u64 value);
extern u64 perf_event_pause(struct perf_event *event, bool reset);
+#ifdef CONFIG_PERF_GUEST_MEDIATED_PMU
+int perf_create_mediated_pmu(void);
+void perf_release_mediated_pmu(void);
+#endif
+
#else /* !CONFIG_PERF_EVENTS: */
static inline void *
diff --git a/init/Kconfig b/init/Kconfig
index 1858e55bfd7cd..78d4277990e94 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2018,6 +2018,10 @@ config GUEST_PERF_EVENTS
bool
depends on HAVE_PERF_EVENTS
+config PERF_GUEST_MEDIATED_PMU
+ bool
+ depends on GUEST_PERF_EVENTS
+
config PERF_USE_VMALLOC
bool
help
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f6045a7f83283..6e194e4ce4a03 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5674,6 +5674,8 @@ static void __free_event(struct perf_event *event)
call_rcu(&event->rcu_head, free_event_rcu);
}
+static void mediated_pmu_unaccount_event(struct perf_event *event);
+
DEFINE_FREE(__free_event, struct perf_event *, if (_T) __free_event(_T))
/* vs perf_event_alloc() success */
@@ -5683,6 +5685,7 @@ static void _free_event(struct perf_event *event)
irq_work_sync(&event->pending_disable_irq);
unaccount_event(event);
+ mediated_pmu_unaccount_event(event);
security_perf_event_free(event);
@@ -6207,6 +6210,81 @@ u64 perf_event_pause(struct perf_event *event, bool reset)
}
EXPORT_SYMBOL_GPL(perf_event_pause);
+#ifdef CONFIG_PERF_GUEST_MEDIATED_PMU
+static atomic_t nr_include_guest_events __read_mostly;
+
+static atomic_t nr_mediated_pmu_vms __read_mostly;
+static DEFINE_MUTEX(perf_mediated_pmu_mutex);
+
+/* !exclude_guest event of PMU with PERF_PMU_CAP_MEDIATED_VPMU */
+static inline bool is_include_guest_event(struct perf_event *event)
+{
+ if ((event->pmu->capabilities & PERF_PMU_CAP_MEDIATED_VPMU) &&
+ !event->attr.exclude_guest)
+ return true;
+
+ return false;
+}
+
+static int mediated_pmu_account_event(struct perf_event *event)
+{
+ if (!is_include_guest_event(event))
+ return 0;
+
+ guard(mutex)(&perf_mediated_pmu_mutex);
+
+ if (atomic_read(&nr_mediated_pmu_vms))
+ return -EOPNOTSUPP;
+
+ atomic_inc(&nr_include_guest_events);
+ return 0;
+}
+
+static void mediated_pmu_unaccount_event(struct perf_event *event)
+{
+ if (!is_include_guest_event(event))
+ return;
+
+ atomic_dec(&nr_include_guest_events);
+}
+
+/*
+ * Currently invoked at VM creation to
+ * - Check whether there are existing !exclude_guest events of PMU with
+ * PERF_PMU_CAP_MEDIATED_VPMU
+ * - Set nr_mediated_pmu_vms to prevent !exclude_guest event creation on
+ * PMUs with PERF_PMU_CAP_MEDIATED_VPMU
+ *
+ * No impact for the PMU without PERF_PMU_CAP_MEDIATED_VPMU. The perf
+ * still owns all the PMU resources.
+ */
+int perf_create_mediated_pmu(void)
+{
+ guard(mutex)(&perf_mediated_pmu_mutex);
+ if (atomic_inc_not_zero(&nr_mediated_pmu_vms))
+ return 0;
+
+ if (atomic_read(&nr_include_guest_events))
+ return -EBUSY;
+
+ atomic_inc(&nr_mediated_pmu_vms);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(perf_create_mediated_pmu);
+
+void perf_release_mediated_pmu(void)
+{
+ if (WARN_ON_ONCE(!atomic_read(&nr_mediated_pmu_vms)))
+ return;
+
+ atomic_dec(&nr_mediated_pmu_vms);
+}
+EXPORT_SYMBOL_GPL(perf_release_mediated_pmu);
+#else
+static int mediated_pmu_account_event(struct perf_event *event) { return 0; }
+static void mediated_pmu_unaccount_event(struct perf_event *event) {}
+#endif
+
/*
* Holding the top-level event's child_mutex means that any
* descendant process that has inherited this event will block
@@ -13182,6 +13260,10 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
if (err)
return ERR_PTR(err);
+ err = mediated_pmu_account_event(event);
+ if (err)
+ return ERR_PTR(err);
+
/* symmetric to unaccount_event() in _free_event() */
account_event(event);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 309/990] perf: Eliminate duplicate arch-specific function definitions
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (307 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 308/990] perf: Add APIs to create/release mediated guest vPMUs Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 310/990] perf: Move and enhance has_extended_regs() for arch-specific use Greg Kroah-Hartman
` (543 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dapeng Mi, Peter Zijlstra (Intel),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <dapeng1.mi@linux.intel.com>
[ Upstream commit cb388bd530cc518b0e245fb4eabc40f3de538e4f ]
Define default common __weak functions for perf_reg_value(),
perf_reg_validate(), perf_reg_abi() and perf_get_regs_user(). This helps
to eliminate the duplicated arch-specific definitions.
No function changes intended.
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260824082731.1013973-5-dapeng1.mi@linux.intel.com
Stable-dep-of: b61c12527223 ("perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/kernel/perf_regs.c | 6 ------
arch/arm64/kernel/perf_regs.c | 6 ------
arch/csky/kernel/perf_regs.c | 6 ------
arch/loongarch/kernel/perf_regs.c | 6 ------
arch/mips/kernel/perf_regs.c | 6 ------
arch/parisc/kernel/perf_regs.c | 6 ------
arch/riscv/kernel/perf_regs.c | 6 ------
arch/x86/kernel/perf_regs.c | 6 ------
include/linux/perf_regs.h | 32 ++++++-------------------------
kernel/events/core.c | 22 +++++++++++++++++++++
10 files changed, 28 insertions(+), 74 deletions(-)
diff --git a/arch/arm/kernel/perf_regs.c b/arch/arm/kernel/perf_regs.c
index 0529f90395c94..d575a4c3ca56f 100644
--- a/arch/arm/kernel/perf_regs.c
+++ b/arch/arm/kernel/perf_regs.c
@@ -31,9 +31,3 @@ u64 perf_reg_abi(struct task_struct *task)
return PERF_SAMPLE_REGS_ABI_32;
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index b4eece3eb17d0..70e2f13f587f5 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -98,9 +98,3 @@ u64 perf_reg_abi(struct task_struct *task)
return PERF_SAMPLE_REGS_ABI_64;
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/csky/kernel/perf_regs.c b/arch/csky/kernel/perf_regs.c
index 09b7f88a2d6ad..94601f37b596d 100644
--- a/arch/csky/kernel/perf_regs.c
+++ b/arch/csky/kernel/perf_regs.c
@@ -31,9 +31,3 @@ u64 perf_reg_abi(struct task_struct *task)
return PERF_SAMPLE_REGS_ABI_32;
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/loongarch/kernel/perf_regs.c b/arch/loongarch/kernel/perf_regs.c
index 263ac4ab5af68..8dd604f017454 100644
--- a/arch/loongarch/kernel/perf_regs.c
+++ b/arch/loongarch/kernel/perf_regs.c
@@ -45,9 +45,3 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
return regs->regs[idx];
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/mips/kernel/perf_regs.c b/arch/mips/kernel/perf_regs.c
index e686780d1647a..7736d3c5ebd2c 100644
--- a/arch/mips/kernel/perf_regs.c
+++ b/arch/mips/kernel/perf_regs.c
@@ -60,9 +60,3 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
return (s64)v; /* Sign extend if 32-bit. */
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/parisc/kernel/perf_regs.c b/arch/parisc/kernel/perf_regs.c
index 68458e2f6197e..87e6990569a76 100644
--- a/arch/parisc/kernel/perf_regs.c
+++ b/arch/parisc/kernel/perf_regs.c
@@ -53,9 +53,3 @@ u64 perf_reg_abi(struct task_struct *task)
return PERF_SAMPLE_REGS_ABI_64;
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/riscv/kernel/perf_regs.c b/arch/riscv/kernel/perf_regs.c
index fd304a248de68..3bba8deababbf 100644
--- a/arch/riscv/kernel/perf_regs.c
+++ b/arch/riscv/kernel/perf_regs.c
@@ -35,9 +35,3 @@ u64 perf_reg_abi(struct task_struct *task)
#endif
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c
index 624703af80a19..81204cb7f7239 100644
--- a/arch/x86/kernel/perf_regs.c
+++ b/arch/x86/kernel/perf_regs.c
@@ -100,12 +100,6 @@ u64 perf_reg_abi(struct task_struct *task)
return PERF_SAMPLE_REGS_ABI_32;
}
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
#else /* CONFIG_X86_64 */
#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
(1ULL << PERF_REG_X86_ES) | \
diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h
index f632c5725f162..144bcc3ff19fe 100644
--- a/include/linux/perf_regs.h
+++ b/include/linux/perf_regs.h
@@ -9,6 +9,12 @@ struct perf_regs {
struct pt_regs *regs;
};
+u64 perf_reg_value(struct pt_regs *regs, int idx);
+int perf_reg_validate(u64 mask);
+u64 perf_reg_abi(struct task_struct *task);
+void perf_get_regs_user(struct perf_regs *regs_user,
+ struct pt_regs *regs);
+
#ifdef CONFIG_HAVE_PERF_REGS
#include <asm/perf_regs.h>
@@ -16,35 +22,9 @@ struct perf_regs {
#define PERF_REG_EXTENDED_MASK 0
#endif
-u64 perf_reg_value(struct pt_regs *regs, int idx);
-int perf_reg_validate(u64 mask);
-u64 perf_reg_abi(struct task_struct *task);
-void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs);
#else
#define PERF_REG_EXTENDED_MASK 0
-static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
-{
- return 0;
-}
-
-static inline int perf_reg_validate(u64 mask)
-{
- return mask ? -ENOSYS : 0;
-}
-
-static inline u64 perf_reg_abi(struct task_struct *task)
-{
- return PERF_SAMPLE_REGS_ABI_NONE;
-}
-
-static inline void perf_get_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
-{
- regs_user->regs = task_pt_regs(current);
- regs_user->abi = perf_reg_abi(current);
-}
#endif /* CONFIG_HAVE_PERF_REGS */
#endif /* _LINUX_PERF_REGS_H */
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6e194e4ce4a03..e7e052f62204b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7606,6 +7606,28 @@ unsigned long perf_instruction_pointer(struct perf_event *event,
0 : perf_arch_instruction_pointer(regs);
}
+u64 __weak perf_reg_value(struct pt_regs *regs, int idx)
+{
+ return 0;
+}
+
+int __weak perf_reg_validate(u64 mask)
+{
+ return mask ? -ENOSYS : 0;
+}
+
+u64 __weak perf_reg_abi(struct task_struct *task)
+{
+ return PERF_SAMPLE_REGS_ABI_NONE;
+}
+
+void __weak perf_get_regs_user(struct perf_regs *regs_user,
+ struct pt_regs *regs)
+{
+ regs_user->regs = task_pt_regs(current);
+ regs_user->abi = perf_reg_abi(current);
+}
+
static void
perf_output_sample_regs(struct perf_output_handle *handle,
struct pt_regs *regs, u64 mask)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 310/990] perf: Move and enhance has_extended_regs() for arch-specific use
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (308 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 309/990] perf: Eliminate duplicate arch-specific function definitions Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 311/990] perf: Add sampling support for SIMD registers Greg Kroah-Hartman
` (542 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kan Liang, Dapeng Mi,
Peter Zijlstra (Intel), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <kan.liang@linux.intel.com>
[ Upstream commit 05fe8825796e6b5557656c6c984486f0e66154fe ]
Move has_extended_regs() to include/linux/perf_event.h so it can be used
by arch-specific code.
While moving it, enhance the check logic and rename it to
event_has_extended_regs() to match existing perf event helper naming.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260824082731.1013973-9-dapeng1.mi@linux.intel.com
Stable-dep-of: b61c12527223 ("perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/perf_event.h | 10 ++++++++++
kernel/events/core.c | 8 +-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 5fb17c4f52f12..b822fa661d11a 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1528,6 +1528,16 @@ perf_event__output_id_sample(struct perf_event *event,
extern void
perf_log_lost_samples(struct perf_event *event, u64 lost);
+static inline bool event_has_extended_regs(struct perf_event *event)
+{
+ struct perf_event_attr *attr = &event->attr;
+
+ return ((attr->sample_type & PERF_SAMPLE_REGS_USER) &&
+ (attr->sample_regs_user & PERF_REG_EXTENDED_MASK)) ||
+ ((attr->sample_type & PERF_SAMPLE_REGS_INTR) &&
+ (attr->sample_regs_intr & PERF_REG_EXTENDED_MASK));
+}
+
static inline bool event_has_any_exclude_flag(struct perf_event *event)
{
struct perf_event_attr *attr = &event->attr;
diff --git a/kernel/events/core.c b/kernel/events/core.c
index e7e052f62204b..a2f1cb4478263 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -12792,12 +12792,6 @@ int perf_pmu_unregister(struct pmu *pmu)
}
EXPORT_SYMBOL_GPL(perf_pmu_unregister);
-static inline bool has_extended_regs(struct perf_event *event)
-{
- return (event->attr.sample_regs_user & PERF_REG_EXTENDED_MASK) ||
- (event->attr.sample_regs_intr & PERF_REG_EXTENDED_MASK);
-}
-
static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)
{
struct perf_event_context *ctx = NULL;
@@ -12832,7 +12826,7 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)
goto err_pmu;
if (!(pmu->capabilities & PERF_PMU_CAP_EXTENDED_REGS) &&
- has_extended_regs(event)) {
+ event_has_extended_regs(event)) {
ret = -EOPNOTSUPP;
goto err_destroy;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 311/990] perf: Add sampling support for SIMD registers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (309 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 310/990] perf: Move and enhance has_extended_regs() for arch-specific use Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 312/990] perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR Greg Kroah-Hartman
` (541 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Peter Zijlstra (Intel), Kan Liang,
Dapeng Mi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <kan.liang@linux.intel.com>
[ Upstream commit 918b7d6d1729952d51da4fa81db7b366a207de8f ]
Users may be interested in sampling SIMD registers during profiling.
The current sample_regs_* structure does not have sufficient space
for all SIMD registers.
To address this, new attribute fields sample_simd_{pred,vec}_reg_* are
added to struct perf_event_attr to represent the SIMD registers that are
expected to be sampled.
Currently, the perf/x86 code supports XMM registers in sample_regs_*.
To unify the configuration of SIMD registers and ensure a consistent
method for configuring XMM and other SIMD registers, a new event
attribute field, sample_simd_regs_enabled, is introduced. When
sample_simd_regs_enabled is set, it indicates that all SIMD registers,
including XMM, will be represented by the newly introduced
sample_simd_{pred|vec}_reg_* fields. The original XMM space in
sample_regs_* is reserved for future uses.
Since SIMD registers are wider than 64 bits, a new output format is
introduced. The number and width of SIMD registers are dumped first,
followed by the register values. The number and width are based on the
user's configuration.
A new ABI, PERF_SAMPLE_REGS_ABI_SIMD, is added to indicate the new format.
The enum perf_sample_regs_abi is now a bitmap. This change should not
impact existing tools, as the version and bitmap remain the same for
values 1 and 2.
Additionally, two new __weak functions are introduced:
- perf_simd_reg_value(): Retrieves the value of the requested SIMD
register.
- perf_simd_reg_validate(): Validates the configuration of the SIMD
registers.
A new flag, PERF_PMU_CAP_SIMD_REGS, is added to indicate that the PMU
supports SIMD register dumping. An error is generated if
sample_simd_{pred|vec}_reg_* is mistakenly set for a PMU that does not
support this capability.
Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Co-developed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260824082731.1013973-13-dapeng1.mi@linux.intel.com
Stable-dep-of: b61c12527223 ("perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/perf_event.h | 12 +++
include/linux/perf_regs.h | 4 +
include/uapi/linux/perf_event.h | 49 ++++++++++-
kernel/events/core.c | 141 +++++++++++++++++++++++++++++---
4 files changed, 192 insertions(+), 14 deletions(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index b822fa661d11a..d698a232df114 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -306,6 +306,7 @@ struct perf_event_pmu_context;
#define PERF_PMU_CAP_AUX_PAUSE 0x0200
#define PERF_PMU_CAP_AUX_PREFER_LARGE 0x0400
#define PERF_PMU_CAP_MEDIATED_VPMU 0x0800
+#define PERF_PMU_CAP_SIMD_REGS 0x1000
/**
* pmu::scope
@@ -1528,6 +1529,17 @@ perf_event__output_id_sample(struct perf_event *event,
extern void
perf_log_lost_samples(struct perf_event *event, u64 lost);
+static inline bool event_has_simd_regs(struct perf_event *event)
+{
+ struct perf_event_attr *attr = &event->attr;
+
+ if (!(event->attr.sample_type &
+ (PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER)))
+ return false;
+
+ return attr->sample_simd_regs_enabled != 0;
+}
+
static inline bool event_has_extended_regs(struct perf_event *event)
{
struct perf_event_attr *attr = &event->attr;
diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h
index 144bcc3ff19fe..518f28c6a7d4b 100644
--- a/include/linux/perf_regs.h
+++ b/include/linux/perf_regs.h
@@ -14,6 +14,10 @@ int perf_reg_validate(u64 mask);
u64 perf_reg_abi(struct task_struct *task);
void perf_get_regs_user(struct perf_regs *regs_user,
struct pt_regs *regs);
+int perf_simd_reg_validate(u16 vec_qwords, u64 vec_mask,
+ u16 pred_qwords, u32 pred_mask);
+u64 perf_simd_reg_value(struct pt_regs *regs, int idx,
+ u16 qwords_idx, bool pred);
#ifdef CONFIG_HAVE_PERF_REGS
#include <asm/perf_regs.h>
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 0d0ed85ad8cb3..97c1de3707a2f 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -314,8 +314,9 @@ enum {
*/
enum perf_sample_regs_abi {
PERF_SAMPLE_REGS_ABI_NONE = 0,
- PERF_SAMPLE_REGS_ABI_32 = 1,
- PERF_SAMPLE_REGS_ABI_64 = 2,
+ PERF_SAMPLE_REGS_ABI_32 = (1 << 0),
+ PERF_SAMPLE_REGS_ABI_64 = (1 << 1),
+ PERF_SAMPLE_REGS_ABI_SIMD = (1 << 2),
};
/*
@@ -383,6 +384,7 @@ enum perf_event_read_format {
#define PERF_ATTR_SIZE_VER7 128 /* Add: sig_data */
#define PERF_ATTR_SIZE_VER8 136 /* Add: config3 */
#define PERF_ATTR_SIZE_VER9 144 /* add: config4 */
+#define PERF_ATTR_SIZE_VER10 176 /* Add: sample_simd_{vec|pred}_reg_* */
/*
* 'struct perf_event_attr' contains various attributes that define
@@ -545,6 +547,29 @@ struct perf_event_attr {
__u64 config3; /* extension of config2 */
__u64 config4; /* extension of config3 */
+
+ /*
+ * Defines the sampling SIMD/PRED(predicate) registers bitmap and
+ * qwords (8 bytes) length.
+ *
+ * sample_simd_regs_enabled != 0 indicates there are SIMD/PRED
+ * registers to be sampled, the SIMD/PRED registers bitmap and
+ * qwords length are represented in
+ * sample_simd_{vec|pred}_reg_{intr|user} and
+ * sample_simd_{vec|pred}_reg_qwords fields separately.
+ *
+ * sample_simd_regs_enabled == 0 indicates no SIMD/PRED registers
+ * are sampled.
+ */
+ __u16 sample_simd_regs_enabled;
+ __u16 sample_simd_pred_reg_qwords;
+ __u16 sample_simd_vec_reg_qwords;
+ __u16 __reserved_4;
+
+ __u32 sample_simd_pred_reg_intr;
+ __u32 sample_simd_pred_reg_user;
+ __u64 sample_simd_vec_reg_intr;
+ __u64 sample_simd_vec_reg_user;
};
/*
@@ -1018,7 +1043,15 @@ enum perf_event_type {
* } && PERF_SAMPLE_BRANCH_STACK
*
* { u64 abi; # enum perf_sample_regs_abi
- * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
+ * u64 regs[weight(mask)];
+ * struct {
+ * u64 nr_vectors; # 0 ... weight(sample_simd_vec_reg_user)
+ * u64 vector_qwords; # 0 ... sample_simd_vec_reg_qwords
+ * u64 nr_pred; # 0 ... weight(sample_simd_pred_reg_user)
+ * u64 pred_qwords; # 0 ... sample_simd_pred_reg_qwords
+ * u64 data[nr_vectors * vector_qwords + nr_pred * pred_qwords];
+ * } && (abi & PERF_SAMPLE_REGS_ABI_SIMD)
+ * } && PERF_SAMPLE_REGS_USER
*
* { u64 size;
* char data[size];
@@ -1045,7 +1078,15 @@ enum perf_event_type {
* { u64 data_src; } && PERF_SAMPLE_DATA_SRC
* { u64 transaction; } && PERF_SAMPLE_TRANSACTION
* { u64 abi; # enum perf_sample_regs_abi
- * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR
+ * u64 regs[weight(mask)];
+ * struct {
+ * u64 nr_vectors; # 0 ... weight(sample_simd_vec_reg_intr)
+ * u64 vector_qwords; # 0 ... sample_simd_vec_reg_qwords
+ * u64 nr_pred; # 0 ... weight(sample_simd_pred_reg_intr)
+ * u64 pred_qwords; # 0 ... sample_simd_pred_reg_qwords
+ * u64 data[nr_vectors * vector_qwords + nr_pred * pred_qwords];
+ * } && (abi & PERF_SAMPLE_REGS_ABI_SIMD)
+ * } && PERF_SAMPLE_REGS_INTR
* { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR
* { u64 cgroup;} && PERF_SAMPLE_CGROUP
* { u64 data_page_size;} && PERF_SAMPLE_DATA_PAGE_SIZE
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a2f1cb4478263..42057df334af3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7628,22 +7628,60 @@ void __weak perf_get_regs_user(struct perf_regs *regs_user,
regs_user->abi = perf_reg_abi(current);
}
+#define word_for_each_set_bit(bit, val) \
+ for (unsigned long long __v = (val); \
+ __v && ((bit = __builtin_ctzll(__v)), 1); \
+ __v &= __v - 1)
+
static void
perf_output_sample_regs(struct perf_output_handle *handle,
struct pt_regs *regs, u64 mask)
{
int bit;
- DECLARE_BITMAP(_mask, 64);
-
- bitmap_from_u64(_mask, mask);
- for_each_set_bit(bit, _mask, sizeof(mask) * BITS_PER_BYTE) {
- u64 val;
- val = perf_reg_value(regs, bit);
+ word_for_each_set_bit(bit, mask) {
+ u64 val = perf_reg_value(regs, bit);
perf_output_put(handle, val);
}
}
+static void
+perf_output_sample_simd_regs(struct perf_output_handle *handle,
+ struct perf_event *event,
+ struct pt_regs *regs,
+ u64 mask, u32 pred_mask)
+{
+ u64 pred_qwords = event->attr.sample_simd_pred_reg_qwords;
+ u64 vec_qwords = event->attr.sample_simd_vec_reg_qwords;
+ u64 nr_vectors = hweight64(mask);
+ u64 nr_pred = hweight32(pred_mask);
+ int bit;
+
+ perf_output_put(handle, nr_vectors);
+ perf_output_put(handle, vec_qwords);
+ perf_output_put(handle, nr_pred);
+ perf_output_put(handle, pred_qwords);
+
+ if (nr_vectors) {
+ word_for_each_set_bit(bit, mask) {
+ for (int i = 0; i < vec_qwords; i++) {
+ u64 val = perf_simd_reg_value(regs, bit,
+ i, false);
+ perf_output_put(handle, val);
+ }
+ }
+ }
+ if (nr_pred) {
+ word_for_each_set_bit(bit, pred_mask) {
+ for (int i = 0; i < pred_qwords; i++) {
+ u64 val = perf_simd_reg_value(regs, bit,
+ i, true);
+ perf_output_put(handle, val);
+ }
+ }
+ }
+}
+
static void perf_sample_regs_user(struct perf_regs *regs_user,
struct pt_regs *regs)
{
@@ -7677,6 +7715,17 @@ static void perf_sample_regs_intr(struct perf_regs *regs_intr,
}
}
+int __weak perf_simd_reg_validate(u16 vec_qwords, u64 vec_mask,
+ u16 pred_qwords, u32 pred_mask)
+{
+ return -EINVAL;
+}
+
+u64 __weak perf_simd_reg_value(struct pt_regs *regs, int idx,
+ u16 qwords_idx, bool pred)
+{
+ return 0;
+}
/*
* Get remaining task size from user stack pointer.
@@ -8214,10 +8263,17 @@ void perf_output_sample(struct perf_output_handle *handle,
perf_output_put(handle, abi);
if (abi) {
- u64 mask = event->attr.sample_regs_user;
+ struct perf_event_attr *attr = &event->attr;
+ u64 mask = attr->sample_regs_user;
perf_output_sample_regs(handle,
data->regs_user.regs,
mask);
+ if (abi & PERF_SAMPLE_REGS_ABI_SIMD) {
+ perf_output_sample_simd_regs(handle, event,
+ data->regs_user.regs,
+ attr->sample_simd_vec_reg_user,
+ attr->sample_simd_pred_reg_user);
+ }
}
}
@@ -8245,11 +8301,18 @@ void perf_output_sample(struct perf_output_handle *handle,
perf_output_put(handle, abi);
if (abi) {
- u64 mask = event->attr.sample_regs_intr;
+ struct perf_event_attr *attr = &event->attr;
+ u64 mask = attr->sample_regs_intr;
perf_output_sample_regs(handle,
data->regs_intr.regs,
mask);
+ if (abi & PERF_SAMPLE_REGS_ABI_SIMD) {
+ perf_output_sample_simd_regs(handle, event,
+ data->regs_intr.regs,
+ attr->sample_simd_vec_reg_intr,
+ attr->sample_simd_pred_reg_intr);
+ }
}
}
@@ -8442,6 +8505,29 @@ static __always_inline u64 __cond_set(u64 flags, u64 s, u64 d)
return d * !!(flags & s);
}
+static u64 perf_update_xregs_size(struct perf_event *event, bool intr)
+{
+ u16 pred_qwords = event->attr.sample_simd_pred_reg_qwords;
+ u16 vec_qwords = event->attr.sample_simd_vec_reg_qwords;
+ u64 pred_mask;
+ u64 mask;
+ int size;
+
+ if (intr) {
+ mask = event->attr.sample_simd_vec_reg_intr;
+ pred_mask = event->attr.sample_simd_pred_reg_intr;
+ } else {
+ mask = event->attr.sample_simd_vec_reg_user;
+ pred_mask = event->attr.sample_simd_pred_reg_user;
+ }
+
+ size = sizeof(u64) * 4;
+ size += (hweight64(mask) * vec_qwords +
+ hweight64(pred_mask) * pred_qwords) * sizeof(u64);
+
+ return size;
+}
+
void perf_prepare_sample(struct perf_sample_data *data,
struct perf_event *event,
struct pt_regs *regs)
@@ -8504,7 +8590,12 @@ void perf_prepare_sample(struct perf_sample_data *data,
if (data->regs_user.regs) {
u64 mask = event->attr.sample_regs_user;
+
size += hweight64(mask) * sizeof(u64);
+ if (event_has_simd_regs(event)) {
+ size += perf_update_xregs_size(event, false);
+ data->regs_user.abi |= PERF_SAMPLE_REGS_ABI_SIMD;
+ }
}
data->dyn_size += size;
@@ -8569,6 +8660,10 @@ void perf_prepare_sample(struct perf_sample_data *data,
u64 mask = event->attr.sample_regs_intr;
size += hweight64(mask) * sizeof(u64);
+ if (event_has_simd_regs(event)) {
+ size += perf_update_xregs_size(event, true);
+ data->regs_intr.abi |= PERF_SAMPLE_REGS_ABI_SIMD;
+ }
}
data->dyn_size += size;
@@ -12825,6 +12920,12 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)
if (ret)
goto err_pmu;
+ if (!(pmu->capabilities & PERF_PMU_CAP_SIMD_REGS) &&
+ event_has_simd_regs(event)) {
+ ret = -EOPNOTSUPP;
+ goto err_destroy;
+ }
+
if (!(pmu->capabilities & PERF_PMU_CAP_EXTENDED_REGS) &&
event_has_extended_regs(event)) {
ret = -EOPNOTSUPP;
@@ -13321,7 +13422,8 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
attr->size = size;
- if (attr->__reserved_1 || attr->__reserved_2 || attr->__reserved_3)
+ if (attr->__reserved_1 || attr->__reserved_2 ||
+ attr->__reserved_3 || attr->__reserved_4)
return -EINVAL;
if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))
@@ -13370,6 +13472,14 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
ret = perf_reg_validate(attr->sample_regs_user);
if (ret)
return ret;
+ if (attr->sample_simd_regs_enabled) {
+ ret = perf_simd_reg_validate(attr->sample_simd_vec_reg_qwords,
+ attr->sample_simd_vec_reg_user,
+ attr->sample_simd_pred_reg_qwords,
+ attr->sample_simd_pred_reg_user);
+ if (ret)
+ return ret;
+ }
}
if (attr->sample_type & PERF_SAMPLE_STACK_USER) {
@@ -13390,8 +13500,19 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
if (!attr->sample_max_stack)
attr->sample_max_stack = sysctl_perf_event_max_stack;
- if (attr->sample_type & PERF_SAMPLE_REGS_INTR)
+ if (attr->sample_type & PERF_SAMPLE_REGS_INTR) {
ret = perf_reg_validate(attr->sample_regs_intr);
+ if (ret)
+ return ret;
+ if (attr->sample_simd_regs_enabled) {
+ ret = perf_simd_reg_validate(attr->sample_simd_vec_reg_qwords,
+ attr->sample_simd_vec_reg_intr,
+ attr->sample_simd_pred_reg_qwords,
+ attr->sample_simd_pred_reg_intr);
+ if (ret)
+ return ret;
+ }
+ }
#ifndef CONFIG_CGROUP_PERF
if (attr->sample_type & PERF_SAMPLE_CGROUP)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 312/990] perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (310 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 311/990] perf: Add sampling support for SIMD registers Greg Kroah-Hartman
@ 2026-11-25 14:27 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 313/990] sched/pelt: Fix u32 truncation of the PELT period count Greg Kroah-Hartman
` (540 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:27 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gennady Kupava, Jayapal Ashwin Nair,
Ravi Bangoria, Peter Zijlstra (Intel), Ingo Molnar, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ravi Bangoria <ravi.bangoria@amd.com>
[ Upstream commit b61c12527223423ab66891b2e8131da0d66537c4 ]
IBS hardware captures a sample and raises an NMI. Since the NMI can be
delivered with a delay, a privilege change may occur between sample
capture and NMI delivery. Because IBS only provides the sample RIP, the
kernel records GPRs from the NMI pt_regs, which may reflect kernel mode
if a privilege switch occurred in the interim. This can leak kernel
addresses to unprivileged users through PERF_SAMPLE_REGS_USER and/or
PERF_SAMPLE_REGS_INTR.
Fix this by using interrupt regs while preparing PERF_SAMPLE_REGS_USER
and PERF_SAMPLE_REGS_INTR. With the change, when IBS samples a user mode
instruction but the NMI is delivered in kernel mode, PERF_SAMPLE_REGS_USER
will source its register state from task_pt_regs(current) and
PERF_SAMPLE_REGS_INTR will be omitted from the data sent to userspace.
In addition to fixing the kernel address leak, this change also ensures
GPR snapshot consistency, which resolves the DWARF unwinding issue with
IBS.
Closes: https://lore.kernel.org/r/CAPu-DQqF0aF6=GS8Z6KKWeeX_V5LiXeKU_rJQZC+uGg8zuTPNw@mail.gmail.com
Fixes: d29e744c7167 ("perf/x86: Relax privilege filter restriction on AMD IBS")
Reported-by: Gennady Kupava <gennady.kupava@gmail.com>
Reported-by: Jayapal Ashwin Nair <janair@amd.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20261026041838.941-3-ravi.bangoria@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/events/amd/ibs.c | 50 ++++++++++++++++++++++++++++++++++++++
include/linux/perf_event.h | 6 +++++
kernel/events/core.c | 10 ++++----
3 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index 23d834e7b565e..d57b34a72dddf 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -1339,6 +1339,56 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
throttle = perf_event_account_interrupt(event);
goto out;
}
+
+ /*
+ * IBS captured RIP is out of sync with NMI pt_regs due to NMI
+ * delivery latency. Use NMI pt_regs for PERF_SAMPLE_REGS_USER.
+ *
+ * Note: Valid user regs are required for PERF_SAMPLE_STACK_USER.
+ */
+ if (event->attr.sample_type & (PERF_SAMPLE_REGS_USER |
+ PERF_SAMPLE_STACK_USER)) {
+ perf_sample_regs_user(&data.regs_user, iregs);
+
+ /*
+ * Don't update dyn_size if user has not requested for
+ * PERF_SAMPLE_REGS_USER.
+ */
+ if (event->attr.sample_type & PERF_SAMPLE_REGS_USER) {
+ /* regs dump ABI info */
+ int size = sizeof(u64);
+
+ if (data.regs_user.regs) {
+ u64 mask = event->attr.sample_regs_user;
+ size += hweight64(mask) * sizeof(u64);
+ }
+
+ data.dyn_size += size;
+ }
+
+ data.sample_flags |= PERF_SAMPLE_REGS_USER;
+ }
+
+ /*
+ * IBS captured RIP is out of sync with NMI pt_regs due to NMI
+ * delivery latency. Use NMI pt_regs for PERF_SAMPLE_REGS_INTR.
+ */
+ if (event->attr.sample_type & PERF_SAMPLE_REGS_INTR) {
+ /* regs dump ABI info */
+ int size = sizeof(u64);
+
+ perf_sample_regs_intr(&data.regs_intr, iregs,
+ event->attr.exclude_kernel);
+
+ if (data.regs_intr.regs) {
+ u64 mask = event->attr.sample_regs_intr;
+ size += hweight64(mask) * sizeof(u64);
+ }
+
+ data.dyn_size += size;
+ data.sample_flags |= PERF_SAMPLE_REGS_INTR;
+ }
+
/*
* Prevent leaking physical addresses to unprivileged users. Skip
* PERF_SAMPLE_PHYS_ADDR check since generic code prevents it for
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index d698a232df114..23444b1b2503b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1829,6 +1829,12 @@ extern unsigned long perf_misc_flags(struct perf_event *event, struct pt_regs *r
extern unsigned long perf_instruction_pointer(struct perf_event *event,
struct pt_regs *regs);
+extern void perf_sample_regs_user(struct perf_regs *regs_user,
+ struct pt_regs *regs);
+extern void perf_sample_regs_intr(struct perf_regs *regs_intr,
+ struct pt_regs *regs,
+ bool exclude_kernel);
+
#ifndef perf_arch_misc_flags
# define perf_arch_misc_flags(regs) \
(user_mode(regs) ? PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 42057df334af3..6d3fe508b7406 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7682,8 +7682,8 @@ perf_output_sample_simd_regs(struct perf_output_handle *handle,
}
}
-static void perf_sample_regs_user(struct perf_regs *regs_user,
- struct pt_regs *regs)
+void perf_sample_regs_user(struct perf_regs *regs_user,
+ struct pt_regs *regs)
{
if (user_mode(regs)) {
regs_user->abi = perf_reg_abi(current);
@@ -7696,9 +7696,9 @@ static void perf_sample_regs_user(struct perf_regs *regs_user,
}
}
-static void perf_sample_regs_intr(struct perf_regs *regs_intr,
- struct pt_regs *regs,
- bool exclude_kernel)
+void perf_sample_regs_intr(struct perf_regs *regs_intr,
+ struct pt_regs *regs,
+ bool exclude_kernel)
{
/*
* Hardware skid can lead to a scenario where a PMI is
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 313/990] sched/pelt: Fix u32 truncation of the PELT period count
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (311 preceding siblings ...)
2026-11-25 14:27 ` [PATCH 6.18 312/990] perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 314/990] sched/topology: Balance cluster static-key updates Greg Kroah-Hartman
` (539 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hui Su, Peter Zijlstra (Intel),
Ingo Molnar, Vincent Guittot, Kayra Cizmeci, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <sh_def@163.com>
[ Upstream commit a0c755e574e37fddb59edf175f27dc3877e7fe23 ]
accumulate_sum() computes the number of elapsed PELT periods in a
u64 but returns u32. When the count is a multiple of 2^32, it is
truncated to zero even though the PELT sums have been updated.
The caller interprets zero as no period boundary crossed and skips
recomputing the averages, leaving *_avg stale relative to *_sum.
Return the period count as u64 so the caller can test it without
truncation.
Fixes: a481db34b9be ("sched/fair: Optimize ___update_sched_avg()")
Signed-off-by: Hui Su <sh_def@163.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Link: https://patch.msgid.link/20261023025207.2967903-1-sh_def@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/pelt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index fa83bbaf4f3e8..75a48236ec463 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -99,7 +99,7 @@ static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3)
* d1 y^p + 1024 \Sum y^n + d3 y^0 (Step 2)
* n=1
*/
-static __always_inline u32
+static __always_inline u64
accumulate_sum(u64 delta, struct sched_avg *sa,
unsigned long load, unsigned long runnable, int running)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 314/990] sched/topology: Balance cluster static-key updates
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (312 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 313/990] sched/pelt: Fix u32 truncation of the PELT period count Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 315/990] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND Greg Kroah-Hartman
` (538 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hui Su, Peter Zijlstra (Intel),
Ingo Molnar, K Prateek Nayak, Kayra Cizmeci, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Su <sh_def@163.com>
[ Upstream commit 5ebdfe12ab96368d0339593129d4ce0bc2bd06f5 ]
build_sched_domains() increments sched_cluster_active once per newly
built partition that contains an SD_CLUSTER domain.
detach_destroy_domains() instead tested the global static key before
decrementing it, so destroying a cluster-less partition could drop a
reference owned by another partition and disable cluster-aware
scheduling while SD_CLUSTER domains remained installed.
Check the installed domains before detaching them, only while the key is
enabled, and decrement only when the removed partition contains an
SD_CLUSTER domain.
With two cluster-bearing partitions installed, removing a singleton
partition left the baseline count at 1 where 2 partitions still
carried SD_CLUSTER; the fixed kernel correctly reports 2. On an
asymmetric cluster topology where the parent partition gains no
cluster domain, the baseline count drops to 0 while a cluster
partition remains installed; the fixed kernel keeps it at 1.
Fixes: 8881e1639f1f ("sched/fair: Scan cluster before scanning LLC in wake-up path")
Signed-off-by: Hui Su <sh_def@163.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Link: https://patch.msgid.link/20261021043834.1140951-1-sh_def@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/topology.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 35478aa2536fc..e3bf754e081c5 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2714,13 +2714,25 @@ int __init sched_init_domains(const struct cpumask *cpu_map)
static void detach_destroy_domains(const struct cpumask *cpu_map)
{
unsigned int cpu = cpumask_any(cpu_map);
+ bool has_cluster = false;
int i;
if (rcu_access_pointer(per_cpu(sd_asym_cpucapacity, cpu)))
static_branch_dec_cpuslocked(&sched_asym_cpucapacity);
- if (static_branch_unlikely(&sched_cluster_active))
- static_branch_dec_cpuslocked(&sched_cluster_active);
+ if (static_branch_unlikely(&sched_cluster_active)) {
+ rcu_read_lock();
+ for_each_cpu(i, cpu_map) {
+ if (lowest_flag_domain(i, SD_CLUSTER)) {
+ has_cluster = true;
+ break;
+ }
+ }
+ rcu_read_unlock();
+
+ if (has_cluster)
+ static_branch_dec_cpuslocked(&sched_cluster_active);
+ }
rcu_read_lock();
for_each_cpu(i, cpu_map)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 315/990] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (313 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 314/990] sched/topology: Balance cluster static-key updates Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 316/990] x86/kcfi: Dont emit KCFI_REFERENCE() in modules Greg Kroah-Hartman
` (537 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Eric Dumazet,
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 475ff14ba558bb8857bca878f1d593784ccc4f0f ]
snd_cwnd has no practical upper bound: snd_cwnd_clamp defaults to ~0,
and RTAX_INITCWND, a locked RTAX_CWND metric, TCP_BPF_IW and
TCP_BPF_SNDCWND_CLAMP accept any positive value.
Congestion control modules do u32 arithmetic on cwnd that assumes
much smaller values. For instance, ssthresh() handlers compute:
CUBIC, BIC, ROCCET: cwnd * (BICTCP_BETA_SCALE + beta), up to 2047
DCTCP: cwnd * dctcp_alpha, up to 1024
CDG, NV, CUBIC, ...: cwnd * beta, below 1024
With a large initcwnd route or TCP_BPF_IW, cwnd is set directly to
such values, and the next RTO or recovery calls ->ssthresh() with it.
The product then wraps: DCTCP with cwnd = 2^24 and alpha = 1024 gets
ssthresh == cwnd, and CUBIC computes a wrong ssthresh and Wmax.
CUBIC bictcp_update() also expects cwnd below about one million packets.
The paths that can grow cwnd by large amounts (tcp_slow_start(),
tcp_cong_avoid_ai(), bbr_set_cwnd() and tcp_init_cwnd()) already
bound it by snd_cwnd_clamp, so give snd_cwnd_clamp a finite default
of 2^20 packets, and cap the metric and BPF paths that set it or set
cwnd directly.
2^20 packets do not limit real flows: with the maximum window scale
of 14, a peer can not advertise more than 65535 << 14 bytes (~1GB),
which is less than 2^20 packets for any MSS of 1024 bytes or more.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Chris Mason <mason@kernel.org>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261030111528.2850082-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/tcp.h | 9 +++++++++
net/core/filter.c | 3 ++-
net/ipv4/tcp.c | 2 +-
net/ipv4/tcp_metrics.c | 3 ++-
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f9bcfa8773a3a..3bf508ceae7b0 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1430,6 +1430,15 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
#define TCP_INFINITE_SSTHRESH 0x7fffffff
+/* Default and maximum snd_cwnd_clamp, in packets.
+ * A peer can not advertise more than 65535 << 14 bytes, so a larger
+ * cwnd is useless with any MSS of 1024 bytes or more.
+ * Congestion control modules multiply cwnd by u32 factors up to 2047
+ * (cwnd * (BICTCP_BETA_SCALE + beta) in CUBIC), and CUBIC's
+ * bictcp_update() expects cwnd to stay below about one million packets.
+ */
+#define TCP_MAX_SND_CWND (1U << 20)
+
static inline u32 tcp_snd_cwnd(const struct tcp_sock *tp)
{
return tp->snd_cwnd;
diff --git a/net/core/filter.c b/net/core/filter.c
index c6677657656c9..8b76dd1201038 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5498,11 +5498,12 @@ static int bpf_sol_tcp_setsockopt(struct sock *sk, int optname,
case TCP_BPF_IW:
if (val <= 0 || tp->data_segs_out > tp->syn_data)
return -EINVAL;
- tcp_snd_cwnd_set(tp, val);
+ tcp_snd_cwnd_set(tp, min_t(u32, val, tp->snd_cwnd_clamp));
break;
case TCP_BPF_SNDCWND_CLAMP:
if (val <= 0)
return -EINVAL;
+ val = min_t(u32, val, TCP_MAX_SND_CWND);
tp->snd_cwnd_clamp = val;
WRITE_ONCE(tp->snd_ssthresh, val);
break;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index aa860cbd3a442..5f983535bc1d6 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -472,7 +472,7 @@ void tcp_init_sock(struct sock *sk)
* initialization of these values.
*/
tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
- tp->snd_cwnd_clamp = ~0;
+ tp->snd_cwnd_clamp = TCP_MAX_SND_CWND;
tp->mss_cache = TCP_MSS_DEFAULT;
tp->reordering = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reordering);
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 276127902f154..5a83f09cdbd7d 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -495,7 +495,8 @@ void tcp_init_metrics(struct sock *sk)
}
if (tcp_metric_locked(tm, TCP_METRIC_CWND))
- tp->snd_cwnd_clamp = tcp_metric_get(tm, TCP_METRIC_CWND);
+ tp->snd_cwnd_clamp = min(tcp_metric_get(tm, TCP_METRIC_CWND),
+ TCP_MAX_SND_CWND);
val = READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) ?
0 : tcp_metric_get(tm, TCP_METRIC_SSTHRESH);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 316/990] x86/kcfi: Dont emit KCFI_REFERENCE() in modules
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (314 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 315/990] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 317/990] net/mlx5e: TC, Fix double free of branch in failure Greg Kroah-Hartman
` (536 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ridge Lomont, Peter Zijlstra (Intel),
Ingo Molnar, Nathan Chancellor, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ridge Lomont <cyridge@proton.me>
[ Upstream commit fb685de78e6bf79e49854e7d149f69b125583de5 ]
KCFI_REFERENCE() takes the address of a symbol so that the compiler
emits its __kcfi_typeid_ symbol, which the SYM_TYPED_FUNC_START()
assembly implementing it needs. It is used from arch/x86 headers for
__clear_pages_unrolled(), copy_page(), __memset() and __memmove(), and
all of that assembly is built into vmlinux.
Modules include the same headers, so with CONFIG_CFI=y every module
also gets an __ADDRESSABLE() reference to each of these symbols in
.discard.addressable. This serves no purpose there, and since
__clear_pages_unrolled() is EXPORT_SYMBOL_GPL, modpost now rejects any
GPL-incompatible module that includes <linux/mm.h>:
ERROR: modpost: GPL-incompatible module repro.ko uses GPL-only
symbol '__clear_pages_unrolled'
even though the module never uses the symbol. This makes OpenZFS
impossible to build against CFI kernels; its configure checks fail
in the same way and are misreported as CONFIG_DEBUG_LOCK_ALLOC.
scripts/module.lds.S does not help here: modpost checks <module>.o
before the final link, and even after it the discarded section only
loses its relocations, the undefined symbols stay in .symtab, where
the module loader resolves them with the same license check.
Only emit the reference when building vmlinux.
Tested on x86_64 with clang 23.1.3 and CONFIG_CFI=y, with both
CONFIG_LTO_CLANG_FULL=y (the configuration from the Fixes: commit) and
CONFIG_LTO_CLANG_THIN=y: vmlinux links without warnings and still contains
__kcfi_typeid___clear_pages_unrolled, __kcfi_typeid_copy_page,
__kcfi_typeid___memset and __kcfi_typeid___memmove. It boots in QEMU
with no CFI failures. A minimal module with MODULE_LICENSE("Proprietary")
including <linux/mm.h> fails modpost before this change and builds and
loads after it. OpenZFS builds against a CFI kernel with this change,
and its pool, encryption, checksum and send/recv operations run
without CFI failures, in QEMU and on a desktop with CFI enforcing.
Fixes: 9b041a4b66b3 ("x86/mm: Ensure clear_page() variants always have __kcfi_typeid_ symbols")
Assisted-by: LLM
Signed-off-by: Ridge Lomont <cyridge@proton.me>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Nathan Chancellor <nathan@kernel.org>
Link: https://github.com/openzfs/zfs/issues/18092
Link: https://patch.msgid.link/20261027-kcfi-reference-modules-v2-1-3a3247f15806@proton.me
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/compiler.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 5b45ea7dff3e5..2911b9e622929 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -248,10 +248,13 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#endif /* __KERNEL__ */
-#if defined(CONFIG_CFI) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
+#if defined(CONFIG_CFI) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO) && \
+ !defined(MODULE)
/*
* Force a reference to the external symbol so the compiler generates
- * __kcfi_typid.
+ * __kcfi_typid. Only vmlinux needs it, as that is where the assembly
+ * using the typeid lives; in a module it would only add a reference to
+ * the symbol, which fails modpost if the symbol is GPL-only.
*/
#define KCFI_REFERENCE(sym) __ADDRESSABLE(sym)
#else
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 317/990] net/mlx5e: TC, Fix double free of branch in failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (315 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 316/990] x86/kcfi: Dont emit KCFI_REFERENCE() in modules Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 318/990] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering Greg Kroah-Hartman
` (535 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Thomas Fourier, Tariq Toukan,
Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <fourier.thomas@gmail.com>
[ Upstream commit 31f9b43a3bb3d2201eadd147440252d0912dab21 ]
When allocating the false branch fails in parse_branch_ctrl(), the
already allocated true branch is freed but attr->branch_true is left
pointing to it. The caller parse_tc_actions() fails the flow, and
free_flow_post_acts(), mlx5_free_flow_attr_actions() which calls again
free_branch_attr() on attr->branch_true.
Clear the pointer after freeing it.
This bug is theoretical and was compile tested only.
Fixes: f86488cb4685 ("net/mlx5e: TC, initialize branch flow attributes")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Tested-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index e2de3a9a647c3..83e3e51420afc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4013,6 +4013,7 @@ parse_branch_ctrl(struct flow_action_entry *act, struct mlx5e_tc_act *tc_act,
err_branch_false:
free_branch_attr(flow, attr->branch_true);
+ attr->branch_true = NULL;
out_err:
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 318/990] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (316 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 317/990] net/mlx5e: TC, Fix double free of branch in failure Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 319/990] locking/osq: Fix unlink queue corruption Greg Kroah-Hartman
` (534 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, Peter Zijlstra (Intel),
Ingo Molnar, Linus Torvalds, Waiman Long, linux-kernel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 1b9e01fcc47aff00d2fd64693c5dcd620eff5865 ]
The atomic_cmpxchg() in osq_wait_next() removes the current CPU's node
from the tail of the queue and puts @old_cpu back.
This is very much like an 'unlock', which is RELEASE, rather than
ACQUIRE.
Additionally, on success (the only case where the ordering is
effective), this returns NULL which means both callsites will do nothing
more, there are no subsequent operations to order against.
Furthermore, the osq_lock() caller will then return false, indicating
failure to acquire -- the mutex must go block. Again, not making a case
for ACQUIRE. Neither atomics nor locks provide ordering on failure.
Since ACQUIRE makes no sense, while RELEASE makes it more symmetric with
osq_unlock(), switch the ordering. This then makes osq_unlock()
consistently RELEASE.
Fixes: c55a6ffa6285 ("locking/osq: Relax atomic semantics")
Suggested-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/locking/osq_lock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
index b4233dc2c2b04..98b12d7b79964 100644
--- a/kernel/locking/osq_lock.c
+++ b/kernel/locking/osq_lock.c
@@ -59,7 +59,7 @@ osq_wait_next(struct optimistic_spin_queue *lock,
for (;;) {
if (atomic_read(&lock->tail) == curr &&
- atomic_cmpxchg_acquire(&lock->tail, curr, old_cpu) == curr) {
+ atomic_cmpxchg_release(&lock->tail, curr, old_cpu) == curr) {
/*
* We were the last queued, we moved @lock back. @prev
* will now observe @lock and will complete its
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 319/990] locking/osq: Fix unlink queue corruption
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (317 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 318/990] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 320/990] perf/x86/amd/uncore: Avoid context migration from non-owners Greg Kroah-Hartman
` (533 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Laight, Peter Zijlstra (Intel),
Ingo Molnar, Linus Torvalds, Waiman Long, linux-kernel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 408b129aac48b574c0c9d11137a89eefba825d5d ]
Very similar to commit 50972fe78f24 ("locking/osq_lock: Fix osq_lock
queue corruption"), make sure to order the prev->next store against
the next->prev store.
Fixes: 50972fe78f24 ("locking/osq_lock: Fix osq_lock queue corruption")
Suggested-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/locking/osq_lock.c | 60 +++++++++++++++++++++++++++++----------
1 file changed, 45 insertions(+), 15 deletions(-)
diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
index 98b12d7b79964..2bcc148eb2ddb 100644
--- a/kernel/locking/osq_lock.c
+++ b/kernel/locking/osq_lock.c
@@ -90,6 +90,49 @@ osq_wait_next(struct optimistic_spin_queue *lock,
}
}
+/*
+ * Set prev->next; this is the counterpart of osq_wait_next() in that
+ * by setting ->next the wait is terminated and progress is resumed.
+ */
+static inline void osq_link_next(struct optimistic_spin_node *prev,
+ struct optimistic_spin_node *next)
+{
+ /*
+ * Suppose:
+ *
+ * tail
+ * |
+ * V
+ * CPU1 -> CPU2 -> CPU3:
+ * n: 2 n: 3 n: nil
+ * p: nil p: 1 p: 2
+ *
+ * And this is CPU2 doing the self-unqueue concurrent against CPU1s
+ * unlock()/unqueue(). Since 'prev->next == NULL' and CPU1 will be
+ * stuck in osq_wait_next() until the below store of 'prev->next'.
+ *
+ * CPU2 CPU1
+ *
+ * next->prev = prev; osq_wait_next()
+ * WMB MB
+ * prev->next = next; next->prev = prev
+ *
+ * Without the WMB it would be possible to have conflicting stores
+ * like:
+ *
+ * CPU2 CPU1
+ *
+ * prev->next = next // CPU1.n = 3
+ * next = osq_wait_next() // = 3
+ * next->prev = prev // CPU3.p = nil
+ * next->prev = prev // CPU3.p = 1
+ *
+ * Which would result in list corruption.
+ */
+ smp_wmb();
+ WRITE_ONCE(prev->next, next);
+}
+
bool osq_lock(struct optimistic_spin_queue *lock)
{
struct optimistic_spin_node *node = this_cpu_ptr(&osq_node);
@@ -113,20 +156,7 @@ bool osq_lock(struct optimistic_spin_queue *lock)
prev = decode_cpu(old);
node->prev = prev;
-
- /*
- * osq_lock() unqueue
- *
- * node->prev = prev osq_wait_next()
- * WMB MB
- * prev->next = node next->prev = prev // unqueue-C
- *
- * Here 'node->prev' and 'next->prev' are the same variable and we need
- * to ensure these stores happen in-order to avoid corrupting the list.
- */
- smp_wmb();
-
- WRITE_ONCE(prev->next, node);
+ osq_link_next(prev, node);
/*
* Normally @prev is untouchable after the above store; because at that
@@ -202,7 +232,7 @@ bool osq_lock(struct optimistic_spin_queue *lock)
*/
WRITE_ONCE(next->prev, prev);
- WRITE_ONCE(prev->next, next);
+ osq_link_next(prev, next);
return false;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 320/990] perf/x86/amd/uncore: Avoid context migration from non-owners
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (318 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 319/990] locking/osq: Fix unlink queue corruption Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 321/990] perf: Fix racy update of cpc->hrtimer_interval Greg Kroah-Hartman
` (532 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sandipan Das, Peter Zijlstra (Intel),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <sandipan.das@amd.com>
[ Upstream commit 0ae655bce1934857fa3e316ddcb4be38c30dbd38 ]
Each uncore context is owned by a single CPU that hosts all events for
the corresponding uncore domain and is advertised through the sysfs
cpumask attribute. When a CPU goes offline, the context is migrated to
an online sibling if the departing CPU is the owner.
Before commit d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore
management"), uncore_down_prepare() checked whether the CPU going
offline owned the context. The check was lost when the function was
replaced by amd_uncore_ctx_move(). Hence, when a CPU that is not the
owner goes offline, ownership is always handed over to the first online
sibling in the uncore domain irrespective of whether another sibling
already owns it. This goes unnoticed as long as the owner is the
lowest-numbered online CPU in the domain, since the first online
sibling is then the owner itself. Once ownership has moved, that no
longer holds.
For example, consider an L3 domain spanning CPUs 8-15,136-143 and owned
by CPU 8.
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120
$ echo 0 | sudo tee /sys/devices/system/cpu/cpu8/online
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,9,16,24,32,40,48,56,64,72,80,88,96,104,112,120
$ echo 1 | sudo tee /sys/devices/system/cpu/cpu8/online
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,9,16,24,32,40,48,56,64,72,80,88,96,104,112,120
$ echo 0 | sudo tee /sys/devices/system/cpu/cpu10/online
$ cat /sys/bus/event_source/devices/amd_l3/cpumask
0,8-9,16,24,32,40,48,56,64,72,80,88,96,104,112,120
Offlining CPU 8 correctly moves ownership to CPU 9 and onlining it
again leaves CPU 9 as the owner. However, offlining CPU 10 then makes
CPU 8 the owner while existing events remain on CPU 9. Both CPUs are
now advertised for the same domain, so tools that open an event on
every CPU in the cpumask count the domain twice, and the context gets
modified from two CPUs without any synchronization.
Restore the ownership check that was lost during the refactor.
Fixes: d6389d3ccc13 ("perf/x86/amd/uncore: Refactor uncore management")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/273135a6d33a40f442fb18e140a90689fae7cd32.1793614726.git.sandipan.das@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/events/amd/uncore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index c960481222727..8714e4b36ff31 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -609,7 +609,7 @@ static void amd_uncore_ctx_move(struct amd_uncore *uncore, unsigned int cpu)
for (i = 0; i < uncore->num_pmus; i++) {
pmu = &uncore->pmus[i];
curr = *per_cpu_ptr(pmu->ctx, cpu);
- if (!curr)
+ if (!curr || curr->cpu != cpu)
continue;
/* Migrate to a shared sibling if possible */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 321/990] perf: Fix racy update of cpc->hrtimer_interval
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (319 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 320/990] perf/x86/amd/uncore: Avoid context migration from non-owners Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 322/990] iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails Greg Kroah-Hartman
` (531 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Ben Segall,
Peter Zijlstra (Intel), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Segall <bsegall@google.com>
[ Upstream commit 3bbd85b2f67aff58f2cbec9a7fb705677b94473b ]
Updates to cpc->hrtimer_interval can race with reads either in the
hrtimer itself, or other calls to perf_mux_hrtimer_restart. This is not
exactly expected to be a common config change, but it's easy enough to
fix.
Since there's already an IPI to each cpu to restart the timer, and all
reads are with irqs disabled, just move the update onto the target cpu.
Fixes: 62b856397927 ("perf: Add sysfs entry to adjust multiplexing interval per PMU")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Ben Segall <bsegall@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://sashiko.dev/#/patchset/xm265wykhyrv.fsf%40google.com
Link: https://patch.msgid.link/xm26se1ihlqb.fsf@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/events/core.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6d3fe508b7406..0f367ffef6deb 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1231,14 +1231,19 @@ static int perf_mux_hrtimer_restart(struct perf_cpu_pmu_context *cpc)
return 0;
}
-static int perf_mux_hrtimer_restart_ipi(void *arg)
+static __always_inline struct perf_cpu_pmu_context *this_cpc(struct pmu *pmu)
{
- return perf_mux_hrtimer_restart(arg);
+ return *this_cpu_ptr(pmu->cpu_pmu_context);
}
-static __always_inline struct perf_cpu_pmu_context *this_cpc(struct pmu *pmu)
+static int perf_mux_hrtimer_interval_ipi(void *arg)
{
- return *this_cpu_ptr(pmu->cpu_pmu_context);
+ struct pmu *pmu = arg;
+ struct perf_cpu_pmu_context *cpc = this_cpc(pmu);
+ int ms = pmu->hrtimer_interval_ms;
+
+ cpc->hrtimer_interval = ns_to_ktime(NSEC_PER_MSEC * ms);
+ return perf_mux_hrtimer_restart(cpc);
}
void perf_pmu_disable(struct pmu *pmu)
@@ -12453,13 +12458,8 @@ perf_event_mux_interval_ms_store(struct device *dev,
/* update all cpuctx for this PMU */
cpus_read_lock();
- for_each_online_cpu(cpu) {
- struct perf_cpu_pmu_context *cpc;
- cpc = *per_cpu_ptr(pmu->cpu_pmu_context, cpu);
- cpc->hrtimer_interval = ns_to_ktime(NSEC_PER_MSEC * timer);
-
- cpu_function_call(cpu, perf_mux_hrtimer_restart_ipi, cpc);
- }
+ for_each_online_cpu(cpu)
+ cpu_function_call(cpu, perf_mux_hrtimer_interval_ipi, pmu);
cpus_read_unlock();
mutex_unlock(&mux_interval_mutex);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 322/990] iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (320 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 321/990] perf: Fix racy update of cpc->hrtimer_interval Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 323/990] cpufreq: Return -EOPNOTSUPP if no policy supports boost Greg Kroah-Hartman
` (530 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dheeraj Kumar Srivastava, Ankit Soni,
Vasant Hegde, Joerg Roedel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
[ Upstream commit ec91bb159dc24eefe144ef8867937f4a055dd0e2 ]
iommu_snp_enable() checks that the IOMMU can support SNP and sets
amd_iommu_snp_en, then calls snp_rmptable_init() to map the RMP table.
If that call fails, CC_ATTR_HOST_SEV_SNP is cleared but amd_iommu_snp_en
is left set. Later IOMMU initialization uses amd_iommu_snp_en to
configure the IOMMU for SNP, on the assumption that RMP setup succeeded.
Clear amd_iommu_snp_en along with CC_ATTR_HOST_SEV_SNP.
Fixes: 409f45387c93 ("x86/sev: Fix broken SNP support with KVM module built-in")
Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Reviewed-by: Ankit Soni <Ankit.Soni@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/amd/init.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index c4694ff364dbf..3768be55b8e67 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3486,6 +3486,7 @@ static __init void iommu_snp_enable(void)
return;
disable_snp:
+ amd_iommu_snp_en = false;
cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
#endif
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 323/990] cpufreq: Return -EOPNOTSUPP if no policy supports boost
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (321 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 322/990] iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 324/990] cpufreq: Preserve global boost state on failed updates Greg Kroah-Hartman
` (529 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lifeng Zheng, Viresh Kumar, Jie Zhan,
Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lifeng Zheng <zhenglifeng1@huawei.com>
[ Upstream commit 77cf053b041fe13d1fdd2e572e16ee7776ff687d ]
In cpufreq_boost_trigger_state(), if none of the the policies support
boost, policy_set_boost() will not be called and this function will
return 0.
But it is better to return an error to indicate that the platform
doesn't support boost.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com>
[ rjw: Subject and changelog edits ]
Link: https://patch.msgid.link/20251202072727.1368285-2-zhenglifeng1@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: a0cde2b601bc ("cpufreq: Preserve global boost state on failed updates")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 002afd47d2d59..46cf3d49b0636 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2809,7 +2809,7 @@ static int cpufreq_boost_trigger_state(int state)
{
struct cpufreq_policy *policy;
unsigned long flags;
- int ret = 0;
+ int ret = -EOPNOTSUPP;
/*
* Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
@@ -2831,6 +2831,10 @@ static int cpufreq_boost_trigger_state(int state)
if (ret)
goto err_reset_state;
}
+
+ if (ret)
+ goto err_reset_state;
+
cpus_read_unlock();
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 324/990] cpufreq: Preserve global boost state on failed updates
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (322 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 323/990] cpufreq: Return -EOPNOTSUPP if no policy supports boost Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 325/990] cpufreq: Serialize global boost updates Greg Kroah-Hartman
` (528 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Loehle, Pengjie Zhang,
Zhongqiu Han, Sumit Gupta, Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <christian.loehle@arm.com>
[ Upstream commit a0cde2b601bc32b76d61e50141c619790e5e2e41 ]
cpufreq_boost_trigger_state() restores the opposite of the requested
state when updating policy boost state fails. For example, a failed
write of 0 when global boost is already disabled enables the global
flag without enabling any policies.
Save the original global boost state and restore it on failure.
Fixes: 121baab7b88e ("cpufreq: Force sync policy boost with global boost on sysfs update")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20261105215223.1263415-2-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 46cf3d49b0636..a48dd423b8f98 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2809,6 +2809,7 @@ static int cpufreq_boost_trigger_state(int state)
{
struct cpufreq_policy *policy;
unsigned long flags;
+ bool boost_enabled;
int ret = -EOPNOTSUPP;
/*
@@ -2817,6 +2818,7 @@ static int cpufreq_boost_trigger_state(int state)
*/
write_lock_irqsave(&cpufreq_driver_lock, flags);
+ boost_enabled = cpufreq_driver->boost_enabled;
cpufreq_driver->boost_enabled = state;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
@@ -2843,7 +2845,7 @@ static int cpufreq_boost_trigger_state(int state)
cpus_read_unlock();
write_lock_irqsave(&cpufreq_driver_lock, flags);
- cpufreq_driver->boost_enabled = !state;
+ cpufreq_driver->boost_enabled = boost_enabled;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
pr_err("%s: Cannot %s BOOST\n",
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 325/990] cpufreq: Serialize global boost updates
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (323 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 324/990] cpufreq: Preserve global boost state on failed updates Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 326/990] Bluetooth: reject invalid LE supervision timeout relationships Greg Kroah-Hartman
` (527 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Loehle, Pengjie Zhang,
Zhongqiu Han, Sumit Gupta, Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Loehle <christian.loehle@arm.com>
[ Upstream commit 3d5720dff09f3b90d9ab2a6707e4bb8d69542f4a ]
Concurrent global boost sysfs writes can interleave their global flag
and per-policy updates. An enabling write can set the global flag, then
a disabling write can clear it and finish before the enabling write
updates the policies. Both writes succeed, leaving boost enabled on
the policies while the global flag is disabled.
Serialize the complete global boost update, including rollback on
failure, with a mutex.
Fixes: 6f19efc0a1ca ("cpufreq: Add boost frequency support in core")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Pengjie Zhang <zhangpengjie2@huawei.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://patch.msgid.link/20261105215223.1263415-3-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpufreq/cpufreq.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index a48dd423b8f98..0df5dbe968ea9 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2805,6 +2805,8 @@ int cpufreq_boost_set_sw(struct cpufreq_policy *policy, int state)
}
EXPORT_SYMBOL_GPL(cpufreq_boost_set_sw);
+static DEFINE_MUTEX(cpufreq_boost_mutex);
+
static int cpufreq_boost_trigger_state(int state)
{
struct cpufreq_policy *policy;
@@ -2812,6 +2814,8 @@ static int cpufreq_boost_trigger_state(int state)
bool boost_enabled;
int ret = -EOPNOTSUPP;
+ guard(mutex)(&cpufreq_boost_mutex);
+
/*
* Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
* make sure all policies are in sync with global boost flag.
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 326/990] Bluetooth: reject invalid LE supervision timeout relationships
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (324 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 325/990] cpufreq: Serialize global boost updates Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 327/990] net/mlx5e: IPoIB, Fix QPN lookup race Greg Kroah-Hartman
` (526 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Pepper, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Pepper <cochcoder@proton.me>
[ Upstream commit c1d50a71cdee90a0c68b7a67221d8aae96d14a0c ]
The LE parameter validator calculates an unsigned maximum latency by
subtracting one from a truncated quotient. If the quotient is zero,
this wraps and accepts invalid parameters. Exact quotient boundaries
also accept equality where the supervision timeout must be greater.
Compare the products directly after checking the field bounds. The
validated interval and latency limits keep the products within int.
This enforces the strict timeout relationship without division or
unsigned subtraction.
Sashiko identified the underflow while reviewing the soft interval
preference RFC. The bug is already present in its unpatched base; keep
this common-validator fix independent of that preference policy.
Fixes: 8757825b128e ("Bluetooth: hci_check_conn_params() check proper range")
Assisted-by: LLM
Signed-off-by: Kyle Pepper <cochcoder@proton.me>
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 | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 37b3dc2b4c945..d244fd50345ec 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -2271,8 +2271,6 @@ static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
u16 to_multiplier)
{
- u16 max_latency;
-
if (min > max) {
BT_WARN("min %d > max %d", min, max);
return -EINVAL;
@@ -2298,19 +2296,14 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
return -EINVAL;
}
- if (max >= to_multiplier * 8) {
- BT_WARN("max %d >= to_multiplier %d * 8", max, to_multiplier);
- return -EINVAL;
- }
-
- max_latency = (to_multiplier * 4 / max) - 1;
if (latency > 499) {
BT_WARN("latency %d > 499", latency);
return -EINVAL;
}
- if (latency > max_latency) {
- BT_WARN("latency %d > max_latency %d", latency, max_latency);
+ if ((latency + 1) * max >= to_multiplier * 4) {
+ BT_WARN("latency %d, max %d and timeout %d are incompatible",
+ latency, max, to_multiplier);
return -EINVAL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 327/990] net/mlx5e: IPoIB, Fix QPN lookup race
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (325 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 326/990] Bluetooth: reject invalid LE supervision timeout relationships Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 328/990] netlink: Do not call the unbind callback with the table locked Greg Kroah-Hartman
` (525 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Prathamesh Deshpande, Tariq Toukan,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
[ Upstream commit 29066b0fc046a2965129a74325b98d9abb4647a9 ]
The parent RX completion path can load a QPN hash entry before
mlx5i_pkey_del_qpn() unlinks and frees it, then dereference freed memory.
Use RCU hlist operations and defer freeing with kfree_rcu(). The existing
RCU read-side section in mlx5e_napi_poll() covers the lookup. Keep ht_lock
for writers and acquire it before looking up the entry to delete.
Fixes: 7e7f4780c340 ("net/mlx5e: IPoIB, Use hash-table to map between QPN to child netdev")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261031225749.14214-1-prathameshdeshpande7@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/mellanox/mlx5/core/ipoib/ipoib.h | 2 +-
.../mellanox/mlx5/core/ipoib/ipoib_vlan.c | 26 +++++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
index 2ab6437a1c49f..944549f8c2f60 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h
@@ -82,7 +82,7 @@ void mlx5i_pkey_qpn_ht_cleanup(struct net_device *netdev);
int mlx5i_pkey_add_qpn(struct net_device *netdev, u32 qpn);
int mlx5i_pkey_del_qpn(struct net_device *netdev, u32 qpn);
-/* Get the net-device corresponding to the given underlay QPN */
+/* Get the net-device for a QPN. Caller must hold rcu_read_lock(). */
struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn);
/* Shared ndo functions */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
index 028a76944d82d..dd42633c52301 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c
@@ -31,6 +31,7 @@
*/
#include <linux/hash.h>
+#include <linux/rculist.h>
#include "ipoib.h"
#define MLX5I_MAX_LOG_PKEY_SUP 7
@@ -39,11 +40,12 @@ struct qpn_to_netdev {
struct net_device *netdev;
struct hlist_node hlist;
u32 underlay_qpn;
+ struct rcu_head rcu;
};
struct mlx5i_pkey_qpn_ht {
struct hlist_head buckets[1 << MLX5I_MAX_LOG_PKEY_SUP];
- spinlock_t ht_lock; /* Synchronise with NAPI */
+ spinlock_t ht_lock; /* Serialize hash table updates */
};
int mlx5i_pkey_qpn_ht_init(struct net_device *netdev)
@@ -68,13 +70,14 @@ void mlx5i_pkey_qpn_ht_cleanup(struct net_device *netdev)
kfree(ipriv->qpn_htbl);
}
-static struct qpn_to_netdev *mlx5i_find_qpn_to_netdev_node(struct hlist_head *buckets,
- u32 qpn)
+static struct qpn_to_netdev *
+mlx5i_find_qpn_to_netdev_node(struct mlx5i_pkey_qpn_ht *ht, u32 qpn)
{
- struct hlist_head *h = &buckets[hash_32(qpn, MLX5I_MAX_LOG_PKEY_SUP)];
+ struct hlist_head *h = &ht->buckets[hash_32(qpn, MLX5I_MAX_LOG_PKEY_SUP)];
struct qpn_to_netdev *node;
- hlist_for_each_entry(node, h, hlist) {
+ hlist_for_each_entry_rcu(node, h, hlist,
+ lockdep_is_held(&ht->ht_lock)) {
if (node->underlay_qpn == qpn)
return node;
}
@@ -96,7 +99,7 @@ int mlx5i_pkey_add_qpn(struct net_device *netdev, u32 qpn)
new_node->netdev = netdev;
new_node->underlay_qpn = qpn;
spin_lock_bh(&ht->ht_lock);
- hlist_add_head(&new_node->hlist, &ht->buckets[key]);
+ hlist_add_head_rcu(&new_node->hlist, &ht->buckets[key]);
spin_unlock_bh(&ht->ht_lock);
return 0;
@@ -109,16 +112,17 @@ int mlx5i_pkey_del_qpn(struct net_device *netdev, u32 qpn)
struct mlx5i_pkey_qpn_ht *ht = ipriv->qpn_htbl;
struct qpn_to_netdev *node;
- node = mlx5i_find_qpn_to_netdev_node(ht->buckets, qpn);
+ spin_lock_bh(&ht->ht_lock);
+ node = mlx5i_find_qpn_to_netdev_node(ht, qpn);
if (!node) {
+ spin_unlock_bh(&ht->ht_lock);
mlx5_core_warn(epriv->mdev, "QPN to netdev delete from HT failed\n");
return -EINVAL;
}
- spin_lock_bh(&ht->ht_lock);
- hlist_del_init(&node->hlist);
+ hlist_del_rcu(&node->hlist);
spin_unlock_bh(&ht->ht_lock);
- kfree(node);
+ kfree_rcu(node, rcu);
return 0;
}
@@ -128,7 +132,7 @@ struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn)
struct mlx5i_priv *ipriv = netdev_priv(netdev);
struct qpn_to_netdev *node;
- node = mlx5i_find_qpn_to_netdev_node(ipriv->qpn_htbl->buckets, qpn);
+ node = mlx5i_find_qpn_to_netdev_node(ipriv->qpn_htbl, qpn);
if (!node)
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 328/990] netlink: Do not call the unbind callback with the table locked
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (326 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 327/990] net/mlx5e: IPoIB, Fix QPN lookup race Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 329/990] net/mlx5e: Add missing Ethernet multicast octets to vport_rx_bytes sum Greg Kroah-Hartman
` (524 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anil Kaushik, Simon Horman,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anil Kaushik <anilkaushikwireless@gmail.com>
[ Upstream commit a36b9e205cb3c452ab96cc783e63465d466fe615 ]
When netlink_bind() fails to insert the socket, it calls
netlink_undo_bind() with the table locked. genl_unbind() then takes
cb_lock, while genl_unregister_family() and genl_register_family() take
cb_lock for writing and then wait in netlink_table_grab() for the table
users to go away:
netlink_bind() genl_unregister_family()
netlink_lock_table() down_write(&cb_lock)
netlink_insert() fails
netlink_undo_bind() netlink_table_grab()
genl_unbind() waits for nl_table_users == 0
down_read(&cb_lock)
An unprivileged user can get here by binding to a port ID that is in
use, with nl_groups set. Lockdep does not see it, as nl_table_users is a
plain counter.
Unlock the table first, as the comment in netlink_release() asks for.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261101101347.3910654-1-anilkaushikwireless@gmail.com
Fixes: 3de21a8990d3 ("genetlink: Add per family bind/unbind callbacks")
Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261102120929.4077030-1-anilkaushikwireless@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netlink/af_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index fb7785a59af59..9e1f64f18e3f8 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1032,8 +1032,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
netlink_insert(sk, nladdr->nl_pid) :
netlink_autobind(sock);
if (err) {
+ netlink_unlock_table();
netlink_undo_bind(BITS_PER_TYPE(u32), groups, sk);
- goto unlock;
+ return err;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 329/990] net/mlx5e: Add missing Ethernet multicast octets to vport_rx_bytes sum
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (327 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 328/990] netlink: Do not call the unbind callback with the table locked Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 330/990] calipso: do not charge request socket options to the listener Greg Kroah-Hartman
` (523 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Or Har-Toov, Maher Sanalla,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Har-Toov <ohartoov@nvidia.com>
[ Upstream commit 9c1adbe7fa6cbc02c25db2039532918acf846400 ]
mlx5e_rep_update_hw_counters() adds transmitted_eth_multicast.packets
to vport_rx_packets but does not add transmitted_eth_multicast.octets
to vport_rx_bytes. As a result, Ethernet multicast sent by a VF/SF is
counted in its representor's rx_packets but not in rx_bytes.
Fix by adding transmitted_eth_multicast.octets to the vport_rx_bytes
sum.
Fixes: 64b68e369649 ("net/mlx5: Refactor and expand rep vport stat group")
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261101065833.282261-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_rep.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index a47fef49ada97..8e2ee08907a95 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -239,6 +239,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep)
MLX5_GET_CTR(out, transmitted_ib_unicast.octets) +
MLX5_GET_CTR(out, transmitted_eth_unicast.octets) +
MLX5_GET_CTR(out, transmitted_ib_multicast.octets) +
+ MLX5_GET_CTR(out, transmitted_eth_multicast.octets) +
MLX5_GET_CTR(out, transmitted_eth_broadcast.octets);
rep_stats->vport_tx_bytes =
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 330/990] calipso: do not charge request socket options to the listener
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (328 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 329/990] net/mlx5e: Add missing Ethernet multicast octets to vport_rx_bytes sum Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 331/990] ipv6: Check the Home Address option again before its address is used Greg Kroah-Hartman
` (522 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Eric Dumazet,
Kuniyuki Iwashima, Paul Moore, 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 b4a2cc6d748d3056a25812dcf5f5377a59afd02f ]
calipso_req_setattr() and calipso_req_delattr() allocate ireq->ipv6_opt
with ipv6_renew_options(), which charges the listener sk_omem_alloc
through sock_kmalloc().
tcp_v6_reqsk_destructor() frees ireq->ipv6_opt without uncharging it,
so each request socket leaks its options size from the listener
budget. Once sysctl_optmem_max is reached, sock_kmalloc() fails,
calipso_req_setattr() returns -ENOBUFS, and tcp_v6_route_req() drops
all subsequent SYN packets. __sk_destruct() also reports an optmem
leakage when the listener is destroyed.
Uncharging in tcp_v6_reqsk_destructor() would not be correct: after a
migration, req->rsk_listener is no longer the socket that was charged.
These options belong to the request socket, there is no reason to
charge them to the listener. Change ipv6_renew_options() to use
kmalloc() when its sk argument is NULL, and use this from
calipso_req_setattr() and calipso_req_delattr(),
like cipso_v4_req_setattr() which uses kzalloc().
Note:
After this patch, calipso_req_setattr() and calipso_req_delattr()
no longer need the listener. Commit 10876da918fa ("calipso: Fix
null-ptr-deref in calipso_req_{set,del}attr().") could be reverted
in net-next (also removing the then unused sk variables), so that
CALIPSO works with SYN cookies.
Fixes: e1adea927080 ("calipso: Allow request sockets to be relabelled by the lsm.")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179378292255.488856.6917577451813010963@kernel.org/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Cc: Paul Moore <paul@paul-moore.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Link: https://patch.msgid.link/20261104150318.1156620-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/calipso.c | 12 ++++--------
net/ipv6/exthdrs.c | 5 +++--
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/net/ipv6/calipso.c b/net/ipv6/calipso.c
index 5775ab1c39c04..ae0cf6520f21c 100644
--- a/net/ipv6/calipso.c
+++ b/net/ipv6/calipso.c
@@ -1220,7 +1220,7 @@ static int calipso_req_setattr(struct request_sock *req,
if (IS_ERR(new))
return PTR_ERR(new);
- txopts = ipv6_renew_options(sk, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
+ txopts = ipv6_renew_options(NULL, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
kfree(new);
@@ -1228,10 +1228,8 @@ static int calipso_req_setattr(struct request_sock *req,
return PTR_ERR(txopts);
txopts = xchg(&req_inet->ipv6_opt, txopts);
- if (txopts) {
- atomic_sub(txopts->tot_len, &sk->sk_omem_alloc);
+ if (txopts)
txopt_put(txopts);
- }
return 0;
}
@@ -1261,14 +1259,12 @@ static void calipso_req_delattr(struct request_sock *req)
if (calipso_opt_del(req_inet->ipv6_opt->hopopt, &new))
return; /* Nothing to do */
- txopts = ipv6_renew_options(sk, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
+ txopts = ipv6_renew_options(NULL, req_inet->ipv6_opt, IPV6_HOPOPTS, new);
if (!IS_ERR(txopts)) {
txopts = xchg(&req_inet->ipv6_opt, txopts);
- if (txopts) {
- atomic_sub(txopts->tot_len, &sk->sk_omem_alloc);
+ if (txopts)
txopt_put(txopts);
- }
}
kfree(new);
}
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 38f15948237c6..f680df587769c 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -1284,7 +1284,7 @@ static void ipv6_renew_option(int renewtype,
* not copied into the new set of options.
*
* The new set of options is allocated from the socket option memory
- * buffer of @sk.
+ * buffer of @sk, or with kmalloc() if @sk is NULL.
*/
struct ipv6_txoptions *
ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
@@ -1312,7 +1312,8 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
return NULL;
tot_len += sizeof(*opt2);
- opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC);
+ opt2 = sk ? sock_kmalloc(sk, tot_len, GFP_ATOMIC) :
+ kmalloc(tot_len, GFP_ATOMIC);
if (!opt2)
return ERR_PTR(-ENOBUFS);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 331/990] ipv6: Check the Home Address option again before its address is used
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (329 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 330/990] calipso: do not charge request socket options to the listener Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 332/990] ata: libata-scsi: fix MODE SELECT handling of data after the mode page Greg Kroah-Hartman
` (521 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Ido Schimmel,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <ast@kernel.org>
[ Upstream commit 30c71476d842b094651bd7712f6c8ee8716147d0 ]
ipv6_dest_hao() checks the Home Address option and sets IP6CB(skb)->dsthao
to the offset of the destination options header. Later mip6_addr_swap() and
mip6_destopt_reject() call ipv6_find_tlv() with that offset and use the 16
address bytes. They assume that the same header is still there.
But the seg6 and ioam6 lwtunnels, the End.B6 actions, ipv6_rpl_srh_rcv()
and BPF lwt progs move or rewrite the IPv6 headers and keep IP6CB(skb).
Then ipv6_find_tlv() parses other bytes. It returns when the type matches,
before it checks that the option is inside the header. Nobody checks the
length of the option again. Thus mip6_addr_swap() can write after the data
of the skb. mip6_destopt_reject() can copy that memory to an xfrm report.
In ipv6_find_tlv(), check the length of an option before its type. The
returned option is then inside the header, and the header is inside the
linear data. In both callers, ignore an option with a length other than 16,
as if ipv6_find_tlv() found none. Then the ICMPv6 error goes to the source
address of the IPv6 header, and the xfrm report has no XFRMA_COADDR
attribute. Nothing changes for a header that ip6_parse_tlv() accepted and
that is still in its place. For the other callers an incomplete option is
now absent:
- ip6_find_1stfragopt() and mip6_rthdr_offset() can return another offset
for the fragment header or the xfrm header, also in a forwarded packet.
- calipso_skbuff_optptr() returns NULL. netlbl_skbuff_getattr() and
netlbl_cache_add() then see no option. calipso_skbuff_delattr() returns
0 and the packet continues unchanged. Today it returns -EINVAL and
SELinux drops the packet. It already returns 0 when an earlier option is
incomplete. The receiver drops such a header in ip6_parse_tlv().
The code that moves the headers still does not reset the offset or the
other fields of IP6CB(skb). If the bytes there look like a header with a
Home Address option of length 16, both callers still use its address.
The first tag also covers ipv6_find_tlv(), because its early return did no
harm before mip6_addr_swap(). The second tag is for mip6_destopt_reject().
Fixes: 793832361fe7 ("[IPV6] MIP6: Revert address to send ICMPv6 error.")
Fixes: 70182ed23d25 ("[IPV6] MIP6: Report to user-space when home address option is rejected.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261102064922.2636027-1-alexei.starovoitov@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/exthdrs_core.c | 7 ++++---
net/ipv6/icmp.c | 7 ++++++-
net/ipv6/mip6.c | 9 ++++++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 4a9748338cf40..764c694fb417a 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -138,9 +138,6 @@ int ipv6_find_tlv(const struct sk_buff *skb, int offset, int type)
int opttype = nh[offset];
int optlen;
- if (opttype == type)
- return offset;
-
switch (opttype) {
case IPV6_TLV_PAD1:
optlen = 1;
@@ -153,6 +150,10 @@ int ipv6_find_tlv(const struct sk_buff *skb, int offset, int type)
goto bad;
break;
}
+ /* Some callers read the option, so it must be in the header. */
+ if (opttype == type)
+ return offset;
+
offset += optlen;
len -= optlen;
}
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9cf0557d0ed29..3164e7ddb6293 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -339,7 +339,12 @@ static void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt
if (likely(off >= 0)) {
hao = (struct ipv6_destopt_hao *)
(skb_network_header(skb) + off);
- swap(iph->saddr, hao->addr);
+ /*
+ * The header can have moved or changed after
+ * ipv6_dest_hao() checked the length.
+ */
+ if (hao->length == 16)
+ swap(iph->saddr, hao->addr);
}
}
}
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 6a16a5bd0d910..9615679724114 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -211,9 +211,16 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb,
if (likely(opt->dsthao)) {
offset = ipv6_find_tlv(skb, opt->dsthao, IPV6_TLV_HAO);
- if (likely(offset >= 0))
+ if (likely(offset >= 0)) {
hao = (struct ipv6_destopt_hao *)
(skb_network_header(skb) + offset);
+ /*
+ * The header can have moved or changed after
+ * ipv6_dest_hao() checked the length.
+ */
+ if (hao->length != 16)
+ hao = NULL;
+ }
}
stamp = skb_get_ktime(skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 332/990] ata: libata-scsi: fix MODE SELECT handling of data after the mode page
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (330 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 331/990] ipv6: Check the Home Address option again before its address is used Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 333/990] ata: libata-scsi: do not accept subpage code FFh in MODE SELECT Greg Kroah-Hartman
` (520 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 6fde0444d07ec954f3d885375e0402ff2f2e5064 ]
ata_scsi_mode_select_xlat() only supports one mode page per MODE SELECT
command, and rejects a parameter list with data after the mode page with
INVALID FIELD IN PARAMETER LIST. However:
- It does not set the field pointer, so the sense data reports 0xffff as
the FIELD POINTER.
- It only checks for data after the mode page after the mode page
handler has been called. ata_mselect_control_ata_feature() has then
already updated the CDL enabled flag of the device, even though the
command is rejected and the CDL setting of the device is not changed.
- For the control mode page, ata_mselect_control_spg0() does not need an
ATA command, so the check is skipped, and the data after the mode page
is silently ignored.
Check for data after the mode page before calling the mode page
handlers, and set the FIELD POINTER to the first byte after the mode
page, i.e. to the first byte of the next mode page.
The reason why only one mode page per command is supported is that a
MODE SELECT command is translated into at most one ATA command, so
update the comment accordingly.
Fixes: 1b26d29ccd59 ("[libata] scsi: implement MODE SELECT command")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-11-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ce206f90d8bc4..ee0346de04744 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4359,6 +4359,17 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
if (pg_len > len)
goto invalid_param_len;
+ /*
+ * A MODE SELECT command is translated into at most one ATA command, so
+ * only one mode page per command is supported. Reject any data after
+ * the mode page before calling the mode page handlers, which may
+ * already update the device flags.
+ */
+ if (len > pg_len) {
+ fp = p - buffer + pg_len;
+ goto invalid_param;
+ }
+
switch (pg) {
case CACHE_MPAGE:
if (ata_mselect_caching(qc, p, pg_len, &fp) < 0) {
@@ -4381,13 +4392,6 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
goto invalid_param;
}
- /*
- * Only one page has changeable data, so we only support setting one
- * page at a time.
- */
- if (len > pg_len)
- goto invalid_param;
-
return 0;
invalid_fld:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 333/990] ata: libata-scsi: do not accept subpage code FFh in MODE SELECT
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (331 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 332/990] ata: libata-scsi: fix MODE SELECT handling of data after the mode page Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 334/990] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit Greg Kroah-Hartman
` (519 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit b29c40dc150b0b4218c4d6844770892eb6b2f6b5 ]
When the SUBPAGE CODE of the mode page in a MODE SELECT parameter list
is FFh, ata_scsi_mode_select_xlat() rejects it for the control mode
page, but accepts it for all other mode pages, i.e. for the caching
mode page, the only other mode page that it supports.
However, FFh is not the subpage code of an actual mode page: SPC-7
(7.5.2) only defines it as the MODE SENSE request code for all
subpages. SUBPAGE CODE FFh only means "all subpages" in requests, i.e.
in the MODE SENSE CDB for mode pages and in the LOG SELECT CDB for log
pages (see SPC-5, 6.8), while the SUBPAGE CODE of a mode page in a MODE
SELECT parameter list identifies a specific mode page. Also, SAT-2 and
later versions of SAT define the Caching mode page with the SPF bit set
to zero (see SAT-6, 10.4.9), i.e. without a SUBPAGE CODE field.
Remove the ALL_SUB_MPAGES case, so that SUBPAGE CODE FFh is rejected
like any other unsupported subpage.
Fixes: 1b26d29ccd59 ("[libata] scsi: implement MODE SELECT command")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-12-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ee0346de04744..b761cfd435f84 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4332,19 +4332,11 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
}
/*
- * Supported subpages: all subpages and ATA feature sub-page f2h of
- * the control page.
+ * The only supported subpage is the ATA feature sub-page f2h of the
+ * control page.
*/
if (spg) {
switch (spg) {
- case ALL_SUB_MPAGES:
- /* All subpages is not supported for the control page */
- if (pg == CONTROL_MPAGE) {
- fp = (p[0] & 0x40) ? 1 : 0;
- fp += hdr_len + bd_len;
- goto invalid_param;
- }
- break;
case ATA_FEATURE_SUB_MPAGE:
if (qc->dev->flags & ATA_DFLAG_CDL &&
pg == CONTROL_MPAGE)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 334/990] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (332 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 333/990] ata: libata-scsi: do not accept subpage code FFh in MODE SELECT Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 335/990] ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages Greg Kroah-Hartman
` (518 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Niklas Cassel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit a1eb72c477ec1320c540f27ce1e2f717d4518e62 ]
ata_scsi_mode_select_xlat() accepts the caching and control mode pages
both in page_0 format and in sub_page format with SUBPAGE CODE 00h.
However, SAT-2 and later versions of SAT define the SPF bit of the
Caching mode page and of the Control mode page as not changeable and
set to zero (see SAT-6, 10.4.9 and 10.4.6), and SPC-7 (6.12, MODE
SELECT(10) command) requires the device server to terminate a MODE
SELECT command with INVALID FIELD IN PARAMETER LIST if the application
client sets any field that is reported as not changeable to a value
other than its current value.
Reject a mode page with the SPF bit set to one and SUBPAGE CODE 00h,
with the FIELD POINTER set to the byte containing the SPF bit. The only
mode page with the SPF bit set to one that remains accepted is the ATA
Feature Control mode page (control mode page, sub-page f2h), for which
SAT-6 (12.3.4) requires the SPF bit to be set to one. The opposite case
does not need a check: a mode page in page_0 format always has subpage
code 00h, so it can never be the ATA Feature Control mode page.
This also allows the mode page handlers to rely on the format of their
mode page, which a later patch will make use of.
Fixes: 1b26d29ccd59 ("[libata] scsi: implement MODE SELECT command")
Link: https://lore.kernel.org/r/20261103205448.931471-13-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b761cfd435f84..ff944a80e35c0 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4317,7 +4317,17 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
if (len < 4)
goto invalid_param_len;
+ /*
+ * Mode pages with subpage code 00h use the page_0 format: SAT
+ * defines the SPF bit of the Caching and Control mode pages,
+ * for subpage code 00h, as not changeable and set to zero.
+ */
spg = p[1];
+ if (!spg) {
+ fp = hdr_len + bd_len;
+ goto invalid_param;
+ }
+
pg_len = get_unaligned_be16(&p[2]);
p += 4;
len -= 4;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 335/990] ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (333 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 334/990] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 336/990] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length Greg Kroah-Hartman
` (517 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 2a4c61cf94d48ec8560473d4fd5383583ce8809c ]
When the mode page of a MODE SELECT parameter list has an unsupported
SUBPAGE CODE, ata_scsi_mode_select_xlat() sets the FIELD POINTER of the
INVALID FIELD IN PARAMETER LIST sense data to the SUBPAGE CODE byte of
the mode page header (byte 1 of the page) if the SPF bit is set, and to
the PAGE CODE byte (byte 0 of the page) otherwise.
However, the SPF bit is tested on p[0] after p has already been advanced
past the mode page header, so the test reads bit 6 of the first byte of
the mode page data instead. If the parameter list ends with the mode
page header, it even reads the byte that follows the parameter list in
buffer, which is not initialized when no data beyond the parameter list
was transferred.
The test is not needed anyway: spg can only be non-zero for a mode page
in sub_page format, i.e. with the SPF bit set, and the field in error is
the SUBPAGE CODE. Always set the FIELD POINTER to the SUBPAGE CODE byte,
which follows the mode parameter header, the block descriptors and the
PAGE CODE byte.
Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-14-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ff944a80e35c0..ce85f1dc69569 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4353,8 +4353,7 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
break;
fallthrough;
default:
- fp = (p[0] & 0x40) ? 1 : 0;
- fp += hdr_len + bd_len;
+ fp = hdr_len + bd_len + 1;
goto invalid_param;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 336/990] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (334 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 335/990] ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 337/990] ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers Greg Kroah-Hartman
` (516 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit a3e52dcf0fbaa1a103accef3e8861cdc250ee5d6 ]
ata_scsi_mode_select_xlat() only accepts MODE SELECT parameter lists
without block descriptors or with a single 8 byte block descriptor. For
any other BLOCK DESCRIPTOR LENGTH, it terminates the command with
INVALID FIELD IN PARAMETER LIST, and the FIELD POINTER should point at
the BLOCK DESCRIPTOR LENGTH field, i.e. at byte 3 of the mode parameter
header(6) or at byte 6 of the mode parameter header(10), as SPC requires
the FIELD POINTER of a multiple-byte field to point at its first byte.
However, the mode parameter header length and the BLOCK DESCRIPTOR
LENGTH are added to the offset of the field, so the FIELD POINTER points
3 or 6 bytes after the end of the block descriptors instead. For
example, a MODE SELECT(10) with a BLOCK DESCRIPTOR LENGTH of 16 reports
byte 30 instead of byte 6.
Do not add the mode parameter header length and the BLOCK DESCRIPTOR
LENGTH to the offset of the BLOCK DESCRIPTOR LENGTH field.
Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-15-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ce85f1dc69569..e408071208018 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4302,7 +4302,6 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
goto invalid_param_len;
if (bd_len != 0 && bd_len != 8) {
fp = (six_byte) ? 3 : 6;
- fp += bd_len + hdr_len;
goto invalid_param;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 337/990] ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (335 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 336/990] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 338/990] ata: libata-scsi: set the field pointer when rejecting CDL Greg Kroah-Hartman
` (515 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 0fdb8eef88a886751e33600d446a66c529384f11 ]
ata_scsi_mode_select_xlat() strips the mode page header before calling
the mode page handlers, which report the position of an invalid field
as an offset relative to the mode page data. It then converts this
offset into an offset in the parameter list by adding the length of the
mode parameter header and of the block descriptors, but not the length
of the mode page header. As a result, the FIELD POINTER of the INVALID
FIELD IN PARAMETER LIST sense data points 2 bytes (page_0 format) or 4
bytes (sub_page format) before the byte that is actually invalid. For
example, changing byte 3 of the caching mode page in a MODE SELECT(10)
parameter list without block descriptors reports byte 9 instead of
byte 11.
Pass the whole mode page, starting with its mode page header, to the
handlers instead, like the ata_msense_*() functions, which generate the
whole mode page. Offsets in buf are then the byte numbers of the mode
page, as used in the mode page definitions of SPC, SBC and SAT, the
handlers can compare buf with the mode page generated by the matching
ata_msense_*() function without adjusting offsets, and the conversion
done by ata_scsi_mode_select_xlat() becomes correct. This also allows
reporting an invalid PAGE LENGTH at the PAGE LENGTH field, which was not
part of buf before. As ata_scsi_mode_select_xlat() rejects SUBPAGE CODE
FFh and mode pages with a wrong SPF bit, each handler only gets its mode
page in a single format, so the mode page header length is known.
Document what buf, len and fp are, and the return values, in kernel-doc
comments for all the handlers.
Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-16-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 133 +++++++++++++++++++++++---------------
1 file changed, 82 insertions(+), 51 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index e408071208018..c9aa4521a4fe5 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4055,14 +4055,22 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc)
/**
* ata_mselect_caching - Simulate MODE SELECT for caching info page
* @qc: Storage for translated ATA taskfile
- * @buf: input buffer
- * @len: number of valid bytes in the input buffer
- * @fp: out parameter for the failed field on error
+ * @buf: Mode page, starting with the mode page header
+ * @len: Length of the mode page, including the mode page header
+ * @fp: Out parameter, offset in @buf of the first invalid byte on error
*
* Prepare a taskfile to modify caching information for the device.
*
+ * The caller has stripped the mode parameter header and the block
+ * descriptors, so @buf points at the mode page header, like the buffer
+ * filled by the ata_msense_*() functions, and offsets in @buf, including
+ * the one returned in @fp, are the byte numbers of the mode page.
+ *
* LOCKING:
* None.
+ *
+ * RETURNS:
+ * 0 if a taskfile was prepared, -EINVAL if the mode page is invalid.
*/
static int ata_mselect_caching(struct ata_queued_cmd *qc,
const u8 *buf, int len, u16 *fp)
@@ -4073,26 +4081,19 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
u8 wce;
int i;
- /*
- * The first two bytes of def_cache_mpage are a header, so offsets
- * in mpage are off by 2 compared to buf. Same for len.
- */
-
- if (len != CACHE_MPAGE_LEN - 2) {
- *fp = min(len, CACHE_MPAGE_LEN - 2);
+ if (len != CACHE_MPAGE_LEN) {
+ *fp = 1;
return -EINVAL;
}
- wce = buf[0] & (1 << 2);
+ wce = buf[2] & (1 << 2);
/*
* Check that read-only bits are not modified.
*/
ata_msense_caching(dev->id, mpage, false);
- for (i = 0; i < CACHE_MPAGE_LEN - 2; i++) {
- if (i == 0)
- continue;
- if (mpage[i + 2] != buf[i]) {
+ for (i = 3; i < CACHE_MPAGE_LEN; i++) {
+ if (mpage[i] != buf[i]) {
*fp = i;
return -EINVAL;
}
@@ -4106,8 +4107,26 @@ static int ata_mselect_caching(struct ata_queued_cmd *qc,
return 0;
}
-/*
- * Simulate MODE SELECT control mode page, sub-page 0.
+/**
+ * ata_mselect_control_spg0 - Simulate MODE SELECT for control sub-page 0
+ * @qc: Storage for translated ATA taskfile
+ * @buf: Mode page, starting with the mode page header
+ * @len: Length of the mode page, including the mode page header
+ * @fp: Out parameter, offset in @buf of the first invalid byte on error
+ *
+ * Simulate MODE SELECT control mode page, sub-page 0.
+ *
+ * The caller has stripped the mode parameter header and the block
+ * descriptors, so @buf points at the mode page header, like the buffer
+ * filled by the ata_msense_*() functions, and offsets in @buf, including
+ * the one returned in @fp, are the byte numbers of the mode page.
+ *
+ * LOCKING:
+ * None.
+ *
+ * RETURNS:
+ * 0, as no ATA command needs to be sent, or -EINVAL if the mode page is
+ * invalid.
*/
static int ata_mselect_control_spg0(struct ata_queued_cmd *qc,
const u8 *buf, int len, u16 *fp)
@@ -4117,26 +4136,19 @@ static int ata_mselect_control_spg0(struct ata_queued_cmd *qc,
u8 d_sense;
int i;
- /*
- * The first two bytes of def_control_mpage are a header, so offsets
- * in mpage are off by 2 compared to buf. Same for len.
- */
-
- if (len != CONTROL_MPAGE_LEN - 2) {
- *fp = min(len, CONTROL_MPAGE_LEN - 2);
+ if (len != CONTROL_MPAGE_LEN) {
+ *fp = 1;
return -EINVAL;
}
- d_sense = buf[0] & (1 << 2);
+ d_sense = buf[2] & (1 << 2);
/*
* Check that read-only bits are not modified.
*/
ata_msense_control_spg0(dev, mpage, false);
- for (i = 0; i < CONTROL_MPAGE_LEN - 2; i++) {
- if (i == 0)
- continue;
- if (mpage[2 + i] != buf[i]) {
+ for (i = 3; i < CONTROL_MPAGE_LEN; i++) {
+ if (mpage[i] != buf[i]) {
*fp = i;
return -EINVAL;
}
@@ -4148,9 +4160,27 @@ static int ata_mselect_control_spg0(struct ata_queued_cmd *qc,
return 0;
}
-/*
- * Translate MODE SELECT control mode page, sub-page f2h (ATA feature mode
- * page) into a SET FEATURES command.
+/**
+ * ata_mselect_control_ata_feature - Translate ATA Feature Control page
+ * @qc: Storage for translated ATA taskfile
+ * @buf: Mode page, starting with the mode page header
+ * @len: Length of the mode page, including the mode page header
+ * @fp: Out parameter, offset in @buf of the first invalid byte on error
+ *
+ * Translate MODE SELECT control mode page, sub-page f2h (ATA feature mode
+ * page) into a SET FEATURES command.
+ *
+ * The caller has stripped the mode parameter header and the block
+ * descriptors, so @buf points at the mode page header, like the buffer
+ * filled by the ata_msense_*() functions, and offsets in @buf, including
+ * the one returned in @fp, are the byte numbers of the mode page.
+ *
+ * LOCKING:
+ * None.
+ *
+ * RETURNS:
+ * 1 if a taskfile was prepared, -EINVAL if the mode page is invalid or if
+ * CDL cannot be enabled.
*/
static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
const u8 *buf, int len, u16 *fp)
@@ -4159,17 +4189,13 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
struct ata_taskfile *tf = &qc->tf;
u8 cdl_action;
- /*
- * The first four bytes of ATA Feature Control mode page are a header,
- * so offsets in mpage are off by 4 compared to buf. Same for len.
- */
- if (len != ATA_FEATURE_SUB_MPAGE_LEN - 4) {
- *fp = min(len, ATA_FEATURE_SUB_MPAGE_LEN - 4);
+ if (len != ATA_FEATURE_SUB_MPAGE_LEN) {
+ *fp = 2;
return -EINVAL;
}
/* Check cdl_ctrl */
- switch (buf[0] & 0x03) {
+ switch (buf[4] & 0x03) {
case 0:
/* Disable CDL */
ata_dev_dbg(dev, "Disabling CDL\n");
@@ -4191,7 +4217,7 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
dev->flags |= ATA_DFLAG_CDL_ENABLED;
break;
default:
- *fp = 0;
+ *fp = 4;
return -EINVAL;
}
@@ -4207,15 +4233,24 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
/**
* ata_mselect_control - Simulate MODE SELECT for control page
* @qc: Storage for translated ATA taskfile
- * @spg: target sub-page of the control page
- * @buf: input buffer
- * @len: number of valid bytes in the input buffer
- * @fp: out parameter for the failed field on error
+ * @spg: Sub-page of the control page, 0 or ATA_FEATURE_SUB_MPAGE
+ * @buf: Mode page, starting with the mode page header
+ * @len: Length of the mode page, including the mode page header
+ * @fp: Out parameter, offset in @buf of the first invalid byte on error
*
- * Prepare a taskfile to modify caching information for the device.
+ * Call the handler of sub-page @spg of the control mode page.
+ *
+ * The caller has stripped the mode parameter header and the block
+ * descriptors, so @buf points at the mode page header, like the buffer
+ * filled by the ata_msense_*() functions, and offsets in @buf, including
+ * the one returned in @fp, are the byte numbers of the mode page.
*
* LOCKING:
* None.
+ *
+ * RETURNS:
+ * 0 if no ATA command needs to be sent, 1 if a taskfile was prepared,
+ * -EINVAL if the mode page is invalid.
*/
static int ata_mselect_control(struct ata_queued_cmd *qc, u8 spg,
const u8 *buf, int len, u16 *fp)
@@ -4327,17 +4362,13 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc)
goto invalid_param;
}
- pg_len = get_unaligned_be16(&p[2]);
- p += 4;
- len -= 4;
+ pg_len = get_unaligned_be16(&p[2]) + 4;
} else {
if (len < 2)
goto invalid_param_len;
spg = 0;
- pg_len = p[1];
- p += 2;
- len -= 2;
+ pg_len = p[1] + 2;
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 338/990] ata: libata-scsi: set the field pointer when rejecting CDL
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (336 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 337/990] ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 339/990] tracing/probes: bound symstr stores to reserved length Greg Kroah-Hartman
` (514 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Damien Le Moal,
Niklas Cassel, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shao Mingyin <shao.mingyin@zte.com.cn>
[ Upstream commit 7c972e73641cbe5f77f63c336de15c7a30268d49 ]
ata_mselect_control_ata_feature() rejects enabling CDL while NCQ
priority is enabled, but unlike its other error branches it returns
without setting *fp.
ata_scsi_mode_select_xlat() initializes fp to 0xffff and, when the
handler fails, adds the offset of the mode page in the parameter list
to it, i.e. the length of the mode parameter header and of the block
descriptors. As fp is a u16, this wraps around, so the resulting sense
data reports the byte before the mode page, i.e. the last byte of the
mode parameter header or of the block descriptors, as the FIELD
POINTER, instead of the byte containing the CDL_CTRL field that
requests enabling CDL.
Set *fp to 4, i.e. to the byte containing the CDL_CTRL field, like the
branch rejecting an invalid CDL_CTRL value does.
Fixes: df60f9c64576 ("scsi: ata: libata: Add ATA feature control sub-page translation")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
[cassel: set *fp to 4, the offset of CDL_CTRL in the mode page]
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20261103205448.931471-17-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ata/libata-scsi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c9aa4521a4fe5..5defffb9a3e09 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4210,6 +4210,7 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) {
ata_dev_err(dev,
"NCQ priority must be disabled to enable CDL\n");
+ *fp = 4;
return -EINVAL;
}
ata_dev_dbg(dev, "Enabling CDL\n");
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 339/990] tracing/probes: bound symstr stores to reserved length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (337 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 338/990] ata: libata-scsi: set the field pointer when rejecting CDL Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 340/990] liveupdate: kho: move to kernel/liveupdate Greg Kroah-Hartman
` (513 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yifan Zhang,
Masami Hiramatsu (Google), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
[ Upstream commit 2fc0b3070d6d5dcecfed43cd0e62aa0fd4b4315c ]
Traceprobe calculates dynamic string sizes before storing the values. A
probed pointer can change between those passes, so
fetch_store_symstrlen() can reserve space for a short symbol while
fetch_store_symstring() observes a longer one. The store path then
overwrites the trace record.
Format the symbol into a temporary KSYM_SYMBOL_LEN buffer and copy only
the bytes that fit in the reserved field, including a trailing NUL.
Update __data_loc with the length actually stored so consumers do not
read beyond the truncated value.
Link: https://lore.kernel.org/all/179378621331.55520.2052332247156241151@stu.pku.edu.cn/
Fixes: b26a124cbfa8 ("tracing/probes: Add symstr type for dynamic events")
Signed-off-by: Yifan Zhang <yfzhang23@stu.pku.edu.cn>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_probe_tmpl.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
index f39b37fcdb3b5..636e0a52383f4 100644
--- a/kernel/trace/trace_probe_tmpl.h
+++ b/kernel/trace/trace_probe_tmpl.h
@@ -87,15 +87,27 @@ fetch_store_symstrlen(unsigned long addr)
static nokprobe_inline int
fetch_store_symstring(unsigned long addr, void *dest, void *base)
{
+ char namebuf[KSYM_SYMBOL_LEN];
int maxlen = get_loc_len(*(u32 *)dest);
void *__dest;
+ int len;
if (unlikely(!maxlen))
return -ENOMEM;
__dest = get_loc_data(dest, base);
+ len = sprint_symbol(namebuf, addr);
+ if (len < 0) {
+ *(u32 *)dest = make_data_loc(0, __dest - base);
+ return 0;
+ }
+
+ len = min(len, maxlen - 1);
+ memcpy(__dest, namebuf, len);
+ ((char *)__dest)[len] = '\0';
+ *(u32 *)dest = make_data_loc(len + 1, __dest - base);
- return sprint_symbol(__dest, addr);
+ return len + 1;
}
/* common part of process_fetch_insn*/
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 340/990] liveupdate: kho: move to kernel/liveupdate
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (338 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 339/990] tracing/probes: bound symstr stores to reserved length Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 341/990] kho: check fdt_phys in is_kho_boot() Greg Kroah-Hartman
` (512 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pasha Tatashin, Jason Gunthorpe,
Mike Rapoport (Microsoft), Alexander Graf, Changyuan Lyu,
Christian Brauner, Jason Gunthorpe, Jonathan Corbet,
Masahiro Yamada, Miguel Ojeda, Pratyush Yadav, Randy Dunlap,
Simon Horman, Tejun Heo, Zhu Yanjun, Andrew Morton, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pasha Tatashin <pasha.tatashin@soleen.com>
[ Upstream commit 48a1b2321d763b5edeaf20bd4576d8c4b5df772b ]
Move KHO to kernel/liveupdate/ in preparation of placing all Live Update
core kernel related files to the same place.
[pasha.tatashin@soleen.com: disable the menu when DEFERRED_STRUCT_PAGE_INIT]
Link: https://lkml.kernel.org/r/CA+CK2bAvh9Oa2SLfsbJ8zztpEjrgr_hr-uGgF1coy8yoibT39A@mail.gmail.com
Link: https://lkml.kernel.org/r/20251101142325.1326536-8-pasha.tatashin@soleen.com
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: Changyuan Lyu <changyuanl@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Pratyush Yadav <pratyush@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Simon Horman <horms@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Zhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 58c5852ca96c ("kho: check fdt_phys in is_kho_boot()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/core-api/kho/concepts.rst | 2 +-
MAINTAINERS | 2 +-
init/Kconfig | 2 +
kernel/Kconfig.kexec | 34 ----------------
kernel/Makefile | 4 +-
kernel/liveupdate/Kconfig | 40 +++++++++++++++++++
kernel/liveupdate/Makefile | 5 +++
kernel/{ => liveupdate}/kexec_handover.c | 4 +-
.../{ => liveupdate}/kexec_handover_debug.c | 0
.../{ => liveupdate}/kexec_handover_debugfs.c | 0
.../kexec_handover_internal.h | 0
11 files changed, 52 insertions(+), 41 deletions(-)
create mode 100644 kernel/liveupdate/Kconfig
create mode 100644 kernel/liveupdate/Makefile
rename kernel/{ => liveupdate}/kexec_handover.c (99%)
rename kernel/{ => liveupdate}/kexec_handover_debug.c (100%)
rename kernel/{ => liveupdate}/kexec_handover_debugfs.c (100%)
rename kernel/{ => liveupdate}/kexec_handover_internal.h (100%)
diff --git a/Documentation/core-api/kho/concepts.rst b/Documentation/core-api/kho/concepts.rst
index 36d5c05cfb307..d626d1dbd6784 100644
--- a/Documentation/core-api/kho/concepts.rst
+++ b/Documentation/core-api/kho/concepts.rst
@@ -70,5 +70,5 @@ in the FDT. That state is called the KHO finalization phase.
Public API
==========
-.. kernel-doc:: kernel/kexec_handover.c
+.. kernel-doc:: kernel/liveupdate/kexec_handover.c
:export:
diff --git a/MAINTAINERS b/MAINTAINERS
index 5821d97ae3304..41b87ea892e03 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13818,7 +13818,7 @@ S: Maintained
F: Documentation/admin-guide/mm/kho.rst
F: Documentation/core-api/kho/*
F: include/linux/kexec_handover.h
-F: kernel/kexec_handover*
+F: kernel/liveupdate/kexec_handover*
F: lib/test_kho.c
F: tools/testing/selftests/kho/
diff --git a/init/Kconfig b/init/Kconfig
index 78d4277990e94..97603e51026ce 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2151,6 +2151,8 @@ config TRACEPOINTS
source "kernel/Kconfig.kexec"
+source "kernel/liveupdate/Kconfig"
+
endmenu # General setup
source "arch/Kconfig"
diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec
index cc6743137946f..15632358bcf71 100644
--- a/kernel/Kconfig.kexec
+++ b/kernel/Kconfig.kexec
@@ -94,40 +94,6 @@ config KEXEC_JUMP
Jump between original kernel and kexeced kernel and invoke
code in physical address mode via KEXEC
-config KEXEC_HANDOVER
- bool "kexec handover"
- depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE
- depends on !DEFERRED_STRUCT_PAGE_INIT
- select MEMBLOCK_KHO_SCRATCH
- select KEXEC_FILE
- select LIBFDT
- select CMA
- help
- Allow kexec to hand over state across kernels by generating and
- passing additional metadata to the target kernel. This is useful
- to keep data or state alive across the kexec. For this to work,
- both source and target kernels need to have this option enabled.
-
-config KEXEC_HANDOVER_DEBUG
- bool "Enable Kexec Handover debug checks"
- depends on KEXEC_HANDOVER
- help
- This option enables extra sanity checks for the Kexec Handover
- subsystem. Since, KHO performance is crucial in live update
- scenarios and the extra code might be adding overhead it is
- only optionally enabled.
-
-config KEXEC_HANDOVER_DEBUGFS
- bool "kexec handover debugfs interface"
- default KEXEC_HANDOVER
- depends on KEXEC_HANDOVER
- select DEBUG_FS
- help
- Allow to control kexec handover device tree via debugfs
- interface, i.e. finalize the state or aborting the finalization.
- Also, enables inspecting the KHO fdt trees with the debugfs binary
- blobs.
-
config CRASH_DUMP
bool "kernel crash dumps"
default ARCH_DEFAULT_CRASH_DUMP
diff --git a/kernel/Makefile b/kernel/Makefile
index 2cf7909a74e56..e83669841b8cc 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -52,6 +52,7 @@ obj-y += printk/
obj-y += irq/
obj-y += rcu/
obj-y += livepatch/
+obj-y += liveupdate/
obj-y += dma/
obj-y += entry/
obj-y += unwind/
@@ -82,9 +83,6 @@ obj-$(CONFIG_CRASH_DUMP_KUNIT_TEST) += crash_core_test.o
obj-$(CONFIG_KEXEC) += kexec.o
obj-$(CONFIG_KEXEC_FILE) += kexec_file.o
obj-$(CONFIG_KEXEC_ELF) += kexec_elf.o
-obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o
-obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o
-obj-$(CONFIG_KEXEC_HANDOVER_DEBUGFS) += kexec_handover_debugfs.o
obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_CGROUPS) += cgroup/
diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig
new file mode 100644
index 0000000000000..eae4283093323
--- /dev/null
+++ b/kernel/liveupdate/Kconfig
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+menu "Live Update and Kexec HandOver"
+ depends on !DEFERRED_STRUCT_PAGE_INIT
+
+config KEXEC_HANDOVER
+ bool "kexec handover"
+ depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE
+ depends on !DEFERRED_STRUCT_PAGE_INIT
+ select MEMBLOCK_KHO_SCRATCH
+ select KEXEC_FILE
+ select LIBFDT
+ select CMA
+ help
+ Allow kexec to hand over state across kernels by generating and
+ passing additional metadata to the target kernel. This is useful
+ to keep data or state alive across the kexec. For this to work,
+ both source and target kernels need to have this option enabled.
+
+config KEXEC_HANDOVER_DEBUG
+ bool "Enable Kexec Handover debug checks"
+ depends on KEXEC_HANDOVER
+ help
+ This option enables extra sanity checks for the Kexec Handover
+ subsystem. Since, KHO performance is crucial in live update
+ scenarios and the extra code might be adding overhead it is
+ only optionally enabled.
+
+config KEXEC_HANDOVER_DEBUGFS
+ bool "kexec handover debugfs interface"
+ default KEXEC_HANDOVER
+ depends on KEXEC_HANDOVER
+ select DEBUG_FS
+ help
+ Allow to control kexec handover device tree via debugfs
+ interface, i.e. finalize the state or aborting the finalization.
+ Also, enables inspecting the KHO fdt trees with the debugfs binary
+ blobs.
+
+endmenu
diff --git a/kernel/liveupdate/Makefile b/kernel/liveupdate/Makefile
new file mode 100644
index 0000000000000..f52ce1ebcf865
--- /dev/null
+++ b/kernel/liveupdate/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o
+obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o
+obj-$(CONFIG_KEXEC_HANDOVER_DEBUGFS) += kexec_handover_debugfs.o
diff --git a/kernel/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
similarity index 99%
rename from kernel/kexec_handover.c
rename to kernel/liveupdate/kexec_handover.c
index e503573e03190..bedf88f3cefe5 100644
--- a/kernel/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -28,8 +28,8 @@
* KHO is tightly coupled with mm init and needs access to some of mm
* internal APIs.
*/
-#include "../mm/internal.h"
-#include "kexec_internal.h"
+#include "../../mm/internal.h"
+#include "../kexec_internal.h"
#include "kexec_handover_internal.h"
#define KHO_FDT_COMPATIBLE "kho-v1"
diff --git a/kernel/kexec_handover_debug.c b/kernel/liveupdate/kexec_handover_debug.c
similarity index 100%
rename from kernel/kexec_handover_debug.c
rename to kernel/liveupdate/kexec_handover_debug.c
diff --git a/kernel/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c
similarity index 100%
rename from kernel/kexec_handover_debugfs.c
rename to kernel/liveupdate/kexec_handover_debugfs.c
diff --git a/kernel/kexec_handover_internal.h b/kernel/liveupdate/kexec_handover_internal.h
similarity index 100%
rename from kernel/kexec_handover_internal.h
rename to kernel/liveupdate/kexec_handover_internal.h
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 341/990] kho: check fdt_phys in is_kho_boot()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (339 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 340/990] liveupdate: kho: move to kernel/liveupdate Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 342/990] drm/xe: Prevent VF memory IRQ from accessing a torn-down engine Greg Kroah-Hartman
` (511 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Greg Thelen, Pratyush Yadav (Google),
Pasha Tatashin, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Thelen <gthelen@google.com>
[ Upstream commit 58c5852ca96c58cdfdb9646870b217fc54d06a97 ]
is_kho_boot() is called early in boot before the linear memory map is
initialized, so calling phys_to_virt() via kho_get_fdt() there is
invalid.
On arm64 (and similarly in upcoming riscv64 support), this triggers
BUG_ONs in debug builds, such as:
kernel BUG at ./arch/arm64/include/asm/memory.h:377!
Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
Call trace:
is_kho_boot+0x2c/0x38 (P)
efi_init+0x94/0xf8
setup_arch+0xf0/0x240
start_kernel+0x84/0x490
__primary_switched+0x88/0x98
Use kho_in.fdt_phys in is_kho_boot() directly instead of translating it
to a virtual address.
Fixes: d6d511639185 ("kexec: introduce is_kho_boot()")
Signed-off-by: Greg Thelen <gthelen@google.com>
Reviewed-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Link: https://patch.msgid.link/20261023054518.3258350-1-gthelen@google.com
[Pasha: massaged the changelog]
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/liveupdate/kexec_handover.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index bedf88f3cefe5..e36f23286e7b8 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -1204,7 +1204,7 @@ static const void *kho_get_fdt(void)
*/
bool is_kho_boot(void)
{
- return !!kho_get_fdt();
+ return !!kho_in.fdt_phys;
}
EXPORT_SYMBOL_GPL(is_kho_boot);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 342/990] drm/xe: Prevent VF memory IRQ from accessing a torn-down engine
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (340 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 341/990] kho: check fdt_phys in is_kho_boot() Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 343/990] drm/xe/tuning: Restrict Anyhit NULL-query tuning to render engines Greg Kroah-Hartman
` (510 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Satyanarayana K V P, Matthew Brost,
Piotr Piórkowski, Dave Airlie, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
[ Upstream commit db58638d5d0531beafafa498cffa516779876ee5 ]
The VF memory IRQ handler iterates over HW engines whose names are set.
Engine teardown clears hwe->gt but leaves hwe->name set, so the handler
can select an engine whose GT has already been invalidated. This can
cause a NULL pointer dereference in xe_hw_engine_handle_irq().
Invalidate the engine name during teardown so subsequent engine scans
skip it.
Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Fixes: 6eb2aad402cc ("drm/xe: Move hw_engine_fini to devm managed")
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20261013152417.3189567-6-satyanarayana.k.v.p@intel.com
(cherry picked from commit f88c6f2fa88bc5892b1e842972096613086c06b2)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_hw_engine.c | 17 ++++++++++++++---
drivers/gpu/drm/xe/xe_irq.c | 3 +++
drivers/gpu/drm/xe/xe_memirq.c | 3 +++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
index 2cc8fe677decd..cf5e42dddacf1 100644
--- a/drivers/gpu/drm/xe/xe_hw_engine.c
+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
@@ -276,11 +276,22 @@ static const struct engine_info engine_infos[] = {
static void hw_engine_fini(void *arg)
{
struct xe_hw_engine *hwe = arg;
+ struct xe_gt *gt = hwe->gt;
+
+ if (gt) {
+ struct xe_device *xe = gt_to_xe(gt);
+ unsigned long flags;
- if (hwe->exl_port)
- xe_execlist_port_destroy(hwe->exl_port);
+ if (hwe->exl_port)
+ xe_execlist_port_destroy(hwe->exl_port);
- hwe->gt = NULL;
+ spin_lock_irqsave(&xe->irq.lock, flags);
+ hwe->name = NULL;
+ hwe->gt = NULL;
+ spin_unlock_irqrestore(&xe->irq.lock, flags);
+ } else {
+ hwe->name = NULL;
+ }
}
/**
diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index 06976cc779180..f49dfa208346f 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -855,6 +855,7 @@ static irqreturn_t xe_irq_msix_default_hwe_handler(int irq, void *arg)
struct xe_hw_engine *hwe;
enum xe_hw_engine_id id;
struct xe_tile *tile;
+ unsigned long flags;
struct xe_gt *gt;
if (!atomic_read(&xe->irq.enabled))
@@ -869,8 +870,10 @@ static irqreturn_t xe_irq_msix_default_hwe_handler(int irq, void *arg)
if (gt->tile != tile)
continue;
+ spin_lock_irqsave(&xe->irq.lock, flags);
for_each_hw_engine(hwe, gt, id)
xe_memirq_hwe_handler(memirq, hwe);
+ spin_unlock_irqrestore(&xe->irq.lock, flags);
}
}
diff --git a/drivers/gpu/drm/xe/xe_memirq.c b/drivers/gpu/drm/xe/xe_memirq.c
index 49c45ec3e83ca..da8a7feb56ece 100644
--- a/drivers/gpu/drm/xe/xe_memirq.c
+++ b/drivers/gpu/drm/xe/xe_memirq.c
@@ -473,6 +473,7 @@ void xe_memirq_handler(struct xe_memirq *memirq)
struct xe_hw_engine *hwe;
enum xe_hw_engine_id id;
struct iosys_map map;
+ unsigned long flags;
unsigned int gtid;
struct xe_gt *gt;
@@ -487,8 +488,10 @@ void xe_memirq_handler(struct xe_memirq *memirq)
if (gt->tile != tile)
continue;
+ spin_lock_irqsave(&xe->irq.lock, flags);
for_each_hw_engine(hwe, gt, id)
xe_memirq_hwe_handler(memirq, hwe);
+ spin_unlock_irqrestore(&xe->irq.lock, flags);
}
/* GuC and media GuC (if present) must be checked separately */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 343/990] drm/xe/tuning: Restrict Anyhit NULL-query tuning to render engines
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (341 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 342/990] drm/xe: Prevent VF memory IRQ from accessing a torn-down engine Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 344/990] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for pre-Xe2 Greg Kroah-Hartman
` (509 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matt Roper, Nitin Gote,
Matthew Brost, Dave Airlie, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nitin Gote <nitin.r.gote@intel.com>
[ Upstream commit ddef200c67d445f978f323d947c8993570ae4756 ]
The "Disable NULL query for Anyhit Shader" tuning uses
xe_rtp_match_first_render_or_compute to program RT_CTRL once per GT.
On a GT with no render (RCS) engine, that match falls back to a
compute (CCS) engine instead, so the tuning is still written even
though RT_CTRL's ray-tracing logic has no hardware behind it there.
A CRI compute-only GT hits exactly this path, causing
igt@xe_debugfs@check-gt-reg-sr to report a save-restore mismatch:
Mismatch on 0xe530, expected 0x400 got 0x0
Restrict the rule to ENGINE_CLASS(RENDER) so it only applies where
ray-tracing hardware is actually present. Every other in-tree platform
in this version range (BMG, LNL, PTL, NVL) always has a render engine,
which xe_rtp_match_first_render_or_compute already resolves ahead of
any compute engine, so this is a no-op for them.
Assisted-by: LLM
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
Fixes: 8d8431298f69 ("drm/xe/xe3: Disable null query for anyhit shader")
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20261012171901.19508-6-nitin.r.gote@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
(cherry picked from commit 65e2e108e466a2def170797a6d1b4b7849cec3a1)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_tuning.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_tuning.c b/drivers/gpu/drm/xe/xe_tuning.c
index a524170a04d02..84e99f6474e61 100644
--- a/drivers/gpu/drm/xe/xe_tuning.c
+++ b/drivers/gpu/drm/xe/xe_tuning.c
@@ -100,7 +100,7 @@ static const struct xe_rtp_entry_sr engine_tunings[] = {
},
{ XE_RTP_NAME("Tuning: Disable NULL query for Anyhit Shader"),
XE_RTP_RULES(GRAPHICS_VERSION_RANGE(2000, XE_RTP_END_VERSION_UNDEFINED),
- FUNC(xe_rtp_match_first_render_or_compute)),
+ ENGINE_CLASS(RENDER)),
XE_RTP_ACTIONS(SET(RT_CTRL, DIS_NULL_QUERY))
},
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 344/990] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for pre-Xe2
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (342 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 343/990] drm/xe/tuning: Restrict Anyhit NULL-query tuning to render engines Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 345/990] drm/xe: Fix build with DRM_XE=y and CONFIGFS_FS=m Greg Kroah-Hartman
` (508 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tvrtko Ursulin, Helen Koike,
Matt Roper, Rodrigo Vivi, Matthew Brost, Dave Airlie, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helen Koike <koike@igalia.com>
[ Upstream commit badac1974e098dba1a0a7f413e53f5b6ae24ab10 ]
CTX_CS_INDIRECT_CTX_OFFSET default value is not retrieved from the GPU
by inhibit+context save mechanism since it is not part of the Engine
Context. Thus, at restore, 0x0 is programmed back to the GPU, which is
an invalid value according to the PRM.
This causes sporadic hangs on Alder Lake when executing test
IntelAngleEnd2EndTestCases (error VK_DEVICE_LOST).
Fix it by partially reverting commit c9dfd66cb91e ("drm/xe/lrc: Allow
INDIRECT_CTX for more engine classes"). Re-add the programming of
CTX_CS_INDIRECT_CTX_OFFSET for pre-Xe2 (in theory it should apply to all
platforms, but we got an unexpected behaviour on Xe2 that still requires
investigation).
Fixes: c9dfd66cb91e ("drm/xe/lrc: Allow INDIRECT_CTX for more engine classes")
Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Helen Koike <koike@igalia.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20261016214112.1647202-1-koike@igalia.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit b99292acb2dce61ce50d37f54a66d84b768b8927)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 3 +++
drivers/gpu/drm/xe/xe_lrc.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
index b5eff383902c5..1b101edb838bf 100644
--- a/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
+++ b/drivers/gpu/drm/xe/regs/xe_lrc_layout.h
@@ -40,4 +40,7 @@
#define INDIRECT_CTX_RING_START_UDW (0x08 + 1)
#define INDIRECT_CTX_RING_CTL (0x0a + 1)
+#define CTX_INDIRECT_CTX_OFFSET_MASK REG_GENMASK(15, 6)
+#define CTX_INDIRECT_CTX_OFFSET_DEFAULT REG_FIELD_PREP(CTX_INDIRECT_CTX_OFFSET_MASK, 0xd)
+
#endif
diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
index 53eadea8ab38d..29a30e83f988c 100644
--- a/drivers/gpu/drm/xe/xe_lrc.c
+++ b/drivers/gpu/drm/xe/xe_lrc.c
@@ -1371,15 +1371,15 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe)
finish_bo(&state);
kfree(state.buffer);
- /*
- * Enable INDIRECT_CTX leaving INDIRECT_CTX_OFFSET at its default: it
- * varies per engine class, but the default is good enough
- */
xe_lrc_write_ctx_reg(lrc,
CTX_CS_INDIRECT_CTX,
(xe_bo_ggtt_addr(lrc->bo) + state.offset) |
/* Size in CLs. */
(state.written * sizeof(u32) / 64));
+ if (GRAPHICS_VER(lrc_to_xe(lrc)) < 20)
+ xe_lrc_write_ctx_reg(lrc,
+ CTX_CS_INDIRECT_CTX_OFFSET,
+ CTX_INDIRECT_CTX_OFFSET_DEFAULT);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 345/990] drm/xe: Fix build with DRM_XE=y and CONFIGFS_FS=m
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (343 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 344/990] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for pre-Xe2 Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 346/990] drm/xe/xe_survivability: Redesign survivability mode Greg Kroah-Hartman
` (507 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Matt Roper,
Rodrigo Vivi, Matthew Brost, Dave Airlie, 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 da475c094342b6d5c8bc020b19d6900130bed047 ]
When xe is built-in but configfs is a module, xe_configfs.o is not
linked into xe, while IS_ENABLED(CONFIG_CONFIGFS_FS) in xe_configfs.h
still exposes the real declarations, leading to undefined references.
Use IS_REACHABLE() so this case falls back to the stubs, the same as
CONFIGFS_FS=n.
Fixes: 16280ded45fb ("drm/xe: Add configfs to enable survivability mode")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610160935.Qk4ZxBxY-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202610162335.FEwMdGY9-lkp@intel.com/
Suggested-by: Matt Roper <matthew.d.roper@intel.com>
Assisted-by: LLM
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20261021194555.2171344-2-rodrigo.vivi@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 30499cbd796117b63be3b59a1781c25ea3f4b27f)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_configfs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
index 08cce375ae0f3..ba24c1839d378 100644
--- a/drivers/gpu/drm/xe/xe_configfs.h
+++ b/drivers/gpu/drm/xe/xe_configfs.h
@@ -12,7 +12,7 @@
struct pci_dev;
-#if IS_ENABLED(CONFIG_CONFIGFS_FS)
+#if IS_REACHABLE(CONFIG_CONFIGFS_FS)
int xe_configfs_init(void);
void xe_configfs_exit(void);
void xe_configfs_check_device(struct pci_dev *pdev);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 346/990] drm/xe/xe_survivability: Redesign survivability mode
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (344 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 345/990] drm/xe: Fix build with DRM_XE=y and CONFIGFS_FS=m Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 347/990] drm/xe/xe_survivability: Simplify runtime survivability error handling Greg Kroah-Hartman
` (506 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Riana Tauro, Rodrigo Vivi,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riana Tauro <riana.tauro@intel.com>
[ Upstream commit f4e9fc967afdb53b1203f894fb4b68451a7fe202 ]
Redesign survivability mode to have only one value per file.
1) Retain the survivability_mode sysfs to indicate the type
cat /sys/bus/pci/devices/0000\:03\:00.0/survivability_mode
(Boot / Runtime)
2) Add survivability_info directory to expose boot breadcrumbs.
Entries in survivability mode sysfs are only visible when
boot breadcrumb registers are populated.
/sys/bus/pci/devices/0000:03:00.0/survivability_info
├── aux_info0
├── aux_info1
├── aux_info2
├── aux_info3
├── aux_info4
├── capability_info
├── postcode_trace
└── postcode_trace_overflow
Capability Info:
Provides data about boot status and has bits that
indicate the support for the other breadcrumbs
Postcode Trace / Postcode Trace Overflow :
Each postcode is represented as an 8-bit value and represents
a boot failure event. When a new failure event is logged by Pcode
the existing postcodes are shifted left. These entries provide a
history of 8 postcodes.
Auxiliary Info:
Some failures have additional debug information.
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patch.msgid.link/20251208084539.3652902-5-riana.tauro@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Stable-dep-of: a890a885b982 ("drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_survivability_mode.c | 222 +++++++++++-------
.../gpu/drm/xe/xe_survivability_mode_types.h | 22 +-
2 files changed, 154 insertions(+), 90 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
index 1662bfddd4bc9..b6ff5da86a4df 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode.c
+++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
@@ -19,8 +19,6 @@
#include "xe_pcode_api.h"
#include "xe_vsec.h"
-#define MAX_SCRATCH_MMIO 8
-
/**
* DOC: Survivability Mode
*
@@ -48,19 +46,38 @@
*
* Refer :ref:`xe_configfs` for more details on how to use configfs
*
- * Survivability mode is indicated by the below admin-only readable sysfs which provides additional
- * debug information::
+ * Survivability mode is indicated by the below admin-only readable sysfs entry. It
+ * provides information about the type of survivability mode (Boot/Runtime).
+ *
+ * .. code-block:: shell
+ *
+ * # cat /sys/bus/pci/devices/<device>/survivability_mode
+ * Boot
+ *
+ *
+ * Any additional debug information if present will be visible under the directory
+ * ``survivability_info``::
+ *
+ * /sys/bus/pci/devices/<device>/survivability_info/
+ * ├── aux_info0
+ * ├── aux_info1
+ * ├── aux_info2
+ * ├── aux_info3
+ * ├── aux_info4
+ * ├── capability_info
+ * ├── fdo_mode
+ * ├── postcode_trace
+ * └── postcode_trace_overflow
+ *
+ * This directory has the following attributes
*
- * /sys/bus/pci/devices/<device>/survivability_mode
+ * - ``capability_info`` : Indicates Boot status and support for additional information
*
- * Capability Information:
- * Provides boot status
- * Postcode Information:
- * Provides information about the failure
- * Overflow Information
- * Provides history of previous failures
- * Auxiliary Information
- * Certain failures may have information in addition to postcode information
+ * - ``postcode_trace``, ``postcode_trace_overflow`` : Each postcode is a 8bit value and
+ * represents a boot failure event. When a new failure event is logged by PCODE the
+ * existing postcodes are shifted left. These entries provide a history of 8 postcodes.
+ *
+ * - ``aux_info<n>`` : Some failures have additional debug information
*
* Runtime Survivability
* =====================
@@ -68,60 +85,76 @@
* Certain runtime firmware errors can cause the device to enter a wedged state
* (:ref:`xe-device-wedging`) requiring a firmware flash to restore normal operation.
* Runtime Survivability Mode indicates that a firmware flash is necessary to recover the device and
- * is indicated by the presence of survivability mode sysfs::
+ * is indicated by the presence of survivability mode sysfs.
+ * Survivability mode sysfs provides information about the type of survivability mode.
*
- * /sys/bus/pci/devices/<device>/survivability_mode
+ * .. code-block:: shell
*
- * Survivability mode sysfs provides information about the type of survivability mode.
+ * # cat /sys/bus/pci/devices/<device>/survivability_mode
+ * Runtime
*
* When such errors occur, userspace is notified with the drm device wedged uevent and runtime
* survivability mode. User can then initiate a firmware flash using userspace tools like fwupd
* to restore device to normal operation.
*/
+static const char * const reg_map[] = {
+ [CAPABILITY_INFO] = "Capability Info",
+ [POSTCODE_TRACE] = "Postcode trace",
+ [POSTCODE_TRACE_OVERFLOW] = "Postcode trace overflow",
+ [AUX_INFO0] = "Auxiliary Info 0",
+ [AUX_INFO1] = "Auxiliary Info 1",
+ [AUX_INFO2] = "Auxiliary Info 2",
+ [AUX_INFO3] = "Auxiliary Info 3",
+ [AUX_INFO4] = "Auxiliary Info 4",
+};
+
+struct xe_survivability_attribute {
+ struct device_attribute attr;
+ u8 index;
+};
+
+static struct
+xe_survivability_attribute *dev_attr_to_survivability_attr(struct device_attribute *attr)
+{
+ return container_of(attr, struct xe_survivability_attribute, attr);
+}
+
static u32 aux_history_offset(u32 reg_value)
{
return REG_FIELD_GET(AUXINFO_HISTORY_OFFSET, reg_value);
}
-static void set_survivability_info(struct xe_mmio *mmio, struct xe_survivability_info *info,
- int id, char *name)
+static void set_survivability_info(struct xe_mmio *mmio, u32 *info, int id)
{
- strscpy(info[id].name, name, sizeof(info[id].name));
- info[id].reg = PCODE_SCRATCH(id).raw;
- info[id].value = xe_mmio_read32(mmio, PCODE_SCRATCH(id));
+ info[id] = xe_mmio_read32(mmio, PCODE_SCRATCH(id));
}
static void populate_survivability_info(struct xe_device *xe)
{
struct xe_survivability *survivability = &xe->survivability;
- struct xe_survivability_info *info = survivability->info;
+ u32 *info = survivability->info;
struct xe_mmio *mmio;
u32 id = 0, reg_value;
- char name[NAME_MAX];
int index;
mmio = xe_root_tile_mmio(xe);
- set_survivability_info(mmio, info, id, "Capability Info");
- reg_value = info[id].value;
+ set_survivability_info(mmio, info, CAPABILITY_INFO);
+ reg_value = info[CAPABILITY_INFO];
if (reg_value & HISTORY_TRACKING) {
- id++;
- set_survivability_info(mmio, info, id, "Postcode Info");
+ set_survivability_info(mmio, info, POSTCODE_TRACE);
- if (reg_value & OVERFLOW_SUPPORT) {
- id = REG_FIELD_GET(OVERFLOW_REG_OFFSET, reg_value);
- set_survivability_info(mmio, info, id, "Overflow Info");
- }
+ if (reg_value & OVERFLOW_SUPPORT)
+ set_survivability_info(mmio, info, POSTCODE_TRACE_OVERFLOW);
}
if (reg_value & AUXINFO_SUPPORT) {
id = REG_FIELD_GET(AUXINFO_REG_OFFSET, reg_value);
- for (index = 0; id && reg_value; index++, reg_value = info[id].value,
- id = aux_history_offset(reg_value)) {
- snprintf(name, NAME_MAX, "Auxiliary Info %d", index);
- set_survivability_info(mmio, info, id, name);
+ for (index = 0; id >= AUX_INFO0 && id < MAX_SCRATCH_REG; index++) {
+ set_survivability_info(mmio, info, id);
+ id = aux_history_offset(info[id]);
}
}
}
@@ -130,15 +163,14 @@ static void log_survivability_info(struct pci_dev *pdev)
{
struct xe_device *xe = pdev_to_xe_device(pdev);
struct xe_survivability *survivability = &xe->survivability;
- struct xe_survivability_info *info = survivability->info;
+ u32 *info = survivability->info;
int id;
dev_info(&pdev->dev, "Survivability Boot Status : Critical Failure (%d)\n",
survivability->boot_status);
- for (id = 0; id < MAX_SCRATCH_MMIO; id++) {
- if (info[id].reg)
- dev_info(&pdev->dev, "%s: 0x%x - 0x%x\n", info[id].name,
- info[id].reg, info[id].value);
+ for (id = 0; id < MAX_SCRATCH_REG; id++) {
+ if (info[id])
+ dev_info(&pdev->dev, "%s: 0x%x\n", reg_map[id], info[id]);
}
}
@@ -156,25 +188,38 @@ static ssize_t survivability_mode_show(struct device *dev,
struct pci_dev *pdev = to_pci_dev(dev);
struct xe_device *xe = pdev_to_xe_device(pdev);
struct xe_survivability *survivability = &xe->survivability;
- struct xe_survivability_info *info = survivability->info;
- int index = 0, count = 0;
- count += sysfs_emit_at(buff, count, "Survivability mode type: %s\n",
- survivability->type ? "Runtime" : "Boot");
+ return sysfs_emit(buff, "%s\n", survivability->type ? "Runtime" : "Boot");
+}
- if (!check_boot_failure(xe))
- return count;
+static DEVICE_ATTR_ADMIN_RO(survivability_mode);
- for (index = 0; index < MAX_SCRATCH_MMIO; index++) {
- if (info[index].reg)
- count += sysfs_emit_at(buff, count, "%s: 0x%x - 0x%x\n", info[index].name,
- info[index].reg, info[index].value);
- }
+static ssize_t survivability_info_show(struct device *dev,
+ struct device_attribute *attr, char *buff)
+{
+ struct xe_survivability_attribute *sa = dev_attr_to_survivability_attr(attr);
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct xe_device *xe = pdev_to_xe_device(pdev);
+ struct xe_survivability *survivability = &xe->survivability;
+ u32 *info = survivability->info;
- return count;
+ return sysfs_emit(buff, "0x%x\n", info[sa->index]);
}
-static DEVICE_ATTR_ADMIN_RO(survivability_mode);
+#define SURVIVABILITY_ATTR_RO(name, _index) \
+ struct xe_survivability_attribute attr_##name = { \
+ .attr = __ATTR(name, 0400, survivability_info_show, NULL), \
+ .index = _index, \
+ }
+
+SURVIVABILITY_ATTR_RO(capability_info, CAPABILITY_INFO);
+SURVIVABILITY_ATTR_RO(postcode_trace, POSTCODE_TRACE);
+SURVIVABILITY_ATTR_RO(postcode_trace_overflow, POSTCODE_TRACE_OVERFLOW);
+SURVIVABILITY_ATTR_RO(aux_info0, AUX_INFO0);
+SURVIVABILITY_ATTR_RO(aux_info1, AUX_INFO1);
+SURVIVABILITY_ATTR_RO(aux_info2, AUX_INFO2);
+SURVIVABILITY_ATTR_RO(aux_info3, AUX_INFO3);
+SURVIVABILITY_ATTR_RO(aux_info4, AUX_INFO4);
static void xe_survivability_mode_fini(void *arg)
{
@@ -182,17 +227,48 @@ static void xe_survivability_mode_fini(void *arg)
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
struct device *dev = &pdev->dev;
- sysfs_remove_file(&dev->kobj, &dev_attr_survivability_mode.attr);
+ device_remove_file(dev, &dev_attr_survivability_mode);
}
+static umode_t survivability_info_attrs_visible(struct kobject *kobj, struct attribute *attr,
+ int idx)
+{
+ struct xe_device *xe = kdev_to_xe_device(kobj_to_dev(kobj));
+ struct xe_survivability *survivability = &xe->survivability;
+ u32 *info = survivability->info;
+
+ if (info[idx])
+ return 0400;
+
+ return 0;
+}
+
+/* Attributes are ordered according to enum scratch_reg */
+static struct attribute *survivability_info_attrs[] = {
+ &attr_capability_info.attr.attr,
+ &attr_postcode_trace.attr.attr,
+ &attr_postcode_trace_overflow.attr.attr,
+ &attr_aux_info0.attr.attr,
+ &attr_aux_info1.attr.attr,
+ &attr_aux_info2.attr.attr,
+ &attr_aux_info3.attr.attr,
+ &attr_aux_info4.attr.attr,
+ NULL,
+};
+
+static const struct attribute_group survivability_info_group = {
+ .name = "survivability_info",
+ .attrs = survivability_info_attrs,
+ .is_visible = survivability_info_attrs_visible,
+};
+
static int create_survivability_sysfs(struct pci_dev *pdev)
{
struct device *dev = &pdev->dev;
struct xe_device *xe = pdev_to_xe_device(pdev);
int ret;
- /* create survivability mode sysfs */
- ret = sysfs_create_file(&dev->kobj, &dev_attr_survivability_mode.attr);
+ ret = device_create_file(dev, &dev_attr_survivability_mode);
if (ret) {
dev_warn(dev, "Failed to create survivability sysfs files\n");
return ret;
@@ -203,6 +279,12 @@ static int create_survivability_sysfs(struct pci_dev *pdev)
if (ret)
return ret;
+ if (check_boot_failure(xe)) {
+ ret = devm_device_add_group(dev, &survivability_info_group);
+ if (ret)
+ return ret;
+ }
+
return 0;
}
@@ -239,25 +321,6 @@ static int enable_boot_survivability_mode(struct pci_dev *pdev)
return ret;
}
-static int init_survivability_mode(struct xe_device *xe)
-{
- struct xe_survivability *survivability = &xe->survivability;
- struct xe_survivability_info *info;
-
- survivability->size = MAX_SCRATCH_MMIO;
-
- info = devm_kcalloc(xe->drm.dev, survivability->size, sizeof(*info),
- GFP_KERNEL);
- if (!info)
- return -ENOMEM;
-
- survivability->info = info;
-
- populate_survivability_info(xe);
-
- return 0;
-}
-
/**
* xe_survivability_mode_is_boot_enabled- check if boot survivability mode is enabled
* @xe: xe device instance
@@ -325,9 +388,7 @@ int xe_survivability_mode_runtime_enable(struct xe_device *xe)
return -EINVAL;
}
- ret = init_survivability_mode(xe);
- if (ret)
- return ret;
+ populate_survivability_info(xe);
ret = create_survivability_sysfs(pdev);
if (ret)
@@ -356,14 +417,11 @@ int xe_survivability_mode_boot_enable(struct xe_device *xe)
{
struct xe_survivability *survivability = &xe->survivability;
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
- int ret;
if (!xe_survivability_mode_is_requested(xe))
return 0;
- ret = init_survivability_mode(xe);
- if (ret)
- return ret;
+ populate_survivability_info(xe);
/* Log breadcrumbs but do not enter survivability mode for Critical boot errors */
if (survivability->boot_status == CRITICAL_FAILURE) {
diff --git a/drivers/gpu/drm/xe/xe_survivability_mode_types.h b/drivers/gpu/drm/xe/xe_survivability_mode_types.h
index cd65a5d167c9c..f31b3907d9331 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode_types.h
+++ b/drivers/gpu/drm/xe/xe_survivability_mode_types.h
@@ -9,23 +9,29 @@
#include <linux/limits.h>
#include <linux/types.h>
+enum scratch_reg {
+ CAPABILITY_INFO,
+ POSTCODE_TRACE,
+ POSTCODE_TRACE_OVERFLOW,
+ AUX_INFO0,
+ AUX_INFO1,
+ AUX_INFO2,
+ AUX_INFO3,
+ AUX_INFO4,
+ MAX_SCRATCH_REG,
+};
+
enum xe_survivability_type {
XE_SURVIVABILITY_TYPE_BOOT,
XE_SURVIVABILITY_TYPE_RUNTIME,
};
-struct xe_survivability_info {
- char name[NAME_MAX];
- u32 reg;
- u32 value;
-};
-
/**
* struct xe_survivability: Contains survivability mode information
*/
struct xe_survivability {
- /** @info: struct that holds survivability info from scratch registers */
- struct xe_survivability_info *info;
+ /** @info: survivability debug info */
+ u32 info[MAX_SCRATCH_REG];
/** @size: number of scratch registers */
u32 size;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 347/990] drm/xe/xe_survivability: Simplify runtime survivability error handling
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (345 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 346/990] drm/xe/xe_survivability: Redesign survivability mode Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 348/990] drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM Greg Kroah-Hartman
` (505 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mallesh Koujalagi, Raag Jadav,
Rodrigo Vivi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
[ Upstream commit 2b8c1d7fe0d521f9d264ef08c15760235e61c341 ]
xe_survivability_mode_runtime_enable() returns an int, but its caller
csc_hw_error_work() ignores the return value and cannot take any
meaningful recovery action on failure. The function logs errors via
dev_err() and proceeds to declare the device wedged regardless of
sysfs creation failure, making the return value redundant.
Change the return type to void and remove the unnecessary
error handling in the caller.
v2:
- Return is not require after the sysfs creation fail. (Rodrigo/Riana)
- Change int to void return type. (Rodrigo)
- Remove extra message from csc_hw_error_work().
v3:
- Remove ret variable. (Raag)
v4:
- Drop ret variable from other part of code.
v5:
- Reframe as refactoring instead of bug fix. (Raag)
- Remove Fixes tag and update subject line.
Signed-off-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Link: https://patch.msgid.link/20260504110300.1467303-2-mallesh.koujalagi@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Stable-dep-of: a890a885b982 ("drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_hw_error.c | 5 +----
drivers/gpu/drm/xe/xe_survivability_mode.c | 14 ++++----------
drivers/gpu/drm/xe/xe_survivability_mode.h | 2 +-
3 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c
index 8c65291f36fc0..3c105269e6fa8 100644
--- a/drivers/gpu/drm/xe/xe_hw_error.c
+++ b/drivers/gpu/drm/xe/xe_hw_error.c
@@ -55,11 +55,8 @@ static void csc_hw_error_work(struct work_struct *work)
{
struct xe_tile *tile = container_of(work, typeof(*tile), csc_hw_error_work);
struct xe_device *xe = tile_to_xe(tile);
- int ret;
- ret = xe_survivability_mode_runtime_enable(xe);
- if (ret)
- drm_err(&xe->drm, "Failed to enable runtime survivability mode\n");
+ xe_survivability_mode_runtime_enable(xe);
}
static void csc_hw_error_handler(struct xe_tile *tile, const enum hardware_error hw_err)
diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
index b6ff5da86a4df..ee4225d57972b 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode.c
+++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
@@ -374,25 +374,21 @@ bool xe_survivability_mode_is_requested(struct xe_device *xe)
* Runtime survivability mode is enabled when certain errors cause the device to be
* in non-recoverable state. The device is declared wedged with the appropriate
* recovery method and survivability mode sysfs exposed to userspace
- *
- * Return: 0 if runtime survivability mode is enabled, negative error code otherwise.
*/
-int xe_survivability_mode_runtime_enable(struct xe_device *xe)
+void xe_survivability_mode_runtime_enable(struct xe_device *xe)
{
struct xe_survivability *survivability = &xe->survivability;
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
- int ret;
if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform < XE_BATTLEMAGE) {
dev_err(&pdev->dev, "Runtime Survivability Mode not supported\n");
- return -EINVAL;
+ return;
}
populate_survivability_info(xe);
- ret = create_survivability_sysfs(pdev);
- if (ret)
- dev_err(&pdev->dev, "Failed to create survivability mode sysfs\n");
+ if (create_survivability_sysfs(pdev))
+ dev_err(&pdev->dev, "Failed to create survivability sysfs\n");
survivability->type = XE_SURVIVABILITY_TYPE_RUNTIME;
dev_err(&pdev->dev, "Runtime Survivability mode enabled\n");
@@ -400,8 +396,6 @@ int xe_survivability_mode_runtime_enable(struct xe_device *xe)
xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_VENDOR);
xe_device_declare_wedged(xe);
dev_err(&pdev->dev, "Firmware flash required, Please refer to the userspace documentation for more details!\n");
-
- return 0;
}
/**
diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.h b/drivers/gpu/drm/xe/xe_survivability_mode.h
index 1cc94226aa82d..cd040e4d18bb8 100644
--- a/drivers/gpu/drm/xe/xe_survivability_mode.h
+++ b/drivers/gpu/drm/xe/xe_survivability_mode.h
@@ -11,7 +11,7 @@
struct xe_device;
int xe_survivability_mode_boot_enable(struct xe_device *xe);
-int xe_survivability_mode_runtime_enable(struct xe_device *xe);
+void xe_survivability_mode_runtime_enable(struct xe_device *xe);
bool xe_survivability_mode_is_boot_enabled(struct xe_device *xe);
bool xe_survivability_mode_is_requested(struct xe_device *xe);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 348/990] drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (346 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 347/990] drm/xe/xe_survivability: Simplify runtime survivability error handling Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 349/990] drm/xe: Rebind BOs evicted before the first LR queue Greg Kroah-Hartman
` (504 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Raag Jadav, Riana Tauro, Matt Roper,
Matthew Brost, Dave Airlie, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raag Jadav <raag.jadav@intel.com>
[ Upstream commit a890a885b982f73e6e984e828ffda06b5121c4b6 ]
xe_device_declare_wedged() callers are expected to hold a runtime PM
reference. Fix it.
Fixes: a7df563b45b0 ("drm/xe/xe_hw_error: Handle CSC Firmware reported Hardware errors")
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Link: https://patch.msgid.link/20261022051303.282805-4-raag.jadav@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
(cherry picked from commit fc8d229d76102489b6f56538a818c285a87db1e9)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_hw_error.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c
index 3c105269e6fa8..0cf3c6d7b3731 100644
--- a/drivers/gpu/drm/xe/xe_hw_error.c
+++ b/drivers/gpu/drm/xe/xe_hw_error.c
@@ -12,6 +12,7 @@
#include "xe_device.h"
#include "xe_hw_error.h"
#include "xe_mmio.h"
+#include "xe_pm.h"
#include "xe_survivability_mode.h"
#define HEC_UNCORR_FW_ERR_BITS 4
@@ -56,6 +57,7 @@ static void csc_hw_error_work(struct work_struct *work)
struct xe_tile *tile = container_of(work, typeof(*tile), csc_hw_error_work);
struct xe_device *xe = tile_to_xe(tile);
+ guard(xe_pm_runtime)(xe);
xe_survivability_mode_runtime_enable(xe);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 349/990] drm/xe: Rebind BOs evicted before the first LR queue
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (347 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 348/990] drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 350/990] drm/xe: Toggle the D3Cold enable flag at runtime resume Greg Kroah-Hartman
` (503 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthew Brost, Thomas Hellström,
Himal Prasad Ghimiray, Arvind Yadav, Tejas Upadhyay, Dave Airlie,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <arvind.yadav@intel.com>
[ Upstream commit b52dcc698250e08eabdc4554a6fdb4d6f909133f ]
A VM bind can evict BOs before the first LR exec queue is added.
There is no preempt fence to trigger at that point.
When the queue is added later, its new preempt fence is not triggered.
The exec IOCTL does not validate or rebind BOs in preempt fence mode,
and the rebind worker skips that work because no preempt fence is
waiting. The first exec can then use stale mappings.
Trigger the new preempt fence in xe_vm_add_compute_exec_queue() when
the VM has evicted BOs or pending rebinds. This keeps the queue
suspended until the rebind worker validates the BOs and restores
their mappings.
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
Link: https://patch.msgid.link/20261015162639.3528278-1-arvind.yadav@intel.com
Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
(cherry picked from commit 928ee5d4fb1f211aa361524801c15b54603fae52)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_vm.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 94a62b4256b42..b6d6608758797 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -258,8 +258,15 @@ int xe_vm_add_compute_exec_queue(struct xe_vm *vm, struct xe_exec_queue *q)
* Check to see if a preemption on VM is in flight or userptr
* invalidation, if so trigger this preempt fence to sync state with
* other preempt fences on the VM.
+ *
+ * Also trigger it if eviction or rebinding is pending. BOs evicted
+ * before the first exec queue was added had no preempt fence to
+ * trigger. Suspend this queue until the rebind worker restores
+ * the mappings.
*/
- wait = __xe_vm_userptr_needs_repin(vm) || preempt_fences_waiting(vm);
+ wait = __xe_vm_userptr_needs_repin(vm) || preempt_fences_waiting(vm) ||
+ !list_empty(&vm->gpuvm.evict.list) ||
+ !list_empty(&vm->rebind_list);
if (wait)
dma_fence_enable_sw_signaling(pfence);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 350/990] drm/xe: Toggle the D3Cold enable flag at runtime resume
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (348 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 349/990] drm/xe: Rebind BOs evicted before the first LR queue Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 351/990] drm/xe/xe_late_bind_fw: Fix firmware leak on missing manifest entry Greg Kroah-Hartman
` (502 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Matthew Auld, Karthik Poosa,
Vinay Belgaumkar, Matthew Brost, Dave Airlie, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
[ Upstream commit e42459b16cbf1cbcebfc1ab406140cca204fd831 ]
We enable this flag during runtime suspend, need to set it back to
false early during resume to maintain consistency in pci driver's
internal state. d3cold_toggle() updates the root port's ability
to go into d3cold via the dev->no_d3cold flag. With this patch, we
are ensuring this internal state remains consistent with that of
the endpoint.
v2: Clarify the commit message (Matt Auld)
v3: Add fixes (Karthik Poosa)
Fixes: f026520367be ("drm/xe: Only set PCI d3cold_allowed when we are really allowing.")
Cc: Matthew Auld <matthew.auld@intel.com>
Acked-by: Karthik Poosa <karthik.poosa@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Reviewed-by: Karthik Poosa <karthik.poosa@intel.com>
Link: https://patch.msgid.link/20261027174351.619929-6-vinay.belgaumkar@intel.com
(cherry picked from commit e994e0f1ba52e4be3607ba7f952a8d835f1f6563)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 10c5d852cf2b9..75334fc1ac66a 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -1057,6 +1057,9 @@ static int xe_pci_runtime_resume(struct device *dev)
struct xe_device *xe = pdev_to_xe_device(pdev);
int err;
+ if (xe->d3cold.allowed)
+ d3cold_toggle(pdev, D3COLD_DISABLE);
+
err = pci_set_power_state(pdev, PCI_D0);
if (err)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 351/990] drm/xe/xe_late_bind_fw: Fix firmware leak on missing manifest entry
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (349 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 350/990] drm/xe: Toggle the D3Cold enable flag at runtime resume Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 352/990] gpiolib: fix GPIO descriptor leak in gpiod_get_array() Greg Kroah-Hartman
` (501 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniele Ceraolo Spurio,
Badal Nilawar, Matthew Brost, Dave Airlie, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Badal Nilawar <badal.nilawar@intel.com>
[ Upstream commit 74f1a6f03f2d46537f929a1b13f7dcd378437a4d ]
Release firmware when the "LTES" manifest entry is not found in the
firmware header.
Fixes: efa29317a553 ("drm/xe/xe_late_bind_fw: Extract and print version info")
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patch.msgid.link/20261102172527.2794537-9-badal.nilawar@intel.com
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
(cherry picked from commit 3e4b2a6349ed7258057fa95a1e58730615703dae)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_late_bind_fw.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_late_bind_fw.c b/drivers/gpu/drm/xe/xe_late_bind_fw.c
index 768442ca7da6d..1bddfaf0fb9f0 100644
--- a/drivers/gpu/drm/xe/xe_late_bind_fw.c
+++ b/drivers/gpu/drm/xe/xe_late_bind_fw.c
@@ -335,19 +335,19 @@ static int __xe_late_bind_fw_init(struct xe_late_bind *late_bind, u32 fw_id)
if (fw->size > XE_LB_MAX_PAYLOAD_SIZE) {
drm_err(&xe->drm, "Firmware %s size %zu is larger than max pay load size %u\n",
lb_fw->blob_path, fw->size, XE_LB_MAX_PAYLOAD_SIZE);
- release_firmware(fw);
- return -ENODATA;
+ ret = -ENODATA;
+ goto release_fw;
}
ret = parse_lb_layout(lb_fw, fw->data, fw->size, "LTES");
if (ret)
- return ret;
+ goto release_fw;
lb_fw->payload_size = fw->size;
lb_fw->payload = drmm_kzalloc(&xe->drm, lb_fw->payload_size, GFP_KERNEL);
if (!lb_fw->payload) {
- release_firmware(fw);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto release_fw;
}
drm_info(&xe->drm, "Using %s firmware from %s version %u.%u.%u.%u\n",
@@ -356,10 +356,11 @@ static int __xe_late_bind_fw_init(struct xe_late_bind *late_bind, u32 fw_id)
lb_fw->version.hotfix, lb_fw->version.build);
memcpy((void *)lb_fw->payload, fw->data, lb_fw->payload_size);
- release_firmware(fw);
INIT_WORK(&lb_fw->work, xe_late_bind_work);
- return 0;
+release_fw:
+ release_firmware(fw);
+ return ret;
}
static int xe_late_bind_fw_init(struct xe_late_bind *late_bind)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 352/990] gpiolib: fix GPIO descriptor leak in gpiod_get_array()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (350 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 351/990] drm/xe/xe_late_bind_fw: Fix firmware leak on missing manifest entry Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 353/990] gpiolib: fix fast-path cancellation " Greg Kroah-Hartman
` (500 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andy Shevchenko, Dmitry Torokhov,
Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ Upstream commit b2a161687acdc297aa91fec7fa0966b5aecf0d16 ]
In gpiod_get_array(), descs->ndescs is used as the loop induction
variable and is only incremented at the end of each iteration. When
krealloc() fails on the first iteration (when index is 0),
descs->desc[0] has already been acquired via gpiod_get_index(), but
descs->ndescs is still 0. Consequently, gpiod_put_array() frees descs
without releasing descs->desc[0], leaking the descriptor.
Fix this by using a dedicated loop induction variable and incrementing
descs->ndescs immediately upon storing the retrieved descriptor.
Additionally, since the fast-path array_info setup only executes for the
first element (index 0), simplify the bitmap_set() calls to start at bit
0 for count bits instead of calculating offsets from the loop index.
Fixes: bf9346f5d47b ("gpiolib: Identify arrays matching GPIO hardware")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/20261105-b4-gpiolib-free-v3-1-bb47ad58642d@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib.c | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index fa2ab0f90dbda..af33ff0778cb9 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -5042,21 +5042,21 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
if (!descs)
return ERR_PTR(-ENOMEM);
- for (descs->ndescs = 0; descs->ndescs < count; descs->ndescs++) {
- desc = gpiod_get_index(dev, con_id, descs->ndescs, flags);
+ for (int i = 0; i < count; i++) {
+ desc = gpiod_get_index(dev, con_id, i, flags);
if (IS_ERR(desc)) {
gpiod_put_array(descs);
return ERR_CAST(desc);
}
- descs->desc[descs->ndescs] = desc;
+ descs->desc[descs->ndescs++] = desc;
gdev = gpiod_to_gpio_device(desc);
/*
* If pin hardware number of array member 0 is also 0, select
* its chip as a candidate for fast bitmap processing path.
*/
- if (descs->ndescs == 0 && gpiod_hwgpio(desc) == 0) {
+ if (i == 0 && gpiod_hwgpio(desc) == 0) {
struct gpio_descs *array;
bitmap_size = BITS_TO_LONGS(gdev->ngpio > count ?
@@ -5081,10 +5081,8 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
array_info->desc = descs->desc;
array_info->size = count;
array_info->gdev = gdev;
- bitmap_set(array_info->get_mask, descs->ndescs,
- count - descs->ndescs);
- bitmap_set(array_info->set_mask, descs->ndescs,
- count - descs->ndescs);
+ bitmap_set(array_info->get_mask, 0, count);
+ bitmap_set(array_info->set_mask, 0, count);
descs->info = array_info;
}
@@ -5094,38 +5092,34 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
/* Unmark array members which don't belong to the 'fast' chip */
if (array_info->gdev != gdev) {
- __clear_bit(descs->ndescs, array_info->get_mask);
- __clear_bit(descs->ndescs, array_info->set_mask);
+ __clear_bit(i, array_info->get_mask);
+ __clear_bit(i, array_info->set_mask);
}
/*
* Detect array members which belong to the 'fast' chip
* but their pins are not in hardware order.
*/
- else if (gpiod_hwgpio(desc) != descs->ndescs) {
+ else if (gpiod_hwgpio(desc) != i) {
/*
* Don't use fast path if all array members processed so
* far belong to the same chip as this one but its pin
* hardware number is different from its array index.
*/
- if (bitmap_full(array_info->get_mask, descs->ndescs)) {
+ if (bitmap_full(array_info->get_mask, i)) {
array_info = NULL;
} else {
- __clear_bit(descs->ndescs,
- array_info->get_mask);
- __clear_bit(descs->ndescs,
- array_info->set_mask);
+ __clear_bit(i, array_info->get_mask);
+ __clear_bit(i, array_info->set_mask);
}
} else {
dflags = READ_ONCE(desc->flags);
/* Exclude open drain or open source from fast output */
if (test_bit(GPIOD_FLAG_OPEN_DRAIN, &dflags) ||
test_bit(GPIOD_FLAG_OPEN_SOURCE, &dflags))
- __clear_bit(descs->ndescs,
- array_info->set_mask);
+ __clear_bit(i, array_info->set_mask);
/* Identify 'fast' pins which require invertion */
if (gpiod_is_active_low(desc))
- __set_bit(descs->ndescs,
- array_info->invert_mask);
+ __set_bit(i, array_info->invert_mask);
}
}
if (array_info)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 353/990] gpiolib: fix fast-path cancellation in gpiod_get_array()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (351 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 352/990] gpiolib: fix GPIO descriptor leak in gpiod_get_array() Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 354/990] gpiolib: of: return -ENOENT from of_gpio_count() stub Greg Kroah-Hartman
` (499 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andy Shevchenko, Dmitry Torokhov,
Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ Upstream commit 51c85306270972f672737dc5e28332e2b41b26f1 ]
In gpiod_get_array(), when a pin on the same chip is not in hardware
order and the preceding pins form a contiguous block, the fast path is
cancelled by setting array_info to NULL. However, descs->info was
already populated with the array_info pointer during the first
iteration, leaving descs->info pointing to the aborted array_info.
Consequently, subsequent array operations still use the fast path with
remaining bits set in the masks and wrong hardware pin numbers.
Clear descs->info alongside array_info when cancelling the fast path so
callers do not erroneously use the aborted array_info.
Fixes: c4c958aa64f3 ("gpiolib: Fix array members of same chip processed separately")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/20261105-b4-gpiolib-free-v3-2-bb47ad58642d@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index af33ff0778cb9..a41219961778d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -5106,6 +5106,7 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
* hardware number is different from its array index.
*/
if (bitmap_full(array_info->get_mask, i)) {
+ descs->info = NULL;
array_info = NULL;
} else {
__clear_bit(i, array_info->get_mask);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 354/990] gpiolib: of: return -ENOENT from of_gpio_count() stub
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (352 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 353/990] gpiolib: fix fast-path cancellation " Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 355/990] ASoC: soc-core: copy the DAI link names into the card Greg Kroah-Hartman
` (498 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andy Shevchenko, Dmitry Torokhov,
Bartosz Golaszewski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[ Upstream commit e20e4b8cda2b4d7dd32dbd2c0875a15d92545f04 ]
gpiod_count() and its firmware backends are expected to return either a
positive number of GPIOs or a negative error code (-ENOENT) when no
GPIOs are assigned. However, the !CONFIG_OF_GPIO stub for
of_gpio_count() returns 0 instead of -ENOENT. This causes gpiod_count()
to skip the platform_gpio_count() fallback (which triggers when
count < 0) and erroneously return 0 to callers.
Change the stub to return -ENOENT to match the real of_gpio_count()
implementation and the other error-returning stubs in gpiolib-of.h.
Fixes: f626d6dfb709 ("gpio: of: Break out OF-only code")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/20261105-b4-gpiolib-free-v3-3-bb47ad58642d@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpio/gpiolib-of.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-of.h b/drivers/gpio/gpiolib-of.h
index 2257f7a498a10..4778b46256bb9 100644
--- a/drivers/gpio/gpiolib-of.h
+++ b/drivers/gpio/gpiolib-of.h
@@ -42,7 +42,7 @@ static inline bool of_gpiochip_instance_match(struct gpio_chip *gc,
static inline int of_gpio_count(const struct fwnode_handle *fwnode,
const char *con_id)
{
- return 0;
+ return -ENOENT;
}
#endif /* CONFIG_OF_GPIO */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 355/990] ASoC: soc-core: copy the DAI link names into the card
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (353 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 354/990] gpiolib: of: return -ENOENT from of_gpio_count() stub Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 356/990] ASoC: qcom: sdw: remove redundant code Greg Kroah-Hartman
` (497 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tyler Baker, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Baker <tyler.baker@oss.qualcomm.com>
[ Upstream commit 33a130f6ed8c75ed59b12889a417a57fb80d0abf ]
snd_soc_of_get_dai_link_codecs() and snd_soc_of_get_dai_link_cpus()
keep a DAI name owned by the component, which is freed when the
component unbinds, so the card cannot bind again afterwards.
Copy the name onto the card device, as simple-card and audio-graph-card
do since commit aa173b70d372 ("ASoC: generic: keep fallback dai_name
stable across rebind").
Fixes: e894efef9ac7 ("ASoC: core: add support to card rebind")
Fixes: 900dedd7e47c ("ASoC: Introduce snd_soc_of_get_dai_link_cpus")
Signed-off-by: Tyler Baker <tyler.baker@oss.qualcomm.com>
Link: https://patch.msgid.link/20261106054333.2748248-2-tyler.baker@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/soc-core.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index feecf3e4e38b4..34f350b75b18c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3701,6 +3701,18 @@ void snd_soc_of_put_dai_link_codecs(struct snd_soc_dai_link *dai_link)
}
EXPORT_SYMBOL_GPL(snd_soc_of_put_dai_link_codecs);
+/* dai_name belongs to the component, which can unbind before the card. */
+static int snd_soc_of_dup_dai_name(struct device *dev,
+ struct snd_soc_dai_link_component *dlc)
+{
+ if (!dlc->dai_name)
+ return 0;
+
+ dlc->dai_name = devm_kstrdup_const(dev, dlc->dai_name, GFP_KERNEL);
+
+ return dlc->dai_name ? 0 : -ENOMEM;
+}
+
/*
* snd_soc_of_get_dai_link_codecs - Parse a list of CODECs in the devicetree
* @dev: Card device
@@ -3730,6 +3742,8 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev,
/* Parse the list */
for_each_link_codecs(dai_link, index, component) {
ret = snd_soc_of_get_dlc(of_node, NULL, component, index);
+ if (!ret)
+ ret = snd_soc_of_dup_dai_name(dev, component);
if (ret)
goto err;
}
@@ -3785,6 +3799,8 @@ int snd_soc_of_get_dai_link_cpus(struct device *dev,
/* Parse the list */
for_each_link_cpus(dai_link, index, component) {
ret = snd_soc_of_get_dlc(of_node, NULL, component, index);
+ if (!ret)
+ ret = snd_soc_of_dup_dai_name(dev, component);
if (ret)
goto err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 356/990] ASoC: qcom: sdw: remove redundant code
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (354 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 355/990] ASoC: soc-core: copy the DAI link names into the card Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 357/990] ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids Greg Kroah-Hartman
` (496 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Srinivas Kandagatla, Mark Brown,
Sasha Levin, Steev Klimaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
[ Upstream commit d02460317ed9c95aa2c5f6ff1c70e22e1857d95d ]
remove redundant code and pointers to handle sdw_stream_runtime by
making use of qcom_snd_sdw_get_stream(). This removes need of machine
specific shutdown and hw_params sdw callbacks and also need to store
sdw_stream_runtime pointers in machine drivers.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Tested-by: Steev Klimaszewski <threeway@gmail.com> # Thinkpad X13s
Link: https://patch.msgid.link/20251022143349.1081513-3-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 704251f9dad3 ("ASoC: qcom: x1e80100: recreate the headset jack on card rebind")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/qcom/sc8280xp.c | 33 +++------------------------------
sound/soc/qcom/sdw.c | 24 ++++++++++++------------
sound/soc/qcom/sdw.h | 6 +-----
sound/soc/qcom/sm8250.c | 33 +++------------------------------
sound/soc/qcom/x1e80100.c | 33 +++------------------------------
5 files changed, 22 insertions(+), 107 deletions(-)
diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index ed8b04c6022e9..b3f2558c9fb8f 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -18,7 +18,6 @@
struct sc8280xp_snd_data {
bool stream_prepared[AFE_PORT_MAX];
struct snd_soc_card *card;
- struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack;
struct snd_soc_jack dp_jack[8];
bool jack_setup;
@@ -68,17 +67,6 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}
-static void sc8280xp_snd_shutdown(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sc8280xp_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card);
- struct sdw_stream_runtime *sruntime = qcom_snd_sdw_get_stream(substream);
-
- pdata->sruntime[cpu_dai->id] = NULL;
- sdw_release_stream(sruntime);
-}
-
static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
@@ -108,25 +96,13 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
-static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sc8280xp_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card);
-
- return qcom_snd_sdw_hw_params(substream, params, &pdata->sruntime[cpu_dai->id]);
-}
-
static int sc8280xp_snd_prepare(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
- struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
- return qcom_snd_sdw_prepare(substream, sruntime,
- &data->stream_prepared[cpu_dai->id]);
+ return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id]);
}
static int sc8280xp_snd_hw_free(struct snd_pcm_substream *substream)
@@ -134,16 +110,13 @@ static int sc8280xp_snd_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
- return qcom_snd_sdw_hw_free(substream, sruntime,
- &data->stream_prepared[cpu_dai->id]);
+ return qcom_snd_sdw_hw_free(substream, &data->stream_prepared[cpu_dai->id]);
}
static const struct snd_soc_ops sc8280xp_be_ops = {
.startup = qcom_snd_sdw_startup,
- .shutdown = sc8280xp_snd_shutdown,
- .hw_params = sc8280xp_snd_hw_params,
+ .shutdown = qcom_snd_sdw_shutdown,
.hw_free = sc8280xp_snd_hw_free,
.prepare = sc8280xp_snd_prepare,
};
diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c
index 5f880c74c8dc2..6576b47a4c8c3 100644
--- a/sound/soc/qcom/sdw.c
+++ b/sound/soc/qcom/sdw.c
@@ -124,19 +124,21 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substream)
EXPORT_SYMBOL_GPL(qcom_snd_sdw_startup);
int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream,
- struct sdw_stream_runtime *sruntime,
bool *stream_prepared)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct sdw_stream_runtime *sruntime;
int ret;
- if (!sruntime)
- return 0;
if (!qcom_snd_is_sdw_dai(cpu_dai->id))
return 0;
+ sruntime = qcom_snd_sdw_get_stream(substream);
+ if (!sruntime)
+ return 0;
+
if (*stream_prepared)
return 0;
@@ -183,26 +185,24 @@ struct sdw_stream_runtime *qcom_snd_sdw_get_stream(struct snd_pcm_substream *sub
}
EXPORT_SYMBOL_GPL(qcom_snd_sdw_get_stream);
-int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct sdw_stream_runtime **psruntime)
+void qcom_snd_sdw_shutdown(struct snd_pcm_substream *substream)
{
- *psruntime = qcom_snd_sdw_get_stream(substream);
-
- return 0;
+ struct sdw_stream_runtime *sruntime = qcom_snd_sdw_get_stream(substream);
+ sdw_release_stream(sruntime);
}
-EXPORT_SYMBOL_GPL(qcom_snd_sdw_hw_params);
+EXPORT_SYMBOL_GPL(qcom_snd_sdw_shutdown);
-int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream,
- struct sdw_stream_runtime *sruntime, bool *stream_prepared)
+int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream, bool *stream_prepared)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct sdw_stream_runtime *sruntime;
if (!qcom_snd_is_sdw_dai(cpu_dai->id))
return 0;
+ sruntime = qcom_snd_sdw_get_stream(substream);
if (sruntime && *stream_prepared) {
sdw_disable_stream(sruntime);
sdw_deprepare_stream(sruntime);
diff --git a/sound/soc/qcom/sdw.h b/sound/soc/qcom/sdw.h
index b8bc5beb05223..061a63f1ac523 100644
--- a/sound/soc/qcom/sdw.h
+++ b/sound/soc/qcom/sdw.h
@@ -7,14 +7,10 @@
#include <linux/soundwire/sdw.h>
int qcom_snd_sdw_startup(struct snd_pcm_substream *substream);
+void qcom_snd_sdw_shutdown(struct snd_pcm_substream *substream);
int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream,
- struct sdw_stream_runtime *runtime,
bool *stream_prepared);
struct sdw_stream_runtime *qcom_snd_sdw_get_stream(struct snd_pcm_substream *stream);
-int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct sdw_stream_runtime **psruntime);
int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream,
- struct sdw_stream_runtime *sruntime,
bool *stream_prepared);
#endif
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
index ce5b0059207f1..203a8705a42fe 100644
--- a/sound/soc/qcom/sm8250.c
+++ b/sound/soc/qcom/sm8250.c
@@ -21,7 +21,6 @@
struct sm8250_snd_data {
bool stream_prepared[AFE_PORT_MAX];
struct snd_soc_card *card;
- struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack;
struct snd_soc_jack usb_offload_jack;
bool usb_offload_jack_setup;
@@ -112,36 +111,13 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
return qcom_snd_sdw_startup(substream);
}
-static void sm8250_snd_shutdown(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
- struct sdw_stream_runtime *sruntime = qcom_snd_sdw_get_stream(substream);
-
- data->sruntime[cpu_dai->id] = NULL;
- sdw_release_stream(sruntime);
-}
-
-static int sm8250_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sm8250_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card);
-
- return qcom_snd_sdw_hw_params(substream, params, &pdata->sruntime[cpu_dai->id]);
-}
-
static int sm8250_snd_prepare(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
- struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
- return qcom_snd_sdw_prepare(substream, sruntime,
- &data->stream_prepared[cpu_dai->id]);
+ return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id]);
}
static int sm8250_snd_hw_free(struct snd_pcm_substream *substream)
@@ -149,16 +125,13 @@ static int sm8250_snd_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
- return qcom_snd_sdw_hw_free(substream, sruntime,
- &data->stream_prepared[cpu_dai->id]);
+ return qcom_snd_sdw_hw_free(substream, &data->stream_prepared[cpu_dai->id]);
}
static const struct snd_soc_ops sm8250_be_ops = {
.startup = sm8250_snd_startup,
- .shutdown = sm8250_snd_shutdown,
- .hw_params = sm8250_snd_hw_params,
+ .shutdown = qcom_snd_sdw_shutdown,
.hw_free = sm8250_snd_hw_free,
.prepare = sm8250_snd_prepare,
};
diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c
index 2e3599516aa2a..a3f4785c4bbe6 100644
--- a/sound/soc/qcom/x1e80100.c
+++ b/sound/soc/qcom/x1e80100.c
@@ -18,7 +18,6 @@
struct x1e80100_snd_data {
bool stream_prepared[AFE_PORT_MAX];
struct snd_soc_card *card;
- struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack;
struct snd_soc_jack dp_jack[8];
bool jack_setup;
@@ -50,17 +49,6 @@ static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}
-static void x1e80100_snd_shutdown(struct snd_pcm_substream *substream)
-{
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
- struct sdw_stream_runtime *sruntime = qcom_snd_sdw_get_stream(substream);
-
- data->sruntime[cpu_dai->id] = NULL;
- sdw_release_stream(sruntime);
-}
-
static int x1e80100_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
@@ -85,16 +73,6 @@ static int x1e80100_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
-static int x1e80100_snd_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
-
- return qcom_snd_sdw_hw_params(substream, params, &data->sruntime[cpu_dai->id]);
-}
-
static int x1e80100_snd_hw_map_channels(unsigned int *ch_map, int num)
{
switch (num) {
@@ -128,7 +106,6 @@ static int x1e80100_snd_prepare(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
- struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
unsigned int channels = substream->runtime->channels;
unsigned int rx_slot[4];
int ret;
@@ -149,8 +126,7 @@ static int x1e80100_snd_prepare(struct snd_pcm_substream *substream)
break;
}
- return qcom_snd_sdw_prepare(substream, sruntime,
- &data->stream_prepared[cpu_dai->id]);
+ return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id]);
}
static int x1e80100_snd_hw_free(struct snd_pcm_substream *substream)
@@ -158,16 +134,13 @@ static int x1e80100_snd_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
- return qcom_snd_sdw_hw_free(substream, sruntime,
- &data->stream_prepared[cpu_dai->id]);
+ return qcom_snd_sdw_hw_free(substream, &data->stream_prepared[cpu_dai->id]);
}
static const struct snd_soc_ops x1e80100_be_ops = {
.startup = qcom_snd_sdw_startup,
- .shutdown = x1e80100_snd_shutdown,
- .hw_params = x1e80100_snd_hw_params,
+ .shutdown = qcom_snd_sdw_shutdown,
.hw_free = x1e80100_snd_hw_free,
.prepare = x1e80100_snd_prepare,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 357/990] ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (355 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 356/990] ASoC: qcom: sdw: remove redundant code Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 358/990] ASoC: qcom: common: validate cpu dai id during parsing Greg Kroah-Hartman
` (495 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mohammad Rafi Shaik,
Srinivas Kandagatla, Krzysztof Kozlowski, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
[ Upstream commit e46957f27c6004f3ab5ec456f4e848950364ebc1 ]
Add new dai ids entries for LPASS LPI MI2S and SENARY MI2S audio lines.
Co-developed-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260402081118.348071-7-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 704251f9dad3 ("ASoC: qcom: x1e80100: recreate the headset jack on card rebind")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../bindings/sound/qcom,q6dsp-lpass-ports.yaml | 5 ++++-
include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h | 12 ++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml b/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
index 08c618e7e4281..2b27d6c8f58f1 100644
--- a/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
@@ -126,13 +126,16 @@ patternProperties:
reg:
contains:
# MI2S DAI ID range PRIMARY_MI2S_RX - QUATERNARY_MI2S_TX and
- # QUINARY_MI2S_RX - QUINARY_MI2S_TX
+ # QUINARY_MI2S_RX - QUINARY_MI2S_TX and
+ # LPI_MI2S_RX_0 - SENARY_MI2S_TX
items:
oneOf:
- minimum: 16
maximum: 23
- minimum: 127
maximum: 128
+ - minimum: 137
+ maximum: 148
then:
required:
- qcom,sd-lines
diff --git a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
index 6d1ce7f5da51c..45850f2d43425 100644
--- a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
+++ b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
@@ -140,6 +140,18 @@
#define DISPLAY_PORT_RX_6 134
#define DISPLAY_PORT_RX_7 135
#define USB_RX 136
+#define LPI_MI2S_RX_0 137
+#define LPI_MI2S_TX_0 138
+#define LPI_MI2S_RX_1 139
+#define LPI_MI2S_TX_1 140
+#define LPI_MI2S_RX_2 141
+#define LPI_MI2S_TX_2 142
+#define LPI_MI2S_RX_3 143
+#define LPI_MI2S_TX_3 144
+#define LPI_MI2S_RX_4 145
+#define LPI_MI2S_TX_4 146
+#define SENARY_MI2S_RX 147
+#define SENARY_MI2S_TX 148
#define LPASS_CLK_ID_PRI_MI2S_IBIT 1
#define LPASS_CLK_ID_PRI_MI2S_EBIT 2
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 358/990] ASoC: qcom: common: validate cpu dai id during parsing
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (356 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 357/990] ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 359/990] ASoC: qcom: common: add DAI-node TDM slot helpers Greg Kroah-Hartman
` (494 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Srinivas Kandagatla, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
[ Upstream commit d49ee8faefecd4d2eb5c6c9f419f4db9488d68aa ]
lpass ports numbers have been added but the afe/apm driver never got
updated with new max port value that it uses to store dai specific data.
There are more than one places these values are cached and always become
out of sync.
This will result in array out of bounds and weird driver behaviour.
To catch such issues, first add a single place where we can define max
port and second add a check in common parsing code which can error
out before corrupting the memory with out of bounds array access.
This should help both avoid and catch these type of mistakes in future.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260402081118.348071-8-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 704251f9dad3 ("ASoC: qcom: x1e80100: recreate the headset jack on card rebind")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/qcom/common.c | 6 ++++++
sound/soc/qcom/common.h | 3 +++
sound/soc/qcom/lpass.h | 3 ++-
sound/soc/qcom/qdsp6/q6afe.h | 3 ++-
sound/soc/qcom/qdsp6/q6apm.h | 3 ++-
5 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index 7ee60a58a3368..cf1f3a767ceef 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -120,6 +120,12 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
link->id = args.args[0];
+ if (link->id >= LPASS_MAX_PORT) {
+ dev_err(dev, "%s: Invalid cpu dai id %d\n", link->name, link->id);
+ ret = -EINVAL;
+ goto err;
+ }
+
if (platform) {
link->platforms->of_node = of_parse_phandle(platform,
"sound-dai",
diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h
index 1b8d3f90bffaf..ee6662885593c 100644
--- a/sound/soc/qcom/common.h
+++ b/sound/soc/qcom/common.h
@@ -4,8 +4,11 @@
#ifndef __QCOM_SND_COMMON_H__
#define __QCOM_SND_COMMON_H__
+#include <dt-bindings/sound/qcom,q6afe.h>
#include <sound/soc.h>
+#define LPASS_MAX_PORT (SENARY_MI2S_TX + 1)
+
int qcom_snd_parse_of(struct snd_soc_card *card);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup);
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index de3ec6f594c11..68b71039b9814 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -14,10 +14,11 @@
#include <linux/regmap.h>
#include <dt-bindings/sound/qcom,lpass.h>
#include <dt-bindings/sound/qcom,q6afe.h>
+#include "common.h"
#include "lpass-hdmi.h"
#define LPASS_AHBIX_CLOCK_FREQUENCY 131072000
-#define LPASS_MAX_PORTS (DISPLAY_PORT_RX_7 + 1)
+#define LPASS_MAX_PORTS (LPASS_MAX_PORT)
#define LPASS_MAX_MI2S_PORTS (8)
#define LPASS_MAX_DMA_CHANNELS (8)
#define LPASS_MAX_HDMI_DMA_CHANNELS (4)
diff --git a/sound/soc/qcom/qdsp6/q6afe.h b/sound/soc/qcom/qdsp6/q6afe.h
index a29abe4ce4368..0b8c3ec1315ca 100644
--- a/sound/soc/qcom/qdsp6/q6afe.h
+++ b/sound/soc/qcom/qdsp6/q6afe.h
@@ -2,8 +2,9 @@
#ifndef __Q6AFE_H__
#define __Q6AFE_H__
+#include "../common.h"
-#define AFE_PORT_MAX 137
+#define AFE_PORT_MAX (LPASS_MAX_PORT)
#define MSM_AFE_PORT_TYPE_RX 0
#define MSM_AFE_PORT_TYPE_TX 1
diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h
index 7ce08b401e310..5cf538397841a 100644
--- a/sound/soc/qcom/qdsp6/q6apm.h
+++ b/sound/soc/qcom/qdsp6/q6apm.h
@@ -14,9 +14,10 @@
#include <linux/of_platform.h>
#include <linux/jiffies.h>
#include <linux/soc/qcom/apr.h>
+#include "../common.h"
#include "audioreach.h"
-#define APM_PORT_MAX 127
+#define APM_PORT_MAX LPASS_MAX_PORT
#define APM_PORT_MAX_AUDIO_CHAN_CNT 8
#define PCM_CHANNEL_NULL 0
#define PCM_CHANNEL_FL 1 /* Front left channel. */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 359/990] ASoC: qcom: common: add DAI-node TDM slot helpers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (357 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 358/990] ASoC: qcom: common: validate cpu dai id during parsing Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 360/990] ASoC: qcom: common: Add generic headset jack helpers Greg Kroah-Hartman
` (493 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Prasad Kumpatla, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>
[ Upstream commit 1e844ecbc9cbd7c88543c5a84c0d1e434f46fd8b ]
Add common helpers to parse standard dai-tdm-slot-* properties from the
CPU and codec child nodes of a backend DAI link and apply the result to
the active DAIs.
QCOM machine drivers already use qcom_snd_parse_of() to build links from
DT, but they lacked a shared helper to translate endpoint TDM properties
into snd_soc_dai_set_tdm_slot() calls. Boards therefore had to carry ad
hoc parsing or rely on non-standard DT properties.
The helpers parse endpoint masks, validate the shared slot count and
slot width, and program CPU and codec DAIs with the resulting slot
configuration. A cfg-based apply helper is provided for callers that
already parsed the DT data and want to avoid a second DT traversal.
Signed-off-by: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260804070307.117119-7-prasad.kumpatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 704251f9dad3 ("ASoC: qcom: x1e80100: recreate the headset jack on card rebind")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/qcom/common.c | 155 ++++++++++++++++++++++++++++++++++++++++
sound/soc/qcom/common.h | 14 ++++
2 files changed, 169 insertions(+)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index cf1f3a767ceef..b021537f27ff1 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -23,6 +23,161 @@ static const struct snd_soc_dapm_widget qcom_jack_snd_widgets[] = {
SND_SOC_DAPM_SPK("DP7 Jack", NULL),
};
+static struct device_node *qcom_snd_get_link_node(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_card *card = rtd->card;
+ struct of_phandle_args args;
+ int ret;
+
+ if (!card->dev || !card->dev->of_node)
+ return NULL;
+
+ for_each_available_child_of_node_scoped(card->dev->of_node, np) {
+ struct device_node *cpu_np __free(device_node) =
+ of_get_child_by_name(np, "cpu");
+
+ if (!cpu_np)
+ continue;
+
+ ret = of_parse_phandle_with_args(cpu_np, "sound-dai", "#sound-dai-cells", 0,
+ &args);
+ if (ret)
+ continue;
+
+ if (args.np == rtd->dai_link->cpus[0].of_node &&
+ args.args_count == 1 && args.args[0] == cpu_dai->id) {
+ of_node_put(args.np);
+ return of_node_get(np);
+ }
+
+ of_node_put(args.np);
+ }
+
+ return NULL;
+}
+
+static int qcom_snd_parse_tdm_slot(struct device_node *np,
+ struct qcom_snd_tdm_slot_cfg *cfg)
+{
+ memset(cfg, 0, sizeof(*cfg));
+
+ return snd_soc_of_parse_tdm_slot(np, &cfg->tx_mask, &cfg->rx_mask,
+ &cfg->slots, &cfg->slot_width);
+}
+
+static int qcom_snd_normalize_tdm_slots(struct qcom_snd_tdm_slot_cfg *cpu_cfg,
+ struct qcom_snd_tdm_slot_cfg *codec_cfg)
+{
+ unsigned int slots;
+ unsigned int slot_width;
+
+ if (cpu_cfg->slots && codec_cfg->slots && cpu_cfg->slots != codec_cfg->slots)
+ return -EINVAL;
+
+ if (cpu_cfg->slot_width && codec_cfg->slot_width &&
+ cpu_cfg->slot_width != codec_cfg->slot_width)
+ return -EINVAL;
+
+ slots = cpu_cfg->slots ?: codec_cfg->slots;
+ if (!slots)
+ return 0;
+
+ slot_width = cpu_cfg->slot_width ?: codec_cfg->slot_width;
+ if (!slot_width)
+ return -EINVAL;
+
+ cpu_cfg->slots = slots;
+ codec_cfg->slots = slots;
+ cpu_cfg->slot_width = slot_width;
+ codec_cfg->slot_width = slot_width;
+
+ return 0;
+}
+
+static int qcom_snd_parse_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd,
+ struct qcom_snd_tdm_slot_cfg *cpu_cfg,
+ struct qcom_snd_tdm_slot_cfg *codec_cfg)
+{
+ struct device_node *link_np __free(device_node) = qcom_snd_get_link_node(rtd);
+ int ret;
+
+ if (!link_np)
+ return -EINVAL;
+
+ struct device_node *cpu_np __free(device_node) =
+ of_get_child_by_name(link_np, "cpu");
+ struct device_node *codec_np __free(device_node) =
+ of_get_child_by_name(link_np, "codec");
+ if (!cpu_np || !codec_np)
+ return -EINVAL;
+
+ ret = qcom_snd_parse_tdm_slot(cpu_np, cpu_cfg);
+ if (ret)
+ return ret;
+
+ return qcom_snd_parse_tdm_slot(codec_np, codec_cfg);
+}
+
+int qcom_snd_get_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd,
+ struct qcom_snd_tdm_slot_cfg *cpu_cfg,
+ struct qcom_snd_tdm_slot_cfg *codec_cfg)
+{
+ int ret;
+
+ ret = qcom_snd_parse_dai_tdm_slots(rtd, cpu_cfg, codec_cfg);
+ if (ret)
+ return ret;
+
+ return qcom_snd_normalize_tdm_slots(cpu_cfg, codec_cfg);
+}
+EXPORT_SYMBOL_GPL(qcom_snd_get_dai_tdm_slots);
+
+int qcom_snd_apply_dai_tdm_slots_cfg(struct snd_soc_pcm_runtime *rtd,
+ const struct qcom_snd_tdm_slot_cfg *cpu_cfg,
+ const struct qcom_snd_tdm_slot_cfg *codec_cfg)
+{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_dai *codec_dai;
+ int i;
+ int ret;
+
+ if (!cpu_cfg->slots)
+ return 0;
+
+ ret = snd_soc_dai_set_tdm_slot(cpu_dai, cpu_cfg->tx_mask, cpu_cfg->rx_mask,
+ cpu_cfg->slots, cpu_cfg->slot_width);
+ if (ret)
+ return ret;
+
+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
+ ret = snd_soc_dai_set_tdm_slot(codec_dai,
+ codec_cfg->tx_mask,
+ codec_cfg->rx_mask,
+ codec_cfg->slots,
+ codec_cfg->slot_width);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(qcom_snd_apply_dai_tdm_slots_cfg);
+
+int qcom_snd_apply_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd)
+{
+ struct qcom_snd_tdm_slot_cfg cpu_cfg;
+ struct qcom_snd_tdm_slot_cfg codec_cfg;
+ int ret;
+
+ ret = qcom_snd_get_dai_tdm_slots(rtd, &cpu_cfg, &codec_cfg);
+ if (ret)
+ return ret == -EINVAL ? 0 : ret;
+
+ return qcom_snd_apply_dai_tdm_slots_cfg(rtd, &cpu_cfg, &codec_cfg);
+}
+EXPORT_SYMBOL_GPL(qcom_snd_apply_dai_tdm_slots);
+
int qcom_snd_parse_of(struct snd_soc_card *card)
{
struct device_node *np;
diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h
index ee6662885593c..02b24caec485e 100644
--- a/sound/soc/qcom/common.h
+++ b/sound/soc/qcom/common.h
@@ -9,7 +9,21 @@
#define LPASS_MAX_PORT (SENARY_MI2S_TX + 1)
+struct qcom_snd_tdm_slot_cfg {
+ unsigned int tx_mask;
+ unsigned int rx_mask;
+ unsigned int slots;
+ unsigned int slot_width;
+};
+
int qcom_snd_parse_of(struct snd_soc_card *card);
+int qcom_snd_get_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd,
+ struct qcom_snd_tdm_slot_cfg *cpu_cfg,
+ struct qcom_snd_tdm_slot_cfg *codec_cfg);
+int qcom_snd_apply_dai_tdm_slots_cfg(struct snd_soc_pcm_runtime *rtd,
+ const struct qcom_snd_tdm_slot_cfg *cpu_cfg,
+ const struct qcom_snd_tdm_slot_cfg *codec_cfg);
+int qcom_snd_apply_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup);
int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 360/990] ASoC: qcom: common: Add generic headset jack helpers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (358 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 359/990] ASoC: qcom: common: add DAI-node TDM slot helpers Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 361/990] ASoC: qcom: x1e80100: recreate the headset jack on card rebind Greg Kroah-Hartman
` (492 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hongyang Zhao, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongyang Zhao <hongyang.zhao@thundersoft.com>
[ Upstream commit 7f8dd07370f8c17f8f98f0fa98691635828b0dac ]
qcom_snd_wcd_jack_setup() combines creation of the card-level headset
jack with the WCD-specific operation of attaching jack detection to
codecs on the TX codec DMA links. External codecs connected over MI2S
also provide component jack detection, but cannot use the WCD-specific
DAI filtering.
Factor the common jack allocation, DAPM pin registration and headset
button mappings into a private initializer. Reuse it from the existing
WCD path and add a generic setup helper which attaches the jack to every
codec component in a runtime.
Treat -ENOTSUPP as a no-op because snd_soc_component_set_jack() uses it
for components which do not provide a set_jack callback.
Add a matching cleanup helper so machine drivers can detach component
jack detection when the DAI link exits. The WCD setup behavior remains
unchanged.
Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
Link: https://patch.msgid.link/20260904-rubikpi-next-20260605-v3-3-f49146d85af3@thundersoft.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 704251f9dad3 ("ASoC: qcom: x1e80100: recreate the headset jack on card rebind")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/qcom/common.c | 61 +++++++++++++++++++++++++++++++++++------
sound/soc/qcom/common.h | 3 ++
2 files changed, 56 insertions(+), 8 deletions(-)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index b021537f27ff1..71cbdd1a44ca2 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -356,13 +356,11 @@ static struct snd_soc_jack_pin qcom_headset_jack_pins[] = {
},
};
-int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
- struct snd_soc_jack *jack, bool *jack_setup)
+static int qcom_snd_headset_jack_init(struct snd_soc_card *card,
+ struct snd_soc_jack *jack,
+ bool *jack_setup)
{
- struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
- struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
- struct snd_soc_card *card = rtd->card;
- int rval, i;
+ int rval;
if (!*jack_setup) {
rval = snd_soc_card_jack_new_pins(card, "Headset Jack",
@@ -386,6 +384,55 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
*jack_setup = true;
}
+ return 0;
+}
+
+int qcom_snd_headset_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *jack, bool *jack_setup)
+{
+ struct snd_soc_dai *codec_dai;
+ struct snd_soc_card *card = rtd->card;
+ int rval, i;
+
+ rval = qcom_snd_headset_jack_init(card, jack, jack_setup);
+ if (rval)
+ return rval;
+
+ for_each_rtd_codec_dais(rtd, i, codec_dai) {
+ rval = snd_soc_component_set_jack(codec_dai->component, jack, NULL);
+ if (rval != 0 && rval != -ENOTSUPP) {
+ dev_warn(card->dev, "Failed to set jack: %d\n", rval);
+ qcom_snd_headset_jack_cleanup(rtd);
+ return rval;
+ }
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(qcom_snd_headset_jack_setup);
+
+void qcom_snd_headset_jack_cleanup(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_dai *codec_dai;
+ int i;
+
+ for_each_rtd_codec_dais(rtd, i, codec_dai)
+ snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
+}
+EXPORT_SYMBOL_GPL(qcom_snd_headset_jack_cleanup);
+
+int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *jack, bool *jack_setup)
+{
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
+ struct snd_soc_card *card = rtd->card;
+ int rval, i;
+
+ rval = qcom_snd_headset_jack_init(card, jack, jack_setup);
+ if (rval)
+ return rval;
+
switch (cpu_dai->id) {
case TX_CODEC_DMA_TX_0:
case TX_CODEC_DMA_TX_1:
@@ -404,8 +451,6 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
default:
break;
}
-
-
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_wcd_jack_setup);
diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h
index 02b24caec485e..6705e135ccd77 100644
--- a/sound/soc/qcom/common.h
+++ b/sound/soc/qcom/common.h
@@ -24,6 +24,9 @@ int qcom_snd_apply_dai_tdm_slots_cfg(struct snd_soc_pcm_runtime *rtd,
const struct qcom_snd_tdm_slot_cfg *cpu_cfg,
const struct qcom_snd_tdm_slot_cfg *codec_cfg);
int qcom_snd_apply_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd);
+int qcom_snd_headset_jack_setup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_soc_jack *jack, bool *jack_setup);
+void qcom_snd_headset_jack_cleanup(struct snd_soc_pcm_runtime *rtd);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup);
int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 361/990] ASoC: qcom: x1e80100: recreate the headset jack on card rebind
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (359 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 360/990] ASoC: qcom: common: Add generic headset jack helpers Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 362/990] ASoC: amd: ps: guard adata->sdw dereferences with NULL check in IRQ handler Greg Kroah-Hartman
` (491 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tyler Baker, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Baker <tyler.baker@oss.qualcomm.com>
[ Upstream commit 704251f9dad3cb5f93ef64ff2d547868d42de319 ]
The headset jack is only created while jack_setup is false and nothing
clears it, so after a card rebind it is not created again and the
codecs keep a pointer to the freed jack.
Clear it on link exit, as sc8280xp does.
Fixes: 6b9dc2da6657 ("ASoC: qcom: Add x1e80100 sound machine driver")
Signed-off-by: Tyler Baker <tyler.baker@oss.qualcomm.com>
Link: https://patch.msgid.link/20261106054333.2748248-3-tyler.baker@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/qcom/x1e80100.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c
index a3f4785c4bbe6..f9a1dfe3e6ae1 100644
--- a/sound/soc/qcom/x1e80100.c
+++ b/sound/soc/qcom/x1e80100.c
@@ -49,6 +49,23 @@ static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
}
+static void x1e80100_snd_exit(struct snd_soc_pcm_runtime *rtd)
+{
+ struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+
+ switch (cpu_dai->id) {
+ case DISPLAY_PORT_RX_0:
+ case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
+ return;
+ default:
+ break;
+ }
+
+ qcom_snd_headset_jack_cleanup(rtd);
+ data->jack_setup = false;
+}
+
static int x1e80100_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
@@ -153,6 +170,7 @@ static void x1e80100_add_be_ops(struct snd_soc_card *card)
for_each_card_prelinks(card, i, link) {
if (link->no_pcm == 1) {
link->init = x1e80100_snd_init;
+ link->exit = x1e80100_snd_exit;
link->be_hw_params_fixup = x1e80100_be_hw_params_fixup;
link->ops = &x1e80100_be_ops;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 362/990] ASoC: amd: ps: guard adata->sdw dereferences with NULL check in IRQ handler
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (360 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 361/990] ASoC: qcom: x1e80100: recreate the headset jack on card rebind Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 363/990] ASoC: SOF: amd: " Greg Kroah-Hartman
` (490 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vijendar Mukunda, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
[ Upstream commit 41e06aaef9c000c1bb52d8a6f73ae66c9bd36d83 ]
The ACP external IRQ handler is registered before sdw_amd_probe() assigns
adata->sdw, so a stray interrupt in the probe window could reach the
adata->sdw->pdev[i] dereference with adata->sdw still NULL.
The same window exists on the teardown side: after sdw_amd_exit() frees
the context but before adata->sdw is cleared by the caller.
Add NULL checks for adata->sdw in acp63_irq_handler() before dereferencing
->pdev[0] and ->pdev[1], and in handle_acp70_sdw_wake_event() for the same
reason. The interrupt-status register write that acknowledges the IRQ is
kept outside the guard so the hardware bit is always cleared regardless of
whether the SoundWire context is live.
Fixes: e1cb350610ce ("ASoC: amd: ps: handle SoundWire interrupts in acp pci driver")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://patch.msgid.link/20261107175339.3547918-2-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/amd/ps/pci-ps.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
index c75aac4af73b5..07bdfdf0d760f 100644
--- a/sound/soc/amd/ps/pci-ps.c
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -26,16 +26,20 @@ static void handle_acp70_sdw_wake_event(struct acp63_dev_data *adata)
struct amd_sdw_manager *amd_manager;
if (adata->acp70_sdw0_wake_event) {
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
- if (amd_manager)
- pm_request_resume(amd_manager->dev);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
+ if (amd_manager)
+ pm_request_resume(amd_manager->dev);
+ }
adata->acp70_sdw0_wake_event = 0;
}
if (adata->acp70_sdw1_wake_event) {
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
- if (amd_manager)
- pm_request_resume(amd_manager->dev);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
+ if (amd_manager)
+ pm_request_resume(amd_manager->dev);
+ }
adata->acp70_sdw1_wake_event = 0;
}
}
@@ -209,18 +213,22 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id)
ext_intr_stat = readl(adata->acp63_base + ACP_EXTERNAL_INTR_STAT);
if (ext_intr_stat & ACP_SDW0_STAT) {
writel(ACP_SDW0_STAT, adata->acp63_base + ACP_EXTERNAL_INTR_STAT);
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
- if (amd_manager)
- schedule_work(&amd_manager->amd_sdw_irq_thread);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
+ if (amd_manager)
+ schedule_work(&amd_manager->amd_sdw_irq_thread);
+ }
irq_flag = 1;
}
ext_intr_stat1 = readl(adata->acp63_base + ACP_EXTERNAL_INTR_STAT1);
if (ext_intr_stat1 & ACP_SDW1_STAT) {
writel(ACP_SDW1_STAT, adata->acp63_base + ACP_EXTERNAL_INTR_STAT1);
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
- if (amd_manager)
- schedule_work(&amd_manager->amd_sdw_irq_thread);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
+ if (amd_manager)
+ schedule_work(&amd_manager->amd_sdw_irq_thread);
+ }
irq_flag = 1;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 363/990] ASoC: SOF: amd: guard adata->sdw dereferences with NULL check in IRQ handler
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (361 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 362/990] ASoC: amd: ps: guard adata->sdw dereferences with NULL check in IRQ handler Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 364/990] ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output Greg Kroah-Hartman
` (489 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vijendar Mukunda, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
[ Upstream commit 34ea81a7f284a13d825279fdede36b7f793f9936 ]
The ACP external IRQ handler is registered before sdw_amd_probe() assigns
adata->sdw, so a stray interrupt in the probe window could reach the
adata->sdw->pdev[i] dereference with adata->sdw still NULL.
The same window exists on the teardown side: after sdw_amd_exit() frees
the context but before adata->sdw is cleared by the caller.
Add NULL checks for adata->sdw in acp_irq_handler() before dereferencing
->pdev[0] and ->pdev[1], and in amd_sof_handle_acp70_sdw_wake_event() for
the same reason. The interrupt-status register write that acknowledges the
IRQ is kept outside the guard so the hardware bit is always cleared
regardless of whether the SoundWire context is live.
Fixes: 96eb81851012 ("ASoC: SOF: amd: add interrupt handling for SoundWire manager devices")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Fixes: 1f41bf67bfe3 ("ASoC: SOF: amd: add soundwire wake irq handling")
Link: https://patch.msgid.link/20261107175339.3547918-3-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/sof/amd/acp.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index 475b77b8ea309..e84ab3069b38f 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -394,16 +394,20 @@ static void amd_sof_handle_acp70_sdw_wake_event(struct acp_dev_data *adata)
struct amd_sdw_manager *amd_manager;
if (adata->acp70_sdw0_wake_event) {
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
- if (amd_manager)
- pm_request_resume(amd_manager->dev);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
+ if (amd_manager)
+ pm_request_resume(amd_manager->dev);
+ }
adata->acp70_sdw0_wake_event = 0;
}
if (adata->acp70_sdw1_wake_event) {
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
- if (amd_manager)
- pm_request_resume(amd_manager->dev);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
+ if (amd_manager)
+ pm_request_resume(amd_manager->dev);
+ }
adata->acp70_sdw1_wake_event = 0;
}
}
@@ -495,10 +499,12 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id)
val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->ext_intr_stat);
if (val & ACP_SDW0_IRQ_MASK) {
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat, ACP_SDW0_IRQ_MASK);
- if (amd_manager)
- schedule_work(&amd_manager->amd_sdw_irq_thread);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[0]->dev);
+ if (amd_manager)
+ schedule_work(&amd_manager->amd_sdw_irq_thread);
+ }
irq_flag = 1;
}
@@ -515,11 +521,13 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id)
if (desc->ext_intr_stat1) {
val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->ext_intr_stat1);
if (val & ACP_SDW1_IRQ_MASK) {
- amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_stat1,
ACP_SDW1_IRQ_MASK);
- if (amd_manager)
- schedule_work(&amd_manager->amd_sdw_irq_thread);
+ if (adata->sdw) {
+ amd_manager = dev_get_drvdata(&adata->sdw->pdev[1]->dev);
+ if (amd_manager)
+ schedule_work(&amd_manager->amd_sdw_irq_thread);
+ }
irq_flag = 1;
}
switch (adata->pci_rev) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 364/990] ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (362 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 363/990] ASoC: SOF: amd: " Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 365/990] btrfs: zoned: only change active zone counter on successful (de)activation Greg Kroah-Hartman
` (488 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Samuel Leyva, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Leyva <samuelslg03idk@gmail.com>
[ Upstream commit f392763d73356760eac3e4ab7c87b0855be0d4bb ]
The speaker amplifier GPIO is driven from a SUPPLY widget. DAPM powers
supplies before the rest of the path, so the amplifier is enabled while
the ES8316 headphone driver and charge pump, which also feed the
speakers, are still powering up. This results in an audible pop every
time the speaker output is powered on.
Move the speaker GPIO handling to the Speaker endpoint widget, which
DAPM powers up last and powers down first, and give the codec output a
short time to settle before enabling the amplifier.
The headphone path is left unchanged: the Headphone endpoint widget
shares its power-up rank with the codec output drivers, so moving it
would not guarantee the same ordering, and it could not be tested.
Fixes: 54fcd9dd44b2 ("ASoC: amd: acp: Add machine driver that enables sound for systems with a ES8336 codec")
Signed-off-by: Samuel Leyva <samuelslg03idk@gmail.com>
Link: https://patch.msgid.link/20261107232225.3838-3-samuelslg03idk@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c b/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c
index 8f65720b153f4..56a733a1ba9be 100644
--- a/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c
+++ b/sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c
@@ -19,6 +19,7 @@
#include <linux/input.h>
#include <linux/io.h>
#include <linux/acpi.h>
+#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/string_choices.h>
#include "../acp-mach.h"
@@ -61,6 +62,8 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = {
#define ES83xx_12288_KHZ_MCLK_FREQ (48000 * 256)
#define ES83xx_48_MHZ_MCLK_FREQ (48000 * 1000)
+#define ES83XX_AMP_ON_DELAY_MS 50
+
static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);
static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,
@@ -115,7 +118,7 @@ static struct snd_soc_jack_pin es83xx_jack_pins[] = {
};
static const struct snd_soc_dapm_widget acp3x_es83xx_widgets[] = {
- SND_SOC_DAPM_SPK("Speaker", NULL),
+ SND_SOC_DAPM_SPK("Speaker", acp3x_es83xx_speaker_power_event),
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_MIC("Internal Mic", NULL),
@@ -123,9 +126,6 @@ static const struct snd_soc_dapm_widget acp3x_es83xx_widgets[] = {
SND_SOC_DAPM_SUPPLY("Headphone Power", SND_SOC_NOPM, 0, 0,
acp3x_es83xx_headphone_power_event,
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
- SND_SOC_DAPM_SUPPLY("Speaker Power", SND_SOC_NOPM, 0, 0,
- acp3x_es83xx_speaker_power_event,
- SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
};
static const struct snd_soc_dapm_route acp3x_es83xx_audio_map[] = {
@@ -139,7 +139,6 @@ static const struct snd_soc_dapm_route acp3x_es83xx_audio_map[] = {
*/
{"Speaker", NULL, "HPOL"},
{"Speaker", NULL, "HPOR"},
- {"Speaker", NULL, "Speaker Power"},
};
@@ -185,10 +184,13 @@ static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w,
struct acp3x_es83xx_private *priv = get_mach_priv(w->dapm->card);
dev_dbg(priv->codec_dev, "speaker power event: %d\n", event);
- if (SND_SOC_DAPM_EVENT_ON(event))
+ if (SND_SOC_DAPM_EVENT_ON(event)) {
+ /* Let the codec output settle before enabling the amplifier */
+ msleep(ES83XX_AMP_ON_DELAY_MS);
priv->speaker_on = true;
- else
+ } else {
priv->speaker_on = false;
+ }
gpiod_set_value_cansleep(priv->gpio_speakers, priv->speaker_on);
gpiod_set_value_cansleep(priv->gpio_headphone, priv->headphone_on);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 365/990] btrfs: zoned: only change active zone counter on successful (de)activation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (363 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 364/990] ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 366/990] btrfs: zoned: fix possible UAF in wait_eb_writebacks() Greg Kroah-Hartman
` (487 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Vacek, Johannes Thumshirn,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
[ Upstream commit 5e79f39fbeea78703ac389c67a810406fa09bc94 ]
btrfs_zone_activate() unconditionally decrements the reserved_active_zones
counter regardless if btrfs_dev_set_active_zone() fails to set the zone
active, i.e. because it raced with another call that already set the bit
in the bitmask, or not.
This can lead to a double decrement of the counter in case the bit has
already been set.
Only decrement the counter *iff* btrfs_dev_set_active_zone() successfully
marked the zone in the bitmap.
Mirror this behaviour when clearing the bit again.
Fixes: a7e1ac7bdc5a ("btrfs: zoned: reserve zones for an active metadata/system block group")
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 69ede4e4d0c20..0ff693fea47c3 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1126,11 +1126,13 @@ u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start,
return pos;
}
-static bool btrfs_dev_set_active_zone(struct btrfs_device *device, u64 pos)
+static bool btrfs_dev_set_active_zone(struct btrfs_device *device, u64 pos, bool *new)
{
struct btrfs_zoned_device_info *zone_info = device->zone_info;
unsigned int zno = (pos >> zone_info->zone_size_shift);
+ *new = false;
+
/* We can use any number of zones */
if (zone_info->max_active_zones == 0)
return true;
@@ -1142,23 +1144,29 @@ static bool btrfs_dev_set_active_zone(struct btrfs_device *device, u64 pos)
if (test_and_set_bit(zno, zone_info->active_zones)) {
/* Someone already set the bit */
atomic_inc(&zone_info->active_zones_left);
+ } else {
+ *new = true;
}
}
return true;
}
-static void btrfs_dev_clear_active_zone(struct btrfs_device *device, u64 pos)
+static bool btrfs_dev_clear_active_zone(struct btrfs_device *device, u64 pos)
{
struct btrfs_zoned_device_info *zone_info = device->zone_info;
unsigned int zno = (pos >> zone_info->zone_size_shift);
/* We can use any number of zones */
if (zone_info->max_active_zones == 0)
- return;
+ return false;
- if (test_and_clear_bit(zno, zone_info->active_zones))
+ if (test_and_clear_bit(zno, zone_info->active_zones)) {
atomic_inc(&zone_info->active_zones_left);
+ return true;
+ }
+
+ return false;
}
int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical,
@@ -2384,6 +2392,7 @@ bool btrfs_zone_activate(struct btrfs_block_group *block_group)
u64 physical;
const bool is_data = (block_group->flags & BTRFS_BLOCK_GROUP_DATA);
bool ret;
+ bool new;
int i;
if (!btrfs_is_zoned(block_group->fs_info))
@@ -2434,12 +2443,12 @@ bool btrfs_zone_activate(struct btrfs_block_group *block_group)
goto out_unlock;
}
- if (!btrfs_dev_set_active_zone(device, physical)) {
+ if (!btrfs_dev_set_active_zone(device, physical, &new)) {
/* Cannot activate the zone */
ret = false;
goto out_unlock;
}
- if (!is_data)
+ if (!is_data && new)
zinfo->reserved_active_zones--;
}
@@ -2486,6 +2495,7 @@ static int call_zone_finish(struct btrfs_block_group *block_group,
struct btrfs_device *device = stripe->dev;
const u64 physical = stripe->physical;
struct btrfs_zoned_device_info *zinfo = device->zone_info;
+ bool cleared;
int ret;
if (!device->bdev)
@@ -2507,9 +2517,9 @@ static int call_zone_finish(struct btrfs_block_group *block_group,
return ret;
}
- if (!(block_group->flags & BTRFS_BLOCK_GROUP_DATA))
+ cleared = btrfs_dev_clear_active_zone(device, physical);
+ if (!(block_group->flags & BTRFS_BLOCK_GROUP_DATA) && cleared)
zinfo->reserved_active_zones++;
- btrfs_dev_clear_active_zone(device, physical);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 366/990] btrfs: zoned: fix possible UAF in wait_eb_writebacks()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (364 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 365/990] btrfs: zoned: only change active zone counter on successful (de)activation Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 367/990] btrfs: zoned: requeue block group if zone reset bails out Greg Kroah-Hartman
` (486 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Vacek, Johannes Thumshirn,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
[ Upstream commit 8ca411c7ad2c02ae65ae208a3f7483d6e0159c4f ]
wait_eb_writebacks() iterates the fs_info->buffer_tree xarray and waits
for the writeback of these extent-buffers. Waiting for writeback needs
to be done without the rcu_read_lock() held (because it can sleep) and
thus the loop drops the rcu_read_lock() before calling into
wait_on_extent_buffer_writeback(). But extent_buffers are freed through
RCU, so if btrfs_release_extent_buffer_rcu() is scheduled while we're
still waiting on the writeback, the extent_buffer will be freed causing
a use-after-free.
Similar to what is done in find_extent_buffer_nolock(), get a reference
to the extent_buffer before calling into
wait_on_extent_buffer_writeback() so a successful writeback does not
free the extent_buffer while we still have a reference to it.
Fixes: 2dd7e7bc0282 ("btrfs: zoned: wait for extent buffer IOs before finishing a zone")
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 0ff693fea47c3..fe35bd531f70f 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -2482,8 +2482,16 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group)
continue;
if (eb->start >= end)
break;
+ /*
+ * Skip if we can't get the refcount for the extent buffer,
+ * i.e. because it was already written back. Otherwise an eb
+ * disappering underneath us can cause a use-after-free.
+ */
+ if (!refcount_inc_not_zero(&eb->refs))
+ continue;
rcu_read_unlock();
wait_on_extent_buffer_writeback(eb);
+ free_extent_buffer(eb);
rcu_read_lock();
}
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 367/990] btrfs: zoned: requeue block group if zone reset bails out
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (365 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 366/990] btrfs: zoned: fix possible UAF in wait_eb_writebacks() Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 368/990] btrfs: zoned: dont wait for ordered extents in do_zone_finish() Greg Kroah-Hartman
` (485 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Vacek, Johannes Thumshirn,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
[ Upstream commit c5f878eefdd4f559422a68bf49b6f59e7c10e70e ]
btrfs_reset_unused_block_groups() drops the block-group from
fs_info->unused_bgs before performing the work that can actually fail,
the actual submission of a REQ_OP_ZONE_RESET.
Every failed operation after this leaves the block-group dangling,
physically reset, but the in-memory structures aren't and it is not
requeued to be reset on fs_info->unused_bgs.
Instead of bailing out, re-add this block-group to fs_info->unused_bgs
list.
Fixes: 453a73c3069a ("btrfs: zoned: reclaim unused zone by zone resetting")
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index fe35bd531f70f..f25cd3ddbd630 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -3107,6 +3107,8 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
{
struct btrfs_fs_info *fs_info = space_info->fs_info;
const sector_t zone_size_sectors = fs_info->zone_size >> SECTOR_SHIFT;
+ LIST_HEAD(retry_list);
+ int ret = 0;
if (!btrfs_is_zoned(fs_info))
return 0;
@@ -3148,11 +3150,10 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
}
if (!found) {
spin_unlock(&fs_info->unused_bgs_lock);
- return 0;
+ goto out;
}
list_del_init(&bg->bg_list);
- btrfs_put_block_group(bg);
spin_unlock(&fs_info->unused_bgs_lock);
/*
@@ -3166,7 +3167,6 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
for (int i = 0; i < map->num_stripes; i++) {
struct btrfs_io_stripe *stripe = &map->stripes[i];
unsigned int nofs_flags;
- int ret;
nofs_flags = memalloc_nofs_save();
ret = blkdev_zone_mgmt(stripe->dev->bdev, REQ_OP_ZONE_RESET,
@@ -3176,7 +3176,7 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
if (ret) {
up_read(&fs_info->dev_replace.rwsem);
- return ret;
+ goto requeue;
}
}
up_read(&fs_info->dev_replace.rwsem);
@@ -3187,7 +3187,7 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
if (bg->ro) {
spin_unlock(&bg->lock);
spin_unlock(&space_info->lock);
- continue;
+ goto requeue;
}
reclaimed = bg->alloc_offset;
@@ -3215,10 +3215,26 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
btrfs_return_free_space(space_info, reclaimed);
spin_unlock(&space_info->lock);
+ btrfs_put_block_group(bg);
+
if (num_bytes <= reclaimed)
break;
num_bytes -= reclaimed;
+ continue;
+
+requeue:
+ list_add_tail(&bg->bg_list, &retry_list);
+
+ if (ret)
+ goto out;
}
- return 0;
+out:
+ if (!list_empty(&retry_list)) {
+ spin_lock(&fs_info->unused_bgs_lock);
+ list_splice_tail(&retry_list, &fs_info->unused_bgs);
+ spin_unlock(&fs_info->unused_bgs_lock);
+ }
+
+ return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 368/990] btrfs: zoned: dont wait for ordered extents in do_zone_finish()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (366 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 367/990] btrfs: zoned: requeue block group if zone reset bails out Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 369/990] btrfs: zoned: fix lockdep splat on mount Greg Kroah-Hartman
` (484 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Naohiro Aota, Johannes Thumshirn,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
[ Upstream commit bcad7df05237382237ad1517411721d839174009 ]
do_zone_finish() calls btrfs_wait_ordered_roots(), which holds
fs_info->ordered_operations_mutex while waiting for writeback. It can be
reached from writeback itself:
cow_file_range()
`-> btrfs_reserve_extent()
`-> find_free_extent()
`-> btrfs_zone_finish_one_bg()
`-> do_zone_finish()
If another task holds the mutex and waits for that writeback, this
deadlocks.
In general, we want to ensure all writes in the block group to
complete before finishing the zone, as relocation does. However, the
current callers do not need the wait (or cannot wait) in do_zone_finish():
- Relocation already waits for reservations and ordered extents itself
before calling btrfs_zone_finish().
- btrfs_delete_unused_bgs() checks that ->reserved is zero and sets the
block group read-only while holding groups_sem, so there can be no
in-flight data write.
- btrfs_zone_finish_one_bg() is called from the allocation path and
cannot wait.
Dropping the wait is still safe. Once the block group is read-only,
->reserved can only drop, and for data it only drops after the ordered
extent's I/O has completed. So if ->reserved is zero, no data write is
left in flight. If it is non-zero, do_zone_finish() returns -EAGAIN,
which all callers handle.
This makes btrfs_zone_finish_one_bg() fail with -EAGAIN when it races
with an allocation in the selected block group.
Fixes: 393f646e34c1 ("btrfs: zoned: finish least available block group on data bg allocation")
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index f25cd3ddbd630..65c238d38e5d5 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -2575,9 +2575,10 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
/* Ensure all writes in this block group finish */
btrfs_wait_block_group_reservations(block_group);
- /* No need to wait for NOCOW writers. Zoned mode does not allow that */
- btrfs_wait_ordered_roots(fs_info, U64_MAX, block_group);
- /* Wait for extent buffers to be written. */
+ /*
+ * No need to wait for NOCOW writers, as zoned mode does not
+ * allow that, only wait for extent buffers to be written.
+ */
if (is_metadata)
wait_eb_writebacks(block_group);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 369/990] btrfs: zoned: fix lockdep splat on mount
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (367 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 368/990] btrfs: zoned: dont wait for ordered extents in do_zone_finish() Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 370/990] btrfs: zstd: prevent leak of workspace below maximum level Greg Kroah-Hartman
` (483 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Naohiro Aota, Johannes Thumshirn,
David Sterba, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
[ Upstream commit 04df03585f0d8ef2727e043119bba2cdfac2d8d7 ]
When mounting a filesystem on a zoned drive passed into a VM via a
virtio-blk disk lockdep sporadically complains about a possible deadlock
between BTRFS' dev_replace::rwsem and virtio-blk's vdev_mutex:
======================================================
WARNING: possible circular locking dependency detected
7.3.0-rc6+ #317 Not tainted
------------------------------------------------------
mount/7418 is trying to acquire lock:
ffff888102c07860 (&vblk->vdev_mutex){+.+.}-{4:4}, at: virtblk_report_zones+0xda/0x440
but task is already holding lock:
ffff8881fd725ea8 (&fs_info->dev_replace.rwsem){++++}-{4:4}, at: btrfs_load_block_group_zone_info+0x186/0xe50
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #4 (&fs_info->dev_replace.rwsem){++++}-{4:4}:
down_read+0x42/0x170
btrfs_map_block+0x1a6/0xe70
btrfs_submit_bbio+0x1a3/0x910
submit_one_bio+0x93/0xd0
btrfs_readahead+0x1c4/0x200
read_pages+0x56/0x200
page_cache_ra_order+0x27c/0x410
filemap_get_pages+0x12f/0x4a0
filemap_read+0xed/0x400
vfs_read+0x240/0x340
ksys_read+0x61/0xd0
do_syscall_64+0xa3/0x4f0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
-> #3 (mapping.invalidate_lock#3){++++}-{4:4}:
down_read+0x42/0x170
filemap_fault+0xb0/0x1a40
__do_fault+0x34/0xc0
__handle_mm_fault+0x919/0x1db0
handle_mm_fault+0x97/0x240
do_user_addr_fault+0x21d/0x690
exc_page_fault+0x8e/0x230
asm_exc_page_fault+0x26/0x30
-> #2 (vm_lock){++++}-{0:0}:
__vma_start_exclude_readers+0x91/0x1b0
__vma_start_write+0x47/0xd0
vma_expand+0x4c/0x2a0
relocate_vma_down+0x126/0x200
setup_arg_pages+0x240/0x3e0
load_elf_binary+0x1be/0x1860
bprm_execve+0x2d2/0x7b0
kernel_execve+0x107/0x130
kernel_init+0xc2/0x130
ret_from_fork+0x1ff/0x2f0
ret_from_fork_asm+0x1a/0x30
-> #1 (&mm->mmap_lock){++++}-{4:4}:
__might_fault+0x68/0xa0
_copy_to_user+0x22/0x70
blkdev_copy_zone_to_user+0x22/0x40
virtblk_report_zones+0x297/0x440
blkdev_report_zones_ioctl+0xfd/0x130
blkdev_ioctl+0x20f/0x2c0
__x64_sys_ioctl+0x86/0xd0
do_syscall_64+0xa3/0x4f0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
-> #0 (&vblk->vdev_mutex){+.+.}-{4:4}:
__lock_acquire+0x15a8/0x2850
lock_acquire+0xea/0x2f0
__mutex_lock+0xa7/0x10d0
virtblk_report_zones+0xda/0x440
blkdev_report_zones_cached+0x162/0x190
btrfs_get_dev_zones+0xdc/0x2c0
btrfs_load_block_group_zone_info+0x2b6/0xe50
btrfs_read_block_groups+0x338/0xc80
open_ctree+0x1aca/0x24b3
btrfs_get_tree.cold+0x105/0x26c
vfs_get_tree+0x28/0xb0
__do_sys_fsconfig+0x324/0x690
do_syscall_64+0xa3/0x4f0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
other info that might help us debug this:
Chain exists of:
&vblk->vdev_mutex --> mapping.invalidate_lock#3 --> &fs_info->dev_replace.rwsem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
rlock(&fs_info->dev_replace.rwsem);
lock(mapping.invalidate_lock#3);
lock(&fs_info->dev_replace.rwsem);
lock(&vblk->vdev_mutex);
*** DEADLOCK ***
locks held by mount/7418: 3, last CPU#0:
#0: ffff888110aa6868 (&fc->uapi_mutex){+.+.}-{4:4}, at: __do_sys_fsconfig+0x2ae/0x690
#1: ffff888112ba20e8 (&type->s_umount_key#31/1){+.+.}-{4:4}, at: sget_fc+0x148/0x8d0
#2: ffff8881fd725ea8 (&fs_info->dev_replace.rwsem){++++}-{4:4}, at: btrfs_load_block_group_zone_info+0x186/0xe50
Holding the rwsem was widened in 0090d6e1b210 ("btrfs: zoned: fix
use-after-free due to race with dev replace"), but it now also covers
calling into blkdev_report_zones_cached(). The device replace ioctl()
only works on a mounted filesystem and the only caller with setting
'new' to false is read_one_block_group() which is only called during
mount, so it is safe to drop the rwsem before calling into
blkdev_report_zones_cached().
Fixes: 0090d6e1b210 ("btrfs: zoned: fix use-after-free due to race with dev replace")
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/zoned.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 65c238d38e5d5..a7f1a1b908641 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1378,11 +1378,13 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
return 0;
}
+ ASSERT(!test_bit(BTRFS_FS_OPEN, &fs_info->flags));
+ up_read(&dev_replace->rwsem);
+
nofs_flag = memalloc_nofs_save();
ret = btrfs_get_dev_zone(device, info->physical, &zone);
memalloc_nofs_restore(nofs_flag);
if (ret) {
- up_read(&dev_replace->rwsem);
if (ret != -EIO && ret != -EOPNOTSUPP)
return ret;
info->alloc_offset = WP_MISSING_DEV;
@@ -1394,7 +1396,6 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
"zoned: unexpected conventional zone %llu on device %s (devid %llu)",
zone.start << SECTOR_SHIFT, rcu_dereference(device->name),
device->devid);
- up_read(&dev_replace->rwsem);
return -EIO;
}
@@ -1422,8 +1423,6 @@ static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
break;
}
- up_read(&dev_replace->rwsem);
-
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 370/990] btrfs: zstd: prevent leak of workspace below maximum level
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (368 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 369/990] btrfs: zoned: fix lockdep splat on mount Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 371/990] btrfs: handle zero num_stripes in btrfs_chunk_item_size() Greg Kroah-Hartman
` (482 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 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 bb66a38f5812f2c04abd4eb6e586a12b5a95172a ]
When putting a workspace we always protect the workspace for the maximum
level from reclaim, since it can be used not just for that level but as
well for any level below it. However the logic is flawed because if we do
the put for a workspace at level 10 for example (maximum is level 15) and
there is currently no idle workspace for the maximum level because all
are currently being used, we don't add the workspace to the LRU list and
that can result in leaking it if we don't get more compression or
decompression requests for level 10 or any level below 10.
Fix this by skipping the addition to the LRU list only if the level of
the workspace matches the maximum level too (besides the list of idle
workspaces for the maximum level being empty).
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c
index baaf3c1436323..ced6406425f9d 100644
--- a/fs/btrfs/zstd.c
+++ b/fs/btrfs/zstd.c
@@ -347,7 +347,8 @@ void zstd_put_workspace(struct btrfs_fs_info *fs_info, struct list_head *ws)
/* A node is only taken off the lru if we are the corresponding level */
if (clip_level(workspace->req_level) == workspace->level) {
/* Hide a max level workspace from reclaim */
- if (list_empty(&zwsm->idle_ws[ZSTD_BTRFS_MAX_LEVEL - 1])) {
+ if (workspace->level == ZSTD_BTRFS_MAX_LEVEL - 1 &&
+ list_empty(&zwsm->idle_ws[ZSTD_BTRFS_MAX_LEVEL - 1])) {
INIT_LIST_HEAD(&workspace->lru_list);
} else {
workspace->last_used = jiffies;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 371/990] btrfs: handle zero num_stripes in btrfs_chunk_item_size()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (369 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 370/990] btrfs: zstd: prevent leak of workspace below maximum level Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 372/990] tcp: try to avoid safer when ACKs are thinned Greg Kroah-Hartman
` (481 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 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 8416012aa6e794a6464e073ab236f4ff862935ac ]
validate_sys_chunk_array() calls btrfs_chunk_item_size() with the
on-disk num_stripes before btrfs_check_chunk_valid() has checked the
chunk. With CONFIG_BTRFS_ASSERT=y, a zero-stripe system chunk trips
ASSERT(num_stripes) instead of being rejected:
assertion failed: num_stripes, in fs/btrfs/volumes.h:714
kernel BUG at fs/btrfs/volumes.h:714!
RIP: 0010:btrfs_validate_super+0x3ce7/0x4210
Call Trace:
open_ctree
btrfs_get_tree
vfs_get_tree
do_new_mount
Drop the assertion and compute the size as the chunk header plus
num_stripes stripes. The size is unchanged for num_stripes > 0, and a
zero-stripe chunk now reaches btrfs_check_chunk_valid(), which rejects
it, so the mount fails with -EUCLEAN.
Suggested-by: Qu Wenruo <wqu@suse.com>
Link: https://lore.kernel.org/linux-btrfs/d2ee0cc1-674e-4447-88da-d346122a43a4@suse.com/
Fixes: 2a9bb78cfd36 ("btrfs: validate system chunk array at btrfs_validate_super()")
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
[ Slightly rework the commit message. ]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/volumes.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index b3b9329f4cf9a..eeb0c506acfbb 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -712,9 +712,8 @@ static inline enum btrfs_map_op btrfs_op(const struct bio *bio)
static inline unsigned long btrfs_chunk_item_size(int num_stripes)
{
- ASSERT(num_stripes);
- return sizeof(struct btrfs_chunk) +
- sizeof(struct btrfs_stripe) * (num_stripes - 1);
+ return offsetof(struct btrfs_chunk, stripe) +
+ sizeof(struct btrfs_stripe) * num_stripes;
}
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 372/990] tcp: try to avoid safer when ACKs are thinned
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (370 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 371/990] btrfs: handle zero num_stripes in btrfs_chunk_item_size() Greg Kroah-Hartman
@ 2026-11-25 14:28 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 373/990] tcp: move tp->delivered and tp->delivered_ce to tcp_sock_write_tx group Greg Kroah-Hartman
` (480 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:28 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilpo Järvinen, Chia-Yu Chang,
Paolo Abeni, Eric Dumazet, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <ij@kernel.org>
[ Upstream commit 7885ce0147401d5f6908ad4da660334031d836b7 ]
Add newly acked pkts EWMA. When ACK thinning occurs, select
between safer and unsafe cep delta in AccECN processing based
on it. If the packets ACKed per ACK tends to be large, don't
conservatively assume ACE field overflow.
This patch uses the existing 2-byte holes in the rx group for new
u16 variables withtout creating more holes. Below are the pahole
outcomes before and after this patch:
[BEFORE THIS PATCH]
struct tcp_sock {
[...]
u32 delivered_ecn_bytes[3]; /* 2744 12 */
/* XXX 4 bytes hole, try to pack */
[...]
__cacheline_group_end__tcp_sock_write_rx[0]; /* 2816 0 */
[...]
/* size: 3264, cachelines: 51, members: 177 */
}
[AFTER THIS PATCH]
struct tcp_sock {
[...]
u32 delivered_ecn_bytes[3]; /* 2744 12 */
u16 pkts_acked_ewma; /* 2756 2 */
/* XXX 2 bytes hole, try to pack */
[...]
__cacheline_group_end__tcp_sock_write_rx[0]; /* 2816 0 */
[...]
/* size: 3264, cachelines: 51, members: 178 */
}
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Co-developed-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260131222515.8485-2-chia-yu.chang@nokia-bell-labs.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: c2213d9b61c1 ("tcp: rate limit receive queue collapsing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../networking/net_cachelines/tcp_sock.rst | 1 +
include/linux/tcp.h | 1 +
net/ipv4/tcp.c | 2 ++
net/ipv4/tcp_input.c | 20 ++++++++++++++++++-
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Documentation/networking/net_cachelines/tcp_sock.rst b/Documentation/networking/net_cachelines/tcp_sock.rst
index 26f32dbcf6ec9..563daea10d6c5 100644
--- a/Documentation/networking/net_cachelines/tcp_sock.rst
+++ b/Documentation/networking/net_cachelines/tcp_sock.rst
@@ -105,6 +105,7 @@ u32 received_ce read_mostly read_w
u32[3] received_ecn_bytes read_mostly read_write
u8:4 received_ce_pending read_mostly read_write
u32[3] delivered_ecn_bytes read_write
+u16 pkts_acked_ewma read_write
u8:2 syn_ect_snt write_mostly read_write
u8:2 syn_ect_rcv read_mostly read_write
u8:2 accecn_minlen write_mostly read_write
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index c718516bcbee3..98e626bde8d61 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -348,6 +348,7 @@ struct tcp_sock {
u32 rate_interval_us; /* saved rate sample: time elapsed */
u32 rcv_rtt_last_tsecr;
u32 delivered_ecn_bytes[3];
+ u16 pkts_acked_ewma;/* Pkts acked EWMA for AccECN cep heuristic */
u64 first_tx_mstamp; /* start of window send phase */
u64 delivered_mstamp; /* time we reached "delivered" */
u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 5f983535bc1d6..d41a94bf29ddf 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3426,6 +3426,7 @@ int tcp_disconnect(struct sock *sk, int flags)
tcp_accecn_init_counters(tp);
tp->prev_ecnfield = 0;
tp->accecn_opt_tstamp = 0;
+ tp->pkts_acked_ewma = 0;
if (icsk->icsk_ca_initialized && icsk->icsk_ca_ops->release)
icsk->icsk_ca_ops->release(sk);
memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv));
@@ -5243,6 +5244,7 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rate_interval_us);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_last_tsecr);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_ecn_bytes);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, pkts_acked_ewma);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, first_tx_mstamp);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_mstamp);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_acked);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 5e73232873fab..13373917c5a99 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -489,6 +489,10 @@ static void tcp_count_delivered(struct tcp_sock *tp, u32 delivered,
tcp_count_delivered_ce(tp, delivered);
}
+#define PKTS_ACKED_WEIGHT 6
+#define PKTS_ACKED_PREC 6
+#define ACK_COMP_THRESH 4
+
/* Returns the ECN CE delta */
static u32 __tcp_accecn_process(struct sock *sk, const struct sk_buff *skb,
u32 delivered_pkts, u32 delivered_bytes,
@@ -500,6 +504,7 @@ static u32 __tcp_accecn_process(struct sock *sk, const struct sk_buff *skb,
u32 delta, safe_delta, d_ceb;
bool opt_deltas_valid;
u32 corrected_ace;
+ u32 ewma;
/* Reordered ACK or uncertain due to lack of data to send and ts */
if (!(flag & (FLAG_FORWARD_PROGRESS | FLAG_TS_PROGRESS)))
@@ -508,6 +513,18 @@ static u32 __tcp_accecn_process(struct sock *sk, const struct sk_buff *skb,
opt_deltas_valid = tcp_accecn_process_option(tp, skb,
delivered_bytes, flag);
+ if (delivered_pkts) {
+ if (!tp->pkts_acked_ewma) {
+ ewma = delivered_pkts << PKTS_ACKED_PREC;
+ } else {
+ ewma = tp->pkts_acked_ewma;
+ ewma = (((ewma << PKTS_ACKED_WEIGHT) - ewma) +
+ (delivered_pkts << PKTS_ACKED_PREC)) >>
+ PKTS_ACKED_WEIGHT;
+ }
+ tp->pkts_acked_ewma = min_t(u32, ewma, 0xFFFFU);
+ }
+
if (!(flag & FLAG_SLOWPATH)) {
/* AccECN counter might overflow on large ACKs */
if (delivered_pkts <= TCP_ACCECN_CEP_ACE_MASK)
@@ -556,7 +573,8 @@ static u32 __tcp_accecn_process(struct sock *sk, const struct sk_buff *skb,
if (d_ceb <
safe_delta * tp->mss_cache >> TCP_ACCECN_SAFETY_SHIFT)
return delta;
- }
+ } else if (tp->pkts_acked_ewma > (ACK_COMP_THRESH << PKTS_ACKED_PREC))
+ return delta;
return safe_delta;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 373/990] tcp: move tp->delivered and tp->delivered_ce to tcp_sock_write_tx group
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (371 preceding siblings ...)
2026-11-25 14:28 ` [PATCH 6.18 372/990] tcp: try to avoid safer when ACKs are thinned Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 374/990] tcp: move tp->segs_in and tp->segs_out to tcp_sock_write_txrx group Greg Kroah-Hartman
` (479 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, 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 9f810527a343fd72671fe7661ebb3694396f45ed ]
These counters are changed whenever sent data is acknowleged.
They do not belong to tcp_sock_write_txrx group, because TCP receivers
do not touch them.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260430100021.211139-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: c2213d9b61c1 ("tcp: rate limit receive queue collapsing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/networking/net_cachelines/tcp_sock.rst | 4 ++--
include/linux/tcp.h | 4 ++--
net/ipv4/tcp.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Documentation/networking/net_cachelines/tcp_sock.rst b/Documentation/networking/net_cachelines/tcp_sock.rst
index 563daea10d6c5..3e1851e5e6e77 100644
--- a/Documentation/networking/net_cachelines/tcp_sock.rst
+++ b/Documentation/networking/net_cachelines/tcp_sock.rst
@@ -99,8 +99,8 @@ u32 snd_cwnd_stamp
u32 prior_cwnd
u32 prr_delivered
u32 prr_out read_mostly read_mostly tcp_rate_skb_sent,tcp_newly_delivered(tx);tcp_ack,tcp_rate_gen,tcp_clean_rtx_queue(rx)
-u32 delivered read_mostly read_write tcp_rate_skb_sent, tcp_newly_delivered(tx);tcp_ack, tcp_rate_gen, tcp_clean_rtx_queue (rx)
-u32 delivered_ce read_mostly read_write tcp_rate_skb_sent(tx);tcp_rate_gen(rx)
+u32 delivered read_write tcp_rate_skb_sent, tcp_newly_delivered(tx);tcp_ack, tcp_rate_gen, tcp_clean_rtx_queue (rx)
+u32 delivered_ce read_write tcp_rate_skb_sent(tx);tcp_rate_gen(rx)
u32 received_ce read_mostly read_write
u32[3] received_ecn_bytes read_mostly read_write
u8:4 received_ce_pending read_mostly read_write
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 98e626bde8d61..64f5a09f4c47b 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -265,6 +265,8 @@ struct tcp_sock {
u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
* total number of data segments sent.
*/
+ u32 delivered; /* Total data packets delivered incl. rexmits */
+ u32 delivered_ce; /* Like the above but only ECE marked packets */
u64 bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut
* total number of data bytes sent.
*/
@@ -312,8 +314,6 @@ struct tcp_sock {
u32 srtt_us; /* smoothed round trip time << 3 in usecs */
u32 packets_out; /* Packets which are "in flight" */
u32 snd_up; /* Urgent pointer */
- u32 delivered; /* Total data packets delivered incl. rexmits */
- u32 delivered_ce; /* Like the above but only ECE marked packets */
u32 received_ce; /* Like the above but for rcvd CE marked pkts */
u32 received_ecn_bytes[3]; /* received byte counters for three ECN
* types: INET_ECN_ECT_1, INET_ECN_ECT_0,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index d41a94bf29ddf..a130fc5e033c9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -5198,6 +5198,8 @@ static void __init tcp_struct_check(void)
/* TX read-write hotpath cache lines */
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, segs_out);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, data_segs_out);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered_ce);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, bytes_sent);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, snd_sml);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_start);
@@ -5224,8 +5226,6 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, srtt_us);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, packets_out);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_up);
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, delivered);
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, delivered_ce);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, received_ce);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, received_ecn_bytes);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, app_limited);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 374/990] tcp: move tp->segs_in and tp->segs_out to tcp_sock_write_txrx group
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (372 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 373/990] tcp: move tp->delivered and tp->delivered_ce to tcp_sock_write_tx group Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 375/990] tcp: move tp->first_tx_mstamp and tp->delivered_mstamp to tcp_sock_write_tx Greg Kroah-Hartman
` (478 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, 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 2b28dd212a8ad67b100137626a3d008b1e40a740 ]
segs_in is changed for each incoming packet, including ACK packets.
segs_out is changed for each outgoing packet, including ACK packets.
They belong to tcp_sock_write_txrx group.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260430100021.211139-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: c2213d9b61c1 ("tcp: rate limit receive queue collapsing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../networking/net_cachelines/tcp_sock.rst | 4 ++--
include/linux/tcp.h | 18 +++++++++---------
net/ipv4/tcp.c | 4 ++--
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/Documentation/networking/net_cachelines/tcp_sock.rst b/Documentation/networking/net_cachelines/tcp_sock.rst
index 3e1851e5e6e77..f03ee3c804a23 100644
--- a/Documentation/networking/net_cachelines/tcp_sock.rst
+++ b/Documentation/networking/net_cachelines/tcp_sock.rst
@@ -13,13 +13,13 @@ u16 tcp_header_len read_mostly read_m
u16 gso_segs read_mostly tcp_xmit_size_goal
__be32 pred_flags read_write read_mostly tcp_select_window(tx);tcp_rcv_established(rx)
u64 bytes_received read_write tcp_rcv_nxt_update(rx)
-u32 segs_in read_write tcp_v6_rcv(rx)
+u32 segs_in read_write read_write tcp_segs_in(),tcp_v6_rcv(rx),tcp_v4_rcv()
u32 data_segs_in read_write tcp_v6_rcv(rx)
u32 rcv_nxt read_mostly read_write tcp_cleanup_rbuf,tcp_send_ack,tcp_inq_hint,tcp_transmit_skb,tcp_receive_window(tx);tcp_v6_do_rcv,tcp_rcv_established,tcp_data_queue,tcp_receive_window,tcp_rcv_nxt_update(write)(rx)
u32 copied_seq read_mostly tcp_cleanup_rbuf,tcp_rcv_space_adjust,tcp_inq_hint
u32 rcv_wup read_write __tcp_cleanup_rbuf,tcp_receive_window,tcp_receive_established
u32 snd_nxt read_write read_mostly tcp_rate_check_app_limited,__tcp_transmit_skb,tcp_event_new_data_sent(write)(tx);tcp_rcv_established,tcp_ack,tcp_clean_rtx_queue(rx)
-u32 segs_out read_write __tcp_transmit_skb
+u32 segs_out read_write read_write __tcp_transmit_skb
u32 data_segs_out read_write __tcp_transmit_skb,tcp_update_skb_after_send
u64 bytes_sent read_write __tcp_transmit_skb
u64 bytes_acked read_write tcp_snd_una_update/tcp_ack
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 64f5a09f4c47b..492b9bfe6b1d2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -259,17 +259,14 @@ struct tcp_sock {
/* TX read-write hotpath cache lines */
__cacheline_group_begin(tcp_sock_write_tx) ____cacheline_aligned;
- u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut
- * The total number of segments sent.
- */
- u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
- * total number of data segments sent.
- */
u32 delivered; /* Total data packets delivered incl. rexmits */
u32 delivered_ce; /* Like the above but only ECE marked packets */
u64 bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut
* total number of data bytes sent.
*/
+ u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
+ * total number of data segments sent.
+ */
u32 snd_sml; /* Last byte of the most recently transmitted small packet */
u8 chrono_type; /* current chronograph type */
u32 chrono_start; /* Start time in jiffies of a TCP chrono */
@@ -326,6 +323,12 @@ struct tcp_sock {
* Options received (usually on last packet, some only on SYN packets).
*/
struct tcp_options_received rx_opt;
+ u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn
+ * total number of segments in.
+ */
+ u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut
+ * The total number of segments sent.
+ */
__cacheline_group_end(tcp_sock_write_txrx);
/* RX read-write hotpath cache lines */
@@ -335,9 +338,6 @@ struct tcp_sock {
* sum(delta(rcv_nxt)), or how many bytes
* were acked.
*/
- u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn
- * total number of segments in.
- */
u32 data_segs_in; /* RFC4898 tcpEStatsPerfDataSegsIn
* total number of data segments in.
*/
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index a130fc5e033c9..bb918059224e4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -5196,7 +5196,6 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, snd_ssthresh);
/* TX read-write hotpath cache lines */
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, segs_out);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, data_segs_out);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered_ce);
@@ -5232,10 +5231,11 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_wnd);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_tstamp);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rx_opt);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, segs_in);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, segs_out);
/* RX read-write hotpath cache lines */
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_received);
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, segs_in);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, data_segs_in);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_wup);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, max_packets_out);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 375/990] tcp: move tp->first_tx_mstamp and tp->delivered_mstamp to tcp_sock_write_tx
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (373 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 374/990] tcp: move tp->segs_in and tp->segs_out to tcp_sock_write_txrx group Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 376/990] tcp: move tp->bytes_acked to tcp_sock_write_tx group Greg Kroah-Hartman
` (477 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, 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 07db42c4b3eb60a21645ad88211b69933eab0a03 ]
These fields are touched in when payload is sent.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260430100021.211139-4-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: c2213d9b61c1 ("tcp: rate limit receive queue collapsing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/tcp.h | 4 ++--
net/ipv4/tcp.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 492b9bfe6b1d2..37511ef31888e 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -264,6 +264,8 @@ struct tcp_sock {
u64 bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut
* total number of data bytes sent.
*/
+ u64 first_tx_mstamp; /* start of window send phase */
+ u64 delivered_mstamp; /* time we reached "delivered" */
u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
* total number of data segments sent.
*/
@@ -349,8 +351,6 @@ struct tcp_sock {
u32 rcv_rtt_last_tsecr;
u32 delivered_ecn_bytes[3];
u16 pkts_acked_ewma;/* Pkts acked EWMA for AccECN cep heuristic */
- u64 first_tx_mstamp; /* start of window send phase */
- u64 delivered_mstamp; /* time we reached "delivered" */
u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
* sum(delta(snd_una)), or how many bytes
* were acked.
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bb918059224e4..6cd8670d5e96c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -5200,6 +5200,8 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered_ce);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, bytes_sent);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, first_tx_mstamp);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered_mstamp);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, snd_sml);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_start);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_stat);
@@ -5245,8 +5247,6 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_last_tsecr);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_ecn_bytes);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, pkts_acked_ewma);
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, first_tx_mstamp);
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_mstamp);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_acked);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_est);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcvq_space);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 376/990] tcp: move tp->bytes_acked to tcp_sock_write_tx group
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (374 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 375/990] tcp: move tp->first_tx_mstamp and tp->delivered_mstamp to tcp_sock_write_tx Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 377/990] tcp: rate limit receive queue collapsing Greg Kroah-Hartman
` (476 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, 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 dd033ec406b4d9eade3e0fd998ec9bfa50db42ba ]
tp->bytes_acked is touched in TX path only.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260430100021.211139-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: c2213d9b61c1 ("tcp: rate limit receive queue collapsing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/networking/net_cachelines/tcp_sock.rst | 2 +-
include/linux/tcp.h | 8 ++++----
net/ipv4/tcp.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Documentation/networking/net_cachelines/tcp_sock.rst b/Documentation/networking/net_cachelines/tcp_sock.rst
index f03ee3c804a23..430317cdb8f64 100644
--- a/Documentation/networking/net_cachelines/tcp_sock.rst
+++ b/Documentation/networking/net_cachelines/tcp_sock.rst
@@ -22,7 +22,7 @@ u32 snd_nxt read_write read_m
u32 segs_out read_write read_write __tcp_transmit_skb
u32 data_segs_out read_write __tcp_transmit_skb,tcp_update_skb_after_send
u64 bytes_sent read_write __tcp_transmit_skb
-u64 bytes_acked read_write tcp_snd_una_update/tcp_ack
+u64 bytes_acked read_write tcp_snd_una_update/tcp_ack
u32 dsack_dups
u32 snd_una read_mostly read_write tcp_wnd_end,tcp_urg_mode,tcp_minshall_check,tcp_cwnd_validate(tx);tcp_ack,tcp_may_update_window,tcp_clean_rtx_queue(write),tcp_ack_tstamp(rx)
u32 snd_sml read_write tcp_minshall_check,tcp_minshall_update
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 37511ef31888e..db348f06ec3e0 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -261,6 +261,10 @@ struct tcp_sock {
__cacheline_group_begin(tcp_sock_write_tx) ____cacheline_aligned;
u32 delivered; /* Total data packets delivered incl. rexmits */
u32 delivered_ce; /* Like the above but only ECE marked packets */
+ u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
+ * sum(delta(snd_una)), or how many bytes
+ * were acked.
+ */
u64 bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut
* total number of data bytes sent.
*/
@@ -351,10 +355,6 @@ struct tcp_sock {
u32 rcv_rtt_last_tsecr;
u32 delivered_ecn_bytes[3];
u16 pkts_acked_ewma;/* Pkts acked EWMA for AccECN cep heuristic */
- u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
- * sum(delta(snd_una)), or how many bytes
- * were acked.
- */
struct {
u32 rtt_us;
u32 seq;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6cd8670d5e96c..fb571e0dd40c9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -5199,6 +5199,7 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, data_segs_out);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered_ce);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, bytes_acked);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, bytes_sent);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, first_tx_mstamp);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, delivered_mstamp);
@@ -5247,7 +5248,6 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_last_tsecr);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_ecn_bytes);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, pkts_acked_ewma);
- CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_acked);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_est);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcvq_space);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 377/990] tcp: rate limit receive queue collapsing
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (375 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 376/990] tcp: move tp->bytes_acked to tcp_sock_write_tx group Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 378/990] NFSv4.1: retain MDS I/O until both thresholds are met Greg Kroah-Hartman
` (475 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Eric Dumazet,
Willem de Bruijn, Kuniyuki Iwashima, Neal Cardwell,
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 c2213d9b61c1d6e99645a636630ee767c7542f78 ]
When a socket is over its receive buffer limit and its sk_rcvbuf can
not grow, every incoming segment that needs memory goes through
tcp_prune_queue(), which runs tcp_collapse_ofo_queue() and tcp_collapse()
on the receive queue. Both walk their whole queue, even when there is
nothing left to collapse.
A peer can trigger this walk per packet, without refilling memory:
1) The segment lands last in the out-of-order queue. Since commit
b0e01253a764 ("tcp: refine tcp_prune_ofo_queue() logic"),
tcp_prune_ofo_queue() drops nothing, the segment is dropped and
the queues are unchanged. The peer can send it again forever.
2) The segment lands second to last: one skb is pruned, and one small
segment fills that space again.
3) The out-of-order queue is empty and the receive queue alone is over
the limit (application not reading). Collapsing frees nothing,
the out-of-order segment is dropped, and the window is not closed.
4) Collapsing frees just one skb, enough to queue the segment. The next
segment is over the limit again.
Only allow a collapse if at least 1/8 of sk_rcvbuf of new memory was
queued in the receive queues since the previous collapse. This restores
the "12.5 % of the queue capacity" amortization of the 2018 SegmentSmack
fixes (CVE-2018-5390), using the same unit as the sk_rcvbuf limit, so
that peers sending small (bloated) segments are not penalized.
The credit is the net growth of sk_rmem_alloc in tcp_queue_rcv() and
tcp_data_queue_ofo(), so that:
- Coalescing a segment into the tailroom of the previous skb charges no
memory, and earns no credit.
- An out-of-order segment replacing or covering queued skbs only earns
the memory it adds.
- Duplicates earn nothing.
- Data moved from the out-of-order queue to the receive queue
(tcp_ofo_queue()) is not credited twice.
In-order data is credited too, so that a receive queue filled by
bloated in-order segments can still be collapsed when a hole appears.
In-order segments are rate limited as well: a peer could otherwise send
small in-order segments that each trigger a collapse freeing a single
skb, enough to queue the segment, while the out-of-order queue holds
many skbs that can not be collapsed.
The credit is tracked in a new u32 tp->rcv_collapse_credit, placed in a
hole of the tcp_sock_write_rx group: no other field moves, and tcp_sock
size is unchanged. tcp_queue_rcv() now samples sk_rmem_alloc, and
writes the credit until it saturates at sk_rcvbuf, so that the fast path
stops writing it after a full buffer of new memory. Saturating at the
goal would not work: sk_rcvbuf, and the goal with it, can grow later
(for instance in tcp_clamp_window(), just before the goal is checked),
and a socket over its limit can not earn more credit until the
application reads.
When collapsing is not allowed, tcp_prune_queue() goes directly to
tcp_prune_ofo_queue(), which is cheap in the cases above.
A regular flow can see a difference when it goes over its limit before
1/8 of sk_rcvbuf of new memory was queued since the previous collapse:
out-of-order skbs can be pruned (even for an in-order segment filling a
hole), and an in-order segment that still does not fit is dropped,
with a zero window advertised, where a collapse might have made room.
Fixes: b0e01253a764 ("tcp: refine tcp_prune_ofo_queue() logic")
Reported-by: Chris Mason <mason@kernel.org>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Link: https://patch.msgid.link/20261105124043.1543405-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../networking/net_cachelines/tcp_sock.rst | 1 +
include/linux/tcp.h | 1 +
net/ipv4/tcp.c | 2 +
net/ipv4/tcp_input.c | 55 +++++++++++++++----
4 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/Documentation/networking/net_cachelines/tcp_sock.rst b/Documentation/networking/net_cachelines/tcp_sock.rst
index 430317cdb8f64..48fbc27044bf2 100644
--- a/Documentation/networking/net_cachelines/tcp_sock.rst
+++ b/Documentation/networking/net_cachelines/tcp_sock.rst
@@ -106,6 +106,7 @@ u32[3] received_ecn_bytes read_mostly read_w
u8:4 received_ce_pending read_mostly read_write
u32[3] delivered_ecn_bytes read_write
u16 pkts_acked_ewma read_write
+u32 rcv_collapse_credit read_write tcp_queue_rcv,tcp_data_queue_ofo,tcp_prune_queue
u8:2 syn_ect_snt write_mostly read_write
u8:2 syn_ect_rcv read_mostly read_write
u8:2 accecn_minlen write_mostly read_write
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index db348f06ec3e0..7cc2ddcd9bc0d 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -355,6 +355,7 @@ struct tcp_sock {
u32 rcv_rtt_last_tsecr;
u32 delivered_ecn_bytes[3];
u16 pkts_acked_ewma;/* Pkts acked EWMA for AccECN cep heuristic */
+ u32 rcv_collapse_credit; /* memory queued since last collapse */
struct {
u32 rtt_us;
u32 seq;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index fb571e0dd40c9..9e861f346e45c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3477,6 +3477,7 @@ int tcp_disconnect(struct sock *sk, int flags)
tp->rx_opt.dsack = 0;
tp->rx_opt.num_sacks = 0;
tp->rcv_ooopack = 0;
+ tp->rcv_collapse_credit = 0;
/* Clean up fastopen related fields */
@@ -5248,6 +5249,7 @@ static void __init tcp_struct_check(void)
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_last_tsecr);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_ecn_bytes);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, pkts_acked_ewma);
+ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_collapse_credit);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_est);
CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcvq_space);
}
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 13373917c5a99..7b5839236f77c 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5184,6 +5184,20 @@ static int tcp_try_rmem_schedule(struct sock *sk, const struct sk_buff *skb,
return 0;
}
+/* Credit the memory added to the receive queues since @rmem was sampled
+ * toward the next allowed collapse. Saturate at sk_rcvbuf, not at the goal
+ * checked in tcp_prune_queue(): sk_rcvbuf (and the goal) can grow later,
+ * for instance in tcp_clamp_window().
+ */
+static void tcp_collapse_credit_add(struct sock *sk, int rmem)
+{
+ struct tcp_sock *tp = tcp_sk(sk);
+ int delta = atomic_read(&sk->sk_rmem_alloc) - rmem;
+
+ if (delta > 0 && tp->rcv_collapse_credit < (u32)sk->sk_rcvbuf)
+ tp->rcv_collapse_credit += delta;
+}
+
static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
@@ -5191,6 +5205,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
struct sk_buff *skb1;
u32 seq, end_seq;
bool fragstolen;
+ int rmem;
tcp_save_lrcv_flowlabel(sk, skb);
tcp_data_ecn_check(sk, skb);
@@ -5201,6 +5216,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
tcp_drop_reason(sk, skb, SKB_DROP_REASON_PROTO_MEM);
return;
}
+ /* Sampled after tcp_try_rmem_schedule(), which can prune. */
+ rmem = atomic_read(&sk->sk_rmem_alloc);
tcp_measure_rcv_mss(sk, skb);
/* Disable header prediction. */
@@ -5330,6 +5347,10 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
skb_condense(skb);
skb_set_owner_r(skb, sk);
}
+ /* Net growth: coalescing can charge nothing, and covered skbs
+ * were freed.
+ */
+ tcp_collapse_credit_add(sk, rmem);
/* do not grow rcvbuf for not-yet-accepted or orphaned sockets. */
if (sk->sk_socket)
tcp_rcvbuf_grow(sk, tp->rcvq_space.space);
@@ -5338,8 +5359,9 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb,
bool *fragstolen)
{
- int eaten;
+ int rmem = atomic_read(&sk->sk_rmem_alloc);
struct sk_buff *tail = skb_peek_tail(&sk->sk_receive_queue);
+ int eaten;
eaten = (tail &&
tcp_try_coalesce(sk, tail,
@@ -5349,6 +5371,7 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb,
tcp_add_receive_queue(sk, skb);
skb_set_owner_r(skb, sk);
}
+ tcp_collapse_credit_add(sk, rmem);
return eaten;
}
@@ -5836,18 +5859,28 @@ static int tcp_prune_queue(struct sock *sk, const struct sk_buff *in_skb)
if (tcp_can_ingest(sk, in_skb))
return 0;
- tcp_collapse_ofo_queue(sk);
- if (!skb_queue_empty(&sk->sk_receive_queue))
- tcp_collapse(sk, &sk->sk_receive_queue, NULL,
- skb_peek(&sk->sk_receive_queue),
- NULL,
- tp->copied_seq, tp->rcv_nxt);
+ /* Collapsing walks both queues and is expensive, and can free
+ * almost nothing. Require at least 1/8 of sk_rcvbuf of new memory
+ * in the receive queues since the previous collapse, otherwise
+ * a stream of segments could trigger one collapse per packet.
+ */
+ if (tp->rcv_collapse_credit >= (u32)sk->sk_rcvbuf >> 3) {
+ tp->rcv_collapse_credit = 0;
- if (tcp_can_ingest(sk, in_skb))
- return 0;
+ tcp_collapse_ofo_queue(sk);
+ if (!skb_queue_empty(&sk->sk_receive_queue))
+ tcp_collapse(sk, &sk->sk_receive_queue, NULL,
+ skb_peek(&sk->sk_receive_queue),
+ NULL,
+ tp->copied_seq, tp->rcv_nxt);
- /* Collapsing did not help, destructive actions follow.
- * This must not ever occur. */
+ if (tcp_can_ingest(sk, in_skb))
+ return 0;
+ }
+
+ /* Collapsing did not help (or was not allowed),
+ * destructive actions follow.
+ */
tcp_prune_ofo_queue(sk, in_skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 378/990] NFSv4.1: retain MDS I/O until both thresholds are met
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (376 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 377/990] tcp: rate limit receive queue collapsing Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 379/990] NFS: honor UTIME_NOW atime with explicit mtime Greg Kroah-Hartman
` (474 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit eab627dcd18a18a44a2cbee47df3058d3637ba0d ]
When both size and I/O thresholds are configured,
pnfs_within_mdsthreshold() uses size && io to decide whether to
keep I/O on the MDS. Both variables indicate an unmet threshold,
so reaching only one threshold returns false and may trigger
pNFS layout acquisition while the other threshold remains unmet.
Use logical OR instead of AND to stay with MDS I/O until both
thresholds are met, as recommended by RFC 8881 Section 5.12.6.
The new RFC contains the same threshold selection rule as RFC
5661 which is referenced in function comment.
Fixes: d23d61c8d351 ("NFSv4.1 test the mdsthreshold hint parameters")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/pnfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3d2d219a24e47..e389fb5159d67 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2059,7 +2059,7 @@ static bool pnfs_within_mdsthreshold(struct nfs_open_context *ctx,
break;
}
if (size_set && io_set) {
- if (size && io)
+ if (size || io)
ret = true;
} else if (size || io)
ret = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 379/990] NFS: honor UTIME_NOW atime with explicit mtime
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (377 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 378/990] NFSv4.1: retain MDS I/O until both thresholds are met Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 380/990] nfs: fix utimensat() for atime with delegated timestamps Greg Kroah-Hartman
` (473 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 2ffcf17d26dabef5793aeadf75a23c595a72be08 ]
When utimensat() requests UTIME_NOW for atime and an explicit mtime,
the VFS sets ATTR_ATIME but not ATTR_ATIME_SET (as it should). The
delegated explicit-mtime path calls nfs_set_timestamps_to_ts(), which
skips atime, but nfs_setattr() then clears ATTR_ATIME, allowing the
syscall to succeed without updating atime.
The delegated explicit-mtime path already updates ctime locally.
The VFS also supplies the requested atime value in ia_atime,
even when ATTR_ATIME_SET is absent.
Check ATTR_ATIME instead of ATTR_ATIME_SET to also apply the
UTIME_NOW atime value supplied by the VFS.
Fixes: aba41e90aade ("NFSv4.2: fix setattr caching of TIME_[MODIFY|ACCESS]_SET when timestamps are delegated")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 970e67768d67e..f74273cca3503 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -662,7 +662,7 @@ static void nfs_set_timestamps_to_ts(struct inode *inode, struct iattr *attr)
inode_maybe_inc_iversion(inode, updated);
cache_flags |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
}
- if (attr->ia_valid & ATTR_ATIME_SET) {
+ if (attr->ia_valid & ATTR_ATIME) {
inode_set_atime_to_ts(inode, attr->ia_atime);
cache_flags |= NFS_INO_INVALID_ATIME;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 380/990] nfs: fix utimensat() for atime with delegated timestamps
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (378 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 379/990] NFS: honor UTIME_NOW atime with explicit mtime Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 381/990] NFS: update ctime for atime-only UTIME_NOW requests Greg Kroah-Hartman
` (472 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Olga Kornievskaia, Jeff Layton,
Trond Myklebust, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <jlayton@kernel.org>
[ Upstream commit 16d99dce938ecbbc703843a31fb951acca46af27 ]
xfstest generic/221 is failing with delegated timestamps enabled. When
the client holds a WRITE_ATTRS_DELEG delegation, and a userland process
does a utimensat() for only the atime, the ctime is not properly
updated. The problem is that the client tries to cache the atime update,
but there is no mtime update, so the delegated attribute update never
updates the ctime.
Delegated timestamps don't have a mechanism to update the ctime in
accordance with atime-only changes due to utimensat() and the like.
Change the client to issue an RPC in this case, so that the ctime gets
properly updated alongside the atime.
Fixes: 40f45ab3814f ("NFS: Further fixes to attribute delegation a/mtime changes")
Reported-by: Olga Kornievskaia <aglo@umich.edu>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Stable-dep-of: a38d7cc8c90f ("NFS: update ctime for atime-only UTIME_NOW requests")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/inode.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index f74273cca3503..1edc11cd286aa 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -758,14 +758,7 @@ nfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
} else if (nfs_have_delegated_atime(inode) &&
attr->ia_valid & ATTR_ATIME &&
!(attr->ia_valid & ATTR_MTIME)) {
- if (attr->ia_valid & ATTR_ATIME_SET) {
- if (uid_eq(task_uid, owner_uid)) {
- spin_lock(&inode->i_lock);
- nfs_set_timestamps_to_ts(inode, attr);
- spin_unlock(&inode->i_lock);
- attr->ia_valid &= ~(ATTR_ATIME|ATTR_ATIME_SET);
- }
- } else {
+ if (!(attr->ia_valid & ATTR_ATIME_SET)) {
nfs_update_delegated_atime(inode);
attr->ia_valid &= ~ATTR_ATIME;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 381/990] NFS: update ctime for atime-only UTIME_NOW requests
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (379 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 380/990] nfs: fix utimensat() for atime with delegated timestamps Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 382/990] NFS: Fix inverted cross-directory rename check Greg Kroah-Hartman
` (471 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit a38d7cc8c90f0d093550487c2905b51db0be1522 ]
When an NFS client holds a timestamp delegation, utimensat()
with atime set to UTIME_NOW and mtime set to UTIME_OMIT reaches
nfs_setattr() with ATTR_TIMES_SET but without ATTR_ATIME_SET.
There may be other paths that can reach here as well.
The delegated-atime fast path treats this as an implicit atime
update, clears ATTR_ATIME and returns success without updating
ctime.
Add check for ATTR_TIMES_SET along with ATTR_ATIME_SET (OR) so
explicit timestamp requests use the normal SETATTR path while
incidental atime updates can keep using the local shortcut.
Fixes: e12912d94137 ("NFSv4: Add support for delegated atime and mtime attributes")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 1edc11cd286aa..f985bf55a4d51 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -758,7 +758,7 @@ nfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
} else if (nfs_have_delegated_atime(inode) &&
attr->ia_valid & ATTR_ATIME &&
!(attr->ia_valid & ATTR_MTIME)) {
- if (!(attr->ia_valid & ATTR_ATIME_SET)) {
+ if (!(attr->ia_valid & (ATTR_ATIME_SET | ATTR_TIMES_SET))) {
nfs_update_delegated_atime(inode);
attr->ia_valid &= ~ATTR_ATIME;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 382/990] NFS: Fix inverted cross-directory rename check
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (380 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 381/990] NFS: update ctime for atime-only UTIME_NOW requests Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 383/990] NFS: restore directory index when resuming readdir Greg Kroah-Hartman
` (470 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit b9d518902ff1969f93d2b4787951d98e50ab0181 ]
nfs_rename_is_unsafe_cross_dir() returns false for cross-directory
renames, causing nfs_rename() to skip nfs_sync_inode() even when
filehandles may expire on rename. Same-directory renames may instead
trigger unnecessary synchronization.
Current condition directly contradicts the function name/comments.
Return false for same-directory renames so cross-directory renames
reach the existing filehandle-volatility check. Keep the conservative
fallback unchanged..
Fixes: dcd21b609d4ab ("NFS: Avoid flushing data while holding directory locks in nfs_rename()")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 4dc91428c79cc..ca91e48dc7973 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2687,7 +2687,7 @@ static bool nfs_rename_is_unsafe_cross_dir(struct dentry *old_dentry,
{
struct nfs_server *server = NFS_SB(old_dentry->d_sb);
- if (old_dentry->d_parent != new_dentry->d_parent)
+ if (old_dentry->d_parent == new_dentry->d_parent)
return false;
if (server->fh_expire_type & NFS_FH_RENAME_UNSAFE)
return !(server->fh_expire_type & NFS_FH_NOEXPIRE_WITH_OPEN);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 383/990] NFS: restore directory index when resuming readdir
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (381 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 382/990] NFS: Fix inverted cross-directory rename check Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 384/990] SUNRPC: wake poll waiters when an empty pipe is unlinked Greg Kroah-Hartman
` (469 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 89b91409b2342e7629b1271eba315a0f06495247 ]
nfs_readdir() restores the cached folio index and cookie when
resuming directory iteration, but leaves current_index at zero.
In 32-bit index mode, nfs_readdir_search_for_cookie() then
reports a folio-relative offset instead of the absolute entry
position.
Restore current_index from the saved logical folio index before
searching the cache.
This solution relies on the current behavior of
nfs_readdir_seek_next_array(), where folio_index advances by
one and current_index advances by nfs_readdir_array_maxentries()
for each full, nonterminal folio.
Fixes: f648022faa68e ("NFS: Convert readdir page cache to use a cookie based index")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/dir.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index ca91e48dc7973..bd35069ffe5cd 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1255,6 +1255,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
spin_lock(&file->f_lock);
desc->dir_cookie = dir_ctx->dir_cookie;
desc->folio_index = dir_ctx->page_index;
+ desc->current_index = (loff_t)desc->folio_index *
+ nfs_readdir_array_maxentries();
desc->last_cookie = dir_ctx->last_cookie;
desc->attr_gencount = dir_ctx->attr_gencount;
desc->eof = dir_ctx->eof;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 384/990] SUNRPC: wake poll waiters when an empty pipe is unlinked
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (382 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 383/990] NFS: restore directory index when resuming readdir Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 385/990] SUNRPC: preserve fatal network errors during RPC binding Greg Kroah-Hartman
` (468 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Jeff Layton, NeilBrown,
Anna Schumaker, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 702d55edc017632a0c39c1d4bdd579bdbadfd730 ]
When an empty rpc_pipefs pipe is unlinked, rpc_purge_list() returns
without waking the pipe wait queue. An existing epoll waiter can
remain blocked even though rpc_pipe_poll() reports EPOLLHUP and
EPOLLERR for the disconnected pipe.
Wake the wait queue after clearing RPC_I(inode)->pipe so existing
poll waiters are notified regardless of whether messages were purged.
Fixes: 9842ef3557ab ("SUNRPC: rpc_timeout_upcall_queue should not sleep")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/rpc_pipe.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 0bd1df2ebb479..3a71426e8b76a 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -191,6 +191,7 @@ rpc_close_pipes(struct dentry *dentry)
cancel_delayed_work_sync(&pipe->queue_timeout);
rpc_inode_setowner(inode, NULL);
RPC_I(inode)->pipe = NULL;
+ wake_up(&RPC_I(inode)->waitq);
inode_unlock(inode);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 385/990] SUNRPC: preserve fatal network errors during RPC binding
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (383 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 384/990] SUNRPC: wake poll waiters when an empty pipe is unlinked Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 386/990] SUNRPC: preserve timeout policy when cloning clients Greg Kroah-Hartman
` (467 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 30150b94c70eff4bf916d7d367ecf75de25d5337 ]
call_bind_status() initializes status to -EIO. When an unbound
transport's port lookup fails with -ENETDOWN or -ENETUNREACH
and RPC_TASK_NETUNREACH_FATAL is set, the function exits the
switch without updating status. The RPC task then reports -EIO
instead of the network error.
This can occur during NFSv3 port discovery with nconnect,
when an additional transport has not yet bound.
Preserve task->tk_status in the fatal branch. Leave the nonfatal
retry handling unchanged.
Fixes: 9827144bfb2b ("NFS: Treat ENETUNREACH errors as fatal in containers")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 07de0efaf37db..bb96cbaf02208 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2125,8 +2125,10 @@ call_bind_status(struct rpc_task *task)
goto retry_timeout;
case -ENETDOWN:
case -ENETUNREACH:
- if (task->tk_flags & RPC_TASK_NETUNREACH_FATAL)
+ if (task->tk_flags & RPC_TASK_NETUNREACH_FATAL) {
+ status = task->tk_status;
break;
+ }
fallthrough;
case -ECONNREFUSED: /* connection problems */
case -ECONNRESET:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 386/990] SUNRPC: preserve timeout policy when cloning clients
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (384 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 385/990] SUNRPC: preserve fatal network errors during RPC binding Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 387/990] SUNRPC: preserve transport security " Greg Kroah-Hartman
` (466 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 5b0ac1f82201c2ab2d9c31ed568cc782bac6a399 ]
rpc_clone_client() and rpc_clone_client_set_auth() leave the
timeout argument unset, causing rpc_new_client() to use the
transport defaults instead of the parent's configured
timeout. This also affects pNFS data-server clients and
changes their request timeout and initial RTT calculations.
Use the parent's cl_timeout when no timeout is specified.
Preserve explicitly supplied timeout overrides.
Fixes: 1b63a75180c6 ("SUNRPC: Refactor rpc_clone_client()")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index bb96cbaf02208..a234c9fedbdfd 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -653,6 +653,8 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
}
args->servername = xprt->servername;
args->nodename = clnt->cl_nodename;
+ if (!args->timeout)
+ args->timeout = clnt->cl_timeout;
new = rpc_new_client(args, xps, xprt, clnt);
if (IS_ERR(new))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 387/990] SUNRPC: preserve transport security policy when cloning clients
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (385 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 386/990] SUNRPC: preserve timeout policy when cloning clients Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 388/990] SUNRPC: Balance switch queue length on transport removal Greg Kroah-Hartman
` (465 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 7783534ce5fee57adf1b9025745c9af2e1ce2ccd ]
RPC client cloning does not copy the parent's transport security
policy into the new client. Clones consequently lose their TLS
policy and certificate/key serials, even though the shared
transport remains protected.
When NFSv4 migration replaces a cloned client's TLS transport, the
missing security policy causes xs_setup_tcp_tls() to return -EACCES.
Copy the parent's cl_xprtsec into the clone arguments before
creating the new client.
Fixes: 500053191297 ("SUNRPC: Plumb an API for setting transport layer security")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index a234c9fedbdfd..30c996750bd4b 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -653,6 +653,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
}
args->servername = xprt->servername;
args->nodename = clnt->cl_nodename;
+ args->xprtsec = clnt->cl_xprtsec;
if (!args->timeout)
args->timeout = clnt->cl_timeout;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 388/990] SUNRPC: Balance switch queue length on transport removal
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (386 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 387/990] SUNRPC: preserve transport security " Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 389/990] SUNRPC: Balance queue accounting when relocating a task Greg Kroah-Hartman
` (464 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit 8acd94f02a960c8936df25a7af9c02c8ea87064d ]
When call_connect_status() moves a task off a transport marked for
removal, it decrements xprt->queuelen but leaves the switch's
xps_queuelen unchanged. The stale count persists after the task
finishes and skews multipath transport selection.
Decrement xps_queuelen alongside xprt->queuelen, matching the normal
transport release path.
Fixes: 6f081693e7b2 ("sunrpc: remove an offlined xprt using sysfs")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 30c996750bd4b..963e9362bfbfc 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2262,6 +2262,7 @@ call_connect_status(struct rpc_task *task)
xprt_release(task);
value = atomic_long_dec_return(&xprt->queuelen);
+ atomic_long_dec(&xps->xps_queuelen);
if (value == 0)
rpc_xprt_switch_remove_xprt(xps, saved,
true);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 389/990] SUNRPC: Balance queue accounting when relocating a task
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (387 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 388/990] SUNRPC: Balance switch queue length on transport removal Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 390/990] NFS/localio: hold the client across an asynchronous LOCALIO probe Greg Kroah-Hartman
` (463 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit f14b157168ac106cfac6d577e08726488b1b886c ]
When rpc_task_set_transport() relocates a movable task from an
offline transport, it releases the request and drops the
transport reference without decrementing the old transport's
queuelen or the switch's xps_queuelen. Releasing the task
later only accounts for the replacement transport.
The stale counts affect transport selection and can prevent
xprt_delete_locked() from removing an otherwise idle transport.
Use rpc_task_release_xprt() to balance the previous assignment
before selecting a replacement. Pass clnt explicitly because
rpc_task_set_client() can assign a transport before tk_client
is initialized.
Fixes: 82ee41b85cef ("SUNRPC don't resend a task on an offlined transport")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 963e9362bfbfc..9c6cdc29102a5 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1197,7 +1197,7 @@ void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)
(task->tk_flags & RPC_TASK_MOVEABLE)))
return;
xprt_release(task);
- xprt_put(task->tk_xprt);
+ rpc_task_release_xprt(clnt, task->tk_xprt);
}
if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
task->tk_xprt = rpc_task_get_first_xprt(clnt);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 390/990] NFS/localio: hold the client across an asynchronous LOCALIO probe
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (388 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 389/990] SUNRPC: Balance queue accounting when relocating a task Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 391/990] ublk: publish a new device by its id only once it is set up Greg Kroah-Hartman
` (462 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mike Snitzer, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <snitzer@kernel.org>
[ Upstream commit 000a87910213562ff09f5bc38cd366ce34fccf71 ]
nfs_local_probe_async() queues the client's own cl_local_probe_work
without a reference on the client, and nfs_free_client() does not cancel
it. The work takes a reference only once it runs. If the last
nfs_put_client() comes first, for example at umount after an NFSv3 I/O
queued a throttled probe, the client is freed with its work queued, and
the work then runs on freed memory.
Take the reference when the work is queued, and drop it when the work
has run. If the work is already queued, it already holds a reference,
and the one just taken is dropped.
Fixes: 76d4cb6345da ("nfs: probe for LOCALIO when v4 client reconnects to server")
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/localio.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index 3138439d19109..f4bd5922e6ba6 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -204,15 +204,22 @@ void nfs_local_probe_async_work(struct work_struct *work)
struct nfs_client *clp =
container_of(work, struct nfs_client, cl_local_probe_work);
- if (!refcount_inc_not_zero(&clp->cl_count))
- return;
nfs_local_probe(clp);
+ /* The reference nfs_local_probe_async() took for this work */
nfs_put_client(clp);
}
+/*
+ * The work is part of the client, so it holds a reference on the client
+ * from when it is queued until it has run: the last nfs_put_client()
+ * cannot free the client under a queued probe.
+ */
void nfs_local_probe_async(struct nfs_client *clp)
{
- queue_work(nfsiod_workqueue, &clp->cl_local_probe_work);
+ if (!refcount_inc_not_zero(&clp->cl_count))
+ return;
+ if (!queue_work(nfsiod_workqueue, &clp->cl_local_probe_work))
+ nfs_put_client(clp); /* already queued, with its reference */
}
EXPORT_SYMBOL_GPL(nfs_local_probe_async);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 391/990] ublk: publish a new device by its id only once it is set up
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (389 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 390/990] NFS/localio: hold the client across an asynchronous LOCALIO probe Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 392/990] net: skbuff: preserve fclone lifetime when freeing stolen heads Greg Kroah-Hartman
` (461 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mark Korenberg, Ming Lei, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Korenberg <socketpair@gmail.com>
[ Upstream commit e5c463e5074a940c644d54d8fc29aba06709aab0 ]
ADD_DEV stores the device in ublk_index_idr when it allocates the id,
and control commands find it there as soon as ublk_add_chdev() has
initialized its struct device, before the char device is added. If
dev_set_name() or cdev_device_add() then fails, ublk_add_chdev() drops
the initial reference to free the device. A DEL_DEV that found the
device meanwhile waits for ublk_ctl_mutex, then calls ublk_remove():
cdev_device_del() of a device that was never added, and a second put of
the initial reference, which frees the device under the callers still
holding references.
Reserve the id with a NULL entry, which idr_find() and the idr iterators
skip, and store the device once ublk_add_chdev() succeeded.
Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
Signed-off-by: Mark Korenberg <socketpair@gmail.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261105-ublk-del-gendisk-hang-v1-1-913a91a4314d@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/ublk_drv.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 8db1f9d9272c6..60bc10ca5ef2b 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -2905,14 +2905,18 @@ static int ublk_alloc_dev_number(struct ublk_device *ub, int idx)
int i = idx;
int err;
+ /*
+ * Only reserve the id: the device is published by
+ * ublk_publish_dev_number() once it is fully set up.
+ */
spin_lock(&ublk_idr_lock);
/* allocate id, if @id >= 0, we're requesting that specific id */
if (i >= 0) {
- err = idr_alloc(&ublk_index_idr, ub, i, i + 1, GFP_NOWAIT);
+ err = idr_alloc(&ublk_index_idr, NULL, i, i + 1, GFP_NOWAIT);
if (err == -ENOSPC)
err = -EEXIST;
} else {
- err = idr_alloc(&ublk_index_idr, ub, 0, UBLK_MAX_UBLKS,
+ err = idr_alloc(&ublk_index_idr, NULL, 0, UBLK_MAX_UBLKS,
GFP_NOWAIT);
}
spin_unlock(&ublk_idr_lock);
@@ -2923,6 +2927,19 @@ static int ublk_alloc_dev_number(struct ublk_device *ub, int idx)
return err;
}
+/*
+ * Make the device visible to control commands by its id. Before its char
+ * device is added, DEL_DEV could find it and remove a char device that was
+ * never added, and drop the reference that ublk_add_chdev() drops on
+ * failure.
+ */
+static void ublk_publish_dev_number(struct ublk_device *ub)
+{
+ spin_lock(&ublk_idr_lock);
+ WARN_ON_ONCE(idr_replace(&ublk_index_idr, ub, ub->ub_number) != NULL);
+ spin_unlock(&ublk_idr_lock);
+}
+
static void ublk_free_dev_number(struct ublk_device *ub)
{
spin_lock(&ublk_idr_lock);
@@ -3409,6 +3426,8 @@ static int ublk_ctrl_add_dev(const struct ublksrv_ctrl_cmd *header)
* ublk_add_chdev() will cleanup everything if it fails.
*/
ret = ublk_add_chdev(ub);
+ if (!ret)
+ ublk_publish_dev_number(ub);
goto out_unlock;
out_deinit_queues:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 392/990] net: skbuff: preserve fclone lifetime when freeing stolen heads
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (390 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 391/990] ublk: publish a new device by its id only once it is set up Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 393/990] xsk: fix list corruption in xsk_buff_add_frag() Greg Kroah-Hartman
` (460 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 86706ffa990ecd46a4326f8eecbccbbd60a6cb8d ]
skb_morph() can give an skb from skbuff_fclone_cache a page-fragment
head without changing its fclone tag. IPv4 reassembly can produce such
an skb, which can subsequently reach the GRO stolen-head path.
napi_skb_free_stolen_head() puts the shell into the ordinary NAPI skb
cache without dropping its fclone_ref. If the embedded companion is
still live, KASAN poisons it along with the original, and later cache
reuse or eviction can overwrite or free the allocation underneath it.
A mirrored batman-adv DAT packet retained in a plug qdisc reproduces a
KASAN use-after-free in plug_dequeue().
Use kfree_skbmem() for fclones in napi_skb_free_stolen_head(), retaining
NAPI caching for ordinary skb heads. Also use kfree_skbmem() in
kfree_skb_partial(), whose stolen-head branch has the same assumption
about the allocation cache. This releases the shell according to its
allocation kind and preserves any live companion without freeing the
data that has been transferred to the receiving skb.
Fixes: f450d539c05a ("skbuff: introduce {,__}napi_build_skb() which reuses NAPI cache heads")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Link: https://patch.msgid.link/20261030042329.74461-1-kylebot@openai.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f1b0045667124..de69f89086513 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1458,6 +1458,10 @@ void napi_skb_free_stolen_head(struct sk_buff *skb)
skb_orphan(skb);
skb->slow_gro = 0;
}
+ if (skb->fclone != SKB_FCLONE_UNAVAILABLE) {
+ kfree_skbmem(skb);
+ return;
+ }
napi_skb_cache_put(skb);
}
@@ -6126,7 +6130,7 @@ void kfree_skb_partial(struct sk_buff *skb, bool head_stolen)
{
if (head_stolen) {
skb_release_head_state(skb);
- kmem_cache_free(net_hotdata.skbuff_cache, skb);
+ kfree_skbmem(skb);
} else {
__kfree_skb(skb);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 393/990] xsk: fix list corruption in xsk_buff_add_frag()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (391 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 392/990] net: skbuff: preserve fclone lifetime when freeing stolen heads Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 394/990] i40e: xsk: fix xsk_buff_add_frag() error handling in Rx Greg Kroah-Hartman
` (459 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nagato Shiratana, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit 94ae1259175f566ed5a33f37b09b6f32a1b2d8af ]
In aligned mode, a fill ring address maps straight to its pool->heads[]
entry. If user space posts the same address twice, a driver can pass
xsk_buff_add_frag() a buffer that is the head of the frame or is
already on pool->xskb_list or pool->free_list.
Re-adding a linked node corrupts the list. With buffers A, B, C, B,
xsk_rcv_zc() emits two descriptors instead of four and leaves the list
head pointing at a self-linked B. When the Rx ring later has no room
for a frame, the xsk_buff_free() cleanup follows B into pool->free_list
and passes the list head to xp_free():
BUG: kernel NULL pointer dereference, address: 00000000000000c0
RIP: 0010:xp_free+0x1a/0x50
Call Trace:
xsk_rcv_zc+0xca/0x200
The head is not on any list and needs a separate check. Adding it as
its own frag lets bpf_xdp_adjust_tail() free the in-use head and wrap
sinfo->nr_frags to 255.
Reject such buffers before adding them to the frags array, as commit
e37b2abca804 ("xsk: fix NULL pointer dereference in __xsk_rcv()") does
in the copy path. Callers already drop the frame on failure.
Unaligned mode is not affected, as each fill ring entry gets its own
xskb from pool->free_heads[].
Reproduced with a KUnit test feeding synthetic buffers to xsk_rcv_zc(),
by Nagato Shiratana.
Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX")
Reported-by: Nagato Shiratana <zuomao338@gmail.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-2-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/xdp_sock_drv.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h
index 21c3b757bb883..e87d081e8e053 100644
--- a/include/net/xdp_sock_drv.h
+++ b/include/net/xdp_sock_drv.h
@@ -156,15 +156,18 @@ static inline void xsk_buff_free(struct xdp_buff *xdp)
static inline bool xsk_buff_add_frag(struct xdp_buff *head,
struct xdp_buff *xdp)
{
+ struct xdp_buff_xsk *frag = container_of(xdp, struct xdp_buff_xsk, xdp);
const void *data = xdp->data;
- struct xdp_buff_xsk *frag;
+
+ /* Duplicate fill ring entries map to the same xskb in aligned mode */
+ if (unlikely(xdp == head || !list_empty(&frag->list_node)))
+ return false;
if (!__xdp_buff_add_frag(head, virt_to_netmem(data),
offset_in_page(data), xdp->data_end - data,
xdp->frame_sz, false))
return false;
- frag = container_of(xdp, struct xdp_buff_xsk, xdp);
list_add_tail(&frag->list_node, &frag->pool->xskb_list);
return true;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 394/990] i40e: xsk: fix xsk_buff_add_frag() error handling in Rx
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (392 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 393/990] xsk: fix list corruption in xsk_buff_add_frag() Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 395/990] ice: xsk: fix leaking Rx buffers in multi-buffer path Greg Kroah-Hartman
` (458 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit a259b7ec09efec032d5521dc2eb751a959c11d15 ]
When xsk_buff_add_frag() fails, i40e_clean_rx_irq_zc() frees the frame
but stays on the current descriptor, so the next poll restarts from the
freed head. If the frags array was full, the retry passes on a frame
missing the freed frags, with its head already on the free list. If the
buffer is a duplicate, every poll fails the same way and the queue
stalls.
Free the current buffer along with the frame and move on to the next
descriptor, as ice does. The rest of the dropped frame is received as
a new frame. xp_free() skips a duplicate already freed with the frame.
Fixes: 1c9ba9c14658 ("i40e: xsk: add RX multi-buffer support")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-3-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/i40e/i40e_xsk.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 9f47388eaba53..624f85851a7d1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -459,16 +459,24 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
xsk_buff_set_size(bi, size);
xsk_buff_dma_sync_for_cpu(bi);
- if (!first)
+ if (++next_to_process == count)
+ next_to_process = 0;
+
+ if (!first) {
first = bi;
- else if (!xsk_buff_add_frag(first, bi)) {
+ } else if (!xsk_buff_add_frag(first, bi)) {
+ /* Drop what has been gathered so far. xp_free() skips
+ * @bi if it duplicates a buffer that is already on a
+ * pool list. Remaining buffers of this packet, if any,
+ * will be processed as a new packet.
+ */
xsk_buff_free(first);
- break;
+ xsk_buff_free(bi);
+ next_to_clean = next_to_process;
+ first = NULL;
+ continue;
}
- if (++next_to_process == count)
- next_to_process = 0;
-
if (i40e_is_non_eop(rx_ring, rx_desc))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 395/990] ice: xsk: fix leaking Rx buffers in multi-buffer path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (393 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 394/990] i40e: xsk: fix xsk_buff_add_frag() error handling in Rx Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 396/990] ice: xsk: do not free in-flight frags on XDP_TX completion Greg Kroah-Hartman
` (457 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit 8b7bd01b9c56c0d1f65d0e2ad304b775e0d709e3 ]
ice_clean_rx_irq_zc() consumes a descriptor without freeing its buffer
when a frag has zero length or when xsk_buff_add_frag() fails, which
happens if the frags array is full or the fill ring has duplicates.
Such buffers are lost to user space until the socket is closed.
Free the buffer in both cases. xp_free() skips a duplicate already
freed with the frame.
Fixes: 1bbc04de607b ("ice: xsk: add RX multi-buffer support")
Fixes: 93f53db9f9dc ("ice: switch to Page Pool")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-4-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_xsk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 102631398af3c..6dfc6fd34c886 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -619,8 +619,11 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring,
if (!first) {
first = xdp;
- } else if (likely(size) && !xsk_buff_add_frag(first, xdp)) {
+ } else if (unlikely(!size)) {
+ xsk_buff_free(xdp);
+ } else if (!xsk_buff_add_frag(first, xdp)) {
xsk_buff_free(first);
+ xsk_buff_free(xdp);
first = NULL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 396/990] ice: xsk: do not free in-flight frags on XDP_TX completion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (394 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 395/990] ice: xsk: fix leaking Rx buffers in multi-buffer path Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 397/990] libeth: " Greg Kroah-Hartman
` (456 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit 5a9b5e315e101dfa02af5d8d3b27d893ba3e5566 ]
ice_xmit_xdp_tx_zc() takes the frags of a multi-buffer frame off
pool->xskb_list but leaves XDP_FLAGS_HAS_FRAGS set on the head. When
the head completes, xsk_buff_free() frees whatever is on the list at
that point, which are the frags of a frame still being received.
If ice_xmit_xdp_tx_zc() completes such a head while cleaning the ring
before sending another frame, xsk_buff_get_frag() returns NULL and
xsk_buff_xdp_get_dma() dereferences it.
Clear the flag on the head once its frags are on the ring. As
xdp_get_buff_len() then covers only the head, count Rx bytes before
running the XDP program, like libeth does.
Fixes: eeb2b5381038 ("ice: xsk: Tx multi-buffer support")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-5-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_xsk.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 6dfc6fd34c886..2009744a9f6a4 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -494,6 +494,11 @@ static int ice_xmit_xdp_tx_zc(struct xdp_buff *xdp,
tx_desc->cmd_type_offset_bsz |=
cpu_to_le64(ICE_TX_DESC_CMD_EOP << ICE_TXD_QW1_CMD_S);
+ /* Each frag is now freed via its own Tx buffer. Completing the head
+ * must not release what is on the pool's frag list at that time.
+ */
+ xdp_buff_clear_frags_flag(head);
+
return ICE_XDP_TX;
busy:
@@ -593,6 +598,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring,
struct sk_buff *skb;
u16 stat_err_bits;
u16 vlan_tci;
+ u32 xdp_len;
rx_desc = ICE_RX_DESC(rx_ring, ntc);
@@ -635,6 +641,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring,
((struct libeth_xdp_buff *)first)->desc = rx_desc;
+ xdp_len = xdp_get_buff_len(first);
xdp_res = ice_run_xdp_zc(rx_ring, first, xdp_prog, xdp_ring,
xsk_pool);
if (likely(xdp_res & (ICE_XDP_TX | ICE_XDP_REDIR))) {
@@ -649,7 +656,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring,
goto construct_skb;
}
- total_rx_bytes += xdp_get_buff_len(first);
+ total_rx_bytes += xdp_len;
total_rx_packets++;
first = NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 397/990] libeth: xsk: do not free in-flight frags on XDP_TX completion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (395 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 396/990] ice: xsk: do not free in-flight frags on XDP_TX completion Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 398/990] i40e: xsk: fix multi-buffer XDP_PASS skb construction Greg Kroah-Hartman
` (455 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit 90e5d84086d95ac45197028b98ad9059b245fc1c ]
libeth_xsk_tx_queue_bulk() takes the frags of a multi-buffer frame off
pool->xskb_list but leaves XDP_FLAGS_HAS_FRAGS set on the head. When
the head completes, libeth_xsk_buff_free_slow() frees whatever is on
the list at that point.
The XDPSQ can be completed by a bulk flush while the frags of a frame
are being queued, or by its cleanup timer while a partial Rx frame is
stashed. Those frags are then freed while in use, and the frame being
queued is sent truncated.
Clear the flag on the head once all of its frags are queued.
Fixes: b3ad8450b4dc ("libeth: xsk: add XSk XDP_TX sending helpers")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-6-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/libeth/xsk.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/net/libeth/xsk.h b/include/net/libeth/xsk.h
index 3d77e72a8cc81..edc0eba471c44 100644
--- a/include/net/libeth/xsk.h
+++ b/include/net/libeth/xsk.h
@@ -77,11 +77,17 @@ libeth_xsk_tx_queue_bulk(struct libeth_xdp_tx_bulk *bq,
if (!libeth_xsk_tx_queue_head(bq, xdp))
goto out;
- for (const struct libeth_xdp_buff *head = xdp; ; ) {
+ for (struct libeth_xdp_buff *head = xdp; ; ) {
xdp = container_of(xsk_buff_get_frag(&head->base),
typeof(*xdp), base);
- if (!xdp)
+ if (!xdp) {
+ /* Each frag is now freed via its own SQE. Freeing
+ * the head must not release what is on the pool's
+ * frag list at that time.
+ */
+ xdp_buff_clear_frags_flag(&head->base);
break;
+ }
if (unlikely(bq->count == LIBETH_XDP_TX_BULK) &&
unlikely(!flush_bulk(bq, LIBETH_XDP_TX_XSK))) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 398/990] i40e: xsk: fix multi-buffer XDP_PASS skb construction
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (396 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 397/990] libeth: " Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 399/990] ice: xsk: free stashed Rx frame when cleaning the ring Greg Kroah-Hartman
` (454 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chenguang Zhao, Aleksandr Loktionov,
Jason Xing, Maciej Fijalkowski, Patryk Holda, Tony Nguyen,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenguang Zhao <zhaochenguang@kylinos.cn>
[ Upstream commit 76b41e83e69ae4ab23cc3535e36b780ea17e76c2 ]
When AF_XDP ZC receives a multi-buffer frame and the XDP program
returns XDP_PASS, i40e_construct_skb_zc() copies frags into a new
skb. The copy used skb_frag_page() as the memcpy source (page
metadata instead of packet data) and passed a virtual address to
__skb_fill_page_desc_noacc(), which expects a struct page *.
Use skb_frag_address() for the copy, attach frags with
skb_add_rx_frag() so len/data_len/truesize are updated, and on
dev_alloc_page() failure free the skb via the shared out path so
xsk_buff_free() still runs and previously attached pages are
released by kfree_skb.
Fixes: 1c9ba9c14658 ("i40e: xsk: add RX multi-buffer support")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Patryk Holda <patryk.holda@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-8-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/i40e/i40e_xsk.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 624f85851a7d1..e48fee2a4229e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -318,22 +318,19 @@ static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring,
goto out;
for (int i = 0; i < nr_frags; i++) {
- struct skb_shared_info *skinfo = skb_shinfo(skb);
skb_frag_t *frag = &sinfo->frags[i];
+ unsigned int frag_size = skb_frag_size(frag);
struct page *page;
- void *addr;
page = dev_alloc_page();
if (!page) {
dev_kfree_skb(skb);
- return NULL;
+ skb = NULL;
+ goto out;
}
- addr = page_to_virt(page);
- memcpy(addr, skb_frag_page(frag), skb_frag_size(frag));
-
- __skb_fill_page_desc_noacc(skinfo, skinfo->nr_frags++,
- addr, 0, skb_frag_size(frag));
+ memcpy(page_to_virt(page), skb_frag_address(frag), frag_size);
+ skb_add_rx_frag(skb, i, page, 0, frag_size, PAGE_SIZE);
}
out:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 399/990] ice: xsk: free stashed Rx frame when cleaning the ring
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (397 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 398/990] i40e: xsk: fix multi-buffer XDP_PASS skb construction Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 400/990] idpf: free stashed XSk Rx frame when releasing the queue Greg Kroah-Hartman
` (453 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit d5e7a86b7cd6c38a628635baace7eb2fdce14a43 ]
ice_clean_rx_irq_zc() stashes a partially received multi-buffer frame
in rx_ring->xsk, with its frags on pool->xskb_list. next_to_clean is
already past its buffers, so ice_xsk_clean_rx_ring(), which walks
next_to_clean..next_to_use, misses the frame, and ice_vsi_cfg_rxq()
later clears the pointer via ring->xdp.data.
The buffers are lost to user space and, as the pool outlives the ring
across ifdown/ifup or a reset, the stale frags are taken as frags of
the next frame. Before commit 93f53db9f9dc ("ice: switch to Page
Pool"), the frame was tracked by rx_ring->first_desc and leaked the
same way.
Free the stashed frame when cleaning the ring.
Fixes: 1bbc04de607b ("ice: xsk: add RX multi-buffer support")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-9-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_xsk.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 2009744a9f6a4..9840522d65dac 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -913,6 +913,11 @@ void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring)
if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))
xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
+ if (rx_ring->xsk) {
+ xsk_buff_free(&rx_ring->xsk->base);
+ rx_ring->xsk = NULL;
+ }
+
while (ntc != ntu) {
struct xdp_buff *xdp = *ice_xdp_buf(rx_ring, ntc);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 400/990] idpf: free stashed XSk Rx frame when releasing the queue
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (398 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 399/990] ice: xsk: free stashed Rx frame when cleaning the ring Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 401/990] net: usb: lan78xx: resume phylink on non-reset USB resume Greg Kroah-Hartman
` (452 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Björn Töpel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
[ Upstream commit 3cbee39da8251098e2631a106fafcaebc7c8e66b ]
idpf_xskrq_poll() stashes a partially received multi-buffer frame in
rxq->xsk, with its frags on pool->xskb_list. Nothing frees or clears
rxq->xsk on queue release, as idpf_rx_desc_rel() only returns the page
stash sharing its storage for non-XSk queues.
On ifdown, the buffers are lost to user space and, as the pool outlives
the queue, the stale frags are taken as frags of the next frame. If the
pool is disabled on a running interface, the queue restarts in page
mode with rxq->xdp.data still pointing to an xskb of the pool, which is
freed later. The page path then takes it for a partial frame, writes
frag info through it and returns it to a page pool.
Free the stashed frame and clear the pointer when the XSk state of the
queue is cleared, while the pool is still attached.
Fixes: 9705d6552f58 ("idpf: implement Rx path for AF_XDP")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://patch.msgid.link/20261102124950.958345-10-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/idpf/xsk.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/xsk.c b/drivers/net/ethernet/intel/idpf/xsk.c
index fd2cc43ab43cb..463c6852f8c99 100644
--- a/drivers/net/ethernet/intel/idpf/xsk.c
+++ b/drivers/net/ethernet/intel/idpf/xsk.c
@@ -132,6 +132,11 @@ void idpf_xsk_clear_queue(void *q, enum virtchnl2_queue_type type)
if (!idpf_queue_has_clear(XSK, rxq))
return;
+ if (rxq->xsk) {
+ libeth_xsk_buff_free_slow(rxq->xsk);
+ rxq->xsk = NULL;
+ }
+
rxq->pool = NULL;
break;
case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 401/990] net: usb: lan78xx: resume phylink on non-reset USB resume
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (399 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 400/990] idpf: free stashed XSk Rx frame when releasing the queue Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 402/990] net: raw: fix ICMP unreachable sent when receive queue is full Greg Kroah-Hartman
` (451 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefano Munari, Oleksij Rempel,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Munari <stefanomunari.sm@gmail.com>
[ Upstream commit be9587c47db16faaca5415f533637755c65a4eb0 ]
lan78xx_suspend() calls phylink_suspend(dev->phylink, false) on an open
interface, which always stops phylink and halts the PHY. The matching
phylink_resume() is only called from lan78xx_reset_resume().
When the USB device stays powered across system sleep (e.g. s2idle) and
the USB core calls .resume instead, the link stays down until the interface
is brought down and up by hand. The ifdown triggers:
WARNING: drivers/net/phy/phy.c:1670 at phy_stop+0x44/0xc8
called from state HALTED
Move phylink_resume() to the end of lan78xx_resume(), which both resume
paths go through, and call it only if the resume succeeded and the
interface was open, mirroring lan78xx_suspend(). As a side effect,
lan78xx_reset_resume() no longer starts phylink on a closed interface.
Tested on a Raspberry Pi 3B+ (LAN7515) with s2idle: the link now comes
back up on its own after resume and ifdown no longer warns.
Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for improved PHY and MAC management")
Signed-off-by: Stefano Munari <stefanomunari.sm@gmail.com>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20261102235133.23011-1-stefanomunari.sm@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/usb/lan78xx.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 133ea36388147..785d356a8dd5b 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -5377,6 +5377,12 @@ static int lan78xx_resume(struct usb_interface *intf)
out:
mutex_unlock(&dev->dev_mutex);
+ if (!ret && dev_open) {
+ rtnl_lock();
+ phylink_resume(dev->phylink);
+ rtnl_unlock();
+ }
+
return ret;
}
@@ -5391,15 +5397,7 @@ static int lan78xx_reset_resume(struct usb_interface *intf)
if (ret < 0)
return ret;
- ret = lan78xx_resume(intf);
- if (ret < 0)
- return ret;
-
- rtnl_lock();
- phylink_resume(dev->phylink);
- rtnl_unlock();
-
- return 0;
+ return lan78xx_resume(intf);
}
static const struct usb_device_id products[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 402/990] net: raw: fix ICMP unreachable sent when receive queue is full
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (400 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 401/990] net: usb: lan78xx: resume phylink on non-reset USB resume Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 403/990] spi: virtio: move teardown to .remove() Greg Kroah-Hartman
` (450 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiayuan Chen, 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 45441a94d50200f1478c52857725e6df624bf2ad ]
It's found in a raw socket application. When the application doesn't
read packets in time, the client receives ICMP Protocol Unreachable,
which makes the client abort the session.
The reason is that the server hits the sk_rcvbuf limit, and
raw_v4_input() skips the socket before setting 'delivered', so it
returns 0. Then ip_protocol_deliver_rcu() sees 'raw' is 0, thinks no one
handles this protocol and calls icmp_send() to send ICMP Protocol
Unreachable.
IPv6 has the same issue, ip6_protocol_deliver_rcu() sends ICMPv6
Parameter Problem instead.
Also, we'd better run icmp_filter() and ip_mc_sf_allow() (icmpv6_filter()
for IPv6) before we check sk_rcvbuf, otherwise packets rejected by
ICMP_FILTER/ICMPV6_FILTER or the multicast filter are counted in
sk_drops. So move the check right before skb_clone().
Fixes: d721812aa875 ("ipv4: raw: check sk->sk_rcvbuf earlier")
Fixes: 026763ece881 ("ipv6: raw: check sk->sk_rcvbuf earlier")
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261104115732.322151-1-jiayuan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/raw.c | 15 ++++++++-------
net/ipv6/raw.c | 15 ++++++++-------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 5735ae7cba01a..076fb2226a0f8 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -184,18 +184,19 @@ static int raw_v4_input(struct net *net, struct sk_buff *skb,
iph->saddr, iph->daddr, dif, sdif))
continue;
- if (atomic_read(&sk->sk_rmem_alloc) >=
- READ_ONCE(sk->sk_rcvbuf)) {
- sk_drops_inc(sk);
- continue;
- }
-
delivered = 1;
if ((iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) &&
ip_mc_sf_allow(sk, iph->daddr, iph->saddr,
skb->dev->ifindex, sdif)) {
- struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
+ struct sk_buff *clone;
+
+ if (atomic_read(&sk->sk_rmem_alloc) >=
+ READ_ONCE(sk->sk_rcvbuf)) {
+ sk_drops_inc(sk);
+ continue;
+ }
+ clone = skb_clone(skb, GFP_ATOMIC);
/* Not releasing hash table! */
if (clone)
raw_rcv(sk, clone);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 5ecbb9c775be0..b69016d9a2638 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -161,12 +161,6 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
inet6_iif(skb), inet6_sdif(skb)))
continue;
- if (atomic_read(&sk->sk_rmem_alloc) >=
- READ_ONCE(sk->sk_rcvbuf)) {
- sk_drops_inc(sk);
- continue;
- }
-
delivered = true;
switch (nexthdr) {
case IPPROTO_ICMPV6:
@@ -197,8 +191,15 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
if (filtered < 0)
break;
if (filtered == 0) {
- struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
+ struct sk_buff *clone;
+
+ if (atomic_read(&sk->sk_rmem_alloc) >=
+ READ_ONCE(sk->sk_rcvbuf)) {
+ sk_drops_inc(sk);
+ continue;
+ }
+ clone = skb_clone(skb, GFP_ATOMIC);
/* Not releasing hash table! */
if (clone)
rawv6_rcv(sk, clone);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 403/990] spi: virtio: move teardown to .remove()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (401 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 402/990] net: raw: fix ICMP unreachable sent when receive queue is full Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 404/990] af_unix: Convert unsigned long to u64 for GC Greg Kroah-Hartman
` (449 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Francesco Valla, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Valla <francesco@valla.it>
[ Upstream commit 9060f5ba658c9b0a7332be55b3d8abfc2b08618b ]
The .remove() callback is not marked as optional for a virtio_driver,
and thus a missing one is a bug. Moreover, the virtio framework expects
a driver to reset the device it controls during teardown and explicitly
checks for this reading the device status and WARNing in case it is
still running. Any devm cleanup action gets however called after that
check, leading to the WARN_ON condition to always be true for
spi-virtio; thus, an empty remove() is not an option.
Move the cleanup actions to the .remove() callback of the driver and
adapt the surrounding code to the new behavior.
Fixes: f98cabe3f6cf ("SPI: Add virtio SPI driver")
Signed-off-by: Francesco Valla <francesco@valla.it>
Link: https://patch.msgid.link/20261108-spi_virtio_remove-v1-1-fda5f0996290@valla.it
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/spi/spi-virtio.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-virtio.c b/drivers/spi/spi-virtio.c
index c92ea19881183..acf9039839547 100644
--- a/drivers/spi/spi-virtio.c
+++ b/drivers/spi/spi-virtio.c
@@ -320,10 +320,8 @@ static int virtio_spi_find_vqs(struct virtio_spi_priv *priv)
}
/* Function must not be called before virtio_spi_find_vqs() has been run */
-static void virtio_spi_del_vq(void *data)
+static void virtio_spi_del_vq(struct virtio_device *vdev)
{
- struct virtio_device *vdev = data;
-
virtio_reset_device(vdev);
vdev->config->del_vqs(vdev);
}
@@ -354,21 +352,26 @@ static int virtio_spi_probe(struct virtio_device *vdev)
if (ret)
return dev_err_probe(&vdev->dev, ret, "Cannot setup virtqueues\n");
- /* Register cleanup for virtqueues using devm */
- ret = devm_add_action_or_reset(&vdev->dev, virtio_spi_del_vq, vdev);
- if (ret)
- return dev_err_probe(&vdev->dev, ret, "Cannot register virtqueue cleanup\n");
-
virtio_device_ready(vdev);
- /* Use devm version to register controller */
- ret = devm_spi_register_controller(&vdev->dev, ctrl);
- if (ret)
+ ret = spi_register_controller(ctrl);
+ if (ret) {
+ virtio_spi_del_vq(vdev);
return dev_err_probe(&vdev->dev, ret, "Cannot register controller\n");
+ }
return 0;
}
+static void virtio_spi_remove(struct virtio_device *vdev)
+{
+ struct spi_controller *ctrl = dev_get_drvdata(&vdev->dev);
+
+ spi_unregister_controller(ctrl);
+
+ virtio_spi_del_vq(vdev);
+}
+
static int virtio_spi_freeze(struct device *dev)
{
struct spi_controller *ctrl = dev_get_drvdata(dev);
@@ -422,6 +425,7 @@ static struct virtio_driver virtio_spi_driver = {
},
.id_table = virtio_spi_id_table,
.probe = virtio_spi_probe,
+ .remove = virtio_spi_remove,
};
module_virtio_driver(virtio_spi_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 404/990] af_unix: Convert unsigned long to u64 for GC.
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (402 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 403/990] spi: virtio: move teardown to .remove() Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 405/990] af_unix: Remove gc_in_progress check in unix_peek_fpl() Greg Kroah-Hartman
` (448 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lim Chanyoun, 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 d5f898d4c47217ce42506698a3a98741393217b7 ]
Lim Chanyoun reported that unix_vertex_max_scc_index could
wrap around on 32-bit kernels, which confuses GC into purging
a live socket receive queue.
I apparently designed GC with u64 in mind to avoid wraparound. [0]
Let's make it true on 32-bit kernels.
Note that unix_vertex.{out_degree,index} are converted for
consistency; they are bounded by the number of allocated
objects and do not exceed UINT_MAX on 32-bit kernels.
Fixes: 4090fa373f0e ("af_unix: Replace garbage collection algorithm.")
Link: https://lore.kernel.org/netdev/20240228030508.31297-1-kuniyu@amazon.com/ #[0]
Reported-by: Lim Chanyoun <onleaf322@gmail.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104082058.452188-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/unix/garbage.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 11b75d37ac03a..1007e110e377c 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -78,9 +78,9 @@ struct unix_vertex {
struct list_head edges;
struct list_head entry;
struct list_head scc_entry;
- unsigned long out_degree;
- unsigned long index;
- unsigned long scc_index;
+ u64 out_degree;
+ u64 index;
+ u64 scc_index;
};
struct unix_edge {
@@ -148,8 +148,8 @@ enum unix_vertex_index {
UNIX_VERTEX_INDEX_START,
};
-static unsigned long unix_vertex_unvisited_index = UNIX_VERTEX_INDEX_MARK1;
-static unsigned long unix_vertex_max_scc_index = UNIX_VERTEX_INDEX_START;
+static u64 unix_vertex_unvisited_index = UNIX_VERTEX_INDEX_MARK1;
+static u64 unix_vertex_max_scc_index = UNIX_VERTEX_INDEX_START;
static void unix_add_edge(struct scm_fp_list *fpl, struct unix_edge *edge)
{
@@ -373,7 +373,7 @@ static bool unix_vertex_dead(struct unix_vertex *vertex)
}
static LIST_HEAD(unix_visited_vertices);
-static unsigned long unix_vertex_grouped_index = UNIX_VERTEX_INDEX_MARK2;
+static u64 unix_vertex_grouped_index = UNIX_VERTEX_INDEX_MARK2;
static bool unix_scc_dead(struct list_head *scc)
{
@@ -451,14 +451,14 @@ static bool unix_scc_cyclic(struct list_head *scc)
return false;
}
-static unsigned long __unix_walk_scc(struct unix_vertex *vertex,
- unsigned long *last_index,
- struct sk_buff_head *hitlist)
+static u64 __unix_walk_scc(struct unix_vertex *vertex,
+ u64 *last_index,
+ struct sk_buff_head *hitlist)
{
- unsigned long cyclic_sccs = 0;
LIST_HEAD(vertex_stack);
struct unix_edge *edge;
LIST_HEAD(edge_stack);
+ u64 cyclic_sccs = 0;
next_vertex:
/* Push vertex to vertex_stack and mark it as on-stack
@@ -554,12 +554,12 @@ static unsigned long __unix_walk_scc(struct unix_vertex *vertex,
return cyclic_sccs;
}
-static unsigned long unix_graph_cyclic_sccs;
+static u64 unix_graph_cyclic_sccs;
static void unix_walk_scc(struct sk_buff_head *hitlist)
{
- unsigned long last_index = UNIX_VERTEX_INDEX_START;
- unsigned long cyclic_sccs = 0;
+ u64 last_index = UNIX_VERTEX_INDEX_START;
+ u64 cyclic_sccs = 0;
unix_vertex_max_scc_index = UNIX_VERTEX_INDEX_START;
@@ -582,7 +582,7 @@ static void unix_walk_scc(struct sk_buff_head *hitlist)
static void unix_walk_scc_fast(struct sk_buff_head *hitlist)
{
- unsigned long cyclic_sccs = unix_graph_cyclic_sccs;
+ u64 cyclic_sccs = unix_graph_cyclic_sccs;
while (!list_empty(&unix_unvisited_vertices)) {
struct unix_vertex *vertex;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 405/990] af_unix: Remove gc_in_progress check in unix_peek_fpl().
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (403 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 404/990] af_unix: Convert unsigned long to u64 for GC Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 406/990] net/mlx5: Bridge, fix bogus MDB offload errors Greg Kroah-Hartman
` (447 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qihang Tang, 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 0edbc945eb9edd0086f25b151a79cfe4adc0dfa8 ]
unix_vertex_dead() and unix_peek_fpl() are synchronised
with unix_peek_seq to prevent GC from purging a live
socket's recvq.
unix_peek_fpl() skips the synchronisation if gc_in_progress
is false.
However, on weakly ordered arch, GC might have already
started working while the write to gc_in_progress is
buffered.
This does not occur on x86.
This is an unlikely path that happens only when AF_UNIX
fd is peeked so not worth complicating.
Instead of adding memory barriers in unix_gc() and
unix_peek_fpl(), let's simply remove the broken short-circuit.
Fixes: e5b31d988a41 ("af_unix: Give up GC if MSG_PEEK intervened.")
Reported-by: Qihang Tang <q.h.hack.winter@gmail.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104162858.991930-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/unix/garbage.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 1007e110e377c..fc1828e01bdbc 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -330,9 +330,6 @@ void unix_peek_fpl(struct scm_fp_list *fpl)
if (!fpl || !fpl->count_unix)
return;
- if (!READ_ONCE(gc_in_progress))
- return;
-
/* Invalidate the final refcnt check in unix_vertex_dead(). */
spin_lock(&unix_peek_lock);
raw_write_seqcount_barrier(&unix_peek_seq);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 406/990] net/mlx5: Bridge, fix bogus MDB offload errors
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (404 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 405/990] af_unix: Remove gc_in_progress check in unix_peek_fpl() Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 407/990] ipv6: ignore link state in gateway check Greg Kroah-Hartman
` (446 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gal Pressman, Jianbo Liu,
Cosmin Ratiu, 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 c714f324eac17b2df03419b5cd5368687efd8e27 ]
MDB add operations are queued on the switchdev deferred queue
(SWITCHDEV_F_DEFER), while vlan object deletions are handled
synchronously.
A 'bridge vlan del' can overtake an MDB add that is still queued, and
the vlan is already gone by the time the driver is called.
The two operations are independent in practice: in my test, the MDB add
is triggered by assigning the VF an IPv6 address (hence joining a
solicited-node multicast group), while another process deletes the vlan
from its representor.
Racing 'bridge mdb add' against concurrent 'bridge vlan del' could
result in:
[ 5390.967651] mlx5_core 0000:08:00.0: E-Switch: Failed to lookup bridge port vlan metadata (vport=1)
[ 5390.969120] mlx5_core 0000:08:00.1: E-Switch: Failed to lookup bridge port vlan metadata to create MDB (MAC=33:33:ff:12:00:05,vid=2204,vport=1)
[ 5390.971676] mlx5_core 0000:08:00.1 eth4: Failed to add Port Multicast Database entry (object id=2) with error: -EINVAL (-22).
Failure in updating the port's Multicast Database could lead to
multicast forwarding issues.
The error cannot reach anyone that could do anything with it, switchdev
returned success to the bridge as soon as the MDB object was queued, and
the errno only flags the entry as offload failed.
The end result is correct either way, if the MDB has been offloaded
before the vlan was deleted, mlx5_esw_bridge_port_mdb_vlan_flush() would
have removed it.
The FDB path already treats this as a harmless race,
mlx5_esw_bridge_port_vlan_lookup() reports it on 'info' logging level
and skips the offload. mlxsw did the same in [1].
Skip the MDB offload, report on 'info' logging level and return
-EOPNOTSUPP: switchdev_port_obj_add_deferred() does not log it, and
br_switchdev_mdb_complete() skips the port group flag update.
[1] Commit 17b334a876fe ("mlxsw: spectrum_switchdev: Don't warn about valid situations")
Fixes: 70f0302b3f20 ("net/mlx5: Bridge, implement mdb offload")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261104183715.771390-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/mellanox/mlx5/core/esw/bridge.c | 21 ++++++++++---------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
index 88487e1a58878..744f5cf9eb780 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
@@ -1867,26 +1867,27 @@ int mlx5_esw_bridge_port_mdb_add(struct net_device *dev, u16 vport_num, u16 esw_
port = mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads);
if (!port) {
- esw_warn(br_offloads->esw->dev,
+ /* MDB is added asynchronously from the switchdev deferred
+ * queue while port might have been deleted concurrently.
+ */
+ esw_info(br_offloads->esw->dev,
"Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)\n",
addr, vport_num);
- NL_SET_ERR_MSG_FMT_MOD(extack,
- "Failed to lookup bridge port to add MDB (MAC=%pM,vport=%u)",
- addr, vport_num);
- return -EINVAL;
+ return -EOPNOTSUPP;
}
bridge = port->bridge;
if (bridge->flags & MLX5_ESW_BRIDGE_VLAN_FILTERING_FLAG && vid) {
vlan = mlx5_esw_bridge_vlan_lookup(vid, port);
if (!vlan) {
- esw_warn(br_offloads->esw->dev,
+ /* MDB is added asynchronously from the switchdev
+ * deferred queue while vlan might have been deleted
+ * concurrently.
+ */
+ esw_info(br_offloads->esw->dev,
"Failed to lookup bridge port vlan metadata to create MDB (MAC=%pM,vid=%u,vport=%u)\n",
addr, vid, vport_num);
- NL_SET_ERR_MSG_FMT_MOD(extack,
- "Failed to lookup vlan metadata for MDB (MAC=%pM,vid=%u,vport=%u)",
- addr, vid, vport_num);
- return -EINVAL;
+ return -EOPNOTSUPP;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 407/990] ipv6: ignore link state in gateway check
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (405 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 406/990] net/mlx5: Bridge, fix bogus MDB offload errors Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 408/990] team: Add matching error label for failed action Greg Kroah-Hartman
` (445 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yaroslav Dudkov, Hangbin Liu,
Ido Schimmel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
[ Upstream commit b76bcf3fff9332076d92de47a80d12fd3d5268e2 ]
IPv6 route cannot be added in table when all
following conditions are true:
- gateway is not link-local address
- ignore_routes_with_linkdown=1 on device
- nexthop has no carrier
- gateway is not present or covered by any route in table already
Also multipath routes addition is invalidated by kernel even
if only one of added nexthops satisfies all above conditions.
Reproducer:
ip netns add t
ip -n t link add va type veth peer name vb
ip -n t link set va up
ip -n t addr add fd00::1/64 dev va nodad
ip netns exec t sysctl -w \
net.ipv6.conf.va.ignore_routes_with_linkdown=1
ip -n t -6 route add 2001:db8::/64 via fd00::2 dev va
# added
ip -n t -6 route add 2001:db8::/64 table 100 via fd00::2 dev va
# RTNETLINK answers: No route to host
ip -n t -6 route show table all
ip netns del t
Route should be added because:
- RT6_LOOKUP_F_IGNORE_LINKSTATE in commit d5d32e4b7668
("net: ipv6: Do not consider link state for nexthop validation")
was added for this
- the same route is valid in main table (when no specifying table id
while adding route)
- fib6_nh_init() initializes nexthops with no carrier
- IPv4 already does this (fib_check_nh_v4_gw() ignores link state
using the FIB_LOOKUP_IGNORE_LINKSTATE flag)
Before commit b2c709cce682 ("ipv6: Convert gateway validation to
use fib6_info") rt6_lookup() was used for checking if nexthop is
valid, rt6_lookup called rt6_device_match() which does not check the
link state. After change rt6_lookup() to fib6_lookup()
find_match() under fib6_lookup() started to invalidate linkdown
devices, because RT6_LOOKUP_F_IGNORE_LINKSTATE is not passed to it.
Adding RT6_LOOKUP_F_IGNORE_LINKSTATE to flags for ip6_route_check_nh()
solves the problem. RT6_LOOKUP_F_IGNORE_LINKSTATE is already used
inside the first search ip6_nh_lookup_table() and fixes the
bug in second search fib6_lookup(). Also RT6_LOOKUP_F_IGNORE_LINKSTATE
isn't read inside fib6_select_path().
Fixes: b2c709cce682 ("ipv6: Convert gateway validation to use fib6_info")
Signed-off-by: Yaroslav Dudkov <aroslavdudkov622@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261104195655.1406837-2-aroslavdudkov622@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c11cf3c65c9f7..ac27f815d497c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3461,9 +3461,9 @@ static int ip6_route_check_nh(struct net *net,
netdevice_tracker *dev_tracker,
struct inet6_dev **idev)
{
+ int flags = RT6_LOOKUP_F_IFACE | RT6_LOOKUP_F_IGNORE_LINKSTATE;
const struct in6_addr *gw_addr = &cfg->fc_gateway;
struct net_device *dev = _dev ? *_dev : NULL;
- int flags = RT6_LOOKUP_F_IFACE;
struct fib6_result res = {};
int err = -EHOSTUNREACH;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 408/990] team: Add matching error label for failed action
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (406 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 407/990] ipv6: ignore link state in gateway check Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 409/990] team: fix promisc/allmulti leak in team_port_add error path Greg Kroah-Hartman
` (444 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nikola Z. Ivanov, Simon Horman,
Jiri Pirko, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikola Z. Ivanov <zlatistiv@gmail.com>
[ Upstream commit aee0f01b4f118844cb126a5f27e91c2adf087c59 ]
Follow the "action" - "err_action" pairing of labels
found across the source code of team net device.
Currently in team_port_add the err_set_slave_promisc
label is reused for exiting on error when setting
allmulti level of the new slave.
Signed-off-by: Nikola Z. Ivanov <zlatistiv@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://patch.msgid.link/20251128072544.223645-1-zlatistiv@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: ff618cb00a64 ("team: fix promisc/allmulti leak in team_port_add error path")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/team/team_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index 7a189f32c865b..cb0ff3d89de93 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -1260,7 +1260,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
if (err) {
if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(port_dev, -1);
- goto err_set_slave_promisc;
+ goto err_set_slave_allmulti;
}
}
@@ -1287,6 +1287,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
return 0;
err_set_dev_type:
+err_set_slave_allmulti:
err_set_slave_promisc:
__team_option_inst_del_port(team, port);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 409/990] team: fix promisc/allmulti leak in team_port_add error path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (407 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 408/990] team: Add matching error label for failed action Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 410/990] net/mlx5: Use only loaded devices for PTP clock operations Greg Kroah-Hartman
` (443 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Li RongQing, Hangbin Liu,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <lirongqing@baidu.com>
[ Upstream commit ff618cb00a645f1e3f89068c5fbda3f3a7f4ae63 ]
team_port_add() increments the port's promiscuity and allmulti
counts before calling team_dev_type_check_change(). If the latter
fails, the error path does not undo these increments, leaving the
port in promiscuous and allmulti mode even though it was not
successfully added to the team.
Undo the promiscuity increment under err_set_slave_allmulti and the
allmulti increment under err_set_dev_type, so each error label only
reverts what was successfully applied, matching the cleanup performed
by team_port_del().
With the promiscuity rollback now living under err_set_slave_allmulti,
the inline dev_set_promiscuity(port_dev, -1) in the dev_set_allmulti()
failure branch becomes redundant: that branch already jumps to
err_set_slave_allmulti, which undoes the promiscuity increment. Drop
the inline call to avoid doing it twice.
Found by source code audit.
Fixes: 0ae9cfc454ea ("team: Move team device type change at the end of team_port_add")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Link: https://patch.msgid.link/20261104015217.2222-1-lirongqing@baidu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/team/team_core.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index cb0ff3d89de93..f1d45e157efca 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -1257,11 +1257,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
/* set allmulti level to new slave */
if (dev->flags & IFF_ALLMULTI) {
err = dev_set_allmulti(port_dev, 1);
- if (err) {
- if (dev->flags & IFF_PROMISC)
- dev_set_promiscuity(port_dev, -1);
+ if (err)
goto err_set_slave_allmulti;
- }
}
err = team_dev_type_check_change(dev, port_dev);
@@ -1287,7 +1284,11 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
return 0;
err_set_dev_type:
+ if (dev->flags & IFF_ALLMULTI)
+ dev_set_allmulti(port_dev, -1);
err_set_slave_allmulti:
+ if (dev->flags & IFF_PROMISC)
+ dev_set_promiscuity(port_dev, -1);
err_set_slave_promisc:
__team_option_inst_del_port(team, port);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 410/990] net/mlx5: Use only loaded devices for PTP clock operations
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (408 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 409/990] team: fix promisc/allmulti leak in team_port_add error path Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 411/990] net/mlx5: Lag, free steering resources on LAG destroy failure Greg Kroah-Hartman
` (442 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Carolina Jubran, Cosmin Ratiu,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carolina Jubran <cjubran@nvidia.com>
[ Upstream commit 908561cc4b4db4510465f02f5323e98f2dc00fad ]
The PTP periodic worker and PTP operations access PCI registers through
the function backing the PTP clock. The PTP clock remains registered
when a PCI function is suspended, so these paths can still access the
function after it has been unloaded.
To fix that, serialize clock hardware access with the clock mutex for
all clocks and fail callbacks with -EAGAIN when there is no loaded
function to service the clock. Additionally, tie the worker's lifetime
to load/unload and use the devcom lock to synchronize with peer
loads/unloads.
Since the periodic worker is stopped during unload, the free running
counter may wrap without being sampled. Reinitialize the timecounter
on load using the hardware real time clock in real time mode, or the
saved PHC time plus elapsed CLOCK_BOOTTIME in free running mode.
This provides best effort PHC continuity across unload/load. In free
running mode, elapsed time while unloaded is estimated using
CLOCK_BOOTTIME rather than the PHC's adjusted frequency.
Fixes: 8fc3e29be924 ("net/mlx5: Fix crash upon suspend/resume")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261104183158.758314-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/mellanox/mlx5/core/lib/clock.c | 248 +++++++++++++-----
.../ethernet/mellanox/mlx5/core/lib/clock.h | 2 +
2 files changed, 185 insertions(+), 65 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index 29e7fa09c32c8..e3e9d6a9c9c63 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -80,6 +80,7 @@ enum {
};
struct mlx5_clock_dev_state {
+ bool loaded;
struct mlx5_core_dev *mdev;
struct mlx5_devcom_comp_dev *compdev;
struct mlx5_nb pps_nb;
@@ -89,7 +90,7 @@ struct mlx5_clock_dev_state {
struct mlx5_clock_priv {
struct mlx5_clock clock;
struct mlx5_core_dev *mdev;
- struct mutex lock; /* protect mdev and used in PTP callbacks */
+ struct mutex lock; /* protect mdev and serialize hardware callbacks */
struct mlx5_core_dev *event_mdev;
};
@@ -100,9 +101,6 @@ static struct mlx5_clock_priv *clock_priv(struct mlx5_clock *clock)
static void mlx5_clock_lockdep_assert(struct mlx5_clock *clock)
{
- if (!clock->shared)
- return;
-
lockdep_assert(lockdep_is_held(&clock_priv(clock)->lock));
}
@@ -115,20 +113,24 @@ static struct mlx5_core_dev *mlx5_clock_mdev_get(struct mlx5_clock *clock)
static void mlx5_clock_lock(struct mlx5_clock *clock)
{
- if (!clock->shared)
- return;
-
mutex_lock(&clock_priv(clock)->lock);
}
static void mlx5_clock_unlock(struct mlx5_clock *clock)
{
- if (!clock->shared)
- return;
-
mutex_unlock(&clock_priv(clock)->lock);
}
+static struct mlx5_core_dev *
+mlx5_clock_active_mdev_get(struct mlx5_clock *clock)
+{
+ struct mlx5_clock_priv *cpriv = clock_priv(clock);
+
+ mlx5_clock_lockdep_assert(clock);
+
+ return cpriv->mdev->clock_state->loaded ? cpriv->mdev : NULL;
+}
+
static bool mlx5_real_time_mode(struct mlx5_core_dev *mdev)
{
return (mlx5_is_real_time_rq(mdev) || mlx5_is_real_time_sq(mdev));
@@ -332,7 +334,11 @@ static int mlx5_ptp_getcrosststamp(struct ptp_clock_info *ptp,
int err;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
if (!mlx5_is_ptm_source_time_available(mdev)) {
err = -EBUSY;
@@ -358,7 +364,11 @@ static int mlx5_ptp_getcrosscycles(struct ptp_clock_info *ptp,
int err;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
if (!mlx5_is_ptm_source_time_available(mdev)) {
err = -EBUSY;
@@ -410,6 +420,12 @@ static u64 read_internal_timer(struct cyclecounter *cc)
return mlx5_read_time(mdev, NULL, false) & cc->mask;
}
+static void mlx5_timer_snapshot(struct mlx5_timer *timer)
+{
+ timer->saved_phc_ns = timer->tc.nsec;
+ timer->saved_boot_ns = ktime_get_boottime_ns();
+}
+
static void mlx5_update_clock_info_page(struct mlx5_core_dev *mdev)
{
struct mlx5_ib_clock_info *clock_info = mdev->clock_info;
@@ -417,6 +433,9 @@ static void mlx5_update_clock_info_page(struct mlx5_core_dev *mdev)
struct mlx5_timer *timer;
u32 sign;
+ timer = &clock->timer;
+ mlx5_timer_snapshot(timer);
+
if (!clock_info)
return;
@@ -424,7 +443,6 @@ static void mlx5_update_clock_info_page(struct mlx5_core_dev *mdev)
smp_store_mb(clock_info->sign,
sign | MLX5_IB_CLOCK_INFO_KERNEL_UPDATING);
- timer = &clock->timer;
clock_info->cycles = timer->tc.cycle_last;
clock_info->mult = timer->cycles.mult;
clock_info->nsec = timer->tc.nsec;
@@ -470,10 +488,9 @@ static long mlx5_timestamp_overflow(struct ptp_clock_info *ptp_info)
clock = container_of(ptp_info, struct mlx5_clock, ptp_info);
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
timer = &clock->timer;
-
- if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+ if (!mdev || mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
goto out;
write_seqlock_irqsave(&clock->lock, flags);
@@ -530,8 +547,13 @@ static int mlx5_ptp_settime(struct ptp_clock_info *ptp, const struct timespec64
int err;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
err = mlx5_clock_settime(mdev, clock, ts);
+unlock:
mlx5_clock_unlock(clock);
return err;
@@ -549,26 +571,40 @@ struct timespec64 mlx5_ptp_gettimex_real_time(struct mlx5_core_dev *mdev,
return ts;
}
-static int mlx5_ptp_gettimex(struct ptp_clock_info *ptp, struct timespec64 *ts,
- struct ptp_system_timestamp *sts)
+static void mlx5_clock_gettimex(struct mlx5_core_dev *mdev,
+ struct mlx5_clock *clock, struct timespec64 *ts,
+ struct ptp_system_timestamp *sts)
{
- struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, ptp_info);
- struct mlx5_core_dev *mdev;
u64 cycles, ns;
- mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
if (mlx5_real_time_mode(mdev)) {
*ts = mlx5_ptp_gettimex_real_time(mdev, sts);
- goto out;
+ return;
}
cycles = mlx5_read_time(mdev, sts, false);
ns = mlx5_timecounter_cyc2time(clock, cycles);
*ts = ns_to_timespec64(ns);
-out:
+}
+
+static int mlx5_ptp_gettimex(struct ptp_clock_info *ptp, struct timespec64 *ts,
+ struct ptp_system_timestamp *sts)
+{
+ struct mlx5_clock *clock =
+ container_of(ptp, struct mlx5_clock, ptp_info);
+ struct mlx5_core_dev *mdev;
+ int err = 0;
+
+ mlx5_clock_lock(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
+ mlx5_clock_gettimex(mdev, clock, ts, sts);
+unlock:
mlx5_clock_unlock(clock);
- return 0;
+ return err;
}
static int mlx5_ptp_getcyclesx(struct ptp_clock_info *ptp,
@@ -579,14 +615,20 @@ static int mlx5_ptp_getcyclesx(struct ptp_clock_info *ptp,
ptp_info);
struct mlx5_core_dev *mdev;
u64 cycles;
+ int err = 0;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
cycles = mlx5_read_time(mdev, sts, false);
*ts = ns_to_timespec64(cycles);
+unlock:
mlx5_clock_unlock(clock);
- return 0;
+ return err;
}
static int mlx5_ptp_adjtime_real_time(struct mlx5_core_dev *mdev, s64 delta)
@@ -619,7 +661,11 @@ static int mlx5_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
int err = 0;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
if (mlx5_modify_mtutc_allowed(mdev)) {
err = mlx5_ptp_adjtime_real_time(mdev, delta);
@@ -629,6 +675,7 @@ static int mlx5_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
}
write_seqlock_irqsave(&clock->lock, flags);
+ timecounter_read(&timer->tc);
timecounter_adjtime(&timer->tc, delta);
mlx5_update_clock_info_page(mdev);
write_sequnlock_irqrestore(&clock->lock, flags);
@@ -645,8 +692,13 @@ static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta)
int err;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
err = mlx5_ptp_adjtime_real_time(mdev, delta);
+unlock:
mlx5_clock_unlock(clock);
return err;
@@ -682,7 +734,11 @@ static int mlx5_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
u32 mult;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
if (mlx5_modify_mtutc_allowed(mdev)) {
err = mlx5_ptp_freq_adj_real_time(mdev, scaled_ppm);
@@ -743,7 +799,11 @@ static int mlx5_extts_configure(struct ptp_clock_info *ptp,
}
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
if (!MLX5_PPS_CAP(mdev)) {
err = -EOPNOTSUPP;
@@ -916,7 +976,11 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp,
return -EBUSY;
mlx5_clock_lock(clock);
- mdev = mlx5_clock_mdev_get(clock);
+ mdev = mlx5_clock_active_mdev_get(clock);
+ if (!mdev) {
+ err = -EAGAIN;
+ goto unlock;
+ }
rt_mode = mlx5_real_time_mode(mdev);
if (!MLX5_PPS_CAP(mdev)) {
@@ -1151,7 +1215,7 @@ static u64 perout_conf_next_event_timer(struct mlx5_core_dev *mdev,
struct timespec64 ts;
s64 target_ns;
- mlx5_ptp_gettimex(&clock->ptp_info, &ts, NULL);
+ mlx5_clock_gettimex(mdev, clock, &ts, NULL);
ts_next_sec(&ts);
target_ns = timespec64_to_ns(&ts);
@@ -1222,8 +1286,8 @@ static void mlx5_timecounter_init(struct mlx5_core_dev *mdev)
timer->nominal_c_mult = timer->cycles.mult;
timer->cycles.mask = CLOCKSOURCE_MASK(41);
- timecounter_init(&timer->tc, &timer->cycles,
- ktime_to_ns(ktime_get_real()));
+ timecounter_init(&timer->tc, &timer->cycles, ktime_get_real_ns());
+ mlx5_timer_snapshot(timer);
}
static void mlx5_init_overflow_period(struct mlx5_core_dev *mdev)
@@ -1370,9 +1434,6 @@ static void mlx5_init_clock_dev(struct mlx5_core_dev *mdev)
clock->ptp);
clock->ptp = NULL;
}
-
- if (clock->ptp)
- ptp_schedule_worker(clock->ptp, 0);
}
static void mlx5_destroy_clock_dev(struct mlx5_core_dev *mdev)
@@ -1517,22 +1578,53 @@ static void mlx5_clock_arm_pps_in_event(struct mlx5_clock *clock,
!clock->pps_info.pin_armed[i])
continue;
- if (new_mdev) {
+ if (new_mdev)
mlx5_set_mtppse(new_mdev, i, 0, MLX5_EVENT_MODE_REPETETIVE);
- cpriv->event_mdev = new_mdev;
- } else {
- cpriv->event_mdev = NULL;
- }
if (old_mdev)
mlx5_set_mtppse(old_mdev, i, 0, MLX5_EVENT_MODE_DISABLE);
}
+ cpriv->event_mdev = new_mdev;
+}
+
+static void mlx5_set_timecounter(struct mlx5_core_dev *mdev, u64 ns)
+{
+ struct mlx5_clock *clock = mdev->clock;
+ struct mlx5_timer *timer;
+ unsigned long flags;
+
+ timer = &clock->timer;
+ mlx5_clock_lockdep_assert(clock);
+
+ write_seqlock_irqsave(&clock->lock, flags);
+ timecounter_init(&timer->tc, &timer->cycles, ns);
+ mlx5_update_clock_info_page(mdev);
+ write_sequnlock_irqrestore(&clock->lock, flags);
+}
+
+static void mlx5_save_timecounter(struct mlx5_core_dev *mdev)
+{
+ struct mlx5_clock *clock = mdev->clock;
+ struct mlx5_timer *timer;
+ unsigned long flags;
+
+ timer = &clock->timer;
+ mlx5_clock_lockdep_assert(clock);
+
+ if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
+ return;
+
+ write_seqlock_irqsave(&clock->lock, flags);
+ timecounter_read(&timer->tc);
+ mlx5_update_clock_info_page(mdev);
+ write_sequnlock_irqrestore(&clock->lock, flags);
}
void mlx5_clock_load(struct mlx5_core_dev *mdev)
{
struct mlx5_clock *clock = mdev->clock;
struct mlx5_clock_priv *cpriv;
+ bool start;
if (!MLX5_CAP_GEN(mdev, device_frequency_khz))
return;
@@ -1541,18 +1633,32 @@ void mlx5_clock_load(struct mlx5_core_dev *mdev)
MLX5_NB_INIT(&mdev->clock_state->pps_nb, mlx5_pps_event, PPS_EVENT);
mlx5_eq_notifier_register(mdev, &mdev->clock_state->pps_nb);
- if (!clock->shared) {
- mlx5_clock_arm_pps_in_event(clock, mdev, NULL);
- return;
- }
-
cpriv = clock_priv(clock);
- mlx5_devcom_comp_lock(mdev->clock_state->compdev);
+ if (clock->shared)
+ mlx5_devcom_comp_lock(mdev->clock_state->compdev);
mlx5_clock_lock(clock);
- if (mdev == cpriv->mdev && mdev != cpriv->event_mdev)
+ start = !cpriv->mdev->clock_state->loaded;
+ mdev->clock_state->loaded = true;
+ if (start) {
+ struct mlx5_timer *timer = &clock->timer;
+ u64 ns;
+
+ cpriv->mdev = mdev;
+ if (mlx5_real_time_mode(mdev))
+ ns = mlx5_read_time(mdev, NULL, true);
+ else
+ ns = timer->saved_phc_ns +
+ ktime_get_boottime_ns() - timer->saved_boot_ns;
+
+ mlx5_set_timecounter(mdev, ns);
mlx5_clock_arm_pps_in_event(clock, mdev, cpriv->event_mdev);
+ }
mlx5_clock_unlock(clock);
- mlx5_devcom_comp_unlock(mdev->clock_state->compdev);
+
+ if (start && clock->ptp)
+ ptp_schedule_worker(clock->ptp, 0);
+ if (clock->shared)
+ mlx5_devcom_comp_unlock(mdev->clock_state->compdev);
}
void mlx5_clock_unload(struct mlx5_core_dev *mdev)
@@ -1560,30 +1666,42 @@ void mlx5_clock_unload(struct mlx5_core_dev *mdev)
struct mlx5_core_dev *peer_dev, *next = NULL;
struct mlx5_clock *clock = mdev->clock;
struct mlx5_devcom_comp_dev *pos;
+ struct mlx5_clock_priv *cpriv;
+ bool stop;
if (!MLX5_CAP_GEN(mdev, device_frequency_khz))
return;
- if (!clock->shared) {
- mlx5_clock_arm_pps_in_event(clock, NULL, mdev);
- goto out;
- }
-
- mlx5_devcom_comp_lock(mdev->clock_state->compdev);
- mlx5_devcom_for_each_peer_entry(mdev->clock_state->compdev, peer_dev, pos) {
- if (peer_dev->clock && peer_dev != mdev) {
- next = peer_dev;
- break;
+ if (clock->shared) {
+ mlx5_devcom_comp_lock(mdev->clock_state->compdev);
+ mlx5_devcom_for_each_peer_entry(mdev->clock_state->compdev,
+ peer_dev, pos) {
+ if (peer_dev->clock == clock &&
+ peer_dev->clock_state->loaded) {
+ next = peer_dev;
+ break;
+ }
}
}
mlx5_clock_lock(clock);
- if (mdev == clock_priv(clock)->event_mdev)
+ cpriv = clock_priv(clock);
+ mdev->clock_state->loaded = false;
+ if (mdev == cpriv->mdev && next)
+ cpriv->mdev = next;
+ if (mdev == cpriv->event_mdev)
mlx5_clock_arm_pps_in_event(clock, next, mdev);
+ stop = !cpriv->mdev->clock_state->loaded;
+ if (!mlx5_real_time_mode(cpriv->mdev))
+ mlx5_save_timecounter(cpriv->mdev);
mlx5_clock_unlock(clock);
- mlx5_devcom_comp_unlock(mdev->clock_state->compdev);
-out:
+ /* Keep devcom locked to prevent a peer from restarting the worker. */
+ if (stop && clock->ptp)
+ ptp_cancel_worker_sync(clock->ptp);
+ if (clock->shared)
+ mlx5_devcom_comp_unlock(mdev->clock_state->compdev);
+
mlx5_eq_notifier_unregister(mdev, &mdev->clock_state->pps_nb);
cancel_work_sync(&mdev->clock_state->out_work);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h
index c18a652c0faa1..d57c5c213e386 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h
@@ -50,6 +50,8 @@ struct mlx5_timer {
struct timecounter tc;
u32 nominal_c_mult;
unsigned long overflow_period;
+ u64 saved_phc_ns;
+ u64 saved_boot_ns;
};
struct mlx5_clock {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 411/990] net/mlx5: Lag, free steering resources on LAG destroy failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (409 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 410/990] net/mlx5: Use only loaded devices for PTP clock operations Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 412/990] net: protect negative destination advice with RCU Greg Kroah-Hartman
` (441 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mark Bloch, Shay Drori, Tariq Toukan,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Bloch <mbloch@nvidia.com>
[ Upstream commit deceb70d1303105e4368a19b251a6fd94428eb11 ]
When firmware fails to destroy LAG, driver returns before releasing the
steering resources, leaking the associated software objects.
The bond is no longer eligible for offload, and the driver cannot
prevent its teardown. Release the steering resources even if LAG
destruction fails. Preserve the error logging and return the original
error after cleanup.
Fixes: da6b0bb0fc73 ("net/mlx5: Lag, use steering to select the affinity port in LAG")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261104183947.772195-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/lag/lag.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
index 17b9a5078f6c4..778f0208dc5c6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
@@ -832,7 +832,6 @@ int mlx5_deactivate_lag(struct mlx5_lag *ldev)
"Failed to deactivate VF LAG; driver restart required\n"
"Make sure all VFs are unbound prior to VF LAG activation or deactivation\n");
}
- return err;
}
if (test_bit(MLX5_LAG_MODE_FLAG_HASH_BASED, &flags)) {
@@ -842,7 +841,7 @@ int mlx5_deactivate_lag(struct mlx5_lag *ldev)
if (mlx5_lag_has_drop_rule(ldev))
mlx5_lag_drop_rule_cleanup(ldev);
- return 0;
+ return err;
}
bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 412/990] net: protect negative destination advice with RCU
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (410 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 411/990] net/mlx5: Lag, free steering resources on LAG destroy failure Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 413/990] net: require a full socket in sock_confirm_neigh() Greg Kroah-Hartman
` (440 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jiayuan Chen, Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 4b77d2792c3e482afa108c08f224ea6fa396d80b ]
SO_CNX_ADVICE calls __dst_negative_advice() while holding the socket
lock. Connected UDP sends can still invalidate or replace sk_dst_cache
without that lock. A concurrent sk_dst_check() can drop the final
destination reference and allow an RCU callback to destroy it while
__dst_negative_advice() retains only a borrowed pointer. This can cause
a use-after-free while accessing dst->ops or running the negative_advice
callback.
The writer-side ordering fixed by commit 92f1655aa2b2 ("net: fix
__dst_negative_advice() race") does not protect this reader from an
independent cache replacement.
Hold an RCU read-side critical section across the lookup and callback.
This follows the datagram release callbacks and covers IPv4, IPv6, and
XFRM advice without changing cache-reset or reference-ownership rules.
Fixes: a87cb3e48ee8 ("net: Facility to report route quality of connected sockets")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104131744.1056562-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/sock.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index fb91d72a955dd..49d4c25271bee 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2176,10 +2176,13 @@ sk_dst_get(const struct sock *sk)
static inline void __dst_negative_advice(struct sock *sk)
{
- struct dst_entry *dst = __sk_dst_get(sk);
+ struct dst_entry *dst;
+ rcu_read_lock();
+ dst = __sk_dst_get(sk);
if (dst && dst->ops->negative_advice)
dst->ops->negative_advice(sk, dst);
+ rcu_read_unlock();
}
static inline void dst_negative_advice(struct sock *sk)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 413/990] net: require a full socket in sock_confirm_neigh()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (411 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 412/990] net: protect negative destination advice with RCU Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 414/990] ipvlan: make outbound skb headers writable Greg Kroah-Hartman
` (439 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Kuniyuki Iwashima, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit c78b47704934e44442f4e48bfdcc99039e3b85a5 ]
An skb can retain dst_pending_confirm after its original output and
socket owner have changed. For example, a raw MSG_CONFIRM packet can
cross veth, have a TCP request socket assigned by TPROXY, and be bridged
into gretap. Neighbor output for the outer packet then calls
sock_confirm_neigh() with the request socket in skb->sk.
The helper unconditionally treats a non-NULL skb->sk as a full socket
when accessing sk_dst_pending_confirm. TCP request and TIME_WAIT sockets
do not contain that field. This produces an out-of-bounds four-byte read
and, if the word is nonzero, an out-of-bounds four-byte zero write. A
KASAN-enabled kernel reports:
BUG: KASAN: slab-out-of-bounds in ip_finish_output2+0xc9f/0xd60
Read of size 4 at addr ffff8880bdc3d880 by task tproxy_dst_conf/1771
Require sk_fullsock() before accessing the socket field, moving the
existing helper earlier in the header to make it available here. Keep
neigh_confirm() independent of the socket type so the skb's neighbor
confirmation still works, including for socketless packets. This also
covers the IPv6, VRF, and BPF neighbor-output callers.
Fixes: 4ff0620354f2 ("net: add dst_pending_confirm flag to skbuff")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261104132900.1071940-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/sock.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 49d4c25271bee..dd728a89c10f0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2231,6 +2231,14 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
+/* This helper checks if a socket is a full socket,
+ * ie _not_ a timewait or request socket.
+ */
+static inline bool sk_fullsock(const struct sock *sk)
+{
+ return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
+}
+
static inline void sk_dst_confirm(struct sock *sk)
{
if (!READ_ONCE(sk->sk_dst_pending_confirm))
@@ -2242,7 +2250,8 @@ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
if (skb_get_dst_pending_confirm(skb)) {
struct sock *sk = skb->sk;
- if (sk && READ_ONCE(sk->sk_dst_pending_confirm))
+ if (sk && sk_fullsock(sk) &&
+ READ_ONCE(sk->sk_dst_pending_confirm))
WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
neigh_confirm(n);
}
@@ -2966,14 +2975,6 @@ skb_sk_is_prefetched(struct sk_buff *skb)
#endif /* CONFIG_INET */
}
-/* This helper checks if a socket is a full socket,
- * ie _not_ a timewait or request socket.
- */
-static inline bool sk_fullsock(const struct sock *sk)
-{
- return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
-}
-
static inline bool
sk_is_refcounted(struct sock *sk)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 414/990] ipvlan: make outbound skb headers writable
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (412 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 413/990] net: require a full socket in sock_confirm_neigh() Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 415/990] wifi: mac80211: mesh: dont linearize SKBs unnecessarily Greg Kroah-Hartman
` (438 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit a45dbf182137275f44ad7c8bc8acd23f7af6b2cf ]
In L3 and L3S modes, ipvlan_process_v4_outbound() and
ipvlan_process_v6_outbound() hand the skb to ip_local_out() and
ip6_local_out(). The IP output path assumes it owns the network header:
__ip_local_out() rewrites tot_len and the header checksum, and
transport-mode XFRM can memmove the network header into the headroom
when xfrm_skb_check_space() finds enough room, without copying.
The skb reaching ipvlan can have its header shared with another skb,
for example after an AF_PACKET tap on the ipvlan device or a tc mirred
mirror action. pskb_network_may_pull() only makes the header linear;
it does not unshare an already linear head. The writes above then
modify the other skb. If that skb is on the receive path and its IPv4
header was already validated, IPv4 option processing can use the
modified header, write past the linear data, and corrupt
skb_shared_info.
Use skb_cow_head() before taking header pointers and entering the local
IP output path, like ip_forward() does with skb_cow() before it touches
the header. Only checking skb_header_cloned() is enough here: skbs that
TCP transmits are clones of the write-queue skb, whose header area has
been released with __skb_header_release(). Their headers are private,
so they are not copied, which avoids a reallocation for every TCP
segment sent through an ipvlan slave.
If the allocation fails, the existing error accounting and drop paths
are used. L2 mode is unaffected.
[edumazet: use skb_cow_head() instead of skb_unclone() to avoid
copying every TCP segment, reword changelog]
Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104113530.986664-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ipvlan/ipvlan_core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 6c6677ded82ef..18f03d59ea486 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -425,7 +425,8 @@ static noinline_for_stack int ipvlan_process_v4_outbound(struct sk_buff *skb)
.flowi4_mark = skb->mark,
};
- if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
+ if (!pskb_network_may_pull(skb, sizeof(struct iphdr)) ||
+ skb_cow_head(skb, 0))
goto err;
ip4h = ip_hdr(skb);
@@ -491,7 +492,8 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
struct net_device *dev = skb->dev;
int err, ret = NET_XMIT_DROP;
- if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr))) {
+ if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)) ||
+ skb_cow_head(skb, 0)) {
DEV_STATS_INC(dev, tx_errors);
kfree_skb(skb);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 415/990] wifi: mac80211: mesh: dont linearize SKBs unnecessarily
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (413 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 414/990] ipvlan: make outbound skb headers writable Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 416/990] wifi: mac80211: abort chanswitch when leaving an IBSS Greg Kroah-Hartman
` (437 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johannes Berg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit 6a6db144d96352967623f38692dfc4b4fb814518 ]
If mesh fast-xmit cannot be used due to aggregation not
being fully set up yet, there's no need to linearize the
SKB. Avoid that, which addresses a stale pointer issue
in the caller.
Change-Id: I6b93e6c7587faf8749f8366ed574ee2b79fd47a5
Fixes: 8b0f5cb6bc7c ("wifi: mac80211: use mesh header cache to speed up mesh forwarding")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/rx.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1f1b1e4f0df70..04dafe115d2c2 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2818,9 +2818,6 @@ ieee80211_rx_mesh_fast_forward(struct ieee80211_sub_if_data *sdata,
if (!sta)
return false;
- if (skb_linearize(skb))
- return false;
-
tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
if (tid_tx) {
@@ -2831,6 +2828,10 @@ ieee80211_rx_mesh_fast_forward(struct ieee80211_sub_if_data *sdata,
tid_tx->last_tx = jiffies;
}
+ /* this function must not fail after this */
+ if (skb_linearize(skb))
+ return false;
+
ieee80211_aggr_check(sdata, sta, skb);
if (ieee80211_get_8023_tunnel_proto(skb->data + hdrlen,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 416/990] wifi: mac80211: abort chanswitch when leaving an IBSS
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (414 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 415/990] wifi: mac80211: mesh: dont linearize SKBs unnecessarily Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 417/990] net: fix mac_len of skbs copied by generic XDP Greg Kroah-Hartman
` (436 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Luka Gejak, Mehmet Fide,
Johannes Berg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
[ Upstream commit 12f97c692dcbce088554a5530c79c55174ccee1a ]
ieee80211_ibss_disconnect() leaves CSA active, as ieee80211_stop_mesh()
did until commit ac7472a24bd4 ("wifi: mac80211: abort chanswitch when
leaving a mesh"). An IBSS left during its countdown and joined again
refuses every new channel switch with -EBUSY.
Abort the channel switch the same way.
Fixes: cd7760e62c2a ("mac80211: add support for CSA in IBSS mode")
Reported-by: Luka Gejak <luka.gejak@linux.dev>
Closes: https://lore.kernel.org/linux-wireless/796598480d47c5bf474d11828769e864b8209558@linux.dev/
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Link: https://patch.msgid.link/20261025193615.1123718-1-mehmet.fide@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/ibss.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 4dc748a667a72..c7348e7db4f16 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -676,6 +676,10 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
netif_carrier_off(sdata->dev);
+
+ sdata->vif.bss_conf.csa_active = false;
+ ieee80211_vif_unblock_queues_csa(sdata);
+
if (!sta_info_flush(sdata, -1))
synchronize_net();
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 417/990] net: fix mac_len of skbs copied by generic XDP
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (415 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 416/990] wifi: mac80211: abort chanswitch when leaving an IBSS Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 418/990] ovl: allow idmapping overlay mounts Greg Kroah-Hartman
` (435 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tianyi Gao,
Toke Høiland-Jørgensen, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianyi Gao <tianyi@cloudflare.com>
[ Upstream commit 71578e43b8a6723025579a08a707f4975a3cd567 ]
skb_pp_cow_data() copies the header fields of the old skb with
skb_copy_header(). skb_copy_header() does not copy mac_len.
Generic XDP uses skb_pp_cow_data() for programs with frags support.
After such a program, the skb can have mac_len 0.
cpu_map_generic_redirect() and tc ingress then get the position of the
Ethernet header wrong.
Copy mac_len in skb_pp_cow_data(), as dev_map_generic_redirect() does
after skb_copy().
Fixes: e6d5dbdd20aa ("xdp: add multi-buff support for xdp running in generic mode")
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://patch.msgid.link/20261103200036.65764-3-tianyi@cloudflare.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index de69f89086513..4ee359dfe93bc 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -934,6 +934,7 @@ int skb_pp_cow_data(struct page_pool *pool, struct sk_buff **pskb,
skb_reserve(nskb, headroom);
skb_copy_header(nskb, skb);
+ nskb->mac_len = skb->mac_len;
skb_mark_for_recycle(nskb);
err = skb_copy_bits(skb, 0, nskb->data, size);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 418/990] ovl: allow idmapping overlay mounts
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (416 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 417/990] net: fix mac_len of skbs copied by generic XDP Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 419/990] ovl: release the upperdir/workdir in-use locks before the umount sync Greg Kroah-Hartman
` (434 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Amir Goldstein,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
[ Upstream commit adedb6a00a1e4c77b1de9ea1f63b5008ad0c21f5 ]
Now that every overlay inode operation honors the overlay mount idmap,
allow the merged overlay mount itself to be idmapped by setting
FS_ALLOW_IDMAP on ovl_fs_type. mount_setattr(MOUNT_ATTR_IDMAP) can
then apply an idmapping to an overlay mount, exposing the merged tree
under a different ownership view.
The composition is clean because overlayfs already normalizes every
underlying id through the relevant layer idmap when it copies
attributes into the overlay inode (ovl_copyattr()); the overlay inode's
i_{u,g}id are thus "overlay-final" ids. The overlay mount idmap
composes on top of that pivot: it is applied to (getattr) and removed
from (setattr, create) those ids at the overlay-inode boundary -
permission, getattr, setattr, ACL owner checks and inode_init_owner() -
while the underlying layers keep being accessed with the mounter's
credentials through their own, possibly idmapped, mounts. The mount
idmap therefore only changes how the caller sees the overlay inode and
never widens the mounter's access to the layers.
This is deliberately the final code patch of the series: only once
every operation honors the mount idmap is it safe to make overlay
mounts idmappable.
Link: https://patch.msgid.link/20260615-work-idmapped-overlayfs-v1-6-7381632aa402@kernel.org
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Stable-dep-of: cb6c084182d4 ("ovl: release the upperdir/workdir in-use locks before the umount sync")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 52d6f32a5a7c3..71ce12e203ea0 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1611,7 +1611,7 @@ struct file_system_type ovl_fs_type = {
.name = "overlay",
.init_fs_context = ovl_init_fs_context,
.parameters = ovl_parameter_spec,
- .fs_flags = FS_USERNS_MOUNT,
+ .fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP,
.kill_sb = kill_anon_super,
};
MODULE_ALIAS_FS("overlay");
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 419/990] ovl: release the upperdir/workdir in-use locks before the umount sync
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (417 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 418/990] ovl: allow idmapping overlay mounts Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 420/990] bonding: fix slave_cnt leak on XDP enslave failure Greg Kroah-Hartman
` (433 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Miklos Szeredi, Amir Goldstein,
Pavel Tikhomirov, Denis V. Lunev, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis V. Lunev <den@openvz.org>
[ Upstream commit cb6c084182d4c69b7eeff0bd519dd7e018749602 ]
The in-use locks on upperdir and workdir are released by ovl_free_fs()
from ->put_super(). generic_shutdown_super() calls sync_filesystem()
before that, and ovl_sync_fs() syncs the whole upper filesystem, so the
locks stay held across a journal commit and a cache flush of the upper
fs after the overlay is gone. With index=on a new overlay that uses the
same upperdir, or uses it as a lowerdir, fails to mount in that window:
overlayfs: upperdir is in-use as upperdir/workdir of another mount,
mount with '-o index=off' to override exclusive upperdir protection.
Userspace hits this when the last reference is not dropped by umount(2)
itself. Docker with the containerd snapshotter mounts a snapshot on a
thread with a private mount namespace for docker cp and for buildkit,
and the superblock dies when that thread exits, after the reply to the
client has gone out. The next request then gets EBUSY. The window grows
with the flush latency of the upper fs and is there even if nothing was
written through the overlay, as the mount itself dirties the upper.
->kill_sb() is called once s_active drops to zero, with no mount and no
open file left. Release the locks there, before generic_shutdown_super()
runs. What the dying superblock still does to the upper fs, the sync and
dropping its references to upper dentries and inodes, does not touch the
contents of upperdir or workdir. ovl_free_fs() still releases the locks
for a failed mount, so clear the *_locked flags to keep it from
unlocking a second time and dropping the lock of a newer mount.
This takes the sync out of the window but does not close it: the final
mntput of a dying mount namespace runs from task_work, after the exiting
thread may have reported completion. Userspace that needs the
directories free should umount(2) before saying the job is done.
Fixes: 2cac0c00a6cd ("ovl: get exclusive ownership on upper/work dirs")
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/overlayfs/overlayfs.h | 1 +
fs/overlayfs/params.c | 5 +----
fs/overlayfs/super.c | 12 +++++++++++-
fs/overlayfs/util.c | 12 ++++++++++++
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 7bd69773f33c9..a0a5f18b5f77d 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -575,6 +575,7 @@ static inline int ovl_set_impure_dir(struct dentry *dentry)
bool ovl_inuse_trylock(struct dentry *dentry);
void ovl_inuse_unlock(struct dentry *dentry);
bool ovl_is_inuse(struct dentry *dentry);
+void ovl_inuse_unlock_all(struct ovl_fs *ofs);
bool ovl_need_index(struct dentry *dentry);
int ovl_nlink_start(struct dentry *dentry);
void ovl_nlink_end(struct dentry *dentry);
diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
index 7d8bc6d3863c1..fc39caf0e4993 100644
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -842,15 +842,12 @@ void ovl_free_fs(struct ovl_fs *ofs)
struct vfsmount **mounts;
unsigned i;
+ ovl_inuse_unlock_all(ofs);
iput(ofs->workbasedir_trap);
iput(ofs->workdir_trap);
dput(ofs->whiteout);
dput(ofs->workdir);
- if (ofs->workdir_locked)
- ovl_inuse_unlock(ofs->workbasedir);
dput(ofs->workbasedir);
- if (ofs->upperdir_locked)
- ovl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root);
/* Reuse ofs->config.lowerdirs as a vfsmount array before freeing it */
mounts = (struct vfsmount **) ofs->config.lowerdirs;
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 71ce12e203ea0..f3a0fc8e12c17 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1606,13 +1606,23 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
return err;
}
+static void ovl_kill_sb(struct super_block *sb)
+{
+ struct ovl_fs *ofs = OVL_FS(sb);
+
+ /* Nothing can modify them now, do not hold them across the sync */
+ if (ofs)
+ ovl_inuse_unlock_all(ofs);
+ kill_anon_super(sb);
+}
+
struct file_system_type ovl_fs_type = {
.owner = THIS_MODULE,
.name = "overlay",
.init_fs_context = ovl_init_fs_context,
.parameters = ovl_parameter_spec,
.fs_flags = FS_USERNS_MOUNT | FS_ALLOW_IDMAP,
- .kill_sb = kill_anon_super,
+ .kill_sb = ovl_kill_sb,
};
MODULE_ALIAS_FS("overlay");
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index f75e8009fb15f..27928c9ea0eb8 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -1064,6 +1064,18 @@ bool ovl_is_inuse(struct dentry *dentry)
return inuse;
}
+void ovl_inuse_unlock_all(struct ovl_fs *ofs)
+{
+ if (ofs->workdir_locked) {
+ ovl_inuse_unlock(ofs->workbasedir);
+ ofs->workdir_locked = false;
+ }
+ if (ofs->upperdir_locked) {
+ ovl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root);
+ ofs->upperdir_locked = false;
+ }
+}
+
/*
* Does this overlay dentry need to be indexed on copy up?
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 420/990] bonding: fix slave_cnt leak on XDP enslave failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (418 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 419/990] ovl: release the upperdir/workdir in-use locks before the umount sync Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 421/990] NFSv4: wake blocking lock waiters when a delegated lock is released Greg Kroah-Hartman
` (432 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, 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 a978095699641d4f83a32b499a981c419c94abca ]
bond_enslave() increments bond->slave_cnt before setting up XDP on the
new slave. If that setup fails (slave has no XDP support, already has
an XDP program, or dev_xdp_propagate() fails), the error path jumps to
err_sysfs_del, which never decrements slave_cnt.
Each failed enslave therefore leaves slave_cnt one too high:
- SIOCBONDINFOQUERY reports a wrong num_slaves,
- balance-rr picks slave ids beyond the end of the slave list, so
bond_get_slave_by_id() falls back to the first usable slave and
transmit is skewed toward it.
Reproducer:
ip link add bond0 type bond mode balance-rr
ip link set bond0 xdpdrv obj xdp_dummy.bpf.o sec xdp
for i in 0 1 2; do
ip link add d$i type dummy
ip link set d$i master bond0 # fails: Slave does not support XDP
done
num_slaves read via SIOCBONDINFOQUERY is 3 before this patch, 0 after.
Add an err_dec_slave_cnt label ahead of err_sysfs_del and use it from
the three XDP failure paths, which are the only failures after the
increment.
Fixes: 9e2ee5c7e7c3 ("net, bonding: Add XDP support to the bonding driver")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104092851.688361-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/bonding/bond_main.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ca2ea493c81a3..9b46eabf2ebaa 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2307,7 +2307,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
SLAVE_NL_ERR(bond_dev, slave_dev, extack,
"Slave does not support XDP");
res = -EOPNOTSUPP;
- goto err_sysfs_del;
+ goto err_dec_slave_cnt;
}
} else if (bond->xdp_prog) {
struct netdev_bpf xdp = {
@@ -2321,14 +2321,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
SLAVE_NL_ERR(bond_dev, slave_dev, extack,
"Slave has XDP program loaded, please unload before enslaving");
res = -EOPNOTSUPP;
- goto err_sysfs_del;
+ goto err_dec_slave_cnt;
}
res = dev_xdp_propagate(slave_dev, &xdp);
if (res < 0) {
/* ndo_bpf() sets extack error message */
slave_dbg(bond_dev, slave_dev, "Error %d calling ndo_bpf\n", res);
- goto err_sysfs_del;
+ goto err_dec_slave_cnt;
}
if (bond->xdp_prog)
bpf_prog_inc(bond->xdp_prog);
@@ -2350,6 +2350,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
return 0;
/* Undo stages on error */
+err_dec_slave_cnt:
+ WRITE_ONCE(bond->slave_cnt, bond->slave_cnt - 1);
+
err_sysfs_del:
bond_sysfs_slave_del(new_slave);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 421/990] NFSv4: wake blocking lock waiters when a delegated lock is released
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (419 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 420/990] bonding: fix slave_cnt leak on XDP enslave failure Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 422/990] tun: delete the flow entries of the moved queue on detach Greg Kroah-Hartman
` (431 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Olga Kornievskaia, Anna Schumaker,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <okorniev@redhat.com>
[ Upstream commit e8433473eca284bc561373d0a0fff632f76aa594 ]
When the client holds a delegation, _nfs4_proc_setlk() caches POSIX
locks locally and never sends a LOCK to the server. It has to strip
FL_SLEEP to do so, since that branch runs holding
sp->so_delegreturn_mutex and nfsi->rwsem and F_SETLKW can block
indefinitely. A contending waiter is therefore never placed on the VFS
blocked-lock list, and locks_wake_up_blocks() does not reach it when the
holder releases.
The waiter blocks in nfs4_retry_setlk() on clp->cl_lock_waitq instead,
whose only waker is nfs4_callback_notify_lock(). The server never saw a
LOCK for a cached lock, so it does not know anyone is waiting and will
never send a CB_NOTIFY_LOCK; nfs4_proc_unlck() returns early without
sending LOCKU for the same reason. The waiter sleeps out the full
NFS4_LOCK_MAXTIMEOUT of 30s before retrying a lock that is long free.
Wake cl_lock_waitq when releasing a cached lock. The releasing thread
cannot tell which waiter wants the lock, so the wakeup names only the
inode; make the owner comparison in nfs4_wake_lock_waiter() conditional
on cbnl_valid so that a CB_NOTIFY_LOCK still wakes exactly the owner it
names. The inode restriction matters: without it every blocked locker
for the server is woken, and those on non-delegated state each retry
with a LOCK RPC.
Fixes: a1d617d8f134 ("nfs: allow blocking locks to be awoken by lock callbacks")
Assisted-by: Claude Opus 5
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4proc.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1e8c1fe993aaf..f37f71226d0ea 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7323,8 +7323,15 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
if (status != 0)
goto out;
/* Is this a delegated lock? */
- if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0)
+ if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) == 0) {
+ struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
+ struct cb_notify_lock_args cbnl = { .cbnl_valid = false };
+
+ /* The server never saw it, so it will not notify waiters */
+ nfs_copy_fh(&cbnl.cbnl_fh, NFS_FH(inode));
+ __wake_up(&clp->cl_lock_waitq, TASK_NORMAL, 0, &cbnl);
goto out;
+ }
alloc_seqid = NFS_SERVER(inode)->nfs_client->cl_mvops->alloc_seqid;
seqid = alloc_seqid(&lsp->ls_seqid, GFP_KERNEL);
status = -ENOMEM;
@@ -7746,8 +7753,14 @@ nfs4_wake_lock_waiter(wait_queue_entry_t *wait, unsigned int mode, int flags, vo
struct nfs_lowner *lowner = &cbnl->cbnl_owner,
*wowner = &waiter->owner;
- /* Only wake if the callback was for the same owner. */
- if (lowner->id != wowner->id || lowner->s_dev != wowner->s_dev)
+ /*
+ * Only wake the owner a CB_NOTIFY_LOCK names. A lock cached
+ * under a delegation is released locally, and the releasing
+ * thread cannot tell which waiter wants it, so those wakeups
+ * (cbnl_valid false) name only the inode and wake them all.
+ */
+ if (cbnl->cbnl_valid &&
+ (lowner->id != wowner->id || lowner->s_dev != wowner->s_dev))
return 0;
/* Make sure it's for the right inode */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 422/990] tun: delete the flow entries of the moved queue on detach
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (420 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 421/990] NFSv4: wake blocking lock waiters when a delegated lock is released Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 423/990] fbnic: Rename PCS IRQ to MAC IRQ as it is actually a MAC interrupt Greg Kroah-Hartman
` (430 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Umang Pokhriyal, Willem de Bruijn,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Umang Pokhriyal <umangpokhriyall@gmail.com>
[ Upstream commit 4cc0a3f897074cea28dae38f1cd9bb230dae5d86 ]
When a queue is detached, __tun_detach() moves the last queue into the
freed slot and decrements tun->numqueues. The flow entries that point at
the old index of the moved queue, now tun->numqueues, are meant to be
deleted, but the call passes tun->numqueues + 1, an index that never
exists, so nothing is deleted.
Until those entries are refreshed by a write on their flow or age out,
tun_automq_select_queue() returns an index past the last queue, and
netdev_core_pick_tx() sends every such flow to queue 0 and warns:
tapq0 selects TX queue 3, but real number of TX queues is 3
Found with an LLM while testing how a VMM detaches tap queues when a
guest lowers its virtio-net queue pairs. With four queues, 30 flows
learned on queue 3 and queue 1 detached, all 30 went to queue 0 with the
warning; with this patch they are spread by hash and no warning is
printed (3 runs each, in a guest booted on net).
Pass tun->numqueues.
Fixes: 96442e42429e ("tuntap: choose the txq based on rxq")
Signed-off-by: Umang Pokhriyal <umangpokhriyall@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261104174240.138491-1-umangpokhriyall@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 51b598d53f5bf..d7780a0069218 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -607,7 +607,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
}
synchronize_net();
- tun_flow_delete_by_queue(tun, tun->numqueues + 1);
+ tun_flow_delete_by_queue(tun, tun->numqueues);
/* Drop read queue */
tun_queue_purge(tfile);
tun_set_real_num_queues(tun);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 423/990] fbnic: Rename PCS IRQ to MAC IRQ as it is actually a MAC interrupt
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (421 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 422/990] tun: delete the flow entries of the moved queue on detach Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 424/990] fbnic: Add logic to track PMD state via MAC/PCS signals Greg Kroah-Hartman
` (429 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Duyck, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <alexanderduyck@fb.com>
[ Upstream commit f18dd1b15f7a0bea5743fcbf3a62b7d2940e2dd5 ]
Throughout several spots in the code I had called out the IRQ as being
related to the PCS. However the actual IRQ is a part of the MAC and it is
just exposing PCS data. To more accurately reflect the owner of the calls
this change makes it so that we rename the functions and values that are
taking in the interrupt value and processing it to reflect that it is a MAC
call and not a PCS one.
This change is mostly motivated by the fact that we will be moving the
handling of this interrupt from being PCS focused to being more PMA/PMD
focused as this will drive the phydev driver that I am adding instead of
driving the PCS directly.
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/176374322373.959489.12018231545479053860.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 05ec5504ff69 ("fbnic: Fix service task races with ndo_stop and PM suspend")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic.h | 6 ++--
drivers/net/ethernet/meta/fbnic/fbnic_irq.c | 30 +++++++++----------
drivers/net/ethernet/meta/fbnic/fbnic_mac.c | 14 ++++-----
drivers/net/ethernet/meta/fbnic/fbnic_mac.h | 8 ++---
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 4 +--
.../net/ethernet/meta/fbnic/fbnic_phylink.c | 2 +-
6 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic.h b/drivers/net/ethernet/meta/fbnic/fbnic.h
index ca465282b53f1..3799bb7f6630a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic.h
@@ -34,7 +34,7 @@ struct fbnic_dev {
u32 __iomem *uc_addr4;
const struct fbnic_mac *mac;
unsigned int fw_msix_vector;
- unsigned int pcs_msix_vector;
+ unsigned int mac_msix_vector;
unsigned short num_irqs;
struct {
@@ -180,8 +180,8 @@ void fbnic_fw_free_mbx(struct fbnic_dev *fbd);
void fbnic_hwmon_register(struct fbnic_dev *fbd);
void fbnic_hwmon_unregister(struct fbnic_dev *fbd);
-int fbnic_pcs_request_irq(struct fbnic_dev *fbd);
-void fbnic_pcs_free_irq(struct fbnic_dev *fbd);
+int fbnic_mac_request_irq(struct fbnic_dev *fbd);
+void fbnic_mac_free_irq(struct fbnic_dev *fbd);
void fbnic_napi_name_irqs(struct fbnic_dev *fbd);
int fbnic_napi_request_irq(struct fbnic_dev *fbd,
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_irq.c b/drivers/net/ethernet/meta/fbnic/fbnic_irq.c
index 1c88a2bf3a7a7..40947e142c5d0 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_irq.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_irq.c
@@ -118,12 +118,12 @@ void fbnic_fw_free_mbx(struct fbnic_dev *fbd)
fbd->fw_msix_vector = 0;
}
-static irqreturn_t fbnic_pcs_msix_intr(int __always_unused irq, void *data)
+static irqreturn_t fbnic_mac_msix_intr(int __always_unused irq, void *data)
{
struct fbnic_dev *fbd = data;
struct fbnic_net *fbn;
- if (fbd->mac->pcs_get_link_event(fbd) == FBNIC_LINK_EVENT_NONE) {
+ if (fbd->mac->get_link_event(fbd) == FBNIC_LINK_EVENT_NONE) {
fbnic_wr32(fbd, FBNIC_INTR_MASK_CLEAR(0),
1u << FBNIC_PCS_MSIX_ENTRY);
return IRQ_HANDLED;
@@ -137,20 +137,20 @@ static irqreturn_t fbnic_pcs_msix_intr(int __always_unused irq, void *data)
}
/**
- * fbnic_pcs_request_irq - Configure the PCS to enable it to advertise link
+ * fbnic_mac_request_irq - Configure the MAC to enable it to advertise link
* @fbd: Pointer to device to initialize
*
- * This function provides basic bringup for the MAC/PCS IRQ. For now the IRQ
+ * This function provides basic bringup for the MAC/PHY IRQ. For now the IRQ
* will remain disabled until we start the MAC/PCS/PHY logic via phylink.
*
* Return: non-zero on failure.
**/
-int fbnic_pcs_request_irq(struct fbnic_dev *fbd)
+int fbnic_mac_request_irq(struct fbnic_dev *fbd)
{
struct pci_dev *pdev = to_pci_dev(fbd->dev);
int vector, err;
- WARN_ON(fbd->pcs_msix_vector);
+ WARN_ON(fbd->mac_msix_vector);
vector = pci_irq_vector(pdev, FBNIC_PCS_MSIX_ENTRY);
if (vector < 0)
@@ -159,7 +159,7 @@ int fbnic_pcs_request_irq(struct fbnic_dev *fbd)
/* Request the IRQ for PCS link vector.
* Map PCS cause to it, and unmask it
*/
- err = request_irq(vector, &fbnic_pcs_msix_intr, 0,
+ err = request_irq(vector, &fbnic_mac_msix_intr, 0,
fbd->netdev->name, fbd);
if (err)
return err;
@@ -168,22 +168,22 @@ int fbnic_pcs_request_irq(struct fbnic_dev *fbd)
fbnic_wr32(fbd, FBNIC_INTR_MSIX_CTRL(FBNIC_INTR_MSIX_CTRL_PCS_IDX),
FBNIC_PCS_MSIX_ENTRY | FBNIC_INTR_MSIX_CTRL_ENABLE);
- fbd->pcs_msix_vector = vector;
+ fbd->mac_msix_vector = vector;
return 0;
}
/**
- * fbnic_pcs_free_irq - Teardown the PCS IRQ to prepare for stopping
+ * fbnic_mac_free_irq - Teardown the MAC IRQ to prepare for stopping
* @fbd: Pointer to device that is stopping
*
- * This function undoes the work done in fbnic_pcs_request_irq and prepares
+ * This function undoes the work done in fbnic_mac_request_irq and prepares
* the device to no longer receive traffic on the host interface.
**/
-void fbnic_pcs_free_irq(struct fbnic_dev *fbd)
+void fbnic_mac_free_irq(struct fbnic_dev *fbd)
{
/* Vector has already been freed */
- if (!fbd->pcs_msix_vector)
+ if (!fbd->mac_msix_vector)
return;
/* Disable interrupt */
@@ -192,14 +192,14 @@ void fbnic_pcs_free_irq(struct fbnic_dev *fbd)
fbnic_wrfl(fbd);
/* Synchronize IRQ to prevent race that would unmask vector */
- synchronize_irq(fbd->pcs_msix_vector);
+ synchronize_irq(fbd->mac_msix_vector);
/* Mask the vector */
fbnic_wr32(fbd, FBNIC_INTR_MASK_SET(0), 1u << FBNIC_PCS_MSIX_ENTRY);
/* Free the vector */
- free_irq(fbd->pcs_msix_vector, fbd);
- fbd->pcs_msix_vector = 0;
+ free_irq(fbd->mac_msix_vector, fbd);
+ fbd->mac_msix_vector = 0;
}
void fbnic_synchronize_irq(struct fbnic_dev *fbd, int nr)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_mac.c b/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
index 2a84bd1d7e268..28a2e1fd3760a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
@@ -434,14 +434,14 @@ static void fbnic_mac_tx_pause_config(struct fbnic_dev *fbd, bool tx_pause)
wr32(fbd, FBNIC_RXB_PAUSE_DROP_CTRL, rxb_pause_ctrl);
}
-static int fbnic_pcs_get_link_event_asic(struct fbnic_dev *fbd)
+static int fbnic_mac_get_link_event(struct fbnic_dev *fbd)
{
- u32 pcs_intr_mask = rd32(fbd, FBNIC_SIG_PCS_INTR_STS);
+ u32 intr_mask = rd32(fbd, FBNIC_SIG_PCS_INTR_STS);
- if (pcs_intr_mask & FBNIC_SIG_PCS_INTR_LINK_DOWN)
+ if (intr_mask & FBNIC_SIG_PCS_INTR_LINK_DOWN)
return FBNIC_LINK_EVENT_DOWN;
- return (pcs_intr_mask & FBNIC_SIG_PCS_INTR_LINK_UP) ?
+ return (intr_mask & FBNIC_SIG_PCS_INTR_LINK_UP) ?
FBNIC_LINK_EVENT_UP : FBNIC_LINK_EVENT_NONE;
}
@@ -521,7 +521,7 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
return !lane_mask;
}
-static bool fbnic_pcs_get_link_asic(struct fbnic_dev *fbd)
+static bool fbnic_mac_get_link(struct fbnic_dev *fbd)
{
bool link;
@@ -869,8 +869,8 @@ static const struct fbnic_mac fbnic_mac_asic = {
.init_regs = fbnic_mac_init_regs,
.pcs_enable = fbnic_pcs_enable_asic,
.pcs_disable = fbnic_pcs_disable_asic,
- .pcs_get_link = fbnic_pcs_get_link_asic,
- .pcs_get_link_event = fbnic_pcs_get_link_event_asic,
+ .get_link = fbnic_mac_get_link,
+ .get_link_event = fbnic_mac_get_link_event,
.get_fec_stats = fbnic_mac_get_fec_stats,
.get_pcs_stats = fbnic_mac_get_pcs_stats,
.get_eth_mac_stats = fbnic_mac_get_eth_mac_stats,
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_mac.h b/drivers/net/ethernet/meta/fbnic/fbnic_mac.h
index ede5ff0dae22f..414c170abcba0 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_mac.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_mac.h
@@ -59,9 +59,9 @@ enum fbnic_sensor_id {
* Configure and enable PCS to enable link if not already enabled
* void (*pcs_disable)(struct fbnic_dev *fbd);
* Shutdown the link if we are the only consumer of it.
- * bool (*pcs_get_link)(struct fbnic_dev *fbd);
+ * bool (*get_link)(struct fbnic_dev *fbd);
* Check PCS link status
- * int (*pcs_get_link_event)(struct fbnic_dev *fbd)
+ * int (*get_link_event)(struct fbnic_dev *fbd)
* Get the current link event status, reports true if link has
* changed to either FBNIC_LINK_EVENT_DOWN or FBNIC_LINK_EVENT_UP
*
@@ -76,8 +76,8 @@ struct fbnic_mac {
int (*pcs_enable)(struct fbnic_dev *fbd);
void (*pcs_disable)(struct fbnic_dev *fbd);
- bool (*pcs_get_link)(struct fbnic_dev *fbd);
- int (*pcs_get_link_event)(struct fbnic_dev *fbd);
+ bool (*get_link)(struct fbnic_dev *fbd);
+ int (*get_link_event)(struct fbnic_dev *fbd);
void (*get_fec_stats)(struct fbnic_dev *fbd, bool reset,
struct fbnic_fec_stats *fec_stats);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index fe995632a42c6..5c8077ee1fe3a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -44,7 +44,7 @@ int __fbnic_open(struct fbnic_net *fbn)
if (err)
goto time_stop;
- err = fbnic_pcs_request_irq(fbd);
+ err = fbnic_mac_request_irq(fbd);
if (err)
goto time_stop;
@@ -89,7 +89,7 @@ static int fbnic_stop(struct net_device *netdev)
phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd));
fbnic_down(fbn);
- fbnic_pcs_free_irq(fbn->fbd);
+ fbnic_mac_free_irq(fbn->fbd);
fbnic_time_stop(fbn);
fbnic_fw_xmit_ownership_msg(fbn->fbd, false);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c b/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
index 62701923cfe96..99fa79acd2df6 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
@@ -132,7 +132,7 @@ fbnic_phylink_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
state->duplex = DUPLEX_FULL;
- state->link = fbd->mac->pcs_get_link(fbd);
+ state->link = fbd->mac->get_link(fbd);
}
static int
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 424/990] fbnic: Add logic to track PMD state via MAC/PCS signals
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (422 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 423/990] fbnic: Rename PCS IRQ to MAC IRQ as it is actually a MAC interrupt Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 425/990] fbnic: Fix service task races with ndo_stop and PM suspend Greg Kroah-Hartman
` (428 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Duyck, Paolo Abeni,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <alexanderduyck@fb.com>
[ Upstream commit 9963117a2b9b29074763ccb62fe8ee4d78ca46f2 ]
One complication with the design of our part is that the PMD doesn't
provide a direct signal to the host. Instead we have visibility to signals
that the PCS provides to the MAC that allow us to check the link state
through that.
We will need to account for several things in the PMD and firmware when
managing the link. Specifically when the link first starts to come up the
PMD will cause the link to flap. This is due to the firmware starting a
training cycle when the link is first detected. This will cause link
flapping if we were to immediately report link up when the PCS first
detects it.
To address that we are adding a pmd_state variable that is meant to be a
countdown of sorts indicating the state of the PMD. If the link is down or
has been reconfigured the PMD will start out in the initialize state. By
default the link is assumed to be in the SEND_DATA state if it is available
on initial link inspection. If link is detected while in the initialize
state the PMD state will switch to training, and if after 4 seconds the
link is still stable we will transition to link_ready, and finally the
send_data state. With this we can avoid link flapping when a cable is
first connected to the NIC.
One side effect of this is that we need to pull the link state away from
the PCS. For now we use a union of the PCS link state register value and
the pmd_state. The plan is to add a PMD register to report the pmd_state
to the phylink interface. With that we can then look at switching over to
the use of the XPCS driver for fbnic instead of having an internal one.
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/176374323107.959489.14951134213387615059.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 05ec5504ff69 ("fbnic: Fix service task races with ndo_stop and PM suspend")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic.h | 4 +
drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 2 +
drivers/net/ethernet/meta/fbnic/fbnic_irq.c | 4 +-
drivers/net/ethernet/meta/fbnic/fbnic_mac.c | 69 ++++++++----
drivers/net/ethernet/meta/fbnic/fbnic_mac.h | 36 +++++--
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 2 +-
.../net/ethernet/meta/fbnic/fbnic_netdev.h | 2 +-
drivers/net/ethernet/meta/fbnic/fbnic_pci.c | 6 +-
.../net/ethernet/meta/fbnic/fbnic_phylink.c | 102 ++++++++++++++----
9 files changed, 175 insertions(+), 52 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic.h b/drivers/net/ethernet/meta/fbnic/fbnic.h
index 3799bb7f6630a..dbc3ff5659b4b 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic.h
@@ -83,6 +83,10 @@ struct fbnic_dev {
/* Last @time_high refresh time in jiffies (to catch stalls) */
unsigned long last_read;
+ /* PMD specific data */
+ unsigned long end_of_pmd_training;
+ u8 pmd_state;
+
/* Local copy of hardware statistics */
struct fbnic_hw_stats hw_stats;
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index 00c76708f2335..cf659be3004b2 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -787,6 +787,8 @@ enum {
/* MAC PCS registers */
#define FBNIC_CSR_START_PCS 0x10000 /* CSR section delimiter */
+#define FBNIC_PCS_PAGE(n) (0x10000 + 0x400 * (n)) /* 0x40000 + 1024*n */
+#define FBNIC_PCS(reg, n) ((reg) + FBNIC_PCS_PAGE(n))
#define FBNIC_CSR_END_PCS 0x10668 /* CSR section delimiter */
#define FBNIC_CSR_START_RSFEC 0x10800 /* CSR section delimiter */
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_irq.c b/drivers/net/ethernet/meta/fbnic/fbnic_irq.c
index 40947e142c5d0..9b068b82f30a0 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_irq.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_irq.c
@@ -131,7 +131,9 @@ static irqreturn_t fbnic_mac_msix_intr(int __always_unused irq, void *data)
fbn = netdev_priv(fbd->netdev);
- phylink_pcs_change(&fbn->phylink_pcs, false);
+ /* Record link down events */
+ if (!fbd->mac->get_link(fbd, fbn->aui, fbn->fec))
+ phylink_pcs_change(&fbn->phylink_pcs, false);
return IRQ_HANDLED;
}
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_mac.c b/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
index 28a2e1fd3760a..fc7abea4ef5bf 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_mac.c
@@ -466,9 +466,8 @@ static u32 __fbnic_mac_cmd_config_asic(struct fbnic_dev *fbd,
return command_config;
}
-static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
+static bool fbnic_mac_get_link_status(struct fbnic_dev *fbd, u8 aui, u8 fec)
{
- struct fbnic_net *fbn = netdev_priv(fbd->netdev);
u32 pcs_status, lane_mask = ~0;
pcs_status = rd32(fbd, FBNIC_SIG_PCS_OUT0);
@@ -476,7 +475,7 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
return false;
/* Define the expected lane mask for the status bits we need to check */
- switch (fbn->aui) {
+ switch (aui) {
case FBNIC_AUI_100GAUI2:
lane_mask = 0xf;
break;
@@ -484,7 +483,7 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
lane_mask = 3;
break;
case FBNIC_AUI_LAUI2:
- switch (fbn->fec) {
+ switch (fec) {
case FBNIC_FEC_OFF:
lane_mask = 0x63;
break;
@@ -502,7 +501,7 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
}
/* Use an XOR to remove the bits we expect to see set */
- switch (fbn->fec) {
+ switch (fec) {
case FBNIC_FEC_OFF:
lane_mask ^= FIELD_GET(FBNIC_SIG_PCS_OUT0_BLOCK_LOCK,
pcs_status);
@@ -521,7 +520,46 @@ static bool fbnic_mac_get_pcs_link_status(struct fbnic_dev *fbd)
return !lane_mask;
}
-static bool fbnic_mac_get_link(struct fbnic_dev *fbd)
+static bool fbnic_pmd_update_state(struct fbnic_dev *fbd, bool signal_detect)
+{
+ /* Delay link up for 4 seconds to allow for link training.
+ * The state transitions for this are as follows:
+ *
+ * All states have the following two transitions in common:
+ * Loss of signal -> FBNIC_PMD_INITIALIZE
+ * The condition handled below (!signal)
+ * Reconfiguration -> FBNIC_PMD_INITIALIZE
+ * Occurs when mac_prepare starts a PHY reconfig
+ * FBNIC_PMD_TRAINING:
+ * signal still detected && 4s have passed -> Report link up
+ * When link is brought up in link_up -> FBNIC_PMD_SEND_DATA
+ * FBNIC_PMD_INITIALIZE:
+ * signal detected -> FBNIC_PMD_TRAINING
+ */
+ if (!signal_detect) {
+ fbd->pmd_state = FBNIC_PMD_INITIALIZE;
+ return false;
+ }
+
+ switch (fbd->pmd_state) {
+ case FBNIC_PMD_TRAINING:
+ return time_before(fbd->end_of_pmd_training, jiffies);
+ case FBNIC_PMD_LINK_READY:
+ case FBNIC_PMD_SEND_DATA:
+ return true;
+ }
+
+ fbd->end_of_pmd_training = jiffies + 4 * HZ;
+
+ /* Ensure end_of_training is visible before the state change */
+ smp_wmb();
+
+ fbd->pmd_state = FBNIC_PMD_TRAINING;
+
+ return false;
+}
+
+static bool fbnic_mac_get_link(struct fbnic_dev *fbd, u8 aui, u8 fec)
{
bool link;
@@ -538,7 +576,8 @@ static bool fbnic_mac_get_link(struct fbnic_dev *fbd)
wr32(fbd, FBNIC_SIG_PCS_INTR_STS,
FBNIC_SIG_PCS_INTR_LINK_DOWN | FBNIC_SIG_PCS_INTR_LINK_UP);
- link = fbnic_mac_get_pcs_link_status(fbd);
+ link = fbnic_mac_get_link_status(fbd, aui, fec);
+ link = fbnic_pmd_update_state(fbd, link);
/* Enable interrupt to only capture changes in link state */
wr32(fbd, FBNIC_SIG_PCS_INTR_MASK,
@@ -586,20 +625,15 @@ void fbnic_mac_get_fw_settings(struct fbnic_dev *fbd, u8 *aui, u8 *fec)
}
}
-static int fbnic_pcs_enable_asic(struct fbnic_dev *fbd)
+static void fbnic_mac_prepare(struct fbnic_dev *fbd, u8 aui, u8 fec)
{
/* Mask and clear the PCS interrupt, will be enabled by link handler */
wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, ~0);
wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0);
- return 0;
-}
-
-static void fbnic_pcs_disable_asic(struct fbnic_dev *fbd)
-{
- /* Mask and clear the PCS interrupt */
- wr32(fbd, FBNIC_SIG_PCS_INTR_MASK, ~0);
- wr32(fbd, FBNIC_SIG_PCS_INTR_STS, ~0);
+ /* If we don't have link tear it all down and start over */
+ if (!fbnic_mac_get_link_status(fbd, aui, fec))
+ fbd->pmd_state = FBNIC_PMD_INITIALIZE;
}
static void fbnic_mac_link_down_asic(struct fbnic_dev *fbd)
@@ -867,10 +901,9 @@ static int fbnic_mac_get_sensor_asic(struct fbnic_dev *fbd, int id,
static const struct fbnic_mac fbnic_mac_asic = {
.init_regs = fbnic_mac_init_regs,
- .pcs_enable = fbnic_pcs_enable_asic,
- .pcs_disable = fbnic_pcs_disable_asic,
.get_link = fbnic_mac_get_link,
.get_link_event = fbnic_mac_get_link_event,
+ .prepare = fbnic_mac_prepare,
.get_fec_stats = fbnic_mac_get_fec_stats,
.get_pcs_stats = fbnic_mac_get_pcs_stats,
.get_eth_mac_stats = fbnic_mac_get_eth_mac_stats,
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_mac.h b/drivers/net/ethernet/meta/fbnic/fbnic_mac.h
index 414c170abcba0..9b4fb0586dff1 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_mac.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_mac.h
@@ -10,6 +10,24 @@ struct fbnic_dev;
#define FBNIC_MAX_JUMBO_FRAME_SIZE 9742
+/* States loosely based on section 136.8.11.7.5 of IEEE 802.3-2022 Ethernet
+ * Standard. These are needed to track the state of the PHY as it has a delay
+ * of several seconds from the time link comes up until it has completed
+ * training that we need to wait to report the link.
+ *
+ * Currently we treat training as a single block as this is managed by the
+ * firmware.
+ *
+ * We have FBNIC_PMD_SEND_DATA set to 0 as the expected default at driver load
+ * and we initialize the structure containing it to zero at allocation.
+ */
+enum {
+ FBNIC_PMD_SEND_DATA = 0x0,
+ FBNIC_PMD_INITIALIZE = 0x1,
+ FBNIC_PMD_TRAINING = 0x2,
+ FBNIC_PMD_LINK_READY = 0x3,
+};
+
enum {
FBNIC_LINK_EVENT_NONE = 0,
FBNIC_LINK_EVENT_UP = 1,
@@ -55,15 +73,15 @@ enum fbnic_sensor_id {
* void (*init_regs)(struct fbnic_dev *fbd);
* Initialize MAC registers to enable Tx/Rx paths and FIFOs.
*
- * void (*pcs_enable)(struct fbnic_dev *fbd);
- * Configure and enable PCS to enable link if not already enabled
- * void (*pcs_disable)(struct fbnic_dev *fbd);
- * Shutdown the link if we are the only consumer of it.
- * bool (*get_link)(struct fbnic_dev *fbd);
- * Check PCS link status
* int (*get_link_event)(struct fbnic_dev *fbd)
* Get the current link event status, reports true if link has
* changed to either FBNIC_LINK_EVENT_DOWN or FBNIC_LINK_EVENT_UP
+ * bool (*get_link)(struct fbnic_dev *fbd, u8 aui, u8 fec);
+ * Check link status
+ *
+ * void (*prepare)(struct fbnic_dev *fbd, u8 aui, u8 fec);
+ * Prepare PHY for init by fetching settings, disabling interrupts,
+ * and sending an updated PHY config to FW if needed.
*
* void (*link_down)(struct fbnic_dev *fbd);
* Configure MAC for link down event
@@ -74,10 +92,10 @@ enum fbnic_sensor_id {
struct fbnic_mac {
void (*init_regs)(struct fbnic_dev *fbd);
- int (*pcs_enable)(struct fbnic_dev *fbd);
- void (*pcs_disable)(struct fbnic_dev *fbd);
- bool (*get_link)(struct fbnic_dev *fbd);
int (*get_link_event)(struct fbnic_dev *fbd);
+ bool (*get_link)(struct fbnic_dev *fbd, u8 aui, u8 fec);
+
+ void (*prepare)(struct fbnic_dev *fbd, u8 aui, u8 fec);
void (*get_fec_stats)(struct fbnic_dev *fbd, bool reset,
struct fbnic_fec_stats *fec_stats);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index 5c8077ee1fe3a..bd738155adb2d 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -86,10 +86,10 @@ static int fbnic_stop(struct net_device *netdev)
{
struct fbnic_net *fbn = netdev_priv(netdev);
+ fbnic_mac_free_irq(fbn->fbd);
phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd));
fbnic_down(fbn);
- fbnic_mac_free_irq(fbn->fbd);
fbnic_time_stop(fbn);
fbnic_fw_xmit_ownership_msg(fbn->fbd, false);
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
index a05fc55221abd..6da8a37c27382 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.h
@@ -111,7 +111,7 @@ int fbnic_phylink_ethtool_ksettings_get(struct net_device *netdev,
int fbnic_phylink_get_fecparam(struct net_device *netdev,
struct ethtool_fecparam *fecparam);
int fbnic_phylink_init(struct net_device *netdev);
-
+void fbnic_phylink_pmd_training_complete_notify(struct net_device *netdev);
bool fbnic_check_split_frames(struct bpf_prog *prog,
unsigned int mtu, u32 hds_threshold);
#endif /* _FBNIC_NETDEV_H_ */
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
index 0ae0f0cf24ad0..df384a4b64517 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
@@ -211,6 +211,10 @@ static void fbnic_service_task(struct work_struct *work)
{
struct fbnic_dev *fbd = container_of(to_delayed_work(work),
struct fbnic_dev, service_task);
+ struct net_device *netdev = fbd->netdev;
+
+ if (netif_running(netdev))
+ fbnic_phylink_pmd_training_complete_notify(netdev);
rtnl_lock();
@@ -228,7 +232,7 @@ static void fbnic_service_task(struct work_struct *work)
netdev_unlock(fbd->netdev);
}
- if (netif_running(fbd->netdev))
+ if (netif_running(netdev))
schedule_delayed_work(&fbd->service_task, HZ);
rtnl_unlock();
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c b/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
index 99fa79acd2df6..20f88c8dcc79a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_phylink.c
@@ -132,25 +132,9 @@ fbnic_phylink_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
state->duplex = DUPLEX_FULL;
- state->link = fbd->mac->get_link(fbd);
-}
-
-static int
-fbnic_phylink_pcs_enable(struct phylink_pcs *pcs)
-{
- struct fbnic_net *fbn = fbnic_pcs_to_net(pcs);
- struct fbnic_dev *fbd = fbn->fbd;
-
- return fbd->mac->pcs_enable(fbd);
-}
-
-static void
-fbnic_phylink_pcs_disable(struct phylink_pcs *pcs)
-{
- struct fbnic_net *fbn = fbnic_pcs_to_net(pcs);
- struct fbnic_dev *fbd = fbn->fbd;
-
- return fbd->mac->pcs_disable(fbd);
+ state->link = (fbd->pmd_state == FBNIC_PMD_SEND_DATA) &&
+ (rd32(fbd, FBNIC_PCS(MDIO_STAT1, 0)) &
+ MDIO_STAT1_LSTATUS);
}
static int
@@ -164,8 +148,6 @@ fbnic_phylink_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
static const struct phylink_pcs_ops fbnic_phylink_pcs_ops = {
.pcs_config = fbnic_phylink_pcs_config,
- .pcs_enable = fbnic_phylink_pcs_enable,
- .pcs_disable = fbnic_phylink_pcs_disable,
.pcs_get_state = fbnic_phylink_pcs_get_state,
};
@@ -179,12 +161,39 @@ fbnic_phylink_mac_select_pcs(struct phylink_config *config,
return &fbn->phylink_pcs;
}
+static int
+fbnic_phylink_mac_prepare(struct phylink_config *config, unsigned int mode,
+ phy_interface_t iface)
+{
+ struct net_device *netdev = to_net_dev(config->dev);
+ struct fbnic_net *fbn = netdev_priv(netdev);
+ struct fbnic_dev *fbd = fbn->fbd;
+
+ fbd->mac->prepare(fbd, fbn->aui, fbn->fec);
+
+ return 0;
+}
+
static void
fbnic_phylink_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state)
{
}
+static int
+fbnic_phylink_mac_finish(struct phylink_config *config, unsigned int mode,
+ phy_interface_t iface)
+{
+ struct net_device *netdev = to_net_dev(config->dev);
+ struct fbnic_net *fbn = netdev_priv(netdev);
+ struct fbnic_dev *fbd = fbn->fbd;
+
+ /* Retest the link state and restart interrupts */
+ fbd->mac->get_link(fbd, fbn->aui, fbn->fec);
+
+ return 0;
+}
+
static void
fbnic_phylink_mac_link_down(struct phylink_config *config, unsigned int mode,
phy_interface_t interface)
@@ -216,7 +225,9 @@ fbnic_phylink_mac_link_up(struct phylink_config *config,
static const struct phylink_mac_ops fbnic_phylink_mac_ops = {
.mac_select_pcs = fbnic_phylink_mac_select_pcs,
+ .mac_prepare = fbnic_phylink_mac_prepare,
.mac_config = fbnic_phylink_mac_config,
+ .mac_finish = fbnic_phylink_mac_finish,
.mac_link_down = fbnic_phylink_mac_link_down,
.mac_link_up = fbnic_phylink_mac_link_up,
};
@@ -257,3 +268,52 @@ int fbnic_phylink_init(struct net_device *netdev)
return 0;
}
+
+/**
+ * fbnic_phylink_pmd_training_complete_notify - PMD training complete notifier
+ * @netdev: Netdev struct phylink device attached to
+ *
+ * When the link first comes up the PMD will have a period of 2 to 3 seconds
+ * where the link will flutter due to link training. To avoid spamming the
+ * kernel log with messages about this we add a delay of 4 seconds from the
+ * time of the last PCS report of link so that we can guarantee we are unlikely
+ * to see any further link loss events due to link training.
+ **/
+void fbnic_phylink_pmd_training_complete_notify(struct net_device *netdev)
+{
+ struct fbnic_net *fbn = netdev_priv(netdev);
+ struct fbnic_dev *fbd = fbn->fbd;
+
+ if (fbd->pmd_state != FBNIC_PMD_TRAINING)
+ return;
+
+ /* Prevent reading end_of_pmd_training until we verified state */
+ smp_rmb();
+
+ if (!time_before(READ_ONCE(fbd->end_of_pmd_training), jiffies))
+ return;
+
+ /* At this point we have verified that the link has been up for
+ * the full training duration. As a first step we will try
+ * transitioning to link ready.
+ */
+ if (cmpxchg(&fbd->pmd_state, FBNIC_PMD_TRAINING,
+ FBNIC_PMD_LINK_READY) != FBNIC_PMD_TRAINING)
+ return;
+
+ /* Perform a follow-up check to verify that the link didn't flap
+ * just before our transition by rechecking the training timer.
+ */
+ if (!time_before(READ_ONCE(fbd->end_of_pmd_training), jiffies))
+ return;
+
+ /* The training timeout has been completed. We are good to swap out
+ * link_ready for send_data assuming no other events have occurred
+ * that would have pulled us back into initialization or training.
+ */
+ if (cmpxchg(&fbd->pmd_state, FBNIC_PMD_LINK_READY,
+ FBNIC_PMD_SEND_DATA) != FBNIC_PMD_LINK_READY)
+ return;
+
+ phylink_pcs_change(&fbn->phylink_pcs, false);
+}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 425/990] fbnic: Fix service task races with ndo_stop and PM suspend
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (423 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 424/990] fbnic: Add logic to track PMD state via MAC/PCS signals Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 426/990] fbnic: Disable PTP completions during the Tx force-flush Greg Kroah-Hartman
` (427 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 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 05ec5504ff69dac8867292c0e778fe79c3dde83c ]
The service task can run after the datapath has been torn down
underneath it. ndo_stop stops the task with the cancel_delayed_work
function, which does not wait for a pass already executing. It cannot
use the cancel_delayed_work_sync function, as ndo_stop holds RTNL and
the task takes RTNL itself, so a pass blocked on RTNL while ndo_stop
runs carries on once ndo_stop returns.
By then the fbnic_down function has demoted the host MACDA and action
entries to UPDATE and disabled the host queues, and ndo_stop has handed
ownership back to firmware, which clears fw_heartbeat_enabled. The late
pass's health check reports a firmware crash that did not happen, and
the fbnic_fw_config_after_crash function reclaims ownership and writes
the host rules back to hardware. If the BMC raised
FBNIC_FW_CAP_F_BMC_TCAM_REINIT in that window, the fbnic_bmc_rpc_check
function does the same through the __fbnic_set_rx_mode function. Either
way host traffic is steered at queues that are no longer running until
the next open and close.
The fbnic_pm_suspend function, which also serves shutdown and PCIe
error recovery, has the same problem and a worse one. It calls ndo_stop
directly with the device detached but __LINK_STATE_START still set, so
a late pass there sees the interface running, restores the host state,
and keeps re-arming itself every second after the mailbox, IRQs and
MMIO are gone.
Only run the health and BMC checks, and only re-arm, while the
interface is running and the device is present. The __dev_close_many
function clears __LINK_STATE_START under RTNL before it calls ndo_stop,
and the suspend path detaches the device under RTNL, so a late pass now
leaves the host state alone and stops. The BMC flags stay raised, and
the __fbnic_open function reclaims ownership, restarts the heartbeat
and rebuilds the BMC rules on the next open. The fbnic_pm_suspend
function also cancels the task synchronously once it has dropped RTNL,
so a pass already running cannot overlap the mailbox and IRQ teardown.
On resume the __fbnic_pm_attach function called the fbnic_up function,
which schedules the next pass, before attaching the device, all without
RTNL. A pass that ran in between would now see the device detached and
stop for good. Check for an init failure first, then hold RTNL and the
instance lock across the stats reset, the fbnic_up call and the attach,
as the suspend path does, so the pass blocks until the device is
present. This also gives the fbnic_up function the instance lock it
expects for the napi_enable_locked calls and the rx mode rewrite.
A device that detaches itself on a failed register read likewise stops
re-arming the task until recovery attaches it.
The issue was found by code review. The change was tested on fbnic
hardware with firmware 26.09.14-017_h7ab84d2ef68f by cycling the
interface through DPC/AER recoveries for a day.
Fixes: 04a230b27d8f ("fbnic: Add logic to repopulate RPC TCAM if BMC enables channel")
Fixes: 6ae7da8e9e06 ("eth: fbnic: reprogram TCAMs after FW crash")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/179381515284.9644.1846335740085170889.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_pci.c | 38 ++++++++++++++++-----
1 file changed, 29 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
index df384a4b64517..caa7cc1ddb6bd 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_pci.c
@@ -222,18 +222,25 @@ static void fbnic_service_task(struct work_struct *work)
fbnic_fw_check_heartbeat(fbd);
- fbnic_health_check(fbd);
-
- fbnic_bmc_rpc_check(fbd);
-
if (netif_carrier_ok(fbd->netdev)) {
netdev_lock(fbd->netdev);
fbnic_napi_depletion_check(fbd->netdev);
netdev_unlock(fbd->netdev);
}
- if (netif_running(netdev))
+ /* fbnic_service_task_stop() does not wait for a pass that is already
+ * blocked on RTNL, so one can run after ndo_stop. Leave host state
+ * alone in that case, and do not re-arm; __fbnic_open() reclaims and
+ * rebuilds it. The PM path calls ndo_stop with the device detached but
+ * still running; fbnic_up() starts the task again on resume.
+ */
+ if (netif_running(netdev) && netif_device_present(netdev)) {
+ fbnic_health_check(fbd);
+
+ fbnic_bmc_rpc_check(fbd);
+
schedule_delayed_work(&fbd->service_task, HZ);
+ }
rtnl_unlock();
}
@@ -443,6 +450,12 @@ static int fbnic_pm_suspend(struct device *dev)
netdev_unlock(netdev);
rtnl_unlock();
+ /* ndo_stop could not wait for a pass already blocked on RTNL. That
+ * pass no longer re-arms, but wait for it to finish before the
+ * mailbox, IRQs and MMIO go away.
+ */
+ cancel_delayed_work_sync(&fbd->service_task);
+
null_uc_addr:
fbnic_fw_log_disable(fbd);
@@ -543,19 +556,26 @@ static void __fbnic_pm_attach(struct device *dev)
struct net_device *netdev = fbd->netdev;
struct fbnic_net *fbn;
- rtnl_lock();
- fbnic_reset_hw_stats(fbd);
- rtnl_unlock();
-
if (fbnic_init_failure(fbd))
return;
fbn = netdev_priv(netdev);
+ /* Hold RTNL until the device is attached, so the service task pass
+ * fbnic_up() schedules cannot run until it will see it present.
+ */
+ rtnl_lock();
+ netdev_lock(netdev);
+
+ fbnic_reset_hw_stats(fbd);
+
if (netif_running(netdev))
fbnic_up(fbn);
netif_device_attach(netdev);
+
+ netdev_unlock(netdev);
+ rtnl_unlock();
}
static int __maybe_unused fbnic_pm_resume(struct device *dev)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 426/990] fbnic: Disable PTP completions during the Tx force-flush
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (424 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 425/990] fbnic: Fix service task races with ndo_stop and PM suspend Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 427/990] fbnic: Suspend phylink after taking the datapath down in ndo_stop Greg Kroah-Hartman
` (426 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 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 7d4568edce74ac72794cdd42767cc116bf1ca9b4 ]
When the Tx queues fail to go idle, fbnic_wait_all_queues_idle() falls
back to fbnic_tx_flush(), which sets FBNIC_TMI_DROP_CTRL_EN. That bit
only drops packets at the Tx MAC Interface start of packet protection FIFO.
The PTP completion path is governed by a separate bit in the same
register. With only the drop enable set, a timestamped frame has its
packet discarded while the matching completion is still forwarded to
the host. fbnic_clean_tsq() then walks the ring with no packet left to
match it against and reports "Tx timestamp without matching packet".
The drop does not retire the completion either, as the completion FIFO
is only drained when the completion disable is set.
Set FBNIC_TMI_DROP_CTRL_CMPL_DIS together with the drop enable so the
completions are drained rather than leaked to the host, and clear both
bits again when the flush is turned off.
Fixes: ad3d9f8bc66c ("eth: fbnic: add TX packets timestamping support")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/179381515954.9644.10831265959574467679.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 | 1 +
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index cf659be3004b2..9ef4dd9609edf 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -456,6 +456,7 @@ enum {
#define FBNIC_TMI_SOP_PROT_CTRL 0x04400 /* 0x11000 */
#define FBNIC_TMI_DROP_CTRL 0x04401 /* 0x11004 */
#define FBNIC_TMI_DROP_CTRL_EN CSR_BIT(0)
+#define FBNIC_TMI_DROP_CTRL_CMPL_DIS CSR_BIT(1)
#define FBNIC_TMI_DROP_PKTS 0x04402 /* 0x11008 */
#define FBNIC_TMI_DROP_BYTE_L 0x04403 /* 0x1100c */
#define FBNIC_TMI_ILLEGAL_PTP_REQS 0x04409 /* 0x11024 */
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index d7ca0216155bf..0a278f2a2ee7a 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -2290,15 +2290,19 @@ void fbnic_disable(struct fbnic_net *fbn)
static void fbnic_tx_flush(struct fbnic_dev *fbd)
{
+ u32 drop_ctrl = FBNIC_TMI_DROP_CTRL_EN | FBNIC_TMI_DROP_CTRL_CMPL_DIS;
+
netdev_warn(fbd->netdev, "triggering Tx flush\n");
- fbnic_rmw32(fbd, FBNIC_TMI_DROP_CTRL, FBNIC_TMI_DROP_CTRL_EN,
- FBNIC_TMI_DROP_CTRL_EN);
+ /* Drop packets and retire their PTP completions */
+ fbnic_rmw32(fbd, FBNIC_TMI_DROP_CTRL, drop_ctrl, drop_ctrl);
}
static void fbnic_tx_flush_off(struct fbnic_dev *fbd)
{
- fbnic_rmw32(fbd, FBNIC_TMI_DROP_CTRL, FBNIC_TMI_DROP_CTRL_EN, 0);
+ u32 drop_ctrl = FBNIC_TMI_DROP_CTRL_EN | FBNIC_TMI_DROP_CTRL_CMPL_DIS;
+
+ fbnic_rmw32(fbd, FBNIC_TMI_DROP_CTRL, drop_ctrl, 0);
}
struct fbnic_idle_regs {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 427/990] fbnic: Suspend phylink after taking the datapath down in ndo_stop
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (425 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 426/990] fbnic: Disable PTP completions during the Tx force-flush Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 428/990] fbnic: Wait for the outbound flush to complete on mailbox teardown Greg Kroah-Hartman
` (425 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 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 b45b9c6b83e7a5ac440d36b46ed9b466788b3e5c ]
The fbnic_stop function calls the phylink_suspend function before the
fbnic_down function. With no BMC present that stops phylink, and the
fbnic_phylink_mac_link_down function disables the MAC and holds its Tx
and Rx clocks and FIFOs in reset. Only then does the fbnic_down function
stop the queues and wait for the Tx path to go idle, so anything still in
flight has to drain into a MAC that is no longer passing traffic, and the
fbnic_wait_all_queues_idle function can be left to time out and force a
flush. With a BMC present phylink leaves the link up but turns the carrier
off, which the phylink_suspend function notes assumes all packets have
already been sent.
It is also the reverse of how the interface comes up: the __fbnic_open
function resumes phylink last, and the fbnic_up function then enables the
queues and installs the host Rx filters.
Call the fbnic_down function first. The Tx path then drains with the link
still up, and Rx is still stopped first, as the fbnic_clear_rx_mode and
fbnic_clear_rules functions remove the host as a destination for its MAC
addresses in the RPC before the queues are disabled. The MAC IRQ is still
freed before phylink is suspended, so no link interrupt runs while the
link is taken down. The PM suspend path goes through ndo_stop and picks
up the same order.
Fixes: 6ede14a2c636 ("fbnic: Move phylink resume out of service_task and into open/close")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Fixes: 69684376eed5 ("eth: fbnic: Add link detection")
Link: https://patch.msgid.link/179381516644.9644.9042901965231900737.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_netdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index bd738155adb2d..8e97c4e7f32b4 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -86,11 +86,11 @@ static int fbnic_stop(struct net_device *netdev)
{
struct fbnic_net *fbn = netdev_priv(netdev);
+ fbnic_down(fbn);
+
fbnic_mac_free_irq(fbn->fbd);
phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd));
- fbnic_down(fbn);
-
fbnic_time_stop(fbn);
fbnic_fw_xmit_ownership_msg(fbn->fbd, false);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 428/990] fbnic: Wait for the outbound flush to complete on mailbox teardown
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (426 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 427/990] fbnic: Suspend phylink after taking the datapath down in ndo_stop Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 429/990] net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist Greg Kroah-Hartman
` (424 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 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 c5820a8cf59b03d59f2f5f9b3754ad27a6014a41 ]
The fbnic_mbx_reset_desc_ring function drops bus mastering and arms the
outbound flush for its ring: the write flush for the Rx ring and the
read flush for the Tx ring. Nothing waits for that flush to finish.
The fbnic_mbx_clean_desc_ring function goes straight on to unmap and
free the ring's buffers, so a device read of a Tx buffer, or a write to
an Rx buffer, can still be outstanding after the buffer is gone. With
an IOMMU it can also target an IOVA that has been unmapped or reused.
The PUL link reset status register reports when each direction's flush
has drained. Poll the done bit for the ring's direction after arming
the flush and before freeing its buffers. The flush only has to retire
what the outbound path already holds; the 1ms cap keeps a wedged device
from spinning.
Every caller of the fbnic_mbx_clean function runs with the datapath
already down, which matters because the read flush covers all
outstanding reads, not just the mailbox ones. A device that has lost
its link reads back as all ones, so the done bit appears set and the
poll ends on the first pass.
Fixes: 3b12f00ddd08 ("fbnic: Gate AXI read/write enabling on FW mailbox")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Link: https://patch.msgid.link/179381517319.9644.1165591016149104577.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 | 4 ++++
drivers/net/ethernet/meta/fbnic/fbnic_fw.c | 16 ++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
index 9ef4dd9609edf..e93f9ff6f4d14 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_csr.h
@@ -960,6 +960,10 @@ enum {
/* PUL User Registers */
#define FBNIC_CSR_START_PUL_USER 0x31000 /* CSR section delimiter */
+#define FBNIC_PUL_USER_IP_LINK_RST_STATUS \
+ 0x31030 /* 0xc40c0 */
+#define FBNIC_PUL_USER_IP_LINK_RST_STATUS_AW_FLUSH_DONE CSR_BIT(7)
+#define FBNIC_PUL_USER_IP_LINK_RST_STATUS_AR_FLUSH_DONE CSR_BIT(8)
#define FBNIC_PUL_OB_TLP_HDR_AW_CFG 0x3103d /* 0xc40f4 */
#define FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH_MODE CSR_BIT(20)
#define FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH CSR_BIT(19)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
index 36607840de1ee..e642bedd2ffa0 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_fw.c
@@ -7,6 +7,7 @@
#include <linux/dev_printk.h>
#include <linux/dma-mapping.h>
#include <linux/gfp.h>
+#include <linux/iopoll.h>
#include <linux/types.h>
#include "fbnic.h"
@@ -176,10 +177,25 @@ static void fbnic_mbx_unmap_and_free_msg(struct fbnic_dev *fbd, int mbx_idx,
static void fbnic_mbx_clean_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
{
+ u32 flush_done, val;
int i;
fbnic_mbx_reset_desc_ring(fbd, mbx_idx);
+ /* Arming the flush only starts it. Wait for the outbound path to
+ * retire the requests it still holds before the buffers they may
+ * target are unmapped and freed. A lost link reads back as all ones,
+ * which ends the poll on the first pass.
+ */
+ flush_done = mbx_idx == FBNIC_IPC_MBX_RX_IDX ?
+ FBNIC_PUL_USER_IP_LINK_RST_STATUS_AW_FLUSH_DONE :
+ FBNIC_PUL_USER_IP_LINK_RST_STATUS_AR_FLUSH_DONE;
+ if (read_poll_timeout_atomic(fbnic_rd32, val, val & flush_done, 2,
+ 1000, false, fbd,
+ FBNIC_PUL_USER_IP_LINK_RST_STATUS))
+ dev_warn(fbd->dev, "Outbound flush did not complete: %08x\n",
+ val);
+
for (i = FBNIC_IPC_MBX_DESC_LEN; i--;)
fbnic_mbx_unmap_and_free_msg(fbd, mbx_idx, i);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 429/990] net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (427 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 428/990] fbnic: Wait for the outbound flush to complete on mailbox teardown Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 430/990] net/mlx5: macsec: Dont remove fs_id when adding a rule fails Greg Kroah-Hartman
` (423 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexander Duyck, Willem de Bruijn,
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 fdca4b030c78fa2773a94fda3a6dc3ce5558a727 ]
The netif_needs_gso function lets a GSO skb reach the device unsegmented
when it is CHECKSUM_PARTIAL or CHECKSUM_UNNECESSARY. The second case was
added for FCoE, whose transmit path marked CRC offload that way at the
time. Commit 253aab0597d9 ("fcoe: Use CHECKSUM_PARTIAL to indicate CRC
offload") moved FCoE back to CHECKSUM_PARTIAL but left the exemption in
place, with nothing left that needed it. Fraglist GSO, added later, is
its only user today, as its segments already carry valid checksums.
A TCP GSO skb can still arrive as CHECKSUM_UNNECESSARY without being
fraglist. Hardware LRO builds its aggregates that way, for example mlx5
sets SKB_GSO_TCPV4 or SKB_GSO_TCPV6 and CHECKSUM_UNNECESSARY, without
SKB_GSO_DODGY. IP forwarding and bridging turn LRO off, but a tc mirred
redirect does not, so such an skb can be sent out another device. It
has no csum_start and its TCP checksum field is whatever the aggregate
left there. Drivers that only set up TSO for CHECKSUM_PARTIAL, such as
fbnic, i40e and ice, then send the whole skb as one oversized frame
with a bad checksum.
Have the validate_xmit_skb function mark any CHECKSUM_UNNECESSARY GSO
skb other than fraglist as CHECKSUM_NONE, which means the same on
transmit but is not exempt in the netif_needs_gso function. The
__skb_gso_segment function then unshares the header and the TCP GSO
code sets the skb up as CHECKSUM_PARTIAL, so a device with TSO segments
it in hardware. Without TSO, and for UDP, it is segmented in software.
The callers of the netif_needs_gso function that decide on segmentation
for themselves, such as tap, are left as they are.
Found by code inspection. In QEMU with an emulated fbnic, TCPv4 and
TCPv6 GSO skbs built this way each went out as a single 11 KB frame
with a bad TCP checksum. With this change they are segmented into
MSS-sized frames with valid checksums.
Fixes: 253aab0597d9 ("fcoe: Use CHECKSUM_PARTIAL to indicate CRC offload")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/179372577673.49909.11253315483074546903.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/dev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index e4216b78a1a49..91da33c29aa18 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4045,6 +4045,18 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
if (unlikely(!skb))
goto out_null;
+ /* Only fraglist GSO, whose segments already carry valid checksums,
+ * can be handed to a device as CHECKSUM_UNNECESSARY. Any other GSO
+ * skb has no csum_start for the device to segment from. NONE means
+ * the same on transmit, but makes netif_needs_gso() send it to the
+ * GSO code, which turns TCP into CHECKSUM_PARTIAL for TSO and
+ * segments anything the device cannot offload in software.
+ */
+ if (unlikely(skb->ip_summed == CHECKSUM_UNNECESSARY &&
+ skb_is_gso(skb) &&
+ !(skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST)))
+ skb->ip_summed = CHECKSUM_NONE;
+
features = netif_skb_features(skb);
skb = validate_xmit_vlan(skb, features);
if (unlikely(!skb))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 430/990] net/mlx5: macsec: Dont remove fs_id when adding a rule fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (428 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 429/990] net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 431/990] dpll: notify about a reference sync pair only if it was added Greg Kroah-Hartman
` (422 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Changyul Lee, Tariq Toukan,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changyul Lee <lcy8047@gmail.com>
[ Upstream commit 5175da73dd128520ad6d704d7fe54926ee5f658b ]
macsec_fs_tx_add_rule() and macsec_fs_rx_add_rule() clean up a failed
rule with macsec_fs_{tx,rx}_del_rule(), which also calls
macsec_fs_id_del(). The fs_id is never in the xarray at that point:
macsec_fs_id_add() is the last step of adding a rule and removes its
own entry when it fails.
macsec_fs_id_del() then dereferences NULL, through macsec_device for
the first SA of a MACsec netdev and through fs_id_found otherwise. On
RX, the SAs of one SC share an fs_id, so a failure while adding another
SA drops the reference that an existing SA holds.
Split the rule teardown from the fs_id removal and do only the teardown
on the error paths.
Fixes: d4ece08f4b1d ("net/mlx5: Maintain fs_id xarray per MACsec device inside macsec steering")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261105003419.4016283-1-lcy8047@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mellanox/mlx5/core/lib/macsec_fs.c | 38 ++++++++++++-------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
index f6d09e4509e55..77e4b406e242d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
@@ -764,13 +764,9 @@ static int macsec_fs_id_add(struct list_head *macsec_devices_list, u32 fs_id,
return err;
}
-static void macsec_fs_tx_del_rule(struct mlx5_macsec_fs *macsec_fs,
- struct mlx5_macsec_tx_rule *tx_rule,
- void *macdev)
+static void macsec_fs_tx_free_rule(struct mlx5_macsec_fs *macsec_fs,
+ struct mlx5_macsec_tx_rule *tx_rule)
{
- macsec_fs_id_del(&macsec_fs->macsec_devices_list, tx_rule->fs_id, macdev,
- &macsec_fs->sci_hash, true);
-
if (tx_rule->rule) {
mlx5_del_flow_rules(tx_rule->rule);
tx_rule->rule = NULL;
@@ -791,6 +787,15 @@ static void macsec_fs_tx_del_rule(struct mlx5_macsec_fs *macsec_fs,
macsec_fs_tx_ft_put(macsec_fs);
}
+static void macsec_fs_tx_del_rule(struct mlx5_macsec_fs *macsec_fs,
+ struct mlx5_macsec_tx_rule *tx_rule,
+ void *macdev)
+{
+ macsec_fs_id_del(&macsec_fs->macsec_devices_list, tx_rule->fs_id, macdev,
+ &macsec_fs->sci_hash, true);
+ macsec_fs_tx_free_rule(macsec_fs, tx_rule);
+}
+
#define MLX5_REFORMAT_PARAM_ADD_MACSEC_OFFSET_4_BYTES 1
static union mlx5_macsec_rule *
@@ -883,7 +888,7 @@ macsec_fs_tx_add_rule(struct mlx5_macsec_fs *macsec_fs,
goto out_spec;
err:
- macsec_fs_tx_del_rule(macsec_fs, tx_rule, macsec_ctx->secy->netdev);
+ macsec_fs_tx_free_rule(macsec_fs, tx_rule);
macsec_rule = NULL;
out_spec:
kvfree(spec);
@@ -1648,15 +1653,11 @@ static void macsec_fs_rx_ft_put(struct mlx5_macsec_fs *macsec_fs)
macsec_fs_rx_destroy(macsec_fs);
}
-static void macsec_fs_rx_del_rule(struct mlx5_macsec_fs *macsec_fs,
- struct mlx5_macsec_rx_rule *rx_rule,
- void *macdev, u32 fs_id)
+static void macsec_fs_rx_free_rule(struct mlx5_macsec_fs *macsec_fs,
+ struct mlx5_macsec_rx_rule *rx_rule)
{
int i;
- macsec_fs_id_del(&macsec_fs->macsec_devices_list, fs_id, macdev,
- &macsec_fs->fs_id_hash, false);
-
for (i = 0; i < RX_NUM_OF_RULES_PER_SA; ++i) {
if (rx_rule->rule[i]) {
mlx5_del_flow_rules(rx_rule->rule[i]);
@@ -1674,6 +1675,15 @@ static void macsec_fs_rx_del_rule(struct mlx5_macsec_fs *macsec_fs,
macsec_fs_rx_ft_put(macsec_fs);
}
+static void macsec_fs_rx_del_rule(struct mlx5_macsec_fs *macsec_fs,
+ struct mlx5_macsec_rx_rule *rx_rule,
+ void *macdev, u32 fs_id)
+{
+ macsec_fs_id_del(&macsec_fs->macsec_devices_list, fs_id, macdev,
+ &macsec_fs->fs_id_hash, false);
+ macsec_fs_rx_free_rule(macsec_fs, rx_rule);
+}
+
static void macsec_fs_rx_setup_fte(struct mlx5_flow_spec *spec,
struct mlx5_flow_act *flow_act,
struct mlx5_macsec_rule_attrs *attrs,
@@ -1833,7 +1843,7 @@ macsec_fs_rx_add_rule(struct mlx5_macsec_fs *macsec_fs,
return macsec_rule;
err:
- macsec_fs_rx_del_rule(macsec_fs, rx_rule, macsec_ctx->secy->netdev, fs_id);
+ macsec_fs_rx_free_rule(macsec_fs, rx_rule);
macsec_rule = NULL;
out_spec:
kvfree(spec);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 431/990] dpll: notify about a reference sync pair only if it was added
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (429 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 430/990] net/mlx5: macsec: Dont remove fs_id when adding a rule fails Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 432/990] ipv4: route: dont blackhole in-use routes when retiring fnhe routes Greg Kroah-Hartman
` (421 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ivan Vecera, Vadim Fedorenko,
Petr Oros, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <ivecera@redhat.com>
[ Upstream commit 7a3837929d049dac1f931620f30b100993ce2594 ]
dpll_pin_ref_sync_pair_add() sends a pin change notification even when
xa_insert() fails and nothing has changed. zl3073x gets -EBUSY when
another channel has already added the same pair and ignores it, so user
space is notified about a change that did not happen.
Send the notification only after a successful insert.
Found by code review. Reproduced on a ZL30732A board with kprobes on
dpll_pin_ref_sync_pair_add() and __dpll_pin_change_ntf(): loading the
driver adds one pair twice and the add failing with -EBUSY sends a
notification. With this patch it does not, and the successful add still
does. A test module adding one pair twice shows the same on the monitor
group.
Fixes: 58256a26bfb3 ("dpll: add reference sync get/set")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Petr Oros <poros@redhat.com>
Link: https://patch.msgid.link/20261105131145.1010406-2-ivecera@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dpll/dpll_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 0a8db4dc25786..aaa576562ae42 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -999,7 +999,8 @@ int dpll_pin_ref_sync_pair_add(struct dpll_pin *pin,
mutex_lock(&dpll_lock);
ret = xa_insert(&pin->ref_sync_pins, ref_sync_pin->id,
ref_sync_pin, GFP_KERNEL);
- __dpll_pin_change_ntf(pin);
+ if (!ret)
+ __dpll_pin_change_ntf(pin);
mutex_unlock(&dpll_lock);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 432/990] ipv4: route: dont blackhole in-use routes when retiring fnhe routes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (430 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 431/990] dpll: notify about a reference sync pair only if it was added Greg Kroah-Hartman
@ 2026-11-25 14:29 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 433/990] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails Greg Kroah-Hartman
` (420 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:29 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Chase Hiltz,
Ido Schimmel, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chase Hiltz <me@chasehil.tz>
[ Upstream commit ae89f2724db1afa96a1f1b661174fc41ae1e88fa ]
When a route cached in a nexthop exception (fnhe) is replaced or
flushed, rt_bind_exception() and fnhe_flush_routes() call
dst_dev_put() on it. That sets dst->dev to blackhole_netdev and
dst->input/output to dst_discard*(), but other CPUs can still be
using the route, e.g. as a noref dst taken from the fnhe under RCU.
Packets that reach dst_input() or dst_output() after that are dropped.
If dst_dev_put() runs after a forwarded packet has entered ip_output(),
ip_skb_dst_mtu() in __ip_finish_output() can return the MTU of
blackhole_netdev (68), and ip_fragment() can then drop a DF packet and
send ICMP_FRAG_NEEDED with mtu 68 to its source.
Commit 5018c59607a5 ("ipv4: fix race condition between route lookup and
invalidation") fixed the same race in rt_cache_route() by putting the
old route on the uncached list instead of calling dst_dev_put(). Do the
same for routes retired from an fnhe. rt_flush_dev() still moves them
to blackhole_netdev when their device is unregistered.
fnhe routes are also retired on fnhe expiry (ip_del_fnhe()) and
eviction (fnhe_remove_oldest()). Those paths don't bump rt_genid, so
without the obsolete marking ipv4_dst_check() could still accept the
route. Keep marking retired routes DST_OBSOLETE_DEAD, as dst_dev_put()
did, so that users that cached them, such as sockets, look up again.
In a netns reproducer that forwards IPv4 traffic over an ip6tnl device,
with an fnhe for the destination, while the FIB keeps changing, this
patch stops the mtu 68 ICMPs and the drops.
Fixes: 95c47f9cf5e0 ("ipv4: call dst_dev_put() properly")
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Chase Hiltz <me@chasehil.tz>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261105182640.2999521-1-me@chasehil.tz
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/route.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 489d3b2cb612b..ef1a3395be44b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -573,6 +573,17 @@ static void ip_rt_build_flow_key(struct flowi4 *fl4, const struct sock *sk,
static DEFINE_SPINLOCK(fnhe_lock);
+/* Other CPUs may still be using @rt, so don't dst_dev_put() it.
+ * rt_flush_dev() handles it if its device is unregistered.
+ * Marking it dead makes ipv4_dst_check() fail for users that cached it.
+ */
+static void fnhe_retire_route(struct rtable *rt)
+{
+ WRITE_ONCE(rt->dst.obsolete, DST_OBSOLETE_DEAD);
+ rt_add_uncached_list(rt);
+ dst_release(&rt->dst);
+}
+
static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
{
struct rtable *rt;
@@ -580,14 +591,12 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
rt = rcu_dereference(fnhe->fnhe_rth_input);
if (rt) {
RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
- dst_dev_put(&rt->dst);
- dst_release(&rt->dst);
+ fnhe_retire_route(rt);
}
rt = rcu_dereference(fnhe->fnhe_rth_output);
if (rt) {
RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
- dst_dev_put(&rt->dst);
- dst_release(&rt->dst);
+ fnhe_retire_route(rt);
}
}
@@ -1502,10 +1511,8 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
if (do_cache) {
dst_hold(&rt->dst);
rcu_assign_pointer(*porig, rt);
- if (orig) {
- dst_dev_put(&orig->dst);
- dst_release(&orig->dst);
- }
+ if (orig)
+ fnhe_retire_route(orig);
ret = true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 433/990] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (431 preceding siblings ...)
2026-11-25 14:29 ` [PATCH 6.18 432/990] ipv4: route: dont blackhole in-use routes when retiring fnhe routes Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 434/990] net: skbuff: uncharge trimmed zerocopy frags on error Greg Kroah-Hartman
` (419 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yuho Choi, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <oss.patchbox@gmail.com>
[ Upstream commit 6a01fb125ba6474cb97f14b68fe5435d3cdd08e5 ]
In a confidential guest, kvm_arch_ptp_init() shares the clock_pair page
with the host using set_memory_decrypted(), and kvm_arch_ptp_exit()
makes it private again with set_memory_encrypted() before freeing it.
The untrusted host can make either call fail and leave the page shared.
Both paths still free the page: the init error path with __free_page(),
and kvm_arch_ptp_exit() after only a WARN_ON(). The page allocator can
then hand a page the host can still access to an unrelated user.
Leak the page in both cases instead, as was done for the same situation
in commit b9fa16949d18 ("dma-direct: Leak pages on dma_set_decrypted()
failure") and commit 03f5a999adba ("Drivers: hv: vmbus: Leak pages if
set_memory_encrypted() fails").
Fixes: 6365ba64b4dbe ("ptp: kvm: Use decrypted memory in confidential guest on x86")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
Link: https://patch.msgid.link/20261105164324.23501-2-oss.patchbox@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_kvm_x86.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c
index 6cea4fe39bcfe..811758bd8b0de 100644
--- a/drivers/ptp/ptp_kvm_x86.c
+++ b/drivers/ptp/ptp_kvm_x86.c
@@ -36,7 +36,7 @@ int kvm_arch_ptp_init(void)
clock_pair = page_address(p);
ret = set_memory_decrypted((unsigned long)clock_pair, 1);
if (ret) {
- __free_page(p);
+ /* The page may be left shared, so leak it. */
clock_pair = NULL;
goto nofree;
}
@@ -68,8 +68,9 @@ int kvm_arch_ptp_init(void)
void kvm_arch_ptp_exit(void)
{
if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
- WARN_ON(set_memory_encrypted((unsigned long)clock_pair, 1));
- free_page((unsigned long)clock_pair);
+ /* Leak the page if it cannot be made private again. */
+ if (!WARN_ON(set_memory_encrypted((unsigned long)clock_pair, 1)))
+ free_page((unsigned long)clock_pair);
clock_pair = NULL;
}
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 434/990] net: skbuff: uncharge trimmed zerocopy frags on error
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (432 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 433/990] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 435/990] net/mlx5e: Release IPsec root table reference on RX setup failure Greg Kroah-Hartman
` (418 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Chris Mason,
Willem de Bruijn, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 8b67debdfbf6b370312ebec5c9e0a1c39b5c7733 ]
__zerocopy_sg_from_iter() accounts for the frags that it adds even when
it returns an error: it adds the growth of skb->truesize to
sk_wmem_queued and, unless the skb is pure zerocopy, charges it to the
socket.
On error, skb_zerocopy_iter_stream() cannot free the skb, as it may hold
data from an earlier send. It trims the new frags, but leaves
skb->truesize and their accounting in place.
Repeated failed sends to the same skb accumulate this stale accounting.
This can inflate TCP memory accounting past tcp_mem, and can wrap
skb->truesize, leading to a use-after-free of the socket.
Undo the accounting after the trim. If the trim fails, the frags and
their accounting remain. The trim only fails if the skb is cloned,
which is not expected for the unsent skb at the TCP write queue tail.
The issue was found by an LLM.
Fixes: 52267790ef52 ("sock: add MSG_ZEROCOPY")
Reported-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Chris Mason <mason@kernel.org>
[willemb: revised commit message]
Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261105223512.3647504-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/skbuff.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4ee359dfe93bc..07df2030ccf2a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1859,6 +1859,7 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
struct ubuf_info *uarg,
struct net_devmem_dmabuf_binding *binding)
{
+ unsigned int orig_truesize = skb->truesize;
int err, orig_len = skb->len;
if (uarg->ops->link_skb) {
@@ -1879,12 +1880,18 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
err = __zerocopy_sg_from_iter(msg, sk, skb, &msg->msg_iter, len,
binding);
if (err == -EFAULT || (err == -EMSGSIZE && skb->len == orig_len)) {
+ u32 delta_truesize = skb->truesize - orig_truesize;
struct sock *save_sk = skb->sk;
/* Streams do not free skb on error. Reset to prev state. */
iov_iter_revert(&msg->msg_iter, skb->len - orig_len);
skb->sk = sk;
- ___pskb_trim(skb, orig_len);
+ if (!___pskb_trim(skb, orig_len)) {
+ skb->truesize -= delta_truesize;
+ sk_wmem_queued_add(sk, -delta_truesize);
+ if (!skb_zcopy_pure(skb))
+ sk_mem_uncharge(sk, delta_truesize);
+ }
skb->sk = save_sk;
return err;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 435/990] net/mlx5e: Release IPsec root table reference on RX setup failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (433 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 434/990] net: skbuff: uncharge trimmed zerocopy frags on error Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 436/990] net/mlx5e: Fix ipsec core device access during profile changes Greg Kroah-Hartman
` (417 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cosmin Ratiu, Jianbo Liu,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <cratiu@nvidia.com>
[ Upstream commit e8303b58108519ff103241442c0a7602fa106af5 ]
Switchdev RX setup takes a root-chain table reference before creating
its flow tables. If creation fails, rx_get() returns without
incrementing the RX reference count, so rx_destroy() never releases the
chain reference.
Extract the cleanup logic in a counter-partner to the function acquiring
the root table ref, and call it on error to properly release everything.
Also call it from the normal destroy path to reduce code duplication.
mlx5_esw_ipsec_rx_status_pass_dest_get() ignored chain table acquisition
errors, returning success with an error pointer as the destination. The
new unwind could then release a reference that was never taken.
Propagate the error so cleanup only runs after a successful get.
Discovered by Sashiko. Not triggered as it's an unlikely error path.
Fixes: 1762f132d542 ("net/mlx5e: Support IPsec packet offload for RX in switchdev mode")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261105211637.1083978-2-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mellanox/mlx5/core/en_accel/ipsec_fs.c | 20 +++++++++++--------
.../mellanox/mlx5/core/esw/ipsec_fs.c | 15 ++++++++++++--
.../mellanox/mlx5/core/esw/ipsec_fs.h | 6 ++++++
3 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
index d8325c0f97c19..be973235c9ff0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
@@ -720,6 +720,16 @@ static void ipsec_rx_sa_selector_destroy(struct mlx5_core_dev *mdev,
mlx5_destroy_flow_table(rx->ft.sa_sel);
}
+static void
+ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec,
+ struct mlx5e_ipsec_rx *rx,
+ u32 family)
+{
+ mlx5_ipsec_fs_roce_rx_destroy(ipsec->roce, family, ipsec->mdev);
+ if (rx == ipsec->rx_esw)
+ mlx5_esw_ipsec_rx_status_pass_dest_put(ipsec);
+}
+
static void rx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
struct mlx5e_ipsec_rx *rx, u32 family)
{
@@ -739,13 +749,7 @@ static void rx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
ipsec_rx_policy_destroy(rx);
- mlx5_ipsec_fs_roce_rx_destroy(ipsec->roce, family, mdev);
-
-#ifdef CONFIG_MLX5_ESWITCH
- if (rx == ipsec->rx_esw)
- mlx5_chains_put_table(esw_chains(ipsec->mdev->priv.eswitch),
- 0, 1, 0);
-#endif
+ ipsec_rx_status_pass_dest_put(ipsec, rx, family);
}
static void ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
@@ -1115,7 +1119,7 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
err_fs_ft_sa_sel:
mlx5_destroy_flow_table(rx->ft.status);
err_fs_ft_status:
- mlx5_ipsec_fs_roce_rx_destroy(ipsec->roce, family, mdev);
+ ipsec_rx_status_pass_dest_put(ipsec, rx, family);
return err;
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
index ab50d2c734ede..f8c97954b6eaf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c
@@ -34,12 +34,23 @@ void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
struct mlx5_flow_destination *dest)
{
- dest->type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
- dest->ft = mlx5_chains_get_table(esw_chains(ipsec->mdev->priv.eswitch), 0, 1, 0);
+ struct mlx5_flow_table *ft;
+
+ ft = mlx5_chains_get_table(esw_chains(ipsec->mdev->priv.eswitch),
+ 0, 1, 0);
+ if (IS_ERR(ft))
+ return PTR_ERR(ft);
+ dest->type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
+ dest->ft = ft;
return 0;
}
+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec)
+{
+ mlx5_chains_put_table(esw_chains(ipsec->mdev->priv.eswitch), 0, 1, 0);
+}
+
int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
struct mlx5_flow_act *flow_act)
{
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h
index 514c15258b1d1..bb6f2423078bd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.h
@@ -12,6 +12,7 @@ void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
struct mlx5e_ipsec_rx_create_attr *attr);
int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
struct mlx5_flow_destination *dest);
+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec);
int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
struct mlx5_flow_act *flow_act);
void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry);
@@ -32,6 +33,11 @@ static inline int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ips
return -EINVAL;
}
+static inline
+void mlx5_esw_ipsec_rx_status_pass_dest_put(struct mlx5e_ipsec *ipsec)
+{
+}
+
static inline int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
struct mlx5_flow_act *flow_act)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 436/990] net/mlx5e: Fix ipsec core device access during profile changes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (434 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 435/990] net/mlx5e: Release IPsec root table reference on RX setup failure Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 437/990] net/mlx5e: Serialize TC and IPsec offload exclusion counters Greg Kroah-Hartman
` (416 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cosmin Ratiu, Jianbo Liu,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <cratiu@nvidia.com>
[ Upstream commit 5b310ae1eff7531030b123bfcb192b0176d73075 ]
Devlink E-Switch mode changes replace the netdev profile without
unregistering the netdev. XFRM state and policy creation can therefore
run while mlx5e_priv_cleanup() clears priv with memset() or
mlx5e_priv_init() initializes it again. Accesses to priv->mdev can
observe NULL or a torn pointer, and repeated loads may return different
values.
Read priv->mdev once in each add callback and use the saved pointer
throughout the callback, including error unwinding. The core device
survives the in-place profile change, so a saved non-NULL pointer
remains valid even if priv is cleared in the meantime.
A NULL priv->mdev means a profile change is in progress, which only
happens during an eswitch mode change. Return -EBUSY in that case, as
mlx5_eswitch_block_mode() does for the same mode change. -EOPNOTSUPP
would make xfrm_dev_state_add() silently fall back to software for a
crypto offload SA for its whole lifetime.
Use WRITE_ONCE() when initializing priv->mdev and when clearing it
before memset(). This makes the transition to NULL atomic; the
subsequent bulk clear only writes zero bytes over an already NULL
pointer. Annotate the READ_ONCE() snapshots with data_race() to allow
that harmless overlap with the unmarked memset() without suppressing
checks for the rest of priv.
This fixes the core-device pointer accesses. Protecting the IPsec
context itself during state and policy creation is handled separately.
This was found by Sashiko, during review of the next patches in the
series. No attempt was made at reproducing this race, the chances seem
vanishingly small.
Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261105211637.1083978-6-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mellanox/mlx5/core/en_accel/ipsec.c | 38 +++++++++++++------
.../net/ethernet/mellanox/mlx5/core/en_main.c | 4 +-
2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index 2874a50bead6a..611876f204134 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -775,12 +775,20 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
{
struct mlx5e_ipsec_sa_entry *sa_entry = NULL;
bool allow_tunnel_mode = false;
+ struct mlx5_core_dev *mdev;
struct mlx5e_ipsec *ipsec;
struct mlx5e_priv *priv;
gfp_t gfp;
int err;
priv = netdev_priv(dev);
+ /* Profile cleanup can memset an already NULL mdev. */
+ mdev = data_race(READ_ONCE(priv->mdev));
+ /* NULL only during a profile change, which is an eswitch operation. */
+ if (!mdev) {
+ NL_SET_ERR_MSG_MOD(extack, "Eswitch busy, can't add state");
+ return -EBUSY;
+ }
if (!priv->ipsec)
return -EOPNOTSUPP;
@@ -799,16 +807,16 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
return 0;
}
- err = mlx5e_xfrm_validate_state(priv->mdev, x, extack);
+ err = mlx5e_xfrm_validate_state(mdev, x, extack);
if (err)
goto err_xfrm;
- if (!mlx5_eswitch_block_ipsec(priv->mdev)) {
+ if (!mlx5_eswitch_block_ipsec(mdev)) {
err = -EBUSY;
goto err_xfrm;
}
- err = mlx5_eswitch_block_mode(priv->mdev);
+ err = mlx5_eswitch_block_mode(mdev);
if (err)
goto unblock_ipsec;
@@ -876,9 +884,9 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
x->xso.offload_handle = (unsigned long)sa_entry;
if (allow_tunnel_mode)
- mlx5_eswitch_unblock_encap(priv->mdev);
+ mlx5_eswitch_unblock_encap(mdev);
- mlx5_eswitch_unblock_mode(priv->mdev);
+ mlx5_eswitch_unblock_mode(mdev);
return 0;
@@ -894,11 +902,11 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
kfree(sa_entry->work);
unblock_encap:
if (allow_tunnel_mode)
- mlx5_eswitch_unblock_encap(priv->mdev);
+ mlx5_eswitch_unblock_encap(mdev);
unblock_mode:
- mlx5_eswitch_unblock_mode(priv->mdev);
+ mlx5_eswitch_unblock_mode(mdev);
unblock_ipsec:
- mlx5_eswitch_unblock_ipsec(priv->mdev);
+ mlx5_eswitch_unblock_ipsec(mdev);
err_xfrm:
kfree(sa_entry);
NL_SET_ERR_MSG_WEAK_MOD(extack, "Device failed to offload this state");
@@ -1267,16 +1275,24 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,
{
struct net_device *netdev = x->xdo.dev;
struct mlx5e_ipsec_pol_entry *pol_entry;
+ struct mlx5_core_dev *mdev;
struct mlx5e_priv *priv;
int err;
priv = netdev_priv(netdev);
+ /* Profile cleanup can memset an already NULL mdev. */
+ mdev = data_race(READ_ONCE(priv->mdev));
+ if (!mdev) {
+ NL_SET_ERR_MSG_MOD(extack, "Eswitch busy, can't add policy");
+ return -EBUSY;
+ }
+
if (!priv->ipsec) {
NL_SET_ERR_MSG_MOD(extack, "Device doesn't support IPsec packet offload");
return -EOPNOTSUPP;
}
- err = mlx5e_xfrm_validate_policy(priv->mdev, x, extack);
+ err = mlx5e_xfrm_validate_policy(mdev, x, extack);
if (err)
return err;
@@ -1287,7 +1303,7 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,
pol_entry->x = x;
pol_entry->ipsec = priv->ipsec;
- if (!mlx5_eswitch_block_ipsec(priv->mdev)) {
+ if (!mlx5_eswitch_block_ipsec(mdev)) {
err = -EBUSY;
goto ipsec_busy;
}
@@ -1301,7 +1317,7 @@ static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,
return 0;
err_fs:
- mlx5_eswitch_unblock_ipsec(priv->mdev);
+ mlx5_eswitch_unblock_ipsec(mdev);
ipsec_busy:
kfree(pol_entry);
NL_SET_ERR_MSG_MOD(extack, "Device failed to offload this policy");
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3bbb19712a586..3695498f27e0b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -6205,7 +6205,7 @@ int mlx5e_priv_init(struct mlx5e_priv *priv,
node = dev_to_node(mlx5_core_dma_dev(mdev));
/* priv init */
- priv->mdev = mdev;
+ WRITE_ONCE(priv->mdev, mdev);
priv->netdev = netdev;
priv->max_nch = nch;
priv->max_opened_tc = 1;
@@ -6298,6 +6298,8 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv)
mlx5e_mqprio_rl_free(priv->mqprio_rl);
}
+ /* Clear atomically before memset() for lockless XFRM readers. */
+ WRITE_ONCE(priv->mdev, NULL);
memset(priv, 0, sizeof(*priv));
if (destroying) /* restore destroying bit, to allow unload */
set_bit(MLX5E_STATE_DESTROYING, &priv->state);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 437/990] net/mlx5e: Serialize TC and IPsec offload exclusion counters
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (435 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 436/990] net/mlx5e: Fix ipsec core device access during profile changes Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 438/990] fou: gue: check IP version of held packets for direct IP encapsulation Greg Kroah-Hartman
` (415 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cosmin Ratiu, Jianbo Liu,
Dragos Tatulea, Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <cratiu@nvidia.com>
[ Upstream commit 717dec565a5e7feab544da5aa77db9da71bc93fe ]
The counters enforcing TC and IPsec packet offload mutual exclusion are
not consistently serialized. IPsec admission conditionally takes
mode_lock for writing, while TC admission holds it only for read.
Neither release path takes the lock, and devices without an eswitch
cannot rely on it at all.
These are per-core-device counters, separate from the eswitch mode and
encapsulation reservations protected by mode_lock. Move them into
mdev->offload_block and protect their checks, increments and decrements
with a dedicated spinlock that is available even without an eswitch.
A spinlock is used because some of these functions are called from
atomic context and is a good fit because the critical sections are and
will stay really short.
IPsec admission then no longer needs mode_lock to update these counters.
Add warnings for unbalanced releases. Keep mlx5_esw_lock() for eswitch
operation admission and temporary mode/encapsulation reservations.
This was found by upstream Sashiko during review of [1], and spun-off
into a fix from the larger patch.
[1]
https://lore.kernel.org/netdev/178907726586.219967.4695695146458742597@kernel.org/
Fixes: c8e350e62fc5 ("net/mlx5e: Make TC and IPsec offloads mutually exclusive on a netdev")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261105211637.1083978-9-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../mellanox/mlx5/core/en_accel/ipsec_fs.c | 43 ++++++-------------
.../net/ethernet/mellanox/mlx5/core/en_tc.c | 18 +++++---
.../net/ethernet/mellanox/mlx5/core/main.c | 1 +
include/linux/mlx5/driver.h | 8 +++-
4 files changed, 31 insertions(+), 39 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
index be973235c9ff0..5c5b33b01bebf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
@@ -2578,45 +2578,26 @@ void mlx5e_accel_ipsec_fs_read_stats(struct mlx5e_priv *priv, void *ipsec_stats)
}
}
-#ifdef CONFIG_MLX5_ESWITCH
static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev)
{
- struct mlx5_eswitch *esw = mdev->priv.eswitch;
- int err = 0;
-
- if (esw) {
- err = mlx5_esw_lock(esw);
- if (err)
- return err;
- }
-
- if (mdev->num_block_ipsec) {
- err = -EBUSY;
- goto unlock;
- }
+ int ret = 0;
- mdev->num_block_tc++;
-
-unlock:
- if (esw)
- mlx5_esw_unlock(esw);
-
- return err;
-}
-#else
-static int mlx5e_ipsec_block_tc_offload(struct mlx5_core_dev *mdev)
-{
- if (mdev->num_block_ipsec)
- return -EBUSY;
+ spin_lock_bh(&mdev->offload_block.lock);
+ if (mdev->offload_block.num_block_ipsec)
+ ret = -EBUSY;
+ else
+ mdev->offload_block.num_block_tc++;
+ spin_unlock_bh(&mdev->offload_block.lock);
- mdev->num_block_tc++;
- return 0;
+ return ret;
}
-#endif
static void mlx5e_ipsec_unblock_tc_offload(struct mlx5_core_dev *mdev)
{
- mdev->num_block_tc--;
+ spin_lock_bh(&mdev->offload_block.lock);
+ if (!WARN_ON_ONCE(!mdev->offload_block.num_block_tc))
+ mdev->offload_block.num_block_tc--;
+ spin_unlock_bh(&mdev->offload_block.lock);
}
int mlx5e_accel_ipsec_fs_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 83e3e51420afc..9308fb8da7d71 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4797,16 +4797,19 @@ static bool is_tc_ipsec_order_check_needed(struct net_device *filter, struct mlx
static int mlx5e_tc_block_ipsec_offload(struct net_device *filter, struct mlx5e_priv *priv)
{
struct mlx5_core_dev *mdev = priv->mdev;
+ int ret = 0;
if (!is_tc_ipsec_order_check_needed(filter, priv))
return 0;
- if (mdev->num_block_tc)
- return -EBUSY;
-
- mdev->num_block_ipsec++;
+ spin_lock_bh(&mdev->offload_block.lock);
+ if (mdev->offload_block.num_block_tc)
+ ret = -EBUSY;
+ else
+ mdev->offload_block.num_block_ipsec++;
+ spin_unlock_bh(&mdev->offload_block.lock);
- return 0;
+ return ret;
}
static void mlx5e_tc_unblock_ipsec_offload(struct net_device *filter, struct mlx5e_priv *priv)
@@ -4814,7 +4817,10 @@ static void mlx5e_tc_unblock_ipsec_offload(struct net_device *filter, struct mlx
if (!is_tc_ipsec_order_check_needed(filter, priv))
return;
- priv->mdev->num_block_ipsec--;
+ spin_lock_bh(&priv->mdev->offload_block.lock);
+ if (!WARN_ON_ONCE(!priv->mdev->offload_block.num_block_ipsec))
+ priv->mdev->offload_block.num_block_ipsec--;
+ spin_unlock_bh(&priv->mdev->offload_block.lock);
}
int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 42bc553d034b5..b6878b33cea1b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1833,6 +1833,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
lockdep_register_key(&dev->lock_key);
mutex_init(&dev->intf_state_mutex);
lockdep_set_class(&dev->intf_state_mutex, &dev->lock_key);
+ spin_lock_init(&dev->offload_block.lock);
mutex_init(&dev->mlx5e_res.uplink_netdev_lock);
mutex_init(&dev->wc_state_lock);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 647dcf144ae90..14b5fea30da31 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -780,8 +780,12 @@ struct mlx5_core_dev {
u32 vsc_addr;
struct mlx5_hv_vhca *hv_vhca;
struct mlx5_hwmon *hwmon;
- u64 num_block_tc;
- u64 num_block_ipsec;
+ struct {
+ /* Protects the fields below. */
+ spinlock_t lock;
+ u64 num_block_tc;
+ u64 num_block_ipsec;
+ } offload_block;
#ifdef CONFIG_MLX5_MACSEC
struct mlx5_macsec_fs *macsec_fs;
/* MACsec notifier chain to sync MACsec core and IB database */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 438/990] fou: gue: check IP version of held packets for direct IP encapsulation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (436 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 437/990] net/mlx5e: Serialize TC and IPsec offload exclusion counters Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 439/990] tcp: Do not allow buggy transitions between ehash and lhash2 Greg Kroah-Hartman
` (414 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, 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 c59f004734a2a7c0e427011db13aca524e781498 ]
For GUE version 0, gue_gro_receive() compares the base GUE header and
its optional fields with every held packet. For GUE version 1 (direct
IP encapsulation), it skips this comparison and selects the next GRO
handler only from the IP version of the incoming packet.
A held version 0 GUE packet from the same outer flow therefore stays
eligible. For example, a GUE/IPv4/UDP packet can be aggregated with a
direct IPv4/TCP packet, and inet_gro_receive() then parses the held
packet's GUE header as an IPv4 header.
Clear same_flow for held packets whose first nibble does not match the
incoming IP version. A valid version 0 GUE header always has a first
nibble between 0 and 3, so this also separates the two GUE formats.
The reverse case is already handled: the version 0 path compares the
whole base GUE header, including the version bits.
Fixes: c1e48af7960e ("gue: Implement direction IP encapsulation")
Reported-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261106195615.2498766-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/fou_core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/ipv4/fou_core.c b/net/ipv4/fou_core.c
index fc930274a1fd0..65da20c30b6ee 100644
--- a/net/ipv4/fou_core.c
+++ b/net/ipv4/fou_core.c
@@ -364,6 +364,18 @@ static struct sk_buff *gue_gro_receive(struct sock *sk,
default:
goto out;
}
+
+ /* Match the encapsulation format and IP version. */
+ list_for_each_entry(p, head, list) {
+ const struct iphdr *iph2;
+
+ if (!NAPI_GRO_CB(p)->same_flow)
+ continue;
+
+ iph2 = (const struct iphdr *)(p->data + off);
+ if (iph2->version != ((struct iphdr *)guehdr)->version)
+ NAPI_GRO_CB(p)->same_flow = 0;
+ }
goto next_proto;
default:
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 439/990] tcp: Do not allow buggy transitions between ehash and lhash2.
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (437 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 438/990] fou: gue: check IP version of held packets for direct IP encapsulation Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 440/990] tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF Greg Kroah-Hartman
` (413 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Michal Luczaj,
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 8cc3aef0cb198049805ecc061a2cc7b79b0ae43e ]
The following state transitions have long been a playground for
syzbot, and recently AI joined in, reporting a lot more bugs.
* listen() + shutdown() + connect()
* connect() + connect(AF_UNSPEC) + listen()
All the fix attempts would add more code to the fast path, which
is not worth it.
Instead of playing whack-a-mole with these edge-case bugs,
let's disallow these transitions.
Note that unhashed_state is placed in the 4-byte hole after
icsk_pmtu_cookie.
$ pahole -C inet_connection_sock vmlinux
struct inet_connection_sock {
...
__u32 icsk_pmtu_cookie; /* 1208 4 */
unsigned char unhashed_state; /* 1212 1 */
/* XXX 3 bytes hole, try to pack */
Reported-by: Kyle Zeng <kylebot@openai.com>
Closes: https://lore.kernel.org/netdev/20260731140512.566464-1-david.lee@trailofbits.com/
Reported-by: Michal Luczaj <mhal@rbox.co>
Closes: https://lore.kernel.org/netdev/20260803-sockmap-lookup-tcp-leak-v2-0-306e025bfe66@rbox.co/
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-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 8c011697f76a ("tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/inet_connection_sock.h | 1 +
net/ipv4/inet_connection_sock.c | 1 +
net/ipv4/inet_hashtables.c | 11 +++++++++++
3 files changed, 13 insertions(+)
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 39ccb785dd4c1..24e0b62143f59 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -95,6 +95,7 @@ struct inet_connection_sock {
u32 icsk_rto_max;
__u32 icsk_delack_max;
__u32 icsk_pmtu_cookie;
+ unsigned char unhashed_state;
const struct tcp_congestion_ops *icsk_ca_ops;
const struct inet_connection_sock_af_ops *icsk_af_ops;
const struct tcp_ulp_ops *icsk_ulp_ops;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 2db9ceda0456a..58aff248278dd 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1284,6 +1284,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
memset(&newicsk->icsk_accept_queue, 0,
sizeof(newicsk->icsk_accept_queue));
+ newicsk->unhashed_state = 0;
inet_sk_set_state(newsk, TCP_SYN_RECV);
inet_clone_ulp(req, newsk, priority);
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index c0accacdc3eb1..030276cde581a 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -791,6 +791,11 @@ int inet_hash(struct sock *sk)
return 0;
}
WARN_ON(!sk_unhashed(sk));
+
+ if (unlikely(inet_csk(sk)->unhashed_state &&
+ inet_csk(sk)->unhashed_state != TCP_LISTEN))
+ return -EINVAL;
+
ilb2 = inet_lhash2_bucket_sk(hashinfo, sk);
spin_lock(&ilb2->lock);
@@ -821,6 +826,9 @@ void inet_unhash(struct sock *sk)
return;
sock_rps_delete_flow(sk);
+
+ inet_csk(sk)->unhashed_state = sk->sk_state;
+
if (sk->sk_state == TCP_LISTEN) {
struct inet_listen_hashbucket *ilb2;
@@ -1050,6 +1058,9 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
int step, l3mdev;
u32 index;
+ if (unlikely(inet_csk(sk)->unhashed_state == TCP_LISTEN))
+ return -EINVAL;
+
if (port) {
local_bh_disable();
ret = check_established(death_row, sk, port, NULL, false,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 440/990] tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (438 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 439/990] tcp: Do not allow buggy transitions between ehash and lhash2 Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 441/990] udp: do not use a cross-family sk_rx_dst in early demux Greg Kroah-Hartman
` (412 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Jiayuan Chen, Kuniyuki Iwashima, 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 8c011697f76abf3b2302718a7a1c50e36d849f28 ]
After listen() + shutdown(), a TCP socket is moved to the closed
section of its reuseport group, while TCP_NEW_SYN_RECV requests
can still reference it as rsk_listener.
If SO_ATTACH_REUSEPORT_[CE]BPF is then used on this socket,
reuseport_attach_prog() calls reuseport_alloc(), which resurrects
it into the listening section of a new group, even though the
socket is still in TCP_CLOSE.
After close(), the socket stays in that group and the pending
requests keep it allocated. When the final ACK arrives,
reuseport_migrate_sock() can select this dead socket and
inet_csk_clone_lock() clones it. With a ULP like espintcp installed
while in TCP_CLOSE, the child inherits icsk_ulp_data and sk_destruct
after tcp_cleanup_ulp() cleared icsk_ulp_ops, leading to a
use-after-free in espintcp_destruct().
As done in commit 8cc3aef0cb19 ("tcp: Do not allow buggy transitions
between ehash and lhash2."), deny this transition instead of adding
checks to the fast path.
Only an unhashed former listener is affected. Applications can still
attach a reuseport prog to a socket that never listened, or to a
listener (including one that called listen() again after shutdown()).
Fixes: 333bb73f620e ("tcp: Keep TCP_CLOSE sockets in the reuseport group.")
Reported-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261106084300.2029567-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/sock_reuseport.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
index d4b7caf86eee3..eb8d24964e2f6 100644
--- a/net/core/sock_reuseport.c
+++ b/net/core/sock_reuseport.c
@@ -6,6 +6,7 @@
* selecting the socket index from the array of available sockets.
*/
+#include <net/inet_connection_sock.h>
#include <net/ip.h>
#include <net/sock_reuseport.h>
#include <linux/bpf.h>
@@ -692,6 +693,14 @@ int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog)
if (!sk->sk_reuseport)
return -EINVAL;
+ /* Do not put a shutdown()ed TCP listener back into the
+ * listening section of a reuseport group while it is in
+ * TCP_CLOSE: requests can still migrate to it.
+ */
+ if (sk_is_tcp(sk) &&
+ inet_csk(sk)->unhashed_state == TCP_LISTEN)
+ return -EINVAL;
+
err = reuseport_alloc(sk, false);
if (err)
return err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 441/990] udp: do not use a cross-family sk_rx_dst in early demux
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (439 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 440/990] tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 442/990] net: gro: compare skb->protocol in gro_list_prepare() Greg Kroah-Hartman
` (411 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 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@kernel.org>
[ Upstream commit 5636e67320563be743d47706ef4914078c27edb2 ]
A dual-stack UDP socket connected to a v4-mapped address can receive
both IPv4 packets and IPv6 packets using v4-mapped addresses:
ip6_rcv_core() no longer rejects a v4-mapped source since commit
dcc32f4f183a ("ipv6: weaken the v4mapped source check"), which kept
that check only in tcp_v6_conn_request(). ipv6_portaddr_hash() hashes
v4-mapped addresses like IPv4 ones, so both early demux handlers find
the socket, and both __udp4_lib_rcv() and __udp6_lib_rcv() store their
input dst in the same sk->sk_rx_dst.
udp_v6_early_demux() validates the cached dst with dst_check(), but
ipv4_dst_check() ignores the cookie, so an IPv4 dst gets attached to
an IPv6 skb. ip6_rcv_finish_core() then skips the route lookup and
ip_local_deliver() parses the IPv6 header as an IPv4 one: the IPv6
next header and hop limit are read as a fragment offset, and the IPv4
protocol is taken from a source address byte.
The reverse direction looks possible too: per-cpu dsts of IPv6 routes
using nexthop objects have rt->sernum set, and ip6_dst_check() then
ignores the cookie, so udp_v4_early_demux() can attach an IPv6 dst to
an IPv4 skb.
Kyle Zeng reported that such a packet can reach XFRM input still
holding the prefetched, non refcounted, socket set by early demux,
which can then outlive its RCU grace period.
Only use the cached dst if its family matches the packet. Otherwise
fall back to a regular route lookup.
TCP does not have the same problem: sk_ehashfn() hashes a v4-mapped
socket with inet_ehashfn(), while IPv6 lookups use inet6_ehashfn(),
so IPv6 packets do not normally find a v4-mapped TCP socket.
Fixes: 5425077d73e0 ("net: ipv6: Add early demux handler for UDP unicast")
Fixes: c9f2c1ae123a ("udp6: fix socket leak on early demux")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261106110135.2161204-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/udp.c | 5 ++++-
net/ipv6/udp.c | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index a7ae0d098f2c6..62cdc8d8f9fb2 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2933,8 +2933,11 @@ enum skb_drop_reason udp_v4_early_demux(struct sk_buff *skb)
skb->destructor = sock_pfree;
dst = rcu_dereference(sk->sk_rx_dst);
- if (dst)
+ /* A dual-stack socket can cache an IPv6 dst. */
+ if (dst && dst->ops->family == AF_INET)
dst = dst_check(dst, 0);
+ else
+ dst = NULL;
if (dst) {
u32 itag = 0;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 7468c1f0a4ff6..1cc143ef7b9c7 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1264,8 +1264,11 @@ void udp_v6_early_demux(struct sk_buff *skb)
skb->destructor = sock_pfree;
dst = rcu_dereference(sk->sk_rx_dst);
- if (dst)
+ /* A dual-stack socket can cache an IPv4 dst. */
+ if (dst && dst->ops->family == AF_INET6)
dst = dst_check(dst, sk->sk_rx_dst_cookie);
+ else
+ dst = NULL;
if (dst) {
/* set noref for now.
* any place which wants to hold dst has to call
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 442/990] net: gro: compare skb->protocol in gro_list_prepare()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (440 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 441/990] udp: do not use a cross-family sk_rx_dst in early demux Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 443/990] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Greg Kroah-Hartman
` (410 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Willem de Bruijn,
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 511582022bfd07475d0daa209e6e6aa5a940740d ]
gro_list_prepare() checks whether a held packet may belong to the same
flow as the incoming one by comparing the device, VLAN tag, metadata
and the link-layer header, using dev->hard_header_len as its length.
On devices without a link-layer header (hard_header_len == 0), such as
L3 GRE tunnels, no compared byte carries the outer protocol:
skb->protocol comes from the tunnel header. Packets of different
protocols can then stay eligible, and the GRO handler selected from the
incoming skb->protocol parses the held packet with the wrong layout.
For example, take an IPv4/UDP packet held by UDP GRO and a
VLAN/IPv4/TCP packet received on the same ipgre device.
vlan_gro_receive() reads the first four bytes of the held IPv4 header
as a VLAN header. With crafted values, the held packet survives up to
tcp_gro_receive(), which uses its UDP header as a TCP header. With a
short linear part, the FIN/PSH update of the held packet's TCP flags
can then write into skb_shared_info.
The VLAN, GRE, IPv4 and IPv6 GRO handlers compare the next-protocol
field of their own header, so once the outer protocol matches, the
inner layers are checked too. Only the outermost protocol was not
compared.
Compare skb->protocol too. On Ethernet devices this is redundant with
compare_ether_header(), but it is cheap.
GUE direct IP encapsulation has a similar issue, but there both packets
have the same outer protocol, so it is fixed separately in
gue_gro_receive().
Fixes: 60769a5dcd87 ("ipv4: gre: add GRO capability")
Reported-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261109164540.3104392-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/gro.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/gro.c b/net/core/gro.c
index a7b3fdc1f7bae..28006c0960871 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -379,6 +379,7 @@ static void gro_list_prepare(const struct list_head *head,
}
diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
+ diffs |= p->protocol != skb->protocol;
diffs |= p->vlan_all ^ skb->vlan_all;
diffs |= skb_metadata_differs(p, skb);
if (maclen == ETH_HLEN)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 443/990] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (441 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 442/990] net: gro: compare skb->protocol in gro_list_prepare() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 444/990] udp: check frag_list IP family before using skb_segment_list() Greg Kroah-Hartman
` (409 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Anandu Padinhare, Lorenzo Bianconi,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anandu Padinhare <Anandu.Padinhare@electrifex.com>
[ Upstream commit 070411c1590c8172eb4d86f045d99c372f22fe23 ]
In the AF_XDP zero-copy RX path, frames that the XDP program passes to
the stack are handed over by stmmac_dispatch_skb_zc(). That function
increments rx_pkt_n instead of rx_packets since
commit 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary").
stmmac_rx_zc() already adds every processed frame to rx_pkt_n, so each
XDP_PASS frame is counted twice there, and rx_packets, which
ndo_get_stats64() reports, never counts them: on a zero-copy queue
rx_bytes grows with the passed frames while rx_packets stays still.
Count the frame in rx_packets, as the regular RX path and the code
before that commit did.
Found while testing AF_XDP zero-copy on an ADSP-SC598 (adi-dwmac,
100 Mbit/s link): rx_pkt_n grew almost twice as fast as the frames the
MAC delivered, while "ip -s link" counted almost none.
Tested on that board with a 6.18-based kernel, whose zero-copy RX
accounting matches net. An AF_XDP zero-copy socket on queue 0 received
frames of one EtherType while UDP traffic was passed to the stack. In a
run with 60 s of traffic before the change, rx_pkt_n was 1.88 times the
frames that reached the driver (MAC frames minus RX FIFO overflows) and
"ip -s link" counted 55 RX packets. In the same test with the change,
rx_pkt_n equals the frames that reached the driver and rx_packets equals
the frames passed to the stack.
Fixes: 133466c3bbe1 ("net: stmmac: use per-queue 64 bit statistics where necessary")
Signed-off-by: Anandu Padinhare <Anandu.Padinhare@electrifex.com>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/PNYPR01MB11444552E41C2B17A992492C0FD762@PNYPR01MB11444.INDPRD01.PROD.OUTLOOK.COM
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0e78c1d2fcf1d..c2b975ac8b566 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5264,7 +5264,7 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue,
napi_gro_receive(&ch->rxtx_napi, skb);
u64_stats_update_begin(&rxq_stats->napi_syncp);
- u64_stats_inc(&rxq_stats->napi.rx_pkt_n);
+ u64_stats_inc(&rxq_stats->napi.rx_packets);
u64_stats_add(&rxq_stats->napi.rx_bytes, len);
u64_stats_update_end(&rxq_stats->napi_syncp);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 444/990] udp: check frag_list IP family before using skb_segment_list()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (442 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 443/990] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 445/990] drm/bridge: sii902x: validate I2S data lane values Greg Kroah-Hartman
` (408 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Willem de Bruijn, Dave Miller, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
[ Upstream commit 22b7cb932c6a0f7566d41072be6956cb6c8af4e1 ]
UDP fraglist GRO uses SKB_GSO_UDP_L4 for both IPv4 and IPv6.
__udp_gso_segment() reuses the frag_list skbs when the geometry of
the head skb was not modified. skb_segment_list() keeps the network
header of each frag_list skb as it was at GRO time and only adjusts
the transport header offset.
Nothing guarantees that the head skb still has the IP family of the
frag_list skbs: helpers like skb_mpls_pop() let the caller choose
the new protocol. In that case __udpv6_gso_segment_list_csum()
handles the 20 byte IPv4 header of each frag_list skb as a struct
ipv6hdr, and can write IPv6 addresses beyond its linear part.
Check the IP version of the first frag_list skb. All skbs in the
list belong to the same flow, so they share the same IP family.
Use the skb_segment() fallback on a mismatch. Regular fraglist GRO
traffic keeps the fast path.
Fixes: b936a9b8d4a5 ("net: ipv6: fix UDPv6 GSO segmentation with NAT")
Fixes: c3df39ac9b0e ("udp: ipv4: manipulate network header of NATed UDP GRO fraglist")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
[edumazet: simplified the fix, rewrote the comment and the changelog]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/udp_offload.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 4f7ae02df8d3a..2fd0d7c72b45e 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -515,9 +515,14 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
}
if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) {
- /* Detect modified geometry and pass those to skb_segment. */
+ /* Detect modified geometry and pass those to skb_segment.
+ * SKB_GSO_UDP_L4 is used by both IPv4 and IPv6: also make sure
+ * the frag_list skbs still have the IP family we segment for,
+ * as their network headers are not rebuilt.
+ */
if ((skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) &&
- !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY))
+ !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY) &&
+ ip_hdr(skb_shinfo(gso_skb)->frag_list)->version == (is_ipv6 ? 6 : 4))
return __udp_gso_segment_list(gso_skb, features, is_ipv6);
ret = __skb_linearize(gso_skb);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 445/990] drm/bridge: sii902x: validate I2S data lane values
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (443 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 444/990] udp: check frag_list IP family before using skb_segment_list() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 446/990] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync() Greg Kroah-Hartman
` (407 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Luca Ceresoli,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 444b7116e7ef1fdb5f7db3bc1f74b20098d062d4 ]
The sil,i2s-data-lanes property reader bounds the number of entries, but
does not bound each entry's value. Those values index the four-entry
i2s_lane_id table when the audio FIFO sequence is built.
Reject unsupported lane values before indexing that table. Report the
property name and invalid value with dev_err_probe() so the diagnostic
identifies the faulty configuration.
The issue was found by our static-analysis tool.
Fixes: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20260920034833.18874-1-hppiscas@163.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/bridge/sii902x.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 1f0aba28ad1e1..9c1566263ed95 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -891,9 +891,15 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x,
}
codec_data.max_i2s_channels = 2 * num_lanes;
- for (i = 0; i < num_lanes; i++)
+ for (i = 0; i < num_lanes; i++) {
+ if (lanes[i] >= ARRAY_SIZE(i2s_lane_id))
+ return dev_err_probe(dev, -EINVAL,
+ "invalid sil,i2s-data-lanes value %u\n",
+ lanes[i]);
+
sii902x->audio.i2s_fifo_sequence[i] |= audio_fifo_id[i] |
i2s_lane_id[lanes[i]] | SII902X_TPI_I2S_FIFO_ENABLE;
+ }
sii902x->audio.mclk = devm_clk_get_optional(dev, "mclk");
if (IS_ERR(sii902x->audio.mclk)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 446/990] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (444 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 445/990] drm/bridge: sii902x: validate I2S data lane values Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 447/990] ASoC: max98090: keep the MIC boost across mic input power-up Greg Kroah-Hartman
` (406 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kavitha Daula, Juergen Gross,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kavitha Daula <kavi@edera.dev>
[ Upstream commit 704f812cdab8bbf30987653c1c76c0d2c1e135e7 ]
Both callers of gnttab_unmap_refs_sync(), free_persistent_gnts() and
xen_blkbk_unmap_purged_grants() in blkback, keep their struct
gntab_unmap_queue_data on the stack. gnttab_unmap_refs_async() sets up
the delayed work inside it with INIT_DELAYED_WORK(), so with
CONFIG_DEBUG_OBJECTS_WORK and CONFIG_DEBUG_OBJECTS_TIMERS every
persistent grant teardown warns twice, once for the work and once for
its timer:
[ 104.366085] ODEBUG: object ffffc9004020fad8 is on stack ffffc9004020c000, but NOT annotated.
[ 104.371551] WARNING: CPU: 1 PID: 48 at lib/debugobjects.c:672 lookup_object_or_alloc.part.0+0x12b/0x1f0
Call Trace:
<TASK>
__debug_object_init+0xfe/0x1a0
debug_object_init+0x38/0x50
__init_work+0x28/0x30
gnttab_unmap_refs_async+0x18/0xa0
gnttab_unmap_refs_sync+0x61/0x90
free_persistent_gnts+0x179/0x280
xen_blkbk_free_caches+0x16/0x30
xen_blkif_disconnect+0xfa/0x2d0
frontend_changed+0x90/0x680
xenbus_otherend_changed+0x80/0xb0
frontend_changed+0x14/0x20
xenwatch_thread+0x96/0x1a0
kthread+0x11d/0x250
ret_from_fork+0x29f/0x2d0
ret_from_fork_asm+0x1a/0x30
</TASK>
gnttab_unmap_refs_sync() waits for the unmap to complete before it
returns, so the work never outlives the caller's frame. Initialise it
with INIT_DELAYED_WORK_ONSTACK() when the item is on the stack and
destroy it before returning. The function is exported, so an item that
is not on the stack keeps INIT_DELAYED_WORK().
Fixes: b44166cd46e2 ("xen/grant: introduce func gnttab_unmap_refs_sync()")
Signed-off-by: Kavitha Daula <kavi@edera.dev>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261105000137.82224-1-kavithadaula@Kavithas-MacBook-Pro.local>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/xen/grant-table.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 478d2ad725ac6..261020f6b7776 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -38,6 +38,7 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/slab.h>
+#include <linux/sched/task_stack.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
#include <linux/io.h>
@@ -1360,12 +1361,21 @@ static void unmap_refs_callback(int result,
int gnttab_unmap_refs_sync(struct gntab_unmap_queue_data *item)
{
struct unmap_refs_callback_data data;
+ bool on_stack = object_is_on_stack(item);
init_completion(&data.completion);
item->data = &data;
item->done = &unmap_refs_callback;
- gnttab_unmap_refs_async(item);
+ /* blkback keeps @item, and so its retry work, on the stack. */
+ if (on_stack)
+ INIT_DELAYED_WORK_ONSTACK(&item->gnttab_work, gnttab_unmap_work);
+ else
+ INIT_DELAYED_WORK(&item->gnttab_work, gnttab_unmap_work);
+ item->age = 0;
+ __gnttab_unmap_refs_async(item);
wait_for_completion(&data.completion);
+ if (on_stack)
+ destroy_delayed_work_on_stack(&item->gnttab_work);
return data.result;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 447/990] ASoC: max98090: keep the MIC boost across mic input power-up
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (445 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 446/990] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 448/990] tcp: Drop any segments if DEFER_CONNECT is set Greg Kroah-Hartman
` (405 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, LiangCheng Wang, Mark Brown,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: LiangCheng Wang <zaq14760@gmail.com>
[ Upstream commit 58d51fa6ff1d21e79c3c340bfb3155dfa3025ca3 ]
PA1EN/PA2EN select both the MIC1/MIC2 preamp enable and its gain
(0 = off, 1 = 0 dB, 2 = +20 dB, 3 = +30 dB). "MICn Boost Volume" keeps
the selected gain in max98090->pa1en/pa2en while the input is off, and
max98090_micinput_event() writes it to the field when the "MICn Input"
widget powers up.
The event handler also reads the field back to keep the stored gain in
sync ("Update for volatile"), but it does so on POST_PMU and POST_PMD.
The widget drives PA1EN/PA2EN as a single enable bit, the low bit of
the field, so at both points DAPM has just rewritten it:
- POST_PMU: DAPM has set the field to 1, so the read-back stores
0 dB and the handler then restores 0 dB.
- POST_PMD: DAPM has cleared the low bit, so a +30 dB (3) gain reads
back as +20 dB (2).
As a result every capture starts at 0 dB: a boost set while the input is
powered down, e.g. restored by alsactl or an audio HAL at boot, never
takes effect, and one changed during capture is lost at the next
power-up.
Read the field back on PRE_PMD instead, while it still holds the active
gain, and only restore the stored gain on POST_PMU.
Tested on i.MX95 with a MAX98090 headset mic on MIC1, running NXP's
6.18.38 vendor kernel (max98090_micinput_event() is the same as in
mainline): with MIC1 Boost Volume set to 2 (+30 dB) before capture,
register 0x10 reads 0x20 (0 dB) during capture without this change and
0x60 (+30 dB) with it, and a boost changed during capture is kept for
the next capture.
Fixes: 685e42154dcf ("ASoC: Replace max98090 Device Driver")
Signed-off-by: LiangCheng Wang <zaq14760@gmail.com>
Link: https://patch.msgid.link/20261111-max98090-mic-boost-v1-1-20b9bd8816db@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/max98090.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 830caf62d0fa8..f686f80b2c522 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -743,14 +743,6 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
else
val = (val & M98090_MIC_PA2EN_MASK) >> M98090_MIC_PA2EN_SHIFT;
- if (val >= 1) {
- if (w->reg == M98090_REG_MIC1_INPUT_LEVEL) {
- max98090->pa1en = val - 1; /* Update for volatile */
- } else {
- max98090->pa2en = val - 1; /* Update for volatile */
- }
- }
-
switch (event) {
case SND_SOC_DAPM_POST_PMU:
/* If turning on, set to most recently selected volume */
@@ -759,6 +751,14 @@ static int max98090_micinput_event(struct snd_soc_dapm_widget *w,
else
val = max98090->pa2en + 1;
break;
+ case SND_SOC_DAPM_PRE_PMD:
+ if (val >= 1) {
+ if (w->reg == M98090_REG_MIC1_INPUT_LEVEL)
+ max98090->pa1en = val - 1;
+ else
+ max98090->pa2en = val - 1;
+ }
+ return 0;
case SND_SOC_DAPM_POST_PMD:
/* If turning off, turn off */
val = 0;
@@ -1108,11 +1108,13 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL,
M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
+ SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_PGA_E("MIC2 Input", M98090_REG_MIC2_INPUT_LEVEL,
M98090_MIC_PA2EN_SHIFT, 0, NULL, 0, max98090_micinput_event,
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
+ SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
+ SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_MIXER("LINEA Mixer", SND_SOC_NOPM, 0, 0,
&max98090_linea_mixer_controls[0],
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 448/990] tcp: Drop any segments if DEFER_CONNECT is set.
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (446 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 447/990] ASoC: max98090: keep the MIC boost across mic input power-up Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 449/990] amt: tear down every amt device on an unregistering lower Greg Kroah-Hartman
` (404 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
[ Upstream commit 44809e49177992b15708a150437d9aebc5beea9c ]
TCP Fast Open lets a client send data in its SYN. With
TCP_FASTOPEN_CONNECT and a cached Fast Open cookie, which the server
sent in the SYN-ACK of an earlier connection, the connection is set up
in two steps:
- connect() sends nothing, so that the SYN can carry the data of the
first write(). It only sets DEFER_CONNECT and inserts the socket into
the hash table in SYN_SENT.
- The first write() calls tcp_connect(), which runs tcp_connect_init()
and sends the SYN.
A socket must not accept any segment before it has sent its SYN. But
nothing on the receive path checks DEFER_CONNECT. So until the write(),
the half-initialised socket processes segments like any socket in
SYN_SENT, and a forged SYN is accepted.
Similarly, ICMP with seq matching ISN is accepted in the state.
Before commit 57889a8f6d49 ("tcp: initialize send sequence numbers
before deferring TFO"), even seq 0 message was accepted.
Drop any segments if DEFER_CONNECT is set.
Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support")
Signed-off-by: Chris Mason <mason@kernel.org>
[kuniyu: revised DEFER_CONNECT tests and the commit message]
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261107235720.3129212-3-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_input.c | 9 +++++++++
net/ipv4/tcp_ipv4.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7b5839236f77c..e72eb30d165c2 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -7048,6 +7048,15 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
goto discard;
case TCP_SYN_SENT:
+ /* We sent nothing yet, so no segment belongs to this connection.
+ * Send no RST: it would be built from this socket, whose TCP-AO
+ * keys are not set up either.
+ */
+ if (unlikely(inet_test_bit(DEFER_CONNECT, sk))) {
+ SKB_DR_SET(reason, NOT_SPECIFIED);
+ goto discard;
+ }
+
tp->rx_opt.saw_tstamp = 0;
tcp_mstamp_refresh(tp);
queued = tcp_rcv_synsent_state_process(sk, skb, th);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fa5437b405207..f8e91616d9bd8 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -546,7 +546,7 @@ int tcp_v4_err(struct sk_buff *skb, u32 info)
if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED))
__NET_INC_STATS(net, LINUX_MIB_LOCKDROPPEDICMPS);
}
- if (sk->sk_state == TCP_CLOSE)
+ if (sk->sk_state == TCP_CLOSE || inet_test_bit(DEFER_CONNECT, sk))
goto out;
if (static_branch_unlikely(&ip4_min_ttl)) {
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b07e8d22edcfb..490fc17a782c9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -425,7 +425,7 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if (sock_owned_by_user(sk) && type != ICMPV6_PKT_TOOBIG)
__NET_INC_STATS(net, LINUX_MIB_LOCKDROPPEDICMPS);
- if (sk->sk_state == TCP_CLOSE)
+ if (sk->sk_state == TCP_CLOSE || inet_test_bit(DEFER_CONNECT, sk))
goto out;
if (static_branch_unlikely(&ip6_min_hopcount)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 449/990] amt: tear down every amt device on an unregistering lower
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (447 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 448/990] tcp: Drop any segments if DEFER_CONNECT is set Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 450/990] net: ena: Keep the RX buffer mapped if skb allocation fails Greg Kroah-Hartman
` (403 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Omar Ramadan, Simon Horman,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Ramadan <omar@blockcast.net>
[ Upstream commit 7262e999ebec0a10ecc97ba4739f12255b7c6da8 ]
amt_device_event() acts only on the amt device that
amt_lookup_upper_dev() returns, which is the first amt device bound to
the event's lower. Several amt devices can share one lower, for
example two gateways.
On NETDEV_UNREGISTER, only the first device is unlinked and
unregistered. The others stay upper-linked to the lower, and
unregister_netdevice_many_notify() warns, because the notifier chain
must detach every upper device. They also still hold a reference on
the lower, so each is torn down only when netdev_wait_allrefs_any(),
called from netdev_run_todo(), rebroadcasts NETDEV_UNREGISTER. By then
the lower's sysfs directory is gone, so unlinking it trips a kernfs
WARN, and unregistering it from inside the rebroadcast trips the WARN
in __rtnl_unlock(). On NETDEV_CHANGEMTU, only the first device is
resized.
Walk every amt device in the lower's netns and act on each one bound
to the lower. On NETDEV_UNREGISTER, queue them all and unregister them
in one batch. amt_dellink() unlinks each device but leaves it on the
netns device list until unregister_netdevice_many(), so the walk stays
valid under RTNL.
To reproduce:
ip link add lower0 type dummy
ip link add amtg1 type amt mode gateway local 192.0.2.1 \
discovery 192.0.2.2 dev lower0
ip link add amtg2 type amt mode gateway local 192.0.2.1 \
discovery 192.0.2.2 dev lower0
ip link del lower0
Without this patch, the last command logs:
WARNING: net/core/dev.c:12773 at unregister_netdevice_many_notify+0x13e5/0x1940, CPU#3: ip/216
kernfs: can not remove 'upper_amtg2', no directory
WARNING: fs/kernfs/dir.c:1784 at kernfs_remove_by_name_ns+0xc9/0xd0, CPU#0: ip/216
WARNING: net/core/rtnetlink.c:141 at __rtnl_unlock+0xb2/0xf0, CPU#0: ip/216
WARNING: net/core/rtnetlink.c:141 at __rtnl_unlock+0xb2/0xf0, CPU#0: ip/216
With it, the commands log nothing and remove both amt devices, and
tools/testing/selftests/net/amt.sh passes on a KASAN and lockdep
kernel.
Found by a selftest for our upcoming AMT offload RFC, which deletes a
lower carrying two amt gateways, on our 6.18-based driver. The
commands above reproduce it on net.
Fixes: b9022b53adad ("amt: add control plane of amt interface")
Signed-off-by: Omar Ramadan <omar@blockcast.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261105232302.494171-1-omar@blockcast.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/amt.c | 56 ++++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 32 deletions(-)
diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index 96cde820237d3..2a8a0c0e78993 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -3383,22 +3383,6 @@ static struct rtnl_link_ops amt_link_ops __read_mostly = {
.fill_info = amt_fill_info,
};
-static struct net_device *amt_lookup_upper_dev(struct net_device *dev)
-{
- struct net_device *upper_dev;
- struct amt_dev *amt;
-
- for_each_netdev(dev_net(dev), upper_dev) {
- if (netif_is_amt(upper_dev)) {
- amt = netdev_priv(upper_dev);
- if (amt->stream_dev == dev)
- return upper_dev;
- }
- }
-
- return NULL;
-}
-
static int amt_device_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{
@@ -3408,26 +3392,34 @@ static int amt_device_event(struct notifier_block *unused,
LIST_HEAD(list);
int new_mtu;
- upper_dev = amt_lookup_upper_dev(dev);
- if (!upper_dev)
- return NOTIFY_DONE;
- amt = netdev_priv(upper_dev);
+ /* amt_dellink() leaves each device on the netns device list until
+ * unregister_netdevice_many(), so the walk stays valid.
+ */
+ for_each_netdev(dev_net(dev), upper_dev) {
+ if (!netif_is_amt(upper_dev))
+ continue;
+ amt = netdev_priv(upper_dev);
+ if (amt->stream_dev != dev)
+ continue;
- switch (event) {
- case NETDEV_UNREGISTER:
- amt_dellink(amt->dev, &list);
- unregister_netdevice_many(&list);
- break;
- case NETDEV_CHANGEMTU:
- if (amt->mode == AMT_MODE_RELAY)
- new_mtu = dev->mtu - AMT_RELAY_HLEN;
- else
- new_mtu = dev->mtu - AMT_GW_HLEN;
+ switch (event) {
+ case NETDEV_UNREGISTER:
+ amt_dellink(amt->dev, &list);
+ break;
+ case NETDEV_CHANGEMTU:
+ if (amt->mode == AMT_MODE_RELAY)
+ new_mtu = dev->mtu - AMT_RELAY_HLEN;
+ else
+ new_mtu = dev->mtu - AMT_GW_HLEN;
- dev_set_mtu(amt->dev, new_mtu);
- break;
+ dev_set_mtu(amt->dev, new_mtu);
+ break;
+ }
}
+ if (event == NETDEV_UNREGISTER)
+ unregister_netdevice_many(&list);
+
return NOTIFY_DONE;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 450/990] net: ena: Keep the RX buffer mapped if skb allocation fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (448 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 449/990] amt: tear down every amt device on an unregistering lower Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 451/990] net: ena: avoid RX copybreak for multi-descriptor packets Greg Kroah-Hartman
` (402 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Breno Leitao, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <leitao@debian.org>
[ Upstream commit 3e8e22a1007a6337ba2400b3ea87077947005c20 ]
We are seeing the following issue in production on arm64 EC2 hosts
(m8g.metal-24xl, 64K pages, SMMUv3 in strict mode, 6.18 based kernel).
Right after a global OOM, the SMMU reports F_TRANSLATION write faults
from the ENA device, followed by a burst of:
WARNING: CPU: 48 PID: 1656834 at drivers/iommu/dma-iommu.c:1242 iommu_dma_unmap_phys+0xf4/0x108
Call trace:
iommu_dma_unmap_phys+0xf4/0x108 (P)
dma_unmap_phys+0x194/0x2a8
dma_unmap_page_attrs+0x1c/0x38
ena_io_poll+0x7bc/0x1790 [ena]
__napi_poll+0x54/0x220
net_rx_action+0x250/0x520
ena_rx_skb() unmaps the RX buffer, or takes an extra page reference to
reuse it, before napi_build_skb() allocates the skb. If the allocation
fails, it returns NULL with rx_info->page still set. ena_clean_rx_irq()
then puts the req_id back on the free list, and ena_alloc_rx_buffer()
treats the buffer as still mapped and posts its old DMA address to the
device again.
With the IOMMU in strict mode, the device then writes to an unmapped
IOVA, and the next completion of that buffer unmaps it a second time.
If the IOVA was handed to a new mapping in between, the device can
write into that buffer instead. On the reuse path, the extra page
reference is never dropped.
Allocate the skb before touching rx_info, so that a failed allocation
leaves the buffer mapped and unchanged for the refill.
Fixes: 9e5269a915a8 ("net: ena: use build_skb() in RX path")
Fixes: f7d625adeb7b ("net: ena: Add dynamic recycling mechanism for rx buffers")
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20261109-ena-rx-skb-alloc-fail-v1-1-aee2927cb51f@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index e35eef9f6ce15..61bac152cf99a 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1009,6 +1009,10 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
buf_len = SKB_DATA_ALIGN(len + buf_offset + tailroom);
+ skb = ena_alloc_skb(rx_ring, buf_addr, buf_len);
+ if (unlikely(!skb))
+ return NULL;
+
/* If XDP isn't loaded try to reuse part of the RX buffer */
reuse_rx_buf_page = !is_xdp_loaded &&
ena_try_rx_buf_page_reuse(rx_info, buf_len, len, pkt_offset);
@@ -1016,10 +1020,6 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
if (!reuse_rx_buf_page)
ena_unmap_rx_buff_attrs(rx_ring, rx_info, DMA_ATTR_SKIP_CPU_SYNC);
- skb = ena_alloc_skb(rx_ring, buf_addr, buf_len);
- if (unlikely(!skb))
- return NULL;
-
/* Populate skb's linear part */
skb_reserve(skb, buf_offset);
skb_put(skb, len);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 451/990] net: ena: avoid RX copybreak for multi-descriptor packets
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (449 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 450/990] net: ena: Keep the RX buffer mapped if skb allocation fails Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 452/990] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK Greg Kroah-Hartman
` (401 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit f3c790c34d228d46c4a05fe5d001d1bbea444e2b ]
ena_rx_skb() selects the copybreak path based on the first RX
descriptor's length without checking the number of descriptors. When
a packet spans multiple descriptors, this copies only the first
buffer into the skb and fails to recycle the remaining request IDs,
while RX cleanup advances by the full descriptor count.
Restrict copybreak to single-descriptor packets and apply the same
restriction to the rx_copybreak_pkt statistic. Multi-descriptor
packets then use the existing fragment-processing path.
Discovered by comparing the in-tree ENA driver with Amazon's
standalone ENA driver.
Compiled with W=1 under x86_64 defconfig.
Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Link: https://patch.msgid.link/20261109141343.920187-2-thnkslprpt@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/amazon/ena/ena_netdev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 61bac152cf99a..f5b738ddb49ea 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -986,7 +986,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
page_offset = rx_info->page_offset;
buf_addr = page_address(rx_info->page) + page_offset;
- if (len <= rx_ring->rx_copybreak) {
+ if (len <= rx_ring->rx_copybreak && likely(descs == 1)) {
skb = ena_alloc_skb(rx_ring, NULL, len);
if (unlikely(!skb))
return NULL;
@@ -1293,7 +1293,8 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
skb_record_rx_queue(skb, rx_ring->qid);
- if (rx_ring->ena_bufs[0].len <= rx_ring->rx_copybreak)
+ if (rx_ring->ena_bufs[0].len <= rx_ring->rx_copybreak &&
+ ena_rx_ctx.descs == 1)
rx_copybreak_pkt++;
total_len += skb->len;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 452/990] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (450 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 451/990] net: ena: avoid RX copybreak for multi-descriptor packets Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 453/990] tls: fix async encryption race on weakly ordered architectures Greg Kroah-Hartman
` (400 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+9ea34da5ca6100593c90,
Kalpesh Solanki, Willem de Bruijn, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kalpesh Solanki <skalpesh942@gmail.com>
[ Upstream commit 968f2b94a5964b75d9c0da84523e42530c1891f0 ]
A userspace application can set the link type of a TUN/TAP interface
to ARPHRD_IEEE802154, ARPHRD_IEEE802154_MONITOR, or ARPHRD_6LOWPAN
via ioctl(fd, TUNSETLINK, arg) because tun_get_addr_len() explicitly
recognized these types.
However, TUN devices cannot function as genuine IEEE 802.15.4 or 6LoWPAN
interfaces:
1. They lack wpan_phy, channels, PAN IDs, and MLME operations, and tun
never initializes dev->ieee802154_ptr or dev->ml_priv. When an
unprivileged user creates a TUN interface in a user+net namespace,
changes its link type to ARPHRD_IEEE802154, and issues a netlink dump
request (such as IEEE802154_LLSEC_LIST_KEY),
ieee802154_llsec_dump_table() unconditionally dereferences
dev->ieee802154_ptr / ieee802154_mlme_ops(dev), triggering a supervisor
null-pointer dereference / general protection fault. Similar
dereferences occur across net/ieee802154/nl-phy.c (ieee802154_del_iface)
and net/ieee802154/socket.c.
2. Similarly, the 6LoWPAN subsystem assumes via lowpan_dev(dev) that
netdev_priv(dev) is struct lowpan_dev. On a TUN device, netdev_priv(dev)
is struct tun_struct. On netdev events (such as NETDEV_DOWN in
net/6lowpan/core.c:lowpan_device_event), it clears bits in
lowpan_dev(dev)->ctx.table flags, which corrupts private memory inside
tun_struct.
Rather than scattering checks across subsystems, fix the issue at the
source: disallow setting ARPHRD_IEEE802154, ARPHRD_IEEE802154_MONITOR, and
ARPHRD_6LOWPAN via TUNSETLINK by returning -EINVAL. Cast arg to unsigned
short in the comparison to prevent upper-bit truncation bypasses (e.g.
arg = ARPHRD_IEEE802154 | 0x10000).
Fixes: ff4cc3ac93e1 ("[TUNTAP]: Allow setting the linktype of the tap device from userspace")
Reported-by: syzbot+9ea34da5ca6100593c90@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9ea34da5ca6100593c90
Signed-off-by: Kalpesh Solanki <skalpesh942@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261109083037.22337-1-skalpesh942@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/tun.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d7780a0069218..b244ae7f4d5eb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3235,6 +3235,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
netif_info(tun, drv, tun->dev,
"Linktype set failed because interface is up\n");
ret = -EBUSY;
+ } else if ((unsigned short)arg == ARPHRD_IEEE802154 ||
+ (unsigned short)arg == ARPHRD_IEEE802154_MONITOR ||
+ (unsigned short)arg == ARPHRD_6LOWPAN) {
+ ret = -EINVAL;
} else {
ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
tun->dev);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 453/990] tls: fix async encryption race on weakly ordered architectures
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (451 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 452/990] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 454/990] net/mlx5: HWS, fix flow meter release on FTE update Greg Kroah-Hartman
` (399 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ofri Zangi, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ofri Zangi <ofriz@xsightlabs.com>
[ Upstream commit a2fd526d644233d6a892c28173f07c61e21e4c93 ]
With async encryption, a record can be transmitted without its TLS
header on weakly ordered architectures such as arm64, because the
consumer may observe rec->tx_ready set while still seeing the old
scatterlist entry.
tls_encrypt_done() restores the TLS header in the scatterlist entry
(sge->offset -= prot->prepend_size, sge->length += prot->prepend_size)
and then publishes the record with smp_store_mb(rec->tx_ready, true).
On another CPU, tls_tx_records() checks rec->tx_ready with READ_ONCE()
and then reads the entry in tls_push_sg().
Nothing orders these accesses. The barrier in smp_store_mb() comes
after the tx_ready store, so it does not order the earlier scatterlist
update before it. On the reader side, READ_ONCE() does not order the
later loads of sge->offset and sge->length. The reader can therefore
see tx_ready set together with the old offset and length, and pushes
the record without its header.
Publish tx_ready with smp_store_release() in tls_encrypt_done() and read
it with smp_load_acquire() in tls_tx_records(), so that observing
tx_ready guarantees the restored scatterlist entry is visible. Keep the
full barrier that smp_store_mb() provided as an explicit smp_mb(), as
it is still needed to order the tx_ready store before the tx_list head
check.
The issue was discovered during development on an arm64 system.
A curl download test over kTLS failed with:
curl: (56) OpenSSL SSL_read: error:0A00010B:SSL routines::wrong version number, errno 0
Fixes: a42055e8d2c3 ("net/tls: Add support for async encryption of records for performance")
Signed-off-by: Ofri Zangi <ofriz@xsightlabs.com>
Link: https://patch.msgid.link/20261108-tls-async-tx-ordering-v1-1-f9a1844ca88e@xsightlabs.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tls/tls_sw.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index ad6c0d61d5474..4f982594f11d3 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -436,7 +436,8 @@ int tls_tx_records(struct sock *sk, int flags)
/* Tx all ready records */
list_for_each_entry_safe(rec, tmp, &ctx->tx_list, list) {
- if (READ_ONCE(rec->tx_ready)) {
+ /* Pairs with smp_store_release() in tls_encrypt_done() */
+ if (smp_load_acquire(&rec->tx_ready)) {
if (flags == -1)
tx_flags = rec->tx_flags;
else
@@ -504,8 +505,14 @@ static void tls_encrypt_done(void *data, int err)
if (rec) {
struct tls_rec *first_rec;
- /* Mark the record as ready for transmission */
- smp_store_mb(rec->tx_ready, true);
+ /* Mark the record as ready for transmission. Pairs with
+ * smp_load_acquire() in tls_tx_records(): the sge
+ * offset/length update above must be visible before tx_ready.
+ */
+ smp_store_release(&rec->tx_ready, true);
+
+ /* Order the tx_ready store before the tx_list head check */
+ smp_mb();
/* If received record is at head of tx_list, schedule tx */
first_rec = list_first_entry(&ctx->tx_list,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 454/990] net/mlx5: HWS, fix flow meter release on FTE update
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (452 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 453/990] tls: fix async encryption race on weakly ordered architectures Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 455/990] drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05 Greg Kroah-Hartman
` (398 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexandre Cassen, Mark Bloch,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Cassen <acassen@corp.free.fr>
[ Upstream commit 145480b28ca82e9fae789427cc4569e596515a32 ]
HWS has no duplicate match. When a flower filter is replaced in place,
its new rule waits as the pending duplicate of the old FTE. Once the
old rule goes, switch_to_pending_act_dests() copies the pending actions
over the FTE before update_fte() releases the actions of the old rule.
An HWS rule reads the base id of its meter action through a pointer to
the exe_aso of the FTE. That release takes the meter action of the new
rule instead.
When the two meters sit in different ASO objects, the old meter action
leaks. It keeps its ASO object referenced. The firmware then fails to
destroy that object and to free the PD of the meters, and its STC is
still in the pool when the context closes. The new meter action is
destroyed one release early, while a rule still points to it, and the
last release underflows its refcount:
mlx5_core 0000:b1:00.1: mlx5_cmd_out_err:822:(pid 2641): DESTROY_GENERAL_OBJECT(0xa03) op_mod(0x24) failed, status bad resource(0x5), syndrome (0xeeda5c), err(-22)
refcount_t: underflow; use-after-free.
WARNING: lib/refcount.c:96 at refcount_dec_not_one+0x3f/0x60, CPU#43: tc/2641
Call Trace:
<TASK>
mlx5_fs_put_hws_action.part.0+0x1a/0xa0 [mlx5_core]
mlx5_fs_destroy_fs_actions+0xa8/0x110 [mlx5_core]
mlx5_cmd_hws_delete_fte+0x49/0x90 [mlx5_core]
del_hw_fte+0x209/0x320 [mlx5_core]
mlx5_del_flow_rules+0x10b/0x260 [mlx5_core]
__mlx5_eswitch_del_rule+0x5c/0x1b0 [mlx5_core]
mlx5_eswitch_del_offloaded_rule+0x10/0x20 [mlx5_core]
mlx5e_tc_rule_unoffload+0x4b/0x100 [mlx5_core]
mlx5e_tc_unoffload_fdb_rules+0x35/0x80 [mlx5_core]
mlx5e_tc_del_fdb_flow+0x2ca/0x310 [mlx5_core]
mlx5e_tc_del_flow+0x5d/0x2d0 [mlx5_core]
mlx5e_flow_put+0x3a/0x80 [mlx5_core]
mlx5e_delete_flower+0x291/0x460 [mlx5_core]
mlx5e_setup_tc_block_cb+0xc4/0x110 [mlx5_core]
tc_setup_cb_destroy+0xcc/0x1b0
fl_hw_destroy_filter+0xa1/0xe0 [cls_flower]
__fl_delete+0x2d0/0x3d0 [cls_flower]
fl_destroy+0xbd/0x160 [cls_flower]
tcf_proto_destroy+0x3b/0x110
tcf_proto_put+0x3d/0x70
tc_del_tfilter+0x362/0x8f0
rtnetlink_rcv_msg+0x384/0x460
netlink_rcv_skb+0x61/0x120
rtnetlink_rcv+0x15/0x30
netlink_unicast+0x2a1/0x3d0
netlink_sendmsg+0x237/0x490
____sys_sendmsg+0x33b/0x360
___sys_sendmsg+0x99/0xf0
__sys_sendmsg+0x93/0x100
__x64_sys_sendmsg+0x1d/0x30
x64_sys_call+0x821/0x23d0
do_syscall_64+0xba/0x550
entry_SYSCALL_64_after_hwframe+0x76/0x7e
</TASK>
mlx5_core 0000:b1:00.1: mlx5_cmd_out_err:822:(pid 2642): DEALLOC_PD(0x801) op_mod(0x0) failed, status bad resource state(0x9), syndrome (0xef0c8a), err(-22)
mlx5_core 0000:b1:00.1: mlx5hws_pool_destroy:386:(pid 2642): Attempting to destroy non-empty pool
Keep the base id in the rule action, as the sampler id is.
Discovered while stress testing a 5G UPF kernel code. Without this fix,
the reproduction below gives the trace above on a ConnectX-7 with
firmware 28.48.1000. It only uses tc and devlink, with no kernel
change. 129 meters cannot fit in one ASO object. DEV is the uplink
representor and PCI its devlink handle:
r() { echo "filter $1 dev $DEV ingress prio 1 handle $2 protocol ip flower skip_sw dst_ip 10.0.0.$2 action police index $3 rate 1mbit burst 32k conform-exceed drop/pipe action drop"; }
devlink dev param set $PCI name flow_steering_mode value hmfs cmode runtime
devlink dev eswitch set $PCI mode switchdev
tc qdisc add dev $DEV ingress
for i in $(seq 129); do r add $i $i; done | tc -b -
r replace 1 1000 | tc -b -
tc filter del dev $DEV ingress prio 1
devlink dev eswitch set $PCI mode legacy
With this fix, the reproduction runs clean on the same ConnectX-7.
It was not tested against kernel selftests.
Fixes: 82d3639ef7dc ("net/mlx5: fs, add support for flow meters HWS action")
Signed-off-by: Alexandre Cassen <acassen@corp.free.fr>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20261110173437.2471233-1-acassen@corp.free.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c | 8 ++++----
.../net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
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 6a5068ff013a7..7b677653be5bd 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
@@ -523,13 +523,13 @@ mlx5_fs_get_action_aso_meter(struct mlx5_fs_hws_context *fs_ctx,
}
static void mlx5_fs_put_action_aso_meter(struct mlx5_fs_hws_context *fs_ctx,
- struct mlx5_exe_aso *exe_aso)
+ u32 base_id)
{
struct mlx5_fs_hws_data *meter_hws_data;
struct xarray *meters_xa;
meters_xa = &fs_ctx->hws_pool.aso_meters;
- meter_hws_data = xa_load(meters_xa, exe_aso->base_id);
+ meter_hws_data = xa_load(meters_xa, base_id);
if (!meter_hws_data)
return;
return mlx5_fs_put_hws_action(meter_hws_data);
@@ -704,7 +704,7 @@ static void mlx5_fs_destroy_fs_action(struct mlx5_flow_root_namespace *ns,
mlx5_fc_put_hws_action(fs_action->counter);
break;
case MLX5HWS_ACTION_TYP_ASO_METER:
- mlx5_fs_put_action_aso_meter(fs_ctx, fs_action->exe_aso);
+ mlx5_fs_put_action_aso_meter(fs_ctx, fs_action->aso_base_id);
break;
case MLX5HWS_ACTION_TYP_SAMPLER:
mlx5_fs_put_dest_action_sampler(fs_ctx, fs_action->sampler_id);
@@ -939,7 +939,7 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_flow_root_namespace *ns,
fte_action->exe_aso.flow_meter.init_color;
(*ractions)[num_actions++].action = tmp_action;
fs_actions[num_fs_actions].action = tmp_action;
- fs_actions[num_fs_actions++].exe_aso = &fte_action->exe_aso;
+ fs_actions[num_fs_actions++].aso_base_id = fte_action->exe_aso.base_id;
}
if (fte_action->action & MLX5_FLOW_CONTEXT_ACTION_DROP) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
index 344c80112ab78..8f7730b50c07c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
@@ -57,7 +57,7 @@ struct mlx5_fs_hws_rule_action {
struct mlx5hws_action *action;
union {
struct mlx5_fc *counter;
- struct mlx5_exe_aso *exe_aso;
+ u32 aso_base_id;
u32 sampler_id;
};
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 455/990] drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (453 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 454/990] net/mlx5: HWS, fix flow meter release on FTE update Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 456/990] drm/xe/guc: Eliminate RPe caching for SLPC parameter handling Greg Kroah-Hartman
` (397 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shekhar Chauhan, Matt Roper,
Lucas De Marchi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shekhar Chauhan <shekhar.chauhan@intel.com>
[ Upstream commit 4fde66699f1ced2eeb6e58ff0eaf46e4fc92a7a0 ]
Add graphics IP versions 30.04 & 30.05 and initial workarounds for these
IP versions.
BSpec: 74201
Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20251016-xe3p-v3-1-3dd173a3097a@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_pci.c | 2 ++
drivers/gpu/drm/xe/xe_wa.c | 6 +++---
drivers/gpu/drm/xe/xe_wa_oob.rules | 9 +++++----
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 75334fc1ac66a..e907751e9e3a4 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -149,6 +149,8 @@ static const struct xe_ip graphics_ips[] = {
{ 3000, "Xe3_LPG", &graphics_xe2 },
{ 3001, "Xe3_LPG", &graphics_xe2 },
{ 3003, "Xe3_LPG", &graphics_xe2 },
+ { 3004, "Xe3_LPG", &graphics_xe2 },
+ { 3005, "Xe3_LPG", &graphics_xe2 },
};
/* Pre-GMDID Media IPs */
diff --git a/drivers/gpu/drm/xe/xe_wa.c b/drivers/gpu/drm/xe/xe_wa.c
index 51c5985830b17..e4810821d4813 100644
--- a/drivers/gpu/drm/xe/xe_wa.c
+++ b/drivers/gpu/drm/xe/xe_wa.c
@@ -675,7 +675,7 @@ static const struct xe_rtp_entry_sr engine_was[] = {
},
{ XE_RTP_NAME("13012615864"),
XE_RTP_RULES(GRAPHICS_VERSION_RANGE(3000, 3001), OR,
- GRAPHICS_VERSION(3003),
+ GRAPHICS_VERSION_RANGE(3003, 3005),
FUNC(xe_rtp_match_first_render_or_compute)),
XE_RTP_ACTIONS(SET(TDL_TSL_CHICKEN, RES_CHK_SPR_DIS))
},
@@ -686,7 +686,7 @@ static const struct xe_rtp_entry_sr engine_was[] = {
XE_RTP_ACTION_FLAG(ENGINE_BASE)))
},
{ XE_RTP_NAME("14021402888"),
- XE_RTP_RULES(GRAPHICS_VERSION(3003), FUNC(xe_rtp_match_first_render_or_compute)),
+ XE_RTP_RULES(GRAPHICS_VERSION_RANGE(3003, 3005), FUNC(xe_rtp_match_first_render_or_compute)),
XE_RTP_ACTIONS(SET(HALF_SLICE_CHICKEN7, CLEAR_OPTIMIZATION_DISABLE))
},
{ XE_RTP_NAME("18041344222"),
@@ -912,7 +912,7 @@ static const struct xe_rtp_entry_sr lrc_was[] = {
DIS_AUTOSTRIP))
},
{ XE_RTP_NAME("22021007897"),
- XE_RTP_RULES(GRAPHICS_VERSION_RANGE(3000, 3003), ENGINE_CLASS(RENDER)),
+ XE_RTP_RULES(GRAPHICS_VERSION_RANGE(3000, 3005), ENGINE_CLASS(RENDER)),
XE_RTP_ACTIONS(SET(COMMON_SLICE_CHICKEN4, SBE_PUSH_CONSTANT_BEHIND_FIX_ENABLE))
},
{ XE_RTP_NAME("14024681466"),
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index 1d32fa1c3b2d7..31b5062585eb3 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -34,14 +34,15 @@
13011645652 GRAPHICS_VERSION(2004)
GRAPHICS_VERSION_RANGE(3000, 3001)
GRAPHICS_VERSION(3003)
+ GRAPHICS_VERSION_RANGE(3004, 3005)
14022293748 GRAPHICS_VERSION_RANGE(2001, 2002)
GRAPHICS_VERSION(2004)
- GRAPHICS_VERSION_RANGE(3000, 3001)
- GRAPHICS_VERSION(3003)
+ GRAPHICS_VERSION_RANGE(3000, 3005)
22019794406 GRAPHICS_VERSION_RANGE(2001, 2002)
GRAPHICS_VERSION(2004)
GRAPHICS_VERSION_RANGE(3000, 3001)
GRAPHICS_VERSION(3003)
+ GRAPHICS_VERSION_RANGE(3004, 3005)
22019338487 MEDIA_VERSION(2000)
GRAPHICS_VERSION(2001), FUNC(xe_rtp_match_not_sriov_vf)
MEDIA_VERSION(3000), MEDIA_STEP(A0, B0), FUNC(xe_rtp_match_not_sriov_vf)
@@ -63,11 +64,11 @@
16023105232 GRAPHICS_VERSION_RANGE(2001, 3001)
MEDIA_VERSION_RANGE(1301, 3000)
MEDIA_VERSION(3002)
- GRAPHICS_VERSION(3003)
+ GRAPHICS_VERSION_RANGE(3003, 3005)
16026508708 GRAPHICS_VERSION_RANGE(1200, 3001)
MEDIA_VERSION_RANGE(1300, 3000)
MEDIA_VERSION(3002)
- GRAPHICS_VERSION(3003)
+ GRAPHICS_VERSION_RANGE(3003, 3005)
14020001231 GRAPHICS_VERSION_RANGE(2001,2004), FUNC(xe_rtp_match_psmi_enabled)
MEDIA_VERSION(2000), FUNC(xe_rtp_match_psmi_enabled)
MEDIA_VERSION(3000), FUNC(xe_rtp_match_psmi_enabled)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 456/990] drm/xe/guc: Eliminate RPe caching for SLPC parameter handling
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (454 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 455/990] drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05 Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 457/990] drm/xe/forcewake: Add scope-based cleanup for forcewake Greg Kroah-Hartman
` (396 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sk Anirban, Vinay Belgaumkar,
Rodrigo Vivi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sk Anirban <sk.anirban@intel.com>
[ Upstream commit 2917e17b5fd25447a702e79f4ecba3e3b3e08d58 ]
RPe is runtime-determined by PCODE and caching it caused stale values,
leading to incorrect GuC SLPC parameter settings.
Drop the cached rpe_freq field and query fresh values from hardware
on each use to ensure GuC SLPC parameters reflect current RPe.
v2: Remove cached RPe frequency field (Rodrigo)
v3: Remove extra variable (Vinay)
Modify function name (Vinay)
v4: Maintain a separate function for PVC (Rodrigo)
v5: Avoid RPn update while fetching RPe frequency (Rodrigo)
v6: Split platform-specific RPe comments (Vinay)
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/5166
Signed-off-by: Sk Anirban <sk.anirban@intel.com>
Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Link: https://patch.msgid.link/20251112185153.3593145-5-sk.anirban@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_guc_pc.c | 61 +++++++++++++++-------------
drivers/gpu/drm/xe/xe_guc_pc_types.h | 2 -
2 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index a3e9796e6430f..e41d97263eb62 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -348,7 +348,7 @@ static int pc_set_min_freq(struct xe_guc_pc *pc, u32 freq)
* Our goal is to have the admin choices respected.
*/
pc_action_set_param(pc, SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY,
- freq < pc->rpe_freq);
+ freq < xe_guc_pc_get_rpe_freq(pc));
return pc_action_set_param(pc,
SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
@@ -393,7 +393,7 @@ static void mtl_update_rpa_value(struct xe_guc_pc *pc)
pc->rpa_freq = decode_freq(REG_FIELD_GET(MTL_RPA_MASK, reg));
}
-static void mtl_update_rpe_value(struct xe_guc_pc *pc)
+static u32 mtl_get_rpe_freq(struct xe_guc_pc *pc)
{
struct xe_gt *gt = pc_to_gt(pc);
u32 reg;
@@ -403,7 +403,7 @@ static void mtl_update_rpe_value(struct xe_guc_pc *pc)
else
reg = xe_mmio_read32(>->mmio, MTL_GT_RPE_FREQUENCY);
- pc->rpe_freq = decode_freq(REG_FIELD_GET(MTL_RPE_MASK, reg));
+ return decode_freq(REG_FIELD_GET(MTL_RPE_MASK, reg));
}
static void tgl_update_rpa_value(struct xe_guc_pc *pc)
@@ -426,24 +426,29 @@ static void tgl_update_rpa_value(struct xe_guc_pc *pc)
}
}
-static void tgl_update_rpe_value(struct xe_guc_pc *pc)
+static u32 pvc_get_rpe_freq(struct xe_guc_pc *pc)
{
struct xe_gt *gt = pc_to_gt(pc);
- struct xe_device *xe = gt_to_xe(gt);
u32 reg;
/*
* For PVC we still need to use fused RP1 as the approximation for RPe
- * For other platforms than PVC we get the resolved RPe directly from
+ */
+ reg = xe_mmio_read32(>->mmio, PVC_RP_STATE_CAP);
+ return REG_FIELD_GET(RP1_MASK, reg) * GT_FREQUENCY_MULTIPLIER;
+}
+
+static u32 tgl_get_rpe_freq(struct xe_guc_pc *pc)
+{
+ struct xe_gt *gt = pc_to_gt(pc);
+ u32 reg;
+
+ /*
+ * For other platforms than PVC, we get the resolved RPe directly from
* PCODE at a different register
*/
- if (xe->info.platform == XE_PVC) {
- reg = xe_mmio_read32(>->mmio, PVC_RP_STATE_CAP);
- pc->rpe_freq = REG_FIELD_GET(RP1_MASK, reg) * GT_FREQUENCY_MULTIPLIER;
- } else {
- reg = xe_mmio_read32(>->mmio, FREQ_INFO_REC);
- pc->rpe_freq = REG_FIELD_GET(RPE_MASK, reg) * GT_FREQUENCY_MULTIPLIER;
- }
+ reg = xe_mmio_read32(>->mmio, FREQ_INFO_REC);
+ return REG_FIELD_GET(RPE_MASK, reg) * GT_FREQUENCY_MULTIPLIER;
}
static void pc_update_rp_values(struct xe_guc_pc *pc)
@@ -451,20 +456,10 @@ static void pc_update_rp_values(struct xe_guc_pc *pc)
struct xe_gt *gt = pc_to_gt(pc);
struct xe_device *xe = gt_to_xe(gt);
- if (GRAPHICS_VERx100(xe) >= 1270) {
+ if (GRAPHICS_VERx100(xe) >= 1270)
mtl_update_rpa_value(pc);
- mtl_update_rpe_value(pc);
- } else {
+ else
tgl_update_rpa_value(pc);
- tgl_update_rpe_value(pc);
- }
-
- /*
- * RPe is decided at runtime by PCODE. In the rare case where that's
- * smaller than the fused min, we will trust the PCODE and use that
- * as our minimum one.
- */
- pc->rpn_freq = min(pc->rpn_freq, pc->rpe_freq);
}
/**
@@ -578,9 +573,17 @@ u32 xe_guc_pc_get_rpa_freq(struct xe_guc_pc *pc)
*/
u32 xe_guc_pc_get_rpe_freq(struct xe_guc_pc *pc)
{
- pc_update_rp_values(pc);
+ struct xe_device *xe = pc_to_xe(pc);
+ u32 freq;
- return pc->rpe_freq;
+ if (GRAPHICS_VERx100(xe) == 1260)
+ freq = pvc_get_rpe_freq(pc);
+ else if (GRAPHICS_VERx100(xe) >= 1270)
+ freq = mtl_get_rpe_freq(pc);
+ else
+ freq = tgl_get_rpe_freq(pc);
+
+ return freq;
}
/**
@@ -1039,7 +1042,7 @@ static int pc_set_mert_freq_cap(struct xe_guc_pc *pc)
/*
* Ensure min and max are bound by MERT_FREQ_CAP until driver loads.
*/
- ret = pc_set_min_freq(pc, min(pc->rpe_freq, pc_max_freq_cap(pc)));
+ ret = pc_set_min_freq(pc, min(xe_guc_pc_get_rpe_freq(pc), pc_max_freq_cap(pc)));
if (!ret)
ret = pc_set_max_freq(pc, min(pc->rp0_freq, pc_max_freq_cap(pc)));
@@ -1391,7 +1394,7 @@ static void xe_guc_pc_fini_hw(void *arg)
XE_WARN_ON(xe_guc_pc_stop(pc));
/* Bind requested freq to mert_freq_cap before unload */
- pc_set_cur_freq(pc, min(pc_max_freq_cap(pc), pc->rpe_freq));
+ pc_set_cur_freq(pc, min(pc_max_freq_cap(pc), xe_guc_pc_get_rpe_freq(pc)));
xe_force_wake_put(gt_to_fw(pc_to_gt(pc)), fw_ref);
}
diff --git a/drivers/gpu/drm/xe/xe_guc_pc_types.h b/drivers/gpu/drm/xe/xe_guc_pc_types.h
index 5e4ea53fbee6e..f27c05d817065 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc_types.h
+++ b/drivers/gpu/drm/xe/xe_guc_pc_types.h
@@ -21,8 +21,6 @@ struct xe_guc_pc {
u32 rp0_freq;
/** @rpa_freq: HW RPa frequency - The Achievable one */
u32 rpa_freq;
- /** @rpe_freq: HW RPe frequency - The Efficient one */
- u32 rpe_freq;
/** @rpn_freq: HW RPN frequency - The Minimum one */
u32 rpn_freq;
/** @user_requested_min: Stash the minimum requested freq by user */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 457/990] drm/xe/forcewake: Add scope-based cleanup for forcewake
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (455 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 456/990] drm/xe/guc: Eliminate RPe caching for SLPC parameter handling Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 458/990] drm/xe/guc_pc: Use scope-based cleanup Greg Kroah-Hartman
` (395 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Michal Wajdeczko, Gustavo Sousa,
Matt Roper, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Roper <matthew.d.roper@intel.com>
[ Upstream commit 074edfbdfba25493324807f749fbc86bf0af3a2d ]
Since forcewake uses a reference counting get/put model, there are many
places where we need to be careful to drop the forcewake reference when
bailing out of a function early on an error path. Add scope-based
cleanup options that can be used in place of explicit get/put to help
prevent mistakes in this area.
Examples:
CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
Obtain forcewake on the XE_FW_GT domain and hold it until the
end of the current block. The wakeref will be dropped
automatically when the current scope is exited by any means
(return, break, reaching the end of the block, etc.).
xe_with_force_wake(fw_ref, gt_to_fw(ss->gt), XE_FORCEWAKE_ALL) {
...
}
Hold all forcewake domains for the following block. As with the
CLASS usage, forcewake will be dropped automatically when the
block is exited by any means.
Use of these cleanup helpers should allow us to remove some ugly
goto-based error handling and help avoid mistakes in functions with lots
of early error exits.
An 'xe_force_wake_release_only' class is also added for cases where a
forcewake reference is passed in from another function and the current
function is responsible for releasing it in every flow and error path.
v2:
- Create a separate constructor that just wraps xe_force_wake_get for
use in the class. This eliminates the need to update the signature
of xe_force_wake_get(). (Michal)
v3:
- Wrap xe_with_force_wake's 'done' marker in __UNIQUE_ID. (Gustavo)
- Add a note to xe_force_wake_get()'s kerneldoc explaining that
scope-based cleanup is preferred when possible. (Gustavo)
- Add an xe_force_wake_release_only class. (Gustavo)
v4:
- Add NULL check on fw in release_only variant. (Gustavo)
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20251118164338.3572146-30-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_force_wake.c | 7 ++++++
drivers/gpu/drm/xe/xe_force_wake.h | 40 ++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_force_wake.c b/drivers/gpu/drm/xe/xe_force_wake.c
index c59a9b330697d..76e054f314ee1 100644
--- a/drivers/gpu/drm/xe/xe_force_wake.c
+++ b/drivers/gpu/drm/xe/xe_force_wake.c
@@ -166,6 +166,13 @@ static int domain_sleep_wait(struct xe_gt *gt,
* xe_force_wake_ref_has_domain() function. Caller must call
* xe_force_wake_put() function to decrease incremented refcounts.
*
+ * When possible, scope-based forcewake (through CLASS(xe_force_wake, ...) or
+ * xe_with_force_wake()) should be used instead of direct calls to this
+ * function. Direct usage of get/put should only be used when the function
+ * has goto-based flows that can interfere with scope-based cleanup, or when
+ * the lifetime of the forcewake reference does not match a specific scope
+ * (e.g., forcewake obtained in one function and released in a different one).
+ *
* Return: opaque reference to woken domains or zero if none of requested
* domains were awake.
*/
diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
index 0e3e84bfa51c3..1e2198f6a0078 100644
--- a/drivers/gpu/drm/xe/xe_force_wake.h
+++ b/drivers/gpu/drm/xe/xe_force_wake.h
@@ -61,4 +61,44 @@ xe_force_wake_ref_has_domain(unsigned int fw_ref, enum xe_force_wake_domains dom
return fw_ref & domain;
}
+struct xe_force_wake_ref {
+ struct xe_force_wake *fw;
+ unsigned int domains;
+};
+
+static struct xe_force_wake_ref
+xe_force_wake_constructor(struct xe_force_wake *fw, unsigned int domains)
+{
+ struct xe_force_wake_ref fw_ref = { .fw = fw };
+
+ fw_ref.domains = xe_force_wake_get(fw, domains);
+
+ return fw_ref;
+}
+
+DEFINE_CLASS(xe_force_wake, struct xe_force_wake_ref,
+ xe_force_wake_put(_T.fw, _T.domains),
+ xe_force_wake_constructor(fw, domains),
+ struct xe_force_wake *fw, unsigned int domains);
+
+/*
+ * Scoped helper for the forcewake class, using the same trick as scoped_guard()
+ * to bind the lifetime to the next statement/block.
+ */
+#define __xe_with_force_wake(ref, fw, domains, done) \
+ for (CLASS(xe_force_wake, ref)(fw, domains), *(done) = NULL; \
+ !(done); (done) = (void *)1)
+
+#define xe_with_force_wake(ref, fw, domains) \
+ __xe_with_force_wake(ref, fw, domains, __UNIQUE_ID(done))
+
+/*
+ * Used when xe_force_wake_constructor() has already been called by another
+ * function and the current function is responsible for releasing the forcewake
+ * reference in all possible cases and error paths.
+ */
+DEFINE_CLASS(xe_force_wake_release_only, struct xe_force_wake_ref,
+ if (_T.fw) xe_force_wake_put(_T.fw, _T.domains), fw_ref,
+ struct xe_force_wake_ref fw_ref);
+
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 458/990] drm/xe/guc_pc: Use scope-based cleanup
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (456 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 457/990] drm/xe/forcewake: Add scope-based cleanup for forcewake Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 459/990] drm/xe: Decouple GuC RC code from xe_guc_pc Greg Kroah-Hartman
` (394 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Gustavo Sousa, Matt Roper,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Roper <matthew.d.roper@intel.com>
[ Upstream commit e9bc4162bf39154c1eb8d5edb11a00fc30771c39 ]
Use scope-based cleanup for forcewake and runtime PM in the GuC PC code.
This allows us to eliminate to goto-based cleanup and simplifies some
other functions.
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20251118164338.3572146-35-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_guc_pc.c | 62 ++++++++++------------------------
1 file changed, 17 insertions(+), 45 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index e41d97263eb62..994675336f04c 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -523,21 +523,17 @@ u32 xe_guc_pc_get_cur_freq_fw(struct xe_guc_pc *pc)
int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq)
{
struct xe_gt *gt = pc_to_gt(pc);
- unsigned int fw_ref;
/*
* GuC SLPC plays with cur freq request when GuCRC is enabled
* Block RC6 for a more reliable read.
*/
- fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
- if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {
- xe_force_wake_put(gt_to_fw(gt), fw_ref);
+ CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
+ if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FW_GT))
return -ETIMEDOUT;
- }
*freq = get_cur_freq(gt);
- xe_force_wake_put(gt_to_fw(gt), fw_ref);
return 0;
}
@@ -1105,13 +1101,8 @@ int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)
*/
int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode)
{
- int ret;
-
- xe_pm_runtime_get(pc_to_xe(pc));
- ret = pc_action_set_param(pc, SLPC_PARAM_PWRGATE_RC_MODE, mode);
- xe_pm_runtime_put(pc_to_xe(pc));
-
- return ret;
+ guard(xe_pm_runtime)(pc_to_xe(pc));
+ return pc_action_set_param(pc, SLPC_PARAM_PWRGATE_RC_MODE, mode);
}
/**
@@ -1122,13 +1113,8 @@ int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mod
*/
int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc)
{
- int ret;
-
- xe_pm_runtime_get(pc_to_xe(pc));
- ret = pc_action_unset_param(pc, SLPC_PARAM_PWRGATE_RC_MODE);
- xe_pm_runtime_put(pc_to_xe(pc));
-
- return ret;
+ guard(xe_pm_runtime)(pc_to_xe(pc));
+ return pc_action_unset_param(pc, SLPC_PARAM_PWRGATE_RC_MODE);
}
static void pc_init_pcode_freq(struct xe_guc_pc *pc)
@@ -1218,7 +1204,7 @@ int xe_guc_pc_set_power_profile(struct xe_guc_pc *pc, const char *buf)
return -EINVAL;
guard(mutex)(&pc->freq_lock);
- xe_pm_runtime_get_noresume(pc_to_xe(pc));
+ guard(xe_pm_runtime_noresume)(pc_to_xe(pc));
ret = pc_action_set_param(pc,
SLPC_PARAM_POWER_PROFILE,
@@ -1229,8 +1215,6 @@ int xe_guc_pc_set_power_profile(struct xe_guc_pc *pc, const char *buf)
else
pc->power_profile = val;
- xe_pm_runtime_put(pc_to_xe(pc));
-
return ret;
}
@@ -1273,17 +1257,14 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
struct xe_device *xe = pc_to_xe(pc);
struct xe_gt *gt = pc_to_gt(pc);
u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));
- unsigned int fw_ref;
ktime_t earlier;
int ret;
xe_gt_assert(gt, xe_device_uc_enabled(xe));
- fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
- if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {
- xe_force_wake_put(gt_to_fw(gt), fw_ref);
+ CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
+ if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FW_GT))
return -ETIMEDOUT;
- }
if (xe->info.skip_guc_pc) {
if (xe->info.platform != XE_PVC)
@@ -1291,9 +1272,7 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
/* Request max possible since dynamic freq mgmt is not enabled */
pc_set_cur_freq(pc, UINT_MAX);
-
- ret = 0;
- goto out;
+ return 0;
}
xe_map_memset(xe, &pc->bo->vmap, 0, 0, size);
@@ -1302,7 +1281,7 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
earlier = ktime_get();
ret = pc_action_reset(pc);
if (ret)
- goto out;
+ return ret;
if (wait_for_pc_state(pc, SLPC_GLOBAL_STATE_RUNNING,
SLPC_RESET_TIMEOUT_MS)) {
@@ -1313,8 +1292,7 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
if (wait_for_pc_state(pc, SLPC_GLOBAL_STATE_RUNNING,
SLPC_RESET_EXTENDED_TIMEOUT_MS)) {
xe_gt_err(gt, "GuC PC Start failed: Dynamic GT frequency control and GT sleep states are now disabled.\n");
- ret = -EIO;
- goto out;
+ return -EIO;
}
xe_gt_warn(gt, "GuC PC excessive start time: %lldms",
@@ -1327,21 +1305,20 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
ret = pc_init_freqs(pc);
if (ret)
- goto out;
+ return ret;
ret = pc_set_mert_freq_cap(pc);
if (ret)
- goto out;
+ return ret;
if (xe->info.platform == XE_PVC) {
xe_guc_pc_gucrc_disable(pc);
- ret = 0;
- goto out;
+ return 0;
}
ret = pc_action_setup_gucrc(pc, GUCRC_FIRMWARE_CONTROL);
if (ret)
- goto out;
+ return ret;
/* Enable SLPC Optimized Strategy for compute */
ret = pc_action_set_strategy(pc, SLPC_OPTIMIZED_STRATEGY_COMPUTE);
@@ -1351,8 +1328,6 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
if (unlikely(ret))
xe_gt_err(gt, "Failed to set SLPC power profile: %pe\n", ERR_PTR(ret));
-out:
- xe_force_wake_put(gt_to_fw(gt), fw_ref);
return ret;
}
@@ -1384,19 +1359,16 @@ static void xe_guc_pc_fini_hw(void *arg)
{
struct xe_guc_pc *pc = arg;
struct xe_device *xe = pc_to_xe(pc);
- unsigned int fw_ref;
if (xe_device_wedged(xe))
return;
- fw_ref = xe_force_wake_get(gt_to_fw(pc_to_gt(pc)), XE_FORCEWAKE_ALL);
+ CLASS(xe_force_wake, fw_ref)(gt_to_fw(pc_to_gt(pc)), XE_FORCEWAKE_ALL);
xe_guc_pc_gucrc_disable(pc);
XE_WARN_ON(xe_guc_pc_stop(pc));
/* Bind requested freq to mert_freq_cap before unload */
pc_set_cur_freq(pc, min(pc_max_freq_cap(pc), xe_guc_pc_get_rpe_freq(pc)));
-
- xe_force_wake_put(gt_to_fw(pc_to_gt(pc)), fw_ref);
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 459/990] drm/xe: Decouple GuC RC code from xe_guc_pc
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (457 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 458/990] drm/xe/guc_pc: Use scope-based cleanup Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 460/990] drm/xe: Add a wrapper for SLPC set/unset params Greg Kroah-Hartman
` (393 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Riana Tauro, Michal Wajdeczko,
Vinay Belgaumkar, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
[ Upstream commit 40a684f91d267164f9adf0d35b572b4cad0b8d3c ]
Move enable/disable GuC RC logic into the new file. This will
allow us to independently enable/disable GuC RC and not rely
on SLPC related functions. GuC already provides separate H2G
interfaces to setup GuC RC and SLPC.
Cc: Riana Tauro <riana.tauro@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Link: https://patch.msgid.link/20260204014234.2867763-2-vinay.belgaumkar@intel.com
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/gpu/xe/xe_firmware.rst | 3 +
drivers/gpu/drm/xe/Makefile | 1 +
drivers/gpu/drm/xe/xe_gt.c | 1 -
drivers/gpu/drm/xe/xe_guc.c | 6 ++
drivers/gpu/drm/xe/xe_guc_pc.c | 68 +++-----------
drivers/gpu/drm/xe/xe_guc_pc.h | 1 -
drivers/gpu/drm/xe/xe_guc_rc.c | 130 +++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_guc_rc.h | 15 ++++
drivers/gpu/drm/xe/xe_uc.c | 10 +--
drivers/gpu/drm/xe/xe_uc.h | 1 -
10 files changed, 172 insertions(+), 64 deletions(-)
create mode 100644 drivers/gpu/drm/xe/xe_guc_rc.c
create mode 100644 drivers/gpu/drm/xe/xe_guc_rc.h
diff --git a/Documentation/gpu/xe/xe_firmware.rst b/Documentation/gpu/xe/xe_firmware.rst
index 5d23e9f273914..9c15a300bc625 100644
--- a/Documentation/gpu/xe/xe_firmware.rst
+++ b/Documentation/gpu/xe/xe_firmware.rst
@@ -31,6 +31,9 @@ GuC Power Conservation (PC)
.. kernel-doc:: drivers/gpu/drm/xe/xe_guc_pc.c
:doc: GuC Power Conservation (PC)
+.. kernel-doc:: drivers/gpu/drm/xe/xe_guc_rc.c
+ :doc: GuC Render C-states (GuC RC)
+
PCIe Gen5 Limitations
=====================
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index c5fc8cc71149c..57346b1085c7a 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -74,6 +74,7 @@ xe-y += xe_bb.o \
xe_guc_klv_helpers.o \
xe_guc_log.o \
xe_guc_pc.o \
+ xe_guc_rc.o \
xe_guc_submit.o \
xe_guc_tlb_inval.o \
xe_heci_gsc.o \
diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index 1099335298471..c276a5fbb43ed 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -889,7 +889,6 @@ static int gt_reset(struct xe_gt *gt)
if (IS_SRIOV_PF(gt_to_xe(gt)))
xe_gt_sriov_pf_stop_prepare(gt);
- xe_uc_gucrc_disable(>->uc);
xe_uc_stop_prepare(>->uc);
xe_gt_pagefault_reset(gt);
diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index ae0c88da422b2..5a8244633b67f 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -33,6 +33,7 @@
#include "xe_guc_klv_helpers.h"
#include "xe_guc_log.h"
#include "xe_guc_pc.h"
+#include "xe_guc_rc.h"
#include "xe_guc_relay.h"
#include "xe_guc_submit.h"
#include "xe_memirq.h"
@@ -852,6 +853,10 @@ int xe_guc_init_post_hwconfig(struct xe_guc *guc)
if (ret)
return ret;
+ ret = xe_guc_rc_init(guc);
+ if (ret)
+ return ret;
+
ret = xe_guc_engine_activity_init(guc);
if (ret)
return ret;
@@ -1614,6 +1619,7 @@ void xe_guc_stop_prepare(struct xe_guc *guc)
if (!IS_SRIOV_VF(guc_to_xe(guc))) {
int err;
+ xe_guc_rc_disable(guc);
err = xe_guc_pc_stop(&guc->pc);
xe_gt_WARN(guc_to_gt(guc), err, "Failed to stop GuC PC: %pe\n",
ERR_PTR(err));
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 994675336f04c..47281c46f0631 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -90,6 +90,17 @@
* Render-C states is also a GuC PC feature that is now enabled in Xe for
* all platforms.
*
+ * Implementation details:
+ * -----------------------
+ * The implementation for GuC Power Management features is split as follows:
+ *
+ * xe_guc_rc: Logic for handling GuC RC
+ * xe_gt_idle: Host side logic for RC6 and Coarse Power gating (CPG)
+ * xe_guc_pc: Logic for all other SLPC related features
+ *
+ * There is some cross interaction between these where host C6 will need to be
+ * enabled when we plan to skip GuC RC. Also, the GuC RC mode is currently
+ * overridden through 0x3003 which is an SLPC H2G call.
*/
static struct xe_guc *pc_to_guc(struct xe_guc_pc *pc)
@@ -270,22 +281,6 @@ static int pc_action_unset_param(struct xe_guc_pc *pc, u8 id)
return ret;
}
-static int pc_action_setup_gucrc(struct xe_guc_pc *pc, u32 mode)
-{
- struct xe_guc_ct *ct = pc_to_ct(pc);
- u32 action[] = {
- GUC_ACTION_HOST2GUC_SETUP_PC_GUCRC,
- mode,
- };
- int ret;
-
- ret = xe_guc_ct_send(ct, action, ARRAY_SIZE(action), 0, 0);
- if (ret && !(xe_device_wedged(pc_to_xe(pc)) && ret == -ECANCELED))
- xe_gt_err(pc_to_gt(pc), "GuC RC enable mode=%u failed: %pe\n",
- mode, ERR_PTR(ret));
- return ret;
-}
-
static u32 decode_freq(u32 raw)
{
return DIV_ROUND_CLOSEST(raw * GT_FREQUENCY_MULTIPLIER,
@@ -1068,30 +1063,6 @@ int xe_guc_pc_restore_stashed_freq(struct xe_guc_pc *pc)
return ret;
}
-/**
- * xe_guc_pc_gucrc_disable - Disable GuC RC
- * @pc: Xe_GuC_PC instance
- *
- * Disables GuC RC by taking control of RC6 back from GuC.
- *
- * Return: 0 on success, negative error code on error.
- */
-int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)
-{
- struct xe_device *xe = pc_to_xe(pc);
- struct xe_gt *gt = pc_to_gt(pc);
- int ret = 0;
-
- if (xe->info.skip_guc_pc)
- return 0;
-
- ret = pc_action_setup_gucrc(pc, GUCRC_HOST_CONTROL);
- if (ret)
- return ret;
-
- return xe_gt_idle_disable_c6(gt);
-}
-
/**
* xe_guc_pc_override_gucrc_mode - override GUCRC mode
* @pc: Xe_GuC_PC instance
@@ -1267,9 +1238,6 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
return -ETIMEDOUT;
if (xe->info.skip_guc_pc) {
- if (xe->info.platform != XE_PVC)
- xe_gt_idle_enable_c6(gt);
-
/* Request max possible since dynamic freq mgmt is not enabled */
pc_set_cur_freq(pc, UINT_MAX);
return 0;
@@ -1311,15 +1279,6 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
if (ret)
return ret;
- if (xe->info.platform == XE_PVC) {
- xe_guc_pc_gucrc_disable(pc);
- return 0;
- }
-
- ret = pc_action_setup_gucrc(pc, GUCRC_FIRMWARE_CONTROL);
- if (ret)
- return ret;
-
/* Enable SLPC Optimized Strategy for compute */
ret = pc_action_set_strategy(pc, SLPC_OPTIMIZED_STRATEGY_COMPUTE);
@@ -1339,10 +1298,8 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc)
{
struct xe_device *xe = pc_to_xe(pc);
- if (xe->info.skip_guc_pc) {
- xe_gt_idle_disable_c6(pc_to_gt(pc));
+ if (xe->info.skip_guc_pc)
return 0;
- }
mutex_lock(&pc->freq_lock);
pc->freq_ready = false;
@@ -1364,7 +1321,6 @@ static void xe_guc_pc_fini_hw(void *arg)
return;
CLASS(xe_force_wake, fw_ref)(gt_to_fw(pc_to_gt(pc)), XE_FORCEWAKE_ALL);
- xe_guc_pc_gucrc_disable(pc);
XE_WARN_ON(xe_guc_pc_stop(pc));
/* Bind requested freq to mert_freq_cap before unload */
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.h b/drivers/gpu/drm/xe/xe_guc_pc.h
index 0e31396f103cd..1b95873b262e3 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.h
+++ b/drivers/gpu/drm/xe/xe_guc_pc.h
@@ -15,7 +15,6 @@ struct drm_printer;
int xe_guc_pc_init(struct xe_guc_pc *pc);
int xe_guc_pc_start(struct xe_guc_pc *pc);
int xe_guc_pc_stop(struct xe_guc_pc *pc);
-int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc);
int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode);
int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc);
void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p);
diff --git a/drivers/gpu/drm/xe/xe_guc_rc.c b/drivers/gpu/drm/xe/xe_guc_rc.c
new file mode 100644
index 0000000000000..6c4591e712d9d
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_guc_rc.c
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#include <drm/drm_print.h>
+
+#include "abi/guc_actions_slpc_abi.h"
+#include "xe_device.h"
+#include "xe_force_wake.h"
+#include "xe_gt.h"
+#include "xe_gt_idle.h"
+#include "xe_gt_printk.h"
+#include "xe_guc.h"
+#include "xe_guc_ct.h"
+#include "xe_guc_rc.h"
+#include "xe_pm.h"
+
+/**
+ * DOC: GuC RC (Render C-states)
+ *
+ * GuC handles the GT transition to deeper C-states in conjunction with Pcode.
+ * GuC RC can be enabled independently of the frequency component in SLPC,
+ * which is also controlled by GuC.
+ *
+ * This file will contain all H2G related logic for handling Render C-states.
+ * There are some calls to xe_gt_idle, where we enable host C6 when GuC RC is
+ * skipped. GuC RC is mostly independent of xe_guc_pc with the exception of
+ * functions that override the mode for which we have to rely on the SLPC H2G
+ * calls.
+ */
+
+static int guc_action_setup_gucrc(struct xe_guc *guc, u32 control)
+{
+ u32 action[] = {
+ GUC_ACTION_HOST2GUC_SETUP_PC_GUCRC,
+ control,
+ };
+ int ret;
+
+ ret = xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action), 0, 0);
+ if (ret && !(xe_device_wedged(guc_to_xe(guc)) && ret == -ECANCELED))
+ xe_gt_err(guc_to_gt(guc),
+ "GuC RC setup %s(%u) failed (%pe)\n",
+ control == GUCRC_HOST_CONTROL ? "HOST_CONTROL" :
+ control == GUCRC_FIRMWARE_CONTROL ? "FIRMWARE_CONTROL" :
+ "UNKNOWN", control, ERR_PTR(ret));
+ return ret;
+}
+
+/**
+ * xe_guc_rc_disable() - Disable GuC RC
+ * @guc: Xe GuC instance
+ *
+ * Disables GuC RC by taking control of RC6 back from GuC.
+ */
+void xe_guc_rc_disable(struct xe_guc *guc)
+{
+ struct xe_device *xe = guc_to_xe(guc);
+ struct xe_gt *gt = guc_to_gt(guc);
+
+ if (!xe->info.skip_guc_pc && xe->info.platform != XE_PVC)
+ if (guc_action_setup_gucrc(guc, GUCRC_HOST_CONTROL))
+ return;
+
+ xe_gt_WARN_ON(gt, xe_gt_idle_disable_c6(gt));
+}
+
+static void xe_guc_rc_fini_hw(void *arg)
+{
+ struct xe_guc *guc = arg;
+ struct xe_device *xe = guc_to_xe(guc);
+ struct xe_gt *gt = guc_to_gt(guc);
+
+ if (xe_device_wedged(xe))
+ return;
+
+ CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
+ xe_guc_rc_disable(guc);
+}
+
+/**
+ * xe_guc_rc_init() - Init GuC RC
+ * @guc: Xe GuC instance
+ *
+ * Add callback action for GuC RC
+ *
+ * Return: 0 on success, negative error code on error.
+ */
+int xe_guc_rc_init(struct xe_guc *guc)
+{
+ struct xe_device *xe = guc_to_xe(guc);
+ struct xe_gt *gt = guc_to_gt(guc);
+
+ xe_gt_assert(gt, xe_device_uc_enabled(xe));
+
+ return devm_add_action_or_reset(xe->drm.dev, xe_guc_rc_fini_hw, guc);
+}
+
+/**
+ * xe_guc_rc_enable() - Enable GuC RC feature if applicable
+ * @guc: Xe GuC instance
+ *
+ * Enables GuC RC feature.
+ *
+ * Return: 0 on success, negative error code on error.
+ */
+int xe_guc_rc_enable(struct xe_guc *guc)
+{
+ struct xe_device *xe = guc_to_xe(guc);
+ struct xe_gt *gt = guc_to_gt(guc);
+
+ xe_gt_assert(gt, xe_device_uc_enabled(xe));
+
+ CLASS(xe_force_wake, fw_ref)(gt_to_fw(gt), XE_FW_GT);
+ if (!xe_force_wake_ref_has_domain(fw_ref.domains, XE_FW_GT))
+ return -ETIMEDOUT;
+
+ if (xe->info.platform == XE_PVC) {
+ xe_guc_rc_disable(guc);
+ return 0;
+ }
+
+ if (xe->info.skip_guc_pc) {
+ xe_gt_idle_enable_c6(gt);
+ return 0;
+ }
+
+ return guc_action_setup_gucrc(guc, GUCRC_FIRMWARE_CONTROL);
+}
diff --git a/drivers/gpu/drm/xe/xe_guc_rc.h b/drivers/gpu/drm/xe/xe_guc_rc.h
new file mode 100644
index 0000000000000..2e7e15e2be506
--- /dev/null
+++ b/drivers/gpu/drm/xe/xe_guc_rc.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2026 Intel Corporation
+ */
+
+#ifndef _XE_GUC_RC_H_
+#define _XE_GUC_RC_H_
+
+struct xe_guc;
+
+int xe_guc_rc_init(struct xe_guc *guc);
+int xe_guc_rc_enable(struct xe_guc *guc);
+void xe_guc_rc_disable(struct xe_guc *guc);
+
+#endif
diff --git a/drivers/gpu/drm/xe/xe_uc.c b/drivers/gpu/drm/xe/xe_uc.c
index b799efc838017..367e05354c384 100644
--- a/drivers/gpu/drm/xe/xe_uc.c
+++ b/drivers/gpu/drm/xe/xe_uc.c
@@ -14,6 +14,7 @@
#include "xe_gt_sriov_vf.h"
#include "xe_guc.h"
#include "xe_guc_pc.h"
+#include "xe_guc_rc.h"
#include "xe_guc_engine_activity.h"
#include "xe_guc_submit.h"
#include "xe_huc.h"
@@ -219,6 +220,10 @@ int xe_uc_load_hw(struct xe_uc *uc)
if (ret)
goto err_out;
+ ret = xe_guc_rc_enable(&uc->guc);
+ if (ret)
+ goto err_out;
+
xe_guc_engine_activity_enable_stats(&uc->guc);
/* We don't fail the driver load if HuC fails to auth, but let's warn */
@@ -244,11 +249,6 @@ int xe_uc_reset_prepare(struct xe_uc *uc)
return xe_guc_reset_prepare(&uc->guc);
}
-void xe_uc_gucrc_disable(struct xe_uc *uc)
-{
- XE_WARN_ON(xe_guc_pc_gucrc_disable(&uc->guc.pc));
-}
-
void xe_uc_stop_prepare(struct xe_uc *uc)
{
xe_gsc_stop_prepare(&uc->gsc);
diff --git a/drivers/gpu/drm/xe/xe_uc.h b/drivers/gpu/drm/xe/xe_uc.h
index 21c9306098cfd..df6b62ddd85ef 100644
--- a/drivers/gpu/drm/xe/xe_uc.h
+++ b/drivers/gpu/drm/xe/xe_uc.h
@@ -12,7 +12,6 @@ int xe_uc_init_noalloc(struct xe_uc *uc);
int xe_uc_init(struct xe_uc *uc);
int xe_uc_init_post_hwconfig(struct xe_uc *uc);
int xe_uc_load_hw(struct xe_uc *uc);
-void xe_uc_gucrc_disable(struct xe_uc *uc);
int xe_uc_reset_prepare(struct xe_uc *uc);
void xe_uc_stop_prepare(struct xe_uc *uc);
void xe_uc_stop(struct xe_uc *uc);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 460/990] drm/xe: Add a wrapper for SLPC set/unset params
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (458 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 459/990] drm/xe: Decouple GuC RC code from xe_guc_pc Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 461/990] drm/xe/pvc: Drop pre-prod workarounds Greg Kroah-Hartman
` (392 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Riana Tauro, Michal Wajdeczko,
Vinay Belgaumkar, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
[ Upstream commit fabedb758fcb16fcd80230c28356f8aaff972446 ]
Also, extract out the GuC RC related set/unset param functions
into xe_guc_rc file. GuC still allows us to override GuC RC mode
using an SLPC H2G interface. Continue to use that interface, but
move the related code to the newly created xe_guc_rc file.
Cc: Riana Tauro <riana.tauro@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Link: https://patch.msgid.link/20260204014234.2867763-4-vinay.belgaumkar@intel.com
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_guc_pc.c | 56 +++++++++++++++++++---------------
drivers/gpu/drm/xe/xe_guc_pc.h | 5 ++-
drivers/gpu/drm/xe/xe_guc_rc.c | 30 ++++++++++++++++++
drivers/gpu/drm/xe/xe_guc_rc.h | 3 ++
drivers/gpu/drm/xe/xe_oa.c | 9 +++---
5 files changed, 70 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 47281c46f0631..da2661e46f12b 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -281,6 +281,37 @@ static int pc_action_unset_param(struct xe_guc_pc *pc, u8 id)
return ret;
}
+/**
+ * xe_guc_pc_action_set_param() - Set value of SLPC param
+ * @pc: Xe_GuC_PC instance
+ * @id: Param id
+ * @value: Value to set
+ *
+ * This function can be used to set any SLPC param.
+ *
+ * Return: 0 on Success
+ */
+int xe_guc_pc_action_set_param(struct xe_guc_pc *pc, u8 id, u32 value)
+{
+ xe_device_assert_mem_access(pc_to_xe(pc));
+ return pc_action_set_param(pc, id, value);
+}
+
+/**
+ * xe_guc_pc_action_unset_param() - Revert to default value
+ * @pc: Xe_GuC_PC instance
+ * @id: Param id
+ *
+ * This function can be used revert any SLPC param to its default value.
+ *
+ * Return: 0 on Success
+ */
+int xe_guc_pc_action_unset_param(struct xe_guc_pc *pc, u8 id)
+{
+ xe_device_assert_mem_access(pc_to_xe(pc));
+ return pc_action_unset_param(pc, id);
+}
+
static u32 decode_freq(u32 raw)
{
return DIV_ROUND_CLOSEST(raw * GT_FREQUENCY_MULTIPLIER,
@@ -1063,31 +1094,6 @@ int xe_guc_pc_restore_stashed_freq(struct xe_guc_pc *pc)
return ret;
}
-/**
- * xe_guc_pc_override_gucrc_mode - override GUCRC mode
- * @pc: Xe_GuC_PC instance
- * @mode: new value of the mode.
- *
- * Return: 0 on success, negative error code on error
- */
-int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode)
-{
- guard(xe_pm_runtime)(pc_to_xe(pc));
- return pc_action_set_param(pc, SLPC_PARAM_PWRGATE_RC_MODE, mode);
-}
-
-/**
- * xe_guc_pc_unset_gucrc_mode - unset GUCRC mode override
- * @pc: Xe_GuC_PC instance
- *
- * Return: 0 on success, negative error code on error
- */
-int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc)
-{
- guard(xe_pm_runtime)(pc_to_xe(pc));
- return pc_action_unset_param(pc, SLPC_PARAM_PWRGATE_RC_MODE);
-}
-
static void pc_init_pcode_freq(struct xe_guc_pc *pc)
{
u32 min = DIV_ROUND_CLOSEST(pc->rpn_freq, GT_FREQUENCY_MULTIPLIER);
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.h b/drivers/gpu/drm/xe/xe_guc_pc.h
index 1b95873b262e3..0678a4e787b3f 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.h
+++ b/drivers/gpu/drm/xe/xe_guc_pc.h
@@ -9,15 +9,14 @@
#include <linux/types.h>
struct xe_guc_pc;
-enum slpc_gucrc_mode;
struct drm_printer;
int xe_guc_pc_init(struct xe_guc_pc *pc);
int xe_guc_pc_start(struct xe_guc_pc *pc);
int xe_guc_pc_stop(struct xe_guc_pc *pc);
-int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mode);
-int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc);
void xe_guc_pc_print(struct xe_guc_pc *pc, struct drm_printer *p);
+int xe_guc_pc_action_set_param(struct xe_guc_pc *pc, u8 id, u32 value);
+int xe_guc_pc_action_unset_param(struct xe_guc_pc *pc, u8 id);
u32 xe_guc_pc_get_act_freq(struct xe_guc_pc *pc);
int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq);
diff --git a/drivers/gpu/drm/xe/xe_guc_rc.c b/drivers/gpu/drm/xe/xe_guc_rc.c
index 6c4591e712d9d..427a889b2a1e0 100644
--- a/drivers/gpu/drm/xe/xe_guc_rc.c
+++ b/drivers/gpu/drm/xe/xe_guc_rc.c
@@ -13,6 +13,7 @@
#include "xe_gt_printk.h"
#include "xe_guc.h"
#include "xe_guc_ct.h"
+#include "xe_guc_pc.h"
#include "xe_guc_rc.h"
#include "xe_pm.h"
@@ -128,3 +129,32 @@ int xe_guc_rc_enable(struct xe_guc *guc)
return guc_action_setup_gucrc(guc, GUCRC_FIRMWARE_CONTROL);
}
+
+/**
+ * xe_guc_rc_set_mode() - set new GUCRC mode
+ * @guc: Xe GuC instance
+ * @mode: new value of the mode.
+ *
+ * Function to set GuC RC mode to one of the enum values.
+ *
+ * Returns: 0 on success, negative error code on error
+ */
+int xe_guc_rc_set_mode(struct xe_guc *guc, enum slpc_gucrc_mode mode)
+{
+ guard(xe_pm_runtime_noresume)(guc_to_xe(guc));
+ return xe_guc_pc_action_set_param(&guc->pc, SLPC_PARAM_PWRGATE_RC_MODE, mode);
+}
+
+/**
+ * xe_guc_rc_unset_mode() - revert to default mode
+ * @guc: Xe GuC instance
+ *
+ * Function to revert GuC RC mode to platform defaults.
+ *
+ * Returns: 0 on success, negative error code on error
+ */
+int xe_guc_rc_unset_mode(struct xe_guc *guc)
+{
+ guard(xe_pm_runtime_noresume)(guc_to_xe(guc));
+ return xe_guc_pc_action_unset_param(&guc->pc, SLPC_PARAM_PWRGATE_RC_MODE);
+}
diff --git a/drivers/gpu/drm/xe/xe_guc_rc.h b/drivers/gpu/drm/xe/xe_guc_rc.h
index 2e7e15e2be506..f1f949e7ecc0c 100644
--- a/drivers/gpu/drm/xe/xe_guc_rc.h
+++ b/drivers/gpu/drm/xe/xe_guc_rc.h
@@ -7,9 +7,12 @@
#define _XE_GUC_RC_H_
struct xe_guc;
+enum slpc_gucrc_mode;
int xe_guc_rc_init(struct xe_guc *guc);
int xe_guc_rc_enable(struct xe_guc *guc);
void xe_guc_rc_disable(struct xe_guc *guc);
+int xe_guc_rc_set_mode(struct xe_guc *guc, enum slpc_gucrc_mode mode);
+int xe_guc_rc_unset_mode(struct xe_guc *guc);
#endif
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index b88d3d39aea66..905c7eae6413c 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -29,7 +29,7 @@
#include "xe_gt.h"
#include "xe_gt_mcr.h"
#include "xe_gt_printk.h"
-#include "xe_guc_pc.h"
+#include "xe_guc_rc.h"
#include "xe_macros.h"
#include "xe_mmio.h"
#include "xe_oa.h"
@@ -877,7 +877,7 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream)
/* Wa_1509372804:pvc: Unset the override of GUCRC mode to enable rc6 */
if (stream->override_gucrc)
- xe_gt_WARN_ON(gt, xe_guc_pc_unset_gucrc_mode(>->uc.guc.pc));
+ xe_gt_WARN_ON(gt, xe_guc_rc_unset_mode(>->uc.guc));
xe_oa_free_configs(stream);
xe_file_put(stream->xef);
@@ -1783,8 +1783,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
* state. Prevent this by overriding GUCRC mode.
*/
if (XE_GT_WA(stream->gt, 1509372804)) {
- ret = xe_guc_pc_override_gucrc_mode(>->uc.guc.pc,
- SLPC_GUCRC_MODE_GUCRC_NO_RC6);
+ ret = xe_guc_rc_set_mode(>->uc.guc, SLPC_GUCRC_MODE_GUCRC_NO_RC6);
if (ret)
goto err_free_configs;
@@ -1842,7 +1841,7 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
xe_force_wake_put(gt_to_fw(gt), fw_ref);
xe_pm_runtime_put(stream->oa->xe);
if (stream->override_gucrc)
- xe_gt_WARN_ON(gt, xe_guc_pc_unset_gucrc_mode(>->uc.guc.pc));
+ xe_gt_WARN_ON(gt, xe_guc_rc_unset_mode(>->uc.guc));
err_free_configs:
xe_oa_free_configs(stream);
exit:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 461/990] drm/xe/pvc: Drop pre-prod workarounds
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (459 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 460/990] drm/xe: Add a wrapper for SLPC set/unset params Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 462/990] drm/xe/wa_oob: Consolidate some OOB rules Greg Kroah-Hartman
` (391 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Balasubramani Vivekanandan,
Matt Roper, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Roper <matthew.d.roper@intel.com>
[ Upstream commit 4405938293631604f0bec290c2e30bd392608393 ]
Production PVC hardware had a graphics stepping of C0. Xe1 platforms
already aren't officially supported by the Xe driver, but pre-production
steppings are especially out of scope (and 'has_pre_prod_wa' is not set
in the device descriptor). Drop the workarounds that aren't relevant to
production hardware.
v2:
- Drop the stream->override_gucrc which is no longer set anywhere after
the removal of Wa_1509372804. (Bala)
- Drop xe_guc_rc_set_mode / xe_guc_rc_unset_mode which are no longer
used after the removal of Wa_1509372804.
Bspec: 44484
Cc: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Link: https://patch.msgid.link/20260220-forupstream-wa_cleanup-v2-2-b12005a05af6@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_guc.c | 3 ---
drivers/gpu/drm/xe/xe_guc_rc.c | 29 -----------------------------
drivers/gpu/drm/xe/xe_guc_rc.h | 2 --
drivers/gpu/drm/xe/xe_oa.c | 19 -------------------
drivers/gpu/drm/xe/xe_oa_types.h | 3 ---
drivers/gpu/drm/xe/xe_wa.c | 5 -----
drivers/gpu/drm/xe/xe_wa_oob.rules | 2 --
7 files changed, 63 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index 5a8244633b67f..6a3546d7a47ba 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -205,9 +205,6 @@ static u32 guc_ctl_wa_flags(struct xe_guc *guc)
!xe_hw_engine_mask_per_class(gt, XE_ENGINE_CLASS_RENDER))
flags |= GUC_WA_RCS_REGS_IN_CCS_REGS_LIST;
- if (XE_GT_WA(gt, 1509372804))
- flags |= GUC_WA_RENDER_RST_RC6_EXIT;
-
if (XE_GT_WA(gt, 14018913170))
flags |= GUC_WA_ENABLE_TSC_CHECK_ON_RC6;
diff --git a/drivers/gpu/drm/xe/xe_guc_rc.c b/drivers/gpu/drm/xe/xe_guc_rc.c
index 427a889b2a1e0..99fa127b261ff 100644
--- a/drivers/gpu/drm/xe/xe_guc_rc.c
+++ b/drivers/gpu/drm/xe/xe_guc_rc.c
@@ -129,32 +129,3 @@ int xe_guc_rc_enable(struct xe_guc *guc)
return guc_action_setup_gucrc(guc, GUCRC_FIRMWARE_CONTROL);
}
-
-/**
- * xe_guc_rc_set_mode() - set new GUCRC mode
- * @guc: Xe GuC instance
- * @mode: new value of the mode.
- *
- * Function to set GuC RC mode to one of the enum values.
- *
- * Returns: 0 on success, negative error code on error
- */
-int xe_guc_rc_set_mode(struct xe_guc *guc, enum slpc_gucrc_mode mode)
-{
- guard(xe_pm_runtime_noresume)(guc_to_xe(guc));
- return xe_guc_pc_action_set_param(&guc->pc, SLPC_PARAM_PWRGATE_RC_MODE, mode);
-}
-
-/**
- * xe_guc_rc_unset_mode() - revert to default mode
- * @guc: Xe GuC instance
- *
- * Function to revert GuC RC mode to platform defaults.
- *
- * Returns: 0 on success, negative error code on error
- */
-int xe_guc_rc_unset_mode(struct xe_guc *guc)
-{
- guard(xe_pm_runtime_noresume)(guc_to_xe(guc));
- return xe_guc_pc_action_unset_param(&guc->pc, SLPC_PARAM_PWRGATE_RC_MODE);
-}
diff --git a/drivers/gpu/drm/xe/xe_guc_rc.h b/drivers/gpu/drm/xe/xe_guc_rc.h
index f1f949e7ecc0c..b083fc364dd43 100644
--- a/drivers/gpu/drm/xe/xe_guc_rc.h
+++ b/drivers/gpu/drm/xe/xe_guc_rc.h
@@ -12,7 +12,5 @@ enum slpc_gucrc_mode;
int xe_guc_rc_init(struct xe_guc *guc);
int xe_guc_rc_enable(struct xe_guc *guc);
void xe_guc_rc_disable(struct xe_guc *guc);
-int xe_guc_rc_set_mode(struct xe_guc *guc, enum slpc_gucrc_mode mode);
-int xe_guc_rc_unset_mode(struct xe_guc *guc);
#endif
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 905c7eae6413c..e7861f135f552 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -875,10 +875,6 @@ static void xe_oa_stream_destroy(struct xe_oa_stream *stream)
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
xe_pm_runtime_put(stream->oa->xe);
- /* Wa_1509372804:pvc: Unset the override of GUCRC mode to enable rc6 */
- if (stream->override_gucrc)
- xe_gt_WARN_ON(gt, xe_guc_rc_unset_mode(>->uc.guc));
-
xe_oa_free_configs(stream);
xe_file_put(stream->xef);
}
@@ -1778,18 +1774,6 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
goto exit;
}
- /*
- * GuC reset of engines causes OA to lose configuration
- * state. Prevent this by overriding GUCRC mode.
- */
- if (XE_GT_WA(stream->gt, 1509372804)) {
- ret = xe_guc_rc_set_mode(>->uc.guc, SLPC_GUCRC_MODE_GUCRC_NO_RC6);
- if (ret)
- goto err_free_configs;
-
- stream->override_gucrc = true;
- }
-
/* Take runtime pm ref and forcewake to disable RC6 */
xe_pm_runtime_get(stream->oa->xe);
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
@@ -1840,9 +1824,6 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
err_fw_put:
xe_force_wake_put(gt_to_fw(gt), fw_ref);
xe_pm_runtime_put(stream->oa->xe);
- if (stream->override_gucrc)
- xe_gt_WARN_ON(gt, xe_guc_rc_unset_mode(>->uc.guc));
-err_free_configs:
xe_oa_free_configs(stream);
exit:
xe_file_put(stream->xef);
diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h
index 48f9520f560c2..468b23d333e1f 100644
--- a/drivers/gpu/drm/xe/xe_oa_types.h
+++ b/drivers/gpu/drm/xe/xe_oa_types.h
@@ -241,9 +241,6 @@ struct xe_oa_stream {
/** @poll_period_ns: hrtimer period for checking OA buffer for available data */
u64 poll_period_ns;
- /** @override_gucrc: GuC RC has been overridden for the OA stream */
- bool override_gucrc;
-
/** @oa_status: temporary storage for oa_status register value */
u32 oa_status;
diff --git a/drivers/gpu/drm/xe/xe_wa.c b/drivers/gpu/drm/xe/xe_wa.c
index e4810821d4813..0a59fd3ef7690 100644
--- a/drivers/gpu/drm/xe/xe_wa.c
+++ b/drivers/gpu/drm/xe/xe_wa.c
@@ -475,11 +475,6 @@ static const struct xe_rtp_entry_sr engine_was[] = {
ENGINE_CLASS(COMPUTE)),
XE_RTP_ACTIONS(SET(RING_HWSTAM(RENDER_RING_BASE), ~0))
},
- { XE_RTP_NAME("14014999345"),
- XE_RTP_RULES(PLATFORM(PVC), ENGINE_CLASS(COMPUTE),
- GRAPHICS_STEP(B0, C0)),
- XE_RTP_ACTIONS(SET(CACHE_MODE_SS, DISABLE_ECC))
- },
/* Xe_LPG */
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index 31b5062585eb3..40ffe05ea2701 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -9,7 +9,6 @@
22012727685 SUBPLATFORM(DG2, G11)
22016596838 PLATFORM(PVC)
18020744125 PLATFORM(PVC)
-1509372804 PLATFORM(PVC), GRAPHICS_STEP(A0, C0)
1409600907 GRAPHICS_VERSION_RANGE(1200, 1250)
14016763929 SUBPLATFORM(DG2, G10)
SUBPLATFORM(DG2, G12)
@@ -60,7 +59,6 @@
18013179988 GRAPHICS_VERSION(1255)
GRAPHICS_VERSION_RANGE(1270, 1274)
1508761755 GRAPHICS_VERSION(1255)
- GRAPHICS_VERSION(1260), GRAPHICS_STEP(A0, B0)
16023105232 GRAPHICS_VERSION_RANGE(2001, 3001)
MEDIA_VERSION_RANGE(1301, 3000)
MEDIA_VERSION(3002)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 462/990] drm/xe/wa_oob: Consolidate some OOB rules
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (460 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 461/990] drm/xe/pvc: Drop pre-prod workarounds Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 463/990] drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule Greg Kroah-Hartman
` (390 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shuicheng Lin, Matt Roper,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Roper <matthew.d.roper@intel.com>
[ Upstream commit a2d0403de6492a32e5c175b22ebac053f579d350 ]
Given the new policy of allowing graphics/media IP ranges to extend over
unused IP versions, we can consolidate some of the OOB workaround rules
and simplify the table. If new IP variants eventually show up that use
these unused versions (e.g., media version 30.01, graphics versions
20.03 / 30.02, etc.), and if an existing workaround does not extend to
that new intermediate version, the ranges will be split back apart as
part of the enablement work for that new IP version.
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Link: https://patch.msgid.link/20260220-forupstream-wa_cleanup-v2-22-b12005a05af6@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Stable-dep-of: 557c7b434378 ("drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_wa_oob.rules | 31 ++++++++----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index 40ffe05ea2701..b703055eb6331 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -30,18 +30,9 @@
MEDIA_VERSION(2000)
16022287689 GRAPHICS_VERSION(2001)
GRAPHICS_VERSION(2004)
-13011645652 GRAPHICS_VERSION(2004)
- GRAPHICS_VERSION_RANGE(3000, 3001)
- GRAPHICS_VERSION(3003)
- GRAPHICS_VERSION_RANGE(3004, 3005)
-14022293748 GRAPHICS_VERSION_RANGE(2001, 2002)
- GRAPHICS_VERSION(2004)
- GRAPHICS_VERSION_RANGE(3000, 3005)
-22019794406 GRAPHICS_VERSION_RANGE(2001, 2002)
- GRAPHICS_VERSION(2004)
- GRAPHICS_VERSION_RANGE(3000, 3001)
- GRAPHICS_VERSION(3003)
- GRAPHICS_VERSION_RANGE(3004, 3005)
+13011645652 GRAPHICS_VERSION_RANGE(2004, 3005)
+14022293748 GRAPHICS_VERSION_RANGE(2001, 3005)
+22019794406 GRAPHICS_VERSION_RANGE(2001, 3005)
22019338487 MEDIA_VERSION(2000)
GRAPHICS_VERSION(2001), FUNC(xe_rtp_match_not_sriov_vf)
MEDIA_VERSION(3000), MEDIA_STEP(A0, B0), FUNC(xe_rtp_match_not_sriov_vf)
@@ -59,18 +50,12 @@
18013179988 GRAPHICS_VERSION(1255)
GRAPHICS_VERSION_RANGE(1270, 1274)
1508761755 GRAPHICS_VERSION(1255)
-16023105232 GRAPHICS_VERSION_RANGE(2001, 3001)
- MEDIA_VERSION_RANGE(1301, 3000)
- MEDIA_VERSION(3002)
- GRAPHICS_VERSION_RANGE(3003, 3005)
-16026508708 GRAPHICS_VERSION_RANGE(1200, 3001)
- MEDIA_VERSION_RANGE(1300, 3000)
- MEDIA_VERSION(3002)
- GRAPHICS_VERSION_RANGE(3003, 3005)
+16023105232 GRAPHICS_VERSION_RANGE(2001, 3005)
+ MEDIA_VERSION_RANGE(1301, 3002)
+16026508708 GRAPHICS_VERSION_RANGE(1200, 3005)
+ MEDIA_VERSION_RANGE(1300, 3002)
14020001231 GRAPHICS_VERSION_RANGE(2001,2004), FUNC(xe_rtp_match_psmi_enabled)
- MEDIA_VERSION(2000), FUNC(xe_rtp_match_psmi_enabled)
- MEDIA_VERSION(3000), FUNC(xe_rtp_match_psmi_enabled)
- MEDIA_VERSION(3002), FUNC(xe_rtp_match_psmi_enabled)
+ MEDIA_VERSION_RANGE(2000, 3002), FUNC(xe_rtp_match_psmi_enabled)
16023683509 MEDIA_VERSION(2000), FUNC(xe_rtp_match_psmi_enabled)
MEDIA_VERSION(3000), MEDIA_STEP(A0, B0), FUNC(xe_rtp_match_psmi_enabled)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 463/990] drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (461 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 462/990] drm/xe/wa_oob: Consolidate some OOB rules Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 464/990] igmp: use the joined device when leaving a multicast group Greg Kroah-Hartman
` (389 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dnyaneshwar Bhadane, Matt Roper,
Shekhar Chauhan, Matt Atwood, Gustavo Sousa, Matthew Brost,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Sousa <gustavo.sousa@intel.com>
[ Upstream commit 557c7b4343781cae9725bf26122d29c26ea12f5d ]
Wa_16023105232 was extended in xe_wa_oob.rules to match extra IP
releases while the respective entry in xe_was[] was overlooked.
Update the latter to be in sync with the former.
Also add comments in the code so that we don't forget to update both
places if new IP versions are added.
Fixes: c96e0df4e9f5 ("drm/xe/xe3: Add support for media IP version 30.02")
Fixes: 4fde66699f1c ("drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05")
Cc: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Shekhar Chauhan <shekhar.chauhan@intel.com>
Reviewed-by: Matt Atwood <matthew.s.atwood@intel.com>
Link: https://patch.msgid.link/20261105-wa_16031259911-v3-2-da6ec790aa29@intel.com
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
(cherry picked from commit 0cfb54f8f4d69efc847641738d25065049160aca)
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/xe/xe_wa.c | 5 +++--
drivers/gpu/drm/xe/xe_wa_oob.rules | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_wa.c b/drivers/gpu/drm/xe/xe_wa.c
index 0a59fd3ef7690..52f7da9e92481 100644
--- a/drivers/gpu/drm/xe/xe_wa.c
+++ b/drivers/gpu/drm/xe/xe_wa.c
@@ -675,8 +675,9 @@ static const struct xe_rtp_entry_sr engine_was[] = {
XE_RTP_ACTIONS(SET(TDL_TSL_CHICKEN, RES_CHK_SPR_DIS))
},
{ XE_RTP_NAME("16023105232"),
- XE_RTP_RULES(MEDIA_VERSION_RANGE(1301, 3000), OR,
- GRAPHICS_VERSION_RANGE(2001, 3001)),
+ /* IP versions need to be in sync with the respective entry in xe_wa_oob.rules. */
+ XE_RTP_RULES(MEDIA_VERSION_RANGE(1301, 3002), OR,
+ GRAPHICS_VERSION_RANGE(2001, 3005)),
XE_RTP_ACTIONS(SET(RING_PSMI_CTL(0), RC_SEMA_IDLE_MSG_DISABLE,
XE_RTP_ACTION_FLAG(ENGINE_BASE)))
},
diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
index b703055eb6331..598e11ee0ed14 100644
--- a/drivers/gpu/drm/xe/xe_wa_oob.rules
+++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
@@ -50,6 +50,7 @@
18013179988 GRAPHICS_VERSION(1255)
GRAPHICS_VERSION_RANGE(1270, 1274)
1508761755 GRAPHICS_VERSION(1255)
+# IP versions need to be in sync with the respective entry in xe_wa.c.
16023105232 GRAPHICS_VERSION_RANGE(2001, 3005)
MEDIA_VERSION_RANGE(1301, 3002)
16026508708 GRAPHICS_VERSION_RANGE(1200, 3005)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 464/990] igmp: use the joined device when leaving a multicast group
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (462 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 463/990] drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 465/990] udp_tunnel: dont treat IPv4 sockets bound to an address as wildcard Greg Kroah-Hartman
` (388 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Junyoung Jang, Hangbin Liu,
Ido Schimmel, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junyoung Jang <graypanda.inzag@gmail.com>
[ Upstream commit 19ec8416a76c08326fe5f814410a1b43046e63be ]
When a socket joins a multicast group, the ifindex of the device is
stored in the socket's membership entry. When leaving,
ip_mc_leave_group() resolves the device again from the request. If the
request only specifies an interface address and that address is not
assigned to any device, no device is found. The membership is still
matched by address and removed from the socket, but the group is not
released on the device it was joined on.
The group is then leaked on the device until the device is unregistered.
An unprivileged user can trigger this by joining with an ifindex and a
non-local address and leaving with the address only. It can also happen
when a socket joins and leaves with the address only and the address is
removed in between.
Fix by resolving the device from the ifindex stored in the membership,
like ip_mc_drop_socket() does.
Fixes: 4eba7bb1d72d ("ipv4: igmp: Allow removing groups from a removed interface")
Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261109125312.2208874-1-graypanda.inzag@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/igmp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 2846c2cee31cc..1c0c3b195af48 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2446,6 +2446,8 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
iml->multi.imr_address.s_addr)
continue;
+ /* The drop request may not resolve to the joined device. */
+ in_dev = inetdev_by_index(net, iml->multi.imr_ifindex);
(void) ip_mc_leave_src(sk, iml, in_dev);
*imlp = iml->next_rcu;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 465/990] udp_tunnel: dont treat IPv4 sockets bound to an address as wildcard
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (463 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 464/990] igmp: use the joined device when leaving a multicast group Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 466/990] net/mlx5: Lag, Return error when enabling MPESW without LAG support Greg Kroah-Hartman
` (387 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Antonio Quartulli, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <antonio@mandelbit.com>
[ Upstream commit 612b8376e8112a6f9caaedc25fa48ac42e02826d ]
With IPv6 enabled, sk_saddr_any() checks sk_v6_rcv_saddr also for
AF_INET sockets, where it is always zero. An IPv4 tunnel socket bound to
a specific address (e.g. fou or geneve with "local") ends up in the GRO
lookup fast path, although another socket may bind the same port on a
different address: GRO then hands that socket's packets to the tunnel's
gro_receive.
Check the IPv6 address only for AF_INET6 sockets.
Fixes: a36283e2b683 ("udp_tunnel: create a fastpath GRO lookup.")
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261110113306.3698438-1-antonio@mandelbit.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/udp_tunnel_core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/udp_tunnel_core.c b/net/ipv4/udp_tunnel_core.c
index 54386e06a8136..4f7e7d24594aa 100644
--- a/net/ipv4/udp_tunnel_core.c
+++ b/net/ipv4/udp_tunnel_core.c
@@ -62,10 +62,10 @@ EXPORT_SYMBOL(udp_sock_create4);
static bool sk_saddr_any(struct sock *sk)
{
#if IS_ENABLED(CONFIG_IPV6)
- return ipv6_addr_any(&sk->sk_v6_rcv_saddr);
-#else
- return !sk->sk_rcv_saddr;
+ if (sk->sk_family == AF_INET6)
+ return ipv6_addr_any(&sk->sk_v6_rcv_saddr);
#endif
+ return !sk->sk_rcv_saddr;
}
void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 466/990] net/mlx5: Lag, Return error when enabling MPESW without LAG support
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (464 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 465/990] udp_tunnel: dont treat IPv4 sockets bound to an address as wildcard Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 467/990] net: virtio: fix UDP tunnel GSO header of VLAN tagged packets Greg Kroah-Hartman
` (386 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Uri Dar, Shay Drori, Tariq Toukan,
Daniel Machon, 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 a532a7049ba23edeb2e16f7bb5929314f2e47ca0 ]
When firmware reports a function as not LAG capable (lag_master=0 or
num_lag_ports < 2), mlx5_lag_add_mdev() creates no LAG object for it.
Enabling multiport E-Switch on such a device returns 0 from
mlx5_lag_mpesw_queue_work(), so
"devlink dev param set ... esw_multiport value true" reports success
although nothing was enabled, and a following "devlink dev param show"
still reports false.
Return -EOPNOTSUPP instead. mlx5_lag_mpesw_disable() ignores the return
value, so disabling keeps its current behavior.
Fixes: a32327a3a02c ("net/mlx5: Lag, Control MultiPort E-Switch single FDB mode")
Signed-off-by: Uri Dar <udar@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20261110114350.2639891-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/lag/mpesw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
index 567e51f0e5dad..6dd97cc372ff8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
@@ -172,7 +172,7 @@ static int mlx5_lag_mpesw_queue_work(struct mlx5_core_dev *dev,
int err = 0;
if (!ldev)
- return 0;
+ return -EOPNOTSUPP;
work = kzalloc(sizeof(*work), GFP_KERNEL);
if (!work)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 467/990] net: virtio: fix UDP tunnel GSO header of VLAN tagged packets
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (465 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 466/990] net/mlx5: Lag, Return error when enabling MPESW without LAG support Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 468/990] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Greg Kroah-Hartman
` (385 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, 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 9e244f94128a4b89004f0564b66e039e58318a34 ]
virtio_net_hdr_tnl_from_skb() builds a wrong header for VLAN tagged UDP
tunnel GSO packets.
1) When the skb carries a hwaccel VLAN tag, tun_put_user() inserts the
802.1Q header in the frame it copies to user space or vhost-net, and
passes vlan_hlen = VLAN_HLEN. virtio_net_hdr_from_skb() adds
vlan_hlen to csum_start, but inner_nh_offset and outer_th_offset do
not account for it, and are 4 bytes short of the real inner L3 and
outer UDP headers in the emitted frame.
tun advertises NETIF_F_HW_VLAN_CTAG_TX and NETIF_F_HW_VLAN_STAG_TX
in hw_enc_features, and its vlan_features keep the UDP tunnel GSO
features, so this happens for example with a VLAN filtering bridge
with a tagged port, or with a vlan device on top of a tap.
2) The outer family comes from skb->protocol, which is ETH_P_8021Q or
ETH_P_8021AD when the VLAN tag is in the packet data, so a packet
with an outer IPv6 header is reported as
VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4. This happens when
__vlan_hwaccel_push_inside() inserted the tag because the device does
not offload it: virtio_net never offloads VLAN insertion but keeps
UDP tunnel GSO in its vlan_features, and tun does the same with VLAN
TX offload disabled, or with QinQ (outer tag offloaded, inner tag in
the data).
The receiver sets inner_network_header and transport_header from these
offsets, and checks them with the wrong outer family. A forwarded
packet that gets segmented again uses the wrong inner headers, and a
receiver checking the outer headers against the virtio header drops
the packet.
Add vlan_hlen to both offsets like csum_start, and take the outer
family from vlan_get_protocol(), which skips VLAN tags in the data.
Fixes: a2fb4bc4e2a6 ("net: implement virtio helpers to handle UDP GSO tunneling.")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179421814766.994134.3669228181251158303@kernel.org/
Closes: https://lore.kernel.org/netdev/179433950084.994134.15100186606737698605@kernel.org/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261110213628.3476051-2-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/virtio_net.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index b7b6b542f4763..fc9667176f23c 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -622,7 +622,10 @@ virtio_net_hdr_tnl_from_skb(const struct sk_buff *skb,
if (feature_hdrlen && hdr->hdr_len)
__virtio_net_set_tnl_hdrlen(skb, hdr);
- if (skb->protocol == htons(ETH_P_IPV6))
+ /* skb->protocol is the VLAN protocol when the tag is in the
+ * packet data.
+ */
+ if (vlan_get_protocol(skb) == htons(ETH_P_IPV6))
hdr->gso_type |= VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV6;
else
hdr->gso_type |= VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4;
@@ -630,8 +633,11 @@ virtio_net_hdr_tnl_from_skb(const struct sk_buff *skb,
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)
hdr->flags |= VIRTIO_NET_HDR_F_UDP_TUNNEL_CSUM;
- inner_nh = skb->inner_network_header - skb_headroom(skb);
- outer_th = skb->transport_header - skb_headroom(skb);
+ /* Like csum_start, the offsets must account for a VLAN tag
+ * the caller inserts in the frame.
+ */
+ inner_nh = skb->inner_network_header - skb_headroom(skb) + vlan_hlen;
+ outer_th = skb->transport_header - skb_headroom(skb) + vlan_hlen;
vhdr->inner_nh_offset = cpu_to_le16(inner_nh);
vhdr->outer_th_offset = cpu_to_le16(outer_th);
return 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 468/990] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (466 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 467/990] net: virtio: fix UDP tunnel GSO header of VLAN tagged packets Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 469/990] net: scm: move scm_detach_fds() from common path to scm_recv_unix() Greg Kroah-Hartman
` (384 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, 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 a9782a6f2bbd0c444689725a710d8b21eab61bc5 ]
When connection migration happens in tcp_v[46]_rcv(), a new
listener is passed to tcp_check_req().
When either of the following is true,
* the new listener queue is full and
net.ipv4.tcp_abort_on_overflow is set
* the packet has RST or (not stripped) SYN
tcp_check_req() sends RST and calls inet_csk_reqsk_queue_drop().
Here, the new listener is passed, and its qlen is decremented
wrongly while reqsk is tied to the old listener.
Once qlen underflows, inet_csk_reqsk_queue_is_full() always
return true, and the new listener stops serving.
Without the patch, this script times out while waiting for SYN+ACK
since the new listener drops SYN, but with the patch, 3WHS completes.
0 `sysctl -q net.ipv4.tcp_migrate_req=1`
+0 `sysctl -q net.ipv4.tcp_syncookies=0`
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
+0 setsockopt(4, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
+0 bind(4, ..., ...) = 0
+0 listen(4, 128) = 0
+0 < S 0:0(0) win 32792 <mss 1000>
+0 > S. 0:0(0) ack 1 <...>
+0 listen(3, 128) = 0
+0 close(4) = 0
+.01 < R 1:1(0) win 0
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
+0 listen(5, 1) = 0
+.01 < S 0:0(0) win 32792 <mss 1000>
+0 > S. 0:0(0) ack 1 <...>
+0 < . 1:1(0) ack 1 win 32792
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 accept(3, ..., ...) = 6
Let's pass req->rsk_listener instead.
Fixes: d4f2c86b2b7e ("tcp: Migrate TCP_NEW_SYN_RECV requests at receiving the final ACK.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261111020304.1532064-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv4/tcp_minisocks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index ebcd78ad13efa..accd276830e2e 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -980,7 +980,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
tcp_reset(sk, skb);
}
if (!fastopen) {
- bool unlinked = inet_csk_reqsk_queue_drop(sk, req);
+ bool unlinked = inet_csk_reqsk_queue_drop(req->rsk_listener, req);
if (unlinked)
__NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 469/990] net: scm: move scm_detach_fds() from common path to scm_recv_unix()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (467 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 468/990] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 470/990] net: af_unix: useful handling of LSM denials on SCM_RIGHTS Greg Kroah-Hartman
` (383 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kuniyuki Iwashima, Jori Koolstra,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jori Koolstra <jkoolstra@xs4all.nl>
[ Upstream commit 48b84acc5e18655f2a02fe2a043330d03f939ffe ]
scm->fp can only be set when using UNIX sockets, therefore we should
move it out of the common path __scm_recv_common() into
scm_recv_unix().
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260813162818.149248-3-jkoolstra@xs4all.nl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 0359338fd8cf ("af_unix: Inherit SO_INQ in unix_stream_connect()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/scm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/core/scm.c b/net/core/scm.c
index 66eaee783e8be..6d0e60feaada9 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -525,9 +525,6 @@ static bool __scm_recv_common(struct sock *sk, struct msghdr *msg,
scm_passec(sk, msg, scm);
- if (scm->fp)
- scm_detach_fds(msg, scm);
-
return true;
}
@@ -547,6 +544,9 @@ void scm_recv_unix(struct socket *sock, struct msghdr *msg,
if (!__scm_recv_common(sock->sk, msg, scm, flags))
return;
+ if (scm->fp)
+ scm_detach_fds(msg, scm);
+
if (sock->sk->sk_scm_pidfd)
scm_pidfd_recv(msg, scm);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 470/990] net: af_unix: useful handling of LSM denials on SCM_RIGHTS
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (468 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 469/990] net: scm: move scm_detach_fds() from common path to scm_recv_unix() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 471/990] af_unix: Inherit SO_INQ in unix_stream_connect() Greg Kroah-Hartman
` (382 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Brauner (Amutable),
Jori Koolstra, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jori Koolstra <jkoolstra@xs4all.nl>
[ Upstream commit fd8756fa1487577535d6294ae7cc67888b19ae2a ]
Right now if some LSM such as Smack denies an AF_UNIX socket peer to
receive an SCM_RIGHTS fd, the SCM_RIGHTS fd array will be cut short at
that point, and MSG_CTRUNC is set on return of recvmsg(). This is
highly problematic behaviour, because it leaves the receiver
wondering what happened. As per man page MSG_CTRUNC is supposed to
indicate that the control buffer was sized too short, but suddenly
a permission error might result in the exact same flag being set.
Moreover, the receiver has no chance to determine how many fds got
originally sent and how many were suppressed.[1]
Add a SO_RIGHTS_NOTRUNC option to UNIX sockets to enable more useful
handling of LSM denials when receiving SCM_RIGHTS messages: instead of
truncating the message at the first blocked fd, keep every fd slot
and store the LSM errno in the blocked slot. The socket option is
inherited by the child accept() socket if set on the listen() socket.
[1]: https://github.com/uapi-group/kernel-features#useful-handling-of-lsm-denials-on-scm_rights
Reviewed-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260813162818.149248-4-jkoolstra@xs4all.nl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 0359338fd8cf ("af_unix: Inherit SO_INQ in unix_stream_connect()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/alpha/include/uapi/asm/socket.h | 2 ++
arch/mips/include/uapi/asm/socket.h | 2 ++
arch/parisc/include/uapi/asm/socket.h | 2 ++
arch/sparc/include/uapi/asm/socket.h | 2 ++
include/net/af_unix.h | 1 +
include/net/scm.h | 13 +++------
include/uapi/asm-generic/socket.h | 2 ++
net/compat.c | 4 +--
net/core/scm.c | 38 +++++++++++++++++++++++----
net/unix/af_unix.c | 12 ++++++++-
10 files changed, 61 insertions(+), 17 deletions(-)
diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
index 5ef57f88df6b3..946a5fad26912 100644
--- a/arch/alpha/include/uapi/asm/socket.h
+++ b/arch/alpha/include/uapi/asm/socket.h
@@ -155,6 +155,8 @@
#define SO_INQ 84
#define SCM_INQ SO_INQ
+#define SO_RIGHTS_NOTRUNC 85
+
#if !defined(__KERNEL__)
#if __BITS_PER_LONG == 64
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
index 72fb1b006da93..f1641dde135fc 100644
--- a/arch/mips/include/uapi/asm/socket.h
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -166,6 +166,8 @@
#define SO_INQ 84
#define SCM_INQ SO_INQ
+#define SO_RIGHTS_NOTRUNC 85
+
#if !defined(__KERNEL__)
#if __BITS_PER_LONG == 64
diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index c16ec36dfee6b..f3a3815c7dc29 100644
--- a/arch/parisc/include/uapi/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
@@ -147,6 +147,8 @@
#define SO_INQ 0x4052
#define SCM_INQ SO_INQ
+#define SO_RIGHTS_NOTRUNC 0x4053
+
#if !defined(__KERNEL__)
#if __BITS_PER_LONG == 64
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 71befa109e1cf..7907f3b1f0ee0 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -148,6 +148,8 @@
#define SO_INQ 0x005d
#define SCM_INQ SO_INQ
+#define SO_RIGHTS_NOTRUNC 0x005e
+
#if !defined(__KERNEL__)
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 34f53dde65cea..bb1b3dee02e82 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -49,6 +49,7 @@ struct unix_sock {
struct scm_stat scm_stat;
int inq_len;
bool recvmsg_inq;
+ bool scm_rights_notrunc;
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
struct sk_buff *oob_skb;
#endif
diff --git a/include/net/scm.h b/include/net/scm.h
index c52519669349f..86ae6bc109ec6 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -50,8 +50,8 @@ struct scm_cookie {
#endif
};
-void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
-void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
+void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm, bool notrunc);
+void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm, bool notrunc);
int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
void __scm_destroy(struct scm_cookie *scm);
struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl);
@@ -107,13 +107,8 @@ void scm_recv(struct socket *sock, struct msghdr *msg,
void scm_recv_unix(struct socket *sock, struct msghdr *msg,
struct scm_cookie *scm, int flags);
-static inline int scm_recv_one_fd(struct file *f, int __user *ufd,
- unsigned int flags)
-{
- if (!ufd)
- return -EFAULT;
- return receive_fd(f, ufd, flags);
-}
+int scm_recv_one_fd(struct file *f, int __user *ufd, unsigned int flags,
+ bool notrunc);
#endif /* __LINUX_NET_SCM_H */
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 53b5a8c002b1e..84ea7b92936e2 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -150,6 +150,8 @@
#define SO_INQ 84
#define SCM_INQ SO_INQ
+#define SO_RIGHTS_NOTRUNC 85
+
#if !defined(__KERNEL__)
#if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
diff --git a/net/compat.c b/net/compat.c
index 485db8ee9b28f..996a8110b3c95 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -287,7 +287,7 @@ static int scm_max_fds_compat(struct msghdr *msg)
return (msg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int);
}
-void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
+void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm, bool notrunc)
{
struct compat_cmsghdr __user *cm =
(struct compat_cmsghdr __user *)msg->msg_control_user;
@@ -297,7 +297,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
int err = 0, i;
for (i = 0; i < fdmax; i++) {
- err = scm_recv_one_fd(scm->fp->fp[i], cmsg_data + i, o_flags);
+ err = scm_recv_one_fd(scm->fp->fp[i], cmsg_data + i, o_flags, notrunc);
if (err < 0)
break;
}
diff --git a/net/core/scm.c b/net/core/scm.c
index 6d0e60feaada9..938f9616a59c7 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -353,7 +353,31 @@ static int scm_max_fds(struct msghdr *msg)
return (msg->msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
}
-void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
+int scm_recv_one_fd(struct file *f, int __user *ufd, unsigned int flags,
+ bool notrunc)
+{
+ int error;
+
+ if (!ufd)
+ return -EFAULT;
+
+ error = security_file_receive(f);
+ if (error)
+ return notrunc ? put_user(error, ufd) : error;
+
+ FD_PREPARE(fdf, flags, get_file(f));
+ if (fdf.err)
+ return fdf.err;
+
+ error = put_user(fd_prepare_fd(fdf), ufd);
+ if (error)
+ return error;
+
+ __receive_sock(fd_prepare_file(fdf));
+ return fd_publish(fdf);
+}
+
+void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm, bool notrunc)
{
struct cmsghdr __user *cm =
(__force struct cmsghdr __user *)msg->msg_control_user;
@@ -367,12 +391,12 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
return;
if (msg->msg_flags & MSG_CMSG_COMPAT) {
- scm_detach_fds_compat(msg, scm);
+ scm_detach_fds_compat(msg, scm, notrunc);
return;
}
for (i = 0; i < fdmax; i++) {
- err = scm_recv_one_fd(scm->fp->fp[i], cmsg_data + i, o_flags);
+ err = scm_recv_one_fd(scm->fp->fp[i], cmsg_data + i, o_flags, notrunc);
if (err < 0)
break;
}
@@ -544,8 +568,12 @@ void scm_recv_unix(struct socket *sock, struct msghdr *msg,
if (!__scm_recv_common(sock->sk, msg, scm, flags))
return;
- if (scm->fp)
- scm_detach_fds(msg, scm);
+ if (scm->fp) {
+ struct unix_sock *u;
+
+ u = unix_sk(sock->sk);
+ scm_detach_fds(msg, scm, READ_ONCE(u->scm_rights_notrunc));
+ }
if (sock->sk->sk_scm_pidfd)
scm_pidfd_recv(msg, scm);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a1e832e531bf3..0638779e7c375 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -934,6 +934,7 @@ static bool unix_custom_sockopt(int optname)
{
switch (optname) {
case SO_INQ:
+ case SO_RIGHTS_NOTRUNC:
return true;
default:
return false;
@@ -969,6 +970,14 @@ static int unix_setsockopt(struct socket *sock, int level, int optname,
WRITE_ONCE(u->recvmsg_inq, val);
break;
+
+ case SO_RIGHTS_NOTRUNC:
+ if (val > 1 || val < 0)
+ return -EINVAL;
+
+ WRITE_ONCE(u->scm_rights_notrunc, val);
+ break;
+
default:
return -ENOPROTOOPT;
}
@@ -1762,9 +1771,10 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
init_peercred(newsk, &peercred);
newu = unix_sk(newsk);
+ otheru = unix_sk(other);
newu->listener = other;
+ newu->scm_rights_notrunc = READ_ONCE(otheru->scm_rights_notrunc);
RCU_INIT_POINTER(newsk->sk_wq, &newu->peer_wq);
- otheru = unix_sk(other);
/* copy address information from listening to new sock
*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 471/990] af_unix: Inherit SO_INQ in unix_stream_connect()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (469 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 470/990] net: af_unix: useful handling of LSM denials on SCM_RIGHTS Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 472/990] amt: use ipv6_hdr() in amt_mldv1_leave_handler() Greg Kroah-Hartman
` (381 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wenbo Sun, Kuniyuki Iwashima,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
[ Upstream commit 0359338fd8cf1a2dc001d0cd69c331c17decee88 ]
When SO_INQ is enabled on a listening AF_UNIX SOCK_STREAM socket,
accepted sockets created by unix_stream_connect() do not inherit
u->recvmsg_inq from the listener, unlike TCP_INQ, AF_VSOCK SO_INQ,
and AF_UNIX SO_RIGHTS_NOTRUNC. As a result, recvmsg() on the
accepted socket never puts an SCM_INQ control message unless SO_INQ
is set again after accept().
Copy otheru->recvmsg_inq to newu->recvmsg_inq in
unix_stream_connect() using READ_ONCE() to pair with the lockless
WRITE_ONCE() in unix_setsockopt().
Found during LLM-assisted code review of unix_stream_connect() while
comparing option inheritance between SO_INQ and SO_RIGHTS_NOTRUNC.
Confirmed on UML (x86_64) by enabling SO_INQ on a listening AF_UNIX
SOCK_STREAM socket before listen() and accept(), sending data from a
connected client, and observing that recvmsg() on the accepted socket
returned no SCM_INQ control message.
Tested on UML (x86_64) against the reproducer, verifying that
recvmsg() on the accepted socket now returns the expected SCM_INQ
control message, and ran the tools/testing/selftests/net/af_unix/scm_inq
selftest (all 6 test cases passed).
Fixes: df30285b3670 ("af_unix: Introduce SO_INQ.")
Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261111023222.77227-1-sunwenbo@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/unix/af_unix.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 0638779e7c375..9c92d13aa6363 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1773,6 +1773,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
newu = unix_sk(newsk);
otheru = unix_sk(other);
newu->listener = other;
+ newu->recvmsg_inq = READ_ONCE(otheru->recvmsg_inq);
newu->scm_rights_notrunc = READ_ONCE(otheru->scm_rights_notrunc);
RCU_INIT_POINTER(newsk->sk_wq, &newu->peer_wq);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 472/990] amt: use ipv6_hdr() in amt_mldv1_leave_handler()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (470 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 471/990] af_unix: Inherit SO_INQ in unix_stream_connect() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 473/990] net: usb: cdc_ncm: dont underflow the NDP room check Greg Kroah-Hartman
` (380 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Wenbo Sun, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
[ Upstream commit 6730fe495c35f174a424ab58cf5fdf99ce4746e9 ]
In amt_mldv1_leave_handler(), which handles IPv6 MLDv1 Done
(ICMPV6_MGM_REDUCTION) messages, the source address is mistakenly
extracted via ip_hdr(skb)->saddr into host.ip4 instead of copying the
IPv6 source address from ipv6_hdr(skb)->saddr into host.ip6 as
amt_mldv1_report_handler() does.
Because amt_lookup_group() compares the full union amt_addr for v6
groups, looking up the group with a 32-bit IPv4 header slice fails to
match the group entry created by amt_mldv1_report_handler(). As a
result, amt_del_group() is not called when an MLDv1 listener leaves,
and the AMT relay continues forwarding multicast traffic until the
group timer expires.
Use ipv6_hdr(skb) and copy ip6h->saddr into host.ip6 so that MLDv1
Done messages properly match and delete the corresponding IPv6 group.
This issue was found via LLM-assisted code review, confirmed by
reproducing the stale group forwarding in a User-Mode Linux (ARCH=um)
environment, and verified in UML by testing that AMT relay multicast
forwarding stops immediately after receiving an MLDv1 Done message.
Fixes: b75f7095d4d4 ("amt: add mld report message handler")
Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261111031147.105834-1-sunwenbo@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/amt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index 2a8a0c0e78993..e577b205f37b1 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -2134,13 +2134,12 @@ static void amt_mldv1_leave_handler(struct amt_dev *amt, struct sk_buff *skb,
struct amt_tunnel_list *tunnel)
{
struct mld_msg *mld = (struct mld_msg *)icmp6_hdr(skb);
- struct iphdr *iph = ip_hdr(skb);
+ struct ipv6hdr *ip6h = ipv6_hdr(skb);
struct amt_group_node *gnode;
union amt_addr group, host;
memcpy(&group.ip6, &mld->mld_mca, sizeof(struct in6_addr));
- memset(&host, 0, sizeof(union amt_addr));
- host.ip4 = iph->saddr;
+ memcpy(&host.ip6, &ip6h->saddr, sizeof(struct in6_addr));
gnode = amt_lookup_group(tunnel, &group, &host, true);
if (gnode) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 473/990] net: usb: cdc_ncm: dont underflow the NDP room check
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (471 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 472/990] amt: use ipv6_hdr() in amt_mldv1_leave_handler() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 474/990] net/mlx5e: IPsec, dont match upper proto selectors in crypto offload TX Greg Kroah-Hartman
` (379 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+1994e2ecf323ed90f255,
Jiahao Xu, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiahao Xu <xujiahao@cmss.chinamobile.com>
[ Upstream commit b507828c7b6135ff7a4b69eba6e33502b4839fb9 ]
cdc_ncm_ndp16() and cdc_ncm_ndp32() verify that the new NDP and the
datagram fit into the NTB with an unsigned subtraction:
if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
return NULL;
Nothing guarantees that skb->len plus the reserve stays below
tx_curr_size, and when it does not the subtraction wraps around to a
huge value, the check passes, and the skb_put_zero() of max_ndp_size
bytes that follows overruns the NTB:
skbuff: skb_over_panic: text:ffff80000db33558 len:428 put:172
head:ffff0000c2c66100 tail:0x1ac end:0x140
kernel BUG at net/core/skbuff.c:200
skb_put_zero include/linux/skbuff.h:2595 [inline]
cdc_ncm_ndp16 drivers/net/usb/cdc_ncm.c:1132 [inline]
cdc_ncm_fill_tx_frame+0xdf0/0x30e0 drivers/net/usb/cdc_ncm.c:1309
Here tx_curr_size is 0x140 = 320, skb->len is already 256 and the
skb_put_zero() wants another 172 bytes.
Two device controlled settings make this reachable:
- dwNtbOutMaxSize = 320 caps tx_max at 320. The lower bound computed
in cdc_ncm_check_tx_max() is max_datagram_size + max_ndp_size + the
NTH header, but cdc_ncm_setup() clamps tx_max before
cdc_ncm_set_dgram_size() runs, so max_datagram_size is still 0 and
the bound is only max_ndp_size + the NTH header. It does not
reserve room for one datagram plus one NDP.
- wNdpOutAlignment = 256 is accepted by cdc_ncm_fix_modulus() as long
as it is smaller than tx_max, and cdc_ncm_align_tail() then pads the
12 byte NTH header up to 256 bytes right before this check.
An NDP can also be added to an NTB that already holds datagrams through
cdc_mbim_tx_fixup(), which uses a different signature per MBIM session.
On plain cdc_ncm the chain lookup in cdc_ncm_ndp16() returns the
existing NDP for the single signature, so there the create path is
normally reached for the first datagram of each NTB.
Rewrite the test as an addition, which cannot underflow and gives the
same answer whenever the original subtraction did not wrap.
Fixes: c78b7c586657 ("net: cdc_ncm: refactoring for tx multiplexing")
Fixes: 0fa81b304a79 ("cdc_ncm: Implement the 32-bit version of NCM Transfer Block")
Reported-by: syzbot+1994e2ecf323ed90f255@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1994e2ecf323ed90f255
Signed-off-by: Jiahao Xu <xujiahao@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261111124156.637661-1-xujiahao@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/usb/cdc_ncm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index ca06525892ac3..5ecd6d951a35f 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1125,7 +1125,7 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp16(struct cdc_ncm_ctx *ctx, struct s
cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
/* verify that there is room for the NDP and the datagram (reserve) */
- if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
+ if (skb->len + reserve + ctx->max_ndp_size > ctx->tx_curr_size)
return NULL;
/* link to it */
@@ -1180,7 +1180,7 @@ static struct usb_cdc_ncm_ndp32 *cdc_ncm_ndp32(struct cdc_ncm_ctx *ctx, struct s
cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
/* verify that there is room for the NDP and the datagram (reserve) */
- if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
+ if (skb->len + reserve + ctx->max_ndp_size > ctx->tx_curr_size)
return NULL;
/* link to it */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 474/990] net/mlx5e: IPsec, dont match upper proto selectors in crypto offload TX
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (472 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 473/990] net: usb: cdc_ncm: dont underflow the NDP room check Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 475/990] net: phy: c45: select BASE-T1 type for the forced speed Greg Kroah-Hartman
` (378 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cosmin Ratiu, Leon Romanovsky,
Tariq Toukan, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <cratiu@nvidia.com>
[ Upstream commit 5ed47bd79cebee8429d06c6640aac7ac7c4805ca ]
The mentioned commit introduced support for upper protocol selectors
(protocol & ports) to mlx5 IPsec offload. In crypto offload mode this
causes offloaded TX SAs to stop matching traffic.
In tx_add_rule(), setup_fte_upper_proto_match() is called for all
offload types and programs a match on the upper protocol (TCP/UDP) and
ports. For crypto offload, setup_fte_esp() is then called and sets
ip_protocol to ESP. The resulting rule requires both ESP as the IP
protocol and TCP/UDP ports, which no packet can satisfy, so TX crypto
offload silently stops working for such SAs.
In crypto offload mode the stack builds the ESP packet and the HW only
encrypts it, so the SA rule should only match on the SPI. Move the
setup_fte_upper_proto_match() call under the XFRM_DEV_OFFLOAD_PACKET
case, where the rule matches the plaintext packet and upper protocol
selectors apply.
The other three callers are unaffected: rx_add_rule_sa_selector() is
already only invoked for packet offload, and tx_add_policy() /
rx_add_policy() are only reachable in packet offload mode, since xfrm
policy offload is exclusively of type XFRM_DEV_OFFLOAD_PACKET.
Fixes: a7385187a386 ("net/mlx5e: IPsec, support upper protocol selector field offload")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261111081337.3129580-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_accel/ipsec_fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
index 5c5b33b01bebf..1046627d4080b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
@@ -2187,7 +2187,6 @@ static int tx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
}
setup_fte_no_frags(spec);
- setup_fte_upper_proto_match(spec, &attrs->upspec);
switch (attrs->type) {
case XFRM_DEV_OFFLOAD_CRYPTO:
@@ -2200,6 +2199,7 @@ static int tx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
setup_fte_reg_a(spec);
break;
case XFRM_DEV_OFFLOAD_PACKET:
+ setup_fte_upper_proto_match(spec, &attrs->upspec);
setup_fte_reg_c4(spec, attrs->reqid);
err = setup_pkt_reformat(ipsec, attrs, &flow_act);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 475/990] net: phy: c45: select BASE-T1 type for the forced speed
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (473 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 474/990] net/mlx5e: IPsec, dont match upper proto selectors in crypto offload TX Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 476/990] selftests: tls: Skip the zero_len tests when TLS is unavailable Greg Kroah-Hartman
` (377 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Iustin Stolniceanu, Andrew Lunn,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
[ Upstream commit df501db9b18fae4d3edd534b992675f4673a938e ]
Commit 25108a834e14 ("net: phy: c45: add support for 1000BASE-T1 forced
setup") made genphy_c45_pma_setup_forced() write the type selection
field (bits 3:0) of the BASE-T1 PMA/PMD control register (1.2100) on
every forced setup: 1000BASE-T1 for SPEED_1000, and 0 for everything
else. 0 selects 100BASE-T1, so forcing a 10BASE-T1L PHY to 10 Mbit/s
now also switches its PMA to 100BASE-T1, a mode it does not implement.
Seen on an ADIN1110 (internal ADIN1100 PHY): after
ethtool -s ethX autoneg off speed 10 master-slave forced-master
1.2100 reads 0xc000 instead of the 0xc002. Since the field is not
restored by re-enabling autoneg, the PHY keeps the wrong type until
the next forced setup or reset.
Add a helper that returns the type selection value for the forced speed
and the supported link modes: 100BASE-T1, 1000BASE-T1, and 10BASE-T1L or
10BASE-T1S for SPEED_10 depending on the supported 10 Mbit/s modes. Fail
with -EINVAL when no type matches instead of writing 100BASE-T1. This
also applies to forced 2.5G, 5G and 10G on BASE-T1 capable PHYs, for
which there are no link modes yet.
The field is called "type selection" in IEEE 802.3-2022 (45.2.1.214,
Table 45-178). Keep the old STRAP names as aliases.
Tested on EVAL-ADIN1110EBZ: with this change, forcing 10 Mbit/s writes
1.2100 = 0xc002 (10BASE-T1L) instead of the invalid 0xc000.
Fixes: 25108a834e14 ("net: phy: c45: add support for 1000BASE-T1 forced setup")
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20261111100053.345196-1-iustin.stolniceanu@analog.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/phy/phy-c45.c | 46 ++++++++++++++++++++++++++++++++++-----
include/uapi/linux/mdio.h | 13 +++++++++--
2 files changed, 52 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index d2e36e460cc7f..db1ae54c62738 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -103,6 +103,36 @@ int genphy_c45_pma_baset1_setup_master_slave(struct phy_device *phydev)
}
EXPORT_SYMBOL_GPL(genphy_c45_pma_baset1_setup_master_slave);
+/* Type selection value for the BASE-T1 PMA/PMD control register (1.2100,
+ * 802.3-2022 Table 45-178) matching the forced speed. 10 Mbit/s is ambiguous
+ * between 10BASE-T1L and 10BASE-T1S, so the supported link modes decide.
+ * 2.5G, 5G and 10GBASE-T1 are not handled as there are no link modes for them
+ * yet.
+ */
+static int genphy_c45_baset1_type_sel(struct phy_device *phydev)
+{
+ switch (phydev->speed) {
+ case SPEED_10:
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,
+ phydev->supported))
+ return MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_10BT1L;
+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1S_Full_BIT,
+ phydev->supported) ||
+ linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1S_Half_BIT,
+ phydev->supported) ||
+ linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT,
+ phydev->supported))
+ return MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_10BT1S;
+ return -EINVAL;
+ case SPEED_100:
+ return MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_100BT1;
+ case SPEED_1000:
+ return MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_1000BT1;
+ default:
+ return -EINVAL;
+ }
+}
+
/**
* genphy_c45_pma_setup_forced - configures a forced speed
* @phydev: target phy_device struct
@@ -165,6 +195,16 @@ int genphy_c45_pma_setup_forced(struct phy_device *phydev)
return -EINVAL;
}
+ /* Resolve the type before the first write, so a speed without a
+ * matching type leaves the PHY untouched.
+ */
+ bt1_ctrl = 0;
+ if (genphy_c45_baset1_able(phydev)) {
+ bt1_ctrl = genphy_c45_baset1_type_sel(phydev);
+ if (bt1_ctrl < 0)
+ return bt1_ctrl;
+ }
+
ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, ctrl1);
if (ret < 0)
return ret;
@@ -178,12 +218,8 @@ int genphy_c45_pma_setup_forced(struct phy_device *phydev)
if (ret < 0)
return ret;
- bt1_ctrl = 0;
- if (phydev->speed == SPEED_1000)
- bt1_ctrl = MDIO_PMA_PMD_BT1_CTRL_STRAP_B1000;
-
ret = phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_PMD_BT1_CTRL,
- MDIO_PMA_PMD_BT1_CTRL_STRAP, bt1_ctrl);
+ MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL, bt1_ctrl);
if (ret < 0)
return ret;
}
diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
index 6975f182b22c6..d194b8182a251 100644
--- a/include/uapi/linux/mdio.h
+++ b/include/uapi/linux/mdio.h
@@ -383,8 +383,17 @@
#define MDIO_AN_10BT1_AN_STAT_LPA_EEE_T1L 0x4000 /* 10BASE-T1L LP EEE ability advertisement */
/* BASE-T1 PMA/PMD control register */
-#define MDIO_PMA_PMD_BT1_CTRL_STRAP 0x000F /* Type selection (Strap) */
-#define MDIO_PMA_PMD_BT1_CTRL_STRAP_B1000 0x0001 /* Select 1000BASE-T1 */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL 0x000F /* Type selection */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_100BT1 0x0000 /* Select 100BASE-T1 */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_1000BT1 0x0001 /* Select 1000BASE-T1 */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_10BT1L 0x0002 /* Select 10BASE-T1L */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_10BT1S 0x0003 /* Select 10BASE-T1S */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_2P5GBT1 0x0004 /* Select 2.5GBASE-T1 */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_5GBT1 0x0005 /* Select 5GBASE-T1 */
+#define MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_10GBT1 0x0006 /* Select 10GBASE-T1 */
+/* Legacy names, kept for userspace */
+#define MDIO_PMA_PMD_BT1_CTRL_STRAP MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL
+#define MDIO_PMA_PMD_BT1_CTRL_STRAP_B1000 MDIO_PMA_PMD_BT1_CTRL_TYPE_SEL_1000BT1
#define MDIO_PMA_PMD_BT1_CTRL_CFG_MST 0x4000 /* MASTER-SLAVE config value */
/* 1000BASE-T1 PCS control register */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 476/990] selftests: tls: Skip the zero_len tests when TLS is unavailable
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (474 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 475/990] net: phy: c45: select BASE-T1 type for the forced speed Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 477/990] nsh: limit recursion in nsh_gso_segment() Greg Kroah-Hartman
` (376 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <cel@kernel.org>
[ Upstream commit 77389a6d30a262fa94d427c03a393c05c013665c ]
FIXTURE_SETUP(zero_len) returns early when ulp_sock_pair() reports
that the TCP_ULP setsockopt failed, so on a kernel built without
CONFIG_TLS the TLS_RX setsockopt never runs. TEST_F(zero_len, test)
then sends its raw records over a plain TCP socket, which returns
the ciphertext verbatim. All eight variants FAIL on a machine that
lacks TLS, and those failures mask any real regression in the same
run.
Skip the test when the fixture recorded notls, as the other
fixtures in this file do.
Fixes: a61a3e961baf ("selftests: tls: add tests for zero-length records")
Signed-off-by: Chuck Lever <cel@kernel.org>
Link: https://patch.msgid.link/20261111185522.2859004-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/net/tls.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index b37ebc2beac7a..462f80a46b900 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -2558,6 +2558,9 @@ TEST_F(zero_len, test)
int rec_off;
int i;
+ if (self->notls)
+ SKIP(return, "no TLS support");
+
for (i = 0; i < 4 && variant->recs[i]; i++)
EXPECT_EQ(send(self->fd, variant->recs[i]->cipher_data,
variant->recs[i]->cipher_len, 0),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 477/990] nsh: limit recursion in nsh_gso_segment()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (475 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 476/990] selftests: tls: Skip the zero_len tests when TLS is unavailable Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 478/990] tracing: skip boot kprobe setup when no events were requested Greg Kroah-Hartman
` (375 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jiri Benc, 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 3921fb102d78a6d7aa61b8d273e097a1a8026b90 ]
nsh_gso_segment() calls skb_mac_gso_segment() for the inner packet,
which calls nsh_gso_segment() again when the next protocol is NSH,
either directly or behind an inner Ethernet header (ETH_P_TEB).
Nothing limits the depth: a GSO packet made of stacked 8-byte NSH
headers recurses once per header, and a 64KB packet can hold about
8000 of them, overflowing the kernel stack.
Such a packet can be injected with a packet socket using
PACKET_VNET_HDR, or with tun/tap or virtio_net, as nothing checks
that a GSO packet with VIRTIO_NET_HDR_F_NEEDS_CSUM carries the
protocol it claims. It is then segmented in software if the output
device does not support the GSO type:
BUG: TASK stack guard page was hit at ffffcad5c0ab3ff8 (stack is ffffcad5c0ab4000..ffffcad5c0ab8000)
Oops: stack guard page: 0000 [#1] SMP NOPTI
CPU: 3 UID: 0 PID: 337 Comm: nsh_gso Tainted: G E 7.4.0-rc1+ #118 PREEMPT(lazy)
RIP: 0010:lock_acquire (kernel/locking/lockdep.c:5902)
Call Trace:
<TASK>
skb_mac_gso_segment (include/linux/rcupdate.h:309 include/linux/rcupdate.h:849 net/core/gso.c:50)
nsh_gso_segment (net/nsh/nsh.c:110) nsh
skb_mac_gso_segment (net/core/gso.c:53)
nsh_gso_segment (net/nsh/nsh.c:110) nsh
[...]
skb_mac_gso_segment (net/core/gso.c:53)
__skb_gso_segment (net/core/gso.c:129)
validate_xmit_skb (net/core/dev.c:4238)
__dev_queue_xmit (net/core/dev.c:5087)
packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189)
__sys_sendto (net/socket.c:800 net/socket.c:818 net/socket.c:2283)
__x64_sys_sendto (net/socket.c:2290 net/socket.c:2286 net/socket.c:2286)
do_syscall_64 (arch/x86/entry/syscall_64.c:61 arch/x86/entry/syscall_64.c:84)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
Use gso_recursion_inc_test(), added in commit 006c8b834aed ("net: gso:
limit recursive IP-in-IP segmentation"), with the same limit as IPv4
and IPv6. The counter is shared with them: a packet with four NSH
headers in front of an IPv4 header is still segmented, one more NSH
header and it is dropped.
The NSH -> ETH_P_TEB -> NSH route is covered as well, as each round
goes through nsh_gso_segment().
Fixes: c411ed854584 ("nsh: add GSO support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/netdev/179443691180.2199510.148246238688217560@kernel.org/
Cc: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiri Benc <jbenc@redhat.com>
Link: https://patch.msgid.link/20261112102001.3744643-2-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/gso.h | 2 +-
net/nsh/nsh.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/net/gso.h b/include/net/gso.h
index 0749230d414ec..e311a8f5b5a72 100644
--- a/include/net/gso.h
+++ b/include/net/gso.h
@@ -19,7 +19,7 @@ struct skb_gso_cb {
int encap_level;
__wsum csum;
__u16 csum_start;
- /* Number of IPv4/IPv6 GSO handler entries for this packet. */
+ /* Number of IPv4/IPv6/NSH GSO handler entries for this packet. */
u8 recursion_counter;
};
#define SKB_GSO_CB_OFFSET 32
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c
index bfb7758063f31..dd4de50fc38c3 100644
--- a/net/nsh/nsh.c
+++ b/net/nsh/nsh.c
@@ -9,6 +9,7 @@
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/gso.h>
+#include <net/ip_tunnels.h>
#include <net/nsh.h>
#include <net/tun_proto.h>
@@ -84,6 +85,12 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
skb_reset_network_header(skb);
+ /* NSH can carry NSH (directly, or in an inner Ethernet frame):
+ * limit the recursion, as IPv4 and IPv6 do.
+ */
+ if (unlikely(gso_recursion_inc_test(skb, IP_TUNNEL_RECURSION_LIMIT)))
+ goto out;
+
outer_proto = skb->protocol;
outer_hlen = skb_mac_header_len(skb);
mac_len = skb->mac_len;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 478/990] tracing: skip boot kprobe setup when no events were requested
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (476 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 477/990] nsh: limit recursion in nsh_gso_segment() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 479/990] docs, kprobes: Fix bracket Greg Kroah-Hartman
` (374 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Wenwen Fu, Masami Hiramatsu (Google),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wenwen Fu <wenwfu@qti.qualcomm.com>
[ Upstream commit 2388a673e9276de30c7e917fce50830e497d46cc ]
setup_boot_kprobe_events() calls enable_boot_kprobe_events() even when
the kprobe_event= boot parameter was not supplied. That call takes
event_mutex without any command-line probes to enable.
Asynchronous eval-map updates also hold event_mutex. A normal boot can
therefore wait in init_kprobe_trace() for this background work despite
having no boot probes to set up.
Return early when the boot-event buffer is empty. Keep the mutex
protection in trace_event_update_all() and retain setup for explicit
kprobe_event= parameters. Bootconfig handles its own probe enablement,
and the existing trace_eval_sync() still waits for background work
before init memory is freed.
Link: https://lore.kernel.org/all/20261106021457.2648231-1-wenwfu@qti.qualcomm.com/
Fixes: 970988e19eb0 ("tracing/kprobe: Add kprobe_event= boot parameter")
Signed-off-by: Wenwen Fu <wenwfu@qti.qualcomm.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/trace/trace_kprobe.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index ee8171b19bee2..52ec16d8d8384 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1995,6 +1995,9 @@ static __init void setup_boot_kprobe_events(void)
char *p, *cmd = kprobe_boot_events_buf;
int ret;
+ if (!kprobe_boot_events_buf[0])
+ return;
+
strreplace(kprobe_boot_events_buf, ',', ' ');
while (cmd && *cmd != '\0') {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 479/990] docs, kprobes: Fix bracket
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (477 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 478/990] tracing: skip boot kprobe setup when no events were requested Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 480/990] KEYS: do not let an unmatched key decide the search result Greg Kroah-Hartman
` (373 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Manuel Ebner, Randy Dunlap,
Masami Hiramatsu (Google), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Ebner <manuelebnerli@mailbox.org>
[ Upstream commit b91a5c16996d089cd07ceaf33b5a621cb94c2c2f ]
Remove needless ')'
Link: https://lore.kernel.org/all/20261112085511.690900-2-manuelebnerli@mailbox.org/
Fixes: a1dac767622c ("kprobes.txt: standardize document format")
Signed-off-by: Manuel Ebner <manuelebnerli@mailbox.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/trace/kprobes.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/trace/kprobes.rst b/Documentation/trace/kprobes.rst
index 5e606730cec63..0b19d82d7d4cb 100644
--- a/Documentation/trace/kprobes.rst
+++ b/Documentation/trace/kprobes.rst
@@ -31,7 +31,7 @@ can trap at almost any kernel code address [1]_, specifying a handler
routine to be invoked when the breakpoint is hit.
.. [1] some parts of the kernel code can not be trapped, see
- :ref:`kprobes_blacklist`)
+ :ref:`kprobes_blacklist`
There are currently two types of probes: kprobes, and kretprobes
(also called return probes). A kprobe can be inserted on virtually
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 480/990] KEYS: do not let an unmatched key decide the search result
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (478 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 479/990] docs, kprobes: Fix bracket Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 481/990] ALSA: aw2-alsa: select SND_PCM Greg Kroah-Hartman
` (372 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jarkko Sakkinen, Guixiong Wei,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixiong Wei <weiguixiong@bytedance.com>
[ Upstream commit 143fe160178c73e43575bff4890d23f84e37146d ]
With the dns_resolver key type available, put a key named "foo" in a
fresh session keyring, revoke it, and search for "bar":
keyctl new_session >/dev/null
A=$(printf '127.0.0.1\0' | keyctl padd dns_resolver foo @s)
keyctl revoke "$A"
keyctl search @s dns_resolver bar
Results:
keyctl_search: Key has been revoked
The search returns -EKEYREVOKED even though there is no key named "bar".
It should return -ENOKEY.
A dns_resolver search walks the keys in the keyring and uses
dns_resolver_cmp() to compare their descriptions with the requested
name. When keyring_search_iterator() sees the revoked "foo" key, it
records -EKEYREVOKED in ctx->result and skips the key before comparing
its description. The search continues, but without a match it returns
the error recorded for "foo".
Call the match callback before checking for invalidated, revoked or
expired keys. A nonmatching key then leaves ctx->result alone.
Fixes: b2a4df200d57 ("KEYS: Expand the capacity of a keyring")
Reported-by: Jarkko Sakkinen <jarkko@kernel.org>
Closes: https://lore.kernel.org/lkml/avDG8G-Jl1YsmfCs@kernel.org/
Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261109032931.80406-2-weiguixiong@bytedance.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
security/keys/keyring.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 74ed1372d22cf..c339b4073ea02 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -598,6 +598,12 @@ static int keyring_search_iterator(const void *object, void *iterator_data)
return 0;
}
+ /* A key the caller did not ask for must not decide the result. */
+ if (!ctx->match_data.cmp(key, &ctx->match_data)) {
+ kleave(" = 0 [!match]");
+ return 0;
+ }
+
/* skip invalidated, revoked and expired keys */
if (ctx->flags & KEYRING_SEARCH_DO_STATE_CHECK) {
time64_t expiry = READ_ONCE(key->expiry);
@@ -617,12 +623,6 @@ static int keyring_search_iterator(const void *object, void *iterator_data)
}
}
- /* keys that don't match */
- if (!ctx->match_data.cmp(key, &ctx->match_data)) {
- kleave(" = 0 [!match]");
- return 0;
- }
-
/* key must have search permissions */
if (!(ctx->flags & KEYRING_SEARCH_NO_CHECK_PERM) &&
key_task_permission(make_key_ref(key, ctx->possessed),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 481/990] ALSA: aw2-alsa: select SND_PCM
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (479 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 480/990] KEYS: do not let an unmatched key decide the search result Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 482/990] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Greg Kroah-Hartman
` (371 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jude Gyimah, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jude Gyimah <jude.gyimah87@gmail.com>
[ Upstream commit bca568589ad118a9b0bac086760baee2a41976a5 ]
Several stanzas in sound/pci/Kconfig select SND_PCM.
SND_AW2 selects nothing at all.
aw2-alsa calls snd_pcm_new, which sound/core/pcm.c provides under SND_PCM.
aw2-alsa.c:(.text+0x554): undefined reference to `snd_pcm_new'
4 symbols are undefined in all.
The driver can be built into vmlinux while SND_PCM is a module, in which
case the symbols are not there at link time.
Select rather than depend on: SND_PCM has no prompt of its own and is only
ever enabled by a select, so a depends on would leave SND_AW2
unselectable.
Reproduced on v7.3, arm64, with CONFIG_SND_AW2=y and CONFIG_SND_PCM=m.
Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.
Fixes: 98f2a97f207a ("[ALSA] Emagic Audiowerk 2 ALSA driver.")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
Link: https://patch.msgid.link/20261113064614.15045-1-jude.gyimah87@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/pci/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index e0996a9d90b03..776d778fa30ec 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -141,6 +141,7 @@ config SND_AU8830
config SND_AW2
tristate "Emagic Audiowerk 2"
+ select SND_PCM
help
Say Y here to include support for Emagic Audiowerk 2 soundcards.
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 482/990] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (480 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 481/990] ALSA: aw2-alsa: select SND_PCM Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 483/990] s390/zcrypt: Make apfs a real unsigned int field Greg Kroah-Hartman
` (370 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Beulich, Juergen Gross,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <jbeulich@suse.com>
[ Upstream commit 2b66f2cc753243a6adb3e9a5c038b0fc59ba7ec9 ]
Both decrease-reservation and populate-physmap can succeed partially. For
the former this may be pretty unlikely, but clearly the latter can hit
both out-of-memory conditions in the hypervisor or denial because of the
allocation exceeding the domain's allowance (there's no interaction with
the balloon driver here either).
In gnttab_dma_free_pages() we simply can't give back to the system what
hasn't been re-filled with backing memory. For gnttab_dma_alloc_pages()
both parts of the overall region need dealing with differently.
While no present caller of gnttab_dma_free_pages() checks its return
value, also don't use -EFAULT there: It really is an out-of-memory
condition. (In gnttab_dma_alloc_pages() -EFAULT doesn't look quite right
either, but I couldn't think of a clearly better error code there.)
Fixes: 9bdc7304f536 ("xen/grant-table: Allow allocating buffers suitable for DMA")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261110095605.369848-3-jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/xen/grant-table.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 261020f6b7776..823bd755a472c 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -1096,6 +1096,24 @@ int gnttab_dma_alloc_pages(struct gnttab_dma_alloc_args *args)
ret = xenmem_reservation_decrease(args->nr_pages, args->frames);
if (ret != args->nr_pages) {
pr_debug("Failed to decrease reservation for DMA buffer\n");
+ if (ret >= 0) {
+ /* Free the part where decrease didn't work. */
+ size_t done = ret << PAGE_SHIFT;
+
+ if (args->coherent)
+ dma_free_coherent(args->dev, size - done,
+ args->vaddr + done,
+ args->dev_bus_addr + done);
+ else
+ dma_free_wc(args->dev, size - done,
+ args->vaddr + done,
+ args->dev_bus_addr + done);
+
+ if (!ret) /* Nothing else to do? */
+ return -EFAULT;
+
+ args->nr_pages = ret;
+ }
ret = -EFAULT;
goto fail;
}
@@ -1129,7 +1147,12 @@ int gnttab_dma_free_pages(struct gnttab_dma_alloc_args *args)
ret = xenmem_reservation_increase(args->nr_pages, args->frames);
if (ret != args->nr_pages) {
pr_debug("Failed to increase reservation for DMA buffer\n");
- ret = -EFAULT;
+ /* Can only free what has been re-filled. */
+ if (!ret)
+ return -ENOMEM;
+ if (ret > 0)
+ args->nr_pages = ret;
+ ret = -ENOMEM;
} else {
ret = 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 483/990] s390/zcrypt: Make apfs a real unsigned int field
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (481 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 482/990] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 484/990] s390/zcrypt: Fix and improve zcrypt reply message verification checks Greg Kroah-Hartman
` (369 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Holger Dengler, Harald Freudenberger,
Heiko Carstens, Vasily Gorbik, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <freude@linux.ibm.com>
[ Upstream commit ecd2fd113e89978ca750a81dea033a2e9f3347df ]
Slight rework on the apfs field: Instead of unsigned char[4]
make this a real 32 bit unsigned int field. With that done,
some assignments and some printouts can be simplified.
With that comes a slight move of the anonymous struct covering
the message type 86 header to dedupe some code lines.
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Stable-dep-of: 5e9b339f3232 ("s390/zcrypt: Fix and improve zcrypt reply message verification checks")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/crypto/zcrypt_error.h | 28 ++++++++++-----------------
drivers/s390/crypto/zcrypt_msgtype6.c | 2 +-
drivers/s390/crypto/zcrypt_msgtype6.h | 4 ++--
3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/drivers/s390/crypto/zcrypt_error.h b/drivers/s390/crypto/zcrypt_error.h
index 46e27b43a8afe..fd10302e68d36 100644
--- a/drivers/s390/crypto/zcrypt_error.h
+++ b/drivers/s390/crypto/zcrypt_error.h
@@ -78,9 +78,13 @@ struct error_hdr {
static inline int convert_error(struct zcrypt_queue *zq,
struct ap_message *reply)
{
- struct error_hdr *ehdr = reply->msg;
- int card = AP_QID_CARD(zq->queue->qid);
int queue = AP_QID_QUEUE(zq->queue->qid);
+ int card = AP_QID_CARD(zq->queue->qid);
+ struct error_hdr *ehdr = reply->msg;
+ struct {
+ struct type86_hdr hdr;
+ struct type86_fmt2_ext fmt2;
+ } __packed * t86hdr = reply->msg;
switch (ehdr->reply_code) {
case REP82_ERROR_INVALID_MSG_LEN: /* 0x23 */
@@ -100,19 +104,12 @@ static inline int convert_error(struct zcrypt_queue *zq,
/* RY indicates malformed request */
if (ehdr->reply_code == REP82_ERROR_FILTERED_BY_HYPERVISOR &&
ehdr->type == TYPE86_RSP_CODE) {
- struct {
- struct type86_hdr hdr;
- struct type86_fmt2_ext fmt2;
- } __packed * head = reply->msg;
- unsigned int apfs = *((u32 *)head->fmt2.apfs);
-
ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x apfs=0x%x => rc=EINVAL\n",
__func__, card, queue,
- ehdr->reply_code, apfs);
+ ehdr->reply_code, t86hdr->fmt2.apfs);
} else {
ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x => rc=EINVAL\n",
- __func__, card, queue,
- ehdr->reply_code);
+ __func__, card, queue, ehdr->reply_code);
}
return -EINVAL;
case REP82_ERROR_MACHINE_FAILURE: /* 0x10 */
@@ -125,15 +122,10 @@ static inline int convert_error(struct zcrypt_queue *zq,
/* For type 86 response show the apfs value (failure reason) */
if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL &&
ehdr->type == TYPE86_RSP_CODE) {
- struct {
- struct type86_hdr hdr;
- struct type86_fmt2_ext fmt2;
- } __packed * head = reply->msg;
- unsigned int apfs = *((u32 *)head->fmt2.apfs);
-
ZCRYPT_DBF_WARN(
"%s dev=%02x.%04x RY=0x%02x apfs=0x%x => bus rescan, rc=EAGAIN\n",
- __func__, card, queue, ehdr->reply_code, apfs);
+ __func__, card, queue, ehdr->reply_code,
+ t86hdr->fmt2.apfs);
} else {
ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x => bus rescan, rc=EAGAIN\n",
__func__, card, queue,
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.c b/drivers/s390/crypto/zcrypt_msgtype6.c
index f0ad39a33fb03..0073bfa369e93 100644
--- a/drivers/s390/crypto/zcrypt_msgtype6.c
+++ b/drivers/s390/crypto/zcrypt_msgtype6.c
@@ -829,7 +829,7 @@ static int convert_response_xcrb(bool userspace, struct zcrypt_queue *zq,
return convert_error(zq, reply);
case TYPE86_RSP_CODE:
if (msg->hdr.reply_code) {
- memcpy(&xcrb->status, msg->fmt2.apfs, sizeof(u32));
+ xcrb->status = msg->fmt2.apfs;
return convert_error(zq, reply);
}
if (msg->cprbx.cprb_ver_id == 0x02)
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.h b/drivers/s390/crypto/zcrypt_msgtype6.h
index 9cbe6e2b2d33c..8cc227df55c88 100644
--- a/drivers/s390/crypto/zcrypt_msgtype6.h
+++ b/drivers/s390/crypto/zcrypt_msgtype6.h
@@ -34,7 +34,7 @@ struct type6_hdr {
unsigned char right[4]; /* 0x00000000 */
unsigned char reserved3[2]; /* 0x0000 */
unsigned char reserved4[2]; /* 0x0000 */
- unsigned char apfs[4]; /* 0x00000000 */
+ unsigned int apfs; /* 0x00000000 */
unsigned int offset1; /* 0x00000058 (offset to CPRB) */
unsigned int offset2; /* 0x00000000 */
unsigned int offset3; /* 0x00000000 */
@@ -83,7 +83,7 @@ struct type86_hdr {
struct type86_fmt2_ext {
unsigned char reserved[4]; /* 0x00000000 */
- unsigned char apfs[4]; /* final status */
+ unsigned int apfs; /* final status */
unsigned int count1; /* length of CPRB + parameters */
unsigned int offset1; /* offset to CPRB */
unsigned int count2; /* 0x00000000 */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 484/990] s390/zcrypt: Fix and improve zcrypt reply message verification checks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (482 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 483/990] s390/zcrypt: Make apfs a real unsigned int field Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 485/990] s390/zcrypt: Explicitly use a card variable in _zcrypt_send_cprb Greg Kroah-Hartman
` (368 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Harald Freudenberger, Holger Dengler,
Heiko Carstens, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <freude@linux.ibm.com>
[ Upstream commit 5e9b339f323216d71f3ede8a0a427abf7859c486 ]
Add or improve checks related to buffer sizes and reply sizes to the
handling of replies from the crypto cards for CCA, EP11 (AP message
type 6) and ICA (AP type 50) messages. The verification code related
to reply field length was not designed well and thus firmware
deficiencies could lead to unexpected behavior in the zcrypt device
driver. Thus improve the code to more closely inspect especially
length fields at message replies.
Add length validation before accessing reply message structures in
zcrypt_msgtype6_receive(), zcrypt_msgtype6_receive_ep11(), and
zcrypt_msgtype50_receive() to prevent out-of-bounds reads and
potential kernel memory disclosure.
Also rework these three functions to validate reply lengths more
carefully before copying data back into the request buffer. Use size_t
for length calculations, reject inconsistent reply sizes, and add
defensive handling for short invalid replies. For XCRB replies,
validate both reply segments and derive the effective message length
from the covered range instead of trusting only the second segment.
Additionally improve some of the later invoked evaluation functions
which further check the payload. Add comments about length assumptions
and for the type50 processing rework the payload processing completely
with removing a misplaced BUG_ON().
Fixes: 5e55a488c87a ("s390/zcrypt: Separate msgtype implementation from card modules.")
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Cc: stable@vger.kernel.org
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/crypto/zcrypt_msgtype50.c | 95 ++++++++----
drivers/s390/crypto/zcrypt_msgtype6.c | 202 ++++++++++++++++++-------
2 files changed, 218 insertions(+), 79 deletions(-)
diff --git a/drivers/s390/crypto/zcrypt_msgtype50.c b/drivers/s390/crypto/zcrypt_msgtype50.c
index fc0a2a053dc22..fecc93f73b454 100644
--- a/drivers/s390/crypto/zcrypt_msgtype50.c
+++ b/drivers/s390/crypto/zcrypt_msgtype50.c
@@ -153,6 +153,11 @@ struct type80_hdr {
unsigned char reserved3[8];
} __packed;
+struct type80_reply {
+ struct type80_hdr hdr;
+ char data[];
+} __packed;
+
int get_rsa_modex_fc(struct ica_rsa_modexpo *mex, int *fcode)
{
if (!mex->inputdatalength)
@@ -341,32 +346,43 @@ static int ICACRT_msg_to_type50CRT_msg(struct zcrypt_queue *zq,
* @data: pointer to user output data
* @length: size of user output data
*
- * Returns 0 on success or -EFAULT.
+ * Returns 0 on success or neg. errno value on failure.
*/
static int convert_type80(struct zcrypt_queue *zq,
struct ap_message *reply,
char __user *outputdata,
unsigned int outputdatalength)
{
- struct type80_hdr *t80h = reply->msg;
- unsigned char *data;
+ struct type80_reply *msg = reply->msg;
+ size_t payload_len;
+
+ /*
+ * reply->len is always >= sizeof(struct type80_reply) here and
+ * outputdatalength (the modulus size) is guaranteed to be equal to
+ * inputdatalength and 0 < outputdatalength <= CEX3A_MAX_MOD_SIZE,
+ * also payload size may be >= outputdatalength.
+ */
+
+ payload_len = reply->len - sizeof(msg->hdr);
- if (t80h->len < sizeof(*t80h) + outputdatalength) {
- /* The result is too short, the CEXxA card may not do that.. */
+ if (outputdatalength > payload_len) {
+ /* We expect at least outputdatalength bytes, broken card ? */
zq->online = 0;
pr_err("Crypto dev=%02x.%04x code=0x%02x => online=0 rc=EAGAIN\n",
AP_QID_CARD(zq->queue->qid),
- AP_QID_QUEUE(zq->queue->qid), t80h->code);
+ AP_QID_QUEUE(zq->queue->qid), msg->hdr.code);
ZCRYPT_DBF_ERR("%s dev=%02x.%04x code=0x%02x => online=0 rc=EAGAIN\n",
__func__, AP_QID_CARD(zq->queue->qid),
- AP_QID_QUEUE(zq->queue->qid), t80h->code);
+ AP_QID_QUEUE(zq->queue->qid), msg->hdr.code);
ap_send_online_uevent(&zq->queue->ap_dev, zq->online);
return -EAGAIN;
}
- BUG_ON(t80h->len > CEX3A_MAX_RESPONSE_SIZE);
- data = reply->msg + t80h->len - outputdatalength;
- if (copy_to_user(outputdata, data, outputdatalength))
+
+ if (copy_to_user(outputdata,
+ msg->data + payload_len - outputdatalength,
+ outputdatalength))
return -EFAULT;
+
return 0;
}
@@ -375,14 +391,19 @@ static int convert_response(struct zcrypt_queue *zq,
char __user *outputdata,
unsigned int outputdatalength)
{
- /* Response type byte is the second byte in the response. */
- unsigned char rtype = ((unsigned char *)reply->msg)[1];
+ struct type80_reply *msg = reply->msg;
+
+ /* reply->len is always >= sizeof(struct error_hdr) here */
- switch (rtype) {
+ switch (msg->hdr.type) {
case TYPE82_RSP_CODE:
case TYPE88_RSP_CODE:
return convert_error(zq, reply);
case TYPE80_RSP_CODE:
+ if (msg->hdr.code)
+ return convert_error(zq, reply);
+ if (reply->len < sizeof(struct type80_reply))
+ return -EINVAL;
return convert_type80(zq, reply,
outputdata, outputdatalength);
default: /* Unknown response type, this should NEVER EVER happen */
@@ -390,11 +411,11 @@ static int convert_response(struct zcrypt_queue *zq,
pr_err("Crypto dev=%02x.%04x unknown response type 0x%02x => online=0 rc=EAGAIN\n",
AP_QID_CARD(zq->queue->qid),
AP_QID_QUEUE(zq->queue->qid),
- (int)rtype);
+ (int)msg->hdr.type);
ZCRYPT_DBF_ERR(
"%s dev=%02x.%04x unknown response type 0x%02x => online=0 rc=EAGAIN\n",
__func__, AP_QID_CARD(zq->queue->qid),
- AP_QID_QUEUE(zq->queue->qid), (int)rtype);
+ AP_QID_QUEUE(zq->queue->qid), (int)msg->hdr.type);
ap_send_online_uevent(&zq->queue->ap_dev, zq->online);
return -EAGAIN;
}
@@ -417,26 +438,46 @@ static void zcrypt_msgtype50_receive(struct ap_queue *aq,
.reply_code = REP82_ERROR_MACHINE_FAILURE,
};
struct type80_hdr *t80h;
- int len;
+ size_t len;
/* Copy the reply message to the request message buffer. */
if (!reply)
goto out; /* ap_msg->rc indicates the error */
+
t80h = reply->msg;
- if (t80h->type == TYPE80_RSP_CODE) {
- len = t80h->len;
- if (len > reply->bufsize || len > msg->bufsize ||
- len != reply->len) {
- pr_debug("len mismatch => EMSGSIZE\n");
- msg->rc = -EMSGSIZE;
+
+ if (reply->len < sizeof(*t80h) ||
+ t80h->type != TYPE80_RSP_CODE) {
+ if (reply->len < sizeof(error_reply)) {
+ /* total broken reply, use static error reply instead */
+ memcpy(msg->msg, &error_reply, sizeof(error_reply));
+ msg->len = sizeof(error_reply);
goto out;
+ } else {
+ /* malformed reply, convert function will handle this */
+ len = reply->len;
+ goto copy_len_and_out;
}
- memcpy(msg->msg, reply->msg, len);
- msg->len = len;
- } else {
- memcpy(msg->msg, reply->msg, sizeof(error_reply));
- msg->len = sizeof(error_reply);
}
+
+ len = t80h->len;
+
+copy_len_and_out:
+ if (len != reply->len) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("len %zu rpl.len %zu mismatch, msg.rc=%d\n",
+ len, reply->len, msg->rc);
+ goto out;
+ }
+ if (len > reply->bufsize || len > msg->bufsize) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("len %zu exceeds buf %zu/%zu, msg.rc=%d\n",
+ len, reply->bufsize, msg->bufsize, msg->rc);
+ goto out;
+ }
+ memcpy(msg->msg, reply->msg, len);
+ msg->len = len;
+
out:
complete(&msg->response.work);
}
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.c b/drivers/s390/crypto/zcrypt_msgtype6.c
index 0073bfa369e93..44fe50396d96f 100644
--- a/drivers/s390/crypto/zcrypt_msgtype6.c
+++ b/drivers/s390/crypto/zcrypt_msgtype6.c
@@ -768,6 +768,15 @@ static int convert_type86_rng(struct zcrypt_queue *zq,
if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0)
return -EINVAL;
+ /*
+ * Note that offset2 and count2 have already been checked in
+ * zcrypt_msgtype6_receive(). So only check for valid count2
+ * and for not exceeding the hard coded rng buffer size.
+ */
+ if (!msg->fmt2.count2)
+ return -EINVAL;
+ if (msg->fmt2.count2 > ZCRYPT_RNG_BUFFER_SIZE)
+ return -EMSGSIZE;
memcpy(buffer, data + msg->fmt2.offset2, msg->fmt2.count2);
return msg->fmt2.count2;
}
@@ -779,11 +788,17 @@ static int convert_response_ica(struct zcrypt_queue *zq,
{
struct type86x_reply *msg = reply->msg;
+ /* reply->len is always >= sizeof(struct error_hdr) here */
+
switch (msg->hdr.type) {
case TYPE82_RSP_CODE:
case TYPE88_RSP_CODE:
return convert_error(zq, reply);
case TYPE86_RSP_CODE:
+ if (msg->hdr.reply_code)
+ return convert_error(zq, reply);
+ if (reply->len < sizeof(struct type86x_reply))
+ return -EINVAL;
if (msg->cprbx.ccp_rtcode &&
msg->cprbx.ccp_rscode == 0x14f &&
outputdatalength > 256) {
@@ -794,8 +809,6 @@ static int convert_response_ica(struct zcrypt_queue *zq,
return -EINVAL;
}
}
- if (msg->hdr.reply_code)
- return convert_error(zq, reply);
if (msg->cprbx.cprb_ver_id == 0x02)
return convert_type86_ica(zq, reply,
outputdata, outputdatalength);
@@ -822,6 +835,8 @@ static int convert_response_xcrb(bool userspace, struct zcrypt_queue *zq,
{
struct type86x_reply *msg = reply->msg;
+ /* reply->len is always >= sizeof(struct error_hdr) here */
+
switch (msg->hdr.type) {
case TYPE82_RSP_CODE:
case TYPE88_RSP_CODE:
@@ -829,9 +844,16 @@ static int convert_response_xcrb(bool userspace, struct zcrypt_queue *zq,
return convert_error(zq, reply);
case TYPE86_RSP_CODE:
if (msg->hdr.reply_code) {
- xcrb->status = msg->fmt2.apfs;
+ if (reply->len < sizeof(struct type86_fmt2_msg))
+ xcrb->status = 0x0008044DL;
+ else
+ xcrb->status = msg->fmt2.apfs;
return convert_error(zq, reply);
}
+ if (reply->len < sizeof(struct type86_fmt2_msg) +
+ offsetof(struct CPRBX, cprb_ver_id) +
+ sizeof(msg->cprbx.cprb_ver_id))
+ return -EINVAL;
if (msg->cprbx.cprb_ver_id == 0x02)
return convert_type86_xcrb(userspace, zq, reply, xcrb);
fallthrough; /* wrong cprb version is an unknown response */
@@ -856,6 +878,8 @@ static int convert_response_ep11_xcrb(bool userspace, struct zcrypt_queue *zq,
{
struct type86_ep11_reply *msg = reply->msg;
+ /* reply->len is always >= sizeof(struct error_hdr) here */
+
switch (msg->hdr.type) {
case TYPE82_RSP_CODE:
case TYPE87_RSP_CODE:
@@ -863,6 +887,8 @@ static int convert_response_ep11_xcrb(bool userspace, struct zcrypt_queue *zq,
case TYPE86_RSP_CODE:
if (msg->hdr.reply_code)
return convert_error(zq, reply);
+ if (reply->len < sizeof(struct type86_ep11_reply))
+ return -EINVAL;
if (msg->cprbx.cprb_ver_id == 0x04)
return convert_type86_ep11_xcrb(userspace, zq, reply, xcrb);
fallthrough; /* wrong cprb version is an unknown resp */
@@ -887,6 +913,8 @@ static int convert_response_rng(struct zcrypt_queue *zq,
{
struct type86x_reply *msg = reply->msg;
+ /* reply->len is always >= sizeof(struct error_hdr) here */
+
switch (msg->hdr.type) {
case TYPE82_RSP_CODE:
case TYPE88_RSP_CODE:
@@ -894,6 +922,8 @@ static int convert_response_rng(struct zcrypt_queue *zq,
case TYPE86_RSP_CODE:
if (msg->hdr.reply_code)
return -EINVAL;
+ if (reply->len < sizeof(struct type86x_reply))
+ return -EINVAL;
if (msg->cprbx.cprb_ver_id == 0x02)
return convert_type86_rng(zq, reply, data);
fallthrough; /* wrong cprb version is an unknown response */
@@ -930,48 +960,85 @@ static void zcrypt_msgtype6_receive(struct ap_queue *aq,
};
struct ap_response_type *resp_type = &msg->response;
struct type86x_reply *t86r;
- int len;
+ size_t minlen, len;
/* Copy the reply message to the request message buffer. */
if (!reply)
goto out; /* ap_msg->rc indicates the error */
+
t86r = reply->msg;
- if (t86r->hdr.type == TYPE86_RSP_CODE &&
- t86r->cprbx.cprb_ver_id == 0x02) {
- switch (resp_type->type) {
- case CEXXC_RESPONSE_TYPE_ICA:
- len = sizeof(struct type86x_reply) + t86r->length;
- if (len > reply->bufsize || len > msg->bufsize ||
- len != reply->len) {
- pr_debug("len mismatch => EMSGSIZE\n");
- msg->rc = -EMSGSIZE;
- goto out;
- }
- memcpy(msg->msg, reply->msg, len);
- msg->len = len;
- break;
- case CEXXC_RESPONSE_TYPE_XCRB:
- if (t86r->fmt2.count2)
- len = t86r->fmt2.offset2 + t86r->fmt2.count2;
- else
- len = t86r->fmt2.offset1 + t86r->fmt2.count1;
- if (len > reply->bufsize || len > msg->bufsize ||
- len != reply->len) {
- pr_debug("len mismatch => EMSGSIZE\n");
+ minlen = sizeof(t86r->hdr) + sizeof(t86r->fmt2) +
+ offsetof(struct CPRBX, cprb_ver_id) +
+ sizeof(t86r->cprbx.cprb_ver_id);
+
+ if (reply->len < minlen ||
+ t86r->hdr.type != TYPE86_RSP_CODE ||
+ t86r->cprbx.cprb_ver_id != 0x02) {
+ if (reply->len < sizeof(error_reply)) {
+ /* total broken reply, use static error reply instead */
+ memcpy(msg->msg, &error_reply, sizeof(error_reply));
+ msg->len = sizeof(error_reply);
+ goto out;
+ } else {
+ /* malformed reply, convert function will handle this */
+ len = reply->len;
+ goto copy_len_and_out;
+ }
+ }
+
+ switch (resp_type->type) {
+ case CEXXC_RESPONSE_TYPE_ICA:
+ if (reply->len < sizeof(struct type86x_reply)) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("rpl.len %zu < struct type86_reply, msg.rc=%d\n",
+ reply->len, msg->rc);
+ goto out;
+ }
+ len = sizeof(struct type86x_reply) + (size_t)t86r->length;
+ break;
+ case CEXXC_RESPONSE_TYPE_XCRB:
+ len = (size_t)t86r->fmt2.offset1 + (size_t)t86r->fmt2.count1;
+ if (len > reply->len) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("offset1 %u count1 %u rpl.len %zu mismatch, msg.rc=%d\n",
+ t86r->fmt2.offset1, t86r->fmt2.count1,
+ reply->len, msg->rc);
+ goto out;
+ }
+ if (t86r->fmt2.count2) {
+ len = (size_t)t86r->fmt2.offset2 +
+ (size_t)t86r->fmt2.count2;
+ if (len > reply->len) {
msg->rc = -EMSGSIZE;
+ pr_debug("offset2 %u count2 %u rpl.len %zu mismatch, msg.rc=%d\n",
+ t86r->fmt2.offset2, t86r->fmt2.count2,
+ reply->len, msg->rc);
goto out;
}
- memcpy(msg->msg, reply->msg, len);
- msg->len = len;
- break;
- default:
- memcpy(msg->msg, &error_reply, sizeof(error_reply));
- msg->len = sizeof(error_reply);
}
- } else {
- memcpy(msg->msg, reply->msg, sizeof(error_reply));
+ break;
+ default:
+ memcpy(msg->msg, &error_reply, sizeof(error_reply));
msg->len = sizeof(error_reply);
+ goto out;
+ }
+
+copy_len_and_out:
+ if (len != reply->len) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("len %zu rpl.len %zu mismatch, msg.rc=%d\n",
+ len, reply->len, msg->rc);
+ goto out;
+ }
+ if (len > reply->bufsize || len > msg->bufsize) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("len %zu exceeds buf %zu/%zu, msg.rc=%d\n",
+ len, reply->bufsize, msg->bufsize, msg->rc);
+ goto out;
}
+ memcpy(msg->msg, reply->msg, len);
+ msg->len = len;
+
out:
complete(&resp_type->work);
}
@@ -994,34 +1061,65 @@ static void zcrypt_msgtype6_receive_ep11(struct ap_queue *aq,
};
struct ap_response_type *resp_type = &msg->response;
struct type86_ep11_reply *t86r;
- int len;
+ size_t minlen, len;
/* Copy the reply message to the request message buffer. */
if (!reply)
goto out; /* ap_msg->rc indicates the error */
+
t86r = reply->msg;
- if (t86r->hdr.type == TYPE86_RSP_CODE &&
- t86r->cprbx.cprb_ver_id == 0x04) {
- switch (resp_type->type) {
- case CEXXC_RESPONSE_TYPE_EP11:
- len = t86r->fmt2.offset1 + t86r->fmt2.count1;
- if (len > reply->bufsize || len > msg->bufsize ||
- len != reply->len) {
- pr_debug("len mismatch => EMSGSIZE\n");
- msg->rc = -EMSGSIZE;
- goto out;
- }
- memcpy(msg->msg, reply->msg, len);
- msg->len = len;
- break;
- default:
+ minlen = sizeof(t86r->hdr) + sizeof(t86r->fmt2) +
+ offsetof(struct ep11_cprb, cprb_ver_id) +
+ sizeof(t86r->cprbx.cprb_ver_id);
+
+ if (reply->len < minlen ||
+ t86r->hdr.type != TYPE86_RSP_CODE ||
+ t86r->cprbx.cprb_ver_id != 0x04) {
+ if (reply->len < sizeof(error_reply)) {
+ /* total broken reply, use static error reply instead */
memcpy(msg->msg, &error_reply, sizeof(error_reply));
msg->len = sizeof(error_reply);
+ goto out;
+ } else {
+ /* malformed reply, convert function will handle this */
+ len = reply->len;
+ goto copy_len_and_out;
}
- } else {
- memcpy(msg->msg, reply->msg, sizeof(error_reply));
+ }
+
+ switch (resp_type->type) {
+ case CEXXC_RESPONSE_TYPE_EP11:
+ len = (size_t)t86r->fmt2.offset1 + (size_t)t86r->fmt2.count1;
+ if (len > reply->len) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("offset1 %u count1 %u rpl.len %zu mismatch, msg.rc=%d\n",
+ t86r->fmt2.offset1, t86r->fmt2.count1,
+ reply->len, msg->rc);
+ goto out;
+ }
+ break;
+ default:
+ memcpy(msg->msg, &error_reply, sizeof(error_reply));
msg->len = sizeof(error_reply);
+ goto out;
+ }
+
+copy_len_and_out:
+ if (len != reply->len) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("len %zu rpl.len %zu mismatch, msg.rc=%d\n",
+ len, reply->len, msg->rc);
+ goto out;
+ }
+ if (len > reply->bufsize || len > msg->bufsize) {
+ msg->rc = -EMSGSIZE;
+ pr_debug("len %zu exceeds buf %zu/%zu, msg.rc=%d\n",
+ len, reply->bufsize, msg->bufsize, msg->rc);
+ goto out;
}
+ memcpy(msg->msg, reply->msg, len);
+ msg->len = len;
+
out:
complete(&resp_type->work);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 485/990] s390/zcrypt: Explicitly use a card variable in _zcrypt_send_cprb
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (483 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 484/990] s390/zcrypt: Fix and improve zcrypt reply message verification checks Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 486/990] s390/zcrypt: Guard domain index uses against speculative bypass Greg Kroah-Hartman
` (367 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Holger Dengler, Harald Freudenberger,
Heiko Carstens, Vasily Gorbik, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <freude@linux.ibm.com>
[ Upstream commit 0e72b785b60e2a33f7bfe1c492f0717e7835b9a4 ]
Use an explicit variable "card" for the card addressing in
function _zcrypt_send_cprb instead of the confusing field
"user_defined" from the ica_xcRB struct. This makes the code
somewhat cleaner and easier to understand.
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Stable-dep-of: 7b88e8b6d714 ("s390/zcrypt: Guard domain index uses against speculative bypass")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/crypto/zcrypt_api.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index eff9ad7aa14ed..640a5b35081f6 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -854,7 +854,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
struct ica_xcRB *xcrb)
{
bool userspace = xflags & ZCRYPT_XFLAG_USERSPACE;
- unsigned int domain, func_code = 0;
+ unsigned int card, domain, func_code = 0;
unsigned int wgt = 0, pref_wgt = 0;
struct zcrypt_queue *zq, *pref_zq;
struct zcrypt_card *zc, *pref_zc;
@@ -900,6 +900,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
pref_zc = NULL;
pref_zq = NULL;
+ card = xcrb->user_defined;
spin_lock(&zcrypt_list_lock);
for_each_zcrypt_card(zc) {
/* Check for usable CCA card */
@@ -907,8 +908,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
!zc->card->hwinfo.cca)
continue;
/* Check for user selected CCA card */
- if (xcrb->user_defined != AUTOSELECT &&
- xcrb->user_defined != zc->card->id)
+ if (card != AUTOSELECT && card != zc->card->id)
continue;
/* check if request size exceeds card max msg size */
if (ap_msg.len > zc->card->maxmsgsize)
@@ -952,7 +952,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
if (!pref_zq) {
pr_debug("no match for address %02x.%04x => ENODEV\n",
- xcrb->user_defined, domain);
+ card, domain);
rc = -ENODEV;
goto out;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 486/990] s390/zcrypt: Guard domain index uses against speculative bypass
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (484 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 485/990] s390/zcrypt: Explicitly use a card variable in _zcrypt_send_cprb Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 487/990] mm: khugepaged: fix folio is used after pte_unmap_unlock() Greg Kroah-Hartman
` (366 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Harald Freudenberger, Holger Dengler,
Heiko Carstens, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <freude@linux.ibm.com>
[ Upstream commit 7b88e8b6d714cd1b2b6185e2963c8ec4d98542d0 ]
The previous array_index_nospec() placement only covered the admin
permission check, leaving ap_test_config_usage_domain() and
ap_test_config_ctrl_domain() in the CCA path exposed to speculative
execution.
Move the sanitization to before all permission and config checks in
both the CCA and EP11 paths. Hold the sanitized domain value in
another variable so that the later use can choose to use either the
original value (subject to speculative execution) or the sanitized
value (which may in case of AUTOSEL_DOM reflect the wrong
value). Before that, check the domain value to be either AUTOSEL_DOM
or in range 0...AP_DOMAINS-1 and return with -EINVAL in case this check
does not pass.
Fixes: e935cd525af4 ("s390/zcrypt: Close speculative mem read possibility")
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Cc: stable@vger.kernel.org
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/s390/crypto/zcrypt_api.c | 35 +++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 640a5b35081f6..bcdfb7cb2fd52 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -854,7 +854,7 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
struct ica_xcRB *xcrb)
{
bool userspace = xflags & ZCRYPT_XFLAG_USERSPACE;
- unsigned int card, domain, func_code = 0;
+ unsigned int card, domain, _dom, func_code = 0;
unsigned int wgt = 0, pref_wgt = 0;
struct zcrypt_queue *zq, *pref_zq;
struct zcrypt_card *zc, *pref_zc;
@@ -877,10 +877,17 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
print_hex_dump_debug("ccareq: ", DUMP_PREFIX_ADDRESS, 16, 1,
ap_msg.msg, ap_msg.len, false);
+ /* Check domain for either AUTOSEL_DOM or in range 0...AP_DOMAINS-1 */
+ if (domain != AUTOSEL_DOM && domain >= AP_DOMAINS) {
+ rc = -EINVAL;
+ goto out;
+ }
+ /* Spectre-v1: sanitize domain unconditionally for later use */
+ _dom = array_index_nospec(domain, AP_DOMAINS);
+
if (perms != &ap_perms && domain < AP_DOMAINS) {
if (ap_msg.flags & AP_MSG_FLAG_ADMIN) {
- domain = array_index_nospec(domain, AP_DOMAINS);
- if (!test_bit_inv(domain, perms->adm)) {
+ if (!test_bit_inv(_dom, perms->adm)) {
rc = -ENODEV;
goto out;
}
@@ -893,10 +900,11 @@ static long _zcrypt_send_cprb(u32 xflags, struct ap_perms *perms,
* If a valid target domain is set and this domain is NOT a usage
* domain but a control only domain, autoselect target domain.
*/
- if (domain < AP_DOMAINS &&
- !ap_test_config_usage_domain(domain) &&
- ap_test_config_ctrl_domain(domain))
- domain = AUTOSEL_DOM;
+ if (domain < AP_DOMAINS) {
+ if (!ap_test_config_usage_domain(_dom) &&
+ ap_test_config_ctrl_domain(_dom))
+ domain = AUTOSEL_DOM;
+ }
pref_zc = NULL;
pref_zq = NULL;
@@ -1040,7 +1048,7 @@ static long _zcrypt_send_ep11_cprb(u32 xflags, struct ap_perms *perms,
struct ep11_target_dev *targets = NULL;
unsigned short target_num;
unsigned int wgt = 0, pref_wgt = 0;
- unsigned int func_code = 0, domain;
+ unsigned int func_code = 0, domain, _dom;
struct ap_message ap_msg;
int cpen, qpen, qid = 0, rc;
struct module *mod;
@@ -1077,10 +1085,17 @@ static long _zcrypt_send_ep11_cprb(u32 xflags, struct ap_perms *perms,
print_hex_dump_debug("ep11req: ", DUMP_PREFIX_ADDRESS, 16, 1,
ap_msg.msg, ap_msg.len, false);
+ /* Check domain for either AUTOSEL_DOM or in range 0...AP_DOMAINS-1 */
+ if (domain != AUTOSEL_DOM && domain >= AP_DOMAINS) {
+ rc = -EINVAL;
+ goto out;
+ }
+ /* Spectre-v1: sanitize domain unconditionally for later use */
+ _dom = array_index_nospec(domain, AP_DOMAINS);
+
if (perms != &ap_perms && domain < AP_DOMAINS) {
if (ap_msg.flags & AP_MSG_FLAG_ADMIN) {
- domain = array_index_nospec(domain, AP_DOMAINS);
- if (!test_bit_inv(domain, perms->adm)) {
+ if (!test_bit_inv(_dom, perms->adm)) {
rc = -ENODEV;
goto out;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 487/990] mm: khugepaged: fix folio is used after pte_unmap_unlock()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (485 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 486/990] s390/zcrypt: Guard domain index uses against speculative bypass Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 488/990] NFSD: Destroy a recalled delegation the client does not hold Greg Kroah-Hartman
` (365 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vernon Yang, Andrew Morton,
David Hildenbrand (Arm), Lorenzo Stoakes (ARM), Barry Song,
Dev Jain, Lance Yang, Ryan Roberts, Zach OKeefe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vernon Yang <yanglincheng@kylinos.cn>
[ Upstream commit ba2f1f92ddfabd340c9248fd2380104f717ee8b1 ]
After the page table lock has dropped, the folio can be freed
concurrently. The trace_mm_khugepaged_scan_pmd() is left with a dangling
folio pointer.
So using the folio_pfn() before dropping the page table lock, closing
use-after-free window.
And other pre-existing bug, When the `for (i = 0; i < HPAGE_PMD_NR; i++)`
iteration to terminate and the folio operation preceding is normal, but
pfn will be incorrect. so we really only trace the PFN if it really was
problematic.
Link: https://lore.kernel.org/20260909025804.3233645-3-vernon2gm@gmail.com
Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages")
Signed-off-by: Vernon Yang <yanglincheng@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Cc: Barry Song <baohua@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Zach O'Keefe <zokeefe@google.com>
Cc: <stable@vger.kernel.org>
[ sashal: Dropped the SCAN_PAGE_LAZYFREE hunk and applied the failed_pfn changes to hpage_collapse_scan_pmd(), the older name and body of collapse_scan_pmd(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/trace/events/huge_memory.h | 6 +++---
mm/khugepaged.c | 9 ++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h
index 1464d45c90abf..6b2e08f4a6be6 100644
--- a/include/trace/events/huge_memory.h
+++ b/include/trace/events/huge_memory.h
@@ -54,10 +54,10 @@ SCAN_STATUS
TRACE_EVENT(mm_khugepaged_scan_pmd,
- TP_PROTO(struct mm_struct *mm, struct folio *folio,
+ TP_PROTO(struct mm_struct *mm, unsigned long pfn,
int referenced, int none_or_zero, int status, int unmapped),
- TP_ARGS(mm, folio, referenced, none_or_zero, status, unmapped),
+ TP_ARGS(mm, pfn, referenced, none_or_zero, status, unmapped),
TP_STRUCT__entry(
__field(struct mm_struct *, mm)
@@ -70,7 +70,7 @@ TRACE_EVENT(mm_khugepaged_scan_pmd,
TP_fast_assign(
__entry->mm = mm;
- __entry->pfn = folio ? folio_pfn(folio) : -1;
+ __entry->pfn = pfn;
__entry->referenced = referenced;
__entry->none_or_zero = none_or_zero;
__entry->status = status;
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 7ca1772c5aa8b..1acef234d22cb 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1254,6 +1254,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
int none_or_zero = 0, shared = 0;
struct page *page = NULL;
struct folio *folio = NULL;
+ unsigned long failed_pfn = -1;
unsigned long addr;
spinlock_t *ptl;
int node = NUMA_NO_NODE, unmapped = 0;
@@ -1330,6 +1331,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
if (!folio_test_anon(folio)) {
result = SCAN_PAGE_ANON;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
@@ -1342,6 +1344,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
if (cc->is_khugepaged &&
shared > khugepaged_max_ptes_shared) {
result = SCAN_EXCEED_SHARED_PTE;
+ failed_pfn = folio_pfn(folio);
count_vm_event(THP_SCAN_EXCEED_SHARED_PTE);
goto out_unmap;
}
@@ -1356,15 +1359,18 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
node = folio_nid(folio);
if (hpage_collapse_scan_abort(node, cc)) {
result = SCAN_SCAN_ABORT;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
cc->node_load[node]++;
if (!folio_test_lru(folio)) {
result = SCAN_PAGE_LRU;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
if (folio_test_locked(folio)) {
result = SCAN_PAGE_LOCK;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
@@ -1380,6 +1386,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
*/
if (folio_expected_ref_count(folio) != folio_ref_count(folio)) {
result = SCAN_PAGE_COUNT;
+ failed_pfn = folio_pfn(folio);
goto out_unmap;
}
@@ -1409,7 +1416,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm,
*mmap_locked = false;
}
out:
- trace_mm_khugepaged_scan_pmd(mm, folio, referenced,
+ trace_mm_khugepaged_scan_pmd(mm, failed_pfn, referenced,
none_or_zero, result, unmapped);
return result;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 488/990] NFSD: Destroy a recalled delegation the client does not hold
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (486 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 487/990] mm: khugepaged: fix folio is used after pte_unmap_unlock() Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 489/990] media: rc: Replace open coded krealloc() for keymap Greg Kroah-Hartman
` (364 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Chuck Lever, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <cel@kernel.org>
[ Upstream commit bbfa823f624d41e85ebca929ac77dc2182cadfed ]
A client that answers CB_RECALL with NFS4ERR_BADHANDLE or
NFS4ERR_BAD_STATEID has no record of the delegation, so the
FREE_STATEID that clears it from cl_revoked never arrives. Every later
SEQUENCE reply carries SEQ4_STATUS_RECALLABLE_STATE_REVOKED, and the
client loops issuing TEST_STATEID.
Destroy such a delegation when it is reaped rather than revoking it
onto cl_revoked. RFC 8881 Section 20.2.4 completes the recall at the
reply when its status is neither NFS4_OK nor NFS4ERR_DELAY, so a
rejected recall leaves nothing to revoke. An administrative revoke
keeps that path, since NFS4ERR_ADMIN_REVOKED reports it. A destroyed
stateid returns NFS4ERR_BAD_STATEID instead of NFS4ERR_DELEG_REVOKED. A
client that rejects the recall but still holds the delegation gets no
notice that its state was revoked.
CB_RECALL can outrun the reply that granted the delegation, so honor
a rejection only once the client has seen that grant. Per RFC 8881
Section 2.10.6.3, retirement of the slot that carried the grant is that
proof; retry until then, and revoke when the retries lapse.
Fixes: 3bd64a5ba171 ("nfsd4: implement SEQ4_STATUS_RECALLABLE_STATE_REVOKED")
Cc: stable@vger.kernel.org # 6.14.x
Link: https://patch.msgid.link/20260802-nfsd-deleg-destroy-badhandle-v1-8-323aa7196055@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
[ sashal: adjusted context for missing directory delegation code, using the single alloc_init_deleg allocator, a void-returning cb prepare, and a plain dl_cb_fattr field in place of the union. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfsd/nfs4state.c | 196 ++++++++++++++++++++++++++++++++++++--------
fs/nfsd/state.h | 13 ++-
2 files changed, 176 insertions(+), 33 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 44ca5746911c8..5b97986ec2442 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -88,6 +88,8 @@ static void nfsd4_end_grace(struct nfsd_net *nn);
static void _free_cpntf_state_locked(struct nfsd_net *nn, struct nfs4_cpntf_state *cps);
static void nfsd4_file_hash_remove(struct nfs4_file *fi);
static void deleg_reaper(struct nfsd_net *nn);
+static void nfsd4_drop_revoked_stid(struct nfs4_stid *s)
+ __releases(&s->sc_client->cl_lock);
/* Locking: */
@@ -1258,6 +1260,9 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_file *fp,
dp->dl_type = dl_type;
dp->dl_retries = 1;
dp->dl_recalled = false;
+ dp->dl_recall_rejected = false;
+ dp->dl_recall_grant.valid = false;
+ dp->dl_recall_grant.retired_at_send = false;
nfsd4_init_cb(&dp->dl_recall, dp->dl_stid.sc_client,
&nfsd4_cb_recall_ops, NFSPROC4_CLNT_CB_RECALL);
nfsd4_init_cb(&dp->dl_cb_fattr.ncf_getattr, dp->dl_stid.sc_client,
@@ -1476,27 +1481,22 @@ static void destroy_delegation(struct nfs4_delegation *dp)
}
/**
- * revoke_delegation - perform nfs4 delegation structure cleanup
- * @dp: pointer to the delegation
+ * revoke_delegation - dispose of a delegation the server has revoked
+ * @dp: delegation to dispose of
+ *
+ * The caller holds a reference on @dp, which this function consumes.
+ * On NFSv4.1 and newer, @dp's sc_status must already carry
+ * SC_STATUS_REVOKED or SC_STATUS_ADMIN_REVOKED.
*
- * This function assumes that it's called either from the administrative
- * interface (nfsd4_revoke_states()) that's revoking a specific delegation
- * stateid or it's called from a laundromat thread (nfsd4_landromat()) that
- * determined that this specific state has expired and needs to be revoked
- * (both mark state with the appropriate stid sc_status mode). It is also
- * assumed that a reference was taken on the @dp state. This function
- * consumes that reference.
+ * @dp is parked on the client's cl_revoked list to await a FREE_STATEID.
+ * Where none can arrive, @dp is destroyed here instead: FREE_STATEID has
+ * already freed it, or the client rejected the recall with
+ * NFS4ERR_BADHANDLE or NFS4ERR_BAD_STATEID and holds no record of the
+ * delegation. NFS4ERR_ADMIN_REVOKED still prompts one, so an
+ * administrative revoke waits on cl_revoked.
*
- * If this function finds that the @dp state is SC_STATUS_FREED it means
- * that a FREE_STATEID operation for this stateid has been processed and
- * we can proceed to removing it from recalled list. However, if @dp state
- * isn't marked SC_STATUS_FREED, it means we need place it on the cl_revoked
- * list and wait for the FREE_STATEID to arrive from the client. At the same
- * time, we need to mark it as SC_STATUS_FREEABLE to indicate to the
- * nfsd4_free_stateid() function that this stateid has already been added
- * to the cl_revoked list and that nfsd4_free_stateid() is now responsible
- * for removing it from the list. Inspection of where the delegation state
- * in the revocation process is protected by the clp->cl_lock.
+ * Context: Takes and releases the client's cl_lock; may sleep after
+ * dropping it.
*/
static void revoke_delegation(struct nfs4_delegation *dp)
{
@@ -1514,6 +1514,19 @@ static void revoke_delegation(struct nfs4_delegation *dp)
list_del_init(&dp->dl_recall_lru);
goto out;
}
+ if (dp->dl_recall_rejected &&
+ !(dp->dl_stid.sc_status & SC_STATUS_ADMIN_REVOKED)) {
+ /*
+ * SC_STATUS_CLOSED, set under cl_lock, makes a racing
+ * FREE_STATEID bail out rather than drop this reference
+ * too. The put releases what cl_revoked would have held.
+ */
+ dp->dl_stid.sc_status |= SC_STATUS_CLOSED;
+ spin_unlock(&clp->cl_lock);
+ nfs4_put_stid(&dp->dl_stid);
+ destroy_unhashed_deleg(dp);
+ return;
+ }
list_add(&dp->dl_recall_lru, &clp->cl_revoked);
dp->dl_stid.sc_status |= SC_STATUS_FREEABLE;
out:
@@ -2637,11 +2650,18 @@ __destroy_client(struct nfs4_client *clp)
list_del_init(&dp->dl_recall_lru);
destroy_unhashed_deleg(dp);
}
+ /*
+ * A CB_RECALL reply can release revoked delegations concurrently:
+ * nfsd4_shutdown_callback() has not run yet.
+ */
+ spin_lock(&clp->cl_lock);
while (!list_empty(&clp->cl_revoked)) {
dp = list_entry(clp->cl_revoked.next, struct nfs4_delegation, dl_recall_lru);
- list_del_init(&dp->dl_recall_lru);
- nfs4_put_stid(&dp->dl_stid);
+ /* this function drops ->cl_lock */
+ nfsd4_drop_revoked_stid(&dp->dl_stid);
+ spin_lock(&clp->cl_lock);
}
+ spin_unlock(&clp->cl_lock);
while (!list_empty(&clp->cl_openowners)) {
oo = list_entry(clp->cl_openowners.next, struct nfs4_openowner, oo_perclient);
nfs4_get_stateowner(&oo->oo_owner);
@@ -5618,6 +5638,60 @@ bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp, struct inode *inode)
return timeo > 0;
}
+static bool nfsd4_recall_grant_slot_retired(struct nfs4_delegation *dp)
+{
+ struct nfs4_client *clp = dp->dl_stid.sc_client;
+ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
+ struct nfsd4_session *ses;
+ struct nfsd4_sessionid sid;
+ bool retired = false;
+ void *entry;
+
+ if (!dp->dl_recall_grant.valid)
+ return false;
+
+ /*
+ * gen_sessionid() composes a sessionid from the client's clientid
+ * and a sequence counter, so the sequence alone identifies the
+ * granting session.
+ */
+ sid.clientid = clp->cl_clientid;
+ sid.sequence = dp->dl_recall_grant.sessionid_seq;
+ sid.reserved = 0;
+
+ /*
+ * A missing session does not prove the client saw the grant: a
+ * DESTROY_SESSION unhashes its own session before the reply to
+ * that compound is encoded.
+ */
+ spin_lock(&nn->client_lock);
+ ses = __find_in_sessionid_hashtbl((struct nfs4_sessionid *)&sid,
+ clp->net);
+ entry = ses ? xa_load(&ses->se_slots, dp->dl_recall_grant.slotid) : NULL;
+ if (xa_is_value(entry)) {
+ /*
+ * A slot is freed only once the client has acknowledged
+ * the smaller slot table, which it cannot do while a
+ * request on that slot is outstanding.
+ */
+ retired = true;
+ } else if (entry) {
+ struct nfsd4_slot *slot = entry;
+
+ /*
+ * A reactivated slot was freed and rebuilt, so the same
+ * acknowledgment applies. The seqid test errs toward
+ * revoking: a rebuilt slot restarting at seqid 1 matches
+ * an old grant.
+ */
+ retired = (slot->sl_flags & NFSD4_SLOT_REUSED) ||
+ ((slot->sl_flags & NFSD4_SLOT_INITIALIZED) &&
+ slot->sl_seqid != dp->dl_recall_grant.seqid);
+ }
+ spin_unlock(&nn->client_lock);
+ return retired;
+}
+
static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb)
{
struct nfs4_delegation *dp = cb_to_delegation(cb);
@@ -5639,6 +5713,34 @@ static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb)
list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru);
}
spin_unlock(&nn->deleg_lock);
+
+ dp->dl_recall_grant.retired_at_send =
+ nfsd4_recall_grant_slot_retired(dp);
+}
+
+/*
+ * cl_lock orders this against a laundromat reaping @dp: either
+ * revoke_delegation() observes dl_recall_rejected and destroys @dp, or
+ * it reached cl_revoked first and @dp is released here instead.
+ */
+static void nfsd4_deleg_recall_rejected(struct nfs4_delegation *dp)
+{
+ struct nfs4_client *clp = dp->dl_stid.sc_client;
+
+ spin_lock(&clp->cl_lock);
+ if (dp->dl_stid.sc_status & (SC_STATUS_CLOSED | SC_STATUS_FREED |
+ SC_STATUS_ADMIN_REVOKED)) {
+ spin_unlock(&clp->cl_lock);
+ return;
+ }
+ if (dp->dl_stid.sc_status & SC_STATUS_FREEABLE) {
+ dp->dl_stid.sc_status |= SC_STATUS_CLOSED;
+ /* this function drops ->cl_lock */
+ nfsd4_drop_revoked_stid(&dp->dl_stid);
+ return;
+ }
+ dp->dl_recall_rejected = true;
+ spin_unlock(&clp->cl_lock);
}
static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
@@ -5648,27 +5750,33 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
trace_nfsd_cb_recall_done(&dp->dl_stid.sc_stateid, task);
- if (dp->dl_stid.sc_status)
- /* CLOSED or REVOKED */
- return 1;
-
switch (task->tk_status) {
case 0:
return 1;
case -NFS4ERR_DELAY:
+ if (dp->dl_stid.sc_status)
+ /* CLOSED or REVOKED */
+ return 1;
rpc_delay(task, 2 * HZ);
return 0;
case -EBADHANDLE:
case -NFS4ERR_BAD_STATEID:
/*
- * Race: client probably got cb_recall before open reply
- * granting delegation.
+ * Retirement of the granting slot proves the client saw
+ * the grant. Trust the rejection only if the slot had
+ * retired when this recall was sent.
*/
- if (dp->dl_retries--) {
+ if (dp->dl_recall_grant.retired_at_send) {
+ nfsd4_deleg_recall_rejected(dp);
+ return 1;
+ }
+ if (!dp->dl_stid.sc_status && dp->dl_retries--) {
+ dp->dl_recall_grant.retired_at_send =
+ nfsd4_recall_grant_slot_retired(dp);
rpc_delay(task, 2 * HZ);
return 0;
}
- fallthrough;
+ return 1;
default:
return 1;
}
@@ -6246,9 +6354,25 @@ static bool nfsd4_want_deleg_timestamps(const struct nfsd4_open *open)
}
#endif /* CONFIG NFSD_V4_DELEG_TIMESTAMPS */
+static void
+nfs4_delegation_record_grant_slot(struct nfs4_delegation *dp,
+ const struct nfsd4_compound_state *cstate)
+{
+ const struct nfsd4_sessionid *sid;
+
+ if (!cstate->session)
+ return;
+ sid = (struct nfsd4_sessionid *)cstate->session->se_sessionid.data;
+ dp->dl_recall_grant.sessionid_seq = sid->sequence;
+ dp->dl_recall_grant.slotid = cstate->slot->sl_index;
+ dp->dl_recall_grant.seqid = cstate->slot->sl_seqid;
+ dp->dl_recall_grant.valid = true;
+}
+
static struct nfs4_delegation *
-nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
- struct svc_fh *parent)
+nfs4_set_delegation(struct nfsd4_open *open,
+ const struct nfsd4_compound_state *cstate,
+ struct nfs4_ol_stateid *stp, struct svc_fh *parent)
{
bool deleg_ts = nfsd4_want_deleg_timestamps(open);
struct nfs4_client *clp = stp->st_stid.sc_client;
@@ -6338,6 +6462,13 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
if (!dp)
goto out_delegees;
+ /*
+ * Record the granting slot before kernel_setlease() makes @dp
+ * visible to lease breakers. A conflicting open can drive
+ * CB_RECALL to completion from that point on.
+ */
+ nfs4_delegation_record_grant_slot(dp, cstate);
+
fl = nfs4_alloc_init_lease(dp);
if (!fl)
goto out_clnt_odstate;
@@ -6498,6 +6629,7 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
struct nfs4_ol_stateid *stp, struct svc_fh *currentfh,
struct svc_fh *fh)
{
+ struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct nfs4_openowner *oo = openowner(stp->st_stateowner);
bool deleg_ts = nfsd4_want_deleg_timestamps(open);
struct nfs4_client *clp = stp->st_stid.sc_client;
@@ -6534,7 +6666,7 @@ nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
default:
goto out_no_deleg;
}
- dp = nfs4_set_delegation(open, stp, parent);
+ dp = nfs4_set_delegation(open, &resp->cstate, stp, parent);
if (IS_ERR(dp))
goto out_no_deleg;
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index fd61bac52721d..f7f91393e2e11 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -206,7 +206,8 @@ struct nfs4_cb_fattr {
* If the server attempts to recall a delegation and the client doesn't do so
* before a timeout, the server may also revoke the delegation. In that case,
* the object will either be destroyed (v4.0) or moved to a per-client list of
- * revoked delegations (v4.1+).
+ * revoked delegations (v4.1+). A v4.1+ client that rejects the recall holds
+ * no record of the delegation, so the object is destroyed rather than listed.
*
* This object is a superset of the nfs4_stid.
*/
@@ -222,12 +223,22 @@ struct nfs4_delegation {
int dl_retries;
struct nfsd4_callback dl_recall;
bool dl_recalled;
+ bool dl_recall_rejected;
bool dl_written;
bool dl_setattr;
/* for CB_GETATTR */
struct nfs4_cb_fattr dl_cb_fattr;
+ /* Forward-channel slot that carried the granting request */
+ struct {
+ u32 sessionid_seq;
+ u32 slotid;
+ u32 seqid;
+ bool valid;
+ bool retired_at_send;
+ } dl_recall_grant;
+
/* For delegated timestamps */
struct timespec64 dl_atime;
struct timespec64 dl_mtime;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 489/990] media: rc: Replace open coded krealloc() for keymap
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (487 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 488/990] NFSD: Destroy a recalled delegation the client does not hold Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 490/990] media: rc: Add missing locking " Greg Kroah-Hartman
` (363 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sean Young, Hans Verkuil,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <sean@mess.org>
[ Upstream commit e4b4aa413cc2e48a261c8c513ced964a3390c0cf ]
Replace open coded krealloc() and remove superfluous member of struct
rc_map - we don't need to track both the size in bytes and entries.
Signed-off-by: Sean Young <sean@mess.org>
Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Stable-dep-of: ab9567336171 ("media: rc: Add missing locking for keymap")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/rc/rc-main.c | 45 +++++++++++++++++++-------------------
include/media/rc-map.h | 2 --
2 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 2f1684a81eb14..6b14ccfc3080a 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -17,9 +17,8 @@
#include <linux/module.h>
#include "rc-core-priv.h"
-/* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
-#define IR_TAB_MIN_SIZE 256
-#define IR_TAB_MAX_SIZE 8192
+#define IR_TAB_MIN_ENTRIES 32
+#define IR_TAB_MAX_ENTRIES 1024
static const struct {
const char *name;
@@ -214,21 +213,23 @@ static int scancode_to_u64(const struct input_keymap_entry *ke, u64 *scancode)
static int ir_create_table(struct rc_dev *dev, struct rc_map *rc_map,
const char *name, u64 rc_proto, size_t size)
{
+ unsigned int alloc;
rc_map->name = kstrdup(name, GFP_KERNEL);
if (!rc_map->name)
return -ENOMEM;
+ alloc = roundup_pow_of_two(size);
rc_map->rc_proto = rc_proto;
- rc_map->alloc = roundup_pow_of_two(size * sizeof(struct rc_map_table));
- rc_map->size = rc_map->alloc / sizeof(struct rc_map_table);
- rc_map->scan = kmalloc(rc_map->alloc, GFP_KERNEL);
+ rc_map->len = 0;
+ rc_map->size = alloc;
+ rc_map->scan = kmalloc_objs(struct rc_map_table, alloc, GFP_KERNEL);
if (!rc_map->scan) {
kfree(rc_map->name);
rc_map->name = NULL;
return -ENOMEM;
}
- dev_dbg(&dev->dev, "Allocated space for %u keycode entries (%u bytes)\n",
- rc_map->size, rc_map->alloc);
+ dev_dbg(&dev->dev, "Allocated space for %u keycode entries (%zu bytes)\n",
+ alloc, alloc * sizeof(struct rc_map_table));
return 0;
}
@@ -262,38 +263,36 @@ static void ir_free_table(struct rc_map *rc_map)
static int ir_resize_table(struct rc_dev *dev, struct rc_map *rc_map,
gfp_t gfp_flags)
{
- unsigned int oldalloc = rc_map->alloc;
- unsigned int newalloc = oldalloc;
- struct rc_map_table *oldscan = rc_map->scan;
+ unsigned int newsize = rc_map->size;
struct rc_map_table *newscan;
if (rc_map->size == rc_map->len) {
/* All entries in use -> grow keytable */
- if (rc_map->alloc >= IR_TAB_MAX_SIZE)
+ if (newsize >= IR_TAB_MAX_ENTRIES)
return -ENOMEM;
- newalloc *= 2;
- dev_dbg(&dev->dev, "Growing table to %u bytes\n", newalloc);
+ newsize *= 2;
+
+ dev_dbg(&dev->dev, "Growing table to %u entries\n", newsize);
}
- if ((rc_map->len * 3 < rc_map->size) && (oldalloc > IR_TAB_MIN_SIZE)) {
+ if (rc_map->len * 3 < rc_map->size && rc_map->size > IR_TAB_MIN_ENTRIES) {
/* Less than 1/3 of entries in use -> shrink keytable */
- newalloc /= 2;
- dev_dbg(&dev->dev, "Shrinking table to %u bytes\n", newalloc);
+ newsize /= 2;
+ dev_dbg(&dev->dev, "Shrinking table to %u entries\n", newsize);
}
- if (newalloc == oldalloc)
+ if (newsize == rc_map->size)
return 0;
- newscan = kmalloc(newalloc, gfp_flags);
+ newscan = krealloc_array(rc_map->scan, newsize,
+ sizeof(struct rc_map_table), gfp_flags);
if (!newscan)
return -ENOMEM;
- memcpy(newscan, rc_map->scan, rc_map->len * sizeof(struct rc_map_table));
rc_map->scan = newscan;
- rc_map->alloc = newalloc;
- rc_map->size = rc_map->alloc / sizeof(struct rc_map_table);
- kfree(oldscan);
+ rc_map->size = newsize;
+
return 0;
}
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index d95ed3e96de28..f167c37179c8f 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -148,7 +148,6 @@ struct rc_map_table {
* @scan: pointer to struct &rc_map_table
* @size: Max number of entries
* @len: Number of entries that are in use
- * @alloc: size of \*scan, in bytes
* @rc_proto: type of the remote controller protocol, as defined at
* enum &rc_proto
* @name: name of the key map table
@@ -158,7 +157,6 @@ struct rc_map {
struct rc_map_table *scan;
unsigned int size;
unsigned int len;
- unsigned int alloc;
enum rc_proto rc_proto;
const char *name;
spinlock_t lock;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 490/990] media: rc: Add missing locking for keymap
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (488 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 489/990] media: rc: Replace open coded krealloc() for keymap Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 491/990] powerpc/bpf: fix alignment of long branch trampoline address Greg Kroah-Hartman
` (362 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sean Young, Hans Verkuil,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <sean@mess.org>
[ Upstream commit ab9567336171e46ce9e03ee126902b3fd7901baa ]
When the rc_map for an rc_dev gets updated, locking is required but is
missing in places. A concurrent scancode lookup and a call to
rc_{register,unregistered}_device() could result in a use-after-free;
this could happen if IR is decoded during those function calls.
Add lockdep assertions where locks are required.
ir_free_table() should only be called for non-TX devices else we will
use a spinlock without iniitializing it.
Fixes: dccc0c3ddf8f ("media: rc: fix race between unregister and urb/irq callbacks")
Signed-off-by: Sean Young <sean@mess.org>
Cc: stable@vger.kernel.org
Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/rc/rc-main.c | 86 +++++++++++++++++++++++++-------------
1 file changed, 57 insertions(+), 29 deletions(-)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 6b14ccfc3080a..be53f1bdc9c77 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -104,7 +104,6 @@ static struct rc_map_list *seek_rc_map(const char *name)
struct rc_map *rc_map_get(const char *name)
{
-
struct rc_map_list *map;
map = seek_rc_map(name);
@@ -201,7 +200,7 @@ static int scancode_to_u64(const struct input_keymap_entry *ke, u64 *scancode)
* ir_create_table() - initializes a scancode table
* @dev: the rc_dev device
* @rc_map: the rc_map to initialize
- * @name: name to assign to the table
+ * @map_name: name to assign to the table
* @rc_proto: ir type to assign to the new table
* @size: initial size of the table
*
@@ -211,23 +210,31 @@ static int scancode_to_u64(const struct input_keymap_entry *ke, u64 *scancode)
* return: zero on success or a negative error code
*/
static int ir_create_table(struct rc_dev *dev, struct rc_map *rc_map,
- const char *name, u64 rc_proto, size_t size)
+ const char *map_name, u64 rc_proto, size_t size)
{
+ struct rc_map_table *scan;
unsigned int alloc;
- rc_map->name = kstrdup(name, GFP_KERNEL);
- if (!rc_map->name)
+ char *name;
+
+ name = kstrdup(map_name, GFP_KERNEL);
+ if (!name)
return -ENOMEM;
+
alloc = roundup_pow_of_two(size);
- rc_map->rc_proto = rc_proto;
- rc_map->len = 0;
- rc_map->size = alloc;
- rc_map->scan = kmalloc_objs(struct rc_map_table, alloc, GFP_KERNEL);
- if (!rc_map->scan) {
- kfree(rc_map->name);
- rc_map->name = NULL;
+ scan = kmalloc_objs(struct rc_map_table, alloc, GFP_KERNEL);
+ if (!scan) {
+ kfree(name);
return -ENOMEM;
}
+ scoped_guard(spinlock_irqsave, &rc_map->lock) {
+ rc_map->name = name;
+ rc_map->scan = scan;
+ rc_map->rc_proto = rc_proto;
+ rc_map->len = 0;
+ rc_map->size = alloc;
+ }
+
dev_dbg(&dev->dev, "Allocated space for %u keycode entries (%zu bytes)\n",
alloc, alloc * sizeof(struct rc_map_table));
return 0;
@@ -237,16 +244,26 @@ static int ir_create_table(struct rc_dev *dev, struct rc_map *rc_map,
* ir_free_table() - frees memory allocated by a scancode table
* @rc_map: the table whose mappings need to be freed
*
- * This routine will free memory alloctaed for key mappings used by given
+ * This routine will free memory allocated for key mappings used by given
* scancode table.
*/
static void ir_free_table(struct rc_map *rc_map)
{
- rc_map->size = 0;
- kfree(rc_map->name);
- rc_map->name = NULL;
- kfree(rc_map->scan);
- rc_map->scan = NULL;
+ struct rc_map_table *scan;
+ const char *name;
+
+ scoped_guard(spinlock_irqsave, &rc_map->lock) {
+ name = rc_map->name;
+ scan = rc_map->scan;
+
+ rc_map->size = 0;
+ rc_map->len = 0;
+ rc_map->name = NULL;
+ rc_map->scan = NULL;
+ }
+
+ kfree(name);
+ kfree(scan);
}
/**
@@ -266,6 +283,8 @@ static int ir_resize_table(struct rc_dev *dev, struct rc_map *rc_map,
unsigned int newsize = rc_map->size;
struct rc_map_table *newscan;
+ lockdep_assert_held(&rc_map->lock);
+
if (rc_map->size == rc_map->len) {
/* All entries in use -> grow keytable */
if (newsize >= IR_TAB_MAX_ENTRIES)
@@ -317,6 +336,8 @@ static unsigned int ir_update_mapping(struct rc_dev *dev,
int old_keycode = rc_map->scan[index].keycode;
int i;
+ lockdep_assert_held(&rc_map->lock);
+
/* Did the user wish to remove the mapping? */
if (new_keycode == KEY_RESERVED || new_keycode == KEY_UNKNOWN) {
dev_dbg(&dev->dev, "#%d: Deleting scan 0x%04llx\n",
@@ -372,6 +393,8 @@ static unsigned int ir_establish_scancode(struct rc_dev *dev,
{
unsigned int i;
+ lockdep_assert_held(&rc_map->lock);
+
/*
* Unfortunately, some hardware-based IR decoders don't provide
* all bits for the complete IR code. In general, they provide only
@@ -396,7 +419,7 @@ static unsigned int ir_establish_scancode(struct rc_dev *dev,
/* No previous mapping found, we might need to grow the table */
if (rc_map->size == rc_map->len) {
if (!resize || ir_resize_table(dev, rc_map, GFP_ATOMIC))
- return -1U;
+ return UINT_MAX;
}
/* i is the proper index to insert our new keycode */
@@ -478,16 +501,18 @@ static int ir_setkeytable(struct rc_dev *dev, const struct rc_map *from)
if (rc)
return rc;
- for (i = 0; i < from->size; i++) {
- index = ir_establish_scancode(dev, rc_map,
- from->scan[i].scancode, false);
- if (index >= rc_map->len) {
- rc = -ENOMEM;
- break;
- }
+ scoped_guard(spinlock_irqsave, &rc_map->lock) {
+ for (i = 0; i < from->size; i++) {
+ index = ir_establish_scancode(dev, rc_map,
+ from->scan[i].scancode, false);
+ if (index >= rc_map->len) {
+ rc = -ENOMEM;
+ break;
+ }
- ir_update_mapping(dev, rc_map, index,
- from->scan[i].keycode);
+ ir_update_mapping(dev, rc_map, index,
+ from->scan[i].keycode);
+ }
}
if (rc)
@@ -523,6 +548,8 @@ static unsigned int ir_lookup_by_scancode(const struct rc_map *rc_map,
{
struct rc_map_table *res;
+ lockdep_assert_held(&rc_map->lock);
+
res = bsearch(&scancode, rc_map->scan, rc_map->len,
sizeof(struct rc_map_table), rc_map_cmp);
if (!res)
@@ -1988,7 +2015,8 @@ int rc_register_device(struct rc_dev *dev)
scoped_guard(mutex, &dev->lock)
dev->registered = false;
out_free_table:
- ir_free_table(&dev->rc_map);
+ if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
+ ir_free_table(&dev->rc_map);
out_raw:
ir_raw_event_free(dev);
out_minor:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 491/990] powerpc/bpf: fix alignment of long branch trampoline address
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (489 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 490/990] media: rc: Add missing locking " Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 492/990] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe Greg Kroah-Hartman
` (361 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hari Bathini, Abhishek Dubey,
Saket Kumar Bhaskar, Yeswanth Krishna Tellakula,
R Nageswara Sastry, Madhavan Srinivasan, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhishek Dubey <adubey@linux.ibm.com>
[ Upstream commit 04001e8ddb979f463f1c3ca8ac4d6ac59fb48921 ]
Ensure the dummy trampoline address field present between the OOL stub
and the long branch stub is 4/8-byte aligned, for memory compatibility
when content loaded to a register.
Reported-by: Hari Bathini <hbathini@linux.ibm.com>
Fixes: d243b62b7bd3 ("powerpc64/bpf: Add support for bpf trampolines")
Cc: stable@vger.kernel.org
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
Tested-by: Yeswanth Krishna Tellakula <yeswanth@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/a8257022057cbb71928c960be589e10b89fc0899.1789982239.git.skb99@linux.ibm.com
[ sashal: Dropped the two fsession prototypes (prepare_for_fsession_fentry() and store_func_meta()) from the context of the bpf_jit.h hunk, since those functions don't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/net/bpf_jit.h | 7 +++---
arch/powerpc/net/bpf_jit_comp.c | 38 ++++++++++++++++++++++++++-----
arch/powerpc/net/bpf_jit_comp32.c | 7 +++---
arch/powerpc/net/bpf_jit_comp64.c | 7 +++---
4 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index ae2c92a8b6e77..4d9cd21510571 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -203,10 +203,11 @@ int bpf_jit_emit_func_call_rel(u32 *image, u32 *fimage, struct codegen_context *
int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct codegen_context *ctx,
u32 *addrs, int pass, bool extra_pass);
void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx);
-void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx);
-void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx);
+void bpf_jit_build_epilogue(u32 *image, u32 *fimage, struct codegen_context *ctx);
+void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context *ctx);
void bpf_jit_realloc_regs(struct codegen_context *ctx);
-int bpf_jit_emit_exit_insn(u32 *image, struct codegen_context *ctx, int tmp_reg, long exit_addr);
+int bpf_jit_emit_exit_insn(u32 *image, u32 *fimage, struct codegen_context *ctx, int tmp_reg,
+ long exit_addr);
int bpf_add_extable_entry(struct bpf_prog *fp, u32 *image, u32 *fimage, int pass,
struct codegen_context *ctx, int insn_idx,
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 829b60ae485ff..4a7f5108fe0fd 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -49,11 +49,35 @@ asm (
" .popsection ;"
);
-void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
+void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
int ool_stub_idx, long_branch_stub_idx;
+ int ool_stub_sz;
/*
+ * Align the mis-aligned dummy_tramp_addr field in the fimage.
+ * The alignment NOP must appear before OOL stub, to make
+ * ool_stub_idx & long_branch_stub_idx constant from end.
+ *
+ * The fimage can be non 8-byte aligned, so final alignment depends
+ * on start of fimage and the stub's instruction count offset. The
+ * OOL stub size is 4 instructions (with CONFIG_PPC_FTRACE_OUT_OF_LINE)
+ * or 3 instructions (without) before dummy_tramp_addr.
+ *
+ * Emit a NOP here if address is not SZL aligned.
+ *
+ * In pass=0 when image==NULL, conservatively account for space
+ * required to accommodate alignment NOP. In case final pass skips
+ * emitting alignment NOP, the image buffer have 4 spare bytes and
+ * jited_len signifies correct program size.
+ */
+
+ ool_stub_sz = IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE) ? 16 : 12;
+ if (!image || !IS_ALIGNED((unsigned long)fimage + ctx->idx*4 + ool_stub_sz, SZL))
+ EMIT(PPC_RAW_NOP());
+
+ /*
+ * nop // optional, for alignment of dummy_tramp_addr
* Out-of-line stub:
* mflr r0
* [b|bl] tramp
@@ -70,7 +94,7 @@ void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
/*
* Long branch stub:
- * .long <dummy_tramp_addr>
+ * .long <dummy_tramp_addr> // 8-byte aligned
* mflr r11
* bcl 20,31,$+4
* mflr r12
@@ -81,6 +105,7 @@ void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
*/
if (image)
*((unsigned long *)&image[ctx->idx]) = (unsigned long)dummy_tramp;
+
ctx->idx += SZL / 4;
long_branch_stub_idx = ctx->idx;
EMIT(PPC_RAW_MFLR(_R11));
@@ -97,7 +122,8 @@ void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
}
}
-int bpf_jit_emit_exit_insn(u32 *image, struct codegen_context *ctx, int tmp_reg, long exit_addr)
+int bpf_jit_emit_exit_insn(u32 *image, u32 *fimage, struct codegen_context *ctx,
+ int tmp_reg, long exit_addr)
{
if (exit_addr && is_offset_in_branch_range(exit_addr - (long)(ctx->idx * 4))) {
PPC_JMP(exit_addr);
@@ -106,7 +132,7 @@ int bpf_jit_emit_exit_insn(u32 *image, struct codegen_context *ctx, int tmp_reg,
PPC_JMP(ctx->alt_exit_addr);
} else {
ctx->alt_exit_addr = ctx->idx * 4;
- bpf_jit_build_epilogue(image, ctx);
+ bpf_jit_build_epilogue(image, fimage, ctx);
}
return 0;
@@ -237,7 +263,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
*/
bpf_jit_build_prologue(NULL, &cgctx);
addrs[fp->len] = cgctx.idx * 4;
- bpf_jit_build_epilogue(NULL, &cgctx);
+ bpf_jit_build_epilogue(NULL, NULL, &cgctx);
fixup_len = fp->aux->num_exentries * BPF_FIXUP_LEN * 4;
extable_len = fp->aux->num_exentries * sizeof(struct exception_table_entry);
@@ -276,7 +302,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
goto out_addrs;
}
addrs[fp->len] = cgctx.idx * 4;
- bpf_jit_build_epilogue(code_base, &cgctx);
+ bpf_jit_build_epilogue(code_base, fcode_base, &cgctx);
proglen = cgctx.idx * 4;
diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index 3087e744fb250..4b78dd8cfb45e 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -194,7 +194,7 @@ static void bpf_jit_emit_common_epilogue(u32 *image, struct codegen_context *ctx
}
-void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
+void bpf_jit_build_epilogue(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
EMIT(PPC_RAW_MR(_R3, bpf_to_ppc(BPF_REG_0)));
@@ -202,7 +202,7 @@ void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
EMIT(PPC_RAW_BLR());
- bpf_jit_build_fentry_stubs(image, ctx);
+ bpf_jit_build_fentry_stubs(image, fimage, ctx);
}
/* Relative offset needs to be calculated based on final image location */
@@ -1114,7 +1114,8 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
* we'll just fall through to the epilogue.
*/
if (i != flen - 1) {
- ret = bpf_jit_emit_exit_insn(image, ctx, _R0, exit_addr);
+ ret = bpf_jit_emit_exit_insn(image, fimage,
+ ctx, _R0, exit_addr);
if (ret)
return ret;
}
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index 94f3f031d039b..be79bd555e217 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -209,7 +209,7 @@ static void bpf_jit_emit_common_epilogue(u32 *image, struct codegen_context *ctx
}
}
-void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
+void bpf_jit_build_epilogue(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
bpf_jit_emit_common_epilogue(image, ctx);
@@ -218,7 +218,7 @@ void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
EMIT(PPC_RAW_BLR());
- bpf_jit_build_fentry_stubs(image, ctx);
+ bpf_jit_build_fentry_stubs(image, fimage, ctx);
}
int bpf_jit_emit_func_call_rel(u32 *image, u32 *fimage, struct codegen_context *ctx, u64 func)
@@ -1461,7 +1461,8 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
* we'll just fall through to the epilogue.
*/
if (i != flen - 1) {
- ret = bpf_jit_emit_exit_insn(image, ctx, tmp1_reg, exit_addr);
+ ret = bpf_jit_emit_exit_insn(image, fimage, ctx,
+ tmp1_reg, exit_addr);
if (ret)
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 492/990] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (490 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 491/990] powerpc/bpf: fix alignment of long branch trampoline address Greg Kroah-Hartman
@ 2026-11-25 14:30 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 493/990] ublk: let STOP_DEV cancel the servers commands before its release Greg Kroah-Hartman
` (360 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:30 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Jianping Li, Ekansh Gupta,
Srinivas Kandagatla, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianping Li <jianping.li@oss.qualcomm.com>
[ Upstream commit 9e47ad9c562e82cabfbb9afa6c2b0dcdf2702a39 ]
Allocating and freeing Audio PD memory from userspace is unsafe because
the kernel cannot reliably determine when the DSP has finished using the
memory. Userspace may free buffers while they are still in use by the DSP,
and remote free requests cannot be safely trusted.
Additionally, the current implementation allows userspace to repeatedly
grow the Audio PD heap, but does not support shrinking it. This can lead
to unbounded memory usage over time, effectively causing a memory leak.
Fix this by allocating the entire Audio PD reserved-memory region during
rpmsg probe and tying its lifetime to the rpmsg channel. This removes
userspace-controlled alloc/free and ensures that memory is reclaimed only
when the DSP process is torn down.
The reserved-memory region is now mandatory for the Audio PD domain.
Rather than failing rpmsg probe when it is missing, validate it in
fastrpc_init_create_static_process() and reject only the static-process
creation. This keeps the fastrpc device probing for all other domains
even on a misconfigured device tree.
Fixes: 0871561055e66 ("misc: fastrpc: Add support for audiopd")
Cc: stable@kernel.org
Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com>
Reviewed-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Link: https://lore.kernel.org/all/20260814101955.234238-1-jianping.li@oss.qualcomm.com/
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://patch.msgid.link/20261002101220.1084101-3-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: Adjusted context for the missing kzalloc_objs and poll-support table by using kcalloc() and anchoring the new probe helper at fastrpc_get_domain_id(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/misc/fastrpc.c | 188 ++++++++++++++++++++++-------------------
1 file changed, 101 insertions(+), 87 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 9d596f4fd4dcd..3f32e1bf73f88 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -46,8 +46,6 @@
#define ADSP_MMAP_HEAP_ADDR 4
/* MAP static DMA buffer on DSP User PD */
#define ADSP_MMAP_DMA_BUFFER 6
-/* Add memory to static PD pool protection thru hypervisor */
-#define ADSP_MMAP_REMOTE_HEAP_ADDR 8
/* Add memory to userPD pool, for user heap */
#define ADSP_MMAP_ADD_PAGES 0x1000
/* Add memory to userPD pool, for LLC heap */
@@ -270,10 +268,14 @@ struct fastrpc_channel_ctx {
struct kref refcount;
/* Flag if dsp attributes are cached */
bool valid_attributes;
+ /* Flag if audio PD init mem was allocated */
+ bool audio_init_mem;
+ /* Audio PD reserved remote heap region */
+ phys_addr_t remote_heap_addr;
+ u64 remote_heap_size;
u32 dsp_attributes[FASTRPC_MAX_DSP_ATTRIBUTES];
struct fastrpc_device *secure_fdevice;
struct fastrpc_device *fdevice;
- struct fastrpc_buf *remote_heap;
struct list_head invoke_interrupted_mmaps;
bool secure;
bool unsigned_support;
@@ -1317,15 +1319,24 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
struct fastrpc_init_create_static init;
struct fastrpc_invoke_args *args;
struct fastrpc_phy_page pages[1];
+ struct fastrpc_channel_ctx *cctx = fl->cctx;
char *name;
int err;
- bool scm_done = false;
struct {
int client_id;
u32 namelen;
u32 pageslen;
} inbuf;
u32 sc;
+ unsigned long flags;
+ bool sent_heap = false;
+
+ if (!cctx->remote_heap_addr || !cctx->remote_heap_size) {
+ err = -ENOMEM;
+ dev_err(fl->sctx->dev,
+ "remote heap memory region is not added\n");
+ return err;
+ }
args = kcalloc(FASTRPC_CREATE_STATIC_PROCESS_NARGS, sizeof(*args), GFP_KERNEL);
if (!args)
@@ -1349,31 +1360,6 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
inbuf.client_id = fl->client_id;
inbuf.namelen = init.namelen;
inbuf.pageslen = 0;
- if (!fl->cctx->remote_heap) {
- err = fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen,
- &fl->cctx->remote_heap);
- if (err)
- goto err_name;
-
- /* Map if we have any heap VMIDs associated with this ADSP Static Process. */
- if (fl->cctx->vmcount) {
- u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
-
- err = qcom_scm_assign_mem(fl->cctx->remote_heap->dma_addr,
- (u64)fl->cctx->remote_heap->size,
- &src_perms,
- fl->cctx->vmperms, fl->cctx->vmcount);
- if (err) {
- dev_err(fl->sctx->dev,
- "Failed to assign memory with dma_addr %pad size 0x%llx err %d\n",
- &fl->cctx->remote_heap->dma_addr,
- fl->cctx->remote_heap->size, err);
- goto err_map;
- }
- scm_done = true;
- inbuf.pageslen = 1;
- }
- }
fl->pd = USER_PD;
@@ -1385,8 +1371,25 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
args[1].length = inbuf.namelen;
args[1].fd = -1;
- pages[0].addr = fl->cctx->remote_heap->dma_addr;
- pages[0].size = fl->cctx->remote_heap->size;
+ /*
+ * Audio PD is a static PD and retains the remote heap
+ * information across daemon restarts. Therefore only
+ * the first attach should provide heap information to
+ * DSP. Subsequent attaches reuse the previously
+ * initialized memory pool.
+ */
+ spin_lock_irqsave(&cctx->lock, flags);
+ if (!cctx->audio_init_mem) {
+ pages[0].addr = cctx->remote_heap_addr;
+ pages[0].size = cctx->remote_heap_size;
+ cctx->audio_init_mem = true;
+ inbuf.pageslen = 1;
+ sent_heap = true;
+ } else {
+ pages[0].addr = 0;
+ pages[0].size = 0;
+ }
+ spin_unlock_irqrestore(&cctx->lock, flags);
args[2].ptr = (u64)(uintptr_t) pages;
args[2].length = sizeof(*pages);
@@ -1404,27 +1407,11 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
return 0;
err_invoke:
- if (fl->cctx->vmcount && scm_done) {
- u64 src_perms = 0;
- struct qcom_scm_vmperm dst_perms;
- u32 i;
-
- for (i = 0; i < fl->cctx->vmcount; i++)
- src_perms |= BIT(fl->cctx->vmperms[i].vmid);
-
- dst_perms.vmid = QCOM_SCM_VMID_HLOS;
- dst_perms.perm = QCOM_SCM_PERM_RWX;
- err = qcom_scm_assign_mem(fl->cctx->remote_heap->dma_addr,
- (u64)fl->cctx->remote_heap->size,
- &src_perms, &dst_perms, 1);
- if (err)
- dev_err(fl->sctx->dev, "Failed to assign memory dma_addr %pad size 0x%llx err %d\n",
- &fl->cctx->remote_heap->dma_addr, fl->cctx->remote_heap->size, err);
+ if (sent_heap) {
+ spin_lock_irqsave(&cctx->lock, flags);
+ cctx->audio_init_mem = false;
+ spin_unlock_irqrestore(&cctx->lock, flags);
}
-err_map:
- fastrpc_buf_free(fl->cctx->remote_heap);
- fl->cctx->remote_heap = NULL;
-err_name:
kfree(name);
err:
kfree(args);
@@ -1920,7 +1907,7 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
if (copy_from_user(&req, argp, sizeof(req)))
return -EFAULT;
- if (req.flags != ADSP_MMAP_ADD_PAGES && req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR) {
+ if (req.flags != ADSP_MMAP_ADD_PAGES) {
dev_err(dev, "flag not supported 0x%x\n", req.flags);
return -EINVAL;
@@ -1931,10 +1918,7 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
return -EINVAL;
}
- if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR)
- err = fastrpc_remote_heap_alloc(fl, dev, req.size, &buf);
- else
- err = fastrpc_buf_alloc(fl, dev, req.size, &buf);
+ err = fastrpc_buf_alloc(fl, dev, req.size, &buf);
if (err) {
dev_err(dev, "failed to allocate buffer\n");
@@ -1973,20 +1957,6 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
/* let the client know the address to use */
req.vaddrout = rsp_msg.vaddr;
- /* Add memory to static PD pool, protection thru hypervisor */
- if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
- u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
-
- err = qcom_scm_assign_mem(buf->dma_addr, (u64)buf->size,
- &src_perms, fl->cctx->vmperms, fl->cctx->vmcount);
- if (err) {
- dev_err(fl->sctx->dev,
- "Failed to assign memory dma_addr %pad size 0x%llx err %d",
- &buf->dma_addr, buf->size, err);
- goto err_assign;
- }
- }
-
spin_lock(&fl->lock);
list_add_tail(&buf->node, &fl->mmaps);
spin_unlock(&fl->lock);
@@ -2322,6 +2292,45 @@ static int fastrpc_get_domain_id(const char *domain)
return -EINVAL;
}
+static int fastrpc_init_reserved_mem(struct fastrpc_channel_ctx *cctx,
+ struct device *rdev, u32 domain_id)
+{
+ struct resource res;
+ u64 src_perms;
+ int err;
+
+ /* Only SDSP and ADSP domains use a reserved remote heap region */
+ if (domain_id != SDSP_DOMAIN_ID && domain_id != ADSP_DOMAIN_ID)
+ return 0;
+
+ err = of_reserved_mem_region_to_resource(rdev->of_node, 0, &res);
+ if (err) {
+ /*
+ * The reserved-memory region is optional at probe time. For
+ * the Audio PD (ADSP) domain its absence is validated later in
+ * fastrpc_init_create_static_process(), so keep probing here.
+ */
+ return 0;
+ }
+
+ /*
+ * Audio PD (ADSP) is a static PD: cache the region so its lifetime
+ * is tied to the rpmsg channel instead of being controlled by
+ * userspace.
+ */
+ if (domain_id == ADSP_DOMAIN_ID) {
+ cctx->remote_heap_addr = res.start;
+ cctx->remote_heap_size = resource_size(&res);
+ }
+
+ if (!cctx->vmcount)
+ return 0;
+
+ src_perms = BIT(QCOM_SCM_VMID_HLOS);
+ return qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
+ cctx->vmperms, cctx->vmcount);
+}
+
static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
{
struct device *rdev = &rpdev->dev;
@@ -2366,21 +2375,9 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
}
}
- if (domain_id == SDSP_DOMAIN_ID) {
- struct resource res;
- u64 src_perms;
-
- err = of_reserved_mem_region_to_resource(rdev->of_node, 0, &res);
- if (!err) {
- src_perms = BIT(QCOM_SCM_VMID_HLOS);
-
- err = qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
- data->vmperms, data->vmcount);
- if (err)
- goto err_free_data;
- }
-
- }
+ err = fastrpc_init_reserved_mem(data, rdev, domain_id);
+ if (err)
+ goto err_free_data;
secure_dsp = !(of_property_read_bool(rdev->of_node, "qcom,non-secure-domain"));
data->secure = secure_dsp;
@@ -2476,8 +2473,25 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev)
list_for_each_entry_safe(buf, b, &cctx->invoke_interrupted_mmaps, node)
list_del(&buf->node);
- if (cctx->remote_heap)
- fastrpc_buf_free(cctx->remote_heap);
+ if (cctx->remote_heap_size && cctx->vmcount) {
+ u64 src_perms = 0;
+ int err, i;
+ struct qcom_scm_vmperm dst_perms;
+
+ for (i = 0; i < cctx->vmcount; i++)
+ src_perms |= BIT(cctx->vmperms[i].vmid);
+
+ dst_perms.vmid = QCOM_SCM_VMID_HLOS;
+ dst_perms.perm = QCOM_SCM_PERM_RWX;
+
+ err = qcom_scm_assign_mem(cctx->remote_heap_addr,
+ cctx->remote_heap_size, &src_perms,
+ &dst_perms, 1);
+ if (err)
+ dev_err(&rpdev->dev,
+ "Failed to assign memory back to HLOS: addr %pa size %#llx err %d\n",
+ &cctx->remote_heap_addr, cctx->remote_heap_size, err);
+ }
of_platform_depopulate(&rpdev->dev);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 493/990] ublk: let STOP_DEV cancel the servers commands before its release
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (491 preceding siblings ...)
2026-11-25 14:30 ` [PATCH 6.18 492/990] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 494/990] drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7 Greg Kroah-Hartman
` (359 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Ming Lei, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <tom.leiming@gmail.com>
[ Upstream commit c8b349f9daf6d88ff21033028167d00e819dafb6 ]
STOP_DEV cancels the fetched commands after dropping ub->mutex, so
START_DEV and FETCH can run in between:
STOP_DEV START_DEV / FETCH
lock ub->mutex
ublk_stop_dev_unlocked() (not started: does nothing)
unlock ub->mutex
START_DEV goes live, schedules scan
FETCH publishes a new command
cancel_work_sync(scan) cancels the new disk's scan
ublk_cancel_dev() takes the new command: NULL io->cmd
on a queue which isn't canceling
A START_DEV after STOP_DEV also goes live over the canceled commands.
Hold a reference on the server's /dev/ublkcN while canceling:
STOP_DEV
lock ub->mutex
ublk_stop_dev_unlocked()
cancel_work_sync(scan)
server attached: take a reference on its file, set STOPPING
unlock ub->mutex
ublk_cancel_dev()
drop the reference
- STOPPING makes FETCH and PREP get UBLK_IO_RES_ABORT and START_DEV
-EBUSY; a START_DEV or END_USER_RECOVERY waiting for the device
to get ready wakes up too; the reset in the server's release
clears it
- the release can't run before the reference is dropped, so no new
server can attach, and the cancel only meets this server's commands
- the cancel still runs after the unlock: io_uring_cmd_done() may take
uring_lock, under which FETCH takes ub->mutex
ublk_ch_open() saves the file in ->ch_file and ublk_ch_release() clears
it, under cancel_mutex. The release runs after the last reference is
gone, so take ours with file_ref_get(). Drop it with __fput_sync(): if
it is the last one, fput() would defer the release to this task, which
DEL_DEV then makes wait for the device to be freed.
A server which opened the device but hasn't fetched is stopped too.
Document what a server sees after STOP_DEV in ublk.rst.
Fixes: 85248d670b71 ("ublk: move ublk_cancel_dev() out of ub->mutex")
Cc: stable@vger.kernel.org
Reported-by: Josef Bacik <josef@toxicpanda.com>
Closes: https://lore.kernel.org/linux-block/20260928-b4-ublk-cancel-stop-v1-0-4a4360232a46@toxicpanda.com/
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-8-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Adapted the counter from nr_queue_ready to nr_io_ready, moved the STOPPING check into ublk_fetch(), and dropped the batch-I/O (PREP) path, which this tree lacks. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/block/ublk.rst | 7 +++
drivers/block/ublk_drv.c | 82 ++++++++++++++++++++++++++++++++----
2 files changed, 81 insertions(+), 8 deletions(-)
diff --git a/Documentation/block/ublk.rst b/Documentation/block/ublk.rst
index 8c4030bcabb63..e14200c8dc254 100644
--- a/Documentation/block/ublk.rst
+++ b/Documentation/block/ublk.rst
@@ -126,6 +126,13 @@ managing and controlling ublk devices with help of several control commands:
ublk server will release resources (such as destroying I/O handler threads &
io_uring).
+ If a server has ``/dev/ublkc*`` open, its fetched I/O commands complete with
+ ``UBLK_IO_RES_ABORT``. Until it closes ``/dev/ublkc*``, new
+ ``UBLK_IO_FETCH_REQ`` and ``UBLK_U_IO_PREP_IO_CMDS`` commands complete with
+ ``UBLK_IO_RES_ABORT`` too, and ``UBLK_CMD_START_DEV`` fails with ``-EBUSY``,
+ even if the server hadn't fetched anything. The device can be started again
+ by a server that opens ``/dev/ublkc*`` after that.
+
- ``UBLK_CMD_DEL_DEV``
Remove ``/dev/ublkc*``. When this command returns, the allocated ublk device
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 60bc10ca5ef2b..a955a3ea471d3 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -220,6 +220,8 @@ struct ublk_device {
#define UB_STATE_OPEN 0
#define UB_STATE_USED 1
#define UB_STATE_DELETED 2
+/* STOP_DEV canceled the server's commands, until its release */
+#define UB_STATE_STOPPING 3
unsigned long state;
int ub_number;
@@ -233,6 +235,8 @@ struct ublk_device {
u32 nr_io_ready;
bool unprivileged_daemons;
struct mutex cancel_mutex;
+ /* the open /dev/ublkcN, protected by cancel_mutex */
+ struct file *ch_file;
/*
* A cancel started in this FETCH round. Set by ublk_set_canceling(),
* cleared only by ublk_reset_ch_dev() when a new round starts. While
@@ -1632,6 +1636,9 @@ static int ublk_ch_open(struct inode *inode, struct file *filp)
return -EBUSY;
filp->private_data = ub;
ub->ublksrv_tgid = current->tgid;
+ mutex_lock(&ub->cancel_mutex);
+ ub->ch_file = filp;
+ mutex_unlock(&ub->cancel_mutex);
return 0;
}
@@ -1652,6 +1659,7 @@ static void ublk_reset_ch_dev(struct ublk_device *ub)
ub->nr_io_ready = 0;
ub->unprivileged_daemons = false;
ub->ublksrv_tgid = -1;
+ clear_bit(UB_STATE_STOPPING, &ub->state);
}
static struct gendisk *ublk_get_disk(struct ublk_device *ub)
@@ -1856,6 +1864,9 @@ static int ublk_ch_release(struct inode *inode, struct file *filp)
{
struct ublk_device *ub = filp->private_data;
+ mutex_lock(&ub->cancel_mutex);
+ ub->ch_file = NULL;
+ mutex_unlock(&ub->cancel_mutex);
/*
* Grab ublk device reference, so it won't be gone until we are
* really released from work function.
@@ -2151,13 +2162,54 @@ static void ublk_stop_dev_unlocked(struct ublk_device *ub)
put_disk(disk);
}
+static struct file *ublk_get_ch_file(struct ublk_device *ub)
+{
+ struct file *file;
+
+ mutex_lock(&ub->cancel_mutex);
+ file = ub->ch_file;
+ if (file && !file_ref_get(&file->f_ref))
+ file = NULL;
+ mutex_unlock(&ub->cancel_mutex);
+ return file;
+}
+
static void ublk_stop_dev(struct ublk_device *ub)
{
+ struct file *file;
+
+ /*
+ * FETCH, PREP and START_DEV take ub->mutex. If a server has
+ * /dev/ublkcN open, set STOPPING, which turns it away, and hold a
+ * reference on the file: the server's release, whose reset clears
+ * STOPPING and lets a new server attach, can't run before we drop it.
+ * So the cancel can run after the unlock and only meets this server's
+ * commands; it has to: io_uring_cmd_done() may take uring_lock, under
+ * which FETCH takes ub->mutex.
+ */
mutex_lock(&ub->mutex);
ublk_stop_dev_unlocked(ub);
- mutex_unlock(&ub->mutex);
cancel_work_sync(&ub->partition_scan_work);
+ file = ublk_get_ch_file(ub);
+ if (file) {
+ /*
+ * The server has to close /dev/ublkcN before this device can
+ * be started again: the reset in its release clears STOPPING.
+ */
+ set_bit(UB_STATE_STOPPING, &ub->state);
+ /* for wake_up_var() below, see wake_up_bit() */
+ smp_mb__after_atomic();
+ }
+ mutex_unlock(&ub->mutex);
+
+ /* no server: nothing to cancel */
+ if (!file)
+ return;
+
+ /* wake a START_DEV waiting for the device to get ready */
+ wake_up_var(&ub->nr_io_ready);
ublk_cancel_dev(ub);
+ __fput_sync(file);
}
/* reset ublk io_uring queue & io flags */
@@ -2417,6 +2469,11 @@ static int ublk_fetch(struct io_uring_cmd *cmd, struct ublk_device *ub,
if (ret)
goto out;
+ if (test_bit(UB_STATE_STOPPING, &ub->state)) {
+ ret = UBLK_IO_RES_ABORT;
+ goto out;
+ }
+
/* UBLK_IO_FETCH_REQ is only allowed before dev is setup */
if (ublk_dev_ready(ub)) {
ret = -EBUSY;
@@ -3046,22 +3103,27 @@ static bool ublk_validate_user_pid(struct ublk_device *ub, pid_t ublksrv_pid)
return ub->ublksrv_tgid == ublksrv_pid;
}
+static bool ublk_dev_ready_or_stopping(const struct ublk_device *ub)
+{
+ return ublk_dev_ready(ub) || test_bit(UB_STATE_STOPPING, &ub->state);
+}
+
/*
- * Wait until all queues have fetched their I/O commands, and return with
- * ub->mutex held and readiness guaranteed. The queues stay canceling if
- * this round saw a cancel, see ublk_reset_io_flags(). Ready may regress
- * between wakeup and mutex_lock() (daemon death), so re-check it under
- * the mutex and wait again.
+ * Wait until all queues have fetched their I/O commands, or STOP_DEV set
+ * UB_STATE_STOPPING, and return with ub->mutex held. The queues stay
+ * canceling if this round saw a cancel, see ublk_reset_io_flags(). Ready
+ * may regress between wakeup and mutex_lock() (daemon death), so re-check
+ * it under the mutex and wait again.
*/
static int ublk_wait_dev_ready_and_lock(struct ublk_device *ub)
{
while (true) {
if (wait_var_event_interruptible(&ub->nr_io_ready,
- ublk_dev_ready(ub)))
+ ublk_dev_ready_or_stopping(ub)))
return -EINTR;
mutex_lock(&ub->mutex);
- if (ublk_dev_ready(ub))
+ if (ublk_dev_ready_or_stopping(ub))
return 0;
mutex_unlock(&ub->mutex);
}
@@ -3144,6 +3206,10 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub,
ret = -EEXIST;
goto out_unlock;
}
+ if (test_bit(UB_STATE_STOPPING, &ub->state)) {
+ ret = -EBUSY;
+ goto out_unlock;
+ }
disk = blk_mq_alloc_disk(&ub->tag_set, &lim, NULL);
if (IS_ERR(disk)) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 494/990] drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (492 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 493/990] ublk: let STOP_DEV cancel the servers commands before its release Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 495/990] inet: frags: prevent acceptance of partially authenticated reassembly Greg Kroah-Hartman
` (358 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Wang, Kenneth Feng,
José Miguel Sarasola, Alex Deucher, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Wang <kevin.wang@amd.com>
[ Upstream commit 6027db7db773714f2e05df82093276f2a52a1fba ]
PMFW treats FeatureCtrlMask as the complete set of active OD features.
Uploads containing only newly edited bits can drop earlier settings.
Fix the OD state handling to:
- preserve committed features across later commits
- keep staged OD settings out of power-cap writes
- update cached state only after successful uploads
- clear restored features only after they return to defaults
- restore PPT for the current AC/DC source after resume
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/3625
Signed-off-by: Kevin Wang <kevin.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Tested-by: José Miguel Sarasola <alosarjos@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit adf63026e1fa706de48d986ac6c1a7cb64cbf927)
Cc: stable@vger.kernel.org
[ sashal: Low-limit power-cap branch tests smu->current_power_limit > msg_limit instead of upstream's firmware Ppt readback, and uses older set_power_limit naming, with the forward declaration anchored on a different function. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 193 +++++++++++++-----
.../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 193 +++++++++++++-----
2 files changed, 293 insertions(+), 93 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
index 9d2d630bba240..4ed3bbc3effef 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
@@ -62,6 +62,9 @@
static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu,
int od_feature_bit,
int32_t *min, int32_t *max);
+static int
+smu_v13_0_0_upload_overdrive_table(struct smu_context *smu,
+ OverDriveTableExternal_t *od_table);
#define FEATURE_MASK(feature) (1ULL << feature)
#define SMC_DPM_FEATURE ( \
@@ -1096,6 +1099,93 @@ static bool smu_v13_0_0_is_od_feature_supported(struct smu_context *smu,
return feature_enabled;
}
+static u32
+smu_v13_0_0_filter_od_feature_mask(struct smu_context *smu, u32 feature_mask)
+{
+ PPTable_t *pptable = smu->smu_table.driver_pptable;
+ u32 supported_mask =
+ pptable->SkuTable.OverDriveLimitsBasicMax.FeatureCtrlMask;
+
+ return feature_mask & supported_mask;
+}
+
+static bool smu_v13_0_0_fan_is_default(const OverDriveTable_t *od,
+ const OverDriveTable_t *boot)
+{
+ return !memcmp(od->FanLinearPwmPoints, boot->FanLinearPwmPoints,
+ sizeof(od->FanLinearPwmPoints)) &&
+ !memcmp(od->FanLinearTempPoints, boot->FanLinearTempPoints,
+ sizeof(od->FanLinearTempPoints)) &&
+ od->FanMinimumPwm == boot->FanMinimumPwm &&
+ od->AcousticTargetRpmThreshold == boot->AcousticTargetRpmThreshold &&
+ od->AcousticLimitRpmThreshold == boot->AcousticLimitRpmThreshold &&
+ od->FanTargetTemperature == boot->FanTargetTemperature &&
+ od->FanMode == boot->FanMode;
+}
+
+static bool smu_v13_0_0_zero_fan_is_default(const OverDriveTable_t *od,
+ const OverDriveTable_t *boot)
+{
+ return od->FanZeroRpmEnable == boot->FanZeroRpmEnable &&
+ od->FanZeroRpmStopTemp == boot->FanZeroRpmStopTemp;
+}
+
+static u32 smu_v13_0_0_normalize_feature_mask(const OverDriveTable_t *od,
+ const OverDriveTable_t *boot,
+ u32 feature_mask)
+{
+ if (od->GfxclkFmin == boot->GfxclkFmin &&
+ od->GfxclkFmax == boot->GfxclkFmax)
+ feature_mask &= ~BIT(PP_OD_FEATURE_GFXCLK_BIT);
+ if (od->UclkFmin == boot->UclkFmin &&
+ od->UclkFmax == boot->UclkFmax)
+ feature_mask &= ~BIT(PP_OD_FEATURE_UCLK_BIT);
+ if (!memcmp(od->VoltageOffsetPerZoneBoundary,
+ boot->VoltageOffsetPerZoneBoundary,
+ sizeof(od->VoltageOffsetPerZoneBoundary)))
+ feature_mask &= ~BIT(PP_OD_FEATURE_GFX_VF_CURVE_BIT);
+ if (smu_v13_0_0_fan_is_default(od, boot))
+ feature_mask &= ~BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ if (smu_v13_0_0_zero_fan_is_default(od, boot))
+ feature_mask &= ~BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
+ if (!od->Ppt)
+ feature_mask &= ~BIT(PP_OD_FEATURE_PPT_BIT);
+
+ return feature_mask;
+}
+
+static int
+smu_v13_0_0_upload_ppt_overdrive_table(struct smu_context *smu, s16 ppt)
+{
+ struct smu_table_context *table_context = &smu->smu_table;
+ OverDriveTableExternal_t *od_table = table_context->overdrive_table;
+ OverDriveTableExternal_t *user_od_table = table_context->user_overdrive_table;
+ OverDriveTableExternal_t upload_table;
+ u32 next_mask = table_context->user_od_feature_mask;
+ int ret;
+
+ /* Do not commit OD settings staged after the last c operation. */
+ memcpy(&upload_table, user_od_table, sizeof(upload_table));
+ upload_table.OverDriveTable.Ppt = ppt;
+ if (ppt)
+ next_mask |= BIT(PP_OD_FEATURE_PPT_BIT);
+ else
+ next_mask &= ~BIT(PP_OD_FEATURE_PPT_BIT);
+ upload_table.OverDriveTable.FeatureCtrlMask =
+ smu_v13_0_0_filter_od_feature_mask(smu, next_mask);
+
+ ret = smu_v13_0_0_upload_overdrive_table(smu, &upload_table);
+ if (ret)
+ return ret;
+
+ table_context->user_od_feature_mask =
+ upload_table.OverDriveTable.FeatureCtrlMask;
+ od_table->OverDriveTable.Ppt = ppt;
+ user_od_table->OverDriveTable.Ppt = ppt;
+
+ return 0;
+}
+
static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu,
int od_feature_bit,
int32_t *min,
@@ -1588,41 +1678,30 @@ static int smu_v13_0_0_od_restore_table_single(struct smu_context *smu, long inp
boot_overdrive_table->OverDriveTable.FanLinearPwmPoints[i];
}
od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_ACOUSTIC_LIMIT:
od_table->OverDriveTable.AcousticLimitRpmThreshold =
boot_overdrive_table->OverDriveTable.AcousticLimitRpmThreshold;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_ACOUSTIC_TARGET:
od_table->OverDriveTable.AcousticTargetRpmThreshold =
boot_overdrive_table->OverDriveTable.AcousticTargetRpmThreshold;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_FAN_TARGET_TEMPERATURE:
od_table->OverDriveTable.FanTargetTemperature =
boot_overdrive_table->OverDriveTable.FanTargetTemperature;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_FAN_MINIMUM_PWM:
od_table->OverDriveTable.FanMinimumPwm =
boot_overdrive_table->OverDriveTable.FanMinimumPwm;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_FAN_ZERO_RPM_ENABLE:
od_table->OverDriveTable.FanZeroRpmEnable =
boot_overdrive_table->OverDriveTable.FanZeroRpmEnable;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
break;
case PP_OD_EDIT_FAN_ZERO_RPM_STOP_TEMP:
od_table->OverDriveTable.FanZeroRpmStopTemp =
boot_overdrive_table->OverDriveTable.FanZeroRpmStopTemp;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
break;
default:
dev_info(adev->dev, "Invalid table index: %ld\n", input);
@@ -1640,9 +1719,17 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
struct smu_table_context *table_context = &smu->smu_table;
OverDriveTableExternal_t *od_table =
(OverDriveTableExternal_t *)table_context->overdrive_table;
+ OverDriveTableExternal_t *user_od_table =
+ (OverDriveTableExternal_t *)table_context->user_overdrive_table;
+ OverDriveTableExternal_t *boot_od_table =
+ (OverDriveTableExternal_t *)table_context->boot_overdrive_table;
+ OverDriveTableExternal_t upload_table;
+ OverDriveTable_t *od = &od_table->OverDriveTable;
+ OverDriveTable_t *boot = &boot_od_table->OverDriveTable;
struct amdgpu_device *adev = smu->adev;
uint32_t offset_of_voltageoffset;
int32_t minimum, maximum;
+ u32 next_mask;
int i, ret = 0;
switch (type) {
@@ -1966,36 +2053,41 @@ static int smu_v13_0_0_od_edit_dpm_table(struct smu_context *smu,
} else {
memcpy(od_table,
table_context->boot_overdrive_table,
- sizeof(OverDriveTableExternal_t));
+ sizeof(OverDriveTableExternal_t));
od_table->OverDriveTable.FeatureCtrlMask = 0;
- table_context->user_od_feature_mask = 0;
}
fallthrough;
case PP_OD_COMMIT_DPM_TABLE:
- table_context->user_od_feature_mask =
- od_table->OverDriveTable.FeatureCtrlMask;
offset_of_voltageoffset = offsetof(OverDriveTable_t, VoltageOffsetPerZoneBoundary);
- if (memcmp((u8 *)od_table + offset_of_voltageoffset,
- table_context->user_overdrive_table + offset_of_voltageoffset,
- sizeof(OverDriveTableExternal_t) - offset_of_voltageoffset)) {
- smu_v13_0_0_dump_od_table(smu, od_table);
+ next_mask = smu_v13_0_0_filter_od_feature_mask(smu,
+ table_context->user_od_feature_mask |
+ od->FeatureCtrlMask);
+ next_mask = smu_v13_0_0_normalize_feature_mask(od, boot,
+ next_mask);
- ret = smu_v13_0_0_upload_overdrive_table(smu, od_table);
+ if (memcmp((u8 *)od_table + offset_of_voltageoffset,
+ (u8 *)user_od_table + offset_of_voltageoffset,
+ sizeof(OverDriveTableExternal_t) - offset_of_voltageoffset) ||
+ next_mask != table_context->user_od_feature_mask) {
+ memcpy(&upload_table, od_table, sizeof(upload_table));
+ upload_table.OverDriveTable.FeatureCtrlMask = next_mask;
+ smu_v13_0_0_dump_od_table(smu, &upload_table);
+
+ ret = smu_v13_0_0_upload_overdrive_table(smu, &upload_table);
if (ret) {
dev_err(adev->dev, "Failed to upload overdrive table!\n");
return ret;
}
- memcpy(table_context->user_overdrive_table + offset_of_voltageoffset,
+ table_context->user_od_feature_mask = next_mask;
+ od_table->OverDriveTable.FeatureCtrlMask = 0;
+ memcpy((u8 *)user_od_table + offset_of_voltageoffset,
(u8 *)od_table + offset_of_voltageoffset,
sizeof(OverDriveTableExternal_t) - offset_of_voltageoffset);
+ user_od_table->OverDriveTable.FeatureCtrlMask = 0;
- if (!memcmp(table_context->user_overdrive_table,
- table_context->boot_overdrive_table,
- sizeof(OverDriveTableExternal_t)))
- smu->user_dpm_profile.user_od = false;
- else
- smu->user_dpm_profile.user_od = true;
+ smu->user_dpm_profile.user_od =
+ !!(next_mask & ~BIT(PP_OD_FEATURE_PPT_BIT));
}
break;
@@ -2254,6 +2346,7 @@ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
memcpy(od_table,
boot_od_table,
sizeof(OverDriveTableExternal_t));
+ od_table->OverDriveTable.FeatureCtrlMask = 0;
/*
* For S3/S4/Runpm resume, we need to setup those overdrive tables again,
@@ -2263,6 +2356,7 @@ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
memcpy(user_od_table,
boot_od_table,
sizeof(OverDriveTableExternal_t));
+ user_od_table->OverDriveTable.FeatureCtrlMask = 0;
smu->user_dpm_profile.user_od = false;
smu->smu_table.user_od_feature_mask = 0;
} else if (smu->user_dpm_profile.user_od) {
@@ -2301,6 +2395,14 @@ static int smu_v13_0_0_set_default_od_settings(struct smu_context *smu)
user_od_table_bak.OverDriveTable.FanZeroRpmEnable;
user_od_table->OverDriveTable.FanZeroRpmStopTemp =
user_od_table_bak.OverDriveTable.FanZeroRpmStopTemp;
+ user_od_table->OverDriveTable.FanMode =
+ user_od_table_bak.OverDriveTable.FanMode;
+ user_od_table->OverDriveTable.FeatureCtrlMask = 0;
+ }
+ if (smu->adev->in_suspend) {
+ user_od_table->OverDriveTable.Ppt = 0;
+ smu->smu_table.user_od_feature_mask &=
+ ~BIT(PP_OD_FEATURE_PPT_BIT);
}
smu_v13_0_0_set_supported_od_feature_mask(smu);
@@ -2313,13 +2415,22 @@ static int smu_v13_0_0_restore_user_od_settings(struct smu_context *smu)
struct smu_table_context *table_context = &smu->smu_table;
OverDriveTableExternal_t *od_table = table_context->overdrive_table;
OverDriveTableExternal_t *user_od_table = table_context->user_overdrive_table;
+ OverDriveTableExternal_t upload_table;
+ u32 next_mask;
int res;
- user_od_table->OverDriveTable.FeatureCtrlMask =
- table_context->user_od_feature_mask;
- res = smu_v13_0_0_upload_overdrive_table(smu, user_od_table);
- user_od_table->OverDriveTable.FeatureCtrlMask = 0;
- if (res == 0)
+
+ next_mask = smu_v13_0_0_filter_od_feature_mask(smu,
+ table_context->user_od_feature_mask);
+ memcpy(&upload_table, user_od_table, sizeof(upload_table));
+ upload_table.OverDriveTable.FeatureCtrlMask = next_mask;
+ res = smu_v13_0_0_upload_overdrive_table(smu, &upload_table);
+ if (res == 0) {
+ table_context->user_od_feature_mask = next_mask;
+ smu->user_dpm_profile.user_od =
+ !!(next_mask & ~BIT(PP_OD_FEATURE_PPT_BIT));
memcpy(od_table, user_od_table, sizeof(OverDriveTableExternal_t));
+ od_table->OverDriveTable.FeatureCtrlMask = 0;
+ }
return res;
}
@@ -3109,9 +3220,7 @@ static int smu_v13_0_0_set_power_limit(struct smu_context *smu,
PPTable_t *pptable = smu->smu_table.driver_pptable;
SkuTable_t *skutable = &pptable->SkuTable;
uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
- struct smu_table_context *table_context = &smu->smu_table;
- OverDriveTableExternal_t *od_table =
- (OverDriveTableExternal_t *)table_context->overdrive_table;
+ s16 ppt;
int ret = 0;
if (limit_type != SMU_DEFAULT_PPT_LIMIT)
@@ -3119,12 +3228,7 @@ static int smu_v13_0_0_set_power_limit(struct smu_context *smu,
if (limit <= msg_limit) {
if (smu->current_power_limit > msg_limit) {
- od_table->OverDriveTable.Ppt = 0;
- table_context->user_od_feature_mask &=
- ~(1U << PP_OD_FEATURE_PPT_BIT);
- od_table->OverDriveTable.FeatureCtrlMask =
- table_context->user_od_feature_mask;
- ret = smu_v13_0_0_upload_overdrive_table(smu, od_table);
+ ret = smu_v13_0_0_upload_ppt_overdrive_table(smu, 0);
if (ret) {
dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
return ret;
@@ -3136,11 +3240,8 @@ static int smu_v13_0_0_set_power_limit(struct smu_context *smu,
if (ret)
return ret;
- od_table->OverDriveTable.Ppt = (limit * 100) / msg_limit - 100;
- table_context->user_od_feature_mask |= 1U << PP_OD_FEATURE_PPT_BIT;
- od_table->OverDriveTable.FeatureCtrlMask =
- table_context->user_od_feature_mask;
- ret = smu_v13_0_0_upload_overdrive_table(smu, od_table);
+ ppt = (limit * 100) / msg_limit - 100;
+ ret = smu_v13_0_0_upload_ppt_overdrive_table(smu, ppt);
if (ret) {
dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
return ret;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 5df28b89cb696..dab5514b1832b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -62,6 +62,9 @@
static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
int od_feature_bit,
int32_t *min, int32_t *max);
+static int
+smu_v13_0_7_upload_overdrive_table(struct smu_context *smu,
+ OverDriveTableExternal_t *od_table);
#define FEATURE_MASK(feature) (1ULL << feature)
#define SMC_DPM_FEATURE ( \
@@ -80,6 +83,7 @@ static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
#define PP_OD_FEATURE_GFXCLK_FMAX 1
#define PP_OD_FEATURE_UCLK_FMIN 2
#define PP_OD_FEATURE_UCLK_FMAX 3
+
#define PP_OD_FEATURE_GFX_VF_CURVE 4
#define PP_OD_FEATURE_FAN_CURVE_TEMP 5
#define PP_OD_FEATURE_FAN_CURVE_PWM 6
@@ -1085,6 +1089,93 @@ static bool smu_v13_0_7_is_od_feature_supported(struct smu_context *smu,
return feature_enabled;
}
+static u32
+smu_v13_0_7_filter_od_feature_mask(struct smu_context *smu, u32 feature_mask)
+{
+ PPTable_t *pptable = smu->smu_table.driver_pptable;
+ u32 supported_mask =
+ pptable->SkuTable.OverDriveLimitsBasicMax.FeatureCtrlMask;
+
+ return feature_mask & supported_mask;
+}
+
+static bool smu_v13_0_7_fan_is_default(const OverDriveTable_t *od,
+ const OverDriveTable_t *boot)
+{
+ return !memcmp(od->FanLinearPwmPoints, boot->FanLinearPwmPoints,
+ sizeof(od->FanLinearPwmPoints)) &&
+ !memcmp(od->FanLinearTempPoints, boot->FanLinearTempPoints,
+ sizeof(od->FanLinearTempPoints)) &&
+ od->FanMinimumPwm == boot->FanMinimumPwm &&
+ od->AcousticTargetRpmThreshold == boot->AcousticTargetRpmThreshold &&
+ od->AcousticLimitRpmThreshold == boot->AcousticLimitRpmThreshold &&
+ od->FanTargetTemperature == boot->FanTargetTemperature &&
+ od->FanMode == boot->FanMode;
+}
+
+static bool smu_v13_0_7_zero_fan_is_default(const OverDriveTable_t *od,
+ const OverDriveTable_t *boot)
+{
+ return od->FanZeroRpmEnable == boot->FanZeroRpmEnable &&
+ od->FanZeroRpmStopTemp == boot->FanZeroRpmStopTemp;
+}
+
+static u32 smu_v13_0_7_normalize_feature_mask(const OverDriveTable_t *od,
+ const OverDriveTable_t *boot,
+ u32 feature_mask)
+{
+ if (od->GfxclkFmin == boot->GfxclkFmin &&
+ od->GfxclkFmax == boot->GfxclkFmax)
+ feature_mask &= ~BIT(PP_OD_FEATURE_GFXCLK_BIT);
+ if (od->UclkFmin == boot->UclkFmin &&
+ od->UclkFmax == boot->UclkFmax)
+ feature_mask &= ~BIT(PP_OD_FEATURE_UCLK_BIT);
+ if (!memcmp(od->VoltageOffsetPerZoneBoundary,
+ boot->VoltageOffsetPerZoneBoundary,
+ sizeof(od->VoltageOffsetPerZoneBoundary)))
+ feature_mask &= ~BIT(PP_OD_FEATURE_GFX_VF_CURVE_BIT);
+ if (smu_v13_0_7_fan_is_default(od, boot))
+ feature_mask &= ~BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+ if (smu_v13_0_7_zero_fan_is_default(od, boot))
+ feature_mask &= ~BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
+ if (!od->Ppt)
+ feature_mask &= ~BIT(PP_OD_FEATURE_PPT_BIT);
+
+ return feature_mask;
+}
+
+static int
+smu_v13_0_7_upload_ppt_overdrive_table(struct smu_context *smu, s16 ppt)
+{
+ struct smu_table_context *table_context = &smu->smu_table;
+ OverDriveTableExternal_t *od_table = table_context->overdrive_table;
+ OverDriveTableExternal_t *user_od_table = table_context->user_overdrive_table;
+ OverDriveTableExternal_t upload_table;
+ u32 next_mask = table_context->user_od_feature_mask;
+ int ret;
+
+ /* Do not commit OD settings staged after the last c operation. */
+ memcpy(&upload_table, user_od_table, sizeof(upload_table));
+ upload_table.OverDriveTable.Ppt = ppt;
+ if (ppt)
+ next_mask |= BIT(PP_OD_FEATURE_PPT_BIT);
+ else
+ next_mask &= ~BIT(PP_OD_FEATURE_PPT_BIT);
+ upload_table.OverDriveTable.FeatureCtrlMask =
+ smu_v13_0_7_filter_od_feature_mask(smu, next_mask);
+
+ ret = smu_v13_0_7_upload_overdrive_table(smu, &upload_table);
+ if (ret)
+ return ret;
+
+ table_context->user_od_feature_mask =
+ upload_table.OverDriveTable.FeatureCtrlMask;
+ od_table->OverDriveTable.Ppt = ppt;
+ user_od_table->OverDriveTable.Ppt = ppt;
+
+ return 0;
+}
+
static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
int od_feature_bit,
int32_t *min,
@@ -1576,41 +1667,30 @@ static int smu_v13_0_7_od_restore_table_single(struct smu_context *smu, long inp
boot_overdrive_table->OverDriveTable.FanLinearPwmPoints[i];
}
od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_ACOUSTIC_LIMIT:
od_table->OverDriveTable.AcousticLimitRpmThreshold =
boot_overdrive_table->OverDriveTable.AcousticLimitRpmThreshold;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_ACOUSTIC_TARGET:
od_table->OverDriveTable.AcousticTargetRpmThreshold =
boot_overdrive_table->OverDriveTable.AcousticTargetRpmThreshold;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_FAN_TARGET_TEMPERATURE:
od_table->OverDriveTable.FanTargetTemperature =
boot_overdrive_table->OverDriveTable.FanTargetTemperature;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_FAN_MINIMUM_PWM:
od_table->OverDriveTable.FanMinimumPwm =
boot_overdrive_table->OverDriveTable.FanMinimumPwm;
- od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
break;
case PP_OD_EDIT_FAN_ZERO_RPM_ENABLE:
od_table->OverDriveTable.FanZeroRpmEnable =
boot_overdrive_table->OverDriveTable.FanZeroRpmEnable;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
break;
case PP_OD_EDIT_FAN_ZERO_RPM_STOP_TEMP:
od_table->OverDriveTable.FanZeroRpmStopTemp =
boot_overdrive_table->OverDriveTable.FanZeroRpmStopTemp;
- od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_ZERO_FAN_BIT);
break;
default:
dev_info(adev->dev, "Invalid table index: %ld\n", input);
@@ -1628,9 +1708,17 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
struct smu_table_context *table_context = &smu->smu_table;
OverDriveTableExternal_t *od_table =
(OverDriveTableExternal_t *)table_context->overdrive_table;
+ OverDriveTableExternal_t *user_od_table =
+ (OverDriveTableExternal_t *)table_context->user_overdrive_table;
+ OverDriveTableExternal_t *boot_od_table =
+ (OverDriveTableExternal_t *)table_context->boot_overdrive_table;
+ OverDriveTableExternal_t upload_table;
+ OverDriveTable_t *od = &od_table->OverDriveTable;
+ OverDriveTable_t *boot = &boot_od_table->OverDriveTable;
struct amdgpu_device *adev = smu->adev;
uint32_t offset_of_voltageoffset;
int32_t minimum, maximum;
+ u32 next_mask;
int i, ret = 0;
switch (type) {
@@ -1956,35 +2044,40 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
table_context->boot_overdrive_table,
sizeof(OverDriveTableExternal_t));
od_table->OverDriveTable.FeatureCtrlMask = 0;
- table_context->user_od_feature_mask = 0;
}
fallthrough;
case PP_OD_COMMIT_DPM_TABLE:
- table_context->user_od_feature_mask =
- od_table->OverDriveTable.FeatureCtrlMask;
offset_of_voltageoffset = offsetof(OverDriveTable_t, VoltageOffsetPerZoneBoundary);
- if (memcmp((u8 *)od_table + offset_of_voltageoffset,
- table_context->user_overdrive_table + offset_of_voltageoffset,
- sizeof(OverDriveTableExternal_t) - offset_of_voltageoffset)) {
- smu_v13_0_7_dump_od_table(smu, od_table);
+ next_mask = smu_v13_0_7_filter_od_feature_mask(smu,
+ table_context->user_od_feature_mask |
+ od->FeatureCtrlMask);
+ next_mask = smu_v13_0_7_normalize_feature_mask(od, boot,
+ next_mask);
- ret = smu_v13_0_7_upload_overdrive_table(smu, od_table);
+ if (memcmp((u8 *)od_table + offset_of_voltageoffset,
+ (u8 *)user_od_table + offset_of_voltageoffset,
+ sizeof(OverDriveTableExternal_t) - offset_of_voltageoffset) ||
+ next_mask != table_context->user_od_feature_mask) {
+ memcpy(&upload_table, od_table, sizeof(upload_table));
+ upload_table.OverDriveTable.FeatureCtrlMask = next_mask;
+ smu_v13_0_7_dump_od_table(smu, &upload_table);
+
+ ret = smu_v13_0_7_upload_overdrive_table(smu, &upload_table);
if (ret) {
dev_err(adev->dev, "Failed to upload overdrive table!\n");
return ret;
}
- memcpy(table_context->user_overdrive_table + offset_of_voltageoffset,
+ table_context->user_od_feature_mask = next_mask;
+ od_table->OverDriveTable.FeatureCtrlMask = 0;
+ memcpy((u8 *)user_od_table + offset_of_voltageoffset,
(u8 *)od_table + offset_of_voltageoffset,
sizeof(OverDriveTableExternal_t) - offset_of_voltageoffset);
+ user_od_table->OverDriveTable.FeatureCtrlMask = 0;
- if (!memcmp(table_context->user_overdrive_table,
- table_context->boot_overdrive_table,
- sizeof(OverDriveTableExternal_t)))
- smu->user_dpm_profile.user_od = false;
- else
- smu->user_dpm_profile.user_od = true;
+ smu->user_dpm_profile.user_od =
+ !!(next_mask & ~BIT(PP_OD_FEATURE_PPT_BIT));
}
break;
@@ -2237,6 +2330,7 @@ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
memcpy(od_table,
boot_od_table,
sizeof(OverDriveTableExternal_t));
+ od_table->OverDriveTable.FeatureCtrlMask = 0;
/*
* For S3/S4/Runpm resume, we need to setup those overdrive tables again,
@@ -2246,6 +2340,7 @@ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
memcpy(user_od_table,
boot_od_table,
sizeof(OverDriveTableExternal_t));
+ user_od_table->OverDriveTable.FeatureCtrlMask = 0;
smu->user_dpm_profile.user_od = false;
smu->smu_table.user_od_feature_mask = 0;
} else if (smu->user_dpm_profile.user_od) {
@@ -2284,6 +2379,14 @@ static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
user_od_table_bak.OverDriveTable.FanZeroRpmEnable;
user_od_table->OverDriveTable.FanZeroRpmStopTemp =
user_od_table_bak.OverDriveTable.FanZeroRpmStopTemp;
+ user_od_table->OverDriveTable.FanMode =
+ user_od_table_bak.OverDriveTable.FanMode;
+ user_od_table->OverDriveTable.FeatureCtrlMask = 0;
+ }
+ if (smu->adev->in_suspend) {
+ user_od_table->OverDriveTable.Ppt = 0;
+ smu->smu_table.user_od_feature_mask &=
+ ~BIT(PP_OD_FEATURE_PPT_BIT);
}
smu_v13_0_7_set_supported_od_feature_mask(smu);
@@ -2296,14 +2399,22 @@ static int smu_v13_0_7_restore_user_od_settings(struct smu_context *smu)
struct smu_table_context *table_context = &smu->smu_table;
OverDriveTableExternal_t *od_table = table_context->overdrive_table;
OverDriveTableExternal_t *user_od_table = table_context->user_overdrive_table;
+ OverDriveTableExternal_t upload_table;
+ u32 next_mask;
int res;
- user_od_table->OverDriveTable.FeatureCtrlMask =
- table_context->user_od_feature_mask;
- res = smu_v13_0_7_upload_overdrive_table(smu, user_od_table);
- user_od_table->OverDriveTable.FeatureCtrlMask = 0;
- if (res == 0)
+ next_mask = smu_v13_0_7_filter_od_feature_mask(smu,
+ table_context->user_od_feature_mask);
+ memcpy(&upload_table, user_od_table, sizeof(upload_table));
+ upload_table.OverDriveTable.FeatureCtrlMask = next_mask;
+ res = smu_v13_0_7_upload_overdrive_table(smu, &upload_table);
+ if (res == 0) {
+ table_context->user_od_feature_mask = next_mask;
+ smu->user_dpm_profile.user_od =
+ !!(next_mask & ~BIT(PP_OD_FEATURE_PPT_BIT));
memcpy(od_table, user_od_table, sizeof(OverDriveTableExternal_t));
+ od_table->OverDriveTable.FeatureCtrlMask = 0;
+ }
return res;
}
@@ -2706,9 +2817,7 @@ static int smu_v13_0_7_set_power_limit(struct smu_context *smu,
PPTable_t *pptable = smu->smu_table.driver_pptable;
SkuTable_t *skutable = &pptable->SkuTable;
uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
- struct smu_table_context *table_context = &smu->smu_table;
- OverDriveTableExternal_t *od_table =
- (OverDriveTableExternal_t *)table_context->overdrive_table;
+ s16 ppt;
int ret = 0;
if (limit_type != SMU_DEFAULT_PPT_LIMIT)
@@ -2716,13 +2825,7 @@ static int smu_v13_0_7_set_power_limit(struct smu_context *smu,
if (limit <= msg_limit) {
if (smu->current_power_limit > msg_limit) {
- od_table->OverDriveTable.Ppt = 0;
- table_context->user_od_feature_mask &=
- ~(1U << PP_OD_FEATURE_PPT_BIT);
- od_table->OverDriveTable.FeatureCtrlMask =
- table_context->user_od_feature_mask;
-
- ret = smu_v13_0_7_upload_overdrive_table(smu, od_table);
+ ret = smu_v13_0_7_upload_ppt_overdrive_table(smu, 0);
if (ret) {
dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
return ret;
@@ -2734,12 +2837,8 @@ static int smu_v13_0_7_set_power_limit(struct smu_context *smu,
if (ret)
return ret;
- od_table->OverDriveTable.Ppt = (limit * 100) / msg_limit - 100;
- table_context->user_od_feature_mask |= 1U << PP_OD_FEATURE_PPT_BIT;
- od_table->OverDriveTable.FeatureCtrlMask =
- table_context->user_od_feature_mask;
-
- ret = smu_v13_0_7_upload_overdrive_table(smu, od_table);
+ ppt = (limit * 100) / msg_limit - 100;
+ ret = smu_v13_0_7_upload_ppt_overdrive_table(smu, ppt);
if (ret) {
dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 495/990] inet: frags: prevent acceptance of partially authenticated reassembly
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (493 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 494/990] drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7 Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 496/990] drm/i915/display: Disable pipe joiner on WCL Greg Kroah-Hartman
` (357 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jérémy Jean, Eric Dumazet,
Dave Miller, 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 6fb4e32f2ce3234ae0c416872e911706a3484430 ]
A reassembled skb retains the secpath from its first fragment, which
makes it possible for the final policy check to accept bytes that were
not covered by the transform recorded on the skb. This can affect IPsec
tunnel traffic, including AH and ESP, and allow a packet to be accepted
even though only part of its payload was authenticated.
Reject a fragment when its secpath differs from the fragments already
in the queue, and keep overlap statistics limited to actual overlaps.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
[ sashal: Adapted the ip6_frag_queue overlap stat to use ip6_dst_idev(skb_dst(skb)) instead of a local idev, and kept existing IPFRAG_TOOBIG/truesize context in inet_frag.h and inet_fragment.c. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/net/inet_frag.h | 1 +
include/net/xfrm.h | 17 +++++++++++++++++
net/ipv4/inet_fragment.c | 5 +++++
net/ipv4/ip_fragment.c | 3 ++-
net/ipv6/reassembly.c | 5 +++--
5 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 6aea2d1ac376f..c1fb419a9cf03 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -173,6 +173,7 @@ extern const u8 ip_frag_ecn_table[16];
#define IPFRAG_OK 0
#define IPFRAG_DUP 1
#define IPFRAG_OVERLAP 2
+#define IPFRAG_MIXED_SECPATH 3
#define IPFRAG_TOOBIG 4
/* Max sum of the truesize of fragments in a queue. This keeps the sums
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index af0869c14a253..7479fe2ca5f5e 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1189,6 +1189,23 @@ secpath_reset(struct sk_buff *skb)
#endif
}
+static inline bool
+secpath_equal(const struct sk_buff *skb1, const struct sk_buff *skb2)
+{
+ const struct sec_path *sp1 = skb_sec_path(skb1);
+ const struct sec_path *sp2 = skb_sec_path(skb2);
+ int i;
+
+ if (!sp1 || !sp2)
+ return sp1 == sp2;
+ if (sp1->len != sp2->len)
+ return false;
+ for (i = 0; i < sp1->len; i++)
+ if (sp1->xvec[i] != sp2->xvec[i])
+ return false;
+ return true;
+}
+
static inline int
xfrm_addr_any(const xfrm_address_t *addr, unsigned short family)
{
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 4d55444a6f30f..1f0327f07faa2 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -24,6 +24,7 @@
#include <net/inet_ecn.h>
#include <net/ip.h>
#include <net/ipv6.h>
+#include <net/xfrm.h>
#include "../core/sock_destructor.h"
@@ -448,6 +449,10 @@ int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb,
if (skb->truesize > INET_FRAG_MAX_TRUESIZE - q->truesize)
return IPFRAG_TOOBIG;
+ /* The reassembled skb keeps the first fragment's secpath. */
+ if (last && !secpath_equal(last, skb))
+ return IPFRAG_MIXED_SECPATH;
+
/* An IP fragment is never a GSO packet, but an untrusted source
* (virtio_net_hdr) may have attached GSO metadata to it. Do not let
* that reach the reassembled skb, whose head keeps the first
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 03e19a29df05e..ef7fd61284a3f 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -378,8 +378,9 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb, int *refs)
err = -EINVAL;
goto err;
}
+ if (err == IPFRAG_OVERLAP)
+ __IP_INC_STATS(net, IPSTATS_MIB_REASM_OVERLAPS);
err = -EINVAL;
- __IP_INC_STATS(net, IPSTATS_MIB_REASM_OVERLAPS);
discard_qp:
inet_frag_kill(&qp->q, refs);
__IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index a5e0cec45974a..74ac8e8bc19b6 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -236,9 +236,10 @@ static int ip6_frag_queue(struct net *net,
err = -EINVAL;
goto err;
}
+ if (err == IPFRAG_OVERLAP)
+ __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
+ IPSTATS_MIB_REASM_OVERLAPS);
err = -EINVAL;
- __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
- IPSTATS_MIB_REASM_OVERLAPS);
discard_fq:
inet_frag_kill(&fq->q, refs);
__IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 496/990] drm/i915/display: Disable pipe joiner on WCL
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (494 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 495/990] inet: frags: prevent acceptance of partially authenticated reassembly Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 497/990] can: skb: make echo skb freeing safe in any IRQ context Greg Kroah-Hartman
` (356 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Charlton Lin, Uma Shankar,
Vidya Srinivas, Joonas Lahtinen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Srinivas <vidya.srinivas@intel.com>
[ Upstream commit b42b656db1384255044754cd2163d370d766b776 ]
Pipe joining is not supported in the WCL display configuration.
Report no joiner support on WCL so that modes which would require
joining are rejected, matching the 4k 60Hz maximum resolution
documented for the platform.
v2: Rebase onto latest upstream
v3: Fix up the commit message
v4: Split the scaler and joiner changes into separate patches (Jani)
Bspec: 74286
Fixes: f8e1c3e07db1 ("drm/i915/xe3lpd: Add support for display version 30.02")
Cc: stable@vger.kernel.org
Suggested-by: Charlton Lin <charlton.lin@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Link: https://patch.msgid.link/20261028070404.1913843-3-vidya.srinivas@intel.com
(cherry picked from commit 917676a55a690319a01b45d3956eaf94ba564df8)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
[ sashal: Dropped the unrelated eDP VBT pipe_joiner_enable check from the context, since this branch lacks it, and applied only the WCL DISPLAY_VERx100 != 3002 condition. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 84fca860c93ee..27bd54c4b4e63 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -490,9 +490,9 @@ bool intel_dp_has_joiner(struct intel_dp *intel_dp)
if (intel_dp->mso_link_count)
return false;
- return DISPLAY_VER(display) >= 12 ||
+ return ((DISPLAY_VER(display) >= 12 && DISPLAY_VERx100(display) != 3002) ||
(DISPLAY_VER(display) == 11 &&
- encoder->port != PORT_A);
+ encoder->port != PORT_A));
}
static int dg2_max_source_rate(struct intel_dp *intel_dp)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 497/990] can: skb: make echo skb freeing safe in any IRQ context
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (495 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 496/990] drm/i915/display: Disable pipe joiner on WCL Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 498/990] mm/userfaultfd: wake all waiters on unregister Greg Kroah-Hartman
` (355 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cunhao Lu, stable, Marc Kleine-Budde,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cunhao Lu <1579567540@qq.com>
[ Upstream commit d743071964920c92af598c87a9e6f4369263ee09 ]
can_put_echo_skb() can be called with hardware interrupts disabled. Its
direct drop paths use kfree_skb(), while can_create_echo_skb() uses
kfree_skb() when cloning fails and consume_skb() after a successful clone.
None of these helpers is safe in every IRQ context.
Use dev_kfree_skb_any() for all drop paths and dev_consume_skb_any() when
consuming a successfully cloned skb. This preserves the respective skb drop
and consumed semantics regardless of the caller IRQ context.
Signed-off-by: Cunhao Lu <1579567540@qq.com>
Link: https://patch.msgid.link/tencent_E84809CF236D0137885E7E4E4D58340B3208@qq.com
Cc: stable@kernel.org
Fixes: ae64438be192 ("can: dev: fix skb drop check")
Fixes: 0ae89beb283a ("can: add destructor for self generated skbs")
Fixes: 3ccd4c6167d3 ("can: Unify droping of invalid tx skbs and netdev stats")
Fixes: 39549eef3587 ("can: CAN Network device driver and Netlink interface")
[mkl: also convert can_dropped_invalid_skb(), can_dev_dropped_skb()]
[mkl: add stable on Cc + add Fixes tags]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/can/dev/skb.c | 6 +++---
include/linux/can/dev.h | 2 +-
include/linux/can/skb.h | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c
index b643995fc5369..a39cfdce341ce 100644
--- a/drivers/net/can/dev/skb.c
+++ b/drivers/net/can/dev/skb.c
@@ -61,7 +61,7 @@ int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
(skb->protocol != htons(ETH_P_CAN) &&
skb->protocol != htons(ETH_P_CANFD) &&
skb->protocol != htons(ETH_P_CANXL))) {
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return 0;
}
@@ -87,7 +87,7 @@ int can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
} else {
/* locking problem with netif_stop_queue() ?? */
netdev_err(dev, "%s: BUG! echo_skb %d is occupied!\n", __func__, idx);
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return -EBUSY;
}
@@ -368,7 +368,7 @@ bool can_dropped_invalid_skb(struct net_device *dev, struct sk_buff *skb)
return false;
inval_skb:
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
dev->stats.tx_dropped++;
return true;
}
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index a2229a61ccde8..dbf9684c1a9da 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -103,7 +103,7 @@ static inline bool can_dev_dropped_skb(struct net_device *dev, struct sk_buff *s
if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) {
netdev_info_once(dev,
"interface in listen only mode, dropping skb\n");
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
dev->stats.tx_dropped++;
return true;
}
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index 27d0ca115c6c1..1f0c3e8cde907 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -92,12 +92,12 @@ static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
nskb = skb_clone(skb, GFP_ATOMIC);
if (unlikely(!nskb)) {
- kfree_skb(skb);
+ dev_kfree_skb_any(skb);
return NULL;
}
can_skb_set_owner(nskb, skb->sk);
- consume_skb(skb);
+ dev_consume_skb_any(skb);
return nskb;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 498/990] mm/userfaultfd: wake all waiters on unregister
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (496 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 497/990] can: skb: make echo skb freeing safe in any IRQ context Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 499/990] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations Greg Kroah-Hartman
` (354 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik,
Mike Rapoport (Microsoft), Lorenzo Stoakes (ARM),
Muhammad Usama Anjum, David Hildenbrand (Arm), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 3afb19d68cc5e7851fdb1069c8094af97bd80417 ]
UFFDIO_UNREGISTER only wakes pending faults if VM_UFFD_MISSING is set.
Threads waiting on write-protect, minor or RWP faults can therefore remain
asleep after unregistering a range that does not track missing faults.
Wake pending faults regardless of the registration mode so they can retry
without an explicit UFFDIO_WAKE or closing the userfaultfd. This matches
the existing behavior for missing faults, including removing unread fault
messages for the woken waiters.
Fix generated by an LLM and sent by Josef Bacik in private.
Fixes: 63b2d4174c4a ("userfaultfd: wp: add the writeprotect API to userfaultfd ioctl")
Cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[ david: rebase; simplify description ]
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Tested-by: Muhammad Usama Anjum <usama.anjum@arm.com>
Link: https://patch.msgid.link/20261031-fixes_core-v3-24-d6437171ecc3@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
[ sashal: Applied the change to the in-tree userfaultfd_unregister() in fs/userfaultfd.c, since the mm/ file move isn't present, with identical function body but a different location. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/userfaultfd.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 02ff11cf42bd8..1b33c92bae9e2 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1505,6 +1505,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
ret = 0;
for_each_vma_range(vmi, vma, end) {
+ struct userfaultfd_wake_range range;
+
cond_resched();
/* VMA not registered with userfaultfd. */
@@ -1522,18 +1524,14 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
/* Prevent new userfaults from being queued after the wakeup. */
vma_start_write(vma);
- if (userfaultfd_missing(vma)) {
- /*
- * Wake any concurrent pending userfault while
- * we unregister, so they will not hang
- * permanently and it avoids userland to call
- * UFFDIO_WAKE explicitly.
- */
- struct userfaultfd_wake_range range;
- range.start = start;
- range.len = vma_end - start;
- wake_userfault(vma->vm_userfaultfd_ctx.ctx, &range);
- }
+ /*
+ * Wake any concurrent pending userfault while we unregister,
+ * so they will not hang permanently and it avoids userland to
+ * call UFFDIO_WAKE explicitly.
+ */
+ range.start = start;
+ range.len = vma_end - start;
+ wake_userfault(ctx, &range);
vma = userfaultfd_clear_vma(&vmi, prev, vma,
start, vma_end);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 499/990] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (497 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 498/990] mm/userfaultfd: wake all waiters on unregister Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 500/990] nvme-tcp: Validate the queue state under the queue lock in the address attribute Greg Kroah-Hartman
` (353 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Salvatore Dipietro, Andrew Morton,
Vlastimil Babka (SUSE), Zi Yan, Johannes Weiner,
Christoph Hellwig, David Hildenbrand, Michal Hocko,
Matthew Wilcox, Dave Chinner, Ritesh Harjani, Dmitry Ilvokhin,
Hazem Mohamed Abuelfotoh, Ali Saidi, Geoff Blake,
Christian Brauner, dipietro.salvatore, Darrick J. Wong,
Brendan Jackman, rvvandan, Suren Baghdasaryan, Garg, Shivank,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salvatore Dipietro <dipiets@amazon.it>
[ Upstream commit 0e05a469c29400eb6e35448ce7318581688a1806 ]
Commit 5d8edfb900d5 ("iomap: Copy larger chunks from userspace")
introduced high-order folio allocations in the iomap buffered write path.
When memory is fragmented, each failed costly-order allocation enters
__alloc_pages_slowpath() which runs direct reclaim, direct compaction and
drain_all_pages(), causing a 0.38x throughput drop on PostgreSQL pgbench
(simple-update) with 1024 clients on a 96-vCPU arm64 system.
The root issue is that direct reclaim and direct compaction are too
expensive for hot allocation paths that have fallbacks to smaller
allocations. __filemap_get_folio_mpol() already marks higher-order
allocations with __GFP_NORETRY | __GFP_NOWARN, signalling that the caller
can handle failure. However, the page allocator still enters the full
blocking slowpath for costly orders with __GFP_NORETRY, which is
unnecessarily aggressive when the caller will simply retry at a lower
order.
For costly-order allocations with __GFP_NORETRY, clear
__GFP_DIRECT_RECLAIM at the very start of the slowpath, before
can_direct_reclaim, can_compact and the nofail checks are evaluated. This
makes the entire slowpath treat the request as non-blocking: no direct
reclaim, no direct compaction and no drain_all_pages() IPI across every
CPU. Reclaim and compaction move to the background instead: kswapd is
still woken for reclaim, and it wakes kcompactd for defragmentation. The
system keeps its long-term health while the latency-critical direct
allocation path no longer stalls.
Allocations that also request __GFP_THISNODE are exempted. That flag
pairing identifies the local-node-first THP attempt issued by
alloc_pages_mpol() (mempolicy.c), which relies on direct compaction to
form transparent huge pages.
Clearing __GFP_DIRECT_RECLAIM makes these allocations reach the
!can_direct_reclaim bailout, which since commit 4c0ed883e051
("mm/page_alloc: fix defrag_mode for non-reclaimable allocations") drops
ALLOC_NOFRAGMENT and retries instead of failing when defrag_mode is on.
With vm.defrag_mode=1 a __GFP_NORETRY allocation could therefore succeed
by fragmenting another migratetype's pageblock. That is the wrong trade
for a caller that has already communicated it can handle failure and has a
cheap lower-order fallback, so exclude __GFP_NORETRY from the relaxation.
The exclusion is not restricted to costly orders: any __GFP_NORETRY caller
has said it can cope with failure, so failing is preferable to fragmenting
for all of them.
Test environment:
Hardware: AWS EC2 m8g.24xlarge (96 vCPU, arm64)
12x 1TB IO2 32000 IOPS RAID0 XFS
OS: AL2023
Kernel: v7.3-rc1
Database: PostgreSQL 18.4
Workload: pgbench simple-update, 1024 clients, 96 threads, 1200s
Results (average of 3 runs, TPS):
Config Avg TPS % vs baseline
v7.3-rc1 baseline (vm.defrag_mode=0) 58,602 -
v7.3-rc1 + this patch (vm.defrag_mode=0) 157,246 +168.3%
v7.3-rc1 baseline (vm.defrag_mode=1) 109,012 -
v7.3-rc1 + this patch (vm.defrag_mode=1) 157,778 +44.7%
Link: https://lore.kernel.org/20261001082152.2879289-1-dipiets@amazon.it
Link: https://lore.kernel.org/all/20260403193535.9970-1-dipiets@amazon.it/T/#t [v1]
Link: https://lore.kernel.org/linux-mm/20260420161404.642-1-dipiets@amazon.it/T/#u [v2]
Link: https://lore.kernel.org/all/20260710143437.12379-1-dipiets@amazon.it/T/#u [v3]
Link: https://lore.kernel.org/all/20260904115629.3993331-1-dipiets@amazon.it/T/#u [v4]
Link: https://lore.kernel.org/all/20260911142102.2294202-1-dipiets@amazon.it/T/#u [v5]
Fixes: 5d8edfb900d5 ("iomap: Copy larger chunks from userspace")
Signed-off-by: Salvatore Dipietro <dipiets@amazon.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Acked-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Dave Chinner <dgc@kernel.org>
Cc: Ritesh Harjani <ritesh.list@gmail.com>
Cc: Dmitry Ilvokhin <d@ilvokhin.com>
Cc: Hazem Mohamed Abuelfotoh <abuehaze@amazon.com>
Cc: Ali Saidi <alisaidi@amazon.com>
Cc: Geoff Blake <blakgeof@amazon.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: <dipietro.salvatore@gmail.com>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: <rvvandan@amazon.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: "Garg, Shivank" <shivankg@amd.com>
introduced high-order folio allocations in the iomap buffered write path.
When memory is fragmented, each failed costly-order allocation enters
__alloc_pages_slowpath() which runs direct reclaim, direct compaction and
drain_all_pages(), causing a 0.38x throughput drop on PostgreSQL pgbench
(simple-update) with 1024 clients on a 96-vCPU arm64 system.
The root issue is that direct reclaim and direct compaction are too
expensive for hot allocation paths that have fallbacks to smaller
allocations. __filemap_get_folio_mpol() already marks higher-order
allocations with __GFP_NORETRY | __GFP_NOWARN, signalling that the caller
can handle failure. However, the page allocator still enters the full
blocking slowpath for costly orders with __GFP_NORETRY, which is
unnecessarily aggressive when the caller will simply retry at a lower
order.
For costly-order allocations with __GFP_NORETRY, clear
__GFP_DIRECT_RECLAIM at the very start of the slowpath, before
can_direct_reclaim, can_compact and the nofail checks are evaluated. This
makes the entire slowpath treat the request as non-blocking: no direct
reclaim, no direct compaction and no drain_all_pages() IPI across every
CPU. Reclaim and compaction move to the background instead: kswapd is
still woken for reclaim, and it wakes kcompactd for defragmentation. The
system keeps its long-term health while the latency-critical direct
allocation path no longer stalls.
Allocations that also request __GFP_THISNODE are exempted. That flag
pairing identifies the local-node-first THP attempt issued by
alloc_pages_mpol() (mempolicy.c), which relies on direct compaction to
form transparent huge pages.
Clearing __GFP_DIRECT_RECLAIM makes these allocations reach the
!can_direct_reclaim bailout, which since commit 4c0ed883e051
("mm/page_alloc: fix defrag_mode for non-reclaimable allocations") drops
ALLOC_NOFRAGMENT and retries instead of failing when defrag_mode is on.
With vm.defrag_mode=1 a __GFP_NORETRY allocation could therefore succeed
by fragmenting another migratetype's pageblock. That is the wrong trade
for a caller that has already communicated it can handle failure and has a
cheap lower-order fallback, so exclude __GFP_NORETRY from the relaxation.
[ sashal: Kept this tree's existing can_compact expression and dropped the defrag_mode __GFP_NORETRY hunk, since the code it modifies isn't present here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/page_alloc.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2578475dd5d3f..867796dad0107 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4738,10 +4738,10 @@ static inline struct page *
__alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
struct alloc_context *ac)
{
- bool can_direct_reclaim = gfp_mask & __GFP_DIRECT_RECLAIM;
- bool can_compact = gfp_compaction_allowed(gfp_mask);
- bool nofail = gfp_mask & __GFP_NOFAIL;
const bool costly_order = order > PAGE_ALLOC_COSTLY_ORDER;
+ bool can_direct_reclaim;
+ bool can_compact;
+ bool nofail;
struct page *page = NULL;
unsigned int alloc_flags;
unsigned long did_some_progress;
@@ -4753,6 +4753,18 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
unsigned int zonelist_iter_cookie;
int reserve_flags;
+ /*
+ * Costly __GFP_NORETRY callers have a cheap fallback, so don't stall
+ * them in reclaim or compaction. __GFP_THISNODE callers are exempt.
+ */
+ if (costly_order && (gfp_mask & __GFP_NORETRY) &&
+ !(gfp_mask & __GFP_THISNODE))
+ gfp_mask &= ~__GFP_DIRECT_RECLAIM;
+
+ can_direct_reclaim = gfp_mask & __GFP_DIRECT_RECLAIM;
+ can_compact = gfp_compaction_allowed(gfp_mask);
+ nofail = gfp_mask & __GFP_NOFAIL;
+
if (unlikely(nofail)) {
/*
* We most definitely don't want callers attempting to
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 500/990] nvme-tcp: Validate the queue state under the queue lock in the address attribute
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (498 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 499/990] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 501/990] nvme-tcp: fix use-after-free in nvme_tcp_free_ctrl() Greg Kroah-Hartman
` (352 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guixin Liu, Nilay Shroff,
Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <kanie@linux.alibaba.com>
[ Upstream commit 2eeeaa9c1ff0c429096acc2947c296db6a56f96d ]
Reading the "address" sysfs attribute calls kernel_getsockname() on the
admin queue socket, which can race with the queue teardown during
connection error recovery: a reader can observe NVME_TCP_Q_LIVE set,
then block on the queue lock while nvme_tcp_free_queue() releases the
socket and clears queue->sock without holding the lock. Once the
reader acquires the lock it dereferences the NULL socket pointer.
Commit 76d54bf20cdc ("nvme-tcp: don't access released socket during
error recovery") had the queue liveness check inside the lock.
Commit 782373ba2766 ("nvme: tcp: avoid race between queue_lock lock
and destroy") moved it back out because the lock itself is destroyed
in nvme_tcp_free_queue(), so a reader arriving late trips
mutex_destroy().
Check the queue liveness inside the queue lock, and clear queue->sock
under the same lock. The teardown clears NVME_TCP_Q_LIVE under the
lock well before the socket is released, so a reader either sees the
bit cleared or a socket that cannot be released while it holds the
lock. To also close the lock lifetime race, the queue locks are now
owned by the controller: they are initialized with the queue array and
only destroyed when the controller is freed, which cannot happen while
a sysfs attribute read is still in progress. The queue count is
computed by the NVME_TCP_OPT_NR_QUEUES() macro from the original
connect options for both initialization and destruction, as reconnects
may shrink ctrl->queue_count.
Fixes: 782373ba2766 ("nvme: tcp: avoid race between queue_lock lock and destroy")
Cc: stable@vger.kernel.org
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
[ sashal: Context adapted for older teardown code (fput, memalloc_noreclaim, list_empty) and per-queue pf_cache_lock init kept, while queue_lock init/destroy moves to the controller. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/tcp.c | 52 +++++++++++++++++++++++++++++------------
1 file changed, 37 insertions(+), 15 deletions(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 72afdd73939f8..d97ef58b834a3 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -154,6 +154,9 @@ enum nvme_tcp_queue_flags {
NVME_TCP_Q_IO_CPU_SET = 3,
};
+#define NVME_TCP_OPT_NR_QUEUES(opts) ((opts)->nr_io_queues + \
+ (opts)->nr_write_queues + (opts)->nr_poll_queues + 1)
+
enum nvme_tcp_recv_state {
NVME_TCP_RECV_PDU = 0,
NVME_TCP_RECV_DATA,
@@ -1547,14 +1550,22 @@ static void nvme_tcp_free_queue(struct nvme_ctrl *nctrl, int qid)
page_frag_cache_drain(&queue->pf_cache);
noreclaim_flag = memalloc_noreclaim_save();
+ /*
+ * Clear queue->sock under the queue lock so that a sysfs reader in
+ * nvme_tcp_get_address() either observes the NVME_TCP_Q_LIVE bit
+ * cleared or a still valid socket. The queue lock itself is owned
+ * by the controller and only destroyed when the controller is
+ * freed, so readers blocked on it cannot race its teardown.
+ */
+ mutex_lock(&queue->queue_lock);
/* ->sock will be released by fput() */
fput(queue->sock->file);
queue->sock = NULL;
+ mutex_unlock(&queue->queue_lock);
memalloc_noreclaim_restore(noreclaim_flag);
kfree(queue->pdu);
mutex_destroy(&queue->send_mutex);
- mutex_destroy(&queue->queue_lock);
mutex_destroy(&queue->pf_cache_lock);
}
@@ -1986,7 +1997,6 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid,
int ret, rcv_pdu_size;
struct file *sock_file;
- mutex_init(&queue->queue_lock);
queue->ctrl = ctrl;
init_llist_head(&queue->req_list);
INIT_LIST_HEAD(&queue->send_list);
@@ -2124,7 +2134,6 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid,
queue->sock = NULL;
err_destroy_mutex:
mutex_destroy(&queue->send_mutex);
- mutex_destroy(&queue->queue_lock);
mutex_destroy(&queue->pf_cache_lock);
return ret;
}
@@ -2772,6 +2781,9 @@ static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl)
static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl)
{
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
+ /* the same count used to size and initialize the queue array */
+ unsigned int nr_queues = NVME_TCP_OPT_NR_QUEUES(nctrl->opts);
+ unsigned int i;
if (list_empty(&ctrl->list))
goto free_ctrl;
@@ -2783,6 +2795,8 @@ static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl)
nvmf_free_options(nctrl->opts);
free_ctrl:
put_net(ctrl->net);
+ for (i = 0; i < nr_queues; i++)
+ mutex_destroy(&ctrl->queues[i].queue_lock);
kfree(ctrl->queues);
kfree(ctrl);
}
@@ -3035,17 +3049,18 @@ static int nvme_tcp_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
len = nvmf_get_address(ctrl, buf, size);
- if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags))
- return len;
-
mutex_lock(&queue->queue_lock);
- ret = kernel_getsockname(queue->sock, (struct sockaddr *)&src_addr);
- if (ret > 0) {
- if (len > 0)
- len--; /* strip trailing newline */
- len += scnprintf(buf + len, size - len, "%ssrc_addr=%pISc\n",
- (len) ? "," : "", &src_addr);
+ if (test_bit(NVME_TCP_Q_LIVE, &queue->flags)) {
+ ret = kernel_getsockname(queue->sock,
+ (struct sockaddr *)&src_addr);
+ if (ret > 0) {
+ if (len > 0)
+ len--; /* strip trailing newline */
+ len += scnprintf(buf + len, size - len,
+ "%ssrc_addr=%pISc\n",
+ (len) ? "," : "", &src_addr);
+ }
}
mutex_unlock(&queue->queue_lock);
@@ -3111,7 +3126,7 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
struct nvmf_ctrl_options *opts)
{
struct nvme_tcp_ctrl *ctrl;
- int ret;
+ int ret, i;
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
if (!ctrl)
@@ -3119,8 +3134,7 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
INIT_LIST_HEAD(&ctrl->list);
ctrl->ctrl.opts = opts;
- ctrl->ctrl.queue_count = opts->nr_io_queues + opts->nr_write_queues +
- opts->nr_poll_queues + 1;
+ ctrl->ctrl.queue_count = NVME_TCP_OPT_NR_QUEUES(opts);
ctrl->ctrl.sqsize = opts->queue_size - 1;
ctrl->ctrl.kato = opts->kato;
@@ -3179,6 +3193,14 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
goto out_free_ctrl;
}
+ /*
+ * The queue locks are owned by the controller, not the queues:
+ * they outlive the per-queue connect/disconnect cycles so that
+ * sysfs readers can never race their destruction.
+ */
+ for (i = 0; i < ctrl->ctrl.queue_count; i++)
+ mutex_init(&ctrl->queues[i].queue_lock);
+
ctrl->net = get_net(current->nsproxy->net_ns);
ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_tcp_ctrl_ops, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 501/990] nvme-tcp: fix use-after-free in nvme_tcp_free_ctrl()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (499 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 500/990] nvme-tcp: Validate the queue state under the queue lock in the address attribute Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 502/990] drm/panthor: Revisit reqs_lock handling in flush/reset paths Greg Kroah-Hartman
` (351 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nilay Shroff,
Christian Aurich Zanettini Martins, Keith Busch, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
[ Upstream commit b1d1f6b1ee03285690f12c2ebf23616416e6d881 ]
nvme_tcp_free_ctrl() reads ctrl->ctrl.opts to know how many queue
mutexes to destroy. When creating the controller fails,
nvmf_create_ctrl() frees opts as soon as nvme_tcp_create_ctrl()
returns, but a concurrent open of the character device can hold the
last reference to the controller. With CONFIG_DEBUG_KOBJECT_RELEASE,
which delays the release, every failed connect reads freed memory:
BUG: KASAN: slab-use-after-free in nvme_tcp_free_ctrl+0x38b/0x430
Read of size 4 at addr ffff888005b93740 by task kworker/2:1/51
Keep the size of the queue array in the controller and use it instead.
Fixes: 2eeeaa9c1ff0 ("nvme-tcp: Validate the queue state under the queue lock in the address attribute")
Cc: stable@vger.kernel.org
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
[ sashal: Replaced upstream's nvme_tcp_exit_queue(), nvme_tcp_init_queue() and kzalloc_objs() with this tree's mutex_destroy(), mutex_init() and kcalloc(), keeping the nr_allocated_queues loop bounds. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/tcp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index d97ef58b834a3..e25cc8e55cf40 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -224,6 +224,7 @@ struct nvme_tcp_ctrl {
struct delayed_work connect_work;
struct nvme_tcp_request async_req;
u32 io_queues[HCTX_MAX_TYPES];
+ unsigned int nr_allocated_queues;
struct net *net;
};
@@ -2781,8 +2782,6 @@ static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl)
static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl)
{
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
- /* the same count used to size and initialize the queue array */
- unsigned int nr_queues = NVME_TCP_OPT_NR_QUEUES(nctrl->opts);
unsigned int i;
if (list_empty(&ctrl->list))
@@ -2795,7 +2794,7 @@ static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl)
nvmf_free_options(nctrl->opts);
free_ctrl:
put_net(ctrl->net);
- for (i = 0; i < nr_queues; i++)
+ for (i = 0; i < ctrl->nr_allocated_queues; i++)
mutex_destroy(&ctrl->queues[i].queue_lock);
kfree(ctrl->queues);
kfree(ctrl);
@@ -3186,7 +3185,8 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
goto out_free_ctrl;
}
- ctrl->queues = kcalloc(ctrl->ctrl.queue_count, sizeof(*ctrl->queues),
+ ctrl->nr_allocated_queues = ctrl->ctrl.queue_count;
+ ctrl->queues = kcalloc(ctrl->nr_allocated_queues, sizeof(*ctrl->queues),
GFP_KERNEL);
if (!ctrl->queues) {
ret = -ENOMEM;
@@ -3198,7 +3198,7 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
* they outlive the per-queue connect/disconnect cycles so that
* sysfs readers can never race their destruction.
*/
- for (i = 0; i < ctrl->ctrl.queue_count; i++)
+ for (i = 0; i < ctrl->nr_allocated_queues; i++)
mutex_init(&ctrl->queues[i].queue_lock);
ctrl->net = get_net(current->nsproxy->net_ns);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 502/990] drm/panthor: Revisit reqs_lock handling in flush/reset paths
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (500 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 501/990] nvme-tcp: fix use-after-free in nvme_tcp_free_ctrl() Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 503/990] cxl/test: Map mock device nodes to an online node Greg Kroah-Hartman
` (350 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Boris Brezillon, Nicolas Frattaroli,
Liviu Dudau, Steven Price, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
[ Upstream commit 4fd08b3d1da78e33cb5939f0086e61f9d660cd6c ]
panthor_gpu_flush_caches() and panthor_gpu_soft_reset() acquire their
reqs_lock spinlock with the IRQ-disabling variants of the spinlocking
functions. This isn't necessary, as the lock is never taken from an
atomic context, as Panthor uses threaded interrupt handlers. The result
of this overly strict locking is that IRQs may be disabled more
frequently and for longer than they should be, resulting in increased
system latency.
Switch the locking to use non-IRQ-disabling scoped_guard statements for
locking. The wait_event_timeout read of pending_reqs outside of the
spinlock is fine as wait_event_timeout is a memory barrier according to
the Linux Memory Model.
Fixes: 5cd894e258c4 ("drm/panthor: Add the GPU logical block")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patch.msgid.link/20260812-panthor-cache-flush-fix-v4-2-751e32901898@collabora.com
[ sashal: Dropped the cache flush tracepoint calls, which this tree lacks. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/panthor/panthor_gpu.c | 61 ++++++++++++---------------
1 file changed, 28 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_gpu.c b/drivers/gpu/drm/panthor/panthor_gpu.c
index 7f2dc65386fd4..6be62672a3be8 100644
--- a/drivers/gpu/drm/panthor/panthor_gpu.c
+++ b/drivers/gpu/drm/panthor/panthor_gpu.c
@@ -259,34 +259,30 @@ int panthor_gpu_l2_power_on(struct panthor_device *ptdev)
int panthor_gpu_flush_caches(struct panthor_device *ptdev,
u32 l2, u32 lsc, u32 other)
{
- unsigned long flags;
int ret = 0;
/* Serialize cache flush operations. */
guard(mutex)(&ptdev->gpu->cache_flush_lock);
- spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags);
- if (!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED)) {
- ptdev->gpu->pending_reqs |= GPU_IRQ_CLEAN_CACHES_COMPLETED;
- gpu_write(ptdev, GPU_CMD, GPU_FLUSH_CACHES(l2, lsc, other));
- } else {
- ret = -EIO;
+ scoped_guard(spinlock, &ptdev->gpu->reqs_lock) {
+ if (!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED)) {
+ ptdev->gpu->pending_reqs |= GPU_IRQ_CLEAN_CACHES_COMPLETED;
+ gpu_write(ptdev, GPU_CMD, GPU_FLUSH_CACHES(l2, lsc, other));
+ } else {
+ return -EIO;
+ }
}
- spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags);
-
- if (ret)
- return ret;
if (!wait_event_timeout(ptdev->gpu->reqs_acked,
!(ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED),
msecs_to_jiffies(100))) {
- spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags);
- if ((ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED) != 0 &&
- !(gpu_read(ptdev, GPU_INT_RAWSTAT) & GPU_IRQ_CLEAN_CACHES_COMPLETED))
- ret = -ETIMEDOUT;
- else
- ptdev->gpu->pending_reqs &= ~GPU_IRQ_CLEAN_CACHES_COMPLETED;
- spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags);
+ scoped_guard(spinlock, &ptdev->gpu->reqs_lock) {
+ if ((ptdev->gpu->pending_reqs & GPU_IRQ_CLEAN_CACHES_COMPLETED) != 0 &&
+ !(gpu_read(ptdev, GPU_INT_RAWSTAT) & GPU_IRQ_CLEAN_CACHES_COMPLETED))
+ ret = -ETIMEDOUT;
+ else
+ ptdev->gpu->pending_reqs &= ~GPU_IRQ_CLEAN_CACHES_COMPLETED;
+ }
}
if (ret) {
@@ -306,27 +302,26 @@ int panthor_gpu_flush_caches(struct panthor_device *ptdev,
int panthor_gpu_soft_reset(struct panthor_device *ptdev)
{
bool timedout = false;
- unsigned long flags;
- spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags);
- if (!drm_WARN_ON(&ptdev->base,
- ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED)) {
- ptdev->gpu->pending_reqs |= GPU_IRQ_RESET_COMPLETED;
- gpu_write(ptdev, GPU_INT_CLEAR, GPU_IRQ_RESET_COMPLETED);
- gpu_write(ptdev, GPU_CMD, GPU_SOFT_RESET);
+ scoped_guard(spinlock, &ptdev->gpu->reqs_lock) {
+ if (!drm_WARN_ON(&ptdev->base,
+ ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED)) {
+ ptdev->gpu->pending_reqs |= GPU_IRQ_RESET_COMPLETED;
+ gpu_write(ptdev, GPU_INT_CLEAR, GPU_IRQ_RESET_COMPLETED);
+ gpu_write(ptdev, GPU_CMD, GPU_SOFT_RESET);
+ }
}
- spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags);
if (!wait_event_timeout(ptdev->gpu->reqs_acked,
!(ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED),
msecs_to_jiffies(100))) {
- spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags);
- if ((ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED) != 0 &&
- !(gpu_read(ptdev, GPU_INT_RAWSTAT) & GPU_IRQ_RESET_COMPLETED))
- timedout = true;
- else
- ptdev->gpu->pending_reqs &= ~GPU_IRQ_RESET_COMPLETED;
- spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags);
+ scoped_guard(spinlock, &ptdev->gpu->reqs_lock) {
+ if ((ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED) != 0 &&
+ !(gpu_read(ptdev, GPU_INT_RAWSTAT) & GPU_IRQ_RESET_COMPLETED))
+ timedout = true;
+ else
+ ptdev->gpu->pending_reqs &= ~GPU_IRQ_RESET_COMPLETED;
+ }
}
if (timedout) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 503/990] cxl/test: Map mock device nodes to an online node
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (501 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 502/990] drm/panthor: Revisit reqs_lock handling in flush/reset paths Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 504/990] accel/amdxdna: Fix unexpected wait when flushing notifier_wq Greg Kroah-Hartman
` (349 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Davidlohr Bueso, Dave Jiang,
Alison Schofield, Shaikh Kamaluddin, Gregory Price (Meta),
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <dave@stgolabs.net>
[ Upstream commit 6f057dea152574dd044382fd0ba5ed19e3ecba25 ]
cxl_type3_mem_init() and cxl_type2_mem_init() assign alternating NUMA
nodes to the mock memdevs to model multi-node topologies. On a
single-node host node 1 has no pgdat, and the first node-aware
allocation in an odd device's probe faults on a NULL zonelist:
Oops: general protection fault, probably for non-canonical address 0xdffffc00000006e3
KASAN: probably user-memory-access in range [0x0000000000003718-0x000000000000371f]
Workqueue: async async_run_entry_fn
RIP: __alloc_frozen_pages_noprof+0x288
new_slab
___slab_alloc
__kmalloc_node_track_caller_noprof
devm_kmalloc
cxl_mock_mem_probe
Map the requested node to an online one, as dax_hmem already does
for its target node.
Fixes: cf1f6877b088 ("cxl/memdev: Add numa_node attribute")
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20260831175119.3247915-1-dave@stgolabs.net
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Dropped the upstream hunk in the type-2 init function, which doesn't exist here, and applied the numa_map_to_online_node() wrapper to the three set_dev_node calls in cxl_mem_init(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/cxl/test/cxl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
index aadb90ec516e5..9663f183aa2c0 100644
--- a/tools/testing/cxl/test/cxl.c
+++ b/tools/testing/cxl/test/cxl.c
@@ -1369,7 +1369,7 @@ static int cxl_mem_init(void)
if (!pdev)
goto err_mem;
pdev->dev.parent = &dport->dev;
- set_dev_node(&pdev->dev, i % 2);
+ set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
rc = cxl_mock_platform_device_add(pdev, &cxl_mem[i]);
if (rc)
@@ -1384,7 +1384,7 @@ static int cxl_mem_init(void)
if (!pdev)
goto err_single;
pdev->dev.parent = &dport->dev;
- set_dev_node(&pdev->dev, i % 2);
+ set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
rc = cxl_mock_platform_device_add(pdev, &cxl_mem_single[i]);
if (rc)
@@ -1400,7 +1400,7 @@ static int cxl_mem_init(void)
if (!pdev)
goto err_rcd;
pdev->dev.parent = &rch->dev;
- set_dev_node(&pdev->dev, i % 2);
+ set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
rc = cxl_mock_platform_device_add(pdev, &cxl_rcd[i]);
if (rc)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 504/990] accel/amdxdna: Fix unexpected wait when flushing notifier_wq
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (502 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 503/990] cxl/test: Map mock device nodes to an online node Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 505/990] fuse: dont bump attr_version for async direct read completion Greg Kroah-Hartman
` (348 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Max Zhen, Lizhi Hou, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <lizhi.hou@amd.com>
[ Upstream commit 445d20910429b41e88768624b914344658991a5b ]
In amdxdna_gem_obj_free(), flush_workqueue(xdna->notifier_wq) waits for
all pending work items on the device-global notifier workqueue, rather
than only the work items associated with the BO being freed.
If another BO has a pending hmm_unreg_work, freeing an unrelated BO can
be unnecessarily blocked until that work completes.
mmu_interval_notifier_remove() is deferred to a workqueue because it
cannot be called from the MMU notifier callback itself. The BO free path
is not a notifier callback, so call mmu_interval_notifier_remove()
directly there and avoid the workqueue.
Fixes: e486147c912f ("accel/amdxdna: Add BO import and export")
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260813205016.941743-1-lizhi.hou@amd.com
[ sashal: Replaced abo->mem.uva with abo->mem.userptr in the unreg work handler, and adjusted surrounding context in the BO free path to match this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/accel/amdxdna/amdxdna_gem.c | 69 +++++++++++++++++++----------
drivers/accel/amdxdna/amdxdna_gem.h | 1 +
2 files changed, 47 insertions(+), 23 deletions(-)
diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
index 412b48f49fa20..69c9034fae78a 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.c
+++ b/drivers/accel/amdxdna/amdxdna_gem.c
@@ -106,13 +106,16 @@ static bool amdxdna_hmm_invalidate(struct mmu_interval_notifier *mni,
struct amdxdna_gem_obj *abo = mapp->abo;
struct amdxdna_dev *xdna;
+ if (!mmu_notifier_range_blockable(range))
+ return false;
+
+ if (mapp->unmapped)
+ return true;
+
xdna = to_xdna_dev(to_gobj(abo)->dev);
XDNA_DBG(xdna, "Invalidating range 0x%lx, 0x%lx, type %d",
mapp->range.start, mapp->range.end, abo->type);
- if (!mmu_notifier_range_blockable(range))
- return false;
-
down_write(&xdna->notifier_lock);
abo->mem.map_invalid = true;
mapp->invalid = true;
@@ -153,33 +156,40 @@ static void amdxdna_hmm_unregister(struct amdxdna_gem_obj *abo,
down_write(&xdna->notifier_lock);
list_for_each_entry(mapp, &abo->mem.umap_list, node) {
- if (!vma || compare_range(mapp, vma->vm_mm, vma->vm_start, vma->vm_end)) {
- if (!mapp->unmapped) {
- queue_work(xdna->notifier_wq, &mapp->hmm_unreg_work);
- mapp->unmapped = true;
- }
- if (vma)
- break;
- }
+ if (!compare_range(mapp, vma->vm_mm, vma->vm_start, vma->vm_end))
+ continue;
+
+ queue_work(xdna->notifier_wq, &mapp->hmm_unreg_work);
+ mapp->unmapped = true;
}
up_write(&xdna->notifier_lock);
}
-static void amdxdna_umap_release(struct kref *ref)
+static void amdxdna_hmm_unregister_all(struct amdxdna_gem_obj *abo)
{
- struct amdxdna_umap *mapp = container_of(ref, struct amdxdna_umap, refcnt);
- struct amdxdna_gem_obj *abo = mapp->abo;
- struct amdxdna_dev *xdna;
-
- mmu_interval_notifier_remove(&mapp->notifier);
+ struct amdxdna_dev *xdna = to_xdna_dev(to_gobj(abo)->dev);
+ struct amdxdna_umap *mapp, *tmp;
+ LIST_HEAD(dead);
- xdna = to_xdna_dev(to_gobj(mapp->abo)->dev);
down_write(&xdna->notifier_lock);
- list_del(&mapp->node);
- if (list_empty(&abo->mem.umap_list))
- abo->mem.userptr = AMDXDNA_INVALID_ADDR;
+ list_for_each_entry_safe(mapp, tmp, &abo->mem.umap_list, node) {
+ mapp->unmapped = true;
+ mapp->cleanup = true;
+ list_move(&mapp->node, &dead);
+ }
up_write(&xdna->notifier_lock);
+ list_for_each_entry_safe(mapp, tmp, &dead, node) {
+ cancel_work_sync(&mapp->hmm_unreg_work);
+ amdxdna_umap_put(mapp);
+ }
+}
+
+static void amdxdna_umap_release(struct kref *ref)
+{
+ struct amdxdna_umap *mapp = container_of(ref, struct amdxdna_umap, refcnt);
+
+ mmu_interval_notifier_remove(&mapp->notifier);
kvfree(mapp->range.hmm_pfns);
kfree(mapp);
}
@@ -193,6 +203,20 @@ static void amdxdna_hmm_unreg_work(struct work_struct *work)
{
struct amdxdna_umap *mapp = container_of(work, struct amdxdna_umap,
hmm_unreg_work);
+ struct amdxdna_gem_obj *abo = mapp->abo;
+ struct amdxdna_dev *xdna;
+
+ xdna = to_xdna_dev(to_gobj(mapp->abo)->dev);
+ down_write(&xdna->notifier_lock);
+ if (mapp->cleanup) {
+ up_write(&xdna->notifier_lock);
+ return;
+ }
+
+ list_del(&mapp->node);
+ if (list_empty(&abo->mem.umap_list))
+ abo->mem.userptr = AMDXDNA_INVALID_ADDR;
+ up_write(&xdna->notifier_lock);
amdxdna_umap_put(mapp);
}
@@ -482,8 +506,7 @@ static void amdxdna_gem_obj_free(struct drm_gem_object *gobj)
XDNA_DBG(xdna, "BO type %d xdna_addr 0x%llx", abo->type, abo->mem.dev_addr);
- amdxdna_hmm_unregister(abo, NULL);
- flush_workqueue(xdna->notifier_wq);
+ amdxdna_hmm_unregister_all(abo);
if (abo->pinned)
amdxdna_gem_unpin(abo);
diff --git a/drivers/accel/amdxdna/amdxdna_gem.h b/drivers/accel/amdxdna/amdxdna_gem.h
index b3c814c0bb7e6..8d89874f1fca3 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.h
+++ b/drivers/accel/amdxdna/amdxdna_gem.h
@@ -17,6 +17,7 @@ struct amdxdna_umap {
struct kref refcnt;
bool invalid;
bool unmapped;
+ bool cleanup;
};
struct amdxdna_mem {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 505/990] fuse: dont bump attr_version for async direct read completion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (503 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 504/990] accel/amdxdna: Fix unexpected wait when flushing notifier_wq Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 506/990] ACPI: APEI: GHES: Validate memory error section length before payload access Greg Kroah-Hartman
` (347 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Horst Birthelmer, Jingbo Xu,
Miklos Szeredi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jingbo Xu <jefflexu@linux.alibaba.com>
[ Upstream commit fc60668db85584da911e5d0a65c8698628f98bba ]
The attr_version counter should only be incremented when cached
attributes are actually modified (as documented in commit 1fb69e781729
("fuse: fix race between getattr and write")). Async direct reads do not
modify any cached inode attributes (size, mtime, ctime), so bumping
attr_version in fuse_aio_complete() for reads is incorrect.
This unconditional bump causes a livelock when auto_inval_data is
enabled together with writeback_cache: fuse_cache_read_iter() issues a
FUSE_GETATTR before every read, but by the time the response arrives,
an async DIO read completion has already incremented fi->attr_version
past the snapshot taken before the request. The GETATTR result is then
discarded (attr_version race), fi->i_time is never refreshed, and every
subsequent read triggers yet another GETATTR -- creating an infinite
loop of useless round-trips.
Fix this by only bumping attr_version for write completions, consistent
with the synchronous DIO write path (fuse_write_update_attr) and the
cached write path.
Fixes: 01e9d11a3e79 ("fuse: add support of async IO")
Reviewed-by: Horst Birthelmer <hbirthelmer@ddn.com>
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[ sashal: Adjusted context: this tree declares inode inside the if block and has no mapping variable, so only the io->write condition was changed. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fuse/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index dc61efd829cc2..238de178611b6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -668,7 +668,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
if (!left && !io->blocking) {
ssize_t res = fuse_get_res_by_io(io);
- if (res >= 0) {
+ if (res >= 0 && io->write) {
struct inode *inode = file_inode(io->iocb->ki_filp);
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 506/990] ACPI: APEI: GHES: Validate memory error section length before payload access
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (504 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 505/990] fuse: dont bump attr_version for async direct read completion Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 507/990] perf thread: Fix live-session detection in thread__e_machine() Greg Kroah-Hartman
` (346 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, sashiko-bot, Hanjun Guo, Shuai Xue,
Dave Jiang, Rafael J. Wysocki, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <dave.jiang@intel.com>
[ Upstream commit 10338c9085b4939a428a8dc78d2bbf62c161278b ]
ghes_do_proc() hands the CPER_SEC_PLATFORM_MEM payload to the report chain,
arch_apei_report_mem_error() and ghes_handle_memory_failure() without
checking gdata->error_data_length. All three read validation_bits and
physical_addr, at offsets 0 and 16, so a shorter section reads past the
record.
Check the length once in ghes_do_proc(), before any consumer runs. Take the
73-byte struct cper_sec_mem_err_old as the floor: older firmware
legitimately emits that UEFI 2.1/2.2 layout, and it makes validation_bits
safe to read.
The fields from "extended" on are absent from that layout, so also require
whatever length the validation bits claim. Derive it per field rather than
demanding the full 80 bytes: rank needs only 76, and the BANK_GROUP and
BANK_ADDRESS bits describe "bank" at offset 38, which every record carries.
Testing the whole mask against one size, as cper_print_mem() does, gets it
wrong both ways.
Reported-by: sashiko-bot@kernel.org
Closes: https://sashiko.dev/#/patchset/20260714231835.303081-1-dave.jiang@intel.com?part=7
Fixes: ca104edc1784 ("ACPI, APEI, GHES: Cleanup ghes memory error handling")
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260904172337.1409775-12-dave.jiang@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Hunk context adjusted: the new length-check helper is placed after the CXL kfifo getter's export because the function it normally follows is absent here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/apei/ghes.c | 41 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index b81d5ed50d439..c10b440c6cab2 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -899,6 +899,28 @@ int cxl_cper_kfifo_get(struct cxl_cper_work_data *wd)
}
EXPORT_SYMBOL_NS_GPL(cxl_cper_kfifo_get, "CXL");
+/*
+ * The fields from "extended" on are absent from the 73-byte UEFI 2.1/2.2
+ * layout that older firmware still emits. Return the length needed for the
+ * fields the validation bits claim, so over-claiming is rejected without
+ * rejecting an honest short record.
+ */
+static u32 ghes_mem_err_min_len(u64 validation_bits)
+{
+ u32 len = sizeof(struct cper_sec_mem_err_old);
+
+ if (validation_bits & (CPER_MEM_VALID_ROW_EXT | CPER_MEM_VALID_CHIP_ID))
+ len = offsetof(struct cper_sec_mem_err, rank);
+ if (validation_bits & CPER_MEM_VALID_RANK_NUMBER)
+ len = offsetof(struct cper_sec_mem_err, mem_array_handle);
+ if (validation_bits & CPER_MEM_VALID_CARD_HANDLE)
+ len = offsetof(struct cper_sec_mem_err, mem_dev_handle);
+ if (validation_bits & CPER_MEM_VALID_MODULE_HANDLE)
+ len = sizeof(struct cper_sec_mem_err);
+
+ return len;
+}
+
static void ghes_do_proc(struct ghes *ghes,
const struct acpi_hest_generic_status *estatus)
{
@@ -923,6 +945,25 @@ static void ghes_do_proc(struct ghes *ghes,
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
+ /*
+ * Check once for all three consumers below. The 73-byte
+ * UEFI 2.1/2.2 layout is the floor, matching
+ * cper_estatus_print_section() and making
+ * validation_bits safe to read.
+ */
+ if (gdata->error_data_length <
+ sizeof(struct cper_sec_mem_err_old))
+ continue;
+
+ /* Then require what the claimed fields actually need. */
+ if (gdata->error_data_length <
+ ghes_mem_err_min_len(mem_err->validation_bits)) {
+ pr_warn_ratelimited(FW_WARN GHES_PFX
+ "memory error section too small (%u) for the fields it claims\n",
+ gdata->error_data_length);
+ continue;
+ }
+
atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);
arch_apei_report_mem_error(sev, mem_err);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 507/990] perf thread: Fix live-session detection in thread__e_machine()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (505 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 506/990] ACPI: APEI: GHES: Validate memory error section length before payload access Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 508/990] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Greg Kroah-Hartman
` (345 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Matt Turner,
Namhyung Kim, Arnaldo Carvalho de Melo, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Turner <mattst88@gmail.com>
[ Upstream commit 15917a3a1ce0695f824892c8f9d0dc51408ee580 ]
When the per-thread e_machine cannot be determined from the DSOs in the
thread's maps, thread__e_machine_endian() decides between reading
/proc/<pid>/exe and falling back to the recorded session environment:
bool is_live = machine->machines == NULL;
if (!is_live) {
/* Check if the session has a data file. */
struct perf_session *session = container_of(...);
is_live = !!session->data;
}
Neither half of that works.
The back pointer added by commit a088031c4998 ("perf tools: Add machine to
machines back pointer") is set by machines__add(), which only ever adds
guests; the host machine never gets one. Host-machine threads, which is to
say almost all of them, therefore see machine->machines == NULL and are
declared live before the session is consulted at all.
The session test is also inverted. A session with a perf_data attached is
one being read from a perf.data file, i.e. exactly the case that is not
live, while a live session such as 'perf top' passes data=NULL to
__perf_session__new().
So a file-based session takes the live path and reads /proc/<pid>/exe on
the analysing host, which at best describes an unrelated process that has
since been given the recorded pid, and normally just fails, leaving
e_machine as EM_NONE. The perf_env fallback that would have supplied the
recorded architecture is never reached, and thread__e_machine() returns
EM_HOST.
For a same-architecture recording this is invisible, since EM_HOST is the
right answer anyway. Cross-architecture it is not: annotating an Alpha
perf.data on an x86_64 host selects the x86 struct arch, so the Alpha
disassembly is matched against the x86 instruction table. Alpha's 'ret'
collides with x86's and gets ret_ops, while its calls and branches match
nothing and are left unparsed, so no call target is resolved and no jump
arrows are drawn.
Set the back pointer for the host machine and correct the session test.
The new back pointer does not disturb the other reader of the field,
machine__findnew_guest_code(), which machine__resolve() only calls when
!machine__is_host(machine).
Fixes: 70351029b55677eb ("perf thread: Add support for reading the e_machine type for a thread")
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Context-only adaptation: machines__init() returns void here and the function is thread__e_machine() rather than thread__e_machine_endian(), so the two changed lines are placed in that older code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/machine.c | 1 +
tools/perf/util/thread.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 8452d776d994a..091022e9c867f 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -232,6 +232,7 @@ void machine__delete(struct machine *machine)
void machines__init(struct machines *machines)
{
machine__init(&machines->host, "", HOST_KERNEL_ID);
+ machines->host.machines = machines;
machines->guests = RB_ROOT_CACHED;
}
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 9409d32dce04c..bda001ccf571d 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -518,7 +518,7 @@ uint16_t thread__e_machine(struct thread *thread, struct machine *machine)
struct perf_session,
machines);
- is_live = !!session->data;
+ is_live = !session->data;
}
/* Read from /proc/pid/exe if live. */
if (is_live)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 508/990] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (506 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 507/990] perf thread: Fix live-session detection in thread__e_machine() Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 509/990] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v " Greg Kroah-Hartman
` (344 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Golla Nagendra, Frank Li, Vinod Koul,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Golla Nagendra <nagendra.golla@amd.com>
[ Upstream commit f2f44b952ea6e0c600e92ea21fcaa83cafeedf6e ]
If sw_desc_pool allocation fails after pm_runtime_resume_and_get()
succeeds in zynqmp_dma_alloc_chan_resources(), the error path returns
without dropping the runtime PM reference.
Route that failure path through err_pm so the runtime PM reference is
balanced before returning the error.
Fixes: 8982d48af36d ("dmaengine: zynqmp_dma: Fix PM reference leak in zynqmp_dma_alloc_chan_resourc()")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260814045616.1661199-2-nagendra.golla@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[ sashal: Kept the older kcalloc() allocation line in the context instead of upstream's kzalloc_objs(), since that helper doesn't exist here; the fix is otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/xilinx/zynqmp_dma.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 1f6bb492be6af..7cc5079511188 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -484,8 +484,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
chan->sw_desc_pool = kcalloc(ZYNQMP_DMA_NUM_DESCS, sizeof(*desc),
GFP_KERNEL);
- if (!chan->sw_desc_pool)
- return -ENOMEM;
+ if (!chan->sw_desc_pool) {
+ ret = -ENOMEM;
+ goto err_pm;
+ }
chan->idle = true;
chan->desc_free_cnt = ZYNQMP_DMA_NUM_DESCS;
@@ -517,6 +519,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
}
return ZYNQMP_DMA_NUM_DESCS;
+
+err_pm:
+ pm_runtime_put_autosuspend(chan->dev);
+ return ret;
}
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 509/990] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v alloc failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (507 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 508/990] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 510/990] wifi: ath12k: fix truncated TX buffer DMA address in MSDU ext descriptor Greg Kroah-Hartman
` (343 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Golla Nagendra, Frank Li, Vinod Koul,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Golla Nagendra <nagendra.golla@amd.com>
[ Upstream commit 4ea99b14b3bd955d768666941e2e03ba186b52f5 ]
In zynqmp_dma_alloc_chan_resources(), sw_desc_pool is allocated before
desc_pool_v. If dma_alloc_coherent() for desc_pool_v fails, the function
currently exits through the runtime PM rollback path but leaves the
already allocated sw_desc_pool behind.
Add a dedicated err_free_sw_desc_pool label for the desc_pool_v failure
path, free sw_desc_pool there, then fall through to err_pm for
pm_runtime_put_autosuspend().
This keeps the error unwind symmetric and avoids leaking the software
descriptor pool on coherent descriptor allocation failure.
Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
Signed-off-by: Golla Nagendra <nagendra.golla@amd.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260814045616.1661199-3-nagendra.golla@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/xilinx/zynqmp_dma.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 7cc5079511188..17bd0cce6833a 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -505,8 +505,10 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
(2 * ZYNQMP_DMA_DESC_SIZE(chan) *
ZYNQMP_DMA_NUM_DESCS),
&chan->desc_pool_p, GFP_KERNEL);
- if (!chan->desc_pool_v)
- return -ENOMEM;
+ if (!chan->desc_pool_v) {
+ ret = -ENOMEM;
+ goto err_free_sw_desc_pool;
+ }
for (i = 0; i < ZYNQMP_DMA_NUM_DESCS; i++) {
desc = chan->sw_desc_pool + i;
@@ -520,6 +522,9 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
return ZYNQMP_DMA_NUM_DESCS;
+err_free_sw_desc_pool:
+ kfree(chan->sw_desc_pool);
+ chan->sw_desc_pool = NULL;
err_pm:
pm_runtime_put_autosuspend(chan->dev);
return ret;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 510/990] wifi: ath12k: fix truncated TX buffer DMA address in MSDU ext descriptor
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (508 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 509/990] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v " Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 511/990] wifi: ath12k: preserve PPDU state across monitor status buffers Greg Kroah-Hartman
` (342 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Baochen Qiang, Rameshkumar Sundaram,
Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
[ Upstream commit 979ecb88ed3528e08dd7f87b90b029374226ca84 ]
ath12k_wifi7_hal_tx_cmd_ext_desc_setup() programs the low 32 bits of the
TX buffer physical address into HAL_TX_MSDU_EXT_INFO0_BUF_PTR_LO but
hardcodes the high bits field HAL_TX_MSDU_EXT_INFO1_BUF_PTR_HI to 0x0.
dma_addr_t is 64-bit on platforms with CONFIG_ARCH_DMA_ADDR_T_64BIT, so
whenever a TX buffer is mapped above the 4 GB boundary the upper bits of
paddr are dropped and the firmware is handed a truncated address,
leading to potential TX failures.
Write the upper bits of paddr into BUF_PTR_HI to fix this issue.
Issue found during code review, compile tested only.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20260818-ath12k-truncated-tx-dma-addr-v1-1-ead978969371@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Replaced the wifi7 function name and path with the older ath12k_hal_tx_cmd_ext_desc_setup() in dp_tx.c, since the wifi7 split is absent here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_tx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c
index abc84ca8467a2..92bb9fc420264 100644
--- a/drivers/net/wireless/ath/ath12k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_tx.c
@@ -115,7 +115,7 @@ static void ath12k_hal_tx_cmd_ext_desc_setup(struct ath12k_base *ab,
{
tcl_ext_cmd->info0 = le32_encode_bits(ti->paddr,
HAL_TX_MSDU_EXT_INFO0_BUF_PTR_LO);
- tcl_ext_cmd->info1 = le32_encode_bits(0x0,
+ tcl_ext_cmd->info1 = le32_encode_bits((u64)ti->paddr >> HAL_ADDR_MSB_REG_SHIFT,
HAL_TX_MSDU_EXT_INFO1_BUF_PTR_HI) |
le32_encode_bits(ti->data_len,
HAL_TX_MSDU_EXT_INFO1_BUF_LEN);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 511/990] wifi: ath12k: preserve PPDU state across monitor status buffers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (509 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 510/990] wifi: ath12k: fix truncated TX buffer DMA address in MSDU ext descriptor Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 512/990] sit: charge ip_tunnel_prl_entry allocations to memcg Greg Kroah-Hartman
` (341 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Yang, Baochen Qiang,
Tamizh Chelvam Raja, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit 69b2d06dafa4a61b718704d655dd370ba660052a ]
A monitor PPDU may span multiple status buffers. However,
__ath12k_wifi7_dp_mon_process_ring() clears mon_ppdu_info before
processing every buffer.
As a result, continuation buffers lose PPDU state collected from
earlier buffers, including ppdu_id and PHY metadata.
This can cause monitor RX processing to fail when
ath12k_wifi7_dp_rx_mon_dest_process() observes a PPDU ID mismatch
between status and destination rings, preventing MSDUs from being
delivered. It can also produce incomplete EHT metadata that triggers
warnings from mac80211:
Rate marked as an EHT rate but data is invalid: MCS:0, NSS:0
ath12k_wifi7_dp_mon_srng_process() already tracks status TLV
continuations via ppdu_continuation. Apply the same logic here and
only reinitialize mon_ppdu_info when starting a new PPDU.
mon_ppdu_info persists across ar->monitor_started transitions. If
monitor mode stops while a PPDU is mid-continuation, ppdu_continuation
stays set and could leak into the next monitor session. Reset it
when monitor mode starts.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 78d3d907d0f1 ("wifi: ath12k: add support to reap and process monitor status ring")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Tamizh Chelvam Raja <tamizh.raja@oss.qualcomm.com>
Link: https://patch.msgid.link/20260828065534.1537-1-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Adapted to the older ath12k layout: edited dp_mon.c instead of wifi7/dp_mon.c and dropped the wifi7_ prefix from helper names, with the dp_mon_parse_rx_dest call taking ar instead of &ar->dp. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_mon.c | 23 ++++++++++++++---------
drivers/net/wireless/ath/ath12k/mac.c | 7 +++++++
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 4aaaccca9412d..3752fa0eed30b 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -4390,18 +4390,23 @@ __ath12k_dp_mon_process_ring(struct ath12k *ar, int mac_id,
goto exit;
while ((skb = __skb_dequeue(&skb_list))) {
- memset(ppdu_info, 0, sizeof(*ppdu_info));
- ppdu_info->peer_id = HAL_INVALID_PEERID;
+ if (!ppdu_info->ppdu_continuation)
+ ath12k_dp_mon_rx_memset_ppdu_info(ppdu_info);
hal_status = ath12k_dp_mon_parse_rx_dest(ar, pmon, skb);
- if (ar->monitor_started &&
- pmon->mon_ppdu_status == DP_PPDU_STATUS_START &&
- hal_status == HAL_TLV_STATUS_PPDU_DONE) {
- rx_mon_stats->status_ppdu_done++;
- pmon->mon_ppdu_status = DP_PPDU_STATUS_DONE;
- ath12k_dp_rx_mon_dest_process(ar, mac_id, *budget, napi);
- pmon->mon_ppdu_status = DP_PPDU_STATUS_START;
+ if (hal_status == HAL_TLV_STATUS_PPDU_DONE) {
+ ppdu_info->ppdu_continuation = false;
+ if (ar->monitor_started &&
+ pmon->mon_ppdu_status == DP_PPDU_STATUS_START) {
+ rx_mon_stats->status_ppdu_done++;
+ pmon->mon_ppdu_status = DP_PPDU_STATUS_DONE;
+ ath12k_dp_rx_mon_dest_process(ar, mac_id,
+ *budget, napi);
+ pmon->mon_ppdu_status = DP_PPDU_STATUS_START;
+ }
+ } else {
+ ppdu_info->ppdu_continuation = true;
}
dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index c3f761cc35558..b9c943b219546 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1387,6 +1387,13 @@ static int ath12k_mac_monitor_start(struct ath12k *ar)
return ret;
}
+ /*
+ * A previous monitor session may have stopped mid-PPDU, leaving
+ * ppdu_continuation set. Clear it so the first status buffer of
+ * this session is not merged with stale state from before.
+ */
+ ar->dp.mon_data.mon_ppdu_info.ppdu_continuation = false;
+
ar->monitor_started = true;
ar->num_started_vdevs++;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 512/990] sit: charge ip_tunnel_prl_entry allocations to memcg
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (510 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 511/990] wifi: ath12k: preserve PPDU state across monitor status buffers Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 513/990] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data Greg Kroah-Hartman
` (340 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Lorenzo Bianconi,
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 40a2b90f5190fcc7b083809fa93f2799abefeeb1 ]
ipip6_tunnel_add_prl() allocates struct ip_tunnel_prl_entry for each
potential router entry added via SIOCADDPRL.
An unprivileged user with CAP_NET_ADMIN in a user namespace can add
an unbounded number of entries, consuming uncharged kernel memory.
Commit 1b51d8271973 ("memcg: ipv6/sit: account and don't WARN on
ip_tunnel_prl structs allocation") added accounting to the temporary
buffer in ipip6_tunnel_get_prl(), but missed the entry allocations
in ipip6_tunnel_add_prl().
Use GFP_KERNEL_ACCOUNT when allocating struct ip_tunnel_prl_entry.
Fixes: 1b51d8271973 ("memcg: ipv6/sit: account and don't WARN on ip_tunnel_prl structs allocation")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260907075846.2913645-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Replaced kzalloc_obj(struct ip_tunnel_prl_entry, GFP_KERNEL_ACCOUNT) with kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL_ACCOUNT) because this tree's sit.c lacks the kzalloc_obj conversion. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/sit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 590b54e9b947d..d7d166cd54f88 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -394,7 +394,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
goto out;
}
- p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL);
+ p = kzalloc(sizeof(struct ip_tunnel_prl_entry), GFP_KERNEL_ACCOUNT);
if (!p) {
err = -ENOBUFS;
goto out;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 513/990] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (511 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 512/990] sit: charge ip_tunnel_prl_entry allocations to memcg Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 514/990] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage Greg Kroah-Hartman
` (339 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Antoine Tenart, Thomas Huth,
Herbert Xu, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Huth <thuth@redhat.com>
[ Upstream commit 5c87bcb2f98dbfe08efa016af037b0f9701ba381 ]
key_tmp[] in safexcel_xcbcmac_setkey() and consts[] / _const[] in
safexcel_cmac_setkey() contain crypto key material that should not
get exposed to the outside once the function is done. Scrub the
arrays with memzero_explicit() to avoid that the data could leak
via the stack.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260813134953.979481-1-thuth%40redhat.com
Fixes: 38f21b4bab11f ("crypto: inside-secure - Added support for the AES XCBC ahash")
Fixes: 7a627db9cafdb ("crypto: inside-secure - Added support for the AES-CMAC ahash")
Acked-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Context line uses aes_expandkey() instead of upstream's aes_prepareenckey(), since the AES library rename isn't in this tree; the added memzero_explicit() calls are identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/inside-secure/safexcel_hash.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index ef0ba48329281..7231e9773bde8 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -1993,6 +1993,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key,
ret = aes_expandkey(ctx->aes,
(u8 *)key_tmp + 2 * AES_BLOCK_SIZE,
AES_MIN_KEY_SIZE);
+ memzero_explicit(key_tmp, sizeof(key_tmp));
if (ret)
return ret;
@@ -2104,6 +2105,8 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,
}
ctx->cbcmac = false;
+ memzero_explicit(consts, sizeof(consts));
+ memzero_explicit(_const, sizeof(_const));
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 514/990] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (512 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 513/990] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 515/990] accel/amdxdna: Fix unsafe use of handle_mm_fault() Greg Kroah-Hartman
` (338 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, 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 fcfb2b562115632e0a60a0928dca495f98eb335c ]
Rearange the code in acpi_bind_one() to avoid situations in which the
existing ACPI companion of the given device would be replaced with NULL
due to a memory allocation error or because somebody tries to bind a
physical device with an ACPI companion to a different ACPI device
erroneously.
Fixes: 7b1998116bbb ("ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Merged two conditionals to avoid redundant check ]
Link: https://patch.msgid.link/3465482.44csPzL39Z@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: Rewrote the one kzalloc_obj(*physical_node) call in acpi_bind_one() as kzalloc(sizeof(*physical_node), GFP_KERNEL) to match the context in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/glue.c | 58 +++++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 34 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index e2a40847d24b6..f915a7c0e7cca 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -243,31 +243,25 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id)
int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
{
struct acpi_device_physical_node *physical_node, *pn;
+ struct acpi_device *comp_dev = ACPI_COMPANION(dev);
char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
struct list_head *physnode_list;
unsigned int node_id;
int retval = -EINVAL;
- if (has_acpi_companion(dev)) {
- if (acpi_dev) {
- dev_warn(dev, "ACPI companion already set\n");
+ if (!acpi_dev) {
+ if (!comp_dev)
return -EINVAL;
- } else {
- acpi_dev = ACPI_COMPANION(dev);
- }
- }
- if (!acpi_dev)
- return -EINVAL;
- acpi_dev_get(acpi_dev);
- get_device(dev);
- physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
- if (!physical_node) {
- retval = -ENOMEM;
- goto err;
+ /* If the companion has been set upfront, pick it up. */
+ acpi_dev = comp_dev;
+ } else if (comp_dev && acpi_dev != comp_dev) {
+ dev_warn(dev, "ACPI companion already set to %s which is not %s\n",
+ acpi_dev_name(comp_dev), acpi_dev_name(acpi_dev));
+ return -EEXIST;
}
- mutex_lock(&acpi_dev->physical_node_lock);
+ guard(mutex)(&acpi_dev->physical_node_lock);
/*
* Keep the list sorted by node_id so that the IDs of removed nodes can
@@ -278,15 +272,12 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
list_for_each_entry(pn, &acpi_dev->physical_node_list, node) {
/* Sanity check. */
if (pn->dev == dev) {
- mutex_unlock(&acpi_dev->physical_node_lock);
-
- dev_warn(dev, "Already associated with ACPI node\n");
- kfree(physical_node);
- if (ACPI_COMPANION(dev) != acpi_dev)
- goto err;
-
- put_device(dev);
- acpi_dev_put(acpi_dev);
+ if (!comp_dev) {
+ /* Really unexpected. */
+ ACPI_COMPANION_SET(dev, acpi_dev);
+ dev_warn(&acpi_dev->dev,
+ "Physical device list corruption fixed up\n");
+ }
return 0;
}
if (pn->node_id == node_id) {
@@ -295,12 +286,19 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
}
}
+ physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
+ if (!physical_node)
+ return -ENOMEM;
+
+ acpi_dev_get(acpi_dev);
+ get_device(dev);
+
physical_node->node_id = node_id;
physical_node->dev = dev;
list_add(&physical_node->node, physnode_list);
acpi_dev->physical_node_count++;
- if (!has_acpi_companion(dev))
+ if (!comp_dev)
ACPI_COMPANION_SET(dev, acpi_dev);
acpi_physnode_link_name(physical_node_name, node_id);
@@ -316,18 +314,10 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
dev_err(dev, "Failed to create link firmware_node (%d)\n",
retval);
- mutex_unlock(&acpi_dev->physical_node_lock);
-
if (acpi_dev->wakeup.flags.valid)
device_set_wakeup_capable(dev, true);
return 0;
-
- err:
- ACPI_COMPANION_SET(dev, NULL);
- put_device(dev);
- acpi_dev_put(acpi_dev);
- return retval;
}
EXPORT_SYMBOL_GPL(acpi_bind_one);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 515/990] accel/amdxdna: Fix unsafe use of handle_mm_fault()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (513 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 514/990] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 516/990] phy: samsung: usbdrd: propagate GS101 PIPE3 lock failures Greg Kroah-Hartman
` (337 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Max Zhen, Lizhi Hou, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <lizhi.hou@amd.com>
[ Upstream commit df4d5352063ac48e1d3566f64ec94baa8b5af94f ]
handle_mm_fault() must not be called from the mmap callback because
the VMA has not yet been linked. The handle_mm_fault() API contract
assumes that the VMA is already linked.
Remove the handle_mm_fault() call from the mmap callback. For imported
BOs, mark the mapping as invalid and rely on the first command submission
to fault in the pages.
For shmem BOs, set the VM_MIXEDMAP flag and use vm_insert_pages().
Implement amdxdna_gem_mixed_vm_ops to handle the page faults.
Fixes: e486147c912f ("accel/amdxdna: Add BO import and export")
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260910211338.1102315-1-lizhi.hou@amd.com
[ sashal: Replaced linear_page_delta(vma, vmf->address) with its open-coded equivalent (vmf->address - vma->vm_start) >> PAGE_SHIFT, since that helper doesn't exist here, and adjusted surrounding context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/accel/amdxdna/amdxdna_gem.c | 151 ++++++++++++++++++++++------
1 file changed, 118 insertions(+), 33 deletions(-)
diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
index 69c9034fae78a..e416a6ef7304e 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.c
+++ b/drivers/accel/amdxdna/amdxdna_gem.c
@@ -13,6 +13,7 @@
#include <linux/dma-direct.h>
#include <linux/iosys-map.h>
#include <linux/pagemap.h>
+#include <linux/swap.h>
#include <linux/vmalloc.h>
#include "amdxdna_ctx.h"
@@ -333,16 +334,16 @@ static int amdxdna_insert_pages(struct amdxdna_gem_obj *abo,
{
struct amdxdna_dev *xdna = to_xdna_dev(to_gobj(abo)->dev);
unsigned long num_pages = vma_pages(vma);
- unsigned long offset = 0;
int ret;
- if (!is_import_bo(abo)) {
- ret = drm_gem_shmem_mmap(&abo->base, vma);
- if (ret) {
- XDNA_ERR(xdna, "Failed shmem mmap %d", ret);
- return ret;
- }
- } else {
+ /*
+ * Until today there is not any use case to mmap with non-zero
+ * offset. Put an explicit check here.
+ */
+ if (vma->vm_pgoff - drm_vma_node_start(&to_gobj(abo)->vma_node))
+ return -EINVAL;
+
+ if (is_import_bo(abo)) {
vma->vm_private_data = NULL;
vma->vm_ops = NULL;
ret = dma_buf_mmap(abo->dma_buf, vma, 0);
@@ -351,23 +352,28 @@ static int amdxdna_insert_pages(struct amdxdna_gem_obj *abo,
return ret;
}
+ amdxdna_mark_mapp_invalid(abo, vma);
+
/* Drop the reference drm_gem_mmap_obj() acquired.*/
drm_gem_object_put(to_gobj(abo));
+ return 0;
}
- do {
- vm_fault_t fault_ret;
-
- fault_ret = handle_mm_fault(vma, vma->vm_start + offset,
- FAULT_FLAG_WRITE, NULL);
- if (fault_ret & VM_FAULT_ERROR) {
- XDNA_ERR(xdna, "Fault in page failed");
- amdxdna_mark_mapp_invalid(abo, vma);
- break;
- }
+ ret = drm_gem_shmem_mmap(&abo->base, vma);
+ if (ret) {
+ XDNA_ERR(xdna, "Failed shmem mmap %d", ret);
+ return ret;
+ }
- offset += PAGE_SIZE;
- } while (--num_pages);
+ vm_flags_mod(vma, VM_MIXEDMAP, VM_PFNMAP);
+ ret = vm_insert_pages(vma, vma->vm_start, abo->base.pages, &num_pages);
+ if (ret) {
+ XDNA_ERR(xdna, "Failed to insert pages %d", ret);
+ dma_resv_lock(to_gobj(abo)->resv, NULL);
+ drm_gem_shmem_put_pages_locked(&abo->base);
+ dma_resv_unlock(to_gobj(abo)->resv);
+ return ret;
+ }
return 0;
}
@@ -379,6 +385,10 @@ static int amdxdna_gem_obj_mmap(struct drm_gem_object *gobj,
struct amdxdna_gem_obj *abo = to_xdna_obj(gobj);
int ret;
+ XDNA_DBG(xdna, "BO map_offset 0x%llx type %d userptr 0x%lx size 0x%lx",
+ drm_vma_node_offset_addr(&gobj->vma_node), abo->type,
+ vma->vm_start, gobj->size);
+
ret = amdxdna_hmm_register(abo, vma);
if (ret)
return ret;
@@ -389,9 +399,6 @@ static int amdxdna_gem_obj_mmap(struct drm_gem_object *gobj,
goto hmm_unreg;
}
- XDNA_DBG(xdna, "BO map_offset 0x%llx type %d userptr 0x%lx size 0x%lx",
- drm_vma_node_offset_addr(&gobj->vma_node), abo->type,
- vma->vm_start, gobj->size);
return 0;
hmm_unreg:
@@ -399,14 +406,99 @@ static int amdxdna_gem_obj_mmap(struct drm_gem_object *gobj,
return ret;
}
+/*
+ * VM operations for amdxdna shmem VMAs that use VM_MIXEDMAP.
+ *
+ * drm_gem_shmem_vm_ops cannot be used on VM_MIXEDMAP VMAs because its fault
+ * handler calls vmf_insert_pfn() → vmf_insert_pfn_prot() which contains:
+ * BUG_ON((vma->vm_flags & VM_MIXEDMAP) && pfn_valid(pfn))
+ * All amdxdna shmem pages are ordinary struct pages so pfn_valid() is always
+ * true, making the combination fatal.
+ *
+ * These ops use vmf_insert_page() (struct-page based) instead, which is the
+ * correct API for VM_MIXEDMAP VMAs backed by real struct pages. The open and
+ * close handlers replicate drm_gem_shmem_vm_open/close using only exported
+ * symbols.
+ */
+static vm_fault_t amdxdna_gem_mixedmap_fault(struct vm_fault *vmf)
+{
+ struct vm_area_struct *vma = vmf->vma;
+ struct drm_gem_object *gobj = vma->vm_private_data;
+ struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(gobj);
+ loff_t num_pages = gobj->size >> PAGE_SHIFT;
+ vm_fault_t ret = VM_FAULT_SIGBUS;
+ pgoff_t page_offset;
+ struct page *page;
+
+ /*
+ * Partial free of vma is unexpected. Otherwise, the wrong page
+ * will be faulted in and the user application may crash itself.
+ */
+ page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
+
+ dma_resv_lock(gobj->resv, NULL);
+
+ if (!shmem->pages || shmem->madv < 0 || page_offset >= num_pages)
+ goto out;
+
+ page = shmem->pages[page_offset];
+ if (WARN_ON_ONCE(!page))
+ goto out;
+
+ /*
+ * Use vmf_insert_page() (struct-page path) not vmf_insert_pfn()
+ * (PFN path) because this VMA carries VM_MIXEDMAP.
+ */
+ ret = vmf_insert_page(vma, vmf->address, page);
+ if (ret == VM_FAULT_NOPAGE)
+ folio_mark_accessed(page_folio(page));
+
+out:
+ dma_resv_unlock(gobj->resv);
+ return ret;
+}
+
+static void amdxdna_gem_mixedmap_vm_open(struct vm_area_struct *vma)
+{
+ struct drm_gem_object *gobj = vma->vm_private_data;
+ struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(gobj);
+
+ /*
+ * Bump pages_use_count so the page array stays alive for the new
+ * mapping copy created by fork(). Mirrors drm_gem_shmem_vm_open().
+ */
+ dma_resv_lock(gobj->resv, NULL);
+ drm_WARN_ON_ONCE(gobj->dev, !refcount_inc_not_zero(&shmem->pages_use_count));
+ dma_resv_unlock(gobj->resv);
+
+ drm_gem_vm_open(vma);
+}
+
+static void amdxdna_gem_mixedmap_vm_close(struct vm_area_struct *vma)
+{
+ struct drm_gem_object *gobj = vma->vm_private_data;
+ struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(gobj);
+
+ dma_resv_lock(gobj->resv, NULL);
+ drm_gem_shmem_put_pages_locked(shmem);
+ dma_resv_unlock(gobj->resv);
+
+ drm_gem_vm_close(vma);
+}
+
+static const struct vm_operations_struct amdxdna_gem_mixedmap_vm_ops = {
+ .fault = amdxdna_gem_mixedmap_fault,
+ .open = amdxdna_gem_mixedmap_vm_open,
+ .close = amdxdna_gem_mixedmap_vm_close,
+};
+
static int amdxdna_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
{
struct drm_gem_object *gobj = dma_buf->priv;
struct amdxdna_gem_obj *abo = to_xdna_obj(gobj);
- unsigned long num_pages = vma_pages(vma);
int ret;
- vma->vm_ops = &drm_gem_shmem_vm_ops;
+ vma->vm_ops = &amdxdna_gem_mixedmap_vm_ops;
vma->vm_private_data = gobj;
drm_gem_object_get(gobj);
@@ -416,16 +508,9 @@ static int amdxdna_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struc
/* The buffer is based on memory pages. Fix the flag. */
vm_flags_mod(vma, VM_MIXEDMAP, VM_PFNMAP);
- ret = vm_insert_pages(vma, vma->vm_start, abo->base.pages,
- &num_pages);
- if (ret)
- goto close_vma;
return 0;
-close_vma:
- vma->vm_ops->close(vma);
- return ret;
put_obj:
drm_gem_object_put(gobj);
return ret;
@@ -538,7 +623,7 @@ static const struct drm_gem_object_funcs amdxdna_gem_shmem_funcs = {
.vmap = drm_gem_shmem_object_vmap,
.vunmap = drm_gem_shmem_object_vunmap,
.mmap = amdxdna_gem_obj_mmap,
- .vm_ops = &drm_gem_shmem_vm_ops,
+ .vm_ops = &amdxdna_gem_mixedmap_vm_ops,
.export = amdxdna_gem_prime_export,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 516/990] phy: samsung: usbdrd: propagate GS101 PIPE3 lock failures
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (514 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 515/990] accel/amdxdna: Fix unsafe use of handle_mm_fault() Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 517/990] accel/amdxdna: Fix race between unmap and free BO Greg Kroah-Hartman
` (336 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Manivannan Sadhasivam,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <pengpeng@iscas.ac.cn>
[ Upstream commit 2ef1e78ef7223eb16d9cf20814a1b2873456f671 ]
The GS101 PIPE3 initialization checks the PMA PLL lock and then checks
the CDR lock. The PLL helper returns an error, but the GS101 PIPE3 init
path dropped that result. The CDR helper only logged a timeout. PHY
initialization could therefore still return success after either the PLL
or the selected receive lane had not locked.
Make the in-file SoC-specific phy_init hook return an int so helpers
with real failure results can propagate them through the existing PHY
init paths. Keep the register-only helpers returning success and use the
new return path to report the GS101 CDR wait failure. Other SoC helper
paths keep their previous success behavior.
Fixes: 32267c29bc7d ("phy: exynos5-usbdrd: support Exynos USBDRD 3.1 combo phy (HS & SS)")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260623135349.42739-1-pengpeng@iscas.ac.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[ sashal: Dropped the exynosautov920 hunks because that driver support doesn't exist in this tree; the remaining hunks apply unchanged apart from context and offsets. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/phy/samsung/phy-exynos5-usbdrd.c | 66 +++++++++++++++++-------
1 file changed, 47 insertions(+), 19 deletions(-)
diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index 93ac302de1eb0..966a894d91b76 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -418,7 +418,7 @@ struct exynos5_usbdrd_phy;
struct exynos5_usbdrd_phy_config {
u32 id;
void (*phy_isol)(struct phy_usb_instance *inst, bool isolate);
- void (*phy_init)(struct exynos5_usbdrd_phy *phy_drd);
+ int (*phy_init)(struct exynos5_usbdrd_phy *phy_drd);
unsigned int (*set_refclk)(struct phy_usb_instance *inst);
};
@@ -655,7 +655,7 @@ exynos5_usbdrd_apply_phy_tunes(struct exynos5_usbdrd_phy *phy_drd,
}
}
-static void exynos5_usbdrd_pipe3_init(struct exynos5_usbdrd_phy *phy_drd)
+static int exynos5_usbdrd_pipe3_init(struct exynos5_usbdrd_phy *phy_drd)
{
u32 reg;
@@ -668,6 +668,8 @@ static void exynos5_usbdrd_pipe3_init(struct exynos5_usbdrd_phy *phy_drd)
reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST);
reg &= ~PHYTEST_POWERDOWN_SSP;
writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST);
+
+ return 0;
}
static void
@@ -778,7 +780,7 @@ exynos5_usbdrd_usbdp_g2_v4_pma_check_pll_lock(struct exynos5_usbdrd_phy *phy_drd
return err;
}
-static void
+static int
exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(struct exynos5_usbdrd_phy *phy_drd)
{
static const unsigned int timeout_us = 40000;
@@ -804,9 +806,11 @@ exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(struct exynos5_usbdrd_phy *phy_drd
((phy_drd->orientation == TYPEC_ORIENTATION_NORMAL)
? 0
: 2), reg);
+
+ return err;
}
-static void exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
+static int exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
{
u32 reg;
@@ -828,6 +832,8 @@ static void exynos5_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
reg = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST);
reg &= ~PHYTEST_POWERDOWN_HSP;
writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYTEST);
+
+ return 0;
}
static int exynos5_usbdrd_phy_init(struct phy *phy)
@@ -864,7 +870,9 @@ static int exynos5_usbdrd_phy_init(struct phy *phy)
writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYUTMICLKSEL);
/* UTMI or PIPE3 specific init */
- inst->phy_cfg->phy_init(phy_drd);
+ ret = inst->phy_cfg->phy_init(phy_drd);
+ if (ret)
+ goto disable_clks;
/* reference clock settings */
reg = inst->phy_cfg->set_refclk(inst);
@@ -887,9 +895,10 @@ static int exynos5_usbdrd_phy_init(struct phy *phy)
reg &= ~PHYCLKRST_PORTRESET;
writel(reg, phy_drd->reg_phy + EXYNOS5_DRD_PHYCLKRST);
+disable_clks:
clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks);
- return 0;
+ return ret;
}
static int exynos5_usbdrd_phy_exit(struct phy *phy)
@@ -1150,7 +1159,7 @@ static void exynos7870_usbdrd_phy_isol(struct phy_usb_instance *inst,
EXYNOS7870_USB2PHY_ENABLE, val);
}
-static void exynos7870_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
+static int exynos7870_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
{
u32 reg;
@@ -1238,6 +1247,8 @@ static void exynos7870_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
if (phy_drd->drv_data->phy_tunes)
exynos5_usbdrd_apply_phy_tunes(phy_drd,
PTS_UTMI_POSTINIT);
+
+ return 0;
}
static int exynos7870_usbdrd_phy_init(struct phy *phy)
@@ -1251,11 +1262,11 @@ static int exynos7870_usbdrd_phy_init(struct phy *phy)
return ret;
/* UTMI or PIPE3 specific init */
- inst->phy_cfg->phy_init(phy_drd);
+ ret = inst->phy_cfg->phy_init(phy_drd);
clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks);
- return 0;
+ return ret;
}
static int exynos7870_usbdrd_phy_exit(struct phy *phy)
@@ -1302,10 +1313,12 @@ static const struct phy_ops exynos7870_usbdrd_phy_ops = {
.owner = THIS_MODULE,
};
-static void exynos2200_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
+static int exynos2200_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
{
/* Configure non-Samsung IP PHY, responsible for UTMI */
phy_init(phy_drd->hs_phy);
+
+ return 0;
}
static void exynos2200_usbdrd_link_init(struct exynos5_usbdrd_phy *phy_drd)
@@ -1405,11 +1418,11 @@ static int exynos2200_usbdrd_phy_init(struct phy *phy)
exynos2200_usbdrd_link_attach_detach_pipe3_phy(inst);
/* UTMI or PIPE3 specific init */
- inst->phy_cfg->phy_init(phy_drd);
+ ret = inst->phy_cfg->phy_init(phy_drd);
clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks);
- return 0;
+ return ret;
}
static int exynos2200_usbdrd_phy_exit(struct phy *phy)
@@ -1463,7 +1476,7 @@ exynos5_usbdrd_usb_v3p1_pipe_override(struct exynos5_usbdrd_phy *phy_drd)
writel(reg, regs_base + EXYNOS850_DRD_SECPMACTL);
}
-static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
+static int exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
{
void __iomem *regs_base = phy_drd->reg_phy;
u32 reg;
@@ -1569,6 +1582,8 @@ static void exynos850_usbdrd_utmi_init(struct exynos5_usbdrd_phy *phy_drd)
if (ss_ports)
exynos5_usbdrd_usb_v3p1_pipe_override(phy_drd);
+
+ return 0;
}
static int exynos850_usbdrd_phy_init(struct phy *phy)
@@ -1582,12 +1597,13 @@ static int exynos850_usbdrd_phy_init(struct phy *phy)
return ret;
/* UTMI or PIPE3 specific init */
+ ret = 0;
scoped_guard(mutex, &phy_drd->phy_mutex)
- inst->phy_cfg->phy_init(phy_drd);
+ ret = inst->phy_cfg->phy_init(phy_drd);
clk_bulk_disable_unprepare(phy_drd->drv_data->n_clks, phy_drd->clks);
- return 0;
+ return ret;
}
static int exynos850_usbdrd_phy_exit(struct phy *phy)
@@ -1636,11 +1652,12 @@ static const struct phy_ops exynos850_usbdrd_phy_ops = {
.owner = THIS_MODULE,
};
-static void exynos5_usbdrd_gs101_pipe3_init(struct exynos5_usbdrd_phy *phy_drd)
+static int exynos5_usbdrd_gs101_pipe3_init(struct exynos5_usbdrd_phy *phy_drd)
{
void __iomem *regs_pma = phy_drd->reg_pma;
void __iomem *regs_phy = phy_drd->reg_phy;
u32 reg;
+ int ret;
exynos5_usbdrd_usbdp_g2_v4_ctrl_pma_ready(phy_drd);
@@ -1662,8 +1679,11 @@ static void exynos5_usbdrd_gs101_pipe3_init(struct exynos5_usbdrd_phy *phy_drd)
SECPMACTL_PMA_INIT_SW_RST);
writel(reg, regs_phy + EXYNOS850_DRD_SECPMACTL);
- if (!exynos5_usbdrd_usbdp_g2_v4_pma_check_pll_lock(phy_drd))
- exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(phy_drd);
+ ret = exynos5_usbdrd_usbdp_g2_v4_pma_check_pll_lock(phy_drd);
+ if (ret)
+ return ret;
+
+ return exynos5_usbdrd_usbdp_g2_v4_pma_check_cdr_lock(phy_drd);
}
static int exynos5_usbdrd_gs101_phy_init(struct phy *phy)
@@ -1688,7 +1708,15 @@ static int exynos5_usbdrd_gs101_phy_init(struct phy *phy)
*/
exynos5_usbdrd_phy_isol(inst, false);
- return exynos850_usbdrd_phy_init(phy);
+ ret = exynos850_usbdrd_phy_init(phy);
+ if (ret) {
+ exynos5_usbdrd_phy_isol(inst, true);
+ if (inst->phy_cfg->id == EXYNOS5_DRDPHY_UTMI)
+ regulator_bulk_disable(phy_drd->drv_data->n_regulators,
+ phy_drd->regulators);
+ }
+
+ return ret;
}
static int exynos5_usbdrd_gs101_phy_exit(struct phy *phy)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 517/990] accel/amdxdna: Fix race between unmap and free BO
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (515 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 516/990] phy: samsung: usbdrd: propagate GS101 PIPE3 lock failures Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 518/990] cxl/cdat: Fix uninitialized stack use in bandwidth gathering Greg Kroah-Hartman
` (335 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Max Zhen, Lizhi Hou, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <lizhi.hou@amd.com>
[ Upstream commit ac18f34f5927e420ae529be72aec86201a262d04 ]
A userspace process can concurrently trigger an unmap, which queues
hmm_unreg_work, and free BO. If amdxdna_hmm_unreg_work() executes
list_del(&mapp->node) and is preempted before calling amdxdna_umap_put(),
amdxdna_hmm_unregister_all() can fail to find the mapping in the list
and return without calling cancel_work_sync(). This allows object
destruction to proceed while the worker still holds a pointer to the BO
in the umap structure.
Moving the work item from struct amdxdna_umap to struct amdxdna_gem_obj.
The worker no longer holds a pointer to an individual mapping, so there
is no longer a window where the umap has been unlinked from umap_list but
work is still pending against it. The work item now lives in the BO
itself, so use a single cancel_work_sync() in the free path to drain the
work.
Fixes: 445d20910429 ("accel/amdxdna: Fix unexpected wait when flushing notifier_wq")
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260917154824.1872220-1-lizhi.hou@amd.com
[ sashal: Adapted the hmm_unreg_work move to the older gem code: the uva field is named userptr, and amdxdna_gem_create_obj() was not relocated since it already follows the worker. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/accel/amdxdna/amdxdna_gem.c | 47 +++++++++++------------------
drivers/accel/amdxdna/amdxdna_gem.h | 3 +-
2 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
index e416a6ef7304e..cc22981d73598 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.c
+++ b/drivers/accel/amdxdna/amdxdna_gem.c
@@ -127,10 +127,8 @@ static bool amdxdna_hmm_invalidate(struct mmu_interval_notifier *mni,
if (range->event == MMU_NOTIFY_UNMAP) {
down_write(&xdna->notifier_lock);
- if (!mapp->unmapped) {
- queue_work(xdna->notifier_wq, &mapp->hmm_unreg_work);
- mapp->unmapped = true;
- }
+ mapp->unmapped = true;
+ queue_work(xdna->notifier_wq, &abo->hmm_unreg_work);
up_write(&xdna->notifier_lock);
}
@@ -160,13 +158,13 @@ static void amdxdna_hmm_unregister(struct amdxdna_gem_obj *abo,
if (!compare_range(mapp, vma->vm_mm, vma->vm_start, vma->vm_end))
continue;
- queue_work(xdna->notifier_wq, &mapp->hmm_unreg_work);
mapp->unmapped = true;
+ queue_work(xdna->notifier_wq, &abo->hmm_unreg_work);
}
up_write(&xdna->notifier_lock);
}
-static void amdxdna_hmm_unregister_all(struct amdxdna_gem_obj *abo)
+static void amdxdna_hmm_unreg_umaps(struct amdxdna_gem_obj *abo, bool force)
{
struct amdxdna_dev *xdna = to_xdna_dev(to_gobj(abo)->dev);
struct amdxdna_umap *mapp, *tmp;
@@ -174,16 +172,18 @@ static void amdxdna_hmm_unregister_all(struct amdxdna_gem_obj *abo)
down_write(&xdna->notifier_lock);
list_for_each_entry_safe(mapp, tmp, &abo->mem.umap_list, node) {
+ if (!force && !mapp->unmapped)
+ continue;
+
mapp->unmapped = true;
- mapp->cleanup = true;
list_move(&mapp->node, &dead);
}
+ if (list_empty(&abo->mem.umap_list))
+ abo->mem.userptr = AMDXDNA_INVALID_ADDR;
up_write(&xdna->notifier_lock);
- list_for_each_entry_safe(mapp, tmp, &dead, node) {
- cancel_work_sync(&mapp->hmm_unreg_work);
+ list_for_each_entry_safe(mapp, tmp, &dead, node)
amdxdna_umap_put(mapp);
- }
}
static void amdxdna_umap_release(struct kref *ref)
@@ -202,24 +202,10 @@ void amdxdna_umap_put(struct amdxdna_umap *mapp)
static void amdxdna_hmm_unreg_work(struct work_struct *work)
{
- struct amdxdna_umap *mapp = container_of(work, struct amdxdna_umap,
- hmm_unreg_work);
- struct amdxdna_gem_obj *abo = mapp->abo;
- struct amdxdna_dev *xdna;
+ struct amdxdna_gem_obj *abo = container_of(work, struct amdxdna_gem_obj,
+ hmm_unreg_work);
- xdna = to_xdna_dev(to_gobj(mapp->abo)->dev);
- down_write(&xdna->notifier_lock);
- if (mapp->cleanup) {
- up_write(&xdna->notifier_lock);
- return;
- }
-
- list_del(&mapp->node);
- if (list_empty(&abo->mem.umap_list))
- abo->mem.userptr = AMDXDNA_INVALID_ADDR;
- up_write(&xdna->notifier_lock);
-
- amdxdna_umap_put(mapp);
+ amdxdna_hmm_unreg_umaps(abo, false);
}
static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,
@@ -271,8 +257,6 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,
mapp->abo = abo;
kref_init(&mapp->refcnt);
- INIT_WORK(&mapp->hmm_unreg_work, amdxdna_hmm_unreg_work);
-
ret = mmu_interval_notifier_insert_locked(&mapp->notifier,
current->mm,
addr,
@@ -591,7 +575,9 @@ static void amdxdna_gem_obj_free(struct drm_gem_object *gobj)
XDNA_DBG(xdna, "BO type %d xdna_addr 0x%llx", abo->type, abo->mem.dev_addr);
- amdxdna_hmm_unregister_all(abo);
+ /* No notifier survives this, so no new work can be queued. */
+ amdxdna_hmm_unreg_umaps(abo, true);
+ cancel_work_sync(&abo->hmm_unreg_work);
if (abo->pinned)
amdxdna_gem_unpin(abo);
@@ -644,6 +630,7 @@ amdxdna_gem_create_obj(struct drm_device *dev, size_t size)
abo->mem.dev_addr = AMDXDNA_INVALID_ADDR;
abo->mem.size = size;
INIT_LIST_HEAD(&abo->mem.umap_list);
+ INIT_WORK(&abo->hmm_unreg_work, amdxdna_hmm_unreg_work);
return abo;
}
diff --git a/drivers/accel/amdxdna/amdxdna_gem.h b/drivers/accel/amdxdna/amdxdna_gem.h
index 8d89874f1fca3..b6573ffe8d7cc 100644
--- a/drivers/accel/amdxdna/amdxdna_gem.h
+++ b/drivers/accel/amdxdna/amdxdna_gem.h
@@ -11,13 +11,11 @@
struct amdxdna_umap {
struct mmu_interval_notifier notifier;
struct hmm_range range;
- struct work_struct hmm_unreg_work;
struct amdxdna_gem_obj *abo;
struct list_head node;
struct kref refcnt;
bool invalid;
bool unmapped;
- bool cleanup;
};
struct amdxdna_mem {
@@ -38,6 +36,7 @@ struct amdxdna_gem_obj {
bool pinned;
struct mutex lock; /* Protects: pinned */
struct amdxdna_mem mem;
+ struct work_struct hmm_unreg_work;
/* Below members is uninitialized when needed */
struct drm_mm mm; /* For AMDXDNA_BO_DEV_HEAP */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 518/990] cxl/cdat: Fix uninitialized stack use in bandwidth gathering
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (516 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 517/990] accel/amdxdna: Fix race between unmap and free BO Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 519/990] cxl/region: Unregister the pmem region when the bridge is unbound Greg Kroah-Hartman
` (334 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guixin Liu, Richard Cheng,
Dave Jiang, Jonathan Cameron, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <kanie@linux.alibaba.com>
[ Upstream commit 97b74de26c81885a6447f5fe87641a2a136f8c7c ]
cxl_endpoint_gather_bandwidth() and cxl_switch_gather_bandwidth() declare
access_coordinate arrays on the stack and rely on their helpers to fill
them. The helpers assign only the bandwidth members, and the combine step
assigns even those only when both inputs are non-zero. The latency members
are summed from stack residue on every call, and the bandwidth members
keep that residue into the region access coordinate sysfs attributes when
the endpoint CDAT reports no bandwidth.
Zero initialize the arrays. Zero is the value this code already uses for
"not reported", so an unset member now reads back as unknown rather than as
a plausible number.
Found by code inspection. Tested on a QEMU CXL topology with two endpoints
sharing a switch upstream link and HMAT generic-port coordinates for the
host bridge, which the calculation requires to run at all: with temporary
printk at the combine sites, the unpatched kernel summed 0xfefefefe, the
CONFIG_INIT_STACK_ALL_PATTERN stack filler, into the latency members, while
the patched kernel reports the CDAT latency values there.
Fixes: a5ab0de0ebaa ("cxl: Calculate region bandwidth of targets with shared upstream link")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Link: https://patch.msgid.link/20260831092216.540644-2-kanie@linux.alibaba.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Context lines differ because kzalloc_obj(*res_xa) isn't available here, so the existing kzalloc(sizeof(*res_xa), GFP_KERNEL) line was kept while applying the same coords initializer change. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/cdat.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/cxl/core/cdat.c b/drivers/cxl/core/cdat.c
index c4bd6e8a0cf03..abb12d45af111 100644
--- a/drivers/cxl/core/cdat.c
+++ b/drivers/cxl/core/cdat.c
@@ -633,9 +633,9 @@ static int cxl_endpoint_gather_bandwidth(struct cxl_region *cxlr,
struct cxl_port *endpoint = to_cxl_port(cxled->cxld.dev.parent);
struct cxl_port *parent_port = to_cxl_port(endpoint->dev.parent);
struct cxl_port *gp_port = to_cxl_port(parent_port->dev.parent);
- struct access_coordinate pci_coord[ACCESS_COORDINATE_MAX];
- struct access_coordinate sw_coord[ACCESS_COORDINATE_MAX];
- struct access_coordinate ep_coord[ACCESS_COORDINATE_MAX];
+ struct access_coordinate pci_coord[ACCESS_COORDINATE_MAX] = { };
+ struct access_coordinate sw_coord[ACCESS_COORDINATE_MAX] = { };
+ struct access_coordinate ep_coord[ACCESS_COORDINATE_MAX] = { };
struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
struct cxl_dev_state *cxlds = cxlmd->cxlds;
struct pci_dev *pdev = to_pci_dev(cxlds->dev);
@@ -757,7 +757,7 @@ static struct xarray *cxl_switch_gather_bandwidth(struct cxl_region *cxlr,
{
struct xarray *res_xa __free(free_perf_xa) =
kzalloc(sizeof(*res_xa), GFP_KERNEL);
- struct access_coordinate coords[ACCESS_COORDINATE_MAX];
+ struct access_coordinate coords[ACCESS_COORDINATE_MAX] = { };
struct cxl_perf_ctx *ctx, *us_ctx;
unsigned long index, us_index;
int dev_count = 0;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 519/990] cxl/region: Unregister the pmem region when the bridge is unbound
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (517 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 518/990] cxl/cdat: Fix uninitialized stack use in bandwidth gathering Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 520/990] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration Greg Kroah-Hartman
` (333 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guixin Liu, Richard Cheng, Li Ming,
Dave Jiang, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guixin Liu <kanie@linux.alibaba.com>
[ Upstream commit bb26797c08d408ea7e8d3625045f0fe28714a425 ]
Removing cxl_acpi unbinds the nvdimm bridge before the regions it
serves. A region probe can therefore register its cxl_pmem_region and
only then find the bridge unbound, which leaves the new device with
nothing to remove it.
The orphan outlives the teardown and pins its region and its memdevs, so
a later cxl_acpi bind renumbers the root port, ports, endpoints,
decoders and the memdev.
Unregister the cxl_pmem_region when the bridge is unbound.
Found by code inspection. Racing a cxl_region bind against a cxl_acpi
unbind leaked a pmem_region device on 12 of 12 attempts, and none with
this patch.
Fixes: f17b558d6663 ("cxl/pmem: Refactor nvdimm device registration, delete the workqueue")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260831061120.200790-1-kanie@linux.alibaba.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Relocated the hunk from the split-out pmem region file into the region file where the function still lives; the hunk content is otherwise unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/region.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 46fc6644c8a72..7df6139f83ef2 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3306,12 +3306,14 @@ static int devm_cxl_add_pmem_region(struct cxl_region *cxlr)
dev_name(dev));
scoped_guard(device, &cxl_nvb->dev) {
- if (cxl_nvb->dev.driver)
+ if (cxl_nvb->dev.driver) {
rc = devm_add_action_or_reset(&cxl_nvb->dev,
cxlr_pmem_unregister,
cxlr_pmem);
- else
+ } else {
rc = -ENXIO;
+ cxlr_pmem_unregister(cxlr_pmem);
+ }
}
if (rc)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 520/990] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (518 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 519/990] cxl/region: Unregister the pmem region when the bridge is unbound Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 521/990] perf dso: Separate libbfd and cmd addr2line caches to fix confusion Greg Kroah-Hartman
` (332 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vitaliy Sochnev, Daniel Lezcano,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaliy Sochnev <sochnev.v.74@gmail.com>
[ Upstream commit 7efceedd23678cd58e98b2c64d4b2b7be03f6cf9 ]
The EN7581 IRQ is requested before the thermal zone is registered, and
the handler passes priv->tz to thermal_zone_device_update(). Unbind
leaves the monitor interrupt enabled, so an interrupt pending on the
next bind fires while priv->tz is NULL. On a Nokia XG-040G-MD this
oopses in thermal_zone_device_update(). On unbind, devres also frees the
zone before the IRQ.
Request the IRQ in post_probe, after zone registration.
Fixes: 42de37f40e1b ("thermal/drivers: Add support for Airoha EN7581 thermal sensor")
Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Link: https://patch.msgid.link/20260915194128.42508-1-sochnev.v.74@gmail.com
[ sashal: Moved the IRQ request to after thermal zone registration in the single probe function, since this tree lacks the split post_probe and regmap code, keeping the local handler name and dev_err. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thermal/airoha_thermal.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c
index 829a7327fc403..a971c0b986ac2 100644
--- a/drivers/thermal/airoha_thermal.c
+++ b/drivers/thermal/airoha_thermal.c
@@ -437,18 +437,6 @@ static int airoha_thermal_probe(struct platform_device *pdev)
of_address_to_resource(chip_scu_np, 0, &priv->scu_adc_res);
of_node_put(chip_scu_np);
- irq = platform_get_irq(pdev, 0);
- if (irq < 0)
- return irq;
-
- ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
- airoha_thermal_irq, IRQF_ONESHOT,
- pdev->name, priv);
- if (ret) {
- dev_err(dev, "Can't get interrupt working.\n");
- return ret;
- }
-
airoha_thermal_setup_monitor(priv);
airoha_thermal_setup_adc_val(dev, priv);
@@ -461,6 +449,19 @@ static int airoha_thermal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
+ /* After zone registration: the handler uses priv->tz */
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
+ return irq;
+
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
+ airoha_thermal_irq, IRQF_ONESHOT,
+ pdev->name, priv);
+ if (ret) {
+ dev_err(dev, "Can't get interrupt working.\n");
+ return ret;
+ }
+
/* Enable LOW and HIGH interrupt */
writel(EN7581_HOFSINTEN0 | EN7581_LOFSINTEN0,
priv->base + EN7581_TEMPMONINT);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 521/990] perf dso: Separate libbfd and cmd addr2line caches to fix confusion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (519 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 520/990] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 522/990] drm/connector: hdmi: Handle reset() state allocation failure Greg Kroah-Hartman
` (331 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Arnaldo Carvalho de Melo,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit f651c02755af85324ad029cd948a8e570d0769fb ]
When a dso executes addr2line via libbfd it instantiates an a2l_data
pointer. If the DSO later executes via the command-line fallback due
to an inlined bug, the a2l pointer is unconditionally populated with a
child_process process wrapper.
If libbfd is queried again, the offline reader attempts to cast struct
a2l_data into child_process, coercing random arbitrary instruction
addresses and causing silent aborts. This cleanly splits the caches.
Fixes: 257046a36750a6db ("perf srcline: Fallback between addr2line implementations")
Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Adapted to a tree where dso__set_symsrc_filename() is a plain inline setter and libbfd__addr2line() is unlocked, so the symsrc cache-free and lock context were left out. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/dso.c | 2 ++
tools/perf/util/dso.h | 15 +++++++++++++++
tools/perf/util/libbfd.c | 10 +++++-----
tools/perf/util/srcline.c | 2 ++
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 70daf4fd200e3..f381ac71e8a57 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -32,6 +32,7 @@
#include "string2.h"
#include "vdso.h"
#include "annotate-data.h"
+#include "libbfd.h"
static const char * const debuglink_paths[] = {
"%.0s%s",
@@ -1668,6 +1669,7 @@ void dso__delete(struct dso *dso)
auxtrace_cache__free(RC_CHK_ACCESS(dso)->auxtrace_cache);
dso_cache__free(dso);
dso__free_a2l(dso);
+ dso__free_a2l_libbfd(dso);
dso__free_symsrc_filename(dso);
nsinfo__zput(RC_CHK_ACCESS(dso)->nsinfo);
mutex_destroy(dso__lock(dso));
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index b374dfabf49cc..a580e7a58078a 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -303,6 +303,9 @@ DECLARE_RC_STRUCT(dso) {
const char *short_name;
const char *long_name;
void *a2l;
+#ifdef HAVE_LIBBFD_SUPPORT
+ void *a2l_libbfd;
+#endif
char *symsrc_filename;
#if defined(__powerpc__)
void *dwfl; /* DWARF debug info */
@@ -369,6 +372,18 @@ static inline void dso__set_a2l(struct dso *dso, void *val)
RC_CHK_ACCESS(dso)->a2l = val;
}
+#ifdef HAVE_LIBBFD_SUPPORT
+static inline void *dso__a2l_libbfd(const struct dso *dso)
+{
+ return RC_CHK_ACCESS(dso)->a2l_libbfd;
+}
+
+static inline void dso__set_a2l_libbfd(struct dso *dso, void *val)
+{
+ RC_CHK_ACCESS(dso)->a2l_libbfd = val;
+}
+#endif
+
static inline unsigned int dso__a2l_fails(const struct dso *dso)
{
return RC_CHK_ACCESS(dso)->a2l_fails;
diff --git a/tools/perf/util/libbfd.c b/tools/perf/util/libbfd.c
index 47d691e4af323..8771a6541f8b4 100644
--- a/tools/perf/util/libbfd.c
+++ b/tools/perf/util/libbfd.c
@@ -227,7 +227,7 @@ static int inline_list__append_dso_a2l(struct dso *dso,
struct inline_node *node,
struct symbol *sym)
{
- struct a2l_data *a2l = dso__a2l(dso);
+ struct a2l_data *a2l = dso__a2l_libbfd(dso);
struct symbol *inline_sym = new_inline_sym(dso, sym, a2l->funcname);
char *srcline = NULL;
@@ -243,11 +243,11 @@ int libbfd__addr2line(const char *dso_name, u64 addr,
struct symbol *sym)
{
int ret = 0;
- struct a2l_data *a2l = dso__a2l(dso);
+ struct a2l_data *a2l = dso__a2l_libbfd(dso);
if (!a2l) {
a2l = addr2line_init(dso_name);
- dso__set_a2l(dso, a2l);
+ dso__set_a2l_libbfd(dso, a2l);
}
if (a2l == NULL) {
@@ -299,14 +299,14 @@ int libbfd__addr2line(const char *dso_name, u64 addr,
void dso__free_a2l_libbfd(struct dso *dso)
{
- struct a2l_data *a2l = dso__a2l(dso);
+ struct a2l_data *a2l = dso__a2l_libbfd(dso);
if (!a2l)
return;
addr2line_cleanup(a2l);
- dso__set_a2l(dso, NULL);
+ dso__set_a2l_libbfd(dso, NULL);
}
static int bfd_symbols__cmpvalue(const void *a, const void *b)
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 27c0966611abb..467cdd8353aa2 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -192,6 +192,7 @@ char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
if (dso__a2l_fails(dso) > A2L_FAIL_LIMIT) {
dso__set_has_srcline(dso, false);
dso__free_a2l(dso);
+ dso__free_a2l_libbfd(dso);
}
out:
if (!show_addr)
@@ -232,6 +233,7 @@ char *get_srcline_split(struct dso *dso, u64 addr, unsigned *line)
if (dso__a2l_fails(dso) > A2L_FAIL_LIMIT) {
dso__set_has_srcline(dso, false);
dso__free_a2l(dso);
+ dso__free_a2l_libbfd(dso);
}
return NULL;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 522/990] drm/connector: hdmi: Handle reset() state allocation failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (520 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 521/990] perf dso: Separate libbfd and cmd addr2line caches to fix confusion Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 523/990] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Greg Kroah-Hartman
` (330 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Maxime Ripard,
Robin Räber, Cristian Ciocaltea, Sasha Levin, Igor Paunovic
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
[ Upstream commit 54acd0c74eba2a2c9a726856f5fdc6f9e74ea2e1 ]
In drmm_connector_hdmi_init(), if the reset callback fails to allocate
memory, e.g. inside drm_atomic_helper_connector_reset(),
connector->state will remain NULL. This is unconditionally passed to
drm_connector_attach_max_bpc_property(), leading to a NULL pointer
dereference.
Bail out with -ENOMEM if the reset callback leaves connector->state
unset.
Fixes: aadb3e16b8f3 ("drm/connector: hdmi: Add output BPC to the connector state")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/20260723015306.C94241F000E9@smtp.kernel.org/
Link: https://lore.kernel.org/all/20260723015306.C94241F000E9@smtp.kernel.org/
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Igor Paunovic <royalnet026@gmail.com> # RK3588 Orange Pi 5 Plus, dual HDMI
Tested-by: Robin Räber <robin.raebi@gmail.com>
Link: https://patch.msgid.link/20260901-dw-hdmi-qp-scramb-v11-2-bc12954a0688@collabora.com
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
[ sashal: Added braces around the single-statement reset branch in drmm_connector_hdmi_init() to fit this tree's code, which lacks the earlier two-arm if/else context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/drm_connector.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 0326b9adb5f12..3e40efc2298a6 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -612,8 +612,11 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
* drm_connector_attach_max_bpc_property() requires the
* connector to have a state.
*/
- if (connector->funcs->reset)
+ if (connector->funcs->reset) {
connector->funcs->reset(connector);
+ if (!connector->state)
+ return -ENOMEM;
+ }
drm_connector_attach_max_bpc_property(connector, 8, max_bpc);
connector->max_bpc = max_bpc;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 523/990] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (521 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 522/990] drm/connector: hdmi: Handle reset() state allocation failure Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 524/990] wifi: rtl8xxxu: unwind incomplete receive startup Greg Kroah-Hartman
` (329 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Adrian Hunter, Frank Li,
Alexandre Belloni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <adrian.hunter@intel.com>
[ Upstream commit 5fbd0790af9484c251341e3ba2ebbb2887c570c8 ]
INTR_IBI_READY indicates that one or more IBI Status Descriptors are
present in the IBI ring. After clearing interrupt status, the interrupt
handler processes only a single IBI even though additional IBIs may
already be queued.
The controller does not reassert INTR_IBI_READY solely because entries
remain in the ring after interrupt status has been cleared. Consequently,
the remaining IBIs are not processed until some later interrupt occurs,
and can accumulate if IBIs arrive more often than the interrupt handler
runs.
Process all IBIs that are pending when the handler runs: capture the IBI
enqueue pointer up front and continue until the dequeue pointer reaches
that position.
Fixes: 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260920151248.46936-10-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[ sashal: adjusted the IBI dequeue-pointer update to keep this tree's hci->lock and re-read RING_OPERATION1 under the lock, since upstream dropped that locking. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/i3c/master/mipi-i3c-hci/dma.c | 40 +++++++++++++++++----------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index 15a34429197b5..8fe607af45d7c 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -631,25 +631,24 @@ static void hci_dma_recycle_ibi_slot(struct i3c_hci *hci,
i3c_generic_ibi_recycle_slot(dev_ibi->pool, slot);
}
-static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
+static bool hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh,
+ u32 *op1_val, unsigned int enq_ptr)
{
struct hci_rings_data *rings = hci->io_data;
struct i3c_dev_desc *dev;
struct i3c_hci_dev_data *dev_data;
struct hci_dma_dev_ibi_data *dev_ibi;
struct i3c_ibi_slot *slot;
- u32 op1_val, op2_val, ibi_status_error;
- unsigned int ptr, enq_ptr, deq_ptr;
+ u32 ibi_status_error;
+ unsigned int ptr, deq_ptr;
unsigned int ibi_size, ibi_chunks, ibi_data_offset, first_part;
int ibi_addr, last_ptr;
void *ring_ibi_data;
dma_addr_t ring_ibi_data_dma;
- op1_val = rh_reg_read(RING_OPERATION1);
- deq_ptr = FIELD_GET(RING_OP1_IBI_DEQ_PTR, op1_val);
-
- op2_val = rh_reg_read(RING_OPERATION2);
- enq_ptr = FIELD_GET(RING_OP2_IBI_ENQ_PTR, op2_val);
+ deq_ptr = FIELD_GET(RING_OP1_IBI_DEQ_PTR, *op1_val);
+ if (deq_ptr == enq_ptr)
+ return false;
ibi_status_error = 0;
ibi_addr = -1;
@@ -699,7 +698,7 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
dev_dbg(&hci->master.dev,
"no LAST_STATUS available (e=%d d=%d)",
enq_ptr, deq_ptr);
- return;
+ return false;
}
deq_ptr = last_ptr + 1;
deq_ptr %= rh->ibi_status_entries;
@@ -780,10 +779,10 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
done:
/* take care to update the ibi dequeue pointer atomically */
spin_lock(&hci->lock);
- op1_val = rh_reg_read(RING_OPERATION1);
- op1_val &= ~RING_OP1_IBI_DEQ_PTR;
- op1_val |= FIELD_PREP(RING_OP1_IBI_DEQ_PTR, deq_ptr);
- rh_reg_write(RING_OPERATION1, op1_val);
+ *op1_val = rh_reg_read(RING_OPERATION1);
+ *op1_val &= ~RING_OP1_IBI_DEQ_PTR;
+ *op1_val |= FIELD_PREP(RING_OP1_IBI_DEQ_PTR, deq_ptr);
+ rh_reg_write(RING_OPERATION1, *op1_val);
spin_unlock(&hci->lock);
/* update the chunk pointer */
@@ -792,6 +791,19 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)
/* and tell the hardware about freed chunks */
rh_reg_write(CHUNK_CONTROL, rh_reg_read(CHUNK_CONTROL) + ibi_chunks);
+
+ return true;
+}
+
+static void hci_dma_drain_ibi_ring(struct i3c_hci *hci, struct hci_rh_data *rh)
+{
+ u32 op1_val = rh_reg_read(RING_OPERATION1);
+ u32 op2_val = rh_reg_read(RING_OPERATION2);
+ unsigned int enq_ptr = FIELD_GET(RING_OP2_IBI_ENQ_PTR, op2_val);
+
+ /* Loop is bounded by enq_ptr. Further IBIs will re-assert INTR_IBI_READY */
+ while (hci_dma_process_ibi(hci, rh, &op1_val, enq_ptr))
+ ;
}
static bool hci_dma_irq_handler(struct i3c_hci *hci)
@@ -813,7 +825,7 @@ static bool hci_dma_irq_handler(struct i3c_hci *hci)
rh_reg_write(INTR_STATUS, status);
if (status & INTR_IBI_READY)
- hci_dma_process_ibi(hci, rh);
+ hci_dma_drain_ibi_ring(hci, rh);
if (status & (INTR_TRANSFER_COMPLETION | INTR_TRANSFER_ERR))
hci_dma_xfer_done(hci, rh);
if (status & INTR_RING_OP)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 524/990] wifi: rtl8xxxu: unwind incomplete receive startup
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (522 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 523/990] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 525/990] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors Greg Kroah-Hartman
` (328 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ping-Ke Shih, Kim Wooseok,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kim Wooseok <5mghybrid@khu.ac.kr>
[ Upstream commit 4c58fb8944a2cfbe5506534de0cf58646408d31a ]
rtl8xxxu_start() allocates and submits RX URBs one at a time. If a later
allocation fails, the error path frees the TX pool but leaves earlier RX
requests active. A partial TX or RX allocation failure can also leave
ret at zero, so start reports success despite the incomplete setup.
Allocate the RX pool before submitting any of it, and return ENOMEM
whenever a pool allocation fails. Pass start errors through
rtl8xxxu_stop(), including interrupt URB submission failures, so the
existing stop path cancels work and releases both active requests and
partially allocated pools.
Share the submission loop with the RX worker. Both callers keep requests
that fail with ENOMEM/EAGAIN. For a fatal error during startup, free the
rest of the unsubmitted batch and return the error so start can unwind.
In the worker, free only the failed request and continue with the rest
of the batch.
Keep the allocation loop in a small helper so the setup and error paths
in start remain easy to follow.
On an RTL8192EU, I exercised every error exit in rtl8xxxu_start()
except interrupt-URB allocation and submission failures, which this
adapter does not use.
Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Assisted-by: GPT-6 Astra
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kim Wooseok <5mghybrid@khu.ac.kr>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260921-codex-rtl-rx-v3-submit-v4-2-eeb09fe8f791@khu.ac.kr
[ sashal: Replaced kmalloc_obj(struct ...) calls with the older kmalloc(sizeof(struct ...), GFP_KERNEL) form, since the kmalloc_obj macro doesn't exist in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 96 +++++++++++---------
1 file changed, 54 insertions(+), 42 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 0f3f10dbfc541..c7e46445545af 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -61,6 +61,7 @@ MODULE_PARM_DESC(dma_agg_pages, "Set DMA aggregation pages (range 1-127, 0 to di
#define RTL8XXXU_TX_URB_LOW_WATER 25
#define RTL8XXXU_TX_URB_HIGH_WATER 32
+static void rtl8xxxu_stop(struct ieee80211_hw *hw, bool suspend);
static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv,
struct rtl8xxxu_rx_urb *rx_urb);
@@ -5880,6 +5881,28 @@ static void rtl8xxxu_free_rx_resources(struct rtl8xxxu_priv *priv)
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
}
+static int rtl8xxxu_alloc_rx_urbs(struct rtl8xxxu_priv *priv)
+{
+ struct rtl8xxxu_rx_urb *rx_urb;
+ int i;
+
+ /* No RX work is active until the complete pool has been allocated. */
+ for (i = 0; i < RTL8XXXU_RX_URBS; i++) {
+ rx_urb = kmalloc(sizeof(struct rtl8xxxu_rx_urb), GFP_KERNEL);
+ if (!rx_urb)
+ return -ENOMEM;
+
+ usb_init_urb(&rx_urb->urb);
+ INIT_LIST_HEAD(&rx_urb->list);
+ rx_urb->hw = priv->hw;
+
+ list_add_tail(&rx_urb->list, &priv->rx_urb_pending_list);
+ priv->rx_urb_pending_count++;
+ }
+
+ return 0;
+}
+
static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
struct rtl8xxxu_rx_urb *rx_urb)
{
@@ -5907,32 +5930,21 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
}
-static void rtl8xxxu_rx_urb_work(struct work_struct *work)
+static int rtl8xxxu_submit_rx_urbs(struct rtl8xxxu_priv *priv, bool startup)
{
- struct rtl8xxxu_priv *priv;
struct rtl8xxxu_rx_urb *rx_urb, *tmp;
- struct list_head local;
unsigned long flags;
+ LIST_HEAD(local);
int ret;
- priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
- INIT_LIST_HEAD(&local);
-
spin_lock_irqsave(&priv->rx_urb_lock, flags);
-
list_splice_init(&priv->rx_urb_pending_list, &local);
priv->rx_urb_pending_count = 0;
-
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
list_for_each_entry_safe(rx_urb, tmp, &local, list) {
list_del_init(&rx_urb->list);
ret = rtl8xxxu_submit_rx_urb(priv, rx_urb);
- /*
- * If out of memory or temporary error, put it back on the
- * queue and try again. Otherwise the device is dead/gone
- * and we should drop it.
- */
switch (ret) {
case 0:
break;
@@ -5941,11 +5953,29 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
rtl8xxxu_queue_rx_urb(priv, rx_urb);
break;
default:
+ usb_free_urb(&rx_urb->urb);
+ if (startup)
+ goto free_remaining;
dev_warn(&priv->udev->dev,
"failed to requeue urb with error %i\n", ret);
- usb_free_urb(&rx_urb->urb);
}
}
+
+ return 0;
+
+free_remaining:
+ list_for_each_entry_safe(rx_urb, tmp, &local, list) {
+ list_del(&rx_urb->list);
+ usb_free_urb(&rx_urb->urb);
+ }
+ return ret;
+}
+
+static void rtl8xxxu_rx_urb_work(struct work_struct *work)
+{
+ struct rtl8xxxu_priv *priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
+
+ rtl8xxxu_submit_rx_urbs(priv, false);
}
/*
@@ -7452,7 +7482,6 @@ static void rtl8xxxu_watchdog_callback(struct work_struct *work)
static int rtl8xxxu_start(struct ieee80211_hw *hw)
{
struct rtl8xxxu_priv *priv = hw->priv;
- struct rtl8xxxu_rx_urb *rx_urb;
struct rtl8xxxu_tx_urb *tx_urb;
unsigned long flags;
int ret, i;
@@ -7467,14 +7496,13 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
if (priv->usb_interrupts) {
ret = rtl8xxxu_submit_int_urb(hw);
if (ret)
- goto exit;
+ goto error_out;
}
for (i = 0; i < RTL8XXXU_TX_URBS; i++) {
tx_urb = kmalloc(sizeof(struct rtl8xxxu_tx_urb), GFP_KERNEL);
if (!tx_urb) {
- if (!i)
- ret = -ENOMEM;
+ ret = -ENOMEM;
goto error_out;
}
@@ -7485,31 +7513,21 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
priv->tx_urb_free_count++;
}
+ ret = rtl8xxxu_alloc_rx_urbs(priv);
+ if (ret)
+ goto error_out;
+
priv->tx_stopped = false;
spin_lock_irqsave(&priv->rx_urb_lock, flags);
priv->shutdown = false;
spin_unlock_irqrestore(&priv->rx_urb_lock, flags);
- for (i = 0; i < RTL8XXXU_RX_URBS; i++) {
- rx_urb = kmalloc(sizeof(struct rtl8xxxu_rx_urb), GFP_KERNEL);
- if (!rx_urb) {
- if (!i)
- ret = -ENOMEM;
-
- goto error_out;
- }
- usb_init_urb(&rx_urb->urb);
- INIT_LIST_HEAD(&rx_urb->list);
- rx_urb->hw = hw;
-
- ret = rtl8xxxu_submit_rx_urb(priv, rx_urb);
- if (ret)
- rtl8xxxu_queue_rx_urb(priv, rx_urb);
- }
+ ret = rtl8xxxu_submit_rx_urbs(priv, true);
+ if (ret)
+ goto error_out;
schedule_delayed_work(&priv->ra_watchdog, 2 * HZ);
-exit:
/*
* Accept all data and mgmt frames
*/
@@ -7522,13 +7540,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
return ret;
error_out:
- rtl8xxxu_free_tx_resources(priv);
- /*
- * Disable all data and mgmt frames
- */
- rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x0000);
- rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0x0000);
-
+ rtl8xxxu_stop(hw, false);
return ret;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 525/990] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (523 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 524/990] wifi: rtl8xxxu: unwind incomplete receive startup Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 526/990] crypto: qat - hold cfg->lock when accessing config sections Greg Kroah-Hartman
` (327 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kim Wooseok, Ping-Ke Shih,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kim Wooseok <5mghybrid@khu.ac.kr>
[ Upstream commit 2f77c66694108785a1f6ae6c5de06453e7f7a91f ]
rtl8xxxu resubmits completed RX requests when more than eight URBs are
waiting on the pending list. It starts with 32 URBs, but frees them on
completion errors. After enough errors, the remaining pool can no longer
reach the submission threshold. Reception then stays stopped even after
the errors end. Temporary submission failures can leave a small batch
waiting with no further work scheduled, too.
Keep the URB when a completion reports EPROTO, EILSEQ, ETIME, EOVERFLOW,
ECOMM or ENOSR. Free its receive buffer and return the request to the
same pending list used by normal completions. ENOMEM/EAGAIN from startup
or worker submission uses this path as well, so a submission failure
cannot strand a request during recovery.
Use one delayed work item to submit the pending requests. An error
queues a retry after 100 ms without moving an existing reservation back.
If a normal completion takes the pending count above eight,
mod_delayed_work(..., 0) brings the work forward. This limits repeated
retries when reception is not progressing, while allowing normal traffic
to replenish the pool promptly. The 100 ms delay is therefore not a
minimum wait for each failed URB.
Keep the shutdown check, queue insertion and scheduling under the RX
lock. Stop sets shutdown under that lock, cancels the delayed work
synchronously, then drains active and pending requests. Cancellation and
device removal continue to free their URBs.
Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Assisted-by: GPT-6 Astra
Signed-off-by: Kim Wooseok <5mghybrid@khu.ac.kr>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260921-codex-rtl-rx-v3-submit-v4-3-eeb09fe8f791@khu.ac.kr
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 46 ++++++++++++-------
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +-
2 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index c7e46445545af..5ba4a72f86be6 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -57,6 +57,7 @@ MODULE_PARM_DESC(dma_agg_pages, "Set DMA aggregation pages (range 1-127, 0 to di
#define USB_VENDOR_ID_REALTEK 0x0bda
#define RTL8XXXU_RX_URBS 32
#define RTL8XXXU_RX_URB_PENDING_WATER 8
+#define RTL8XXXU_RX_URB_RETRY_DELAY_MS 100
#define RTL8XXXU_TX_URBS 64
#define RTL8XXXU_TX_URB_LOW_WATER 25
#define RTL8XXXU_TX_URB_HIGH_WATER 32
@@ -5904,9 +5905,8 @@ static int rtl8xxxu_alloc_rx_urbs(struct rtl8xxxu_priv *priv)
}
static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
- struct rtl8xxxu_rx_urb *rx_urb)
+ struct rtl8xxxu_rx_urb *rx_urb, bool defer_schedule)
{
- struct sk_buff *skb;
unsigned long flags;
spin_lock_irqsave(&priv->rx_urb_lock, flags);
@@ -5914,16 +5914,13 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
if (!priv->shutdown) {
list_add_tail(&rx_urb->list, &priv->rx_urb_pending_list);
priv->rx_urb_pending_count++;
- /*
- * Arm the worker under rx_urb_lock so this is atomic with the
- * shutdown check: moving it out of the lock would let a
- * completion arm the work after rtl8xxxu_stop() canceled it.
- */
- if (priv->rx_urb_pending_count > RTL8XXXU_RX_URB_PENDING_WATER)
- schedule_work(&priv->rx_urb_wq);
+ /* Serialize scheduling with the shutdown check and cancellation. */
+ if (defer_schedule)
+ schedule_delayed_work(&priv->rx_urb_wq,
+ msecs_to_jiffies(RTL8XXXU_RX_URB_RETRY_DELAY_MS));
+ else if (priv->rx_urb_pending_count > RTL8XXXU_RX_URB_PENDING_WATER)
+ mod_delayed_work(system_percpu_wq, &priv->rx_urb_wq, 0);
} else {
- skb = (struct sk_buff *)rx_urb->urb.context;
- dev_kfree_skb_irq(skb);
usb_free_urb(&rx_urb->urb);
}
@@ -5950,7 +5947,7 @@ static int rtl8xxxu_submit_rx_urbs(struct rtl8xxxu_priv *priv, bool startup)
break;
case -ENOMEM:
case -EAGAIN:
- rtl8xxxu_queue_rx_urb(priv, rx_urb);
+ rtl8xxxu_queue_rx_urb(priv, rx_urb, true);
break;
default:
usb_free_urb(&rx_urb->urb);
@@ -5973,7 +5970,8 @@ static int rtl8xxxu_submit_rx_urbs(struct rtl8xxxu_priv *priv, bool startup)
static void rtl8xxxu_rx_urb_work(struct work_struct *work)
{
- struct rtl8xxxu_priv *priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
+ struct rtl8xxxu_priv *priv = container_of(to_delayed_work(work),
+ struct rtl8xxxu_priv, rx_urb_wq);
rtl8xxxu_submit_rx_urbs(priv, false);
}
@@ -6629,10 +6627,24 @@ static void rtl8xxxu_rx_complete(struct urb *urb)
skb = NULL;
rx_urb->urb.context = NULL;
- rtl8xxxu_queue_rx_urb(priv, rx_urb);
+ rtl8xxxu_queue_rx_urb(priv, rx_urb, false);
} else {
dev_dbg(dev, "%s: status %i\n", __func__, urb->status);
- goto cleanup;
+
+ switch (urb->status) {
+ case -EPROTO:
+ case -EILSEQ:
+ case -ETIME:
+ case -EOVERFLOW:
+ case -ECOMM:
+ case -ENOSR:
+ dev_kfree_skb(skb);
+ urb->context = NULL;
+ rtl8xxxu_queue_rx_urb(priv, rx_urb, true);
+ return;
+ default:
+ goto cleanup;
+ }
}
return;
@@ -7563,7 +7575,7 @@ static void rtl8xxxu_stop(struct ieee80211_hw *hw, bool suspend)
* it drained via rtl8xxxu_submit_rx_urb(), so a worker still running
* after the kill could submit a URB that escapes it.
*/
- cancel_work_sync(&priv->rx_urb_wq);
+ cancel_delayed_work_sync(&priv->rx_urb_wq);
usb_kill_anchored_urbs(&priv->rx_anchor);
usb_kill_anchored_urbs(&priv->tx_anchor);
@@ -7877,7 +7889,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
spin_lock_init(&priv->tx_urb_lock);
INIT_LIST_HEAD(&priv->rx_urb_pending_list);
spin_lock_init(&priv->rx_urb_lock);
- INIT_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work);
+ INIT_DELAYED_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work);
INIT_DELAYED_WORK(&priv->ra_watchdog, rtl8xxxu_watchdog_callback);
INIT_DELAYED_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback);
skb_queue_head_init(&priv->c2hcmd_queue);
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index f42463e595cc2..c6a4a58a92512 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1803,7 +1803,7 @@ struct rtl8xxxu_priv {
struct list_head rx_urb_pending_list;
int rx_urb_pending_count;
bool shutdown;
- struct work_struct rx_urb_wq;
+ struct delayed_work rx_urb_wq;
u8 mac_addr[ETH_ALEN];
char chip_name[8];
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 526/990] crypto: qat - hold cfg->lock when accessing config sections
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (524 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 525/990] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 527/990] serial: 8250: export and rename wait_for_xmitr() Greg Kroah-Hartman
` (326 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ahsan Atta, Giovanni Cabiddu,
Herbert Xu, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahsan Atta <ahsan.atta@intel.com>
[ Upstream commit cb3a1364fed9ea7b063e3ae026177a145abb5940 ]
adf_cfg_sec_find() walks the per-device section list without holding
cfg->lock, and the returned section pointer is used later under the
lock. A concurrent section deletion under cfg->lock
(adf_cfg_del_all_except() on device down, or adf_cfg_dev_remove() on
removal) can free the section first, leading to a use-after-free.
The debugfs dev_cfg reader has the same problem: qat_dev_cfg_show()
walks both the section list and each section's param_head under the
global qat_cfg_read_lock mutex, not the per-device cfg->lock used by the
add and delete paths, so the two do not serialise. Updating an existing
key frees the old key_val under cfg->lock, so even a config write
concurrent with an open dev_cfg read can free an entry mid-walk, a wider
window than section deletion alone.
Take cfg->lock around the section lookup in adf_cfg_add_key_value_param()
and around the lookup and insert in adf_cfg_section_add(), and use
down_read()/up_read(&cfg->lock) in the debugfs start/stop callbacks.
Remove the now-unused qat_cfg_read_lock.
While here, return -ENOENT rather than -EFAULT when the section is not
found; EFAULT (bad userspace address) is not meaningful for this case.
Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
Signed-off-by: Ahsan Atta <ahsan.atta@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ sashal: Replaced the new kzalloc_obj(*sec) allocator call with this tree's existing kzalloc(sizeof(*sec), GFP_KERNEL) in adf_cfg_section_add(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/crypto/intel/qat/qat_common/adf_cfg.c | 49 +++++++++++--------
1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/drivers/crypto/intel/qat/qat_common/adf_cfg.c b/drivers/crypto/intel/qat/qat_common/adf_cfg.c
index 7180dd2b504a1..f60034387fd55 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_cfg.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_cfg.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
/* Copyright(c) 2014 - 2020 Intel Corporation */
-#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/list.h>
@@ -9,13 +8,11 @@
#include "adf_cfg.h"
#include "adf_common_drv.h"
-static DEFINE_MUTEX(qat_cfg_read_lock);
-
static void *qat_dev_cfg_start(struct seq_file *sfile, loff_t *pos)
{
struct adf_cfg_device_data *dev_cfg = sfile->private;
- mutex_lock(&qat_cfg_read_lock);
+ down_read(&dev_cfg->lock);
return seq_list_start(&dev_cfg->sec_list, *pos);
}
@@ -43,7 +40,9 @@ static void *qat_dev_cfg_next(struct seq_file *sfile, void *v, loff_t *pos)
static void qat_dev_cfg_stop(struct seq_file *sfile, void *v)
{
- mutex_unlock(&qat_cfg_read_lock);
+ struct adf_cfg_device_data *dev_cfg = sfile->private;
+
+ up_read(&dev_cfg->lock);
}
static const struct seq_operations qat_dev_cfg_sops = {
@@ -272,13 +271,10 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
enum adf_cfg_val_type type)
{
struct adf_cfg_device_data *cfg = accel_dev->cfg;
+ struct adf_cfg_section *section;
struct adf_cfg_key_val *key_val;
- struct adf_cfg_section *section = adf_cfg_sec_find(accel_dev,
- section_name);
char temp_val[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
-
- if (!section)
- return -EFAULT;
+ int ret = 0;
key_val = kzalloc(sizeof(*key_val), GFP_KERNEL);
if (!key_val)
@@ -308,20 +304,28 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
* anything (the newly created key_val is freed).
*/
down_write(&cfg->lock);
+
+ section = adf_cfg_sec_find(accel_dev, section_name);
+ if (!section) {
+ kfree(key_val);
+ ret = -ENOENT;
+ goto unlock;
+ }
+
if (!adf_cfg_key_val_get(accel_dev, section_name, key, temp_val)) {
if (strncmp(temp_val, key_val->val, sizeof(temp_val))) {
adf_cfg_keyval_remove(key, section);
} else {
kfree(key_val);
- goto out;
+ goto unlock;
}
}
adf_cfg_keyval_add(key_val, section);
-out:
+unlock:
up_write(&cfg->lock);
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(adf_cfg_add_key_value_param);
@@ -339,21 +343,26 @@ EXPORT_SYMBOL_GPL(adf_cfg_add_key_value_param);
int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name)
{
struct adf_cfg_device_data *cfg = accel_dev->cfg;
- struct adf_cfg_section *sec = adf_cfg_sec_find(accel_dev, name);
+ struct adf_cfg_section *sec;
+ int ret = 0;
- if (sec)
- return 0;
+ down_write(&cfg->lock);
+
+ if (adf_cfg_sec_find(accel_dev, name))
+ goto unlock;
sec = kzalloc(sizeof(*sec), GFP_KERNEL);
- if (!sec)
- return -ENOMEM;
+ if (!sec) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
strscpy(sec->name, name);
INIT_LIST_HEAD(&sec->param_head);
- down_write(&cfg->lock);
list_add_tail(&sec->list, &cfg->sec_list);
+unlock:
up_write(&cfg->lock);
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(adf_cfg_section_add);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 527/990] serial: 8250: export and rename wait_for_xmitr()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (525 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 526/990] crypto: qat - hold cfg->lock when accessing config sections Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 528/990] serial: 8250_mid: wait for LSR tx empty before setting termios Greg Kroah-Hartman
` (325 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tate Whiteberg, Andy Shevchenko,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tate Whiteberg <whiteberg@arista.com>
[ Upstream commit 2c5942fd0300cb966339dd0366890be626b405e8 ]
Export wait_for_xmitr() and rename it to follow naming convention.
Signed-off-by: Tate Whiteberg <whiteberg@arista.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://patch.msgid.link/20260831165911.2029839-2-whiteberg@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 1c305d5f1daa ("serial: 8250_mid: wait for LSR tx empty before setting termios")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/8250/8250.h | 1 +
drivers/tty/serial/8250/8250_port.c | 13 +++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 0076eb28661cb..e1feed8b4d510 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -188,6 +188,7 @@ static unsigned int __maybe_unused serial_icr_read(struct uart_8250_port *up,
void serial8250_clear_fifos(struct uart_8250_port *p);
void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p);
void serial8250_fifo_wait_for_lsr_thre(struct uart_8250_port *up, unsigned int count);
+void serial8250_wait_for_xmitr(struct uart_8250_port *up, int bits);
void serial8250_rpm_get(struct uart_8250_port *p);
void serial8250_rpm_put(struct uart_8250_port *p);
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 455d55827ada1..4f50e83254f87 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1993,7 +1993,7 @@ static bool wait_for_lsr(struct uart_8250_port *up, int bits)
}
/* Wait for transmitter and holding register to empty with timeout */
-static void wait_for_xmitr(struct uart_8250_port *up, int bits)
+void serial8250_wait_for_xmitr(struct uart_8250_port *up, int bits)
{
unsigned int tmout;
@@ -2017,6 +2017,7 @@ static void wait_for_xmitr(struct uart_8250_port *up, int bits)
}
}
}
+EXPORT_SYMBOL_NS_GPL(serial8250_wait_for_xmitr, "SERIAL_8250");
#ifdef CONFIG_CONSOLE_POLL
/*
@@ -2060,7 +2061,7 @@ static void serial8250_put_poll_char(struct uart_port *port,
ier = serial_port_in(port, UART_IER);
serial8250_clear_IER(up);
- wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
+ serial8250_wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
/*
* Send the character out.
*/
@@ -2070,7 +2071,7 @@ static void serial8250_put_poll_char(struct uart_port *port,
* Finally, wait for transmitter to become empty
* and restore the IER
*/
- wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
+ serial8250_wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
serial_port_out(port, UART_IER, ier);
}
@@ -2185,7 +2186,7 @@ static void serial8250_THRE_test(struct uart_port *port)
* Synchronize UART_IER access against the console.
*/
scoped_guard(uart_port_lock_irqsave, port) {
- wait_for_xmitr(up, UART_LSR_THRE);
+ serial8250_wait_for_xmitr(up, UART_LSR_THRE);
serial_port_out_sync(port, UART_IER, UART_IER_THRI);
udelay(1); /* allow THRE to set */
iir_noint1 = serial_port_in(port, UART_IIR) & UART_IIR_NO_INT;
@@ -3245,7 +3246,7 @@ static void serial8250_console_wait_putchar(struct uart_port *port, unsigned cha
{
struct uart_8250_port *up = up_to_u8250p(port);
- wait_for_xmitr(up, UART_LSR_THRE);
+ serial8250_wait_for_xmitr(up, UART_LSR_THRE);
serial8250_console_putchar(port, ch);
}
@@ -3386,7 +3387,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,
* Finally, wait for transmitter to become empty
* and restore the IER
*/
- wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
+ serial8250_wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
if (em485) {
mdelay(port->rs485.delay_rts_after_send);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 528/990] serial: 8250_mid: wait for LSR tx empty before setting termios
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (526 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 527/990] serial: 8250: export and rename wait_for_xmitr() Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 529/990] bpf: Keep target extended until its last freplace link detaches Greg Kroah-Hartman
` (324 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tate Whiteberg, Andy Shevchenko,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tate Whiteberg <whiteberg@arista.com>
[ Upstream commit 1c305d5f1daabd317a60b6a2e2ac6b1aff7e05df ]
If mid8250_set_termios is called while data is still in transmission,
the corresponding register updates will corrupt the transmission.
Fix this by locking the port and and waiting for the transmitter to
empty before performing updates. It is necessary to wait for both
UART_LSR_THRE and UART_LSR_TEMT to ensure the final character is sent.
Fixes: f549e94effa1 ("serial: 8250_pci: add Intel Penwell ports")
Signed-off-by: Tate Whiteberg <whiteberg@arista.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://patch.msgid.link/20260831165911.2029839-3-whiteberg@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/8250/8250_mid.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c
index 82656645b8a64..c02ecb96e8b6f 100644
--- a/drivers/tty/serial/8250/8250_mid.c
+++ b/drivers/tty/serial/8250/8250_mid.c
@@ -7,6 +7,7 @@
*/
#include <linux/bitops.h>
+#include <linux/cleanup.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/rational.h>
@@ -209,6 +210,7 @@ static void mid8250_set_termios(struct uart_port *p, struct ktermios *termios,
const struct ktermios *old)
{
unsigned int baud = tty_termios_baud_rate(termios);
+ struct uart_8250_port *up = up_to_u8250p(p);
struct mid8250 *mid = p->private_data;
unsigned short ps = 16;
unsigned long fuart = baud * ps;
@@ -231,11 +233,16 @@ static void mid8250_set_termios(struct uart_port *p, struct ktermios *termios,
}
rational_best_approximation(fuart, mid->board->freq, w, w, &mul, &div);
- p->uartclk = fuart * 16 / ps; /* core uses ps = 16 always */
- writel(ps, p->membase + INTEL_MID_UART_PS); /* set PS */
- writel(mul, p->membase + INTEL_MID_UART_MUL); /* set MUL */
- writel(div, p->membase + INTEL_MID_UART_DIV);
+ scoped_guard(spinlock_irq, &p->lock) {
+ p->uartclk = fuart * 16 / ps; /* core uses ps = 16 always */
+
+ serial8250_wait_for_xmitr(up, UART_LSR_BOTH_EMPTY);
+
+ writel(ps, p->membase + INTEL_MID_UART_PS); /* set PS */
+ writel(mul, p->membase + INTEL_MID_UART_MUL); /* set MUL */
+ writel(div, p->membase + INTEL_MID_UART_DIV);
+ }
serial8250_do_set_termios(p, termios, old);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 529/990] bpf: Keep target extended until its last freplace link detaches
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (527 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 528/990] serial: 8250_mid: wait for LSR tx empty before setting termios Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 530/990] mfd: cs42l43: Move cancel_work_sync() into remove Greg Kroah-Hartman
` (323 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yuan Chen, Jiri Olsa,
Kumar Kartikeya Dwivedi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <chenyuan@kylinos.cn>
[ Upstream commit c43c348a84460b003fa757dd43d8c89848ae220d ]
The is_extended / prog_array_member_cnt protocol introduced by commit
d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace")
keeps a prog extended by a freplace program out of prog_array maps, and
vice versa: once a tail call re-enters an extended subprogram, its
tail_call_cnt resets on every execution and the loop never terminates.
But is_extended is a plain boolean, while one target prog can carry
several freplace links at the same time, one on its entry and one on a
global subprogram. __bpf_trampoline_unlink_prog() cleared is_extended
whenever *any* freplace link detached, so detaching one of two links
re-armed the unbounded loop through the remaining one.
Replace the is_extended boolean with a count of the freplace links
attached to each target prog, so the target stays extended until its
last link detaches. Also rename bpf_freplace_check_tgt_prog() to
bpf_freplace_link_tgt_prog(), as the helper has never been a pure
check: it reserves the target prog on success.
Fixes: d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20260924023737.1140521-2-chenyuan_fl@163.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[ sashal: adjusted context in include/linux/bpf.h, where neighboring struct members differ, and in the trampoline code, which still uses the older bpf_tramp_link layout. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 4 ++--
kernel/bpf/arraymap.c | 2 +-
kernel/bpf/trampoline.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index fc5af5a7f6a21..f165743cd71f3 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1624,14 +1624,13 @@ struct bpf_prog_aux {
bool xdp_has_frags;
bool exception_cb;
bool exception_boundary;
- bool is_extended; /* true if extended by freplace program */
bool jits_use_priv_stack;
bool priv_stack_requested;
bool changes_pkt_data;
bool might_sleep;
bool kprobe_write_ctx;
u64 prog_array_member_cnt; /* counts how many times as member of prog_array */
- struct mutex ext_mutex; /* mutex for is_extended and prog_array_member_cnt */
+ struct mutex ext_mutex; /* mutex for freplace_link_cnt and prog_array_member_cnt */
struct bpf_arena *arena;
void (*recursion_detected)(struct bpf_prog *prog); /* callback if recursion is detected */
/* BTF_KIND_FUNC_PROTO for valid attach_btf_id */
@@ -1662,6 +1661,7 @@ struct bpf_prog_aux {
struct bpf_map *cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE];
char name[BPF_OBJ_NAME_LEN];
u64 (*bpf_exception_cb)(u64 cookie, u64 sp, u64 bp, u64, u64);
+ u16 freplace_link_cnt; /* counts freplace links extending this prog */
#ifdef CONFIG_SECURITY
void *security;
#endif
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 248ab6854cf24..859fb807ea899 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -967,7 +967,7 @@ static void *prog_fd_array_get_ptr(struct bpf_map *map,
}
mutex_lock(&prog->aux->ext_mutex);
- is_extended = prog->aux->is_extended;
+ is_extended = prog->aux->freplace_link_cnt > 0;
if (!is_extended)
prog->aux->prog_array_member_cnt++;
mutex_unlock(&prog->aux->ext_mutex);
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index ccb943b7ac2c1..478ea4ec3a801 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -532,7 +532,7 @@ static enum bpf_tramp_prog_type bpf_attach_type_to_tramp(struct bpf_prog *prog)
}
}
-static int bpf_freplace_check_tgt_prog(struct bpf_prog *tgt_prog)
+static int bpf_freplace_link_tgt_prog(struct bpf_prog *tgt_prog)
{
struct bpf_prog_aux *aux = tgt_prog->aux;
@@ -546,7 +546,7 @@ static int bpf_freplace_check_tgt_prog(struct bpf_prog *tgt_prog)
*/
return -EBUSY;
- aux->is_extended = true;
+ aux->freplace_link_cnt++;
return 0;
}
@@ -573,7 +573,7 @@ static int __bpf_trampoline_link_prog(struct bpf_tramp_link *link,
/* Cannot attach extension if fentry/fexit are in use. */
if (cnt)
return -EBUSY;
- err = bpf_freplace_check_tgt_prog(tgt_prog);
+ err = bpf_freplace_link_tgt_prog(tgt_prog);
if (err)
return err;
tr->extension_prog = link->link.prog;
@@ -628,7 +628,7 @@ static int __bpf_trampoline_unlink_prog(struct bpf_tramp_link *link,
tr->extension_prog->bpf_func, NULL);
tr->extension_prog = NULL;
guard(mutex)(&tgt_prog->aux->ext_mutex);
- tgt_prog->aux->is_extended = false;
+ tgt_prog->aux->freplace_link_cnt--;
return err;
}
hlist_del_init(&link->tramp_hlist);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 530/990] mfd: cs42l43: Move cancel_work_sync() into remove
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (528 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 529/990] bpf: Keep target extended until its last freplace link detaches Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 531/990] accel/amdxdna: Preallocate hardware context schedulers Greg Kroah-Hartman
` (322 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Charles Keepax, Lee Jones,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <ckeepax@opensource.cirrus.com>
[ Upstream commit 86bcfdc6f1e1f8943fbe12256b3c89a66ebbad03 ]
The cs42l43 driver kicks off a work item waiting for the device
to appear on the SoundWire bus, once the device appears the
MFD children are added and the clean up is then done through
devres. As the work is synchronised in from the devres clean
up this could lead to new devres items being added after the
clean up has started, if the driver is removed before the work
has fully completed. The work should be synchronised before any
devres clean up is started.
Fixes: 0f35dc4bd50d ("mfd: cs42l43: Use devres for remove as well")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260904131243.755201-1-ckeepax@opensource.cirrus.com
Signed-off-by: Lee Jones <lee@kernel.org>
[ sashal: changed cs42l43_sdw_remove() to return int with return 0, since this tree's sdw_driver remove callback is not void. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/mfd/cs42l43-i2c.c | 8 ++++++++
drivers/mfd/cs42l43-sdw.c | 10 ++++++++++
drivers/mfd/cs42l43.c | 12 ++++++++----
drivers/mfd/cs42l43.h | 1 +
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/cs42l43-i2c.c b/drivers/mfd/cs42l43-i2c.c
index a2ab001a600ae..f0ad4002652dc 100644
--- a/drivers/mfd/cs42l43-i2c.c
+++ b/drivers/mfd/cs42l43-i2c.c
@@ -56,6 +56,13 @@ static int cs42l43_i2c_probe(struct i2c_client *i2c)
return cs42l43_dev_probe(cs42l43);
}
+static void cs42l43_i2c_remove(struct i2c_client *i2c)
+{
+ struct cs42l43 *cs42l43 = dev_get_drvdata(&i2c->dev);
+
+ cs42l43_dev_remove(cs42l43);
+}
+
#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id cs42l43_of_match[] = {
{ .compatible = "cirrus,cs42l43", },
@@ -81,6 +88,7 @@ static struct i2c_driver cs42l43_i2c_driver = {
},
.probe = cs42l43_i2c_probe,
+ .remove = cs42l43_i2c_remove,
};
module_i2c_driver(cs42l43_i2c_driver);
diff --git a/drivers/mfd/cs42l43-sdw.c b/drivers/mfd/cs42l43-sdw.c
index 023f7e1a30f8c..3938d48039c48 100644
--- a/drivers/mfd/cs42l43-sdw.c
+++ b/drivers/mfd/cs42l43-sdw.c
@@ -187,6 +187,15 @@ static int cs42l43_sdw_probe(struct sdw_slave *sdw, const struct sdw_device_id *
return cs42l43_dev_probe(cs42l43);
}
+static int cs42l43_sdw_remove(struct sdw_slave *sdw)
+{
+ struct cs42l43 *cs42l43 = dev_get_drvdata(&sdw->dev);
+
+ cs42l43_dev_remove(cs42l43);
+
+ return 0;
+}
+
static const struct sdw_device_id cs42l43_sdw_id[] = {
SDW_SLAVE_ENTRY(0x01FA, 0x4243, 0),
{}
@@ -200,6 +209,7 @@ static struct sdw_driver cs42l43_sdw_driver = {
},
.probe = cs42l43_sdw_probe,
+ .remove = cs42l43_sdw_remove,
.id_table = cs42l43_sdw_id,
.ops = &cs42l43_sdw_ops,
};
diff --git a/drivers/mfd/cs42l43.c b/drivers/mfd/cs42l43.c
index 13d446755fe20..e875154e8d813 100644
--- a/drivers/mfd/cs42l43.c
+++ b/drivers/mfd/cs42l43.c
@@ -1037,15 +1037,19 @@ static int cs42l43_power_down(struct cs42l43 *cs42l43)
return 0;
}
-static void cs42l43_dev_remove(void *data)
+static void cs42l43_dev_power_down(void *data)
{
struct cs42l43 *cs42l43 = data;
- cancel_work_sync(&cs42l43->boot_work);
-
cs42l43_power_down(cs42l43);
}
+void cs42l43_dev_remove(struct cs42l43 *cs42l43)
+{
+ flush_work(&cs42l43->boot_work);
+}
+EXPORT_SYMBOL_NS_GPL(cs42l43_dev_remove, "MFD_CS42L43");
+
int cs42l43_dev_probe(struct cs42l43 *cs42l43)
{
int i, ret;
@@ -1092,7 +1096,7 @@ int cs42l43_dev_probe(struct cs42l43 *cs42l43)
if (ret)
return ret;
- ret = devm_add_action_or_reset(cs42l43->dev, cs42l43_dev_remove, cs42l43);
+ ret = devm_add_action_or_reset(cs42l43->dev, cs42l43_dev_power_down, cs42l43);
if (ret)
return ret;
diff --git a/drivers/mfd/cs42l43.h b/drivers/mfd/cs42l43.h
index f3da783930f53..8d1b1b0f5a473 100644
--- a/drivers/mfd/cs42l43.h
+++ b/drivers/mfd/cs42l43.h
@@ -25,5 +25,6 @@ bool cs42l43_precious_register(struct device *dev, unsigned int reg);
bool cs42l43_volatile_register(struct device *dev, unsigned int reg);
int cs42l43_dev_probe(struct cs42l43 *cs42l43);
+void cs42l43_dev_remove(struct cs42l43 *cs42l43);
#endif /* CS42L43_CORE_INT_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 531/990] accel/amdxdna: Preallocate hardware context schedulers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (529 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 530/990] mfd: cs42l43: Move cancel_work_sync() into remove Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 532/990] bpf: Check fastcall stack contract once for all stack accesses Greg Kroah-Hartman
` (321 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jonghyuk Kim(MalHyuk), Max Zhen,
Lizhi Hou, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <lizhi.hou@amd.com>
[ Upstream commit f7afecd54296cf7ad6fa36f692d2a7427e32f25d ]
The hardware context scheduler fence is exposed through
drm_syncobj_add_point(). After a hardware context is destroyed,
userspace can still call drm_sched_fence_get_timeline_name() on the
fence through SYNC_IOC_FILE_INFO. This results in a use-after-free
when accessing fence->sched->name.
Preallocate hardware context schedulers and free them during device
teardown instead. A destroyed hardware context no longer frees its
scheduler, ensuring that the scheduler remains valid while its fences
are still accessible.
Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Reported-by: Jonghyuk Kim(MalHyuk) <malhyuk97@gmail.com>
Link: https://lore.kernel.org/dri-devel/20260902012712.880520-1-malhyuk97@gmail.com/
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260923200501.281208-1-lizhi.hou@amd.com
[ sashal: Adapted to the older tree by using ndev->xdna, a single firmware-load failure path that unwinds the scheduler init, and dropping the duplicate ndev declaration and assignment in the hwctx functions. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/accel/amdxdna/aie2_ctx.c | 117 +++++++++++++++++++++++--------
drivers/accel/amdxdna/aie2_pci.c | 9 ++-
drivers/accel/amdxdna/aie2_pci.h | 6 +-
3 files changed, 99 insertions(+), 33 deletions(-)
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index a87b24654c367..fb411887b6470 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -7,6 +7,7 @@
#include <drm/drm_device.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_shmem_helper.h>
+#include <drm/drm_managed.h>
#include <drm/drm_print.h>
#include <drm/drm_syncobj.h>
#include <linux/hmm.h>
@@ -62,7 +63,7 @@ static void aie2_hwctx_status_restore(struct amdxdna_hwctx *hwctx)
static void aie2_hwctx_stop(struct amdxdna_dev *xdna, struct amdxdna_hwctx *hwctx,
struct drm_sched_job *bad_job)
{
- drm_sched_stop(&hwctx->priv->sched, bad_job);
+ drm_sched_stop(hwctx->priv->sched, bad_job);
aie2_destroy_context(xdna->dev_handle, hwctx);
}
@@ -96,7 +97,7 @@ static int aie2_hwctx_restart(struct amdxdna_dev *xdna, struct amdxdna_hwctx *hw
}
out:
- drm_sched_start(&hwctx->priv->sched, 0);
+ drm_sched_start(hwctx->priv->sched, 0);
XDNA_DBG(xdna, "%s restarted, ret %d", hwctx->name, ret);
return ret;
}
@@ -528,10 +529,19 @@ static void aie2_ctx_syncobj_destroy(struct amdxdna_hwctx *hwctx)
drm_syncobj_put(hwctx->priv->syncobj);
}
-int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
+void aie2_hwctx_sched_fini(struct amdxdna_dev_hdl *ndev)
{
- struct amdxdna_client *client = hwctx->client;
- struct amdxdna_dev *xdna = client->xdna;
+ int i;
+
+ for (i = 0; i < ndev->priv->hwctx_limit; i++)
+ drm_sched_fini(&ndev->hwctx_sched[i]);
+
+ ida_destroy(&ndev->hwctx_sched_ida);
+}
+
+int aie2_hwctx_sched_init(struct amdxdna_dev_hdl *ndev)
+{
+ struct amdxdna_dev *xdna = ndev->xdna;
const struct drm_sched_init_args args = {
.ops = &sched_ops,
.num_rqs = DRM_SCHED_PRIORITY_COUNT,
@@ -540,10 +550,57 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
.name = "amdxdna_js",
.dev = xdna->ddev.dev,
};
- struct drm_gpu_scheduler *sched;
+ int i, ret;
+
+ ndev->hwctx_sched = drmm_kcalloc(&xdna->ddev, ndev->priv->hwctx_limit,
+ sizeof(*ndev->hwctx_sched), GFP_KERNEL);
+ if (!ndev->hwctx_sched)
+ return -ENOMEM;
+
+ for (i = 0; i < ndev->priv->hwctx_limit; i++) {
+ ret = drm_sched_init(&ndev->hwctx_sched[i], &args);
+ if (ret) {
+ XDNA_ERR(xdna, "Failed to init DRM scheduler. ret %d", ret);
+ goto fini_sched;
+ }
+ }
+
+ ida_init(&ndev->hwctx_sched_ida);
+
+ return 0;
+
+fini_sched:
+ while (--i >= 0)
+ drm_sched_fini(&ndev->hwctx_sched[i]);
+
+ return ret;
+}
+
+static struct drm_gpu_scheduler *aie2_hwctx_sched_alloc(struct amdxdna_dev_hdl *ndev)
+{
+ int ret;
+
+ ret = ida_alloc_range(&ndev->hwctx_sched_ida, 0,
+ ndev->priv->hwctx_limit - 1, GFP_KERNEL);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
+ return &ndev->hwctx_sched[ret];
+}
+
+static void aie2_hwctx_sched_free(struct amdxdna_dev_hdl *ndev,
+ struct drm_gpu_scheduler *sched)
+{
+ ida_free(&ndev->hwctx_sched_ida, sched - ndev->hwctx_sched);
+}
+
+int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
+{
+ struct amdxdna_client *client = hwctx->client;
+ struct amdxdna_dev *xdna = client->xdna;
+ struct amdxdna_dev_hdl *ndev = xdna->dev_handle;
struct amdxdna_hwctx_priv *priv;
struct amdxdna_gem_obj *heap;
- struct amdxdna_dev_hdl *ndev;
int i, ret;
priv = kzalloc(sizeof(*hwctx->priv), GFP_KERNEL);
@@ -551,13 +608,26 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
return -ENOMEM;
hwctx->priv = priv;
+ priv->sched = aie2_hwctx_sched_alloc(ndev);
+ if (IS_ERR(priv->sched)) {
+ ret = PTR_ERR(priv->sched);
+ goto free_priv;
+ }
+
+ ret = drm_sched_entity_init(&priv->entity, DRM_SCHED_PRIORITY_NORMAL,
+ &priv->sched, 1, NULL);
+ if (ret) {
+ XDNA_ERR(xdna, "Failed to initial sched entity. ret %d", ret);
+ goto free_sched;
+ }
+
mutex_lock(&client->mm_lock);
heap = client->dev_heap;
if (!heap) {
XDNA_ERR(xdna, "The client dev heap object not exist");
mutex_unlock(&client->mm_lock);
ret = -ENOENT;
- goto free_priv;
+ goto free_entity;
}
drm_gem_object_get(to_gobj(heap));
mutex_unlock(&client->mm_lock);
@@ -590,30 +660,16 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
priv->cmd_buf[i] = abo;
}
- sched = &priv->sched;
mutex_init(&priv->io_lock);
fs_reclaim_acquire(GFP_KERNEL);
might_lock(&priv->io_lock);
fs_reclaim_release(GFP_KERNEL);
- ret = drm_sched_init(sched, &args);
- if (ret) {
- XDNA_ERR(xdna, "Failed to init DRM scheduler. ret %d", ret);
- goto free_cmd_bufs;
- }
-
- ret = drm_sched_entity_init(&priv->entity, DRM_SCHED_PRIORITY_NORMAL,
- &sched, 1, NULL);
- if (ret) {
- XDNA_ERR(xdna, "Failed to initial sched entiry. ret %d", ret);
- goto free_sched;
- }
-
ret = aie2_hwctx_col_list(hwctx);
if (ret) {
XDNA_ERR(xdna, "Create col list failed, ret %d", ret);
- goto free_entity;
+ goto free_cmd_bufs;
}
ret = amdxdna_pm_resume_get(xdna);
@@ -641,7 +697,6 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
amdxdna_pm_suspend_put(xdna);
hwctx->status = HWCTX_STAT_INIT;
- ndev = xdna->dev_handle;
ndev->hwctx_num++;
init_waitqueue_head(&priv->job_free_wq);
@@ -655,10 +710,6 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
amdxdna_pm_suspend_put(xdna);
free_col_list:
kfree(hwctx->col_list);
-free_entity:
- drm_sched_entity_destroy(&priv->entity);
-free_sched:
- drm_sched_fini(&priv->sched);
free_cmd_bufs:
for (i = 0; i < ARRAY_SIZE(priv->cmd_buf); i++) {
if (!priv->cmd_buf[i])
@@ -668,6 +719,10 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
amdxdna_gem_unpin(heap);
put_heap:
drm_gem_object_put(to_gobj(heap));
+free_entity:
+ drm_sched_entity_destroy(&priv->entity);
+free_sched:
+ aie2_hwctx_sched_free(ndev, priv->sched);
free_priv:
kfree(priv);
return ret;
@@ -687,10 +742,10 @@ void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx)
aie2_hwctx_wait_for_idle(hwctx);
/* Request fw to destroy hwctx and cancel the rest pending requests */
- drm_sched_stop(&hwctx->priv->sched, NULL);
+ drm_sched_stop(hwctx->priv->sched, NULL);
aie2_release_resource(hwctx);
hwctx->status = HWCTX_STAT_STOP;
- drm_sched_start(&hwctx->priv->sched, 0);
+ drm_sched_start(hwctx->priv->sched, 0);
mutex_unlock(&xdna->dev_lock);
drm_sched_entity_destroy(&hwctx->priv->entity);
@@ -701,7 +756,7 @@ void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx)
atomic64_read(&hwctx->job_free_cnt));
mutex_lock(&xdna->dev_lock);
- drm_sched_fini(&hwctx->priv->sched);
+ aie2_hwctx_sched_free(ndev, hwctx->priv->sched);
aie2_ctx_syncobj_destroy(hwctx);
for (idx = 0; idx < ARRAY_SIZE(hwctx->priv->cmd_buf); idx++)
diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index 4a7d1feac6a5e..5a030da5b9d4a 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -502,11 +502,15 @@ static int aie2_init(struct amdxdna_dev *xdna)
ndev->priv = xdna->dev_info->dev_priv;
ndev->xdna = xdna;
+ ret = aie2_hwctx_sched_init(ndev);
+ if (ret)
+ return ret;
+
ret = request_firmware(&fw, ndev->priv->fw_path, &pdev->dev);
if (ret) {
XDNA_ERR(xdna, "failed to request_firmware %s, ret %d",
ndev->priv->fw_path, ret);
- return ret;
+ goto free_hwctx_sched;
}
ret = pcim_enable_device(pdev);
@@ -597,6 +601,8 @@ static int aie2_init(struct amdxdna_dev *xdna)
aie2_hw_stop(xdna);
release_fw:
release_firmware(fw);
+free_hwctx_sched:
+ aie2_hwctx_sched_fini(ndev);
return ret;
}
@@ -605,6 +611,7 @@ static void aie2_fini(struct amdxdna_dev *xdna)
{
amdxdna_pm_fini(xdna);
aie2_hw_stop(xdna);
+ aie2_hwctx_sched_fini(xdna->dev_handle);
}
static int aie2_get_aie_status(struct amdxdna_client *client,
diff --git a/drivers/accel/amdxdna/aie2_pci.h b/drivers/accel/amdxdna/aie2_pci.h
index 7d56f4bca3d63..a3f66e87d0a55 100644
--- a/drivers/accel/amdxdna/aie2_pci.h
+++ b/drivers/accel/amdxdna/aie2_pci.h
@@ -133,7 +133,7 @@ struct amdxdna_hwctx_priv {
struct amdxdna_gem_obj *heap;
void *mbox_chann;
- struct drm_gpu_scheduler sched;
+ struct drm_gpu_scheduler *sched;
struct drm_sched_entity entity;
struct mutex io_lock; /* protect seq and cmd order */
@@ -173,6 +173,8 @@ struct amdxdna_dev_hdl {
u32 total_col;
struct aie_version version;
struct aie_metadata metadata;
+ struct drm_gpu_scheduler *hwctx_sched;
+ struct ida hwctx_sched_ida;
/* power management and clock*/
enum amdxdna_power_mode_type pw_mode;
@@ -293,6 +295,8 @@ int aie2_sync_bo(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,
/* aie2_hwctx.c */
int aie2_hwctx_init(struct amdxdna_hwctx *hwctx);
void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx);
+int aie2_hwctx_sched_init(struct amdxdna_dev_hdl *ndev);
+void aie2_hwctx_sched_fini(struct amdxdna_dev_hdl *ndev);
int aie2_hwctx_config(struct amdxdna_hwctx *hwctx, u32 type, u64 value, void *buf, u32 size);
void aie2_hwctx_suspend(struct amdxdna_client *client);
int aie2_hwctx_resume(struct amdxdna_client *client);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 532/990] bpf: Check fastcall stack contract once for all stack accesses
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (530 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 531/990] accel/amdxdna: Preallocate hardware context schedulers Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 533/990] bpf: Look at frame 0 when telling async callback entries apart Greg Kroah-Hartman
` (320 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kumar Kartikeya Dwivedi,
Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[ Upstream commit ec3a69e7c021cd826be8886ba6af4ee3147788fb ]
When the verifier inlines a bpf_fastcall helper or kfunc, it removes the
spill/fill pairs that clang emitted around the call and lowers the
subprogram's stack depth so that their slots are no longer part of the
frame. This is only safe if nothing else accesses those slots or any slot
below them. check_fastcall_stack_contract() enforces this: an access to
that region from outside a fastcall pattern disables the rewrite for the
subprogram. It is called from the four stack load and store paths, and
two kinds of access escape it.
Stack buffers passed to helpers and kfuncs are validated by
check_stack_range_initialized(), which does not call it. If such a buffer
is the only other access to the region, the rewrite is still applied, the
JIT reserves a frame that does not contain the buffer, and the helper
reads or writes live kernel stack below the program's frame. For example,
without CAP_PERFMON:
*(u64 *)(r10 - 8) = r1;
call bpf_get_smp_processor_id;
r1 = *(u64 *)(r10 - 8);
r2 = 0;
r3 = r10;
r3 += -64;
r4 = 8;
call bpf_skb_load_bytes;
is accepted with a stack depth of 0 instead of 64.
Some buffers got the check indirectly. For constant-sized outputs in raw
mode, mark_raw_stack() marks the buffer initialized through ordinary
byte stores, which call the check. Commit 5da4a9f26fca ("bpf: Preserve
stack initialization for generic output buffers") limited raw mode to
programs that may read uninitialized stack, so outputs of programs
without CAP_PERFMON lost the check, as in the example above. Buffers
that never used raw mode have lacked the check since fastcall support
was added: helper inputs such as a map key whose only store is a fastcall
spill, variable-sized outputs, and buffers at a variable stack offset.
check_stack_read_fixed_off() applies the check to the current frame,
even when the pointer targets a caller's stack. A callee can therefore
read a caller's fastcall spill slot without disabling the caller's
rewrite:
caller:
r1 = 1;
*(u64 *)(r10 - 8) = r1;
call bpf_get_smp_processor_id;
r1 = *(u64 *)(r10 - 8);
r1 = r10;
r1 += -8;
call callee;
callee:
r0 = *(u64 *)(r1 + 0);
The caller's spill and fill are removed and its stack depth drops to 0,
but the verifier still tracks the slot as holding the spilled constant.
The callee's load then reads kernel stack outside the caller's frame,
while the verifier assumes r0 is 1.
Every stack access first goes through check_stack_access_within_bounds():
loads and stores from check_mem_access(), helper and kfunc buffers from
check_stack_range_initialized(), and the dynptr, iterator and irq flag
slots that kfuncs initialize, whose handlers use check_mem_access(). It
resolves the frame that owns the slots and the lowest offset the access
can touch, and it is the only place where a frame's stack depth grows.
Check the contract there, once for every access, and drop the calls from
the stack read and write paths. Zero-sized buffers touch no stack and
leave the rewrite enabled.
Fixes: 5b5f51bff1b6 ("bpf: no_caller_saved_registers attribute for helper calls")
Fixes: 5da4a9f26fca ("bpf: Preserve stack initialization for generic output buffers")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/85f9995a43edb70c76615280e103dc5325742e88330f36c97962ee35f17e3e32@mail.kernel.org
Link: https://patch.msgid.link/20260924075352.2343553-2-memxor@gmail.com
[ sashal: Removed the four old fastcall stack-contract calls and added the single check in check_stack_access_within_bounds(); the code matches upstream, with only hunk context adjusted for surrounding code that differs. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 139671b393a05..e146b860f5692 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -5230,7 +5230,6 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env,
bpf_mark_stack_write(env, state->frameno, BIT(spi));
}
- check_fastcall_stack_contract(env, state, insn_idx, off);
mark_stack_slot_scratched(env, spi);
if (reg && !(off % BPF_REG_SIZE) && reg->type == SCALAR_VALUE && env->bpf_capable) {
bool reg_value_fits;
@@ -5349,7 +5348,6 @@ static int check_stack_write_var_off(struct bpf_verifier_env *env,
return err;
}
- check_fastcall_stack_contract(env, state, insn_idx, min_off);
/* Variable offset writes destroy any spilled pointers in range. */
for (i = min_off; i < max_off; i++) {
u8 new_type, *stype;
@@ -5493,7 +5491,6 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
reg = ®_state->stack[spi].spilled_ptr;
mark_stack_slot_scratched(env, spi);
- check_fastcall_stack_contract(env, state, env->insn_idx, off);
err = bpf_mark_stack_read(env, reg_state->frameno, env->insn_idx, BIT(spi));
if (err)
return err;
@@ -5652,7 +5649,6 @@ static int check_stack_read_var_off(struct bpf_verifier_env *env,
min_off = reg->smin_value + off;
max_off = reg->smax_value + off;
mark_reg_stack_read(env, ptr_state, min_off, max_off + size, dst_regno);
- check_fastcall_stack_contract(env, ptr_state, env->insn_idx, min_off);
return 0;
}
@@ -7688,6 +7684,15 @@ static int check_stack_access_within_bounds(
return err;
}
+ /*
+ * Every stack access passes through here, including buffers passed to
+ * helpers and kfuncs and accesses into a caller's frame, so check the
+ * fastcall contract of the frame that owns the slots once for all of
+ * them. Zero-sized accesses touch no stack and keep the rewrite enabled.
+ */
+ if (access_size)
+ check_fastcall_stack_contract(env, state, env->insn_idx, min_off);
+
/* Note that there is no stack access with offset zero, so the needed stack
* size is -min_off, not -min_off+1.
*/
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 533/990] bpf: Look at frame 0 when telling async callback entries apart
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (531 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 532/990] bpf: Check fastcall stack contract once for all stack accesses Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 534/990] ASoC: mediatek: mt8188: fix clk leak on error in audsys_clk_register Greg Kroah-Hartman
` (319 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Puranjay Mohan, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <puranjay@kernel.org>
[ Upstream commit e55220162aae99622d9e80d4700e51c13a6f2a16 ]
push_async_cb() sets in_async_callback_fn and async_entry_cnt on the
callback's own frame, which is frame 0 of the fresh state it starts, and
setup_func_entry() copies neither, so a subprog called by the callback
carries neither. Two places read them from the innermost frame instead.
is_state_visited() skips the infinite loop check when two states differ
in async_entry_cnt, because seeing the same state on a second entry into
an async callback is not a loop. A callback which re-arms itself and
calls a subprog therefore compares the two entries at a loop inside that
subprog, where the innermost frame is the subprog's and has no flag set,
and the state is rejected:
infinite loop detected at insn 60
push_callback_call() numbers a new entry as the caller's count plus one.
When the callback re-arms itself from a subprog, the caller is that
subprog's frame with a count of 0, so every entry is numbered 1, the
check above never sees a difference, and a loop anywhere in such a
callback is rejected the same way.
Read the flag and the count from frame 0 in both places. A loop within a
single entry still has a matching count and is still caught, and frame 0
of a non-async state does not have the flag set, so nothing else changes.
The two other readers are already correct: check_return_code() reads
frame[0], and the one in do_check() is reached only after an early return
for curframe != 0.
Fixes: bfc6bb74e4f1 ("bpf: Implement verifier support for validation of async callbacks.")
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924162609.1746610-2-puranjay@kernel.org
[ sashal: Ported the is_state_visited() hunk into kernel/bpf/verifier.c because the state-pruning code hasn't been split out into states.c in this tree; the push_callback_call() hunk applied unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index e146b860f5692..8ac91e5ced84b 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -10884,7 +10884,7 @@ static int push_callback_call(struct bpf_verifier_env *env, struct bpf_insn *ins
if (IS_ERR(async_cb))
return PTR_ERR(async_cb);
callee = async_cb->frame[0];
- callee->async_entry_cnt = caller->async_entry_cnt + 1;
+ callee->async_entry_cnt = state->frame[0]->async_entry_cnt + 1;
/* Convert bpf_timer_set_callback() args into timer callback args */
err = set_callee_state_cb(env, caller, callee, insn_idx);
@@ -20017,10 +20017,10 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
continue;
if (sl->state.branches) {
- struct bpf_func_state *frame = sl->state.frame[sl->state.curframe];
+ struct bpf_func_state *frame = sl->state.frame[0];
if (frame->in_async_callback_fn &&
- frame->async_entry_cnt != cur->frame[cur->curframe]->async_entry_cnt) {
+ frame->async_entry_cnt != cur->frame[0]->async_entry_cnt) {
/* Different async_entry_cnt means that the verifier is
* processing another entry into async callback.
* Seeing the same state is not an indication of infinite
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 534/990] ASoC: mediatek: mt8188: fix clk leak on error in audsys_clk_register
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (532 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 533/990] bpf: Look at frame 0 when telling async callback entries apart Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 535/990] bpf, x86: Fix timed may_goto with private stack Greg Kroah-Hartman
` (318 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, bui duc phuc, Cezary Rojewski,
AngeloGioacchino Del Regno, Mark Brown, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <phucduc.bui@gmail.com>
[ Upstream commit 6cddf6e56d2539fd13c0ee9dd817c4e06a967173 ]
devm_add_action_or_reset() is called after the loop that registers gate
clocks. If kzalloc() fails mid-loop, the function returns -ENOMEM before
that call, so cleanup is never registered and all previously registered
clocks leak permanently.
Move devm_add_action_or_reset() before the loop so cleanup is always
scheduled. The clock from the current (failing) iteration is not yet
stored in afe_priv->lookup[i], so it still needs an explicit
clk_unregister_gate() call.
Fixes: fd67a7a1a22c ("ASoC: mediatek: mt8188: fix use-after-free in driver remove path")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20260907120310.135693-8-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[ sashal: Kept the branch's existing kzalloc(sizeof(*cl), GFP_KERNEL) in the context lines instead of upstream's kzalloc_obj(*cl), since that helper isn't available here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/mediatek/mt8188/mt8188-audsys-clk.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
index 40d2ab0a7677b..4d0d65e217bcf 100644
--- a/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
+++ b/sound/soc/mediatek/mt8188/mt8188-audsys-clk.c
@@ -170,7 +170,7 @@ int mt8188_audsys_clk_register(struct mtk_base_afe *afe)
struct mt8188_afe_private *afe_priv = afe->platform_priv;
struct clk *clk;
struct clk_lookup *cl;
- int i;
+ int i, ret;
afe_priv->lookup = devm_kcalloc(afe->dev, CLK_AUD_NR_CLK,
sizeof(*afe_priv->lookup),
@@ -179,6 +179,10 @@ int mt8188_audsys_clk_register(struct mtk_base_afe *afe)
if (!afe_priv->lookup)
return -ENOMEM;
+ ret = devm_add_action_or_reset(afe->dev, mt8188_audsys_clk_unregister, afe);
+ if (ret)
+ return ret;
+
for (i = 0; i < ARRAY_SIZE(aud_clks); i++) {
const struct afe_gate *gate = &aud_clks[i];
@@ -194,8 +198,10 @@ int mt8188_audsys_clk_register(struct mtk_base_afe *afe)
/* add clk_lookup for devm_clk_get(SND_SOC_DAPM_CLOCK_SUPPLY) */
cl = kzalloc(sizeof(*cl), GFP_KERNEL);
- if (!cl)
+ if (!cl) {
+ clk_unregister_gate(clk);
return -ENOMEM;
+ }
cl->clk = clk;
cl->con_id = gate->name;
@@ -206,5 +212,5 @@ int mt8188_audsys_clk_register(struct mtk_base_afe *afe)
afe_priv->lookup[i] = cl;
}
- return devm_add_action_or_reset(afe->dev, mt8188_audsys_clk_unregister, afe);
+ return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 535/990] bpf, x86: Fix timed may_goto with private stack
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (533 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 534/990] ASoC: mediatek: mt8188: fix clk leak on error in audsys_clk_register Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 536/990] bpf: Adjust pc-relative insn copied into its own patch Greg Kroah-Hartman
` (317 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 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 bb83425b3cdcb7bb3c629598a4d5efad9cc80733 ]
arch_bpf_timed_may_goto() computes the address of count and timestamp
as rbp + offset. When the prog uses private stack the JIT maps r10 to r9
and nothing is reserved under rbp, so bpf_check_timed_may_goto() reads
and writes the timestamp in the kernel stack, where
arch_bpf_timed_may_goto() has just saved r0-r5 or further down.
The following loop in fentry prog with r0-r5 set to zero:
1: may_goto +2
r6 += 1
goto 1b
leaves r3 with ktime in it when the prog has 64 bytes of stack and
ends after 65535 iterations when it has 128.
Add the frame pointer to the offset in the JIT, where rbp vs r9 is
known, and pass the pointer in AX.
arm64 and powerpc JITs keep the address of private stack in BPF_REG_FP
and are not affected.
Fixes: 2fb761823ead ("bpf, x86: Add x86 JIT support for timed may_goto")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924233130.1213812-2-alexei.starovoitov@gmail.com
[ sashal: Dropped the absent kfunc-argument block from the hunk's context, so the new timed may_goto add-frame-pointer code is inserted right after the !imm32 check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/net/bpf_jit_comp.c | 12 ++++++++++++
arch/x86/net/bpf_timed_may_goto.S | 10 ++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 39cf6974e11e1..86f50102f8b7d 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -2421,6 +2421,18 @@ st: if (is_imm8(insn->off))
}
if (!imm32)
return -EINVAL;
+ if (func == (u8 *)arch_bpf_timed_may_goto) {
+ u32 fp = priv_frame_ptr ? X86_REG_R9 : BPF_REG_FP;
+
+ /*
+ * AX has the offset of count and timestamp
+ * in the stack. Turn it into a pointer.
+ * add r10, rbp or add r10, r9
+ */
+ maybe_emit_mod(&prog, BPF_REG_AX, fp, true);
+ EMIT2(0x01, add_2reg(0xC0, BPF_REG_AX, fp));
+ ip += 3;
+ }
if (priv_frame_ptr) {
push_r9(&prog);
ip += 2;
diff --git a/arch/x86/net/bpf_timed_may_goto.S b/arch/x86/net/bpf_timed_may_goto.S
index 54c690cae1908..6c6e03f725a30 100644
--- a/arch/x86/net/bpf_timed_may_goto.S
+++ b/arch/x86/net/bpf_timed_may_goto.S
@@ -11,12 +11,6 @@
SYM_FUNC_START(arch_bpf_timed_may_goto)
ANNOTATE_NOENDBR
- /*
- * r10 passes us stack depth, load the pointer to count and timestamp
- * into r10 by adding it to BPF frame pointer.
- */
- leaq (%rbp, %r10, 1), %r10
-
/* Setup frame. */
pushq %rbp
movq %rsp, %rbp
@@ -30,8 +24,8 @@ SYM_FUNC_START(arch_bpf_timed_may_goto)
pushq %r8
/*
- * r10 has the pointer to count and timestamp, pass it as first
- * argument.
+ * r10 has the pointer to count and timestamp. JIT added the frame
+ * pointer to the offset. Pass it as first argument.
*/
movq %r10, %rdi
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 536/990] bpf: Adjust pc-relative insn copied into its own patch
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (534 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 535/990] bpf, x86: Fix timed may_goto with private stack Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 537/990] bpf: Fix overflow of jump offset in may_goto expansion Greg Kroah-Hartman
` (316 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 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 67a3b916a7ae7c1a6bed08555417d444de6f5838 ]
bpf_do_misc_fixups() inits may_goto count by patching the first insn
of a subprog with [ST, ST, first insn]. bpf_convert_ctx_accesses()
patches insn that needs a barrier with [nospec, insn].
bpf_adj_branches() doesn't adjust insns inside the patch, so when
the copy is a call, ld_imm64 of a func or a jump that points backward
its target is off by the number of insns in front of it:
static int A(void) { return 1; }
static int A2(void) { return 2; }
static int B(void)
{
int i, ret = A();
for (i = 0; i < 10 && can_loop; i++)
...
return ret;
}
When A is placed in front of B and may_goto is timed 'call A' becomes
call of A + 2. B returns 2 when A + 2 is the start of A2. Otherwise
the prog is rejected with "verifier bug: No program to jit at insn".
Add bpf_adj_moved_insn() and use it for both copies.
Fixes: 011832b97b31 ("bpf: Introduce may_goto instruction")
Fixes: d6f1c85f2253 ("bpf: Fall back to nospec for Spectre v1")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924233130.1213812-4-alexei.starovoitov@gmail.com
[ sashal: Applied the changes to kernel/bpf/verifier.c instead of fixups.c, using the local function names convert_ctx_accesses() and do_misc_fixups() in place of the bpf_-prefixed upstream ones. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 55 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 8ac91e5ced84b..13864488b5a07 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -21471,6 +21471,44 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of
return new_prog;
}
+/*
+ * insn was moved down by delta insns inside its own patch. Operands relative
+ * to the pc that point in front of the old position did not move with it.
+ */
+static int bpf_adj_moved_insn(struct bpf_insn *insn, u32 delta)
+{
+ u8 class = BPF_CLASS(insn->code), op = BPF_OP(insn->code);
+ s64 off = insn->imm, off_min = S32_MIN;
+ bool is_imm = true;
+
+ if (bpf_pseudo_func(insn) || bpf_pseudo_call(insn)) {
+ /* subprog that started at the old position starts with the patch */
+ if (off >= 0)
+ return 0;
+ } else if ((class == BPF_JMP || class == BPF_JMP32) &&
+ op != BPF_CALL && op != BPF_EXIT) {
+ if (insn->code != (BPF_JMP32 | BPF_JA)) {
+ off = insn->off;
+ off_min = S16_MIN;
+ is_imm = false;
+ }
+ /* jump to itself stays */
+ if (off >= -1)
+ return 0;
+ } else {
+ return 0;
+ }
+
+ off -= delta;
+ if (off < off_min)
+ return -ERANGE;
+ if (is_imm)
+ insn->imm = off;
+ else
+ insn->off = off;
+ return 0;
+}
+
/*
* For all jmp insns in a given 'prog' that point to 'tgt_idx' insn adjust the
* jump offset by 'delta'.
@@ -21962,7 +22000,13 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
struct bpf_insn *patch = insn_buf;
*patch++ = BPF_ST_NOSPEC();
- *patch++ = *insn;
+ *patch = *insn;
+ ret = bpf_adj_moved_insn(patch++, 1);
+ if (ret) {
+ verbose(env, "insn %d cannot be patched due to 16-bit range\n",
+ env->insn_aux_data[i + delta].orig_idx);
+ return ret;
+ }
cnt = patch - insn_buf;
new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
if (!new_prog)
@@ -23576,7 +23620,14 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
BPF_MAX_LOOPS);
}
/* Copy first actual insn to preserve it */
- insn_buf[cnt++] = env->prog->insnsi[subprog_start];
+ insn_buf[cnt] = env->prog->insnsi[subprog_start];
+ ret = bpf_adj_moved_insn(&insn_buf[cnt], cnt);
+ if (ret) {
+ verbose(env, "insn %d cannot be patched due to 16-bit range\n",
+ env->insn_aux_data[subprog_start].orig_idx);
+ return ret;
+ }
+ cnt++;
new_prog = bpf_patch_insn_data(env, subprog_start, insn_buf, cnt);
if (!new_prog)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 537/990] bpf: Fix overflow of jump offset in may_goto expansion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (535 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 536/990] bpf: Adjust pc-relative insn copied into its own patch Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 538/990] bpf: Dont converge a loop on an iterator that was created anew Greg Kroah-Hartman
` (315 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 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 8a12a00f6c5dba70a6d908fe27a3c980d42b9515 ]
may_goto is expanded into 'if AX == 0 goto off + 5' when it's timed,
off + 2 when it's not and off - 1 when it jumps backward. The sum is
stored into 16-bit off without a range check, so may_goto +32763
turns into:
if r12 == 0x0 goto pc-32768
and the prog jumps backward when may_goto expires.
Emit 'if AX != 0 goto +1; gotol' when the offset doesn't fit and
compute the offset from the number of insns in the expansion.
JITs that don't support gotol will reject such prog.
Fixes: 011832b97b31 ("bpf: Introduce may_goto instruction")
Fixes: e723608bf428 ("bpf: Add verifier support for timed may_goto")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924233130.1213812-6-alexei.starovoitov@gmail.com
[ sashal: Ported the may_goto overflow fix into verifier.c, since this tree has no fixups.c, and used the older do_misc_fixups() and is_may_goto_insn() names. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 68 ++++++++++++++++++++++++++++---------------
1 file changed, 44 insertions(+), 24 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 13864488b5a07..407526349ccfa 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -22735,6 +22735,30 @@ static int add_hidden_subprog(struct bpf_verifier_env *env, struct bpf_insn *pat
return 0;
}
+/*
+ * Expand may_goto: load the count from the stack, jump to the target of
+ * may_goto when it is zero, then the tail that updates the count.
+ * Use gotol when the target is too far for 16-bit offset of a conditional jump.
+ */
+static int may_goto_expand(struct bpf_insn *insn_buf, int off, int stack_off,
+ const struct bpf_insn *tail, int tail_cnt)
+{
+ int cnt = 0;
+
+ /* Forward jump has to step over the tail */
+ off = off >= 0 ? off + tail_cnt : off - 1;
+
+ insn_buf[cnt++] = BPF_LDX_MEM(BPF_DW, BPF_REG_AX, BPF_REG_10, stack_off);
+ if (off == (s16)off) {
+ insn_buf[cnt++] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_AX, 0, off);
+ } else {
+ insn_buf[cnt++] = BPF_JMP_IMM(BPF_JNE, BPF_REG_AX, 0, 1);
+ insn_buf[cnt++] = BPF_JMP32_A(off >= 0 ? off : off - 1);
+ }
+ memcpy(insn_buf + cnt, tail, tail_cnt * sizeof(*tail));
+ return cnt + tail_cnt;
+}
+
/* Do various post-verification rewrites in a single program pass.
* These rewrites simplify JIT and interpreter implementations.
*/
@@ -23015,6 +23039,18 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
if (is_may_goto_insn(insn) && bpf_jit_supports_timed_may_goto()) {
int stack_off_cnt = -stack_depth - 16;
+ /*
+ * AX is used as an argument to pass in stack_off_cnt
+ * (to add to r10/fp), and also as the return value of
+ * the call to arch_bpf_timed_may_goto.
+ */
+ struct bpf_insn tail[] = {
+ BPF_ALU64_IMM(BPF_SUB, BPF_REG_AX, 1),
+ BPF_JMP_IMM(BPF_JNE, BPF_REG_AX, 0, 2),
+ BPF_MOV64_IMM(BPF_REG_AX, stack_off_cnt),
+ BPF_EMIT_CALL(arch_bpf_timed_may_goto),
+ BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_AX, stack_off_cnt),
+ };
/*
* Two 8 byte slots, depth-16 stores the count, and
@@ -23031,22 +23067,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
* after subtraction, rinse and repeat.
*/
stack_depth_extra = 16;
- insn_buf[0] = BPF_LDX_MEM(BPF_DW, BPF_REG_AX, BPF_REG_10, stack_off_cnt);
- if (insn->off >= 0)
- insn_buf[1] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_AX, 0, insn->off + 5);
- else
- insn_buf[1] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_AX, 0, insn->off - 1);
- insn_buf[2] = BPF_ALU64_IMM(BPF_SUB, BPF_REG_AX, 1);
- insn_buf[3] = BPF_JMP_IMM(BPF_JNE, BPF_REG_AX, 0, 2);
- /*
- * AX is used as an argument to pass in stack_off_cnt
- * (to add to r10/fp), and also as the return value of
- * the call to arch_bpf_timed_may_goto.
- */
- insn_buf[4] = BPF_MOV64_IMM(BPF_REG_AX, stack_off_cnt);
- insn_buf[5] = BPF_EMIT_CALL(arch_bpf_timed_may_goto);
- insn_buf[6] = BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_AX, stack_off_cnt);
- cnt = 7;
+ cnt = may_goto_expand(insn_buf, insn->off, stack_off_cnt,
+ tail, ARRAY_SIZE(tail));
new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
if (!new_prog)
@@ -23058,16 +23080,14 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
goto next_insn;
} else if (is_may_goto_insn(insn)) {
int stack_off = -stack_depth - 8;
+ struct bpf_insn tail[] = {
+ BPF_ALU64_IMM(BPF_SUB, BPF_REG_AX, 1),
+ BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_AX, stack_off),
+ };
stack_depth_extra = 8;
- insn_buf[0] = BPF_LDX_MEM(BPF_DW, BPF_REG_AX, BPF_REG_10, stack_off);
- if (insn->off >= 0)
- insn_buf[1] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_AX, 0, insn->off + 2);
- else
- insn_buf[1] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_AX, 0, insn->off - 1);
- insn_buf[2] = BPF_ALU64_IMM(BPF_SUB, BPF_REG_AX, 1);
- insn_buf[3] = BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_AX, stack_off);
- cnt = 4;
+ cnt = may_goto_expand(insn_buf, insn->off, stack_off,
+ tail, ARRAY_SIZE(tail));
new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt);
if (!new_prog)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 538/990] bpf: Dont converge a loop on an iterator that was created anew
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (536 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 537/990] bpf: Fix overflow of jump offset in may_goto expansion Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 539/990] bpf: Fix uninit read for non-fetch atomics on partially spilled slots Greg Kroah-Hartman
` (314 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 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 6f3ee3516305da3043f1787e3890381a54151730 ]
When the verifier reaches bpf_iter_*_next() in a state that is equal to
a state that is still being explored it concludes that the loop
converged, since an active iterator will be drained eventually.
states_equal() matches ids through idmap, so the same is concluded for
an iterator that was destroyed and created again since the old state:
bpf_iter_num_new(&it, 0, 10);
loop:
if (bpf_ktime_get_ns())
goto remake;
next:
if (!bpf_iter_num_next(&it))
goto out;
goto loop;
remake:
bpf_iter_num_destroy(&it);
bpf_iter_num_new(&it, 0, 10);
goto next;
Such prog is accepted when the call of bpf_iter_num_next() is the first
prune point after bpf_iter_num_new() and it never returns. Otherwise
it's rejected with "infinite loop detected".
Require the iterator to have the same id in both states.
Fixes: 06accc8779c1 ("bpf: add support for open-coded iterator loops")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260924233130.1213812-8-alexei.starovoitov@gmail.com
[ sashal: Compares ref_obj_id instead of id for iterator identity, since iterators have no id here, and applies the check in is_state_visited() in the old verifier layout with old_frame added to the existing declaration. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 407526349ccfa..2c1afef34070d 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -20072,8 +20072,9 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
*/
if (is_iter_next_insn(env, insn_idx)) {
if (states_equal(env, &sl->state, cur, RANGE_WITHIN)) {
- struct bpf_func_state *cur_frame;
+ struct bpf_func_state *cur_frame, *old_frame;
struct bpf_reg_state *iter_state, *iter_reg;
+ struct bpf_reg_state *old_iter;
int spi;
cur_frame = cur->frame[cur->curframe];
@@ -20087,7 +20088,16 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
*/
spi = __get_spi(iter_reg->off + iter_reg->var_off.value);
iter_state = &func(env, iter_reg)->stack[spi].spilled_ptr;
- if (iter_state->iter.state == BPF_ITER_STATE_ACTIVE) {
+ old_frame = sl->state.frame[iter_reg->frameno];
+ old_iter = &old_frame->stack[spi].spilled_ptr;
+ /*
+ * states_equal() matches ids through idmap.
+ * The loop converged only if it's the same
+ * iterator. The one that was destroyed and
+ * created again starts from the beginning.
+ */
+ if (iter_state->iter.state == BPF_ITER_STATE_ACTIVE &&
+ iter_state->ref_obj_id == old_iter->ref_obj_id) {
loop = true;
goto hit;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 539/990] bpf: Fix uninit read for non-fetch atomics on partially spilled slots
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (537 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 538/990] bpf: Dont converge a loop on an iterator that was created anew Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 540/990] bpf: Fix uninit read for helper mem args " Greg Kroah-Hartman
` (313 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hao Sun, Kumar Kartikeya Dwivedi,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Sun <sunhao.th@gmail.com>
[ Upstream commit 5a84b4424db8ae07f0ac682ab031c37a91dce50b ]
check_stack_read_fixed_off() skips partial spill checks for non-fetch
atomics; the following prog can be loaded:
0: (b7) r1 = 1 ; R1=1
1: (63) *(u32 *)(r10 -8) = r1 ; R1=1 R10=fp0 fp-8=????1
2: (db) lock *(u64 *)(r10 -8) += r1 ; R1=1 R10=fp0 fp-8=mmmmmmmm
3: (79) r0 = *(u64 *)(r10 -8) ; R0=scalar() R10=fp0 fp-8=mmmmmmmm
4: (77) r0 >>= 32 ; R0=scalar(smin=0,smax=umax=0xffffffff,var_off=(0x0; 0xffffffff))
5: (95) exit
When test run:
retval=4294967295
Note fp-8 is ????1 at #1, yet it becomes fp-8=mmmmmmmm after the
non-fetching atomic add at #2; hence the high 32 bits are leaked.
Fix by applying the partial load check; after the patch, the
prog is rejected:
Verification failed: Memory Safety: Uninitialized stack read
Reason:
This rejected read uses 8 bytes at stack offset -8, but byte 4 in that range is uninitialized on
this path. Programs loaded with CAP_PERFMON can be allowed to read uninitialized stack bytes, but
this program is being rejected without that allowance.
At:
...
0 | (b7) r1 = 1
1 | (63) *(u32 *)(r10 -8) = r1
>>> 2 | (db) lock *(u64 *)(r10 -8) += r1
3 | (79) r0 = *(u64 *)(r10 -8)
4 | (77) r0 >>= 32
This affects CAP_BPF only.
Fixes: 354e8f1970f8 ("bpf: Support <8-byte scalar spill and refill")
Signed-off-by: Hao Sun <sunhao.th@gmail.com>
Link: https://lore.kernel.org/bpf/20260924131342.934290-1-sunhao.th@gmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[ sashal: Context lines differ because the target tree has an older subreg_def comment block where upstream has a get_reg_width() check; the patch was applied by hand with identical added and removed lines. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 2c1afef34070d..c8a72c96e227a 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -5508,11 +5508,11 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
return -EACCES;
}
- if (dst_regno < 0)
- return 0;
-
if (size <= spill_size &&
bpf_stack_narrow_access_ok(off, size, spill_size)) {
+ if (dst_regno < 0)
+ return 0;
+
/* The earlier check_reg_arg() has decided the
* subreg_def for this insn. Save it first.
*/
@@ -5548,6 +5548,9 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
return -EACCES;
}
+ if (dst_regno < 0)
+ return 0;
+
if (spill_cnt == size &&
tnum_is_const(reg->var_off) && reg->var_off.value == 0) {
__mark_reg_const_zero(env, &state->regs[dst_regno]);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 540/990] bpf: Fix uninit read for helper mem args on partially spilled slots
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (538 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 539/990] bpf: Fix uninit read for non-fetch atomics on partially spilled slots Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 541/990] fuse: zero the correct range on a short read reply Greg Kroah-Hartman
` (312 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kumar Kartikeya Dwivedi, Hao Sun,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Sun <sunhao.th@gmail.com>
[ Upstream commit b3861495d2b2f7459cddf49e63fa0758ba430583 ]
check_stack_range_initialized() takes the spilled register path when
bpf_is_spilled_reg(ss) holds, which, however, only looks at the last
byte of the slot. Hence, a partially spilled scalar (on the lower part)
bypasses the check and the following loads:
0: (b7) r1 = 1 ; R1=1
1: (63) *(u32 *)(r10 -8) = r1 ; R1=1 R10=fp0 fp-8=????1
2: (18) r1 = 0x0 ; R1=map_ptr(map=rb,ks=0,vs=0)
4: (bf) r2 = r10 ; R2=fp0 R10=fp0
5: (07) r2 += -8 ; R2=fp-8
6: (b7) r3 = 8 ; R3=8
7: (b7) r4 = 0 ; R4=0
8: (85) call bpf_ringbuf_output#130
...
When executed, it dumps the uninit four bytes:
RINGBUF: 01 00 00 00 ff ff ff ff
This is the same root cause as the non-fetch atomic case fixed in
commit 5a84b4424db8 ("bpf: Fix uninit read for non-fetch atomics on
partially spilled slots").
Fix by only taking the spilled register path for the bytes marked
STACK_SPILL, so the rest of the slot goes through the usual checks.
Fixes: 354e8f1970f8 ("bpf: Support <8-byte scalar spill and refill")
Suggested-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Hao Sun <sunhao.th@gmail.com>
Link: https://lore.kernel.org/bpf/20260925082814.1554771-1-sunhao.th@gmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
[ sashal: Context lines differ because the target tree still uses is_spilled_reg() on state->stack[spi] where upstream uses bpf_is_spilled_reg(ss); the patch was applied by hand with identical added and removed lines. ]
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 c8a72c96e227a..23c1401a97bdf 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -8318,7 +8318,12 @@ static int check_stack_range_initialized(
goto mark;
}
- if (is_spilled_reg(&state->stack[spi]) &&
+ /*
+ * Only the bytes marked STACK_SPILL hold the spilled register.
+ * The rest of a narrowly spilled slot keeps its previous type
+ * and must be initialized on its own.
+ */
+ if (*stype == STACK_SPILL &&
(state->stack[spi].spilled_ptr.type == SCALAR_VALUE ||
env->allow_ptr_leaks)) {
if (clobber) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 541/990] fuse: zero the correct range on a short read reply
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (539 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 540/990] bpf: Fix uninit read for helper mem args " Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 542/990] platform/x86/intel/pmt: complete pcidev to device update Greg Kroah-Hartman
` (311 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Kanishka De Silva,
Joanne Koong, Miklos Szeredi, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joanne Koong <joannelkoong@gmail.com>
[ Upstream commit d0a079b5b94bf5e10f1c00bd092eda0333782037 ]
When a read reply is shorter than the requested range, fuse_copy_folio()
zeroes everything in the folio outside the copied bytes. However, for
folios with block sizes smaller than the folio size, this can clear
blocks outside the requested range which are uptodate, or dirty and have
not yet been written back.
Move the zeroing logic into fuse_copy_folios(), since descs[i].length
needs to be used, and clear only the tail of the requested range that
the server did not send.
The range is also no longer cleared upfront in the non
cs->skip_folio_copy case. This is fine since a failed copy leaves those
blocks non-uptodate, so the uncopied bytes are never visible. This also
matches the pre-existing behavior in the non-short-read case (a failed
copy doesn't zero out the range in the folio). This lets the zeroing
logic stay the same regardless of whether the folio copy is skipped or
not.
Fixes: a4c9ab1d4975 ("fuse: use iomap for buffered writes")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Reported-by: Kanishka De Silva <kpskanna1915@gmail.com>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[ sashal: Moved zeroing into fuse_copy_folios() in dev.c, kept fuse_copy_folio() static so the dev.h hunk is dropped, and omitted the skip_folio_copy/folio_zero_segments logic that isn't present here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fuse/dev.c | 32 ++++++++++++++++++++------------
fs/fuse/notify.c | 2 +-
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 0f9ef3ca9824f..56bc4381c2874 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1129,17 +1129,10 @@ static int fuse_ref_folio(struct fuse_copy_state *cs, struct folio *folio,
* done atomically
*/
static int fuse_copy_folio(struct fuse_copy_state *cs, struct folio **foliop,
- unsigned offset, unsigned count, int zeroing)
+ unsigned offset, unsigned count)
{
int err;
struct folio *folio = *foliop;
- size_t size;
-
- if (folio) {
- size = folio_size(folio);
- if (zeroing && count < size)
- folio_zero_range(folio, 0, size);
- }
while (count) {
if (cs->write && cs->pipebufs && folio) {
@@ -1156,7 +1149,7 @@ static int fuse_copy_folio(struct fuse_copy_state *cs, struct folio **foliop,
}
} else if (!cs->len) {
if (cs->move_folios && folio &&
- offset == 0 && count == size) {
+ offset == 0 && count == folio_size(folio)) {
err = fuse_try_move_folio(cs, foliop);
if (err <= 0)
return err;
@@ -1197,10 +1190,25 @@ static int fuse_copy_folios(struct fuse_copy_state *cs, unsigned nbytes,
for (i = 0; i < ap->num_folios && (nbytes || zeroing); i++) {
int err;
+ struct folio *folio = ap->folios[i];
unsigned int offset = ap->descs[i].offset;
- unsigned int count = min(nbytes, ap->descs[i].length);
+ unsigned int length = ap->descs[i].length;
+ unsigned int count = min(nbytes, length);
+
+ /*
+ * The reply may be shorter than what was asked for. The full
+ * descs[i].length is reported as read, so the tail bytes the
+ * server did not send are about to be marked uptodate and need
+ * to be zeroed.
+ *
+ * Only [offset, offset + length) can be touched since the
+ * rest of the folio can hold blocks that are already uptodate
+ * or dirty, and clearing those would lose data.
+ */
+ if (folio && zeroing && count < length)
+ folio_zero_range(folio, offset + count, length - count);
- err = fuse_copy_folio(cs, &ap->folios[i], offset, count, zeroing);
+ err = fuse_copy_folio(cs, &ap->folios[i], offset, count);
if (err)
return err;
@@ -1835,7 +1843,7 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size,
nr_bytes = min_t(unsigned, num, folio_size(folio) - folio_offset);
nr_pages = (offset + nr_bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
- err = fuse_copy_folio(cs, &folio, folio_offset, nr_bytes, 0);
+ err = fuse_copy_folio(cs, &folio, folio_offset, nr_bytes);
if (!folio_test_uptodate(folio) && !err && offset == 0 &&
(nr_bytes == folio_size(folio) || file_size == end)) {
folio_zero_segment(folio, nr_bytes, folio_size(folio));
diff --git a/fs/fuse/notify.c b/fs/fuse/notify.c
index 7cd63502e124b..f21ba27f0f82e 100644
--- a/fs/fuse/notify.c
+++ b/fs/fuse/notify.c
@@ -184,7 +184,7 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size,
folio_offset = offset_in_folio(folio, pos);
nr_bytes = min(num, folio_size(folio) - folio_offset);
- err = fuse_copy_folio(cs, &folio, folio_offset, nr_bytes, 0);
+ err = fuse_copy_folio(cs, &folio, folio_offset, nr_bytes);
if (!folio_test_uptodate(folio) && !err && folio_offset == 0 &&
(nr_bytes == folio_size(folio) || file_size == end)) {
folio_zero_segment(folio, nr_bytes, folio_size(folio));
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 542/990] platform/x86/intel/pmt: complete pcidev to device update
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (540 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 541/990] fuse: zero the correct range on a short read reply Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 543/990] perf machine: Add session back pointer to fix out of bounds read Greg Kroah-Hartman
` (310 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rodrigo Vivi, Michael J. Ruhl,
Ilpo Järvinen, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael J. Ruhl <michael.j.ruhl@intel.com>
[ Upstream commit b86e5062cb881f6e5c1ddb8913c1357a9508f6db ]
The update that moved struct pci_dev usage to struct device is
incomplete. Only telemetry endpoints are covered.
Other PMT features (crashlog) are now blocked from using the callback
mechanism.
Change struct intel_pmt_entry pci_dev member to device.
Update callback usage to use the intel_pmt_entry rather than the
telemetry endpoint.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Fixes: 353042d54d82 ("platform/x86/intel/vsec: Switch exported helpers from pci_dev to device")
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Link: https://patch.msgid.link/20260923181115.2514193-23-michael.j.ruhl@intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
[ sashal: Removed the entry->pcidev = pci_dev; line from the single intel_pmt_populate_entry() here, since this tree lacks upstream's pmt_resolve_access_pci() split, and added entry->dev there. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/platform/x86/intel/pmt/class.c | 4 ++--
drivers/platform/x86/intel/pmt/class.h | 3 +--
drivers/platform/x86/intel/pmt/discovery.c | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c
index 9ec843617e3c9..ebb5071334e5c 100644
--- a/drivers/platform/x86/intel/pmt/class.c
+++ b/drivers/platform/x86/intel/pmt/class.c
@@ -99,7 +99,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,
if (count > entry->size - off)
count = entry->size - off;
- count = pmt_telem_read_mmio(entry->ep->dev, entry->cb, entry->header.guid, buf,
+ count = pmt_telem_read_mmio(entry->dev, entry->cb, entry->header.guid, buf,
entry->base, off, count);
return count;
@@ -283,10 +283,10 @@ static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
return -EINVAL;
}
- entry->pcidev = pci_dev;
entry->guid = header->guid;
entry->size = header->size;
entry->cb = ivdev->priv_data;
+ entry->dev = ivdev->dev;
return 0;
}
diff --git a/drivers/platform/x86/intel/pmt/class.h b/drivers/platform/x86/intel/pmt/class.h
index 1ae56a5baad23..1d66681d14722 100644
--- a/drivers/platform/x86/intel/pmt/class.h
+++ b/drivers/platform/x86/intel/pmt/class.h
@@ -20,7 +20,6 @@
#define GET_ADDRESS(v) ((v) & GENMASK(31, 3))
struct device;
-struct pci_dev;
extern struct class intel_pmt_class;
struct telem_endpoint {
@@ -41,7 +40,7 @@ struct intel_pmt_header {
struct intel_pmt_entry {
struct telem_endpoint *ep;
- struct pci_dev *pcidev;
+ struct device *dev;
struct intel_pmt_header header;
struct bin_attribute pmt_bin_attr;
const struct attribute_group *attr_grp;
diff --git a/drivers/platform/x86/intel/pmt/discovery.c b/drivers/platform/x86/intel/pmt/discovery.c
index c482368bfaaef..f4203d240f542 100644
--- a/drivers/platform/x86/intel/pmt/discovery.c
+++ b/drivers/platform/x86/intel/pmt/discovery.c
@@ -609,7 +609,7 @@ void intel_pmt_get_features(struct intel_pmt_entry *entry)
mutex_lock(&feature_list_lock);
list_for_each_entry(feature, &pmt_feature_list, list) {
- if (feature->priv->parent != entry->ep->dev)
+ if (feature->priv->parent != entry->dev)
continue;
pmt_get_features(entry, feature);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 543/990] perf machine: Add session back pointer to fix out of bounds read
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (541 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 542/990] platform/x86/intel/pmt: complete pcidev to device update Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 544/990] arm64: dts: qcom: x1-asus-vivobook-s15: Mark the EC reset gpio as reserved Greg Kroah-Hartman
` (309 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Arnaldo Carvalho de Melo,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit d227b45fc162ce9134bb96f33f71e6952ec36ea5 ]
thread__e_machine_endian() decides whether a thread is live, and so
whether to read /proc/pid/exe rather than fall back to the perf.data
environment, by recovering the session from the machine:
session = container_of(machine->machines, struct perf_session,
machines);
is_live = !session->data;
That only holds when the struct machines is the one embedded in a struct
perf_session. It is not the only one. aslr_tool keeps its own in struct
aslr_tool, and hists_cumulate, hists_filter, hists_link, hists_output
and thread-maps-share each put one on the stack. For those the
container_of subtracts offsetof(struct perf_session, machines) from an
address that was never inside a session, and the following load of
session->data reads outside the object, which is what ASan reports.
Replace the derivation with an explicit link. machines__init() takes the
owning session, or NULL when the machines is standalone, and
thread__e_machine_endian() reads it back through machines__session().
A NULL session is treated as live. The tests use synthetic pids that
have no /proc entry, so the read fails there and the e_machine falls
back to EM_HOST as before, rather than being decided by whatever the
out of bounds read happened to return. perf inject registers its
session with the aslr tool once the session exists, before any event is
processed, so that tool keeps reporting file based threads as not live.
Fixes: 70351029b556 ("perf thread: Add support for reading the e_machine type for a thread")
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: adapted to machines__init() returning void and dropped the ASLR hunks since that code is absent, so the test callers pass NULL as a plain statement. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/tests/hists_cumulate.c | 2 +-
tools/perf/tests/hists_filter.c | 2 +-
tools/perf/tests/hists_link.c | 2 +-
tools/perf/tests/hists_output.c | 2 +-
tools/perf/tests/thread-maps-share.c | 2 +-
tools/perf/util/machine.c | 3 ++-
tools/perf/util/machine.h | 10 +++++++++-
tools/perf/util/session.c | 2 +-
tools/perf/util/thread.c | 8 +++-----
9 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index 3eb9ef8d7ec63..bdf4ce82612dd 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -724,7 +724,7 @@ static int test__hists_cumulate(struct test_suite *test __maybe_unused, int subt
goto out;
err = TEST_FAIL;
- machines__init(&machines);
+ machines__init(&machines, /*session=*/NULL);
/* setup threads/dso/map/symbols also */
machine = setup_fake_machine(&machines);
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 1cebd20cc91c0..4a1d45ecc03ff 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -131,7 +131,7 @@ static int test__hists_filter(struct test_suite *test __maybe_unused, int subtes
goto out;
err = TEST_FAIL;
- machines__init(&machines);
+ machines__init(&machines, /*session=*/NULL);
/* setup threads/dso/map/symbols also */
machine = setup_fake_machine(&machines);
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 996f5f0b3bd17..0af2ba1ad1aa5 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -303,7 +303,7 @@ static int test__hists_link(struct test_suite *test __maybe_unused, int subtest
goto out;
err = TEST_FAIL;
- machines__init(&machines);
+ machines__init(&machines, /*session=*/NULL);
/* setup threads/dso/map/symbols also */
machine = setup_fake_machine(&machines);
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index ee5ec8bda60e5..a80263ab1d346 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -611,7 +611,7 @@ static int test__hists_output(struct test_suite *test __maybe_unused, int subtes
goto out;
err = TEST_FAIL;
- machines__init(&machines);
+ machines__init(&machines, /*session=*/NULL);
/* setup threads/dso/map/symbols also */
machine = setup_fake_machine(&machines);
diff --git a/tools/perf/tests/thread-maps-share.c b/tools/perf/tests/thread-maps-share.c
index e9ecd30a5c058..cea1f92b5302c 100644
--- a/tools/perf/tests/thread-maps-share.c
+++ b/tools/perf/tests/thread-maps-share.c
@@ -27,7 +27,7 @@ static int test__thread_maps_share(struct test_suite *test __maybe_unused, int s
* other group (pid: 4, tids: 4, 5)
*/
- machines__init(&machines);
+ machines__init(&machines, /*session=*/NULL);
machine = &machines.host;
/* create process with 4 threads */
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 091022e9c867f..0fcbd56746f24 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -229,9 +229,10 @@ void machine__delete(struct machine *machine)
}
}
-void machines__init(struct machines *machines)
+void machines__init(struct machines *machines, struct perf_session *session)
{
machine__init(&machines->host, "", HOST_KERNEL_ID);
+ machines->session = session;
machines->host.machines = machines;
machines->guests = RB_ROOT_CACHED;
}
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 22a42c5825fab..049bbbdfa20d2 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -15,6 +15,7 @@ struct dso;
struct dso_id;
struct evsel;
struct perf_sample;
+struct perf_session;
struct symbol;
struct target;
struct thread;
@@ -148,13 +149,20 @@ int machine__process_event(struct machine *machine, union perf_event *event,
typedef void (*machine__process_t)(struct machine *machine, void *data);
struct machines {
+ /** @session: back link to owning session if there is one. */
+ struct perf_session *session;
struct machine host;
struct rb_root_cached guests;
};
-void machines__init(struct machines *machines);
+void machines__init(struct machines *machines, struct perf_session *session);
void machines__exit(struct machines *machines);
+static inline struct perf_session *machines__session(struct machines *machines)
+{
+ return machines->session;
+}
+
void machines__process_guests(struct machines *machines,
machine__process_t process, void *data);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0eee9d2f59d9a..f737ddb377553 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -152,7 +152,7 @@ struct perf_session *__perf_session__new(struct perf_data *data,
session->decomp_data.zstd_decomp = &session->zstd_data;
session->active_decomp = &session->decomp_data;
INIT_LIST_HEAD(&session->auxtrace_index);
- machines__init(&session->machines);
+ machines__init(&session->machines, session);
ordered_events__init(&session->ordered_events,
ordered_events__deliver_event, NULL);
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index bda001ccf571d..6e22f83ae1e1b 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -513,12 +513,10 @@ uint16_t thread__e_machine(struct thread *thread, struct machine *machine)
bool is_live = machine->machines == NULL;
if (!is_live) {
- /* Check if the session has a data file. */
- struct perf_session *session = container_of(machine->machines,
- struct perf_session,
- machines);
+ /* Check if the session has a data file (assume no session is a test). */
+ struct perf_session *session = machines__session(machine->machines);
- is_live = !session->data;
+ is_live = !session || !session->data;
}
/* Read from /proc/pid/exe if live. */
if (is_live)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 544/990] arm64: dts: qcom: x1-asus-vivobook-s15: Mark the EC reset gpio as reserved
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (542 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 543/990] perf machine: Add session back pointer to fix out of bounds read Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 545/990] wifi: ath12k: fix skb leak on paddr mismatch in wifi7 mon RX pop Greg Kroah-Hartman
` (308 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Abel Vesa, Bjorn Andersson,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <abel.vesa@oss.qualcomm.com>
[ Upstream commit 94a0d3a2595821878de98d495e89691f694a2083 ]
GPIO 65 from TLMM is used by the embedded controller as its reset line.
On some devices, toggling the embedded controller reset line makes the
device not power up at all, unless the battery is unplugged.
So reserve it in order to prevent Linux from requesting or
reconfiguring it.
Fixes: d0e2f8f62dff ("arm64: dts: qcom: Add device tree for ASUS Vivobook S 15")
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Link: https://patch.msgid.link/20260922-dts-qcom-hamoa-reserve-ec-reset-gpio-v3-9-fde7f8a53382@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
[ sashal: Applied the one-line GPIO 65 reservation to the single-file Vivobook S 15 devicetree, since the upstream shared .dtsi file does not exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts b/arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts
index f2960953e608f..7abd519f38a4e 100644
--- a/arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts
+++ b/arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts
@@ -742,6 +742,7 @@ &smb2360_1_eusb2_repeater {
&tlmm {
gpio-reserved-ranges = <34 2>, /* Unused */
<44 4>, /* SPI (TPM) */
+ <65 1>, /* EC reset */
<238 1>; /* UFS Reset */
edp_reg_en: edp-reg-en-state {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 545/990] wifi: ath12k: fix skb leak on paddr mismatch in wifi7 mon RX pop
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (543 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 544/990] arm64: dts: qcom: x1-asus-vivobook-s15: Mark the EC reset gpio as reserved Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 546/990] wifi: ath12k: free pending MSDUs on duplicate mon link descriptor Greg Kroah-Hartman
` (307 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Yang, Baochen Qiang,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit 4dfe8e3ac731c3372b5c1f1f73b0676c301c3916 ]
When rxcb->paddr does not match the MSDU-list paddr reported by
the link descriptor, ath12k_wifi7_dp_rx_mon_mpdu_pop() sets
drop_mpdu = true and continues to the next MSDU. At that point
the skb is still attached to the descriptor via desc_info->skb;
the local msdu variable only holds a copy of that pointer. The
continue skips the rest of the loop body, which would normally
DMA-unmap the buffer, free the skb, clear desc_info->skb, and
append the descriptor to used_list in the next_msdu block.
The descriptor therefore stays in_use with the skb attached
forever. The skb is never DMA-unmapped, delivered, freed or
replaced, and HW does not write into it either because the
descriptor is no longer posted to any SRNG. The descriptor is
also never returned to used_list, so
ath12k_dp_rx_bufs_replenish() cannot allocate a fresh buffer
for it and the RX refill ring gradually drains.
The skb is still reachable via dp->rxbaddr[][].skb and is
reclaimed at teardown by ath12k_dp_cc_cleanup(), so this is not
a kmemleak-style unreachable leak. Nevertheless, both the
descriptor slot and the skb memory are wasted for the module
lifetime, and under sustained mismatches monitor RX stalls.
Remove the continue so drop_mpdu remains true, execution reaches
the DMA unmap and dev_kfree_skb_any() below, and the descriptor
is returned to used_list via the next_msdu block for replenish.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 72bfbf19b7da ("wifi: ath12k: add support to reap and process mon dest ring")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260916060325.854-2-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Renamed the file path from the wifi7 split (wifi7/dp_mon.c, ath12k_wifi7_dp_rx_mon_mpdu_pop) to ath12k/dp_mon.c with ath12k_dp_rx_mon_mpdu_pop; the one-line continue removal itself is unchanged. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_mon.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 3752fa0eed30b..a7cb7ba62f2d4 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -4173,7 +4173,6 @@ ath12k_dp_rx_mon_mpdu_pop(struct ath12k *ar, int mac_id,
i, (unsigned long)rxcb->paddr,
(unsigned long)msdu_list.paddr[i]);
drop_mpdu = true;
- continue;
}
if (!rxcb->unmapped) {
dma_unmap_single(ar->ab->dev, rxcb->paddr,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 546/990] wifi: ath12k: free pending MSDUs on duplicate mon link descriptor
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (544 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 545/990] wifi: ath12k: fix skb leak on paddr mismatch in wifi7 mon RX pop Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 547/990] wifi: ath12k: fix stale tail_msdu pointer returned from mpdu_pop Greg Kroah-Hartman
` (306 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Yang, Baochen Qiang,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit d8e8eac3fcffc114a79f7d07d7cb73cc16645381 ]
ath12k_wifi7_dp_rx_mon_mpdu_pop() aborts processing when a duplicate
monitor link descriptor is detected.
Previous iterations may already have linked MSDUs onto *head_msdu
and detached the corresponding RX buffers from their descriptors.
Returning without completing or freeing the chain leaves those
skbs orphaned, resulting in a memory leak.
kmemleak reports these skbs in field testing:
kmemleak_alloc()
__netdev_alloc_skb()
ath12k_dp_rx_bufs_replenish()
ath12k_wifi7_dp_rx_mon_dest_process()
Free the accumulated MSDU chain before returning and clear
*head_msdu so callers observe a consistent state.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 72bfbf19b7da ("wifi: ath12k: add support to reap and process mon dest ring")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260916060325.854-3-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Applied to the pre-split monitor RX file with the function name ath12k_dp_rx_mon_mpdu_pop() instead of the wifi7 path and name; the two-line change itself is identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_mon.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index a7cb7ba62f2d4..0e9b02f1140fc 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -4130,6 +4130,8 @@ ath12k_dp_rx_mon_mpdu_pop(struct ath12k *ar, int mac_id,
if (pmon->mon_last_linkdesc_paddr == paddr) {
pmon->rx_mon_stats.dup_mon_linkdesc_cnt++;
spin_unlock_bh(&pmon->mon_lock);
+ kfree_skb_list(*head_msdu);
+ *head_msdu = NULL;
return rx_bufs_used;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 547/990] wifi: ath12k: fix stale tail_msdu pointer returned from mpdu_pop
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (545 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 546/990] wifi: ath12k: free pending MSDUs on duplicate mon link descriptor Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 548/990] wifi: ath12k: place dp_mon_mpdu on stack in mon dst reap loop Greg Kroah-Hartman
` (305 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Yang, Baochen Qiang,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit 1a10a558555072dba8510ded23a9174b2a00d079 ]
ath12k_wifi7_dp_rx_mon_mpdu_pop() assigns *tail_msdu from the loop
cursor msdu at function exit. That cursor reflects the state of the
last msdu_list entry processed, not the end of the accumulated MSDU
chain: on next_msdu paths (invalid skb, drop_mpdu, first-MSDU rx_desc
invalid) it is set to NULL, and on the set_pktlen failure path it
becomes a dangling pointer to a freed skb. When these occur on the
final iteration, callers see head_msdu populated with a valid chain
while tail_msdu is NULL or points to freed memory.
The chain end is already tracked by the local variable last, which is
updated only after each MSDU has been validated and linked. Use it as
the source for tail_msdu so head_msdu and tail_msdu are either both
NULL or both point into the same live chain.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 72bfbf19b7da ("wifi: ath12k: add support to reap and process mon dest ring")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260916060325.854-4-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Applied the one-line change to the pre-split dp_mon.c, using the old function name, since the wifi7 split of ath12k does not exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_mon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 0e9b02f1140fc..a9ba30c330833 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -4254,7 +4254,7 @@ ath12k_dp_rx_mon_mpdu_pop(struct ath12k *ar, int mac_id,
if (last)
last->next = NULL;
- *tail_msdu = msdu;
+ *tail_msdu = last;
if (msdu_cnt == 0)
*npackets = 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 548/990] wifi: ath12k: place dp_mon_mpdu on stack in mon dst reap loop
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (546 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 547/990] wifi: ath12k: fix stale tail_msdu pointer returned from mpdu_pop Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 549/990] wifi: ath12k: fix skb leak on monitor PPDU ID wraparound Greg Kroah-Hartman
` (304 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Yang, Baochen Qiang,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit 8b1d2f4c3805b9f1bddd5dc3bd241edd1f9ab2d9 ]
ath12k_wifi7_dp_rx_mon_dest_process() allocates a dp_mon_mpdu with
kzalloc(GFP_ATOMIC) for each delivered MPDU. On allocation failure
it breaks out of the reap loop without calling
ath12k_hal_srng_dst_get_next_entry(), leaving the destination ring
tail pointer parked on the current entry -- the same entry will
be peek()ed on every subsequent NAPI schedule, stalling monitor
RX until the mon_dest_ring_stuck_cnt recovery path resyncs the
PPDU ID. The head_msdu chain accumulated for this iteration is
also orphaned since the break bypasses both the delivery and
the cleanup paths.
kmemleak reports these skbs in field testing:
kmemleak_alloc()
__netdev_alloc_skb()
ath12k_dp_rx_bufs_replenish()
ath12k_wifi7_dp_rx_mon_dest_process()
dp_mon_mpdu is used only within a single reap loop iteration and
is passed synchronously to ath12k_wifi7_dp_mon_rx_deliver(); the
callee does not retain the pointer. Place it on the stack instead
of using kzalloc(GFP_ATOMIC). This eliminates the allocation
failure path (and the ring stall it caused) and saves a
kzalloc/kfree pair per delivered MPDU.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 72bfbf19b7da ("wifi: ath12k: add support to reap and process mon dest ring")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260916060325.854-5-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Replaced the kzalloc'd dp_mon_mpdu with a stack variable, adapted to the pre-wifi7-split file path and function names (ath12k_dp_mon_rx_deliver(ar, ...)). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_mon.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index a9ba30c330833..cfd9ea83887aa 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -4278,7 +4278,6 @@ static void ath12k_dp_rx_mon_dest_process(struct ath12k *ar, int mac_id,
struct ath12k_dp *dp = &ar->ab->dp;
struct ath12k_base *ab = ar->ab;
void *ring_entry, *mon_dst_srng;
- struct dp_mon_mpdu *tmp_mpdu;
LIST_HEAD(rx_desc_used_list);
struct hal_srng *srng;
@@ -4341,18 +4340,16 @@ static void ath12k_dp_rx_mon_dest_process(struct ath12k *ar, int mac_id,
}
if (head_msdu && tail_msdu) {
- tmp_mpdu = kzalloc(sizeof(*tmp_mpdu), GFP_ATOMIC);
- if (!tmp_mpdu)
- break;
-
- tmp_mpdu->head = head_msdu;
- tmp_mpdu->tail = tail_msdu;
- tmp_mpdu->err_bitmap = pmon->err_bitmap;
- tmp_mpdu->decap_format = pmon->decap_format;
- ath12k_dp_mon_rx_deliver(ar, tmp_mpdu,
+ struct dp_mon_mpdu tmp_mpdu = {
+ .head = head_msdu,
+ .tail = tail_msdu,
+ .err_bitmap = pmon->err_bitmap,
+ .decap_format = pmon->decap_format,
+ };
+
+ ath12k_dp_mon_rx_deliver(ar, &tmp_mpdu,
&pmon->mon_ppdu_info, napi);
rx_mon_stats->dest_mpdu_done++;
- kfree(tmp_mpdu);
}
ring_entry = ath12k_hal_srng_dst_get_next_entry(ar->ab,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 549/990] wifi: ath12k: fix skb leak on monitor PPDU ID wraparound
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (547 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 548/990] wifi: ath12k: place dp_mon_mpdu on stack in mon dst reap loop Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 550/990] wifi: ath12k: fix out-of-bounds access on TX stats arrays Greg Kroah-Hartman
` (303 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kang Yang, Baochen Qiang,
Vasanthakumar Thiagarajan, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <kang.yang@oss.qualcomm.com>
[ Upstream commit 97b144b82e2388efef1f78269626d61de0480feb ]
ath12k_dp_mon_comp_ppduid() updates *ppdu_id and returns
msdu_ppdu_id to indicate that a PPDU transition was detected.
When PPDU IDs wrap around, msdu_ppdu_id can be 0. In that case
the function updates *ppdu_id but returns 0, causing
ath12k_wifi7_dp_rx_mon_mpdu_pop() to interpret the result as
"no PPDU update" and continue processing the MPDU.
The MSDUs are then linked into head_msdu while their RX
descriptors have already been detached. Later,
ath12k_wifi7_dp_rx_mon_dest_process() detects the PPDU
mismatch and exits with the partially built MSDU chain,
leaking the SKBs.
kmemleak reports the leak through:
kmemleak_alloc()
__netdev_alloc_skb()
ath12k_dp_rx_bufs_replenish()
ath12k_wifi7_dp_rx_mon_dest_process()
Fix this by returning a boolean value from
ath12k_dp_mon_comp_ppduid() so the update notification is
independent of the actual PPDU ID value.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
Fixes: 72bfbf19b7da ("wifi: ath12k: add support to reap and process mon dest ring")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20260916060325.854-6-kang.yang@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Kept the function static in dp_mon.c and dropped the header hunk, since this tree has no prototype; only the return type changed to bool. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_mon.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index cfd9ea83887aa..2cb4e0bb0221a 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -1860,24 +1860,23 @@ ath12k_dp_rx_mon_buf_done(struct ath12k_base *ab, struct hal_srng *srng,
return DP_MON_STATUS_REPLINISH;
}
-static u32 ath12k_dp_mon_comp_ppduid(u32 msdu_ppdu_id, u32 *ppdu_id)
+static bool ath12k_dp_mon_comp_ppduid(u32 msdu_ppdu_id, u32 *ppdu_id)
{
- u32 ret = 0;
-
if ((*ppdu_id < msdu_ppdu_id) &&
((msdu_ppdu_id - *ppdu_id) < DP_NOT_PPDU_ID_WRAP_AROUND)) {
/* Hold on mon dest ring, and reap mon status ring. */
*ppdu_id = msdu_ppdu_id;
- ret = msdu_ppdu_id;
- } else if ((*ppdu_id > msdu_ppdu_id) &&
- ((*ppdu_id - msdu_ppdu_id) > DP_NOT_PPDU_ID_WRAP_AROUND)) {
+ return true;
+ }
+ if ((*ppdu_id > msdu_ppdu_id) &&
+ ((*ppdu_id - msdu_ppdu_id) > DP_NOT_PPDU_ID_WRAP_AROUND)) {
/* PPDU ID has exceeded the maximum value and will
* restart from 0.
*/
*ppdu_id = msdu_ppdu_id;
- ret = msdu_ppdu_id;
+ return true;
}
- return ret;
+ return false;
}
static
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 550/990] wifi: ath12k: fix out-of-bounds access on TX stats arrays
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (548 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 549/990] wifi: ath12k: fix skb leak on monitor PPDU ID wraparound Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 551/990] ACPI: PCC: Free channel on OpRegion deactivation Greg Kroah-Hartman
` (302 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pardeep Kaur, Rameshkumar Sundaram,
Baochen Qiang, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pardeep Kaur <pardeep.kaur@oss.qualcomm.com>
[ Upstream commit c8f83d3389d1d1b318ac3bd2ae3d60c2862c90b4 ]
The fw_tx_status[], tx_wbm_rel_source[], and tqm_rel_reason[] arrays
are indexed directly by values read from hardware without bounds checks.
Values at or beyond MAX_FW_TX_STATUS, HAL_WBM_REL_SRC_MODULE_MAX, or
MAX_TQM_RELEASE_REASON respectively would write past the end of the
arrays causing memory corruption.
Add likely() bounds checks before incrementing each counter. For
tx_wbm_rel_source[] and tqm_rel_reason[], add WARN_ON_ONCE() on the
out-of-bounds else branch. For fw_tx_status[], no WARN_ON_ONCE is added
since the switch statement that follows already calls ath12k_warn() in
its default: branch for unknown values, avoiding a double-warn.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6.r1-00402-QCAHKSWPL_SILICONZ-1
Fixes: c5c62287e690 ("wifi: ath12k: Add device dp stats support")
Signed-off-by: Pardeep Kaur <pardeep.kaur@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20260819053247.1420393-2-pardeep.kaur@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Applied the same three bounds checks to the pre-wifi7-split dp_tx.c and used ab->device_stats instead of dp->device_stats. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/dp_tx.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c
index 92bb9fc420264..ed8c82346608b 100644
--- a/drivers/net/wireless/ath/ath12k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_tx.c
@@ -667,7 +667,8 @@ ath12k_dp_tx_process_htt_tx_complete(struct ath12k_base *ab, void *desc,
wbm_status = le32_get_bits(status_desc->info0,
HTT_TX_WBM_COMP_INFO0_STATUS);
- ab->device_stats.fw_tx_status[wbm_status]++;
+ if (likely(wbm_status < MAX_FW_TX_STATUS))
+ ab->device_stats.fw_tx_status[wbm_status]++;
switch (wbm_status) {
case HAL_WBM_REL_HTT_TX_COMP_STATUS_OK:
@@ -1071,11 +1072,17 @@ void ath12k_dp_tx_completion_handler(struct ath12k_base *ab, int ring_id)
/* Find the HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE value */
buf_rel_source = le32_get_bits(tx_status->info0,
HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE);
- ab->device_stats.tx_wbm_rel_source[buf_rel_source]++;
+ if (likely(buf_rel_source < HAL_WBM_REL_SRC_MODULE_MAX))
+ ab->device_stats.tx_wbm_rel_source[buf_rel_source]++;
+ else
+ WARN_ON_ONCE(1);
rel_status = le32_get_bits(tx_status->info0,
HAL_WBM_COMPL_TX_INFO0_TQM_RELEASE_REASON);
- ab->device_stats.tqm_rel_reason[rel_status]++;
+ if (likely(rel_status < MAX_TQM_RELEASE_REASON))
+ ab->device_stats.tqm_rel_reason[rel_status]++;
+ else
+ WARN_ON_ONCE(1);
/* Release descriptor as soon as extracting necessary info
* to reduce contention
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 551/990] ACPI: PCC: Free channel on OpRegion deactivation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (549 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 550/990] wifi: ath12k: fix out-of-bounds access on TX stats arrays Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 552/990] arm64: dts: qcom: lemans-evk: fix SerDes PHY regulator supplies Greg Kroah-Hartman
` (301 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Huisong Li, Sudeep Holla,
Rafael J. Wysocki, 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 fa9c7ee692988edddc1da74bc5257d53dd3c7130 ]
ACPICA calls the address space setup callback with
ACPI_REGION_DEACTIVATE when a PCC OperationRegion is torn down.
The PCC setup callback currently allocates a fresh pcc_data and requests
the mailbox channel before looking at the function argument. If ACPICA
deactivates a region, this can leave the existing region context and
mailbox channel unreleased, and may also request a channel during
teardown.
Handle ACPI_REGION_DEACTIVATE before allocation. Free the PCC mailbox
channel, release the region context and clear the context pointer.
Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype")
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Link: https://patch.msgid.link/20260922144302.3847593-4-sudeep.holla@kernel.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ sashal: kept the existing kzalloc(sizeof(*data), GFP_KERNEL) allocation line instead of upstream's kzalloc_obj(*data), which only affected the surrounding context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/acpi_pcc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
index 683924a708ba0..04bb232603965 100644
--- a/drivers/acpi/acpi_pcc.c
+++ b/drivers/acpi/acpi_pcc.c
@@ -55,6 +55,19 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
struct pcc_mbox_chan *pcc_chan;
acpi_status ret;
+ if (function == ACPI_REGION_DEACTIVATE) {
+ data = *region_context;
+ if (data) {
+ pcc_mbox_free_channel(data->pcc_chan);
+ kfree(data);
+ *region_context = NULL;
+ }
+ return AE_OK;
+ }
+
+ if (function != ACPI_REGION_ACTIVATE)
+ return AE_BAD_PARAMETER;
+
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return AE_NO_MEMORY;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 552/990] arm64: dts: qcom: lemans-evk: fix SerDes PHY regulator supplies
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (550 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 551/990] ACPI: PCC: Free channel on OpRegion deactivation Greg Kroah-Hartman
@ 2026-11-25 14:31 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 553/990] bpf: Rebase the exception callback subprog when dead subprogs are removed Greg Kroah-Hartman
` (300 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:31 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mohd Ayaan Anwar,
Bartosz Golaszewski, Manivannan Sadhasivam, Bjorn Andersson,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
[ Upstream commit 457cf65a7997e398d8d6cef08601b4ea61b58e38 ]
The SerDes PHY nodes were configured with 'phy-supply = <&vreg_l5a>',
which was incorrect on two counts: vreg_l5a is not a supply the PHY
requires, and only one rail was described whereas the hardware needs
two.
The PHY requires vdda-0p9 (vreg_l4a) and vdda-1p2 (vreg_l1c). Replace
the incorrect phy-supply with these two named properties on both the
base EVK node and the IFP mezzanine overlay.
Fixes: 71ee90ed1756 ("arm64: dts: qcom: lemans-evk: Enable 2.5G Ethernet interface")
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260804-b4-sgmiieth_serdes_regulator-v2-3-c4bc688177dd@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
[ sashal: dropped the lemans-evk-ifp-mezzanine.dtso hunk (&serdes1) because that overlay file doesn't exist in this tree; the &serdes0 hunk in lemans-evk.dts applies with adjusted context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm64/boot/dts/qcom/lemans-evk.dts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/lemans-evk.dts b/arch/arm64/boot/dts/qcom/lemans-evk.dts
index c7dc9b8f44578..5cac85b782d6e 100644
--- a/arch/arm64/boot/dts/qcom/lemans-evk.dts
+++ b/arch/arm64/boot/dts/qcom/lemans-evk.dts
@@ -646,7 +646,8 @@ &sdhc {
};
&serdes0 {
- phy-supply = <&vreg_l5a>;
+ vdda-0p9-supply = <&vreg_l4a>;
+ vdda-1p2-supply = <&vreg_l1c>;
status = "okay";
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 553/990] bpf: Rebase the exception callback subprog when dead subprogs are removed
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (551 preceding siblings ...)
2026-11-25 14:31 ` [PATCH 6.18 552/990] arm64: dts: qcom: lemans-evk: fix SerDes PHY regulator supplies Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 554/990] tools/nolibc: fix readdir_r() with 64-bit directory offsets Greg Kroah-Hartman
` (299 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Daniel Borkmann, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <daniel@iogearbox.net>
[ Upstream commit 8608ec8e981974b18834e2d67ed39638a9ec2e63 ]
adjust_subprog_starts_after_remove() compacts subprog_info[] and the
func_info when whole subprograms are removed as dead code, but leaves
env->exception_callback_subprog alone, so an exception callback declared
through the exception_callback decl tag which sits behind a removed
subprogram keeps its old index. jit_subprogs() then takes the exception
callback from func[] at that index, which is past the end when the
callback was the last subprogram, or another subprogram otherwise.
Rebase the index along with the entries it refers to.
Fixes: b9ae0c9dd0ac ("bpf: Add support for custom exception callbacks")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260925175244.1136329-4-daniel@iogearbox.net
[ sashal: Applied the fix to the same function in kernel/bpf/verifier.c, since this tree predates the split into fixups.c; the three added lines and surrounding context are otherwise identical. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 23c1401a97bdf..b664c160b9277 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -21608,6 +21608,9 @@ static int adjust_subprog_starts_after_remove(struct bpf_verifier_env *env,
* in adjust_btf_func() - no need to adjust
*/
}
+ /* The exception callback is live, so it cannot sit inside the removed range. */
+ if (env->exception_callback_subprog >= j)
+ env->exception_callback_subprog -= j - i;
} else {
/* convert i from "first prog to remove" to "first to adjust" */
if (env->subprog_info[i].start == off)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 554/990] tools/nolibc: fix readdir_r() with 64-bit directory offsets
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (552 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 553/990] bpf: Rebase the exception callback subprog when dead subprogs are removed Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 555/990] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access Greg Kroah-Hartman
` (298 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Danish Khateeb,
Thomas Weißschuh, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danish Khateeb <danishkhateeb03@gmail.com>
[ Upstream commit 00c81514ad49110574e4b9bdbc448551004161f2 ]
readdir_r() stores the result of _sys_lseek() in an int. Directory
offsets are opaque cookies which can use all 64 bits: ext4, for
instance, gives 64-bit processes 63-bit hashes, and
0x7fffffffffffffff as the offset after the last entry. Truncated to an
int, such an offset is negative about half the time, and readdir_r()
takes it for an error.
Since commit 4ada5679f18d ("tools/nolibc/dirent: avoid errno in
readdir_r"), readdir_r() fails at the first entry whose offset has
bit 31 set, which on ext4 is usually one of the first few, and returns
the truncated offset as the error number. Before that, only -1 counted
as an error, which the last entry always hits: readdir_r() then
returned errno, usually 0, without filling in the entry, so the caller
got the previous entry a second time and never saw the last one.
32-bit processes get 31-bit hashes from ext4 and are not affected.
Keep the offset in an off_t.
Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access")
Assisted-by: LLM
Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
Link: https://patch.msgid.link/20260925211600.119116-2-danishkhateeb03@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
[ sashal: Renamed _sys_lseek() to sys_lseek() in the readdir_r() hunk, since this tree still uses the older helper name. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/include/nolibc/dirent.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/include/nolibc/dirent.h b/tools/include/nolibc/dirent.h
index 61a122a60327d..be0eaefea7a41 100644
--- a/tools/include/nolibc/dirent.h
+++ b/tools/include/nolibc/dirent.h
@@ -67,6 +67,7 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
struct linux_dirent64 *ldir = (void *)buf;
intptr_t i = (intptr_t)dirp;
int fd, ret;
+ off_t off;
if (i >= 0)
return EBADF;
@@ -86,9 +87,9 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
* readdir() can only return one entry at a time.
* Make sure the non-returned ones are not skipped.
*/
- ret = sys_lseek(fd, ldir->d_off, SEEK_SET);
- if (ret < 0)
- return -ret;
+ off = sys_lseek(fd, ldir->d_off, SEEK_SET);
+ if (off < 0)
+ return -off;
entry->d_ino = ldir->d_ino;
/* the destination should always be big enough */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 555/990] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (553 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 554/990] tools/nolibc: fix readdir_r() with 64-bit directory offsets Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 556/990] RDMA/mlx5: Set QP event handler before firmware QPC insertion Greg Kroah-Hartman
` (297 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yishai Hadas, Leon Romanovsky,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <yishaih@nvidia.com>
[ Upstream commit 89abac4b60b708037595255ea2614b6967c86ee5 ]
pvrdma embeds a pvrdma_ring_state header directly inside the QP and SRQ
ring buffers, and the hypervisor writes cons_head into that header.
Pinning with access=0 does not force a private page copy (no
FOLL_WRITE), so the hypervisor may write into a shared page.
Pass IB_ACCESS_LOCAL_WRITE for all three rings. The SRQ ring_state is
not currently used by the driver but is pinned writable for consistency.
Fixes: 29c8d9eba550 ("IB: Add vmw_pvrdma driver")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://patch.msgid.link/20260915140933.40580-4-yishaih@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Replaced ib_umem_get_va() calls with the older ib_umem_get() name while changing the access argument from 0 to IB_ACCESS_LOCAL_WRITE. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 6 ++++--
drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
index 98b2a0090bf2a..3017a4080235d 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
@@ -270,7 +270,8 @@ int pvrdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
/* set qp->sq.wqe_cnt, shift, buf_size.. */
qp->rumem = ib_umem_get(ibqp->device,
ucmd.rbuf_addr,
- ucmd.rbuf_size, 0);
+ ucmd.rbuf_size,
+ IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(qp->rumem)) {
ret = PTR_ERR(qp->rumem);
goto err_qp;
@@ -282,7 +283,8 @@ int pvrdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
}
qp->sumem = ib_umem_get(ibqp->device, ucmd.sbuf_addr,
- ucmd.sbuf_size, 0);
+ ucmd.sbuf_size,
+ IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(qp->sumem)) {
if (!is_srq)
ib_umem_release(qp->rumem);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
index bdc2703532c6c..99748f0f296dd 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
@@ -146,7 +146,8 @@ int pvrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
goto err_srq;
}
- srq->umem = ib_umem_get(ibsrq->device, ucmd.buf_addr, ucmd.buf_size, 0);
+ srq->umem = ib_umem_get(ibsrq->device, ucmd.buf_addr, ucmd.buf_size,
+ IB_ACCESS_LOCAL_WRITE);
if (IS_ERR(srq->umem)) {
ret = PTR_ERR(srq->umem);
goto err_srq;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 556/990] RDMA/mlx5: Set QP event handler before firmware QPC insertion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (554 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 555/990] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 557/990] RDMA/bnxt_re: Serialize dcb_wq access against async notifier Greg Kroah-Hartman
` (296 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Yishai Hadas, Leon Romanovsky,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <yishaih@nvidia.com>
[ Upstream commit 05a078c97eb0bb7158526dae414b853737692485 ]
Four QP creation paths assigned base->container_mibqp and
base->mqp.event after the firmware create call that inserts the QP into
dev->qp_table.tree. A firmware error EQE in that window reaches
qp->event() with a NULL pointer.
Move both assignments before the firmware call.
Also set ibqp.qp_num inside mlx5_qpc_create_qp() before
create_resource_common() so an EQE arriving early does not observe
qp_num==0.
In addition, add a WARN_ON_ONCE(!qp->event) guard in
rsc_event_notifier() as a safeguard for future regressions.
Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://patch.msgid.link/20260915140933.40580-14-yishaih@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Moved the base->container_mibqp and mqp.event assignments ahead of the firmware QP creation call, with context adjusted for the older base (no attrs argument in create_raw_packet_qp_sq()). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/mlx5/qp.c | 22 ++++++++++------------
drivers/infiniband/hw/mlx5/qpc.c | 10 ++++++++++
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 865000d1a2c52..5a6aede3f138a 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1599,6 +1599,8 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
if (err)
return err;
+ sq->base.container_mibqp = qp;
+ sq->base.mqp.event = mlx5_ib_qp_event;
err = create_raw_packet_qp_sq(dev, udata, sq, in, pd,
to_mcq(init_attr->send_cq));
if (err)
@@ -1610,9 +1612,6 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
resp->sqn = sq->base.mqp.qpn;
resp->comp_mask |= MLX5_IB_CREATE_QP_RESP_MASK_SQN;
}
-
- sq->base.container_mibqp = qp;
- sq->base.mqp.event = mlx5_ib_qp_event;
}
if (qp->rq.wqe_cnt) {
@@ -2062,13 +2061,13 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
}
base = &qp->trans_qp.base;
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
kvfree(in);
if (err)
return err;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
if (MLX5_CAP_GEN(mdev, ece_support))
params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
@@ -2206,14 +2205,14 @@ static int create_dci(struct mlx5_ib_dev *dev, struct ib_pd *pd,
qp->flags &= ~IB_QP_CREATE_PCI_WRITE_END_PADDING;
}
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
kvfree(in);
if (err)
goto err_create;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
if (MLX5_CAP_GEN(mdev, ece_support))
params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
@@ -2402,6 +2401,8 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
qp->flags &= ~IB_QP_CREATE_PCI_WRITE_END_PADDING;
}
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
if (init_attr->qp_type == IB_QPT_RAW_PACKET ||
qp->flags & IB_QP_CREATE_SOURCE_QPN) {
qp->raw_packet_qp.sq.ubuffer.buf_addr = ucmd->sq_buf_addr;
@@ -2415,8 +2416,6 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
if (err)
goto err_create;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
if (MLX5_CAP_GEN(mdev, ece_support))
params->resp.ece_options = MLX5_GET(create_qp_out, out, ece);
@@ -2545,14 +2544,13 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
MLX5_CAP_GEN(mdev, go_back_n))
MLX5_SET(qpc, qpc, retry_mode, MLX5_QP_RM_GO_BACK_N);
+ base->container_mibqp = qp;
+ base->mqp.event = mlx5_ib_qp_event;
err = mlx5_qpc_create_qp(dev, &base->mqp, in, inlen, out);
kvfree(in);
if (err)
goto err_create;
- base->container_mibqp = qp;
- base->mqp.event = mlx5_ib_qp_event;
-
get_cqs(qp->type, attr->send_cq, attr->recv_cq,
&send_cq, &recv_cq);
spin_lock_irqsave(&dev->reset_flow_resource_lock, flags);
diff --git a/drivers/infiniband/hw/mlx5/qpc.c b/drivers/infiniband/hw/mlx5/qpc.c
index 67ed45f3ae17f..9272e1ef81135 100644
--- a/drivers/infiniband/hw/mlx5/qpc.c
+++ b/drivers/infiniband/hw/mlx5/qpc.c
@@ -146,6 +146,8 @@ static int rsc_event_notifier(struct notifier_block *nb,
case MLX5_RES_RQ:
case MLX5_RES_SQ:
qp = (struct mlx5_core_qp *)common;
+ if (WARN_ON_ONCE(!qp->event))
+ goto out;
qp->event(qp, event_type);
/* Need to put resource in event handler */
return NOTIFY_OK;
@@ -258,6 +260,14 @@ int mlx5_qpc_create_qp(struct mlx5_ib_dev *dev, struct mlx5_core_qp *qp,
qp->uid = MLX5_GET(create_qp_in, in, uid);
qp->qpn = MLX5_GET(create_qp_out, out, qpn);
+ /* Set ibqp.qp_num before create_resource_common() inserts the QP into
+ * the radix tree and makes it visible to EQE processing. The
+ * assignment in create_qp() happens only after this function returns,
+ * leaving a window where an arriving EQE would observe qp_num == 0.
+ * create_qp() still overrides this with 0/1 for QP0/QP1, and sets it
+ * independently for DCT (which does not go through this function).
+ */
+ to_mibqp(qp)->ibqp.qp_num = qp->qpn;
err = create_resource_common(dev, qp, MLX5_RES_QP);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 557/990] RDMA/bnxt_re: Serialize dcb_wq access against async notifier
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (555 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 556/990] RDMA/mlx5: Set QP event handler before firmware QPC insertion Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 558/990] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub Greg Kroah-Hartman
` (295 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Selvin Xavier, Leon Romanovsky,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <selvin.xavier@broadcom.com>
[ Upstream commit 81caf9240dfb082c0eb2b24feef8266268fd152f ]
bnxt_re_async_notifier() runs in NAPI/softirq context via bnxt_en's
RCU-protected ULP ops dispatch, never under rtnl_lock, so it isn't
serialized against bnxt_re_uninit_dcb_wq() destroying rdev->dcb_wq.
A concurrent notifier call can queue_work() on a workqueue that is
being, or has just been, destroyed.
Add a spinlock scoped to dcb_wq: the notifier takes it before
checking dcb_wq and queuing work, and bnxt_re_uninit_dcb_wq() takes
it to atomically clear dcb_wq before destroying it. Initialize the
lock at rdev allocation so it is valid on every teardown path,
including bnxt_re_dev_init()'s early failure labels.
Fixes: 51dc5312dcd9 ("RDMA/bnxt_re: Add support to handle DCB_CONFIG_CHANGE event")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Used the branch's kzalloc(sizeof(*dcb_work), GFP_ATOMIC) in place of upstream's kzalloc_obj(*dcb_work, GFP_ATOMIC) in the DCB_CONFIG_CHANGE notifier, to fit the surrounding code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 4 ++++
drivers/infiniband/hw/bnxt_re/main.c | 24 ++++++++++++++++++++----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
index 3485e495ac6aa..ce3a1fd8aa830 100644
--- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
+++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
@@ -222,6 +222,10 @@ struct bnxt_re_dev {
unsigned long event_bitmap;
struct bnxt_qplib_cc_param cc_param;
struct workqueue_struct *dcb_wq;
+ /* Protects dcb_wq against bnxt_re_uninit_dcb_wq() destroying it
+ * concurrently with bnxt_re_async_notifier() queuing work on it.
+ */
+ spinlock_t dcb_lock;
struct dentry *cc_config;
struct bnxt_re_dbg_cc_config_params *cc_config_params;
#define BNXT_VPD_FLD_LEN 32
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index e8a4befd6ca01..690b261b581a5 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -367,9 +367,15 @@ static int bnxt_re_init_dcb_wq(struct bnxt_re_dev *rdev)
static void bnxt_re_uninit_dcb_wq(struct bnxt_re_dev *rdev)
{
- if (!rdev->dcb_wq)
- return;
- destroy_workqueue(rdev->dcb_wq);
+ struct workqueue_struct *dcb_wq;
+
+ spin_lock_bh(&rdev->dcb_lock);
+ dcb_wq = rdev->dcb_wq;
+ rdev->dcb_wq = NULL;
+ spin_unlock_bh(&rdev->dcb_lock);
+
+ if (dcb_wq)
+ destroy_workqueue(dcb_wq);
}
static void bnxt_re_dcb_wq_task(struct work_struct *work)
@@ -424,14 +430,23 @@ static void bnxt_re_async_notifier(void *handle, struct hwrm_async_event_cmpl *c
switch (event_id) {
case ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE:
+ spin_lock(&rdev->dcb_lock);
+ if (!rdev->dcb_wq) {
+ spin_unlock(&rdev->dcb_lock);
+ break;
+ }
+
dcb_work = kzalloc(sizeof(*dcb_work), GFP_ATOMIC);
- if (!dcb_work)
+ if (!dcb_work) {
+ spin_unlock(&rdev->dcb_lock);
break;
+ }
dcb_work->rdev = rdev;
memcpy(&dcb_work->cmpl, cmpl, sizeof(*cmpl));
INIT_WORK(&dcb_work->work, bnxt_re_dcb_wq_task);
queue_work(rdev->dcb_wq, &dcb_work->work);
+ spin_unlock(&rdev->dcb_lock);
break;
default:
break;
@@ -1446,6 +1461,7 @@ static struct bnxt_re_dev *bnxt_re_dev_add(struct auxiliary_device *adev,
INIT_LIST_HEAD(&rdev->qp_list);
mutex_init(&rdev->qp_lock);
mutex_init(&rdev->pacing.dbq_lock);
+ spin_lock_init(&rdev->dcb_lock);
atomic_set(&rdev->stats.res.qp_count, 0);
atomic_set(&rdev->stats.res.cq_count, 0);
atomic_set(&rdev->stats.res.srq_count, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 558/990] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (556 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 557/990] RDMA/bnxt_re: Serialize dcb_wq access against async notifier Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 559/990] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Greg Kroah-Hartman
` (294 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Abhishek Dubey, Saket Kumar Bhaskar,
Yeswanth Krishna Tellakula, R Nageswara Sastry, Hari Bathini,
Madhavan Srinivasan, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhishek Dubey <adubey@linux.ibm.com>
[ Upstream commit 6652b9941a6c9b6814ca6d2eb153dbf162b89a02 ]
Move the long branch address field to the bottom of the long
branch stub. This allows uninterrupted disassembly until the
last 4/8 bytes. The last bytes exclusion is logically necessary to
prevent disassembly failure, otherwise the actual program layout
is never altered. Hence no effect on overall program size.
Also, align dummy_tramp_addr field with 8-byte boundary.
Following is disassembler output for test program with moved down
dummy_tramp_addr field:
.....
.....
pc:68 left:44 a6 03 08 7c : mtlr 0
pc:72 left:40 bc ff ff 4b : b .-68
pc:76 left:36 a6 02 68 7d : mflr 11
pc:80 left:32 05 00 9f 42 : bcl 20, 31, .+4
pc:84 left:28 a6 02 88 7d : mflr 12
pc:88 left:24 14 00 8c e9 : ld 12, 20(12)
pc:92 left:20 a6 03 89 7d : mtctr 12
pc:96 left:16 a6 03 68 7d : mtlr 11
pc:100 left:12 20 04 80 4e : bctr
pc:104 left:8 c0 34 1d 00 :
Failure log:
Can't disasm instruction at offset 104: c0 34 1d 00 00 00 00 c0
Disassembly logic can truncate at 104, ignoring last 8 bytes.
Update the dummy_tramp_addr field offset calculation from the end
of the program to reflect its new location, for bpf_arch_text_poke()
to update the actual trampoline's address in this field.
All BPF trampoline selftests continue to pass with this patch applied.
Fixes: d243b62b7bd3 ("powerpc64/bpf: Add support for bpf trampolines")
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
Tested-by: Yeswanth Krishna Tellakula <yeswanth@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/552225fc257381fb83d282b3040c6ad363246465.1789982239.git.skb99@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/net/bpf_jit_comp.c | 44 ++++++++++++++++++---------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 4a7f5108fe0fd..f23ed48c4e327 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -52,19 +52,19 @@ asm (
void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
int ool_stub_idx, long_branch_stub_idx;
- int ool_stub_sz;
+ int stub_sz;
/*
+ * The dummy_tramp_addr field is placed at bottom of Long branch stub.
* Align the mis-aligned dummy_tramp_addr field in the fimage.
* The alignment NOP must appear before OOL stub, to make
* ool_stub_idx & long_branch_stub_idx constant from end.
*
* The fimage can be non 8-byte aligned, so final alignment depends
- * on start of fimage and the stub's instruction count offset. The
- * OOL stub size is 4 instructions (with CONFIG_PPC_FTRACE_OUT_OF_LINE)
- * or 3 instructions (without) before dummy_tramp_addr.
- *
- * Emit a NOP here if address is not SZL aligned.
+ * on start of fimage and the stub's instruction count. The
+ * stubs block has 11 instructions (with CONFIG_PPC_FTRACE_OUT_OF_LINE)
+ * or 10 instructions (without) before dummy_tramp_addr field. Emit a
+ * NOP if the address of dummy_tramp_addr is non aligned.
*
* In pass=0 when image==NULL, conservatively account for space
* required to accommodate alignment NOP. In case final pass skips
@@ -72,8 +72,8 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context
* jited_len signifies correct program size.
*/
- ool_stub_sz = IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE) ? 16 : 12;
- if (!image || !IS_ALIGNED((unsigned long)fimage + ctx->idx*4 + ool_stub_sz, SZL))
+ stub_sz = IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE) ? 44 : 40;
+ if (!image || !IS_ALIGNED((unsigned long)fimage + ctx->idx*4 + stub_sz, SZL))
EMIT(PPC_RAW_NOP());
/*
@@ -94,28 +94,29 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context
/*
* Long branch stub:
- * .long <dummy_tramp_addr> // 8-byte aligned
* mflr r11
* bcl 20,31,$+4
- * mflr r12
- * ld r12, -8-SZL(r12)
+ * mflr r12 // lr/r12 stores pc of current(this) inst.
+ * ld r12, 20(r12) // offset(dummy_tramp_addr) from prev inst. is 20
* mtctr r12
- * mtlr r11 // needed to retain ftrace ABI
+ * mtlr r11 // needed to retain ftrace ABI
* bctr
+ * .long <dummy_tramp_addr> // SZL bytes aligned
*/
- if (image)
- *((unsigned long *)&image[ctx->idx]) = (unsigned long)dummy_tramp;
-
- ctx->idx += SZL / 4;
long_branch_stub_idx = ctx->idx;
EMIT(PPC_RAW_MFLR(_R11));
EMIT(PPC_RAW_BCL4());
EMIT(PPC_RAW_MFLR(_R12));
- EMIT(PPC_RAW_LL(_R12, _R12, -8-SZL));
+ EMIT(PPC_RAW_LL(_R12, _R12, 20));
EMIT(PPC_RAW_MTCTR(_R12));
EMIT(PPC_RAW_MTLR(_R11));
EMIT(PPC_RAW_BCTR());
+ if (image)
+ *((unsigned long *)&image[ctx->idx]) = (unsigned long)dummy_tramp;
+
+ ctx->idx += SZL / 4;
+
if (!bpf_jit_ool_stub) {
bpf_jit_ool_stub = (ctx->idx - ool_stub_idx) * 4;
bpf_jit_long_branch_stub = (ctx->idx - long_branch_stub_idx) * 4;
@@ -1129,6 +1130,7 @@ static void do_isync(void *info __maybe_unused)
* bpf_func:
* [nop|b] ool_stub
* 2. Out-of-line stub:
+ * nop // optional nop for alignment
* ool_stub:
* mflr r0
* [b|bl] <bpf_prog>/<long_branch_stub>
@@ -1136,14 +1138,14 @@ static void do_isync(void *info __maybe_unused)
* b bpf_func + 4
* 3. Long branch stub:
* long_branch_stub:
- * .long <branch_addr>/<dummy_tramp>
* mflr r11
* bcl 20,31,$+4
* mflr r12
- * ld r12, -16(r12)
+ * ld r12, 20(r12)
* mtctr r12
* mtlr r11 // needed to retain ftrace ABI
* bctr
+ * .long <branch_addr>/<dummy_tramp>
*
* dummy_tramp is used to reduce synchronization requirements.
*
@@ -1243,10 +1245,12 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type poke_type,
* 1. Update the address in the long branch stub:
* If new_addr is out of range, we will have to use the long branch stub, so patch new_addr
* here. Otherwise, revert to dummy_tramp, but only if we had patched old_addr here.
+ *
+ * dummy_tramp_addr moved to bottom of long branch stub.
*/
if ((new_addr && !is_offset_in_branch_range(new_addr - ip)) ||
(old_addr && !is_offset_in_branch_range(old_addr - ip)))
- ret = patch_ulong((void *)(bpf_func_end - bpf_jit_long_branch_stub - SZL),
+ ret = patch_ulong((void *)(bpf_func_end - SZL), /* SZL: dummy_tramp_addr offset */
(new_addr && !is_offset_in_branch_range(new_addr - ip)) ?
(unsigned long)new_addr : (unsigned long)dummy_tramp);
if (ret)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 559/990] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (557 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 558/990] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 560/990] perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events Greg Kroah-Hartman
` (293 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Venkat Rao Bagalkote,
Mukesh Kumar Chaurasiya, Shrikanth Hegde, Madhavan Srinivasan,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
[ Upstream commit 644ffb02746690c0ebfe143e066f81c9bde2975e ]
radix_enabled() uses a jump label which is only valid after
setup_feature_keys() is called. Before that point, on a pSeries
hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in
cur_cpu_spec->mmu_features, but the jump label has not yet been patched,
so radix_enabled() incorrectly returns true.
The dangerous usage window where it goes wrong in early_setup():
early_setup:
configure_exceptions();
<exceptions can happen now, and handler enter/exit can be invoked>
<those could use radix_enabled(), which returns stale true>
setup_feature_keys();
<jump labels set up; post this it is safe to use radix_enabled()>
If an NMI occurs in this window, !radix_enabled() evaluates to false in
DEFINE_INTERRUPT_HANDLER_NMI. The handler fails to skip NMI entry in real
mode and attempts to access memory outside the Real Mode Area (RMA),
hanging the boot.
Since common interrupt wrappers do not have the context of early or late,
using early_radix_enabled() is the safer option. It does a plain bitmask
check against cur_cpu_spec->mmu_features and is correct at all times.
Console logs from a pSeries HASH guest showing values across boot stages:
[ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=0 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!)
[ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=0 radix_enabled=1
[ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=0 radix_enabled=0 (should now match!)
[ 0.057124] DEBUG: post secondary CPU bringup: early_radix_enabled=0 radix_enabled=0 (should match!)
Console logs from a RADIX guest showing values across boot stages:
[ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=1 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!)
[ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=1 radix_enabled=1
[ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=1 radix_enabled=1 (should now match!)
[ 0.057016] DEBUG: post secondary CPU bringup: early_radix_enabled=1 radix_enabled=1 (should match!)
Add the missing #include <asm/mmu.h> in alphabetical order since
early_radix_enabled() is declared there.
Fixes: 8d0e21012743 ("powerpc/mce: Avoid nmi_enter/exit in real mode on pseries hash")
Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Reviewed-by: Mukesh Kumar Chaurasiya <mkchauras@gmail.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260909123240.58786-1-venkat88@linux.ibm.com
[ sashal: Applied the early_radix_enabled() change in the interrupt_nmi_enter_prepare() and interrupt_nmi_exit_prepare() helpers instead of the DEFINE_INTERRUPT_HANDLER_NMI macro body, since the logic was already refactored there. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/include/asm/interrupt.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
index eb0e4a20b8188..af8c7df0ab9d0 100644
--- a/arch/powerpc/include/asm/interrupt.h
+++ b/arch/powerpc/include/asm/interrupt.h
@@ -72,6 +72,7 @@
#include <asm/firmware.h>
#include <asm/ftrace.h>
#include <asm/kprobes.h>
+#include <asm/mmu.h>
#include <asm/runlatch.h>
#ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
@@ -326,7 +327,7 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte
*/
if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
firmware_has_feature(FW_FEATURE_LPAR) &&
- !radix_enabled())
+ !early_radix_enabled())
return;
/*
@@ -355,7 +356,7 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter
nmi_exit();
} else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) &&
firmware_has_feature(FW_FEATURE_LPAR) &&
- !radix_enabled()) {
+ !early_radix_enabled()) {
// no nmi_exit for a pseries hash guest taking a real mode exception
} else if (IS_ENABLED(CONFIG_KASAN)) {
// no nmi_exit for KASAN in real mode
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 560/990] perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (558 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 559/990] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 561/990] ALSA: usb-audio: Fix UAC2 mixer unit request handling Greg Kroah-Hartman
` (292 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Adrian Hunter, Song Liu,
Arnaldo Carvalho de Melo, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit 7c89ea1bd4c612eb5cc2e6c01f77ebfc21d5c95d ]
On kernels without the fix ("perf/core: Restore header fields in
sideband output callbacks") to restore event_id.header.size in
perf_event_ksymbol_output(), perf_event_bpf_output(), and
perf_event_text_poke_output(), concurrent perf sessions cause those
sideband records to be emitted with header.size inflated by multiple
id_header_size increments while the single id_sample is written
immediately after the event payload. Indexing backwards from
event->header.size reads uninitialized ring-buffer bytes at the end of
the record, causing evlist__event2evsel() to fail with -EFAULT.
Add evsel__event_size() to clamp the effective size used to locate the
trailing id_sample for PERF_RECORD_KSYMBOL, PERF_RECORD_BPF_EVENT, and
PERF_RECORD_TEXT_POKE to payload + id_hdr_size while leaving
event->header.size intact for advancing the ring-buffer/file stream.
Fixes: 9aa0bfa370b278a5 ("perf tools: Handle PERF_RECORD_KSYMBOL")
Fixes: 45178a928a4b7c60 ("perf tools: Handle PERF_RECORD_BPF_EVENT")
Fixes: 246eba8e9041c477 ("perf tools: Add support for PERF_RECORD_TEXT_POKE")
Link: https://lore.kernel.org/r/20260929014206.4175245-1-irogers@google.com
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Replaced evlist__id_pos()/evlist__is_pos() accessors with direct evlist->id_pos/is_pos field reads, and adapted perf_evsel__parse_id_sample() to the pointer-walk array form instead of an index. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/util/evlist.c | 6 ++--
tools/perf/util/evsel.c | 59 +++++++++++++++++++++++++++++++++++++++-
tools/perf/util/evsel.h | 1 +
3 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 314393a430a37..67d1ad8a6ee16 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -648,13 +648,15 @@ static int evlist__event2id(struct evlist *evlist, union perf_event *event, u64
const __u64 *array = event->sample.array;
ssize_t n;
- n = (event->header.size - sizeof(event->header)) >> 3;
-
if (event->header.type == PERF_RECORD_SAMPLE) {
+ n = (event->header.size - sizeof(event->header)) >> 3;
if (evlist->id_pos >= n)
return -1;
*id = array[evlist->id_pos];
} else {
+ u16 size = evsel__event_size(evlist__first(evlist), event);
+
+ n = (size - sizeof(event->header)) >> 3;
if (evlist->is_pos > n)
return -1;
n -= evlist->is_pos;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index a0db385b9bec5..a6d91af538dc4 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2888,7 +2888,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel,
bool swapped = evsel->needs_swap;
union u64_swap u;
- array += ((event->header.size -
+ array += ((evsel__event_size(evsel, event) -
sizeof(event->header)) / sizeof(u64)) - 1;
if (type & PERF_SAMPLE_IDENTIFIER) {
@@ -3512,6 +3512,63 @@ u16 evsel__id_hdr_size(const struct evsel *evsel)
return size;
}
+/*
+ * Prior to kernel fix, perf_event_ksymbol_output(), perf_event_bpf_output(),
+ * and perf_event_text_poke_output() in kernel/events/core.c did not save and
+ * restore event_id.header.size across perf_iterate_sb() iterations. When
+ * multiple perf_events had attr.ksymbol, attr.bpf_event, or attr.text_poke
+ * enabled, header.size was incremented by id_header_size for each matching
+ * event while only a single id_sample was written immediately after the event
+ * payload. Clamp the effective size used to locate the trailing id_sample to
+ * payload + id_hdr_size so events recorded on unpatched kernels can be parsed
+ * without reading uninitialized ring-buffer bytes.
+ */
+u16 evsel__event_size(const struct evsel *evsel, const union perf_event *event)
+{
+ u16 size = event->header.size;
+ u16 id_hdr_size;
+ size_t payload;
+
+ if (!evsel->core.attr.sample_id_all)
+ return size;
+
+ switch (event->header.type) {
+ case PERF_RECORD_KSYMBOL: {
+ const char *name = event->ksymbol.name;
+ size_t fixed = offsetof(struct perf_record_ksymbol, name);
+ size_t max_len, len;
+
+ if (size <= fixed)
+ return size;
+ max_len = size - fixed;
+ len = strnlen(name, max_len);
+ if (len == max_len)
+ return size;
+ payload = fixed + PERF_ALIGN(len + 1, sizeof(u64));
+ break;
+ }
+ case PERF_RECORD_BPF_EVENT:
+ payload = sizeof(struct perf_record_bpf_event);
+ break;
+ case PERF_RECORD_TEXT_POKE: {
+ size_t fixed = offsetof(struct perf_record_text_poke_event, bytes);
+
+ if (size < fixed)
+ return size;
+ payload = PERF_ALIGN(fixed + (size_t)event->text_poke.old_len +
+ event->text_poke.new_len, sizeof(u64));
+ break;
+ }
+ default:
+ return size;
+ }
+
+ id_hdr_size = evsel__id_hdr_size(evsel);
+ if (payload + id_hdr_size < size)
+ return payload + id_hdr_size;
+ return size;
+}
+
#ifdef HAVE_LIBTRACEEVENT
struct tep_format_field *evsel__field(struct evsel *evsel, const char *name)
{
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index f8de0f9a719b0..664bcc8712c2f 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -425,6 +425,7 @@ int evsel__parse_sample_timestamp(struct evsel *evsel, union perf_event *event,
u64 *timestamp);
u16 evsel__id_hdr_size(const struct evsel *evsel);
+u16 evsel__event_size(const struct evsel *evsel, const union perf_event *event);
static inline struct evsel *evsel__next(struct evsel *evsel)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 561/990] ALSA: usb-audio: Fix UAC2 mixer unit request handling
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (559 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 560/990] perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 562/990] serial: 8250_mid: Add missing module namespace import for SERIAL_8250 Greg Kroah-Hartman
` (291 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zipdox, 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 0458d97859840506c3688a963dcd4f72b4a23083 ]
For a request for a Mixer Unit on UAC2 (also UAC3), the wValue is
different from UAC1 and an incompatible value must be passed.
Namely, UAC1 takes a word consisting of 1-based input channel in the
high byte and 1-based output channel in the low byte.
Meanwhile, UAC2/3 takes UAC2_MU_MIXER in the high byte and a MCN
(0-based bit position of input/output channels) in the low byte.
The current driver implementation blindly assumes the UAC1 way, hence
it would cause a firmware error.
This patch attempts to implement the conversion to UAC2 MCN at
get_ctl_value_v2() and snd_usb_mixer_set_ctl_value() for mixer units.
At the points above, the old wValue containing ICN and OCN is
converted to the corresponding MCN, and it's used as the proper
wValue.
Reported-by: Zipdox <zipdox@zipdox.net>
Closes: https://lore.kernel.org/d46fcac6-bd7e-4fc4-95e1-4e8d39f92ad3@zipdox.net
Fixes: 23caaf19b11e ("ALSA: usb-mixer: Add support for Audio Class v2.0")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260930155356.348608-3-tiwai@suse.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/mixer.c | 23 +++++++++++++++++++++++
sound/usb/mixer.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index f4e44c31111cd..e578a29a675f0 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -335,6 +335,17 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,
return -EINVAL;
}
+/* convert the given UAC1 wValue (ICN|OCN) to UAC2 MCN */
+static unsigned char to_mcn(const struct usb_mixer_elem_info *cval,
+ unsigned int validx)
+{
+ unsigned char m = (validx >> 8) & 0xff; /* 1-based input channel */
+ unsigned char v = validx & 0xff; /* 1-based output channel */
+
+ /* num_inputs * num_outputs is guaranteed to be < 256 */
+ return (m - 1) * cval->num_outputs + (v - 1);
+}
+
static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
int validx, int *value_ret)
{
@@ -347,6 +358,10 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request,
val_size = uac2_ctl_value_size(cval->val_type);
+ /* correct wValue for UAC2 mixer control with MCN */
+ if (cval->v2_mixer)
+ validx = (UAC2_MU_MIXER << 8) | to_mcn(cval, validx);
+
if (request == UAC_GET_CUR) {
bRequest = UAC2_CS_CUR;
size = val_size;
@@ -473,6 +488,10 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
}
request = UAC2_CS_CUR;
+
+ /* correct wValue for UAC2 mixer control with MCN */
+ if (cval->v2_mixer)
+ validx = (UAC2_MU_MIXER << 8) | to_mcn(cval, validx);
}
value_set = convert_bytes_value(cval, value_set);
@@ -2206,6 +2225,10 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid);
cval->control = in_ch + 1; /* based on 1 */
+ if (state->mixer->protocol == UAC_VERSION_2 ||
+ state->mixer->protocol == UAC_VERSION_3)
+ cval->v2_mixer = true;
+ cval->num_outputs = num_outs;
cval->val_type = USB_MIXER_S16;
for (i = 0; i < num_outs; i++) {
__u8 *c = uac_mixer_unit_bmControls(desc, state->mixer->protocol);
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 8e5e8da6d480f..00ffefb751d2a 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -97,6 +97,8 @@ struct usb_mixer_elem_info {
int cache_val[MAX_CHANNELS];
u8 initialized;
u8 min_mute;
+ u8 num_outputs;
+ bool v2_mixer;
void *private_data;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 562/990] serial: 8250_mid: Add missing module namespace import for SERIAL_8250
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (560 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 561/990] ALSA: usb-audio: Fix UAC2 mixer unit request handling Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 563/990] mm/memory_hotplug: fix missing rollback in __add_pages() Greg Kroah-Hartman
` (290 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nathan Chancellor, Andy Shevchenko,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <nathan@kernel.org>
[ Upstream commit 789f52f83305032ecfaaf7efae9a8ba75815c01b ]
After commit 1c305d5f1daa ("serial: 8250_mid: wait for LSR tx empty
before setting termios"), modpost errors (or warning with
CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y):
ERROR: modpost: drivers/tty/serial/8250/8250_mid.ko: module uses symbol 'serial8250_wait_for_xmitr' from namespace 'SERIAL_8250', but does not import it.
Add the missing module namespace import to clear up the error/warning.
Fixes: 1c305d5f1daa ("serial: 8250_mid: wait for LSR tx empty before setting termios")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://patch.msgid.link/20260927-tty-8250_mid-ns-import-v1-1-84d0482e1c5d@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/8250/8250_mid.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c
index c02ecb96e8b6f..47f820fcd1a45 100644
--- a/drivers/tty/serial/8250/8250_mid.c
+++ b/drivers/tty/serial/8250/8250_mid.c
@@ -415,3 +415,4 @@ module_pci_driver(mid8250_pci_driver);
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Intel MID UART driver");
+MODULE_IMPORT_NS("SERIAL_8250");
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 563/990] mm/memory_hotplug: fix missing rollback in __add_pages()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (561 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 562/990] serial: 8250_mid: Add missing module namespace import for SERIAL_8250 Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 564/990] bpf: Roll back freplace link state when bpf_arch_text_poke() fails Greg Kroah-Hartman
` (289 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Muchun Song, Lance Yang,
David Hildenbrand (Arm), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lance Yang <lance.yang@linux.dev>
[ Upstream commit c31bb839fb829958101250ee5acfa4f94fdb7ecd ]
__add_pages() returns on a sparse_add_section() failure without removing
the sections already added in the same request.
For memremap_pages(), the failed range is not counted in pgmap->nr_range,
so memunmap_pages() skips it. The sections already added in that range
retain their vmemmap mappings and subsection bits. Retrying a
section-aligned range can then fail with -EEXIST.
Save the initial PFN and remove [start_pfn, pfn) on failure. For a vmemmap
population failure, section_activate() already cleans up the current
section, so the rollback excludes it. If the first section fails,
__remove_pages() receives an empty range and does nothing.
Link: https://lore.kernel.org/all/BAD58999-1EDD-4A37-ABA0-DB1BD8AB3453@linux.dev/
Suggested-by: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Lance Yang <lance.yang@linux.dev>
Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug")
Acked-by: Muchun Song <muchun.song@linux.dev>
Link: https://patch.msgid.link/20260930160432.5564-1-lance.yang@linux.dev
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
[ sashal: Dropped the fourth params->pgmap argument from the __remove_pages() rollback call, since this tree's __remove_pages() takes only three arguments. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/memory_hotplug.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 9fdfb2d317654..5172401788bd0 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -389,6 +389,7 @@ EXPORT_SYMBOL_GPL(pfn_to_online_page);
int __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
struct mhp_params *params)
{
+ const unsigned long start_pfn = pfn;
const unsigned long end_pfn = pfn + nr_pages;
unsigned long cur_nr_pages;
int err;
@@ -422,8 +423,10 @@ int __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
SECTION_ALIGN_UP(pfn + 1) - pfn);
err = sparse_add_section(nid, pfn, cur_nr_pages, altmap,
params->pgmap);
- if (err)
+ if (err) {
+ __remove_pages(start_pfn, pfn - start_pfn, altmap);
break;
+ }
cond_resched();
}
vmemmap_populate_print_last();
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 564/990] bpf: Roll back freplace link state when bpf_arch_text_poke() fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (562 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 563/990] mm/memory_hotplug: fix missing rollback in __add_pages() Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 565/990] scsi: scsi_debug: Enforce physical block alignment of zoned writes Greg Kroah-Hartman
` (288 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Leon Hwang, Yuan Chen,
Alexei Starovoitov, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <chenyuan@kylinos.cn>
[ Upstream commit 5ec398d9ec8fe13f8058af9a2e5f5e8f46e0a35a ]
A freplace attach claims the target prog by bumping
tgt_prog->aux->freplace_link_cnt and setting tr->extension_prog.
bpf_arch_text_poke() then makes the extension take effect. If the
poke fails, the claims are never released: the attach unwinds
through bpf_link_cleanup(), which clears link->prog, so
bpf_trampoline_unlink_prog() never runs.
Drop the link count under ext_mutex on the error path, and set
tr->extension_prog only after the poke succeeded. The count is
still bumped before the poke: it blocks prog_array updates while
the entry is patched.
Fixes: d6083f040d5d ("bpf: Prevent tailcall infinite loop caused by freplace")
Fixes: be8704ff07d2 ("bpf: Introduce dynamic program extensions")
Suggested-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Link: https://patch.msgid.link/20260928091121.219333-1-chenyuan_fl@163.com
[ sashal: Adapted the freplace fix to the older bpf_arch_text_poke() four-argument form and link->link.prog, instead of the newer BPF_MOD_NOP call and node->link->prog. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/trampoline.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
index 478ea4ec3a801..98704c030a20b 100644
--- a/kernel/bpf/trampoline.c
+++ b/kernel/bpf/trampoline.c
@@ -576,9 +576,16 @@ static int __bpf_trampoline_link_prog(struct bpf_tramp_link *link,
err = bpf_freplace_link_tgt_prog(tgt_prog);
if (err)
return err;
+ err = bpf_arch_text_poke(tr->func.addr, BPF_MOD_JUMP, NULL,
+ link->link.prog->bpf_func);
+ if (err) {
+ /* Undo the claim from bpf_freplace_link_tgt_prog(). */
+ guard(mutex)(&tgt_prog->aux->ext_mutex);
+ tgt_prog->aux->freplace_link_cnt--;
+ return err;
+ }
tr->extension_prog = link->link.prog;
- return bpf_arch_text_poke(tr->func.addr, BPF_MOD_JUMP, NULL,
- link->link.prog->bpf_func);
+ return 0;
}
if (cnt >= BPF_MAX_TRAMP_LINKS)
return -E2BIG;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 565/990] scsi: scsi_debug: Enforce physical block alignment of zoned writes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (563 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 564/990] bpf: Roll back freplace link state when bpf_arch_text_poke() fails Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 566/990] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node Greg Kroah-Hartman
` (287 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Damien Le Moal, Niklas Cassel,
Martin K. Petersen (Oracle), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <cassel@kernel.org>
[ Upstream commit 63cb3900be261fccc05cadcf3402058418a5fada ]
ZBC-3 r06 (T10/BSR INCITS 579), 4.5.3.3.2, requires a write to a sequential
write required zone to be terminated with ILLEGAL REQUEST / UNALIGNED WRITE
COMMAND both when it does not start at the write pointer and when it does
not end on a physical block boundary. That is why sd_zbc_read_zones() sets
the zone_write_granularity queue limit to the physical block size of a
host-managed device.
check_zbc_access_params() implements the first condition but not the
second. So with zbc=managed sector_size=512 physblk_exp=3, a write of a
single logical block at the write pointer is accepted and advances the
write pointer by one logical block, leaving it off the granularity that was
advertised: nothing can write at it any more, and the zone can only be used
again after being reset.
Check the ending LBA as well, with the same sense data, as the standard
gives both conditions the same. An entire medium write same command, which
the standard excludes, needs no special case: the preceding check already
terminates it with WRITE BOUNDARY VIOLATION. Sequential write preferred
zones are left alone, as writes to them need not be sequential, and with
the default physblk_exp=0 the check is a no-op.
Assisted-by: LLM
Fixes: f0d1cf9378bd ("scsi: scsi_debug: Add ZBC zone commands")
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-23-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
[ sashal: changed the mk_sense_buffer() call to the older four-argument form (LBA_OUT_OF_RANGE, UNALIGNED_WRITE_ASCQ) used by neighbouring code, since the combined UNALIGNED_WRITE_COMMAND form is not used here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/scsi/scsi_debug.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 524e0fa457a83..60baa3a3ccbd0 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3904,6 +3904,17 @@ static int check_zbc_access_params(struct scsi_cmnd *scp,
UNALIGNED_WRITE_ASCQ);
return check_condition_result;
}
+ /*
+ * Writes must end on a physical block boundary, that is, the
+ * transfer length must be a multiple of the physical block
+ * size.
+ */
+ if (!IS_ALIGNED(lba + num, 1U << sdebug_physblk_exp)) {
+ mk_sense_buffer(scp, ILLEGAL_REQUEST,
+ LBA_OUT_OF_RANGE,
+ UNALIGNED_WRITE_ASCQ);
+ return check_condition_result;
+ }
}
/* Handle implicit open of closed and empty zones */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 566/990] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (564 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 565/990] scsi: scsi_debug: Enforce physical block alignment of zoned writes Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 567/990] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Greg Kroah-Hartman
` (286 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nicolin Chen, Mostafa Saleh,
Will Deacon, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <nicolinc@nvidia.com>
[ Upstream commit 2888520bdcbe0599cfc77b2fad8dc6c95505a3cb ]
arm_smmu_insert_master() skips inserting a stream whose StreamID duplicates
one the same master already owns (bridged PCI devices can present duplicate
IDs), leaving that master->streams[i].node zeroed and unlinked from the
smmu->streams rb-tree.
Both the insert error-rollback loop and arm_smmu_remove_master() then call
rb_erase() on every master->streams[i].node unconditionally. rb_erase() on
a zeroed node sees a NULL parent, treats the node as the tree root and sets
root->rb_node = NULL, silently emptying the whole SID tree and breaking SID
lookups (and DMA) for every other master on the SMMU.
Mark each node with RB_CLEAR_NODE() after sort_nonatomic() reorders the
array, since sorting relocates the entries and would leave the earlier
self-referential RB_CLEAR_NODE() pointer stale. An un-inserted node then
stays RB_EMPTY_NODE() and is skipped in both erase loops; inserted nodes
are linked by rb_find_add() and erased as before.
Fixes: b00d24997a11 ("iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated stream ids")
Assisted-by: LLM
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
[ sashal: Placed the RB_CLEAR_NODE() loop right after master->num_streams is set, since this tree has no sort() or build_invs context, and dropped the upstream sort comment. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 84dff2f06bcd1..8a678910a18cd 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3535,6 +3535,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
return -ENOMEM;
master->num_streams = fwspec->num_ids;
+ for (i = 0; i < fwspec->num_ids; i++)
+ RB_CLEAR_NODE(&master->streams[i].node);
+
mutex_lock(&smmu->streams_mutex);
for (i = 0; i < fwspec->num_ids; i++) {
struct arm_smmu_stream *new_stream = &master->streams[i];
@@ -3570,7 +3573,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
if (ret) {
for (i--; i >= 0; i--)
- rb_erase(&master->streams[i].node, &smmu->streams);
+ if (!RB_EMPTY_NODE(&master->streams[i].node))
+ rb_erase(&master->streams[i].node,
+ &smmu->streams);
kfree(master->streams);
}
mutex_unlock(&smmu->streams_mutex);
@@ -3589,7 +3594,8 @@ static void arm_smmu_remove_master(struct arm_smmu_master *master)
mutex_lock(&smmu->streams_mutex);
for (i = 0; i < fwspec->num_ids; i++)
- rb_erase(&master->streams[i].node, &smmu->streams);
+ if (!RB_EMPTY_NODE(&master->streams[i].node))
+ rb_erase(&master->streams[i].node, &smmu->streams);
mutex_unlock(&smmu->streams_mutex);
kfree(master->streams);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 567/990] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (565 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 566/990] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 568/990] dlm: validate node weights before building member array Greg Kroah-Hartman
` (285 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Baryshkov, Konrad Dybcio,
Rob Clark, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
[ Upstream commit 77e3ffcf69065c4ce92c725540e0b4db14f43ad7 ]
Only a530/a540 have a GPMU. On the other a5xx parts, reading the
0xa800-0xac60 GPMU aperture during a crashdump resets the board -- on
sda660 (a512) a GPU hang thus reboots the SoC instead of recovering.
Split the GPMU block into its own array and collect it only when a GPMU
is present.
Fixes: e20c9284c8f2 ("drm/msm/adreno: Add support for Adreno 510 GPU")
Assisted-by: LLM
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/754867/
Message-ID: <20260920-a5xx-no-gpmu-v1-1-714200254f76@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
[ sashal: Replaced upstream's kzalloc_obj(*a5xx_state) with kzalloc(sizeof(*a5xx_state), GFP_KERNEL) because the helper doesn't exist here, and kept the added adreno_gpu declaration. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 49 +++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 4a04dc43a8e67..3d123f6e51ab2 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1338,9 +1338,14 @@ static const u32 a5xx_registers[] = {
0xE800, 0xE806, 0xE810, 0xE89A, 0xE8A0, 0xE8A4, 0xE8AA, 0xE8EB,
0xE900, 0xE905, 0xEB80, 0xEB8F, 0xEBB0, 0xEBB0, 0xEC00, 0xEC05,
0xEC08, 0xECE9, 0xECF0, 0xECF0, 0xEA80, 0xEA80, 0xEA82, 0xEAA3,
- 0xEAA5, 0xEAC2, 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D,
- 0XA880, 0xA88D, 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5,
- 0xAC60, 0xAC60, ~0,
+ 0xEAA5, 0xEAC2, ~0,
+};
+
+/* GPMU registers, only valid on parts with a GPMU (a530/a540) */
+static const u32 a5xx_gpmu_registers[] = {
+ 0xA800, 0xA800, 0xA820, 0xA828, 0xA840, 0xA87D, 0xA880, 0xA88D,
+ 0xA890, 0xA8A3, 0xA8D0, 0xA8D8, 0xA8E0, 0xA8F5, 0xAC60, 0xAC60,
+ ~0,
};
static void a5xx_dump(struct msm_gpu *gpu)
@@ -1451,6 +1456,7 @@ struct a5xx_crashdumper {
struct a5xx_gpu_state {
struct msm_gpu_state base;
u32 *hlsqregs;
+ u32 *gpmuregs;
};
static int a5xx_crashdumper_init(struct msm_gpu *gpu,
@@ -1568,8 +1574,30 @@ static void a5xx_gpu_state_get_hlsq_regs(struct msm_gpu *gpu,
msm_gem_kernel_put(dumper.bo, gpu->vm);
}
+static void a5xx_gpu_state_get_gpmu_regs(struct msm_gpu *gpu,
+ struct a5xx_gpu_state *a5xx_state)
+{
+ u32 count = 0, pos = 0;
+ int i;
+
+ for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2)
+ count += a5xx_gpmu_registers[i + 1] - a5xx_gpmu_registers[i] + 1;
+
+ a5xx_state->gpmuregs = kcalloc(count, sizeof(u32), GFP_KERNEL);
+ if (!a5xx_state->gpmuregs)
+ return;
+
+ for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2) {
+ u32 addr;
+
+ for (addr = a5xx_gpmu_registers[i]; addr <= a5xx_gpmu_registers[i + 1]; addr++)
+ a5xx_state->gpmuregs[pos++] = gpu_read(gpu, addr);
+ }
+}
+
static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu)
{
+ struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
struct a5xx_gpu_state *a5xx_state = kzalloc(sizeof(*a5xx_state),
GFP_KERNEL);
bool stalled = !!(gpu_read(gpu, REG_A5XX_RBBM_STATUS3) & BIT(24));
@@ -1585,6 +1613,9 @@ static struct msm_gpu_state *a5xx_gpu_state_get(struct msm_gpu *gpu)
a5xx_state->base.rbbm_status = gpu_read(gpu, REG_A5XX_RBBM_STATUS);
+ if (adreno_is_a530(adreno_gpu) || adreno_is_a540(adreno_gpu))
+ a5xx_gpu_state_get_gpmu_regs(gpu, a5xx_state);
+
/*
* Get the HLSQ regs with the help of the crashdumper, but only if
* we are not stalled in an iommu fault (in which case the crashdumper
@@ -1606,6 +1637,7 @@ static void a5xx_gpu_state_destroy(struct kref *kref)
struct a5xx_gpu_state, base);
kfree(a5xx_state->hlsqregs);
+ kfree(a5xx_state->gpmuregs);
adreno_gpu_state_destroy(state);
kfree(a5xx_state);
@@ -1634,6 +1666,17 @@ static void a5xx_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
adreno_show(gpu, state, p);
+ if (a5xx_state->gpmuregs) {
+ u32 o, pos = 0;
+
+ drm_printf(p, "registers-gpmu:\n");
+
+ for (i = 0; a5xx_gpmu_registers[i] != ~0; i += 2)
+ for (o = a5xx_gpmu_registers[i]; o <= a5xx_gpmu_registers[i + 1]; o++)
+ drm_printf(p, " - { offset: 0x%04x, value: 0x%08x }\n",
+ o << 2, a5xx_state->gpmuregs[pos++]);
+ }
+
/* Dump the additional a5xx HLSQ registers */
if (!a5xx_state->hlsqregs)
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 568/990] dlm: validate node weights before building member array
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (566 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 567/990] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 569/990] dmaengine: ste_dma40: Fix cyclic transfer residue Greg Kroah-Hartman
` (284 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Qing Ming, Alexander Aring,
David Teigland, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qing Ming <a0yami@mailbox.org>
[ Upstream commit 7f662eb1807ed732ac7d5e119753c8185f241bb8 ]
DLM node weights are parsed as signed integers and copied into the member
list. make_member_array() uses their sum as the allocation count, but only
positive weights contribute entries to the array. A negative weight can
therefore reduce the allocation without reducing the number of writes.
The issue was found through static analysis of the configfs input and
member array construction. With two recovery members weighted -31 and 32,
the sum is 1, so recovery allocates one int and then writes the positive
member's node ID 32 times. A reproducer using dlm_controld and dlm_tool
triggered the same report on a KASAN kernel:
BUG: KASAN: slab-out-of-bounds in dlm_recover_members [dlm]
Write of size 4 by task dlm_recoverd
Call Trace:
dlm_recover_members
dlm_recoverd
kthread
ret_from_fork
Reject negative weights at the configfs input boundary. Also detect
overflow when adding non-negative weights to the signed allocation count,
and propagate array construction errors to the recovery path.
Fixes: e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM")
Signed-off-by: Qing Ming <a0yami@mailbox.org>
Assisted-by: Codex:gpt-5
Acked-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
[ sashal: Kept the branch's kmalloc_array() allocation in make_member_array() where upstream context uses kmalloc_objs(), and dropped the early ls_total_weight assignment. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/dlm/config.c | 9 ++++++++-
fs/dlm/member.c | 17 +++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 0db5ce43425ca..8ea193017ee98 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -857,10 +857,17 @@ static ssize_t node_weight_show(struct config_item *item, char *buf)
static ssize_t node_weight_store(struct config_item *item, const char *buf,
size_t len)
{
- int rc = kstrtoint(buf, 0, &config_item_to_node(item)->weight);
+ struct dlm_node *node = config_item_to_node(item);
+ int weight;
+ int rc;
+ rc = kstrtoint(buf, 0, &weight);
if (rc)
return rc;
+ if (weight < 0)
+ return -EINVAL;
+
+ node->weight = weight;
return len;
}
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index c0f557a80a754..c33782235d1b1 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -406,7 +406,7 @@ void dlm_clear_members_gone(struct dlm_ls *ls)
clear_memb_list(&ls->ls_nodes_gone, NULL);
}
-static void make_member_array(struct dlm_ls *ls)
+static int make_member_array(struct dlm_ls *ls)
{
struct dlm_member *memb;
int i, w, x = 0, total = 0, all_zero = 0, *array;
@@ -415,8 +415,8 @@ static void make_member_array(struct dlm_ls *ls)
ls->ls_node_array = NULL;
list_for_each_entry(memb, &ls->ls_nodes, list) {
- if (memb->weight)
- total += memb->weight;
+ if (check_add_overflow(total, memb->weight, &total))
+ return -EOVERFLOW;
}
/* all nodes revert to weight of 1 if all have weight 0 */
@@ -426,10 +426,9 @@ static void make_member_array(struct dlm_ls *ls)
all_zero = 1;
}
- ls->ls_total_weight = total;
array = kmalloc_array(total, sizeof(*array), GFP_NOFS);
if (!array)
- return;
+ return -ENOMEM;
list_for_each_entry(memb, &ls->ls_nodes, list) {
if (!all_zero && !memb->weight)
@@ -446,7 +445,10 @@ static void make_member_array(struct dlm_ls *ls)
array[x++] = memb->nodeid;
}
+ ls->ls_total_weight = total;
ls->ls_node_array = array;
+
+ return 0;
}
/* send a status request to all members just to establish comms connections */
@@ -621,7 +623,10 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)
}
ls->ls_low_nodeid = low;
- make_member_array(ls);
+ error = make_member_array(ls);
+ if (error)
+ return error;
+
*neg_out = neg;
error = ping_members(ls, rv->seq);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 569/990] dmaengine: ste_dma40: Fix cyclic transfer residue
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (567 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 568/990] dlm: validate node weights before building member array Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 570/990] dmaengine: ste_dma40: Recover coalesced cyclic callbacks Greg Kroah-Hartman
` (283 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Frank Li, Frank Li, Linus Walleij,
Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit c80edceff29ee212987c2d2c851b2cb2eb4b477a ]
DMA40 reads residue from the element count of the currently active LLI.
For a cyclic transfer this reports at most one period, not the bytes
remaining until the cyclic buffer wraps.
Once DMA40 advertises burst granularity, DMAengine PCM uses this residue
directly. For a four-period PCM buffer it consequently reports the
hardware pointer near three periods after every period interrupt. ALSA
eventually stops playback with -EIO although DMA period callbacks
continue.
Calculate cyclic residue from the current memory-side hardware pointer
instead. Read the destination pointer for capture and the source pointer
for playback. Sample the split logical channel pointer coherently and
retain the last valid residue during relink transitions.
Make at most three residue sampling attempts: one initial read plus two
retries. The retries let transient split-register updates or LLI relink
windows settle, while the limit prevents unbounded polling if hardware does
not yield a valid pointer.
This avoids counting terminal-count interrupts, which races with hardware
advancing to the next LLI and cannot account for coalesced interrupt
status. Also reject cyclic periods that expand into multiple LLIs because
logical cyclic LLIs each request a terminal-count interrupt and would
generate more than one callback per period.
Reject invalid cyclic geometries before dividing or constructing the
scatterlist as well.
Reported-by: Frank Li <Frank.li@oss.nxp.com>
Closes: https://lore.kernel.org/dmaengine/aq2wIPJW6viUxyy9@SMW015318/
Fixes: 15c606686541 ("dmaengine: ste_dma40: indicate granularity on channels")
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-2-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
[ sashal: Replaced the kzalloc_objs() allocation call with kcalloc() for the scatterlist in dma40_prep_dma_cyclic(), since the newer helper is missing here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 106 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 101 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 21469034495d7..53e56b4be3fca 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -69,6 +69,9 @@ struct stedma40_platform_data {
/* Maximum iterations taken before giving up suspending a channel */
#define D40_SUSPEND_MAX_IT 500
+/* Maximum attempts to sample a stable cyclic residue position */
+#define D40_RESIDUE_MAX_ATTEMPTS 3
+
/* Milliseconds */
#define DMA40_AUTOSUSPEND_DELAY 100
@@ -368,6 +371,9 @@ struct d40_lli_pool {
* @lli_len: Number of llis of current descriptor.
* @lli_current: Number of transferred llis.
* @lcla_alloc: Number of LCLA entries allocated.
+ * @cyclic_dma_addr: Start address of the cyclic buffer.
+ * @cyclic_buf_len: Length of the cyclic buffer.
+ * @cyclic_residue: Last valid cyclic residue sample.
* @txd: DMA engine struct. Used for among other things for communication
* during a transfer.
* @node: List entry.
@@ -386,6 +392,9 @@ struct d40_desc {
int lli_len;
int lli_current;
int lcla_alloc;
+ dma_addr_t cyclic_dma_addr;
+ size_t cyclic_buf_len;
+ size_t cyclic_residue;
struct dma_async_tx_descriptor txd;
struct list_head node;
@@ -1412,6 +1421,64 @@ static u32 d40_residue(struct d40_chan *d40c)
return num_elt * d40c->dma_cfg.dst_info.data_width;
}
+static bool d40_current_addr(struct d40_chan *d40c, dma_addr_t *addr)
+{
+ bool dst = d40c->dma_cfg.dir == DMA_DEV_TO_MEM;
+ void __iomem *high_reg;
+ void __iomem *low_reg;
+ u32 low;
+ u32 high;
+ u32 check;
+ int i;
+
+ if (chan_is_physical(d40c)) {
+ *addr = readl(chan_base(d40c) +
+ (dst ? D40_CHAN_REG_SDPTR : D40_CHAN_REG_SSPTR));
+ return true;
+ }
+
+ if (dst) {
+ low_reg = &d40c->lcpa->lcsp2;
+ high_reg = &d40c->lcpa->lcsp3;
+ } else {
+ low_reg = &d40c->lcpa->lcsp0;
+ high_reg = &d40c->lcpa->lcsp1;
+ }
+
+ for (i = 0; i < D40_RESIDUE_MAX_ATTEMPTS; i++) {
+ high = readl(high_reg) & D40_MEM_LCSP1_SPTR_MASK;
+ low = readl(low_reg) & D40_MEM_LCSP0_SPTR_MASK;
+ check = readl(high_reg) & D40_MEM_LCSP1_SPTR_MASK;
+ if (high == check) {
+ *addr = low | high;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool d40_cyclic_offset(struct d40_chan *d40c, struct d40_desc *d40d,
+ size_t *offset)
+{
+ dma_addr_t current_addr;
+ dma_addr_t current_offset;
+ int i;
+
+ for (i = 0; i < D40_RESIDUE_MAX_ATTEMPTS; i++) {
+ if (!d40_current_addr(d40c, ¤t_addr))
+ continue;
+
+ current_offset = current_addr - d40d->cyclic_dma_addr;
+ if (current_offset <= d40d->cyclic_buf_len) {
+ *offset = current_offset;
+ return true;
+ }
+ }
+
+ return false;
+}
+
static bool d40_tx_is_linked(struct d40_chan *d40c)
{
bool is_link;
@@ -2202,15 +2269,26 @@ static bool d40_is_paused(struct d40_chan *d40c)
}
-static u32 stedma40_residue(struct dma_chan *chan)
+static u32 stedma40_residue(struct dma_chan *chan, dma_cookie_t cookie)
{
struct d40_chan *d40c =
container_of(chan, struct d40_chan, chan);
+ struct d40_desc *d40d;
+ size_t offset;
u32 bytes_left;
unsigned long flags;
spin_lock_irqsave(&d40c->lock, flags);
- bytes_left = d40_residue(d40c);
+ d40d = d40_first_active_get(d40c);
+ if (d40d && d40d->txd.cookie == cookie && d40d->cyclic &&
+ d40d->cyclic_buf_len) {
+ if (d40_cyclic_offset(d40c, d40d, &offset))
+ d40d->cyclic_residue = d40d->cyclic_buf_len - offset;
+ bytes_left = d40d->cyclic_residue;
+ } else {
+ bytes_left = d40_residue(d40c);
+ }
+
spin_unlock_irqrestore(&d40c->lock, flags);
return bytes_left;
@@ -2346,8 +2424,13 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
if (desc == NULL)
goto unlock;
- if (sg_next(&sg_src[sg_len - 1]) == sg_src)
+ if (sg_next(&sg_src[sg_len - 1]) == sg_src) {
desc->cyclic = true;
+ if (desc->lli_len != sg_len) {
+ chan_err(chan, "Cyclic periods must fit in one LLI\n");
+ goto free_desc;
+ }
+ }
src_dev_addr = 0;
dst_dev_addr = 0;
@@ -2630,11 +2713,18 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
size_t buf_len, size_t period_len,
enum dma_transfer_direction direction, unsigned long flags)
{
- unsigned int periods = buf_len / period_len;
+ unsigned int periods;
struct dma_async_tx_descriptor *txd;
+ struct d40_desc *desc;
struct scatterlist *sg;
+ dma_addr_t buf_addr = dma_addr;
int i;
+ if (!buf_len || !period_len || buf_len % period_len)
+ return NULL;
+
+ periods = buf_len / period_len;
+
sg = kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT);
if (!sg)
return NULL;
@@ -2649,6 +2739,12 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
txd = d40_prep_sg(chan, sg, sg, periods, direction,
DMA_PREP_INTERRUPT);
+ if (txd) {
+ desc = container_of(txd, struct d40_desc, txd);
+ desc->cyclic_dma_addr = buf_addr;
+ desc->cyclic_buf_len = buf_len;
+ desc->cyclic_residue = buf_len;
+ }
kfree(sg);
@@ -2669,7 +2765,7 @@ static enum dma_status d40_tx_status(struct dma_chan *chan,
ret = dma_cookie_status(chan, cookie, txstate);
if (ret != DMA_COMPLETE && txstate)
- dma_set_residue(txstate, stedma40_residue(chan));
+ dma_set_residue(txstate, stedma40_residue(chan, cookie));
if (d40_is_paused(d40c))
ret = DMA_PAUSED;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 570/990] dmaengine: ste_dma40: Recover coalesced cyclic callbacks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (568 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 569/990] dmaengine: ste_dma40: Fix cyclic transfer residue Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 571/990] wifi: mt76: mt7996: free the WTBL index if a link allocation fails Greg Kroah-Hartman
` (282 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Linus Walleij, Frank Li, Vinod Koul,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit db28400d92cd97005065dad230b8a5d72ab121cb ]
DMA40 has one terminal-count status bit per channel, so cyclic period
interrupts can coalesce.
Use the memory-side pointer displacement to queue the minimum observable
number of callbacks. If sampling fails, queue one callback and invalidate
the saved position; the next successful sample resynchronizes without
recounting it.
The pointer is modulo the cyclic buffer: a displacement of d periods can
mean d plus n complete iterations of the buffer. Report d, so the driver
could have missed n iterations of the buffer; DMA40 has no counter to
recover them. For an unchanged pointer, report one callback rather than
risk a spurious full-buffer burst.
This condition has not been seen in practice and is only a product of
review comments that the buffer can miss interrupts.
The preceding cyclic-residue fix ensures that every cyclic period fits in
one LLI, so each boundary corresponds to one client callback.
Fixes: 0c842b551063 ("dma40: cyclic xfer support")
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-3-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 69 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 53e56b4be3fca..2c83eb05faa16 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -374,11 +374,14 @@ struct d40_lli_pool {
* @cyclic_dma_addr: Start address of the cyclic buffer.
* @cyclic_buf_len: Length of the cyclic buffer.
* @cyclic_residue: Last valid cyclic residue sample.
+ * @cyclic_period_len: Length of one cyclic period.
+ * @cyclic_callback_pos: Position after the callbacks already queued.
* @txd: DMA engine struct. Used for among other things for communication
* during a transfer.
* @node: List entry.
* @is_in_client_list: true if the client owns this descriptor.
* @cyclic: true if this is a cyclic job
+ * @cyclic_callback_pos_valid: Whether cyclic_callback_pos is reliable.
*
* This descriptor is used for both logical and physical transfers.
*/
@@ -395,12 +398,15 @@ struct d40_desc {
dma_addr_t cyclic_dma_addr;
size_t cyclic_buf_len;
size_t cyclic_residue;
+ size_t cyclic_period_len;
+ size_t cyclic_callback_pos;
struct dma_async_tx_descriptor txd;
struct list_head node;
bool is_in_client_list;
bool cyclic;
+ bool cyclic_callback_pos_valid;
};
/**
@@ -1479,6 +1485,61 @@ static bool d40_cyclic_offset(struct d40_chan *d40c, struct d40_desc *d40d,
return false;
}
+static unsigned int d40_cyclic_periods_elapsed(struct d40_chan *d40c,
+ struct d40_desc *d40d)
+{
+ size_t current_pos;
+ size_t delta;
+ size_t offset;
+ unsigned int periods;
+
+ if (!d40d->cyclic_period_len)
+ return 1;
+
+ if (!d40_cyclic_offset(d40c, d40d, &offset)) {
+ d40d->cyclic_callback_pos_valid = false;
+ return 1;
+ }
+
+ current_pos = rounddown(offset, d40d->cyclic_period_len);
+ if (!d40_residue(d40c) && current_pos != offset)
+ current_pos += d40d->cyclic_period_len;
+ if (current_pos == d40d->cyclic_buf_len)
+ current_pos = 0;
+
+ if (!d40d->cyclic_callback_pos_valid) {
+ /*
+ * The previous interrupt was reported without a pointer
+ * sample. Resynchronize without using the stale position,
+ * which would count that callback again.
+ */
+ d40d->cyclic_callback_pos = current_pos;
+ d40d->cyclic_callback_pos_valid = true;
+ return 1;
+ }
+
+ /*
+ * The pointer wraps with the cyclic buffer, so its displacement is
+ * only the minimum number of elapsed periods. Complete buffer laps
+ * are not observable.
+ */
+ delta = (current_pos + d40d->cyclic_buf_len -
+ d40d->cyclic_callback_pos) % d40d->cyclic_buf_len;
+ periods = delta / d40d->cyclic_period_len;
+ if (!periods) {
+ /*
+ * The TC status is a single latched bit. An unchanged pointer
+ * cannot distinguish a complete lap from a repeated interrupt,
+ * so do not amplify it into a buffer's worth of callbacks.
+ */
+ periods = 1;
+ }
+
+ d40d->cyclic_callback_pos = current_pos;
+
+ return periods;
+}
+
static bool d40_tx_is_linked(struct d40_chan *d40c)
{
bool is_link;
@@ -1626,6 +1687,7 @@ static struct d40_desc *d40_queue_start(struct d40_chan *d40c)
static void dma_tc_handle(struct d40_chan *d40c)
{
struct d40_desc *d40d;
+ unsigned int callbacks = 1;
/* Get first active entry from list */
d40d = d40_first_active_get(d40c);
@@ -1650,6 +1712,8 @@ static void dma_tc_handle(struct d40_chan *d40c)
if (d40d->lli_current == d40d->lli_len)
d40d->lli_current = 0;
}
+
+ callbacks = d40_cyclic_periods_elapsed(d40c, d40d);
} else {
d40_lcla_free_all(d40c, d40d);
@@ -1670,7 +1734,7 @@ static void dma_tc_handle(struct d40_chan *d40c)
}
}
- d40c->pending_tx++;
+ d40c->pending_tx += callbacks;
tasklet_schedule(&d40c->tasklet);
}
@@ -2744,6 +2808,9 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
desc->cyclic_dma_addr = buf_addr;
desc->cyclic_buf_len = buf_len;
desc->cyclic_residue = buf_len;
+ desc->cyclic_period_len = period_len;
+ desc->cyclic_callback_pos = 0;
+ desc->cyclic_callback_pos_valid = true;
}
kfree(sg);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 571/990] wifi: mt76: mt7996: free the WTBL index if a link allocation fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (569 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 570/990] dmaengine: ste_dma40: Recover coalesced cyclic callbacks Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 572/990] wifi: mt76: mt7921: fix of_node reference leaks in regd update Greg Kroah-Hartman
` (281 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Felix Fietkau, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <nbd@nbd.name>
[ Upstream commit 36f1934a2bf04f355e748c68ba7f7cbb5e6950fc ]
mt7996_mac_sta_init_link() takes a WTBL index from wcid_mask before it
allocates the msta_link of a link other than the first one. If that
allocation fails, the function returns -ENOMEM and the index stays set
in wcid_mask, so no later station can use it.
Return the index to wcid_mask on that error.
Fixes: dd82a9e02c05 ("wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks")
Link: https://patch.msgid.link/20261006205936.669125-11-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ sashal: Kept the older kzalloc(sizeof(*msta_link), GFP_KERNEL) allocation instead of kzalloc_obj(*msta_link) as the context line, then applied the same fix on top. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index fa0fe117e8f30..02ffd5b1c0ca3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1056,8 +1056,10 @@ mt7996_mac_sta_init_link(struct mt7996_dev *dev,
mt7996_sta_init_txq_wcid(sta, idx);
} else {
msta_link = kzalloc(sizeof(*msta_link), GFP_KERNEL);
- if (!msta_link)
+ if (!msta_link) {
+ mt76_wcid_mask_clear(dev->mt76.wcid_mask, idx);
return -ENOMEM;
+ }
if (msta->seclink_id == msta->deflink_id &&
(sta->valid_links & ~BIT(msta->deflink_id)))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 572/990] wifi: mt76: mt7921: fix of_node reference leaks in regd update
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (570 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 571/990] wifi: mt76: mt7996: free the WTBL index if a link allocation fails Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 573/990] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class Greg Kroah-Hartman
` (280 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Felix Fietkau, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <nbd@nbd.name>
[ Upstream commit 2f209a8dca88507bc094de370e582adefc55723e ]
mt7921_regd_channel_update() and __mt7921_mcu_set_clc() never
release the nodes returned by mt76_find_power_limits_node(),
of_get_child_by_name() and mt76_find_channel_node(). Each regulatory
domain change and each CLC update on a device with DT power limits
leaks these references.
Release every node after use. This relies on
mt76_find_power_limits_node() also returning a reference for the
fallback node, which it does since commit 3a62c9f7ec3d ("wifi: mt76:
Fix of_node reference leak in mt76_get_rate_power_limits()").
Fixes: 09382d8f8641 ("wifi: mt76: mt7921: update the channel usage when the regd domain changed")
Link: https://patch.msgid.link/20261007112419.1277594-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[ sashal: Applied the fix inside mt7921_regd_channel_update() in init.c (no regd.c here) and inlined the mt7921_regd_dt_has_channel() helper, with no goto out on the 5 GHz check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/wireless/mediatek/mt76/mt7921/init.c | 31 ++++++++++++++-----
.../net/wireless/mediatek/mt76/mt7921/mcu.c | 7 ++++-
2 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index b9098a7331b1a..67a3b3dcf60a2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -67,7 +67,7 @@ mt7921_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
(!(dev->phy.clc_chan_conf & BIT(idx)) && (cfreq) >= (sfreq) && (cfreq) <= (efreq))
struct ieee80211_supported_band *sband;
struct mt76_dev *mdev = &dev->mt76;
- struct device_node *np, *band_np;
+ struct device_node *np, *band_np, *chan_np;
struct ieee80211_channel *ch;
int i, cfreq;
@@ -79,28 +79,39 @@ mt7921_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
ch = &sband->channels[i];
cfreq = ch->center_freq;
- if (np && (!band_np || !mt76_find_channel_node(band_np, ch))) {
- ch->flags |= IEEE80211_CHAN_DISABLED;
- continue;
+ if (np) {
+ chan_np = band_np ?
+ mt76_find_channel_node(band_np, ch) : NULL;
+ of_node_put(chan_np);
+ if (!chan_np) {
+ ch->flags |= IEEE80211_CHAN_DISABLED;
+ continue;
+ }
}
/* UNII-4 */
if (IS_UNII_INVALID(0, 5845, 5925))
ch->flags |= IEEE80211_CHAN_DISABLED;
}
+ of_node_put(band_np);
sband = wiphy->bands[NL80211_BAND_6GHZ];
if (!sband)
- return;
+ goto out;
band_np = np ? of_get_child_by_name(np, "txpower-6g") : NULL;
for (i = 0; i < sband->n_channels; i++) {
ch = &sband->channels[i];
cfreq = ch->center_freq;
- if (np && (!band_np || !mt76_find_channel_node(band_np, ch))) {
- ch->flags |= IEEE80211_CHAN_DISABLED;
- continue;
+ if (np) {
+ chan_np = band_np ?
+ mt76_find_channel_node(band_np, ch) : NULL;
+ of_node_put(chan_np);
+ if (!chan_np) {
+ ch->flags |= IEEE80211_CHAN_DISABLED;
+ continue;
+ }
}
/* UNII-5/6/7/8 */
@@ -110,6 +121,10 @@ mt7921_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
IS_UNII_INVALID(4, 6875, 7125))
ch->flags |= IEEE80211_CHAN_DISABLED;
}
+ of_node_put(band_np);
+
+out:
+ of_node_put(np);
}
void mt7921_regd_update(struct mt792x_dev *dev)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
index 7363a553a007d..5e6e3cb4d5e15 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
@@ -3,6 +3,7 @@
#include <linux/fs.h>
#include <linux/firmware.h>
+#include <linux/of.h>
#include "mt7921.h"
#include "mcu.h"
#include "../mt76_connac2_mac.h"
@@ -1361,6 +1362,7 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
.acpi_conf = mt792x_acpi_get_flags(&dev->phy),
.mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2),
};
+ struct device_node *np;
int ret, valid_cnt = 0;
u32 buf_len = 0;
u8 *pos;
@@ -1370,8 +1372,11 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
if (dev->phy.chip_cap & MT792x_CHIP_CAP_CLC_EVT_EN)
req.cap |= CLC_CAP_EVT_EN;
- if (mt76_find_power_limits_node(&dev->mt76))
+
+ np = mt76_find_power_limits_node(&dev->mt76);
+ if (np)
req.cap |= CLC_CAP_DTS_EN;
+ of_node_put(np);
buf_len = le32_to_cpu(clc->len) - sizeof(*clc);
pos = clc->data;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 573/990] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (571 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 572/990] wifi: mt76: mt7921: fix of_node reference leaks in regd update Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 574/990] fs/ntfs3: check return values in indx_delete_entry() Greg Kroah-Hartman
` (279 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Melissa Wen, Tvrtko Ursulin,
Dan Wheeler, Roman Li, Alex Deucher, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <mwen@igalia.com>
[ Upstream commit 6c4f8c5cc00326f6c709bff0d640d504c90862ca ]
Don't create an amdgpu_dm_atomic_state_template event since this is just
a template. Declare the template as an event class that will be used by
actual event tracers.
Fixes: e8a982355f96 ("drm/amd/display: Add tracepoint for amdgpu_dm")
Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
[ sashal: Replaced struct drm_atomic_commit with struct drm_atomic_state in TP_PROTO and __field, since the rename isn't present in this tree. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../amd/display/amdgpu_dm/amdgpu_dm_trace.h | 56 +++++++++----------
1 file changed, 26 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
index a8f52c35a94d3..ec8b39b8342fb 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h
@@ -311,36 +311,32 @@ DEFINE_EVENT(amdgpu_dm_plane_state_template, amdgpu_dm_atomic_update_cursor,
TP_PROTO(const struct drm_plane_state *state),
TP_ARGS(state));
-TRACE_EVENT(amdgpu_dm_atomic_state_template,
- TP_PROTO(const struct drm_atomic_state *state),
- TP_ARGS(state),
-
- TP_STRUCT__entry(
- __field(const struct drm_atomic_state *, state)
- __field(bool, allow_modeset)
- __field(bool, legacy_cursor_update)
- __field(bool, async_update)
- __field(bool, duplicated)
- __field(int, num_connector)
- __field(int, num_private_objs)
- ),
-
- TP_fast_assign(
- __entry->state = state;
- __entry->allow_modeset = state->allow_modeset;
- __entry->legacy_cursor_update = state->legacy_cursor_update;
- __entry->async_update = state->async_update;
- __entry->duplicated = state->duplicated;
- __entry->num_connector = state->num_connector;
- __entry->num_private_objs = state->num_private_objs;
- ),
-
- TP_printk("state=%p allow_modeset=%d legacy_cursor_update=%d "
- "async_update=%d duplicated=%d num_connector=%d "
- "num_private_objs=%d",
- __entry->state, __entry->allow_modeset, __entry->legacy_cursor_update,
- __entry->async_update, __entry->duplicated, __entry->num_connector,
- __entry->num_private_objs)
+DECLARE_EVENT_CLASS(amdgpu_dm_atomic_state_template,
+ TP_PROTO(const struct drm_atomic_state *state),
+ TP_ARGS(state),
+ TP_STRUCT__entry(__field(const struct drm_atomic_state *, state)
+ __field(bool, allow_modeset)
+ __field(bool, legacy_cursor_update)
+ __field(bool, async_update)
+ __field(bool, duplicated)
+ __field(int, num_connector)
+ __field(int, num_private_objs)
+ ),
+ TP_fast_assign(__entry->state = state;
+ __entry->allow_modeset = state->allow_modeset;
+ __entry->legacy_cursor_update = state->legacy_cursor_update;
+ __entry->async_update = state->async_update;
+ __entry->duplicated = state->duplicated;
+ __entry->num_connector = state->num_connector;
+ __entry->num_private_objs = state->num_private_objs;
+ ),
+ TP_printk("state=%p allow_modeset=%d legacy_cursor_update=%d "
+ "async_update=%d duplicated=%d num_connector=%d "
+ "num_private_objs=%d",
+ __entry->state, __entry->allow_modeset,
+ __entry->legacy_cursor_update, __entry->async_update,
+ __entry->duplicated, __entry->num_connector,
+ __entry->num_private_objs)
);
DEFINE_EVENT(amdgpu_dm_atomic_state_template, amdgpu_dm_atomic_commit_tail_begin,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 574/990] fs/ntfs3: check return values in indx_delete_entry()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (572 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 573/990] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 575/990] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path Greg Kroah-Hartman
` (278 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dmitry Morgun, Konstantin Komarov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Morgun <d.morgun@ispras.ru>
[ Upstream commit 131f7d7abf0f10edc6ea6b032f8a3908bdb13ce8 ]
When the index tree collapses down to an empty root,
indx_delete_entry() calls attr_set_size() and ni_remove_attr() for
both ATTR_ALLOC and ATTR_BITMAP, but their return values are
overwritten by the following call without being checked.
In most other call sites of these functions the return value is
checked, so add the same checks here in case an error at this point
is meaningful.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Dmitry Morgun <d.morgun@ispras.ru>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
[ sashal: added the missing NULL argument to both attr_set_size() calls to match this branch's older function prototype. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ntfs3/index.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 97cbe176a83e5..88a5f336d9040 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -2691,18 +2691,28 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
err = attr_set_size(ni, ATTR_ALLOC, in->name, in->name_len,
&indx->alloc_run, 0, NULL, false, NULL);
+ if (err)
+ goto out;
+
if (in->name == I30_NAME)
i_size_write(&ni->vfs_inode, 0);
err = ni_remove_attr(ni, ATTR_ALLOC, in->name, in->name_len,
false, NULL);
run_close(&indx->alloc_run);
+ if (err)
+ goto out;
err = attr_set_size(ni, ATTR_BITMAP, in->name, in->name_len,
&indx->bitmap_run, 0, NULL, false, NULL);
+ if (err)
+ goto out;
+
err = ni_remove_attr(ni, ATTR_BITMAP, in->name, in->name_len,
false, NULL);
run_close(&indx->bitmap_run);
+ if (err)
+ goto out;
root = indx_get_root(indx, ni, &attr, &mi);
if (!root) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 575/990] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (573 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 574/990] fs/ntfs3: check return values in indx_delete_entry() Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 576/990] ALSA: pcmtest: Fix leak at probe error Greg Kroah-Hartman
` (277 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 237782c3d416b392a12642f32959e9d3c94e0c26 ]
tx_coal_frames[] is written by ethtool (stmmac_set_coalesce) and read
locklessly from the TX fast path (stmmac_xmit, stmmac_tso_xmit,
stmmac_xdp_xmit_zc and stmmac_xdp_xmit_xdpf), so pair every access
with READ_ONCE()/WRITE_ONCE() to mark the intentional data race and
read a consistent value into a local variable.
Moreover, ethtool allows disabling TX coalescing by setting
tx_max_coalesced_frames to 0: guard the modulo operation in
stmmac_xdp_xmit_xdpf() against a zero tx_coal_frames[queue] to avoid
a division by zero.
Both issues were found by code inspection while extending the XDP TX
path with multi-buff support, and neither has ever been triggered, so
they are only theoretical. Tested on the Qualcomm RB3-gen2 board.
Fixes: db2f2842e6f5 ("net: stmmac: add per-queue TX & RX coalesce ethtool support")
Fixes: be8b38a722e6 ("net: stmmac: Add support for XDP_TX action")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261001-b4-stmmac-xmit-mb-v4-1-664e0c3eb289@oss.qualcomm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Dropped the duplicate pay_len, mss, queue declaration and kept this branch's local variable names (des, has_vlan, set_ic, proto_hdr_len) instead of upstream's declaration changes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 11 ++---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 42 ++++++++-----------
2 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 741e3864f5094..3d501be64619f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -832,7 +832,8 @@ static int __stmmac_get_coalesce(struct net_device *dev,
if (queue < tx_cnt) {
ec->tx_coalesce_usecs = priv->tx_coal_timer[queue];
- ec->tx_max_coalesced_frames = priv->tx_coal_frames[queue];
+ ec->tx_max_coalesced_frames =
+ READ_ONCE(priv->tx_coal_frames[queue]);
} else {
ec->tx_coalesce_usecs = 0;
ec->tx_max_coalesced_frames = 0;
@@ -921,14 +922,14 @@ static int __stmmac_set_coalesce(struct net_device *dev,
int i;
for (i = 0; i < tx_cnt; i++) {
- priv->tx_coal_frames[i] =
- ec->tx_max_coalesced_frames;
+ WRITE_ONCE(priv->tx_coal_frames[i],
+ ec->tx_max_coalesced_frames);
priv->tx_coal_timer[i] =
ec->tx_coalesce_usecs;
}
} else if (queue < tx_cnt) {
- priv->tx_coal_frames[queue] =
- ec->tx_max_coalesced_frames;
+ WRITE_ONCE(priv->tx_coal_frames[queue],
+ ec->tx_max_coalesced_frames);
priv->tx_coal_timer[queue] =
ec->tx_coalesce_usecs;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c2b975ac8b566..0dc333218aa98 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2524,7 +2524,8 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
struct stmmac_metadata_request meta_req;
struct xsk_tx_metadata *meta = NULL;
dma_addr_t dma_addr;
- bool set_ic;
+ bool set_ic = false;
+ u32 tx_coal;
/* We are sharing with slow path and stop XSK TX desc submission when
* available TX ring is less than threshold.
@@ -2575,12 +2576,9 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
tx_q->tx_count_frames++;
- if (!priv->tx_coal_frames[queue])
- set_ic = false;
- else if (tx_q->tx_count_frames % priv->tx_coal_frames[queue] == 0)
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
+ if (tx_coal && !(tx_q->tx_count_frames % tx_coal))
set_ic = true;
- else
- set_ic = false;
meta_req.priv = priv;
meta_req.tx_desc = tx_desc;
@@ -3179,7 +3177,7 @@ static void stmmac_init_coalesce(struct stmmac_priv *priv)
for (chan = 0; chan < tx_channel_count; chan++) {
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
- priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES;
+ WRITE_ONCE(priv->tx_coal_frames[chan], STMMAC_TX_FRAMES);
priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER;
hrtimer_setup(&tx_q->txtimer, stmmac_tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
@@ -4268,9 +4266,9 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
unsigned int first_entry, entry, tx_packets;
struct stmmac_txq_stats *txq_stats;
+ u32 tx_coal, pay_len, mss, queue;
int i, first_tx, nfrags, ndesc;
struct stmmac_tx_queue *tx_q;
- u32 pay_len, mss, queue;
u8 proto_hdr_len, hdr;
dma_addr_t des;
bool set_ic;
@@ -4408,16 +4406,16 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
tx_packets = (tx_q->cur_tx + 1) - first_tx;
tx_q->tx_count_frames += tx_packets;
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && priv->hwts_tx_en)
set_ic = true;
- else if (!priv->tx_coal_frames[queue])
+ else if (!tx_coal)
set_ic = false;
else if (!netdev_xmit_more())
set_ic = true;
- else if (tx_packets > priv->tx_coal_frames[queue])
+ else if (tx_packets > tx_coal)
set_ic = true;
- else if ((tx_q->tx_count_frames %
- priv->tx_coal_frames[queue]) < tx_packets)
+ else if ((tx_q->tx_count_frames % tx_coal) < tx_packets)
set_ic = true;
else
set_ic = false;
@@ -4563,7 +4561,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
bool has_vlan, set_ic;
int entry, first_tx;
dma_addr_t des;
- u32 sdu_len;
+ u32 tx_coal, sdu_len;
tx_q = &priv->dma_conf.tx_queue[queue];
txq_stats = &priv->xstats.txq_stats[queue];
@@ -4697,16 +4695,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
tx_packets = (entry + 1) - first_tx;
tx_q->tx_count_frames += tx_packets;
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
if ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && priv->hwts_tx_en)
set_ic = true;
- else if (!priv->tx_coal_frames[queue])
+ else if (!tx_coal)
set_ic = false;
else if (!netdev_xmit_more())
set_ic = true;
- else if (tx_packets > priv->tx_coal_frames[queue])
+ else if (tx_packets > tx_coal)
set_ic = true;
- else if ((tx_q->tx_count_frames %
- priv->tx_coal_frames[queue]) < tx_packets)
+ else if ((tx_q->tx_count_frames % tx_coal) < tx_packets)
set_ic = true;
else
set_ic = false;
@@ -5008,7 +5006,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
unsigned int entry = tx_q->cur_tx;
struct dma_desc *tx_desc;
dma_addr_t dma_addr;
- bool set_ic;
+ u32 tx_coal;
if (stmmac_tx_avail(priv, queue) < STMMAC_TX_THRESH(priv))
return STMMAC_XDP_CONSUMED;
@@ -5061,12 +5059,8 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
tx_q->tx_count_frames++;
- if (tx_q->tx_count_frames % priv->tx_coal_frames[queue] == 0)
- set_ic = true;
- else
- set_ic = false;
-
- if (set_ic) {
+ tx_coal = READ_ONCE(priv->tx_coal_frames[queue]);
+ if (tx_coal && !(tx_q->tx_count_frames % tx_coal)) {
tx_q->tx_count_frames = 0;
stmmac_set_tx_ic(priv, tx_desc);
u64_stats_update_begin(&txq_stats->q_syncp);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 576/990] ALSA: pcmtest: Fix leak at probe error
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (574 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 575/990] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 577/990] ALSA: aloop: Avoid a bad mixure of guard() and goto Greg Kroah-Hartman
` (276 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, 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 d0f2ca62e89f3c666d0ec203eaa23b8d965e5443 ]
When an error happens at probe of pcmtest driver before
snd_card_register() succeeds, we have to release the card explicitly,
but it's not done, leading to a potential memory leak.
Also, pcmtest driver manages struct pcmtst object unnecessarily
complicatedly by a dynamic allocation and release.
This patch fixes and cleans up the resource management:
- Use card's private_data allocation for struct sndpcmtst at the card
creation, which is released automatically together with the card
- Since the allocation of pcmtest is gone, snd_pcmtst_create() is
rather pointless, so just directly calling snd_pcmtst_new_pcm()
- Use the new auto-clean mechanism to handle the error case at probe.
- Many release handlers became superfluous and dropped
In the end we got a good amount of code reduction.
Fixes: 315a3d57c64c ("ALSA: Implement the new Virtual PCM Test Driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261007172533.14667-3-tiwai@suse.de
[ sashal: Dropped the deleted snd_pcmtst_create() function in full, including its older kzalloc(sizeof(*pcmtst), GFP_KERNEL) line where upstream had kzalloc_obj(*pcmtst), since the branch lacks that helper. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/drivers/pcmtest.c | 66 +++++++----------------------------------
1 file changed, 10 insertions(+), 56 deletions(-)
diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c
index b63df0623c73f..026bc53211d77 100644
--- a/sound/drivers/pcmtest.c
+++ b/sound/drivers/pcmtest.c
@@ -465,20 +465,6 @@ static snd_pcm_uframes_t snd_pcmtst_pcm_pointer(struct snd_pcm_substream *substr
return bytes_to_frames(substream->runtime, v_iter->buf_pos);
}
-static int snd_pcmtst_free(struct pcmtst *pcmtst)
-{
- if (!pcmtst)
- return 0;
- kfree(pcmtst);
- return 0;
-}
-
-// These callbacks are required, but empty - all freeing occurs in pdev_remove
-static int snd_pcmtst_dev_free(struct snd_device *device)
-{
- return 0;
-}
-
static void pcmtst_pdev_release(struct device *dev)
{
}
@@ -582,40 +568,9 @@ static int snd_pcmtst_new_pcm(struct pcmtst *pcmtst)
return err;
}
-static int snd_pcmtst_create(struct snd_card *card, struct platform_device *pdev,
- struct pcmtst **r_pcmtst)
-{
- struct pcmtst *pcmtst;
- int err;
- static const struct snd_device_ops ops = {
- .dev_free = snd_pcmtst_dev_free,
- };
-
- pcmtst = kzalloc(sizeof(*pcmtst), GFP_KERNEL);
- if (!pcmtst)
- return -ENOMEM;
- pcmtst->card = card;
- pcmtst->pdev = pdev;
-
- err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pcmtst, &ops);
- if (err < 0)
- goto _err_free_chip;
-
- err = snd_pcmtst_new_pcm(pcmtst);
- if (err < 0)
- goto _err_free_chip;
-
- *r_pcmtst = pcmtst;
- return 0;
-
-_err_free_chip:
- snd_pcmtst_free(pcmtst);
- return err;
-}
-
static int pcmtst_probe(struct platform_device *pdev)
{
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_free) = NULL;
struct pcmtst *pcmtst;
int err;
@@ -623,10 +578,16 @@ static int pcmtst_probe(struct platform_device *pdev)
if (err)
return err;
- err = snd_devm_card_new(&pdev->dev, index, id, THIS_MODULE, 0, &card);
+ err = snd_devm_card_new(&pdev->dev, index, id, THIS_MODULE,
+ sizeof(*pcmtst), &card);
if (err < 0)
return err;
- err = snd_pcmtst_create(card, pdev, &pcmtst);
+
+ pcmtst = card->private_data;
+ pcmtst->card = card;
+ pcmtst->pdev = pdev;
+
+ err = snd_pcmtst_new_pcm(pcmtst);
if (err < 0)
return err;
@@ -639,17 +600,11 @@ static int pcmtst_probe(struct platform_device *pdev)
return err;
platform_set_drvdata(pdev, pcmtst);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static void pdev_remove(struct platform_device *pdev)
-{
- struct pcmtst *pcmtst = platform_get_drvdata(pdev);
-
- snd_pcmtst_free(pcmtst);
-}
-
static struct platform_device pcmtst_pdev = {
.name = "pcmtest",
.dev.release = pcmtst_pdev_release,
@@ -657,7 +612,6 @@ static struct platform_device pcmtst_pdev = {
static struct platform_driver pcmtst_pdrv = {
.probe = pcmtst_probe,
- .remove = pdev_remove,
.driver = {
.name = "pcmtest",
},
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 577/990] ALSA: aloop: Avoid a bad mixure of guard() and goto
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (575 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 576/990] ALSA: pcmtest: Fix leak at probe error Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 578/990] net: macb: configure ENST registers for all queues Greg Kroah-Hartman
` (275 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, 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 f7faf5d9b5668919cae84a6247f8f7b4e2c0227c ]
The rewrite of aloop driver code using guard() leaded to a mixture of
guard() and some goto; although it currently works, it isn't really a
good match.
For avoiding the bad match, just move the code using goto into a
function and wrap it with guard().
Fixes: ebd9b6c91d4e ("ALSA: aloop: Use guard() for mutex locks")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261007172533.14667-6-tiwai@suse.de
[ sashal: Kept the existing kzalloc(sizeof(*dpcm), GFP_KERNEL) call in the context instead of upstream's kzalloc_obj(*dpcm), since the file still uses plain kzalloc. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/drivers/aloop.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 93ac63edfb975..c11648f431096 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -1276,7 +1276,7 @@ static const struct loopback_ops loopback_snd_timer_ops = {
.dpcm_info = loopback_snd_timer_dpcm_info,
};
-static int loopback_open(struct snd_pcm_substream *substream)
+static int __loopback_open(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct loopback *loopback = substream->private_data;
@@ -1285,7 +1285,6 @@ static int loopback_open(struct snd_pcm_substream *substream)
int err = 0;
int dev = get_cable_index(substream);
- guard(mutex)(&loopback->cable_lock);
dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
if (!dpcm)
return -ENOMEM;
@@ -1375,6 +1374,14 @@ static int loopback_open(struct snd_pcm_substream *substream)
return err;
}
+static int loopback_open(struct snd_pcm_substream *substream)
+{
+ struct loopback *loopback = substream->private_data;
+
+ guard(mutex)(&loopback->cable_lock);
+ return __loopback_open(substream);
+}
+
static int loopback_close(struct snd_pcm_substream *substream)
{
struct loopback *loopback = substream->private_data;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 578/990] net: macb: configure ENST registers for all queues
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (576 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 577/990] ALSA: aloop: Avoid a bad mixure of guard() and goto Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 579/990] wifi: nl80211: reject zero RNR/MBSSID elements Greg Kroah-Hartman
` (274 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Théo Lebrun, Vineeth Karumanchi,
Jacob Keller, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
[ Upstream commit 04a943067baa670fef3c1424ea616a2ed87d3d19 ]
When a taprio config only covered a subset of queues, the driver
programmed the ENST registers only for the queues named in the config
and left the remaining queues holding stale register values. This
produced an inconsistent hardware setup that affected the scheduling
of the configured queues.
This was observed on a GEM instance with four hardware queues, all
enabled:
Initial configuration:
- All four queues are enabled.
- enst_on_time_qX registers are left at their reset value (0x0001FFFF).
- Only q0 and q1 are configured with valid, non-overlapping ENST
schedules (T0 and T1 respectively).
- Traffic streams p0 and p1 are bound to q0 and q1.
- ENST is enabled only on q0 and q1.
Observed behavior:
- During T0 on-time, both p0 and p1 packets are transmitted.
- During T1 on-time, both p0 and p1 packets are transmitted.
With the unused queues (q2 and q3) explicitly programmed with
enst_on_time = 0x0:
- During T0 on-time, only p0 packets are transmitted.
- During T1 on-time, only p1 packets are transmitted.
Leaving the ENST on-time registers of unused queues at their reset
value (0x0001FFFF) disrupts the scheduling of the configured queues,
whereas programming them with 0x0 yields the expected ENST operation.
Program the ENST registers for every queue unconditionally. The
per-queue configuration array is now allocated for bp->num_queues and
indexed directly by queue_id; unconfigured queues are left
zero-initialized by kzalloc_objs(), so their registers are cleared.
Indexing the array by queue_id also makes the queue_id field in
struct macb_queue_enst_config redundant, so drop it.
Fixes: 89934dbf169e ("net: macb: Add TAPRIO traffic scheduling support")
Reviewed-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20261005110855.1669249-1-vineeth.karumanchi@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Queue index is computed with hweight32(bp->queue_mask & (gate_mask - 1)) instead of upstream's order_base_2(gate_mask), since sparse queue masks are possible here, and kcalloc replaces kzalloc_objs. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/cadence/macb.h | 2 --
drivers/net/ethernet/cadence/macb_main.c | 23 ++++++++++++-----------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index a6602aae3f9d3..008d7dc670099 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1458,7 +1458,6 @@ struct macb_platform_data {
* @start_time_mask: Bitmask representing the start time for the queue
* @on_time_bytes: "on" time nsec expressed in bytes
* @off_time_bytes: "off" time nsec expressed in bytes
- * @queue_id: Identifier for the queue
*
* This structure holds the configuration parameters for an ENST queue,
* used to control time-based transmission scheduling in the MACB driver.
@@ -1467,7 +1466,6 @@ struct macb_queue_enst_config {
u32 start_time_mask;
u32 on_time_bytes;
u32 off_time_bytes;
- u8 queue_id;
};
#endif /* _MACB_H */
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1eaf9be483153..112b1785e817e 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4232,7 +4232,8 @@ static int macb_taprio_setup_replace(struct net_device *ndev,
struct macb *bp = netdev_priv(ndev);
struct ethtool_link_ksettings kset;
struct macb_queue *queue;
- size_t i;
+ size_t i, q;
+ u8 queue_id;
int err;
if (conf->num_entries > bp->num_queues) {
@@ -4260,7 +4261,7 @@ static int macb_taprio_setup_replace(struct net_device *ndev,
return -EINVAL;
}
- enst_queue = kcalloc(conf->num_entries, sizeof(*enst_queue), GFP_KERNEL);
+ enst_queue = kcalloc(bp->num_queues, sizeof(*enst_queue), GFP_KERNEL);
if (unlikely(!enst_queue))
return -ENOMEM;
@@ -4318,13 +4319,14 @@ static int macb_taprio_setup_replace(struct net_device *ndev,
goto cleanup;
}
- enst_queue[i].queue_id = order_base_2(entry->gate_mask);
- enst_queue[i].start_time_mask =
+ /* Map the hardware queue to its index in bp->queues (the mask may be sparse) */
+ queue_id = hweight32(bp->queue_mask & (entry->gate_mask - 1));
+ enst_queue[queue_id].start_time_mask =
(start_time_sec << GEM_START_TIME_SEC_OFFSET) |
start_time_nsec;
- enst_queue[i].on_time_bytes =
+ enst_queue[queue_id].on_time_bytes =
enst_ns_to_hw_units(entry->interval, speed);
- enst_queue[i].off_time_bytes =
+ enst_queue[queue_id].off_time_bytes =
enst_ns_to_hw_units(conf->cycle_time - entry->interval, speed);
configured_queues |= entry->gate_mask;
@@ -4349,15 +4351,14 @@ static int macb_taprio_setup_replace(struct net_device *ndev,
gem_writel(bp, ENST_CONTROL,
bp->queue_mask << GEM_ENST_DISABLE_QUEUE_OFFSET);
- for (i = 0; i < conf->num_entries; i++) {
- queue = &bp->queues[enst_queue[i].queue_id];
+ for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
/* Configure queue timing registers */
queue_writel(queue, ENST_START_TIME,
- enst_queue[i].start_time_mask);
+ enst_queue[q].start_time_mask);
queue_writel(queue, ENST_ON_TIME,
- enst_queue[i].on_time_bytes);
+ enst_queue[q].on_time_bytes);
queue_writel(queue, ENST_OFF_TIME,
- enst_queue[i].off_time_bytes);
+ enst_queue[q].off_time_bytes);
}
/* Enable ENST for all configured queues in one write */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 579/990] wifi: nl80211: reject zero RNR/MBSSID elements
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (577 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 578/990] net: macb: configure ENST registers for all queues Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 580/990] dma-direct: Restore arch_dma_alloc() for the DMA_ATTR_NO_KERNEL_MAPPING case Greg Kroah-Hartman
` (273 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Johannes Berg, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit c767e1173aeab7825a8dfb197041d3996db84e39 ]
That's a nonsensical configuration, and we get errors
reported further down in mac80211 for it; hostapd has
code that only adds the nested element if it'll not be
an empty list.
Remove an unnecessary NULL check while at it.
Fixes: dbbb27e183b1 ("cfg80211: support RNR for EMA AP")
Assisted-by: LLM
Link: https://patch.msgid.link/20261005224950.97db49d9d104.I5765a3310528b3d1cb1673dc90ad5ab5fc3ea571@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ sashal: Kept the existing kzalloc(struct_size(...), GFP_KERNEL) allocation instead of upstream's kzalloc_flex(), adding the zero-element guard above it in both parse functions. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/wireless/nl80211.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d4b1e5dc5eb4f..429dba541cb88 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6152,6 +6152,9 @@ nl80211_parse_mbssid_elems(struct wiphy *wiphy, struct nlattr *attrs,
num_elems++;
}
+ if (!num_elems)
+ return ERR_PTR(-EINVAL);
+
elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL);
if (!elems)
return ERR_PTR(-ENOMEM);
@@ -6187,6 +6190,9 @@ nl80211_parse_rnr_elems(struct wiphy *wiphy, struct nlattr *attrs,
num_elems++;
}
+ if (!num_elems)
+ return ERR_PTR(-EINVAL);
+
elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL);
if (!elems)
return ERR_PTR(-ENOMEM);
@@ -6335,7 +6341,8 @@ static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev,
if (IS_ERR(rnr))
return PTR_ERR(rnr);
- if (rnr && rnr->cnt < bcn->mbssid_ies->cnt) {
+ /* RNR elements are only used with MBSSID elements */
+ if (rnr->cnt < bcn->mbssid_ies->cnt) {
kfree(rnr);
return -EINVAL;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 580/990] dma-direct: Restore arch_dma_alloc() for the DMA_ATTR_NO_KERNEL_MAPPING case
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (578 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 579/990] wifi: nl80211: reject zero RNR/MBSSID elements Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 581/990] cxl/port: Attach endpoints to a dport under the lock that pins it Greg Kroah-Hartman
` (272 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aneesh Kumar K.V, Marek Szyprowski,
Sasha Levin, Claude Opus 5.5
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <m.szyprowski@samsung.com>
[ Upstream commit 5e3bc6b44c8853bcc7782eac122c5baf2d02f399 ]
Commit 849facea92fa ("dma-direct: simplify the DMA_ATTR_NO_KERNEL_MAPPING
handling") moved the DMA_ATTR_NO_KERNEL_MAPPING shortcut in
dma_direct_alloc() in front of the arch_dma_alloc() call. Architectures
providing their own DMA coherent allocator (CONFIG_ARCH_HAS_DMA_ALLOC)
therefore no longer see such requests. ARM 32bit is one of such. Lack of
the call to arch_dma_alloc() results in the lack of proper cache
management on HighMem pages.
Take the dma-direct shortcut only for coherent devices or when the
architecture doesn't provide arch_dma_alloc(). While touching this,
move that check into separate function to avoid duplication in alloc
and free paths.
Fixes: 849facea92fa ("dma-direct: simplify the DMA_ATTR_NO_KERNEL_MAPPING handling")
Reported-by: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
Closes: https://lore.kernel.org/all/yq5ams2akznl.fsf@kernel.org/
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Link: https://lore.kernel.org/r/20260930135734.1013905-1-m.szyprowski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[ sashal: Adapted the helper's attribute check to use force_dma_unencrypted() instead of the newer __DMA_ATTR_ALLOC_CC_SHARED flag, which this tree lacks. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/dma/direct.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index cc334eb94b33d..11960210266fb 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -181,6 +181,21 @@ static struct page *dma_direct_alloc_from_pool(struct device *dev, size_t size,
return page;
}
+/*
+ * Check if the allocation can skip the kernel mapping and return the page
+ * pointer as the cookie.
+ */
+static bool dma_direct_use_no_mapping(struct device *dev, unsigned long attrs)
+{
+ if (!(attrs & DMA_ATTR_NO_KERNEL_MAPPING))
+ return false;
+ if (force_dma_unencrypted(dev) || is_swiotlb_for_alloc(dev))
+ return false;
+ if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_ALLOC) && !dev_is_dma_coherent(dev))
+ return false;
+ return true;
+}
+
static void *dma_direct_alloc_no_mapping(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp)
{
@@ -210,8 +225,7 @@ void *dma_direct_alloc(struct device *dev, size_t size,
if (attrs & DMA_ATTR_NO_WARN)
gfp |= __GFP_NOWARN;
- if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) &&
- !force_dma_unencrypted(dev) && !is_swiotlb_for_alloc(dev))
+ if (dma_direct_use_no_mapping(dev, attrs))
return dma_direct_alloc_no_mapping(dev, size, dma_handle, gfp);
if (!dev_is_dma_coherent(dev)) {
@@ -314,8 +328,7 @@ void dma_direct_free(struct device *dev, size_t size,
{
unsigned int page_order = get_order(size);
- if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) &&
- !force_dma_unencrypted(dev) && !is_swiotlb_for_alloc(dev)) {
+ if (dma_direct_use_no_mapping(dev, attrs)) {
/* cpu_addr is a struct page cookie, not a kernel address */
dma_free_contiguous(dev, cpu_addr, size);
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 581/990] cxl/port: Attach endpoints to a dport under the lock that pins it
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (579 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 580/990] dma-direct: Restore arch_dma_alloc() for the DMA_ATTR_NO_KERNEL_MAPPING case Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 582/990] ALSA: hda/realtek: Fix mute LEDs on HP ENVY 17-cr1xxx Greg Kroah-Hartman
` (271 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Li Ming, Alison Schofield,
Dave Jiang, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <dave.jiang@intel.com>
[ Upstream commit bcda00c78d075340fe30cb6c980507fac711e7d1 ]
devm_cxl_enumerate_ports() and add_port_attach_ep() look up or create a
dport under its port's device lock, drop the lock, then pass the dport
to cxl_add_ep(). add_ep() reads dport->port before taking the lock, and
cxl_gpf_port_setup() reads and writes the dport with no lock held.
A concurrent cxl_detach_ep() for another memdev below the same port can
free the dport in that window: it calls del_dports() under the port lock
when the last endpoint leaves. The enumerating memdev then dereferences
freed memory.
Attach the endpoint and set up GPF while the port lock from the lookup
is still held. Make add_ep() assert that lock instead of taking it.
Under the lock, a dport found in port->dports is still live, since
removal erases it from the xarray before freeing it.
[ dj: Added kdoc update from Alison. ]
Fixes: de516b40116e ("cxl/port: Record dport in endpoint references")
Reported-by: Li Ming <ming.li@zohomail.com>
Closes: https://lore.kernel.org/linux-cxl/0c68324c-cfc7-46b2-9344-24ae40e88923@zohomail.com/
Assisted-by: LLM
Reviewed-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20261001154744.1095902-4-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[ sashal: Replaced the dport lookup's lock guard with a single guard(device)(&port->dev) in the helper because port_to_host() doesn't exist here, so upstream's two-lock scheme was dropped. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cxl/core/port.c | 121 +++++++++++++++++++++-------------------
1 file changed, 65 insertions(+), 56 deletions(-)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index b9a585f64b8ab..9c9fcea02816f 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1383,7 +1383,7 @@ static int add_ep(struct cxl_ep *new)
{
struct cxl_port *port = new->dport->port;
- guard(device)(&port->dev);
+ device_lock_assert(&port->dev);
if (port->dead)
return -ENXIO;
@@ -1399,6 +1399,11 @@ static int add_ep(struct cxl_ep *new)
* Intermediate CXL ports are scanned based on the arrival of endpoints.
* When those endpoints depart the port can be destroyed once all
* endpoints that care about that port have been removed.
+ *
+ * Context: Caller must hold the device lock of @dport->port, which pins
+ * @dport, across the lookup of @dport and this call. @dport->port
+ * is never the CXL root port, whose dports are pinned by its
+ * uport_dev instead.
*/
static int cxl_add_ep(struct cxl_dport *dport, struct device *ep_dev)
{
@@ -1727,13 +1732,15 @@ static struct cxl_dport *probe_dport(struct cxl_port *port,
return drv->add_dport(port, dport_dev);
}
-static struct cxl_dport *devm_cxl_create_port(struct device *ep_dev,
- struct cxl_port *parent_port,
- struct cxl_dport *parent_dport,
- struct device *uport_dev,
- struct device *dport_dev)
+static int devm_cxl_create_port(struct device *ep_dev,
+ struct cxl_port *parent_port,
+ struct cxl_dport *parent_dport,
+ struct device *uport_dev,
+ struct device *dport_dev)
{
resource_size_t component_reg_phys;
+ struct cxl_dport *dport;
+ int rc;
device_lock_assert(&parent_port->dev);
if (!parent_port->dev.driver) {
@@ -1750,7 +1757,7 @@ static struct cxl_dport *devm_cxl_create_port(struct device *ep_dev,
port = devm_cxl_add_port(&parent_port->dev, uport_dev,
component_reg_phys, parent_dport);
if (IS_ERR(port))
- return ERR_CAST(port);
+ return PTR_ERR(port);
/*
* retry to make sure a port is found. a port device
@@ -1758,7 +1765,7 @@ static struct cxl_dport *devm_cxl_create_port(struct device *ep_dev,
*/
port = find_cxl_port_by_uport(uport_dev);
if (!port)
- return ERR_PTR(-ENODEV);
+ return -ENODEV;
dev_dbg(ep_dev, "created port %s:%s\n",
dev_name(&port->dev), dev_name(port->uport_dev));
@@ -1767,11 +1774,25 @@ static struct cxl_dport *devm_cxl_create_port(struct device *ep_dev,
* Port was created before right before this function is
* called. Signal the caller to deal with it.
*/
- return ERR_PTR(-EAGAIN);
+ return -EAGAIN;
}
+ /* @dport is only valid while @port's lock is held */
guard(device)(&port->dev);
- return probe_dport(port, dport_dev);
+ dport = probe_dport(port, dport_dev);
+ if (IS_ERR(dport))
+ return PTR_ERR(dport);
+
+ rc = cxl_add_ep(dport, ep_dev);
+ if (rc == -EBUSY) {
+ /*
+ * "can't" happen, but this error code means
+ * something to the caller, so translate it.
+ */
+ rc = -ENXIO;
+ }
+
+ return rc;
}
static int add_port_attach_ep(struct cxl_memdev *cxlmd,
@@ -1779,7 +1800,7 @@ static int add_port_attach_ep(struct cxl_memdev *cxlmd,
struct device *dport_dev)
{
struct device *dparent = grandparent(dport_dev);
- struct cxl_dport *dport, *parent_dport;
+ struct cxl_dport *parent_dport;
int rc;
if (is_cxl_host_bridge(dparent)) {
@@ -1808,46 +1829,51 @@ static int add_port_attach_ep(struct cxl_memdev *cxlmd,
return PTR_ERR(parent_dport);
}
- dport = devm_cxl_create_port(&cxlmd->dev, parent_port,
- parent_dport, uport_dev,
- dport_dev);
- if (IS_ERR(dport)) {
- /* Port or dport already exists, restart iteration */
- if (PTR_ERR(dport) == -EAGAIN || PTR_ERR(dport) == -EBUSY)
- return 0;
- return PTR_ERR(dport);
- }
+ rc = devm_cxl_create_port(&cxlmd->dev, parent_port,
+ parent_dport, uport_dev, dport_dev);
}
- rc = cxl_add_ep(dport, &cxlmd->dev);
- if (rc == -EBUSY) {
- /*
- * "can't" happen, but this error code means
- * something to the caller, so translate it.
- */
- rc = -ENXIO;
- }
+ /* Port or dport already exists, restart iteration */
+ if (rc == -EAGAIN || rc == -EBUSY)
+ return 0;
return rc;
}
-static struct cxl_dport *find_or_add_dport(struct cxl_port *port,
- struct device *dport_dev)
+static int find_or_add_dport_attach_ep(struct cxl_memdev *cxlmd,
+ struct cxl_port *port,
+ struct device *dport_dev)
{
struct cxl_dport *dport;
+ int rc;
- device_lock_assert(&port->dev);
+ guard(device)(&port->dev);
dport = cxl_find_dport_by_dev(port, dport_dev);
if (!dport) {
dport = probe_dport(port, dport_dev);
if (IS_ERR(dport))
- return dport;
+ return PTR_ERR(dport);
/* New dport added, restart iteration */
- return ERR_PTR(-EAGAIN);
+ return -EAGAIN;
}
- return dport;
+ /* @dport is only valid while @port's lock is held */
+ rc = cxl_add_ep(dport, &cxlmd->dev);
+
+ /*
+ * If the endpoint already exists in the port's list,
+ * that's ok, it was added on a previous pass.
+ * Otherwise, retry in add_port_attach_ep() after taking
+ * the parent_port lock as the current port may be being
+ * reaped.
+ */
+ if (rc && rc != -EBUSY)
+ return rc;
+
+ cxl_gpf_port_setup(dport);
+
+ return 0;
}
int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd)
@@ -1876,7 +1902,6 @@ int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd)
for (iter = dev; iter; iter = grandparent(iter)) {
struct device *dport_dev = grandparent(iter);
struct device *uport_dev;
- struct cxl_dport *dport;
if (is_cxl_host_bridge(dport_dev))
return 0;
@@ -1903,29 +1928,13 @@ int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd)
* RP port enumerated by cxl_acpi without dport will
* have the dport added here.
*/
- scoped_guard(device, &port->dev) {
- dport = find_or_add_dport(port, dport_dev);
- if (IS_ERR(dport)) {
- if (PTR_ERR(dport) == -EAGAIN)
- goto retry;
- return PTR_ERR(dport);
- }
- }
-
- rc = cxl_add_ep(dport, &cxlmd->dev);
-
- /*
- * If the endpoint already exists in the port's list,
- * that's ok, it was added on a previous pass.
- * Otherwise, retry in add_port_attach_ep() after taking
- * the parent_port lock as the current port may be being
- * reaped.
- */
- if (rc && rc != -EBUSY)
+ rc = find_or_add_dport_attach_ep(cxlmd, port,
+ dport_dev);
+ if (rc == -EAGAIN)
+ goto retry;
+ if (rc)
return rc;
- cxl_gpf_port_setup(dport);
-
/* Any more ports to add between this one and the root? */
if (!dev_is_cxl_root_child(&port->dev))
continue;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 582/990] ALSA: hda/realtek: Fix mute LEDs on HP ENVY 17-cr1xxx
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (580 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 581/990] cxl/port: Attach endpoints to a dport under the lock that pins it Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 583/990] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq Greg Kroah-Hartman
` (270 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maksim Krasutski, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksim Krasutski <krasutskimaksim@gmail.com>
[ Upstream commit dd83323e4d5e22bd04f7506a9ec33533465c8393 ]
The HP ENVY Laptop 17-cr1xxx with subsystem ID 103c:8be8 uses an
ALC245 codec and two CS35L41 I2C speaker amplifiers. Its existing
quirk configures the amplifiers but does not enable the speaker
and microphone mute LED handlers.
Select ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS to retain the
amplifier setup and enable both mute indicators.
The equivalent change was tested on an HP ENVY 17-cr1xxx running
Kubuntu 26.04.1 with kernel 7.0.0-38-generic. Both keyboard mute
indicators were confirmed working.
Fixes: aa8e3ef4fe53 ("ALSA: hda/realtek: Add quirks for various HP ENVY models")
Assisted-by: LLM
Signed-off-by: Maksim Krasutski <krasutskimaksim@gmail.com>
Link: https://patch.msgid.link/20261010185335.30949-1-krasutskimaksim@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: Adjusted context lines: the neighbouring 0x8be9 quirk entry differs in this tree, so only the 0x8be8 line was changed to the HP mute-LEDs fixup. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/codecs/realtek/alc269.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index ba850cb119ec6..6ee95ae0e8f67 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -7106,7 +7106,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
- SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS),
SND_PCI_QUIRK(0x103c, 0x8be9, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8bfd, "HP Pavilion 15-eg3xxx", ALC287_FIXUP_HP_GPIO_LED),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 583/990] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (581 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 582/990] ALSA: hda/realtek: Fix mute LEDs on HP ENVY 17-cr1xxx Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 584/990] RDMA/core: Clear driver_udata before destroying objects in rdma_core Greg Kroah-Hartman
` (269 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Quanye Yang, Farhad Alemi, Jack Wang,
Leon Romanovsky, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quanye Yang <quanyeyang@proton.me>
[ Upstream commit 3255d6b83491574b115806ec958d8f6ca090fa9c ]
On disconnect the client error recovery path calls ib_drain_qp(), which
requires one free RQ slot and that no recv WQEs are posted while the
queue is being drained.
When the server is loaded with always_invalidate=N, the path does not
advertise RTRS_MSG_NEW_RKEY_F. A client-requested invalidation is then
a standalone SEND_WITH_INV. The recv completion path did not repost
that WQE; it posted two empty recv WQEs later, when the RDMA-with-IMM
response carried RTRS_IO_RSP_W_INV_IMM. If the invalidate receive
never arrived, each such response increased RQ occupancy by one until
ib_post_recv() started returning -ENOMEM and __ib_drain_rq() failed
with:
failed to drain recv queue: -12
Repost one empty recv WQE for every receive completion, including
SEND_WITH_INV completions on the always_invalidate=N path, and only
while the path is still connected so CQ polling cannot race with
ib_drain_qp(). Size IO connection RQs to 2 * queue_depth + 1 to match
the posted recv count and leave the drain slot.
Tested with a synthetic RTRS client flooding unpaired
RTRS_IO_RSP_W_INV_IMM messages; error recovery no longer triggers
__ib_drain_rq() warnings.
Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
Signed-off-by: Quanye Yang <quanyeyang@proton.me>
Link: https://lore.kernel.org/linux-rdma/CA+0ovCihE2_pxLimjmmR8NMz4g-ie8dvvq1jmAj-Om33y3Vzfg@mail.gmail.com
Link: https://patch.msgid.link/20261005-rtrs-fix-ib-drain-rq-v2-1-35535a3ed115@proton.me
Tested-by: Quanye Yang <quanyeyang@proton.me>
Reported-by: Farhad Alemi <farhad.alemi@berkeley.edu>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Adjusted context for the older error-log format and the min_t() form of the max_recv_wr computation, then applied the same repost and queue_depth * 2 + 1 changes. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 45 +++++++++-----------------
1 file changed, 15 insertions(+), 30 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index dbce23eabcfd1..3525508fe0321 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -582,25 +582,21 @@ static struct ib_cqe io_comp_cqe = {
.done = rtrs_clt_rdma_done
};
-/*
- * Post x2 empty WRs: first is for this RDMA with IMM,
- * second is for RECV with INV, which happened earlier.
- */
-static int rtrs_post_recv_empty_x2(struct rtrs_con *con, struct ib_cqe *cqe)
+static int rtrs_clt_repost_recv(struct rtrs_clt_con *con)
{
- struct ib_recv_wr wr_arr[2], *wr;
- int i;
+ struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
+ int err;
- memset(wr_arr, 0, sizeof(wr_arr));
- for (i = 0; i < ARRAY_SIZE(wr_arr); i++) {
- wr = &wr_arr[i];
- wr->wr_cqe = cqe;
- if (i)
- /* Chain backwards */
- wr->next = &wr_arr[i - 1];
- }
+ if (READ_ONCE(clt_path->state) != RTRS_CLT_CONNECTED)
+ return 0;
- return ib_post_recv(con->qp, wr, NULL);
+ err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
+ if (err) {
+ rtrs_err(con->c.path, "rtrs_post_recv_empty(): %pe\n",
+ ERR_PTR(err));
+ rtrs_rdma_error_recovery(con);
+ }
+ return err;
}
static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
@@ -661,19 +657,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
rtrs_wrn(con->c.path, "Unknown IMM type %u\n",
imm_type);
}
- if (w_inval)
- /*
- * Post x2 empty WRs: first is for this RDMA with IMM,
- * second is for RECV with INV, which happened earlier.
- */
- err = rtrs_post_recv_empty_x2(&con->c, &io_comp_cqe);
- else
- err = rtrs_post_recv_empty(&con->c, &io_comp_cqe);
- if (err) {
- rtrs_err(con->c.path, "rtrs_post_recv_empty(): %d\n",
- err);
- rtrs_rdma_error_recovery(con);
- }
+ rtrs_clt_repost_recv(con);
break;
case IB_WC_RECV:
/*
@@ -689,6 +673,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc)
return rtrs_clt_rkey_rsp_done(con, wc);
}
+ rtrs_clt_repost_recv(con);
break;
case IB_WC_RDMA_WRITE:
/*
@@ -1710,7 +1695,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)
/* QD * (REQ + RSP + FR REGS or INVS) + drain */
clt_path->queue_depth * 4 + 1);
max_recv_wr = min_t(int, wr_limit,
- clt_path->queue_depth * 3 + 1);
+ clt_path->queue_depth * 2 + 1);
max_send_sge = 2;
}
atomic_set(&con->c.sq_wr_avail, max_send_wr);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 584/990] RDMA/core: Clear driver_udata before destroying objects in rdma_core
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (582 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 583/990] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 585/990] dmaengine: ste_dma40: Preserve the LCPA I/O address space Greg Kroah-Hartman
` (268 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jacob Moroni, Leon Romanovsky,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <jmoroni@google.com>
[ Upstream commit d37e98844afea39a9614cac0de837701263c90f7 ]
When uobject creation fails while copying user output data (i.e.,
after the HW object has been created), it calls
rdma_alloc_abort_uobject() with hw_obj_valid=true which then
invokes the object's destroy callback, but passes the
uverbs_attr_bundle from the original creation command.
The issue is that drivers are expected to validate the udata
and return an error if there's unexpected content, and data from
the wrong command counts as "unexpected content", so this ends
up causing the driver's destroy call to fail.
A similar issue exists in the rereg_mr path when a new MR
is created and the old one is destroyed.
Fix this by clearing driver_udata before invoking the driver's
destroy method.
Fixes: 6e0954b11c05 ("RDMA/uverbs: Allow drivers to create a new HW object during rereg_mr")
Fixes: 0ac8903cbbe6 ("RDMA/core: Allow the ioctl layer to abort a fully created uobject")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
Link: https://patch.msgid.link/20261006152908.888059-1-jmoroni@google.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Backport keeps only the two rdma_core.c call-site hunks and drops the helper move to an inline, the create_qp() change and the NULL-attrs handling, since the helper stays a plain function in uverbs_cmd.c here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/core/rdma_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
index 18918f4633614..9503c7e90bd87 100644
--- a/drivers/infiniband/core/rdma_core.c
+++ b/drivers/infiniband/core/rdma_core.c
@@ -688,6 +688,7 @@ void rdma_assign_uobject(struct ib_uobject *to_uobj, struct ib_uobject *new_uobj
* If this fails then the uobject is still completely valid (though with
* a new ID) and we leak it until context close.
*/
+ uverbs_get_cleared_udata(attrs);
uverbs_destroy_uobject(to_uobj, RDMA_REMOVE_DESTROY, attrs);
}
@@ -703,6 +704,7 @@ void rdma_alloc_abort_uobject(struct ib_uobject *uobj,
int ret;
if (hw_obj_valid) {
+ uverbs_get_cleared_udata(attrs);
ret = uobj->uapi_object->type_class->destroy_hw(
uobj, RDMA_REMOVE_ABORT, attrs);
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 585/990] dmaengine: ste_dma40: Preserve the LCPA I/O address space
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (583 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 584/990] RDMA/core: Clear driver_udata before destroying objects in rdma_core Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 586/990] net: devmem: check uid and netns in net_devmem_get_binding() Greg Kroah-Hartman
` (267 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernel test robot, Linus Walleij,
Frank Li, Vinod Koul, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <linusw@kernel.org>
[ Upstream commit 42c31fec1ca76b8b5f7759def122d418dff2cd4b ]
The LCPA area is mapped with devm_ioremap(), but lcpa_base and the
per-channel lcpa pointer lack __iomem annotations. This loses the I/O
address space and makes sparse warn when d40_current_addr() assigns
LCPA register addresses to its __iomem pointers.
Annotate both pointers and the LCPA argument of d40_log_lli_lcpa_write()
to preserve the I/O address space from the mapping to the register
accessors. This also fixes the existing LCPA read and write warnings
without changing the generated code.
Fixes: c80edceff29e ("dmaengine: ste_dma40: Fix cyclic transfer residue")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202610090216.pjMRxhRL-lkp@intel.com/
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20261010-dma40-smatch-fix-v1-1-26ca10043957@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/ste_dma40.c | 4 ++--
drivers/dma/ste_dma40_ll.c | 8 ++++----
drivers/dma/ste_dma40_ll.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 2c83eb05faa16..6699689deecae 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -509,7 +509,7 @@ struct d40_chan {
u32 src_def_cfg;
u32 dst_def_cfg;
struct d40_def_lcsp log_def;
- struct d40_log_lli_full *lcpa;
+ struct d40_log_lli_full __iomem *lcpa;
/* Runtime reconfiguration */
dma_addr_t runtime_addr;
enum dma_transfer_direction runtime_direction;
@@ -617,7 +617,7 @@ struct d40_base {
/* Physical half channels */
struct d40_phy_res *phy_res;
struct d40_lcla_pool lcla_pool;
- void *lcpa_base;
+ void __iomem *lcpa_base;
dma_addr_t phy_lcpa;
resource_size_t lcpa_size;
struct kmem_cache *desc_slab;
diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c
index 4c489b126cb27..3be7f5b1abb08 100644
--- a/drivers/dma/ste_dma40_ll.c
+++ b/drivers/dma/ste_dma40_ll.c
@@ -333,10 +333,10 @@ static void d40_log_lli_link(struct d40_log_lli *lli_dst,
(dlos << D40_MEM_LCSP1_SLOS_POS);
}
-void d40_log_lli_lcpa_write(struct d40_log_lli_full *lcpa,
- struct d40_log_lli *lli_dst,
- struct d40_log_lli *lli_src,
- int next, unsigned int flags)
+void d40_log_lli_lcpa_write(struct d40_log_lli_full __iomem *lcpa,
+ struct d40_log_lli *lli_dst,
+ struct d40_log_lli *lli_src,
+ int next, unsigned int flags)
{
d40_log_lli_link(lli_dst, lli_src, next, flags);
diff --git a/drivers/dma/ste_dma40_ll.h b/drivers/dma/ste_dma40_ll.h
index 55090cb310579..ca9d076493610 100644
--- a/drivers/dma/ste_dma40_ll.h
+++ b/drivers/dma/ste_dma40_ll.h
@@ -455,7 +455,7 @@ int d40_log_sg_to_lli(struct scatterlist *sg,
u32 lcsp13, /* src or dst*/
u32 data_width1, u32 data_width2);
-void d40_log_lli_lcpa_write(struct d40_log_lli_full *lcpa,
+void d40_log_lli_lcpa_write(struct d40_log_lli_full __iomem *lcpa,
struct d40_log_lli *lli_dst,
struct d40_log_lli *lli_src,
int next, unsigned int flags);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 586/990] net: devmem: check uid and netns in net_devmem_get_binding()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (584 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 585/990] dmaengine: ste_dma40: Preserve the LCPA I/O address space Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 587/990] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Greg Kroah-Hartman
` (266 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kaifeng Wang, Stanislav Fomichev,
Bobby Eshleman, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaifeng Wang <kaifengw@google.com>
[ Upstream commit 3a82195416fd71fdd6cb4ff80f611ec28073be16 ]
NETDEV_CMD_BIND_TX is unprivileged, and dmabuf binding IDs are allocated
from a single global xarray. Currently net_devmem_get_binding() looks up
the binding by ID without checking whether the sending socket belongs to
the same user or network namespace that created the binding.
Record the creating netlink socket's network namespace and UID on the
binding, and verify both in net_devmem_get_binding() before checking the
route destination device. Return -EINVAL on mismatch so callers cannot
distinguish non-existent IDs from bindings owned by other users.
Fixes: bd61848900bf ("net: devmem: Implement TX path")
Signed-off-by: Kaifeng Wang <kaifengw@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Kept this branch's simpler net_devmem_bind_dmabuf() signature, adding nl_sk without the vdev/niov_shift parameters or the netkit bind-device logic, and adjusted the struct hunk context. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/devmem.c | 7 ++++++-
net/core/devmem.h | 5 +++++
net/core/netdev-genl.c | 6 ++++--
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/net/core/devmem.c b/net/core/devmem.c
index 16ce197cb0faf..9b937d426cb9a 100644
--- a/net/core/devmem.c
+++ b/net/core/devmem.c
@@ -180,6 +180,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,
struct device *dma_dev,
enum dma_data_direction direction,
unsigned int dmabuf_fd, struct netdev_nl_sock *priv,
+ const struct sock *nl_sk,
struct netlink_ext_ack *extack)
{
struct net_devmem_dmabuf_binding *binding;
@@ -207,6 +208,8 @@ net_devmem_bind_dmabuf(struct net_device *dev,
}
binding->dev = dev;
+ write_pnet(&binding->net, sock_net(nl_sk));
+ binding->uid = sk_uid(nl_sk);
xa_init_flags(&binding->bound_rxqs, XA_FLAGS_ALLOC);
refcount_set(&binding->ref, 1);
@@ -374,7 +377,9 @@ struct net_devmem_dmabuf_binding *net_devmem_get_binding(struct sock *sk,
int err = 0;
binding = net_devmem_lookup_dmabuf(dmabuf_id);
- if (!binding || !binding->tx_vec) {
+ if (!binding || !binding->tx_vec ||
+ !net_eq(sock_net(sk), read_pnet(&binding->net)) ||
+ !uid_eq(sk_uid(sk), binding->uid)) {
err = -EINVAL;
goto out_err;
}
diff --git a/net/core/devmem.h b/net/core/devmem.h
index 101150d761af2..674279180dc8d 100644
--- a/net/core/devmem.h
+++ b/net/core/devmem.h
@@ -10,6 +10,7 @@
#ifndef _NET_DEVMEM_H
#define _NET_DEVMEM_H
+#include <net/net_namespace.h>
#include <net/netmem.h>
#include <net/netdev_netlink.h>
@@ -21,6 +22,8 @@ struct net_devmem_dmabuf_binding {
struct sg_table *sgt;
struct net_device *dev;
struct gen_pool *chunk_pool;
+ possible_net_t net;
+ kuid_t uid;
/* Protect dev */
struct mutex lock;
@@ -88,6 +91,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,
struct device *dma_dev,
enum dma_data_direction direction,
unsigned int dmabuf_fd, struct netdev_nl_sock *priv,
+ const struct sock *nl_sk,
struct netlink_ext_ack *extack);
struct net_devmem_dmabuf_binding *net_devmem_lookup_dmabuf(u32 id);
void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding);
@@ -175,6 +179,7 @@ net_devmem_bind_dmabuf(struct net_device *dev,
enum dma_data_direction direction,
unsigned int dmabuf_fd,
struct netdev_nl_sock *priv,
+ const struct sock *nl_sk,
struct netlink_ext_ack *extack)
{
return ERR_PTR(-EOPNOTSUPP);
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index 77042ac6d0428..d42e4c4d7a7d3 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -1004,7 +1004,8 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
}
binding = net_devmem_bind_dmabuf(netdev, dma_dev, DMA_FROM_DEVICE,
- dmabuf_fd, priv, info->extack);
+ dmabuf_fd, priv, NETLINK_CB(skb).sk,
+ info->extack);
if (IS_ERR(binding)) {
err = PTR_ERR(binding);
goto err_rxq_bitmap;
@@ -1097,7 +1098,8 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)
dma_dev = netdev_queue_get_dma_dev(netdev, 0);
binding = net_devmem_bind_dmabuf(netdev, dma_dev, DMA_TO_DEVICE,
- dmabuf_fd, priv, info->extack);
+ dmabuf_fd, priv, NETLINK_CB(skb).sk,
+ info->extack);
if (IS_ERR(binding)) {
err = PTR_ERR(binding);
goto err_unlock_netdev;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 587/990] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (585 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 586/990] net: devmem: check uid and netns in net_devmem_get_binding() Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 588/990] net: stmmac: set real_num_tx_queues to max(offset + count) Greg Kroah-Hartman
` (265 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Boris Brezillon, Steven Price,
Adrián Larumbe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrián Larumbe <adrian.larumbe@collabora.com>
[ Upstream commit e9672bf9382ff80be21d586f88e50339b85f5766 ]
During device probe(), failure to do a PM get() will leave the usage_count
set to 0, which is the value assigned at device creation time. That means
when the autosuspend delay expires, runtime suspend callback won't be
invoked, so the device will remain powered on forever.
On top of that, failure to call PM put() during device unplug means
Panfrost device's PM usage_count increases monotonically for every new
module reload.
The outcome of both of the above meant that:
- Devfreq OPP transition notifications would be printed all the time,
even when no jobs are being submitted. This quickly fills the kernel
ring buffer with junk.
- Because MMU interrupts are only enabled when the device is reset,
the very first job targeting the tiler heap BO after device probe()
would always time out, since the driver's PM runtime resume callback
would not be invoked.
To fix the above:
- Manually adjust the PM refcnt at device probe and removal time.
- Ensure pm_runtime_dont_use_autosuspend is called in the wind-down path.
- Call pm_runtime_put_autosuspend() when device is ready to accept jobs
Fixes: 635430797d3f ("drm/panfrost: Rework runtime PM initialization")
Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20261012-claude-fixes-v15-6-bc0a6c498553@collabora.com
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
[ sashal: Replaced pfdev->base.dev with pfdev->dev, and placed pm_runtime_put_autosuspend() after panfrost_gem_shrinker_init() since this tree's probe has that extra step and error label. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index a31c5395de18c..2d49edaa9467d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -761,6 +761,11 @@ static int panfrost_probe(struct platform_device *pdev)
goto err_out0;
}
+ /* The reason we must manually set the PM status and usage counter is
+ * we have just powered the device up but did not go through the PM
+ * runtime resume callback, so we need to update these ourselves.
+ */
+ pm_runtime_get_noresume(pfdev->dev);
pm_runtime_set_active(pfdev->dev);
pm_runtime_mark_last_busy(pfdev->dev);
pm_runtime_enable(pfdev->dev);
@@ -779,14 +784,18 @@ static int panfrost_probe(struct platform_device *pdev)
if (err)
goto err_out2;
+ pm_runtime_put_autosuspend(pfdev->dev);
+
return 0;
err_out2:
drm_dev_unregister(ddev);
err_out1:
+ pm_runtime_dont_use_autosuspend(pfdev->dev);
pm_runtime_disable(pfdev->dev);
panfrost_device_fini(pfdev);
pm_runtime_set_suspended(pfdev->dev);
+ pm_runtime_put_noidle(pfdev->dev);
err_out0:
drm_dev_put(ddev);
return err;
@@ -801,9 +810,11 @@ static void panfrost_remove(struct platform_device *pdev)
panfrost_gem_shrinker_cleanup(ddev);
pm_runtime_get_sync(pfdev->dev);
+ pm_runtime_dont_use_autosuspend(pfdev->dev);
pm_runtime_disable(pfdev->dev);
panfrost_device_fini(pfdev);
pm_runtime_set_suspended(pfdev->dev);
+ pm_runtime_put_noidle(pfdev->dev);
drm_dev_put(ddev);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 588/990] net: stmmac: set real_num_tx_queues to max(offset + count)
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (586 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 587/990] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 589/990] net: stmmac: align real_num_tx_queues to mqprio configuration Greg Kroah-Hartman
` (264 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Daniel Thompson,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit d128212667593c548a3c67d30031063ed46c29b7 ]
tc_setup_dwmac510_mqprio() computes the number of real TX queues as the
sum of the per-TC queue counts. mqprio_validate_queue_counts() only
rejects out-of-bounds or overlapping ranges, so layouts with gaps or a
non-zero first offset are accepted, and in those cases the sum is smaller
than the highest queue referenced by the netdev TC map.
netif_set_real_num_tx_queues() then passes this too-small count to
netif_setup_tc(). However stmmac_set_ndev_tcs() has already zeroed
dev->prio_tc_map() through netdev_reset_tc(), so when netif_setup_tc()
runs every priority maps to TC0 and only the TC0 range is checked. A
layout whose TC0 range fits but where a later TC references a queue
beyond the new real_num_tx_queues is left with num_tc set and its TC map
pointing at queues that are no longer real, without any warning; only
when TC0 itself is out of range is the mapping disabled. The real
prio_tc_map is programmed later by the qdisc, after this call, so the
driver cannot rely on netif_setup_tc() to catch those cases.
Compute num_tx_queues as the maximum of offset[i] + count[i] instead of
the sum of the counts, so real_num_tx_queues always covers the highest
queue referenced by the TC map. This is a no-op for the contiguous
channel-mode layouts where offset[i] == i and count[i] == 1.
The issue has been reported by sashiko and the patch has been tested on
Qualcomm RB3-Gen2 board.
Fixes: 195e4f409a40 ("net: stmmac: support fp parameter of tc-mqprio")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261006-stmmac-mqprio-prio-offload-v5-1-d7da93419784@oss.qualcomm.com
Tested-by: Daniel Thompson <daniel@riscstar.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 49161241d0328..bd28d0e6361d0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -1268,7 +1268,7 @@ static int tc_setup_dwmac510_mqprio(struct stmmac_priv *priv,
for (u32 tc = 0; tc < num_tc; tc++) {
offset = qopt->offset[tc];
count = qopt->count[tc];
- num_stack_tx_queues += count;
+ num_stack_tx_queues = max(num_stack_tx_queues, offset + count);
err = netdev_set_tc_queue(ndev, tc, count, offset);
if (err)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 589/990] net: stmmac: align real_num_tx_queues to mqprio configuration
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (587 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 588/990] net: stmmac: set real_num_tx_queues to max(offset + count) Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 590/990] wifi: ath12k: Fix NAPI resource leaks in AHB external IRQ paths Greg Kroah-Hartman
` (263 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maxime Chevallier, Lorenzo Bianconi,
Daniel Thompson, Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit ac1ca0c3e139a2ebef2fc6c570af6647329726f1 ]
stmmac_hw_setup() unconditionally sets the number of real TX queues to
plat->tx_queues_to_use on every device open. When a tc-mqprio qdisc is
offloaded the driver reduces netif_set_real_num_tx_queues() to the number
of queues enabled by the offload, but the next device open reverts it to
plat->tx_queues_to_use while the netdev TC map is still the one programmed
by the qdisc, leaving the two inconsistent.
Track the number of TX queues enabled by the current qdisc configuration
in the per-qdisc state (priv->xmit_qdisc.num_tx_queues) and use it in
stmmac_hw_setup(). The field defaults to plat->tx_queues_to_use at probe
time and when the mqprio qdisc is destroyed, meaning no offload is active
and the number of real TX queues must match the number of queues the
driver allocated, and it is updated to the offloaded queue count on a
successful mqprio setup.
mqprio only validates the requested queue ranges against
dev->real_num_tx_queues, which can be larger than plat->tx_queues_to_use
while the interface has not been opened yet. Reject a qopt whose highest
referenced queue (offset + count) exceeds plat->tx_queues_to_use, so
xmit_qdisc.num_tx_queues can never be larger than the number of TX queues
the driver provisions. Otherwise stmmac_hw_setup() would expose TX queues
without an allocated DMA ring.
Refuse to lower the number of TX queues below the count required by the
active mqprio offload in stmmac_reinit_queues(), otherwise
netif_set_real_num_tx_queues() would leave real_num_tx_queues
inconsistent with the netdev TC map.
The issue has been reported by sashiko and the patch has been tested on
a Qualcomm RB3-Gen2 board.
Fixes: 195e4f409a40 ("net: stmmac: support fp parameter of tc-mqprio")
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20261006-stmmac-mqprio-prio-offload-v5-2-d7da93419784@oss.qualcomm.com
Tested-by: Daniel Thompson <daniel@riscstar.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Moved the queue-range check into a pre-pass before any state change, since the local mqprio setup lacks upstream's staging arrays, and used the existing num_stack_tx_queues variable. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 ++++++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++++++++++-
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 15 +++++++++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 61e182278d156..7cb09679a0d97 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -282,6 +282,12 @@ struct stmmac_priv {
/* Protect est parameters */
struct mutex est_lock;
struct stmmac_est *est;
+
+ struct {
+ bool enabled;
+ u32 num_tx_queues;
+ } xmit_qdisc;
+
struct dma_features dma_cap;
struct stmmac_counters mmc;
int hw_cap_support;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 0dc333218aa98..c4053684dec3f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3552,7 +3552,7 @@ static int stmmac_hw_setup(struct net_device *dev)
/* Configure real RX and TX queues */
netif_set_real_num_rx_queues(dev, priv->plat->rx_queues_to_use);
- netif_set_real_num_tx_queues(dev, priv->plat->tx_queues_to_use);
+ netif_set_real_num_tx_queues(dev, priv->xmit_qdisc.num_tx_queues);
/* Start the ball rolling... */
stmmac_start_all_dma(priv);
@@ -7484,6 +7484,10 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
struct stmmac_priv *priv = netdev_priv(dev);
int ret = 0, i;
+ if (priv->xmit_qdisc.enabled &&
+ tx_cnt < priv->xmit_qdisc.num_tx_queues)
+ return -EINVAL;
+
if (netif_running(dev))
stmmac_release(dev);
@@ -7491,6 +7495,9 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
priv->plat->rx_queues_to_use = rx_cnt;
priv->plat->tx_queues_to_use = tx_cnt;
+ if (!priv->xmit_qdisc.enabled)
+ priv->xmit_qdisc.num_tx_queues = tx_cnt;
+
if (!netif_is_rxfh_configured(dev))
for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
priv->rss.table[i] = ethtool_rxfh_indir_default(i,
@@ -7682,6 +7689,9 @@ int stmmac_dvr_probe(struct device *device,
ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
NETDEV_XDP_ACT_XSK_ZEROCOPY;
+ /* Default qdisc num_tx_queues */
+ priv->xmit_qdisc.num_tx_queues = priv->plat->tx_queues_to_use;
+
ret = stmmac_tc_init(priv, priv);
if (!ret) {
ndev->hw_features |= NETIF_F_HW_TC;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index bd28d0e6361d0..a254644bc7b81 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -1242,6 +1242,9 @@ static int stmmac_reset_tc_mqprio(struct net_device *ndev,
{
struct stmmac_priv *priv = netdev_priv(ndev);
+ priv->xmit_qdisc.num_tx_queues = priv->plat->tx_queues_to_use;
+ priv->xmit_qdisc.enabled = false;
+
netdev_reset_tc(ndev);
netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use);
@@ -1261,6 +1264,15 @@ static int tc_setup_dwmac510_mqprio(struct stmmac_priv *priv,
if (!num_tc)
return stmmac_reset_tc_mqprio(ndev, extack);
+ for (u32 tc = 0; tc < num_tc; tc++) {
+ if (qopt->offset[tc] + qopt->count[tc] >
+ priv->plat->tx_queues_to_use) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Queues exceed hw TX queues");
+ return -EINVAL;
+ }
+ }
+
err = netdev_set_num_tc(ndev, num_tc);
if (err)
return err;
@@ -1284,6 +1296,9 @@ static int tc_setup_dwmac510_mqprio(struct stmmac_priv *priv,
if (err)
goto err_reset_tc;
+ priv->xmit_qdisc.num_tx_queues = num_stack_tx_queues;
+ priv->xmit_qdisc.enabled = true;
+
return 0;
err_reset_tc:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 590/990] wifi: ath12k: Fix NAPI resource leaks in AHB external IRQ paths
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (588 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 589/990] net: stmmac: align real_num_tx_queues to mqprio configuration Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 591/990] wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup Greg Kroah-Hartman
` (262 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aaradhana Sahu, Baochen Qiang,
Rameshkumar Sundaram, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaradhana Sahu <aaradhana.sahu@oss.qualcomm.com>
[ Upstream commit ebc938ba1d5ff33652013b99c7b9a74f05690336 ]
Currently, NAPI instances and their associated netdevs allocated for AHB
external IRQ groups are not released when external IRQ configuration
fails. They are also not freed when arch_init() fails after
ath12k_ahb_config_irq() succeeds during probe, or when the driver is
unloaded.
Fix this by adding a common cleanup helper to release the NAPI instances
and associated netdevs. Call it from the external IRQ configuration error
path, probe error path, and driver cleanup path.
Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.6-01275-QCAHKSWPL_SILICONZ-1
Fixes: 6cee30f0da75 ("wifi: ath12k: add AHB driver support for IPQ5332")
Fixes: 614c23e24ee8 ("wifi: ath12k: Support arch-specific DP device allocation")
Signed-off-by: Aaradhana Sahu <aaradhana.sahu@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20261001045423.493121-1-aaradhana.sahu@oss.qualcomm.com
[renamed label err_free_irq]
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: Dropped the arch_init/arch_deinit parts missing on this branch and routed the ath12k_core_init() failure in probe to the new err_free_ext_napi label. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/ahb.c | 41 ++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index 1a1195951a140..39cb9901dbd76 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -183,6 +183,26 @@ static void __ath12k_ahb_ext_irq_disable(struct ath12k_base *ab)
}
}
+static void ath12k_ahb_free_napi_for_group(struct ath12k_ext_irq_grp *irq_grp)
+{
+ netif_napi_del(&irq_grp->napi);
+ free_netdev(irq_grp->napi_ndev);
+ irq_grp->napi_ndev = NULL;
+}
+
+static void ath12k_ahb_free_napi(struct ath12k_base *ab, int num_ext_irq_grp)
+{
+ int i;
+
+ for (i = 0; i < num_ext_irq_grp; i++)
+ ath12k_ahb_free_napi_for_group(&ab->ext_irq_grp[i]);
+}
+
+static void ath12k_ahb_free_ext_napi(struct ath12k_base *ab)
+{
+ ath12k_ahb_free_napi(ab, ATH12K_EXT_IRQ_GRP_NUM_MAX);
+}
+
static void ath12k_ahb_ext_grp_enable(struct ath12k_ext_irq_grp *irq_grp)
{
int i;
@@ -580,8 +600,10 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
irq_grp->grp_id = i;
irq_grp->napi_ndev = alloc_netdev_dummy(0);
- if (!irq_grp->napi_ndev)
- return -ENOMEM;
+ if (!irq_grp->napi_ndev) {
+ ret = -ENOMEM;
+ goto free_napi_ndev;
+ }
netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi,
ath12k_ahb_ext_grp_napi_poll);
@@ -628,12 +650,19 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
ath12k_ahb_ext_interrupt_handler,
IRQF_TRIGGER_RISING,
irq_name[irq_idx], irq_grp);
- if (ret)
+ if (ret) {
ath12k_warn(ab, "failed request_irq for %d\n", irq);
+ ath12k_ahb_free_napi_for_group(irq_grp);
+ goto free_napi_ndev;
+ }
}
}
return 0;
+
+free_napi_ndev:
+ ath12k_ahb_free_napi(ab, i);
+ return ret;
}
static int ath12k_ahb_config_irq(struct ath12k_base *ab)
@@ -1071,11 +1100,14 @@ static int ath12k_ahb_probe(struct platform_device *pdev)
ret = ath12k_core_init(ab);
if (ret) {
ath12k_err(ab, "failed to init core: %d\n", ret);
- goto err_rproc_deconfigure;
+ goto err_free_ext_napi;
}
return 0;
+err_free_ext_napi:
+ ath12k_ahb_free_ext_napi(ab);
+
err_rproc_deconfigure:
ath12k_ahb_deconfigure_rproc(ab);
@@ -1115,6 +1147,7 @@ static void ath12k_ahb_free_resources(struct ath12k_base *ab)
{
struct platform_device *pdev = ab->pdev;
+ ath12k_ahb_free_ext_napi(ab);
ath12k_hal_srng_deinit(ab);
ath12k_ce_free_pipes(ab);
ath12k_ahb_resource_deinit(ab);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 591/990] wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (589 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 590/990] wifi: ath12k: Fix NAPI resource leaks in AHB external IRQ paths Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 592/990] bnge: skip dev_addr when building the VNIC unicast list Greg Kroah-Hartman
` (261 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jiale Yao, Baochen Qiang,
Rameshkumar Sundaram, Jeff Johnson, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <yaojiale02@163.com>
[ Upstream commit 94c7b50351fd30e1dfe1b4051197a1445d8547e1 ]
The pending management TX cleanup walks txmgmt_idr with idr_for_each(),
and its callback removes the current entry. This can invalidate the
radix-tree iterator retained by idr_for_each().
Use idr_for_each_entry() so every iteration starts with a fresh lookup.
Continue to remove each entry under txmgmt_idr_lock before freeing its skb,
preventing concurrent TX completion from finding a stale skb pointer.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20261003092104.520135-5-yaojiale02@163.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
[ sashal: adjusted context lines in core.c, mac.c and mac.h to match the older tree; the functional change is identical to upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath12k/core.c | 3 +--
drivers/net/wireless/ath/ath12k/mac.c | 12 ++++++------
drivers/net/wireless/ath/ath12k/mac.h | 2 +-
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index dc969b2516ea0..8a11ff7fb58fc 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -1468,8 +1468,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
complete_all(&ar->regd_update_completed);
wake_up(&ar->dp.tx_empty_waitq);
- idr_for_each(&ar->txmgmt_idr,
- ath12k_mac_tx_mgmt_pending_free, ar);
+ ath12k_mac_tx_mgmt_pending_free(ar);
idr_destroy(&ar->txmgmt_idr);
wake_up(&ar->txmgmt_empty_waitq);
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index b9c943b219546..13a7d60c50c7c 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -8476,13 +8476,13 @@ static void ath12k_mac_tx_mgmt_free(struct ath12k *ar, int buf_id)
ath12k_mgmt_over_wmi_tx_drop(ar, msdu);
}
-int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx)
+void ath12k_mac_tx_mgmt_pending_free(struct ath12k *ar)
{
- struct ath12k *ar = ctx;
-
- ath12k_mac_tx_mgmt_free(ar, buf_id);
+ struct sk_buff *msdu;
+ int buf_id;
- return 0;
+ idr_for_each_entry(&ar->txmgmt_idr, msdu, buf_id)
+ ath12k_mac_tx_mgmt_free(ar, buf_id);
}
static void ath12k_mac_vif_txmgmt_cleanup(struct ath12k *ar,
@@ -13977,7 +13977,7 @@ static struct wiphy_iftype_ext_capab ath12k_iftypes_ext_capa[] = {
static void ath12k_mac_cleanup_unregister(struct ath12k *ar)
{
- idr_for_each(&ar->txmgmt_idr, ath12k_mac_tx_mgmt_pending_free, ar);
+ ath12k_mac_tx_mgmt_pending_free(ar);
idr_destroy(&ar->txmgmt_idr);
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
diff --git a/drivers/net/wireless/ath/ath12k/mac.h b/drivers/net/wireless/ath/ath12k/mac.h
index 1f689e367c8a1..0d75fae5c7bf7 100644
--- a/drivers/net/wireless/ath/ath12k/mac.h
+++ b/drivers/net/wireless/ath/ath12k/mac.h
@@ -172,7 +172,7 @@ struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id)
void ath12k_mac_drain_tx(struct ath12k *ar);
void ath12k_mac_peer_cleanup_all(struct ath12k *ar);
-int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
+void ath12k_mac_tx_mgmt_pending_free(struct ath12k *ar);
enum rate_info_bw ath12k_mac_bw_to_mac80211_bw(enum ath12k_supported_bw bw);
enum ath12k_supported_bw ath12k_mac_mac80211_bw_to_ath12k_bw(enum rate_info_bw bw);
enum hal_encrypt_type ath12k_dp_tx_get_encrypt_type(u32 cipher);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 592/990] bnge: skip dev_addr when building the VNIC unicast list
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (590 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 591/990] wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 593/990] RDMA/bnxt_re: Use kvzalloc for QP table allocation Greg Kroah-Hartman
` (260 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vikas Gupta, Dharmender Garg,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikas Gupta <vikas.gupta@broadcom.com>
[ Upstream commit 0b3fc7fe6f3f68569b9f9139893491b61a4b45b9 ]
The default VNIC programs the device's MAC as L2 filter 0 in
bnge_init_chip() via bnge_hwrm_set_vnic_filter(bn, 0, 0, dev_addr).
bnge_cfg_rx_mode() then walks dev->uc and programs each unicast
address as a further L2 filter, without excluding dev_addr.
Skip dev_addr when building uc_list, since it is already installed as
filter 0. As dev_addr now takes neither a uc_list slot nor an
l2_filters[] slot, count only the non-dev_addr entries for the
uc_list overflow check too, otherwise an input such as
{dev_addr, A, B, C} would needlessly fall back to promiscuous mode
even though A, B and C fit in exact-match filters.
bnge_uc_list_updated() applies the same skip and count so the
change detection stays consistent and does not loop.
This issue was caught by Sashiko (nipa).
Tested on Thor Ultra device.
Fixes: 9afad4a17174 ("bng_en: Configure default VNIC")
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Reviewed-by: Dharmender Garg <dharmender.garg@broadcom.com>
Link: https://patch.msgid.link/20261006141928.1432927-1-vikas.gupta@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Adapted to the older API: kept dev-based netdev_for_each_uc_addr() iteration and locking in bnge_cfg_def_vnic() instead of the upstream uc/snapshot parameters and bnge_cfg_rx_mode(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/broadcom/bnge/bnge_netdev.c | 27 +++++++++++++------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index 02be751f3d8fc..d1c55ac9318f2 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -1670,18 +1670,19 @@ static bool bnge_uc_list_updated(struct bnge_net *bn)
struct bnge_vnic_info *vnic = &bn->vnic_info[BNGE_VNIC_DEFAULT];
struct net_device *dev = bn->netdev;
struct netdev_hw_addr *ha;
- int off = 0;
-
- if (netdev_uc_count(dev) != (vnic->uc_filter_count - 1))
- return true;
+ int off = 0, count = 0;
netdev_for_each_uc_addr(ha, dev) {
+ if (ether_addr_equal(ha->addr, dev->dev_addr))
+ continue;
+ if (count >= vnic->uc_filter_count - 1)
+ return true;
if (!ether_addr_equal(ha->addr, vnic->uc_list + off))
return true;
-
off += ETH_ALEN;
+ count++;
}
- return false;
+ return count != vnic->uc_filter_count - 1;
}
static bool bnge_promisc_ok(struct bnge_net *bn)
@@ -1693,9 +1694,9 @@ static int bnge_cfg_def_vnic(struct bnge_net *bn)
{
struct bnge_vnic_info *vnic = &bn->vnic_info[BNGE_VNIC_DEFAULT];
struct net_device *dev = bn->netdev;
+ int i, off = 0, rc, uc_count = 0;
struct bnge_dev *bd = bn->bd;
struct netdev_hw_addr *ha;
- int i, off = 0, rc;
bool uc_update;
netif_addr_lock_bh(dev);
@@ -1715,10 +1716,20 @@ static int bnge_cfg_def_vnic(struct bnge_net *bn)
vnic->uc_filter_count = 1;
netif_addr_lock_bh(dev);
- if (netdev_uc_count(dev) > (BNGE_MAX_UC_ADDRS - 1)) {
+ /* dev_addr is already programmed as L2 filter 0, so it takes neither a
+ * uc_list slot nor an l2_filters[] slot. Count only the entries that
+ * will actually be programmed so the overflow check matches the fill
+ * loop below (and bnge_uc_list_updated()).
+ */
+ netdev_for_each_uc_addr(ha, dev)
+ if (!ether_addr_equal(ha->addr, dev->dev_addr))
+ uc_count++;
+ if (uc_count > BNGE_MAX_UC_ADDRS - 1) {
vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
} else {
netdev_for_each_uc_addr(ha, dev) {
+ if (ether_addr_equal(ha->addr, dev->dev_addr))
+ continue;
memcpy(vnic->uc_list + off, ha->addr, ETH_ALEN);
off += ETH_ALEN;
vnic->uc_filter_count++;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 593/990] RDMA/bnxt_re: Use kvzalloc for QP table allocation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (591 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 592/990] bnge: skip dev_addr when building the VNIC unicast list Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 594/990] RDMA/bnxt_re: Unpublish QP table before freeing it Greg Kroah-Hartman
` (259 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Abhishek Mohapatra, Selvin Xavier,
Leon Romanovsky, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhishek Mohapatra <abhishek.mohapatra@broadcom.com>
[ Upstream commit 724a39b36af94787d32094da87729f24a28888b7 ]
The QP table size depends on the firmware reported max_qp, so it can
be large and a physically contiguous kzalloc may fail. Use kvzalloc_objs()
and free it with kvfree().
Fixes: 82f1f575aa13 ("RDMA/bnxt_re: Fix allocation of QP table")
Signed-off-by: Abhishek Mohapatra <abhishek.mohapatra@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/20261013140427.256612-2-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Replaced kzalloc_objs() with kvcalloc() for the QP table allocation, since the older kcalloc() form is what this branch had and kvzalloc_objs() doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/bnxt_re/qplib_res.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
index d92db77e7ed50..ad0ba952eb48d 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
@@ -867,7 +867,7 @@ int bnxt_qplib_init_res(struct bnxt_qplib_res *res)
void bnxt_qplib_free_res(struct bnxt_qplib_res *res)
{
- kfree(res->rcfw->qp_tbl);
+ kvfree(res->rcfw->qp_tbl);
bnxt_qplib_free_sgid_tbl(res, &res->sgid_tbl);
bnxt_qplib_free_pd_tbl(&res->pd_tbl);
bnxt_qplib_free_dpi_tbl(res, &res->dpi_tbl);
@@ -884,8 +884,8 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct net_device *netdev)
/* Allocate one extra to hold the QP1 entries */
rcfw->qp_tbl_size = max_t(u32, BNXT_RE_MAX_QPC_COUNT + 1, dev_attr->max_qp);
- rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
- GFP_KERNEL);
+ rcfw->qp_tbl = kvcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
+ GFP_KERNEL);
if (!rcfw->qp_tbl)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 594/990] RDMA/bnxt_re: Unpublish QP table before freeing it
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (592 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 593/990] RDMA/bnxt_re: Use kvzalloc for QP table allocation Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 595/990] Bluetooth: btintel_pcie: remove duplicate BTINTEL_PCIE_MAGIC_NUM definition Greg Kroah-Hartman
` (258 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Selvin Xavier, Leon Romanovsky,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <selvin.xavier@broadcom.com>
[ Upstream commit 978361dd2ccff357d4fe6aac6ce057d1bfae8312 ]
bnxt_re_dev_uninit() frees the QP table before the RCFW channel is
disabled, so the CREQ tasklet can still look up rcfw->qp_tbl while it
is being freed.
Clear rcfw->qp_tbl under tbl_lock before freeing it, and have the QP
error notification handler bail out if the table is gone.
Fixes: 82f1f575aa13 ("RDMA/bnxt_re: Fix allocation of QP table")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Link: https://patch.msgid.link/20261013140427.256612-3-selvin.xavier@broadcom.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 4 ++++
drivers/infiniband/hw/bnxt_re/qplib_res.c | 10 +++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
index 4dad0cfcfa98d..a70aa6a83da3b 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
@@ -638,6 +638,10 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
err_event = (struct creq_qp_error_notification *)qp_event;
qp_id = le32_to_cpu(err_event->xid);
spin_lock(&rcfw->tbl_lock);
+ if (!rcfw->qp_tbl) {
+ spin_unlock(&rcfw->tbl_lock);
+ break;
+ }
tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw);
qp = rcfw->qp_tbl[tbl_indx].qp_handle;
if (!qp) {
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
index ad0ba952eb48d..5948e1f11384e 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
@@ -867,7 +867,15 @@ int bnxt_qplib_init_res(struct bnxt_qplib_res *res)
void bnxt_qplib_free_res(struct bnxt_qplib_res *res)
{
- kvfree(res->rcfw->qp_tbl);
+ struct bnxt_qplib_rcfw *rcfw = res->rcfw;
+ struct bnxt_qplib_qp_node *qp_tbl;
+
+ /* The CREQ tasklet may still be running; unpublish the table first */
+ spin_lock_bh(&rcfw->tbl_lock);
+ qp_tbl = rcfw->qp_tbl;
+ rcfw->qp_tbl = NULL;
+ spin_unlock_bh(&rcfw->tbl_lock);
+ kvfree(qp_tbl);
bnxt_qplib_free_sgid_tbl(res, &res->sgid_tbl);
bnxt_qplib_free_pd_tbl(&res->pd_tbl);
bnxt_qplib_free_dpi_tbl(res, &res->dpi_tbl);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 595/990] Bluetooth: btintel_pcie: remove duplicate BTINTEL_PCIE_MAGIC_NUM definition
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (593 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 594/990] RDMA/bnxt_re: Unpublish QP table before freeing it Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 596/990] Bluetooth: btintel_pcie: fix PM flow for S0ix, S3 and S4 Greg Kroah-Hartman
` (257 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chandrashekar Devegowda,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
[ Upstream commit 937363063afde2dce1f45d8f22514db99b9eba6b ]
Two identical definitions of BTINTEL_PCIE_MAGIC_NUM were present in
btintel_pcie.c, one indented with spaces and one with a tab. Remove the
space-indented duplicate and the surrounding blank lines. Kernel coding
style requires tabs for indentation, so keep the tab-indented copy.
No functional change.
Assisted-by: Copilot:claude-opus-4.7 sparse
Fixes: 6ed83047389c ("Bluetooth: btintel_pcie: Setup buffers for firmware traces")
Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Removed the duplicate space-indented BTINTEL_PCIE_MAGIC_NUM define and one blank line, since the two defines are not adjacent in this tree and the context differed. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btintel_pcie.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 3e8c894fbf640..75bbb2bb6be55 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -63,8 +63,6 @@ struct btintel_pcie_dev_recovery {
#define BTINTEL_PCIE_HCI_EVT_PKT 0x00000004
#define BTINTEL_PCIE_HCI_ISO_PKT 0x00000005
-#define BTINTEL_PCIE_MAGIC_NUM 0xA5A5A5A5
-
#define BTINTEL_PCIE_BLZR_HWEXP_SIZE 1024
#define BTINTEL_PCIE_BLZR_HWEXP_DMP_ADDR 0xB00A7C00
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 596/990] Bluetooth: btintel_pcie: fix PM flow for S0ix, S3 and S4
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (594 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 595/990] Bluetooth: btintel_pcie: remove duplicate BTINTEL_PCIE_MAGIC_NUM definition Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 597/990] Bluetooth: hci_event: Fix LE link drop on remote features command status Greg Kroah-Hartman
` (256 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ravindra, Sergey Lebedev,
Paul Menzel, Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ravindra <ravindra@intel.com>
[ Upstream commit 2926eb396711f1f843a0aafee6778822f50e9021 ]
Fix two issues in the PM suspend/resume path:
1. S3 was handled the same as S0ix, keeping the controller on the
D3hot-style path. That caused resume instability because S3 can
remove power from the controller, unlike s2idle/S0ix. Use
pm_suspend_target_state to distinguish them: D3_HOT for S0ix and
D3_COLD for S3/S4. Add .restore to force FLR-based firmware recovery
after S4 and S3 (PM_SUSPEND_MEM), as power is lost. S0ix resumes via
a normal D0 transition.
2. During hibernation, .freeze() puts the controller into the D3cold
state without any loss of power, and the flow normally continues to
.poweroff(). If hibernation instead fails, .thaw() is called to bring
the controller back up, and the old code routed it through
btintel_pcie_resume(), which forced FLR-based firmware recovery
whenever data->pm_sx_event was PM_EVENT_FREEZE. That check was
incorrect: since the controller's power was never actually removed on
this failed-hibernation path, FLR-based recovery is unnecessary. Remove
pm_sx_event and route .thaw through a normal D0 transition instead;
FLR-based recovery is retained only in .restore, where genuine S4
power loss requires it.
Tested with:
S0ix: sudo sh -c 'echo "+40" > /sys/class/rtc/rtc0/wakealarm' && \
echo freeze | sudo tee /sys/power/state
S3: sudo rtcwake -m mem -s 60
S4: sudo rtcwake -m disk -s 60
Fixes: e57362f4911b ("Bluetooth: btintel_pcie: Add support for _suspend() / _resume()")
Assisted-by: GitHub-Copilot:GPT5
Signed-off-by: Ravindra <ravindra@intel.com>
Tested-by: Sergey Lebedev <lsa.uz@pm.me>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Replaced the btintel_pcie_request_reset(data, FLR) call with btintel_pcie_reset() and kept the gp0_received = false resets, because the set_dxstate retry rework is missing here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/bluetooth/btintel_pcie.c | 45 +++++++++++++++++++++-----------
drivers/bluetooth/btintel_pcie.h | 2 --
2 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 75bbb2bb6be55..3799e5b20d5f7 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -13,6 +13,7 @@
#include <linux/wait.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/suspend.h>
#include <linux/unaligned.h>
#include <linux/devcoredump.h>
@@ -2580,10 +2581,12 @@ static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
data = pci_get_drvdata(pdev);
- dxstate = (mesg.event == PM_EVENT_SUSPEND ?
- BTINTEL_PCIE_STATE_D3_HOT : BTINTEL_PCIE_STATE_D3_COLD);
-
- data->pm_sx_event = mesg.event;
+ /* S0ix (s2idle) uses D3_HOT; S3, freeze and hibernate use D3_COLD. */
+ if (mesg.event == PM_EVENT_SUSPEND &&
+ pm_suspend_target_state == PM_SUSPEND_TO_IDLE)
+ dxstate = BTINTEL_PCIE_STATE_D3_HOT;
+ else
+ dxstate = BTINTEL_PCIE_STATE_D3_COLD;
data->gp0_received = false;
@@ -2622,7 +2625,7 @@ static int btintel_pcie_freeze(struct device *dev)
return btintel_pcie_suspend_late(dev, PMSG_FREEZE);
}
-static int btintel_pcie_resume(struct device *dev)
+static int btintel_pcie_resume_event(struct device *dev, pm_message_t mesg)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct btintel_pcie_data *data;
@@ -2634,15 +2637,12 @@ static int btintel_pcie_resume(struct device *dev)
start = ktime_get();
- /* When the system enters S4 (hibernate) mode, bluetooth device loses
- * power, which results in the erasure of its loaded firmware.
- * Consequently, function level reset (flr) is required on system
- * resume to bring the controller back into an operational state by
- * initiating a new firmware download.
+ /* S3 and S4 may cut power, erasing the firmware. Force FLR to recover
+ * instead of a normal D0 transition.
*/
-
- if (data->pm_sx_event == PM_EVENT_FREEZE ||
- data->pm_sx_event == PM_EVENT_HIBERNATE) {
+ if (mesg.event == PM_EVENT_RESTORE ||
+ (mesg.event == PM_EVENT_RESUME &&
+ pm_suspend_target_state == PM_SUSPEND_MEM)) {
set_bit(BTINTEL_PCIE_CORE_HALTED, &data->flags);
btintel_pcie_reset(data->hdev);
return 0;
@@ -2685,13 +2685,28 @@ static int btintel_pcie_resume(struct device *dev)
return 0;
}
+static int btintel_pcie_resume(struct device *dev)
+{
+ return btintel_pcie_resume_event(dev, PMSG_RESUME);
+}
+
+static int btintel_pcie_restore(struct device *dev)
+{
+ return btintel_pcie_resume_event(dev, PMSG_RESTORE);
+}
+
+static int btintel_pcie_thaw(struct device *dev)
+{
+ return btintel_pcie_resume_event(dev, PMSG_THAW);
+}
+
static const struct dev_pm_ops btintel_pcie_pm_ops = {
.suspend = btintel_pcie_suspend,
.resume = btintel_pcie_resume,
.freeze = btintel_pcie_freeze,
- .thaw = btintel_pcie_resume,
+ .thaw = btintel_pcie_thaw,
.poweroff = btintel_pcie_hibernate,
- .restore = btintel_pcie_resume,
+ .restore = btintel_pcie_restore,
};
static struct pci_driver btintel_pcie_driver = {
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index 481de85456e2b..43be595d20b65 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -461,7 +461,6 @@ struct btintel_pcie_dump_header {
* @txq: TX Queue struct
* @rxq: RX Queue struct
* @alive_intr_ctxt: Alive interrupt context
- * @pm_sx_event: PM event on which system got suspended
*/
struct btintel_pcie_data {
struct pci_dev *pdev;
@@ -511,7 +510,6 @@ struct btintel_pcie_data {
u32 alive_intr_ctxt;
struct btintel_pcie_dbgc dbgc;
struct btintel_pcie_dump_header dmp_hdr;
- u8 pm_sx_event;
};
static inline u32 btintel_pcie_rd_reg32(struct btintel_pcie_data *data,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 597/990] Bluetooth: hci_event: Fix LE link drop on remote features command status
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (595 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 596/990] Bluetooth: btintel_pcie: fix PM flow for S0ix, S3 and S4 Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 598/990] irqchip/mst-intc: Validate the DT interrupt range Greg Kroah-Hartman
` (255 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kevin Dewald, Luiz Augusto von Dentz,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Dewald <kevin@simpleble.org>
[ Upstream commit 91638f53ff2b8234195ff27ec913e068269a28e9 ]
When the local controller supports peripheral-initiated features
exchange, the LE Read Remote Features procedure also runs for incoming
connections, and it fails with Unsupported Remote Feature (0x1a) if the
central does not support that feature. hci_le_remote_feat_complete_evt()
and hci_le_read_all_remote_features_evt() handle this and let the
connection transition into connected state.
A controller can also return that error in the Command Status event
instead. An Intel controller does so for a central that does not
support peripheral-initiated features exchange, presumably because it
already has the features of the central. hci_cs_le_read_remote_features()
and hci_cs_le_read_all_remote_features() then confirm the connection as
failed while it is still in BT_CONFIG, and the hci_conn_drop() in
le_read_features_complete() disconnects it right away:
> HCI Event: LE Meta Event (0x3e) plen 31
LE Enhanced Connection Complete (0x0a)
Status: Success (0x00)
Role: Peripheral (0x01)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
> HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) ncmd 1
Status: Unsupported Remote Feature / Unsupported LMP Feature (0x1a)
< HCI Command: Disconnect (0x01|0x0006) plen 3
Reason: Remote User Terminated Connection (0x13)
Data the central sends afterwards is reported as:
Bluetooth: hci0: ACL packet for unknown connection handle 3585
Handle Unsupported Remote Feature in the command status the same way as
in the complete events.
Fixes: 0fe29fd1cd77 ("Bluetooth: Read LE remote features during connection establishment")
Fixes: a106e50be74b ("Bluetooth: HCI: Add support for LL Extended Feature Set")
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Kevin Dewald <kevin@simpleble.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Dropped the hunk for hci_cs_le_read_all_remote_features() (function absent here) and placed the fix inside the nested if (conn) { if (conn->state == BT_CONFIG) } form of hci_cs_le_read_remote_features(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/hci_event.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3e487963eaff9..797b86f57c6db 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2941,6 +2941,22 @@ static void hci_cs_le_read_remote_features(struct hci_dev *hdev, u8 status)
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(cp->handle));
if (conn) {
if (conn->state == BT_CONFIG) {
+ /* If the local controller supports peripheral-initiated
+ * features exchange, but the remote controller does not,
+ * then the controller may already return the error code
+ * 0x1a for unsupported remote feature in the command
+ * status.
+ *
+ * Handle it as hci_le_remote_feat_complete_evt() does and
+ * allow the connection to transition into connected state.
+ */
+ if (!conn->out &&
+ status == HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE &&
+ (hdev->le_features[0] & HCI_LE_PERIPHERAL_FEATURES)) {
+ conn->state = BT_CONNECTED;
+ status = 0x00;
+ }
+
hci_connect_cfm(conn, status);
hci_conn_drop(conn);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 598/990] irqchip/mst-intc: Validate the DT interrupt range
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (596 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 597/990] Bluetooth: hci_event: Fix LE link drop on remote features command status Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 599/990] pinctrl: stm32: Fix the unit of the hwspinlock timeout Greg Kroah-Hartman
` (254 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pengpeng Hou, Thomas Gleixner,
Radu Rendec, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <hppiscas@163.com>
[ Upstream commit 16f25d326e5d3b9fd51bc5e3916ecbffbca63e7b ]
The driver takes an inclusive interrupt range from the device tree
without checking its endpoints. A reversed range wraps the unsigned
count calculation, and a range larger than MST_INTC_MAX_IRQS exceeds the
controller capacity used by the driver.
Reject these ranges before calculating nr_irqs or creating the domain.
Check the difference after ordering the endpoints so the validation
itself cannot wrap.
The issue was found by our static-analysis tool.
Fixes: ad4c938c92af ("irqchip/irq-mst: Add MStar interrupt controller support")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Assisted-by: gpt 5
Reviewed-by: Radu Rendec <radu@rendec.net>
Link: https://patch.msgid.link/20260920034236.16229-1-hppiscas@163.com
[ sashal: Context adjusted: the upstream range check is inserted above this tree's older kzalloc(sizeof(*cd), GFP_KERNEL) call instead of kzalloc_obj(*cd). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/irqchip/irq-mst-intc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/irqchip/irq-mst-intc.c b/drivers/irqchip/irq-mst-intc.c
index 7f760f555a76a..d380030eda935 100644
--- a/drivers/irqchip/irq-mst-intc.c
+++ b/drivers/irqchip/irq-mst-intc.c
@@ -263,6 +263,9 @@ static int __init mst_intc_of_init(struct device_node *dn,
of_property_read_u32_index(dn, "mstar,irqs-map-range", 1, &irq_end))
return -EINVAL;
+ if (irq_end < irq_start || irq_end - irq_start >= MST_INTC_MAX_IRQS)
+ return -EINVAL;
+
cd = kzalloc(sizeof(*cd), GFP_KERNEL);
if (!cd)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 599/990] pinctrl: stm32: Fix the unit of the hwspinlock timeout
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (597 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 598/990] irqchip/mst-intc: Validate the DT interrupt range Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 600/990] dpll: zl3073x: make embedded sync follow the output carrier frequency Greg Kroah-Hartman
` (253 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ju Nan, Linus Walleij, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ju Nan <junan76@163.com>
[ Upstream commit 544b3f8042dd7c18baa48dcb1a393ff8b6742322 ]
HWSPNLCK_TIMEOUT is passed to hwspin_lock_timeout_in_atomic(), whose
timeout argument is in milliseconds, not microseconds:
atomic_delay += HWSPINLOCK_RETRY_DELAY_US;
if (atomic_delay > to * 1000)
return -ETIMEDOUT;
The hwspinlock core documents this explicitly:
If the mode is HWLOCK_IN_ATOMIC (called from an atomic context) the
timeout is handled with busy-waiting delays, hence shall not exceed
few msecs.
Fixes: 290a9f937e5a ("pinctrl: stm32: use the hwspin_lock_timeout_in_atomic() API")
Signed-off-by: Ju Nan <junan76@163.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
[ sashal: Dropped the two hunks touching the skipped I/O-sync and skew-delay functions (absent here), so only the HWSPNLCK_TIMEOUT_MS rename and the five existing callers apply. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/pinctrl/stm32/pinctrl-stm32.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index 384fdc13a504b..8f9935d07e432 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -82,7 +82,7 @@
#define gpio_range_to_bank(chip) \
container_of(chip, struct stm32_gpio_bank, range)
-#define HWSPNLCK_TIMEOUT 1000 /* usec */
+#define HWSPNLCK_TIMEOUT_MS 1
static const char * const stm32_gpio_functions[] = {
"gpio", "af0", "af1",
@@ -559,7 +559,7 @@ static int stm32_gpio_domain_activate(struct irq_domain *d,
if (pctl->hwlock) {
ret = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (ret) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
return ret;
@@ -896,7 +896,7 @@ static int stm32_pmx_set_mode(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
@@ -1033,7 +1033,7 @@ static int stm32_pconf_set_driving(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
@@ -1084,7 +1084,7 @@ static int stm32_pconf_set_speed(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
@@ -1135,7 +1135,7 @@ static int stm32_pconf_set_bias(struct stm32_gpio_bank *bank,
if (pctl->hwlock) {
err = hwspin_lock_timeout_in_atomic(pctl->hwlock,
- HWSPNLCK_TIMEOUT);
+ HWSPNLCK_TIMEOUT_MS);
if (err) {
dev_err(pctl->dev, "Can't get hwspinlock\n");
goto unlock;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 600/990] dpll: zl3073x: make embedded sync follow the output carrier frequency
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (598 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 599/990] pinctrl: stm32: Fix the unit of the hwspinlock timeout Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 601/990] bpf: Dont hand out a linked element as extra element Greg Kroah-Hartman
` (252 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Petr Oros, Ivan Vecera,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <ivecera@redhat.com>
[ Upstream commit bf6f105f2cb6477e36a9312477d0aa32a43aa13d ]
The eSync period and width are relative to the output carrier, but
changing the output frequency did not update them, so eSync ran at
a wrong frequency and duty cycle. For a 1 Hz carrier esync_get()
returns -EOPNOTSUPP, so eSync left enabled could not be disabled.
Factor out zl3073x_out_esync_{is_enabled,enable,disable}() helpers
and use them in frequency_set() to recompute the eSync period and
width for the new carrier, or to disable eSync for a 1 Hz carrier.
Also compute the reported pulse width in 64 bits, as
50 * esync_n_width overflows u32 for low carrier frequencies.
Hit during development, confirmed on an oscilloscope.
Fixes: ce26d7ca50a5 ("dpll: zl3073x: Add support to get/set frequency on pins")
Fixes: 634ca2cb06d2 ("dpll: zl3073x: Add support to get/set esync on pins")
Reviewed-by: Petr Oros <poros@redhat.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Link: https://patch.msgid.link/20261011061211.448373-5-ivecera@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: adapted new eSync helpers in out.h to open-code clock type get/set with FIELD_GET/FIELD_PREP, and rebased esync_get/esync_set onto the older open-coded form, since the clock type accessors are missing. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dpll/zl3073x/dpll.c | 56 ++++++++++++++++++-------------------
drivers/dpll/zl3073x/out.h | 40 ++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 29 deletions(-)
diff --git a/drivers/dpll/zl3073x/dpll.c b/drivers/dpll/zl3073x/dpll.c
index c2ea96df3bcb6..75a8584e6368f 100644
--- a/drivers/dpll/zl3073x/dpll.c
+++ b/drivers/dpll/zl3073x/dpll.c
@@ -771,7 +771,7 @@ zl3073x_dpll_output_pin_esync_get(const struct dpll_pin *dpll_pin,
const struct zl3073x_synth *synth;
const struct zl3073x_out *out;
u32 synth_freq, out_freq;
- u8 clock_type, out_id;
+ u8 out_id;
out_id = zl3073x_output_pin_out_get(pin->id);
out = zl3073x_out_state_get(zldev, out_id);
@@ -794,8 +794,7 @@ zl3073x_dpll_output_pin_esync_get(const struct dpll_pin *dpll_pin,
esync->range = esync_freq_ranges;
esync->range_num = ARRAY_SIZE(esync_freq_ranges);
- clock_type = FIELD_GET(ZL_OUTPUT_MODE_CLOCK_TYPE, out->mode);
- if (clock_type != ZL_OUTPUT_MODE_CLOCK_TYPE_ESYNC) {
+ if (!zl3073x_out_esync_is_enabled(out)) {
/* No need to read esync data if it is not enabled */
esync->freq = 0;
esync->pulse = 0;
@@ -811,7 +810,7 @@ zl3073x_dpll_output_pin_esync_get(const struct dpll_pin *dpll_pin,
* Note that half pulse width is in units of half synth cycles, which
* is why it reduces down to be output_div.
*/
- esync->pulse = (50 * out->esync_n_width) / out->div;
+ esync->pulse = div_u64(mul_u32_u32(50, out->esync_n_width), out->div);
return 0;
}
@@ -828,7 +827,7 @@ zl3073x_dpll_output_pin_esync_set(const struct dpll_pin *dpll_pin,
struct zl3073x_dpll_pin *pin = pin_priv;
const struct zl3073x_synth *synth;
struct zl3073x_out out;
- u8 clock_type, out_id;
+ u8 out_id;
u32 synth_freq;
out_id = zl3073x_output_pin_out_get(pin->id);
@@ -841,36 +840,18 @@ zl3073x_dpll_output_pin_esync_set(const struct dpll_pin *dpll_pin,
if (zl3073x_out_is_ndiv(&out))
return -EOPNOTSUPP;
- /* Select clock type */
- if (freq)
- clock_type = ZL_OUTPUT_MODE_CLOCK_TYPE_ESYNC;
- else
- clock_type = ZL_OUTPUT_MODE_CLOCK_TYPE_NORMAL;
-
- /* Update clock type in output mode */
- out.mode &= ~ZL_OUTPUT_MODE_CLOCK_TYPE;
- out.mode |= FIELD_PREP(ZL_OUTPUT_MODE_CLOCK_TYPE, clock_type);
-
- /* If esync is being disabled just write mailbox and finish */
- if (!freq)
- goto write_mailbox;
+ if (!freq) {
+ zl3073x_out_esync_disable(&out);
+ return zl3073x_out_state_set(zldev, out_id, &out);
+ }
/* Get attached synth frequency */
synth = zl3073x_synth_state_get(zldev, zl3073x_out_synth_get(&out));
synth_freq = zl3073x_synth_freq_get(synth);
- /* Compute and update esync period */
- out.esync_n_period = synth_freq / (u32)freq / out.div;
-
- /* Half of the period in units of 1/2 synth cycle can be represented by
- * the output_div. To get the supported esync pulse width of 25% of the
- * period the output_div can just be divided by 2. Note that this
- * assumes that output_div is even, otherwise some resolution will be
- * lost.
- */
- out.esync_n_width = out.div / 2;
+ /* Enable 1PPS eSync for this pin frequency */
+ zl3073x_out_esync_enable(&out, synth_freq / out.div);
-write_mailbox:
/* Commit output configuration */
return zl3073x_out_state_set(zldev, out_id, &out);
}
@@ -924,6 +905,23 @@ zl3073x_dpll_output_pin_frequency_set(const struct dpll_pin *dpll_pin,
/* For 50/50 duty cycle the divisor is equal to width */
out.width = new_div;
+ /* The embedded sync period and width are computed relative to
+ * the output carrier so they have to be adjusted to follow the
+ * new frequency.
+ */
+ if (zl3073x_out_esync_is_enabled(&out)) {
+ if (frequency == 1) {
+ /* eSync cannot work on a 1 Hz carrier */
+ zl3073x_out_esync_disable(&out);
+ } else {
+ /* Update esync period and width according to
+ * the new frequency.
+ */
+ zl3073x_out_esync_enable(&out,
+ synth_freq / out.div);
+ }
+ }
+
/* Commit output configuration */
return zl3073x_out_state_set(zldev, out_id, &out);
}
diff --git a/drivers/dpll/zl3073x/out.h b/drivers/dpll/zl3073x/out.h
index 318f9bb8da3a0..1f2cda4d37fcf 100644
--- a/drivers/dpll/zl3073x/out.h
+++ b/drivers/dpll/zl3073x/out.h
@@ -107,4 +107,44 @@ static inline u8 zl3073x_out_synth_get(const struct zl3073x_out *out)
return FIELD_GET(ZL_OUTPUT_CTRL_SYNTH_SEL, out->ctrl);
}
+static inline bool zl3073x_out_esync_is_enabled(const struct zl3073x_out *out)
+{
+ u8 clock_type = FIELD_GET(ZL_OUTPUT_MODE_CLOCK_TYPE, out->mode);
+
+ return clock_type == ZL_OUTPUT_MODE_CLOCK_TYPE_ESYNC;
+}
+
+static inline
+void zl3073x_out_esync_enable(struct zl3073x_out *out, u32 base_freq)
+{
+ /* Period is expressed as the number of output divider clock cycles.
+ * So for 1 Hz the period is equal to base frequency.
+ */
+ out->esync_n_period = base_freq;
+
+ /* Half of the period in units of 1/2 synth cycle can be represented by
+ * the output_div. To get the supported esync pulse width of 25% of the
+ * period the output_div can just be divided by 2. Note that this
+ * assumes that output_div is even, otherwise some resolution will be
+ * lost.
+ */
+ out->esync_n_width = out->div / 2;
+
+ /* Update the clock type */
+ out->mode &= ~ZL_OUTPUT_MODE_CLOCK_TYPE;
+ out->mode |= FIELD_PREP(ZL_OUTPUT_MODE_CLOCK_TYPE,
+ ZL_OUTPUT_MODE_CLOCK_TYPE_ESYNC);
+}
+
+static inline
+void zl3073x_out_esync_disable(struct zl3073x_out *out)
+{
+ /* Just update the clock type. The eSync period and width are
+ * ignored for this clock type.
+ */
+ out->mode &= ~ZL_OUTPUT_MODE_CLOCK_TYPE;
+ out->mode |= FIELD_PREP(ZL_OUTPUT_MODE_CLOCK_TYPE,
+ ZL_OUTPUT_MODE_CLOCK_TYPE_NORMAL);
+}
+
#endif /* _ZL3073X_OUT_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 601/990] bpf: Dont hand out a linked element as extra element
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (599 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 600/990] dpll: zl3073x: make embedded sync follow the output carrier frequency Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 602/990] bpf: Keep a program until its bpf_wq callback has ended Greg Kroah-Hartman
` (251 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit ccb88db8dac8fabde58656d5d4a33711e89c480a ]
When htab_map_update_elem() replaces an element of a preallocated map,
alloc_htab_elem() takes the spare element of this cpu and puts the old
element into the per-cpu slot right away, long before the old element is
unlinked from its bucket. The bucket lock disables interrupts, but it
does not keep out an NMI, or a tracing program on the return of
alloc_htab_elem(). bpf_prog_active only helps if both programs are
kprobe, tracepoint or perf_event programs. A program that updates an
existing key in another bucket of the same map gets to use the slot:
htab_map_update_elem(k1) tc, xdp, fentry, raw_tp, ...
alloc_htab_elem()
l_new = *pl_new
*pl_new = l_old still linked in bucket 1
<NMI>
htab_map_update_elem(k2) perf_event program
l_new = *pl_new the l_old of the outer update
hlist_nulls_add_head_rcu(l_new, bucket 2)
hlist_nulls_del_rcu(k2's old element)
</NMI>
hlist_nulls_add_head_rcu(l_new, bucket 1)
hlist_nulls_del_rcu(l_old)
If l_old was the first element of bucket 1, the outer add points its pprev
at l_new, and the delete takes it out of bucket 1 only. l_new->next now
leads into bucket 2, where l_old stays with a poisoned pprev, on which a
delete of k2 crashes. If it was not the first, the delete takes it out of
bucket 2: k2 is gone from the map, and the chain of bucket 1 still contains
l_old, whose next pointer leads into bucket 2.
Either way a walk of bucket 1 ends on the nulls value of bucket 2.
lookup_nulls_elem_raw() restarts whenever that happens, so every lookup in
bucket 1 which does not find its key spins forever:
rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
__htab_map_lookup_elem+0x354/0x4d0
BUG: KASAN: wild-memory-access in htab_map_delete_elem+0x30c/0x670
Write of size 8 at addr dead000000000122 by task extra/102
An NMI between the load and the store of the slot makes both updates use
the same element, with much the same result.
Empty the slot when the spare element is taken, in a way that is atomic
on this cpu, and put the old element in only after it has been unlinked
and its timers and the like have been cancelled. A nested update that
finds the slot empty, which is the case that corrupted the map, fails with
-EBUSY.
Fixes: 8c290e60fa2a ("bpf: fix hashmap extra_elems logic")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-5-alexei.starovoitov@gmail.com
[ sashal: Replaced check_and_cancel_fields() with the older check_and_free_fields() helper in htab_map_update_elem(), since the cancel helper does not exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/hashtab.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index ffc534384f84d..95e9a760a7be3 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -1085,11 +1085,17 @@ static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
if (prealloc) {
if (old_elem) {
/* if we're updating the existing element,
- * use per-cpu extra elems to avoid freelist_pop/push
+ * use per-cpu extra elems to avoid freelist_pop/push.
+ * The caller puts old_elem into the slot once it is
+ * unlinked. Until then the slot is empty for an NMI
+ * or a kprobe that updates this map on this cpu.
*/
pl_new = this_cpu_ptr(htab->extra_elems);
- l_new = *pl_new;
- *pl_new = old_elem;
+ l_new = READ_ONCE(*pl_new);
+ do {
+ if (!l_new)
+ return ERR_PTR(-EBUSY);
+ } while (!try_cmpxchg_local(pl_new, &l_new, NULL));
} else {
struct pcpu_freelist_node *l;
@@ -1251,11 +1257,15 @@ static long htab_map_update_elem(struct bpf_map *map, void *key, void *value,
if (l_old) {
hlist_nulls_del_rcu(&l_old->hash_node);
- /* l_old has already been stashed in htab->extra_elems, free
- * its special fields before it is available for reuse.
+ /*
+ * l_old replaces the extra element that alloc_htab_elem() took.
+ * Free its special fields first: once it is in the
+ * slot, the next update on this cpu can reuse it.
*/
- if (htab_is_prealloc(htab))
+ if (htab_is_prealloc(htab)) {
check_and_free_fields(htab, l_old);
+ WRITE_ONCE(*this_cpu_ptr(htab->extra_elems), l_old);
+ }
}
htab_unlock_bucket(b, flags);
if (l_old && !htab_is_prealloc(htab))
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 602/990] bpf: Keep a program until its bpf_wq callback has ended
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (600 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 601/990] bpf: Dont hand out a linked element as extra element Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 603/990] bpf: Count sleepable callbacks as sleepable map users Greg Kroah-Hartman
` (250 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 1e28a5e52d32b7d3f4c9fb24898774f941166d2b ]
bpf_wq_work() runs the callback under rcu_read_lock_trace() only, since
the callback may sleep. The program it belongs to need not be sleepable,
and such a program is freed behind a plain RCU grace period. The
reference that the bpf_wq holds is dropped when the map element goes, or
when another callback is set, no matter whether the work is running.
If that was the last reference the program is freed under the running
callback, and the worker goes on in the freed JIT image:
Oops: int3: 0000 [#1] SMP NOPTI
RIP: 0010:0xffffffffc0600947
All it takes is to close the map and the program while the callback runs.
Note in the program that it has a callback that runs sleepable, and wait
for an RCU Tasks Trace grace period, which implies a plain one, before
such a program is freed. Let bpf_wq_work() enter its read side critical
section before it reads callback_fn.
bpf_task_work holds a reference to the program until the callback is done.
Fixes: 8e83da9732d9 ("bpf: add bpf_wq_start")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-23-alexei.starovoitov@gmail.com
[ sashal: Dropped the nonexistent tramp_linked context line and the __bpf_prog_put_rcu_tasks() hunk, and used bpf_prog_runs_sleepable() in the simpler if/else of __bpf_prog_put_noref(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf.h | 10 ++++++++++
kernel/bpf/helpers.c | 9 ++++++---
kernel/bpf/syscall.c | 2 +-
kernel/bpf/verifier.c | 2 ++
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index f165743cd71f3..2d8cb15fb9ba7 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -1619,6 +1619,7 @@ struct bpf_prog_aux {
bool offload_requested; /* Program is bound and offloaded to the netdev. */
bool attach_btf_trace; /* true if attaching to BTF-enabled raw tp */
bool attach_tracing_prog; /* true if tracing another tracing program */
+ bool sleepable_async_cb; /* has a bpf_wq or bpf_task_work callback */
bool func_proto_unreliable;
bool tail_call_reachable;
bool xdp_has_frags;
@@ -1741,6 +1742,15 @@ struct bpf_prog {
};
};
+/*
+ * Does the program, or a callback of it, run under RCU Tasks Trace protection
+ * only, outside of any RCU read side critical section?
+ */
+static inline bool bpf_prog_runs_sleepable(const struct bpf_prog *prog)
+{
+ return prog->sleepable || prog->aux->sleepable_async_cb;
+}
+
struct bpf_array_aux {
/* Programs with direct jumps into programs part of this array. */
struct list_head poke_progs;
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 89cb7e38be764..5271bc5178ea3 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -1214,18 +1214,21 @@ static void bpf_wq_work(struct work_struct *work)
BTF_TYPE_EMIT(struct bpf_wq);
+ /* keeps the program that callback_fn belongs to */
+ rcu_read_lock_trace();
+
callback_fn = READ_ONCE(cb->callback_fn);
if (!callback_fn)
- return;
+ goto out;
key = map_key_from_value(map, value, &idx);
- rcu_read_lock_trace();
- migrate_disable();
+ migrate_disable();
callback_fn((u64)(long)map, (u64)(long)key, (u64)(long)value, 0, 0);
migrate_enable();
+out:
rcu_read_unlock_trace();
}
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 79668e8441419..865107eb49467 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -2403,7 +2403,7 @@ static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred)
btf_put(prog->aux->attach_btf);
if (deferred) {
- if (prog->sleepable)
+ if (bpf_prog_runs_sleepable(prog))
call_rcu_tasks_trace(&prog->aux->rcu, __bpf_prog_put_rcu);
else
call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu);
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index b664c160b9277..55d6cf2653755 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -10891,6 +10891,8 @@ static int push_callback_call(struct bpf_verifier_env *env, struct bpf_insn *ins
is_async_cb_sleepable(env, insn));
if (IS_ERR(async_cb))
return PTR_ERR(async_cb);
+ if (is_async_cb_sleepable(env, insn))
+ env->prog->aux->sleepable_async_cb = true;
callee = async_cb->frame[0];
callee->async_entry_cnt = state->frame[0]->async_entry_cnt + 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 603/990] bpf: Count sleepable callbacks as sleepable map users
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (601 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 602/990] bpf: Keep a program until its bpf_wq callback has ended Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 604/990] bpf: Assume no bounds for buffers behind a tail call Greg Kroah-Hartman
` (249 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 927c9c985f3ef4d30c086884b7e0ecb933f742ef ]
map->sleepable_refcnt tells bpf_map_fd_put_ptr() whether an inner map that
is taken out of its outer map has to wait for an RCU Tasks Trace grace
period as well. It counts the sleepable programs that use the outer map.
The bpf_wq or bpf_task_work callback of a program that is not sleepable
runs under rcu_read_lock_trace() only, and is not counted.
Such a callback can look an inner map up and keep it while user space
deletes it from the outer map. The inner map is freed behind a plain RCU
grace period, under the callback:
BUG: KASAN: slab-use-after-free in array_map_update_elem+0x6bc/0x7d0
Count a program with such a callback. The maps are bound before the
verifier meets the callback, so raise the count of those that are bound
when it does.
Fixes: 8e83da9732d9 ("bpf: add bpf_wq_start")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-24-alexei.starovoitov@gmail.com
[ sashal: Kept the local static bool is_may_goto_insn() name in the context line instead of upstream's bpf_is_may_goto_insn(), with the new helper inserted above it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/core.c | 2 +-
kernel/bpf/syscall.c | 2 +-
kernel/bpf/verifier.c | 17 +++++++++++++++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index bbd0f1ebd2d3c..59c87eeb07cdb 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -2908,7 +2908,7 @@ void __bpf_free_used_maps(struct bpf_prog_aux *aux,
bool sleepable;
u32 i;
- sleepable = aux->prog->sleepable;
+ sleepable = bpf_prog_runs_sleepable(aux->prog);
for (i = 0; i < len; i++) {
map = used_maps[i];
if (map->ops->map_poke_untrack)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 865107eb49467..a076c1bc41ac3 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -6124,7 +6124,7 @@ static int bpf_prog_bind_map(union bpf_attr *attr)
/* The bpf program will not access the bpf map, but for the sake of
* simplicity, increase sleepable_refcnt for sleepable program as well.
*/
- if (prog->sleepable)
+ if (bpf_prog_runs_sleepable(prog))
atomic64_inc(&map->sleepable_refcnt);
memcpy(used_maps_new, used_maps_old,
sizeof(used_maps_old[0]) * prog->aux->used_map_cnt);
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 55d6cf2653755..ca27c14004ce3 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -573,6 +573,19 @@ static bool is_async_cb_sleepable(struct bpf_verifier_env *env, struct bpf_insn
return false;
}
+/* From here on the maps of the program count it as a sleepable user. */
+static void mark_sleepable_async_cb(struct bpf_verifier_env *env)
+{
+ int i;
+
+ if (bpf_prog_runs_sleepable(env->prog))
+ return;
+
+ env->prog->aux->sleepable_async_cb = true;
+ for (i = 0; i < env->used_map_cnt; i++)
+ atomic64_inc(&env->used_maps[i]->sleepable_refcnt);
+}
+
static bool is_may_goto_insn(struct bpf_insn *insn)
{
return insn->code == (BPF_JMP | BPF_JCOND) && insn->src_reg == BPF_MAY_GOTO;
@@ -10892,7 +10905,7 @@ static int push_callback_call(struct bpf_verifier_env *env, struct bpf_insn *ins
if (IS_ERR(async_cb))
return PTR_ERR(async_cb);
if (is_async_cb_sleepable(env, insn))
- env->prog->aux->sleepable_async_cb = true;
+ mark_sleepable_async_cb(env);
callee = async_cb->frame[0];
callee->async_entry_cnt = state->frame[0]->async_entry_cnt + 1;
@@ -21188,7 +21201,7 @@ static int __add_used_map(struct bpf_verifier_env *env, struct bpf_map *map)
if (err)
return err;
- if (env->prog->sleepable)
+ if (bpf_prog_runs_sleepable(env->prog))
atomic64_inc(&map->sleepable_refcnt);
/* hold the map. If the program is rejected by verifier,
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 604/990] bpf: Assume no bounds for buffers behind a tail call
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (602 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 603/990] bpf: Count sleepable callbacks as sleepable map users Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 605/990] bpf: Assume no bounds for a writable tp with tail calls Greg Kroah-Hartman
` (248 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 7fa323d77688e8b62b2f0bf6c3208a2c96d4a5e7 ]
The bpf_map_elem, bpf_sk_storage_map and sockmap iterators hand the key
and the value of an element to the program as buffers. The verifier notes
how far a program reaches into them, and the iterator compares that with
the map when the program is attached. A program that does not touch the
buffers passes. It can tail-call another program of the same target,
which gets the same context, and whose reach nobody compares with the
map:
BUG: KASAN: slab-out-of-bounds in ___bpf_prog_run+0xa46a/0xae80
The program array can be filled at any time, so there is nothing to look
at when the link is made. For the same reason a program with a tail call
is taken to use the whole stack and the whole packet. Take it to reach
as far as can be into the buffers as well, so that these iterators refuse
it with -EACCES.
Fixes: d6c4503cc296 ("bpf: Implement bpf iterator for hash maps")
Fixes: 5ce6e77c7edf ("bpf: Implement bpf iterator for sock local storage map")
Fixes: 0365351524d7 ("net: Allow iterating sockmap and sockhash")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-26-alexei.starovoitov@gmail.com
[ sashal: Moved the added max_rdonly_access = U32_MAX line into do_misc_fixups() in verifier.c, since this tree still has the fixups code there and not in a separate file. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index ca27c14004ce3..13da4dd120d74 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -23176,6 +23176,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
if (!allow_tail_call_in_subprogs(env))
prog->aux->stack_depth = MAX_BPF_STACK;
prog->aux->max_pkt_offset = MAX_PACKET_OFF;
+ prog->aux->max_rdonly_access = U32_MAX;
+ prog->aux->max_rdwr_access = U32_MAX;
/* mark bpf_tail_call as different opcode to avoid
* conditional branch in the interpreter for every normal
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 605/990] bpf: Assume no bounds for a writable tp with tail calls
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (603 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 604/990] bpf: Assume no bounds for buffers behind a tail call Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 606/990] bpf: Free what map_free() unlinks for sleepable readers Greg Kroah-Hartman
` (247 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit cd0490e671d70326d70c7d36e82388939fd9b071 ]
A writable raw tracepoint hands a buffer to the program. The verifier
notes how far the program reaches into it, and bpf_probe_register() refuses
a program that reaches further than the tracepoint allows. A program that
does not touch the buffer passes, and can tail-call one of its type that
reads and writes behind it.
Take a BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE program with a tail call to
reach as far as can be, as for the stack, the packet and the buffers of
iterators. It cannot be attached any more. Plain raw tracepoint programs,
for which the limit is zero, cannot get at the buffer, and a tail call
stays within one type: they are left alone.
Fixes: 9df1c28bb752 ("bpf: add writable context for raw tracepoints")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-28-alexei.starovoitov@gmail.com
[ sashal: Moved the added max_tp_access = U32_MAX lines into do_misc_fixups() in verifier.c, since this tree still has the fixups code there and not in a separate file. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 13da4dd120d74..dc7b4d0280f65 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -23178,6 +23178,8 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
prog->aux->max_pkt_offset = MAX_PACKET_OFF;
prog->aux->max_rdonly_access = U32_MAX;
prog->aux->max_rdwr_access = U32_MAX;
+ if (prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE)
+ prog->aux->max_tp_access = U32_MAX;
/* mark bpf_tail_call as different opcode to avoid
* conditional branch in the interpreter for every normal
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 606/990] bpf: Free what map_free() unlinks for sleepable readers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (604 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 605/990] bpf: Assume no bounds for a writable tp with tail calls Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 607/990] bpf: Let bpf_dynptr_write() mark a global function Greg Kroah-Hartman
` (246 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 5bdd61e98da5468140aff5b5abc0e8544deaf2ee ]
bpf_local_storage_map_free() takes the elements of the map off the lists
of their owners, which are alive, and frees them, and the storage of an
owner with its last element, behind a plain RCU grace period. Nobody uses
the map any more, but the other maps of these owners are in use. A
sleepable program calls the get and delete helpers under
rcu_read_lock_trace() only. While it walks the list of an owner for its
own map, or is about to lock the storage, the element it stands on, or the
storage, can be freed under it.
Whatever else takes an element off the list of a live owner frees it
behind an RCU Tasks Trace grace period, which implies a plain one. Do so
in bpf_local_storage_map_free() as well. It waits for these callbacks
before it frees the map.
This does not help a sleepable program that hands an owner to the helpers
which nobody holds, and which may be gone by then.
Fixes: dcf456c9a095 ("bpf: Fix usage of trace RCU in local storage.")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017163745.3341787-31-alexei.starovoitov@gmail.com
[ sashal: Replaced the upstream change in the missing bpf_selem_unlink_nofail() with flipping bpf_selem_unlink(selem, true) to false in bpf_local_storage_map_free(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/bpf_local_storage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
index b931fbceb54da..9fb26ae066f54 100644
--- a/kernel/bpf/bpf_local_storage.c
+++ b/kernel/bpf/bpf_local_storage.c
@@ -890,7 +890,7 @@ void bpf_local_storage_map_free(struct bpf_map *map,
struct bpf_local_storage_elem, map_node))) {
if (busy_counter)
this_cpu_inc(*busy_counter);
- bpf_selem_unlink(selem, true);
+ bpf_selem_unlink(selem, false);
if (busy_counter)
this_cpu_dec(*busy_counter);
cond_resched_rcu();
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 607/990] bpf: Let bpf_dynptr_write() mark a global function
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (605 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 606/990] bpf: Free what map_free() unlinks for sleepable readers Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 608/990] bpf: Dont take a dynptr argument for a local dynptr Greg Kroah-Hartman
` (245 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 589998616e0f9190ba6f6644a19532c5b2ba66d0 ]
The caller of a global function loses its packet pointers if the function
may change packet data. That is found out by a scan for calls of the
helpers which bpf_helper_changes_pkt_data() lists.
bpf_dynptr_write() is not on the list, because it depends on the type of
the dynptr: check_helper_call() looks at it. The scan cannot do that, and
so a global function which makes a dynptr from the skb, or gets one as an
argument, and writes through it counts as harmless. The write can
reallocate the head of the skb, and the caller goes on with pointers into
the old one, which has been freed.
Let every call of bpf_dynptr_write() mark the function, as a tail call
does. The same mark decides whether a program may replace a function.
Fixes: 51081a3f25c7 ("bpf: track changes_pkt_data property for global functions")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017230950.802052-10-alexei.starovoitov@gmail.com
[ sashal: Applied the same change in kernel/bpf/verifier.c instead of kernel/bpf/cfg.c, which doesn't exist here, with one differing context line (struct bpf_kfunc_call_arg_meta meta;). ]
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 dc7b4d0280f65..1890c0ba642ab 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -18471,7 +18471,9 @@ static int visit_insn(int t, struct bpf_verifier_env *env)
*/
if (ret == 0 && fp->might_sleep)
mark_subprog_might_sleep(env, t);
- if (bpf_helper_changes_pkt_data(insn->imm))
+ /* nobody knows yet whether the dynptr is that of an skb */
+ if (bpf_helper_changes_pkt_data(insn->imm) ||
+ insn->imm == BPF_FUNC_dynptr_write)
mark_subprog_changes_pkt_data(env, t);
} else if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL) {
struct bpf_kfunc_call_arg_meta meta;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 608/990] bpf: Dont take a dynptr argument for a local dynptr
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (606 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 607/990] bpf: Let bpf_dynptr_write() mark a global function Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 609/990] locking/atomic: arc, hexagon, openrisc: Define arch_cmpxchg_local() Greg Kroah-Hartman
` (244 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit b7f97db88948aa511bcd989978f181e1367e0e8b ]
A global function is verified on its own. A dynptr which it gets as an
argument is assumed to be of type BPF_DYNPTR_TYPE_LOCAL, but the callers
may pass one of any type, that of an skb for example.
The type decides whether a write through the dynptr invalidates packet
pointers, and whether a slice of it is invalidated together with them.
Inside of the function neither happens. It can take a packet pointer from
its context argument, or a slice from the dynptr, write through the dynptr
and go on using the pointer, although the write may have reallocated the
head of the skb.
Assume the type of an skb dynptr instead. Nothing becomes forbidden for the
dynptr itself, and a clone inherits the caution. The dynptr which the
callback of bpf_user_ringbuf_drain() gets is known to be local, and stays
so.
Fixes: a64bfe618665 ("bpf: add support for passing dynptr pointer to global subprog")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261017230950.802052-11-alexei.starovoitov@gmail.com
[ sashal: Kept this branch's ARG_PTR_TO_DYNPTR | MEM_RDONLY condition and dropped the extra 0 argument to the four-argument __mark_dynptr_reg(), changing the type to BPF_DYNPTR_TYPE_SKB. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 1890c0ba642ab..0d93bcdcef81a 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -24006,8 +24006,12 @@ static int do_check_common(struct bpf_verifier_env *env, int subprog)
reg->type = SCALAR_VALUE;
mark_reg_unknown(env, regs, i);
} else if (arg->arg_type == (ARG_PTR_TO_DYNPTR | MEM_RDONLY)) {
- /* assume unspecial LOCAL dynptr type */
- __mark_dynptr_reg(reg, BPF_DYNPTR_TYPE_LOCAL, true, ++env->id_gen);
+ /*
+ * The callers may hand in a dynptr of any type.
+ * Take it for that of an skb, so that a write
+ * through it and its slices are treated with care.
+ */
+ __mark_dynptr_reg(reg, BPF_DYNPTR_TYPE_SKB, true, ++env->id_gen);
} else if (base_type(arg->arg_type) == ARG_PTR_TO_MEM) {
reg->type = PTR_TO_MEM;
reg->type |= arg->arg_type &
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 609/990] locking/atomic: arc, hexagon, openrisc: Define arch_cmpxchg_local()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (607 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 608/990] bpf: Dont take a dynptr argument for a local dynptr Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 610/990] bpf: Zero-extend the index in inlined bpf_get_func_arg() Greg Kroah-Hartman
` (243 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, kernelci.org bot, kernel test robot,
Sasha Levin, Alexei Starovoitov
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8cebaa3be829c88a59957900f8de98fed09daefe ]
Commit ccb88db8dac8 ("bpf: Don't hand out a linked element as extra
element") made alloc_htab_elem() take the per-cpu spare element with
try_cmpxchg_local(), the first caller of cmpxchg_local() outside of
architecture code. It doesn't build on arc, hexagon and openrisc:
include/linux/atomic/atomic-arch-fallback.h:384:27: error: implicit declaration of function 'arch_cmpxchg_local'; did you mean 'raw_cmpxchg_local'? [-Werror=implicit-function-declaration]
raw_cmpxchg_local() maps to arch_cmpxchg_local() unconditionally, but
these three architectures don't define it, and unlike nios2 and
microblaze they don't get it from asm-generic/cmpxchg.h either.
cmpxchg_local() only has to be atomic with respect to the local CPU, so
an architecture's own arch_cmpxchg() can serve for the sizes it
supports. arc uses its relaxed LLOCK/SCOND variant when ARC_HAS_LLSC is
set and its atomic_ops_lock() variant otherwise, and openrisc uses its
LL/SC arch_cmpxchg(), the way arm64, riscv and s390 alias theirs. The
hexagon arch_cmpxchg() only handles 32-bit words, so hexagon uses the
generic version that disables interrupts, like sh, sparc32 and xtensa
do. Linux has no NMIs on hexagon, so that is sufficient there.
Fixes: ccb88db8dac8 ("bpf: Don't hand out a linked element as extra element")
Reported-by: kernelci.org bot <bot@kernelci.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261018132907.3823160-1-sashal@kernel.org
Closes: https://d.kernelci.org/i/maestro:78b65519ee4561df1fbf1e72f1dec9da7e5b153e
Closes: https://lore.kernel.org/oe-kbuild-all/202610181750.BoqAddaF-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202610182048.aEaiBP8W-lkp@intel.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arc/include/asm/cmpxchg.h | 4 ++++
arch/hexagon/include/asm/cmpxchg.h | 6 ++++++
arch/openrisc/include/asm/cmpxchg.h | 2 ++
3 files changed, 12 insertions(+)
diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index 66b3743c94008..93f7153eb267a 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -59,6 +59,8 @@
_prev_; \
})
+#define arch_cmpxchg_local arch_cmpxchg_relaxed
+
#else
#define arch_cmpxchg(ptr, old, new) \
@@ -80,6 +82,8 @@
_prev_; \
})
+#define arch_cmpxchg_local arch_cmpxchg
+
#endif
/*
diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h
index 9c58fb81f7fd6..e6114e713db9f 100644
--- a/arch/hexagon/include/asm/cmpxchg.h
+++ b/arch/hexagon/include/asm/cmpxchg.h
@@ -8,6 +8,8 @@
#ifndef _ASM_CMPXCHG_H
#define _ASM_CMPXCHG_H
+#include <asm-generic/cmpxchg-local.h>
+
/*
* __arch_xchg - atomically exchange a register and a memory location
* @x: value to swap
@@ -72,4 +74,8 @@ __arch_xchg(unsigned long x, volatile void *ptr, int size)
__oldval; \
})
+#define arch_cmpxchg_local(ptr, o, n) \
+ ((__typeof__(*(ptr)))__generic_cmpxchg_local((ptr), \
+ (unsigned long)(o), (unsigned long)(n), sizeof(*(ptr))))
+
#endif /* _ASM_CMPXCHG_H */
diff --git a/arch/openrisc/include/asm/cmpxchg.h b/arch/openrisc/include/asm/cmpxchg.h
index 8ee151c072e41..fcf1bc8db8fe9 100644
--- a/arch/openrisc/include/asm/cmpxchg.h
+++ b/arch/openrisc/include/asm/cmpxchg.h
@@ -140,6 +140,8 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
sizeof(*(ptr))); \
})
+#define arch_cmpxchg_local arch_cmpxchg
+
/*
* This function doesn't exist, so you'll get a linker error if
* something tries to do an invalidly-sized xchg().
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 610/990] bpf: Zero-extend the index in inlined bpf_get_func_arg()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (608 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 609/990] locking/atomic: arc, hexagon, openrisc: Define arch_cmpxchg_local() Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 611/990] netfilter: flowtable: reset transport header after nf_flow_encap_pop() Greg Kroah-Hartman
` (242 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Woojin Ji, Alexei Starovoitov,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Woojin Ji <random6.xyz@gmail.com>
[ Upstream commit 1c1dda9ba9f3af9cd511a197dcc86de2465d8fe5 ]
bpf_get_func_arg() takes a u32 index, but the inlined expansion compared
only the low 32 bits of R2 with the argument count and then shifted the
full 64-bit register to compute the context address. R2 is ARG_ANYTHING,
so nothing guarantees that its upper bits are zero: an index of
1ULL << 32 passes the bounds check as index zero while the load is
performed at ctx + (1ULL << 35).
Shift the index as a 32-bit value. When the 32-bit bounds check passes,
the low 32 bits of R2 are below R0, and R0 is at most 255: the trampoline
arm masks the argument count with 0xFF and the raw_tp arm uses the BTF
argument count minus one, which the verifier caps at MAX_BPF_FUNC_ARGS.
The 3-bit shift therefore cannot overflow and it clears the upper bits of
the register. Widening the comparison instead would reject indices whose
low 32 bits are valid. The check itself is unchanged, so this cannot
change which programs are accepted, only the address that is computed.
Fixes: f92c1e183604 ("bpf: Add get_func_[arg|ret|arg_cnt] helpers")
Signed-off-by: Woojin Ji <random6.xyz@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261018-get-func-arg-v2-1-048848b3eddf@gmail.com
[ sashal: Replaced a 64-bit shift with a 32-bit one in the inlined bpf_get_func_arg() code in verifier.c, since the fixups code isn't split into its own file here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 0d93bcdcef81a..a004c95969636 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -23475,7 +23475,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
/* Load nr_args from ctx - 8 */
insn_buf[0] = BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8);
insn_buf[1] = BPF_JMP32_REG(BPF_JGE, BPF_REG_2, BPF_REG_0, 6);
- insn_buf[2] = BPF_ALU64_IMM(BPF_LSH, BPF_REG_2, 3);
+ insn_buf[2] = BPF_ALU32_IMM(BPF_LSH, BPF_REG_2, 3);
insn_buf[3] = BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_1);
insn_buf[4] = BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 0);
insn_buf[5] = BPF_STX_MEM(BPF_DW, BPF_REG_3, BPF_REG_0, 0);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 611/990] netfilter: flowtable: reset transport header after nf_flow_encap_pop()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (609 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 610/990] bpf: Zero-extend the index in inlined bpf_get_func_arg() Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 612/990] cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier() Greg Kroah-Hartman
` (241 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lorenzo Bianconi, Pablo Neira Ayuso,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
[ Upstream commit 08f7882637f2db5b98f521498eeaf94770383a6e ]
nf_flow_encap_pop() pulls vlan/pppoe or ip tunnel headers and resets the
network header, but leaves the transport header pointing into the removed
outer header. Reset the transport header to the inner L4 header, otherwise
later consumers (e.g. GSO segmentation) parse a bogus header.
Fixes: 4cd91f7c290f ("netfilter: flowtable: add vlan support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[ sashal: adjusted nf_flow_encap_pop() call context to the older two-argument form (skb, tuplehash) in the IPv6 hunk, since this tree's helper lacks the ctx parameter. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/netfilter/nf_flow_table_ip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 041d928b0bee0..aa22d8fd39fc1 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -410,6 +410,7 @@ static int nf_flow_offload_forward(struct nf_flowtable_ctx *ctx,
nf_flow_encap_pop(skb, tuplehash);
thoff -= ctx->offset;
+ skb_set_transport_header(skb, thoff);
iph = ip_hdr(skb);
nf_flow_nat_ip(flow, skb, thoff, dir, iph);
@@ -698,6 +699,7 @@ static int nf_flow_offload_ipv6_forward(struct nf_flowtable_ctx *ctx,
flow_offload_refresh(flow_table, flow, false);
nf_flow_encap_pop(skb, tuplehash);
+ skb_set_transport_header(skb, sizeof(*ip6h));
ip6h = ipv6_hdr(skb);
nf_flow_nat_ipv6(flow, skb, dir, ip6h);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 612/990] cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (610 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 611/990] netfilter: flowtable: reset transport header after nf_flow_encap_pop() Greg Kroah-Hartman
@ 2026-11-25 14:32 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 613/990] cgroup/cpuset: Consolidate isolated_cpus_can_update() into prstate_housekeeping_conflict() Greg Kroah-Hartman
` (240 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:32 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Waiman Long, 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 46b885416c27214072272b85adb898ed91801062 ]
It is found that when a local isolated partition is being invalidated
because its parent partition is no longer valid, the isolated_cpus
cpumask may not be properly updated. Those isolated CPUs may or may
not needed to be removed from isolated_cpus depending on if there is
a local isolated partition ancestor that will now own those isolated
CPUs instead.
Fix that by calling a new ancestor_partition() helper to return the
closeset valid partition root ancestor. If that ancestor is PRS_ROOT,
the isolated CPUs will have to be removed from isolated_cpus. For
a PRS_ISOLATED ancestor, the isolated CPUs are checked against
the ancestor's ones to see if any of them should be removed as it is
possible that the invalidation of the parent may be caused by change in
the effective xcpus of that ancestor. If any of the isolated CPUs should
be removed, isolated_cpus_update() will be called under callback_lock.
An existing test case in test_cpuset_prs.sh is modifed and a new one
added to test that.
Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Selftest TEST_MATRIX rows were adapted to the older format with explicit ":S+" markers on non-leaf cpusets, while the cpuset.c changes match upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 57 +++++++++++++++++--
.../selftests/cgroup/test_cpuset_prs.sh | 6 +-
2 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index e90fb48cf0f9b..3ef103c4b68d3 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2232,6 +2232,25 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
rcu_read_unlock();
}
+/*
+ * ancestor_partition - Find and return the closest valid partition root ancestor
+ * @cs: the current cpuset
+ *
+ * Return: The closet partition root ancestor cpuset
+ */
+static struct cpuset *ancestor_partition(struct cpuset *cs)
+{
+ struct cpuset *ancestor = parent_cs(cs);
+
+ /*
+ * The top_cpuset is always a valid partition root which will stop
+ * the loop if it is reached.
+ */
+ while (!is_partition_valid(ancestor))
+ ancestor = parent_cs(ancestor);
+ return ancestor;
+}
+
/*
* update_cpumasks_hier - Update effective cpumasks and tasks in the subtree
* @cs: the cpuset to consider
@@ -2334,7 +2353,10 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
* cpuset if the parent's effective_cpus changes.
*/
if ((cp != cs) && old_prs) {
- switch (parent->partition_root_state) {
+ int parent_prs = parent->partition_root_state;
+ struct cpumask *del_cpus = NULL;
+
+ switch (parent_prs) {
case PRS_ROOT:
case PRS_ISOLATED:
update_parent = true;
@@ -2342,12 +2364,37 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
default:
/*
- * When parent is not a partition root or is
- * invalid, child partition roots become
- * invalid too.
+ * When parent is not a valid partition root,
+ * child partition roots become invalid too.
+ *
+ * For a to be invalidated isolated partition,
+ * its isolated CPUs may or may not need to be
+ * removed from isolated_cpus depending on if
+ * its closest partition root ancestor is a root
+ * or isolated partition. With a PRS_ISOLATED
+ * ancestor, the CPUs are checked against its
+ * effective xcpus to see if any of them needed
+ * to be removed.
*/
if (is_partition_valid(cp))
- new_prs = -cp->partition_root_state;
+ new_prs = -old_prs;
+
+ if (old_prs == PRS_ISOLATED) {
+ struct cpuset *ancestor = ancestor_partition(cp);
+
+ if (ancestor->partition_root_state == PRS_ROOT)
+ del_cpus = cp->effective_xcpus;
+ else if (cpumask_andnot(tmp->delmask,
+ cp->effective_xcpus,
+ ancestor->effective_xcpus))
+ del_cpus = tmp->delmask;
+
+ if (del_cpus) {
+ spin_lock_irq(&callback_lock);
+ isolated_cpus_update(old_prs, new_prs, del_cpus);
+ spin_unlock_irq(&callback_lock);
+ }
+ }
WRITE_ONCE(cp->prs_err,
is_partition_invalid(parent)
? PERR_INVPARENT : PERR_NOTPART);
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 6f7e387f68e5b..ffa030cf1984d 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -291,9 +291,9 @@ TEST_MATRIX=(
A1:P0|A2:P2|A3:P1 2-4|2-3"
" C0-4:S+ C1-4:S+ C2-4 . X2-4 X2-4:P2 X3-4:P1 . 0 A1:0-1|A2:2|A3:3-4 \
A1:P0|A2:P2|A3:P1 2"
- " C0-4:X2-4:S+ C1-4:X2-4:S+:P2 C2-4:X4:P1 \
- . . X5 . . 0 A1:0-4|A2:1-4|A3:2-4 \
- A1:P0|A2:P-2|A3:P-1 ."
+ " C1-4:X2-4:S+ C2-4:X3-4:S+:P1 C3-4:X4:P2 \
+ . . X5 . . 0 A1:1-4|A2:2-4|A3:3-4 \
+ A1:P0|A2:P-1|A3:P-2 ."
" C0-4:X2-4:S+ C1-4:X2-4:S+:P2 C2-4:X4:P1 \
. . . X1 . 0 A1:0-1|A2:2-4|A3:2-4 \
A1:P0|A2:P2|A3:P-1 2-4"
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 613/990] cgroup/cpuset: Consolidate isolated_cpus_can_update() into prstate_housekeeping_conflict()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (611 preceding siblings ...)
2026-11-25 14:32 ` [PATCH 6.18 612/990] cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 614/990] cgroup/cpuset: Consider all the exclusive CPUs when doing housekeeping check Greg Kroah-Hartman
` (239 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guopeng Zhang, Waiman Long,
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 53bbfb33b1f4fd669c5bffcb7670c4099ecbb225 ]
The isolated_cpus_can_update() and prstate_housekeeping_conflict() are
checking different aspects of upcoming cpumask changes that may conflict
with the current setting of the housekeeping cpumasks. There are places
where both are called together. There are also places where only one
of them is called. That inconsistency can contribute to missing check
where invalid cpumask changes may be allowed to move forward.
Fix that by consolidating isolated_cpus_can_update() into
prstate_housekeeping_conflict() and call prstate_housekeeping_conflict()
in all the places where either one of them or both are called. The
exception is the validate_partition() function where the
prstate_housekeeping_conflict() call is removed. It is because
validate_partition() is called only from partition_cpus_change()
where prstate_housekeeping_conflict() will be called from either
remote_cpus_update() or update_parent_effective_cpumask() with
partcmd_update if not for partition invalidatation or disablement.
Now prstate_housekeeping_conflict() will be called in the following
locations:
- when a partition is enabled in remote_partition_enable() or in
update_parent_effective_cpumask() with partcmd_enable*.
- when a cpumask is updated in remote_cpus_update() or in
update_parent_effective_cpumask() with partcmd_update.
- when a partition state changes from root to isolated or vice versa
in update_prstate().
Fixes: 4a74e418881f ("cgroup/cpuset: Check partition conflict with housekeeping setup")
Fixes: 103b08709e8a ("cgroup/cpuset: Fail if isolated and nohz_full don't leave any housekeeping")
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Replaced this tree's boot-isolcpus variables (have_boot_isolcpus, boot_hk_cpus) for the missing HK_TYPE_DOMAIN_BOOT housekeeping checks, with context adjusted for earlier backports. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 147 +++++++++++++++++++++--------------------
1 file changed, 77 insertions(+), 70 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 3ef103c4b68d3..4bda4c6b754f4 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1428,64 +1428,87 @@ static bool partition_xcpus_del(int old_prs, struct cpuset *parent,
}
/*
- * isolated_cpus_can_update - check for isolated & nohz_full conflicts
- * @add_cpus: cpu mask for cpus that are going to be isolated
- * @del_cpus: cpu mask for cpus that are no longer isolated, can be NULL
- * Return: false if there is conflict, true otherwise
- *
- * If nohz_full is enabled and we have isolated CPUs, their combination must
- * still leave housekeeping CPUs.
+ * prstate_housekeeping_conflict - check for partition & housekeeping conflicts
+ * @new_prs: new partition root state to be checked
+ * @parent_prs: Parent partition root state
+ * @add_cpus: additional CPUs to be added to current cpuset
+ * @del_cpus: CPUs to be removed from current cpuset, can be NULL
+ * Return: true if there is conflict, false otherwise
*
- * TBD: Should consider merging this function into
- * prstate_housekeeping_conflict().
+ * There are two different housekeeping conflicts to be checked:
+ * 1) If new_prs is PRS_ROOT, none of the @add_cpus can be a boot-time isolated
+ * CPU. IOW, the whole @add_cpus must be a subset of boot_hk_cpus.
+ * 2) If nohz_full is enabled and we have isolated CPUs, their combination must
+ * still leave housekeeping CPUs. This check is only needed if new_prs
+ * differs from parent_prs and one of them is PRS_ISOLATED.
*/
-static bool isolated_cpus_can_update(struct cpumask *add_cpus,
- struct cpumask *del_cpus)
+static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
+ struct cpumask *add_cpus,
+ struct cpumask *del_cpus)
{
cpumask_var_t full_hk_cpus;
- int res = true;
+ int res;
- if (!housekeeping_enabled(HK_TYPE_KERNEL_NOISE))
- return true;
+ WARN_ON_ONCE(parent_prs <= 0);
+ if (!new_prs)
+ return false;
- if (del_cpus && cpumask_weight_and(del_cpus,
- housekeeping_cpumask(HK_TYPE_KERNEL_NOISE)))
+ /*
+ * For a currently invalid partition root state, do the check assuming
+ * that it may be converted back to valid.
+ *
+ * There are code paths where an invalid partition may be reverted back
+ * to a valid partition but we still need to run the housekeeping check
+ * before the conversion happens to make sure the switch is valid. We
+ * can either do the negative to positive PRS switch individually in all
+ * these code paths or do it here which I think will make the code a bit
+ * easier to read.
+ */
+ if (new_prs < 0)
+ new_prs = -new_prs;
+
+ if (have_boot_isolcpus && (new_prs == PRS_ROOT) &&
+ !cpumask_subset(add_cpus, boot_hk_cpus))
return true;
- if (!alloc_cpumask_var(&full_hk_cpus, GFP_KERNEL))
+ /*
+ * Exit 2nd check early and return false if
+ * 1) there is no boot time isolated nohz_full CPU
+ * 2) parent and child has the same partition state
+ * 3) new_prs is PRS_ROOT, parent_prs is PRS_ISOLATED and no CPU will
+ * be returned back to the parent.
+ */
+ if (!housekeeping_enabled(HK_TYPE_KERNEL_NOISE) ||
+ (new_prs == parent_prs) ||
+ ((new_prs == PRS_ROOT) && (!del_cpus || cpumask_empty(del_cpus))))
+ return false;
+
+ /*
+ * Now make sure that @add_cpus contains new CPUs to be isolated and
+ * @del_cpus contains isolated CPUs to be un-isolated.
+ * With the guards above, @add_cpus can't be NULL after the swap.
+ */
+ if (parent_prs == PRS_ISOLATED)
+ swap(add_cpus, del_cpus);
+
+ if (del_cpus &&
+ (cpumask_first_and_and(del_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
+ cpu_active_mask) < nr_cpu_ids))
return false;
+ if (!alloc_cpumask_var(&full_hk_cpus, GFP_KERNEL))
+ return true;
+
cpumask_and(full_hk_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
housekeeping_cpumask(HK_TYPE_DOMAIN));
cpumask_andnot(full_hk_cpus, full_hk_cpus, isolated_cpus);
cpumask_and(full_hk_cpus, full_hk_cpus, cpu_active_mask);
- if (!cpumask_weight_andnot(full_hk_cpus, add_cpus))
- res = false;
+ res = !cpumask_weight_andnot(full_hk_cpus, add_cpus);
free_cpumask_var(full_hk_cpus);
return res;
}
-/*
- * prstate_housekeeping_conflict - check for partition & housekeeping conflicts
- * @prstate: partition root state to be checked
- * @new_cpus: cpu mask
- * Return: true if there is conflict, false otherwise
- *
- * CPUs outside of boot_hk_cpus, if defined, can only be used in an
- * isolated partition.
- */
-static bool prstate_housekeeping_conflict(int prstate, struct cpumask *new_cpus)
-{
- if (!have_boot_isolcpus)
- return false;
-
- if ((prstate != PRS_ISOLATED) && !cpumask_subset(new_cpus, boot_hk_cpus))
- return true;
-
- return false;
-}
-
static void update_isolation_cpumasks(bool isolcpus_updated)
{
int ret;
@@ -1645,9 +1668,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
return PERR_INVCPUS;
if (cpumask_intersects(tmp->new_cpus, subpartitions_cpus))
return PERR_NOCPUS;
- if (((new_prs == PRS_ISOLATED) &&
- !isolated_cpus_can_update(tmp->new_cpus, NULL)) ||
- prstate_housekeeping_conflict(new_prs, tmp->new_cpus))
+ if (prstate_housekeeping_conflict(new_prs, PRS_ROOT, tmp->new_cpus, NULL))
return PERR_HKEEPING;
spin_lock_irq(&callback_lock);
@@ -1755,8 +1776,8 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
else if (cpumask_intersects(tmp->addmask, subpartitions_cpus) ||
cpumask_subset(top_cpuset.effective_cpus, tmp->addmask))
WRITE_ONCE(cs->prs_err, PERR_NOCPUS);
- else if ((prs == PRS_ISOLATED) &&
- !isolated_cpus_can_update(tmp->addmask, tmp->delmask))
+ else if (prstate_housekeeping_conflict(prs, PRS_ROOT,
+ tmp->addmask, tmp->delmask))
WRITE_ONCE(cs->prs_err, PERR_HKEEPING);
if (cs->prs_err)
goto invalidate;
@@ -1901,11 +1922,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
if (cpumask_empty(xcpus))
return PERR_INVCPUS;
- if (prstate_housekeeping_conflict(new_prs, xcpus))
- return PERR_HKEEPING;
-
- if ((new_prs == PRS_ISOLATED) && (new_prs != parent_prs) &&
- !isolated_cpus_can_update(xcpus, NULL))
+ if (prstate_housekeeping_conflict(new_prs, parent_prs, xcpus, NULL))
return PERR_HKEEPING;
if (tasks_nocpu_error(parent, cs, xcpus))
@@ -1980,20 +1997,12 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
}
/*
- * TBD: Invalidate a currently valid child root partition may
- * still break isolated_cpus_can_update() rule if parent is an
- * isolated partition.
+ * Check for housekeeping conflicts
*/
- if (is_partition_valid(cs) && (old_prs != parent_prs)) {
- if ((parent_prs == PRS_ROOT) &&
- /* Adding to parent means removing isolated CPUs */
- !isolated_cpus_can_update(tmp->delmask, tmp->addmask))
- part_error = PERR_HKEEPING;
- if ((parent_prs == PRS_ISOLATED) &&
- /* Adding to parent means adding isolated CPUs */
- !isolated_cpus_can_update(tmp->addmask, tmp->delmask))
- part_error = PERR_HKEEPING;
- }
+ if (is_partition_valid(cs) &&
+ prstate_housekeeping_conflict(old_prs, parent_prs,
+ tmp->delmask, tmp->addmask))
+ part_error = PERR_HKEEPING;
/*
* The new CPUs to be removed from parent's effective CPUs
@@ -2559,10 +2568,6 @@ static enum prs_errcode validate_partition(struct cpuset *cs, struct cpuset *tri
if (cpumask_empty(trialcs->effective_xcpus))
return PERR_INVCPUS;
- if (prstate_housekeeping_conflict(trialcs->partition_root_state,
- trialcs->effective_xcpus))
- return PERR_HKEEPING;
-
if (tasks_nocpu_error(parent, cs, trialcs->effective_xcpus))
return PERR_NOCPUS;
@@ -2616,7 +2621,7 @@ static int cpus_allowed_validate_change(struct cpuset *cs, struct cpuset *trialc
* CPU modifications may cause a partition to be disabled or require state updates.
*/
static void partition_cpus_change(struct cpuset *cs, struct cpuset *trialcs,
- struct tmpmasks *tmp)
+ struct tmpmasks *tmp)
{
enum prs_errcode prs_err;
@@ -3173,13 +3178,15 @@ static int update_prstate(struct cpuset *cs, int new_prs)
err = remote_partition_enable(cs, new_prs, &tmpmask);
}
} else if (old_prs && new_prs) {
+ int parent_prs = is_remote_partition(cs)
+ ? PRS_ROOT : parent->partition_root_state;
+
/*
* A change in load balance state only, no change in cpumasks.
* Need to update isolated_cpus.
*/
- if (((new_prs == PRS_ISOLATED) &&
- !isolated_cpus_can_update(cs->effective_xcpus, NULL)) ||
- prstate_housekeeping_conflict(new_prs, cs->effective_xcpus))
+ if (prstate_housekeeping_conflict(new_prs, parent_prs,
+ cs->effective_xcpus, NULL))
err = PERR_HKEEPING;
else
isolcpus_updated = true;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 614/990] cgroup/cpuset: Consider all the exclusive CPUs when doing housekeeping check
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (612 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 613/990] cgroup/cpuset: Consolidate isolated_cpus_can_update() into prstate_housekeeping_conflict() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 615/990] cgroup/cpuset: Do housekeeping check before converting invalid partition to valid Greg Kroah-Hartman
` (238 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Waiman Long, 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 9527ff78a413e2b4089e78953926af77b98fd43f ]
When prstate_housekeeping_conflict() is called to perform housekeeping
check with cpumask changes, the cpumask changes are passed in via add_cpus
and del_cpus parameters. With this arrangement, the exclusive CPUs owned
by the child partitions and not affected by the cpumask change, if any,
are excluded in the analysis. The only places where there are separate
add and delete masks are when the cpuset.cpus or cpuset.cpus.exclusive
is being changed. In both cases, partition_cpus_change() is a good place
to perform the housekeeping check.
If we allow a root partition to be created under an isolated partition,
it is possible the cpumask change will still leave active housekeeping
CPUs but then no housekeeping CPUs will be left when the child partitions
are disabled or invalidated.
As a first step to protect against this possibility, all the exclusive
CPUs of the cpuset should be considered to be owned by the current cpuset
when doing housekeeping check. At the same time, we do want to know if
some housekeeping CPUs are going to be removed from the isolated partition
that there will be no danger of losing all the active housekeeping CPUs.
So the current add_cpus paremeter is renamed as new_cpus to indicate
that it includes the complete set of effective xcpus.
With the new check in partition_cpus_change(), the housekeeping check
in update_parent_effective_cpumask() with partcmd_update and newmask
is now duplicative and can be removed. The housekeeping check in
remote_cpus_update(), however, will still be useful as this function can
be called directly from update_cpumasks_hier() without going through
partition_cpus_change(). The update_parent_effective_cpumask() call
from update_cpumasks_hier() is partcmd_update with no cpumask which
still have the housekeeping check and so is covered.
Fixes: 103b08709e8a ("cgroup/cpuset: Fail if isolated and nohz_full don't leave any housekeeping")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Replaced the upstream HK_TYPE_DOMAIN_BOOT housekeeping checks with this tree's have_boot_isolcpus and boot_hk_cpus, keeping the add_cpus to new_cpus rename. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 46 +++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 19 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 4bda4c6b754f4..ee5ee72b8590d 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1431,19 +1431,19 @@ static bool partition_xcpus_del(int old_prs, struct cpuset *parent,
* prstate_housekeeping_conflict - check for partition & housekeeping conflicts
* @new_prs: new partition root state to be checked
* @parent_prs: Parent partition root state
- * @add_cpus: additional CPUs to be added to current cpuset
- * @del_cpus: CPUs to be removed from current cpuset, can be NULL
+ * @new_cpus: the set of new effective xcpus in the current cpuset
+ * @del_cpus: old CPUs going to be removed from current cpuset, can be NULL
* Return: true if there is conflict, false otherwise
*
* There are two different housekeeping conflicts to be checked:
- * 1) If new_prs is PRS_ROOT, none of the @add_cpus can be a boot-time isolated
- * CPU. IOW, the whole @add_cpus must be a subset of boot_hk_cpus.
+ * 1) If new_prs is PRS_ROOT, none of the @new_cpus can be a boot-time isolated
+ * CPU. IOW, the whole @new_cpus must be a subset of boot_hk_cpus.
* 2) If nohz_full is enabled and we have isolated CPUs, their combination must
* still leave housekeeping CPUs. This check is only needed if new_prs
* differs from parent_prs and one of them is PRS_ISOLATED.
*/
static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
- struct cpumask *add_cpus,
+ struct cpumask *new_cpus,
struct cpumask *del_cpus)
{
cpumask_var_t full_hk_cpus;
@@ -1468,7 +1468,7 @@ static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
new_prs = -new_prs;
if (have_boot_isolcpus && (new_prs == PRS_ROOT) &&
- !cpumask_subset(add_cpus, boot_hk_cpus))
+ !cpumask_subset(new_cpus, boot_hk_cpus))
return true;
/*
@@ -1484,12 +1484,12 @@ static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
return false;
/*
- * Now make sure that @add_cpus contains new CPUs to be isolated and
+ * Now make sure that @new_cpus contains new CPUs to be isolated and
* @del_cpus contains isolated CPUs to be un-isolated.
- * With the guards above, @add_cpus can't be NULL after the swap.
+ * With the guards above, @new_cpus can't be NULL after the swap.
*/
if (parent_prs == PRS_ISOLATED)
- swap(add_cpus, del_cpus);
+ swap(new_cpus, del_cpus);
if (del_cpus &&
(cpumask_first_and_and(del_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
@@ -1503,7 +1503,7 @@ static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
housekeeping_cpumask(HK_TYPE_DOMAIN));
cpumask_andnot(full_hk_cpus, full_hk_cpus, isolated_cpus);
cpumask_and(full_hk_cpus, full_hk_cpus, cpu_active_mask);
- res = !cpumask_weight_andnot(full_hk_cpus, add_cpus);
+ res = !cpumask_weight_andnot(full_hk_cpus, new_cpus);
free_cpumask_var(full_hk_cpus);
return res;
@@ -1777,7 +1777,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
cpumask_subset(top_cpuset.effective_cpus, tmp->addmask))
WRITE_ONCE(cs->prs_err, PERR_NOCPUS);
else if (prstate_housekeeping_conflict(prs, PRS_ROOT,
- tmp->addmask, tmp->delmask))
+ excpus, tmp->delmask))
WRITE_ONCE(cs->prs_err, PERR_HKEEPING);
if (cs->prs_err)
goto invalidate;
@@ -1996,14 +1996,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
parent->effective_xcpus);
}
- /*
- * Check for housekeeping conflicts
- */
- if (is_partition_valid(cs) &&
- prstate_housekeeping_conflict(old_prs, parent_prs,
- tmp->delmask, tmp->addmask))
- part_error = PERR_HKEEPING;
-
/*
* The new CPUs to be removed from parent's effective CPUs
* must be present.
@@ -2629,6 +2621,22 @@ static void partition_cpus_change(struct cpuset *cs, struct cpuset *trialcs,
return;
prs_err = validate_partition(cs, trialcs);
+ if (!prs_err && !cpumask_empty(trialcs->effective_xcpus)) {
+ int prs = cs->partition_root_state;
+ int parent_prs = is_remote_partition(cs)
+ ? PRS_ROOT : parent_cs(cs)->partition_root_state;
+ /*
+ * Check for housekeeping conflict by passing the whole
+ * effective_xcpus as well as those CPUs that are to be
+ * removed from cs as delmask.
+ */
+ cpumask_andnot(tmp->delmask, cs->effective_xcpus, trialcs->effective_xcpus);
+ if (parent_prs > 0 &&
+ prstate_housekeeping_conflict(prs, parent_prs,
+ trialcs->effective_xcpus, tmp->delmask))
+ prs_err = PERR_HKEEPING;
+ }
+
if (prs_err) {
WRITE_ONCE(cs->prs_err, prs_err);
trialcs->prs_err = prs_err;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 615/990] cgroup/cpuset: Do housekeeping check before converting invalid partition to valid
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (613 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 614/990] cgroup/cpuset: Consider all the exclusive CPUs when doing housekeeping check Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 616/990] cgroup/cpuset: Properly disabling partition when partition state switching fails Greg Kroah-Hartman
` (237 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guopeng Zhang, Waiman Long,
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 2c0a5742fc459cd8416607acff4a38a1abcb2e1b ]
When a hotplug event happens or when update_cpumasks_hier() is called, an
invalid partition may be converted back to valid. However check against
housekeeping conflict isn't being done which can lead to a partition
state that violates the housekeeping rules. Update the code to allow
reviving an invalid partition only if it can pass the housekeeping check.
Fixes: 4a74e418881f ("cgroup/cpuset: Check partition conflict with housekeeping setup")
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index ee5ee72b8590d..4a38da24c3612 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2044,9 +2044,15 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
bool exclusive = true;
/*
- * Convert invalid partition to valid has to
- * pass the cpu exclusivity test.
+ * Convert invalid partition to valid has to pass the
+ * cpu exclusivity test as well as the housekeeping
+ * check.
*/
+ if (prstate_housekeeping_conflict(cs->partition_root_state,
+ parent_prs, xcpus, NULL)) {
+ part_error = PERR_HKEEPING;
+ goto write_error;
+ }
rcu_read_lock();
cpuset_for_each_child(child, css, parent) {
if (child == cs)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 616/990] cgroup/cpuset: Properly disabling partition when partition state switching fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (614 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 615/990] cgroup/cpuset: Do housekeeping check before converting invalid partition to valid Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 617/990] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Greg Kroah-Hartman
` (236 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Guopeng Zhang,
Waiman Long, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <longman@redhat.com>
[ Upstream commit db27a748a399e24af715c54c12a7e928e32d15b0 ]
Before commit 103b08709e8a ("cgroup/cpuset: Fail if isolated and nohz_full
don't leave any housekeeping"), the partition state can be freely switched
from "root" to "isolated" and vice versa. After that commit, the switch
from "root" to "isolated" can fail if it exhausts all the housekeeping
CPUs. Later on, the switch from "isolated" to "root" can also fail if
some of the partition CPUs are boot-time isolated by "isolcpus".
A local or remote partition is made invalid when the switch fails.
However there are 2 problems with the existing invalidation code.
1) Both the subpartitions_cpus and isolated_cpus are not properly
updated.
2) In the case of remote partition with remote_partition flag set, it
is not cleared.
Fix this by calling the proper partition disabling function in this case.
On an x86 test system with boot option "isolcpus=10 cgroup_debug" set
and more than 16 cores, the following commands were executed after boot.
# cd /sys/fs/cgroup
# echo +cpuset > cgroup.subtree_control
# cat cpuset.cpus.isolated
10
# mkdir A
# echo 10-12 > A/cpuset.cpus
# echo isolated > A/cpuset.cpus.partition
# cat A/cpuset.cpus.partition
isolated
Before the patch:
# echo root > A/cpuset.cpus.partition
# cat A/cpuset.cpus.partition
root invalid (partition config conflicts with housekeeping setup)
# cat cpuset.cpus.isolated .__DEBUG__.cpuset.cpus.subpartitions
10-12
10-12
After the patch:
# echo root > A/cpuset.cpus.partition
# cat A/cpuset.cpus.partition
root invalid (partition config conflicts with housekeeping setup)
# cat cpuset.cpus.isolated .__DEBUG__.cpuset.cpus.subpartitions
10
Reported-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/lkml/7f4c57b26ad120ab30adf35653f1dd94@kernel.org/
Fixes: 4a74e418881f ("cgroup/cpuset: Check partition conflict with housekeeping setup")
Fixes: 103b08709e8a ("cgroup/cpuset: Fail if isolated and nohz_full don't leave any housekeeping")
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 4a38da24c3612..751ea3d6dcc0a 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -3140,6 +3140,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
struct cpuset *parent = parent_cs(cs);
struct tmpmasks tmpmask;
bool isolcpus_updated = false;
+ bool disable_partition = false;
if (old_prs == new_prs)
return 0;
@@ -3200,15 +3201,21 @@ static int update_prstate(struct cpuset *cs, int new_prs)
* Need to update isolated_cpus.
*/
if (prstate_housekeeping_conflict(new_prs, parent_prs,
- cs->effective_xcpus, NULL))
+ cs->effective_xcpus, NULL)) {
+ disable_partition = true;
err = PERR_HKEEPING;
- else
+ } else {
isolcpus_updated = true;
+ }
} else {
/*
* Switching back to member is always allowed even if it
* disables child partitions.
*/
+ disable_partition = true;
+ }
+
+ if (disable_partition) {
if (is_remote_partition(cs))
remote_partition_disable(cs, &tmpmask);
else
@@ -3217,7 +3224,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
/*
* Invalidation of child partitions will be done in
- * update_cpumasks_hier().
+ * update_cpumasks_hier() below.
*/
}
out:
@@ -3240,8 +3247,8 @@ static int update_prstate(struct cpuset *cs, int new_prs)
spin_unlock_irq(&callback_lock);
update_isolation_cpumasks(isolcpus_updated);
- /* Force update if switching back to member & update effective_xcpus */
- update_cpumasks_hier(cs, &tmpmask, !new_prs);
+ /* Force update if partition is disabled & update effective_xcpus */
+ update_cpumasks_hier(cs, &tmpmask, disable_partition);
/* A newly created partition must have effective_xcpus set */
WARN_ON_ONCE(!old_prs && (new_prs > 0)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 617/990] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (615 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 616/990] cgroup/cpuset: Properly disabling partition when partition state switching fails Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 618/990] xsk: freeze deferred pool teardown without blocking unregister Greg Kroah-Hartman
` (235 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Serhat Kumral, Leon Romanovsky,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Serhat Kumral <serhatkumral1@gmail.com>
[ Upstream commit bb75e5580b15cd23ededf15683a5ad67d7b61aab ]
In MLX5_IB_METHOD_STEERING_ANCHOR_CREATE, the user-supplied u16 priority
is passed directly to _get_flow_table() without an upper bound check.
This can lead to out-of-bounds array accesses on dev->flow_db priority
tables.
Check that priority does not exceed MLX5_IB_FLOW_LAST_PRIO before calling
_get_flow_table(), matching the existing validation in raw_fs_rule_add()
and mlx5_ib_create_flow().
Fixes: 0c6ab0ca9a66 ("RDMA/mlx5: Expose steering anchor to userspace")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
Link: https://patch.msgid.link/20261018144907.20123-1-serhatkumral1@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
[ sashal: Kept the branch's kzalloc(sizeof(*obj), GFP_KERNEL) as context instead of upstream's kzalloc_obj(*obj), with the same 3-line priority bounds check added before it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/infiniband/hw/mlx5/fs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
index b67994df98f2c..af3fd7781e685 100644
--- a/drivers/infiniband/hw/mlx5/fs.c
+++ b/drivers/infiniband/hw/mlx5/fs.c
@@ -2999,6 +2999,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_STEERING_ANCHOR_CREATE)(
if (err)
return err;
+ if (priority > MLX5_IB_FLOW_LAST_PRIO)
+ return -EINVAL;
+
obj = kzalloc(sizeof(*obj), GFP_KERNEL);
if (!obj)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 618/990] xsk: freeze deferred pool teardown without blocking unregister
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (616 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 617/990] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 619/990] ip6mr: clear skb->cb[] in reg_vif_xmit() Greg Kroah-Hartman
` (234 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Hilliard,
Björn Töpel, Jason Xing, Stanislav Fomichev,
Paolo Abeni, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hilliard <james.hilliard1@gmail.com>
[ Upstream commit fece8420e76fe53ee84f0439f18d026b4c7641da ]
Deferred pool destruction calls ndo_bpf() under RTNL. system_wq is
not frozen during system sleep, so that callback can run after a
device has suspended and gated its clocks. Use system_freezable_wq
so running destruction finishes before device suspend and new work
waits until process thaw.
Keep assigned pools visible to NETDEV_UNREGISTER independently of
the socket list. A released socket has already left that list, but
its final pool put can queue destruction after workqueues freeze.
A resume-time unregister would then wait for a device reference
whose release cannot run until the resume completes.
Track assigned pools per netdev with netdev operations locking and detach
remaining pools after the notifier socket walk, including copy-mode pools.
This also covers leased queues without scanning pools from unrelated
devices or network namespaces. Remove the entry on assignment failure and
normal teardown. The deferred worker still owns the pool and later observes
the cleared device pointer, avoiding a second driver detach or put.
The lifetime problem was identified by code inspection of the deferred
release and system-sleep paths.
Fixes: 1c1efc2af158 ("xsk: Create and free buffer pool independently from umem")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20261014-xsk-suspend-teardown-v4-1-27795582e4a3@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ sashal: Replaced the missing netdev_assert_locked_ops_compat() with this tree's equivalent netdev_ops_assert_locked(), and dropped the old assertion before ndo_bpf() so it isn't duplicated. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/netdevice.h | 5 ++++
include/net/xsk_buff_pool.h | 3 +++
net/xdp/xsk.c | 5 ++++
net/xdp/xsk_buff_pool.c | 46 ++++++++++++++++++++++++++++++-------
4 files changed, 51 insertions(+), 8 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f08d17f1d2e0a..d367760b902f1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2497,6 +2497,11 @@ struct net_device {
/* protected by rtnl_lock */
struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE];
+#ifdef CONFIG_XDP_SOCKETS
+ /** @xsk_pools: assigned AF_XDP pools, ops protected */
+ struct hlist_head xsk_pools;
+#endif
+
u8 dev_addr_shadow[MAX_ADDR_LEN];
netdevice_tracker linkwatch_dev_tracker;
netdevice_tracker watchdog_dev_tracker;
diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
index a461bb63761b7..93b60d7294afb 100644
--- a/include/net/xsk_buff_pool.h
+++ b/include/net/xsk_buff_pool.h
@@ -48,6 +48,8 @@ struct xsk_buff_pool {
struct device *dev;
struct net_device *netdev;
struct list_head xsk_tx_list;
+ /* Assigned pools, including deferred releases; ops protected. */
+ struct hlist_node dev_node;
/* Protects modifications to the xsk_tx_list */
spinlock_t xsk_tx_list_lock;
refcount_t users;
@@ -124,6 +126,7 @@ bool xp_put_pool(struct xsk_buff_pool *pool);
void xp_clear_dev(struct xsk_buff_pool *pool);
void xp_add_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs);
void xp_del_xsk(struct xsk_buff_pool *pool, struct xdp_sock *xs);
+void xp_clear_dev_all(struct net_device *dev);
/* AF_XDP, and XDP core. */
void xp_free(struct xdp_buff_xsk *xskb);
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 5d2067777d351..b9008668b3fd8 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -2038,6 +2038,11 @@ static int xsk_notifier(struct notifier_block *this,
mutex_unlock(&xs->mutex);
}
mutex_unlock(&net->xdp.lock);
+ /*
+ * A released socket is no longer on xdp.list. Its pool can still
+ * hold a device reference on the frozen release workqueue.
+ */
+ xp_clear_dev_all(dev);
break;
}
return NOTIFY_DONE;
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index 9dc1ff31867a1..f261a8879ea9e 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -182,7 +182,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
u32 frame_size;
int err = 0;
- ASSERT_RTNL();
+ netdev_ops_assert_locked(netdev);
force_zc = flags & XDP_ZEROCOPY;
force_copy = flags & XDP_COPY;
@@ -211,6 +211,11 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
pool->cached_need_wakeup = XDP_WAKEUP_TX;
dev_hold(netdev);
+ /*
+ * Socket removal precedes the final pool put. Keep the pool visible to
+ * NETDEV_UNREGISTER even while release work is waiting for process thaw.
+ */
+ hlist_add_head(&pool->dev_node, &netdev->xsk_pools);
if (force_copy)
/* For copy-mode, we are done. */
@@ -251,7 +256,6 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
bpf.xsk.pool = pool;
bpf.xsk.queue_id = queue_id;
- netdev_ops_assert_locked(netdev);
err = netdev->netdev_ops->ndo_bpf(netdev, &bpf);
if (err)
goto err_unreg_pool;
@@ -273,6 +277,8 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
if (err) {
pool->umem->flags = umem_flags;
xsk_clear_pool_at_qid(netdev, queue_id);
+ hlist_del(&pool->dev_node);
+ pool->netdev = NULL;
dev_put(netdev);
}
return err;
@@ -299,19 +305,39 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs,
return xp_assign_dev(pool, dev, queue_id, flags);
}
+static void __xp_clear_dev(struct xsk_buff_pool *pool)
+{
+ struct net_device *netdev = pool->netdev;
+
+ netdev_ops_assert_locked(netdev);
+ xp_disable_drv_zc(pool);
+ xsk_clear_pool_at_qid(netdev, pool->queue_id);
+ hlist_del(&pool->dev_node);
+ pool->netdev = NULL;
+ dev_put(netdev);
+}
+
void xp_clear_dev(struct xsk_buff_pool *pool)
{
struct net_device *netdev = pool->netdev;
- if (!pool->netdev)
+ if (!netdev)
return;
netdev_lock_ops(netdev);
- xp_disable_drv_zc(pool);
- xsk_clear_pool_at_qid(pool->netdev, pool->queue_id);
- pool->netdev = NULL;
+ __xp_clear_dev(pool);
netdev_unlock_ops(netdev);
- dev_put(netdev);
+}
+
+void xp_clear_dev_all(struct net_device *dev)
+{
+ struct xsk_buff_pool *pool;
+ struct hlist_node *next;
+
+ netdev_lock_ops(dev);
+ hlist_for_each_entry_safe(pool, next, &dev->xsk_pools, dev_node)
+ __xp_clear_dev(pool);
+ netdev_unlock_ops(dev);
}
static void xp_release_deferred(struct work_struct *work)
@@ -349,7 +375,11 @@ bool xp_put_pool(struct xsk_buff_pool *pool)
if (refcount_dec_and_test(&pool->users)) {
INIT_WORK(&pool->work, xp_release_deferred);
- schedule_work(&pool->work);
+ /*
+ * Teardown calls ndo_bpf(), which may need powered hardware.
+ * RTNL alone does not exclude the device's system PM callbacks.
+ */
+ queue_work(system_freezable_wq, &pool->work);
return true;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 619/990] ip6mr: clear skb->cb[] in reg_vif_xmit()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (617 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 618/990] xsk: freeze deferred pool teardown without blocking unregister Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 620/990] exfat: fix used_clusters accounting during cluster allocation Greg Kroah-Hartman
` (233 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, 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 238164201431a425e48dfcb8e9a59de63caf175b ]
reg_vif_xmit() hands the skb to ip6mr_cache_report() as an
MRT6MSG_WHOLEPKT report. skb_realloc_headroom() copies skb->cb[]
into the report, which is queued to the mroute socket, where
rawv6_recvmsg() reads it as IP6CB.
By the time the pim6reg device transmits the packet, skb->cb[] is
not IP6CB anymore: qdisc_pkt_len_init() overwrites iif and ra,
and any qdisc installed on the device (fq, fq_codel, pie, cake...)
or a tc BPF program writing skb->cb[] fills the area holding
dst0, srcrt, dst1, lastopt and flags.
Since commit dd433671fef3 ("ipv6: validate extension header length
before copying to cmsg") these stale offsets can no longer cause
out-of-bounds reads, but the mroute socket can still receive bogus
IPV6_PKTINFO ifindex and extension header ancillary data.
Clear IP6CB before building the report. The skb is freed right
after, so nothing else depends on its control block.
Fixes: 14fb64e1f449 ("[IPV6] MROUTE: Support PIM-SM (SSM).")
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Kept the branch's rcu_read_lock(); line as context and inserted the upstream memset and comment after it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/ip6mr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 53837248498a6..5a49fb4ae4513 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -629,6 +629,13 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,
DEV_STATS_ADD(dev, tx_bytes, skb->len);
DEV_STATS_INC(dev, tx_packets);
rcu_read_lock();
+
+ /* skb->cb[] holds qdisc/tc state at this point, not IP6CB.
+ * ip6mr_cache_report() copies it to the report delivered to
+ * the mroute socket, where it is read as IP6CB.
+ */
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
+
ip6mr_cache_report(mrt, skb, READ_ONCE(mrt->mroute_reg_vif_num),
MRT6MSG_WHOLEPKT);
rcu_read_unlock();
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 620/990] exfat: fix used_clusters accounting during cluster allocation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (618 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 619/990] ip6mr: clear skb->cb[] in reg_vif_xmit() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 621/990] exfat: take bitmap_lock at the start of exfat_alloc_cluster() Greg Kroah-Hartman
` (232 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Chi Zhiling, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chi Zhiling <chizhiling@kylinos.cn>
[ Upstream commit cb9dbf8a4e34b4fdf311598835ab4d76ed7e07c1 ]
In the current exfat_alloc_cluster(), p_chain->size is incremented as
each cluster is allocated so that the partially allocated chain can
be freed by __exfat_free_cluster() on the error path.
However, sbi->used_clusters is still updated only after all clusters
have been allocated, while __exfat_free_cluster() unconditionally
subtracts the number of freed clusters from sbi->used_clusters.
Therefore, when allocation fails partway through, the partially
allocated clusters are subtracted from sbi->used_clusters even
though they were never added to it. This corrupts the free-space
accounting and can cause sbi->used_clusters to underflow.
Increment sbi->used_clusters together with p_chain->size as each
cluster is allocated. This keeps the accounting consistent with
__exfat_free_cluster() on both the success and error paths.
This issue is caught by generic/476 with 256k cluster size:
Ran: generic/476
Failures: generic/476
Failed 1 of 1 tests
*** fsck.exfat output ***
ERROR: <path>: more clusters are allocated. truncate to N bytes
...
/dev/vdc: corrupted. directories 331, files 526
/dev/vdc: files corrupted 9, files fixed 0
*** end fsck.exfat output ***
Fixes: d5c514b6a0c0 ("exfat: fix the newly allocated clusters are not freed in error handling")
Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Dropped the blank line after the removed sbi->used_clusters += num_alloc; because this tree's success block lacks the done: label and uses num_alloc instead of p_chain->size. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/exfat/fatent.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
index 825083634ba2d..13a79845be016 100644
--- a/fs/exfat/fatent.c
+++ b/fs/exfat/fatent.c
@@ -431,13 +431,12 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
}
}
p_chain->size++;
+ sbi->used_clusters++;
last_clu = new_clu;
if (p_chain->size == num_alloc) {
sbi->clu_srch_ptr = hint_clu;
- sbi->used_clusters += num_alloc;
-
mutex_unlock(&sbi->bitmap_lock);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 621/990] exfat: take bitmap_lock at the start of exfat_alloc_cluster()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (619 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 620/990] exfat: fix used_clusters accounting during cluster allocation Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 622/990] ksmbd: disconnect on invalid encryption transform flags Greg Kroah-Hartman
` (231 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Chi Zhiling, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chi Zhiling <chizhiling@kylinos.cn>
[ Upstream commit 48acff2eedef7fecdfbd39be1b6f4463a9e43e3e ]
exfat_alloc_cluster() checks sbi->used_clusters against the total
number of data clusters before acquiring sbi->bitmap_lock. A concurrent
allocation can update sbi->used_clusters after the check but before
the lock is acquired, making the check stale. This can allow the
allocation to proceed even though there are not enough free clusters,
causing it to fail partway through.
Acquire sbi->bitmap_lock before checking sbi->used_clusters so that
the free-space check and subsequent cluster allocation are serialized
with concurrent allocations.
Fixes: f55c096f62f1 ("exfat: do not zero the extended part")
Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/exfat/fatent.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
index 13a79845be016..87c7823efa718 100644
--- a/fs/exfat/fatent.c
+++ b/fs/exfat/fatent.c
@@ -355,19 +355,22 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
struct super_block *sb = inode->i_sb;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
+ mutex_lock(&sbi->bitmap_lock);
+
total_cnt = EXFAT_DATA_CLUSTER_COUNT(sbi);
if (unlikely(total_cnt < sbi->used_clusters)) {
exfat_fs_error_ratelimit(sb,
"%s: invalid used clusters(t:%u,u:%u)\n",
__func__, total_cnt, sbi->used_clusters);
- return -EIO;
+ ret = -EIO;
+ goto unlock;
}
- if (num_alloc > total_cnt - sbi->used_clusters)
- return -ENOSPC;
-
- mutex_lock(&sbi->bitmap_lock);
+ if (num_alloc > total_cnt - sbi->used_clusters) {
+ ret = -ENOSPC;
+ goto unlock;
+ }
hint_clu = p_chain->dir;
/* find new cluster */
@@ -437,8 +440,8 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
if (p_chain->size == num_alloc) {
sbi->clu_srch_ptr = hint_clu;
- mutex_unlock(&sbi->bitmap_lock);
- return 0;
+ ret = 0;
+ goto unlock;
}
hint_clu = new_clu + 1;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 622/990] ksmbd: disconnect on invalid encryption transform flags
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (620 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 621/990] exfat: take bitmap_lock at the start of exfat_alloc_cluster() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 623/990] ksmbd: cache the resolved share path for durable reconnects Greg Kroah-Hartman
` (230 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 0882f124ae329eefb66b00e63b9043f24c006b0e ]
MS-SMB2 3.3.5.2.1.1 requires the Flags/EncryptionAlgorithm field in an
SMB2 transform header to be 0x0001. The server must disconnect the
connection when it has any other value.
smb3_decrypt_req() currently ignores this field. A client with the
session key can therefore send a correctly authenticated encrypted
request with invalid flags and have it processed. Check the field
before looking up the session key or decrypting the request. The caller
aborts the connection when this check fails.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Added a transform-flags check to smb3_decrypt_req() unchanged, but anchored it after the "Transform message is too small" check because the surrounding length-check code differs on this branch. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 53094243d456b..88f07ec22723a 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -9651,6 +9651,12 @@ int smb3_decrypt_req(struct ksmbd_work *work)
return -ECONNABORTED;
}
+ if (tr_hdr->Flags != cpu_to_le16(TRANSFORM_FLAG_ENCRYPTED)) {
+ pr_err_ratelimited("Invalid transform flags 0x%04x\n",
+ le16_to_cpu(tr_hdr->Flags));
+ return -ECONNABORTED;
+ }
+
if (buf_data_size < le32_to_cpu(tr_hdr->OriginalMessageSize)) {
pr_err("Transform message is broken\n");
return -ECONNABORTED;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 623/990] ksmbd: cache the resolved share path for durable reconnects
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (621 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 622/990] ksmbd: disconnect on invalid encryption transform flags Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 624/990] ksmbd: fix durable reconnects for root shares Greg Kroah-Hartman
` (229 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Dairui Zhang, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 2a90ba573d41efa82e075ba9ac532bb3ec0519c4 ]
A share configured as /a/link/b, with /a/link pointing to /real, is
opened relative to share->vfs_path at /real/b. However,
ksmbd_validate_name_reconnect() compares the file's d_path() result
against the original /a/link/b string and rejects a valid reconnect.
Render share->vfs_path with d_path() after the existing kern_path()
lookup and cache a copy in real_path along with its length. Use the
resolved string for durable reconnect name validation. Keep path and
path_sz as the configured spelling for existing consumers, including
the volume serial calculation and path lookups.
Fixes: c8efcc786146 ("ksmbd: add support for durable handles v1/v2")
Reported-by: Dairui Zhang <zhangdairui@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Dropped the scoped_with_init_fs() wrapper around the share_config_resolve_path() call and the fs_struct.h include, since this tree has neither and calls the helper directly. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/mgmt/share_config.c | 43 +++++++++++++++++++++++++++++--
fs/smb/server/mgmt/share_config.h | 2 ++
fs/smb/server/vfs_cache.c | 12 +++++----
3 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/fs/smb/server/mgmt/share_config.c b/fs/smb/server/mgmt/share_config.c
index 8813a81ca6629..5fbc2235ab8d3 100644
--- a/fs/smb/server/mgmt/share_config.c
+++ b/fs/smb/server/mgmt/share_config.c
@@ -8,6 +8,7 @@
#include <linux/slab.h>
#include <linux/rwsem.h>
#include <linux/parser.h>
+#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/sched.h>
#include <linux/mm.h>
@@ -50,6 +51,7 @@ static void kill_share(struct ksmbd_share_config *share)
path_put(&share->vfs_path);
kfree(share->name);
kfree(share->path);
+ kfree(share->real_path);
kfree(share);
}
@@ -124,6 +126,43 @@ static int parse_veto_list(struct ksmbd_share_config *share,
return 0;
}
+static int share_config_resolve_path(struct ksmbd_share_config *share)
+{
+ char *buf, *path;
+ int ret;
+
+ ret = kern_path(share->path, 0, &share->vfs_path);
+ if (ret)
+ return ret;
+
+ buf = kmalloc(PATH_MAX, KSMBD_DEFAULT_GFP);
+ if (!buf) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ path = d_path(&share->vfs_path, buf, PATH_MAX);
+ if (IS_ERR(path)) {
+ ret = PTR_ERR(path);
+ goto out_buf;
+ }
+
+ path = kstrdup(path, KSMBD_DEFAULT_GFP);
+ if (!path) {
+ ret = -ENOMEM;
+ goto out_buf;
+ }
+
+ share->real_path = path;
+ share->real_path_sz = strlen(path);
+out_buf:
+ kfree(buf);
+out:
+ if (ret)
+ path_put(&share->vfs_path);
+ return ret;
+}
+
static struct ksmbd_share_config *share_config_request(struct ksmbd_work *work,
const char *name)
{
@@ -212,12 +251,12 @@ static struct ksmbd_share_config *share_config_request(struct ksmbd_work *work,
goto out;
}
- ret = kern_path(share->path, 0, &share->vfs_path);
+ ret = share_config_resolve_path(share);
ksmbd_revert_fsids(work);
if (ret) {
ksmbd_debug(SMB, "failed to access '%s'\n",
share->path);
- /* Avoid put_path() */
+ /* No path reference is retained on failure. */
kfree(share->path);
share->path = NULL;
}
diff --git a/fs/smb/server/mgmt/share_config.h b/fs/smb/server/mgmt/share_config.h
index d4ac2dd4de204..baa9f9ed91cde 100644
--- a/fs/smb/server/mgmt/share_config.h
+++ b/fs/smb/server/mgmt/share_config.h
@@ -16,8 +16,10 @@ struct ksmbd_work;
struct ksmbd_share_config {
char *name;
char *path;
+ char *real_path;
unsigned int path_sz;
+ unsigned int real_path_sz;
unsigned int flags;
struct list_head veto_list;
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index 2621d2cffe619..b1ee76949a2ea 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -1355,6 +1355,8 @@ void ksmbd_free_global_file_table(void)
int ksmbd_validate_name_reconnect(struct ksmbd_share_config *share,
struct ksmbd_file *fp, char *name)
{
+ const char *share_path = share->real_path;
+ size_t share_path_sz = share->real_path_sz;
char *pathname, *ab_pathname;
int ret = 0;
@@ -1371,14 +1373,14 @@ int ksmbd_validate_name_reconnect(struct ksmbd_share_config *share,
if (name) {
size_t len = strlen(ab_pathname);
- if (len == share->path_sz && !strncmp(ab_pathname, share->path, len)) {
+ if (len == share_path_sz && !strncmp(ab_pathname, share_path, len)) {
/* the durable fp is the share root itself */
if (name[0])
ret = -EINVAL;
- } else if (len <= share->path_sz ||
- strncmp(ab_pathname, share->path, share->path_sz) ||
- ab_pathname[share->path_sz] != '/' ||
- strcmp(&ab_pathname[share->path_sz + 1], name)) {
+ } else if (len <= share_path_sz ||
+ strncmp(ab_pathname, share_path, share_path_sz) ||
+ ab_pathname[share_path_sz] != '/' ||
+ strcmp(&ab_pathname[share_path_sz + 1], name)) {
ret = -EINVAL;
}
if (ret)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 624/990] ksmbd: fix durable reconnects for root shares
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (622 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 623/990] ksmbd: cache the resolved share path for durable reconnects Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 625/990] ALSA: hda/realtek: Add mute and mic-mute LEDs for HP ENVY 16 (103c:8be5) Greg Kroah-Hartman
` (228 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Dairui Zhang, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 25e36df831a47597c03c6239fbc71285e7d714c2 ]
When a share exports "/", ksmbd_validate_name_reconnect() expects
another slash after the share path. For a file at /foo, this rejects
the valid reconnect name "foo" even though the file is in the share.
Compare the requested name with the rendered file path after its
leading slash when the resolved share root is "/". Keep the
exact-root/empty-name check and reject rendered paths without an
initial slash.
Fixes: c8efcc786146 ("ksmbd: add support for durable handles v1/v2")
Reported-by: Dairui Zhang <zhangdairui@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/vfs_cache.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index b1ee76949a2ea..52389fff3d4a0 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -1377,6 +1377,10 @@ int ksmbd_validate_name_reconnect(struct ksmbd_share_config *share,
/* the durable fp is the share root itself */
if (name[0])
ret = -EINVAL;
+ } else if (share_path_sz == 1 && share_path[0] == '/') {
+ if (ab_pathname[0] != '/' ||
+ strcmp(ab_pathname + 1, name))
+ ret = -EINVAL;
} else if (len <= share_path_sz ||
strncmp(ab_pathname, share_path, share_path_sz) ||
ab_pathname[share_path_sz] != '/' ||
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 625/990] ALSA: hda/realtek: Add mute and mic-mute LEDs for HP ENVY 16 (103c:8be5)
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (623 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 624/990] ksmbd: fix durable reconnects for root shares Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 626/990] perf lock contention: Filter events before creating lock_stat Greg Kroah-Hartman
` (227 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Ajanesh Lal, Takashi Iwai,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ajanesh Lal <ajaneshlal3@gmail.com>
[ Upstream commit ed7995e4ec3789a90e37eb826bfccf43cc85d2fd ]
The HP ENVY Laptop 16-h1xxx (PCI SSID 103c:8be5) uses an ALC245 codec
with CS35L41 I2C speaker amplifiers. No LED fixup is applied for this
subsystem ID, so the speaker mute LED and the microphone mute LED are
never driven and do not follow their keys.
Add a fixup that calls the existing ALC245 mute LED COEF helper and the
GPIO mic-mute LED helper directly, then chains to the CS35L41 I2C
amplifier setup so the speakers keep working. Use it for 103c:8be5.
Tested on an HP ENVY Laptop 16-h1xxx running kernel 7.2.11: the
hda::mute and hda::micmute LEDs appear and follow their keys, and the
speaker amplifiers still bind (CS35L41 Bound in dmesg). The mic LED
GPIO pin and polarity are not verified on other hardware.
Fixes: aa8e3ef4fe53 ("ALSA: hda/realtek: Add quirks for various HP ENVY models")
Assisted-by: Claude:claude-haiku-5-5
Signed-off-by: Ajanesh Lal <ajaneshlal3@gmail.com>
Link: https://patch.msgid.link/20261021142453.177174-1-ajaneshlal3@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ sashal: Added the new enum value and fixup table entry after the tree's last entries, since the context entries the upstream patch anchors on are missing, and left out the unneeded ALC245_FIXUP_CS35L41_I2C_2_MUTE_LED additions. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/hda/codecs/realtek/alc269.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index 6ee95ae0e8f67..dbc7b56f4d42b 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -1585,6 +1585,14 @@ static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
}
}
+/* mute LED via COEF bit and mic-mute LED via GPIO, called directly */
+static void alc245_fixup_cs35l41_mute_micmute(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+ alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
+ alc245_fixup_hp_gpio_led(codec, fix, action);
+}
+
static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec,
const struct hda_fixup *fix,
int action)
@@ -4045,6 +4053,7 @@ enum {
ALC289_FIXUP_ASUS_ZEPHYRUS_DUAL_SPK,
ALC256_FIXUP_VAIO_RPL_MIC_NO_PRESENCE,
ALC245_FIXUP_ACER_MICMUTE_LED,
+ ALC245_FIXUP_CS35L41_I2C_2_MUTE_MICMUTE_LED,
};
/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -6668,6 +6677,12 @@ static const struct hda_fixup alc269_fixups[] = {
.v.func = alc285_fixup_hp_coef_micmute_led,
.chained = true,
.chain_id = ALC2XX_FIXUP_HEADSET_MIC,
+ },
+ [ALC245_FIXUP_CS35L41_I2C_2_MUTE_MICMUTE_LED] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc245_fixup_cs35l41_mute_micmute,
+ .chained = true,
+ .chain_id = ALC287_FIXUP_CS35L41_I2C_2,
}
};
@@ -7103,7 +7118,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x8be1, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8be2, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8be3, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
- SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x103c, 0x8be5, "HP Envy 16", ALC245_FIXUP_CS35L41_I2C_2_MUTE_MICMUTE_LED),
SND_PCI_QUIRK(0x103c, 0x8be6, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8be7, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x103c, 0x8be8, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS),
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 626/990] perf lock contention: Filter events before creating lock_stat
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (624 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 625/990] ALSA: hda/realtek: Add mute and mic-mute LEDs for HP ENVY 16 (103c:8be5) Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 627/990] zram: fix short reads from block_state Greg Kroah-Hartman
` (226 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Namhyung Kim, Ian Rogers,
Arnaldo Carvalho de Melo, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
[ Upstream commit c58d1598e79554cc8f587668ab2ebcaeb616b076 ]
In report_lock_contention_begin_event(), lock_stat_findnew() was
called before checking filters.nr_types (-Y), filters.nr_addrs (-L),
and match_callstack_filter() (-S).
When a filtered-out lock event (such as a mutex contention when
running with -Y spinlock) shared the same aggregation key as a
subsequent matching event (for example, contention on the mutex's
internal wait_lock spinlock from the same caller), the first event
created the lock_stat entry with the filtered-out lock's flags and the
second event reused that entry, causing non-spinlock entries to appear
in -Y spinlock output.
Check the type, address, and callstack filters before looking up or
creating the lock_stat entry.
Fixes: b4a7eff93c39f985 ("perf lock contention: Add -Y/--type-filter option")
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ sashal: Used the tree's lock_contention_caller(evsel, sample, ...) signature, with the extra evsel argument, in the moved lock_stat lookup block instead of upstream's lock_contention_caller(sample, ...). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/perf/builtin-lock.c | 61 +++++++++++++++++++++------------------
1 file changed, 33 insertions(+), 28 deletions(-)
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 5585aeb97684d..66bfd9e4fe17f 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -977,6 +977,7 @@ static int report_lock_contention_begin_event(struct evsel *evsel,
struct machine *machine = &session->machines.host;
struct map *kmap;
struct symbol *sym;
+ u64 *callstack = NULL;
ret = get_key_by_aggr_mode(&key, addr, evsel, sample);
if (ret < 0)
@@ -1012,33 +1013,6 @@ static int report_lock_contention_begin_event(struct evsel *evsel,
}
}
- ls = lock_stat_find(key);
- if (!ls) {
- char buf[128];
- const char *name = "";
-
- switch (aggr_mode) {
- case LOCK_AGGR_ADDR:
- sym = machine__find_kernel_symbol(machine, key, &kmap);
- if (sym)
- name = sym->name;
- break;
- case LOCK_AGGR_CALLER:
- name = buf;
- if (lock_contention_caller(evsel, sample, buf, sizeof(buf)) < 0)
- name = "Unknown";
- break;
- case LOCK_AGGR_CGROUP:
- case LOCK_AGGR_TASK:
- default:
- break;
- }
-
- ls = lock_stat_findnew(key, name, flags);
- if (!ls)
- return -ENOMEM;
- }
-
if (filters.nr_types) {
bool found = false;
@@ -1068,7 +1042,7 @@ static int report_lock_contention_begin_event(struct evsel *evsel,
}
if (needs_callstack()) {
- u64 *callstack = get_callstack(sample, max_stack_depth);
+ callstack = get_callstack(sample, max_stack_depth);
if (callstack == NULL)
return -ENOMEM;
@@ -1076,7 +1050,38 @@ static int report_lock_contention_begin_event(struct evsel *evsel,
free(callstack);
return 0;
}
+ }
+
+ ls = lock_stat_find(key);
+ if (!ls) {
+ char buf[128];
+ const char *name = "";
+
+ switch (aggr_mode) {
+ case LOCK_AGGR_ADDR:
+ sym = machine__find_kernel_symbol(machine, key, &kmap);
+ if (sym)
+ name = sym->name;
+ break;
+ case LOCK_AGGR_CALLER:
+ name = buf;
+ if (lock_contention_caller(evsel, sample, buf, sizeof(buf)) < 0)
+ name = "Unknown";
+ break;
+ case LOCK_AGGR_CGROUP:
+ case LOCK_AGGR_TASK:
+ default:
+ break;
+ }
+
+ ls = lock_stat_findnew(key, name, flags);
+ if (!ls) {
+ free(callstack);
+ return -ENOMEM;
+ }
+ }
+ if (callstack) {
if (ls->callstack == NULL)
ls->callstack = callstack;
else
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 627/990] zram: fix short reads from block_state
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (625 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 626/990] perf lock contention: Filter events before creating lock_stat Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 628/990] cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition Greg Kroah-Hartman
` (225 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pooyan Azad, Andrew Morton,
Sergey Senozhatsky, Minchan Kim, Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pooyan Azad <pooyan.azadparvar@gmail.com>
[ Upstream commit 372012202260db088b489ed00059c4571a602552 ]
read_block_state() formats each entry directly into the buffer supplied by
read(). If the remaining buffer is too small for one complete record,
snprintf() returns the full record length and the function stops without
copying data or advancing the file position. A read from this debugfs
file which is smaller than a record therefore returns zero at a non-EOF
position and cannot make progress.
Convert block_state to seq_file so formatted records are buffered
independently of the userspace read size. Keep dev_lock held across each
seq_file iteration and continue to protect individual entries with their
slot locks.
Link: https://lore.kernel.org/20260929071846.24829-1-pooyan.azadparvar@gmail.com
Fixes: c0265342bff4 ("zram: introduce zram memory tracking")
Signed-off-by: Pooyan Azad <pooyan.azadparvar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Closes: https://lore.kernel.org/r/CANC3H+LdtoydSp+o2ecErAw7k6R2+gRf9LyxcaoHv_mGhJmyQQ@mail.gmail.com/
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
[ sashal: Renamed this tree's older helpers and lock (init_lock, zram_slot_lock, zram_allocated, etc.) in place of upstream's, and kept the ktime_t-based timestamp formatting instead of upstream's integer ac_time print. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/block/zram/zram_drv.c | 105 +++++++++++++++++-----------------
1 file changed, 53 insertions(+), 52 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index ea5a9b81a310e..1ef4a15947683 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1134,72 +1134,73 @@ static void zram_debugfs_destroy(void)
debugfs_remove_recursive(zram_debugfs_root);
}
-static ssize_t read_block_state(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+static void *zram_block_state_start(struct seq_file *seq, loff_t *pos)
{
- char *kbuf;
- ssize_t index, written = 0;
- struct zram *zram = file->private_data;
+ struct zram *zram = seq->private;
unsigned long nr_pages;
- kbuf = kvmalloc(count, GFP_KERNEL);
- if (!kbuf)
- return -ENOMEM;
-
down_read(&zram->init_lock);
- if (!init_done(zram)) {
- up_read(&zram->init_lock);
- kvfree(kbuf);
- return -EINVAL;
- }
+ if (!init_done(zram))
+ return ERR_PTR(-EINVAL);
nr_pages = zram->disksize >> PAGE_SHIFT;
+ if (*pos >= nr_pages)
+ return NULL;
- for (index = *ppos; index < nr_pages; index++) {
- int copied;
- struct timespec64 ts;
+ return pos;
+}
- zram_slot_lock(zram, index);
- if (!zram_allocated(zram, index))
- goto next;
+static void *zram_block_state_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct zram *zram = seq->private;
+ unsigned long nr_pages = zram->disksize >> PAGE_SHIFT;
- ts = ktime_to_timespec64(zram->table[index].ac_time);
- copied = snprintf(kbuf + written, count,
- "%12zd %12lld.%06lu %c%c%c%c%c%c\n",
- index, (s64)ts.tv_sec,
- ts.tv_nsec / NSEC_PER_USEC,
- zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
- zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',
- zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.',
- zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.',
- zram_get_priority(zram, index) ? 'r' : '.',
- zram_test_flag(zram, index,
- ZRAM_INCOMPRESSIBLE) ? 'n' : '.');
-
- if (count <= copied) {
- zram_slot_unlock(zram, index);
- break;
- }
- written += copied;
- count -= copied;
-next:
- zram_slot_unlock(zram, index);
- *ppos += 1;
- }
+ ++*pos;
+ if (*pos >= nr_pages)
+ return NULL;
+
+ return pos;
+}
+
+static void zram_block_state_stop(struct seq_file *seq, void *v)
+{
+ struct zram *zram = seq->private;
up_read(&zram->init_lock);
- if (copy_to_user(buf, kbuf, written))
- written = -EFAULT;
- kvfree(kbuf);
+}
- return written;
+static int zram_block_state_show(struct seq_file *seq, void *v)
+{
+ struct zram *zram = seq->private;
+ unsigned long index = *(loff_t *)v;
+ struct timespec64 ts;
+
+ zram_slot_lock(zram, index);
+ if (zram_allocated(zram, index)) {
+ ts = ktime_to_timespec64(zram->table[index].ac_time);
+ seq_printf(seq, "%12lu %12lld.%06lu %c%c%c%c%c%c\n",
+ index, (s64)ts.tv_sec,
+ ts.tv_nsec / NSEC_PER_USEC,
+ zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
+ zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',
+ zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.',
+ zram_test_flag(zram, index, ZRAM_IDLE) ? 'i' : '.',
+ zram_get_priority(zram, index) ? 'r' : '.',
+ zram_test_flag(zram, index,
+ ZRAM_INCOMPRESSIBLE) ? 'n' : '.');
+ }
+ zram_slot_unlock(zram, index);
+
+ return 0;
}
-static const struct file_operations proc_zram_block_state_op = {
- .open = simple_open,
- .read = read_block_state,
- .llseek = default_llseek,
+static const struct seq_operations zram_block_state_sops = {
+ .start = zram_block_state_start,
+ .next = zram_block_state_next,
+ .stop = zram_block_state_stop,
+ .show = zram_block_state_show,
};
+DEFINE_SEQ_ATTRIBUTE(zram_block_state);
static void zram_debugfs_register(struct zram *zram)
{
@@ -1209,7 +1210,7 @@ static void zram_debugfs_register(struct zram *zram)
zram->debugfs_dir = debugfs_create_dir(zram->disk->disk_name,
zram_debugfs_root);
debugfs_create_file("block_state", 0400, zram->debugfs_dir,
- zram, &proc_zram_block_state_op);
+ zram, &zram_block_state_fops);
}
static void zram_debugfs_unregister(struct zram *zram)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 628/990] cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (626 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 627/990] zram: fix short reads from block_state Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 629/990] cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask() Greg Kroah-Hartman
` (224 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Waiman Long, Guopeng Zhang,
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 0bce85ff2cc0f7f7d8de16f5fdfc0ae7d29f21f1 ]
Commit 46b885416c27 ("cgroup/cpuset: Fix a missing isolated_cpus
update in update_cpumasks_hier()") searches for the closet partition
root ancestor to determine if the isolated CPUs in a to be invalidated
isolation partition should be removed from isolated_cpus or not.
As reported by sashiko, this method may not work when there is a deeply
nested isolated partition hierarchy. For instance, Consider a nested
hierarchy A0 -> A1 -> A2 -> A3 where all four are PRS_ISOLATED:
A0: effective_xcpus = 0-4
A1: effective_xcpus = 1-4
A2: effective_xcpus = 2-4
A3: effective_xcpus = 3-4
When A1 shrinks its exclusive_cpus from 1-4 to 1-2, A2 will update it
effective_xcpus to 2. A3 will find its closet partition root ancestor
A2 and decides that its effective_xcpus 3-4 should be removed from
isolated_cpus which is incorrect.
Address this corner case by adding a new isolated_cpus_release() helper
to replace the existing ancestor_partition() helper. This new helper
will search for the furthest isolated partition root ancestor to decide
if some or all of its isolated CPUs should be removed from isolated_cpus
and also perform the removal when appropriate.
The is_remote_partition() and is_local_partition() helpers are also
moved up so they can be used in earlier functions.
There are other pre-existing problems that will still prevent the
above test case to work correctly. These problems will be addressed in
subsequent patches.
Fixes: 46b885416c27 ("cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier()")
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Replaced the upstream cs->remote_partition check in is_remote_partition() with this tree's remote_sibling list test, and adjusted context around the plain isolated_cpus_update(). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 104 +++++++++++++++++++++--------------------
1 file changed, 53 insertions(+), 51 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 751ea3d6dcc0a..54ee036020e05 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1348,6 +1348,16 @@ static void reset_partition_data(struct cpuset *cs)
cpumask_copy(cs->effective_cpus, parent->effective_cpus);
}
+static inline bool is_remote_partition(struct cpuset *cs)
+{
+ return !list_empty(&cs->remote_sibling);
+}
+
+static inline bool is_local_partition(struct cpuset *cs)
+{
+ return is_partition_valid(cs) && !is_remote_partition(cs);
+}
+
/*
* isolated_cpus_update - Update the isolated_cpus mask
* @old_prs: old partition_root_state
@@ -1363,6 +1373,45 @@ static void isolated_cpus_update(int old_prs, int new_prs, struct cpumask *xcpus
cpumask_andnot(isolated_cpus, isolated_cpus, xcpus);
}
+/*
+ * isolated_cpus_release - Remove the relevant CPUs in @xcpus from isolated_cpus
+ * @cs: the current cpuset
+ * @xcpus: the set of effective xcpus to be considered for removal
+ *
+ * This function is called when an isolated partition is invalidated or when
+ * some of its effective xcpus are to be removed from isolated_cpus due to
+ * changes in parent cpuset. The given @xcpus must be modifiable as the function
+ * will update its value to determine the right set of CPUs to be removed.
+ */
+static void isolated_cpus_release(struct cpuset *cs, struct cpumask *xcpus)
+{
+ struct cpuset *ancestor = parent_cs(cs);
+ struct cpuset *iancestor = NULL;
+
+ /*
+ * Search the furthest isolated partition root ancestor available
+ * until top_cpuset or a remote partition root is hit.
+ */
+ for (; ancestor; ancestor = parent_cs(ancestor)) {
+ if (ancestor->partition_root_state == PRS_ISOLATED)
+ iancestor = ancestor;
+ if (is_remote_partition(ancestor))
+ break;
+ }
+
+ /*
+ * If a furthest isolated partition acnestor is found, use it to
+ * determine which of the CPUs in @xcpus should be removed from
+ * isolated_cpus. Otherwise, all of them will be removed.
+ */
+ if (iancestor && !cpumask_andnot(xcpus, xcpus, iancestor->effective_xcpus))
+ return; /* No CPU should be removed from isolated_cpus */
+
+ spin_lock_irq(&callback_lock);
+ isolated_cpus_update(PRS_ISOLATED, PRS_ROOT, xcpus);
+ spin_unlock_irq(&callback_lock);
+}
+
/*
* partition_xcpus_add - Add new exclusive CPUs to partition
* @new_prs: new partition_root_state
@@ -1621,16 +1670,6 @@ static int compute_trialcs_excpus(struct cpuset *trialcs, struct cpuset *cs)
return rm_siblings_excl_cpus(parent, cs, excpus);
}
-static inline bool is_remote_partition(struct cpuset *cs)
-{
- return !list_empty(&cs->remote_sibling);
-}
-
-static inline bool is_local_partition(struct cpuset *cs)
-{
- return is_partition_valid(cs) && !is_remote_partition(cs);
-}
-
/*
* remote_partition_enable - Enable current cpuset as a remote partition root
* @cs: the cpuset to update
@@ -2239,25 +2278,6 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
rcu_read_unlock();
}
-/*
- * ancestor_partition - Find and return the closest valid partition root ancestor
- * @cs: the current cpuset
- *
- * Return: The closet partition root ancestor cpuset
- */
-static struct cpuset *ancestor_partition(struct cpuset *cs)
-{
- struct cpuset *ancestor = parent_cs(cs);
-
- /*
- * The top_cpuset is always a valid partition root which will stop
- * the loop if it is reached.
- */
- while (!is_partition_valid(ancestor))
- ancestor = parent_cs(ancestor);
- return ancestor;
-}
-
/*
* update_cpumasks_hier - Update effective cpumasks and tasks in the subtree
* @cs: the cpuset to consider
@@ -2361,7 +2381,6 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
*/
if ((cp != cs) && old_prs) {
int parent_prs = parent->partition_root_state;
- struct cpumask *del_cpus = NULL;
switch (parent_prs) {
case PRS_ROOT:
@@ -2375,32 +2394,15 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
* child partition roots become invalid too.
*
* For a to be invalidated isolated partition,
- * its isolated CPUs may or may not need to be
- * removed from isolated_cpus depending on if
- * its closest partition root ancestor is a root
- * or isolated partition. With a PRS_ISOLATED
- * ancestor, the CPUs are checked against its
- * effective xcpus to see if any of them needed
- * to be removed.
+ * call return_isolated_cpus() to remove the
+ * relevant CPUs from isolated_cpus.
*/
if (is_partition_valid(cp))
new_prs = -old_prs;
if (old_prs == PRS_ISOLATED) {
- struct cpuset *ancestor = ancestor_partition(cp);
-
- if (ancestor->partition_root_state == PRS_ROOT)
- del_cpus = cp->effective_xcpus;
- else if (cpumask_andnot(tmp->delmask,
- cp->effective_xcpus,
- ancestor->effective_xcpus))
- del_cpus = tmp->delmask;
-
- if (del_cpus) {
- spin_lock_irq(&callback_lock);
- isolated_cpus_update(old_prs, new_prs, del_cpus);
- spin_unlock_irq(&callback_lock);
- }
+ cpumask_copy(tmp->delmask, cp->effective_xcpus);
+ isolated_cpus_release(cp, tmp->delmask);
}
WRITE_ONCE(cp->prs_err,
is_partition_invalid(parent)
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 629/990] cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (627 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 628/990] cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 630/990] cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict() Greg Kroah-Hartman
` (223 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Waiman Long, Guopeng Zhang,
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 69a75e4f377629928bd173747b864694c2af4e1c ]
Since the introduction of cpuset.cpus.exclusive in commit
e2ffe502ba45 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2"), a
compute_effective_exclusive_cpumask() helper which is later renamed to
compute_excpus() is added to compute the effective xcpus of a partition
root. However update_parent_effective_cpumask() is not updated in all
proper places to use the new helper to check if a given cpuset should
remain a valid partition root. This can cause a cpuset to incorrectly
remain a valid partition root even if no effective xcpus is left.
Fix that problem by using compute_excpus() to compute the effective xcpus
into delmask in all cases except partcmd_disable, partcmd_invalidate
or partcmd_update with newmask set and use it for tasks_nocpu_error()
check as well as checking its emptiness. This enables us to catch invalid
partition root more accurately in update_parent_effective_cpumask().
In the case of partcmd_update with newmask set, the passed in new
effective xcpus value will directly be used in the tasks_nocpu_error()
check without relying on old data in the cpuset.
For the partcmd_update with NULL newmask case, the cpu exclusivity test
there is also relaxed to be performed only if exclusive_cpus is empty.
Some test case are added to test_cpuset_prs.sh for invalidating a
partition root due to its effective xcpus becoming empty as well as
making sure that an invalid partition can only be revived when exclusive
CPUs are available agin.
Fixes: e2ffe502ba45 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2")
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Tested-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Adjusted context for the older base (kept the xcpus declaration and subparts_delta lines, no PERR_ISOPARENT blocks) and added :S+ to parent cpusets in the selftest rows. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 86 ++++++++++---------
.../selftests/cgroup/test_cpuset_prs.sh | 11 +++
2 files changed, 56 insertions(+), 41 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 54ee036020e05..7b13381755d07 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1854,7 +1854,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
* update_parent_effective_cpumask - update effective_cpus mask of parent cpuset
* @cs: The cpuset that requests change in partition root state
* @cmd: Partition root state change command
- * @newmask: Optional new cpumask for partcmd_update
+ * @newmask: Optional new effective xcpus for partcmd_update
* @tmp: Temporary addmask and delmask
* Return: 0 or a partition root state error code
*
@@ -1869,11 +1869,11 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
* given back to parent's effective_cpus. 0 will always be returned.
*
* For partcmd_update, if the optional newmask is specified, the cpu list is
- * to be changed from effective_xcpus to newmask. Otherwise, effective_xcpus is
- * assumed to remain the same. The cpuset should either be a valid or invalid
- * partition root. The partition root state may change from valid to invalid
- * or vice versa. An error code will be returned if transitioning from
- * invalid to valid violates the exclusivity rule.
+ * to be changed from effective_xcpus to newmask. Otherwise, effective_xcpus
+ * will be computed and a valid partition will be invalidated if it is the new
+ * cpumask is empty. The cpuset should either be a valid or invalid partition
+ * root. The partition root state may change from valid to invalid or vice
+ * versa.
*
* For partcmd_invalidate, the current partition will be made invalid.
*
@@ -1941,30 +1941,30 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
if (!newmask && xcpus_empty(cs))
return PERR_CPUSEMPTY;
- nocpu = tasks_nocpu_error(parent, cs, xcpus);
+ /*
+ * Except for partcmd_disable and non-NULL newmask, use delmask
+ * to compute the current effective xcpus value and use it for
+ * tasks_nocpu_error check.
+ */
+ if ((cmd != partcmd_disable) && !newmask) {
+ compute_excpus(cs, tmp->delmask);
+ nocpu = tasks_nocpu_error(parent, cs, tmp->delmask);
+ }
if ((cmd == partcmd_enable) || (cmd == partcmd_enablei)) {
- /*
- * Need to call compute_excpus() in case
- * exclusive_cpus not set. Sibling conflict should only happen
- * if exclusive_cpus isn't set.
- */
- xcpus = tmp->delmask;
- if (compute_excpus(cs, xcpus))
- WARN_ON_ONCE(!cpumask_empty(cs->exclusive_cpus));
new_prs = (cmd == partcmd_enable) ? PRS_ROOT : PRS_ISOLATED;
/*
* Enabling partition root is not allowed if its
* effective_xcpus is empty.
*/
- if (cpumask_empty(xcpus))
+ if (cpumask_empty(tmp->delmask))
return PERR_INVCPUS;
- if (prstate_housekeeping_conflict(new_prs, parent_prs, xcpus, NULL))
+ if (prstate_housekeeping_conflict(new_prs, parent_prs, tmp->delmask, NULL))
return PERR_HKEEPING;
- if (tasks_nocpu_error(parent, cs, xcpus))
+ if (nocpu)
return PERR_NOCPUS;
/*
@@ -1976,17 +1976,15 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
*
* Warn if it is not the case.
*/
- cpumask_and(tmp->new_cpus, xcpus, cpu_active_mask);
+ cpumask_and(tmp->new_cpus, tmp->delmask, cpu_active_mask);
WARN_ON_ONCE(!cpumask_subset(tmp->new_cpus, parent->effective_cpus));
-
deleting = true;
subparts_delta++;
} else if (cmd == partcmd_disable) {
/*
* May need to add cpus back to parent's effective_cpus
* (and maybe removed from subpartitions_cpus/isolated_cpus)
- * for valid partition root. xcpus may contain CPUs that
- * shouldn't be removed from the two global cpumasks.
+ * for valid partition root.
*/
if (is_partition_valid(cs)) {
cpumask_copy(tmp->addmask, cs->effective_xcpus);
@@ -2003,8 +2001,8 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
goto write_error;
}
- /* Check newmask again, whether cpus are available for parent/cs */
- nocpu |= tasks_nocpu_error(parent, cs, newmask);
+ /* Check newmask whether cpus are available for parent/cs */
+ nocpu = tasks_nocpu_error(parent, cs, newmask);
/*
* partcmd_update with newmask:
@@ -2059,7 +2057,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
/*
* partcmd_update w/o newmask
*
- * delmask = effective_xcpus & parent->effective_cpus
+ * delmask = newly computed effective xcpus value
*
* This can be called from:
* 1) update_cpumasks_hier()
@@ -2071,43 +2069,49 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
* A partition error happens when parent has tasks and all
* its effective CPUs will have to be distributed out.
*/
- if (nocpu) {
+ if (nocpu || cpumask_empty(tmp->delmask)) {
part_error = PERR_NOCPUS;
if (is_partition_valid(cs))
adding = cpumask_and(tmp->addmask,
xcpus, parent->effective_xcpus);
- } else if (is_partition_invalid(cs) && !cpumask_empty(xcpus) &&
- cpumask_subset(xcpus, parent->effective_xcpus)) {
+ } else if (is_partition_invalid(cs)) {
struct cgroup_subsys_state *css;
struct cpuset *child;
bool exclusive = true;
/*
* Convert invalid partition to valid has to pass the
- * cpu exclusivity test as well as the housekeeping
- * check.
+ * cpu exclusivity test when cpuset.cpus.exclusive is
+ * empty as well as the housekeeping check.
*/
if (prstate_housekeeping_conflict(cs->partition_root_state,
- parent_prs, xcpus, NULL)) {
+ parent_prs, tmp->delmask, NULL)) {
part_error = PERR_HKEEPING;
goto write_error;
}
- rcu_read_lock();
- cpuset_for_each_child(child, css, parent) {
- if (child == cs)
- continue;
- if (!cpusets_are_exclusive(cs, child)) {
- exclusive = false;
- break;
+ if (cpumask_empty(cs->exclusive_cpus)) {
+ rcu_read_lock();
+ cpuset_for_each_child(child, css, parent) {
+ if (child == cs)
+ continue;
+ if (!cpusets_are_exclusive(cs, child)) {
+ exclusive = false;
+ break;
+ }
}
+ rcu_read_unlock();
}
- rcu_read_unlock();
if (exclusive)
- deleting = cpumask_and(tmp->delmask,
- xcpus, parent->effective_cpus);
+ deleting = !cpumask_empty(tmp->delmask);
else
part_error = PERR_NOTEXCL;
}
+ /*
+ * When both cs and parent remain valid, parent's
+ * compute_partition_effective_cpumask() call would have removed
+ * cs's effective_xcpus from the parent's effective_cpus. So
+ * there is no need to adjust parent's effective_cpus here.
+ */
}
write_error:
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index ffa030cf1984d..7a077f4365072 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -291,6 +291,8 @@ TEST_MATRIX=(
A1:P0|A2:P2|A3:P1 2-4|2-3"
" C0-4:S+ C1-4:S+ C2-4 . X2-4 X2-4:P2 X3-4:P1 . 0 A1:0-1|A2:2|A3:3-4 \
A1:P0|A2:P2|A3:P1 2"
+ "C1-6:P2:S+ C3-6:P2:S+ C3-4:P2 . . C5-6 . . 0 A1:1-4|A2:5-6|A3:5-6 \
+ A1:P2|A2:P2|A3:P-2 1-6"
" C1-4:X2-4:S+ C2-4:X3-4:S+:P1 C3-4:X4:P2 \
. . X5 . . 0 A1:1-4|A2:2-4|A3:3-4 \
A1:P0|A2:P-1|A3:P-2 ."
@@ -360,6 +362,10 @@ TEST_MATRIX=(
# cpuset.cpus is allowed, but those extra CPUs are ignored.
"C2-3:P1:S+ C3:P1 . . . C2-4 . . 0 A1:|A2:2-3 A1:P1|A2:P1"
+ # A child cannot recover until its exclusive CPUs are available again.
+ "CX1-4:P1:S+ CX3-4:P1 . . X1-2 . . . 0 A1:1-2|A2:1-2|XA2: A1:P1|A2:P-1"
+ "CX1-4:P1:S+ CX3-4:P1 . . X1-2:X1-4 . . . 0 A1:1-2|A2:3-4|XA2:3-4 A1:P1|A2:P1"
+
# Taking away all CPUs from parent or itself if there are tasks
# will make the partition invalid.
"C2-3:P1:S+ C3:P1 . . T C2-3 . . 0 A1:2-3|A2:2-3 A1:P1|A2:P-1"
@@ -419,6 +425,11 @@ TEST_MATRIX=(
" CX1-4:S+ CX2-4:P2 . C5-6 . . . P1:C3-6 0 A1:1|A2:2-4|B1:5-6 \
A1:P0|A2:P2:B1:P-1 2-4"
+ # A middle isolated parent shrunk below coverage: the released CPUs of
+ # an invalidated child stay isolated as a higher ancestor still covers them.
+ "CX0-4:P2:S+ CX2-4:P2:S+ CX3-4:P2 . . X2 . . 0 A1:0-1,3-4|A2:2|A3:2 \
+ A1:P2|A2:P2|A3:P-2 0-4"
+
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
# ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
# Failure cases:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 630/990] cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (628 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 629/990] cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 631/990] cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier() Greg Kroah-Hartman
` (222 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Waiman Long, Guopeng Zhang,
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 40702b2ca8fa08fb64b926d8c72a4909d0330580 ]
Commit 9527ff78a413 ("cgroup/cpuset: Consider all the exclusive CPUs when
doing housekeeping check") changes the way prstate_housekeeping_conflict()
is being used by considering all the exclusive xcpus to be owned by the
partition when doing housekeeping check. However there are two minor
issues reported by sashiko with that patch:
1) In partition_cpus_change(), prstate_housekeeping_conflict() can
be called with an invalid partition root. In that case, there are
no isolated CPUs that are going to be returned back to the system to
become housekeeping CPUs, so the calculation of the del_cpus cpumask
is meaningless.
2) The checking of del_cpus in prstate_housekeeping_conflict() to see
if it can contain an active housekeeping CPU that can be returned to the
system ignores the fact that an active CPU not in HK_TYPE_DOMAIN_BOOT HK
cpumask will not become an active housekeeping CPU when it is released
by an isolated partition.
Update the existing code to handle these two issues properly to make
prstate_housekeeping_conflict() produce more accurate result.
Fixes: 9527ff78a413 ("cgroup/cpuset: Consider all the exclusive CPUs when doing housekeeping check")
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Replaced upstream's housekeeping_cpumask(HK_TYPE_DOMAIN_BOOT) with have_boot_isolcpus ? boot_hk_cpus : cpu_possible_mask, since that housekeeping type is missing here and boot_hk_cpus is only allocated with boot isolation. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 45 +++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 7b13381755d07..d2bedfbd533de 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1520,6 +1520,9 @@ static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
!cpumask_subset(new_cpus, boot_hk_cpus))
return true;
+ if (del_cpus && cpumask_empty(del_cpus))
+ del_cpus = NULL;
+
/*
* Exit 2nd check early and return false if
* 1) there is no boot time isolated nohz_full CPU
@@ -1528,8 +1531,7 @@ static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
* be returned back to the parent.
*/
if (!housekeeping_enabled(HK_TYPE_KERNEL_NOISE) ||
- (new_prs == parent_prs) ||
- ((new_prs == PRS_ROOT) && (!del_cpus || cpumask_empty(del_cpus))))
+ (new_prs == parent_prs) || (!del_cpus && (new_prs == PRS_ROOT)))
return false;
/*
@@ -1540,20 +1542,29 @@ static bool prstate_housekeeping_conflict(int new_prs, int parent_prs,
if (parent_prs == PRS_ISOLATED)
swap(new_cpus, del_cpus);
- if (del_cpus &&
- (cpumask_first_and_and(del_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
- cpu_active_mask) < nr_cpu_ids))
- return false;
-
if (!alloc_cpumask_var(&full_hk_cpus, GFP_KERNEL))
return true;
+ /*
+ * Check if del_cpus may contain a CPU that can become an active
+ * housekeeping CPU again.
+ */
+ if (del_cpus) {
+ cpumask_and(full_hk_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
+ have_boot_isolcpus ? boot_hk_cpus : cpu_possible_mask);
+ if (cpumask_first_and_and(del_cpus, full_hk_cpus,
+ cpu_active_mask) < nr_cpu_ids) {
+ res = false;
+ goto out;
+ }
+ }
+
cpumask_and(full_hk_cpus, housekeeping_cpumask(HK_TYPE_KERNEL_NOISE),
housekeeping_cpumask(HK_TYPE_DOMAIN));
cpumask_andnot(full_hk_cpus, full_hk_cpus, isolated_cpus);
cpumask_and(full_hk_cpus, full_hk_cpus, cpu_active_mask);
res = !cpumask_weight_andnot(full_hk_cpus, new_cpus);
-
+out:
free_cpumask_var(full_hk_cpus);
return res;
}
@@ -2628,23 +2639,29 @@ static void partition_cpus_change(struct cpuset *cs, struct cpuset *trialcs,
struct tmpmasks *tmp)
{
enum prs_errcode prs_err;
+ int parent_prs = is_remote_partition(cs)
+ ? PRS_ROOT : parent_cs(cs)->partition_root_state;
if (cs_is_member(cs))
return;
prs_err = validate_partition(cs, trialcs);
- if (!prs_err && !cpumask_empty(trialcs->effective_xcpus)) {
+ if (!prs_err && (parent_prs > 0) &&
+ !cpumask_empty(trialcs->effective_xcpus)) {
int prs = cs->partition_root_state;
- int parent_prs = is_remote_partition(cs)
- ? PRS_ROOT : parent_cs(cs)->partition_root_state;
+
/*
* Check for housekeeping conflict by passing the whole
* effective_xcpus as well as those CPUs that are to be
* removed from cs as delmask.
*/
- cpumask_andnot(tmp->delmask, cs->effective_xcpus, trialcs->effective_xcpus);
- if (parent_prs > 0 &&
- prstate_housekeeping_conflict(prs, parent_prs,
+ if (prs > 0)
+ cpumask_andnot(tmp->delmask, cs->effective_xcpus,
+ trialcs->effective_xcpus);
+ else
+ cpumask_clear(tmp->delmask);
+
+ if (prstate_housekeeping_conflict(prs, parent_prs,
trialcs->effective_xcpus, tmp->delmask))
prs_err = PERR_HKEEPING;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 631/990] cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (629 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 630/990] cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 632/990] cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask() Greg Kroah-Hartman
` (221 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guopeng Zhang, Waiman Long,
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 10a6f00d82544a1baa901de8d28f41f28c364995 ]
Guopeng reports that changing the cpumask of a remote partition root
may set the effective_cpus of the top_cpuset incorrectly. It is
due to the following call sequence:
update_cpumask()
-> partition_cpus_change()
-> remote_cpus_update()
-> update_sibling_cpumasks()
-> update_cpumasks_hier()
-> remote_cpus_update()
The second remote_cpus_update() call passes in the cs->effective_xcpus
instead of the trialcs->effective_xcpus of the first remote_cpus_update()
call. As a result, the second call can revert what has been done in
the first call leading to incorrect effective_cpus of the top_cpuset
as well as subpartitions_cpus.
Fix that by adding a new remote_partition_updating flag into the cpuset
structure to indicate that a remote partition is being updated and
update_cpumasks_hier() should skip the whole subtree as update_cpumask()
or update_exclusive_cpumask() which calls partition_cpus_change()
will eventually calls update_cpumasks_hier() for that subtree anyway.
This new flag is currently set only in remote_cpus_update() to prevent
recursive call of remote_cpus_update() on the same cpuset.
A test case is added to test_cpuset_prs.sh to verify this change.
Reported-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Link: https://lore.kernel.org/lkml/20261010075947.333549-2-guopeng.zhang@linux.dev
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Tested-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Fixes: f62a5d39368e ("cgroup/cpuset: Remove remote_partition_check() & make update_cpumasks_hier() handle remote partition")
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: adjusted struct field placement because remote_partition bool is missing, and added :S+ to the new selftest row to match this tree's row format. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset-internal.h | 5 +++++
kernel/cgroup/cpuset.c | 13 +++++++++----
tools/testing/selftests/cgroup/test_cpuset_prs.sh | 1 +
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/kernel/cgroup/cpuset-internal.h b/kernel/cgroup/cpuset-internal.h
index 0eb9ebd4fcb92..89acf907e7354 100644
--- a/kernel/cgroup/cpuset-internal.h
+++ b/kernel/cgroup/cpuset-internal.h
@@ -161,6 +161,11 @@ struct cpuset {
/* partition root state */
int partition_root_state;
+ /*
+ * Set to true when a remote partition is undergoing update.
+ */
+ bool remote_partition_updating;
+
/*
* number of SCHED_DEADLINE tasks attached to this cpuset, so that we
* know when to rebuild associated root domain bandwidth information.
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index d2bedfbd533de..b63489f9d3765 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1833,6 +1833,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
goto invalidate;
}
+ cs->remote_partition_updating = true;
spin_lock_irq(&callback_lock);
if (adding)
isolcpus_updated += partition_xcpus_add(prs, NULL, tmp->addmask);
@@ -1855,6 +1856,7 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *xcpus,
*/
cpuset_update_tasks_cpumask(&top_cpuset, tmp->new_cpus);
update_sibling_cpumasks(&top_cpuset, NULL, tmp);
+ cs->remote_partition_updating = false;
return;
invalidate:
@@ -2323,16 +2325,19 @@ static void update_cpumasks_hier(struct cpuset *cs, struct tmpmasks *tmp,
old_prs = new_prs = cp->partition_root_state;
/*
- * For child remote partition root (!= cs), we need to call
- * remote_cpus_update() if effective_xcpus will be changed.
- * Otherwise, we can skip the whole subtree.
+ * For a child remote partition with remote_partition_updating
+ * set, we can skip the whole subtree as the this function will
+ * be called eventually. We can also skip the subtree if the
+ * effective_xcpus isn't going to be changed. Otherwise, we
+ * will have to call remote_cpus_update().
*
* remote_cpus_update() will reuse tmp->new_cpus only after
* its value is being processed.
*/
if (remote && (cp != cs)) {
compute_excpus(cp, tmp->new_cpus);
- if (cpumask_equal(cp->effective_xcpus, tmp->new_cpus)) {
+ if (cp->remote_partition_updating ||
+ cpumask_equal(cp->effective_xcpus, tmp->new_cpus)) {
pos_css = css_rightmost_descendant(pos_css);
continue;
}
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 7a077f4365072..bd06324af3843 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -277,6 +277,7 @@ TEST_MATRIX=(
" C0-3:S+ C1-3:S+ C2-3 C4 X2-3 X2-3 X2-3:P2 P2:C4-5 0 A3:2-3|B1:4-5 A3:P2|B1:P2 2-5"
" C4:X0-3:S+ X1-3:S+ X2-3 . . P2 . . 0 A1:4|A2:1-3|A3:1-3 A2:P2 1-3"
" C4:X0-3:S+ X1-3:S+ X2-3 . . . P2 . 0 A1:4|A2:4|A3:2-3 A3:P2 2-3"
+ " CX1-6:S+ C1-4:P1 . C4-5 . C1-3 . . 0 A1:4-6|A2:1-3|B1:4-5 A2:P1"
# Nested remote/local partition tests
" C0-3:S+ C1-3:S+ C2-3 C4-5 X2-3 X2-3:P1 P2 P1 0 A1:0-1|A2:|A3:2-3|B1:4-5 \
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 632/990] cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (630 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 631/990] cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 633/990] cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent Greg Kroah-Hartman
` (220 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Waiman Long, Guopeng Zhang,
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 a7d89d92fdfbceb678d82710135d4eee2623d727 ]
It is found by sashiko that when a child isolated partition with parent
root partition is invalidated in compute_partition_effective_cpumask(),
the switching of the isolated exclusive CPUs from child to parent will
not be reflected in isolated_cpus leading to CPU leakage. Fix that by
calling isolated_cpus_update() when that happens.
Also simplify compute_partition_effective_cpumask() by doing
child partition invalidation only for the special case of no more
effective_cpus left in a populated parent. The other case doesn't
actually warrant invalidation at this stage and subsequent iteration
in update_cpumasks_hier() and update_parent_effective_cpumask() for
that child should handle that.
Also drop the make_partition_invalid() helper by inlining it into
compute_partition_effective_cpumask() as it is the only caller.
A new test case is add to test_cpuset_prs.sh to verify this.
Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Tested-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Kept the existing nr_subparts decrement and reset lines in the context, and added the explicit ":S+" to the new selftest row to match this tree's test-matrix syntax. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 46 +++++++------------
.../selftests/cgroup/test_cpuset_prs.sh | 4 ++
2 files changed, 21 insertions(+), 29 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index b63489f9d3765..084cee4e789d5 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -170,15 +170,6 @@ static inline bool cs_is_member(const struct cpuset *cs)
return cs->partition_root_state == PRS_MEMBER;
}
-/*
- * Callers should hold callback_lock to modify partition_root_state.
- */
-static inline void make_partition_invalid(struct cpuset *cs)
-{
- if (cs->partition_root_state > 0)
- cs->partition_root_state = -cs->partition_root_state;
-}
-
/*
* Send notification event of whenever partition_root_state changes.
*/
@@ -2234,8 +2225,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
* or update_cpumasks_hier() where parent and children are modified
* successively, we don't need to call update_parent_effective_cpumask()
* and the child's effective_cpus will be updated in later iterations.
- *
- * Note that rcu_read_lock() is assumed to be held.
*/
static void compute_partition_effective_cpumask(struct cpuset *cs,
struct cpumask *new_ecpus)
@@ -2247,15 +2236,16 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
WARN_ON_ONCE(!is_partition_valid(cs));
/*
- * Check child partition roots to see if they should be
- * invalidated when
- * 1) child effective_xcpus not a subset of new
- * excluisve_cpus
- * 2) All the effective_cpus will be used up and cp
- * has tasks
+ * Check child partition roots to see if they should be invalidated
+ * when all the effective_cpus will be used up and cs is populated.
+ * It is better to sacrifice a child partition root than invalidating
+ * the whole subtree.
+ *
+ * Return early if the effective_cpus is already empty.
*/
compute_excpus(cs, new_ecpus);
- cpumask_and(new_ecpus, new_ecpus, cpu_active_mask);
+ if (!cpumask_and(new_ecpus, new_ecpus, cpu_active_mask))
+ return;
rcu_read_lock();
cpuset_for_each_child(child, css, cs) {
@@ -2267,22 +2257,20 @@ static void compute_partition_effective_cpumask(struct cpuset *cs,
* partition root.
*/
WARN_ON_ONCE(is_remote_partition(child));
- WRITE_ONCE(child->prs_err, 0);
- if (!cpumask_subset(child->effective_xcpus,
- cs->effective_xcpus))
- WRITE_ONCE(child->prs_err, PERR_INVCPUS);
- else if (populated &&
- cpumask_subset(new_ecpus, child->effective_xcpus))
- WRITE_ONCE(child->prs_err, PERR_NOCPUS);
-
- if (child->prs_err) {
+ if (populated && cpumask_subset(new_ecpus, child->effective_xcpus)) {
int old_prs = child->partition_root_state;
+ int parent_prs = cs->partition_root_state;
/*
- * Invalidate child partition
+ * Invalidate child partition and update isolated_cpus
+ * if necessary.
*/
spin_lock_irq(&callback_lock);
- make_partition_invalid(child);
+ WRITE_ONCE(child->prs_err, PERR_NOCPUS);
+ if ((old_prs == PRS_ISOLATED) && (parent_prs == PRS_ROOT))
+ isolated_cpus_update(PRS_ISOLATED, PRS_ROOT,
+ child->effective_xcpus);
+ child->partition_root_state = -old_prs;
cs->nr_subparts--;
child->nr_subparts = 0;
spin_unlock_irq(&callback_lock);
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index bd06324af3843..9a1590e630e6b 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -431,6 +431,10 @@ TEST_MATRIX=(
"CX0-4:P2:S+ CX2-4:P2:S+ CX3-4:P2 . . X2 . . 0 A1:0-1,3-4|A2:2|A3:2 \
A1:P2|A2:P2|A3:P-2 0-4"
+ # When an isolated partition child with root partition parent is invalidated,
+ # its effective xcpus will be removed from isolated_cpus.
+ "C1-4:P1:S+ C3-4:P2 . . T:C3-4 . . . 0 A1:3-4|A2:3-4 A1:P1|A2:P-2 ."
+
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
# ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
# Failure cases:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 633/990] cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (631 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 632/990] cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 634/990] ksmbd: use the resolved share path for the share root Greg Kroah-Hartman
` (219 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Waiman Long, Guopeng Zhang,
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 ec0254b9eb49ebc9383dc3ae5cb69c8606f88499 ]
It is also reported by sashiko that there may be leakages of isolated
CPUs when a root partition parent shrinks its effective_xcpus with
isolated partition children. Leakage here means that isolated_cpus may
contain extra CPUs that are not in any isolated partitions and not boot
time isolated. Those CPUs cannot be used in any isolated partitions
anymore.
There are 2 different cases here. The effective_xcpus becomes empty and
the isolated partition should be invalidated in this case. Alternatively
some of its effective_xcpus are not in parent's effective xcpus but
still have some valid effective_xcpus left. The isolated partition can
remain valid. In both cases, the invalid isolated CPUs will have to be
released from isolated_cpus if appropriate.
Fix that by calling isolated_cpus_release() to release those isolated
CPUs from isolated_cpus.
New test cases are added to test_cpuset_prs.sh to test this.
Fixes: 11e5f407b64a ("cgroup/cpuset: Keep track of CPUs in isolated partitions")
Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Tested-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Test-matrix rows use this tree's explicit :S+ syntax, and a stray # comment line was added by conflict resolution; the cpuset.c change itself matches upstream apart from line offsets. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/cgroup/cpuset.c | 16 +++++++++++++++-
.../testing/selftests/cgroup/test_cpuset_prs.sh | 7 +++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 084cee4e789d5..91a3fa0cf801a 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2072,8 +2072,22 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
*
* A partition error happens when parent has tasks and all
* its effective CPUs will have to be distributed out.
+ *
+ * For an isolated partition with a shrunk root partition parent
+ * we may need to return some or all of its isolated CPUs.
*/
- if (nocpu || cpumask_empty(tmp->delmask)) {
+ nocpu |= cpumask_empty(tmp->delmask);
+ if ((parent_prs == PRS_ROOT) && (old_prs == PRS_ISOLATED)) {
+ cpumask_clear(tmp->addmask);
+ if (nocpu)
+ cpumask_copy(tmp->addmask, cs->effective_xcpus);
+ else if (!cpumask_subset(cs->effective_xcpus, parent->effective_xcpus))
+ cpumask_andnot(tmp->addmask, cs->effective_xcpus,
+ parent->effective_xcpus);
+ if (!cpumask_empty(tmp->addmask))
+ isolated_cpus_release(cs, tmp->addmask);
+ }
+ if (nocpu) {
part_error = PERR_NOCPUS;
if (is_partition_valid(cs))
adding = cpumask_and(tmp->addmask,
diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 9a1590e630e6b..25eef20c17466 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -435,6 +435,13 @@ TEST_MATRIX=(
# its effective xcpus will be removed from isolated_cpus.
"C1-4:P1:S+ C3-4:P2 . . T:C3-4 . . . 0 A1:3-4|A2:3-4 A1:P1|A2:P-2 ."
+ # When a root partition parent with an isolated partition child is shrunk
+ # so that its effective xcpus is no longer a superset of its child effective
+ # xcpus, the invalid isolated CPUs should be removed from cpuset.cpus.isolated.
+ "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 ."
+
+ #
# old-A1 old-A2 old-A3 old-B1 new-A1 new-A2 new-A3 new-B1 fail ECPUs Pstate ISOLCPUS
# ------ ------ ------ ------ ------ ------ ------ ------ ---- ----- ------ --------
# Failure cases:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 634/990] ksmbd: use the resolved share path for the share root
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (632 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 633/990] cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 635/990] sched_ext: Reject rq-lock-taking kfuncs in tracing programs Greg Kroah-Hartman
` (218 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Denis Kulikov, Namjae Jeon,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Kulikov <dar1knessx@gmail.com>
[ Upstream commit 03b47bdc9ac8e9dacbf1d66a1dfc54b328e283f2 ]
If the share path is a mount point and crossmnt is not set (crossmnt = no,
or ksmbd-tools that predate the option), the share root looks empty to
clients: QUERY_DIRECTORY on it returns only "." and "..". Files created
in the root go to the mounted filesystem, but a directory query cannot
find them afterwards, so e.g. "rm" of a file that was just uploaded
fails with STATUS_NO_SUCH_FILE.
An empty name refers to the share root. For it, ksmbd_vfs_path_lookup()
looks up share_conf->path again starting from its parent, and the mount
on the last component is not followed, which gives the directory covered
by the mount. All other names are looked up relative to
share_conf->vfs_path, which was resolved through the mount when the
share was set up.
share_conf->vfs_path already refers to the share root, so return a
reference to it instead of looking the path up again.
Fixes: 74d7970febf7 ("ksmbd: fix racy issue from using ->d_parent and ->d_name")
Signed-off-by: Denis Kulikov <dar1knessx@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Adapted the context to this branch's older ksmbd_vfs_path_lookup(), keeping do_lock and the getname_kernel() filename handling instead of for_remove and CLASS(filename_kernel). ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/vfs.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index a3db77b3c2728..466a0853dc486 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -82,12 +82,13 @@ static int ksmbd_vfs_path_lookup(struct ksmbd_share_config *share_conf,
if (do_lock)
return -EINVAL;
- pathname = share_conf->path;
- root_share_path = NULL;
- } else {
- flags |= LOOKUP_BENEATH;
+ *path = share_conf->vfs_path;
+ path_get(path);
+ return 0;
}
+ flags |= LOOKUP_BENEATH;
+
filename = getname_kernel(pathname);
if (IS_ERR(filename))
return PTR_ERR(filename);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 635/990] sched_ext: Reject rq-lock-taking kfuncs in tracing programs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (633 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 634/990] ksmbd: use the resolved share path for the share root Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 636/990] net-sysfs: reject a one-entry RPS flow table Greg Kroah-Hartman
` (217 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Junbin Zhang, Tejun Heo, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junbin Zhang <sprooc69@gmail.com>
[ Upstream commit b07a7450f6ef98c79ebd450a92fc4bb6b8f1e02e ]
scx_bpf_cpuperf_set() and scx_bpf_cidperf_set() are members of
scx_kfunc_ids_any, which is registered for BPF_PROG_TYPE_TRACING.
A tracing program can run in a context which already holds the target
rq lock, in which case scx_cpuperf_set() attempts to acquire the same
lock again:
__schedule()
rq_lock(rq); /* rq->__lock is held */
trace_sched_switch();
BPF tracing program
scx_bpf_cpuperf_set(smp_processor_id(), 1024);
scx_cpuperf_set();
locked_rq = scx_locked_rq(); /* NULL */
rq_lock_irqsave(rq, &rf); /* same lock */
scx_locked_rq() only tracks rq locks held during SCX callback
invocations, so it cannot detect an rq lock held by the surrounding
kernel code.
The deadlock can be reproduced with two BPF programs. The first is a
minimal SCX scheduler, which only needs to be registered and enabled:
SEC(".struct_ops.link")
struct sched_ext_ops minimal_ops = {
.name = "minimal",
};
The second is a tracing program attached to tp_btf/sched_switch,
which fires from __schedule() with rq->__lock already held:
SEC("tp_btf/sched_switch")
int BPF_PROG(on_sched_switch, bool preempt, struct task_struct *prev,
struct task_struct *next, unsigned int prev_state)
{
scx_bpf_cpuperf_set(bpf_get_smp_processor_id(), 1024);
return 0;
}
With both programs attached, the next context switch on any CPU
deadlocks that CPU. Lockdep reports:
WARNING: possible recursive locking detected
7.3.0-rc7 #3 Not tainted
swapper/3/0 is trying to acquire lock:
(&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x1e/0x30
but task is already holding lock:
(&rq->__lock){-.-.}-{2:2}, at: __schedule+0xeb/0x1430
Possible unsafe locking scenario:
CPU0
----
lock(&rq->__lock);
lock(&rq->__lock);
*** DEADLOCK ***
Call Trace:
<TASK>
print_deadlock_bug.cold+0xc0/0xd0
__lock_acquire+0x12fa/0x1b80
lock_acquire+0xd1/0x2f0
_raw_spin_lock_nested+0x32/0x40
raw_spin_rq_lock_nested+0x1e/0x30
scx_cpuperf_set+0x1e9/0x310
scx_bpf_cpuperf_set+0x9b/0x230
bpf_prog_..._on_sched_switch+0x3d/0x41
bpf_trace_run4+0x125/0x450
__traceiter_sched_switch+0x4b/0x70
__schedule+0x94a/0x1430
schedule_idle+0x26/0x50
cpu_startup_entry+0x2d/0x30
start_secondary+0xfc/0x100
</TASK>
The CPU remains locked up with interrupts disabled.
scx_bpf_cidperf_set() is similarly affected, as it resolves the CID
through scx_cid_to_cpu() before reaching the same rq-locking path.
There is no reliable way for these kfuncs to determine whether the
surrounding tracing context already holds an rq lock. Reject calls to
both kfuncs from tracing programs at verification time, while
preserving their availability to SCX struct_ops and syscall programs.
Fixes: a11d6784d731 ("sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set()")
Signed-off-by: Junbin Zhang <sprooc69@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
[ sashal: Replaced the tracing-visible scx_kfunc_context_filter() check with a separate BTF kfunc set for scx_bpf_cpuperf_set(), registered only for struct_ops and syscall programs, and dropped the cid variant. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/ext.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index af5828f093045..b3a6d60709403 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -7013,7 +7013,6 @@ BTF_ID_FLAGS(func, scx_bpf_error_bstr, KF_TRUSTED_ARGS)
BTF_ID_FLAGS(func, scx_bpf_dump_bstr, KF_TRUSTED_ARGS)
BTF_ID_FLAGS(func, scx_bpf_cpuperf_cap)
BTF_ID_FLAGS(func, scx_bpf_cpuperf_cur)
-BTF_ID_FLAGS(func, scx_bpf_cpuperf_set)
BTF_ID_FLAGS(func, scx_bpf_nr_node_ids)
BTF_ID_FLAGS(func, scx_bpf_nr_cpu_ids)
BTF_ID_FLAGS(func, scx_bpf_get_possible_cpumask, KF_ACQUIRE)
@@ -7036,6 +7035,25 @@ static const struct btf_kfunc_id_set scx_kfunc_set_any = {
.set = &scx_kfunc_ids_any,
};
+/*
+ * Kfuncs which may take the rq lock on their unlocked path.
+ *
+ * A tracing program can execute in any kernel context, including ones which
+ * already hold the rq lock (e.g. sched_switch). scx_locked_rq() only tracks
+ * rq locks taken for SCX callbacks, so from such a context it returns NULL
+ * and these kfuncs would acquire the already held rq lock again and deadlock
+ * the CPU. They cannot be made safe for tracing programs, so keep them off
+ * the tracing hook.
+ */
+BTF_KFUNCS_START(scx_kfunc_ids_no_tracing)
+BTF_ID_FLAGS(func, scx_bpf_cpuperf_set)
+BTF_KFUNCS_END(scx_kfunc_ids_no_tracing)
+
+static const struct btf_kfunc_id_set scx_kfunc_set_no_tracing = {
+ .owner = THIS_MODULE,
+ .set = &scx_kfunc_ids_no_tracing,
+};
+
static int __init scx_init(void)
{
int ret;
@@ -7065,6 +7083,10 @@ static int __init scx_init(void)
&scx_kfunc_set_any)) ||
(ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING,
&scx_kfunc_set_any)) ||
+ (ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS,
+ &scx_kfunc_set_no_tracing)) ||
+ (ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL,
+ &scx_kfunc_set_no_tracing)) ||
(ret = register_btf_kfunc_id_set(BPF_PROG_TYPE_SYSCALL,
&scx_kfunc_set_any))) {
pr_err("sched_ext: Failed to register kfunc sets (%d)\n", ret);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 636/990] net-sysfs: reject a one-entry RPS flow table
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (634 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 635/990] sched_ext: Reject rq-lock-taking kfuncs in tracing programs Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 637/990] tls: keep TX and RX hardware offload on the same device Greg Kroah-Hartman
` (216 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Dudu Lu, Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <phx0fer@gmail.com>
[ Upstream commit 24927bdf0f62f63470a065c21d80fff7e4e9f207 ]
store_rps_dev_flow_table_cnt() accepts rps_flow_cnt == 1. For count == 1
the round-up loop leaves mask == 0, which is stored as log == 0 in the
tag (tag_ptr |= ilog2(mask) + 1). get_rps_cpu() then calls
rfs_slot() -> hash_32(hash, rps_tag_to_log(tag_ptr)) with log == 0:
include/linux/hash.h:68
return __hash_32(val) >> (32 - bits); /* bits == 0 -> shift by 32 */
The shift by 32 is undefined and yields the full 32-bit hash, which is
used to index the one-entry rps_dev_flow[] table unchecked:
UBSAN: shift-out-of-bounds in ./include/linux/hash.h:68:24
shift exponent 32 is too large for 32-bit type 'unsigned int'
__ubsan_handle_shift_out_of_bounds+0x11c/0x208
get_rps_cpu+0x12fc/0x1344
netif_rx_internal+0x1e0/0x4d4
rps_dev_flow[] is then read (rflow->cpu) and written (last_qtail) out of
bounds on the packet path. Require at least two entries.
Fixes: f3483c8e1da6 ("net: rfs: hash function change")
Signed-off-by: Dudu Lu <phx0fer@gmail.com>
Link: https://patch.msgid.link/20261021155522.67521-1-phx0fer@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Context lines adapted to the older overflow checks and vmalloc code; the added if (!mask) return -EINVAL; block is otherwise identical to upstream. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/net-sysfs.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 3a3a92f3a314c..e408f0b6786b7 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1101,6 +1101,14 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
*/
while ((mask | (mask >> 1)) != mask)
mask |= (mask >> 1);
+
+ /* Require at least two entries. A one-entry table rounds up
+ * to mask == 0, which encodes log == 0 in the tag.
+ * get_rps_cpu() then computes hash_32(hash, 0), a shift by 32.
+ */
+ if (!mask)
+ return -EINVAL;
+
/* On 64 bit arches, must check mask fits in table->mask (u32),
* and on 32bit arches, must check
* RPS_DEV_FLOW_TABLE_SIZE(mask + 1) doesn't overflow.
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 637/990] tls: keep TX and RX hardware offload on the same device
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (635 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 636/990] net-sysfs: reject a one-entry RPS flow table Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 638/990] ksmbd: return complete and aligned stream information Greg Kroah-Hartman
` (215 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rishikesh Jethwani, Dave Miller,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rishikesh Jethwani <rjethwani@purestorage.com>
[ Upstream commit 1c8a70075235cd733095532a97f2405037c52a7b ]
After TX is offloaded on device A, a route change, or a change in the
usable-slave set of an 802.3ad or balance-xor (layer3+4) bond, can make
RX setup program device B. tls_device_attach() sees the existing TLS
destructor and keeps ctx->netdev pointing at A. The RX driver state on B
is then untracked: tls_dev_resync() and tls_dev_del() are invoked on A
for a context it never created, and neither socket close nor
NETDEV_DOWN on B calls tls_dev_del() for B, so the driver context leaks.
The reverse setup order has the same problem.
Check the shared device binding under device_offload_lock before each
tls_dev_add(). Permit the first attachment and a second direction on the
same device. Reject a different device, including when the old binding
was cleared by NETDEV_DOWN: the TLS destructor remains installed and
tls_device_attach() cannot establish a new binding. Setup then falls
back to software for the requested direction.
The RX check precedes allocation and software setup. TX uses its existing
resource unwind path without calling the driver. Document the shared
binding and clarify that fallback is per direction.
This issue was discovered during code review and subsequently
reproduced on hardware using mlx5 and TLS 1.2 AES-GCM-128.
Changing the route between TX and RX setup installed the second
direction on a different device. Driver traces showed successful adds
on both devices, but both deletes at socket close targeted the first
device, leaving an orphaned context on the second. Both setup orders
reproduced the leak, even though all current core TLS context counters
returned to zero. No crash was observed.
With the fix, the same tests correctly fall back to software for the
second direction and leave no orphaned hardware context.
Fixes: 4799ac81e52a ("tls: Add rx inline crypto offload")
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
[ sashal: Kept the branch's kzalloc(sizeof(*context), GFP_KERNEL) instead of upstream's kzalloc_obj(*context) and placed the new tls_device_can_attach() check just before it. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Documentation/networking/tls-offload.rst | 16 ++++++++++------
net/tls/tls_device.c | 24 ++++++++++++++++++++++++
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/Documentation/networking/tls-offload.rst b/Documentation/networking/tls-offload.rst
index 7354d48cdf926..7ed28e40f1702 100644
--- a/Documentation/networking/tls-offload.rst
+++ b/Documentation/networking/tls-offload.rst
@@ -76,12 +76,16 @@ During driver initialization device sets the ``NETIF_F_HW_TLS_RX`` and
pointer in the :c:member:`tlsdev_ops` member of the
:c:type:`struct net_device <net_device>`.
-When TLS cryptographic connection state is installed on a ``ktls`` socket
-(note that it is done twice, once for RX and once for TX direction,
-and the two are completely independent), the kernel checks if the underlying
-network device is offload-capable and attempts the offload. In case offload
-fails the connection is handled entirely in software using the same mechanism
-as if the offload was never tried.
+TLS cryptographic connection state is installed separately for RX and TX
+on a ``ktls`` socket. For each direction, the kernel checks if the underlying
+network device is offload-capable and attempts the offload. If offload fails,
+that direction is handled in software as if offload had never been tried.
+
+Both hardware directions share one device binding. Once one direction is
+offloaded, the other direction must use the same device. If a route change
+selects a different device, or ``NETDEV_DOWN`` has cleared the binding,
+hardware offload of the other direction is declined and it uses software
+instead.
Offload request is performed via the :c:member:`tls_dev_add` callback of
:c:type:`struct tlsdev_ops <tlsdev_ops>`:
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 2c661e17efb8f..c49798486ea52 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -1030,6 +1030,20 @@ int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx)
return tls_device_reencrypt(sk, tls_ctx);
}
+/* Both directions share ctx->netdev. A second direction must use that
+ * device; after NETDEV_DOWN clears it, no new direction can be offloaded.
+ */
+static bool tls_device_can_attach(struct tls_context *ctx, struct sock *sk,
+ struct net_device *netdev)
+{
+ struct net_device *ctx_netdev;
+
+ ctx_netdev = rcu_dereference_protected(ctx->netdev,
+ lockdep_is_held(&device_offload_lock));
+ return sk->sk_destruct != tls_device_sk_destruct ||
+ ctx_netdev == netdev;
+}
+
static void tls_device_attach(struct tls_context *ctx, struct sock *sk,
struct net_device *netdev)
{
@@ -1165,6 +1179,11 @@ int tls_set_device_offload(struct sock *sk)
goto release_lock;
}
+ if (!tls_device_can_attach(ctx, sk, netdev)) {
+ rc = -EOPNOTSUPP;
+ goto release_lock;
+ }
+
ctx->priv_ctx_tx = offload_ctx;
rc = netdev->tlsdev_ops->tls_dev_add(netdev, sk, TLS_OFFLOAD_CTX_DIR_TX,
&ctx->crypto_send.info,
@@ -1235,6 +1254,11 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
goto release_lock;
}
+ if (!tls_device_can_attach(ctx, sk, netdev)) {
+ rc = -EOPNOTSUPP;
+ goto release_lock;
+ }
+
context = kzalloc(sizeof(*context), GFP_KERNEL);
if (!context) {
rc = -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 638/990] ksmbd: return complete and aligned stream information
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (636 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 637/990] tls: keep TX and RX hardware offload on the same device Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 639/990] block: dont enter reclaim under rq_qos_mutex Greg Kroah-Hartman
` (214 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Namjae Jeon, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 206fc30f71b005156085fd8523ccc84a2c67791b ]
FILE_STREAM_INFORMATION responses are assembled without aligning entries
and truncated to the client buffer length after the fact. A short query
can therefore return STATUS_BUFFER_OVERFLOW with an incomplete entry and
a nonzero NextEntryOffset, which clients may reject as an invalid
network response. Standalone queries can also exhaust the server
response buffer and silently omit streams while reporting success.
Allocate the same large response buffer used by other variable-length
QUERY_INFO classes for stream queries. Pack only complete entries within
the requested output length and available response space, aligning each
entry to eight bytes and sizing names after UTF-16 conversion. Return
STATUS_BUFFER_OVERFLOW when more entries remain, using an SMB2 error
response if no entry fits.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Fixes: 6b8b79226bc3 ("ksmbd: fix partial file information responses")
Link: https://github.com/namjaejeon/ksmbd/issues/522#issuecomment-6391152923
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
[ sashal: Only the FILE_STREAM_INFORMATION case was added to the large-response-buffer list in smb2_allocate_rsp_buf(), because FILE_NORMALIZED_NAME_INFORMATION isn't in that list here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/server/smb2pdu.c | 183 +++++++++++++++++++++++++---------------
1 file changed, 115 insertions(+), 68 deletions(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 88f07ec22723a..aae6e9adf2e84 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -555,7 +555,8 @@ int smb2_allocate_rsp_buf(struct ksmbd_work *work)
req = smb_get_msg(work->request_buf);
if ((req->InfoType == SMB2_O_INFO_FILE &&
(req->FileInfoClass == FILE_FULL_EA_INFORMATION ||
- req->FileInfoClass == FILE_ALL_INFORMATION)) ||
+ req->FileInfoClass == FILE_ALL_INFORMATION ||
+ req->FileInfoClass == FILE_STREAM_INFORMATION)) ||
req->InfoType == SMB2_O_INFO_SECURITY)
sz = large_sz;
}
@@ -5255,41 +5256,107 @@ static void get_file_alternate_info(struct ksmbd_work *work,
cpu_to_le32(struct_size(file_info, FileName, conv_len));
}
+struct smb2_stream_info_buffer {
+ struct smb2_query_info_rsp *rsp;
+ struct smb2_file_stream_info *last;
+ const struct nls_table *local_nls;
+ unsigned int length;
+ unsigned int capacity;
+};
+
+static int smb2_add_stream_info(struct smb2_stream_info_buffer *buf,
+ const char *name, loff_t size, u64 allocation_size)
+{
+ struct smb2_file_stream_info *file_info;
+ __le16 *utf16_name;
+ size_t name_len = strlen(name);
+ unsigned int offset = ALIGN(buf->length, 8), name_bytes;
+ int conv_len, ret = 0;
+
+ if (offset > buf->capacity ||
+ buf->capacity - offset < sizeof(*file_info))
+ return -ENOSPC;
+
+ utf16_name = kmalloc_array(name_len + 1, sizeof(*utf16_name),
+ KSMBD_DEFAULT_GFP);
+ if (!utf16_name)
+ return -ENOMEM;
+
+ conv_len = smbConvertToUTF16(utf16_name, name, name_len,
+ buf->local_nls, 0);
+ if (conv_len < 0) {
+ ret = conv_len;
+ goto out;
+ }
+
+ name_bytes = conv_len * sizeof(*utf16_name);
+ if (name_bytes > buf->capacity - offset - sizeof(*file_info)) {
+ ret = -ENOSPC;
+ goto out;
+ }
+
+ file_info = (struct smb2_file_stream_info *)&buf->rsp->Buffer[offset];
+ if (buf->last) {
+ memset(&buf->rsp->Buffer[buf->length], 0, offset - buf->length);
+ buf->last->NextEntryOffset =
+ cpu_to_le32((char *)file_info - (char *)buf->last);
+ }
+ file_info->NextEntryOffset = 0;
+ file_info->StreamNameLength = cpu_to_le32(name_bytes);
+ file_info->StreamSize = cpu_to_le64(size);
+ file_info->StreamAllocationSize = cpu_to_le64(allocation_size);
+ memcpy(file_info->StreamName, utf16_name, name_bytes);
+
+ buf->last = file_info;
+ buf->length = offset + sizeof(*file_info) + name_bytes;
+out:
+ kfree(utf16_name);
+ return ret;
+}
+
static int get_file_stream_info(struct ksmbd_work *work,
+ struct smb2_query_info_req *req,
struct smb2_query_info_rsp *rsp,
- struct ksmbd_file *fp,
- void *rsp_org)
+ struct ksmbd_file *fp)
{
- struct ksmbd_conn *conn = work->conn;
- struct smb2_file_stream_info *file_info;
+ struct smb2_stream_info_buffer buf = {
+ .rsp = rsp,
+ .local_nls = work->conn->local_nls,
+ };
char *stream_name, *xattr_list = NULL, *stream_buf;
struct kstat stat;
const struct path *path = &fp->filp->f_path;
ssize_t xattr_list_len;
ssize_t slen;
loff_t ssize;
- int nbytes = 0, streamlen, stream_name_len, next, idx = 0;
+ unsigned int req_output_len = le32_to_cpu(req->OutputBufferLength);
+ int streamlen, idx = 0;
int buf_free_len;
int ret;
+ if (req_output_len < FILE_STREAM_INFORMATION_SIZE) {
+ rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH;
+ return -EINVAL;
+ }
+
+ buf_free_len = smb2_calc_max_out_buf_len(work,
+ offsetof(struct smb2_query_info_rsp, Buffer),
+ req_output_len);
+ if (buf_free_len < 0)
+ return buf_free_len;
+ buf.capacity = buf_free_len;
+
ret = vfs_getattr(&fp->filp->f_path, &stat, STATX_BASIC_STATS,
AT_STATX_SYNC_AS_STAT);
if (ret)
return ret;
- file_info = (struct smb2_file_stream_info *)rsp->Buffer;
-
- buf_free_len = smb2_resp_buf_len(work,
- offsetof(struct smb2_query_info_rsp, Buffer));
- if (buf_free_len < 0)
- goto out;
-
xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list);
if (xattr_list_len < 0) {
- goto out;
+ goto default_stream;
} else if (!xattr_list_len) {
ksmbd_debug(SMB, "empty xattr in the file\n");
- goto out;
+ goto default_stream;
}
while (idx < xattr_list_len) {
@@ -5299,69 +5366,49 @@ static int get_file_stream_info(struct ksmbd_work *work,
ksmbd_debug(SMB, "%s, len %d\n", stream_name, streamlen);
- if (strncmp(&stream_name[XATTR_USER_PREFIX_LEN],
- STREAM_PREFIX, STREAM_PREFIX_LEN))
+ if (strncmp(stream_name, XATTR_NAME_STREAM,
+ XATTR_NAME_STREAM_LEN))
continue;
- stream_name_len = streamlen - (XATTR_USER_PREFIX_LEN +
- STREAM_PREFIX_LEN);
- streamlen = stream_name_len;
-
- /* plus : size */
- streamlen += 1;
- stream_buf = kmalloc(streamlen + 1, KSMBD_DEFAULT_GFP);
- if (!stream_buf)
- break;
-
- streamlen = snprintf(stream_buf, streamlen + 1,
- ":%s", &stream_name[XATTR_NAME_STREAM_LEN]);
-
- next = sizeof(struct smb2_file_stream_info) + streamlen * 2;
- /* smbConvertToUTF16() also writes a terminating UTF-16 unit. */
- if (next + sizeof(__le16) > buf_free_len) {
- kfree(stream_buf);
- break;
+ stream_buf = kasprintf(KSMBD_DEFAULT_GFP, ":%s",
+ &stream_name[XATTR_NAME_STREAM_LEN]);
+ if (!stream_buf) {
+ ret = -ENOMEM;
+ goto out;
}
-
- file_info = (struct smb2_file_stream_info *)&rsp->Buffer[nbytes];
- streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,
- stream_buf, streamlen,
- conn->local_nls, 0);
- streamlen *= 2;
- kfree(stream_buf);
- file_info->StreamNameLength = cpu_to_le32(streamlen);
slen = ksmbd_vfs_xattr_len(file_mnt_idmap(fp->filp),
path->dentry, stream_name);
ssize = slen < 0 ? 0 : (loff_t)slen;
- file_info->StreamSize = cpu_to_le64(ssize);
- file_info->StreamAllocationSize = cpu_to_le64(ssize);
+ ret = smb2_add_stream_info(&buf, stream_buf, ssize, ssize);
+ kfree(stream_buf);
+ if (ret == -ENOSPC)
+ goto overflow;
+ if (ret)
+ goto out;
+ }
- nbytes += next;
- buf_free_len -= next;
- file_info->NextEntryOffset = cpu_to_le32(next);
+default_stream:
+ if (!S_ISDIR(stat.mode)) {
+ ret = smb2_add_stream_info(&buf, "::$DATA", stat.size,
+ stat.blocks << 9);
+ if (ret == -ENOSPC)
+ goto overflow;
+ if (ret)
+ goto out;
}
+ ret = 0;
+ goto out;
+
+overflow:
+ rsp->hdr.Status = STATUS_BUFFER_OVERFLOW;
+ /* An empty overflow needs an SMB2 error response. */
+ ret = buf.length ? 0 : -EOVERFLOW;
out:
- if (!S_ISDIR(stat.mode) &&
- buf_free_len >= sizeof(struct smb2_file_stream_info) + (7 + 1) * 2) {
- file_info = (struct smb2_file_stream_info *)
- &rsp->Buffer[nbytes];
- streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,
- "::$DATA", 7, conn->local_nls, 0);
- streamlen *= 2;
- file_info->StreamNameLength = cpu_to_le32(streamlen);
- file_info->StreamSize = cpu_to_le64(stat.size);
- file_info->StreamAllocationSize = cpu_to_le64(stat.blocks << 9);
- nbytes += sizeof(struct smb2_file_stream_info) + streamlen;
- }
-
- /* last entry offset should be 0 */
- file_info->NextEntryOffset = 0;
+ if (!ret)
+ rsp->OutputBufferLength = cpu_to_le32(buf.length);
kvfree(xattr_list);
-
- rsp->OutputBufferLength = cpu_to_le32(nbytes);
-
- return 0;
+ return ret;
}
static int get_file_internal_info(struct smb2_query_info_rsp *rsp,
@@ -5646,7 +5693,7 @@ static int smb2_get_info_file(struct ksmbd_work *work,
break;
case FILE_STREAM_INFORMATION:
- rc = get_file_stream_info(work, rsp, fp, work->response_buf);
+ rc = get_file_stream_info(work, req, rsp, fp);
break;
case FILE_INTERNAL_INFORMATION:
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 639/990] block: dont enter reclaim under rq_qos_mutex
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (637 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 638/990] ksmbd: return complete and aligned stream information Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 640/990] tls: Honor O_NONBLOCK in tls_sw_splice_read() Greg Kroah-Hartman
` (213 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tejun Heo, Josef Bacik, Jens Axboe,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 045cbfc369f5929ed473f7c200dc2e8146569ce5 ]
ioc_qos_write() and the wbt_lat_usec writers take rq_qos_mutex with the
queue frozen, blkcg_deactivate_policy() does the same with blkcg_mutex,
so nothing holding either may wait for IO. blkg_conf_prep() got
GFP_NOIO for the blkg in commit 5d726c4dbeed, but the
radix_tree_preload() right after it, the policy init functions and the
GFP_KERNEL fallback in blkcg_activate_policy() can still enter reclaim
there. lockdep reports the cycle on the first write to io.max.
Use GFP_NOIO for all of them.
Fixes: 9730763f4756 ("block: correct locking order for protecting blk-wbt parameters")
Fixes: 5d726c4dbeed ("blk-cgroup: fix possible deadlock while configuring policy")
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-35-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Replaced upstream's kzalloc_obj(*ptr) allocator calls with kzalloc(sizeof(*ptr), GFP_NOIO) in blk-iocost.c and blk-iolatency.c, since this tree lacks kzalloc_obj. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-cgroup.c | 13 +++++++++----
block/blk-iocost.c | 5 +++--
block/blk-iolatency.c | 3 ++-
block/blk-throttle.c | 3 ++-
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 610ea63ad3861..36e6fdad93bd6 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -917,7 +917,11 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
parent = blkcg_parent(parent);
}
- /* Drop locks to do new blkg allocation with GFP_KERNEL. */
+ /*
+ * Drop the spinlock to allocate the new blkg. rq_qos_mutex and
+ * blkcg_mutex stay held, and both are taken with the queue
+ * frozen elsewhere: GFP_NOIO.
+ */
spin_unlock_irq(&q->queue_lock);
new_blkg = blkg_alloc(pos, disk, GFP_NOIO);
@@ -926,7 +930,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
goto fail_exit;
}
- if (radix_tree_preload(GFP_KERNEL)) {
+ if (radix_tree_preload(GFP_NOIO)) {
blkg_free(new_blkg);
ret = -ENOMEM;
goto fail_exit;
@@ -1646,7 +1650,8 @@ int blkcg_activate_policy(struct gendisk *disk, const struct blkcg_policy *pol)
if (!pd) {
/*
* GFP_NOWAIT failed. Free the existing one and
- * prealloc for @blkg w/ GFP_KERNEL.
+ * prealloc for @blkg w/ GFP_NOIO: blkcg_mutex is held,
+ * and a bio based queue has not been frozen above.
*/
if (pinned_blkg)
blkg_put(pinned_blkg);
@@ -1658,7 +1663,7 @@ int blkcg_activate_policy(struct gendisk *disk, const struct blkcg_policy *pol)
if (pd_prealloc)
pol->pd_free_fn(pd_prealloc);
pd_prealloc = pol->pd_alloc_fn(disk, blkg->blkcg,
- GFP_KERNEL);
+ GFP_NOIO);
if (pd_prealloc)
goto retry;
else
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index a05e5cfd0ac0f..6c3ba62090477 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2982,11 +2982,12 @@ static int blk_iocost_init(struct gendisk *disk)
struct ioc *ioc;
int i, cpu, ret;
- ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
+ /* The caller holds rq_qos_mutex, which is taken with the queue frozen */
+ ioc = kzalloc(sizeof(*ioc), GFP_NOIO);
if (!ioc)
return -ENOMEM;
- ioc->pcpu_stat = alloc_percpu(struct ioc_pcpu_stat);
+ ioc->pcpu_stat = alloc_percpu_gfp(struct ioc_pcpu_stat, GFP_NOIO);
if (!ioc->pcpu_stat) {
kfree(ioc);
return -ENOMEM;
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 741c804c217bf..3e0c9ec5df367 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -761,7 +761,8 @@ static int blk_iolatency_init(struct gendisk *disk)
struct blk_iolatency *blkiolat;
int ret;
- blkiolat = kzalloc(sizeof(*blkiolat), GFP_KERNEL);
+ /* The caller holds rq_qos_mutex, which is taken with the queue frozen */
+ blkiolat = kzalloc(sizeof(*blkiolat), GFP_NOIO);
if (!blkiolat)
return -ENOMEM;
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 36f8dc324d79f..faf53bf759957 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1327,7 +1327,8 @@ static int blk_throtl_init(struct gendisk *disk)
unsigned int memflags;
int ret;
- td = kzalloc_node(sizeof(*td), GFP_KERNEL, q->node);
+ /* The caller holds rq_qos_mutex, which is taken with the queue frozen */
+ td = kzalloc_node(sizeof(*td), GFP_NOIO, q->node);
if (!td)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 640/990] tls: Honor O_NONBLOCK in tls_sw_splice_read()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (638 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 639/990] block: dont enter reclaim under rq_qos_mutex Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 641/990] ipv6: Protect multiple routes insertion by table lock Greg Kroah-Hartman
` (212 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever, Jakub Kicinski,
Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <cel@kernel.org>
[ Upstream commit 78ded647d43e335891f981f68c5992a2e763cfcc ]
tls_sw_splice_read() takes its blocking behavior from
SPLICE_F_NONBLOCK alone. When splicing from a socket to a pipe,
do_splice() sets that flag from the pipe's O_NONBLOCK, not the
socket's. On a nonblocking socket, a splice(2) call without
SPLICE_F_NONBLOCK therefore sleeps in tls_rx_rec_wait() until a
record arrives. tcp_splice_read() instead reads sock->file->f_flags
and returns -EAGAIN.
Polling first does not avoid the sleep once tls_sw_splice_read()
consumes zero-length records, as it does after a later patch in this
series. tls_sw_sock_is_readable() reports the socket readable while
any record sits on rx_list, including a zero-length record that
delivers no bytes to the pipe. For TLS 1.3 the strparser announces a
record before decryption, when its plaintext length is still unknown,
so the readiness test cannot screen such a record out. A splice that
consumes the record and waits for the next stalls every connection
an event loop multiplexes.
An LLM audit of the TLS read paths found this defect.
Treat the socket's O_NONBLOCK as nonblocking too. A caller that
sets O_NONBLOCK on the socket and splices without SPLICE_F_NONBLOCK
now gets -EAGAIN where the splice blocked before. sendfile(2) from
a TLS socket changes the same way, because do_sendfile() leaves the
input file's O_NONBLOCK out of the splice flags. Both now behave as
they do on a plain TCP socket.
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
Signed-off-by: Chuck Lever <cel@kernel.org>
Link: https://patch.msgid.link/20261027015215.605919-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Passed the branch's existing NULL psock argument to tls_rx_rec_wait() since its signature has an extra parameter, substituting only the nonblock variable for the flags check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tls/tls_sw.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 4f982594f11d3..23b6e0000caf2 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2331,10 +2331,14 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
struct tls_msg *tlm;
struct sk_buff *skb;
ssize_t copied = 0;
+ bool nonblock;
int chunk;
int err;
- err = tls_rx_reader_lock(sk, ctx, flags & SPLICE_F_NONBLOCK);
+ nonblock = flags & SPLICE_F_NONBLOCK ||
+ sock->file->f_flags & O_NONBLOCK;
+
+ err = tls_rx_reader_lock(sk, ctx, nonblock);
if (err < 0)
return err;
@@ -2348,8 +2352,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
} else {
struct tls_decrypt_arg darg;
- err = tls_rx_rec_wait(sk, NULL, flags & SPLICE_F_NONBLOCK,
- true, false);
+ err = tls_rx_rec_wait(sk, NULL, nonblock, true, false);
if (err <= 0)
goto splice_read_end;
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 641/990] ipv6: Protect multiple routes insertion by table lock.
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (639 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 640/990] tls: Honor O_NONBLOCK in tls_sw_splice_read() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 642/990] ice: use reference counting and SRCU for PTP port access Greg Kroah-Hartman
` (211 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+751b587577d0ebca10f2,
Kuniyuki Iwashima, Eric Dumazet, David Ahern, 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 4c6fbb1fbafa85029fa789b5b01f39ebcb459d1a ]
syzbot reported the warning below. [0]
While call_fib6_multipath_entry_notifiers() is called locklessly,
fib6_siblings could be changed concurrently, leading to the
warning (and later null-ptr-deref).
Let's protect multiple routes insertion with tb6_lock.
Along with that, __ip6_ins_rt() and ip6_route_del() are changed
to fib6_add() and fib6_del().
Note that fib6_del() finally calls rt6_multipath_rebalance(),
which requires rcu_read_lock().
[0]:
i != fen6_info->nsiblings
WARNING: drivers/net/netdevsim/fib.c:831 at nsim_fib6_event_init drivers/net/netdevsim/fib.c:831 [inline], CPU#0: syz.0.157/6279
WARNING: drivers/net/netdevsim/fib.c:831 at nsim_fib6_prepare_event drivers/net/netdevsim/fib.c:947 [inline], CPU#0: syz.0.157/6279
WARNING: drivers/net/netdevsim/fib.c:831 at nsim_fib_event_schedule_work drivers/net/netdevsim/fib.c:1003 [inline], CPU#0: syz.0.157/6279
WARNING: drivers/net/netdevsim/fib.c:831 at nsim_fib_event_nb+0x1029/0x11d0 drivers/net/netdevsim/fib.c:1043, CPU#0: syz.0.157/6279
Modules linked in:
CPU: 0 UID: 0 PID: 6279 Comm: syz.0.157 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:nsim_fib6_event_init drivers/net/netdevsim/fib.c:831 [inline]
RIP: 0010:nsim_fib6_prepare_event drivers/net/netdevsim/fib.c:947 [inline]
RIP: 0010:nsim_fib_event_schedule_work drivers/net/netdevsim/fib.c:1003 [inline]
RIP: 0010:nsim_fib_event_nb+0x1029/0x11d0 drivers/net/netdevsim/fib.c:1043
Code: eb 0d 4d 89 fd e8 b7 c5 6c fa be 01 00 00 00 48 89 df e8 5a 38 85 fd 4d 89 ef 4c 8b 6c 24 20 e9 4a f3 ff ff e8 98 c5 6c fa 90 <0f> 0b 90 e9 db fa ff ff 89 e9 80 e1 07 80 c1 03 38 c1 0f 8c df f0
RSP: 0018:ffffc900047bef10 EFLAGS: 00010293
RAX: ffffffff875b59a8 RBX: 0000000000000002 RCX: ffff888079770000
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000001
RBP: ffffc900047bf0a0 R08: ffff88805c0bb02f R09: 1ffff1100b817605
R10: dffffc0000000000 R11: ffffed100b817606 R12: dffffc0000000000
R13: 0000000000000000 R14: 0000000000000001 R15: ffff88802c792000
FS: 00007f334ba076c0(0000) GS:ffff888123ad0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f334ba06ff8 CR3: 000000007a5b2000 CR4: 00000000003526f0
Call Trace:
<TASK>
notifier_call_chain+0x1a5/0x3d0 kernel/notifier.c:85
atomic_notifier_call_chain+0xda/0x180 kernel/notifier.c:223
call_fib_notifiers+0x31/0x60 net/core/fib_notifier.c:36
call_fib6_multipath_entry_notifiers+0xf5/0x160 net/ipv6/ip6_fib.c:428
ip6_route_multipath_add net/ipv6/route.c:5542 [inline]
inet6_rtm_newroute+0x14f5/0x1a30 net/ipv6/route.c:5664
rtnetlink_rcv_msg+0x802/0xc00 net/core/rtnetlink.c:7163
netlink_rcv_skb+0x226/0x4a0 net/netlink/af_netlink.c:2572
netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
netlink_unicast+0x7bd/0x940 net/netlink/af_netlink.c:1361
netlink_sendmsg+0x813/0xb40 net/netlink/af_netlink.c:1916
sock_sendmsg_nosec+0x14e/0x190 net/socket.c:800
__sock_sendmsg net/socket.c:818 [inline]
____sys_sendmsg+0x54e/0x850 net/socket.c:2715
___sys_sendmsg+0x2a5/0x360 net/socket.c:2769
__sys_sendmmsg+0x273/0x4d0 net/socket.c:2858
__do_sys_sendmmsg net/socket.c:2885 [inline]
__se_sys_sendmmsg net/socket.c:2882 [inline]
__x64_sys_sendmmsg+0xa0/0xc0 net/socket.c:2882
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f334ab9e1d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f334ba07028 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f334ae26090 RCX: 00007f334ab9e1d9
RDX: 04000000000001f2 RSI: 0000200000000000 RDI: 0000000000000004
RBP: 00007f334ac35888 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000000fc R11: 0000000000000246 R12: 0000000000000000
R13: 00007f334ae26128 R14: 00007f334ae26090 R15: 00007ffd96688aa8
</TASK>
Fixes: 169fd62799e8 ("ipv6: Get rid of RTNL for SIOCADDRT and RTM_NEWROUTE.")
Reported-by: syzbot+751b587577d0ebca10f2@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6adbaed6.67317f00.38c4bc.001b.GAE@google.com/T/
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20261027065247.2871134-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Dropped the third RT_DEL_REASON_UNSPEC argument from the fib6_del() call in the multipath error path, since this tree's fib6_del() takes only two arguments. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/ipv6/ip6_fib.c | 4 ----
net/ipv6/route.c | 16 ++++++++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 962d01b9954e4..0ec46c65ee0b5 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1252,9 +1252,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
fib6_nsiblings++;
}
BUG_ON(fib6_nsiblings != rt->fib6_nsiblings);
- rcu_read_lock();
rt6_multipath_rebalance(temp_sibling);
- rcu_read_unlock();
}
/*
@@ -1298,9 +1296,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct fib6_info *rt,
sibling->fib6_nsiblings - 1);
WRITE_ONCE(rt->fib6_nsiblings, 0);
list_del_rcu(&rt->fib6_siblings);
- rcu_read_lock();
rt6_multipath_rebalance(next_sibling);
- rcu_read_unlock();
return err;
}
}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ac27f815d497c..4e5e01970ef73 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4894,8 +4894,10 @@ void rt6_multipath_rebalance(struct fib6_info *rt)
if (WARN_ON_ONCE(!first))
return;
+ rcu_read_lock();
total = rt6_multipath_total_weight(first);
rt6_multipath_upper_bound_set(first, total);
+ rcu_read_unlock();
}
static int fib6_ifup(struct fib6_info *rt, void *p_arg)
@@ -5432,6 +5434,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
struct fib6_info *rt_notif = NULL, *rt_last = NULL;
struct nl_info *info = &cfg->fc_nlinfo;
struct rt6_nh *nh, *nh_safe;
+ struct fib6_table *table;
struct fib6_config r_cfg;
struct rtnexthop *rtnh;
LIST_HEAD(rt6_nh_list);
@@ -5518,10 +5521,12 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
*/
info->skip_notify_kernel = 1;
+ table = rt->fib6_table;
+ spin_lock_bh(&table->tb6_lock);
+
err_nh = NULL;
list_for_each_entry(nh, &rt6_nh_list, list) {
- err = __ip6_ins_rt(nh->fib6_info, info, extack);
-
+ err = fib6_add(&table->tb6_root, nh->fib6_info, info, extack);
if (err) {
if (replace && nhn)
NL_SET_ERR_MSG_MOD(extack,
@@ -5576,11 +5581,13 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
/* success ... tell user about new route */
ip6_route_mpath_notify(rt_notif, rt_last, info, nlflags);
+
+ spin_unlock_bh(&table->tb6_lock);
goto cleanup;
add_errout:
/* send notification for routes that were added so that
- * the delete notifications sent by ip6_route_del are
+ * the delete notifications sent by fib6_del() are
* coherent
*/
if (rt_notif)
@@ -5590,9 +5597,10 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
list_for_each_entry(nh, &rt6_nh_list, list) {
if (err_nh == nh)
break;
- ip6_route_del(&nh->r_cfg, extack);
+ fib6_del(nh->fib6_info, &nh->r_cfg.fc_nlinfo);
}
+ spin_unlock_bh(&table->tb6_lock);
cleanup:
list_for_each_entry_safe(nh, nh_safe, &rt6_nh_list, list) {
fib6_info_release(nh->fib6_info);
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 642/990] ice: use reference counting and SRCU for PTP port access
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (640 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 641/990] ipv6: Protect multiple routes insertion by table lock Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 643/990] blk-mq-dma: initialize the dma state for P2P, too Greg Kroah-Hartman
` (210 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciek Machnikowski, Jacob Keller,
Jakub Kicinski, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <jacob.e.keller@intel.com>
[ Upstream commit d5d859a6efff473d799d35999a35aa764dcc185b ]
The ice adapter structure maintains a list of ports associated with the
adapter. This is used for supporting PTP, where the clock owner must handle
many operations that require access to the PTP port structures of the
associated PFs.
This is implemented using a linked list and a mutex. This sort of works,
but a few places within the code do not acquire the mutex when iterating
the list. This includes ice_ptp_flush_all_tx_tracker(),
ice_ptp_restart_all_phy(), and ice_ptp_prepare_rebuild_sec().
Fixing this is tricky, especially since it is not clear if we can simply
acquire the lock around the complete iterations.
The pattern of use for the port list is read-mostly with modifications only
happening during PF initialization when elements are inserted. This
typically only happens during early boot, though a PF could in principle be
removed or loaded at arbitrary times via bind and unbind operations.
The use of a mutex does mean the driver can sleep while holding it, but it
still creates complicates with lock ordering and prevents iterating the
list in any code path that *can't* sleep.
Instead, use SRCU primitives for the port linked list, along with a
reference count on the port. The kref reference counter ensures that a PF
will have a valid lifetime and not be removed until the reference is
released. Note that this change focuses solely on the port list and does
not make an effort to resolve access to ctrl_pf, which is currently being
investigated by another developer.
Use of sleepable RCU is required because we often iterate the PTP port list
and perform operations that might sleep. Attempts at implementing regular
RCU have thus far not proven to be acceptable.
The remove path first removes the port from the list, and we use
kref_get_unless_zero to ensure that such ports are skipped when iterating
the list. This ensures that once a port starts removing we will drop
references and no longer be able to acquire new ones. This avoids loop
iterations chaining together to indefinitely block removal.
The ice_ptp_release_port_srcu() function is used as the release function
for the kref_put() call. This uses wake_up_var() to wake the removing
thread. The waiting thread will block until the final reference has been
removed, then it will use synchronize_srcu() to ensure any outstanding SRCU
critical sections have had the necessary grace period.
This flow ensures that accesses to ports via the adapter port list will
remain valid until both the SRCU critical sections have ended and all the
references to the ports have been dropped. Strictly speaking, SRCU alone
might be sufficient for existing code paths, but the reference count allows
the option for passing a pointer to the port on to other functions if
necessary in the future.
Fixes: e800654e85b5 ("ice: Use ice_adapter for PTP shared data instead of auxdev")
Reviewed-by: Maciek Machnikowski <maciej.machnikowski@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20261027-reduction-v1-1-81237c67a361@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ sashal: Dropped the cpi_phy_lock init/destroy context, used kzalloc(sizeof(*adapter), GFP_KERNEL) instead of kzalloc_obj(), and omitted the mutex.h include context line. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_adapter.c | 17 ++-
drivers/net/ethernet/intel/ice/ice_adapter.h | 17 ++-
drivers/net/ethernet/intel/ice/ice_ptp.c | 125 ++++++++++++++-----
drivers/net/ethernet/intel/ice/ice_ptp.h | 4 +
4 files changed, 121 insertions(+), 42 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c b/drivers/net/ethernet/intel/ice/ice_adapter.c
index 0a8a48cd4bce6..8d0a4f6653cf0 100644
--- a/drivers/net/ethernet/intel/ice/ice_adapter.c
+++ b/drivers/net/ethernet/intel/ice/ice_adapter.c
@@ -6,6 +6,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <linux/srcu.h>
#include <linux/xarray.h>
#include "ice_adapter.h"
#include "ice.h"
@@ -54,26 +55,34 @@ static unsigned long ice_adapter_xa_index(struct pci_dev *pdev)
static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev)
{
struct ice_adapter *adapter;
+ int err;
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter)
return NULL;
+ err = init_srcu_struct(&adapter->ports.srcu);
+ if (err) {
+ kfree(adapter);
+ return NULL;
+ }
+
adapter->index = ice_adapter_index(pdev);
spin_lock_init(&adapter->ptp_gltsyn_time_lock);
spin_lock_init(&adapter->txq_ctx_lock);
refcount_set(&adapter->refcount, 1);
- mutex_init(&adapter->ports.lock);
- INIT_LIST_HEAD(&adapter->ports.ports);
+ spin_lock_init(&adapter->ports.lock);
+ INIT_LIST_HEAD(&adapter->ports.list);
return adapter;
}
static void ice_adapter_free(struct ice_adapter *adapter)
{
- WARN_ON(!list_empty(&adapter->ports.ports));
- mutex_destroy(&adapter->ports.lock);
+ WARN_ON(!list_empty(&adapter->ports.list));
+
+ cleanup_srcu_struct(&adapter->ports.srcu);
kfree(adapter);
}
diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h b/drivers/net/ethernet/intel/ice/ice_adapter.h
index e95266c7f20bd..636ee05f110af 100644
--- a/drivers/net/ethernet/intel/ice/ice_adapter.h
+++ b/drivers/net/ethernet/intel/ice/ice_adapter.h
@@ -5,6 +5,7 @@
#define _ICE_ADAPTER_H_
#include <linux/types.h>
+#include <linux/srcu.h>
#include <linux/spinlock_types.h>
#include <linux/refcount_types.h>
@@ -14,15 +15,19 @@ struct ice_pf;
/**
* struct ice_port_list - data used to store the list of adapter ports
*
- * This structure contains data used to maintain a list of adapter ports
+ * This structure contains data used to maintain a list of adapter ports.
+ * Writers modifying the list *must* acquire the lock, and use SRCU safe list
+ * operations. Readers should use srcu_read_lock() on the provided domain.
*
- * @ports: list of ports
- * @lock: protect access to the ports list
+ * @list: list of ports
+ * @lock: protect write access to the list
+ * @srcu: Sleepable RCU domain for this adapter
*/
struct ice_port_list {
- struct list_head ports;
- /* To synchronize the ports list operations */
- struct mutex lock;
+ struct list_head list;
+ /* To synchronize write operations on the port list */
+ spinlock_t lock;
+ struct srcu_struct srcu;
};
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index d33cd5f5f21c3..09e9550096a09 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2021, Intel Corporation. */
+#include <linux/rculist.h>
+#include <linux/srcu.h>
+#include <linux/wait_bit.h>
#include "ice.h"
#include "ice_lib.h"
#include "ice_trace.h"
@@ -674,20 +677,37 @@ static void ice_ptp_process_tx_tstamp(struct ice_ptp_tx *tx)
}
}
+static void ice_ptp_release_port_srcu(struct kref *ref)
+{
+ /* wake_up_var() requires full ordering but kref_put only provides
+ * release ordering.
+ */
+ smp_mb__after_atomic();
+ wake_up_var(ref);
+}
+
static void ice_ptp_tx_tstamp_owner(struct ice_pf *pf)
{
+ struct ice_port_list *ports = &pf->adapter->ports;
struct ice_ptp_port *port;
+ int srcu_idx;
- mutex_lock(&pf->adapter->ports.lock);
- list_for_each_entry(port, &pf->adapter->ports.ports, list_node) {
+ srcu_idx = srcu_read_lock(&ports->srcu);
+ list_for_each_entry_srcu(port, &ports->list, list_node,
+ srcu_read_lock_held(&ports->srcu)) {
struct ice_ptp_tx *tx = &port->tx;
- if (!tx || !tx->init)
+ if (!tx->init)
+ continue;
+
+ if (!kref_get_unless_zero(&port->ref))
continue;
ice_ptp_process_tx_tstamp(tx);
+
+ kref_put(&port->ref, ice_ptp_release_port_srcu);
}
- mutex_unlock(&pf->adapter->ports.lock);
+ srcu_read_unlock(&ports->srcu, srcu_idx);
}
/**
@@ -807,10 +827,19 @@ ice_ptp_mark_tx_tracker_stale(struct ice_ptp_tx *tx)
static void
ice_ptp_flush_all_tx_tracker(struct ice_pf *pf)
{
+ struct ice_port_list *ports = &pf->adapter->ports;
struct ice_ptp_port *port;
+ int srcu_idx;
- list_for_each_entry(port, &pf->adapter->ports.ports, list_node)
+ srcu_idx = srcu_read_lock(&ports->srcu);
+ list_for_each_entry_srcu(port, &ports->list, list_node,
+ srcu_read_lock_held(&ports->srcu)) {
+ if (!kref_get_unless_zero(&port->ref))
+ continue;
ice_ptp_flush_tx_tracker(ptp_port_to_pf(port), &port->tx);
+ kref_put(&port->ref, ice_ptp_release_port_srcu);
+ }
+ srcu_read_unlock(&ports->srcu, srcu_idx);
}
/**
@@ -1403,16 +1432,22 @@ static void ice_ptp_reset_phy_timestamping(struct ice_pf *pf)
*/
static void ice_ptp_restart_all_phy(struct ice_pf *pf)
{
- struct list_head *entry;
+ struct ice_port_list *ports = &pf->adapter->ports;
+ struct ice_ptp_port *port;
+ int srcu_idx;
- list_for_each(entry, &pf->adapter->ports.ports) {
- struct ice_ptp_port *port = list_entry(entry,
- struct ice_ptp_port,
- list_node);
+ srcu_idx = srcu_read_lock(&ports->srcu);
+ list_for_each_entry_srcu(port, &ports->list, list_node,
+ srcu_read_lock_held(&ports->srcu)) {
+ if (!kref_get_unless_zero(&port->ref))
+ continue;
if (port->link_up)
ice_ptp_port_phy_restart(port);
+
+ kref_put(&port->ref, ice_ptp_release_port_srcu);
}
+ srcu_read_unlock(&ports->srcu, srcu_idx);
}
/**
@@ -2672,19 +2707,28 @@ static bool ice_port_has_timestamps(struct ice_ptp_tx *tx)
static bool ice_any_port_has_timestamps(struct ice_pf *pf)
{
+ struct ice_port_list *ports = &pf->adapter->ports;
+ bool have_tstamps = false;
struct ice_ptp_port *port;
+ int srcu_idx;
- scoped_guard(mutex, &pf->adapter->ports.lock) {
- list_for_each_entry(port, &pf->adapter->ports.ports,
- list_node) {
- struct ice_ptp_tx *tx = &port->tx;
+ srcu_idx = srcu_read_lock(&ports->srcu);
+ list_for_each_entry_srcu(port, &ports->list, list_node,
+ srcu_read_lock_held(&ports->srcu)) {
+ if (!kref_get_unless_zero(&port->ref))
+ continue;
- if (ice_port_has_timestamps(tx))
- return true;
- }
+ if (ice_port_has_timestamps(&port->tx))
+ have_tstamps = true;
+
+ kref_put(&port->ref, ice_ptp_release_port_srcu);
+
+ if (have_tstamps)
+ break;
}
+ srcu_read_unlock(&ports->srcu, srcu_idx);
- return false;
+ return have_tstamps;
}
bool ice_ptp_tx_tstamps_pending(struct ice_pf *pf)
@@ -2868,14 +2912,18 @@ void ice_ptp_queue_work(struct ice_pf *pf)
static void ice_ptp_prepare_rebuild_sec(struct ice_pf *pf, bool rebuild,
enum ice_reset_req reset_type)
{
- struct list_head *entry;
+ struct ice_port_list *ports = &pf->adapter->ports;
+ struct ice_ptp_port *port;
+ int srcu_idx;
- list_for_each(entry, &pf->adapter->ports.ports) {
- struct ice_ptp_port *port = list_entry(entry,
- struct ice_ptp_port,
- list_node);
+ srcu_idx = srcu_read_lock(&ports->srcu);
+ list_for_each_entry_srcu(port, &ports->list, list_node,
+ srcu_read_lock_held(&ports->srcu)) {
struct ice_pf *peer_pf = ptp_port_to_pf(port);
+ if (!kref_get_unless_zero(&port->ref))
+ continue;
+
if (!ice_is_primary(&peer_pf->hw)) {
if (rebuild) {
/* TODO: When implementing rebuild=true:
@@ -2887,7 +2935,10 @@ static void ice_ptp_prepare_rebuild_sec(struct ice_pf *pf, bool rebuild,
ice_ptp_prepare_for_reset(peer_pf, reset_type);
}
}
+
+ kref_put(&port->ref, ice_ptp_release_port_srcu);
}
+ srcu_read_unlock(&ports->srcu, srcu_idx);
}
/**
@@ -3069,24 +3120,34 @@ static int ice_ptp_setup_pf(struct ice_pf *pf)
return -ENODEV;
INIT_LIST_HEAD(&ptp->port.list_node);
- mutex_lock(&pf->adapter->ports.lock);
+ kref_init(&ptp->port.ref);
- list_add(&ptp->port.list_node,
- &pf->adapter->ports.ports);
- mutex_unlock(&pf->adapter->ports.lock);
+ spin_lock(&pf->adapter->ports.lock);
+ list_add_rcu(&ptp->port.list_node, &pf->adapter->ports.list);
+ spin_unlock(&pf->adapter->ports.lock);
return 0;
}
static void ice_ptp_cleanup_pf(struct ice_pf *pf)
{
+ struct ice_port_list *ports = &pf->adapter->ports;
struct ice_ptp *ptp = &pf->ptp;
+ struct kref *ref;
- if (pf->hw.mac_type != ICE_MAC_UNKNOWN) {
- mutex_lock(&pf->adapter->ports.lock);
- list_del(&ptp->port.list_node);
- mutex_unlock(&pf->adapter->ports.lock);
- }
+ if (pf->hw.mac_type == ICE_MAC_UNKNOWN)
+ return;
+
+ spin_lock(&ports->lock);
+ list_del_rcu(&ptp->port.list_node);
+ spin_unlock(&ports->lock);
+
+ ref = &ptp->port.ref;
+ kref_put(ref, ice_ptp_release_port_srcu);
+
+ wait_var_event(ref, !kref_read(ref));
+
+ synchronize_srcu(&ports->srcu);
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h
index 0a5a1db66d614..1a1ea1891245b 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.h
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.h
@@ -5,6 +5,8 @@
#define _ICE_PTP_H_
#include <linux/ptp_clock_kernel.h>
+#include <linux/rculist.h>
+#include <linux/kref.h>
#include <linux/kthread.h>
#include "ice_ptp_hw.h"
@@ -138,6 +140,7 @@ struct ice_ptp_tx {
* and determine when the port's PHY offset is valid.
*
* @list_node: list member structure
+ * @ref: reference counter for use with adapter ports list
* @tx: Tx timestamp tracking for this port
* @ov_work: delayed work task for tracking when PHY offset is valid
* @ps_lock: mutex used to protect the overall PTP PHY start procedure
@@ -147,6 +150,7 @@ struct ice_ptp_tx {
*/
struct ice_ptp_port {
struct list_head list_node;
+ struct kref ref;
struct ice_ptp_tx tx;
struct kthread_delayed_work ov_work;
struct mutex ps_lock; /* protects overall PTP PHY start procedure */
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 643/990] blk-mq-dma: initialize the dma state for P2P, too
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (641 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 642/990] ice: use reference counting and SRCU for PTP port access Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 644/990] pidfs: do not report fields that do not fit into the callers struct Greg Kroah-Hartman
` (209 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, Christoph Hellwig,
Jens Axboe, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 035236c9e135a2ce7d0f68cb56e63d4a3da2abe1 ]
blk_rq_dma_map_iter_start() promises that the caller need not initialize
the dma_iova_state, but the P2P bus address path returns before it does
so. The state then holds what the last request with that tag left, and
blk_rq_dma_map_coalesce() describes a transfer as one IOVA range that it
isn't. Clear it on that path too.
Fixes: 858299dc6160 ("block: add scatterlist-less DMA mapping helpers")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261028164415.1262013-33-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ sashal: Kept the existing P2P request-flag code in the bus-address case and added the upstream memset of state after it, before the return. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
block/blk-mq-dma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c
index b7c26599f6b05..fef1448453f88 100644
--- a/block/blk-mq-dma.c
+++ b/block/blk-mq-dma.c
@@ -177,6 +177,8 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev,
bio_integrity(req->bio)->bip_flags |= BIP_P2P_DMA;
else
req->cmd_flags |= REQ_P2PDMA;
+ /* don't leave the state of an earlier mapping to the caller */
+ memset(state, 0, sizeof(*state));
return blk_dma_map_bus(iter, &vec);
case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE:
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 644/990] pidfs: do not report fields that do not fit into the callers struct
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (642 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 643/990] blk-mq-dma: initialize the dma state for P2P, too Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 645/990] Bluetooth: 6lowpan: avoid concurrent peer_del() in bt_6lowpan_disconnect Greg Kroah-Hartman
` (208 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Nickolai Zeldovich, Luca Boccassi,
Christian Brauner (Amutable), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nickolai Zeldovich <nickolai@csail.mit.edu>
[ Upstream commit 1534c37167488f2b85c74de048e1d6a4ba3848de ]
The documentation of struct pidfd_info promises that "If the structure
size is too small to contain a field (requested or not), to avoid
confusion the mask will not contain a bit for that field", and asks
userspace to trust the returned mask when deciding which fields hold
valid data.
pidfd_info() does not keep that promise. It builds kinfo.mask without
looking at the size encoded in the ioctl command, and
copy_struct_to_user() then truncates the copy to that size. A caller
that passes a 64-byte struct (PIDFD_INFO_SIZE_VER0) and requests
PIDFD_INFO_COREDUMP or PIDFD_INFO_SUPPORTED_MASK gets a mask with
PIDFD_INFO_COREDUMP, PIDFD_INFO_COREDUMP_SIGNAL, PIDFD_INFO_COREDUMP_CODE
and PIDFD_INFO_SUPPORTED_MASK set, while the coredump_* and
supported_mask fields behind the 64 bytes were never written. Trusting
the mask as documented, userspace then reads whatever its own buffer
held at those offsets. The same happens for a 72- or 80-byte struct
and the fields added after it.
Clear the bits of the fields that lie beyond the caller's size before
the copy, in the one place that knows both the final mask and the size.
A request for a field that cannot be returned is thereby answered the
way the header describes: the field is simply absent from the mask.
Fixes: 1d8db6fd698d ("pidfs, coredump: add PIDFD_INFO_COREDUMP")
Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Link: https://patch.msgid.link/20261024041334.831273-2-nickolai@csail.mit.edu
Acked-by: Luca Boccassi <luca.boccassi@gmail.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
[ sashal: Dropped the COREDUMP_SIGNAL, COREDUMP_CODE and SUPPORTED_MASK clearing hunks, since those bits and struct sizes don't exist here, keeping only the PIDFD_INFO_COREDUMP check. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/pidfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/pidfs.c b/fs/pidfs.c
index a014db891aaa8..cfecc1098170e 100644
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -440,6 +440,10 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
}
copy_out:
+ /* Only report fields that fit into the caller's struct. */
+ if (usize < PIDFD_INFO_SIZE_VER1)
+ kinfo.mask &= ~PIDFD_INFO_COREDUMP;
+
/*
* If userspace and the kernel have the same struct size it can just
* be copied. If userspace provides an older struct, only the bits that
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 645/990] Bluetooth: 6lowpan: avoid concurrent peer_del() in bt_6lowpan_disconnect
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (643 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 644/990] pidfs: do not report fields that do not fit into the callers struct Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 646/990] mm/slub: refill prefilled sheaves from the barn Greg Kroah-Hartman
` (207 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Pauli Virtanen,
Luiz Augusto von Dentz, Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <pav@iki.fi>
[ Upstream commit df5175dfcf4879f6bcdadee614ac089e5627b721 ]
bt_6lowpan_disconnect() looks up and accesses peer->chan, without
holding locks guaranteeing peer_del() cannot free the peer concurrently.
Take devices_lock to ensure peer can be dereferenced safely.
Fixes: 15f32cabf426 ("Bluetooth: 6lowpan: add missing l2cap_chan_lock()")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ sashal: Kept this tree's existing lock/close/unlock sequence on the pinned channel instead of upstream's l2cap_chan_close_unlocked() helper, which is missing here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/6lowpan.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 64dffdc8125b3..9515b82cda688 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -913,18 +913,29 @@ static int bt_6lowpan_connect(bdaddr_t *addr, u8 dst_type)
static int bt_6lowpan_disconnect(struct l2cap_conn *conn, u8 dst_type)
{
struct lowpan_peer *peer;
+ struct l2cap_chan *chan;
BT_DBG("conn %p dst type %u", conn, dst_type);
+ spin_lock(&devices_lock);
+
peer = lookup_peer(conn);
- if (!peer)
+ if (!peer) {
+ spin_unlock(&devices_lock);
return -ENOENT;
+ }
+
+ chan = peer->chan;
+ l2cap_chan_hold(chan);
+
+ spin_unlock(&devices_lock);
- BT_DBG("peer %p chan %p", peer, peer->chan);
+ BT_DBG("peer %p chan %p", peer, chan);
- l2cap_chan_lock(peer->chan);
- l2cap_chan_close(peer->chan, ENOENT);
- l2cap_chan_unlock(peer->chan);
+ l2cap_chan_lock(chan);
+ l2cap_chan_close(chan, ENOENT);
+ l2cap_chan_unlock(chan);
+ l2cap_chan_put(chan);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 646/990] mm/slub: refill prefilled sheaves from the barn
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (644 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 645/990] Bluetooth: 6lowpan: avoid concurrent peer_del() in bt_6lowpan_disconnect Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 647/990] tracing/eprobe: Install the trigger for every instance that enables the eprobe Greg Kroah-Hartman
` (206 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hao Li, Harry Yoo (Meta),
Vlastimil Babka (SUSE), Sasha Levin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hao Li <hao.li@linux.dev>
[ Upstream commit 1b87ea06a34b213e45e3e0c4effd5043f15046ed ]
Currently, when the prefill API refills a non-full sheaf, it takes the
objects from partial slabs and never from the full sheaves in the barn,
so once the barn's full list becomes saturated, it stays saturated.
For objects freed via kfree_rcu(), every RCU sheaf then has to be
flushed to slabs because the barn's full list has no room.
To fix this, let the sheaf refill from the barn first, and introduce a
partial sheaf in the barn, which holds the leftover objects [1].
Only the prefill path needs the partial sheaf. The generic allocation
path (__pcs_replace_empty_main()) exchanges an empty sheaf for a full
one from the barn, so nothing is left over. The prefill path refills a
sheaf that is not necessarily empty, so taking objects from the barn
usually leaves leftovers, and the partial sheaf is where they are
kept. refill_sheaf() only takes objects from partial slabs and never
involves the partial sheaf.
The sheaf is refilled by copying objects from the partial sheaf, and
then from a full sheaf taken from the barn if it is still not full. A
sheaf that objects were copied from stays in the barn as the partial
sheaf if it still holds objects, or goes on the empty list if it is
empty. The sheaf being refilled is never replaced.
The gain comes from two sides: every full sheaf taken out makes room on
the barn's full list for a future RCU sheaf, and refilling from the
barn is cheaper than refilling from partial slabs under list_lock.
Note that putting the sheaf with the leftover objects on the full list
instead would not work: it would occupy room on the full list, so the
list would stay saturated and rcu_free_sheaf() would still keep
flushing.
An earlier version of this patch swapped sheaves instead, to minimize
the memcpy overhead. As Harry Yoo pointed out [2], replacing the
caller's sheaf loses cache affinity, filling it directly is more
straightforward, and testing showed no measurable difference between
the two approaches, so the approach he suggested is used.
Tested with will-it-scale mmap1 (192 processes, one-minute runs) on the
maple_node cache.
throughput: 27778727 -> 34500556 (+24.2%)
metric baseline patched change
=====================================================================
alloc_fastpath 54,124 56,696 +4.75%
alloc_slab 7,100,651 159,739 -97.75%
barn_get 849 194,460,392 +22904539.81%
barn_get_fail 2 217 +10750.00%
barn_put 851 182,306,701 +21422544.07%
barn_put_fail 260,400,484 145,522,675 -44.12%
cmpxchg_double_fail 1,029,204 334,228 -67.53%
free_add_partial 326,694,687 181,935,790 -44.31%
free_fastpath 13,297 15,611 +17.40%
free_rcu_sheaf 8,332,839,104 10,490,535,227 +25.89%
free_remove_partial 7,099,788 158,297 -97.77%
free_slab 7,099,788 158,297 -97.77%
free_slowpath 10,969,156 782,851 -92.86%
objects 15,295 14,849 -2.92%
objects_partial 15,295 14,849 -2.92%
partial 1,604 2,336 +45.64%
sheaf_alloc 137,757,895 141,208,076 +2.50%
sheaf_flush 8,332,823,922 4,656,725,764 -44.12%
sheaf_free 137,757,883 141,208,072 +2.50%
sheaf_prefill_fast 3,337,502,163 4,196,506,116 +25.74%
sheaf_prefill_slow 685 400 -41.61%
sheaf_refill 8,343,794,364 4,657,509,724 -44.18%
sheaf_return_fast 3,337,502,411 4,196,506,382 +25.74%
sheaf_return_slow 437 134 -69.34%
slabs 1,604 2,336 +45.64%
total_objects 102,656 149,504 +45.64%
Here is what the important metric changes mean.
barn_get and barn_put: refills now take full sheaves out of the barn,
and RCU sheaves are put into the barn again. Before, the barn's full
list was saturated once and hardly ever consumed.
barn_put_fail: more than half of the RCU sheaves are now put into the
barn instead of being flushed. The rest are still flushed because they
arrive while the barn's full list is at its limit.
sheaf_refill and free_add_partial: fewer objects are taken from partial
slabs to refill sheaves, and fewer slabs are added to the partial list,
by the same percentage.
alloc_slab and free_slab: the partial list is almost never empty when a
refill looks at it, so slabs are almost never allocated and freed again
only to serve refills.
After the test, the maple_node cache holds 1604 slabs without the patch
and 2336 with it. After a manual shrink
(echo 1 > /sys/kernel/slab/maple_node/shrink), it holds 485 without
the patch and 563 with it. So most of the extra slabs are held only by
objects sitting in sheaves and are returned by a shrink, and what
remains is a small difference, because objects handed out from the barn
come from many more slabs than a refill from partial slabs would use.
Link: https://lore.kernel.org/linux-mm/aqPlMzUIw-4g2iOX@fedora/ [1]
Link: https://lore.kernel.org/linux-mm/aq0ylDidEHa2kg4X@thinkstation/ [2]
Signed-off-by: Hao Li <hao.li@linux.dev>
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
Link: https://patch.msgid.link/20260921094521.141665-1-hao.li@linux.dev
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
[ sashal: Adapted by calling refill_sheaf_from_barn() directly in the two prefill/refill functions, since the upstream pfmemalloc prefill helper doesn't exist here. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
mm/slub.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 84 insertions(+), 2 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 8fdbe531a0cba..d49b6f69136c5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -462,6 +462,7 @@ struct node_barn {
spinlock_t lock;
struct list_head sheaves_full;
struct list_head sheaves_empty;
+ struct slab_sheaf *sheaf_partial;
unsigned int nr_full;
unsigned int nr_empty;
};
@@ -3047,6 +3048,7 @@ static void barn_init(struct node_barn *barn)
spin_lock_init(&barn->lock);
INIT_LIST_HEAD(&barn->sheaves_full);
INIT_LIST_HEAD(&barn->sheaves_empty);
+ barn->sheaf_partial = NULL;
barn->nr_full = 0;
barn->nr_empty = 0;
}
@@ -3067,6 +3069,10 @@ static void barn_shrink(struct kmem_cache *s, struct node_barn *barn)
barn->nr_full = 0;
list_splice_init(&barn->sheaves_empty, &empty_list);
barn->nr_empty = 0;
+ if (barn->sheaf_partial) {
+ list_add(&barn->sheaf_partial->barn_list, &full_list);
+ barn->sheaf_partial = NULL;
+ }
spin_unlock_irqrestore(&barn->lock, flags);
@@ -5381,6 +5387,78 @@ void *kmem_cache_alloc_node_noprof(struct kmem_cache *s, gfp_t gfpflags, int nod
}
EXPORT_SYMBOL(kmem_cache_alloc_node_noprof);
+/*
+ * Refill @sheaf from the barn: from its partial sheaf first, then from its full
+ * sheaves. A sheaf that objects were copied from stays in the barn as the
+ * partial sheaf if it still holds objects, or goes on the empty list if it is
+ * empty.
+ *
+ * Returns true if the sheaf is now full, at s->sheaf_capacity.
+ * Returns false if the sheaf is still not full.
+ */
+static bool refill_sheaf_from_barn(struct kmem_cache *s,
+ struct slab_sheaf *sheaf)
+{
+ struct node_barn *barn = get_barn(s);
+ struct slab_sheaf *src;
+ unsigned int to_move;
+ unsigned long flags;
+
+ if (!barn)
+ return false;
+
+ if (!data_race(barn->nr_full) && !data_race(barn->sheaf_partial))
+ return false;
+
+ spin_lock_irqsave(&barn->lock, flags);
+
+ /*
+ * The partial sheaf can hold fewer objects than @sheaf needs to
+ * reach capacity, and a sheaf on the full list is not necessarily
+ * full (see the comment in rcu_free_sheaf()), so keep taking from
+ * the barn until @sheaf is full or nothing is left.
+ */
+ while (sheaf->size < s->sheaf_capacity) {
+ src = barn->sheaf_partial;
+ barn->sheaf_partial = NULL;
+ if (!src) {
+ if (!barn->nr_full)
+ break;
+ src = list_first_entry(&barn->sheaves_full,
+ struct slab_sheaf, barn_list);
+ list_del(&src->barn_list);
+ barn->nr_full--;
+ }
+
+ to_move = min(s->sheaf_capacity - sheaf->size, src->size);
+ src->size -= to_move;
+ memcpy(&sheaf->objects[sheaf->size], &src->objects[src->size],
+ to_move * sizeof(void *));
+ sheaf->size += to_move;
+
+ if (src->size) {
+ barn->sheaf_partial = src;
+ } else {
+ /*
+ * No empty-limit check: the sheaf put on the empty list
+ * was already in the barn, so the barn holds no more
+ * sheaves than before. barn_replace_empty_sheaf() skips
+ * the check for the same reason.
+ */
+ list_add(&src->barn_list, &barn->sheaves_empty);
+ barn->nr_empty++;
+ }
+ }
+
+ spin_unlock_irqrestore(&barn->lock, flags);
+
+ if (sheaf->size < s->sheaf_capacity)
+ return false;
+
+ stat(s, BARN_GET);
+ return true;
+}
+
/*
* returns a sheaf that has at least the requested size
* when prefilling is needed, do so with given gfp flags
@@ -5452,7 +5530,8 @@ kmem_cache_prefill_sheaf(struct kmem_cache *s, gfp_t gfp, unsigned int size)
sheaf = alloc_empty_sheaf(s, gfp);
if (sheaf && sheaf->size < size) {
- if (refill_sheaf(s, sheaf, gfp)) {
+ if (!refill_sheaf_from_barn(s, sheaf) &&
+ refill_sheaf(s, sheaf, gfp)) {
sheaf_flush_unused(s, sheaf);
free_empty_sheaf(s, sheaf);
sheaf = NULL;
@@ -5546,8 +5625,11 @@ int kmem_cache_refill_sheaf(struct kmem_cache *s, gfp_t gfp,
return 0;
if (likely(sheaf->capacity >= size)) {
- if (likely(sheaf->capacity == s->sheaf_capacity))
+ if (likely(sheaf->capacity == s->sheaf_capacity)) {
+ if (refill_sheaf_from_barn(s, sheaf))
+ return 0;
return refill_sheaf(s, sheaf, gfp);
+ }
if (!__kmem_cache_alloc_bulk(s, gfp, sheaf->capacity - sheaf->size,
&sheaf->objects[sheaf->size])) {
--
2.53.0
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 647/990] tracing/eprobe: Install the trigger for every instance that enables the eprobe
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (645 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 646/990] mm/slub: refill prefilled sheaves from the barn Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 648/990] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE Greg Kroah-Hartman
` (205 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Carlier,
Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Carlier <devnexen@gmail.com>
commit be94710b1f6ba1bea33e73129c110af80e999b2d upstream.
The eprobe trigger lives in the instance of the enabling file, but it is
only added when the eprobe is first enabled and only removed when the
last file goes away. A second instance then records nothing, and the
first instance's trigger is left behind once the eprobe is disabled
there, so the eprobe can be deleted while that trigger still uses it.
Add and remove the trigger for each file. The file is never NULL here,
so warn if it is and drop the dead perf paths.
Link: https://lore.kernel.org/all/20261107101233.151434-1-devnexen@gmail.com/
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_eprobe.c | 58 ++++++++++++++------------------------------
1 file changed, 19 insertions(+), 39 deletions(-)
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -642,37 +642,32 @@ static int enable_trace_eprobe(struct tr
{
struct trace_probe *tp;
struct trace_eprobe *ep;
- bool enabled;
int ret = 0;
int cnt = 0;
+ if (WARN_ON_ONCE(!file))
+ return -EINVAL;
+
tp = trace_probe_primary_from_call(call);
if (WARN_ON_ONCE(!tp))
return -ENODEV;
- enabled = trace_probe_is_enabled(tp);
/* This also changes "enabled" state */
- if (file) {
- ret = trace_probe_add_file(tp, file);
- if (ret)
- return ret;
- } else
- trace_probe_set_flag(tp, TP_FLAG_PROFILE);
-
- if (enabled)
- return 0;
+ ret = trace_probe_add_file(tp, file);
+ if (ret)
+ return ret;
+ /* The trigger lives in the instance of the file, add it for each file */
for_each_trace_eprobe_tp(ep, tp) {
ret = enable_eprobe(ep, file);
if (ret)
break;
- enabled = true;
cnt++;
}
if (ret) {
/* Failed to enable one of them. Roll back all */
- if (enabled) {
+ if (cnt) {
/*
* It's a bug if one failed for something other than memory
* not being available but another eprobe succeeded.
@@ -685,10 +680,7 @@ static int enable_trace_eprobe(struct tr
break;
}
}
- if (file)
- trace_probe_remove_file(tp, file);
- else
- trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
+ trace_probe_remove_file(tp, file);
}
return ret;
@@ -700,33 +692,21 @@ static int disable_trace_eprobe(struct t
struct trace_probe *tp;
struct trace_eprobe *ep;
+ if (WARN_ON_ONCE(!file))
+ return -EINVAL;
+
tp = trace_probe_primary_from_call(call);
if (WARN_ON_ONCE(!tp))
return -ENODEV;
- if (file) {
- if (!trace_probe_get_file_link(tp, file))
- return -ENOENT;
- if (!trace_probe_has_single_file(tp))
- goto out;
- trace_probe_clear_flag(tp, TP_FLAG_TRACE);
- } else
- trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
-
- if (!trace_probe_is_enabled(tp)) {
- for_each_trace_eprobe_tp(ep, tp)
- disable_eprobe(ep, file->tr);
- }
+ if (!trace_probe_get_file_link(tp, file))
+ return -ENOENT;
- out:
- if (file)
- /*
- * Synchronization is done in below function. For perf event,
- * file == NULL and perf_trace_event_unreg() calls
- * tracepoint_synchronize_unregister() to ensure synchronize
- * event. We don't need to care about it.
- */
- trace_probe_remove_file(tp, file);
+ for_each_trace_eprobe_tp(ep, tp)
+ disable_eprobe(ep, file->tr);
+
+ /* Synchronization is done in below function. */
+ trace_probe_remove_file(tp, file);
return 0;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 648/990] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (646 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 647/990] tracing/eprobe: Install the trigger for every instance that enables the eprobe Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 649/990] KEYS: Verify the key identity in __key_unlink_begin Greg Kroah-Hartman
` (204 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Eric Biggers,
Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <jarkko@kernel.org>
commit 094c53d2994975e36d4cab7cf5d9f34c1b0f1916 upstream.
KEY_MAX_DESC_SIZE includes the trailing NULL character. Descriptions
generated from payloads and in-kernel paths bypass the userspace limit.
Reject descriptions at or above KEY_MAX_DESC_SIZE with -EINVAL at the
following sites:
- key_alloc(): before quota calculation
- __key_create_or_update(): before key_set_index_key()
- keyring_search(): before match_preparse
- request_key_and_link(): before match_preparse
- request_key_rcu(): before check_cached_key()
Cc: stable@vger.kernel.org
Fixes: f771fde82051 ("keys: Simplify key description management")
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/r/20261020174325.2229448-3-jarkko@kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/key.h | 3 +++
security/keys/key.c | 10 +++++++++-
security/keys/keyctl.c | 2 --
security/keys/keyring.c | 7 ++++++-
security/keys/request_key.c | 14 ++++++++++++--
5 files changed, 30 insertions(+), 6 deletions(-)
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -37,6 +37,9 @@ struct net;
#undef KEY_DEBUGGING
+/* Maximum length of a key description, including the trailing NUL */
+#define KEY_MAX_DESC_SIZE 4096
+
#define KEY_POS_VIEW 0x01000000 /* possessor can view a key's attributes */
#define KEY_POS_READ 0x02000000 /* possessor can read key payload / view keyring */
#define KEY_POS_WRITE 0x04000000 /* possessor can update key payload / add link to keyring */
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -245,6 +245,8 @@ struct key *key_alloc(struct key_type *t
}
desclen = strlen(desc);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ goto error;
quotalen = desclen + 1 + type->def_datalen;
/* get hold of the key tracking for this user */
@@ -829,6 +831,7 @@ static key_ref_t __key_create_or_update(
key_ref_t key_ref;
int ret;
struct key_restriction *restrict_link = NULL;
+ size_t desclen;
/* look up the key type to see if it's one of the registered kernel
* types */
@@ -869,7 +872,12 @@ static key_ref_t __key_create_or_update(
if (!index_key.description)
goto error_free_prep;
}
- index_key.desc_len = strlen(index_key.description);
+ desclen = strlen(index_key.description);
+ if (desclen >= KEY_MAX_DESC_SIZE) {
+ key_ref = ERR_PTR(-EINVAL);
+ goto error_free_prep;
+ }
+ index_key.desc_len = desclen;
key_set_index_key(&index_key);
ret = __key_link_lock(keyring, &index_key);
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -24,8 +24,6 @@
#include <keys/request_key_auth-type.h>
#include "internal.h"
-#define KEY_MAX_DESC_SIZE 4096
-
static const unsigned char keyrings_capabilities[2] = {
[0] = (KEYCTL_CAPS0_CAPABILITIES |
(IS_ENABLED(CONFIG_PERSISTENT_KEYRINGS) ? KEYCTL_CAPS0_PERSISTENT_KEYRINGS : 0) |
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -957,7 +957,6 @@ key_ref_t keyring_search(key_ref_t keyri
struct keyring_search_context ctx = {
.index_key.type = type,
.index_key.description = description,
- .index_key.desc_len = strlen(description),
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
@@ -965,8 +964,14 @@ key_ref_t keyring_search(key_ref_t keyri
.flags = KEYRING_SEARCH_DO_STATE_CHECK,
};
key_ref_t key;
+ size_t desclen;
int ret;
+ desclen = strlen(description);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ return ERR_PTR(-EINVAL);
+ ctx.index_key.desc_len = desclen;
+
if (recurse)
ctx.flags |= KEYRING_SEARCH_RECURSE;
if (type->match_preparse) {
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -584,7 +584,6 @@ struct key *request_key_and_link(struct
.index_key.type = type,
.index_key.domain_tag = domain_tag,
.index_key.description = description,
- .index_key.desc_len = strlen(description),
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
@@ -595,8 +594,14 @@ struct key *request_key_and_link(struct
};
struct key *key;
key_ref_t key_ref;
+ size_t desclen;
int ret;
+ desclen = strlen(description);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ return ERR_PTR(-EINVAL);
+ ctx.index_key.desc_len = desclen;
+
kenter("%s,%s,%p,%zu,%p,%p,%lx",
ctx.index_key.type->name, ctx.index_key.description,
callout_info, callout_len, aux, dest_keyring, flags);
@@ -787,7 +792,6 @@ struct key *request_key_rcu(struct key_t
.index_key.type = type,
.index_key.domain_tag = domain_tag,
.index_key.description = description,
- .index_key.desc_len = strlen(description),
.cred = current_cred(),
.match_data.cmp = key_default_cmp,
.match_data.raw_data = description,
@@ -797,6 +801,12 @@ struct key *request_key_rcu(struct key_t
};
struct key *key;
key_ref_t key_ref;
+ size_t desclen;
+
+ desclen = strlen(description);
+ if (desclen >= KEY_MAX_DESC_SIZE)
+ return ERR_PTR(-EINVAL);
+ ctx.index_key.desc_len = desclen;
kenter("%s,%s", type->name, description);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 649/990] KEYS: Verify the key identity in __key_unlink_begin
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (647 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 648/990] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 650/990] bootconfig: Allow keys with the maximum supported depth Greg Kroah-Hartman
` (203 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, David Howells, Eric Biggers,
Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <jarkko@kernel.org>
commit 7a7f70ff7b26519c98b339a3e0cd9ee3c8d17f77 upstream.
When two keys have identical type and description, linking the second key
replaces the first in a keyring. However, attempting to unlink the first
key (no longer in the keyring) unlinks the second key.
This happens because __key_unlink_begin() calls assoc_array_delete() with
&key->index_key, matching only on type and description rather than the
key's identity.
Example:
keyctl new_session >/dev/null
keyctl newring ring_a @s
keyctl newring ring_b @s
A=$(keyctl add user A ss %:ring_a)
B=$(keyctl add user A qq %:ring_b)
keyctl newring R @s
keyctl link $A %:R
keyctl link $B %:R
keyctl unlink $A %:R
keyctl show
Verify the key identity before unlinking, and return -ENOENT on mismatch,
instead of unlinking the key with the wrong identity.
Cc: stable@vger.kernel.org
Fixes: b2a4df200d57 ("KEYS: Expand the capacity of a keyring")
Reviewed-by: David Howells <dhowells@redhat.com>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Link: https://lore.kernel.org/r/20261020174325.2229448-4-jarkko@kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
security/keys/keyring.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -1506,9 +1506,15 @@ static int __key_unlink_begin(struct key
struct assoc_array_edit **_edit)
{
struct assoc_array_edit *edit;
+ const void *object;
BUG_ON(*_edit != NULL);
+ object = assoc_array_find(&keyring->keys, &keyring_assoc_array_ops,
+ &key->index_key);
+ if (!object || keyring_ptr_to_key(object) != key)
+ return -ENOENT;
+
edit = assoc_array_delete(&keyring->keys, &keyring_assoc_array_ops,
&key->index_key);
if (IS_ERR(edit))
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 650/990] bootconfig: Allow keys with the maximum supported depth
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (648 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 649/990] KEYS: Verify the key identity in __key_unlink_begin Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 651/990] ALSA: caiaq: Kill EP1 URB before unregistering the input device Greg Kroah-Hartman
` (202 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhiqi Zhang,
Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiqi Zhang <zhiqizhangg@gmail.com>
commit cab697164b47eecfa2f146024f5d661f99a1a1e7 upstream.
xbc_verify_tree() accepts keys with XBC_DEPTH_MAX (16) components,
but xbc_node_compose_key_after() returns -ERANGE immediately after
storing the sixteenth component. It rejects the key before discovering
that there are no more ancestors to collect.
For example, a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p = value can be attached
to an initrd successfully. However, bootconfig -l stops listing and
prints "Failed to compose key -34". In the kernel, the same error
propagates through copy_xbc_key_value_list() during its length probe,
so proc_boot_config_init() returns before creating /proc/bootconfig.
Check the array capacity before storing the next component. This lets
exactly XBC_DEPTH_MAX components be composed while retaining the check
before any out-of-bounds store.
I found this issue while reviewing bootconfig's depth handling and used
OpenAI Codex to verify the failure and develop the fix. I reviewed the
change and wrote and ran the regression tests.
Link: https://lore.kernel.org/all/20261104073742.21202-2-zhiqizhangg@gmail.com/
Fixes: 76db5a27a827 ("bootconfig: Add Extra Boot Config support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhiqi Zhang <zhiqizhangg@gmail.com>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/bootconfig.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -302,9 +302,9 @@ int __init xbc_node_compose_key_after(st
node = xbc_node_get_parent(node);
while (node && node != root) {
- keys[depth++] = xbc_node_index(node);
if (depth == XBC_DEPTH_MAX)
return -ERANGE;
+ keys[depth++] = xbc_node_index(node);
node = xbc_node_get_parent(node);
}
if (!node && root)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 651/990] ALSA: caiaq: Kill EP1 URB before unregistering the input device
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (649 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 650/990] bootconfig: Allow keys with the maximum supported depth Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 652/990] ALSA: hda/realtek: Fix the Dell XPS 8940 headset microphone Greg Kroah-Hartman
` (201 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sergei Nizovtsev, Takashi Iwai
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Nizovtsev <snizovtsev@cloudlinux.com>
commit 5d325345185015024a86abca4cc5fa6a3f75294e upstream.
snd_disconnect() unregisters the input device via
snd_usb_caiaq_input_disconnect() and only afterwards kills the EP1
command URB (cdev->ep1_in_urb). The EP1 completion handler
usb_ep1_command_reply_dispatch() feeds snd_usb_caiaq_input_dispatch()
for EP1_CMD_READ_{ERP,ANALOG,IO} replies, which report into
cdev->input_dev. Since commit b04dcbb7f7b1 ("ALSA: caiaq: Use
snd_card_free_when_closed() at disconnection") the input device is
unregistered from snd_usb_caiaq_input_disconnect() but cdev->input_dev
is cleared only later, in snd_usb_caiaq_input_free() from the card
destructor. As the dispatch guard only tests cdev->input_dev for NULL,
an EP1 reply that completes after input_unregister_device() but before
cdev->ep1_in_urb is killed reports into an input device that has
already been unregistered and, with no evdev client holding it open,
freed.
Normally the window is closed by the USB core: usb_unbind_interface()
calls usb_disable_interface() before ->disconnect(), which flushes the
EP1 URB as long as endpoint 0x81 belongs to the interface being
unbound. But caiaq addresses EP1 through the device-wide pipe
usb_rcvbulkpipe(usb_dev, 0x1) without checking which interface owns
the endpoint. If a device declares it in another interface, the URB
stays live across snd_disconnect() of the interface that owns the card.
This needs a crafted device descriptor; a device that has EP1 in the
interface caiaq is bound to is not affected.
Kill cdev->ep1_in_urb (and the paired midi_out_urb) before the input
and audio disconnect helpers, so no EP1 completion can run once the
input device has been unregistered.
Reproduced under KASAN with raw-gadget + dummy_hcd emulating an Audio
Kontrol 1 (17cc:0815) with the EP1 bulk pair in interface 1: only
interface 0 was bound to snd-usb-caiaq and then unbound through sysfs
while the gadget flooded EP1 with EP1_CMD_READ_ERP replies. With no PCM
stream running the window is very short and was only hit by stalling
the unbinding CPU with a kgdb breakpoint at
snd_usb_caiaq_audio_disconnect(). With the fix applied, the same test
runs clean.
BUG: KASAN: slab-use-after-free in input_event+0x3a/0xc0
Read of size 8 at addr ffff8880151a4028 by task sh/118
Call Trace:
<IRQ>
input_event+0x3a/0xc0
snd_usb_caiaq_input_dispatch+0xab2/0xf00
usb_ep1_command_reply_dispatch+0x1f3/0x580
__usb_hcd_giveback_urb+0x246/0x400
dummy_timer+0x1415/0x3380
__hrtimer_run_queues+0x39d/0x800
hrtimer_run_softirq+0x187/0x2d0
handle_softirqs+0x1ff/0x930
__irq_exit_rcu+0x15b/0x210
irq_exit_rcu+0xe/0x20
sysvec_apic_timer_interrupt+0x81/0xb0
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20
RIP: 0010:snd_usb_caiaq_audio_disconnect+0x0/0x70
snd_disconnect+0x81/0x110
usb_unbind_interface+0x1a0/0x860
device_release_driver_internal+0x2c5/0x470
unbind_store+0xde/0x100
</TASK>
Allocated by task 80:
input_allocate_device+0x47/0x340
snd_usb_caiaq_input_init+0x4c/0x1ac0
snd_probe+0xab3/0x1160
usb_probe_interface+0x2ea/0x810
Freed by task 118:
kfree+0x1ea/0x5c0
input_dev_release+0xab/0xd0
device_release+0xcf/0x250
kobject_put+0x169/0x320
snd_disconnect+0x79/0x110
usb_unbind_interface+0x1a0/0x860
Fixes: b04dcbb7f7b1 ("ALSA: caiaq: Use snd_card_free_when_closed() at disconnection")
Cc: stable@vger.kernel.org
Signed-off-by: Sergei Nizovtsev <snizovtsev@cloudlinux.com>
Assisted-by: Claude:claude-opus-4-8
Link: https://patch.msgid.link/20261112094904.2430318-1-snizovtsev@cloudlinux.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/usb/caiaq/device.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -593,14 +593,19 @@ static void snd_disconnect(struct usb_in
snd_card_disconnect(card);
+ /*
+ * Kill the EP1 URB before disconnecting the input device: its
+ * completion reports into cdev->input_dev, which input_disconnect()
+ * frees without clearing the pointer.
+ */
+ usb_kill_urb(cdev->ep1_in_urb);
+ usb_kill_urb(cdev->midi_out_urb);
+
#ifdef CONFIG_SND_USB_CAIAQ_INPUT
snd_usb_caiaq_input_disconnect(cdev);
#endif
snd_usb_caiaq_audio_disconnect(cdev);
- usb_kill_urb(cdev->ep1_in_urb);
- usb_kill_urb(cdev->midi_out_urb);
-
snd_card_free_when_closed(card);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 652/990] ALSA: hda/realtek: Fix the Dell XPS 8940 headset microphone
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (650 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 651/990] ALSA: caiaq: Kill EP1 URB before unregistering the input device Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 653/990] ALSA: usb-audio: Drop capture packets with bogus actual_length Greg Kroah-Hartman
` (200 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Angel J, Takashi Iwai
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Angel J <iamanaws@httpd.dev>
commit ae28ba98f55a2f30fed57371899b8cecd7cbde64 upstream.
The Dell XPS 8940 (1028:09c5) has an ALC3861 codec (0x10ec0899).
Its BIOS marks the headset microphone pin at NID 0x19 as disconnected
(0x411111f0). With no external microphone input in the pin configuration,
the generic parser creates a shared headphone/mic input on NID 0x1b
instead. Headphone playback works, but the headset microphone is silent.
Override NID 0x19 as a front microphone without independent presence
detection. This gives the generic parser the dedicated microphone
input and preserves NID 0x1b for simultaneous headphone playback.
I encountered this issue on my XPS 8940. Similar symptoms were also
reported by a user on Ubuntu:
https://bugs.launchpad.net/bugs/1971232
Cc: stable@vger.kernel.org
Assisted-by: Codex (GPT-6.1 Sol)
Signed-off-by: Angel J <iamanaws@httpd.dev>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261103150336.507675-1-iamanaws@httpd.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/hda/codecs/realtek/alc882.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/sound/hda/codecs/realtek/alc882.c
+++ b/sound/hda/codecs/realtek/alc882.c
@@ -50,6 +50,7 @@ enum {
ALC889_FIXUP_MP41_VREF,
ALC882_FIXUP_INV_DMIC,
ALC882_FIXUP_NO_PRIMARY_HP,
+ ALC898_FIXUP_DELL_XPS8940_MIC,
ALC887_FIXUP_ASUS_BASS,
ALC887_FIXUP_BASS_CHMAP,
ALC1220_FIXUP_GB_DUAL_CODECS,
@@ -507,6 +508,13 @@ static const struct hda_fixup alc882_fix
.type = HDA_FIXUP_FUNC,
.v.func = alc882_fixup_no_primary_hp,
},
+ [ALC898_FIXUP_DELL_XPS8940_MIC] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+ { 0x19, 0x02a19130 }, /* headset mic, no separate jack detect */
+ {}
+ },
+ },
[ALC887_FIXUP_ASUS_BASS] = {
.type = HDA_FIXUP_PINS,
.v.pins = (const struct hda_pintbl[]) {
@@ -610,6 +618,8 @@ static const struct hda_quirk alc882_fix
SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
+ SND_PCI_QUIRK(0x1028, 0x09c5, "Dell XPS 8940",
+ ALC898_FIXUP_DELL_XPS8940_MIC),
SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 653/990] ALSA: usb-audio: Drop capture packets with bogus actual_length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (651 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 652/990] ALSA: hda/realtek: Fix the Dell XPS 8940 headset microphone Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 654/990] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set Greg Kroah-Hartman
` (199 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Gichoon Han, Takashi Iwai
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gichoon Han <gichoon.han@samsung.com>
commit eed0e9583a290e6adbe3a8480bdae911f31e1ed9 upstream.
retire_capture_urb() copies urb->iso_frame_desc[i].actual_length bytes
out of urb->transfer_buffer at the packet's offset, but never checks
that value against the requested packet length. A host controller
reporting more data than requested makes memcpy() read past the end
of the URB transfer buffer.
Commit 06be918062ad ("ALSA: usb-audio: Bound packet copies by the PCM
buffer size") clamps the count to the PCM ring buffer size, which
protects the destination. The source slot is only ep->curpacksize
bytes per packet, though, so the over-read remains.
This was hit on an ARM32 system (vendor 5.4 kernel; the code path is
unchanged in mainline) with a full-speed UAC1 microphone behind a
high-speed hub, i.e. the EHCI siTD path. sitd_complete() computes
actual_length as desc->length - SITD_LENGTH(t); the controller
reported a remaining length larger than the programmed one, the value
wrapped to ~4G, and the capture copy faulted on the first unmapped
page after the URB buffer:
Unable to handle kernel paging request at virtual address e8756000
Internal error: Oops: 7 [#1] PREEMPT SMP ARM
r3 : 00000000 r2 : 0001e700 r1 : e8756000 r0 : e878fc80
Code: ba000002 f5d1f03c f5d1f05c f5d1f07c (e8b151f8)
A packet can never legitimately carry more than its requested length,
so warn and skip it instead of copying.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Gichoon Han <gichoon.han@samsung.com>
Link: https://patch.msgid.link/20261110060021.2146383-1-gichoon.han@samsung.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/usb/pcm.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1337,6 +1337,12 @@ static void retire_capture_urb(struct sn
"frame %d active: %d\n", i,
urb->iso_frame_desc[i].status);
bytes = urb->iso_frame_desc[i].actual_length;
+ if (unlikely(bytes > urb->iso_frame_desc[i].length)) {
+ dev_warn_ratelimited(&subs->dev->dev,
+ "packet %d: actual_length %u exceeds length %u, dropping\n",
+ i, bytes, urb->iso_frame_desc[i].length);
+ continue;
+ }
if (subs->stream_offset_adj > 0) {
unsigned int adj = min(subs->stream_offset_adj, bytes);
cp += adj;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 654/990] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (652 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 653/990] ALSA: usb-audio: Drop capture packets with bogus actual_length Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 655/990] selftests/ftrace: Add missing spaces after ! in probe syntax tests Greg Kroah-Hartman
` (198 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Andrew Davison, Takashi Iwai
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Davison <andy@dvsn.net>
commit fda103c1432f344e1cd548f346d157b1e67ee7c5 upstream.
parse_codec_mode() reads the vendor and subsystem IDs of a patch file's
[codec] line into an int, and skips the check when the value is zero or
negative, as documented. An ID with bit 31 set, such as SigmaTel's
0x8384xxxx or Intel's 0x8086xxxx, comes out negative, so it is taken as
a wildcard and the section is applied to every codec instead of the one
it names.
This was seen on an OpenPeak OpenFrame 2 with an IDT 92HD75B2X5
(0x111d7608). A patch file written for the STAC9202 (0x83847632) in the
related OpenFrame 1 was applied to it, swapping the headphone and
speaker pin configurations, so auto-mute never muted the speaker.
Read the IDs as long long, so real IDs are compared exactly. Values
written as negative numbers (e.g. -1) still act as wildcards, as
documented; a hex value such as 0xffffffff is now compared as written.
Tested on 6.18.60 on an OpenFrame 2, with a rebuilt snd-hda-codec and
the STAC9202 patch file: user_pin_configs stays empty for the IDT codec,
and the headphone and line-out pins are assigned as the BIOS sets them.
Not tested on a STAC9202 itself.
The bug was tracked down and this fix written with an AI coding
assistant (Claude Code, Claude Opus 5.5), which also ran the tests
above. I have reviewed the change and the tests.
Fixes: ef940b0403d4 ("ALSA: hda - Allow patching with any vendor/subsystem ids")
Cc: stable@vger.kernel.org
Signed-off-by: Andrew Davison <andy@dvsn.net>
Link: https://patch.msgid.link/20261106175518.18629-1-andy@dvsn.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/hda/common/sysfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/sound/hda/common/sysfs.c
+++ b/sound/hda/common/sysfs.c
@@ -511,11 +511,12 @@ static inline int strmatch(const char *a
static void parse_codec_mode(char *buf, struct hda_bus *bus,
struct hda_codec **codecp)
{
- int vendorid, subid, caddr;
+ long long vendorid, subid;
+ int caddr;
struct hda_codec *codec;
*codecp = NULL;
- if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) {
+ if (sscanf(buf, "%lli %lli %i", &vendorid, &subid, &caddr) == 3) {
list_for_each_codec(codec, bus) {
if ((vendorid <= 0 || codec->core.vendor_id == vendorid) &&
(subid <= 0 || codec->core.subsystem_id == subid) &&
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 655/990] selftests/ftrace: Add missing spaces after ! in probe syntax tests
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (653 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 654/990] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 656/990] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Greg Kroah-Hartman
` (197 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jaewon Jung,
Masami Hiramatsu (Google), Shuah Khan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaewon Jung <jaewon8868@gmail.com>
commit 36990c8fda77d918b1e52d5d6df3a144b552d86e upstream.
Add the missing space between ! and grep. Otherwise, the shell tries
to run !grep and reports "!grep: not found". This always skips the
conditional checks without checking for kernel return probe argument
support.
Link: https://lore.kernel.org/r/20261025075044.1750113-1-jaewon8868@gmail.com
Fixes: 25f00e40ce79 ("tracing/probes: Support $argN in return probe (kprobe and fprobe)")
Cc: stable@vger.kernel.org
Signed-off-by: Jaewon Jung <jaewon8868@gmail.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/testing/selftests/ftrace/test.d/dynevent/fprobe_syntax_errors.tc | 4 ++--
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_syntax_errors.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_syntax_errors.tc
@@ -33,7 +33,7 @@ check_error 'f vfs_read ^$stack10000' #
check_error 'f vfs_read ^$arg10000' # BAD_ARG_NUM
-if !grep -q 'kernel return probes support:' README; then
+if ! grep -q 'kernel return probes support:' README; then
check_error 'f vfs_read $retval ^$arg1' # BAD_VAR
fi
check_error 'f vfs_read ^$none_var' # BAD_VAR
@@ -100,7 +100,7 @@ if grep -q "<argname>" README; then
check_error 'f vfs_read args=^$arg*' # BAD_VAR_ARGS
check_error 'f vfs_read +0(^$arg*)' # BAD_VAR_ARGS
check_error 'f vfs_read $arg* ^$arg*' # DOUBLE_ARGS
-if !grep -q 'kernel return probes support:' README; then
+if ! grep -q 'kernel return probes support:' README; then
check_error 'f vfs_read%return ^$arg*' # NOFENTRY_ARGS
fi
check_error 'f vfs_read ^hoge' # NO_BTFARG
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc
@@ -108,7 +108,7 @@ if grep -q "<argname>" README; then
check_error 'p vfs_read args=^$arg*' # BAD_VAR_ARGS
check_error 'p vfs_read +0(^$arg*)' # BAD_VAR_ARGS
check_error 'p vfs_read $arg* ^$arg*' # DOUBLE_ARGS
-if !grep -q 'kernel return probes support:' README; then
+if ! grep -q 'kernel return probes support:' README; then
check_error 'r vfs_read ^$arg*' # NOFENTRY_ARGS
fi
check_error 'p vfs_read+20 ^$arg*' # NOFENTRY_ARGS
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 656/990] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (654 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 655/990] selftests/ftrace: Add missing spaces after ! in probe syntax tests Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 657/990] kprobes: Fix error return and slot leak in __register_kprobe() Greg Kroah-Hartman
` (196 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Steven Rostedt,
Masami Hiramatsu (Google), Shuah Khan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <rostedt@goodmis.org>
commit 88d5f8cb8a6276194ac8c1de44f3ed77d7e938ce upstream.
The checkbashism is giving a false positive to the kprobe test of:
($"foo" should be eval_gettext "foo"):
if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
This is because it sees the $" at the end of the grep as a bash symbol.
Instead, escape the '$' with a backslash as it is within quotes and that
'$' is for grep to process an end of line character and not a bash
variable.
Link: https://lore.kernel.org/r/20261029211218.3749963a@fedora
Cc: stable@vger.kernel.org
Fixes: d22c3e0088e85 ("selftests/ftrace: Fix unique symbol check in kprobe_non_uniq_symbol.tc")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc
@@ -6,7 +6,7 @@
SYMBOL='name_show'
# We skip this test on kernel where SYMBOL is unique or does not exist.
-if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}$" /proc/kallsyms)" -le '1' ]; then
+if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}\$" /proc/kallsyms)" -le '1' ]; then
exit_unsupported
fi
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 657/990] kprobes: Fix error return and slot leak in __register_kprobe()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (655 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 656/990] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 658/990] kprobes: Fix double free and NULL deref in unregister_kretprobes() Greg Kroah-Hartman
` (195 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit 6a658cc2d605e5acf35e638c62f480460d5939cd upstream.
When arm_kprobe() fails in __register_kprobe(), the probe is removed
from kprobe_table and synchronize_rcu() is executed, but the error code
ret was ignored and try_to_optimize_kprobe(p) was executed, returning 0.
Additionally, the instruction slot allocated by prepare_kprobe() was
leaked.
Fix this by releasing the instruction slot via arch_remove_kprobe(p)
and returning ret when arm_kprobe() fails.
Link: https://lore.kernel.org/all/179375030756.247640.10859474201266455798.stgit@devnote2/
Fixes: 587e8e6d640b ("kprobes: Adopt guard() and scoped_guard()")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/kprobes.c | 2 ++
1 file changed, 2 insertions(+)
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1631,6 +1631,8 @@ static int __register_kprobe(struct kpro
if (ret) {
hlist_del_rcu(&p->hlist);
synchronize_rcu();
+ arch_remove_kprobe(p);
+ return ret;
}
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 658/990] kprobes: Fix double free and NULL deref in unregister_kretprobes()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (656 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 657/990] kprobes: Fix error return and slot leak in __register_kprobe() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 659/990] kprobes: Validate re-registration earlier in register_kretprobe() Greg Kroah-Hartman
` (194 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit 2053bac1d6e47b33fa2e570c87518395e64f7da0 upstream.
In unregister_kretprobes(), if __unregister_kprobe_top() returns an error
(e.g., if the kretprobe was not registered or was already unregistered),
rethook_free(rps[i]->rh) or rcu_assign_pointer(rps[i]->rph->rp, NULL) is
still executed. For rethook-based kretprobes, calling rethook_free() on an
already-freed rethook causes a double-free / list corruption in RCU. For
legacy kretprobes, rps[i]->rph is NULL after previous cleanup, resulting
in a NULL pointer dereference.
Skip rethook_free() and rph cleanup if __unregister_kprobe_top() fails,
and clear rps[i]->rh after synchronize_rcu() has waited for in-flight
pre_handler_kretprobe() invocations to complete.
Link: https://lore.kernel.org/all/179375031660.247640.6349602689169856649.stgit@devnote2/
Fixes: 73f9b911faa7 ("kprobes: Use rethook for kretprobe if possible")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/kprobes.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2290,8 +2290,10 @@ void unregister_kretprobes(struct kretpr
for (i = 0; i < num; i++) {
guard(mutex)(&kprobe_mutex);
- if (__unregister_kprobe_top(&rps[i]->kp) < 0)
+ if (__unregister_kprobe_top(&rps[i]->kp) < 0) {
rps[i]->kp.addr = NULL;
+ continue;
+ }
#ifdef CONFIG_KRETPROBE_ON_RETHOOK
rethook_free(rps[i]->rh);
#else
@@ -2303,7 +2305,9 @@ void unregister_kretprobes(struct kretpr
for (i = 0; i < num; i++) {
if (rps[i]->kp.addr) {
__unregister_kprobe_bottom(&rps[i]->kp);
-#ifndef CONFIG_KRETPROBE_ON_RETHOOK
+#ifdef CONFIG_KRETPROBE_ON_RETHOOK
+ rps[i]->rh = NULL;
+#else
free_rp_inst(rps[i]);
#endif
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 659/990] kprobes: Validate re-registration earlier in register_kretprobe()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (657 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 658/990] kprobes: Fix double free and NULL deref in unregister_kretprobes() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 660/990] mmc: jz4740: Remove the host before resetting the controller Greg Kroah-Hartman
` (193 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit a553b499f22bf054964d4fd16d136f3d4f836c23 upstream.
register_kretprobe() only checked for re-registration if rp->kp.addr was
specified, skipping the check when rp was registered with symbol_name
and rp->kp.addr was NULL. In that scenario, register_kretprobe()
proceeded to allocate a new rethook (or kretprobe holder), and when
register_kprobe(&rp->kp) subsequently failed due to re-registration, the
error path freed and NULL-ed rp->rh (or rp->rph) on the still-active
kretprobe, leading to NULL pointer dereferences when the active probe
was hit.
Resolve the target address via _kprobe_addr() up-front and check whether
the probe is already registered at that address via
check_kprobe_rereg_at() before allocating any resources, and drop the
WARN_ON_ONCE() in the re-registration check now that re-registration is
gracefully detected and rejected.
Link: https://lore.kernel.org/all/179375032568.247640.17429793187163536192.stgit@devnote2/
Fixes: 0188b87899ff ("kretprobe: Avoid re-registration of the same kretprobe earlier")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/kprobes.c | 72 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 40 insertions(+), 32 deletions(-)
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1478,52 +1478,61 @@ _kprobe_addr(kprobe_opcode_t *addr, cons
return addr;
}
-static kprobe_opcode_t *kprobe_addr(struct kprobe *p)
-{
- bool on_func_entry;
-
- return _kprobe_addr(p->addr, p->symbol_name, p->offset, &on_func_entry);
-}
-
/*
* Check the 'p' is valid and return the aggregator kprobe
* at the same address.
*/
-static struct kprobe *__get_valid_kprobe(struct kprobe *p)
+static struct kprobe *__get_valid_kprobe_at(struct kprobe *p, kprobe_opcode_t *addr)
{
+ struct hlist_head *head;
struct kprobe *ap, *list_p;
lockdep_assert_held(&kprobe_mutex);
- ap = get_kprobe(p->addr);
- if (unlikely(!ap))
+ if (unlikely(!addr))
return NULL;
- if (p == ap)
- return ap;
-
- list_for_each_entry(list_p, &ap->list, list)
- if (list_p == p)
- /* kprobe p is a valid probe */
+ head = &kprobe_table[hash_ptr(addr, KPROBE_HASH_BITS)];
+ hlist_for_each_entry_rcu(ap, head, hlist,
+ lockdep_is_held(&kprobe_mutex)) {
+ if (ap == p) {
+ p->addr = addr;
return ap;
+ }
+ if (ap->addr == addr && kprobe_aggrprobe(ap)) {
+ list_for_each_entry(list_p, &ap->list, list) {
+ if (list_p == p) {
+ p->addr = addr;
+ return ap;
+ }
+ }
+ }
+ }
return NULL;
}
-/*
- * Warn and return error if the kprobe is being re-registered since
- * there must be a software bug.
- */
-static inline int warn_kprobe_rereg(struct kprobe *p)
+static inline struct kprobe *__get_valid_kprobe(struct kprobe *p)
+{
+ return __get_valid_kprobe_at(p, p->addr);
+}
+
+/* Return error if the kprobe is being re-registered */
+static inline int check_kprobe_rereg_at(struct kprobe *p, kprobe_opcode_t *addr)
{
guard(mutex)(&kprobe_mutex);
- if (WARN_ON_ONCE(__get_valid_kprobe(p)))
+ if (__get_valid_kprobe_at(p, addr))
return -EINVAL;
return 0;
}
+static inline int check_kprobe_rereg(struct kprobe *p)
+{
+ return check_kprobe_rereg_at(p, p->addr);
+}
+
static int check_ftrace_location(struct kprobe *p)
{
unsigned long addr = (unsigned long)p->addr;
@@ -1654,7 +1663,7 @@ int register_kprobe(struct kprobe *p)
return PTR_ERR(addr);
p->addr = addr;
- ret = warn_kprobe_rereg(p);
+ ret = check_kprobe_rereg(p);
if (ret)
return ret;
@@ -2190,20 +2199,19 @@ int register_kretprobe(struct kretprobe
int ret;
int i;
void *addr;
+ bool on_func_entry;
- ret = kprobe_on_func_entry(rp->kp.addr, rp->kp.symbol_name, rp->kp.offset);
- if (ret)
- return ret;
+ addr = _kprobe_addr(rp->kp.addr, rp->kp.symbol_name, rp->kp.offset, &on_func_entry);
+ if (IS_ERR(addr))
+ return PTR_ERR(addr);
+
+ if (!on_func_entry)
+ return -EINVAL;
- /* If only 'rp->kp.addr' is specified, check reregistering kprobes */
- if (rp->kp.addr && warn_kprobe_rereg(&rp->kp))
+ if (check_kprobe_rereg_at(&rp->kp, addr))
return -EINVAL;
if (kretprobe_blacklist_size) {
- addr = kprobe_addr(&rp->kp);
- if (IS_ERR(addr))
- return PTR_ERR(addr);
-
for (i = 0; kretprobe_blacklist[i].name != NULL; i++) {
if (kretprobe_blacklist[i].addr == addr)
return -EINVAL;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 660/990] mmc: jz4740: Remove the host before resetting the controller
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (658 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 659/990] kprobes: Validate re-registration earlier in register_kretprobe() Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 661/990] mmc: sunxi: fix clock and runtime PM leaks on probe failure Greg Kroah-Hartman
` (192 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Olivier Louvignes, Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Louvignes <olivier@mgcrea.io>
commit 6b8b1e8827837bf4cf1f87219038fddae9e81b0b upstream.
jz4740_mmc_remove() masks every interrupt and resets the controller
before mmc_remove_host(), which removes the card and lets the card's
driver send its last commands. Those commands then run on a controller
that was just reset, and can wait out the driver's 5 s request timeout.
With an SDIO card that cost 5 s on every unbind: on a HiBy R1 (Ingenic
X1600, a BCM43430A1 driven by brcmfmac), the CMD52 that
sdio_release_irq() sends from brcmfmac's remove waited 5.1 s. The
command had finished (END_CMD_RES set in MSC_STAT), but MSC_IMASK read
0xffffffff although the request had unmasked END_CMD_RES. MSC_STAT can
still show IS_RESETTING after jz4740_mmc_reset() returns, so the reset
most likely completed after that write and undid it.
Remove the host first, then quiesce the controller, as other host
drivers do. On the R1, unbinding the Wi-Fi's MSC now takes 0.65 s.
Fixes: 61bfbdb85687 ("MMC: Add support for the controller on JZ4740 SoCs.")
Cc: stable@vger.kernel.org
Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/jz4740_mmc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -1151,12 +1151,13 @@ static void jz4740_mmc_remove(struct pla
{
struct jz4740_mmc_host *host = platform_get_drvdata(pdev);
+ /* The card's driver may still send commands as it goes */
+ mmc_remove_host(host->mmc);
+
timer_delete_sync(&host->timeout_timer);
jz4740_mmc_set_irq_enabled(host, 0xff, false);
jz4740_mmc_reset(host);
- mmc_remove_host(host->mmc);
-
free_irq(host->irq, host);
if (host->use_dma)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 661/990] mmc: sunxi: fix clock and runtime PM leaks on probe failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (659 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 660/990] mmc: jz4740: Remove the host before resetting the controller Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 662/990] mmc: mmci: fix DMA channel leak when mmc_add_host() fails Greg Kroah-Hartman
` (191 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Anfernee Cao, Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anfernee Cao <anferneemelokc5@gmail.com>
commit e35e360bd66898a977c296ab71fe4bae17ddceb7 upstream.
sunxi_mmc_resource_request() enables the bus, card, output and sample
clocks before returning. Several failure paths later in
sunxi_mmc_probe() leave them running:
- If devm_request_threaded_irq() fails, the clocks enabled by
sunxi_mmc_enable() are never disabled.
- If dma_alloc_coherent(), mmc_of_parse() or sunxi_mmc_init_host()
fails, probe only frees the DMA buffer and the mmc_host.
- If mmc_add_host() fails, runtime PM has already been enabled, but
pm_runtime_disable() is never called.
Besides leaking the clocks, this leaves the clock enable counts
unbalanced, so a reprobe (for example after -EPROBE_DEFER) calls
clk_prepare_enable() on the same clocks again.
Disable the IRQ and the clocks in the probe error path, and disable
runtime PM on the mmc_add_host() failure path. Also handle a failure of
devm_request_threaded_irq() in sunxi_mmc_resource_request().
Tested with QEMU's orangepi-pc machine: with forced sunxi_mmc_init_host()
and mmc_add_host() failures the MMC clocks stay disabled in clk_summary,
and a normal probe with an emulated SD card still works.
This issue was found by manual code inspection.
Fixes: 3cbcb16095f9 ("mmc: sunxi: Add driver for SD/MMC hosts found on Allwinner sunxi SoCs")
Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support")
Cc: stable@vger.kernel.org # v4.18+
Signed-off-by: Anfernee Cao <anferneemelokc5@gmail.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/sunxi-mmc.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1355,8 +1355,13 @@ static int sunxi_mmc_resource_request(st
goto error_disable_mmc;
}
- return devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq,
- sunxi_mmc_handle_manual_stop, 0, "sunxi-mmc", host);
+ ret = devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq,
+ sunxi_mmc_handle_manual_stop, 0,
+ "sunxi-mmc", host);
+ if (ret)
+ goto error_disable_mmc;
+
+ return 0;
error_disable_mmc:
sunxi_mmc_disable(host);
@@ -1386,9 +1391,11 @@ static int sunxi_mmc_probe(struct platfo
host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
&host->sg_dma, GFP_KERNEL);
- if (!host->sg_cpu)
- return dev_err_probe(&pdev->dev, -ENOMEM,
- "Failed to allocate DMA descriptor mem\n");
+ if (!host->sg_cpu) {
+ ret = dev_err_probe(&pdev->dev, -ENOMEM,
+ "Failed to allocate DMA descriptor mem\n");
+ goto error_disable_mmc;
+ }
if (host->cfg->ccu_has_timings_switch) {
/*
@@ -1468,7 +1475,7 @@ static int sunxi_mmc_probe(struct platfo
ret = mmc_add_host(mmc);
if (ret)
- goto error_free_dma;
+ goto error_disable_rpm;
dev_info(&pdev->dev, "initialized, max. request size: %u KB%s\n",
mmc->max_req_size >> 10,
@@ -1476,8 +1483,13 @@ static int sunxi_mmc_probe(struct platfo
return 0;
+error_disable_rpm:
+ pm_runtime_disable(&pdev->dev);
error_free_dma:
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
+error_disable_mmc:
+ disable_irq(host->irq);
+ sunxi_mmc_disable(host);
return ret;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 662/990] mmc: mmci: fix DMA channel leak when mmc_add_host() fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (660 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 661/990] mmc: sunxi: fix clock and runtime PM leaks on probe failure Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 663/990] mmc: omap: synchronize clock timer before disabling fclk Greg Kroah-Hartman
` (190 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Anfernee Cao, Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anfernee Cao <anferneemelokc5@gmail.com>
commit 2d8927fadbf95e2d2dfa95bcc73882d6e19c2ce4 upstream.
mmci_probe() calls mmci_dma_setup(), which acquires the RX and TX DMA
channels via dma_request_chan(). These channels are not managed by
devres, and are released only by mmci_dma_release().
If the following mmc_add_host() fails, probe jumps to the clk_disable
label, which only disables the clock. As probe then fails,
mmci_remove() is never called, so both DMA channels are leaked.
Release them by adding a dedicated unwind label, reached only after
mmci_dma_setup().
This issue was found by manual code inspection.
Fixes: b38a20f29a49 ("mmc: mmci: fix return value check of mmc_add_host()")
Cc: stable@vger.kernel.org
Signed-off-by: Anfernee Cao <anferneemelokc5@gmail.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/mmci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -2477,11 +2477,13 @@ static int mmci_probe(struct amba_device
ret = mmc_add_host(mmc);
if (ret)
- goto clk_disable;
+ goto dma_release;
pm_runtime_put(&dev->dev);
return 0;
+dma_release:
+ mmci_dma_release(host);
clk_disable:
clk_disable_unprepare(host->clk);
return ret;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 663/990] mmc: omap: synchronize clock timer before disabling fclk
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (661 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 662/990] mmc: mmci: fix DMA channel leak when mmc_add_host() fails Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 664/990] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B Greg Kroah-Hartman
` (189 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Runyu Xiao, Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Runyu Xiao <runyu.xiao@seu.edu.cn>
commit c931c51681e33b24bc8d65c6df35b70e1827daa2 upstream.
mmc_omap_select_slot() removes clk_timer with timer_delete() before
switching slots and changing the functional clock state. timer_delete()
only removes a pending timer and does not wait for a callback that is
already running.
If mmc_omap_clk_timer() is already running, it can therefore call
mmc_omap_fclk_enable() while the request or slot-switch path changes the
same clock state. During host removal, the same window can overlap the
final clock shutdown.
Use timer_delete_sync() so the callback has completed before slot switching
or changing the functional clock state. Keep the timer restartable for
normal request handling.
Fixes: 0807a9b5739a ("MMC: OMAP: Lazy clock shutdown")
Cc: stable@vger.kernel.org
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/omap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -214,7 +214,7 @@ static void mmc_omap_select_slot(struct
host->mmc = slot->mmc;
spin_unlock_irqrestore(&host->slot_lock, flags);
no_claim:
- timer_delete(&host->clk_timer);
+ timer_delete_sync(&host->clk_timer);
if (host->current_slot != slot || !claimed)
mmc_omap_fclk_offdelay(host->current_slot);
@@ -273,7 +273,7 @@ static void mmc_omap_release_slot(struct
/* Keeps clock running for at least 8 cycles on valid freq */
mod_timer(&host->clk_timer, jiffies + HZ/10);
else {
- timer_delete(&host->clk_timer);
+ timer_delete_sync(&host->clk_timer);
mmc_omap_fclk_offdelay(slot);
mmc_omap_fclk_enable(host, 0);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 664/990] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (662 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 663/990] mmc: omap: synchronize clock timer before disabling fclk Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 665/990] mmc: meson-gx: report busy from DAT0 alone Greg Kroah-Hartman
` (188 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Adrian Hunter, Ian Ray, Haibo Chen,
Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Ray <ian.ray@gehealthcare.com>
commit d35d93c2902592a84347a15deac4d67a323694c9 upstream.
Since commit 5a52c5701a67 ("mmc: core: Fix host controller programming
for fixed driver type"), the eMMC driver strength is passed directly to
mmc_set_driver_type(), which propagates the value through ios.drv_type
all the way to sdhci_set_ios(). For value 4, SDHCI correctly warns:
mmc2: invalid driver type, default to driver type B
The host driver type has no effect on this controller: esdhc_writew_le()
never programs the driver-type field of SDHCI_HOST_CONTROL2. Hook
set_ios() and force drv_type to the always-valid Type B, so that SDHCI
never sees an unsupported value.
Tested on i.MX8MP (usdhc3, eMMC in HS400) with
`fixed-emmc-driver-type = <4>`: the warning is gone and the HS_TIMING
register contains 0x43 as expected.
Fixes: 5a52c5701a67 ("mmc: core: Fix host controller programming for fixed driver type")
Link: https://lore.kernel.org/all/20260926122908.866-1-ian.ray@gehealthcare.com/
Cc: stable@vger.kernel.org
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1131,6 +1131,20 @@ static void esdhc_reset_tuning(struct sd
}
}
+static void sdhci_esdhc_imx_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
+{
+ /*
+ * This controller has no driver-type control: esdhc_writew_le()
+ * discards the driver-type field when writing SDHCI_HOST_CONTROL2.
+ * The programmed value is therefore irrelevant, but SDHCI rejects
+ * non-SD values such as 4 (eMMC 40 ohm, from fixed-emmc-driver-type).
+ * Force an always-valid Type B.
+ */
+ ios->drv_type = MMC_SET_DRIVER_TYPE_B;
+
+ sdhci_set_ios(mmc, ios);
+}
+
static void usdhc_init_card(struct mmc_host *mmc, struct mmc_card *card)
{
struct sdhci_host *host = mmc_priv(mmc);
@@ -1929,6 +1943,9 @@ static int sdhci_esdhc_imx_probe(struct
host->max_timeout_count = 0xF;
}
+ /* No SDHCI driver type control */
+ host->mmc_host_ops.set_ios = sdhci_esdhc_imx_set_ios;
+
if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
sdhci_esdhc_ops.platform_execute_tuning =
esdhc_executing_tuning;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 665/990] mmc: meson-gx: report busy from DAT0 alone
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (663 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 664/990] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 666/990] mmc: meson-gx: honour the busy timeout for R1b commands Greg Kroah-Hartman
` (187 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit 318fdb75f4dc9d18ae621b9fb25eb11160c95649 upstream.
meson_mmc_card_busy() reports busy only while DAT0..3 are all low. A
busy card drives DAT0 low and leaves DAT1..3 to the pull-ups, and the
callback is defined as "Check if the card is pulling dat[0] low". So a
busy card is reported free, and the core, which prefers card_busy over
CMD13 in mmc_busy_cb(), stops polling after CMD6 and erase at once. The
controller hides this on R1b commands, where it waits for busy itself.
Once max_busy_timeout is reported, the core sends the longer waits, the
120 s BKOPS and 240 s sanitize switches among them, as R1 and has only
the polling left.
Look at DAT0 only, as sdhci_card_busy() does. The checks around the
voltage switch in mmc_set_uhs_voltage() still hold: the card drives
DAT0..3 low together after CMD11 and keeps them low together on
failure.
Fixes: 186cd8b7f586 ("mmc: meson-gx: implement card_busy callback")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1079,8 +1079,8 @@ static int meson_mmc_card_busy(struct mm
regval = readl(host->regs + SD_EMMC_STATUS);
- /* We are only interrested in lines 0 to 3, so mask the other ones */
- return !(FIELD_GET(STATUS_DATI, regval) & 0xf);
+ /* The card signals busy on DAT0 alone. */
+ return !(FIELD_GET(STATUS_DATI, regval) & BIT(0));
}
static int meson_mmc_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 666/990] mmc: meson-gx: honour the busy timeout for R1b commands
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (664 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 665/990] mmc: meson-gx: report busy from DAT0 alone Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 667/990] mmc: meson-gx: report the longest busy wait the controller can do Greg Kroah-Hartman
` (186 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit 7e3cc541aa5855bc36e6cbffa82efc2795955a10 upstream.
For a command without data the driver programs a fixed 1024 ms into the
CMD_CFG timeout field, and for R1b the controller waits for the card to
release busy within that time. The core sends erase and cache flush as
R1b with busy timeouts of up to 60 s and 30 s, and the controller gives
up after one second:
mmc_erase: erase error -110, status 0x0
mmc1: cache flush error -110
Program the timeout from cmd->busy_timeout, kept between 1024 ms, the
fixed value until now, and 32768 ms, the most the field holds, and
rounded up to a power of two. The clamp comes first: MMC_IOC_CMD passes
cmd_timeout_ms from user space straight into busy_timeout, and
roundup_pow_of_two() of a value above 2^31 does not fit in unsigned
int. sdhci takes its command timeout from cmd->busy_timeout in the
same way.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -214,6 +214,20 @@ static unsigned int meson_mmc_get_timeou
return min(timeout, 32768U); /* max. 2^15 ms */
}
+/* For R1b the controller waits for busy to be released within this timeout. */
+static unsigned int meson_mmc_get_cmd_timeout_msecs(struct mmc_command *cmd)
+{
+ unsigned int timeout = cmd->busy_timeout;
+
+ if (!timeout)
+ return SD_EMMC_CMD_TIMEOUT;
+
+ timeout = clamp_t(unsigned int, timeout, SD_EMMC_CMD_TIMEOUT,
+ SD_EMMC_CMD_TIMEOUT_MAX);
+
+ return roundup_pow_of_two(timeout);
+}
+
static struct mmc_command *meson_mmc_get_next_command(struct mmc_command *cmd)
{
if (cmd->opcode == MMC_SET_BLOCK_COUNT && !cmd->error)
@@ -840,7 +854,7 @@ static void meson_mmc_start_cmd(struct m
cmd_data = host->bounce_dma_addr & CMD_DATA_MASK;
} else {
cmd_cfg |= FIELD_PREP(CMD_CFG_TIMEOUT_MASK,
- ilog2(SD_EMMC_CMD_TIMEOUT));
+ ilog2(meson_mmc_get_cmd_timeout_msecs(cmd)));
}
/* Last descriptor */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 667/990] mmc: meson-gx: report the longest busy wait the controller can do
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (665 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 666/990] mmc: meson-gx: honour the busy timeout for R1b commands Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 668/990] mmc: meson-gx: name the limit of the CMD_CFG timeout field Greg Kroah-Hartman
` (185 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit 18e9f7fb05ada68d491ff49165b9644f790e0e0c upstream.
The driver does not set max_busy_timeout, so the core takes the host
for one that can wait for busy indefinitely and sends erase and cache
flush as R1b with busy timeouts of up to 60 s and 30 s. The CMD_CFG
timeout field holds at most 32768 ms, so the controller times out first.
Report 32768 ms as max_busy_timeout. The core then sizes discards to
fit and, for a longer wait, sends R1 and polls for busy itself.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1180,6 +1180,9 @@ static int meson_mmc_probe(struct platfo
mmc->caps |= MMC_CAP_CMD23;
+ /* The longest busy wait the CMD_CFG timeout field can hold. */
+ mmc->max_busy_timeout = SD_EMMC_CMD_TIMEOUT_MAX;
+
if (mmc->caps & MMC_CAP_SDIO_IRQ)
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 668/990] mmc: meson-gx: name the limit of the CMD_CFG timeout field
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (666 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 667/990] mmc: meson-gx: report the longest busy wait the controller can do Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 669/990] errseq: dont let errseq_check_and_advance() hide later errors Greg Kroah-Hartman
` (184 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Igor Velkov, Neil Armstrong,
Ulf Hansson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Velkov <iav@iav.lv>
commit e1644210d15f7f8adbe6315199b4b73bead63a2c upstream.
The data timeout is capped at a literal 32768 ms with a comment next to
it. Give the limit a name beside the other timeout constants.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Igor Velkov <iav@iav.lv>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/mmc/host/meson-gx-mmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -125,6 +125,7 @@
#define SD_EMMC_CFG_RESP_TIMEOUT 256 /* in clock cycles */
#define SD_EMMC_CMD_TIMEOUT 1024 /* in ms */
#define SD_EMMC_CMD_TIMEOUT_DATA 4096 /* in ms */
+#define SD_EMMC_CMD_TIMEOUT_MAX 32768 /* in ms, 2^15: limit of CMD_CFG_TIMEOUT_MASK */
#define SD_EMMC_CFG_CMD_GAP 16 /* in clock cycles */
#define SD_EMMC_DESC_BUF_LEN PAGE_SIZE
@@ -211,7 +212,7 @@ static unsigned int meson_mmc_get_timeou
timeout = roundup_pow_of_two(timeout);
- return min(timeout, 32768U); /* max. 2^15 ms */
+ return min_t(unsigned int, timeout, SD_EMMC_CMD_TIMEOUT_MAX);
}
/* For R1b the controller waits for busy to be released within this timeout. */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 669/990] errseq: dont let errseq_check_and_advance() hide later errors
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (667 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 668/990] mmc: meson-gx: name the limit of the CMD_CFG timeout field Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 670/990] backing-file: pass RWF_NOAPPEND to synchronous writes Greg Kroah-Hartman
` (183 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Shashank Mohan Jain, Jan Kara,
Jeff Layton, Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Mohan Jain <jain.sm@gmail.com>
commit 94defd41d80f10bbe883c0c8d1b28d1665b6b153 upstream.
errseq_check_and_advance() reads the errseq_t, sets ERRSEQ_SEEN with a
cmpxchg() and then advances *since to the value it computed, ignoring
whether the cmpxchg() succeeded. When it fails because errseq_set()
recorded a different error in the meantime, *since ends up holding a
value that was never stored in the errseq_t.
errseq_set() only bumps the counter when ERRSEQ_SEEN is set. So as long
as nobody has seen the new error, recording the original errno again
recreates exactly the old value, and once another subscriber marks it
seen, it is equal to the stale *since. The next check through that
cursor then reports nothing, although -ENOSPC was recorded after the
value that check reported, and -EIO was recorded again after it
returned:
cursor f writeback cursor g
-------- --------- --------
set(-EIO)
check_and_advance(&f)
old = [c, EIO]
set(-ENOSPC)
-> [c, ENOSPC]
cmpxchg() fails
f = [c, EIO, SEEN]
returns -EIO
set(-EIO)
-> [c, EIO]
(no bump: unseen)
check_and_advance(&g)
-> [c, EIO, SEEN]
returns -EIO
check_and_advance(&f)
[c, EIO, SEEN] == f
returns 0 <- -ENOSPC and the second -EIO are lost
For file->f_wb_err this means that fsync() on one descriptor can return
0 although writeback failed after the previous fsync() on that
descriptor returned, when writeback errors race with fsync() on another
descriptor of the same file. The same applies to syncfs() through
sb->s_wb_err, which every file on the filesystem shares, and to the
ext4 and jbd2 cursors on the block device mapping. The kernel-doc
promises "Negative errno if one has been stored, or 0 if no new error
has occurred".
Retry with the value found when the cmpxchg() fails, so that *since is
only ever advanced to a value that was actually stored with ERRSEQ_SEEN
set. Every later errseq_set() then has to bump the counter, and the
error is reported. The retry loop terminates because each iteration
needs a concurrent update, like the loop in errseq_set().
A TLA+ model of errseq_set() and errseq_check_and_advance(), checked
with the TLC model checker, finds the lost error with the current code;
with this change TLC checks that an error recorded after a check
returned is always reported by the next check (exhaustively for two
subscribers with three checks each, and one writer recording four
errors or two writers recording two each). The KUnit race test added
in the next patch misses the error in 1-6% of 2 million rounds on
4-CPU UML before this change (depending on host load), and in none
after it.
Fixes: 84cbadadc6ea ("lib: add errseq_t type and infrastructure for handling it")
Cc: stable@vger.kernel.org
Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com>
Link: https://patch.msgid.link/20260927051726.71337-2-jain.sm@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/errseq.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -162,7 +162,8 @@ EXPORT_SYMBOL(errseq_check);
* points to. If it does, then just return 0.
*
* If it doesn't, then the value has changed. Set the "seen" flag, and try to
- * swap it into place as the new eseq value. Then, set that value as the new
+ * swap it into place as the new eseq value. If the swap fails because the
+ * value changed, retry with the new value. Then, set that value as the new
* "since" value, and return whatever the error portion is set to.
*
* Note that no locking is provided here for concurrent updates to the "since"
@@ -184,24 +185,30 @@ int errseq_check_and_advance(errseq_t *e
* to take the lock that protects the "since" value.
*/
old = READ_ONCE(*eseq);
- if (old != *since) {
+ while (old != *since) {
/*
* Set the flag and try to swap it into place if it has
* changed.
*
- * We don't care about the outcome of the swap here. If the
- * swap doesn't occur, then it has either been updated by a
- * writer who is altering the value in some way (updating
- * counter or resetting the error), or another reader who is
- * just setting the "seen" flag. Either outcome is OK, and we
- * can advance "since" and return an error based on what we
- * have.
+ * If the swap fails, a writer or another reader changed the
+ * value under us, so retry with the new value. "since" must
+ * only ever be set to a value that was stored with the SEEN
+ * flag: errseq_set() does not bump the counter while the
+ * flag is clear, so an unstored value could come back later
+ * and hide the errors that were recorded in the meantime.
*/
new = old | ERRSEQ_SEEN;
- if (new != old)
- cmpxchg(eseq, old, new);
+ if (new != old) {
+ errseq_t cur = cmpxchg(eseq, old, new);
+
+ if (cur != old) {
+ old = cur;
+ continue;
+ }
+ }
*since = new;
err = -(new & ERRNO_MASK);
+ break;
}
return err;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 670/990] backing-file: pass RWF_NOAPPEND to synchronous writes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (668 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 669/990] errseq: dont let errseq_check_and_advance() hide later errors Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 671/990] pidfd: restrict task access ioctls to the callers pid namespace Greg Kroah-Hartman
` (182 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chris Mason, Amir Goldstein,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <mason@kernel.org>
commit afa735786a89bde4959db52f20e3579de54ec740 upstream.
pwritev2() with RWF_NOAPPEND ignores the offset and appends the data on
an overlayfs or FUSE passthrough file that was opened with O_APPEND, and
the call still returns success. The flag must make the write go to the
given offset even though the file is in append mode. Any user who can
write to the file is affected, with the default mount options.
overlayfs and FUSE passthrough forward the reads and writes on their
files to a backing file on an underlying filesystem, through the helpers
in fs/backing-file.c.
The flag works for the file that the user opened: kiocb_set_rw_flags()
clears IOCB_APPEND in the write's kiocb. It also copies RWF_NOAPPEND
into ki_flags, as it does with every RWF_ flag.
overlayfs and FUSE passthrough then pass the write on to the backing
file. They opened it with the open flags of the user's file, so it is in
append mode too.
For a synchronous write, do_backing_file_write_iter() calls
vfs_iter_write(), which sets up a new kiocb for the backing file. That
kiocb starts out with IOCB_APPEND set. vfs_iter_write() is only given
the flags of the user's kiocb that are in BACKING_IOCB_MASK, and
RWF_NOAPPEND is not one of them. So nothing clears IOCB_APPEND again,
and the data goes to the end of the file while the call returns success.
An asynchronous write reuses the flags of the user's kiocb and is not
affected.
Reproduced by calling pwritev2() with RWF_NOAPPEND at offset 0, on an
overlayfs file and on a FUSE passthrough file opened with O_APPEND: the
data was at the end of the file afterwards.
Fix this by adding RWF_NOAPPEND to BACKING_IOCB_MASK.
Fixes: 73fa7547c70b ("vfs: add RWF_NOAPPEND flag for pwritev2")
Cc: stable@vger.kernel.org
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20261101123440.3184069-1-amir73il@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/backing-file.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/fs/backing-file.c
+++ b/fs/backing-file.c
@@ -114,8 +114,13 @@ struct backing_aio {
static struct kmem_cache *backing_aio_cachep;
+/*
+ * RWF_NOAPPEND stays set in ki_flags. Pass it on, because the backing file is
+ * in append mode as well and a new kiocb for it starts with IOCB_APPEND.
+ */
#define BACKING_IOCB_MASK \
- (IOCB_NOWAIT | IOCB_HIPRI | IOCB_DSYNC | IOCB_SYNC | IOCB_APPEND)
+ (IOCB_NOWAIT | IOCB_HIPRI | IOCB_DSYNC | IOCB_SYNC | IOCB_APPEND | \
+ (__force int) RWF_NOAPPEND)
static rwf_t iocb_to_rw_flags(int flags)
{
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 671/990] pidfd: restrict task access ioctls to the callers pid namespace
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (669 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 670/990] backing-file: pass RWF_NOAPPEND to synchronous writes Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 672/990] eventpoll: wake the next waiter when a woken waiter is killed Greg Kroah-Hartman
` (181 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jann Horn, Christian Brauner,
Chen Linxuan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Linxuan <me@black-desk.cn>
commit ee8323fdc827c580425644db605a4be776cace57 upstream.
pidfds can cross pid namespace boundaries: a task may obtain one for a
process outside of its own pid namespace hierarchy through SO_PASSPIDFD
or SO_PEERPIDFD, via SCM_RIGHTS, or through file descriptor inheritance.
The namespace ioctls gate access with a ptrace check against the
target's credentials only. That check does not account for the pid
namespace relationship between the caller and the target, so a task
inside a pid namespace can use a pidfd obtained across that boundary to
acquire namespace file descriptors of a task outside of its hierarchy.
procfs exposes the equivalent information only for tasks visible in the
reader's pid namespace, and PIDFD_GET_INFO already answers with -EREMOTE
for targets outside the caller's hierarchy. Extend that policy to the
namespace ioctls: fail with -EREMOTE unless the target is visible in the
caller's active pid namespace. Callers in ancestor pid namespaces are
unaffected.
Unlike PIDFD_GET_INFO, the visibility check is performed after the task
lookup here, so reaped targets outside of the caller's pid namespace
hierarchy answer -ESRCH instead of -EREMOTE.
Link: https://lore.kernel.org/all/CAG48ez1T5-tUHVK_iHsgUtWa-inVdrZxA3E-ZCW0iENJvasKfg@mail.gmail.com
Link: https://lore.kernel.org/all/20260925-gewischt-auftrag-tierzucht-c153cb3f9f74@brauner
Suggested-by: Jann Horn <jannh@google.com>
Suggested-by: Christian Brauner <brauner@kernel.org>
Fixes: 5b08bd408534 ("pidfs: allow retrieval of namespace file descriptors")
Cc: stable@vger.kernel.org
Signed-off-by: Chen Linxuan <me@black-desk.cn>
Link: https://patch.msgid.link/20261027-pidfd-task-access-v1-1-d46cf0fa4ca1@black-desk.cn
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/pidfs.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -514,6 +514,14 @@ static long pidfd_ioctl(struct file *fil
return -EINVAL;
/*
+ * Require the target to be visible in the caller's pid namespace
+ * for operations that grant access to its resources, mirroring
+ * procfs and PIDFD_GET_INFO.
+ */
+ if (!pid_in_current_pidns(pidfd_pid(file)))
+ return -EREMOTE;
+
+ /*
* We're trying to open a file descriptor to the namespace so perform a
* filesystem cred ptrace check. Hold @task's exec_update_lock for the
* duration of the ptrace check and the namespace lookup so that the
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 672/990] eventpoll: wake the next waiter when a woken waiter is killed
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (670 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 671/990] pidfd: restrict task access ioctls to the callers pid namespace Greg Kroah-Hartman
@ 2026-11-25 14:33 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 673/990] aio: dont let exit_aio() return before complete() is done Greg Kroah-Hartman
` (180 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:33 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mani Tofigh,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mani Tofigh <mt4022@columbia.edu>
commit 9f4413e522faed76f4cf610098b2369eb3ba1f1c upstream.
Processes sharing an epoll instance can sleep forever while an event is
ready. An event wakes only one waiter, which then wakes the next one in
ep_done_scan() if events are still ready. Since commit c257a340ede0
("fs, epoll: short circuit fetching events if thread has been killed"),
ep_send_events() returns before the scan when the waiter has a fatal
signal. If the woken waiter is killed before it runs, nobody wakes the
next one:
Task A Task B Task C
epoll_wait(ep, -1) epoll_wait(ep, -1)
write(efd)
/* wakes A only */
kill(A, SIGKILL)
ep_send_events()
return -EINTR
/* skips ep_done_scan() */
/* still asleep */
B then sleeps until another file on the instance becomes ready, if ever.
This can hit eg a pre-fork server whose worker gets OOM killed. Commit
7fab29e35630 ("fs/epoll: restore waking from ep_done_scan()") fixed the
same kind of hang when the wakeup in ep_done_scan() was removed.
Keep the early return so that a dying task still doesn't take events
nobody will see, but wake the next waiter there if events are ready, as
ep_done_scan() would have. With the fix, B gets the event.
This bug was identified and confirmed with the help of a deterministic
hypervisor currently under development. The C reproducer below however
hits it within about 2s.
Fixes: c257a340ede0 ("fs, epoll: short circuit fetching events if thread has been killed")
Cc: stable@vger.kernel.org
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
Link: https://patch.msgid.link/20261103-epoll-killed-waiter-v1-1-36e08c16b8a2@columbia.edu
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/eventpoll.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -2088,10 +2088,17 @@ static int ep_send_events(struct eventpo
/*
* Always short-circuit for fatal signals to allow threads to make a
* timely exit without the chance of finding more events available and
- * fetching repeatedly.
+ * fetching repeatedly. The wakeup that got us here may have been the
+ * only one for the events on ->rdllist, so pass it on to the next
+ * waiter, as ep_done_scan() would have.
*/
- if (fatal_signal_pending(current))
+ if (fatal_signal_pending(current)) {
+ spin_lock_irq(&ep->lock);
+ if (!list_empty(&ep->rdllist))
+ wake_up(&ep->wq);
+ spin_unlock_irq(&ep->lock);
return -EINTR;
+ }
init_poll_funcptr(&pt, NULL);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 673/990] aio: dont let exit_aio() return before complete() is done
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (671 preceding siblings ...)
2026-11-25 14:33 ` [PATCH 6.18 672/990] eventpoll: wake the next waiter when a woken waiter is killed Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 674/990] fs: fix the SEEK_CUR f_lock condition Greg Kroah-Hartman
` (179 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Jan Kara,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
commit ac4b449b39e605123c12ea10042cafc9b6f39603 upstream.
exit_aio() kills all contexts in one go and waits for them with a
single on-stack struct ctx_rq_wait. The count starts at table->nr, each
killed context drops one count in free_ioctx_reqs() and exit_aio()
subtracts the empty slots afterwards. Whoever drops the last count
either calls complete() or, if it is exit_aio(), skips the wait.
With a full table skipped is zero and atomic_sub_and_test(0, ...) only
tells us whether the count already hit zero. free_ioctx_reqs() runs from
the percpu_ref RCU callback, so if exit_aio() is off the CPU long enough
the last callback can have done its atomic_dec_and_test() but not yet
called complete():
free_ioctx_reqs() exit_aio()
atomic_dec_and_test() // 1 -> 0
atomic_sub_and_test(0) // true
kfree(table)
return
complete(&wait.comp)
complete() then locks and writes a completion on a stack frame that is
gone. So hold an extra count for exit_aio() itself. Then the last count
is always dropped by exit_aio() after it waited, or by a callback while
exit_aio() waits for it. An unprivileged user gets there with four
io_setup() calls and an exit without io_destroy().
Reported-by: Kyle Zeng <kylebot@openai.com>
Fixes: dc48e56d7616 ("aio: fix serial draining in exit_aio()")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261030-work-aio-exit_aio-v1-1-83942022a4c4@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/aio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -910,7 +910,7 @@ void exit_aio(struct mm_struct *mm)
if (!table)
return;
- atomic_set(&wait.count, table->nr);
+ atomic_set(&wait.count, table->nr + 1);
init_completion(&wait.comp);
skipped = 0;
@@ -934,7 +934,7 @@ void exit_aio(struct mm_struct *mm)
kill_ioctx(mm, ctx, &wait);
}
- if (!atomic_sub_and_test(skipped, &wait.count)) {
+ if (!atomic_sub_and_test(skipped + 1, &wait.count)) {
/* Wait until all IO for the context are done. */
wait_for_completion(&wait.comp);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 674/990] fs: fix the SEEK_CUR f_lock condition
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (672 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 673/990] aio: dont let exit_aio() return before complete() is done Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 675/990] splice, net: avoid MSG_MORE when the bvec array fills Greg Kroah-Hartman
` (178 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jan Kara,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
commit 1448959fe3d013ffdb8302d17e4a8fdad2d2da95 upstream.
Commit da06e3c51794 ("fs: don't needlessly acquire f_lock") wanted to
skip f_lock for SEEK_CUR on files that already serialize f_pos through
f_pos_lock, i.e. FMODE_ATOMIC_POS files and directories, and keep it
for everything else. The condition it added does the opposite:
file_seek_cur_needs_f_lock() returns false exactly for the files that
never take f_pos_lock and true for the ones that do.
So since v6.15 a SEEK_CUR on a shared block device or on a character
device that uses fixed_size_llseek() updates f_pos without any lock and
two concurrent calls can lose an update, while regular files and
directories pay for a spinlock they don't need.
Invert the condition.
Fixes: da06e3c51794 ("fs: don't needlessly acquire f_lock")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261106-work-file-seek_f_lock-v1-1-5b9a6c2928d4@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/file.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/fs/file.c
+++ b/fs/file.c
@@ -1210,14 +1210,18 @@ static inline bool file_needs_f_pos_lock
bool file_seek_cur_needs_f_lock(struct file *file)
{
- if (!(file->f_mode & FMODE_ATOMIC_POS) && !file->f_op->iterate_shared)
- return false;
-
/*
+ * Files that go through f_pos_lock when they are shared, i.e.
+ * FMODE_ATOMIC_POS files and directories, don't need f_lock for a
+ * SEEK_CUR. Everything else does, since nothing else serializes
+ * the f_pos update.
+ *
* Note that we are not guaranteed to be called after fdget_pos() on
* this file obj, in which case the caller is expected to provide the
* appropriate locking.
*/
+ if ((file->f_mode & FMODE_ATOMIC_POS) || file->f_op->iterate_shared)
+ return false;
return true;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 675/990] splice, net: avoid MSG_MORE when the bvec array fills
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (673 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 674/990] fs: fix the SEEK_CUR f_lock condition Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 676/990] libfs: make i_rwsem the lock of the offset tree Greg Kroah-Hartman
` (177 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
commit 8eaa35c6c29ae669949f4b5b0814c3d34c8ed658 upstream.
splice_to_socket() leaves tail at the last included pipe buffer when
its 16-entry bvec array fills. If the requested length exceeds the
available pipe data, pipe_occupancy() counts that buffer again and sets
MSG_MORE even though the pipe is empty. Small TCP transfers can then be
delayed until the cork timeout expires.
Advance tail before checking the array limit so the occupancy test
counts only pipe buffers that have not been included in the send.
Fixes: ca2d49f77ce4 ("splice, net: Fix splice_to_socket() to handle pipe bufs larger than a page")
Cc: stable@vger.kernel.org
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Link: https://patch.msgid.link/20261031095922.3577591-2-thnkslprpt@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/splice.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -865,9 +865,9 @@ ssize_t splice_to_socket(struct pipe_ino
bvec_set_page(&bvec[bc++], buf->page, seg, buf->offset);
remain -= seg;
+ tail++;
if (remain == 0 || bc >= ARRAY_SIZE(bvec))
break;
- tail++;
}
if (!bc)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 676/990] libfs: make i_rwsem the lock of the offset tree
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (674 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 675/990] splice, net: avoid MSG_MORE when the bvec array fills Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 677/990] mm/mmzone: read the zoneref slot once in zonelist_zone() Greg Kroah-Hartman
` (176 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chuck Lever,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
commit e7d73cef9726bea49de97ae1fd76405df4050a75 upstream.
The offset tree of a directory is only changed with the directory's
i_rwsem held exclusive and offset_readdir() walks it with i_rwsem held
shared. But the maple tree doesn't know that. It is set up with its
internal spinlock, which every mtree_*() helper takes, and readdir takes
rcu_read_lock() around each lookup.
The next patch makes readdir keep one ma_state across dir_emit(), which
can sleep. That is safe because no writer can run while readdir holds
i_rwsem. But the maple tree only allows keeping a ma_state across a
sleep if it is protected by the tree's lock. A reader that relies on
rcu_read_lock() has to mas_pause() before it drops it, and that means a
walk from the root for every entry again.
So tell the tree what protects it. Initialize it with
MT_FLAGS_LOCK_EXTERN and the directory's i_rwsem as its lock and switch
the writers from the mtree_*() helpers to the mas_*() api. They all run
with i_rwsem held exclusive already. With lockdep enabled the maple tree
now also checks that every writer holds i_rwsem exclusive.
Nothing can reach the offset tree anymore when the directory inode is
destroyed. So clear the external lock with mt_on_stack() and destroy the
tree with __mt_destroy() instead of taking i_rwsem in ->destroy_inode().
Cc: stable@vger.kernel.org # v6.14+
Link: https://patch.msgid.link/20261101-work-libfs-offset_readdir-v2-1-c621125b56d1@kernel.org
Reviewed-by: Chuck Lever <cel@kernel.org>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/libfs.c | 46 +++++++++++++++++++++++++++++-----------------
include/linux/fs.h | 2 +-
mm/shmem.c | 2 +-
3 files changed, 31 insertions(+), 19 deletions(-)
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -264,17 +264,18 @@ static long dentry2offset(struct dentry
return (long)dentry->d_fsdata;
}
-static struct lock_class_key simple_offset_lock_class;
-
/**
* simple_offset_init - initialize an offset_ctx
* @octx: directory offset map to be initialized
+ * @dir: the directory @octx belongs to
*
+ * The directory's i_rwsem is the lock of the offset map. Writers hold it
+ * exclusive, offset_readdir() holds it shared.
*/
-void simple_offset_init(struct offset_ctx *octx)
+void simple_offset_init(struct offset_ctx *octx, struct inode *dir)
{
- mt_init_flags(&octx->mt, MT_FLAGS_ALLOC_RANGE);
- lockdep_set_class(&octx->mt.ma_lock, &simple_offset_lock_class);
+ mt_init_flags(&octx->mt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_LOCK_EXTERN);
+ mt_set_external_lock(&octx->mt, &dir->i_rwsem);
octx->next_offset = DIR_OFFSET_MIN;
}
@@ -297,12 +298,13 @@ int simple_offset_add(struct offset_ctx
unsigned long offset;
int ret;
+ MA_STATE(mas, &octx->mt, 0, 0);
+
if (dentry2offset(dentry) != 0)
return -EBUSY;
- ret = mtree_alloc_cyclic(&octx->mt, &offset, dentry, DIR_OFFSET_MIN,
- DIR_OFFSET_MAX, &octx->next_offset,
- GFP_KERNEL);
+ ret = mas_alloc_cyclic(&mas, &offset, dentry, DIR_OFFSET_MIN,
+ DIR_OFFSET_MAX, &octx->next_offset, GFP_KERNEL);
if (unlikely(ret < 0))
return ret == -EBUSY ? -ENOSPC : ret;
@@ -315,7 +317,9 @@ static int simple_offset_replace(struct
{
int ret;
- ret = mtree_store(&octx->mt, offset, dentry, GFP_KERNEL);
+ MA_STATE(mas, &octx->mt, offset, offset);
+
+ ret = mas_store_gfp(&mas, dentry, GFP_KERNEL);
if (ret)
return ret;
offset_set(dentry, offset);
@@ -330,13 +334,14 @@ static int simple_offset_replace(struct
*/
void simple_offset_remove(struct offset_ctx *octx, struct dentry *dentry)
{
- long offset;
+ long offset = dentry2offset(dentry);
+
+ MA_STATE(mas, &octx->mt, offset, offset);
- offset = dentry2offset(dentry);
if (offset == 0)
return;
- mtree_erase(&octx->mt, offset);
+ mas_erase(&mas);
offset_set(dentry, 0);
}
@@ -394,16 +399,20 @@ int simple_offset_rename_exchange(struct
long new_index = dentry2offset(new_dentry);
int ret;
+ MA_STATE(old_mas, &old_ctx->mt, old_index, old_index);
+ MA_STATE(new_mas, &new_ctx->mt, new_index, new_index);
+
if (WARN_ON(!old_index || !new_index))
return -EINVAL;
- ret = mtree_store(&new_ctx->mt, new_index, old_dentry, GFP_KERNEL);
+ ret = mas_store_gfp(&new_mas, old_dentry, GFP_KERNEL);
if (WARN_ON(ret))
return ret;
- ret = mtree_store(&old_ctx->mt, old_index, new_dentry, GFP_KERNEL);
+ ret = mas_store_gfp(&old_mas, new_dentry, GFP_KERNEL);
if (WARN_ON(ret)) {
- mtree_store(&new_ctx->mt, new_index, new_dentry, GFP_KERNEL);
+ mas_set(&new_mas, new_index);
+ mas_store_gfp(&new_mas, new_dentry, GFP_KERNEL);
return ret;
}
@@ -418,11 +427,14 @@ int simple_offset_rename_exchange(struct
* @octx: directory offset ctx that is about to be destroyed
*
* During fs teardown (eg. umount), a directory's offset map might still
- * contain entries. xa_destroy() cleans out anything that remains.
+ * contain entries. __mt_destroy() cleans out anything that remains.
+ * Nothing can reach the map of a directory that is being destroyed, so
+ * this runs without the directory's i_rwsem.
*/
void simple_offset_destroy(struct offset_ctx *octx)
{
- mtree_destroy(&octx->mt);
+ mt_on_stack(octx->mt);
+ __mt_destroy(&octx->mt);
}
/**
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3781,7 +3781,7 @@ struct offset_ctx {
unsigned long next_offset;
};
-void simple_offset_init(struct offset_ctx *octx);
+void simple_offset_init(struct offset_ctx *octx, struct inode *dir);
int simple_offset_add(struct offset_ctx *octx, struct dentry *dentry);
void simple_offset_remove(struct offset_ctx *octx, struct dentry *dentry);
void simple_offset_rename(struct inode *old_dir, struct dentry *old_dentry,
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3183,7 +3183,7 @@ static struct inode *__shmem_get_inode(s
inode->i_size = 2 * BOGO_DIRENT_SIZE;
inode->i_op = &shmem_dir_inode_operations;
inode->i_fop = &simple_offset_dir_operations;
- simple_offset_init(shmem_get_offset_ctx(inode));
+ simple_offset_init(shmem_get_offset_ctx(inode), inode);
break;
case S_IFLNK:
/*
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 677/990] mm/mmzone: read the zoneref slot once in zonelist_zone()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (675 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 676/990] libfs: make i_rwsem the lock of the offset tree Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 678/990] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone Greg Kroah-Hartman
` (175 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta), Zi Yan,
Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit 9c52ebe9c89d41c56fcb5d94efe9e539414175a9 upstream.
Memory hotplug rebuilds zonelists in place while allocations walk them,
so a zoneref slot can change between two loads of it.
zonelist_zone() loads the slot with a plain access. The compiler may
load it again later instead of keeping the zone it already read, so a
caller can check one zone and then use another, or the NULL terminator.
Use READ_ONCE(). Callers that take a zone from a slot and keep using
it, such as get_page_from_freelist() with ac->preferred_zoneref, need
that single load.
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-6-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/mmzone.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1710,7 +1710,8 @@ extern struct zone *next_zone(struct zon
static inline struct zone *zonelist_zone(struct zoneref *zoneref)
{
- return zoneref->zone;
+ /* Memory hotplug rewrites zonelists in place. */
+ return READ_ONCE(zoneref->zone);
}
static inline int zonelist_zone_idx(const struct zoneref *zoneref)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 678/990] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (676 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 677/990] mm/mmzone: read the zoneref slot once in zonelist_zone() Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 679/990] mm: page_frag: refill the cache for large fragments Greg Kroah-Hartman
` (174 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Gregory Price (Meta), Zi Yan, Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 6c48b3ab4ee435c41c3395d31e8ec3dbccc3478c upstream.
should_reclaim_retry() walks a zonelist and passes the zoneref pointer
to the reclaim_retry_zone tracepoint, which loads the zone from the
entry again to find the node.
Memory hotplug rebuilds the zonelists in place while allocations are
under way. When a zone in front of the zoneref entry has become empty,
the entries move up, and this one can be the end marker by the time the
tracepoint looks at it. zonelist_node_idx() then dereferences a NULL
zone. Short of that, the event can name another zone than the one its
numbers belong to.
Pass the zone pointer instead of the zoneref pointer.
Fixes: d379f01de095 ("oom, trace: add oom detection tracepoints")
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>
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Tested-by: Gregory Price (Meta) <gourry@gourry.net>
Acked-by: Zi Yan <ziy@nvidia.com>
Link: https://patch.msgid.link/20261101021340.2251928-4-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/trace/events/oom.h | 8 ++++----
mm/page_alloc.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
--- a/include/trace/events/oom.h
+++ b/include/trace/events/oom.h
@@ -33,7 +33,7 @@ TRACE_EVENT(oom_score_adj_update,
TRACE_EVENT(reclaim_retry_zone,
- TP_PROTO(struct zoneref *zoneref,
+ TP_PROTO(struct zone *zone,
int order,
unsigned long reclaimable,
unsigned long available,
@@ -41,7 +41,7 @@ TRACE_EVENT(reclaim_retry_zone,
int no_progress_loops,
bool wmark_check),
- TP_ARGS(zoneref, order, reclaimable, available, min_wmark, no_progress_loops, wmark_check),
+ TP_ARGS(zone, order, reclaimable, available, min_wmark, no_progress_loops, wmark_check),
TP_STRUCT__entry(
__field( int, node)
@@ -55,8 +55,8 @@ TRACE_EVENT(reclaim_retry_zone,
),
TP_fast_assign(
- __entry->node = zonelist_node_idx(zoneref);
- __entry->zone_idx = zonelist_zone_idx(zoneref);
+ __entry->node = zone_to_nid(zone);
+ __entry->zone_idx = zone_idx(zone);
__entry->order = order;
__entry->reclaimable = reclaimable;
__entry->available = available;
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4674,7 +4674,7 @@ should_reclaim_retry(gfp_t gfp_mask, uns
*/
wmark = __zone_watermark_ok(zone, order, min_wmark,
ac->highest_zoneidx, alloc_flags, available);
- trace_reclaim_retry_zone(z, order, reclaimable,
+ trace_reclaim_retry_zone(zone, order, reclaimable,
available, min_wmark, *no_progress_loops, wmark);
if (wmark) {
ret = true;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 679/990] mm: page_frag: refill the cache for large fragments
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (677 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 678/990] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 680/990] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node() Greg Kroah-Hartman
` (173 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Johannes Weiner, Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit c028ecdf15131a2ab70d78a76657b81c00fa240d upstream.
A fragment which is larger than PAGE_SIZE can only be served from the
32K page of a page_frag_cache. If memory is low and the cache had to fall
back to a single page, __page_frag_alloc_align() returns NULL and keeps
that page.
Since the offset counts up, this check comes first and is made whenever
the fragment does not fit behind nc->offset, no matter how big the page
of the cache is. So the cache is never refilled on behalf of a large
fragment: with fragsz = 10000 the first three allocations succeed, the
fourth one and all the following ones fail although memory is plentiful.
nc->offset does not move either, so this lasts until smaller fragments
have used up the rest of the page, which never happens if the cache has
no other user.
The nfp driver allocates its receive buffers with napi_alloc_frag() and
netdev_alloc_frag(). They are larger than a page with a jumbo MTU.
Only give up if the fragment does not fit into the page at all, which is
what the comment describes. The fourth allocation in the scenario above
with a 32k page will thus now proceed to refill the cache.
Fixes: 8218f62c9c9b ("mm: page_frag: use initial zero offset for page_frag_alloc_align()")
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: Johannes Weiner <hannes@cmpxchg.org>
[vbabka@kernel.org: make the comment more obvious]
Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-2-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_frag_cache.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
--- a/mm/page_frag_cache.c
+++ b/mm/page_frag_cache.c
@@ -119,15 +119,20 @@ refill:
size = PAGE_SIZE << encoded_page_decode_order(encoded_page);
offset = __ALIGN_KERNEL_MASK(nc->offset, ~align_mask);
if (unlikely(offset + fragsz > size)) {
- if (unlikely(fragsz > PAGE_SIZE)) {
+ if (unlikely(fragsz > size)) {
/*
- * The caller is trying to allocate a fragment
- * with fragsz > PAGE_SIZE but the cache isn't big
- * enough to satisfy the request, this may
- * happen in low memory conditions.
- * We don't release the cache page because
- * it could make memory pressure worse
- * so we simply return NULL here.
+ * The caller is trying to allocate a fragment that's
+ * larger than the whole cache page.
+ *
+ * Either fragsz is larger than PAGE_FRAG_CACHE_MAX_SIZE
+ * so this cannot ever succeed.
+ *
+ * Or the refill has fallen back to order-0 due to a low
+ * memory condition. Then we don't want to release the
+ * cache page to attempt a new large-size refill because
+ * it could make memory pressure worse.
+ *
+ * So in both cases we simply return NULL here.
*/
return NULL;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 680/990] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (678 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 679/990] mm: page_frag: refill the cache for large fragments Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 681/990] mm/memory_hotplug: resize zones under their seqlock Greg Kroah-Hartman
` (172 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit 4cc1bcdf2e4ebcd319005ce2ea132489f6155139 upstream.
For a bind or preferred-many policy, mempolicy_slab_node() tests the
first matching 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
mempolicy_slab_node()
zonelist_zone(slot 4)
= node 2 NORMAL
offline_pages()
build_all_zonelists()
slot 4 = NULL
zonelist_node_idx(slot 4)
zone_to_nid(NULL)
Current GCC merges the two reads, but nothing requires it. With
mm/mempolicy.o built with -fno-inline -fno-ipa-sra, holding a bound
task's slab_strict_numa allocation between the reads while a movable
block earlier in the zonelist goes offline oopses every time:
BUG: kernel NULL pointer dereference, address: 0000000000000060
RIP: 0010:zone_to_nid+0x0/0x10
Call Trace:
kmem_cache_alloc_noprof+0x294/0x610
do_getname+0x34/0x230
mempolicy_slab_node() and zonelist_node_idx() are tail calls here, so
neither appears in the trace.
Read the slot once and use that zone.
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-12-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/mempolicy.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2088,6 +2088,7 @@ unsigned int mempolicy_slab_node(void)
case MPOL_PREFERRED_MANY:
{
struct zoneref *z;
+ struct zone *zone;
/*
* Follow bind policy behavior and start allocation at the
@@ -2098,7 +2099,8 @@ unsigned int mempolicy_slab_node(void)
zonelist = &NODE_DATA(node)->node_zonelists[ZONELIST_FALLBACK];
z = first_zones_zonelist(zonelist, highest_zoneidx,
&policy->nodes);
- return zonelist_zone(z) ? zonelist_node_idx(z) : node;
+ zone = zonelist_zone(z);
+ return zone ? zone_to_nid(zone) : node;
}
case MPOL_LOCAL:
return node;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 681/990] mm/memory_hotplug: resize zones under their seqlock
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (679 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 680/990] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node() Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 682/990] mm/page_alloc: dont undo another isolation in alloc_contig_range Greg Kroah-Hartman
` (171 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 58e81bb7de5aac8ec5e4aa21d401e7dafbd4058b upstream.
With CONFIG_DEBUG_VM the page allocator checks that a page which is
freed, split or allocated lies within its zone. The check reads
zone->zone_start_pfn and zone->spanned_pages under zone->span_seqlock, as
memory hotplug can change the two at any time.
Commit 27cacaad16c5 ("mm,memory_hotplug: drop unneeded locking") removed
the write side, since all resizing is serialized by the hotplug lock. That
leaves the reader without protection. When memory below the start of a
zone goes online, the start is lowered first and the size is raised
afterwards. When the lowest memory of a zone goes offline, the size is
reduced first. In between, the zone seems to end before its last pages. If
one of them goes through the allocator at that moment, it is reported as
being outside of the zone triggers VM_BUG_ON_PAGE().
Write the two fields in a write section of the seqlock. Interrupts are
disabled as pages are freed from interrupts, too, and the reader would
wait for the writer which it has interrupted.
Fixes: 27cacaad16c5 ("mm,memory_hotplug: drop unneeded locking")
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>
Link: https://patch.msgid.link/20261103-pgalloc-ai-hotfixes-v2-4-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/memory_hotplug.c | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -479,6 +479,22 @@ static unsigned long find_biggest_sectio
return 0;
}
+/*
+ * The page allocator checks pages against the span of their zone while the
+ * zone is resized, see page_outside_zone_boundaries(). It must not see the
+ * new value of one field together with the old value of the other one.
+ */
+static void zone_set_span(struct zone *zone, unsigned long start_pfn,
+ unsigned long spanned_pages)
+{
+ unsigned long flags;
+
+ write_seqlock_irqsave(&zone->span_seqlock, flags);
+ zone->zone_start_pfn = start_pfn;
+ zone->spanned_pages = spanned_pages;
+ write_sequnlock_irqrestore(&zone->span_seqlock, flags);
+}
+
static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
unsigned long end_pfn)
{
@@ -494,13 +510,10 @@ static void shrink_zone_span(struct zone
*/
pfn = find_smallest_section_pfn(nid, zone, end_pfn,
zone_end_pfn(zone));
- if (pfn) {
- zone->spanned_pages = zone_end_pfn(zone) - pfn;
- zone->zone_start_pfn = pfn;
- } else {
- zone->zone_start_pfn = 0;
- zone->spanned_pages = 0;
- }
+ if (pfn)
+ zone_set_span(zone, pfn, zone_end_pfn(zone) - pfn);
+ else
+ zone_set_span(zone, 0, 0);
} else if (zone_end_pfn(zone) == end_pfn) {
/*
* If the section is biggest section in the zone, it need
@@ -511,11 +524,10 @@ static void shrink_zone_span(struct zone
pfn = find_biggest_section_pfn(nid, zone, zone->zone_start_pfn,
start_pfn);
if (pfn)
- zone->spanned_pages = pfn - zone->zone_start_pfn + 1;
- else {
- zone->zone_start_pfn = 0;
- zone->spanned_pages = 0;
- }
+ zone_set_span(zone, zone->zone_start_pfn,
+ pfn - zone->zone_start_pfn + 1);
+ else
+ zone_set_span(zone, 0, 0);
}
}
@@ -706,12 +718,12 @@ static void online_pages_range(unsigned
static void __meminit resize_zone_range(struct zone *zone, unsigned long start_pfn,
unsigned long nr_pages)
{
- unsigned long old_end_pfn = zone_end_pfn(zone);
+ unsigned long end_pfn = max(start_pfn + nr_pages, zone_end_pfn(zone));
- if (zone_is_empty(zone) || start_pfn < zone->zone_start_pfn)
- zone->zone_start_pfn = start_pfn;
+ if (!zone_is_empty(zone) && start_pfn > zone->zone_start_pfn)
+ start_pfn = zone->zone_start_pfn;
- zone->spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - zone->zone_start_pfn;
+ zone_set_span(zone, start_pfn, end_pfn - start_pfn);
}
static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned long start_pfn,
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 682/990] mm/page_alloc: dont undo another isolation in alloc_contig_range
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (680 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 681/990] mm/memory_hotplug: resize zones under their seqlock Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 683/990] mm/page_alloc: keep the pagesets of an empty zone Greg Kroah-Hartman
` (170 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta), Zi Yan,
Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit 7d9c29ed8feec8bfbe5e5f673ba2b5926da11375 upstream.
An alloc_contig_range() that overlaps a block going offline can leave
the offline spinning until it gets a signal, holding the device hotplug
lock. When isolation fails, alloc_contig_frozen_range() undoes it over
the whole range, clearing the offline's MIGRATE_ISOLATE too:
CPU 1 (offline_pages) CPU 2 (alloc_contig_range)
start_isolate_page_range()
blocks are MIGRATE_ISOLATE
start_isolate_page_range()
-EBUSY on CPU 1's blocks
undo_isolate_page_range()
blocks are MIGRATE_MOVABLE
test_pages_isolated()
never succeeds again
start_isolate_page_range() fails only on a block someone else isolated,
after undoing its own, so this undo only ever clears another caller's.
Return directly, as before alloc_contig_range() went pageblock granular.
With offline_pages() parked after isolating a DIMM block and a 1G
hugetlb allocation made over it, the offline on base still loops 30s
later in 4 of 4 runs:
offline_pages+0x5b2/0x1570
memory_subsys_offline+0x17e/0x470
device_offline+0x250/0x340
state_store+0x88/0x110
With this patch the allocation still fails, and the offline completes in
3 of 3 runs.
Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
Cc: stable@vger.kernel.org
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261027042204.3741307-5-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7104,9 +7104,13 @@ int alloc_contig_range_noprof(unsigned l
* put back to page allocator so that buddy can use them.
*/
+ /*
+ * On failure this has undone its own isolation, and any other
+ * isolated blocks in the range belong to someone else, e.g. offline.
+ */
ret = start_isolate_page_range(start, end, mode);
if (ret)
- goto done;
+ return ret;
drain_all_pages(cc.zone);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 683/990] mm/page_alloc: keep the pagesets of an empty zone
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (681 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 682/990] mm/page_alloc: dont undo another isolation in alloc_contig_range Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 684/990] mm/page_alloc: detect zonelist rebuilds from memory hot-add Greg Kroah-Hartman
` (169 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Johannes Weiner, Gregory Price (Meta), Zi Yan,
Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit 7bfcf81b1cb469bc016fa8e07939c0924b9ff8db upstream.
When the last memory of a zone goes offline, zone_pcp_reset() frees
zone->per_cpu_pageset and zone->per_cpu_zonestats. Nothing waits for those
who found the zone populated and still use the two pointers. They take
neither the memory hotplug lock nor any other lock which offline_pages()
holds, and some of them can sleep:
CPU0 vmstat_update() CPU1 offline_pages()
refresh_cpu_vm_stats()
for_each_populated_zone(zone)
pcp = zone->per_cpu_pageset
cond_resched()
adjust_present_page_count()
zone_pcp_reset(zone)
free_percpu(zone->per_cpu_pageset)
decay_pcp_high(zone, pcp)
__this_cpu_write(pcp->expire, 0)
The same goes for drain_all_pages(NULL), which takes pcp->lock, for
zone_pcp_update(), show_free_areas() and the readers and writers of the
zonestats. If the per-cpu memory has got a new owner in the meantime, it
is corrupted.
The pagesets are only freed because setup_zone_pageset() would otherwise
leak them when the zone gets memory again. Keep them instead and let
setup_zone_pageset() and zone_pcp_init() use them again, like it is done
with pgdat->per_cpu_nodestats. Their lists are empty, and their limits
have been calculated for a zone without memory by the
init_per_zone_wmark_min() of offline_pages(), which is what
setup_zone_pageset() would come up with as well.
Fixes: 340175b7d14d ("mm/hotplug: free zone->pageset when a zone becomes empty")
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: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261101021340.2251928-3-gourry@gourry.net
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6210,6 +6210,10 @@ void __meminit setup_zone_pageset(struct
{
int cpu;
+ /* The zone has been populated before, see zone_pcp_reset(). */
+ if (zone->per_cpu_pageset != &boot_pageset)
+ return;
+
/* Size may be 0 on !SMP && !NUMA */
if (sizeof(struct per_cpu_zonestat) > 0)
zone->per_cpu_zonestats = alloc_percpu(struct per_cpu_zonestat);
@@ -6303,6 +6307,10 @@ void __init setup_per_cpu_pageset(void)
__meminit void zone_pcp_init(struct zone *zone)
{
+ /* This initialization only needs to be done once */
+ if (zone->per_cpu_pageset)
+ return;
+
/*
* per cpu subsystem is not up at this point. The following code
* relies on the ability of the linker to provide the
@@ -7344,6 +7352,12 @@ void zone_pcp_enable(struct zone *zone)
mutex_unlock(&pcp_batch_high_lock);
}
+/*
+ * The zone has become empty. Its pagesets and zonestats are not freed: nothing
+ * keeps somebody who found the zone populated, such as refresh_cpu_vm_stats()
+ * or drain_all_pages(), from still using them. They are used again when the
+ * zone gets memory again.
+ */
void zone_pcp_reset(struct zone *zone)
{
int cpu;
@@ -7354,12 +7368,6 @@ void zone_pcp_reset(struct zone *zone)
pzstats = per_cpu_ptr(zone->per_cpu_zonestats, cpu);
drain_zonestat(zone, pzstats);
}
- free_percpu(zone->per_cpu_pageset);
- zone->per_cpu_pageset = &boot_pageset;
- if (zone->per_cpu_zonestats != &boot_zonestats) {
- free_percpu(zone->per_cpu_zonestats);
- zone->per_cpu_zonestats = &boot_zonestats;
- }
}
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 684/990] mm/page_alloc: detect zonelist rebuilds from memory hot-add
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (682 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 683/990] mm/page_alloc: keep the pagesets of an empty zone Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 685/990] mm/page_alloc: snapshot the preferred zone against shrink rebuilds Greg Kroah-Hartman
` (168 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vlastimil Babka (SUSE),
Gregory Price (Meta), Zi Yan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit e5db040c3d09c5d85dda70f736d4d1a6714b741e upstream.
The zonelist_update_seq retry was limited to CONFIG_MEMORY_HOTREMOVE,
presumably because only hot-remove takes zones out of a zonelist.
However, build_zonerefs_node() rewrites the zonelists in place, so
onlining the first block of a zone shifts the entries that follow it
in every zonelist containing that zone. This can cause a spurious
allocation failure for a __GFP_THISNODE caller.
For a node with only ZONE_NORMAL, onlining its first ZONE_MOVABLE block
rewrites the node's ZONELIST_NOFALLBACK list as:
[NORMAL, NULL] -> [MOVABLE, NULL] -> [MOVABLE, NORMAL, NULL]
A concurrent GFP_KERNEL | __GFP_THISNODE allocation can observe the
intermediate list, skip ZONE_MOVABLE, and find no eligible zone. With
CONFIG_MEMORY_HOTREMOVE=n, check_retry_zonelist() returns 0 and the
allocation fails even though the node has free ZONE_NORMAL memory.
Gate the sequence checks on CONFIG_MEMORY_HOTPLUG, which covers every
configuration that rebuilds zonelists after boot.
Fixes: 3d36424b3b58 ("mm/page_alloc: fix race condition between build_all_zonelists and page allocation")
Cc: stable@vger.kernel.org
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://patch.msgid.link/20261101021340.2251928-5-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4416,7 +4416,7 @@ static DEFINE_SEQLOCK(zonelist_update_se
static unsigned int zonelist_iter_begin(void)
{
- if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE))
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
return read_seqbegin(&zonelist_update_seq);
return 0;
@@ -4424,7 +4424,7 @@ static unsigned int zonelist_iter_begin(
static unsigned int check_retry_zonelist(unsigned int seq)
{
- if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE))
+ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
return read_seqretry(&zonelist_update_seq, seq);
return seq;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 685/990] mm/page_alloc: snapshot the preferred zone against shrink rebuilds
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (683 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 684/990] mm/page_alloc: detect zonelist rebuilds from memory hot-add Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 686/990] mm/page_alloc: clear ->private of deferred free pages Greg Kroah-Hartman
` (167 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Gregory Price (Meta),
Vlastimil Babka (SUSE), Zi Yan
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory Price (Meta) <gourry@gourry.net>
commit b3e3a760eb68449e2794ef68ab212173d9c3e8c7 upstream.
get_page_from_freelist() and alloc_pages_bulk_noprof() reread
ac->preferred_zoneref->zone at every use. Offlining a zone's last block
rebuilds the zonelists in place, and the shrunk list's NULL terminator
can land on the preferred slot mid-walk:
CPU 0 CPU 1
get_page_from_freelist(GFP_KERNEL | __GFP_THISNODE)
zone = NORMAL (slot 1)
offline_pages()
build_all_zonelists()
[MOVABLE, NORMAL, NULL]
-> [NORMAL, NULL]
rmqueue(zonelist_zone(slot 1), zone)
zone_statistics(NULL, zone)
BUG: kernel NULL pointer dereference, address: 0000000000000060
RIP: 0010:get_page_from_freelist+0x6a5/0x15f0
Call Trace:
__alloc_frozen_pages_noprof+0x125/0x330
Read the slot once. Zones are never freed, so a stale zone is safe, and
a NULL slot fails the same way as walking off the end.
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-7-gourry@gourry.net
Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3793,12 +3793,21 @@ get_page_from_freelist(gfp_t gfp_mask, u
{
struct zoneref *z;
struct zone *zone;
+ struct zone *preferred_zone;
struct pglist_data *last_pgdat = NULL;
bool last_pgdat_dirty_ok = false;
bool no_fallback;
bool skip_kswapd_nodes = nr_online_nodes > 1;
bool skipped_kswapd_nodes = false;
+ /*
+ * A concurrent zonelist rebuild can NULL or replace this slot. Zones
+ * are never freed, so reading it once keeps a usable zone.
+ */
+ preferred_zone = zonelist_zone(ac->preferred_zoneref);
+ if (!preferred_zone)
+ return NULL;
+
retry:
/*
* Scan zonelist, looking for a zone with enough free.
@@ -3845,7 +3854,7 @@ retry:
}
if (no_fallback && !defrag_mode && nr_online_nodes > 1 &&
- zone != zonelist_zone(ac->preferred_zoneref)) {
+ zone != preferred_zone) {
int local_nid;
/*
@@ -3853,7 +3862,7 @@ retry:
* fragmenting fallbacks. Locality is more important
* than fragmentation avoidance.
*/
- local_nid = zonelist_node_idx(ac->preferred_zoneref);
+ local_nid = zone_to_nid(preferred_zone);
if (zone_to_nid(zone) != local_nid) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
goto retry;
@@ -3917,7 +3926,7 @@ check_alloc_wmark:
goto try_this_zone;
if (!node_reclaim_enabled() ||
- !zone_allows_reclaim(zonelist_zone(ac->preferred_zoneref), zone))
+ !zone_allows_reclaim(preferred_zone, zone))
continue;
ret = node_reclaim(zone->zone_pgdat, gfp_mask, order);
@@ -3939,7 +3948,7 @@ check_alloc_wmark:
}
try_this_zone:
- page = rmqueue(zonelist_zone(ac->preferred_zoneref), zone, order,
+ page = rmqueue(preferred_zone, zone, order,
gfp_mask, alloc_flags, ac->migratetype);
if (page) {
prep_new_page(page, order, gfp_mask, alloc_flags);
@@ -5156,6 +5165,7 @@ unsigned long alloc_pages_bulk_noprof(gf
struct page *page;
unsigned long __maybe_unused UP_flags;
struct zone *zone;
+ struct zone *preferred_zone;
struct zoneref *z;
struct per_cpu_pages *pcp;
struct list_head *pcp_list;
@@ -5206,6 +5216,11 @@ unsigned long alloc_pages_bulk_noprof(gf
goto out;
gfp = alloc_gfp;
+ /* Read once; see get_page_from_freelist(). */
+ preferred_zone = zonelist_zone(ac.preferred_zoneref);
+ if (!preferred_zone)
+ goto failed;
+
/* Find an allowed local zone that meets the low watermark. */
z = ac.preferred_zoneref;
for_next_zone_zonelist_nodemask(zone, z, ac.highest_zoneidx, ac.nodemask) {
@@ -5216,8 +5231,8 @@ unsigned long alloc_pages_bulk_noprof(gf
continue;
}
- if (nr_online_nodes > 1 && zone != zonelist_zone(ac.preferred_zoneref) &&
- zone_to_nid(zone) != zonelist_node_idx(ac.preferred_zoneref)) {
+ if (nr_online_nodes > 1 && zone != preferred_zone &&
+ zone_to_nid(zone) != zone_to_nid(preferred_zone)) {
goto failed;
}
@@ -5225,7 +5240,7 @@ unsigned long alloc_pages_bulk_noprof(gf
retry_this_zone:
mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK) + nr_pages;
if (zone_watermark_fast(zone, 0, mark,
- zonelist_zone_idx(ac.preferred_zoneref),
+ zone_idx(preferred_zone),
alloc_flags, gfp)) {
break;
}
@@ -5284,7 +5299,7 @@ retry_this_zone:
pcp_trylock_finish(UP_flags);
__count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account);
- zone_statistics(zonelist_zone(ac.preferred_zoneref), zone, nr_account);
+ zone_statistics(preferred_zone, zone, nr_account);
out:
return nr_populated;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 686/990] mm/page_alloc: clear ->private of deferred free pages
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (684 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 685/990] mm/page_alloc: snapshot the preferred zone against shrink rebuilds Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 687/990] btrfs: fix bio counter and bioc leak when async checksumming fails Greg Kroah-Hartman
` (166 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik, David Hildenbrand (Arm),
Zi Yan, Johannes Weiner, Vlastimil Babka (SUSE)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <josef@toxicpanda.com>
commit aae6b83fe47ed8bff9195efbe1d191ec52e5436e upstream.
free_pages_nolock() and free_frozen_pages_nolock() put the page on
zone->trylock_free_pages if they get neither the pcp lock nor zone->lock.
add_page_to_zone_llist() keeps the order of the page in page->private.
The next free_one_page() which does get zone->lock passes these pages to
split_large_buddy() with ->private still set.
__free_one_page() writes ->private of the head of the resulting free page
only. If the deferred page is merged with its lower buddy, it becomes a
tail of that free page and keeps the order in ->private.
All other free pages which are not the head of a buddy have a ->private
of zero, and since commit 819bfbd47e49 ("mm/page_alloc: remove
set_page_private() in prep_compound_tail()") the allocator relies on it.
When the stale page is allocated again as a tail of a larger page:
- prep_compound_tail() hits VM_WARN_ON_ONCE(tail->private);
- with the page checks enabled, __free_pages_prepare() reports
"BUG: Bad page state", "nonzero private", and leaks the whole page;
- without them the value is seen by whoever uses that page next, e.g. as
folio->private of a folio which is split off a large folio.
Only pages of an order above zero are affected. Those can be freed
through _nolock() by the stack depot (order 2) and by SLUB (a new slab
which cannot be added to the partial list by kmalloc_nolock()).
Clear ->private when the page is taken off the list.
Fixes: 8c57b687e833 ("mm, bpf: Introduce free_pages_nolock()")
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-1-e0d2890ab74f@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/page_alloc.c | 2 ++
1 file changed, 2 insertions(+)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1608,6 +1608,8 @@ static void free_one_page(struct zone *z
llist_for_each_entry_safe(p, tmp, llnode, pcp_llist) {
unsigned int p_order = p->private;
+ /* It may end up as a tail of the merged free page. */
+ p->private = 0;
split_large_buddy(zone, p, page_to_pfn(p), p_order, fpi_flags);
__count_vm_events(PGFREE, 1 << p_order);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 687/990] btrfs: fix bio counter and bioc leak when async checksumming fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (685 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 686/990] mm/page_alloc: clear ->private of deferred free pages Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 688/990] coda: honor the append state of each write Greg Kroah-Hartman
` (165 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Qu Wenruo, Mani Tofigh, David Sterba
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mani Tofigh <mt4022@columbia.edu>
commit d27d0039bc1334be8a72c769e14c0b0c3efc317d upstream.
A single failed checksum allocation can make a later device replace
hang forever. btrfs_submit_chunk() takes a dev-replace bio counter
reference and a bioc before it hands a write to the checksum worker.
If the checksum fails there (e.g., its allocation fails),
run_one_async_done() ends the bio but drops neither. The counter then
never gets back to zero and the next replace waits for it:
[ 8.369] BTRFS info (device ram0): dev_replace from /dev/ram0 (devid 1) to /dev/ram1 finished
[41.534] INFO: task btrfscsum:80 blocked for more than 20 seconds.
[41.534] btrfs_rm_dev_replace_blocked+0x135/0x180
[41.534] btrfs_dev_replace_finishing+0xefe/0x13b0
The worker is only used when CONFIG_BTRFS_EXPERIMENTAL is off and the
checksum isn't a fast one, e.g., sha256. We hit it on a sha256
filesystem.
We put the bioc and drop the counter in that error branch. We also
put the bioc on the synchronous error path and on the btrfs_split_bio()
error path, which both only drop the counter. With the fix, the
replace doesn't hang anymore.
This bug was identified and confirmed with the help of fault-injection
testing on a deterministic hypervisor currently under development. Our
C reproducer however hits it within about 35s.
Fixes: f8a53bb58ec7 ("btrfs: handle checksum generation in the storage layer")
Fixes: c7c97ceff98c ("btrfs: handle bio_split() errors")
CC: stable@vger.kernel.org # 6.6+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/btrfs/bio.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -624,6 +624,8 @@ static void run_one_async_done(struct bt
/* If an error occurred we just want to clean up the bio and move on. */
if (bio->bi_status) {
+ btrfs_put_bioc(async->bioc);
+ btrfs_bio_counter_dec(async->bbio->inode->root->fs_info);
btrfs_bio_end_io(async->bbio, bio->bi_status);
return;
}
@@ -759,6 +761,7 @@ static bool btrfs_submit_chunk(struct bt
split = btrfs_split_bio(fs_info, bbio, map_length);
if (IS_ERR(split)) {
status = errno_to_blk_status(PTR_ERR(split));
+ btrfs_put_bioc(bioc);
btrfs_bio_counter_dec(fs_info);
goto end_bbio;
}
@@ -820,6 +823,7 @@ done:
return map_length == length;
fail:
+ btrfs_put_bioc(bioc);
btrfs_bio_counter_dec(fs_info);
/*
* We have split the original bbio, now we have to end both the current
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 688/990] coda: honor the append state of each write
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (686 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 687/990] btrfs: fix bio counter and bioc leak when async checksumming fails Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 689/990] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp Greg Kroah-Hartman
` (164 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hungyu Lin,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
commit 87ea037a9166a5842356ce68e3585fc6e756603b upstream.
coda_open() adds O_APPEND to the container file's f_flags after it has
been opened, without updating its cached f_iocb_flags. An O_APPEND write
can therefore overwrite existing data instead of appending. For example,
writing "Z" to a file containing "abc" produces "Zbc" rather than "abcZ".
Pass RWF_APPEND or RWF_NOAPPEND to vfs_iter_write() according to the
incoming IOCB_APPEND state. This also honors changes made with F_SETFL
and per-write append overrides instead of relying on the container's
open-time flags.
Fixes: 164f4064ca81 ("keep iocb_flags() result cached in struct file")
Cc: stable@vger.kernel.org # 6.9+
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Link: https://patch.msgid.link/20261105051406.52442-1-dennylin0707@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/coda/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -71,6 +71,7 @@ coda_file_write_iter(struct kiocb *iocb,
struct file *host_file = cfi->cfi_container;
loff_t ki_pos = iocb->ki_pos;
size_t count = iov_iter_count(to);
+ rwf_t flags = (iocb->ki_flags & IOCB_APPEND) ? RWF_APPEND : RWF_NOAPPEND;
ssize_t ret;
ret = venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode),
@@ -80,7 +81,7 @@ coda_file_write_iter(struct kiocb *iocb,
goto finish_write;
inode_lock(coda_inode);
- ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, 0);
+ ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, flags);
coda_inode->i_size = file_inode(host_file)->i_size;
coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
inode_set_mtime_to_ts(coda_inode, inode_set_ctime_current(coda_inode));
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 689/990] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (687 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 688/990] coda: honor the append state of each write Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 690/990] macsec: reject frames that decapsulate into runt Ethernet frames Greg Kroah-Hartman
` (163 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ilya Maximets, Sasha Levin,
Jakub Kicinski, David S. Miller, Eric Dumazet, Paolo Abeni,
Simon Horman, Sridhar Samudrala, Kees Cook, Jean-Paul Sergent
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Paul Sergent <jpsergent@gmail.com>
commit 74a7db839308dd7d1c3f72dd1e3299784df3affb upstream.
Commit 3fcece12bc1b6 ("net: store port/representator id in
metadata_dst") dropped the options_len equality check when converting
skb_metadata_dst_cmp() to a type switch, so the memcmp length is taken
from skb a alone. When skb b carries fewer options than a, the
comparison reads past b's allocation.
Hit in practice with Cilium geneve GRO aggregation, comparing an skb
carrying 12 bytes of tunnel options against one carrying none:
memcmp: detected buffer overflow: 108 byte read of buffer size 96
WARNING: CPU: 0 PID: 15 at lib/string_helpers.c:1036 __fortify_report
__fortify_panic+0x9/0x10
skb_metadata_dst_cmp+0x11b/0x120
dev_gro_receive+0x303/0x620
gro_cell_poll+0x67/0xa0
Restore the check: unequal options_len means different metadata and no
aggregation; the memcmp only runs when both sides carry the same
options length.
Fixes: 3fcece12bc1b6 ("net: store port/representator id in metadata_dst")
Cc: stable@vger.kernel.org
Cc: Ilya Maximets <i.maximets@ovn.org>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Sridhar Samudrala <sridhar.samudrala@intel.com>
Cc: Kees Cook <kees@kernel.org>
Signed-off-by: Jean-Paul Sergent <jpsergent@gmail.com>
Link: https://patch.msgid.link/20261109082410.206140-1-jpsergent@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/dst_metadata.h | 2 ++
1 file changed, 2 insertions(+)
--- a/include/net/dst_metadata.h
+++ b/include/net/dst_metadata.h
@@ -116,6 +116,8 @@ static inline int skb_metadata_dst_cmp(c
return memcmp(&a->u.port_info, &b->u.port_info,
sizeof(a->u.port_info));
case METADATA_IP_TUNNEL:
+ if (a->u.tun_info.options_len != b->u.tun_info.options_len)
+ return 1;
return memcmp(&a->u.tun_info, &b->u.tun_info,
sizeof(a->u.tun_info) +
a->u.tun_info.options_len);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 690/990] macsec: reject frames that decapsulate into runt Ethernet frames
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (688 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 689/990] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 691/990] mctp: accept MSG_CMSG_COMPAT in recvmsg Greg Kroah-Hartman
` (162 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Dave Miller
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 1d5e2c57e9ffc134e14b3f837c8d7c53b508bd22 upstream.
When an SCI is unknown and the C bit is clear, macsec_handle_frame()
removes the SecTAG and the default ICV without checking how much of the
frame remains. A short frame can therefore become an skb shorter than
ETH_HLEN. eth_type_trans() cannot pull its Ethernet header, and a second
stacked MACsec device can copy stale skb headroom into a packet delivered
to a packet socket.
The matched-SCI path has a related hole: macsec_validate_skb() accepts a
short_length of one, so a frame that passes the existing length check can
still become a 13-byte Ethernet frame.
Require enough bytes for the MACsec overhead and a complete Ethernet
header before decapsulating an unknown-SCI frame. Apply the same bound
in macsec_validate_skb(), using the selected SecY's ICV length, to cover
the no-SA, synchronous-decrypt and asynchronous-decrypt delivery paths.
Leave other unknown-SCI handling unchanged.
Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/macsec.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -403,8 +403,10 @@ static bool macsec_validate_skb(struct s
int len = skb->len - 2 * ETH_ALEN;
int extra_len = macsec_extra_len(!!(h->tci_an & MACSEC_TCI_SC)) + icv_len;
- /* a) It comprises at least 17 octets */
- if (skb->len <= 16)
+ /* a) It comprises at least 17 octets. The SecTAG and ICV must
+ * also leave a complete Ethernet header.
+ */
+ if (skb->len < ETH_HLEN + extra_len)
return false;
/* b) MACsec EtherType: already checked */
@@ -1326,9 +1328,12 @@ drop_direct:
nosci:
/* 10.6.1 if the SC is not found */
cbit = !!(hdr->tci_an & MACSEC_TCI_C);
- if (!cbit)
- macsec_finalize_skb(skb, MACSEC_DEFAULT_ICV_LEN,
- macsec_extra_len(macsec_skb_cb(skb)->has_sci));
+ if (!cbit) {
+ len = macsec_extra_len(macsec_skb_cb(skb)->has_sci);
+ if (skb->len < ETH_HLEN + len + MACSEC_DEFAULT_ICV_LEN)
+ goto drop_nosc;
+ macsec_finalize_skb(skb, MACSEC_DEFAULT_ICV_LEN, len);
+ }
list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
struct sk_buff *nskb;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 691/990] mctp: accept MSG_CMSG_COMPAT in recvmsg
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (689 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 690/990] macsec: reject frames that decapsulate into runt Ethernet frames Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 692/990] net/mlx5e: Fix queue stats access to queues without stats Greg Kroah-Hartman
` (161 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Davidlohr Bueso, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <dave@stgolabs.net>
commit 350e1d0d3b386fcc0cff2d37aa920fab4800bf72 upstream.
32-bit userspace running on a 64-bit kernel is unable to receive MCTP
messages on an AF_MCTP socket, even though sending succeeds. There is
nothing for MCTP to do with it beyond not rejecting it, as af_packet,
af_key and can/isotp already do, for example.
Fixes: 833ef3b91de6 ("mctp: Populate socket implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://patch.msgid.link/20261105160704.2546031-1-dave@stgolabs.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mctp/af_mctp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/mctp/af_mctp.c
+++ b/net/mctp/af_mctp.c
@@ -291,7 +291,7 @@ static int mctp_recvmsg(struct socket *s
u8 type;
int rc;
- if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK))
+ if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK | MSG_CMSG_COMPAT))
return -EOPNOTSUPP;
skb = skb_recv_datagram(sk, flags, &rc);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 692/990] net/mlx5e: Fix queue stats access to queues without stats
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (690 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 691/990] mctp: accept MSG_CMSG_COMPAT in recvmsg Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 693/990] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported Greg Kroah-Hartman
` (160 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Breno Leitao, Tariq Toukan,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <leitao@debian.org>
commit 9a24799e219b1699bb1c144248c8c500b9504db5 upstream.
I am seeing the following mlx5e crash in the Meta fleet:
pc : mlx5e_get_queue_stats_rx+0x4c/0xc8
Call trace:
mlx5e_get_queue_stats_rx+0x4c/0xc8 (P)
netdev_stat_queue_sum+0x78/0x480
netdev_nl_qstats_get_dump_one+0xf0/0x268
netdev_nl_qstats_get_dumpit+0x7c/0x1f8
When dumping device-wide qstats, the core calls the per-queue callbacks
for every queue below real_num_{rx,tx}_queues, regardless of whether the
netdev is up. Some of those queues have no stats behind them:
- RX stats live in priv->channel_stats[], which only has entries for
channels that have been opened (stats_nch). real_num_rx_queues can
be larger, for example after the channel count is raised while the
netdev is down, or after opening the channels failed part way.
- TX stats are looked up in priv->txq2sq_stats[], which is NULL for
SQs that were never activated and for HTB queues while the channels
are closed.
In both cases the callback dereferences a NULL pointer. The dump needs
no privileges, so any user can trigger it.
Return early for RX queues at or above stats_nch and for TX queues
without SQ stats.
Fixes: 7b66ae536a78 ("net/mlx5e: Add per queue netdev-genl stats")
Cc: stable@vger.kernel.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20261104-mlx5e-qstats-null-v1-1-a6a003245cec@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -5413,7 +5413,7 @@ static void mlx5e_get_queue_stats_rx(str
struct mlx5e_rq_stats *xskrq_stats;
struct mlx5e_rq_stats *rq_stats;
- if (mlx5e_is_uplink_rep(priv) || !mlx5e_stats_nch_read(priv))
+ if (mlx5e_is_uplink_rep(priv) || i >= mlx5e_stats_nch_read(priv))
return;
channel_stats = priv->channel_stats[i];
@@ -5440,6 +5440,9 @@ static void mlx5e_get_queue_stats_tx(str
* inactive sqs.
*/
sq_stats = priv->txq2sq_stats[i];
+ if (!sq_stats)
+ return;
+
stats->packets = sq_stats->packets;
stats->bytes = sq_stats->bytes;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 693/990] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (691 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 692/990] net/mlx5e: Fix queue stats access to queues without stats Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 694/990] net/rds: Do not unpin a page after a failed atomic pin Greg Kroah-Hartman
` (159 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Dragos Tatulea, Tariq Toukan,
Jiabin Deng, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiabin Deng <dengjiabin2023@gmail.com>
commit 68c183619f24982a635930697bf8e148f2d78f71 upstream.
When SHAMPO and relaxed ordering writes are enabled, aligned RQ end
padding can corrupt received TCP data. Due to reordering, alignment
padding written at the end of one packet can overwrite data from the
next packet.
The current RQ end padding selection avoids alignment padding for LRO,
but not for SHAMPO. Extend the condition to SHAMPO to prevent this
corruption.
The issue was observed in a two-host test using a BlueField-3 NIC and
an NVIDIA H20 GPU. In the original test with MTU 1500, 354 of 400
transfers contained corrupted data before the fix. After applying this
change, all 400 transfers across eight message sizes from 32 KiB to
4 MiB, with 50 transfers per size, completed successfully, with no
incorrect bytes or corrupted intervals.
Fixes: e5ca8fb08ab2 ("net/mlx5e: Add control path for SHAMPO feature")
Closes: https://lore.kernel.org/r/CAFxp=AY2cVRQrZvB9WNnigbsobuw11NMG-cagHx0_V+ur2ToFw@mail.gmail.com
Link: https://lore.kernel.org/r/atZKOtjrb9HKSNHF@dtatulea-c5.nvidia.com
Suggested-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jiabin Deng <dengjiabin2023@gmail.com>
Link: https://patch.msgid.link/20261110035723.26587-1-dengjiabin2023@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
@@ -873,10 +873,11 @@ static void mlx5e_build_rx_cq_param(stru
static u8 rq_end_pad_mode(struct mlx5_core_dev *mdev, struct mlx5e_params *params)
{
- bool lro_en = params->packet_merge.type == MLX5E_PACKET_MERGE_LRO;
+ bool no_pad = params->packet_merge.type == MLX5E_PACKET_MERGE_LRO ||
+ params->packet_merge.type == MLX5E_PACKET_MERGE_SHAMPO;
bool ro = MLX5_CAP_GEN(mdev, relaxed_ordering_write);
- return ro && lro_en ?
+ return ro && no_pad ?
MLX5_WQ_END_PAD_MODE_NONE : MLX5_WQ_END_PAD_MODE_ALIGN;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 694/990] net/rds: Do not unpin a page after a failed atomic pin
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (692 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 693/990] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 695/990] net/smc: fix lgr/lnk lifetime vs diag reader race Greg Kroah-Hartman
` (158 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Kyle Zeng, Allison Henderson,
Dave Miller
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 8d5ce4751fad9499ea408163af7f410f18a85782 upstream.
rds_cmsg_atomic() assumes that a non-NULL output from rds_pin_pages()
represents a pin that it owns. However, pin_user_pages_fast() can roll
back a fast-GUP pin after racing fork() and then fail in the slow path,
for example after a concurrent mprotect(PROT_NONE). The output slot can
still contain the already-unpinned page.
The common error path calls unpin_user_page() on that stale pointer.
This can consume another subsystem's pin and allow the page to be freed
while it is still in use. A local unprivileged reproducer triggers a
KASAN use-after-free write through an io_uring registered buffer.
Clear page when rds_pin_pages() does not return one. The error path
continues to release the page on errors after a successful pin, and
successful requests retain their existing ownership and behavior. All
four RDS atomic ancillary operations share this path.
The issue was found by an LLM.
Fixes: 15133f6e67d8 ("RDS: Implement atomic operations")
Cc: stable@kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Allison Henderson <achender@kernel.org>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/rds/rdma.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -960,8 +960,11 @@ int rds_cmsg_atomic(struct rds_sock *rs,
}
ret = rds_pin_pages(args->local_addr, 1, &page, 1);
- if (ret != 1)
+ if (ret != 1) {
+ /* A failed pin can leave a stale page pointer. */
+ page = NULL;
goto err;
+ }
ret = 0;
sg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 695/990] net/smc: fix lgr/lnk lifetime vs diag reader race
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (693 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 694/990] net/rds: Do not unpin a page after a failed atomic pin Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 696/990] net/smc: fix link group ownership in handshake abort Greg Kroah-Hartman
` (157 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mahanta Jambigi, Sidraya Jayagond,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahanta Jambigi <mjambigi@linux.ibm.com>
commit d7900fa51642fbc2a5a03354238e71050a7d391d upstream.
The diag dump walks the socket hash table under a read_lock and
dereferences conn->lgr and conn->lnk. Several paths expose a window
where a hashed socket has freed or partially freed conn/lgr/lnk state.
First, smc_conn_abort() calls smc_conn_free() during early handshake
aborts while the socket is still hashed in SMC_INIT, synchronously
freeing the lgr on the smc_lgr_cleanup_early() path without holding the
hash write_lock. A concurrent diag reader can load a non-NULL conn->lgr
and dereference it after the kfree. Skip the connection, link group and
DMB attributes in __smc_diag_dump() for sockets in SMC_INIT or
SMC_CLOSED or fallen back to TCP, and take diag_mode from an is_smcd
flag cached at connection creation.
The state filter alone does not close the race. A connection aborted by
a failed handshake can keep its alert token, because smc_conn_free()
skips the unregister when smc_lgr_terminate_sched() has emptied
lgr->list; close_work may also have been queued before the abort, as the
CDC receive path is not excluded by the handshake's socket lock.
smc_close_passive_work() would then move the hashed socket from SMC_INIT
to SMC_APPCLOSEWAIT1 or SMC_PROCESSABORT, states the filter does not
cover, and later run a passive-closing sock_put() that
smc_connect_decline_fallback() dropped already. Return early from
smc_close_passive_work() when the connection was freed; the check holds
the socket lock that every smc_conn_free() caller holds as well, so a
hashed socket with a freed connection stays in SMC_INIT or SMC_CLOSED
until release.
This changes the sock_diag output for such sockets: the connection, link
group and DMB attributes are omitted, which smcss does not read for
sockets in these states, while SMC_DIAG_FALLBACK is still reported and
an SMC-D socket in SMC_INIT or SMC_CLOSED still reports
SMC_DIAG_MODE_SMCD from the cached flag. A fallback socket is a plain
TCP socket with no SMC connection state to report; the stale conn fields
left behind by smc_conn_abort() must not be read.
Second, in smc_conn_kill() on SMC-D with dmb_nocopy, smcd_buf_detach()
NULLs and frees conn->sndbuf_desc while the socket is still hashed. A
concurrent diag reader entering the CONNINFO block can dereference the
freed descriptor. Unhash the socket right before smcd_buf_detach(). As a
result, killed ACTIVE and APPCLOSEWAIT sockets that are still open are
no longer visible to smcss on loopback-ism devices.
Third, in the terminal teardown branches of smc_close_active_abort()
(PEERCLOSEWAIT and PROCESSABORT groups) and in smc_close_passive_work(),
smc_conn_free() drops lgr and lnk references while the socket is still
hashed. Unhash immediately before each smc_conn_free() call at those
sites. Sockets killed in those close states are therefore unhashed, and
their inuse accounting dropped, before close(), even if the fd is still
open.
Fourth, use smp_load_acquire() / smp_store_release() on sk_state to
order these checks on weakly ordered CPUs. A reader that observes
SMC_ACTIVE is guaranteed to see the connection setup that preceded the
store; a reader that observes SMC_CLOSED from smc_listen_out_err() skips
the connection fields in any case, so that particular store is hardening
kept for uniformity, not a required ordering.
Additionally, in __smc_diag_dump(), use the cached link->ibname instead
of link->smcibdev->ibdev->name, avoiding a NULL pointer dereference or
use-after-free of the IB device when __smcr_link_clear() zeroes the link
during concurrent SMC-R link failover. The link data is still read
without conns_lock or send_lock, so a dump racing a failover may
transiently report zeroed or mixed link fields; this does not affect
memory safety and the next dump reports the new link. Like the SMC
netlink link dump and the tracepoints, the name is the one cached at
link creation time.
Fixes: f16a7dd5cf27 ("smc: netlink interface for SMC sockets")
Fixes: 2a0674fffb6b ("net/smc: improve abnormal termination of link groups")
Fixes: 46c28dbd4c23 ("net/smc: no socket state changes in tasklet context")
Fixes: 9dbe086c69b8 ("net/smc: fix invalid link access in dumping SMC-R connections")
Fixes: ae2be35cbed2 ("net/smc: {at|de}tach sndbuf to peer DMB if supported")
Cc: stable@vger.kernel.org
Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
Link: https://patch.msgid.link/20261102083122.1098393-1-mjambigi@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/smc/af_smc.c | 10 +++++-----
net/smc/smc.h | 1 +
net/smc/smc_close.c | 14 ++++++++++++++
net/smc/smc_core.c | 8 +++++++-
net/smc/smc_diag.c | 12 ++++++++----
5 files changed, 35 insertions(+), 10 deletions(-)
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -976,7 +976,7 @@ static int smc_connect_fallback(struct s
smc_copy_sock_settings_to_clc(smc);
smc->connect_nonblock = 0;
if (smc->sk.sk_state == SMC_INIT)
- smc->sk.sk_state = SMC_ACTIVE;
+ smp_store_release(&smc->sk.sk_state, SMC_ACTIVE);
return 0;
}
@@ -1381,7 +1381,7 @@ static int smc_connect_rdma(struct smc_s
smc_copy_sock_settings_to_clc(smc);
smc->connect_nonblock = 0;
if (smc->sk.sk_state == SMC_INIT)
- smc->sk.sk_state = SMC_ACTIVE;
+ smp_store_release(&smc->sk.sk_state, SMC_ACTIVE);
return 0;
connect_abort:
@@ -1484,7 +1484,7 @@ static int smc_connect_ism(struct smc_so
smc_copy_sock_settings_to_clc(smc);
smc->connect_nonblock = 0;
if (smc->sk.sk_state == SMC_INIT)
- smc->sk.sk_state = SMC_ACTIVE;
+ smp_store_release(&smc->sk.sk_state, SMC_ACTIVE);
return 0;
connect_abort:
@@ -1955,7 +1955,7 @@ static void smc_listen_out_connected(str
struct sock *newsmcsk = &new_smc->sk;
if (newsmcsk->sk_state == SMC_INIT)
- newsmcsk->sk_state = SMC_ACTIVE;
+ smp_store_release(&newsmcsk->sk_state, SMC_ACTIVE);
smc_listen_out(new_smc);
}
@@ -1969,7 +1969,7 @@ static void smc_listen_out_err(struct sm
this_cpu_inc(net->smc.smc_stats->srv_hshake_err_cnt);
if (newsmcsk->sk_state == SMC_INIT)
sock_put(&new_smc->sk); /* passive closing */
- newsmcsk->sk_state = SMC_CLOSED;
+ smp_store_release(&newsmcsk->sk_state, SMC_CLOSED);
smc_listen_out(new_smc);
}
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -196,6 +196,7 @@ struct smc_connection {
struct rb_node alert_node;
struct smc_link_group *lgr; /* link group of connection */
struct smc_link *lnk; /* assigned SMC-R link */
+ bool is_smcd; /* SMC-R or SMC-D connection */
u32 alert_token_local; /* unique conn. id */
u8 peer_rmbe_idx; /* from tcp handshake */
int peer_rmbe_size; /* size of peer rx buffer */
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -154,6 +154,7 @@ void smc_close_active_abort(struct smc_s
if (sk->sk_state != SMC_PEERABORTWAIT)
break;
sk->sk_state = SMC_CLOSED;
+ sk->sk_prot->unhash(sk);
smc_conn_free(&smc->conn);
release_clcsock = true;
sock_put(sk); /* passive closing */
@@ -165,6 +166,7 @@ void smc_close_active_abort(struct smc_s
if (sk->sk_state != SMC_PEERABORTWAIT)
break;
sk->sk_state = SMC_CLOSED;
+ sk->sk_prot->unhash(sk);
smc_conn_free(&smc->conn);
release_clcsock = true;
break;
@@ -367,6 +369,17 @@ static void smc_close_passive_work(struc
lock_sock(sk);
old_state = sk->sk_state;
+ if (conn->freed) {
+ /* conn->freed is set under the socket lock, which is
+ * held here as well, so this cannot race with the free; the
+ * state machine and its postponed sock_put() are not owed
+ * anymore
+ */
+ release_sock(sk);
+ sock_put(sk); /* sock_hold done by schedulers of close_work */
+ return;
+ }
+
rxflags = &conn->local_rx_ctrl.conn_state_flags;
if (rxflags->peer_conn_abort) {
/* peer has not received all data */
@@ -433,6 +446,7 @@ wakeup:
sk->sk_state_change(sk);
if ((sk->sk_state == SMC_CLOSED) &&
(sock_flag(sk, SOCK_DEAD) || !sk->sk_socket)) {
+ sk->sk_prot->unhash(sk);
smc_conn_free(conn);
if (smc->clcsock)
release_clcsock = true;
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -1516,8 +1516,10 @@ static void smc_conn_kill(struct smc_con
tasklet_kill(&conn->rx_tsklet);
else
tasklet_unlock_wait(&conn->rx_tsklet);
- if (smc_ism_support_dmb_nocopy(conn->lgr->smcd))
+ if (smc_ism_support_dmb_nocopy(conn->lgr->smcd)) {
+ smc->sk.sk_prot->unhash(&smc->sk);
smcd_buf_detach(conn);
+ }
} else {
smc_cdc_wait_pend_tx_wr(conn);
}
@@ -2037,6 +2039,10 @@ create:
goto out;
}
}
+ /* cache the connection type: smc_diag reads it after
+ * smc_conn_free() dropped the link group reference
+ */
+ conn->is_smcd = conn->lgr->is_smcd;
smc_lgr_hold(conn->lgr); /* lgr_put in smc_conn_free() */
if (!conn->lgr->is_smcd)
smcr_link_hold(conn->lnk); /* link_put in smc_conn_free() */
--- a/net/smc/smc_diag.c
+++ b/net/smc/smc_diag.c
@@ -87,10 +87,10 @@ static int __smc_diag_dump(struct sock *
r = nlmsg_data(nlh);
smc_diag_msg_common_fill(r, sk);
- r->diag_state = sk->sk_state;
+ r->diag_state = smp_load_acquire(&sk->sk_state);
if (smc->use_fallback)
r->diag_mode = SMC_DIAG_MODE_FALLBACK_TCP;
- else if (smc_conn_lgr_valid(&smc->conn) && smc->conn.lgr->is_smcd)
+ else if (smc->conn.is_smcd)
r->diag_mode = SMC_DIAG_MODE_SMCD;
else
r->diag_mode = SMC_DIAG_MODE_SMCR;
@@ -103,6 +103,10 @@ static int __smc_diag_dump(struct sock *
if (nla_put(skb, SMC_DIAG_FALLBACK, sizeof(fallback), &fallback) < 0)
goto errout;
+ if (r->diag_state == SMC_INIT || r->diag_state == SMC_CLOSED ||
+ smc->use_fallback)
+ goto out;
+
if ((req->diag_ext & (1 << (SMC_DIAG_CONNINFO - 1))) &&
smc->conn.alert_token_local) {
struct smc_connection *conn = &smc->conn;
@@ -154,8 +158,7 @@ static int __smc_diag_dump(struct sock *
.lnk[0].link_id = link->link_id,
};
- memcpy(linfo.lnk[0].ibname, link->smcibdev->ibdev->name,
- sizeof(link->smcibdev->ibdev->name));
+ memcpy(linfo.lnk[0].ibname, link->ibname, sizeof(link->ibname));
smc_gid_be16_convert(linfo.lnk[0].gid, link->gid);
smc_gid_be16_convert(linfo.lnk[0].peer_gid, link->peer_gid);
@@ -185,6 +188,7 @@ static int __smc_diag_dump(struct sock *
goto errout;
}
+out:
nlmsg_end(skb, nlh);
return 0;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 696/990] net/smc: fix link group ownership in handshake abort
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (694 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 695/990] net/smc: fix lgr/lnk lifetime vs diag reader race Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 697/990] net: bridge: use one headroom snapshot for ND replies Greg Kroah-Hartman
` (156 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mahanta Jambigi, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahanta Jambigi <mjambigi@linux.ibm.com>
commit e227b511582828c5a6513f70fc6a71211e5efbf0 upstream.
An aborted first-contact handshake can hang the handshake worker on the
socket lock it already holds, reset the clcsock of a socket that has
fallen back to TCP, or corrupt the alert-node lookup when the handshake
retries with the same connection.
The abort leaves a connection registered in a link group that another
context has already unlinked for termination: smc_conn_free() skips the
unregister when lgr->list is empty, so the alert token and alert node
stay in lgr->conns_all. If the handshake retries another device or SMC
version, smc_conn_create() creates a second link group and
smc_lgr_register_conn() inserts the same alert node into it: the token
loop is skipped, rb_link_node() links a node that is still in the old
tree into the new one, and a second sock_hold() is taken where only one
sock_put() will follow. The old group's terminator then keeps returning
that node from rb_first() and can kill a connection that now belongs to
the new group.
smc_lgr_cleanup_early() also starts a second termination of the link
group that is already being terminated, which takes lock_sock() on the
socket the handshake worker holds; if the termination work wins the race
instead, it later kills the freed connection and aborts the clcsock of a
socket that has fallen back to TCP. Making the unregister unconditional
also lets smc_conn_free() reach the delayed free work on a claimed link
group, where the lockless freeing check can arm it after the owner has
cancelled it.
Always unregister the connection, claim a link group for termination
once under lgr_lock, keep the link group alive across the abort, and arm
the delayed free work only under the same lock and cancel it
synchronously before the teardown. Drop an already freed connection in
smc_conn_kill() without running the connection and socket teardown.
Fixes: 2a0674fffb6b ("net/smc: improve abnormal termination of link groups")
Fixes: f9aab6f2ce57 ("net/smc: immediate freeing in smc_lgr_cleanup_early()")
Cc: stable@vger.kernel.org
Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Link: https://patch.msgid.link/20261106130457.1092203-1-mjambigi@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/smc/af_smc.c | 11 ++++---
net/smc/smc_core.c | 78 ++++++++++++++++++++++++++++++++++++++---------------
net/smc/smc_core.h | 6 ++--
3 files changed, 65 insertions(+), 30 deletions(-)
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1009,14 +1009,15 @@ static void smc_conn_abort(struct smc_so
{
struct smc_connection *conn = &smc->conn;
struct smc_link_group *lgr = conn->lgr;
- bool lgr_valid = false;
-
- if (smc_conn_lgr_valid(conn))
- lgr_valid = true;
+ bool lgr_valid = local_first && smc_conn_lgr_valid(conn);
+ if (lgr_valid)
+ smc_lgr_hold(lgr); /* lgr_put below */
smc_conn_free(conn);
- if (local_first && lgr_valid)
+ if (lgr_valid) {
smc_lgr_cleanup_early(lgr);
+ smc_lgr_put(lgr);
+ }
}
/* check if there is a rdma device available for this connection. */
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -80,16 +80,21 @@ static void smc_ibdev_cnt_dec(struct smc
static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
{
+ spinlock_t *lgr_lock;
+
/* client link group creation always follows the server link group
* creation. For client use a somewhat higher removal delay time,
* otherwise there is a risk of out-of-sync link groups.
*/
+ smc_lgr_list_head(lgr, &lgr_lock);
+ spin_lock_bh(lgr_lock);
if (!lgr->freeing) {
mod_delayed_work(system_percpu_wq, &lgr->free_work,
(!lgr->is_smcd && lgr->role == SMC_CLNT) ?
SMC_LGR_FREE_DELAY_CLNT :
SMC_LGR_FREE_DELAY_SERV);
}
+ spin_unlock_bh(lgr_lock);
}
/* Register connection's alert token in our lookup structure.
@@ -679,19 +684,34 @@ int smcd_nl_get_lgr(struct sk_buff *skb,
return skb->len;
}
-void smc_lgr_cleanup_early(struct smc_link_group *lgr)
+/* Claim a link group for termination. Only one context can succeed: the
+ * lgr is removed from its list and marked freeing under lgr_lock.
+ * Returns false if @lgr is NULL or another context owns it.
+ */
+static bool smc_lgr_claim(struct smc_link_group *lgr)
{
spinlock_t *lgr_lock;
if (!lgr)
- return;
-
+ return false;
smc_lgr_list_head(lgr, &lgr_lock);
spin_lock_bh(lgr_lock);
+ if (lgr->freeing || lgr->terminating || list_empty(&lgr->list)) {
+ spin_unlock_bh(lgr_lock);
+ return false;
+ }
/* do not use this link group for new connections */
- if (!list_empty(&lgr->list))
- list_del_init(&lgr->list);
+ list_del_init(&lgr->list);
+ lgr->freeing = 1;
spin_unlock_bh(lgr_lock);
+ return true;
+}
+
+/* The caller must keep @lgr alive for the duration of the call. */
+void smc_lgr_cleanup_early(struct smc_link_group *lgr)
+{
+ if (!smc_lgr_claim(lgr))
+ return; /* another context owns the termination */
__smc_lgr_terminate(lgr, true);
}
@@ -1265,10 +1285,12 @@ void smc_conn_free(struct smc_connection
if (current_work() != &conn->abort_work)
cancel_work_sync(&conn->abort_work);
}
- if (!list_empty(&lgr->list)) {
+ /* The handshake can retry another device or SMC version with this
+ * connection, so it must never stay registered in an lgr it left.
+ */
+ if (!list_empty(&lgr->list))
smc_buf_unuse(conn, lgr); /* allow buffer reuse */
- smc_lgr_unregister_conn(conn);
- }
+ smc_lgr_unregister_conn(conn);
if (!lgr->conns_num)
smc_lgr_schedule_free_work(lgr);
@@ -1503,6 +1525,15 @@ static void smc_conn_kill(struct smc_con
{
struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
+ if (conn->freed) {
+ /* The connection was already freed, e.g. by a close or
+ * a handshake that fell back to TCP. Do not abort a socket
+ * that is no longer part of this link group.
+ */
+ smc_lgr_unregister_conn(conn);
+ return;
+ }
+
if (conn->lgr->is_smcd && conn->lgr->peer_shutdown)
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
else
@@ -1550,12 +1581,20 @@ static void __smc_lgr_terminate(struct s
struct smc_connection *conn;
struct smc_sock *smc;
struct rb_node *node;
+ spinlock_t *lgr_lock;
- if (lgr->terminating)
+ smc_lgr_list_head(lgr, &lgr_lock);
+ spin_lock_bh(lgr_lock);
+ if (lgr->terminating) {
+ spin_unlock_bh(lgr_lock);
return; /* lgr already terminating */
- /* cancel free_work sync, will terminate when lgr->freeing is set */
- cancel_delayed_work(&lgr->free_work);
+ }
lgr->terminating = 1;
+ spin_unlock_bh(lgr_lock);
+ /* The lgr is claimed, so no new free_work can be armed; wait for
+ * one that is already queued or running.
+ */
+ cancel_delayed_work_sync(&lgr->free_work);
/* kill remaining link group connections */
read_lock_bh(&lgr->conns_lock);
@@ -1566,7 +1605,11 @@ static void __smc_lgr_terminate(struct s
sock_hold(&smc->sk); /* sock_put below */
read_unlock_bh(&lgr->conns_lock);
lock_sock(&smc->sk);
- smc_conn_kill(conn, soft);
+ /* The connection may have been re-registered in another
+ * link group by a retried handshake in the meantime.
+ */
+ if (conn->lgr == lgr)
+ smc_conn_kill(conn, soft);
release_sock(&smc->sk);
sock_put(&smc->sk); /* sock_hold above */
read_lock_bh(&lgr->conns_lock);
@@ -1580,17 +1623,8 @@ static void __smc_lgr_terminate(struct s
/* unlink link group and schedule termination */
void smc_lgr_terminate_sched(struct smc_link_group *lgr)
{
- spinlock_t *lgr_lock;
-
- smc_lgr_list_head(lgr, &lgr_lock);
- spin_lock_bh(lgr_lock);
- if (list_empty(&lgr->list) || lgr->terminating || lgr->freeing) {
- spin_unlock_bh(lgr_lock);
+ if (!smc_lgr_claim(lgr))
return; /* lgr already terminating */
- }
- list_del_init(&lgr->list);
- lgr->freeing = 1;
- spin_unlock_bh(lgr_lock);
schedule_work(&lgr->terminate_work);
}
--- a/net/smc/smc_core.h
+++ b/net/smc/smc_core.h
@@ -297,9 +297,9 @@ struct smc_link_group {
struct delayed_work free_work; /* delayed freeing of an lgr */
struct work_struct terminate_work; /* abnormal lgr termination */
struct workqueue_struct *tx_wq; /* wq for conn. tx workers */
- u8 sync_err : 1; /* lgr no longer fits to peer */
- u8 terminating : 1;/* lgr is terminating */
- u8 freeing : 1; /* lgr is being freed */
+ u8 sync_err; /* lgr no longer fits to peer */
+ u8 terminating; /* lgr is terminating */
+ u8 freeing; /* lgr is being freed */
refcount_t refcnt; /* lgr reference count */
bool is_smcd; /* SMC-R or SMC-D */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 697/990] net: bridge: use one headroom snapshot for ND replies
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (695 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 696/990] net/smc: fix link group ownership in handshake abort Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 698/990] net: dsa: microchip: initialize the IRQ access mutex Greg Kroah-Hartman
` (155 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, TencentOS Corvus AI,
Jun Yang, Nikolay Aleksandrov, Ido Schimmel, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun Yang <junvyyang@tencent.com>
commit e573df093ef849bb7c763aed591cb6556b110671 upstream.
br_nd_send() calls LL_RESERVED_SPACE(dev) once to size the reply skb and
again to reserve its headroom. When a port requiring more headroom is
added to the bridge, br_add_if() can increase dev->needed_headroom
between the two calls. The reserved headroom can then exceed the space
accounted for by alloc_skb().
Take one headroom snapshot and use it for both the allocation size and
skb_reserve().
Fixes: ed842faeb2bd ("bridge: suppress nd pkts on BR_NEIGH_SUPPRESS ports")
Cc: stable@kernel.org
Reported-by: TencentOS Corvus AI <corvus@tencent.com>
Signed-off-by: Jun Yang <junvyyang@tencent.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261103075439.43644-1-juny24602@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bridge/br_arp_nd_proxy.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/net/bridge/br_arp_nd_proxy.c
+++ b/net/bridge/br_arp_nd_proxy.c
@@ -262,6 +262,7 @@ static void br_nd_send(struct net_bridge
struct sk_buff *reply;
struct ipv6hdr *pip6;
int na_olen = 8; /* opt hdr + ETH_ALEN for target */
+ int headroom;
int ns_olen;
int i, len;
u8 *daddr;
@@ -271,7 +272,8 @@ static void br_nd_send(struct net_bridge
if (!dev || skb_linearize(request))
return;
- len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr) +
+ headroom = LL_RESERVED_SPACE(dev);
+ len = headroom + sizeof(struct ipv6hdr) +
sizeof(*na) + na_olen + dev->needed_tailroom;
reply = alloc_skb(len, GFP_ATOMIC);
@@ -280,7 +282,7 @@ static void br_nd_send(struct net_bridge
reply->protocol = htons(ETH_P_IPV6);
reply->dev = dev;
- skb_reserve(reply, LL_RESERVED_SPACE(dev));
+ skb_reserve(reply, headroom);
skb_push(reply, sizeof(struct ethhdr));
skb_set_mac_header(reply, 0);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 698/990] net: dsa: microchip: initialize the IRQ access mutex
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (696 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 697/990] net: bridge: use one headroom snapshot for ND replies Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 699/990] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls Greg Kroah-Hartman
` (154 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Tapio Reijonen, Daniel Machon,
Paolo Abeni
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <tapio.reijonen@vaisala.com>
commit ba1dc196502f3435f4ae53ed6745caacf066f83e upstream.
ksz_switch_register() initializes dev_mutex, regmap_mutex, alu_mutex and
vlan_mutex but not lock_irq, which the IRQ chip takes in its bus lock
callbacks on every mask and unmask of a switch interrupt, and the PTP
code takes the same way. The zeroed mutex happens to work on the
uncontended fast path, but with CONFIG_DEBUG_MUTEXES the first lock,
from the IRQ domain mapping during probe, warns:
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: kernel/locking/mutex.c:625 at __mutex_lock
...
ksz_irq_domain_map
irq_domain_associate_locked
irq_create_mapping_affinity
ksz_irq_common_setup
ksz9477_setup
dsa_register_switch
ksz_spi_probe
and turns lock debugging off for the rest of the boot.
Initialize it with the other mutexes.
Triggered at every boot of a KSZ9897S over SPI on an i.MX6 SoloX board
with CONFIG_DEBUG_MUTEXES, on v7.4-rc1 and earlier. With this patch the
same board boots with lock debugging enabled and it stays enabled
(debug_locks 1) through two hours of unrelated stress tests.
Fixes: c9cd961c0d43 ("net: dsa: microchip: lan937x: add interrupt support for port phy link")
Cc: stable@vger.kernel.org
Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20261104-ksz-irq-mutex-init-v1-1-e3bb7d9dbd80@vaisala.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/dsa/microchip/ksz_common.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -5418,6 +5418,7 @@ int ksz_switch_register(struct ksz_devic
mutex_init(&dev->regmap_mutex);
mutex_init(&dev->alu_mutex);
mutex_init(&dev->vlan_mutex);
+ mutex_init(&dev->lock_irq);
ret = ksz_switch_detect(dev);
if (ret)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 699/990] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (697 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 698/990] net: dsa: microchip: initialize the IRQ access mutex Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 700/990] net: mana: report RX checksum offload for IPv6 Greg Kroah-Hartman
` (153 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Lukáš Lalinský,
Jens Axboe, Dave Miller
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <axboe@kernel.dk>
commit bdc350ddbcbe4788158019d4d8e8e9345cb16235 upstream.
____sys_sendmsg() and ____sys_recvmsg() turn O_NONBLOCK on the socket
into MSG_DONTWAIT. That is right for the system calls, but io_uring uses
__sys_sendmsg_sock() and __sys_recvmsg_sock() for a blocking attempt
from io-wq as well, after the non-blocking attempts with MSG_DONTWAIT
have failed. On an O_NONBLOCK socket that attempt can't block either and
the request completes with -EAGAIN, unlike IORING_OP_SEND and RECV,
which call sock_sendmsg() and sock_recvmsg() directly and don't look at
O_NONBLOCK at all.
Move the O_NONBLOCK handling to ___sys_sendmsg() and ___sys_recvmsg(),
which the sendmsg, sendmmsg, recvmsg and recvmmsg system calls go
through. The io_uring helpers then pass the flags the caller asked for.
Cc: stable@vger.kernel.org
Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()")
Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")
Link: https://lore.kernel.org/io-uring/a5589b66-9a20-4b1c-a0f1-1b5b31af3667@app.fastmail.com/
Reported-by: Lukáš Lalinský <lukas@lalinsky.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/socket.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- a/net/socket.c
+++ b/net/socket.c
@@ -2613,8 +2613,6 @@ static int ____sys_sendmsg(struct socket
flags &= ~MSG_INTERNAL_SENDMSG_FLAGS;
msg_sys->msg_flags = flags;
- if (sock->file->f_flags & O_NONBLOCK)
- msg_sys->msg_flags |= MSG_DONTWAIT;
/*
* If this is sendmmsg() and current destination address is same as
* previously succeeded address, omit asking LSM's decision.
@@ -2678,6 +2676,9 @@ static int ___sys_sendmsg(struct socket
msg_sys->msg_name = &address;
+ if (sock->file->f_flags & O_NONBLOCK)
+ flags |= MSG_DONTWAIT;
+
err = sendmsg_copy_msghdr(msg_sys, msg, flags, &iov);
if (err < 0)
return err;
@@ -2842,9 +2843,6 @@ static int ____sys_recvmsg(struct socket
/* We assume all kernel code knows the size of sockaddr_storage */
msg_sys->msg_namelen = 0;
- if (sock->file->f_flags & O_NONBLOCK)
- flags |= MSG_DONTWAIT;
-
if (unlikely(nosec))
err = sock_recvmsg_nosec(sock, msg_sys, flags);
else
@@ -2886,6 +2884,9 @@ static int ___sys_recvmsg(struct socket
struct sockaddr __user *uaddr;
ssize_t err;
+ if (sock->file->f_flags & O_NONBLOCK)
+ flags |= MSG_DONTWAIT;
+
err = recvmsg_copy_msghdr(msg_sys, msg, flags, &uaddr, &iov);
if (err < 0)
return err;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 700/990] net: mana: report RX checksum offload for IPv6
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (698 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 699/990] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 701/990] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl Greg Kroah-Hartman
` (152 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Haiyang Zhang, Hamza Mahfooz,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
commit bbcd02741c4cfbf9e1c59b1906f21ef772bd15eb upstream.
The hardware validates TCP and UDP checksums for both IPv4 and IPv6 and
reports the result in rx_tcp_csum_succeed and rx_udp_csum_succeed.
However, mana_rx_skb() also requires rx_iphdr_csum_succeed before it
sets CHECKSUM_UNNECESSARY. That bit is only set for IPv4 (since IPv6
has no header checksum), so IPv6 TCP and UDP traffic is always
checksummed again in software.
So, only look at the L4 result. For IPv4 this makes no material
difference since CHECKSUM_UNNECESSARY only covers the L4 checksum, and
ip_rcv_core() always verifies the IPv4 header checksum in software.
Between two Azure Standard_E16s_v6 VMs (VF enabled), IPv6 TCP and UDP
packets (including VXLAN over IPv6), now arrive with
CHECKSUM_UNNECESSARY instead of CHECKSUM_NONE, so GRO no longer
checksums them in software. Calls to __skb_gro_checksum_complete() on
the receiver during an 8 second iperf3 run:
before after
TCP/IPv4, 12.2 Gbps 23 28
TCP/IPv6, 12.1 Gbps 8728419 25
UDP/IPv6, 1.5 Gbps 1071380 20
TCP/VXLAN/IPv6, 10.9 Gbps 7934373 18
Cc: stable@vger.kernel.org
Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Link: https://patch.msgid.link/20261109142856.779955-1-hamzamahfooz@linux.microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -1978,10 +1978,9 @@ static void mana_rx_skb(void *buf_va, bo
skb_checksum_none_assert(skb);
skb_record_rx_queue(skb, rxq_idx);
- if ((ndev->features & NETIF_F_RXCSUM) && cqe->rx_iphdr_csum_succeed) {
- if (cqe->rx_tcp_csum_succeed || cqe->rx_udp_csum_succeed)
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- }
+ if ((ndev->features & NETIF_F_RXCSUM) &&
+ (cqe->rx_tcp_csum_succeed || cqe->rx_udp_csum_succeed))
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
if (cqe->rx_hashtype != 0 && (ndev->features & NETIF_F_RXHASH)) {
hash_value = cqe->ppi[0].pkt_hash;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 701/990] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (699 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 700/990] net: mana: report RX checksum offload for IPv6 Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 702/990] net: usb: lan78xx: let unregister_netdev() stop phylink Greg Kroah-Hartman
` (151 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, James Clark, Maxime Chevallier,
Lorenzo Bianconi, Kory Maincent, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <jjc@jclark.com>
commit b66fca408bf85bb40f48a689daac75421f5283f8 upstream.
Commit 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to
ptp_clock_info") modified the PTP core to validate the supported flags
of external timestamp requests, rather than relying on each driver to
check them.
stmmac_enable() and dwmac1000_ptp_enable() ignore the flags, and
neither stmmac_ptp_clock_ops nor dwmac1000_ptp_clock_ops was given any
.supported_extts_flags. Since PTP_EXTTS_REQUEST2 always implies
PTP_STRICT_FLAGS, the core now rejects every PTP_EXTTS_REQUEST2 for
this driver with -EOPNOTSUPP, where before that commit the same
requests succeeded. Only the PTP_EXTTS_REQUEST ioctl still works.
Tests on an NXP i.MX 8M Plus (FRDM-IMX8MPLUS, GMAC 5.10a) show that the
auxiliary snapshot inputs timestamp just the rising edge. The reference
manuals for the STM32MP13 (GMAC 4.20a) and the Cyclone V HPS (GMAC
3.70a, which uses dwmac1000_ptp_clock_ops) say the same.
Encode this in .supported_extts_flags. A PTP_EXTTS_REQUEST2 for the
rising edge then succeeds, and one for the falling edge or for both
edges fails with -EOPNOTSUPP.
Fixes: 7c571ac57d9d ("net: ptp: introduce .supported_extts_flags to ptp_clock_info")
Cc: stable@vger.kernel.org
Signed-off-by: James Clark <jjc@jclark.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20261104052504.1886335-1-jjc@jclark.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -302,6 +302,7 @@ const struct ptp_clock_info stmmac_ptp_c
.n_per_out = 0, /* will be overwritten in stmmac_ptp_register */
.n_pins = 0,
.pps = 0,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = stmmac_adjust_freq,
.adjtime = stmmac_adjust_time,
.gettime64 = stmmac_get_time,
@@ -319,6 +320,7 @@ const struct ptp_clock_info dwmac1000_pt
.n_per_out = 0,
.n_pins = 0,
.pps = 0,
+ .supported_extts_flags = PTP_RISING_EDGE | PTP_STRICT_FLAGS,
.adjfine = stmmac_adjust_freq,
.adjtime = stmmac_adjust_time,
.gettime64 = stmmac_get_time,
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 702/990] net: usb: lan78xx: let unregister_netdev() stop phylink
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (700 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 701/990] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 703/990] xsk: defer software checksum until the skb is complete Greg Kroah-Hartman
` (150 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Bin Yu, Cheng Wen, YuanZhe Liu,
Oleksij Rempel, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit 9280128245612b30ca4a238daa6a777b0f4e583e upstream.
lan78xx_disconnect() stops phylink before unregistering the net device.
phylink_start() is only called from lan78xx_open(), so when the device is
unplugged before the interface has been brought up, the attached PHY is
still in PHY_READY and phy_stop() reports:
called from state READY
WARNING: drivers/net/phy/phy.c:1670 at phy_stop+0xad/0x380
The same warning is emitted after an ifup/ifdown cycle, where the PHY is
already in PHY_HALTED.
unregister_netdev() already closes a running device, which calls
lan78xx_stop() and phylink_stop() with dev->dev_mutex held and after the
URBs have been terminated. Unregister first and disconnect the PHY
afterwards, so the interface is stopped exactly once and only while it is
running, and the net device can no longer be opened while its phylink
instance has no PHY attached.
Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for improved PHY and MAC management")
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>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20261031165213.2738-1-25031212351@stu.xidian.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/usb/lan78xx.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -4594,13 +4594,12 @@ static void lan78xx_disconnect(struct us
udev = interface_to_usbdev(intf);
net = dev->net;
+ unregister_netdev(net);
+
rtnl_lock();
- phylink_stop(dev->phylink);
phylink_disconnect_phy(dev->phylink);
rtnl_unlock();
- unregister_netdev(net);
-
timer_shutdown_sync(&dev->stat_monitor);
set_bit(EVENT_DEV_DISCONNECT, &dev->flags);
cancel_delayed_work_sync(&dev->wq);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 703/990] xsk: defer software checksum until the skb is complete
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (701 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 702/990] net: usb: lan78xx: let unregister_netdev() stop phylink Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 704/990] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore Greg Kroah-Hartman
` (149 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Maciej Fijalkowski,
Stanislav Fomichev, Jason Xing, Rongzheng Wang, Paolo Abeni
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rongzheng Wang <testwrzwrz@gmail.com>
commit f2eddafbfcc004098425fee7c5664adbe29152d7 upstream.
When XDP_UMEM_TX_SW_CSUM is used with multi-buffer TX, xsk_skb_metadata()
calls skb_checksum_help() while only the first descriptor has been added to
the skb. The checksum therefore covers just the first fragment, and
skb_checksum_help() sets ip_summed to CHECKSUM_NONE, so the remaining
fragments are never included in the checksum.
Move the software checksum calculation to the point where the last
descriptor has been added to the skb.
On a checksum failure the packet is now dropped instead of being returned
to the application for a retry. This path is not reachable with the
existing metadata validation, but the behavior change is intentional.
Fixes: 11614723af26 ("xsk: Add option to calculate TX checksum in SW")
Cc: stable@vger.kernel.org
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Rongzheng Wang <testwrzwrz@gmail.com>
Link: https://patch.msgid.link/20261104034809.24545-2-testwrzwrz@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/xdp/xsk.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -902,14 +902,6 @@ static int xsk_skb_metadata(struct sk_bu
skb->csum_start = hr + csum_start;
skb->csum_offset = csum_offset;
skb->ip_summed = CHECKSUM_PARTIAL;
-
- if (unlikely(pool->tx_sw_csum)) {
- int err;
-
- err = skb_checksum_help(skb);
- if (err)
- return err;
- }
}
if (flags & XDP_TXMD_FLAGS_LAUNCH_TIME)
@@ -921,6 +913,15 @@ static int xsk_skb_metadata(struct sk_bu
return 0;
}
+static int xsk_skb_sw_csum(struct sk_buff *skb, struct xsk_buff_pool *pool)
+{
+ if (unlikely(pool->tx_sw_csum &&
+ skb->ip_summed == CHECKSUM_PARTIAL))
+ return skb_checksum_help(skb);
+
+ return 0;
+}
+
static struct sk_buff *xsk_build_skb_zerocopy(struct xdp_sock *xs,
struct xdp_desc *desc)
{
@@ -1174,6 +1175,12 @@ static int __xsk_generic_xmit(struct soc
continue;
}
+ err = xsk_skb_sw_csum(skb, xs->pool);
+ if (unlikely(err)) {
+ xsk_drop_skb(skb);
+ goto out;
+ }
+
err = __dev_direct_xmit(skb, xs->queue_id);
if (err == NETDEV_TX_BUSY) {
/* Tell user-space to retry the send */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 704/990] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (702 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 703/990] xsk: defer software checksum until the skb is complete Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 705/990] tsacct: Keep task begin times stable across suspend Greg Kroah-Hartman
` (148 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jerome Mohm, Stefano Garzarella,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Mohm <jrmmhm.kernel@eldare.de>
commit 2a24ba1694f14299fbde3fa107e5d56629f2f8b6 upstream.
virtio_vsock_vqs_del() frees the virtqueues but leaves vsock->vqs[]
pointing at them. If virtio_vsock_restore() then fails, the driver
stays bound with a dangling vqs[], and the next freeze or unbind
passes a freed virtqueue to virtqueue_detach_unused_buf():
BUG: KASAN: slab-use-after-free in virtqueue_detach_unused_buf
virtio_vsock_vqs_del (net/vmw_vsock/virtio_transport.c:785)
virtio_vsock_remove
Freed by task ...:
vp_del_vqs
virtio_vsock_freeze
Clear vqs[] after del_vqs() and when virtio_find_vqs() fails. Return
early from virtio_vsock_vqs_del() when vqs[] is empty: the detach
loops would pass NULL to virtqueue_detach_unused_buf(), and a second
del_vqs() would free virtio-mmio's IRQ again, which only WARNs in
free_irq() ("Trying to free already-free IRQ").
Found with the help of Anthropic's Claude and reproduced on virtio-pci
and virtio-mmio by failing the restore with failslab, without other
kernel changes; the virtio-mmio WARN was found by the netdev Sashiko
review and reproduced with v1 of this patch. With this patch neither
report appears on virtio-pci or virtio-mmio guests, and the vsock
vmtest.sh single-VM tests pass. A find_vqs() failure after some
virtqueues were set up was not exercised.
Fixes: bd50c5dc182b ("vsock/virtio: add support for device suspend/resume")
Cc: stable@vger.kernel.org
Signed-off-by: Jerome Mohm <jrmmhm.kernel@eldare.de>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://patch.msgid.link/20261109-vsock-restore-uaf-send-v4-1-1df8dfb5d5de@eldare.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/vmw_vsock/virtio_transport.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -690,8 +690,10 @@ static int virtio_vsock_vqs_init(struct
atomic_set(&vsock->queued_replies, 0);
ret = virtio_find_vqs(vdev, VSOCK_VQ_MAX, vsock->vqs, vqs_info, NULL);
- if (ret < 0)
+ if (ret < 0) {
+ memset(vsock->vqs, 0, sizeof(vsock->vqs));
return ret;
+ }
virtio_vsock_update_guest_cid(vsock);
@@ -752,11 +754,19 @@ static void virtio_vsock_vqs_del(struct
vsock->event_run = false;
mutex_unlock(&vsock->event_lock);
+ virtio_vsock_skb_queue_purge(&vsock->send_pkt_queue);
+
/* Flush all device writes and interrupts, device will not use any
* more buffers.
*/
virtio_reset_device(vdev);
+ /* After a failed restore no virtqueues are live, and a second
+ * del_vqs() would free virtio-mmio's IRQ again (a WARN in free_irq()).
+ */
+ if (!vsock->vqs[VSOCK_VQ_RX])
+ return;
+
mutex_lock(&vsock->rx_lock);
while ((skb = virtqueue_detach_unused_buf(vsock->vqs[VSOCK_VQ_RX])))
kfree_skb(skb);
@@ -767,10 +777,10 @@ static void virtio_vsock_vqs_del(struct
kfree_skb(skb);
mutex_unlock(&vsock->tx_lock);
- virtio_vsock_skb_queue_purge(&vsock->send_pkt_queue);
-
/* Delete virtqueues and flush outstanding callbacks if any */
vdev->config->del_vqs(vdev);
+
+ memset(vsock->vqs, 0, sizeof(vsock->vqs));
}
static int virtio_vsock_probe(struct virtio_device *vdev)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 705/990] tsacct: Keep task begin times stable across suspend
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (703 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 704/990] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 706/990] tls: only install push_pending_record for a TX context Greg Kroah-Hartman
` (147 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Oleg Nesterov, Thomas Gleixner,
Hungyu Lin
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
commit c49b3c20a2d0b22700e2100a527e68e829ece7f0 upstream.
bacct_add_tsk() derives ac_btime and ac_btime64 by subtracting a
CLOCK_MONOTONIC elapsed duration from CLOCK_REALTIME. MONOTONIC stops
during suspend while REALTIME continues, so querying an existing task
after resume moves its reported begin time forward by the time spent
suspended.
Calculate the begin time from the wall-clock boot timestamp and the
task's CLOCK_BOOTTIME start timestamp instead. This accounts for suspend
and adds the nanoseconds before truncating to seconds. Keep ac_etime and
ac_tgetime on CLOCK_MONOTONIC and retain the existing rebasing when the
wall clock is adjusted.
The new begin time can be negative: setting CLOCK_REALTIME is bounded
by CLOCK_MONOTONIC, which excludes suspend, rather than CLOCK_BOOTTIME.
A permitted backward clock adjustment after suspend can therefore put
the task's begin time before the epoch. Clamp ac_btime64 at zero too,
instead of wrapping in the unsigned field, and retain its positive range.
Fixes: f3cef7a99469 ("[PATCH] csa: basic accounting over taskstats")
Reported-by: Oleg Nesterov <oleg@redhat.com>
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20130611200600.GA15168@redhat.com
Link: https://lore.kernel.org/r/alpine.DEB.2.21.1911071335320.4256@nanos.tec.linutronix.de
Link: https://patch.msgid.link/20261030054227.35453-3-dennylin0707@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/tsacct.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -24,7 +24,7 @@ void bacct_add_tsk(struct user_namespace
const struct cred *tcred;
u64 utime, stime, utimescaled, stimescaled;
u64 now_ns, delta;
- time64_t btime;
+ struct timespec64 btime;
BUILD_BUG_ON(TS_COMM_LEN < TASK_COMM_LEN);
@@ -39,9 +39,11 @@ void bacct_add_tsk(struct user_namespace
do_div(delta, NSEC_PER_USEC);
stats->ac_etime = delta;
/* Convert to seconds for btime (note y2106 limit) */
- btime = ktime_get_real_seconds() - div_u64(delta, USEC_PER_SEC);
- stats->ac_btime = clamp_t(time64_t, btime, 0, U32_MAX);
- stats->ac_btime64 = btime;
+ getboottime64(&btime);
+ btime = timespec64_add(btime, ns_to_timespec64(tsk->start_boottime));
+ stats->ac_btime = clamp_t(time64_t, btime.tv_sec, 0, U32_MAX);
+ /* Setting the clock back after suspend can make btime negative. */
+ stats->ac_btime64 = max_t(time64_t, btime.tv_sec, 0);
if (tsk->flags & PF_EXITING)
stats->ac_exitcode = tsk->exit_code;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 706/990] tls: only install push_pending_record for a TX context
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (704 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 705/990] tsacct: Keep task begin times stable across suspend Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 707/990] tcp: do not coalesce segments after FIN Greg Kroah-Hartman
` (146 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rishikesh Jethwani, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rishikesh Jethwani <rjethwani@purestorage.com>
commit c47e766c5307c06a78304582b2b5b5ab01ee1358 upstream.
tls_set_sw_offload() assigns ctx->push_pending_record for both
directions, but the hook is a TX-side dispatcher. On a socket whose TX
side is HW offloaded, tls_set_device_offload() installs
tls_device_push_pending_record(); any later TLS_RX setsockopt
overwrites it with tls_sw_push_pending_record(), because
tls_set_device_offload_rx() itself calls tls_set_sw_offload(sk, 0, NULL)
for the software half of a successful HW RX offload, and so does the
fallback when the RX offload is declined (NIC with TX-only offload,
tls_dev_add() failure).
>From then on tls_handle_open_record() (a TLS_SET_RECORD_TYPE cmsg after
a MSG_MORE send, or the close path with a pending writer) runs
tls_sw_push_pending_record() against priv_ctx_tx, which is a
struct tls_offload_context_tx, not a struct tls_sw_context_tx, and
reads open_rec from inside the offload context. On x86_64 without lock
debugging that field overlays sg_tx_data[2].dma_address, which is never
set, so the push is silently skipped and the data buffered by the
MSG_MORE send is later sent under the cmsg's record type, e.g.
application data in a handshake or alert record. Enabling
CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_LOCK_ALLOC and CONFIG_LOCKDEP, but
not CONFIG_LOCK_STAT, in the tested x86_64 configuration moves open_rec
over sg_tx_data[5].page_link. Once populated, its page pointer and
scatterlist flags are interpreted as a tls_rec pointer and dereferenced
while reading msg_plaintext.sg.size.
Only set the hook when initialising the TX side.
Found by code review while developing TLS 1.3 HW offload rekey support.
Tested with HW TLS TX and RX offload on Mellanox ConnectX-6 Dx (Crypto
Enabled): after setting TLS_RX, send() "AAAA" with MSG_MORE, then
sendmsg() "BBBB" with a TLS_SET_RECORD_TYPE cmsg for a handshake
record. Without this patch the peer receives a single handshake record
"AAAABBBB"; with it, an application data record "AAAA" followed by a
handshake record "BBBB".
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Cc: stable@vger.kernel.org
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
Link: https://patch.msgid.link/20261102213011.4191020-1-rjethwani@purestorage.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/tls/tls_sw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2933,7 +2933,8 @@ int tls_set_sw_offload(struct sock *sk,
}
}
- ctx->push_pending_record = tls_sw_push_pending_record;
+ if (tx)
+ ctx->push_pending_record = tls_sw_push_pending_record;
/* setkey is the last operation that could fail during a
* rekey. if it succeeds, we can start modifying the
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 707/990] tcp: do not coalesce segments after FIN
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (705 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 706/990] tls: only install push_pending_record for a TX context Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 708/990] tcp: fix authentication bypass via unsupported TCP auth options Greg Kroah-Hartman
` (145 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyunwoo Kim, Eric Dumazet,
Kuniyuki Iwashima, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <imv4bel@gmail.com>
commit 1c46780dec48893b8c25fd5e33a3127e8dc39dd4 upstream.
A FIN consumes a sequence number. If another FIN segment is coalesced
into an skb that already carries FIN, end_seq advances to account for
the additional FIN, but tcp_flags still contains only one FIN bit.
When the preceding gap is filled and tcp_ofo_queue() processes the
coalesced skb, rcv_nxt advances to the skb's end_seq. When the receive
path consumes all data in the skb, copied_seq advances by the data
length and one sequence number for FIN. If three or more FIN segments
have been coalesced into one skb, tcp_inq() can still return a positive
value after the receive queue becomes empty and the SOCK_DONE adjustment
is applied.
TCP_ZEROCOPY_RECEIVE is another consumer affected by this state.
tcp_zerocopy_receive() takes its length from tcp_inq() and follows
skb->next without checking for the end of the receive queue.
Software kTLS receive is one consumer affected by this state. When
strp->copy_mode is false, tls_strp_msg_consume() calls the TCP helper
tcp_read_done() to consume the current TLS record. In the reproducer,
tcp_read_done() consumed the record data and one FIN before freeing the
receive skb.
When kTLS looked for the next record, tcp_inq() reported at least
TLS_HEADER_SIZE bytes even though the receive queue was empty.
tcp_recv_skb() returned NULL, so tls_strp_load_anchor_with_queue() hit
WARN_ON_ONCE() and returned without updating the anchor.
Since tcp_inq() had reported at least TLS_HEADER_SIZE,
tls_strp_read_sock() proceeded to tls_strp_check_queue_ok().
skb_shinfo(strp->anchor)->frag_list still pointed to the freed receive
skb. tls_strp_check_queue_ok() then read TCP_SKB_CB(first)->seq through
the stale pointer, causing a use-after-free.
The reproducer followed this call path:
tls_rx_rec_done()
tls_strp_msg_consume()
tcp_read_done() // frees the receive skb
tls_strp_check_rcv()
tls_strp_read_sock()
tls_strp_load_anchor_with_queue() // returns after WARN_ON_ONCE()
tcp_recv_skb() == NULL
tls_strp_check_queue_ok()
TCP_SKB_CB(first)->seq // reads the freed receive skb
KASAN reported:
BUG: KASAN: slab-use-after-free in tls_strp_check_queue_ok.isra.0+0x5f/0x100
Read of size 4 at addr ffff888103169ca8 by task ktls-server/71
...
Call Trace:
<TASK>
...
tls_strp_check_queue_ok.isra.0+0x5f/0x100
tls_strp_check_rcv+0x2a9/0x400
...
tls_sw_recvmsg+0x3ce/0xa10
...
sock_recvmsg+0xea/0x100
__sys_recvfrom+0x142/0x1f0
...
__x64_sys_recvfrom+0x76/0x90
do_syscall_64+0xdd/0x4a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
...
</TASK>
...
Freed by task 71:
...
napi_skb_cache_put+0x24/0xf0
skb_attempt_defer_free+0x183/0x3b0
tcp_read_done+0x2d4/0x340
tls_strp_msg_consume+0x45/0x80
tls_sw_recvmsg+0x3c4/0xa10
...
In tcp_try_coalesce(), skip coalescing when the destination skb already
carries FIN. tcp_add_backlog() calls skb_try_coalesce() directly instead
of using this helper, so add the same check there. Since both paths check
only the destination skb, a final segment carrying data and FIN can still
be coalesced into an skb without FIN when the other coalescing checks pass.
Fixes: e93a0435f809 ("tcp: allow segment with FIN in tcp_try_coalesce()")
Fixes: 4f693b55c3d2 ("tcp: implement coalescing on backlog queue")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/au3HMfqNW3_DRMqS@v4bel
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/tcp_input.c | 4 ++++
net/ipv4/tcp_ipv4.c | 2 ++
2 files changed, 6 insertions(+)
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5063,6 +5063,10 @@ static bool tcp_try_coalesce(struct sock
if (!tcp_skb_can_collapse_rx(to, from))
return false;
+ /* Nothing follows a FIN. */
+ if (unlikely(TCP_SKB_CB(to)->tcp_flags & TCPHDR_FIN))
+ return false;
+
if (!skb_try_coalesce(to, from, fragstolen, &delta))
return false;
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2084,6 +2084,8 @@ bool tcp_add_backlog(struct sock *sk, st
((TCP_SKB_CB(tail)->tcp_flags ^
TCP_SKB_CB(skb)->tcp_flags) &
(TCPHDR_ECE | TCPHDR_CWR | TCPHDR_AE)) ||
+ /* Nothing follows a FIN, see tcp_try_coalesce() */
+ (TCP_SKB_CB(tail)->tcp_flags & TCPHDR_FIN) ||
!tcp_skb_can_collapse_rx(tail, skb) ||
thtail->doff != th->doff ||
memcmp(thtail + 1, th + 1, hdrlen - sizeof(*th)) ||
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 708/990] tcp: fix authentication bypass via unsupported TCP auth options
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (706 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 707/990] tcp: do not coalesce segments after FIN Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 709/990] tcp: fix request_sock use-after-free during Fast Open accept() Greg Kroah-Hartman
` (144 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jérémy Jean,
Kuniyuki Iwashima, Dmitry Safonov, Jakub Kicinski
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>
commit 7cc235fb1251fec1183e3158c60d2e504c2a8e8b upstream.
tcp_inbound_hash() parses both TCP-MD5 and TCP-AO options when at
least one of the two features is enabled. With TCP_MD5SIG=y and
TCP_AO=n, a packet carrying an AO option reaches the disabled
tcp_inbound_ao_hash() stub. That stub returns success, so sockets
configured to require MD5 authentication end up accepting
unauthenticated data. A forged AO option skips the unsigned fast
path, which is the only place where tcp_inbound_hash() can return
SKB_DROP_REASON_TCP_MD5NOTFOUND.
The inverse configuration with TCP_MD5SIG=n and TCP_AO=y has the same
problem for an MD5 option on AO sockets.
Note that TCP-AO depends on 64BIT: therefore, every 32-bit kernel with
TCP_MD5SIG=y is in the vulnerable configuration.
Make the disabled stubs reject options for the unsupported
authentication scheme. This matches the real helpers' behavior for
sockets without keys. It also means that kernels with TCP_MD5SIG=n and
TCP_AO=y now drop segments carrying an MD5 option on unkeyed sockets,
as kernels configured with TCP_MD5SIG=y already do.
Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
Cc: stable@vger.kernel.org
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Acked-by: Dmitry Safonov <dima@arista.com>
Link: https://patch.msgid.link/20261107224733.1104094-2-Jeremy.Jean@oss.cyber.gouv.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/tcp_ao.h | 3 ++-
net/ipv4/tcp.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
--- a/include/net/tcp_ao.h
+++ b/include/net/tcp_ao.h
@@ -287,7 +287,8 @@ static inline enum skb_drop_reason tcp_i
const struct request_sock *req, int l3index,
const struct tcp_ao_hdr *aoh)
{
- return SKB_NOT_DROPPED_YET;
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPAOKEYNOTFOUND);
+ return SKB_DROP_REASON_TCP_AOUNEXPECTED;
}
static inline struct tcp_ao_key *tcp_ao_do_lookup(const struct sock *sk,
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4965,7 +4965,8 @@ tcp_inbound_md5_hash(const struct sock *
const void *saddr, const void *daddr,
int family, int l3index, const __u8 *hash_location)
{
- return SKB_NOT_DROPPED_YET;
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
+ return SKB_DROP_REASON_TCP_MD5UNEXPECTED;
}
#endif
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 709/990] tcp: fix request_sock use-after-free during Fast Open accept()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (707 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 708/990] tcp: fix authentication bypass via unsupported TCP auth options Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 710/990] seg6: validate state in netfilter continuations Greg Kroah-Hartman
` (143 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyunwoo Kim, Kuniyuki Iwashima,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <imv4bel@gmail.com>
commit 62754aad50d0b30938bd8ce30b43474ce502a2af upstream.
Commit e3d95ad7da4f ("inet: avoid fastopen lock for regular accept()")
made inet_csk_accept() check tfo_listener before taking fastopenq.lock
to avoid taking the lock for connections that did not use Fast Open.
reqsk_fastopen_remove() clears tfo_listener while holding fastopenq.lock,
then reads req->sk. If inet_csk_accept() concurrently observes
tfo_listener after it has been cleared, it skips fastopenq.lock and
drops the last reference to the request_sock. This can free the
request_sock while reqsk_fastopen_remove() is still using it.
If the freed memory is reused for a new request_sock with req->sk ==
NULL, the reset path in reqsk_fastopen_remove() can append the new
request_sock to the original listener's list of requests that caused an
RST. After the new request_sock is freed, the next append writes through
the stale rskq_rst_tail into freed memory.
KASAN reported the following use-after-free when writing
fastopenq->rskq_rst_tail->dl_next = req:
BUG: KASAN: slab-use-after-free in reqsk_fastopen_remove+0x142/0x210
Write of size 8 at addr ffff888108230688 by task swapper/5/0
...
Call Trace:
<IRQ>
...
reqsk_fastopen_remove+0x142/0x210
tcp_check_req+0x96f/0xdd0
...
tcp_rcv_state_process+0x19c/0x26b0
...
tcp_v4_do_rcv+0x16e/0x490
tcp_v4_rcv+0x14a0/0x1af0
...
ip_protocol_deliver_rcu+0x39/0x1e0
ip_local_deliver_finish+0x124/0x1e0
ip_local_deliver+0xfb/0x1e0
...
</IRQ>
To widen the race windows, mdelay(5) was added after newsk = req->sk,
mdelay(20) after the if (req) reqsk_put(req) block, and mdelay(100)
after tcp_rsk(req)->tfo_listener = false. The KASAN report above was
reproduced with this kernel.
For the lockless check, use tcp_sk(newsk)->syn_fastopen_child instead of
tfo_listener, which reqsk_fastopen_remove() clears.
syn_fastopen_child is a field of the Fast Open child TCP socket
referenced by newsk, not of the request_sock. It is set before the child
socket is added to the accept queue. The paths that call
reqsk_fastopen_remove() in response to a remote ACK or RST do not clear
this field.
inet_csk_accept() uses this field to take fastopenq.lock only for Fast
Open child sockets and rechecks tfo_listener while holding the lock.
Connections that did not use Fast Open continue to avoid the lock.
Fixes: e3d95ad7da4f ("inet: avoid fastopen lock for regular accept()")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/avQKA_YTAThtbsYU@v4bel
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/inet_connection_sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -684,7 +684,7 @@ struct sock *inet_csk_accept(struct sock
newsk = req->sk;
if (sk->sk_protocol == IPPROTO_TCP &&
- tcp_rsk(req)->tfo_listener) {
+ tcp_sk(newsk)->syn_fastopen_child) {
spin_lock_bh(&queue->fastopenq.lock);
if (tcp_rsk(req)->tfo_listener) {
/* We are still waiting for the final ACK from 3WHS
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 710/990] seg6: validate state in netfilter continuations
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (708 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 709/990] tcp: fix request_sock use-after-free during Fast Open accept() Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 711/990] mptcp: reject DATA_ACKs against a reversed send interval Greg Kroah-Hartman
` (142 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vega, Sashiko, Zixuan Chai, Ren Wei,
Hangbin Liu, Pablo Neira Ayuso, Andrea Mayer, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zixuan Chai <petalzu987@gmail.com>
commit 549484dd3e80a721d51bd695f22a800d2e05bea1 upstream.
When nf_hooks_lwtunnel is enabled, End.DX4 sends decapsulated packets
through NF_INET_PRE_ROUTING. If DNAT changes the inner destination,
nf_nat_ipv4_pre_routing() drops skb_dst(), and the continuation then
dereferences the missing dst's lwtstate. This causes a KASAN NULL
pointer dereference and fatal exception panic.
End.DX6 has the same issue with IPv6 DNAT. In seg6_iptunnel,
POST_ROUTING SNAT with an outbound XFRM policy can replace the dst before
the continuation resumes.
Validate the current dst and expected lwtstate type in each NF_HOOK()
continuation before calling the existing handler. Drop packets with
missing or incompatible state while preserving direct no-hook paths.
The helpers return bool because callers only need a validity check.
Testing shows that the End.DX4 DNAT reproducer triggers a KASAN NULL
pointer dereference without this change and no longer does so with the
fix. The SNAT+ESP/XFRM reproducer also completes without the reported
fault. The in-tree End.DX4 netfilter forwarding selftest passes all four
bidirectional checks with nf_hooks_lwtunnel disabled and enabled.
Fixes: 7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260720204430.1886091-1-xmei5@asu.edu
Signed-off-by: Zixuan Chai <petalzu987@gmail.com>
Signed-off-by: Ren Wei <weir@nebusec.ai>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Reviewed-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Link: https://patch.msgid.link/8574739acd6f5d9eb0a5640e893122619e9f79ef.1793726355.git.petalzu987@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/seg6_iptunnel.c | 46 +++++++++++++++++++++++++++++++++++----
net/ipv6/seg6_local.c | 55 ++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 94 insertions(+), 7 deletions(-)
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -18,6 +18,7 @@
#include <net/ip6_fib.h>
#include <net/route.h>
#include <net/seg6.h>
+#include <net/dst_metadata.h>
#include <linux/seg6.h>
#include <linux/seg6_iptunnel.h>
#include <net/addrconf.h>
@@ -58,6 +59,21 @@ static inline struct seg6_lwt *seg6_lwt_
return (struct seg6_lwt *)lwt->data;
}
+static bool seg6_skb_has_lwtstate(struct sk_buff *skb)
+{
+ struct dst_entry *dst;
+
+ if (unlikely(!skb_valid_dst(skb)))
+ return false;
+
+ dst = skb_dst(skb);
+ if (unlikely(!dst->lwtstate ||
+ dst->lwtstate->type != LWTUNNEL_ENCAP_SEG6))
+ return false;
+
+ return true;
+}
+
static inline struct seg6_iptunnel_encap *
seg6_encap_lwtunnel(struct lwtunnel_state *lwt)
{
@@ -538,6 +554,17 @@ drop:
return err;
}
+static int seg6_input_core_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return seg6_input_core(net, sk, skb);
+}
+
static int seg6_input_nf(struct sk_buff *skb)
{
struct net_device *dev = skb_dst_dev(skb);
@@ -546,10 +573,10 @@ static int seg6_input_nf(struct sk_buff
switch (skb->protocol) {
case htons(ETH_P_IP):
return NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, NULL,
- skb, NULL, dev, seg6_input_core);
+ skb, NULL, dev, seg6_input_core_nf);
case htons(ETH_P_IPV6):
return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, net, NULL,
- skb, NULL, dev, seg6_input_core);
+ skb, NULL, dev, seg6_input_core_nf);
}
return -EINVAL;
@@ -624,6 +651,17 @@ drop:
return err;
}
+static int seg6_output_core_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return seg6_output_core(net, sk, skb);
+}
+
static int seg6_output_nf(struct net *net, struct sock *sk, struct sk_buff *skb)
{
struct net_device *dev = skb_dst_dev(skb);
@@ -631,10 +669,10 @@ static int seg6_output_nf(struct net *ne
switch (skb->protocol) {
case htons(ETH_P_IP):
return NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, skb,
- NULL, dev, seg6_output_core);
+ NULL, dev, seg6_output_core_nf);
case htons(ETH_P_IPV6):
return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, net, sk, skb,
- NULL, dev, seg6_output_core);
+ NULL, dev, seg6_output_core_nf);
}
return -EINVAL;
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -24,6 +24,7 @@
#include <net/addrconf.h>
#include <net/ip6_route.h>
#include <net/dst_cache.h>
+#include <net/dst_metadata.h>
#include <net/ip_tunnels.h>
#ifdef CONFIG_IPV6_SEG6_HMAC
#include <net/seg6_hmac.h>
@@ -211,6 +212,21 @@ static struct seg6_local_lwt *seg6_local
return (struct seg6_local_lwt *)lwt->data;
}
+static bool seg6_local_skb_has_lwtstate(struct sk_buff *skb)
+{
+ struct dst_entry *dst;
+
+ if (unlikely(!skb_valid_dst(skb)))
+ return false;
+
+ dst = skb_dst(skb);
+ if (unlikely(!dst->lwtstate ||
+ dst->lwtstate->type != LWTUNNEL_ENCAP_SEG6_LOCAL))
+ return false;
+
+ return true;
+}
+
static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb)
{
struct ipv6_sr_hdr *srh;
@@ -942,6 +958,17 @@ static int input_action_end_dx6_finish(s
return dst_input(skb);
}
+static int input_action_end_dx6_finish_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_local_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return input_action_end_dx6_finish(net, sk, skb);
+}
+
/* decapsulate and forward to specified nexthop */
static int input_action_end_dx6(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
@@ -962,7 +989,7 @@ static int input_action_end_dx6(struct s
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
return NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING,
dev_net(skb->dev), NULL, skb, skb->dev,
- NULL, input_action_end_dx6_finish);
+ NULL, input_action_end_dx6_finish_nf);
return input_action_end_dx6_finish(dev_net(skb->dev), NULL, skb);
drop:
@@ -1030,6 +1057,17 @@ static int input_action_end_dx4_finish(s
return dst_input(skb);
}
+static int input_action_end_dx4_finish_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_local_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return input_action_end_dx4_finish(net, sk, skb);
+}
+
static int input_action_end_dx4(struct sk_buff *skb,
struct seg6_local_lwt *slwt)
{
@@ -1050,7 +1088,7 @@ static int input_action_end_dx4(struct s
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
return NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING,
dev_net(skb->dev), NULL, skb, skb->dev,
- NULL, input_action_end_dx4_finish);
+ NULL, input_action_end_dx4_finish_nf);
return input_action_end_dx4_finish(dev_net(skb->dev), NULL, skb);
drop:
@@ -1684,6 +1722,17 @@ static int seg6_local_input_core(struct
return rc;
}
+static int seg6_local_input_core_nf(struct net *net, struct sock *sk,
+ struct sk_buff *skb)
+{
+ if (unlikely(!seg6_local_skb_has_lwtstate(skb))) {
+ kfree_skb(skb);
+ return -EINVAL;
+ }
+
+ return seg6_local_input_core(net, sk, skb);
+}
+
static int seg6_local_input(struct sk_buff *skb)
{
if (skb->protocol != htons(ETH_P_IPV6)) {
@@ -1694,7 +1743,7 @@ static int seg6_local_input(struct sk_bu
if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_IN,
dev_net(skb->dev), NULL, skb, skb->dev, NULL,
- seg6_local_input_core);
+ seg6_local_input_core_nf);
return seg6_local_input_core(dev_net(skb->dev), NULL, skb);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 711/990] mptcp: reject DATA_ACKs against a reversed send interval
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (709 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 710/990] seg6: validate state in netfilter continuations Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 712/990] ipv4: keep XFRM headers out of corked skb lengths Greg Kroah-Hartman
` (141 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Eric Dumazet,
Matthieu Baerts (NGI0), Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit d75e5cd72995ec2fa77ec77a593cea28e2490ff1 upstream.
ack_update_msk() samples snd_nxt before taking the data lock, but reads
snd_una after taking it. Concurrent transmission and ACK processing can
therefore leave the sampled upper bound behind snd_una. Active-open
completion also exposes a reversed interval when it initializes snd_una
to IDSN + 1 while the socket-owned state synchronization is deferred.
A peer-supplied 64-bit Data ACK half a sequence space away can pass both
wraparound comparisons against such an interval. The resulting snd_una
can make __mptcp_retrans() inflate a fragment's already_sent field. Later
ACKs can then underflow data_len and cause out-of-bounds page fragments
to be passed to TCP.
Read snd_nxt after acquiring the data lock and reject reversed intervals
before checking the received Data ACK. This keeps the interval shorter
than half the sequence space, so the existing upper-bound check cannot
accept an advance beyond snd_nxt. Preserve the existing handling of old
ACKs and keep the transmit fields under their existing socket locking.
Cc: stable@vger.kernel.org
Fixes: 7439d687b79c ("mptcp: avoid a few atomic ops in the rx path")
Fixes: 3f83d8a77eee ("mptcp: fix more tx path fields initialization")
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20261104130747.1045741-1-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mptcp/options.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -1137,9 +1137,9 @@ static void ack_update_msk(struct mptcp_
struct sock *ssk,
struct mptcp_options_received *mp_opt)
{
- u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt);
+ u64 new_wnd_end, new_snd_una, old_snd_una;
struct sock *sk = (struct sock *)msk;
- u64 old_snd_una;
+ u64 snd_nxt;
mptcp_data_lock(sk);
@@ -1148,10 +1148,14 @@ static void ack_update_msk(struct mptcp_
* more dangerous than missing an ack
*/
old_snd_una = msk->snd_una;
+ snd_nxt = READ_ONCE(msk->snd_nxt);
new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64);
- /* ACK for data not even sent yet? Ignore.*/
- if (unlikely(after64(new_snd_una, snd_nxt)))
+ /* The active-open state sync can defer the snd_nxt update. Do not
+ * accept an ACK against a reversed interval, or beyond snd_nxt.
+ */
+ if (unlikely(before64(snd_nxt, old_snd_una) ||
+ after64(new_snd_una, snd_nxt)))
new_snd_una = old_snd_una;
new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 712/990] ipv4: keep XFRM headers out of corked skb lengths
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (710 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 711/990] mptcp: reject DATA_ACKs against a reversed send interval Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 713/990] ipv4: fib_trie: prevent speculative out-of-bounds child access Greg Kroah-Hartman
` (140 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Kyle Zeng, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 0f47fce51a98d3d9f439c16861d519a7b833a176 upstream.
__ip_append_data() allocates space for dst.header_len in the first skb,
but includes that space in skb->len until __ip_make_skb() pulls it.
Fragment accounting uses an MTU that already excludes the XFRM headers.
As a result, the next skb can have a fraggap larger than its capped
datalen, and skb_copy_and_csum_bits() can overwrite its shared info.
For example, five AH tunnel states can reserve 500 bytes while leaving
an effective MTU of 348. With 40 bytes of IPv4 options, the second skb
has room for 288 bytes of fragment data but receives a 500-byte gap
copy. The overwritten shared info is subsequently consumed by the skb
release paths.
Reserve the XFRM headers together with the link-layer headroom instead.
This keeps skb->len, the gap-copy offsets and the trim lengths relative
to the IPv4 packet throughout corking. The network and transport header
addresses and the headroom available to XFRM at output are unchanged.
Both paged and linear allocations, including subsequent corked appends,
use the corrected accounting.
Fixes: 353e5c9abd90 ("ipv4: Fix IPsec slowpath fragmentation problem")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Link: https://patch.msgid.link/20261030042229.74068-1-kylebot@openai.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/ip_output.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1151,16 +1151,16 @@ alloc_new_skb:
*/
skb->ip_summed = csummode;
skb->csum = 0;
- skb_reserve(skb, hh_len);
+ skb_reserve(skb, hh_len + exthdrlen);
/*
* Find where to start putting bytes.
*/
- data = skb_put(skb, fraglen + exthdrlen - pagedlen);
- skb_set_network_header(skb, exthdrlen);
+ data = skb_put(skb, fraglen - pagedlen);
+ skb_reset_network_header(skb);
skb->transport_header = (skb->network_header +
fragheaderlen);
- data += fragheaderlen + exthdrlen;
+ data += fragheaderlen;
if (fraggap) {
skb->csum = skb_copy_and_csum_bits(
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 713/990] ipv4: fib_trie: prevent speculative out-of-bounds child access
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (711 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 712/990] ipv4: keep XFRM headers out of corked skb lengths Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 714/990] ipv6: fix cached route reuse for control messages Greg Kroah-Hartman
` (139 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Daniël Trujillo,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniël Trujillo <datrujillo@nvidia.com>
commit fd3d73286662950656f54616d0b3fea29e2dc99a upstream.
fib_table_lookup() checks the child index against the bounds before
passing it to get_child_rcu().
The index is derived from the lookup key, which in turn is derived from
flp->daddr. A userspace process can therefore influence the index by
triggering lookups for chosen destination IPv4 addresses.
If this bounds check is mispredicted as in-bounds, an out-of-bounds index
can be transiently passed to get_child_rcu(). The value loaded beyond the
child array is then treated as a node pointer. A later transient
dereference of that pointer can cause a data-dependent cache footprint.
This was found during Spectre-v1 research. Leakage was demonstrated with
instrumentation that delays branch resolution with a CLFLUSH before the
mispredicted branch and makes the leaked location deterministic for
reproducible measurement. In that setup, a userspace-controlled IPv4
lookup key was able to trigger a transient out-of-bounds child access.
The transient use of the loaded value as a pointer caused a
data-dependent cache footprint that was recoverable from userspace using
Prime+Probe. A real-world attacker would likely need to delay branch
resolution, which was not demonstrated end-to-end without the added
CLFLUSH.
Sanitize the index with array_index_nospec() before accessing the child
array. This removed the observed leakage in the described setup.
Apply the hardening before setting cindex in fib_table_lookup(), because
cindex can later be used by the backtrace path to load another child
pointer. fib_find_node() has the same pattern, with the checked index
derived from a user-provided key in fib_table_insert() and
fib_table_delete(). leaf_walk_rcu() has a similar checked cindex before
get_child_rcu(), and the traversed state can be influenced by userspace
actions. fib_find_node() runs under RTNL and leaf_walk_rcu() is not on
the packet lookup hot path, so harden those analogous accesses in the
same way. Also harden fib_trie_get_next(), where a mispredicted loop
condition could transiently read one child past the array.
I see a slowdown of roughly 10% in a microbenchmark where we call
fib_table_lookup() with 64 routes directly from inside the kernel. I
observed no slowdown in a loopback UDP sendto() microbenchmark.
Fixes: 9f9e636d4f89 ("fib_trie: Optimize fib_table_lookup to avoid wasting time on loops/variables")
Cc: stable@vger.kernel.org
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Signed-off-by: Daniël Trujillo <datrujillo@nvidia.com>
Link: https://patch.msgid.link/20261106-fib-trie-nospec-v3-1-53da6550dcf8@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/fib_trie.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -61,6 +61,7 @@
#include <linux/export.h>
#include <linux/vmalloc.h>
#include <linux/notifier.h>
+#include <linux/nospec.h>
#include <net/net_namespace.h>
#include <net/inet_dscp.h>
#include <net/ip.h>
@@ -961,6 +962,8 @@ static struct key_vector *fib_find_node(
break;
}
+ index = array_index_nospec(index, 1ul << n->bits);
+
/* keep searching until we find a perfect match leaf or NULL */
} while (IS_TNODE(n));
@@ -1466,6 +1469,8 @@ int fib_table_lookup(struct fib_table *t
if (IS_LEAF(n))
goto found;
+ index = array_index_nospec(index, 1ul << n->bits);
+
/* only record pn and cindex if we are going to be chopping
* bits later. Otherwise we are just wasting cycles.
*/
@@ -1766,6 +1771,8 @@ static struct key_vector *leaf_walk_rcu(
if (cindex >> pn->bits)
break;
+ cindex = array_index_nospec(cindex, 1ul << pn->bits);
+
/* descend into the next child */
n = get_child_rcu(pn, cindex++);
if (!n)
@@ -1787,6 +1794,8 @@ static struct key_vector *leaf_walk_rcu(
continue;
}
+ cindex = array_index_nospec(cindex, 1ul << pn->bits);
+
/* grab the next available node */
n = get_child_rcu(pn, cindex++);
if (!n)
@@ -2438,7 +2447,10 @@ static struct key_vector *fib_trie_get_n
while (!IS_TRIE(pn)) {
while (cindex < child_length(pn)) {
- struct key_vector *n = get_child_rcu(pn, cindex++);
+ struct key_vector *n;
+
+ cindex = array_index_nospec(cindex, child_length(pn));
+ n = get_child_rcu(pn, cindex++);
if (!n)
continue;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 714/990] ipv6: fix cached route reuse for control messages
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (712 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 713/990] ipv4: fib_trie: prevent speculative out-of-bounds child access Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 715/990] ipv6: reject routes without an inet6_dev Greg Kroah-Hartman
` (138 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Willem de Bruijn, Xia Yan,
Willem de Bruijn, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xia Yan <yanxia@cmss.chinamobile.com>
commit f778e80b3daf5033fb996f45c2b5d0ce1e82c0a7 upstream.
A connected IPv6 UDP or ping socket can reuse its cached route when an
SO_MARK cmsg requests another mark. A packet can then bypass a prohibit
rule instead of failing with EACCES.
ip6_sk_dst_lookup_flow() reads the cache even when connected is false.
UDP clears connected after parsing IP or socket control messages. Ping
always passes false.
Only read the cache when connected is true. Ordinary connected UDP
sends keep using the cache. Ping sends do a fresh lookup.
Found during code review of IPv6 UDP route caching. On UML, the same
connected-socket selftest fails four IPv6 cases before the fix and
passes all 54 with it.
Fixes: c6af0c227a22 ("ip: support SO_MARK cmsg")
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Link: https://lore.kernel.org/netdev/willemdebruijn.kernel.1e0038bcc3ef8@gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261109014400.9025-1-yanxia@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/ip6_output.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1287,7 +1287,7 @@ EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
* @sk: socket which provides the dst cache and route info
* @fl6: flow to lookup
* @final_dst: final destination address for ipsec lookup
- * @connected: whether @sk is connected or not
+ * @connected: whether the flow can use and update the socket dst cache
*
* This function performs a route lookup on the given flow with the
* possibility of using the cached route in the socket if it is valid.
@@ -1304,11 +1304,14 @@ struct dst_entry *ip6_sk_dst_lookup_flow
const struct in6_addr *final_dst,
bool connected)
{
- struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
+ struct dst_entry *dst;
- dst = ip6_sk_dst_check(sk, dst, fl6);
- if (dst)
- return dst;
+ if (connected) {
+ dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
+ dst = ip6_sk_dst_check(sk, dst, fl6);
+ if (dst)
+ return dst;
+ }
dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, final_dst);
if (connected && !IS_ERR(dst))
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 715/990] ipv6: reject routes without an inet6_dev
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (713 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 714/990] ipv6: fix cached route reuse for control messages Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 716/990] ipvs: Defer application parent freeing until after RCU readers Greg Kroah-Hartman
` (137 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Alexei Starovoitov, Hangbin Liu,
Yingjie Wang, Ido Schimmel, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <1075151112@qq.com>
commit 08a1eb7a634f665718ebe74e0960e242f597135e upstream.
ip6_route_output() and ip6_route_lookup() can return an error-free route
whose rt6i_idev is NULL. Lowering an external nexthop device's MTU below
IPV6_MIN_MTU tears down its inet6_dev, while fib6_ifdown() leaves routes
using nexthop objects in the FIB.
An unprivileged user with CAP_NET_ADMIN in a private user and network
namespace can construct this state. Consumers which treat a route without
an error as usable can then dereference the NULL rt6i_idev. This was
reproduced as a KASAN NULL pointer dereference in ip6_tnl_xmit().
An audit of IPv6 route and tunnel users found this unchecked
ip6_dst_idev() dereference.
A similar missing inet6_dev check was fixed in commit 1b9b5323725e
("netfilter: ip6t_rpfilter: reject routes without inet6_dev"). However,
the route construction path still marks routes without an inet6_dev as
successful, leaving every consumer responsible for the same check.
Acquire the inet6_dev reference before initializing the destination. If a
non-reject route has no inet6_dev, initialize it as RTN_UNREACHABLE instead
of a successful route. Explicit reject routes keep their original type and
error. This establishes that ordinary error-free IPv6 routes have an
inet6_dev while retaining the existing defensive checks at callers.
The modified route object builds cleanly with W=1. A full x86_64 KASAN
bzImage build completes; it reports two pre-existing kernel-doc warnings
outside this change.
Tests:
- `make W=1 net/ipv6/route.o`
- full x86_64 KASAN `bzImage` build with `W=1`
- KASAN QEMU with an unprivileged user and network namespace: after
lowering the MTU, the stale route returned `No route to host`, a normal
route still resolved, and the collect_md trigger completed without
KASAN, oops, or panic
- `tools/testing/selftests/net/ip6_tunnel.sh` in the same KASAN QEMU
Fixes: 5b98324ebe29 ("ipv6: Allow routes to use nexthop objects")
Closes: https://lore.kernel.org/netdev/DMP4WRIOGMBX.3VW2KNLBGDZ0K@gmail.com/
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <1075151112@qq.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/tencent_91DA7FD8277B509C55906702D1E425FBC906@qq.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/route.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1143,6 +1143,12 @@ static void ip6_rt_init_dst(struct rt6_i
return;
}
+ /* addrconf_ifdown() removed inet6_dev. The device can't do IPv6. */
+ if (!rt->rt6i_idev) {
+ ip6_rt_init_dst_reject(rt, RTN_UNREACHABLE);
+ return;
+ }
+
rt->dst.error = 0;
rt->dst.output = ip6_output;
@@ -1178,10 +1184,10 @@ static void ip6_rt_copy_init(struct rt6_
const struct net_device *dev = nh->fib_nh_dev;
struct fib6_info *f6i = res->f6i;
+ rt->rt6i_idev = dev ? in6_dev_get(dev) : NULL;
ip6_rt_init_dst(rt, res);
rt->rt6i_dst = f6i->fib6_dst;
- rt->rt6i_idev = dev ? in6_dev_get(dev) : NULL;
rt->rt6i_flags = res->fib6_flags;
if (nh->fib_nh_gw_family) {
rt->rt6i_gateway = nh->fib_nh_gw6;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 716/990] ipvs: Defer application parent freeing until after RCU readers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (714 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 715/990] ipv6: reject routes without an inet6_dev Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 717/990] ipvs: fix protocol data lifetime during namespace teardown Greg Kroah-Hartman
` (136 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chengfeng Ye, Julian Anastasov,
Pablo Neira Ayuso
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <nicoyip.dev@gmail.com>
commit 1e0808008e44d736e57a897a51d14fa995099010 upstream.
unregister_ip_vs_app() removes each incarnation from its protocol list and
uses call_rcu() to defer freeing it, but frees the parent application
immediately. An RCU reader that already found an incarnation can still
access the parent through inc->app in ip_vs_app_inc_get().
During FTP helper module unload, the following interleaving is possible:
CPU 0 (RCU reader) CPU 1 (module unload)
tcp_app_conn_bind()
find inc in protocol list
unregister_ip_vs_app()
ip_vs_app_inc_release(inc)
list_del_rcu(&inc->p_list)
call_rcu(&inc->rcu_head, ...)
kfree(a)
ip_vs_app_inc_get(inc)
try_module_get(inc->app->module)
The helper module is already going away, so try_module_get() would fail,
but evaluating its argument first reads the freed parent. The subsequent
rcu_barrier() in pernet unregistration cannot protect this earlier free.
KASAN reported:
BUG: KASAN: slab-use-after-free in ip_vs_app_inc_get+0x7c/0x90
Call Trace:
ip_vs_app_inc_get+0x7c/0x90
tcp_app_conn_bind+0x1bc/0x290
ip_vs_conn_new+0x1915/0x20d0
ip_vs_schedule+0x697/0xea0
tcp_conn_schedule+0x489/0x820
ip_vs_in_hook+0x7bf/0x1f40
Allocated by task 88:
kmemdup_noprof+0x20/0x50
register_ip_vs_app+0x12d/0x2c0
__ip_vs_ftp_init+0x56/0x160 [ip_vs_ftp]
Freed by task 104:
kfree+0x131/0x3c0
unregister_ip_vs_app+0x2f4/0x5b0
unregister_pernet_operations+0x232/0x490
unregister_pernet_subsys+0x1c/0x30
__do_sys_delete_module+0x346/0x510
Use kfree_rcu() with the existing rcu_head to keep the parent alive until
these readers finish. Successful helper references already prevent normal
module unload, and incarnation RCU callbacks do not access the parent.
Fixes: 363c97d7435e ("ipvs: convert app locks")
Cc: stable@vger.kernel.org
Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_app.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -243,7 +243,7 @@ void unregister_ip_vs_app(struct netns_i
}
list_del(&a->a_list);
- kfree(a);
+ kfree_rcu(a, rcu_head);
/* decrease the module use count */
ip_vs_use_count_dec();
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 717/990] ipvs: fix protocol data lifetime during namespace teardown
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (715 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 716/990] ipvs: Defer application parent freeing until after RCU readers Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 718/990] gtp: free the skb after handling an echo response Greg Kroah-Hartman
` (135 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Chengfeng Ye, Julian Anastasov,
Pablo Neira Ayuso
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <nicoyip.dev@gmail.com>
commit 832aa3e89e806bb2667fe4e656b705f4088b3c9d upstream.
IPVS frees its per-net protocol data before control cleanup cancels
defense work and unregisters the sysctl table. A defense worker can load
a protocol data pointer, then namespace cleanup can unlink and free that
object before the worker dereferences pd->pp or pd->next. The worker's
securetcp_lock does not serialize with protocol cleanup. A concurrent
defense-mode sysctl write can reach the same timeout update path.
KASAN reported:
BUG: KASAN: slab-use-after-free in ip_vs_protocol_timeout_change
Workqueue: events_long defense_work_handler
Call Trace:
ip_vs_protocol_timeout_change+0x1b4/0x1e0
update_defense_level+0x63e/0xd80
defense_work_handler+0x1e/0xc0
Allocated by task 125:
ip_vs_protocol_net_init+0xda/0x2f0
__ip_vs_init+0x16b/0x240
setup_net+0xfc/0x310
Freed by task 12:
ip_vs_protocol_net_cleanup+0x1d6/0x2e0
__ip_vs_cleanup_batch+0x7d/0x100
cleanup_net+0x38c/0x770
Run control cleanup before protocol cleanup so that defense work and
active sysctl handlers have finished before their protocol data is freed.
Initialize protocols before exposing the control interface, and unwind
in reverse order, to enforce the same lifetime on initialization failure.
Protocol initialization and exit do not depend on control state.
Fixes: 9330419d9aa4 ("IPVS: netns, use ip_vs_proto_data as param.")
Cc: stable@vger.kernel.org
Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/ipvs/ip_vs_core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -2319,12 +2319,12 @@ static int __net_init __ip_vs_init(struc
if (ip_vs_estimator_net_init(ipvs) < 0)
goto estimator_fail;
- if (ip_vs_control_net_init(ipvs) < 0)
- goto control_fail;
-
if (ip_vs_protocol_net_init(ipvs) < 0)
goto protocol_fail;
+ if (ip_vs_control_net_init(ipvs) < 0)
+ goto control_fail;
+
if (ip_vs_app_net_init(ipvs) < 0)
goto app_fail;
@@ -2344,10 +2344,10 @@ sync_fail:
conn_fail:
ip_vs_app_net_cleanup(ipvs);
app_fail:
- ip_vs_protocol_net_cleanup(ipvs);
-protocol_fail:
ip_vs_control_net_cleanup(ipvs);
control_fail:
+ ip_vs_protocol_net_cleanup(ipvs);
+protocol_fail:
ip_vs_estimator_net_cleanup(ipvs);
estimator_fail:
net->ipvs = NULL;
@@ -2364,8 +2364,8 @@ static void __net_exit __ip_vs_cleanup_b
ipvs = net_ipvs(net);
ip_vs_conn_net_cleanup(ipvs);
ip_vs_app_net_cleanup(ipvs);
- ip_vs_protocol_net_cleanup(ipvs);
ip_vs_control_net_cleanup(ipvs);
+ ip_vs_protocol_net_cleanup(ipvs);
ip_vs_estimator_net_cleanup(ipvs);
IP_VS_DBG(2, "ipvs netns %d released\n", ipvs->gen);
net->ipvs = NULL;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 718/990] gtp: free the skb after handling an echo response
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (716 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 717/990] ipvs: fix protocol data lifetime during namespace teardown Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 719/990] hv_netvsc: Stop PPI parsing on invalid metadata Greg Kroah-Hartman
` (134 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
commit f17b293d155f377e4cff582b8113991d2ad346d6 upstream.
gtp0_handle_echo_resp() and gtp1u_handle_echo_resp() return the result
of genlmsg_multicast_netns() to gtp_encap_recv(). When the netlink
notification is delivered that result is 0, and gtp_encap_recv() treats
0 as "the skb has been consumed":
switch (ret) {
case 1:
netdev_dbg(gtp->dev, "pass up to the process\n");
break;
case 0:
break;
case -1:
netdev_dbg(gtp->dev, "GTP packet has been dropped\n");
kfree_skb(skb);
ret = 0;
break;
}
The echo response handlers only read from the skb and never free it or
pass it on, so every echo response that is reported to a listener on the
gtp multicast group leaks the skb. Echo responses are handled for any
peer when the UDP sockets were created by the kernel, so a remote host
can leak memory on the receiver by sending GTP echo responses while a
process with CAP_NET_ADMIN is subscribed to the gtp multicast group, for
example a daemon that monitors echo responses.
The error paths do not leak but have a related problem. -ENOMEM and the error from
genlmsg_multicast_netns() (-ESRCH when nobody listens) are not -1, so
they are returned unchanged to the UDP stack, which takes a negative
value from encap_rcv() as a request to resubmit the packet to the
protocol with that number.
Return -1 when the notification cannot be built, so that
gtp_encap_recv() drops the skb, and consume the skb once the
notification has been handed to netlink, whether or not anybody is
listening.
Found by LLM-assisted source review, untested.
Fixes: d33bd757d362 ("gtp: Implement GTP echo request")
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Link: https://patch.msgid.link/20261110-gtp-echo-rsp-leak-v1-1-192c032f3dfa@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/gtp.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -560,16 +560,19 @@ static int gtp0_handle_echo_resp(struct
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
if (!msg)
- return -ENOMEM;
+ return -1;
ret = gtp_genl_fill_echo(msg, 0, 0, 0, GTP_CMD_ECHOREQ, echo);
if (ret < 0) {
nlmsg_free(msg);
- return ret;
+ return -1;
}
- return genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
- msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
+ msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ consume_skb(skb);
+
+ return 0;
}
static int gtp_proto_to_family(__u16 proto)
@@ -747,16 +750,19 @@ static int gtp1u_handle_echo_resp(struct
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
if (!msg)
- return -ENOMEM;
+ return -1;
ret = gtp_genl_fill_echo(msg, 0, 0, 0, GTP_CMD_ECHOREQ, echo);
if (ret < 0) {
nlmsg_free(msg);
- return ret;
+ return -1;
}
- return genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
- msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ genlmsg_multicast_netns(>p_genl_family, dev_net(gtp->dev),
+ msg, 0, GTP_GENL_MCGRP, GFP_ATOMIC);
+ consume_skb(skb);
+
+ return 0;
}
static int gtp_parse_exthdrs(struct sk_buff *skb, unsigned int *hdrlen)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 719/990] hv_netvsc: Stop PPI parsing on invalid metadata
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (717 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 718/990] gtp: free the skb after handling an echo response Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 720/990] hv_sock: Report no unread data before a channel is available Greg Kroah-Hartman
` (133 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Erni Sri Satya Vennela,
Haiyang Zhang, Wei Liu, Simon Horman, Dave Miller
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
commit 19a227903e65c7a9c179156485660a4e017575fe upstream.
rndis_get_ppi() uses continue when a per-packet information entry has an
invalid size or offset, or cannot hold the requested metadata. However,
the remaining length and entry pointer are only updated at the bottom
of the loop. Each error path therefore retries the same invalid entry
indefinitely, repeatedly logging the error and preventing receive
processing from completing.
Return NULL on these validation failures instead of continuing. This
terminates the lookup when malformed metadata is encountered while
preserving the existing behavior for valid entries.
The issue was reported through an internal bug-tracking system and
confirmed by manual code inspection. The pre-fix hang has not been
reproduced locally.
Fixes: 44144185951a ("hv_netvsc: Add validation for untrusted Hyper-V values")
Cc: stable@vger.kernel.org
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Wei Liu <liuwe@microsoft.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/hyperv/rndis_filter.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -401,12 +401,12 @@ static inline void *rndis_get_ppi(struct
/* Validate ppi_offset and ppi_size */
if (ppi->size > len) {
netdev_err(ndev, "Invalid ppi size: %u\n", ppi->size);
- continue;
+ return NULL;
}
if (ppi->ppi_offset >= ppi->size) {
netdev_err(ndev, "Invalid ppi_offset: %u\n", ppi->ppi_offset);
- continue;
+ return NULL;
}
if (ppi->type == type && ppi->internal == internal) {
@@ -414,7 +414,7 @@ static inline void *rndis_get_ppi(struct
if (ppi->size - ppi->ppi_offset < ppi_size) {
netdev_err(ndev, "Invalid ppi: size %u ppi_offset %u\n",
ppi->size, ppi->ppi_offset);
- continue;
+ return NULL;
}
return (void *)((ulong)ppi + ppi->ppi_offset);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 720/990] hv_sock: Report no unread data before a channel is available
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (718 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 719/990] hv_netvsc: Stop PPI parsing on invalid metadata Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 721/990] net: gro: avoid parsing headers from shared fragments Greg Kroah-Hartman
` (132 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Parri, Stefano Garzarella,
Luigi Leonardi, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
commit 71b06766b7c49ed5f489b8bd104f82ff164d67a3 upstream.
The Hyper-V transport is assigned before the asynchronous VMBus channel
offer completes. Its zero-initialized hvsock therefore has a NULL chan
until hvs_open_connection() associates the channel with the socket.
SIOCINQ can query the assigned transport while the socket is connecting,
or after connect() fails once the transport has been assigned. Unlike
poll(), that path does not check stream_is_active() before calling the
transport's stream_has_data callback. hvs_stream_has_data() then passes
the NULL channel to hvs_channel_readable_payload(), and any user in the
guest can trigger an oops:
BUG: kernel NULL pointer dereference, address: 0000000000000178
RIP: 0010:hvs_stream_has_data+0x23/0x120
Call Trace:
<TASK>
? vsock_ioctl+0x74/0xf0
sock_do_ioctl+0x42/0xf0
sock_ioctl+0x27d/0x310
do_vfs_ioctl+0x700/0x810
__x64_sys_ioctl+0x7d/0xf0
Return zero unread bytes when no channel is available, before accessing
the receive state or ring. Leave the existing channel-backed receive
handling unchanged.
The oops was reproduced on an unmodified v7.4-rc1 kernel in a WSL2
guest with a small user-space program, available on request. With this
patch, the program reports zero unread bytes and the kernel logs nothing.
Other vsock_test cases were not run, as most of them need a host-side
peer.
AI assistance was used to identify the issue and develop the fix.
Fixes: f7c722659275 ("vsock: Add support for SIOCINQ ioctl")
Cc: stable@vger.kernel.org
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
Link: https://patch.msgid.link/20261106123920.162131-1-parri.andrea@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/vmw_vsock/hyperv_transport.c | 3 +++
1 file changed, 3 insertions(+)
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -698,6 +698,9 @@ static s64 hvs_stream_has_data(struct vs
struct hvsock *hvs = vsk->trans;
s64 ret;
+ if (!hvs->chan)
+ return 0;
+
if (hvs->recv_data_len > 0)
return hvs->recv_data_len;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 721/990] net: gro: avoid parsing headers from shared fragments
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (719 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 720/990] hv_sock: Report no unread data before a channel is available Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 722/990] net: gro: do not undo remote checksum offload on merged packets Greg Kroah-Hartman
` (131 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, stable, Kyle Zeng, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 44818c9a826d766dc0e21179dc76f229334f1dda upstream.
When an skb has an empty linear head, skb_gro_reset_offset() can expose
the first page fragment directly to GRO header parsers. For an
SKBFL_SHARED_FRAG skb, those bytes may still be writable through a file
mapping. Headers validated during receive can therefore differ from the
headers later copied into the linear head and used during completion.
For example, changing an IPv6 destination-options length between the
short and full header fetches in ipv6_gro_pull_exthdrs() can make
ipv6_gro_complete() pass an out-of-bounds offset to udp6_gro_complete().
A userspace reproducer triggered a KASAN slab-out-of-bounds read there
on an unmodified kernel as UID 1000. The same completion path can write
the UDP checksum and length through the invalid offset. The packet has
trusted TCP GSO metadata and spliced file data, so it reaches completion
without an skb zerocopy destructor or a second GRO packet.
Disable the direct-fragment fast path for skbs with externally writable
fragments. With an empty linear head, frag0_len remains zero, so
skb_gro_header_slow() pulls each required header into the linear head
before it is inspected. Subsequent pulls preserve the validated prefix.
This covers both gro_receive_skb() and napi_gro_frags(), including other
protocols using the same helpers. Linear headers and private fragments
retain their existing fast paths.
Codex assisted with review of the supplied report, reproducer and draft
fix, related-path analysis, and this changelog. The patched
net/core/gro.o builds with W=1 using the supplied x86-64 configuration,
allyesconfig and allmodconfig. The fix was checked by code-path analysis;
the reproducer and kernel selftests have not been run on a booted
patched kernel.
The issue was found by an LLM.
Fixes: dff0b0161ad5 ("net: gro: parse ipv6 ext headers without frag0 invalidation")
Cc: stable@kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Link: https://patch.msgid.link/20261031050752.31869-1-kylebot@openai.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/core/gro.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -419,7 +419,8 @@ static inline void skb_gro_reset_offset(
headlen = skb_headlen(skb);
NAPI_GRO_CB(skb)->frag0 = skb->data;
NAPI_GRO_CB(skb)->frag0_len = headlen;
- if (headlen)
+ /* Shared fragments must be pulled into the linear head before parsing. */
+ if (headlen || skb_has_shared_frag(skb))
return;
pinfo = skb_shinfo(skb);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 722/990] net: gro: do not undo remote checksum offload on merged packets
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (720 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 721/990] net: gro: avoid parsing headers from shared fragments Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 723/990] net: gro: invalidate frag0 after a pull Greg Kroah-Hartman
` (130 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Eric Dumazet, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
commit c817ec1b06875b98460fbd19591be541bc3fa924 upstream.
skb_gro_flush_final_remcsum() calls skb_gro_remcsum_cleanup() to undo
the checksum adjustment done by skb_gro_remcsum_process() when the
packet was not consumed by GRO.
When the inner handler merged the packet (NAPI_GRO_CB(skb)->same_flow
is set), grc->offset can no longer be trusted:
- skb_gro_receive() either gives the frags or the head of the skb
to the held packet, or uses __skb_pull(skb, offset) before adding
the skb to the frag_list of the held packet.
- skb_gro_receive_list() uses skb_pull(skb, skb_gro_offset(skb)).
grc->offset is relative to the original skb->data, so the 2-byte
read-modify-write done by skb_gro_remcsum_cleanup() can land in
the payload of a packet which now belongs to the GRO packet.
pskb_may_pull() can also be called on this frag_list member.
With fraglist GRO, this can also be a use-after-free:
pskb_may_pull(skb, skb_gro_offset(skb)) in skb_gro_receive_list()
or udp_gro_receive_segment() releases the first page fragment if it
only contains headers. NAPI_GRO_CB(skb)->frag0 and frag0_len are not
updated, so skb_gro_remcsum_cleanup() takes the fast path and writes
through frag0 into a page the skb no longer holds a reference on.
The non merged case, where frag0 is used after this pull, is handled
in the following patch.
For skbs merged by skb_gro_receive(), the cleanup can be skipped:
the skb is freed, or its headers are rebuilt from the head skb in
skb_segment().
Fraglist members keep their own inner headers, as skb_segment_list()
only copies the link-layer and tunnel headers from the head skb.
Their checksum can not be right in all cases: a packet forwarded with
its tunnel header needs the original value, while a VXLAN packet
decapsulated locally needs the adjusted one, as vxlan_remcsum() only
adjusts the head skb. Make skb_gro_receive_list() refuse packets with
skb->remcsum_offload set, so that fraglist members never carry an
adjusted checksum.
This affects VXLAN (VXLAN_F_REMCSUM_NOPARTIAL) and GUE
(FOU_F_REMCSUM_NOPARTIAL).
This was found while fixing a report from Taesoo Kim and Cen Zhang,
who used LLM assisted code analysis and provided reproducers.
Fixes: 26c4f7da3e41 ("net: Fix remcsum in GRO path to not change packet")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104151042.1157782-2-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/gro.h | 8 +++++++-
net/core/gro.c | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
--- a/include/net/gro.h
+++ b/include/net/gro.h
@@ -351,7 +351,13 @@ static inline void skb_gro_remcsum_clean
void *ptr;
size_t plen = grc->offset + sizeof(u16);
- if (!grc->delta)
+ /* Once merged, grc->offset can not be trusted: the frags or head
+ * of this skb now belong to the GRO packet, or skb->data was pulled
+ * past the headers before adding it to a frag_list.
+ * skb_gro_receive_list() does not merge packets with an adjusted
+ * checksum, other merged packets do not use their headers anymore.
+ */
+ if (!grc->delta || NAPI_GRO_CB(skb)->same_flow)
return;
ptr = skb_gro_header(skb, plen, grc->offset);
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -243,6 +243,13 @@ int skb_gro_receive_list(struct sk_buff
NAPI_GRO_CB(skb)->flush))
return -E2BIG;
+ /* Fraglist members keep their own headers. Their checksum can not
+ * be right both for a forwarded packet and for a decapsulated one,
+ * if remote checksum offload adjusted it.
+ */
+ if (unlikely(skb->remcsum_offload))
+ return -EINVAL;
+
if (!pskb_may_pull(skb, skb_gro_offset(skb))) {
NAPI_GRO_CB(skb)->flush = 1;
return -ENOMEM;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 723/990] net: gro: invalidate frag0 after a pull
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (721 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 722/990] net: gro: do not undo remote checksum offload on merged packets Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 724/990] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Greg Kroah-Hartman
` (129 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Taesoo Kim, Cen Zhang, Eric Dumazet,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@kernel.org>
commit 98d949a15ff9d3fffaa6983223178374aab92db6 upstream.
Since commit bd56a29c7a4e ("net: gro: change skb_gro_network_header()"),
skb_gro_header_slow() no longer invalidates NAPI_GRO_CB(skb)->frag0
after pskb_may_pull(). skb_gro_may_pull() keeps comparing against the
frag0_len value set in skb_gro_reset_offset(), assuming that after a
slow pull, all later accesses are beyond frag0_len.
This is not true:
- udp4_gro_receive() and udp6_gro_receive() read the network header
with skb_gro_network_header() after udp_gro_udphdr() pulled the
UDP header.
- vxlan_gro_receive() calls skb_gro_remcsum_cleanup() at a lower
offset after the inner handlers pulled their headers.
- skb_gro_remcsum_process() can pull beyond the inner Ethernet header
before eth_gro_receive() reads it.
- napi_frags_skb() calls __skb_pull(skb, ETH_HLEN) after a slow pull,
so frag0 still points to the Ethernet header.
If the pull consumed the first page fragment, __skb_pull_tail() released
it. If the head had to grow, pskb_expand_head() freed the old one.
These reads, and the 2-byte write in skb_gro_remcsum_cleanup(), then
access memory the skb no longer holds a reference on.
esp4_gro_receive(), esp6_gro_receive(), skb_gro_receive_list() and
udp_gro_receive_segment() also pull directly and never invalidated
frag0.
Add skb_gro_frag0_invalidate(), which only clears frag0_len, and call
it before each of these pulls. This is a single store in the slow path,
and frag0 stays non NULL, so skb_gro_network_header() does not need
a NULL test.
frag0 must be invalidated even if the pull fails: __pskb_pull_tail()
can return NULL after pskb_expand_head() freed the old head, for
instance if a frag_list member has to be cloned or pulled.
As frag0 is now invalidated before a pull that can fail,
gro_try_pull_from_frag0() can see an skb whose linear part does not
cover skb_gro_offset() while frag0 still points to the start of the
packet, for instance after skb_gro_remcsum_cleanup() pulled a shorter
length. Copying from frag0 would then corrupt the headers: only use
frag0 while frag0_len is not zero, and use pskb_may_pull() otherwise.
If this pull fails, for instance after a failed pskb_pull() in
esp4_gro_receive(), do not hold the packet: later GRO lookups and
gro_complete() handlers expect its headers in the linear part.
This was found by Taesoo Kim and Cen Zhang, using LLM assisted code
analysis, and confirmed with reproducers.
Fixes: bd56a29c7a4e ("net: gro: change skb_gro_network_header()")
Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
Cc: stable@vger.kernel.org
Reported-by: Taesoo Kim <tsgatesv@gmail.com>
Reported-by: Cen Zhang <cenzhang@linux.microsoft.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Link: https://patch.msgid.link/20261104151042.1157782-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/gro.h | 10 ++++++++++
net/core/gro.c | 20 ++++++++++++++++----
net/ipv4/esp4_offload.c | 1 +
net/ipv4/udp_offload.c | 1 +
net/ipv6/esp6_offload.c | 1 +
5 files changed, 29 insertions(+), 4 deletions(-)
--- a/include/net/gro.h
+++ b/include/net/gro.h
@@ -160,9 +160,19 @@ static inline bool skb_gro_may_pull(cons
return likely(hlen <= NAPI_GRO_CB(skb)->frag0_len);
}
+/* A pull can release the page fragment frag0 points to, or reallocate
+ * skb->head, even if it fails. Call this before the pull, to make sure later
+ * skb_gro_header() and skb_gro_network_header() calls no longer use frag0.
+ */
+static inline void skb_gro_frag0_invalidate(struct sk_buff *skb)
+{
+ NAPI_GRO_CB(skb)->frag0_len = 0;
+}
+
static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
unsigned int offset)
{
+ skb_gro_frag0_invalidate(skb);
if (!pskb_may_pull(skb, hlen))
return NULL;
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -250,6 +250,7 @@ int skb_gro_receive_list(struct sk_buff
if (unlikely(skb->remcsum_offload))
return -EINVAL;
+ skb_gro_frag0_invalidate(skb);
if (!pskb_may_pull(skb, skb_gro_offset(skb))) {
NAPI_GRO_CB(skb)->flush = 1;
return -ENOMEM;
@@ -464,12 +465,19 @@ static void gro_pull_from_frag0(struct s
}
}
-static void gro_try_pull_from_frag0(struct sk_buff *skb)
+static bool gro_try_pull_from_frag0(struct sk_buff *skb)
{
int grow = skb_gro_offset(skb) - skb_headlen(skb);
- if (grow > 0)
+ if (grow <= 0)
+ return true;
+
+ /* frag0 can only be used if no pull happened. */
+ if (likely(NAPI_GRO_CB(skb)->frag0_len)) {
gro_pull_from_frag0(skb, grow);
+ return true;
+ }
+ return pskb_may_pull(skb, skb_gro_offset(skb));
}
static void gro_flush_oldest(struct gro_node *gro, struct list_head *head)
@@ -571,13 +579,17 @@ found_ptype:
if (NAPI_GRO_CB(skb)->flush)
goto normal;
+ /* Must be called before setting NAPI_GRO_CB(skb)->{age|last}.
+ * A held packet must have its headers in the linear part.
+ */
+ if (unlikely(!gro_try_pull_from_frag0(skb)))
+ goto normal;
+
if (unlikely(gro_list->count >= MAX_GRO_SKBS))
gro_flush_oldest(gro, &gro_list->list);
else
gro_list->count++;
- /* Must be called before setting NAPI_GRO_CB(skb)->{age|last} */
- gro_try_pull_from_frag0(skb);
NAPI_GRO_CB(skb)->age = jiffies;
NAPI_GRO_CB(skb)->last = skb;
if (!skb_is_gso(skb))
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -37,6 +37,7 @@ static struct sk_buff *esp4_gro_receive(
__be32 seq;
__be32 spi;
+ skb_gro_frag0_invalidate(skb);
if (!pskb_pull(skb, offset))
return NULL;
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -759,6 +759,7 @@ static struct sk_buff *udp_gro_receive_s
pp = p;
} else {
if (NAPI_GRO_CB(skb)->is_flist) {
+ skb_gro_frag0_invalidate(skb);
if (!pskb_may_pull(skb, skb_gro_offset(skb))) {
NAPI_GRO_CB(skb)->flush = 1;
return NULL;
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -64,6 +64,7 @@ static struct sk_buff *esp6_gro_receive(
if (NAPI_GRO_CB(skb)->proto == IPPROTO_UDP)
encap_type = UDP_ENCAP_ESPINUDP;
+ skb_gro_frag0_invalidate(skb);
if (!pskb_pull(skb, offset))
return NULL;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 724/990] netfilter: nf_dup: preserve guard across NFQUEUE reinjection
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (722 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 723/990] net: gro: invalidate frag0 after a pull Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 725/990] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock Greg Kroah-Hartman
` (128 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Vega, Luxing Yin, Zihan Xi,
Pablo Neira Ayuso
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zihan Xi <zihanx@nebusec.ai>
commit 82052e5b5ec36504fe1b9c3c28a711a78fcacf37 upstream.
NFQUEUE can suspend traversal of a duplicated packet while the task-local
duplication guard is set. The output call then returns and clears the guard
before a later verdict resumes hook traversal.
Save the guard in the queue entry and restore it while reinjection
continues hook traversal. Preserve and restore the verdict task's prior
state, including nested synchronous reinjection.
Fixes: cd58bcd9787e ("netfilter: xt_TEE: have cloned packet travel through Xtables too")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Assisted-by: LLM
Co-developed-by: Luxing Yin <root@tr0jan.top>
Signed-off-by: Luxing Yin <root@tr0jan.top>
Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/netfilter/nf_queue.h | 1 +
net/netfilter/nf_queue.c | 1 +
net/netfilter/nfnetlink_queue.c | 17 ++++++++++++++---
3 files changed, 16 insertions(+), 3 deletions(-)
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -23,6 +23,7 @@ struct nf_queue_entry {
struct net_device *physout;
#endif
struct nf_hook_state state;
+ bool in_nf_duplicate;
bool nf_ct_is_unconfirmed;
u16 size; /* sizeof(entry) + saved route keys */
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -218,6 +218,7 @@ static int __nf_queue(struct sk_buff *sk
*entry = (struct nf_queue_entry) {
.skb = skb,
.skb_dev = skb->dev,
+ .in_nf_duplicate = current->in_nf_duplicate,
.state = *state,
.hook_index = index,
.size = sizeof(*entry) + route_key_size,
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -44,6 +44,7 @@
#include <net/sock.h>
#include <net/tcp_states.h>
#include <net/netfilter/nf_queue.h>
+#include <net/net_debug.h>
#include <net/netns/generic.h>
#include <linux/atomic.h>
@@ -351,21 +352,30 @@ static void nf_reinject(struct nf_queue_
const struct nf_hook_entry *hook_entry;
const struct nf_hook_entries *hooks;
struct sk_buff *skb = entry->skb;
+ bool old_in_nf_duplicate;
const struct net *net;
unsigned int i;
int err;
u8 pf;
+ DEBUG_NET_WARN_ONCE(current->in_nf_duplicate &&
+ !entry->in_nf_duplicate,
+ "%s called with unexpected duplication guard",
+ __func__);
+ local_bh_disable();
+ old_in_nf_duplicate = current->in_nf_duplicate;
+
net = entry->state.net;
pf = entry->state.pf;
+ current->in_nf_duplicate = entry->in_nf_duplicate;
hooks = nf_hook_entries_head(net, pf, entry->state.hook);
i = entry->hook_index;
if (!hooks || i >= hooks->num_hook_entries) {
kfree_skb_reason(skb, SKB_DROP_REASON_NETFILTER_DROP);
nf_queue_entry_free(entry);
- return;
+ goto out;
}
hook_entry = &hooks->hooks[i];
@@ -388,9 +398,7 @@ next_hook:
switch (verdict & NF_VERDICT_MASK) {
case NF_ACCEPT:
case NF_STOP:
- local_bh_disable();
entry->state.okfn(entry->state.net, entry->state.sk, skb);
- local_bh_enable();
break;
case NF_QUEUE:
err = nf_queue(skb, &entry->state, i, verdict);
@@ -404,6 +412,9 @@ next_hook:
}
nf_queue_entry_free(entry);
+out:
+ current->in_nf_duplicate = old_in_nf_duplicate;
+ local_bh_enable();
}
/* return true if the entry has an unconfirmed conntrack attached that isn't owned by us
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 725/990] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (723 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 724/990] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 726/990] netfilter: flowtable: extend ct timeout of offloaded GRE flows Greg Kroah-Hartman
` (127 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, AutonomousCodeSecurity,
Cen Zhang (Microsoft), Pablo Neira Ayuso
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
commit 17c2e41736b62cfe444c64d67860b1fbc1e886ac upstream.
recent_proc_net_exit() removes the /proc/net/xt_recent/<name> entries of
a dying network namespace while holding spin_lock_bh(&recent_lock).
remove_proc_entry() may sleep: proc_entry_rundown() waits until every
task that is still inside the entry's file operations has left. A reader
of such an entry is counted in by proc_reg_read() before
recent_seq_start() takes recent_lock. So if a read is in flight when the
namespace is torn down, cleanup_net() sleeps in atomic context holding
the spinlock that the reader is spinning on, and neither side can ever
make progress.
An unprivileged user can trigger this from a user namespace by adding a
rule with the "recent" match and reading its proc file while the
namespace is being destroyed. As recent_lock is global, every later
attempt to take it spins forever too: the spinning can spread to all
CPUs, and network namespace teardown stops system-wide.
BUG: sleeping function called from invalid context at
kernel/sched/completion.c:116
#3: (recent_lock){+...}-{3:3}, at: recent_net_exit+0x2b/0x140
Workqueue: netns cleanup_net
Call Trace:
proc_entry_rundown+0x185/0x1b0
remove_proc_entry+0x21a/0x520
recent_net_exit+0x7f/0x140
cleanup_net+0x414/0x8f0
...
rcu: INFO: rcu_preempt self-detected stall on CPU
Call Trace:
queued_spin_lock_slowpath+0x313/0xc20
recent_seq_start+0x87/0x1b0
seq_read_iter+0x265/0x11e0
proc_reg_read+0x1ab/0x270
Fix by taking recent_mutex instead of recent_lock. According to
commit a0e889bb1bdc ("[NETFILTER]: recent match: fix "sleeping function
called from invalid context""), recent_mutex is the lock to use here: it
protects recent_net->tables and was introduced so that proc entries are
created and removed without recent_lock held, because those calls may
sleep. hashlimit_proc_net_exit() does the same for xt_hashlimit.
Fixes: 665e205c16c1 ("netfilter: xt_recent: fix namespace destroy path")
Cc: stable@vger.kernel.org
Cc: AutonomousCodeSecurity@microsoft.com
Signed-off-by: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/xt_recent.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -649,14 +649,15 @@ static void __net_exit recent_proc_net_e
/* recent_net_exit() is called before recent_mt_destroy(). Make sure
* that the parent xt_recent proc entry is empty before trying to
- * remove it.
+ * remove it. Use recent_mutex instead of recent_lock since
+ * remove_proc_entry() may sleep.
*/
- spin_lock_bh(&recent_lock);
+ mutex_lock(&recent_mutex);
list_for_each_entry(t, &recent_net->tables, list)
remove_proc_entry(t->name, recent_net->xt_recent);
recent_net->xt_recent = NULL;
- spin_unlock_bh(&recent_lock);
+ mutex_unlock(&recent_mutex);
remove_proc_entry("xt_recent", net->proc_net);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 726/990] netfilter: flowtable: extend ct timeout of offloaded GRE flows
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (724 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 725/990] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 727/990] netfs: preserve prepare_write errno on reissue Greg Kroah-Hartman
` (126 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+521f7e7e2b974abde99a,
Michail Andreas Michalopoulos, Pablo Neira Ayuso
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
commit 46ecda278f6eedffb2898d41e3e56757c996a41f upstream.
Since commit 03428ca5cee9 ("netfilter: conntrack: rework offload nf_conn
timeout extension logic"), the flowtable gc worker extends the timeout
of an offloaded conntrack entry from nf_flow_table_extend_ct_timeout()
once it falls below 5 minutes. That function only knows about TCP and
UDP and hits WARN_ON_ONCE() for any other layer 4 protocol. However,
GRE flows can be offloaded too, both via nft_flow_offload and act_ct,
since commit 4e8d9584d154 ("netfilter: flowtable: Support GRE").
The timeout of an offloaded GRE entry drops below that threshold as soon
as a packet of the flow still goes through conntrack. With ip6gre
tunnels using the default encapsulation limit this is ordinary traffic:
the flowtable does not parse the Destination Options header in front of
GRE, so every packet of the flow takes the classic forwarding path. It
also happens for a packet with ttl <= 1, which the flowtable fast path
passes up to the classic forwarding path. nf_conntrack_gre_packet() then
refreshes ct->timeout to the GRE stream timeout (180 seconds by default),
and the next gc run triggers, as reported by syzbot:
WARNING: net/netfilter/nf_flow_table_core.c:553 at nf_flow_table_extend_ct_timeout+0x1ee/0x2f0
Workqueue: events_power_efficient nf_flow_offload_work_gc
Call Trace:
nf_flow_offload_gc_step+0x545/0x7b0
nf_flow_table_iterate+0x13c/0x1f0
nf_flow_offload_work_gc+0x22/0x70
process_scheduled_works+0xc3d/0x1630
worker_thread+0xa47/0xfb0
kthread+0x38b/0x480
Besides the splat, which panics the machine with panic_on_warn, the
default branch sets the new timeout to 1 jiffy, so the conntrack entry
expires right away and the offloaded flow is torn down.
Handle GRE like UDP and extend the timeout to NF_CT_DAY. GRE conntrack
has no protocol state to take into account, and NF_CT_DAY is also what
flow_offload_add() already sets for every offloaded entry, GRE included.
This also restores the behaviour from before commit 03428ca5cee9, when
the conntrack gc worker extended offloaded entries of any protocol to
NF_CT_DAY.
Fixes: 03428ca5cee9 ("netfilter: conntrack: rework offload nf_conn timeout extension logic")
Reported-by: syzbot+521f7e7e2b974abde99a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=521f7e7e2b974abde99a
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/netfilter/nf_flow_table_core.c | 1 +
1 file changed, 1 insertion(+)
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -537,6 +537,7 @@ static void nf_flow_table_extend_ct_time
switch (l4proto) {
case IPPROTO_UDP:
+ case IPPROTO_GRE:
new_timeout = NF_CT_DAY;
break;
case IPPROTO_TCP:
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 727/990] netfs: preserve prepare_write errno on reissue
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (725 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 726/990] netfilter: flowtable: extend ct timeout of offloaded GRE flows Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 728/990] netfs: keep the prepare_read errno when abandoning read retries Greg Kroah-Hartman
` (125 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Iván Ezequiel Rodriguez,
David Howells, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
commit 62869ecb3aeca670b86058387e7533a33524b95b upstream.
prepare_write() may call netfs_prepare_write_failed() (FAILED + errno)
before write_retry calls netfs_reissue_write(). Clearing subreq->error
to 0 for a clean I/O reissue (82e8885bd763) then makes
netfs_do_issue_write() terminate with 0. The collector copies
front->error into stream->error and mapping_set_error(), which ignores
0, so writeback failure is silent.
Skip clearing error when NETFS_SREQ_FAILED is already set;
do_issue_write() already terminates FAILED subrequests.
Fixes: 82e8885bd763 ("netfs: when subreq is marked for retry, do not check if it faced an error")
Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/netfs/write_issue.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/fs/netfs/write_issue.c
+++ b/fs/netfs/write_issue.c
@@ -252,7 +252,9 @@ void netfs_reissue_write(struct netfs_io
iov_iter_truncate(&subreq->io_iter, size);
subreq->retry_count++;
- subreq->error = 0;
+ /* Keep prepare_write() errno; do_issue_write() terminates FAILED. */
+ if (!test_bit(NETFS_SREQ_FAILED, &subreq->flags))
+ subreq->error = 0;
__clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
__set_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags);
netfs_stat(&netfs_n_wh_retry_write_subreq);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 728/990] netfs: keep the prepare_read errno when abandoning read retries
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (726 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 727/990] netfs: preserve prepare_write errno on reissue Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 729/990] netfs: dont hang a read whose retry is abandoned Greg Kroah-Hartman
` (124 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit d88a0c3a96fd6d7228d04532cecb23f23676aa2d upstream.
When ->prepare_read() fails while retrying a read,
netfs_retry_read_subrequests() marks the subrequest failed and abandons
the rest, which overwrites the error of every failed subrequest with
-ENOMEM. The reader then gets -ENOMEM for e.g. a handle that couldn't be
reopened (-EHOSTDOWN, -ENOENT), a credit wait interrupted by a signal
(-ERESTARTSYS) or umount -f (-EIO). The first pass doesn't have this
problem, as netfs_cancel_read() keeps the errno.
Record the errno of ->prepare_read() in the subrequest and keep the error
of subrequests that already failed, using -ENOMEM only for those
abandoned while still waiting for a retry.
Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/netfs/read_retry.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
--- a/fs/netfs/read_retry.c
+++ b/fs/netfs/read_retry.c
@@ -28,6 +28,7 @@ static void netfs_retry_read_subrequests
struct netfs_io_subrequest *subreq;
struct netfs_io_stream *stream = &rreq->io_streams[0];
struct list_head *next;
+ int ret;
_enter("R=%x", rreq->debug_id);
@@ -140,8 +141,11 @@ static void netfs_retry_read_subrequests
/* Renegotiate max_len (rsize) */
stream->sreq_max_len = subreq->len;
- if (rreq->netfs_ops->prepare_read &&
- rreq->netfs_ops->prepare_read(subreq) < 0) {
+ ret = 0;
+ if (rreq->netfs_ops->prepare_read)
+ ret = rreq->netfs_ops->prepare_read(subreq);
+ if (ret < 0) {
+ subreq->error = ret;
trace_netfs_sreq(subreq, netfs_sreq_trace_reprep_failed);
__set_bit(NETFS_SREQ_FAILED, &subreq->flags);
goto abandon;
@@ -222,7 +226,9 @@ static void netfs_retry_read_subrequests
part = netfs_limit_iter(&source, 0, part, stream->sreq_max_segs);
netfs_stat(&netfs_n_rh_download);
- if (rreq->netfs_ops->prepare_read(subreq) < 0) {
+ ret = rreq->netfs_ops->prepare_read(subreq);
+ if (ret < 0) {
+ subreq->error = ret;
trace_netfs_sreq(subreq, netfs_sreq_trace_reprep_failed);
__set_bit(NETFS_SREQ_FAILED, &subreq->flags);
goto abandon;
@@ -258,7 +264,9 @@ abandon:
if (!test_bit(NETFS_SREQ_FAILED, &subreq->flags) &&
!test_bit(NETFS_SREQ_NEED_RETRY, &subreq->flags))
continue;
- subreq->error = -ENOMEM;
+ if (!subreq->error ||
+ !test_bit(NETFS_SREQ_FAILED, &subreq->flags))
+ subreq->error = -ENOMEM;
__set_bit(NETFS_SREQ_FAILED, &subreq->flags);
__clear_bit(NETFS_SREQ_NEED_RETRY, &subreq->flags);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 729/990] netfs: dont hang a read whose retry is abandoned
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (727 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 728/990] netfs: keep the prepare_read errno when abandoning read retries Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 730/990] net/sched: sch_teql: reject qdiscs from another network namespace Greg Kroah-Hartman
` (123 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit d1bb754ab9e775b0fbb2743d3df425c25a561114 upstream.
When ->prepare_read() fails while retrying a read, or a subrequest can't
be allocated, netfs_retry_read_subrequests() marks the remaining
subrequests failed without reissuing them. If none was reissued in that
pass, nothing is in progress any more to wake the collector, which
returned after the retry, so an offloaded read (readahead, async direct
I/O) never completes and its folios stay locked.
Wake the collector after abandoning, so it collects the failed
subrequests and completes the request.
Fixes: e2d46f2ec332 ("netfs: Change the read result collector to only use one work item")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/netfs/read_retry.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/netfs/read_retry.c
+++ b/fs/netfs/read_retry.c
@@ -270,6 +270,7 @@ abandon:
__set_bit(NETFS_SREQ_FAILED, &subreq->flags);
__clear_bit(NETFS_SREQ_NEED_RETRY, &subreq->flags);
}
+ netfs_wake_collector(rreq);
}
/*
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 730/990] net/sched: sch_teql: reject qdiscs from another network namespace
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (728 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 729/990] netfs: dont hang a read whose retry is abandoned Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 731/990] net/sched: act_ife: encode configured zero metadata values Greg Kroah-Hartman
` (122 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, shaos, Victor Nogueira,
Jamal Hadi Salim, Simon Horman, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
commit 1ae84bdd736f8fab30180159996e1d193f8029ff upstream.
Reported by shaos <shawnq1@163.com> with a reproducer, which was
reproduced and verified in our test environment.
The issue:
The teql master devices are created once in the initial network
namespace and their Qdisc_ops are global. teql_qdisc_init() takes the
teql_master embedded in the registered sch->ops and uses it without
checking whether the new qdisc's device lives in the same network
namespace as the master. A qdisc created in another netns can therefore
attach to the init-net master and change its MTU and flags.
The Fix:
Reject a teql qdisc whose device is not in the master's network
namespace with -EOPNOTSUPP and an extack message; same-netns teql still
works.
Initialize the private skb queue before any validation so every
constructor failure path, including qdisc_create_dflt(), which resets the
qdisc before destroying it, sees an initialized empty queue.
Conditions to recreate the bug:
CONFIG_NET_SCH_TEQL=y, CONFIG_DUMMY=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y.
As an unprivileged UID, unshare a user and network namespace, create a
dummy device, set its MTU to 60000, and add a root teql0 qdisc:
unshare -Urn
ip link add dummy0 type dummy
ip link set dummy0 mtu 60000
tc qdisc add dev dummy0 root teql0
The init-net teql0 device changes from MTU 1500 to 60000. A pfifo control
on the same device leaves the MTU unchanged, and a direct MTU change on
init-net teql0 is denied. The namespace needs CAP_NET_ADMIN; no init-net
privilege is required. With the fix the attach fails with
"Operation not supported" and the init-net MTU stays 1500.
Fixes: 7316ae88c43d ("net_sched: make traffic control network namespace aware")
Reported-by: shaos <shawnq1@163.com>
Link: https://lore.kernel.org/netdev/20261022144830.67948-1-shawnq1@163.com/
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v1.r2.20261031160050-3%40mojatatu.com
Link: https://lore.kernel.org/netdev/179366641863.488856.17368571591466000274@kernel.org/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-3@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sched/sch_teql.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -198,6 +198,8 @@ static int teql_qdisc_init(struct Qdisc
struct Qdisc *first;
unsigned long flags;
+ skb_queue_head_init(&q->q);
+
if (dev->hard_header_len > m->dev->hard_header_len)
return -EINVAL;
@@ -209,9 +211,12 @@ static int teql_qdisc_init(struct Qdisc
return -EOPNOTSUPP;
}
- q->m = m;
+ if (dev_net(dev) != dev_net(m->dev)) {
+ NL_SET_ERR_MSG_MOD(extack, "teql master is in a different network namespace");
+ return -EOPNOTSUPP;
+ }
- skb_queue_head_init(&q->q);
+ q->m = m;
raw_spin_lock_irqsave(&m->slaves_lock, flags);
first = rcu_dereference_protected(m->slaves, lockdep_is_held(&m->slaves_lock));
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 731/990] net/sched: act_ife: encode configured zero metadata values
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (729 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 730/990] net/sched: sch_teql: reject qdiscs from another network namespace Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 732/990] net/sched: act_ife: require a full Ethernet header on egress Greg Kroah-Hartman
` (121 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, shaos, Victor Nogueira,
Jamal Hadi Salim, Simon Horman, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
commit 7d02c07c738bf5c4b9a7d7ef498fbf465c446853 upstream.
Reported by shaos <shawnq1@163.com> with a reproducer for the 32-bit
case, which was reproduced and verified in our test environment.
The issue:
ife_check_meta_u32() and ife_check_meta_u16() both reserve eight bytes
of metadata for a configured value even when that value is zero, but the
matching encoder returns without calling ife_tlv_meta_encode(). The
encoder therefore writes neither the TLV header nor its value, while the
enclosing IFE length still includes the reserved bytes, exposing stale
skb headroom contents to the peer.
The 32-bit helper has been present since the IFE action was introduced
(v4.6); the 16-bit helper was added with the 16-bit metadata helpers used
by the skbtcindex callback (v4.9). Both defects predate the oldest
supported stable kernel (5.10), so they are fixed together in this patch.
Each hunk keeps its own Fixes: tag for provenance.
The fix:
Encode any configured value, including zero; skip the TLV only when
there is neither a configured nor a runtime value. The runtime fallback
is unchanged.
A raw TCA_IFE_METALST netlink request is needed to express the
configured zero: the IFE_META_SKBMARK attribute carries four zero
payload bytes for the u32 helper, and IFE_META_TCINDEX two zero payload
bytes for the 16-bit helper (not an absent or zero-length attribute).
Stock tc cannot build these requests; "use mark 0x0" emits no mark
attribute and "allow mark" emits a zero-length one.
Conditions to recreate the bug:
CONFIG_NET_ACT_IFE=y, CONFIG_NET_IFE_SKBMARK=y,
CONFIG_NET_IFE_SKBTCINDEX=y, CONFIG_NET_CLS_MATCHALL=y,
CONFIG_NET_SCH_INGRESS=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y,
CONFIG_VETH=y. In a fresh user and network namespace create a veth pair
and attach clsact to the egress side. Install a matchall filter whose
ife encode action carries a zero skb mark (or a zero tcindex) in
TCA_IFE_METALST. Send a frame through the veth and inspect the IFE
metadata in the received frame. The metadata region is eight bytes but
holds neither a valid TLV header nor a value; it exposes prior headroom
contents. Setting the value to a nonzero one does not trigger the leak.
The namespace needs CAP_NET_ADMIN; no additional privilege is required.
With the fix the zero TLVs are 0001000800000000 (u32) and
0005000600000000 (u16).
Fixes: ef6980b6becb ("introduce IFE action")
Fixes: 6a5d58b67e20 ("net sched ife action: add 16 bit helpers")
Reported-by: shaos <shawnq1@163.com>
Link: https://lore.kernel.org/netdev/20261022144739.61342-1-shawnq1@163.com/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-1@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sched/act_ife.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -50,8 +50,7 @@ int ife_encode_meta_u16(u16 metaval, voi
edata = *(u16 *)mi->metaval;
else if (metaval)
edata = metaval;
-
- if (!edata) /* will not encode */
+ else
return 0;
edata = htons(edata);
@@ -94,8 +93,7 @@ int ife_encode_meta_u32(u32 metaval, voi
edata = *(u32 *)mi->metaval;
else if (metaval)
edata = metaval;
-
- if (!edata) /* will not encode */
+ else
return 0;
edata = htonl(edata);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 732/990] net/sched: act_ife: require a full Ethernet header on egress
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (730 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 731/990] net/sched: act_ife: encode configured zero metadata values Greg Kroah-Hartman
@ 2026-11-25 14:34 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 733/990] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids Greg Kroah-Hartman
` (120 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:34 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko (nipa), shaos,
Victor Nogueira, Jamal Hadi Salim, Simon Horman, Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <jhs@mojatatu.com>
commit 11dbce09083473249c3843ff31bf8d8fa01bdeef upstream.
This is a followup of commit 5b483f7791b0 ("net/sched: act_ife: Only
operate on Ethernet frames") as reported by Sashiko.
The finding was raised by both Sashiko providers (nipa and gemini)
while reviewing the parent patchset. shaos <shawnq1@163.com>
independently reported the same undersized-egress path with a
reproducer, which was reproduced and verified in our test environment.
The issue:
On egress tcf_ife_is_eth_skb() only checks the device type; it does not
check that the skb carries a full Ethernet header. For an Ethernet or
loopback device it returns true even when the skb has no Ethernet
header. tcf_ife_encode() then calls ife_encode(), which copies ETH_HLEN
bytes from skb->data. A short skb therefore reads past its linear data
and the copied bytes, including stale kernel memory, are emitted in the
outer Ethernet header.
The parent commit fixed the reported ingress mac_len case but left the
egress path without a length check.
A total-length test is not sufficient: a non-GSO TUN skb can have a
large total length while only a single byte sits in the linear area, so
ife_encode() still reads past the linear header. Require instead that
the Ethernet header the encoder copies is present in the linear part of
the skb.
The Fix:
On egress require pskb_may_pull(skb, ETH_HLEN) before encoding, which
ensures the Ethernet header is present in the linear data ife_encode()
copies from; the ingress mac_len check is unchanged. A short egress skb
is now dropped instead of being encoded.
Conditions to recreate the bug:
CONFIG_NET_ACT_IFE=y, CONFIG_NET_CLS_MATCHALL=y, CONFIG_NET_SCH_INGRESS=y,
CONFIG_TUN=y, CONFIG_NET_ACT_MIRRED=y. In two user and network
namespaces (a victim and an attacker), open a TUN device in IFF_TUN mode
and attach clsact to it and to lo. Redirect ingress traffic from the TUN
device to lo egress with mirred, and install an ife encode action on lo
egress:
tc qdisc add dev <tun> clsact
tc qdisc add dev lo clsact
tc filter add dev <tun> ingress matchall action mirred egress \
redirect dev lo
tc filter add dev lo egress matchall action ife encode use mark 1 \
action ok
Send a TUN packet shorter than ETH_HLEN (a one-byte payload is enough)
and receive the emitted frame on the other side. Without the fix the
outer Ethernet header contains bytes copied past the short packet; with
the fix the short skb is dropped. The attacker needs CAP_NET_ADMIN in
its user namespace; no init-net privilege is required.
The same path is reachable when the total length is large but the
Ethernet header is not linear: write a non-GSO virtio header with
hdr_len=1 followed by an 8192-byte packet so that only one byte stays
linear. Without the fix the copied header reads past the linear data;
with the fix the header is pulled into the linear area before the copy.
Fixes: 295a6e06d21e ("net/sched: act_ife: Change to use ife module")
Reported-by: Sashiko (nipa) <sashiko-bot@kernel.org>
Reported-by: Sashiko (gemini) <sashiko-bot@kernel.org>
Reported-by: shaos <shawnq1@163.com>
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260821164031.32824-1-victor%40mojatatu.com
Link: https://sashiko.dev/#/patchset/20260821164031.32824-1-victor@mojatatu.com
Link: https://lore.kernel.org/netdev/20261022144736.61227-1-shawnq1@163.com/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-2@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sched/act_ife.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -871,13 +871,16 @@ drop:
* is an Ethernet header because the skb could've been redirected with mirred
* from a non-Ethernet device.
*/
-static bool tcf_ife_is_eth_skb(const struct sk_buff *skb)
+static bool tcf_ife_is_eth_skb(struct sk_buff *skb)
{
if (skb->dev->type != ARPHRD_ETHER &&
skb->dev->type != ARPHRD_LOOPBACK)
return false;
- return !skb_at_tc_ingress(skb) || skb->mac_len == ETH_HLEN;
+ if (skb_at_tc_ingress(skb))
+ return skb->mac_len == ETH_HLEN;
+
+ return pskb_may_pull(skb, ETH_HLEN);
}
TC_INDIRECT_SCOPE int tcf_ife_act(struct sk_buff *skb,
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 733/990] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (731 preceding siblings ...)
2026-11-25 14:34 ` [PATCH 6.18 732/990] net/sched: act_ife: require a full Ethernet header on egress Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 734/990] openvswitch: advance by the real header length in get_ipv6_ext_hdrs() Greg Kroah-Hartman
` (119 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Menninger, Anna Schumaker
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Menninger <tmenninger@everpuredata.com>
commit 151d95a1e696979a7d54b23c96338754be2fcc1f upstream.
When processing an out-of-order OPEN stateid on an NFSv4.1 or later
mount, nfs_set_open_stateid_locked() waits for stateid updates to be
processed in order. A five-second timeout is intended to prevent
indefinite waits when preceding updates never arrive.
However, each iteration calls schedule_timeout() with a fresh
five-second timeout. An update to the shared open state can wake the
caller without satisfying its ordering check. The remaining timeout
is then discarded, and the next iteration starts another full wait.
Under sustained concurrent OPEN/CLOSE activity on the same open state,
repeated wakeups can prevent the timeout from ever expiring. Some
tasks can remain stuck in update_open_stateid() while others continue
making progress.
Compute a single deadline on entry and pass only the remaining time
to schedule_timeout(). Once the deadline expires, take the existing
timeout path rather than starting another wait. This prevents
wakeups from extending the wait indefinitely.
Observed on Linux 6.8.0 and reproduced on 7.3.0 with 96 concurrent
O_RDWR|O_TRUNC open/close loops on one NFSv4.1/TCP file (nconnect=16).
Ten workers made no progress for over 300 seconds while others ran.
With the fix, all workers resumed after transient stalls.
Fixes: c9399f21c215 ("NFSv4: Fix OPEN / CLOSE race")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/nfs/nfs4proc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1775,6 +1775,8 @@ static void nfs_set_open_stateid_locked(
{
DEFINE_WAIT(wait);
int status = 0;
+ unsigned long deadline = jiffies + 5 * HZ;
+ signed long remaining;
for (;;) {
if (nfs_stateid_is_sequential(state, stateid))
@@ -1809,7 +1811,8 @@ static void nfs_set_open_stateid_locked(
if (!fatal_signal_pending(current) &&
!nfs_current_task_exiting()) {
- if (schedule_timeout(5*HZ) == 0)
+ remaining = (long)(deadline - jiffies);
+ if (remaining <= 0 || schedule_timeout(remaining) == 0)
status = -EAGAIN;
else
status = 0;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 734/990] openvswitch: advance by the real header length in get_ipv6_ext_hdrs()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (732 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 733/990] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 735/990] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit Greg Kroah-Hartman
` (118 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Joas Antonio dos Santos,
Simon Horman, Aaron Conole, Eelco Chaudron, Paolo Abeni
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
commit dbce972650ed6348e3d3856e49308aa5603e02a7 upstream.
get_ipv6_ext_hdrs() walks the IPv6 extension header chain to fill
key->ipv6.exthdrs, but advances to the next header with ipv6_optlen()
whatever the current header is. That is only right for Hop-by-Hop,
Destination Options and Routing headers:
- an Authentication Header is ((hdrlen + 2) << 2) bytes long
(ipv6_authlen()), so with hdrlen = 4 the walk skips 40 bytes instead
of 24 and reads the next "header" from the ICV and payload;
- a Fragment header is always 8 bytes, and the byte read as hdrlen is
its Reserved field, which the sender controls and receivers ignore,
so a non-zero value makes the walk skip up to 2048 bytes and miss
the headers that follow;
- in a non-first fragment nothing after the Fragment header is a
header at all, it is the middle of the fragmentable part, yet the
walk keeps parsing it as an extension header chain.
In all cases the OFPIEH12_* bits stored in key->ipv6.exthdrs depend on
bytes chosen by the sender rather than on the headers that are actually
present: payload bytes that look like another AH or a Hop-by-Hop header
add OFPIEH12_UNREP/OFPIEH12_UNSEQ, and real headers after a Fragment
header can go unreported. Flows that match on OVS_KEY_ATTR_IPV6_EXTHDRS
then classify such packets wrongly. There is no memory safety issue,
skb_header_pointer() bounds every read.
Advance by sizeof(struct frag_hdr) for Fragment headers and by
ipv6_authlen() for AH, and stop at the Fragment header if its offset is
non-zero, as ipv6_find_hdr() does.
Fixes: 28a3f0601727 ("net: openvswitch: IPv6: Add IPv6 extension header support")
Link: https://lore.kernel.org/all/178905555085.219967.6617611783437228045@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Eelco Chaudron <echaudron@ovn.org>
Link: https://patch.msgid.link/20261102-ovs-exthdrs-v2-1-21ceef6a243d@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/openvswitch/flow.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -370,11 +370,28 @@ static void get_ipv6_ext_hdrs(struct sk_
return;
}
+ if (next_type == IPPROTO_FRAGMENT) {
+ struct frag_hdr _fh, *fh;
+
+ fh = skb_header_pointer(skb, start, sizeof(_fh), &_fh);
+ if (!fh)
+ break;
+ /* Only the first fragment has the headers that follow. */
+ if (fh->frag_off & htons(IP6_OFFSET))
+ break;
+ start += sizeof(_fh);
+ next_type = fh->nexthdr;
+ continue;
+ }
+
hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr);
if (!hp)
break;
+ if (next_type == IPPROTO_AH)
+ start += ipv6_authlen(hp);
+ else
+ start += ipv6_optlen(hp);
next_type = hp->nexthdr;
- start += ipv6_optlen(hp);
}
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 735/990] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (733 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 734/990] openvswitch: advance by the real header length in get_ipv6_ext_hdrs() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 736/990] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Greg Kroah-Hartman
` (117 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Phat Dinh, Peter Zijlstra (Intel)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phat Dinh <phatdt1116@gmail.com>
commit 59f1398140869432c7171b9a2a279ca315467c4e upstream.
perf_cgroup_switch() relies on:
/*
* cpuctx->cgrp is set when the first cgroup event enabled,
* and is cleared when the last cgroup event disabled.
*/
It computes the next task's cgroup, schedules out the CPU context and
then assigns cpuctx->cgrp unconditionally:
ctx_sched_out(&cpuctx->ctx, NULL, EVENT_ALL|EVENT_CGROUP);
/*
* must not be done before ctxswout due
* to update_cgrp_time_from_cpuctx() in
* ctx_sched_out()
*/
cpuctx->cgrp = cgrp;
However, ctx_sched_out() can disable events itself. If a cgroup event
has a pending disable from perf_event_disable_inatomic() (e.g. its
PERF_EVENT_IOC_REFRESH limit ran out) that the irq_work has not
handled yet, event_sched_out() consumes it inline:
if (event->pending_disable) {
event->pending_disable = 0;
perf_cgroup_event_disable(event, ctx);
state = PERF_EVENT_STATE_OFF;
}
If that was the last cgroup event, perf_cgroup_event_disable() clears
cpuctx->cgrp:
if (--ctx->nr_cgroups)
return;
cpuctx->cgrp = NULL;
and perf_cgroup_switch() then sets it again. cpuctx->cgrp is left
non-NULL with ctx.nr_cgroups == 0, so the NULL check in
perf_cgroup_switch() no longer catches it and the next switch trips:
WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0);
cpuctx->cgrp does not hold a reference on the cgroup. Once that cgroup
is removed, the next ctx_sched_in() dereferences the stale pointer:
BUG: KASAN: slab-use-after-free in ctx_sched_in+0xb1f/0xfa0
Read of size 8 at addr ffff8881008972d0 by task swapper/3/0
Tainted: [W]=WARN
Call Trace:
<IRQ>
ctx_sched_in+0xb1f/0xfa0
perf_event_sched_in+0x1a/0x70
ctx_resched+0x32b/0xac0
__perf_install_in_context+0x475/0xab0
remote_function+0x105/0x200
__flush_smp_call_function_queue+0x179/0x8d0
__sysvec_call_function_single+0x1b/0x1c0
sysvec_call_function_single+0x66/0x80
</IRQ>
<TASK>
asm_sysvec_call_function_single+0x1a/0x20
Only assign cpuctx->cgrp when cgroup events remain after the context
has been scheduled out, so that it stays NULL as the invariant
requires.
Fixes: e19cd0b6fa59 ("perf/core: Always set cpuctx cgrp when enable cgroup event")
Signed-off-by: Phat Dinh <phatdt1116@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261106101642.494674-1-phatdt1116@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/events/core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -971,8 +971,13 @@ static void perf_cgroup_switch(struct ta
* must not be done before ctxswout due
* to update_cgrp_time_from_cpuctx() in
* ctx_sched_out()
+ *
+ * ctx_sched_out() can consume a pending disable and drop the last cgroup
+ * event, which clear the cpuctx->cgrp. Cgroup tracking follow active cgroup
+ * event, so do not resurrect it
*/
- cpuctx->cgrp = cgrp;
+ if (cpuctx->ctx.nr_cgroups)
+ cpuctx->cgrp = cgrp;
/*
* set cgrp before ctxsw in to allow
* perf_cgroup_set_timestamp() in ctx_sched_in()
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 736/990] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (734 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 735/990] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 737/990] PM: runtime: Update last_busy in rpm_resume() for active devices Greg Kroah-Hartman
` (116 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Paolo Bertinetti,
Peter Zijlstra (Intel)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bertinetti <paolobertinetti200f4@proton.me>
commit 6bea5e29daf123a78ae58cb5926023f4705f396f upstream.
Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
__perf_event_overflow() stops the event with pmu->stop() and disables
it when the PERF_EVENT_IOC_REFRESH limit is reached. When userspace
re-arms the event with PERF_EVENT_IOC_REFRESH, the event is enabled
again and pmu->add() is called with PERF_EF_START.
hw_breakpoint_add() sets PERF_HES_STOPPED when PERF_EF_START is
missing, but never clears it. The flag set by pmu->stop() stays, and
perf_bp_event() drops every later hit, so a breakpoint re-armed this
way delivers only its first overflow.
Set the state from PERF_EF_START on every add, as perf_swevent_add()
does.
Fixes: 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage")
Assisted-by: LLM
Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261103130732.764081-3-paolobertinetti200f4@proton.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/events/hw_breakpoint.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -967,8 +967,7 @@ static int hw_breakpoint_event_init(stru
static int hw_breakpoint_add(struct perf_event *bp, int flags)
{
- if (!(flags & PERF_EF_START))
- bp->hw.state = PERF_HES_STOPPED;
+ bp->hw.state = (flags & PERF_EF_START) ? 0 : PERF_HES_STOPPED;
if (is_sampling_event(bp)) {
bp->hw.last_period = bp->hw.sample_period;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 737/990] PM: runtime: Update last_busy in rpm_resume() for active devices
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (735 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 736/990] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 738/990] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup Greg Kroah-Hartman
` (115 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Brian Norris, Rafael J. Wysocki,
Alan Stern
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit 55b2b8af704f845e01fa2f31ee259b07641ce3a9 upstream.
Setting an autosuspend delay for a device can be expected to cause a
runtime suspend of the device after calling, say, pm_runtime_put() to
be deferred, so the time between the last successful attempt to resume
the device and its subsequent suspend is at least equal to the
autosuspend delay.
However, that expectation is only met after the device has been actually
resumed in rpm_resume() by invoking its runtime resume callback. If the
runtime PM status of the device is already "active" when rpm_resume()
runs for it, the device's last_busy timestamp is not updated which may
allow a subsequent pm_runtime_put() invocation (or similar) to suspend
it right away.
This is arguably inconsistent and confusing, so make rpm_resume() also
update the device's last_busy timestamp when it finds that the device is
already "active" and it is about to return 1 early.
Fixes: 56f487c78015 ("PM / Runtime: Update last_busy in rpm_resume")
Link: https://lore.kernel.org/linux-pm/CAJZ5v0jTX1FgeS9FCV=+V4uacSgLQBVsSPnU27ybgUGg57GUOA@mail.gmail.com/
Reported-by: Brian Norris <briannorris@chromium.org>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Link: https://patch.msgid.link/13032301.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/power/runtime.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -822,6 +822,12 @@ static int rpm_resume(struct device *dev
pm_runtime_deactivate_timer(dev);
if (dev->power.runtime_status == RPM_ACTIVE) {
+ /*
+ * The attempt to resume the device means that it is needed for
+ * something, so update its last_busy timestamp as in the case
+ * in which it actually resumes below.
+ */
+ pm_runtime_mark_last_busy(dev);
retval = 1;
goto out;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 738/990] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (736 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 737/990] PM: runtime: Update last_busy in rpm_resume() for active devices Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 739/990] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files Greg Kroah-Hartman
` (114 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Baoli Zhang, Peter Ujfalusi,
Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baoli Zhang <baoli.zhang@linux.intel.com>
commit e5c09fe3f9c8d9da33b177ee432db15b6ab46884 upstream.
sof_ipc4_widget_setup_comp_process() allocates the input and output pin
format arrays via sof_ipc4_get_audio_fmt(). When the following
sof_ipc4_widget_setup_msg() fails, e.g. because the firmware does not
provide a module matching the widget UUID, the error path jumps to the
'err' label, which frees the process struct and clears swidget->private
but skips sof_ipc4_free_audio_fmt(). The arrays are then unreachable and
are reported by kmemleak:
sof_ipc4_get_audio_fmt+0xc9/0x420 [snd_sof]
sof_ipc4_widget_setup_comp_process+0x8e/0x200 [snd_sof]
snd_sof_load_topology+0x71a/0x840 [snd_sof]
sof_pcm_probe+0x77/0x120 [snd_sof]
snd_soc_component_probe+0x21/0x60 [snd_soc_core]
...
Jump to 'free_available_fmt' instead, as the other process widget error
paths after sof_ipc4_get_audio_fmt() already do.
The other IPC4 widget setup functions (pga, mixer, src, asrc) free the
audio formats in their common error label and are not affected.
Fixes: f9efae954905 ("ASoC: SOF: ipc4-topology: Add support for base config extension")
Cc: stable@vger.kernel.org
Signed-off-by: Baoli Zhang <baoli.zhang@linux.intel.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20261109005604.1004362-1-baoli.zhang@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
sound/soc/sof/ipc4-topology.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1205,7 +1205,7 @@ static int sof_ipc4_widget_setup_comp_pr
ret = sof_ipc4_widget_setup_msg(swidget, &process->msg);
if (ret)
- goto err;
+ goto free_available_fmt;
/* parse process init module payload config type from module info */
fw_module = swidget->module_info;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 739/990] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (737 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 738/990] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 740/990] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Greg Kroah-Hartman
` (113 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, YuanZhe Liu, Bartosz Golaszewski,
Luiz Augusto von Dentz
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
commit eeca795cec6d9c6c193c2c1bd0cb26cde44f9fc3 upstream.
qca_debugfs_init() creates an "ibs" directory under hdev->debugfs and
stores pointers to fields of struct qca_data in the debugfs files.
qca_close() frees qca_data without removing that directory, while
hdev->debugfs is only removed when the HCI device is released. The HCI
device can outlive the driver data, for example when an HCI socket still
references it, so reading or writing one of the ibs files then
dereferences freed memory.
Store the directory dentry in struct qca_data and remove the directory
with debugfs_remove_recursive() before qca_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
debugfs helpers. This covers the two writable files as well.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261102113654.8724-1-25031212351%40stu.xidian.edu.cn
Fixes: 0ff252c1976d ("Bluetooth: hciuart: Add support QCA chipset for UART")
Cc: stable@vger.kernel.org
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.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 | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -162,6 +162,7 @@ struct qca_data {
struct delayed_work ctrl_memdump_timeout;
struct qca_memdump_info *qca_memdump;
unsigned long flags;
+ struct dentry *debugfs_ibs_dir;
struct completion drop_ev_comp;
wait_queue_head_t suspend_wait_q;
enum qca_memdump_states memdump_state;
@@ -667,6 +668,7 @@ static void qca_debugfs_init(struct hci_
return;
ibs_dir = debugfs_create_dir("ibs", hdev->debugfs);
+ qca->debugfs_ibs_dir = ibs_dir;
/* read only */
mode = 0444;
@@ -742,6 +744,9 @@ static int qca_close(struct hci_uart *hu
hu->priv = NULL;
+ debugfs_remove_recursive(qca->debugfs_ibs_dir);
+ qca->debugfs_ibs_dir = NULL;
+
kfree(qca);
return 0;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 740/990] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (738 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 739/990] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 741/990] cgroup/cpuset: Dont revive invalid partition without active CPU on hotplug Greg Kroah-Hartman
` (112 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Luiz Augusto von Dentz
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 1f2ac56137c51be0601e18a163d817e02a15913f upstream.
Reading buffered ERTM data after ACL link loss can clear local busy and
send a supervisory frame after l2cap_conn_del() has destroyed the HCI
channel, which oopses on a NULL pointer in hci_send_acl(). The socket still
owns its L2CAP channel, so its lifetime does not protect the underlying HCI
channel.
Require BT_CONNECTED before clearing local busy in recvmsg. The socket lock
already held here serializes this check and send with teardown, which
closes the socket before the HCI channel is destroyed. Continue to allow
buffered data to be read after disconnection.
AI assistance was used.
Fixes: 61aa4f5b9f43 ("Bluetooth: Use the transmit state machine for busy state changes")
Cc: stable@vger.kernel.org # needs adjustments for 5.15
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bluetooth/l2cap_sock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1289,7 +1289,8 @@ static int l2cap_sock_recvmsg(struct soc
* available. This avoids resending large numbers of
* frames.
*/
- if (test_bit(CONN_LOCAL_BUSY, &pi->chan->conn_state) &&
+ if (sk->sk_state == BT_CONNECTED &&
+ test_bit(CONN_LOCAL_BUSY, &pi->chan->conn_state) &&
atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf >> 1)
l2cap_chan_busy(pi->chan, 0);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 741/990] cgroup/cpuset: Dont revive invalid partition without active CPU on hotplug
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (739 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 740/990] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 742/990] crypto: caam - reject overlong RSA CRT parameters Greg Kroah-Hartman
` (111 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Ridong Chen, Waiman Long,
Tejun Heo
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ridong Chen <chenridong@xiaomi.com>
commit acec9637e03ca54bd3c3a0c1a6ad5c6dfa07c0df upstream.
When a CPU hotplug leaves no CPU outside of the partitions for the top
cpuset, cpuset_handle_hotplug() clears subpartitions_cpus and gives all
the active CPUs back to the top cpuset. cpuset_hotplug_update_tasks()
then walks the hierarchy and invalidates the partitions, as
subpartitions_cpus is empty.
However, an invalid partition visited in the same walk may be revived
if its effective_xcpus is not empty. tasks_nocpu_error() doesn't catch
it when its CPUs are all offline but it has no task. Its CPUs are put
back into subpartitions_cpus, and the valid partitions visited after it
are no longer invalidated, as subpartitions_cpus is not empty any more.
The top cpuset is left with CPUs overlapping with these partitions.
It can be reproduced on a system with 8 CPUs:
# cd /sys/fs/cgroup
# echo +cpuset > cgroup.subtree_control
# mkdir A1 B1
# echo 1 > A1/cpuset.cpus
# echo 1 > A1/cpuset.cpus.exclusive
# echo 0,2-7 > B1/cpuset.cpus
# echo root > B1/cpuset.cpus.partition
# echo root > A1/cpuset.cpus.partition
# cat A1/cpuset.cpus.partition
root invalid (Parent unable to distribute cpu downstream)
# echo 0 > /sys/devices/system/cpu/cpu1/online
# cat A1/cpuset.cpus.partition B1/cpuset.cpus.partition
root
root
# cat cpuset.cpus.effective
0,2-7
A1 can't take CPU 1, the last CPU of the root cgroup which has tasks.
When CPU 1 is offlined, A1 is revived without any active CPU, and B1
stays valid while its CPUs are also in the effective CPUs of the root
cgroup, which triggers
WARNING: kernel/cgroup/cpuset.c:919 at rebuild_sched_domains_locked
Only revive an invalid partition in hotplug if its effective_xcpus has
an active CPU, the same as what is required to create a partition with
tasks. With that, A1 and B1 are both invalidated in the above case.
Fixes: 0c7f293efc87 ("cgroup/cpuset: Add cpuset.cpus.exclusive.effective for v2")
Cc: stable@vger.kernel.org # v6.7+
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20261114083124.1340140-1-ridong.chen%40linux.dev?part=11
Signed-off-by: Ridong Chen <chenridong@xiaomi.com>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/cgroup/cpuset.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -4164,10 +4164,10 @@ retry:
partcmd = partcmd_invalidate;
/*
* On the other hand, an invalid partition root may be transitioned
- * back to a regular one with a non-empty effective xcpus.
+ * back to a regular one if its effective xcpus has an active CPU.
*/
else if (is_partition_valid(parent) && is_partition_invalid(cs) &&
- !cpumask_empty(cs->effective_xcpus))
+ cpumask_intersects(cs->effective_xcpus, cpu_active_mask))
partcmd = partcmd_update;
if (partcmd >= 0) {
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 742/990] crypto: caam - reject overlong RSA CRT parameters
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (740 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 741/990] cgroup/cpuset: Dont revive invalid partition without active CPU on hotplug Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 743/990] crypto: essiv - fix use-after-free in AEAD path Greg Kroah-Hartman
` (110 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jérémy Jean,
Sahil Malhotra, Herbert Xu
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>
commit 828c3b265b6df877dced3dde56ea41daa2e6181e upstream.
caam_read_rsa_crt() right-aligns dP, dQ, and qInv in buffers sized
from the corresponding prime. rsa_parse_priv_key() only bounds these
integers against n, so a malformed key can provide, for example, a
two-byte dP with a one-byte p. dstlen - nbytes then underflows and
memcpy() writes outside the allocation during set_priv_key(). KASAN
reports a slab-out-of-bounds write in caam_read_rsa_crt().
Reject empty or overlong CRT parameters after stripping leading zeros.
qInv is consumed by CAAM as a p-sized value, so size it from p rather
than q to match the DMA mapping in set_rsa_priv_f3_pdb(). Let the
top-level key cleanup handle partial form-3 allocations and return the
specific error to the caller.
Also test nbytes before dereferencing it while stripping zeros, so an
all-zero integer does not read one byte beyond its input.
Fixes: 4a651b122adb ("crypto: caam - add support for RSA key form 3")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Reviewed-by: Sahil Malhotra <sahil.malhotra@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/crypto/caam/caampkc.c | 79 +++++++++++++++++-------------------------
1 file changed, 32 insertions(+), 47 deletions(-)
--- a/drivers/crypto/caam/caampkc.c
+++ b/drivers/crypto/caam/caampkc.c
@@ -880,7 +880,7 @@ static void caam_rsa_free_key(struct caa
static void caam_rsa_drop_leading_zeros(const u8 **ptr, size_t *nbytes)
{
- while (!**ptr && *nbytes) {
+ while (*nbytes && !**ptr) {
(*ptr)++;
(*nbytes)--;
}
@@ -896,22 +896,22 @@ static void caam_rsa_drop_leading_zeros(
* @ptr : pointer to {dP, dQ, qInv} CRT member
* @nbytes: length in bytes of {dP, dQ, qInv} CRT member
* @dstlen: length in bytes of corresponding p or q prime factor
+ * @dst : pointer to the zero-padded output buffer
*/
-static u8 *caam_read_rsa_crt(const u8 *ptr, size_t nbytes, size_t dstlen)
+static int caam_read_rsa_crt(const u8 *ptr, size_t nbytes, size_t dstlen,
+ u8 **dst)
{
- u8 *dst;
-
caam_rsa_drop_leading_zeros(&ptr, &nbytes);
- if (!nbytes)
- return NULL;
+ if (!nbytes || nbytes > dstlen)
+ return -EINVAL;
- dst = kzalloc(dstlen, GFP_KERNEL);
- if (!dst)
- return NULL;
+ *dst = kzalloc(dstlen, GFP_KERNEL);
+ if (!*dst)
+ return -ENOMEM;
- memcpy(dst + (dstlen - nbytes), ptr, nbytes);
+ memcpy(*dst + (dstlen - nbytes), ptr, nbytes);
- return dst;
+ return 0;
}
/**
@@ -991,6 +991,7 @@ static int caam_rsa_set_priv_key_form(st
size_t p_sz = raw_key->p_sz;
size_t q_sz = raw_key->q_sz;
unsigned aligned_size;
+ int ret;
rsa_key->p = caam_read_raw_data(raw_key->p, &p_sz);
if (!rsa_key->p)
@@ -999,57 +1000,39 @@ static int caam_rsa_set_priv_key_form(st
rsa_key->q = caam_read_raw_data(raw_key->q, &q_sz);
if (!rsa_key->q)
- goto free_p;
+ return -ENOMEM;
rsa_key->q_sz = q_sz;
aligned_size = ALIGN(raw_key->p_sz, dma_get_cache_alignment());
rsa_key->tmp1 = kzalloc(aligned_size, GFP_KERNEL);
if (!rsa_key->tmp1)
- goto free_q;
+ return -ENOMEM;
aligned_size = ALIGN(raw_key->q_sz, dma_get_cache_alignment());
rsa_key->tmp2 = kzalloc(aligned_size, GFP_KERNEL);
if (!rsa_key->tmp2)
- goto free_tmp1;
+ return -ENOMEM;
rsa_key->priv_form = FORM2;
- rsa_key->dp = caam_read_rsa_crt(raw_key->dp, raw_key->dp_sz, p_sz);
- if (!rsa_key->dp)
- goto free_tmp2;
-
- rsa_key->dq = caam_read_rsa_crt(raw_key->dq, raw_key->dq_sz, q_sz);
- if (!rsa_key->dq)
- goto free_dp;
-
- rsa_key->qinv = caam_read_rsa_crt(raw_key->qinv, raw_key->qinv_sz,
- q_sz);
- if (!rsa_key->qinv)
- goto free_dq;
+ ret = caam_read_rsa_crt(raw_key->dp, raw_key->dp_sz, p_sz,
+ &rsa_key->dp);
+ if (ret)
+ return ret;
+
+ ret = caam_read_rsa_crt(raw_key->dq, raw_key->dq_sz, q_sz,
+ &rsa_key->dq);
+ if (ret)
+ return ret;
+
+ ret = caam_read_rsa_crt(raw_key->qinv, raw_key->qinv_sz, p_sz,
+ &rsa_key->qinv);
+ if (ret)
+ return ret;
rsa_key->priv_form = FORM3;
return 0;
-
-free_dq:
- kfree_sensitive(rsa_key->dq);
- rsa_key->dq = NULL;
-free_dp:
- kfree_sensitive(rsa_key->dp);
- rsa_key->dp = NULL;
-free_tmp2:
- kfree_sensitive(rsa_key->tmp2);
- rsa_key->tmp2 = NULL;
-free_tmp1:
- kfree_sensitive(rsa_key->tmp1);
- rsa_key->tmp1 = NULL;
-free_q:
- kfree_sensitive(rsa_key->q);
- rsa_key->q = NULL;
-free_p:
- kfree_sensitive(rsa_key->p);
- rsa_key->p = NULL;
- return -ENOMEM;
}
static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
@@ -1067,6 +1050,8 @@ static int caam_rsa_set_priv_key(struct
if (ret)
return ret;
+ ret = -ENOMEM;
+
/* Copy key in DMA zone */
rsa_key->d = kmemdup(raw_key.d, raw_key.d_sz, GFP_KERNEL);
if (!rsa_key->d)
@@ -1103,7 +1088,7 @@ static int caam_rsa_set_priv_key(struct
err:
caam_rsa_free_key(rsa_key);
- return -ENOMEM;
+ return ret;
}
static unsigned int caam_rsa_max_size(struct crypto_akcipher *tfm)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 743/990] crypto: essiv - fix use-after-free in AEAD path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (741 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 742/990] crypto: caam - reject overlong RSA CRT parameters Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 744/990] dcache: let d_invalidate() wait for a d_set_mounted() in flight Greg Kroah-Hartman
` (109 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jérémy Jean, Herbert Xu
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>
commit e9ce64dce975a14700e835003847415e29918474 upstream.
The request that ESSIV submits to its wrapped AEAD transform may
finish before crypto_aead_encrypt() or crypto_aead_decrypt() returns.
In case this happens, essiv_aead_done() calls aead_request_complete()
on the original ESSIV request, which can end up freeing the request
before essiv_aead_crypt() resumes, creating a UAF:
BUG: KASAN: slab-use-after-free in essiv_aead_crypt+0x8e6/0x950
Read of size 8 at addr ffff888102af1360 by task init/66
Check the return status before dereferencing rctx after submitting that
request. If the operation did not return -EINPROGRESS or -EBUSY, then
the request cannot have been freed yet.
Fixes: be1eb7f78aa8 ("crypto: essiv - create wrapper template for ESSIV generation")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
crypto/essiv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/crypto/essiv.c
+++ b/crypto/essiv.c
@@ -250,7 +250,7 @@ static int essiv_aead_crypt(struct aead_
err = enc ? crypto_aead_encrypt(subreq) :
crypto_aead_decrypt(subreq);
- if (rctx->assoc && err != -EINPROGRESS && err != -EBUSY)
+ if (err != -EINPROGRESS && err != -EBUSY)
kfree(rctx->assoc);
return err;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 744/990] dcache: let d_invalidate() wait for a d_set_mounted() in flight
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (742 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 743/990] crypto: essiv - fix use-after-free in AEAD path Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 745/990] fs/adfs: bound directory entry name length in adfs_fplus_getnext() Greg Kroah-Hartman
` (108 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Josef Bacik,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <brauner@kernel.org>
commit 20a6a9ec19e522ae85f87337886b3fb47efce5f3 upstream.
d_invalidate() and d_set_mounted() are supposed to exclude each other.
Either the mount fails with -ENOENT because an ancestor of the
mountpoint was unhashed or d_invalidate() finds the mountpoint and
detaches the mount. d_invalidate() unhashes the dentry first and then
searches the subtree with d_walk() which starts out lockless and only
looks at the seqcount of rename_lock.
Since d_set_mounted() switched to read_seqlock_excl() nothing makes that
walk wait or retry:
CPU0: mount on A/M CPU1: d_invalidate(A)
d_set_mounted(M)
read_seqlock_excl(&rename_lock)
A is hashed, go on
__d_drop(A)
shrink_dcache_parent(A)
d_walk(A, find_submount)
read_seqbegin(&rename_lock)
M is not a mountpoint
need_seqretry() == false
return
M->d_flags |= DCACHE_MOUNTED
return 0
mount gets attached to M
The mount ends up below an unhashed dentry. It can't be reached anymore
and pins the subtree until its parent mount or the mount namespace goes
away. The window grows with the depth of the mountpoint. With a FUSE
directory 3000 levels deep a bind mount racing with
FUSE_NOTIFY_INVAL_ENTRY for the parent of the mountpoint survived in 151
of 200 attempts.
Before 5e317d23f6c6 the seqcount bump made the walk wait while
d_set_mounted() ran and retry under the lock when one had run in the
meantime. That was the right thing to wait for on the wrong counter:
every rename_lock reader paid for it, d_lookup(), d_path(), the ".."
step of the RCU walk.
So give d_set_mounted() a seqlock of its own. It is the only writer and
d_invalidate() is the only reader. After unhashing the dentry
d_invalidate() runs an empty read_seqbegin()/read_seqretry() section on
it. That spins while the count is odd, i.e. while a d_set_mounted() is
between its ancestor check and its flag, and goes round once more if
one started in the meantime. Nobody else retries anything. The ordering
comes from the locks both already take:
- If that d_set_mounted() saw the dentry hashed its check ran under the
dentry's d_lock before __d_drop() took it. So the count is odd by the
time d_invalidate() reads it and d_invalidate() waits.
- Once the count is even again the flag has been set under the
mountpoint's d_lock and the walk takes that lock to look at it.
A d_set_mounted() that starts after the unhash fails its ancestor check
and never touches the flag. So the only flag the walk can pick up
belongs to the one mount that saw the dentry hashed and is still in
flight, and there is at most one of those because namespace_sem
serializes mounts. Either it gets attached and detach_mounts() takes it
off after waiting for namespace_sem or it fails later on and drops the
flag again. In that case the walk goes round once more and finds
nothing. The same goes for the mountpoint that attach_recursive_mnt()
preallocates on the root of the tree it attaches. IOW, d_invalidate()
does at most one extra round, which the removed-name trap (cf. [1])
relies on.
Note that on PREEMPT_RT read_seqbegin() takes the lock instead of
spinning on a preempted d_set_mounted().
The cost is a seqlock around the ancestor walk for every new mountpoint
and two loads of a cacheline that only d_set_mounted() writes for every
d_invalidate() of a positive dentry. Walking the ancestors a second time
after setting the flag would close the race as well but doubles the
cost of d_set_mounted() with the depth of the mountpoint: about 1us at
64 levels and 75us at 4096 levels.
[1]: https://patch.msgid.link/20261028-work-mount-trap-b4-v1-0-f20d9d0730d6@kernel.org
Fixes: 5e317d23f6c6 ("d_set_mounted(): we don't need to bump seqcount component of rename_lock")
Reported-by: Josef Bacik <josef@toxicpanda.com>
Cc: stable@vger.kernel.org # v6.17+
Link: https://patch.msgid.link/20261030-work-dcache-ai-v1-1-cd6b86e0ccc7@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/dcache.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1437,21 +1437,25 @@ int path_has_submounts(const struct path
}
EXPORT_SYMBOL(path_has_submounts);
+/* odd while d_set_mounted() runs, d_invalidate() waits on it */
+static __cacheline_aligned_in_smp DEFINE_SEQLOCK(d_set_mounted_lock);
+
/*
* Called by mount code to set a mountpoint and check if the mountpoint is
* reachable (e.g. NFS can unhash a directory dentry and then the complete
* subtree can become unreachable).
*
* Only one of d_invalidate() and d_set_mounted() must succeed. For
- * this reason take rename_lock and d_lock on dentry and ancestors.
- * Likewise for dont_mount() which marks a dentry that is being removed
- * under d_lock.
+ * this reason take rename_lock, d_set_mounted_lock and d_lock on dentry
+ * and ancestors. Likewise for dont_mount() which marks a dentry that
+ * is being removed under d_lock.
*/
int d_set_mounted(struct dentry *dentry)
{
struct dentry *p;
int ret = -ENOENT;
read_seqlock_excl(&rename_lock);
+ write_seqlock(&d_set_mounted_lock);
for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) {
/* Need exclusion wrt. d_invalidate() */
spin_lock(&p->d_lock);
@@ -1469,8 +1473,9 @@ int d_set_mounted(struct dentry *dentry)
ret = 0;
}
}
- spin_unlock(&dentry->d_lock);
+ spin_unlock(&dentry->d_lock);
out:
+ write_sequnlock(&d_set_mounted_lock);
read_sequnlock_excl(&rename_lock);
return ret;
}
@@ -1674,6 +1679,7 @@ static enum d_walk_ret find_submount(voi
void d_invalidate(struct dentry *dentry)
{
bool had_submounts = false;
+ unsigned seq;
spin_lock(&dentry->d_lock);
if (d_unhashed(dentry)) {
spin_unlock(&dentry->d_lock);
@@ -1686,6 +1692,11 @@ void d_invalidate(struct dentry *dentry)
if (!dentry->d_inode)
return;
+ /* wait for a d_set_mounted() that saw us hashed to set its flag */
+ do {
+ seq = read_seqbegin(&d_set_mounted_lock);
+ } while (read_seqretry(&d_set_mounted_lock, seq));
+
shrink_dcache_parent(dentry);
for (;;) {
struct dentry *victim = NULL;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 745/990] fs/adfs: bound directory entry name length in adfs_fplus_getnext()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (743 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 744/990] dcache: let d_invalidate() wait for a d_set_mounted() in flight Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 746/990] fs/proc: fix the write length returned by proc_sys_call_handler() Greg Kroah-Hartman
` (107 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hyungjung Joo, HyeongJun An,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <sammiee5311@gmail.com>
commit ebf5025b0d989f95542fc9da899b7de2fec499f2 upstream.
adfs_fplus_getnext() reads the per-entry name length bigdirobnamelen
straight from the on-disk big directory and passes it to
adfs_dir_copyfrom() as the copy length into obj->name[], a fixed
ADFS_MAX_NAME_LEN (260) byte buffer. adfs_dir_copyfrom() only bounds
the copy against the number of directory buffers, not the size of the
destination, so a crafted image with bigdirobnamelen larger than the
buffer overflows the stack-allocated object_info::name that
adfs_fplus_iterate() passes in.
adfs_object_fixup() may additionally append a four byte ",xyz" filetype
suffix, so the accepted length must also leave room for that.
The old-style directory parser (dir_f.c) already clamps names to
ADFS_F_NAME_LEN, and adfs_fplus_validate_header() validates the header
name fields, but the per-entry name length in the big directory format
was never checked. Reject over-long entries, using -EIO as elsewhere
in this file for a corrupt big directory.
Reported-by: Hyungjung Joo <jhj140711@gmail.com>
Closes: https://lore.kernel.org/all/CAP_j_b9BqyQrk3D5nj6RSa=eGcs2HkRYsWc3WdXeXp9O3=z4nQ@mail.gmail.com/
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Link: https://patch.msgid.link/20260715115231.1585166-1-sammiee5311@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/adfs/dir_fplus.c | 2 ++
1 file changed, 2 insertions(+)
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -192,6 +192,8 @@ adfs_fplus_getnext(struct adfs_dir *dir,
obj->indaddr = le32_to_cpu(bde.bigdirindaddr);
obj->attr = le32_to_cpu(bde.bigdirattr);
obj->name_len = le32_to_cpu(bde.bigdirobnamelen);
+ if (obj->name_len > ADFS_MAX_NAME_LEN - 4) /* leave room for ,xyz suffix */
+ return -EIO;
offset = adfs_fplus_offset(h, le32_to_cpu(h->bigdirentries));
offset += le32_to_cpu(bde.bigdirobnameptr);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 746/990] fs/proc: fix the write length returned by proc_sys_call_handler()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (744 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 745/990] fs/adfs: bound directory entry name length in adfs_fplus_getnext() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 747/990] fs/splice: clamp an over-reported write_iter result Greg Kroah-Hartman
` (106 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cheng Yongkang,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
commit fbdc020ee1b82079102e493aaa7200de5f497a38 upstream.
proc_sys_call_handler() reads the write length from iov_iter_count() and
copies that many bytes from the iterator into kbuf. A cgroup/sysctl BPF
program can replace the new value through bpf_sysctl_set_new_value() and
update count to the length of the replacement value. The handler then
returns that adjusted count as the number of bytes written, even though
the iterator originally held a different number of bytes.
If the replacement value is longer than the original input, ->write_iter()
reports more bytes than the iterator held. splice(2) passes that value to
iter_file_splice_write(), which subtracts it from the pipe length and
walks past the pipe head:
Splice Exceeded! ret=7 tot=1 left=0
Oops: general protection fault
RIP: 0010:iter_file_splice_write+0xb6f/0x1170
The write path consumes at most the original iterator length in
copy_from_iter_full() before the BPF hook runs. Return the smaller of the
adjusted and original counts on the write path, so an expanded BPF value
cannot exceed the iterator while a handler that reports a shorter parsed
length still produces a short write. The read path keeps using the
adjusted count for copy_to_iter().
Fixes: 4e63acdff864 ("bpf: Introduce bpf_sysctl_{get,set}_new_value helpers")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/179328314073.648427.7892850166511253762@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/proc/proc_sysctl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -557,6 +557,8 @@ static ssize_t proc_sys_call_handler(str
struct ctl_table_header *head = grab_header(inode);
const struct ctl_table *table = PROC_I(inode)->sysctl_entry;
size_t count = iov_iter_count(iter);
+ /* ->write_iter() must never report more than the iterator held */
+ size_t orig_count = count;
char *kbuf;
ssize_t error;
@@ -607,7 +609,8 @@ static ssize_t proc_sys_call_handler(str
goto out_free_buf;
}
- error = count;
+ /* the write path consumed at most the original iterator length */
+ error = write ? min(count, orig_count) : count;
out_free_buf:
kvfree(kbuf);
out:
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 747/990] fs/splice: clamp an over-reported write_iter result
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (745 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 746/990] fs/proc: fix the write length returned by proc_sys_call_handler() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 748/990] arm64/gcs: Ignore attempts to change GCS mode during signal return Greg Kroah-Hartman
` (105 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Cheng Yongkang,
Christian Brauner (Amutable)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cheng Yongkang <teel4res@gmail.com>
commit 2d956723e82cddae8ff8e9da99a666217b02065f upstream.
iter_file_splice_write() builds a bvec iterator of at most
sd.total_len - left bytes and passes it to ->write_iter(). It then
subtracts the returned length from sd.total_len and walks the pipe
buffers by that length. A ->write_iter() implementation that reports
more bytes than the iterator held makes sd.total_len underflow and the
dismissal loop advance pipe->tail past pipe->head, releasing a zeroed
pipe buffer:
Splice Exceeded! ret=7 tot=1 left=0
Oops: general protection fault
RIP: 0010:iter_file_splice_write+0xb6f/0x1170
Commit a3de58b12ce0 ("netfs: Fix unbuffered write error handling")
added the warning for this condition but only reports it. Clamp the
return value to the size of the iterator that was actually handed to
->write_iter(), so the pipe accounting stays consistent even when a
producer violates the iterator contract.
Fixes: 8d0207652cbe ("->splice_write() via ->write_iter()")
Cc: stable@vger.kernel.org
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/179328314072.648427.13388575162083843840@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/splice.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -739,9 +739,12 @@ iter_file_splice_write(struct pipe_inode
sd.pos = kiocb.ki_pos;
if (ret <= 0)
break;
- WARN_ONCE(ret > sd.total_len - left,
- "Splice Exceeded! ret=%zd tot=%zu left=%zu\n",
- ret, sd.total_len, left);
+ if (unlikely(ret > sd.total_len - left)) {
+ WARN_ONCE(1,
+ "Splice Exceeded! ret=%zd tot=%zu left=%zu\n",
+ ret, sd.total_len, left);
+ ret = sd.total_len - left;
+ }
sd.num_spliced += ret;
sd.total_len -= ret;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 748/990] arm64/gcs: Ignore attempts to change GCS mode during signal return
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (746 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 747/990] fs/splice: clamp an over-reported write_iter result Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 749/990] arm64: errata: Add Cortex-A715/A720 AMU core counter workaround Greg Kroah-Hartman
` (104 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Catalin Marinas, Mark Brown
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <broonie@kernel.org>
commit d395db3dcd4c590d26a2f3d581d8d5b7ddbfa478 upstream.
If userspace tries to update the GCS mode as part of signal return then
we update the thread state but don't update GCSCRE0_EL1, meaning the
change does not take effect. We may also get issues for other tasks on
context switch since we suppress writes of the register if the two tasks
have the same mode.
Since no currently known userspace tries to use this functionality close
this by ignoring any attempt to change the mode through signal return.
The GCS mode for the current thread can be changed using the prctl()
interface and will be preserved on signal return, allowing updates to
the mode from the signal handler.
Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/as-8IqsbMbOBo5Oq@arm.com
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 16f47bb9ac8a ("arm64/signal: Expose GCS state in signal frames")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Documentation/arch/arm64/gcs.rst | 13 ++++---------
arch/arm64/kernel/signal.c | 22 +---------------------
2 files changed, 5 insertions(+), 30 deletions(-)
--- a/Documentation/arch/arm64/gcs.rst
+++ b/Documentation/arch/arm64/gcs.rst
@@ -179,9 +179,8 @@ intended to be exhaustive.
When returning from a signal handler:
-* If there is a gcs_context record in the signal frame then the GCS flags
- and GCSPR_EL0 will be restored from that context prior to further
- validation.
+* If there is a gcs_context record in the signal frame then GCSPR_EL0
+ will be restored from that context prior to further validation.
* If there is no gcs_context record in the signal frame then the GCS
configuration will be unchanged.
@@ -190,12 +189,8 @@ When returning from a signal handler:
point to a valid GCS signal cap record, this will be popped from the
GCS prior to signal return.
-* If the GCS configuration is locked when returning from a signal then any
- attempt to change the GCS configuration will be treated as an error. This
- is true even if GCS was not enabled prior to signal entry.
-
-* GCS may be disabled via signal return but any attempt to enable GCS via
- signal return will be rejected.
+* The features_enabled in the signal return context will be ignored; any
+ changes made using the prctl() in the signal handler will be preserved.
6. ptrace extensions
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -741,36 +741,16 @@ static int preserve_gcs_context(struct g
static int restore_gcs_context(struct user_ctxs *user)
{
- u64 gcspr, enabled;
+ u64 gcspr;
int err = 0;
if (user->gcs_size != sizeof(*user->gcs))
return -EINVAL;
__get_user_error(gcspr, &user->gcs->gcspr, err);
- __get_user_error(enabled, &user->gcs->features_enabled, err);
if (err)
return err;
- /* Don't allow unknown modes */
- if (enabled & ~PR_SHADOW_STACK_SUPPORTED_STATUS_MASK)
- return -EINVAL;
-
- err = gcs_check_locked(current, enabled);
- if (err != 0)
- return err;
-
- /* Don't allow enabling */
- if (!task_gcs_el0_enabled(current) &&
- (enabled & PR_SHADOW_STACK_ENABLE))
- return -EINVAL;
-
- /* If we are disabling disable everything */
- if (!(enabled & PR_SHADOW_STACK_ENABLE))
- enabled = 0;
-
- current->thread.gcs_el0_mode = enabled;
-
/*
* We let userspace set GCSPR_EL0 to anything here, we will
* validate later in gcs_restore_signal().
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 749/990] arm64: errata: Add Cortex-A715/A720 AMU core counter workaround
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (747 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 748/990] arm64/gcs: Ignore attempts to change GCS mode during signal return Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 750/990] arm64: kexec_file: Do not use CMA for images with a non-zero text_offset Greg Kroah-Hartman
` (103 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Beata Michalska, Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Beata Michalska <beata.michalska@arm.com>
commit be777145858218f591b4d9d19f3d40d3ecea9de3 upstream.
On Cortex-A715 (erratum 2738462) and Cortex-A720 (erratum 2738461),
the AMEVCNTR00 counter may continue incrementing while the core
remains in WFE with the clocks being enabled. The resulting core
cycle count may become unreliable.
Add a workaround that effectively treats the AMU counter
as unavailable.
Cc: <stable@vger.kernel.org>
Signed-off-by: Beata Michalska <beata.michalska@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/Kconfig | 32 ++++++++++++++++++++++++++++
arch/arm64/kernel/cpu_errata.c | 20 +++++++++++++++++
arch/arm64/kernel/cpufeature.c | 3 +-
arch/arm64/kernel/topology.c | 3 +-
arch/arm64/tools/cpucaps | 1
6 files changed, 61 insertions(+), 2 deletions(-)
--- a/Documentation/arch/arm64/silicon-errata.rst
+++ b/Documentation/arch/arm64/silicon-errata.rst
@@ -162,8 +162,12 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A715 | #2645198 | ARM64_ERRATUM_2645198 |
+----------------+-----------------+-----------------+-----------------------------+
+| ARM | Cortex-A715 | #2738462 | ARM64_ERRATUM_2738461 |
++----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A715 | #3456084 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
+| ARM | Cortex-A720 | #2738461 | ARM64_ERRATUM_2738461 |
++----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A720 | #3456091 | ARM64_ERRATUM_3194386 |
+----------------+-----------------+-----------------+-----------------------------+
| ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 |
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1057,6 +1057,38 @@ config ARM64_WORKAROUND_BROKEN_AMU_CONST
# making it unreliable. As a result, AMU users should treat it as
# unavailable rather than relying on misleading counter values.
+config ARM64_WORKAROUND_BROKEN_AMU_CORECNT
+ bool
+ # Targeting errata affecting AMEVCNTR00, the AMU core cycle counter.
+ # On affected CPUs the counter may continue incrementing while core
+ # remains in WFE with the clocks enabled.
+ # This may lead to readings of said counter being unreliable.
+ # How much though depends on the sampling intervals.
+
+config ARM64_ERRATUM_2738461
+ bool "Cortex-A715/Cortex-A720: workaround for AMEVCNTR00 incrementing incorrectly"
+ depends on ARM64_AMU_EXTN
+ select ARM64_WORKAROUND_BROKEN_AMU_CORECNT
+ default y
+ help
+ This option adds the workaround for the following errata:
+
+ * ARM Cortex-A715 erratum 2738462
+ * ARM Cortex-A720 erratum 2738461
+
+ On affected cores the AMEVCNTR00 counter (AMU core frequency cycles
+ counter) may continue incrementing while the core remains in WFE
+ with the clocks being enabled.
+ This may result in inaccurate counter readings, with the magnitude
+ of the discrepancy depending on the sampling interval.
+
+ With this workaround, reads of the affected counter return 0 in
+ the relevant paths. This causes users of the counter to treat it
+ as unavailable and is functionally equivalent to firmware disabling
+ the affected counter.
+
+ If unsure, say Y.
+
config ARM64_ERRATUM_2457168
bool "Cortex-A510: 2457168: workaround for AMEVCNTR01 incrementing incorrectly"
depends on ARM64_AMU_EXTN
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -367,6 +367,18 @@ static const struct midr_range workaroun
};
#endif /* CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT */
+#ifdef CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CORECNT
+static const struct midr_range workaround_amu_corecnt_list[] = {
+#ifdef CONFIG_ARM64_ERRATUM_2738461
+ /* Cortex-A715 r0p0 - r1p3 */
+ MIDR_RANGE(MIDR_CORTEX_A715, 0, 0, 1, 3),
+ /* Cortex-A720 r0p0 - r0p1 */
+ MIDR_RANGE(MIDR_CORTEX_A720, 0, 0, 0, 1),
+#endif
+ {}
+};
+#endif /* CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CORECNT */
+
#ifdef CONFIG_CAVIUM_ERRATUM_23154
static const struct midr_range cavium_erratum_23154_cpus[] = {
MIDR_ALL_VERSIONS(MIDR_THUNDERX),
@@ -891,6 +903,14 @@ const struct arm64_cpu_capabilities arm6
CAP_MIDR_RANGE_LIST(workaround_amu_constcnt_list)
},
#endif
+#ifdef CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CORECNT
+ {
+ .desc = "Broken AMU AMEVCNTR00 (core cycle counter)",
+ .capability = ARM64_WORKAROUND_BROKEN_AMU_CORECNT,
+ .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
+ CAP_MIDR_RANGE_LIST(workaround_amu_corecnt_list)
+ },
+#endif
#ifdef CONFIG_ARM64_ERRATUM_2038923
{
.desc = "ARM erratum 2038923",
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -2054,7 +2054,8 @@ static void cpu_amu_enable(struct arm64_
cpumask_set_cpu(smp_processor_id(), &amu_cpus);
/* 0 reference values signal broken/disabled counters */
- if (!this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT))
+ if (!this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT) &&
+ !this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CORECNT))
update_freq_counters_refs();
}
}
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -420,7 +420,8 @@ static void cpu_read_corecnt(void *val)
* counter read is properly handled as an error case by the users of the
* counter.
*/
- *(u64 *)val = read_corecnt();
+ *(u64 *)val = this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CORECNT) ?
+ 0UL : read_corecnt();
}
static void cpu_read_constcnt(void *val)
--- a/arch/arm64/tools/cpucaps
+++ b/arch/arm64/tools/cpucaps
@@ -122,3 +122,4 @@ WORKAROUND_SPECULATIVE_AT
WORKAROUND_SPECULATIVE_SSBS
WORKAROUND_SPECULATIVE_UNPRIV_LOAD
WORKAROUND_BROKEN_AMU_CONSTCNT
+WORKAROUND_BROKEN_AMU_CORECNT
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 750/990] arm64: kexec_file: Do not use CMA for images with a non-zero text_offset
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (748 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 749/990] arm64: errata: Add Cortex-A715/A720 AMU core counter workaround Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 751/990] arm64: ptrace: dont warn on missing siginfo in a group-stop Greg Kroah-Hartman
` (102 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jinjie Ruan, Will Deacon,
Mike Rapoport, Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <ruanjinjie@huawei.com>
commit 18f2d01bfce99a885511c451cba95234eea190bc upstream.
image_load() adds text_offset to kernel_segment->mem and subtracts it
from kernel_segment->memsz. For CMA backed segments this breaks the
load path: the payload is copied to page_address(cma), which is the CMA
base, while image->start is set to the adjusted address, so kexec jumps
into the middle of the kernel. kimage_map_segment() has the same
mismatch when a segment has been moved.
The adjusted memsz also breaks the release path: the CMA pages are
freed using segment->memsz >> PAGE_SHIFT, which is fewer than were
allocated, leaking the tail of the allocation.
Both problems are specific to CMA segments, which are accessed through
page_address(cma) and ignore segment->mem. The normal load path uses
segment->mem, so the text_offset adjustment stays consistent there.
Keep honoring text_offset, but load such images from regular memory by
setting image->no_cma: they lose the CMA contiguous allocation, but
keep working.
Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20260921090450.807575-2-ruanjinjie@huawei.com/
Link: https://lore.kernel.org/all/20260921090450.807575-3-ruanjinjie@huawei.com/
Link: https://lore.kernel.org/all/au4JOjnQlx2aSpiE@arm.com/
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/kernel/kexec_image.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/arch/arm64/kernel/kexec_image.c
+++ b/arch/arm64/kernel/kexec_image.c
@@ -82,6 +82,13 @@ static void *image_load(struct kimage *i
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
kbuf.memsz = le64_to_cpu(h->image_size);
text_offset = le64_to_cpu(h->text_offset);
+ /*
+ * A CMA segment is loaded and mapped through page_address(cma), which
+ * is the CMA base and cannot represent the text_offset adjustment
+ * below. Load images with a non-zero text_offset from normal memory.
+ */
+ if (text_offset)
+ image->no_cma = true;
kbuf.buf_align = MIN_KIMG_ALIGN;
/* Adjust kernel segment with TEXT_OFFSET */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 751/990] arm64: ptrace: dont warn on missing siginfo in a group-stop
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (749 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 750/990] arm64: kexec_file: Do not use CMA for images with a non-zero text_offset Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 752/990] arm64: suspend: Save POR_EL0 over suspend Greg Kroah-Hartman
` (101 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zhao Gongyi, Oleg Nesterov,
Will Deacon, Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Gongyi <zhaogongyi@bytedance.com>
commit 5306f124f3171289b2ef5bac1e08aad175f66d1e upstream.
PTRACE_ATTACH to a group-stopped child can enter do_jobctl_trap(),
which calls ptrace_stop() without siginfo. If the tracer writes
NT_ARM_SYSTEM_CALL, system_call_set() can change syscallno from
NO_SYSCALL before update_syscall_orig_x0_after_ptrace() checks
last_siginfo. WARN_ON_ONCE(!info) then fires for a valid ptrace stop.
Keep the early return when siginfo is absent, but remove the warning.
This leaves orig_x0 untouched at a non-seized group-stop and preserves
the existing syscall-exit-stop handling.
Fixes: 88b839ce497c ("arm64: ptrace: Keep 'orig_x0' in-sync with x0 on syscall entry")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Gongyi <zhaogongyi@bytedance.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Will Deacon <will@kernel.org>
[catalin.marinas@arm.com: modified comment as per Will's suggestion]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/kernel/ptrace.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -573,8 +573,12 @@ static void update_syscall_orig_x0_after
if (regs->syscallno == NO_SYSCALL)
return;
- /* We should only be called when target is in a ptrace stop */
- if (WARN_ON_ONCE(!info))
+ /*
+ * For exit-stops, info is always non-NULL, but that's not true for other
+ * stops such as non-seized group-stops. In those cases, just return early
+ * as there's no need to update orig_x0 anyway.
+ */
+ if (!info)
return;
/*
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 752/990] arm64: suspend: Save POR_EL0 over suspend
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (750 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 751/990] arm64: ptrace: dont warn on missing siginfo in a group-stop Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 753/990] arm64: suspend: Save GCS state " Greg Kroah-Hartman
` (100 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mark Brown, Vladimir Murzin,
Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <broonie@kernel.org>
commit 2386c3dcf13e39d7576eae821af66537332c02de upstream.
POR_EL0 is a live EL0 register on systems with S1POE but it is not saved
and restored by cpu_do_suspend()/cpu_do_resume(). This means that the task
that initiated suspend can return to userspace with an UNKNOWN value. Fix
this by saving and restoring the value over suspend.
This increases the size of struct cpu_suspend_ctx.
Fixes: bf83dae90fbc ("arm64: enable the Permission Overlay Extension for EL0")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/include/asm/suspend.h | 2 +-
arch/arm64/mm/proc.S | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
--- a/arch/arm64/include/asm/suspend.h
+++ b/arch/arm64/include/asm/suspend.h
@@ -2,7 +2,7 @@
#ifndef __ASM_SUSPEND_H
#define __ASM_SUSPEND_H
-#define NR_CTX_REGS 15
+#define NR_CTX_REGS 16
#define NR_CALLEE_SAVED_REGS 12
/*
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -108,6 +108,10 @@ alternative_if ARM64_SME
mrs_s x2, SYS_TPIDR2_EL0
str x2, [x0, #112]
alternative_else_nop_endif
+alternative_if ARM64_HAS_S1POE
+ mrs x2, REG_POR_EL0
+ str x2, [x0, #120]
+alternative_else_nop_endif
ret
SYM_FUNC_END(cpu_do_suspend)
@@ -150,6 +154,10 @@ alternative_if ARM64_SME
ldr x2, [x0, #112]
msr_s SYS_TPIDR2_EL0, x2
alternative_else_nop_endif
+alternative_if ARM64_HAS_S1POE
+ ldr x2, [x0, #120]
+ msr REG_POR_EL0, x2
+alternative_else_nop_endif
msr sctlr_el1, x12
set_this_cpu_offset x13
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 753/990] arm64: suspend: Save GCS state over suspend
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (751 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 752/990] arm64: suspend: Save POR_EL0 over suspend Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 754/990] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io() Greg Kroah-Hartman
` (99 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mark Brown, Catalin Marinas
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <broonie@kernel.org>
commit 7ca488055c69eed71219546deb805811854aca35 upstream.
GCSCRE0_EL1 and GCSPR_EL0 are live registers for EL0 on systems with GCS
but are not saved and restored by cpu_do_suspend()/cpu_do_resume(). This
means that the task that initiated suspend can return to userspace with
UNKNOWN or incorrect values for GCSPR_EL0 and GCSCRE0_EL1 (many fields
in GCSCRE0_EL1 reset to 0). This will in turn lead to ongoing
corruption, including not restoring mode until a task with a different
GCS mode is run. Fix this by saving and restoring the values over
suspend.
This increases the size of struct cpu_suspend_ctx by 16 bytes.
Fixes: 5d8b172e7005 ("arm64: Add Kconfig for Guarded Control Stack (GCS)")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/include/asm/suspend.h | 2 +-
arch/arm64/mm/proc.S | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
--- a/arch/arm64/include/asm/suspend.h
+++ b/arch/arm64/include/asm/suspend.h
@@ -2,7 +2,7 @@
#ifndef __ASM_SUSPEND_H
#define __ASM_SUSPEND_H
-#define NR_CTX_REGS 16
+#define NR_CTX_REGS 18
#define NR_CALLEE_SAVED_REGS 12
/*
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -112,6 +112,12 @@ alternative_if ARM64_HAS_S1POE
mrs x2, REG_POR_EL0
str x2, [x0, #120]
alternative_else_nop_endif
+alternative_if ARM64_HAS_GCS
+ mrs x2, REG_GCSPR_EL0
+ str x2, [x0, #128]
+ mrs x2, REG_GCSCRE0_EL1
+ str x2, [x0, #136]
+alternative_else_nop_endif
ret
SYM_FUNC_END(cpu_do_suspend)
@@ -158,6 +164,12 @@ alternative_if ARM64_HAS_S1POE
ldr x2, [x0, #120]
msr REG_POR_EL0, x2
alternative_else_nop_endif
+alternative_if ARM64_HAS_GCS
+ ldr x2, [x0, #128]
+ msr REG_GCSPR_EL0, x2
+ ldr x2, [x0, #136]
+ msr REG_GCSCRE0_EL1, x2
+alternative_else_nop_endif
msr sctlr_el1, x12
set_this_cpu_offset x13
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 754/990] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (752 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 753/990] arm64: suspend: Save GCS state " Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 755/990] cpufreq: Improve suspend-resume synchronization Greg Kroah-Hartman
` (98 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Li RongQing, Zhongqiu Han,
Rafael J. Wysocki
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <lirongqing@baidu.com>
commit 6bc092a0fc4d331a4adbbb664078af149c580834 upstream.
When policy->freq_table is built in acpi_cpufreq_cpu_init(), entries
that are not lower in frequency than the previous one are skipped.
For each remaining entry, freq_table[].driver_data stores the
original ACPI P-state index, so the index space of freq_table no
longer matches perf->states[].
extract_io() currently walks perf->states[] with index i and uses the
same i to index policy->freq_table[i]. When duplicate frequencies
exist, this can associate a P-state status with the frequency of a
different P-state. It can also access an invalid or sentinel entry in
freq_table when the number of entries in perf->states[] is greater than
the number of entries remaining in the frequency table.
extract_io() is used on ACPI_ADR_SPACE_SYSTEM_IO platforms by the
frequency verification path, which is enabled by the
acpi_pstate_strict module parameter. With the mismatched lookup,
check_freqs() can fail to match the frequency of the P-state that
drv_write() has already programmed. It then sleeps through all 100
iterations - at least ~1 ms of usleep_range() plus 100 cross-CPU
calls and I/O port reads, all with policy->rwsem held, and
.target_index() returns -EAGAIN, leaving perf->state at its previous
value while the hardware is running at the newly requested P-state.
The cpufreq core consequently keeps policy->cur at the old frequency.
Since __cpufreq_driver_target() returns early when the requested
frequency equals policy->cur, the driver is not called again for that
frequency and the control register is not rewritten. The hardware can
therefore remain at a frequency that differs from the frequency known
to the cpufreq core.
Fix this by iterating over policy->freq_table and using
pos->driver_data as the original ACPI P-state index when accessing
perf->states[], as extract_msr() already does.
Fixes: fe27cb358835 ("[CPUFREQ][2/8] acpi: reorganize code to make MSR support addition easier")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Cc: All applicable <stable@vger.kernel.org>
Link: https://patch.msgid.link/20260910111329.2220-2-lirongqing@baidu.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/acpi-cpufreq.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -197,14 +197,13 @@ static unsigned extract_io(struct cpufre
{
struct acpi_cpufreq_data *data = policy->driver_data;
struct acpi_processor_performance *perf;
- int i;
+ struct cpufreq_frequency_table *pos;
perf = to_perf_data(data);
- for (i = 0; i < perf->state_count; i++) {
- if (value == perf->states[i].status)
- return policy->freq_table[i].frequency;
- }
+ cpufreq_for_each_entry(pos, policy->freq_table)
+ if (value == perf->states[pos->driver_data].status)
+ return pos->frequency;
return 0;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 755/990] cpufreq: Improve suspend-resume synchronization
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (753 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 754/990] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 756/990] cpufreq: intel_pstate: Clear last written P-state value on suspend Greg Kroah-Hartman
` (97 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki,
Zak Brighton Knight, Zhongqiu Han, Viresh Kumar, Doug Smythies,
Christian Loehle
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit eee2a44e4e2b41c0699919a550d41cc38daa4f42 upstream.
The suspend-resume synchronization in the cpufreq core is not perfect
because the global cpufreq_suspended variable is set at the end of
cpufreq_suspend() after stopping governors for all of the active
policies, so the governor .limits() callback may run via
cpufreq_governor_limits() after stopping the governor and before
setting cpufreq_suspended which is questionable. Likewise, the
governor .limits() callback may run between clearing cpufreq_suspended
in cpufreq_resume() and starting the governor.
Address this by adding a per-policy "suspended" flag that is always
read under the policy rwsem and is updated under it when the governor
is stopped in cpufreq_suspend() and when the governor is restarted in
cpufreq_resume().
Also make cpufreq_resume() use the cpus_read_lock guard to reflect
what is done in cpufreq_suspend() and call cpufreq_exit_governor() for
policies that were suspended during a system suspend transition and
are inactive during the subsequent system resume (to avoid leaking an
inactive policy with a stopped governor that has not exited yet).
Fixes: 8e30444e1530 ("cpufreq: fix cpufreq suspend/resume for intel_pstate")
Fixes: b1b12babe3b7 ("cpufreq: update 'cpufreq_suspended' after stopping governors")
Cc: All applicable <stable@vger.kernel.org>
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/4796894.LvFx2qVVIh@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/cpufreq.c | 86 +++++++++++++++++++++++++++++++++-------------
include/linux/cpufreq.h | 3 +
2 files changed, 66 insertions(+), 23 deletions(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -35,6 +35,9 @@
static LIST_HEAD(cpufreq_policy_list);
/* Macros to iterate over CPU policies */
+#define for_each_policy(__policy) \
+ list_for_each_entry(__policy, &cpufreq_policy_list, policy_list)
+
#define for_each_suitable_policy(__policy, __active) \
list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) \
if ((__active) == !policy_is_inactive(__policy))
@@ -1962,6 +1965,14 @@ int cpufreq_generic_suspend(struct cpufr
}
EXPORT_SYMBOL(cpufreq_generic_suspend);
+static void cpufreq_suspend_policy(struct cpufreq_policy *policy)
+{
+ guard(cpufreq_policy_write)(policy);
+
+ cpufreq_stop_governor(policy);
+ policy->suspended = true;
+}
+
/**
* cpufreq_suspend() - Suspend CPUFreq governors.
*
@@ -1984,11 +1995,8 @@ void cpufreq_suspend(void)
pr_debug("%s: Suspending Governors\n", __func__);
for_each_active_policy(policy) {
- if (has_target()) {
- scoped_guard(cpufreq_policy_write, policy) {
- cpufreq_stop_governor(policy);
- }
- }
+ if (has_target())
+ cpufreq_suspend_policy(policy);
if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
pr_err("%s: Failed to suspend driver: %s\n", __func__,
@@ -2000,6 +2008,32 @@ suspend:
cpus_read_unlock();
}
+static void cpufreq_resume_policy(struct cpufreq_policy *policy, bool start)
+{
+ guard(cpufreq_policy_write)(policy);
+
+ if (!policy->suspended)
+ return;
+
+ policy->suspended = false;
+
+ if (policy_is_inactive(policy)) {
+ /*
+ * The policy was active when it was suspended, so its governor
+ * is still there. Let the governor go.
+ */
+ cpufreq_exit_governor(policy);
+ return;
+ }
+
+ if (!start)
+ return;
+
+ if (cpufreq_start_governor(policy))
+ pr_err("%s: Failed to start governor for CPU%u's policy\n",
+ __func__, policy->cpu);
+}
+
/**
* cpufreq_resume() - Resume CPUFreq governors.
*
@@ -2009,11 +2043,12 @@ suspend:
void cpufreq_resume(void)
{
struct cpufreq_policy *policy;
- int ret;
if (!cpufreq_driver)
return;
+ guard(cpus_read_lock)();
+
if (unlikely(!cpufreq_suspended))
return;
@@ -2024,19 +2059,18 @@ void cpufreq_resume(void)
pr_debug("%s: Resuming Governors\n", __func__);
- for_each_active_policy(policy) {
- if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
- pr_err("%s: Failed to resume driver: %s\n", __func__,
- cpufreq_driver->name);
- } else if (has_target()) {
- scoped_guard(cpufreq_policy_write, policy) {
- ret = cpufreq_start_governor(policy);
- }
+ for_each_policy(policy) {
+ int ret = 0;
+ if (cpufreq_driver->resume && !policy_is_inactive(policy)) {
+ ret = cpufreq_driver->resume(policy);
if (ret)
- pr_err("%s: Failed to start governor for CPU%u's policy\n",
- __func__, policy->cpu);
+ pr_err("%s: Failed to resume driver: %s\n", __func__,
+ cpufreq_driver->name);
}
+
+ if (has_target())
+ cpufreq_resume_policy(policy, ret == 0);
}
}
@@ -2410,12 +2444,17 @@ __weak struct cpufreq_governor *cpufreq_
return NULL;
}
+static bool cpufreq_is_suspended(struct cpufreq_policy *policy)
+{
+ return cpufreq_suspended || policy->suspended;
+}
+
static int cpufreq_init_governor(struct cpufreq_policy *policy)
{
int ret;
- /* Don't start any governor operations if we are entering suspend */
- if (cpufreq_suspended)
+ /* Don't start any governor operations for suspended policies. */
+ if (cpufreq_is_suspended(policy))
return 0;
/*
* Governor might not be initiated here if ACPI _PPC changed
@@ -2458,7 +2497,7 @@ static int cpufreq_init_governor(struct
static void cpufreq_exit_governor(struct cpufreq_policy *policy)
{
- if (cpufreq_suspended || !policy->governor)
+ if (cpufreq_is_suspended(policy) || !policy->governor)
return;
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
@@ -2473,7 +2512,7 @@ int cpufreq_start_governor(struct cpufre
{
int ret;
- if (cpufreq_suspended)
+ if (cpufreq_is_suspended(policy))
return 0;
if (!policy->governor)
@@ -2497,7 +2536,7 @@ int cpufreq_start_governor(struct cpufre
void cpufreq_stop_governor(struct cpufreq_policy *policy)
{
- if (cpufreq_suspended || !policy->governor)
+ if (cpufreq_is_suspended(policy) || !policy->governor)
return;
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
@@ -2508,7 +2547,7 @@ void cpufreq_stop_governor(struct cpufre
static void cpufreq_governor_limits(struct cpufreq_policy *policy)
{
- if (cpufreq_suspended || !policy->governor)
+ if (cpufreq_is_suspended(policy) || !policy->governor)
return;
pr_debug("%s: for CPU %u\n", __func__, policy->cpu);
@@ -2736,7 +2775,8 @@ static void cpufreq_policy_refresh(struc
* -> ask driver for current freq and notify governors about a change
*/
if (cpufreq_driver->get && has_target() &&
- (cpufreq_suspended || WARN_ON(!cpufreq_verify_current_freq(policy, false))))
+ (cpufreq_is_suspended(policy) ||
+ WARN_ON(!cpufreq_verify_current_freq(policy, false))))
return;
refresh_frequency_limits(policy);
--- 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;
+ /* The policy has been suspended. */
+ bool suspended;
+
/* Cached frequency lookup from cpufreq_driver_resolve_freq. */
unsigned int cached_target_freq;
unsigned int cached_resolved_idx;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 756/990] cpufreq: intel_pstate: Clear last written P-state value on suspend
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (754 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 755/990] cpufreq: Improve suspend-resume synchronization Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 757/990] cpufreq: intel_pstate: Use rdmsrq_safe() to read MSR_MISC_PWR_MGMT Greg Kroah-Hartman
` (96 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Zak Brighton Knight, Doug Smythies,
Rafael J. Wysocki, Zhongqiu Han, Viresh Kumar, Christian Loehle
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit 02e77af824d5be3a94fdd885835a352f90d24c5c upstream.
Preserving cpu->pstate.current_pstate across system suspend-resume
cycles, when running in the passive mode with HWP disabled, is a mistake
because its value from before system suspend may become stale after the
subsequent system resume and in some cases it prevents MSR_IA32_PERF_CTL
from being updated properly after system resume [1].
Address this by clearing cpu->pstate.current_pstate after the governor
has been stopped during system suspend.
Fixes: 001c76f05b01 ("cpufreq: intel_pstate: Generic governors support")
Fixes: 4adcf2e5829f ("cpufreq: intel_pstate: Add ->offline and ->online callbacks")
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> # 342d3a73c5db cpufreq: Force passing target frequency to driver during resume
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/14150222.uLZWGnKmhe@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/intel_pstate.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -3412,10 +3412,11 @@ static void intel_cpufreq_cpu_exit(struc
static int intel_cpufreq_suspend(struct cpufreq_policy *policy)
{
+ struct cpudata *cpu = all_cpu_data[policy->cpu];
+
intel_pstate_suspend(policy);
if (hwp_active) {
- struct cpudata *cpu = all_cpu_data[policy->cpu];
u64 value = READ_ONCE(cpu->hwp_req_cached);
/*
@@ -3426,6 +3427,17 @@ static int intel_cpufreq_suspend(struct
value &= ~HWP_DESIRED_PERF(~0L);
wrmsrq_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value);
WRITE_ONCE(cpu->hwp_req_cached, value);
+ } else {
+ /*
+ * Invalidate the cached P-state value that may be stale when
+ * the governor is started again during resume and may prevent
+ * MSR_IA32_PERF_CTL from being updated.
+ *
+ * This does not require synchronization because the core
+ * prevents frequency updates for suspended policies from
+ * occurring.
+ */
+ cpu->pstate.current_pstate = 0;
}
return 0;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 757/990] cpufreq: intel_pstate: Use rdmsrq_safe() to read MSR_MISC_PWR_MGMT
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (755 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 756/990] cpufreq: intel_pstate: Clear last written P-state value on suspend Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 758/990] cpufreq: Cache post-resolution target frequency in __resolve_freq() Greg Kroah-Hartman
` (95 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Li Zhaoxin, Rafael J. Wysocki
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhaoxin <lizhaoxin04@baidu.com>
commit 2c0e6f2858d235c99f7ba4621bd176cd67226f00 upstream.
Commit ed7cad0504e3 ("cpufreq: intel_pstate: Relocate platform
preference check") moved the intel_pstate_platform_pwr_mgmt_exists()
call to the beginning of intel_pstate_init(), right after the vendor
check, so it now runs before "no_load" (intel_pstate=disable) and the
other checks.
MSR_MISC_PWR_MGMT is model-specific and KVM does not emulate it. In a
KVM guest using a CPU model listed in intel_pstate_cpu_oob_ids[] (for
example "-cpu host" on Emerald Rapids), reading it raises #GP and the
unchecked rdmsrq() emits a warning with a call trace on every boot, even
with intel_pstate=disable:
unchecked MSR access error: RDMSR from 0x1aa at rIP: 0xffffffffa4009342 (native_read_msr+0x2/0x50)
Call Trace:
<TASK>
intel_pstate_platform_pwr_mgmt_exists+0x3b/0x220
intel_pstate_init+0x1e/0x500
do_one_initcall+0x59/0x350
...
Before that commit, such guests typically returned from
intel_pstate_init() earlier, either because of intel_pstate=disable or
because intel_pstate_msrs_not_valid() failed on the zero ratios that
KVM reports in MSR_PLATFORM_INFO by default, so the MSR was not read.
Use rdmsrq_safe() and treat a failing read as "no OOB mode". The
exception fixup already zeroes the result of a failed unchecked read,
so apart from the warning going away there is no functional change.
Fixes: ed7cad0504e3 ("cpufreq: intel_pstate: Relocate platform preference check")
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Li Zhaoxin <lizhaoxin04@baidu.com>
Link: https://patch.msgid.link/20261104070149.41393-1-lizhaoxin04@baidu.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/intel_pstate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -3683,12 +3683,12 @@ static struct acpi_platform_list plat_in
static bool __init intel_pstate_platform_pwr_mgmt_exists(void)
{
const struct x86_cpu_id *id;
- u64 misc_pwr;
+ u64 misc_pwr = 0;
int idx;
id = x86_match_cpu(intel_pstate_cpu_oob_ids);
if (id) {
- rdmsrq(MSR_MISC_PWR_MGMT, misc_pwr);
+ rdmsrq_safe(MSR_MISC_PWR_MGMT, &misc_pwr);
if (misc_pwr & BITMASK_OOB) {
pr_debug("Bit 8 or 18 in the MISC_PWR_MGMT MSR set\n");
pr_debug("P states are controlled in Out of Band mode by the firmware/hardware\n");
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 758/990] cpufreq: Cache post-resolution target frequency in __resolve_freq()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (756 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 757/990] cpufreq: intel_pstate: Use rdmsrq_safe() to read MSR_MISC_PWR_MGMT Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 759/990] software node: only let the owner release a managed node Greg Kroah-Hartman
` (94 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rafael J. Wysocki, Christian Loehle
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
commit 166207cac45191637c47a457a5c16ca6b6773a16 upstream.
get_next_freq() in the schedutil governor returns the resolved
frequency from cpufreq_driver_resolve_freq(), and that resolved value
is then passed to cpufreq_driver_fast_switch(). The only reader of
cached_target_freq, acpi_cpufreq_fast_switch(), compares it with the
post-resolution target frequency, but it holds the pre-resolution
clamped frequency, so any request that falls between table entries
misses the cache and falls back to a table scan.
Address this by making __resolve_freq() store the post-resolution
frequency in cached_target_freq.
Fixes: e3c062360870 ("cpufreq: add cpufreq_driver_resolve_freq()")
Cc: All applicable <stable@vger.kernel.org>
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>
Link: https://patch.msgid.link/14161745.uLZWGnKmhe@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/cpufreq/cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -509,8 +509,8 @@ static unsigned int __resolve_freq(struc
idx = cpufreq_frequency_table_target(policy, target_freq, min, max, relation);
policy->cached_resolved_idx = idx;
- policy->cached_target_freq = target_freq;
- return policy->freq_table[idx].frequency;
+ policy->cached_target_freq = policy->freq_table[idx].frequency;
+ return policy->cached_target_freq;
}
/**
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 759/990] software node: only let the owner release a managed node
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (757 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 758/990] cpufreq: Cache post-resolution target frequency in __resolve_freq() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 760/990] SUNRPC: Fix TCP-with-TLS transport class identification Greg Kroah-Hartman
` (93 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Balasubramani Vivekanandan,
Bartosz Golaszewski, Heikki Krogerus, Johan Hovold
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
commit f8623ce596492d2e96ca57eeec992938d3d79f00 upstream.
device_create_managed_software_node() creates a node whose lifetime is
tied to the device it was created for. software_node_notify_remove() is
called for every device that has the node as its fwnode (primary OR
secondary) and, if the node is managed, unconditionally detaches it from
that device and drops the creation reference.
This breaks when the node is shared with another device. Example: the
i2c-designware copies the parent's fwnode to the adapter's struct device.
When the adapter is deleted, it releases the reference that belongs to
the owner and the latter ends up with a dangling pointer.
Record the device's "manager" and only perform the actual release when
notify is called for that "owner" device.
Note that it was never the intention that managed software nodes would
be shared, but descendants reusing ancestor firmware nodes is not
uncommon and such use is hard to predict when allocating software nodes.
Reported-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Closes: https://lore.kernel.org/all/20261009164241.923756-2-balasubramani.vivekanandan@intel.com/
Fixes: 151f6ff78cdf ("software node: Provide replacement for device_add_properties()")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Fixes: 0f485f88656a ("drm/xe/i2c: use device_create_managed_software_node()")
Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Tested-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261102-swnode-only-owner-release-v1-1-ee4c9022a629@oss.qualcomm.com
[ johan: drop temporary variable; skip clearing owner field;
mention reuse not intended in commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/swnode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -29,6 +29,8 @@ struct swnode {
struct fwnode_handle fwnode;
const struct software_node *node;
int id;
+ /* Device the managed node's lifetime is tied to. */
+ struct device *owner;
/* hierarchy */
struct ida child_ids;
@@ -37,7 +39,6 @@ struct swnode {
struct swnode *parent;
unsigned int allocated:1;
- unsigned int managed:1;
};
static DEFINE_IDA(swnode_root_ids);
@@ -1060,7 +1061,7 @@ int device_create_managed_software_node(
if (IS_ERR(fwnode))
return PTR_ERR(fwnode);
- to_swnode(fwnode)->managed = true;
+ to_swnode(fwnode)->owner = dev;
set_secondary_fwnode(dev, fwnode);
if (device_is_registered(dev))
@@ -1103,7 +1104,7 @@ void software_node_notify_remove(struct
sysfs_remove_link(&dev->kobj, "software_node");
kobject_put(&swnode->kobj);
- if (swnode->managed) {
+ if (swnode->owner == dev) {
set_secondary_fwnode(dev, NULL);
kobject_put(&swnode->kobj);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 760/990] SUNRPC: Fix TCP-with-TLS transport class identification
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (758 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 759/990] software node: only let the owner release a managed node Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 761/990] timekeeping: Read getboottime64() offsets under the sequence counter Greg Kroah-Hartman
` (92 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Avi Weiss, Benjamin Coddington,
Anna Schumaker
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
commit 0502c7e7f171a8c9c892bdef89e6aa6f44d7b2a3 upstream.
xs_setup_tcp_tls() assigns the ordinary TCP transport class to
a TCP-with-TLS transport. When rpc_clnt_add_xprt() is called
with an unspecified transport type, it inherits the class
identifier and can create an unencrypted TCP transport.
Looks like a copy-paste error from the commit 3 years ago.
NFSv4 trunk discovery uses an unspecified transport type when
adding server-advertised addresses. If the additional transport
passes server-identity validation, it can be admitted to the
client's transport switch.
An isolated loopback test reproduced plaintext application RPC
transmission for TLS- and mTLS-configured clients, including
an unpinned TLS-client RPC that selected the added transport.
Assign the TCP-with-TLS class instead. With the fix, the
plaintext-only test peer receives TLS negotiation probes but
no application payloads.
Fixes: 75eb6af7acdf ("SUNRPC: Add a TCP-with-TLS RPC transport class")
Cc: stable@vger.kernel.org
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Reviewed-by: Benjamin Coddington <bcodding@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sunrpc/xprtsock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -3524,7 +3524,7 @@ static struct rpc_xprt *xs_setup_tcp_tls
transport = container_of(xprt, struct sock_xprt, xprt);
xprt->prot = IPPROTO_TCP;
- xprt->xprt_class = &xs_tcp_transport;
+ xprt->xprt_class = &xs_tcp_tls_transport;
xprt->max_payload = RPC_MAX_FRAGMENT_SIZE;
xprt->bind_timeout = XS_BIND_TO;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 761/990] timekeeping: Read getboottime64() offsets under the sequence counter
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (759 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 760/990] SUNRPC: Fix TCP-with-TLS transport class identification Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 762/990] timekeeping: Refresh auxiliary base before offset validation Greg Kroah-Hartman
` (91 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hungyu Lin, Thomas Gleixner,
John Stultz
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hungyu Lin <dennylin0707@gmail.com>
commit 385b5ec1f31dd39297578eed42be74b07ae74017 upstream.
getboottime64() computes the wall-clock boot timestamp from offs_real
minus offs_boot without checking tk_core.seq. A concurrent timekeeping
update can leave the reader with an inconsistent pair of offsets or,
on 32-bit systems, a torn 64-bit offset, producing an incorrect boot
timestamp.
Read both offsets under tk_core.seq and retry if an update overlaps
the sample. Convert the resulting local value to a timespec64 afterward.
Fixes: 7c3f1a573237 ("Introduce boot based time")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: John Stultz <jstultz@google.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261030054227.35453-2-dennylin0707@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/time/timekeeping.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2419,7 +2419,13 @@ void update_wall_time(void)
void getboottime64(struct timespec64 *ts)
{
struct timekeeper *tk = &tk_core.timekeeper;
- ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot);
+ unsigned int seq;
+ ktime_t t;
+
+ do {
+ seq = read_seqcount_begin(&tk_core.seq);
+ t = ktime_sub(tk->offs_real, tk->offs_boot);
+ } while (read_seqcount_retry(&tk_core.seq, seq));
*ts = ktime_to_timespec64(t);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 762/990] timekeeping: Refresh auxiliary base before offset validation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (760 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 761/990] timekeeping: Read getboottime64() offsets under the sequence counter Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 763/990] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path Greg Kroah-Hartman
` (90 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Avi Weiss, Thomas Gleixner
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <thnkslprpt@gmail.com>
commit c1b96ba87e3caaa701d6dba254e58db7cc3c99be upstream.
timekeeping_forward_now() can advance an auxiliary timekeeper across a
second boundary without refreshing tkr_mono.base. The negative-time
check in __timekeeping_inject_offset() then uses the stale base and
rejects valid ADJ_SETOFFSET adjustments with -EINVAL.
Refresh the derived timekeeper data before calculating the current
auxiliary time, as aux_clock_set() already does.
On 7.4-rc1, a valid negative adjustment fails at the first second
rollover. The patched kernel accepts all 12 tested rollover adjustments
and continues to reject invalid negative offsets.
Fixes: 2c8aea59c206 ("timekeeping: Add auxiliary clock support to __timekeeping_inject_offset()")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261103090605.1292660-1-thnkslprpt@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/time/timekeeping.c | 1 +
1 file changed, 1 insertion(+)
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1503,6 +1503,7 @@ static int __timekeeping_inject_offset(s
struct tk_read_base *tkr_mono = &tks->tkr_mono;
ktime_t now, offs;
+ tk_update_ktime_data(tks);
/* Get the current time */
now = ktime_add_ns(tkr_mono->base, timekeeping_get_ns(tkr_mono));
/* Add the relative offset change */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 763/990] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (761 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 762/990] timekeeping: Refresh auxiliary base before offset validation Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 764/990] tpm: Check return value of crypto_kpp_set_secret() Greg Kroah-Hartman
` (89 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Takashi Iwai, Paul Menzel,
Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@suse.de>
commit 03fcb358249dc715124b3616f814ea0ecc6ec36c upstream.
When devm_add_action() returns an error, tpm_read_log_acpi() clears
log->bios_event_log unnecessarily to NULL before calling
tpm_bios_log_free(), and it would lead to a memory leak of the
allocated log buffer.
Fix it by simply jumping to the err.
Cc: stable@vger.kernel.org # v6.18+
Fixes: a3a860bc0fd6 ("tpm: Change to kvalloc() in eventlog/acpi.c")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261109173756.742248-1-tiwai@suse.de
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/eventlog/acpi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/char/tpm/eventlog/acpi.c
+++ b/drivers/char/tpm/eventlog/acpi.c
@@ -167,10 +167,8 @@ int tpm_read_log_acpi(struct tpm_chip *c
}
ret = devm_add_action(&chip->dev, tpm_bios_log_free, log->bios_event_log);
- if (ret) {
- log->bios_event_log = NULL;
+ if (ret)
goto err;
- }
return format;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 764/990] tpm: Check return value of crypto_kpp_set_secret()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (762 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 763/990] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 765/990] tpm: eventlog: check the payload size before reading tag events Greg Kroah-Hartman
` (88 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Eric Biggers, Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <ebiggers@kernel.org>
commit 8cff8f1c89d33e55c9af82177b14f6f9f6a899fe upstream.
crypto_kpp_set_secret() can fail, for example if the kernel is booted
with fips=1 and the broken-by-design FIPS RNG used for ECC private key
generation doesn't feel like generating random bytes at the moment.
Check for error, cancelling the TPM session creation rather than
proceeding with a zero or uninitialized private key.
Fixes: 699e3efd6c64 ("tpm: Add HMAC session start and end functions")
Cc: stable@vger.kernel.org # v6.12+
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261025211119.138277-1-ebiggers@kernel.org
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/tpm2-sessions.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -535,7 +535,9 @@ static int tpm_buf_append_salt(struct tp
}
crypto_ecdh_encode_key(encoded_key, buf_len, &p);
/* this generates a random private key */
- crypto_kpp_set_secret(kpp, encoded_key, buf_len);
+ rc = crypto_kpp_set_secret(kpp, encoded_key, buf_len);
+ if (rc)
+ goto err_free_kpp;
/* salt is now the public point of this private key */
req = kpp_request_alloc(kpp, GFP_KERNEL);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 765/990] tpm: eventlog: check the payload size before reading tag events
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (763 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 764/990] tpm: Check return value of crypto_kpp_set_secret() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 766/990] tpm: flush timeout work outside buffer_mutex to avoid deadlock Greg Kroah-Hartman
` (87 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Guanglei Zhu, Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanglei Zhu <zhugl3@xiaopeng.com>
commit 0a385f668ba77d29ae167c1668fd452418ebc9d6 upstream.
The EVENT_TAG branch of get_event_name() casts the event payload to
struct tcpa_pc_event and reads from it:
pc_event = (struct tcpa_pc_event *)event_entry;
switch (do_endian_conversion(pc_event->event_id)) {
...
for (i = 0; i < 20; i++)
d_len += sprintf(&data[2*i], "%02x",
pc_event->event_data[i]);
The log iterators only verify that the event header plus the declared
event_size stays within the log buffer; they do not require the
payload of an EVENT_TAG entry to be large enough for the fields the
branch reads. A truncated entry makes the branch read up to 20 bytes
of event_data[] past the end of the entry, and, for the last entry in
the log, past the end of the buffer itself.
The legacy PC Client spec defines the EV_EVENT_TAG payload as a
TCPA_PC_EVENT - event_id, event_size and event-type-specific data -
so a conformant entry carries the 8-byte header and the hash-type
ids carry a full digest. The log itself, however, is an ACPI table
the firmware leaves in memory: the TPM never measures the log, so
the kernel cannot tell a conformant log from a corrupted one. The
iterators already work on that assumption - they stop once the
declared event_size runs past the buffer end - and the readers
should apply the same rule to what they take off the payload.
Skip entries whose payload cannot even hold the event id, and skip
the 20-byte digest dump when the payload cannot hold the full
tcpa_pc_event header plus the digest, so the branch never reads
beyond the entry it is formatting.
Cc: stable@vger.kernel.org
Fixes: 55a82ab3181b ("[PATCH] tpm: add bios measurement log")
Signed-off-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/eventlog/tpm1.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/char/tpm/eventlog/tpm1.c
+++ b/drivers/char/tpm/eventlog/tpm1.c
@@ -178,6 +178,10 @@ static int get_event_name(char *dest, st
}
break;
case EVENT_TAG:
+ if (do_endian_conversion(event->event_size) <
+ sizeof(pc_event->event_id))
+ break;
+
pc_event = (struct tcpa_pc_event *)event_entry;
/* ToDo Row data -> Base64 */
@@ -203,6 +207,9 @@ static int get_event_name(char *dest, st
name = tcpa_pc_event_id_strings[do_endian_conversion
(pc_event->event_id)];
n_len = strlen(name);
+ if (do_endian_conversion(event->event_size) <
+ sizeof(struct tcpa_pc_event) + 20)
+ break;
for (i = 0; i < 20; i++)
d_len += sprintf(&data[2*i], "%02x",
pc_event->event_data[i]);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 766/990] tpm: flush timeout work outside buffer_mutex to avoid deadlock
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (764 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 765/990] tpm: eventlog: check the payload size before reading tag events Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 767/990] spi: tegra210-quad: Track DMA mapping state Greg Kroah-Hartman
` (86 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Hyunjung Ko, Jarkko Sakkinen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunjung Ko <hj351016@gmail.com>
commit c22052a012698ce56d599d75b669d55778521c7c upstream.
tpm_common_read() calls flush_work(&priv->timeout_work) under
priv->buffer_mutex, but tpm_timeout_work() also takes buffer_mutex, so a
running timeout work deadlocks the flush. Flush after unlocking; the timer
is deleted under the lock, so no new work can be queued.
Fixes: 9488585b21be ("tpm: add support for partial reads")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261108165812.676876-1-hj351016@gmail.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/char/tpm/tpm-dev-common.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--- a/drivers/char/tpm/tpm-dev-common.c
+++ b/drivers/char/tpm/tpm-dev-common.c
@@ -132,6 +132,7 @@ ssize_t tpm_common_read(struct file *fil
{
struct file_priv *priv = file->private_data;
ssize_t ret_size = 0;
+ bool flush = false;
int rc;
if (!size)
@@ -164,9 +165,18 @@ out:
if (!priv->response_length) {
*off = 0;
timer_delete_sync(&priv->user_read_timer);
- flush_work(&priv->timeout_work);
+ flush = true;
}
mutex_unlock(&priv->buffer_mutex);
+
+ /*
+ * tpm_timeout_work() takes buffer_mutex, so flush it after dropping
+ * the mutex to avoid a deadlock; the timer is deleted above, so no new
+ * timeout work can be queued once the mutex is released.
+ */
+ if (flush)
+ flush_work(&priv->timeout_work);
+
return ret_size;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 767/990] spi: tegra210-quad: Track DMA mapping state
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (765 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 766/990] tpm: flush timeout work outside buffer_mutex to avoid deadlock Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 768/990] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Greg Kroah-Hartman
` (85 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mark Brown, Vishwaroop A
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishwaroop A <va@nvidia.com>
commit 7b9e6f7bc13c0259b192d0a964e802d4ad53b8b8 upstream.
tegra_qspi_dma_unmap_xfer() assumes a streaming mapping is always
outstanding and recomputes its length from the live
tqspi->curr_dma_words. Nothing records whether tegra_qspi_dma_map_xfer()
mapped anything, so neither assumption holds.
For a multi-chunk transfer, handle_dma_based_xfer() unmaps the chunk that
just completed, recalculates the parameters for the next chunk, which
overwrites curr_dma_words, and re-arms the hardware. If
tegra_qspi_start_dma_based_transfer() then fails at its
tegra_qspi_dma_map_xfer() call, nothing is mapped. That early return also
sits above the smp_store_release() that clears tqspi->trans_status, so the
previous chunk's QSPI_RDY survives, and the re-arm's return value is never
checked, so handle_dma_based_xfer() returns IRQ_HANDLED without completing
the transfer.
The caller times out, tegra_qspi_handle_timeout() sees the stale QSPI_RDY,
concludes the transfer completed and calls handle_dma_based_xfer() again.
No DMA completion arrives, so num_errors is incremented and
tegra_qspi_dma_unmap_xfer() runs with nothing mapped. t->tx_dma then holds
either the DMA_MAPPING_ERROR sentinel or, if the RX mapping was the one
that failed, the preceding chunk's address that has already been released.
Behind an IOMMU the latter frees an IOVA that may since have been
reallocated.
Record whether a mapping is outstanding and the length that was mapped,
and return early from tegra_qspi_dma_unmap_xfer() when there is nothing to
release. is_dma_mapped is only updated under tqspi->lock, or on the timeout
path after synchronize_irq() and cancel_work_sync() have quiesced the ISR
and the bottom half.
Also skip releasing the TX mapping on the RX failure path unless a TX
mapping was created; t->tx_dma is uninitialised when t->tx_buf is NULL.
Fixes: 921fc1838fb0 ("spi: tegra210-quad: Add support for Tegra210 QSPI controller")
Suggested-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Vishwaroop A <va@nvidia.com>
Link: https://patch.msgid.link/20261026111412.3843954-3-va@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/spi/spi-tegra210-quad.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -215,6 +215,17 @@ struct tegra_qspi {
bool is_packed;
bool use_dma;
+ /*
+ * Set while a streaming mapping created by
+ * tegra_qspi_dma_map_xfer() is outstanding, together with the
+ * length that was handed to dma_map_single(). is_curr_dma_xfer
+ * only records that the last armed chunk took the DMA path,
+ * which is not the same thing: a chunk whose mapping failed
+ * leaves the DMA path flagged with nothing mapped.
+ */
+ bool is_dma_mapped;
+ unsigned int dma_map_len;
+
u32 command1_reg;
u32 dma_control_reg;
u32 def_command1_reg;
@@ -584,24 +595,32 @@ static int tegra_qspi_dma_map_xfer(struc
if (t->rx_buf) {
t->rx_dma = dma_map_single(tqspi->rx_dma_dev, (void *)rx_buf, len, DMA_FROM_DEVICE);
if (dma_mapping_error(tqspi->rx_dma_dev, t->rx_dma)) {
- dma_unmap_single(tqspi->tx_dma_dev, t->tx_dma, len, DMA_TO_DEVICE);
+ if (t->tx_buf)
+ dma_unmap_single(tqspi->tx_dma_dev, t->tx_dma,
+ len, DMA_TO_DEVICE);
return -ENOMEM;
}
}
+ tqspi->dma_map_len = len;
+ tqspi->is_dma_mapped = true;
+
return 0;
}
static void tegra_qspi_dma_unmap_xfer(struct tegra_qspi *tqspi, struct spi_transfer *t)
{
- unsigned int len;
-
- len = DIV_ROUND_UP(tqspi->curr_dma_words * tqspi->bytes_per_word, 4) * 4;
+ if (!tqspi->is_dma_mapped)
+ return;
if (t->tx_buf)
- dma_unmap_single(tqspi->tx_dma_dev, t->tx_dma, len, DMA_TO_DEVICE);
+ dma_unmap_single(tqspi->tx_dma_dev, t->tx_dma,
+ tqspi->dma_map_len, DMA_TO_DEVICE);
if (t->rx_buf)
- dma_unmap_single(tqspi->rx_dma_dev, t->rx_dma, len, DMA_FROM_DEVICE);
+ dma_unmap_single(tqspi->rx_dma_dev, t->rx_dma,
+ tqspi->dma_map_len, DMA_FROM_DEVICE);
+
+ tqspi->is_dma_mapped = false;
}
static int tegra_qspi_start_dma_based_transfer(struct tegra_qspi *tqspi, struct spi_transfer *t)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 768/990] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (766 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 767/990] spi: tegra210-quad: Track DMA mapping state Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 769/990] x86/CPU/AMD: Dont print reset reason in VMs Greg Kroah-Hartman
` (84 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Feng, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
commit 57c7cbe21acc77291ec0fbdd4bd72aa259cf4986 upstream.
npcm_wdt_start() unconditionally prepares and enables the watchdog
clock, and npcm_wdt_stop() is the only place that disables it.
npcm_wdt_set_timeout() calls npcm_wdt_start() again whenever the
watchdog is already active, so every WDIOC_SETTIMEOUT ioctl issued
while the watchdog is running takes one extra clock prepare/enable
reference that is never dropped.
Split the register programming out of npcm_wdt_start() into a
__npcm_wdt_start() helper that assumes the clock is already running,
and call the helper from npcm_wdt_set_timeout() instead; only the
watchdog .start callback (and the restart path, which intentionally
keeps the clock) now acquires the clock.
Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261109071004.1506-1-zhaofeng2@cmss.chinamobile.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/watchdog/npcm_wdt.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -63,13 +63,11 @@ static int npcm_wdt_ping(struct watchdog
return 0;
}
-static int npcm_wdt_start(struct watchdog_device *wdd)
+static void __npcm_wdt_start(struct watchdog_device *wdd)
{
struct npcm_wdt *wdt = to_npcm_wdt(wdd);
u32 val;
- clk_prepare_enable(wdt->clk);
-
if (wdd->timeout < 2)
val = 0x800;
else if (wdd->timeout < 3)
@@ -94,6 +92,15 @@ static int npcm_wdt_start(struct watchdo
val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE;
writel(val, wdt->reg);
+}
+
+static int npcm_wdt_start(struct watchdog_device *wdd)
+{
+ struct npcm_wdt *wdt = to_npcm_wdt(wdd);
+
+ clk_prepare_enable(wdt->clk);
+
+ __npcm_wdt_start(wdd);
return 0;
}
@@ -134,7 +141,7 @@ static int npcm_wdt_set_timeout(struct w
wdd->timeout = 2750;
if (watchdog_active(wdd))
- npcm_wdt_start(wdd);
+ __npcm_wdt_start(wdd);
return 0;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 769/990] x86/CPU/AMD: Dont print reset reason in VMs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (767 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 768/990] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 770/990] x86/mm: Ensure write visibility during LDT installation Greg Kroah-Hartman
` (83 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Borislav Petkov, Jason Andryuk,
Mario Limonciello (AMD), Yazen Ghannam, Juergen Gross
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Andryuk <jason.andryuk@amd.com>
commit ea51d1a4c31fc8320c34f897dc5296a0bfc5c7ca upstream.
print_s5_reset_status_mmio() expects to read FCH MMIO on baremetal. VMs don't
have emulated FCH registers, so there is nothing to check. Add an early exit
when running on a hypervisor.
The real motivation is Xen PV domUs can't boot on Zen CPUs. PV domUs PTEs
contain system physical addresses - they don't have the concept of guest
physical addresses. domUs can only map physical addresses they are assigned, so
a domU fails to map the FCH MMIO addresses.
However set_pte() does not return failure, so ioremap() returns a pointer while
the PTEs are unpopulated. print_s5_reset_status_mmio() faults when reading
through the pointer, breaking the boot.
Limit the reset reason printing to baremetal only where it actually makes sense.
[ bp: Massage commit message. ]
Fixes: ab8131028710 ("x86/CPU/AMD: Print the reason for the last reset")
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261104013026.185392-1-jason.andryuk@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/cpu/amd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1370,7 +1370,8 @@ static __init int print_s5_reset_status_
u32 value;
int i;
- if (!cpu_feature_enabled(X86_FEATURE_ZEN))
+ if (!cpu_feature_enabled(X86_FEATURE_ZEN) ||
+ cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
return 0;
addr = ioremap(FCH_PM_BASE + FCH_PM_S5_RESET_STATUS, sizeof(value));
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 770/990] x86/mm: Ensure write visibility during LDT installation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (768 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 769/990] x86/CPU/AMD: Dont print reset reason in VMs Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 771/990] x86/video: Preserve the default VGA fallback for legacy modes Greg Kroah-Hartman
` (82 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Jaeyoung Chung, Dave Hansen,
Ingo Molnar, Linus Torvalds, Peter Zijlstra (Intel)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <dave.hansen@linux.intel.com>
commit 0dc2a4dac3d04e9e4479aeb0b46172feab1cca0a upstream.
During LDT installation, the intent is to overwrite the old per-mm
LDT value, then send an IPI to the mm user CPUs to have each load
the new value.
But there is an ordering problem: a new mm user CPU sets itself in
mm_cpumask() and then reads mm->context.ldt. The LDT-installing CPU
writes mm->context.ldt and then reads mm_cpumask(). But, there is
nothing which orders the LDT installation side actions. The CPU
can read mm_cpumask() before its write becomes visible.
Ensure that new mm user CPUs see the new mm->context.ldt. Make
mm->context.ldt visible before reading mm_cpumask().
Also convert the smp_store_release() over to a WRITE_ONCE().
smp_store_release() has an internal barrier which is weaker than
the new smp_mb(). Avoid an extra barrier by converting it to
WRITE_ONCE().
Also refresh/correct misleading comments. READ/WRITE_ONCE() do not
"synchronize" anything themselves.
Reported-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Jaeyoung Chung <jjy600901@snu.ac.kr>
Acked-by: Linus Torvalds <torvalds@linuxfoundation.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/ldt.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -43,7 +43,7 @@ void load_mm_ldt(struct mm_struct *mm)
{
struct ldt_struct *ldt;
- /* READ_ONCE synchronizes with smp_store_release */
+ /* Pairs with WRITE_ONCE() in install_ldt() */
ldt = READ_ONCE(mm->context.ldt);
/*
@@ -422,8 +422,14 @@ static void install_ldt(struct mm_struct
{
mutex_lock(&mm->context.lock);
- /* Synchronizes with READ_ONCE in load_mm_ldt. */
- smp_store_release(&mm->context.ldt, ldt);
+ /*
+ * Ensure that new mm user CPUs either see the new LDT value
+ * or get an IPI. Make the store visible before reading
+ * mm_cpumask(). New mm users make their mm_cpumask() writes
+ * visible before reading mm->context.ldt.
+ */
+ WRITE_ONCE(mm->context.ldt, ldt);
+ smp_mb();
/* Activate the LDT for all CPUs using currents mm. */
on_each_cpu_mask(mm_cpumask(mm), flush_ldt, mm, true);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 771/990] x86/video: Preserve the default VGA fallback for legacy modes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (769 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 770/990] x86/mm: Ensure write visibility during LDT installation Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 772/990] xen/gntdev: fix deadlock between map ioctl and mmap Greg Kroah-Hartman
` (81 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Hengyu Liang, Borislav Petkov (AMD),
Mario Limonciello (AMD), Thomas Zimmermann
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hengyu Liang <hengyul@cs.unc.edu>
commit 3b4c98b47ba7c3c57bcf54fb85f54a854622041c upstream.
Commit
596b3678326d ("x86/video: Only fall back to vga_default_device() without screen info")
made video_is_primary_device() rely exclusively on screen_info resources
whenever any are available.
However, screen_info_resources() also returns legacy I/O and memory ranges for
VGA text modes. These ranges are not PCI BARs, so pci_find_resource() does not
find them and the default VGA fallback is skipped. As a result, no device is
primary in VGA text mode.
On a SeaBIOS QEMU guest with bochs and VKMS, the boot VGA (bochs) loses its
DRM boot_display attribute. VKMS registers fb0 and bochs registers fb1. VKMS
is not a PCI device, so it is not primary either. With no primary device,
fbcon keeps the console on fb0 and never remaps it to bochs. This can be
checked with:
cat /sys/class/drm/card1/boot_display
stty -F /dev/tty1 size
Without the fix, boot_display is missing and tty1 is 48 rows by 128 columns.
With it, boot_display contains 1 and tty1 is 50 rows by 160 columns. VKMS only
makes the console part visible. Without VKMS, tty1 has the same size with and
without the fix, but boot_display is still missing without it.
Use resource-based selection only for linear framebuffers. Fall back to
vga_default_device() for legacy display modes, while keeping EFI and VESA
framebuffer ownership authoritative.
Fixes: 596b3678326d ("x86/video: Only fall back to vga_default_device() without screen info")
Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261103031630.2085194-1-hengyul@cs.unc.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/video/video-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/video/video-common.c
+++ b/arch/x86/video/video-common.c
@@ -45,7 +45,7 @@ bool video_is_primary_device(struct devi
#ifdef CONFIG_SCREEN_INFO
numres = screen_info_resources(si, res, ARRAY_SIZE(res));
- if (numres > 0) {
+ if (numres > 0 && __screen_info_has_lfb(screen_info_video_type(si))) {
for (i = 0; i < numres; ++i) {
if (!(res[i].flags & IORESOURCE_MEM))
continue;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 772/990] xen/gntdev: fix deadlock between map ioctl and mmap
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (770 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 771/990] x86/video: Preserve the default VGA fallback for legacy modes Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 773/990] xen/privcmd: fix double free when an irqfd is shut down twice Greg Kroah-Hartman
` (80 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Andrey Misiurov, Juergen Gross
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <andrey.misyrov@gmail.com>
commit 7620a997e4854c94eacebf0c2d453fbd78ccdb46 upstream.
Commit 45ca1afe2fd1 ("xen/gntdev: fix error handling in ioctl") moved
copy_to_user() in gntdev_ioctl_map_grant_ref() under priv->lock. A
fault in copy_to_user() takes mmap_lock, while gntdev_mmap() is called
with mmap_lock held and takes priv->lock:
ioctl thread mmap thread
mutex_lock(&priv->lock)
mmap_write_lock(mm)
gntdev_mmap()
mutex_lock(&priv->lock)
copy_to_user() faults
mmap_read_lock(mm)
Reproduced on Debian 6.12.111 in a Xen guest, with the ioctl argument
on a MAP_PRIVATE file page that has not been written yet. sysrq-w:
task:repro state:D stack:0 pid:4479 tgid:4477 ppid:1 flags:0x00000000
rwsem_down_read_slowpath+0x25c/0x480
down_read_killable+0x48/0xc0
lock_mm_and_find_vma+0x96/0x250
do_user_addr_fault+0x12d/0x620
exc_page_fault+0x7e/0x180
asm_exc_page_fault+0x26/0x30
_copy_to_user+0x36/0x50
gntdev_ioctl+0x3b9/0xa00 [xen_gntdev]
__x64_sys_ioctl+0x97/0xc0
task:repro state:D stack:0 pid:4480 tgid:4477 ppid:1 flags:0x00000000
__mutex_lock.constprop.0+0x41b/0x720
gntdev_mmap+0x4d/0x330 [xen_gntdev]
__mmap_region+0x697/0xb10
mmap_region+0x78/0xa0
do_mmap+0x45d/0x630
vm_mmap_pgoff+0xf8/0x1c0
Drop priv->lock before copy_to_user() again. On failure, re-take it
and remove the map by index, as IOCTL_GNTDEV_UNMAP_GRANT_REF does,
since another thread may have unmapped it meanwhile.
Fixes: 45ca1afe2fd1 ("xen/gntdev: fix error handling in ioctl")
Cc: stable@vger.kernel.org
Signed-off-by: Andrey Misiurov <andrey.misyrov@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261013170745.583279-1-andrey.misyrov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/gntdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -676,15 +676,19 @@ static long gntdev_ioctl_map_grant_ref(s
mutex_lock(&priv->lock);
gntdev_add_map(priv, map);
op.index = map->index << PAGE_SHIFT;
+ mutex_unlock(&priv->lock);
if (copy_to_user(u, &op, sizeof(op)) != 0) {
- list_del(&map->next);
+ mutex_lock(&priv->lock);
+ map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT,
+ op.count);
+ if (map)
+ list_del(&map->next);
mutex_unlock(&priv->lock);
gntdev_put_map(priv, map);
return -EFAULT;
}
- mutex_unlock(&priv->lock);
return 0;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 773/990] xen/privcmd: fix double free when an irqfd is shut down twice
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (771 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 772/990] xen/gntdev: fix deadlock between map ioctl and mmap Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 774/990] xen/pvcalls: unwind pvcalls_new_active_socket() step by step Greg Kroah-Hartman
` (79 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Qihang, Juergen Gross
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qihang <q.h.hack.winter@gmail.com>
commit 72a900c666adb97df77b05cf8540c4117f9c83ba upstream.
irqfd_deactivate() takes the irqfd off irqfds_list and queues
irqfd_shutdown(). queue_work() is not a once-only gate: it refuses to
enqueue a work item only while WORK_STRUCT_PENDING is set, and
process_one_work() clears that bit before it calls the work function. So
nothing records that the shutdown work has already been queued, and
nothing protects the window between the start of irqfd_shutdown() and the
kfree() at its end.
Two paths call irqfd_deactivate() for the same irqfd:
- privcmd_irqfd_deassign(), from the PRIVCMD_IRQFD_FLAG_DEASSIGN ioctl;
- irqfd_wakeup(), with EPOLLHUP set, when the last reference to the
eventfd file goes away, which runs wake_up_poll(&ctx->wqh, EPOLLHUP)
from eventfd_release().
irqfds_lock serialises the two calls, but it does not make the second one
a no-op, and eventfd_ctx_fdget() takes a reference to the eventfd_ctx,
not to the struct file, so the last fd can still be closed while the
ioctl is running:
CPU0 CPU1
eventfd_ctx_fdget()
spin_lock(irqfds_lock)
list_del_init(&kirqfd->list)
queue_work(&kirqfd->shutdown) close(fd)
eventfd_release()
wake_up_poll(EPOLLHUP)
irqfd_wakeup()
spin_lock(irqfds_lock)
irqfd_deactivate() again
If the work item has already started by then, its pending bit has been
cleared and the second queue_work() succeeds. irqfd_shutdown() then runs
twice, so eventfd_ctx_remove_wait_queue(), eventfd_ctx_put() and kfree()
each hit the same object a second time; and when the second queue_work()
lands after the irqfd has been freed, the workqueue list operations write
to freed memory.
virt/kvm/eventfd.c has the same two callers and has had this guard since
the original irqfd support (721eecbf4fe99): irqfd_wakeup() calls
irqfd_deactivate() only if irqfd_is_active(). The comment there explains
why that is enough: the other side deactivates the irqfd before it takes
it off the waitqueue, and irqfd_shutdown() needs the waitqueue lock,
which this callback holds, so the irqfd cannot be freed under it.
Do the same here. list_del_init() leaves the list head empty and the
irqfd stays off the list until kfree(), so it serves as a one-way
"active" flag. The test is in irqfd_deactivate() rather than in
irqfd_wakeup() because privcmd_irqfd_deassign() walks irqfds_list and can
therefore never reach an inactive irqfd; only the wakeup path can, and a
single test covers both callers.
Fixes: f8941e6c4c712 ("xen: privcmd: Add support for irqfd")
Cc: stable@vger.kernel.org
Signed-off-by: Qihang <q.h.hack.winter@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261101163251.55099-1-q.h.hack.winter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/privcmd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -901,10 +901,25 @@ struct privcmd_kernel_irqfd {
poll_table pt;
};
+static bool irqfd_is_active(struct privcmd_kernel_irqfd *kirqfd)
+{
+ lockdep_assert_held(&irqfds_lock);
+
+ return !list_empty(&kirqfd->list);
+}
+
static void irqfd_deactivate(struct privcmd_kernel_irqfd *kirqfd)
{
lockdep_assert_held(&irqfds_lock);
+ /*
+ * Both the deassign ioctl and the eventfd wakeup path can reach
+ * this function. list_del_init() marks the irqfd inactive, so
+ * only the first caller may queue the shutdown work.
+ */
+ if (!irqfd_is_active(kirqfd))
+ return;
+
list_del_init(&kirqfd->list);
queue_work(irqfd_cleanup_wq, &kirqfd->shutdown);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 774/990] xen/pvcalls: unwind pvcalls_new_active_socket() step by step
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (772 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 773/990] xen/privcmd: fix double free when an irqfd is shut down twice Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 775/990] xen/pvcalls: destroy the per-socket workqueue on release Greg Kroah-Hartman
` (78 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefano Stabellini, Yehyeong Lee,
Juergen Gross
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 702ba3c80a8736898813a2c7484d695278aa114d upstream.
Every error path in pvcalls_new_active_socket() jumps to one shared label
that does list_del(&map->list) and then hands map to
pvcalls_back_release_active(). But map comes from kzalloc() and its
list_head is only published at the very end of the function, after the last
of those jumps:
down(&fedata->socket_lock);
list_add_tail(&map->list, &fedata->socket_mappings);
up(&fedata->socket_lock);
so on the error path map->list is still {NULL, NULL} and __list_del()
writes through a NULL pointer.
A frontend gets there with one value it owns: the ring_order field of the
page it granted. Anything above MAX_RING_ORDER takes the second goto, and
nothing else in the function has run by then.
The result is an oops in whichever context handled the request - the
pvcalls-back threaded IRQ handler for PVCALLS_CONNECT, mappass->wq for
PVCALLS_ACCEPT - and because it happens after down(&fedata->socket_lock)
that semaphore is never released, so every later operation on the frontend
blocks on it and the backend never completes backend_disconnect(). (With
CONFIG_DEBUG_LIST the list_del() only reports and returns, and
pvcalls_back_release_active() then runs on a map whose irq is still 0 and
whose bytes, ioworker.wq and saved_data_ready are all NULL.)
A frontend asking for ring_order 5, on a dom0 built with KASAN
(the request was issued by a test-only change to the frontend):
[ 133.728877] pvcalls_new_active_socket frontend requested ring_order 5, which is > MAX (4)
[ 133.732868] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
[ 133.737910] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
[ 133.741666] CPU: 0 UID: 0 PID: 133 Comm: irq/39-pvcalls- Not tainted 7.3.0-kCTLblk2-15482-g21a7f44fd076-dirty #1 PREEMPT(full)
[ 133.746986] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 133.751512] RIP: 0010:pvcalls_new_active_socket+0x821/0xb90
[ 133.754237] Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 f6 01 00 00 48 8d 79 08 4c 8b 6b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 14 02 00 00 4c 89 ea 4c 89 69 08 48 b8 00 00 00
[ 133.763126] RSP: 0018:ffffc900004afb38 EFLAGS: 00010202
[ 133.765861] RAX: dffffc0000000000 RBX: ffff88810886c900 RCX: 0000000000000000
[ 133.769348] RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000008
[ 133.772787] RBP: 1ffff92000095f6b R08: 0000000000000001 R09: fffff52000095f58
[ 133.776260] R10: 0000000000000003 R11: ffff888100077320 R12: ffff88810858b410
[ 133.779823] R13: 0000000000000000 R14: ffff88810858b460 R15: ffff88810858b400
[ 133.783382] FS: 0000000000000000(0000) GS:ffff8881b034c000(0000) knlGS:0000000000000000
[ 133.787351] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 133.790308] CR2: 00000000006042c0 CR3: 0000000108400001 CR4: 0000000000770ef0
[ 133.793822] PKRU: 55555554
[ 133.795347] Call Trace:
[ 133.796778] <TASK>
[ 133.798082] ? __pfx_pvcalls_new_active_socket+0x10/0x10
[ 133.800801] ? security_socket_post_create+0x4d/0x60
[ 133.803275] ? release_sock+0x1a/0x1d0
[ 133.805182] pvcalls_back_event+0x1b09/0x23e0
[ 133.807431] ? __pfx_pvcalls_back_event+0x10/0x10
[ 133.809814] ? __pfx__raw_spin_lock_irqsave+0x10/0x10
[ 133.812251] ? __pfx_pvcalls_back_event+0x10/0x10
[ 133.814554] irq_thread_fn+0x86/0x150
[ 133.816468] irq_thread+0x2da/0x580
[ 133.818363] ? __pfx_irq_thread_fn+0x10/0x10
[ 133.820586] ? __pfx_irq_thread+0x10/0x10
[ 133.822670] ? __kthread_parkme+0x88/0x170
[ 133.824803] ? __pfx_irq_thread+0x10/0x10
[ 133.827153] ? __pfx_irq_thread+0x10/0x10
[ 133.829304] kthread+0x2c8/0x3b0
[ 133.831176] ? recalc_sigpending+0x15c/0x1e0
[ 133.833570] ? __pfx_kthread+0x10/0x10
[ 133.835572] ret_from_fork+0x373/0x5b0
[ 133.837581] ? __pfx_ret_from_fork+0x10/0x10
[ 133.839978] ? __switch_to+0x3c4/0xb40
[ 133.841984] ? __pfx_kthread+0x10/0x10
[ 133.843970] ret_from_fork_asm+0x1a/0x30
[ 133.846031] </TASK>
[ 133.847420] Modules linked in:
[ 133.849240] ---[ end trace 0000000000000000 ]---
Give each failure its own label, so that only resources that were actually
acquired are released and the list the map was never added to is left
alone. The map is not published anywhere at that point, so the error path
needs no socket_lock at all. sock_release() stays in the callee on every
error path, the way
commit 8fafac202d18 ("xen/pvcalls-back: fix double frees with pvcalls_new_active_socket()")
arranged it.
Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command")
Cc: stable@vger.kernel.org
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261110125002.46683-2-yhlee@isslab.korea.ac.kr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/pvcalls-back.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -337,7 +337,7 @@ static struct sock_mapping *pvcalls_new_
ret = xenbus_map_ring_valloc(fedata->dev, &ref, 1, &page);
if (ret < 0)
- goto out;
+ goto out_map;
map->ring = page;
map->ring_order = map->ring->ring_order;
/* first read the order, then map the data ring */
@@ -345,19 +345,19 @@ static struct sock_mapping *pvcalls_new_
if (map->ring_order > MAX_RING_ORDER) {
pr_warn("%s frontend requested ring_order %u, which is > MAX (%u)\n",
__func__, map->ring_order, MAX_RING_ORDER);
- goto out;
+ goto out_unmap_ring;
}
ret = xenbus_map_ring_valloc(fedata->dev, map->ring->ref,
(1 << map->ring_order), &page);
if (ret < 0)
- goto out;
+ goto out_unmap_ring;
map->bytes = page;
ret = bind_interdomain_evtchn_to_irqhandler_lateeoi(
fedata->dev, evtchn,
pvcalls_back_conn_event, 0, "pvcalls-backend", map);
if (ret < 0)
- goto out;
+ goto out_unmap_bytes;
map->irq = ret;
map->data.in = map->bytes;
@@ -365,7 +365,7 @@ static struct sock_mapping *pvcalls_new_
map->ioworker.wq = alloc_ordered_workqueue("pvcalls_io", 0);
if (!map->ioworker.wq)
- goto out;
+ goto out_unbind;
atomic_set(&map->io, 1);
INIT_WORK(&map->ioworker.register_work, pvcalls_back_ioworker);
@@ -381,11 +381,16 @@ static struct sock_mapping *pvcalls_new_
write_unlock_bh(&map->sock->sk->sk_callback_lock);
return map;
-out:
- down(&fedata->socket_lock);
- list_del(&map->list);
- pvcalls_back_release_active(fedata->dev, fedata, map);
- up(&fedata->socket_lock);
+
+out_unbind:
+ unbind_from_irqhandler(map->irq, map);
+out_unmap_bytes:
+ xenbus_unmap_ring_vfree(fedata->dev, map->bytes);
+out_unmap_ring:
+ xenbus_unmap_ring_vfree(fedata->dev, (void *)map->ring);
+out_map:
+ sock_release(sock);
+ kfree(map);
return NULL;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 775/990] xen/pvcalls: destroy the per-socket workqueue on release
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (773 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 774/990] xen/pvcalls: unwind pvcalls_new_active_socket() step by step Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 776/990] hwmon: (aht10) Fix update_interval overflow on 64-bit Greg Kroah-Hartman
` (77 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Stefano Stabellini, Yehyeong Lee,
Juergen Gross
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
commit 6b3feb6bfa9ac384f7a3ec25c40b9b4d3da96d25 upstream.
pvcalls_new_active_socket() gives every active socket its own ordered
workqueue:
map->ioworker.wq = alloc_ordered_workqueue("pvcalls_io", 0);
and nothing ever destroys it. pvcalls_back_release_active() flushes
map->ioworker.register_work and frees map, but the workqueue and its
pool_workqueues stay allocated, so a frontend leaks a workqueue per socket
it connects and releases - a loop a guest can run as long as it likes.
Destroy it right after flush_work(): the IRQ is disabled and sk_data_ready
restored by then, so nothing can queue new work, and the rings are still
mapped while it drains - pvcalls_conn_back_read() reads map->ring and
map->data, which xenbus_unmap_ring_vfree() takes away a few lines later.
pvcalls_back_ioworker() does not take fedata->socket_lock, which the
backend_disconnect() caller holds here - only the socket's own
sk_receive_queue lock - so draining it from this point is safe; the
flush_work() just above already has the same requirement.
Fixes: 5db4d286a8ef ("xen/pvcalls: implement connect command")
Cc: stable@vger.kernel.org
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261110125002.46683-3-yhlee@isslab.korea.ac.kr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/xen/pvcalls-back.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -452,6 +452,7 @@ static int pvcalls_back_release_active(s
atomic_set(&map->release, 1);
flush_work(&map->ioworker.register_work);
+ destroy_workqueue(map->ioworker.wq);
xenbus_unmap_ring_vfree(dev, map->bytes);
xenbus_unmap_ring_vfree(dev, (void *)map->ring);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 776/990] hwmon: (aht10) Fix update_interval overflow on 64-bit
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (774 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 775/990] xen/pvcalls: destroy the per-socket workqueue on release Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 777/990] hwmon: (gpio-fan) Fix runtime PM imbalance in probe and teardown Greg Kroah-Hartman
` (76 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Rupesh Majhi, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rupesh Majhi <zoone.rupert@gmail.com>
commit b5c5b67e02406fb48acf57cf2c30a570230fd6aa upstream.
On 64-bit, update_interval writes are clamped to LONG_MAX ms, but
ms_to_ktime() overflows above 9223372036854 ms and the interval wraps.
LONG_MAX becomes -1 ms, so every read starts a new measurement and
update_interval reads back -1.
Clamp to INT_MAX like sht4x, so the limit is the same on all platforms.
Fixes: 8c78f0dee437 ("hwmon: Add AHT10 Temperature and Humidity Sensor Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
Link: https://patch.msgid.link/20261108172651.220121-1-zoone.rupert@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/aht10.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/aht10.c
+++ b/drivers/hwmon/aht10.c
@@ -229,7 +229,7 @@ static int aht10_read_values(struct aht1
static ssize_t aht10_interval_write(struct aht10_data *data,
long val)
{
- data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, LONG_MAX));
+ data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, INT_MAX));
return 0;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 777/990] hwmon: (gpio-fan) Fix runtime PM imbalance in probe and teardown
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (775 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 776/990] hwmon: (aht10) Fix update_interval overflow on 64-bit Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 778/990] hwmon: (pmbus/mp2975) Get vout fault limits dynamically Greg Kroah-Hartman
` (75 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <linux@roeck-us.net>
commit 221b565a3316b1ba3a9bcd1f61238440207b3e00 upstream.
In gpio_fan_probe(), gpio_fan_stop() is registered conditionally as a
devres action before runtime PM is initialized, while gpio_fan_stop()
unconditionally calls pm_runtime_disable(). This breaks runtime PM
disable_depth and usage_count invariants across several paths:
- On alarm-only devices without control GPIOs, gpio_fan_stop() is never
registered, leaving pm_runtime_enable() unbalanced on unbind and
triggering "Unbalanced pm_runtime_enable!" on subsequent binds.
- When control GPIOs are present and devm_add_action_or_reset(), hwmon
registration, or fan_alarm_init() fails, gpio_fan_stop() runs before
pm_runtime_enable(), incrementing disable_depth to 2 (leaving runtime
PM permanently disabled on re-probe) and, if speed_index > 0,
underflowing usage_count via pm_runtime_put_sync().
- If pm_runtime_resume_and_get() fails when speed_index > 0, it drops
its reference while speed_index remains non-zero, causing
gpio_fan_stop() to call pm_runtime_put_sync() and underflow
usage_count.
- Registering the hwmon device before enabling runtime PM exposes sysfs
attributes that can invoke set_fan_speed() before runtime PM state is
initialized.
Initialize runtime PM upfront with pm_runtime_set_suspended() and
devm_pm_runtime_enable(), remove pm_runtime_disable() from
gpio_fan_stop(), and acquire the initial active runtime PM reference
before registering gpio_fan_stop() and the hwmon device.
Fixes: 0d01110e6356 ("hwmon: (gpio-fan) Add regulator support")
Reported-by: Sashiko <sashiko@sashiko.dev>
Link: https://sashiko.dev/#/bug/linux-349aa3ba-30c3-4c3c-b47e-f52839af2b8d
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/gpio-fan.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -531,8 +531,6 @@ static void gpio_fan_stop(void *data)
mutex_lock(&fan_data->lock);
set_fan_speed(data, 0);
mutex_unlock(&fan_data->lock);
-
- pm_runtime_disable(fan_data->dev);
}
static int gpio_fan_probe(struct platform_device *pdev)
@@ -560,6 +558,11 @@ static int gpio_fan_probe(struct platfor
return dev_err_probe(dev, PTR_ERR(fan_data->supply),
"Failed to get fan-supply");
+ pm_runtime_set_suspended(dev);
+ err = devm_pm_runtime_enable(dev);
+ if (err)
+ return err;
+
/* Configure control GPIOs if available. */
if (fan_data->gpios && fan_data->num_gpios > 0) {
if (!fan_data->speed || fan_data->num_speed <= 1)
@@ -567,6 +570,12 @@ static int gpio_fan_probe(struct platfor
err = fan_ctrl_init(fan_data);
if (err)
return err;
+ /* If current GPIO state is active, mark RPM as active as well */
+ if (fan_data->speed_index > 0) {
+ err = pm_runtime_resume_and_get(dev);
+ if (err)
+ return err;
+ }
err = devm_add_action_or_reset(dev, gpio_fan_stop, fan_data);
if (err)
return err;
@@ -587,17 +596,6 @@ static int gpio_fan_probe(struct platfor
return err;
}
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
- /* If current GPIO state is active, mark RPM as active as well */
- if (fan_data->speed_index > 0) {
- int ret;
-
- ret = pm_runtime_resume_and_get(&pdev->dev);
- if (ret)
- return ret;
- }
-
/* Optional cooling device register for Device tree platforms */
fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
"gpio-fan", fan_data, &gpio_fan_cool_ops);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 778/990] hwmon: (pmbus/mp2975) Get vout fault limits dynamically
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (776 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 777/990] hwmon: (gpio-fan) Fix runtime PM imbalance in probe and teardown Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 779/990] hwmon: (sy7636a) fix negative temperatures Greg Kroah-Hartman
` (74 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Felix Radensky, Vadim Pasternak,
Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Radensky <fradensky@nvidia.com>
commit 00944852275efd39706fe7b9ce75c28edde983eb upstream.
The over- and under-voltage fault limits of the tracking mode are
relative to the voltage reference, which follows the VID/AVS requests
issued to the device and therefore changes at runtime.
The driver reads the voltage reference once during probe and derives the
limits from that snapshot, which the PMBus core caches in addition. As a
result in2_crit and in2_lcrit reflect the operating point at probe, rather
than the thresholds the device enforces. On systems where the device
supplies the CPU core voltage, in2_crit was reported anywhere between
1.15V and 1.70V across identical systems, causing false over-voltage
reports once the CPU voltage exceeded the value latched at probe.
Read the voltage reference and the over-voltage offset selector whenever
a limit is requested, and mark both limits with pmbus_set_update(), so
that the core does not cache them. The voltage reference is available on
page 3 only. Let the core change the page, so that the page it caches
matches the device, except for a single rail configuration, for which the
core does not issue PAGE commands, and the page is changed directly.
With the selector read at runtime, a device configured with an
unsupported selector no longer fails to probe. The OVP1 threshold, which
does not depend on the selector, is reported for it instead, with a
warning.
Clamp the under-voltage limit to zero, since the offset can exceed a low
voltage reference, while a negative value would be reported as a read
error.
Fixes: 2c6fcbb21149 ("hwmon: (pmbus) Add support for MPS Multi-phase mp2975 controller")
Cc: stable@vger.kernel.org
Signed-off-by: Felix Radensky <fradensky@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://patch.msgid.link/20261105193200.1570996-1-fradensky@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/pmbus/mp2975.c | 207 +++++++++++++++++++++++--------------------
1 file changed, 115 insertions(+), 92 deletions(-)
--- a/drivers/hwmon/pmbus/mp2975.c
+++ b/drivers/hwmon/pmbus/mp2975.c
@@ -110,10 +110,7 @@ struct mp2975_data {
int vout_scale;
int max_phases[MP2975_PAGE_NUM];
int vid_step[MP2975_PAGE_NUM];
- int vref[MP2975_PAGE_NUM];
- int vref_off[MP2975_PAGE_NUM];
int vout_max[MP2975_PAGE_NUM];
- int vout_ov_fixed[MP2975_PAGE_NUM];
int curr_sense_gain[MP2975_PAGE_NUM];
};
@@ -466,12 +463,77 @@ static int mp2973_write_word_data(struct
return pmbus_write_word_data(client, 0, PMBUS_SMBALERT_MASK, ret);
}
+/*
+ * Let the PMBus core change the page, so that the page it caches matches the
+ * device. The core does not issue PAGE commands for a single rail
+ * configuration, thus change the page directly then.
+ */
+static int
+mp2975_page_set(struct i2c_client *client, struct mp2975_data *data, int page)
+{
+ if (data->info.pages > 1)
+ return pmbus_set_page(client, page, 0xff);
+
+ return i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
+}
+
+/*
+ * Voltage reference is available on page 3 only. The callers read a register
+ * of the rail through the core first, thus the core caches the rail page.
+ */
+static int
+mp2975_vref_get(struct i2c_client *client, struct mp2975_data *data, int page)
+{
+ int ret, vref;
+
+ ret = mp2975_page_set(client, data, 3);
+ if (ret < 0)
+ return ret;
+
+ vref = i2c_smbus_read_word_data(client, page ? MP2975_MFR_READ_VREF_R2 :
+ MP2975_MFR_READ_VREF_R1);
+
+ ret = mp2975_page_set(client, data, page);
+ if (ret < 0)
+ return ret;
+
+ return (vref < 0) ? vref : vref * data->vid_step[page];
+}
+
+static int
+mp2975_ovp2_offset_get(int ovp_th_set)
+{
+ switch ((ovp_th_set & GENMASK(5, 3)) >> 3) {
+ case 1:
+ return 140;
+ case 2:
+ return 220;
+ case 4:
+ return 400;
+ default:
+ return -EINVAL;
+ }
+}
+
+static int
+mp2975_vout_ovp2_get(struct i2c_client *client, struct mp2975_data *data,
+ int page, int vref_off)
+{
+ int vref;
+
+ vref = mp2975_vref_get(client, data, page);
+ if (vref < 0)
+ return vref;
+
+ return vref + DIV_ROUND_CLOSEST(vref_off * data->vout_scale, 10);
+}
+
static int mp2975_read_word_data(struct i2c_client *client, int page,
int phase, int reg)
{
const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
struct mp2975_data *data = to_mp2975_data(info);
- int ret;
+ int ret, ovp1, vref_off, uv_off;
switch (reg) {
case PMBUS_OT_FAULT_LIMIT:
@@ -488,19 +550,35 @@ static int mp2975_read_word_data(struct
break;
case PMBUS_VOUT_OV_FAULT_LIMIT:
/*
- * Register provides two values for over-voltage protection
- * threshold for fixed (ovp2) and tracking (ovp1) modes. The
- * minimum of these two values is provided as over-voltage
- * fault alarm.
+ * Device provides dual over-voltage protection. OVP1 is
+ * referred to the maximum reference voltage, while OVP2 is
+ * referred to the current voltage reference, which is changed
+ * at runtime. Protection is tripped by any of them, thus the
+ * minimum of the two is exposed as over-voltage fault alarm,
+ * and OVP2 is obtained on each read.
*/
ret = mp2975_read_word_helper(client, page, phase,
MP2975_MFR_OVP_TH_SET,
- GENMASK(2, 0));
+ GENMASK(5, 0));
if (ret < 0)
return ret;
- ret = min_t(int, data->vout_max[page] + 50 * (ret + 1),
- data->vout_ov_fixed[page]);
+ ovp1 = data->vout_max[page] + 50 * ((ret & GENMASK(2, 0)) + 1);
+
+ /* OVP1 still applies if the OVP2 threshold is unknown. */
+ vref_off = mp2975_ovp2_offset_get(ret);
+ if (vref_off < 0) {
+ dev_warn_once(&client->dev,
+ "unsupported OVP2 selector, reporting OVP1 threshold\n");
+ ret = ovp1;
+ break;
+ }
+
+ ret = mp2975_vout_ovp2_get(client, data, page, vref_off);
+ if (ret < 0)
+ return ret;
+
+ ret = min_t(int, ovp1, ret);
break;
case PMBUS_VOUT_UV_FAULT_LIMIT:
ret = mp2975_read_word_helper(client, page, phase,
@@ -509,8 +587,17 @@ static int mp2975_read_word_data(struct
if (ret < 0)
return ret;
- ret = DIV_ROUND_CLOSEST(data->vref[page] * 10 - 50 *
- (ret + 1) * data->vout_scale, 10);
+ uv_off = 50 * (ret + 1) * data->vout_scale;
+
+ ret = mp2975_vref_get(client, data, page);
+ if (ret < 0)
+ return ret;
+
+ /*
+ * Offset can exceed the voltage reference, while a negative
+ * value would be reported as a read error.
+ */
+ ret = max_t(int, DIV_ROUND_CLOSEST(ret * 10 - uv_off, 10), 0);
break;
case PMBUS_VIRT_READ_POUT_MAX:
ret = mp2975_read_word_helper(client, page, phase,
@@ -760,60 +847,6 @@ mp2975_current_sense_gain_get(struct i2c
}
static int
-mp2975_vref_get(struct i2c_client *client, struct mp2975_data *data,
- struct pmbus_driver_info *info)
-{
- int ret;
-
- ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 3);
- if (ret < 0)
- return ret;
-
- /* Get voltage reference value for rail 1. */
- ret = i2c_smbus_read_word_data(client, MP2975_MFR_READ_VREF_R1);
- if (ret < 0)
- return ret;
-
- data->vref[0] = ret * data->vid_step[0];
-
- /* Get voltage reference value for rail 2, if connected. */
- if (data->info.pages == MP2975_PAGE_NUM) {
- ret = i2c_smbus_read_word_data(client, MP2975_MFR_READ_VREF_R2);
- if (ret < 0)
- return ret;
-
- data->vref[1] = ret * data->vid_step[1];
- }
- return 0;
-}
-
-static int
-mp2975_vref_offset_get(struct i2c_client *client, struct mp2975_data *data,
- int page)
-{
- int ret;
-
- ret = i2c_smbus_read_word_data(client, MP2975_MFR_OVP_TH_SET);
- if (ret < 0)
- return ret;
-
- switch ((ret & GENMASK(5, 3)) >> 3) {
- case 1:
- data->vref_off[page] = 140;
- break;
- case 2:
- data->vref_off[page] = 220;
- break;
- case 4:
- data->vref_off[page] = 400;
- break;
- default:
- return -EINVAL;
- }
- return 0;
-}
-
-static int
mp2975_vout_max_get(struct i2c_client *client, struct mp2975_data *data,
struct pmbus_driver_info *info, int page)
{
@@ -917,25 +950,6 @@ mp2975_vout_per_rail_config_get(struct i
ret = mp2975_vout_max_get(client, data, info, i);
if (ret < 0)
return ret;
-
- /* Skip if reading Vref is unsupported */
- if (data->chip_id != mp2975)
- continue;
-
- /* Obtain voltage reference offsets. */
- ret = mp2975_vref_offset_get(client, data, i);
- if (ret < 0)
- return ret;
-
- /*
- * Set over-voltage fixed value. Thresholds are provided as
- * fixed value, and tracking value. The minimum of them are
- * exposed as over-voltage critical threshold.
- */
- data->vout_ov_fixed[i] = data->vref[i] +
- DIV_ROUND_CLOSEST(data->vref_off[i] *
- data->vout_scale,
- 10);
}
return 0;
@@ -1049,11 +1063,6 @@ static int mp2975_probe(struct i2c_clien
if (ret)
return ret;
- /* Obtain voltage reference values. */
- ret = mp2975_vref_get(client, data, info);
- if (ret)
- return ret;
-
/* Obtain vout over-voltage scales. */
ret = mp2975_vout_ov_scale_get(client, data, info);
if (ret < 0)
@@ -1070,7 +1079,21 @@ static int mp2975_probe(struct i2c_clien
if (ret)
return ret;
- return pmbus_do_probe(client, info);
+ ret = pmbus_do_probe(client, info);
+ if (ret)
+ return ret;
+
+ /*
+ * Vout over- and under-voltage fault limits are relative to the
+ * voltage reference, which is changed at runtime. Do not allow the
+ * PMBus core to cache them.
+ */
+ if (data->chip_id == mp2975) {
+ pmbus_set_update(client, PMBUS_VOUT_OV_FAULT_LIMIT, true);
+ pmbus_set_update(client, PMBUS_VOUT_UV_FAULT_LIMIT, true);
+ }
+
+ return 0;
}
static const struct of_device_id mp2975_of_match[] = {
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 779/990] hwmon: (sy7636a) fix negative temperatures
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (777 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 778/990] hwmon: (pmbus/mp2975) Get vout fault limits dynamically Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 780/990] hwmon: (scmi) Check channel config allocation Greg Kroah-Hartman
` (73 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Pablo Mazzini, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Mazzini <pmazzini@gmail.com>
commit fc8519fab34e162b0c29dacccf73031820878917 upstream.
The thermistor readout is a signed 8-bit value in degrees Celsius.
Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a")
Cc: stable@vger.kernel.org
Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
Link: https://patch.msgid.link/20261108093602.329554-3-pmazzini@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/sy7636a-hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hwmon/sy7636a-hwmon.c
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -29,7 +29,7 @@ static int sy7636a_read(struct device *d
if (ret)
return ret;
- *temp = reg_val * 1000;
+ *temp = (s8)reg_val * 1000;
return 0;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 780/990] hwmon: (scmi) Check channel config allocation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (778 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 779/990] hwmon: (sy7636a) fix negative temperatures Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 781/990] hwmon: (max31760) Fix the local temperature limit registers Greg Kroah-Hartman
` (72 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Sudeep Holla, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sudeep Holla <sudeep.holla@kernel.org>
commit a2996d892d0150d059d39c683d95d6fd7a37630a upstream.
scmi_hwmon_add_chan_info() can fail to allocate a channel's config
array. Ignoring that error leaves a channel with a NULL config pointer
in the hwmon chip info, which hwmon dereferences while registering the
device.
Check the helper's return value and abort probe on failure.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-d10ced6b-a6f0-403b-9619-f5a6573f9e7f
Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI")
Cc: stable@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
Link: https://patch.msgid.link/20261109151927.1672956-1-sudeep.holla@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/scmi-hwmon.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -228,8 +228,8 @@ static int scmi_thermal_sensor_register(
static int scmi_hwmon_probe(struct scmi_device *sdev)
{
- int i, idx;
u16 nr_sensors;
+ int i, idx, ret;
enum hwmon_sensor_types type;
struct scmi_sensors *scmi_sensors;
const struct scmi_sensor_info *sensor;
@@ -297,8 +297,12 @@ static int scmi_hwmon_probe(struct scmi_
if (!nr_count[type])
continue;
- scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type],
- type, hwmon_attributes[type]);
+ ret = scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev,
+ nr_count[type], type,
+ hwmon_attributes[type]);
+ if (ret)
+ return ret;
+
*ptr_scmi_ci++ = scmi_hwmon_chan++;
scmi_sensors->info[type] =
@@ -333,8 +337,6 @@ static int scmi_hwmon_probe(struct scmi_
return PTR_ERR(hwdev);
for (i = 0; i < nr_count_temp; i++) {
- int ret;
-
sensor = *(scmi_sensors->info[hwmon_temp] + i);
if (!sensor)
continue;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 781/990] hwmon: (max31760) Fix the local temperature limit registers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (779 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 780/990] hwmon: (scmi) Check channel config allocation Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 782/990] hwmon: (max31760) Leave standby mode at probe Greg Kroah-Hartman
` (71 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Stanislav Aleksandrov, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Aleksandrov <lightofmysoul@gmail.com>
commit 028ed93145d9be88eee670088ef13482b5d36c1a upstream.
temp2_max and temp2_crit use each other's registers, so reading them
shows the local limits swapped and writing temp2_max changes the
overtemperature (SHDN) threshold.
Use the high limit (0x0C) for temp2_max and the overtemperature limit
(0x08) for temp2_crit.
Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Aleksandrov <lightofmysoul@gmail.com>
Link: https://patch.msgid.link/20261108-max31760-fixes-v1-1-a61450463059@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/max31760.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/max31760.c
+++ b/drivers/hwmon/max31760.c
@@ -27,8 +27,8 @@
#define REG_TACH(ch) (0x52 + (ch) * 2)
#define REG_TEMP_INPUT(ch) (0x56 + (ch) * 2)
-#define REG_TEMP_MAX(ch) (0x06 + (ch) * 2)
-#define REG_TEMP_CRIT(ch) (0x0A + (ch) * 2)
+#define REG_TEMP_MAX(ch) ((ch) ? 0x0C : 0x06)
+#define REG_TEMP_CRIT(ch) ((ch) ? 0x08 : 0x0A)
#define TEMP11_FROM_REG(reg) ((reg) / 32 * 125)
#define TEMP11_TO_REG(val) (DIV_ROUND_CLOSEST(clamp_val((val), -128000, \
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 782/990] hwmon: (max31760) Leave standby mode at probe
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (780 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 781/990] hwmon: (max31760) Fix the local temperature limit registers Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 783/990] hwmon: (max31760) Report 0 RPM before the first fan speed measurement Greg Kroah-Hartman
` (70 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Stanislav Aleksandrov, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Aleksandrov <lightofmysoul@gmail.com>
commit 95bddc5252a4c0a2ed9d62e7e53a3461265d9603 upstream.
The driver never clears the standby bit (CR2_STBY) during probe.
While max31760_resume() clears this bit on resume, probe only
configured CR2_ALERTS.
If the chip was left in standby (for example, by boot firmware or a
previously running OS before a warm reboot), it remains in standby:
temperature sensing, fan speed counting, and PWM output are halted.
This occurs on the Samsung Galaxy XR, where the bootloader places the
chip in standby during boot.
Clear CR2_STBY alongside setting CR2_ALERTS in probe.
Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Aleksandrov <lightofmysoul@gmail.com>
Link: https://patch.msgid.link/20261108-max31760-fixes-v1-2-a61450463059@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/max31760.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/max31760.c
+++ b/drivers/hwmon/max31760.c
@@ -533,8 +533,9 @@ static int max31760_probe(struct i2c_cli
dev_set_drvdata(dev, state);
- /* Set alert output to comparator mode */
- ret = regmap_set_bits(state->regmap, REG_CR2, CR2_ALERTS);
+ /* Leave standby mode, set alert output to comparator mode */
+ ret = regmap_update_bits(state->regmap, REG_CR2, CR2_STBY | CR2_ALERTS,
+ CR2_ALERTS);
if (ret)
return dev_err_probe(dev, ret, "cannot write register\n");
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 783/990] hwmon: (max31760) Report 0 RPM before the first fan speed measurement
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (781 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 782/990] hwmon: (max31760) Leave standby mode at probe Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 784/990] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Greg Kroah-Hartman
` (69 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Stanislav Aleksandrov, Guenter Roeck
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Aleksandrov <lightofmysoul@gmail.com>
commit 33d58cbf2ab26bda81bc3052158d8b9867d5b9a6 upstream.
The tachometer count registers initialize to 0 until the first
measurement cycle completes after power-on. To prevent division by
zero, tach_to_rpm() clamped tach == 0 to 1, causing it to compute
and report 3,000,000 RPM (60 * 100000 / 1 / 2).
Return 0 RPM when tach == 0 instead.
Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Aleksandrov <lightofmysoul@gmail.com>
Link: https://patch.msgid.link/20261108-max31760-fixes-v1-3-a61450463059@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hwmon/max31760.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/hwmon/max31760.c
+++ b/drivers/hwmon/max31760.c
@@ -68,8 +68,9 @@ static const int max31760_pwm_freq[] = {
static int tach_to_rpm(u16 tach)
{
+ /* The count is 0 until the first measurement */
if (tach == 0)
- tach = 1;
+ return 0;
return 60 * 100000 / tach / 2;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 784/990] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (782 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 783/990] hwmon: (max31760) Report 0 RPM before the first fan speed measurement Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 785/990] s390/dasd: Dont trust userspace-supplied result field in format check Greg Kroah-Hartman
` (68 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jan Höppner,
Stefan Haberland, Jens Axboe
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
commit df56f7a6c20a5eb2794c0a7391bde50ba7c8c54b upstream.
dasd_eckd_build_check_tcw() allocates its request with
dasd_fmalloc_request(), but its out_err path frees it with
dasd_sfree_request(). The latter uses a different pool and therefor,
leading to invalid pointer arithmetic and a crash.
Use the matching dasd_ffree_request() instead.
The same error path also leaves start_priv->count incremented
without ever decrementing it again.
This leaks a permanent reference on every build failure.
Decrement it before freeing the request.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260722103704.1709668-1-sth@linux.ibm.com
Fixes: 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT")
Cc: stable@vger.kernel.org #4.7
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Fixes: 5e2b17e712cf ("s390/dasd: Add dynamic formatting support for ESE volumes")
Link: https://patch.msgid.link/20261112102608.1057852-4-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/s390/block/dasd_eckd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2594,7 +2594,8 @@ dasd_eckd_build_check_tcw(struct dasd_de
return cqr;
out_err:
- dasd_sfree_request(cqr, startdev);
+ start_priv->count--;
+ dasd_ffree_request(cqr, startdev);
return ERR_PTR(rc);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 785/990] s390/dasd: Dont trust userspace-supplied result field in format check
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (783 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 784/990] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 786/990] sched/deadline: Fix spurious -EPERM for migration-disabled tasks Greg Kroah-Hartman
` (67 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Jan Höppner,
Stefan Haberland, Jens Axboe
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <sth@linux.ibm.com>
commit 7cc2dda4f7aaf596c1796184649007151ff98f8d upstream.
BIODASDCHECKFMT used to copy the entire format_check_t struct from
userspace, including the result/unit/rec/num_records/blksize/
key_length fields that are output fields only.
dasd_eckd_format_evaluate_tracks() relies on cdata->result being zero
to decide whether to apply an index correction (i--/pos--) after a
successful check. A caller that pre-sets result to a non-zero value
can suppress that correction, leaving pos advanced past the last valid
entry; the (partially out-of-bounds) fmt_buffer[pos] fields are then
copied back to userspace, leaking heap contents.
Only expect is an Input field; copy just that member in and zero
the rest of cdata.
Fixes: 8fd575200db5 ("s390/dasd: Add new ioctl BIODASDCHECKFMT")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260722103704.1709668-1-sth@linux.ibm.com
Cc: stable@vger.kernel.org #4.7
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-5-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/s390/block/dasd_ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -304,7 +304,9 @@ static int dasd_ioctl_check_format(struc
goto out_err;
}
- if (copy_from_user(&cdata, argp, sizeof(cdata))) {
+ /* copy only input fields, clear the rest */
+ memset(&cdata, 0, sizeof(cdata));
+ if (copy_from_user(&cdata.expect, argp, sizeof(cdata.expect))) {
rc = -EFAULT;
goto out_err;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 786/990] sched/deadline: Fix spurious -EPERM for migration-disabled tasks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (784 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 785/990] s390/dasd: Dont trust userspace-supplied result field in format check Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 787/990] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE Greg Kroah-Hartman
` (66 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrea Parri, Peter Zijlstra (Intel),
Ingo Molnar, Sebastian Andrzej Siewior, Juri Lelli
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
commit 6616bffa9b52da1338cf8bff9882404e02b9e361 upstream.
sched_setattr() can refuse to make a task SCHED_DEADLINE with -EPERM,
even though the task's affinity covers the whole root domain. A retry
can succeed, but the error blames an affinity the task does not have.
__sched_setscheduler() tests p->cpus_ptr, which is not always the task's
affinity. When a task is scheduled out inside a migrate_disable() section,
migrate_disable_switch() points p->cpus_ptr at the current CPU until
migrate_enable(). On PREEMPT_RT every spinlock_t holder is in such a
section, so ordinary kernel work opens the window. Elsewhere, seccomp
filters run in one.
Test p->cpus_mask instead, which keeps the task's affinity and is what
sched_getaffinity() reports. This should be safe because an admitted
task's cpus_mask covers the root domain, so set_cpus_allowed_dl() moves
no bandwidth when migrate_enable() restores p->cpus_ptr.
The following program, run as root, had 553679, 453720 and 424623 of its
1000000 requests refused on three boots of a 4-CPU PREEMPT_RT guest, and
236182, 217174 and 237183 without PREEMPT_RT. With this applied the count
is 0, also with lockdep, and a task pinned to one CPU is still refused:
#define _GNU_SOURCE
#include <errno.h>
#include <linux/filter.h>
#include <linux/seccomp.h>
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/syscall.h>
#include <unistd.h>
#define REQUESTS 1000000
#define INSNS 300
struct attr {
uint32_t size, policy;
uint64_t flags;
int32_t nice;
uint32_t prio;
uint64_t runtime, deadline, period;
};
static volatile int stop;
static volatile pid_t target;
static long set(struct attr a)
{
a.size = sizeof(a);
return syscall(SYS_sched_setattr, target, &a, 0);
}
static void *worker(void *arg)
{
struct sock_filter f[INSNS + 1];
struct sock_fprog prog = { .len = INSNS + 1, .filter = f };
int i;
/* Reading the arguments keeps seccomp from caching the result */
for (i = 0; i < INSNS; i++)
f[i] = (struct sock_filter)
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
offsetof(struct seccomp_data, args));
f[INSNS] = (struct sock_filter)
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW);
syscall(SYS_seccomp, SECCOMP_SET_MODE_FILTER, 0, &prog);
target = syscall(SYS_gettid);
while (!stop)
syscall(SYS_getppid);
return arg;
}
static void *hog(void *arg)
{
while (!stop)
;
return arg;
}
int main(void)
{
pthread_t t[9];
long refused = 0;
int i;
pthread_create(&t[0], NULL, worker, NULL);
while (!target)
usleep(100);
for (i = 1; i < 9; i++)
pthread_create(&t[i], NULL, hog, NULL);
for (i = 0; i < REQUESTS; i++) {
/* SCHED_DEADLINE, 2us every 1s */
if (set((struct attr){ .policy = 6, .runtime = 2000,
.deadline = 1000000000,
.period = 1000000000 }) && errno == EPERM)
refused++;
set((struct attr){ .policy = 0 }); /* SCHED_OTHER */
}
stop = 1;
for (i = 0; i < 9; i++)
pthread_join(t[i], NULL);
printf("%ld of %d requests refused\n", refused, REQUESTS);
return 0;
}
An LLM helped find this bug and write this patch and its test.
Fixes: af449901b84c ("sched: Add migrate_disable()")
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261102135420.244745-1-parri.andrea@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/sched/syscalls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -638,7 +638,7 @@ change:
* the entire root_domain to become SCHED_DEADLINE. We
* will also fail if there's no bandwidth available.
*/
- if (!cpumask_subset(span, p->cpus_ptr) ||
+ if (!cpumask_subset(span, &p->cpus_mask) ||
rq->rd->dl_bw.bw == 0) {
retval = -EPERM;
goto unlock;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 787/990] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (785 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 786/990] sched/deadline: Fix spurious -EPERM for migration-disabled tasks Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 788/990] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler() Greg Kroah-Hartman
` (65 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Andrea Parri,
Peter Zijlstra (Intel), Ingo Molnar, Vincent Guittot
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
commit 8127ec8458df29bd702db602473042ccb9e619b9 upstream.
sched_setattr() accepts sched_util_min and sched_util_max values that do
not fit in uclamp_se::value. A single thread can do:
sched_setattr(max = 800) returns 0
sched_setattr(min = 0xfffffffe) returns 0
sched_getattr() min=2046 max=800
which leaves the minimum above both SCHED_CAPACITY_SCALE and the task's own
maximum.
The range check in uclamp_validate() relies on the + 1 wrapping -1, the
reset value, to 0:
if (util_min + 1 > SCHED_CAPACITY_SCALE + 1)
That only works for an unsigned type. util_min and util_max are int and
SCHED_CAPACITY_SCALE is a long, so every negative value passes the check,
and so does INT_MAX, whose + 1 wraps.
uclamp_se_set() then truncates what got through to the 11 bits of
uclamp_se::value, but computes the bucket from the full value. A minimum
of 0xfffff800 is stored as 0 in the top bucket, where uclamp_rq_max_value()
takes it for the highest active clamp once a higher value leaves the rq.
The rq clamp falls below what the remaining tasks requested, and emptying
their bucket trips the WARN_ON_ONCE() in uclamp_rq_dec_id(), without any
privilege:
WARNING: kernel/sched/core.c:1862 at dequeue_task+0x2a3/0x2b0, CPU#0: repro/126
Call Trace:
__schedule+0x933/0x1320
schedule+0x36/0x100
do_nanosleep+0x61/0x190
hrtimer_nanosleep+0xb5/0x1d0
Make util_min and util_max unsigned int, so that -1 is the only value that
wraps. The pair check below is unaffected, since it skips -1 explicitly and
anything else is at most SCHED_CAPACITY_SCALE by then.
Requests that were only accepted because of this now fail with -EINVAL.
The following program triggers the warning when run by any user outside
a child cpu cgroup. With this applied, its 0xfffff800 request fails with
-EINVAL and the warning no longer appears:
#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
struct attr {
uint32_t size, policy;
uint64_t flags;
int32_t nice;
uint32_t prio;
uint64_t runtime, deadline, period;
uint32_t util_min, util_max;
};
static volatile int stop;
static void set_min(uint32_t v)
{
/* KEEP_POLICY | KEEP_PARAMS | UTIL_CLAMP_MIN */
struct attr a = { .size = sizeof(a), .flags = 0x38, .util_min = v };
syscall(SYS_sched_setattr, 0, &a, 0);
}
static void burn(long us)
{
struct timespec s, n;
clock_gettime(CLOCK_MONOTONIC, &s);
do
clock_gettime(CLOCK_MONOTONIC, &n);
while ((n.tv_sec - s.tv_sec) * 1000000 +
(n.tv_nsec - s.tv_nsec) / 1000 < us);
}
static void *bogus(void *arg)
{
set_min(0xfffff800);
while (!stop)
burn(1000);
return arg;
}
static void *worker(void *arg)
{
long v = (long)arg;
set_min(v);
while (!stop) {
burn(v == 800 ? 300 : 1500);
usleep(100);
}
return arg;
}
int main(void)
{
pthread_t t[3];
cpu_set_t c;
int i;
CPU_ZERO(&c);
CPU_SET(0, &c);
sched_setaffinity(0, sizeof(c), &c);
pthread_create(&t[0], NULL, bogus, NULL);
usleep(50000);
pthread_create(&t[1], NULL, worker, (void *)500L);
pthread_create(&t[2], NULL, worker, (void *)800L);
sleep(15);
stop = 1;
for (i = 0; i < 3; i++)
pthread_join(t[i], NULL);
return 0;
}
An LLM helped find the warning and write this patch and its tests.
Fixes: 480a6ca2dc6e ("sched/uclamp: Allow to reset a task uclamp constraint value")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20261016062629.2102883-1-sh_def%40163.com
Link: https://patch.msgid.link/20261102134831.243255-1-parri.andrea@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/sched/syscalls.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -328,8 +328,8 @@ static inline void __setscheduler_dl_pi(
static int uclamp_validate(struct task_struct *p,
const struct sched_attr *attr)
{
- int util_min = p->uclamp_req[UCLAMP_MIN].value;
- int util_max = p->uclamp_req[UCLAMP_MAX].value;
+ unsigned int util_min = p->uclamp_req[UCLAMP_MIN].value;
+ unsigned int util_max = p->uclamp_req[UCLAMP_MAX].value;
if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) {
util_min = attr->sched_util_min;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 788/990] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (786 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 787/990] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 789/990] sctp: abort unordered partial delivery when its message is skipped Greg Kroah-Hartman
` (64 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Andrea Parri,
Peter Zijlstra (Intel), Ingo Molnar, Waiman Long, Kayra Cizmeci,
Juri Lelli
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Parri <parri.andrea@gmail.com>
commit f7141257dd67d4936f906a6cfd1d0007721f6898 upstream.
A sched_setattr() with SCHED_FLAG_KEEP_POLICY on a SCHED_DEADLINE task
unlocks cpuset_mutex twice if the task's policy changes concurrently:
WARNING: bad unlock balance detected!
7.4.0-rc1 #1 Not tainted
-------------------------------------
repro/126 is trying to release lock (cpuset_mutex) at:
[<ffffffff9a17cacc>] __sched_setscheduler+0x9cc/0xc40
but there are no more locks to release!
...
Call Trace:
print_unlock_imbalance_bug.part.0+0xfb/0x110
lock_release+0x286/0x2e0
__mutex_unlock_slowpath+0x1a/0x400
__sched_setscheduler+0x9cc/0xc40
__x64_sys_sched_setattr+0xa3/0x1b0
do_syscall_64+0x106/0x5f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
__sched_setscheduler() samples p->policy before taking any lock, and
restarts from the recheck label if p->policy differs under the rq lock.
The restart drops cpuset_mutex but leaves cpuset_locked set, so a pass
that no longer needs the mutex still unlocks it on its way out:
CPU 1 CPU 2
__sched_setscheduler(KEEP_POLICY)
policy = p->policy /* DEADLINE */
__sched_setscheduler(SCHED_OTHER)
p->policy = SCHED_OTHER
cpuset_locked = true
cpuset_lock()
rq = task_rq_lock(p)
oldpolicy != p->policy
cpuset_unlock()
goto recheck
/* no cpuset_lock() this time */
...
if (cpuset_locked)
cpuset_unlock()
Without CONFIG_DEBUG_MUTEXES, or CONFIG_DEBUG_RT_MUTEXES on PREEMPT_RT,
nothing warns. The second unlock still clears the owner field regardless
of who holds the mutex, so another task can lose cpuset_mutex inside its
critical section. Entering SCHED_DEADLINE needs CAP_SYS_NICE, but a
racing caller that owns the task does not need it if it samples a policy
other than SCHED_DEADLINE.
Clear cpuset_locked when dropping the mutex for the restart. This should be
safe because the flag is only tested on the paths leaving the next pass,
after that pass has set it again if it took the mutex.
The following program, run as root, reproduces the splat, which no longer
appears with this applied. On PREEMPT_RT it crashes the kernel within
seconds, which this also fixes:
#define _GNU_SOURCE
#include <pthread.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <unistd.h>
struct attr {
uint32_t size, policy;
uint64_t flags;
int32_t nice;
uint32_t prio;
uint64_t runtime, deadline, period;
};
static volatile int stop;
static volatile pid_t target;
static void set(struct attr a)
{
a.size = sizeof(a);
syscall(SYS_sched_setattr, target, &a, 0);
}
static void *sleeper(void *arg)
{
target = syscall(SYS_gettid);
while (!stop)
usleep(1000);
return arg;
}
static void *switcher(void *arg)
{
while (!stop) {
/* SCHED_DEADLINE, 2us every 1s */
set((struct attr){ .policy = 6, .runtime = 2000,
.deadline = 1000000000,
.period = 1000000000 });
set((struct attr){ .policy = 0 }); /* SCHED_OTHER */
}
return arg;
}
static void *racer(void *arg)
{
/* KEEP_POLICY | KEEP_PARAMS */
while (!stop)
set((struct attr){ .flags = 0x18 });
return arg;
}
int main(void)
{
pthread_t t[5];
int i;
pthread_create(&t[0], NULL, sleeper, NULL);
while (!target)
usleep(100);
pthread_create(&t[1], NULL, switcher, NULL);
for (i = 2; i < 5; i++)
pthread_create(&t[i], NULL, racer, NULL);
sleep(30);
stop = 1;
for (i = 0; i < 5; i++)
pthread_join(t[i], NULL);
return 0;
}
An LLM helped find the PREEMPT_RT crash and write this patch and its test.
Fixes: 111cd11bbc54 ("sched/cpuset: Bring back cpuset_mutex")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Waiman Long <longman@redhat.com>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Reviewed-by: Juri Lelli <juri.lelli@redhat.com>
Cc: stable@vger.kernel.org
Link: https://sashiko.dev/#/patchset/20261016062629.2102883-1-sh_def%40163.com
Link: https://patch.msgid.link/20261102134606.242743-1-parri.andrea@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/sched/syscalls.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -650,8 +650,10 @@ change:
if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
policy = oldpolicy = -1;
task_rq_unlock(rq, p, &rf);
- if (cpuset_locked)
+ if (cpuset_locked) {
cpuset_unlock();
+ cpuset_locked = false;
+ }
goto recheck;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 789/990] sctp: abort unordered partial delivery when its message is skipped
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (787 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 788/990] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler() Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 790/990] sctp: avoid requeueing pending control chunks Greg Kroah-Hartman
` (63 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Budding, Xin Long,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Budding <tim.budding@gmail.com>
commit 05852c8b70f2291a50bb3f740a66ce9caf9cb98d upstream.
When an I-FORWARD-TSN skips unordered messages on a stream,
sctp_intl_skip() only aborts the stream's unordered partial delivery if
the MID being delivered is lower than the skipped MID. If the skipped
message is the one being partially delivered, partial delivery stays in
progress: no PARTIAL_DELIVERY_ABORTED is sent, and the next unordered
message on the stream is delivered as the rest of the abandoned one.
Abort the partial delivery when the MID being delivered is at or below
the skipped MID, as the ordered case already does.
Reproduced on an unmodified kernel with the uo_pd test of the
sctp_ifwdtsn.sh selftest added later in this series; its partial
delivery checks pass with this fix. Reproduction and fix done with AI
assistance.
Fixes: de60fe910543 ("sctp: implement handle_ftsn for sctp_stream_interleave")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Budding <tim.budding@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261105050225.49292-2-tim.budding@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/stream_interleave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1255,7 +1255,7 @@ static void sctp_intl_skip(struct sctp_u
struct sctp_stream *stream = &ulpq->asoc->stream;
if (flags & SCTP_FTSN_U_BIT) {
- if (sin->pd_mode_uo && MID_lt(sin->mid_uo, mid)) {
+ if (sin->pd_mode_uo && !MID_lt(mid, sin->mid_uo)) {
sin->pd_mode_uo = 0;
sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
GFP_ATOMIC);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 790/990] sctp: avoid requeueing pending control chunks
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (788 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 789/990] sctp: abort unordered partial delivery when its message is skipped Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 791/990] sctp: fix ASCONF address change on single-homed hosts Greg Kroah-Hartman
` (62 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, stable, Xin Long, Kyle Zeng,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <kylebot@openai.com>
commit 665b4149e91b781a71bce8637c3a4d7d64dba05f upstream.
The T4 and RE-CONFIG timeout handlers take a reference to their cached
control chunk and submit it through SCTP_CMD_REPLY. A previous
transmission can still be on the control outqueue when output is corked
or suppressed, or when sctp_packet_transmit_chunk() could not append the
chunk.
sctp_outq_tail() then adds the same list node a second time. Re-adding a
non-tail entry can corrupt the list without being caught by the
insertion-time list checks. A subsequent flush or association teardown
can access an already freed chunk. The ASCONF path is reproducible by an
unprivileged SCTP socket owner in a user/network namespace, with KASAN
reporting a use-after-free in __sctp_outq_teardown().
Check sctp_chunk_pending() in both timeout handlers before taking the
extra reference and issuing SCTP_CMD_REPLY. If the chunk is already
linked, leave the existing entry for normal output processing. Keep
the remaining timer and error-handling commands unchanged. This also
covers RE-CONFIG retransmission after sctp_assoc_rm_peer() moves the
request to another transport and starts its timer.
The issue was found by an LLM.
Fixes: 2e3216cd54b1 ("sctp: Follow security requirement of responding with 1 packet")
Fixes: 7b9438de0cd4 ("sctp: add stream reconf timer")
Cc: stable@kernel.org
Suggested-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261107030532.32310-1-kylebot@openai.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/sm_statefuns.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1122,9 +1122,11 @@ enum sctp_disposition sctp_sf_send_recon
return SCTP_DISPOSITION_DELETE_TCB;
}
- sctp_chunk_hold(asoc->strreset_chunk);
- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
- SCTP_CHUNK(asoc->strreset_chunk));
+ if (!sctp_chunk_pending(asoc->strreset_chunk)) {
+ sctp_chunk_hold(asoc->strreset_chunk);
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+ SCTP_CHUNK(asoc->strreset_chunk));
+ }
sctp_add_cmd_sf(commands, SCTP_CMD_STRIKE, SCTP_TRANSPORT(transport));
return SCTP_DISPOSITION_CONSUME;
@@ -6194,9 +6196,11 @@ enum sctp_disposition sctp_sf_t4_timer_e
* chunk, it MUST be the same (including its serial number) as the last
* ASCONF sent.
*/
- sctp_chunk_hold(asoc->addip_last_asconf);
- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
- SCTP_CHUNK(asoc->addip_last_asconf));
+ if (!sctp_chunk_pending(asoc->addip_last_asconf)) {
+ sctp_chunk_hold(asoc->addip_last_asconf);
+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+ SCTP_CHUNK(asoc->addip_last_asconf));
+ }
/* ADDIP 4.1 B5) Restart the T-4 RTO timer. Note that if a different
* destination is selected, then the RTO used will be that of the new
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 791/990] sctp: fix ASCONF address change on single-homed hosts
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (789 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 790/990] sctp: avoid requeueing pending control chunks Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 792/990] sctp: fix I-FORWARD-TSN handling of fragments on other streams Greg Kroah-Hartman
` (61 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Andrey Misiurov, Xin Long,
Dave Miller
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <andrey.misyrov@gmail.com>
commit 5175b2fb34c77cf2cd56a290affa45412cb3a228 upstream.
Commit 9b2854f86f0b ("sctp: don't free the ASCONF's own transport in
DEL-IP processing") refuses a DEL-IP of the transport the ASCONF was
located by, so that a later wildcard DEL-IP cannot use it after free.
This also breaks the single-homed address change (RFC 5061 5.3.2). The
host sends [Address Parameter L] [ADD-IP S] [DEL-IP L], the association
is located by L, and DEL-IP L is now refused. The sender never gets an
all-success ASCONF-ACK, keeps src_out_of_asoc_ok set and stops sending
data, so the association stalls.
Fix the wildcard DEL-IP instead: look up the transport of the packet
source rather than reusing asconf->transport. Both DEL-IP paths can
now free asconf->transport, and chunks bundled after the ASCONF still
use it, so point it at a surviving transport: the packet source for the
wildcard delete, the primary path for a plain one.
Found by manual code inspection while reviewing a backport of commit
9b2854f86f0b; reproduced on a two-namespace single-homed renumber.
Fixes: 9b2854f86f0b ("sctp: don't free the ASCONF's own transport in DEL-IP processing")
Cc: stable@vger.kernel.org
Signed-off-by: Andrey Misiurov <andrey.misyrov@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/sm_make_chunk.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3157,9 +3157,12 @@ static __be16 sctp_process_asconf_param(
* packet MUST be deleted.
*/
if (af->is_any(&addr)) {
- sctp_assoc_set_primary(asoc, asconf->transport);
- sctp_assoc_del_nonprimary_peers(asoc,
- asconf->transport);
+ peer = sctp_assoc_lookup_paddr(asoc, &asconf->source);
+ if (!peer)
+ return SCTP_ERROR_REQ_REFUSED;
+ sctp_assoc_set_primary(asoc, peer);
+ sctp_assoc_del_nonprimary_peers(asoc, peer);
+ asconf->transport = peer;
return SCTP_ERROR_NO_ERROR;
}
@@ -3172,13 +3175,9 @@ static __be16 sctp_process_asconf_param(
if (!peer)
return SCTP_ERROR_DNS_FAILED;
- /* Don't free asconf->transport; a later wildcard DEL-IP
- * parameter reuses it.
- */
- if (peer == asconf->transport)
- return SCTP_ERROR_REQ_REFUSED;
-
sctp_assoc_rm_peer(asoc, peer);
+ if (asconf->transport == peer)
+ asconf->transport = asoc->peer.primary_path;
break;
case SCTP_PARAM_SET_PRIMARY:
/* ADDIP Section 4.2.4
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 792/990] sctp: fix I-FORWARD-TSN handling of fragments on other streams
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (790 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 791/990] sctp: fix ASCONF address change on single-homed hosts Greg Kroah-Hartman
@ 2026-11-25 14:35 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 793/990] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED Greg Kroah-Hartman
` (60 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:35 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Tim Budding, Xin Long,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Budding <tim.budding@gmail.com>
commit 5b9cfc6491a6e32e7315dc222992c7dbd5baa3e9 upstream.
sctp_report_iftsn() incorrectly frees queued I-DATA fragments in two
cases. First, it drops any queued fragments with TSN less than or equal
to the New Cumulative TSN. This prevents reconstruction of messages
still being received on other streams and can fully block an ordered
stream. Second, it calls sctp_intl_abort_pd() if the New Cumulative TSN
equals the highest TSN seen. This check exists for association resets
but can be inadvertently triggered by any I-FORWARD-TSN that arrives
before data with a higher TSN, causing data loss and, if a partial
delivery is in progress on an ordered stream, an aborted association.
Fix the first by freeing fragments from sctp_intl_skip() based on
stream, U bit, and MID instead of TSN. Fix the second by moving the call
to sctp_intl_abort_pd() from sctp_report_iftsn() to the corresponding
reset handlers.
Observed in real use as unexpected message loss. Reproduced on an
unmodified kernel with the sctp_ifwdtsn.sh selftest added later in this
series, which passes with this fix. Reproduction and fix done with AI
assistance.
Fixes: 47b20a88566f ("sctp: implement report_ftsn for sctp_stream_interleave")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Budding <tim.budding@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261105050225.49292-4-tim.budding@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/stream.c | 2 ++
net/sctp/stream_interleave.c | 32 +++++++++++---------------------
2 files changed, 13 insertions(+), 21 deletions(-)
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -749,6 +749,7 @@ struct sctp_chunk *sctp_process_strreset
*/
max_tsn_seen = sctp_tsnmap_get_max_tsn_seen(&asoc->peer.tsn_map);
asoc->stream.si->report_ftsn(&asoc->ulpq, max_tsn_seen);
+ asoc->stream.si->abort_pd(&asoc->ulpq, GFP_ATOMIC);
/* G1: Compute an appropriate value for the Receiver's Next TSN -- the
* TSN that the peer should use to send the next DATA chunk. The
@@ -1028,6 +1029,7 @@ struct sctp_chunk *sctp_process_strreset
LIST_HEAD(temp);
asoc->stream.si->report_ftsn(&asoc->ulpq, mtsn);
+ asoc->stream.si->abort_pd(&asoc->ulpq, GFP_ATOMIC);
sctp_tsnmap_init(&asoc->peer.tsn_map,
SCTP_TSN_MAP_INITIAL,
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1203,28 +1203,21 @@ static void sctp_report_fwdtsn(struct sc
sctp_ulpq_abort_pd(ulpq, GFP_ATOMIC);
}
-static void sctp_intl_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 ftsn)
+static void sctp_intl_reasm_flush_mid(struct sk_buff_head *reasm, __u16 sid,
+ __u32 mid)
{
struct sk_buff *pos, *tmp;
- skb_queue_walk_safe(&ulpq->reasm, pos, tmp) {
+ skb_queue_walk_safe(reasm, pos, tmp) {
struct sctp_ulpevent *event = sctp_skb2event(pos);
- __u32 tsn = event->tsn;
- if (TSN_lte(tsn, ftsn)) {
- __skb_unlink(pos, &ulpq->reasm);
- sctp_ulpevent_free(event);
- }
- }
+ if (event->stream < sid)
+ continue;
+ if (event->stream > sid || MID_lt(mid, event->mid))
+ break;
- skb_queue_walk_safe(&ulpq->reasm_uo, pos, tmp) {
- struct sctp_ulpevent *event = sctp_skb2event(pos);
- __u32 tsn = event->tsn;
-
- if (TSN_lte(tsn, ftsn)) {
- __skb_unlink(pos, &ulpq->reasm_uo);
- sctp_ulpevent_free(event);
- }
+ __skb_unlink(pos, reasm);
+ sctp_ulpevent_free(event);
}
}
@@ -1232,11 +1225,6 @@ static void sctp_report_iftsn(struct sct
{
/* Move the Cumulattive TSN Ack ahead. */
sctp_tsnmap_skip(&ulpq->asoc->peer.tsn_map, ftsn);
- /* purge the fragmentation queue */
- sctp_intl_reasm_flushtsn(ulpq, ftsn);
- /* abort only when it's for all data */
- if (ftsn == sctp_tsnmap_get_max_tsn_seen(&ulpq->asoc->peer.tsn_map))
- sctp_intl_abort_pd(ulpq, GFP_ATOMIC);
}
static void sctp_handle_fwdtsn(struct sctp_ulpq *ulpq, struct sctp_chunk *chunk)
@@ -1260,6 +1248,7 @@ static void sctp_intl_skip(struct sctp_u
sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
GFP_ATOMIC);
}
+ sctp_intl_reasm_flush_mid(&ulpq->reasm_uo, sid, mid);
return;
}
@@ -1271,6 +1260,7 @@ static void sctp_intl_skip(struct sctp_u
sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x0, GFP_ATOMIC);
}
+ sctp_intl_reasm_flush_mid(&ulpq->reasm, sid, mid);
sctp_mid_skip(stream, in, sid, mid);
sctp_intl_reap_ordered(ulpq, sid);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 793/990] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (791 preceding siblings ...)
2026-11-25 14:35 ` [PATCH 6.18 792/990] sctp: fix I-FORWARD-TSN handling of fragments on other streams Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 794/990] sctp: reset stored flag for each association Greg Kroah-Hartman
` (59 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Sashiko, Tim Budding, Xin Long,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Budding <tim.budding@gmail.com>
commit 3097fba868019924e92b8786ebd473992565f015 upstream.
When an I-FORWARD-TSN skips the message being partially delivered on a
stream, sctp_intl_skip() passes the MID from the I-FORWARD-TSN to the
PARTIAL_DELIVERY_ABORTED notification as pdapi_seq. That MID is the
highest one skipped on the stream, so when more than one message is
skipped, the notification names a later message instead of the one
whose partial delivery was aborted.
Report the MID being partially delivered, sin->mid_uo or sin->mid,
instead.
Reproduced on an unmodified kernel with the pdapi and pdapi_uo tests of
the sctp_ifwdtsn.sh selftest added later in this series, which pass
with this fix. Reproduction and fix done with AI assistance.
Fixes: de60fe910543 ("sctp: implement handle_ftsn for sctp_stream_interleave")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/179293012867.3134.16497481637722705271@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Tim Budding <tim.budding@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261105050225.49292-3-tim.budding@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/stream_interleave.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -1245,7 +1245,7 @@ static void sctp_intl_skip(struct sctp_u
if (flags & SCTP_FTSN_U_BIT) {
if (sin->pd_mode_uo && !MID_lt(mid, sin->mid_uo)) {
sin->pd_mode_uo = 0;
- sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x1,
+ sctp_intl_stream_abort_pd(ulpq, sid, sin->mid_uo, 0x1,
GFP_ATOMIC);
}
sctp_intl_reasm_flush_mid(&ulpq->reasm_uo, sid, mid);
@@ -1257,7 +1257,7 @@ static void sctp_intl_skip(struct sctp_u
if (sin->pd_mode) {
sin->pd_mode = 0;
- sctp_intl_stream_abort_pd(ulpq, sid, mid, 0x0, GFP_ATOMIC);
+ sctp_intl_stream_abort_pd(ulpq, sid, sin->mid, 0x0, GFP_ATOMIC);
}
sctp_intl_reasm_flush_mid(&ulpq->reasm, sid, mid);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 794/990] sctp: reset stored flag for each association
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (792 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 793/990] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 795/990] LoongArch: kexec_file: Fix a modified cmdline leak Greg Kroah-Hartman
` (58 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Xiang Mei, Weiming Shi, Xin Long,
Jakub Kicinski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <bestswngs@gmail.com>
commit 173712d868eb20628ad82deb07f6829a68a9e064 upstream.
sctp_send_asconf_del_ip() walks every association on an endpoint. The
stored flag records that the current association took the single-homed
deferral path and therefore did not allocate an ASCONF chunk. It is
currently scoped to the whole function. Once one association sets it,
later eligible multihomed associations allocate chunks but skip
sctp_send_asconf(), leaking each chunk and its skb.
Reset stored for every association so only an association taking the
deferral path skips transmission. In an A/B kmemleak test, the
vulnerable kernel reported 210 leaked objects from this call path and the
fixed kernel reported none.
Cc: stable@vger.kernel.org
Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host")
Reported-by: Xiang Mei <xmei5@asu.edu>
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20261108161149.2774119-1-bestswngs@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/sctp/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -808,7 +808,6 @@ static int sctp_send_asconf_del_ip(struc
struct sctp_sockaddr_entry *saddr;
int i;
int retval = 0;
- int stored = 0;
chunk = NULL;
sp = sctp_sk(sk);
@@ -821,6 +820,7 @@ static int sctp_send_asconf_del_ip(struc
__func__, sk, addrs, addrcnt);
list_for_each_entry(asoc, &ep->asocs, asocs) {
+ int stored = 0;
if (!asoc->peer.asconf_capable)
continue;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 795/990] LoongArch: kexec_file: Fix a modified cmdline leak
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (793 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 794/990] sctp: reset stored flag for each association Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 796/990] LoongArch: kexec_file: Fix elf_headers memory leak in retry loop Greg Kroah-Hartman
` (57 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jinjie Ruan, Huacai Chen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <ruanjinjie@huawei.com>
commit b7000844b374a1ab75f0cc561f1d4d321cd6eeb0 upstream.
machine_kexec_prepare() copies it to KEXEC_CMDLINE_ADDR and overwrites
the pointer. Free the heap buffer after the copy here.
Cc: stable@vger.kernel.org
Fixes: d162feec6b6e ("LoongArch: Add preparatory infrastructure for kexec_file")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/loongarch/kernel/machine_kexec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/loongarch/kernel/machine_kexec.c b/arch/loongarch/kernel/machine_kexec.c
index 1883cae93bc3..19ccc91b6f2a 100644
--- a/arch/loongarch/kernel/machine_kexec.c
+++ b/arch/loongarch/kernel/machine_kexec.c
@@ -14,6 +14,7 @@
#include <linux/mm.h>
#include <linux/of_fdt.h>
#include <linux/reboot.h>
+#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/sched/task_stack.h>
@@ -56,6 +57,7 @@ int machine_kexec_prepare(struct kimage *kimage)
*/
memcpy((void *)KEXEC_CMDLINE_ADDR, (void *)kimage->arch.cmdline_ptr,
strlen((char *)kimage->arch.cmdline_ptr) + 1);
+ kfree((void *)kimage->arch.cmdline_ptr);
kimage->arch.cmdline_ptr = (unsigned long)KEXEC_CMDLINE_ADDR;
} else {
/* Find the command line */
--
2.56.1
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 796/990] LoongArch: kexec_file: Fix elf_headers memory leak in retry loop
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (794 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 795/990] LoongArch: kexec_file: Fix a modified cmdline leak Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 797/990] LoongArch: Restore KFENCE pages through DMW on resume Greg Kroah-Hartman
` (56 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Jinjie Ruan, Huacai Chen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <ruanjinjie@huawei.com>
commit 065dd1636abef6b9962fd5af82accac69850bbe8 upstream.
A retry allocates new elf headers and overwrites image->elf_headers,
leaking the previous buffer. Free it before assigning here.
Cc: stable@vger.kernel.org
Fixes: 55d990f0084c ("LoongArch: Add EFI binary support for kexec_file")
Link: https://sashiko.dev/#/patchset/20260729031235.2840255-1-ruanjinjie%40huawei.com
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/loongarch/kernel/machine_kexec_file.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/arch/loongarch/kernel/machine_kexec_file.c
+++ b/arch/loongarch/kernel/machine_kexec_file.c
@@ -182,6 +182,10 @@ int load_other_segments(struct kimage *i
vfree(headers);
goto out_err;
}
+
+ if (unlikely(image->elf_headers))
+ vfree(image->elf_headers);
+
image->elf_headers = headers;
image->elf_load_addr = kbuf.mem;
image->elf_headers_sz = headers_sz;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 797/990] LoongArch: Restore KFENCE pages through DMW on resume
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (795 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 796/990] LoongArch: kexec_file: Fix elf_headers memory leak in retry loop Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 798/990] LoongArch: KVM: Propagate real error code in kvm_pch_pic_create() Greg Kroah-Hartman
` (55 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mike Rapoport (Microsoft),
Huacai Chen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Rapoport (Microsoft) <rppt@kernel.org>
commit 40d7a3e63c3d88b43e9115d23d9937dd506bbd02 upstream.
With KFENCE enabled, resume from hibernation triggers KFENCE reports
while swsusp_asm_resume() copies the image pages, for example:
BUG: KFENCE: use-after-free write in swsusp_asm_resume+0x20/0x94
Use-after-free write at 0x00000000a57ee925 (in kfence-#254):
swsusp_asm_resume+0x20/0x94
hibernation_restore+0x128/0x1a0
load_image_and_restore+0x6c/0xc8
software_resume+0x240/0x260
do_one_initcall+0x68/0x200
kernel_init_freeable+0x26c/0x304
kernel_init+0x20/0x134
ret_from_kernel_thread+0x24/0x1d0
ret_from_kernel_thread_asm+0xc/0x98
During resume from hibernation, the image pages that occupy physical
pages used by the restore kernel are first loaded into free pages and
then, as the very last step, swsusp_asm_resume() copies them to their
final location pointed to by pbe->orig_address, which the hibernation
core sets to page_address() of the page in the restore kernel.
The early KFENCE pool is allocated from memblock and normally occupies
the same physical pages in the restore kernel and in the image kernel,
so these pages are usually copied by swsusp_asm_resume().
The KFENCE pool is remapped into the KFENCE area above vm_map_base and
set_page_address() adjusts page->virtual so that page_address() returns
the page-table mapped alias rather than the DMW virtual address of the
pool pages.
Hence, pbe->orig_address of KFENCE pages points to that alias and
swsusp_asm_resume() writes them through the page tables. But:
* the copy loop overwrites the kernel page tables, so a TLB refill for
the KFENCE alias may use a partially restored page table
* the KFENCE pool pages that are protected in the restore kernel fault
in the middle of the copy
Convert pbe->orig_address to DMW addresses before starting the copy.
Cc: stable@vger.kernel.org
Fixes: 0ca84aeaee15 ("LoongArch: Make {virt, phys, page, pfn} translation work with KFENCE")
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/loongarch/power/hibernate.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/arch/loongarch/power/hibernate.c
+++ b/arch/loongarch/power/hibernate.c
@@ -59,6 +59,12 @@ extern int swsusp_asm_resume(void);
int swsusp_arch_resume(void)
{
+#ifdef CONFIG_KFENCE
+ struct pbe *pbe;
+
+ for (pbe = restore_pblist; pbe; pbe = pbe->next)
+ pbe->orig_address = __va(virt_to_phys(pbe->orig_address));
+#endif
/* Avoid TLB mismatch during and after kernel resume */
local_flush_tlb_all();
return swsusp_asm_resume();
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 798/990] LoongArch: KVM: Propagate real error code in kvm_pch_pic_create()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (796 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 797/990] LoongArch: Restore KFENCE pages through DMW on resume Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 799/990] LoongArch: KVM: Reject repeated PCH-PIC CTRL_INIT Greg Kroah-Hartman
` (54 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bibo Mao, Tao Cui, Huacai Chen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <cuitao@kylinos.cn>
commit 20f3bf3d3dce16f43b82881293586ce7d73982b6 upstream.
The real error code of kvm_setup_default_irq_routing() is replaced by
kvm_pch_pic_create() with a fixed -ENOMEM. Return the actual error code,
as kvm_eiointc_create() already does; while the kvm_ipi_create() case is
fixed separately by "Return the actual error code in kvm_ipi_create()"
(Chaithanya Lagisetty).
Cc: stable@vger.kernel.org
Fixes: e785dfacf7e7 ("LoongArch: KVM: Add PCHPIC device support")
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/loongarch/kvm/intc/pch_pic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/loongarch/kvm/intc/pch_pic.c
+++ b/arch/loongarch/kvm/intc/pch_pic.c
@@ -436,7 +436,7 @@ static int kvm_pch_pic_create(struct kvm
ret = kvm_setup_default_irq_routing(kvm);
if (ret)
- return -ENOMEM;
+ return ret;
s = kzalloc(sizeof(struct loongarch_pch_pic), GFP_KERNEL);
if (!s)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 799/990] LoongArch: KVM: Reject repeated PCH-PIC CTRL_INIT
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (797 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 798/990] LoongArch: KVM: Propagate real error code in kvm_pch_pic_create() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 800/990] tracing/perf: Clear stop state in perf_trace_add() Greg Kroah-Hartman
` (53 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bibo Mao, Tao Cui, Huacai Chen
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Cui <cuitao@kylinos.cn>
commit 422e532809572ba1043192bf6a0c653bc68b3140 upstream.
KVM_DEV_LOONGARCH_PCH_PIC_CTRL_INIT has no guard against repeated
invocation: every call overwrites pch_pic_base and registers the same
kvm_io_device on the MMIO bus at the new base address, while the
kvm_pch_pic_destroy() unregisters only one bus range. After a repeated
init, MMIO to the stale ranges computes its register offset against the
new base address and silently reads 0 / drops writes, and the leftover
bus entries persist until the VM is destroyed.
Reject repeated initialization with -EEXIST, using the initialized
state of the kvm_io_device as the indicator. The check, the MMIO base
update and the bus registration are serialized by slots_lock, and the
real registration error is propagated instead of being replaced with
-EFAULT. On a registration failure the base addr and the device state
are rolled back so that a retry can start over.
Cc: stable@vger.kernel.org
Fixes: d206d9514873 ("LoongArch: KVM: Add PCHPIC user mode read and write functions")
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/loongarch/kvm/intc/pch_pic.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- a/arch/loongarch/kvm/intc/pch_pic.c
+++ b/arch/loongarch/kvm/intc/pch_pic.c
@@ -273,16 +273,25 @@ static int kvm_pch_pic_init(struct kvm_d
struct kvm_io_device *device;
struct loongarch_pch_pic *s = dev->kvm->arch.pch_pic;
- s->pch_pic_base = addr;
device = &s->device;
+ mutex_lock(&kvm->slots_lock);
+ if (s->device.ops) {
+ ret = -EEXIST;
+ goto out;
+ }
+ s->pch_pic_base = addr;
/* init device by pch pic writing and reading ops */
kvm_iodevice_init(device, &kvm_pch_pic_ops);
- mutex_lock(&kvm->slots_lock);
/* register pch pic device */
ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, addr, PCH_PIC_SIZE, device);
+ if (ret) {
+ s->pch_pic_base = 0;
+ s->device.ops = NULL;
+ }
+out:
mutex_unlock(&kvm->slots_lock);
- return (ret < 0) ? -EFAULT : 0;
+ return ret;
}
/* used by user space to get or set pch pic registers */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 800/990] tracing/perf: Clear stop state in perf_trace_add()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (798 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 799/990] LoongArch: KVM: Reject repeated PCH-PIC CTRL_INIT Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 801/990] tracing/uprobes: Fix memory leak of tail in __trace_uprobe_create() Greg Kroah-Hartman
` (52 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Francesco Nigro, Paolo Bertinetti,
Peter Zijlstra (Intel)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bertinetti <paolobertinetti200f4@proton.me>
commit fb3f6b21b04f1e8b8982e90e9bf62db9f0dcb5e4 upstream.
Since commit 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage"),
__perf_event_overflow() stops the event with pmu->stop() and disables
it when the PERF_EVENT_IOC_REFRESH limit is reached. When userspace
re-arms the event with PERF_EVENT_IOC_REFRESH, the event is enabled
again and pmu->add() is called with PERF_EF_START.
perf_trace_add() sets PERF_HES_STOPPED when PERF_EF_START is missing,
but never clears it. The flag set by pmu->stop() stays, and
perf_tp_event_match() drops every later hit. A tracepoint, kprobe or
uprobe event re-armed this way delivers only its first overflow. This
breaks self-profilers such as async-profiler, and the "Event re-armed
with PERF_EVENT_IOC_REFRESH" perf test fails:
1000 events, count 1, 1 overflows (1 POLL_HUP), re-arm errno 0
Tracepoint event : FAILED!
Set the state from PERF_EF_START on every add, as perf_swevent_add()
does.
Fixes: 18dbcbfabfff ("perf: Fix the POLL_HUP delivery breakage")
Closes: https://lore.kernel.org/r/20261021131006.2101248-1-nigro.fra@gmail.com/
Reported-by: Francesco Nigro <nigro.fra@gmail.com>
Assisted-by: LLM
Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://github.com/async-profiler/async-profiler/issues/1813
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261103130732.764081-2-paolobertinetti200f4@proton.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_event_perf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -354,8 +354,7 @@ int perf_trace_add(struct perf_event *p_
struct trace_event_call *tp_event = p_event->tp_event;
struct hw_perf_event *hwc = &p_event->hw;
- if (!(flags & PERF_EF_START))
- p_event->hw.state = PERF_HES_STOPPED;
+ hwc->state = (flags & PERF_EF_START) ? 0 : PERF_HES_STOPPED;
if (is_sampling_event(p_event)) {
hwc->last_period = hwc->sample_period;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 801/990] tracing/uprobes: Fix memory leak of tail in __trace_uprobe_create()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (799 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 800/990] tracing/perf: Clear stop state in perf_trace_add() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 802/990] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field() Greg Kroah-Hartman
` (51 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Sashiko, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit c15120853eebbda98f3fe1f1e59370439c6c4447 upstream.
When generating a default event name in __trace_uprobe_create(), tail is
allocated with kstrdup() without __free(kfree). If the subsequent
kmalloc() for buf fails, the function returns -ENOMEM immediately and
leaks tail.
Declare tail with __free(kfree) so it is automatically freed on all
exit paths.
Link: https://lore.kernel.org/all/179455856197.403392.16569431894958507645.stgit@devnote2/
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-204240@kernel.org/
Fixes: 97e8230f89a3 ("tracing: uprobe-event: Allocate string buffers from heap")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_uprobe.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -666,7 +666,7 @@ static int __trace_uprobe_create(int arg
}
if (!event) {
- char *tail;
+ char *tail __free(kfree) = NULL;
char *ptr;
tail = kstrdup(kbasename(filename), GFP_KERNEL);
@@ -682,7 +682,6 @@ static int __trace_uprobe_create(int arg
goto fail_mem;
snprintf(buf, MAX_EVENT_NAME_LEN, "%c_%s_0x%lx", 'p', tail, offset);
event = buf;
- kfree(tail);
}
argc -= 2;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 802/990] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (800 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 801/990] tracing/uprobes: Fix memory leak of tail in __trace_uprobe_create() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 803/990] tracing/eprobe: Disallow attaching eprobes to fprobe events Greg Kroah-Hartman
` (50 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit a0f836eea463d4c468edb58eedb03911c9c0791d upstream.
Because the kernel is built with -funsigned-char, plain 'char' is
unsigned on all architectures. Reading 1-byte signed trace event fields
via *(char *)addr in get_event_field() therefore zero-extends instead of
sign-extending negative s8 values.
Use explicit fixed-width integer types (s8/u8, s16/u16, s32/u32) when
reading event fields.
Link: https://lore.kernel.org/all/179455852542.403392.15666310371702309464.stgit@devnote2/
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_eprobe.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -328,21 +328,21 @@ get_event_field(struct fetch_insn *code,
switch (field->size) {
case 1:
if (field->is_signed)
- val = *(char *)addr;
+ val = *(s8 *)addr;
else
- val = *(unsigned char *)addr;
+ val = *(u8 *)addr;
break;
case 2:
if (field->is_signed)
- val = *(short *)addr;
+ val = *(s16 *)addr;
else
- val = *(unsigned short *)addr;
+ val = *(u16 *)addr;
break;
case 4:
if (field->is_signed)
- val = *(int *)addr;
+ val = *(s32 *)addr;
else
- val = *(unsigned int *)addr;
+ val = *(u32 *)addr;
break;
default:
if (field->size == sizeof(long)) {
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 803/990] tracing/eprobe: Disallow attaching eprobes to fprobe events
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (801 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 802/990] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 804/990] tracing/probes: Check enabled and busy state before unlinking sibling probes Greg Kroah-Hartman
` (49 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit 92d9fa0ed69e1f724feed908bd0a462a42df4b88 upstream.
Event probes (eprobes) are not allowed to attach to other dynamic probe
events (kprobes, uprobes, and eprobes) to avoid recursive probe chains
and lifecycle dependencies. However, when fprobe events were introduced,
TRACE_EVENT_FL_FPROBE was omitted from the exclusion mask in
find_and_get_event(), allowing eprobes to attach to fprobe and tprobe
events.
Exclude TRACE_EVENT_FL_FPROBE events in find_and_get_event().
Link: https://lore.kernel.org/all/179455853457.403392.14549390017750529531.stgit@devnote2/
Fixes: 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_eprobe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -756,7 +756,8 @@ find_and_get_event(const char *system, c
(TRACE_EVENT_FL_IGNORE_ENABLE |
TRACE_EVENT_FL_KPROBE |
TRACE_EVENT_FL_UPROBE |
- TRACE_EVENT_FL_EPROBE))
+ TRACE_EVENT_FL_EPROBE |
+ TRACE_EVENT_FL_FPROBE))
continue;
if (!tp_event->class->system ||
strcmp(system, tp_event->class->system))
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 804/990] tracing/probes: Check enabled and busy state before unlinking sibling probes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (802 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 803/990] tracing/eprobe: Disallow attaching eprobes to fprobe events Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 805/990] tracing/probes: Enable newly appended probe when target event is enabled Greg Kroah-Hartman
` (48 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit f1d9b7a3fe99b4228acdbab3c744c29f7ffe86ef upstream.
When a multiprobe event is enabled or referenced (for example, by an
eprobe, trigger, or open tracefs file) and a user attempts to delete the
event or one of its probes via dynamic_events, checking
trace_probe_has_sibling() before the enabled and busy checks allows the
first probe to be unlinked and freed while the event is still active,
only returning -EBUSY on the last sibling probe. For uprobe events,
unlinking and freeing an enabled sibling probe without unregistering its
uprobe_consumer also causes a use-after-free.
Ensure all four probe types (kprobe, fprobe, uprobe, and eprobe) verify
that the event is neither enabled nor busy before unlinking any sibling
probe.
Link: https://lore.kernel.org/all/179455848898.403392.17675270675769076596.stgit@devnote2/
Fixes: ca89bc071d5e ("tracing/kprobe: Add multi-probe per event support")
Fixes: 41af3cf587f4 ("tracing/uprobe: Add multi-probe per uprobe event support")
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Fixes: 334e5519c375 ("tracing/probes: Add fprobe events for tracing function entry and exit.")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_eprobe.c | 12 ++++++++----
kernel/trace/trace_fprobe.c | 8 ++++----
kernel/trace/trace_kprobe.c | 8 ++++----
kernel/trace/trace_uprobe.c | 8 ++++++--
4 files changed, 22 insertions(+), 14 deletions(-)
--- a/kernel/trace/trace_eprobe.c
+++ b/kernel/trace/trace_eprobe.c
@@ -89,14 +89,18 @@ static int eprobe_dyn_event_show(struct
static int unregister_trace_eprobe(struct trace_eprobe *ep)
{
- /* If other probes are on the event, just unregister eprobe */
- if (trace_probe_has_sibling(&ep->tp))
- goto unreg;
-
/* Enabled event can not be unregistered */
if (trace_probe_is_enabled(&ep->tp))
return -EBUSY;
+ /* If there's a reference to the dynamic event */
+ if (trace_event_dyn_busy(trace_probe_event_call(&ep->tp)))
+ return -EBUSY;
+
+ /* If other probes are on the event, just unregister eprobe */
+ if (trace_probe_has_sibling(&ep->tp))
+ goto unreg;
+
/* Will fail if probe is being used by ftrace or perf */
if (trace_probe_unregister_event_call(&ep->tp))
return -EBUSY;
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -857,10 +857,6 @@ static void __unregister_trace_fprobe(st
/* Unregister a trace_probe and probe_event */
static int unregister_trace_fprobe(struct trace_fprobe *tf)
{
- /* If other probes are on the event, just unregister fprobe */
- if (trace_probe_has_sibling(&tf->tp))
- goto unreg;
-
/* Enabled event can not be unregistered */
if (trace_probe_is_enabled(&tf->tp))
return -EBUSY;
@@ -869,6 +865,10 @@ static int unregister_trace_fprobe(struc
if (trace_event_dyn_busy(trace_probe_event_call(&tf->tp)))
return -EBUSY;
+ /* If other probes are on the event, just unregister fprobe */
+ if (trace_probe_has_sibling(&tf->tp))
+ goto unreg;
+
/* Will fail if probe is being used by ftrace or perf */
if (unregister_fprobe_event(tf))
return -EBUSY;
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -538,10 +538,6 @@ static void __unregister_trace_kprobe(st
/* Unregister a trace_probe and probe_event */
static int unregister_trace_kprobe(struct trace_kprobe *tk)
{
- /* If other probes are on the event, just unregister kprobe */
- if (trace_probe_has_sibling(&tk->tp))
- goto unreg;
-
/* Enabled event can not be unregistered */
if (trace_probe_is_enabled(&tk->tp))
return -EBUSY;
@@ -550,6 +546,10 @@ static int unregister_trace_kprobe(struc
if (trace_event_dyn_busy(trace_probe_event_call(&tk->tp)))
return -EBUSY;
+ /* If other probes are on the event, just unregister kprobe */
+ if (trace_probe_has_sibling(&tk->tp))
+ goto unreg;
+
/* Will fail if probe is being used by ftrace or perf */
if (unregister_kprobe_event(tk))
return -EBUSY;
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -396,13 +396,17 @@ static int unregister_trace_uprobe(struc
{
int ret;
- if (trace_probe_has_sibling(&tu->tp))
- goto unreg;
+ /* Enabled event can not be unregistered */
+ if (trace_probe_is_enabled(&tu->tp))
+ return -EBUSY;
/* If there's a reference to the dynamic event */
if (trace_event_dyn_busy(trace_probe_event_call(&tu->tp)))
return -EBUSY;
+ if (trace_probe_has_sibling(&tu->tp))
+ goto unreg;
+
ret = unregister_uprobe_event(tu);
if (ret)
return ret;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 805/990] tracing/probes: Enable newly appended probe when target event is enabled
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (803 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 804/990] tracing/probes: Check enabled and busy state before unlinking sibling probes Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 806/990] tracing/probes: Fix missing BTF kind checks in char pointer/array helpers Greg Kroah-Hartman
` (47 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit 72d3a5cb0cd7335553549aaffecc683e3ecc0c43 upstream.
Unlike kprobe events, fprobe and uprobe events only register their
underlying probes when the trace event is enabled. When a new probe is
appended to an existing multiprobe fprobe or uprobe event that is
already enabled, the appended probe is linked into the event's probe
list without being registered.
As a result, the newly appended probe never fires until the event is
disabled and re-enabled. Moreover, disabling an fprobe event calls
unregister_fprobe() on the unregistered fprobe, and opening or closing a
perf event on an enabled uprobe event dereferences a NULL tu->uprobe in
uprobe_apply().
Register and enable the newly appended fprobe or uprobe immediately when
the target event is already enabled.
Link: https://lore.kernel.org/all/179455849798.403392.135678786198324285.stgit@devnote2/
Fixes: 41af3cf587f4 ("tracing/uprobe: Add multi-probe per uprobe event support")
Fixes: 2db832ec9090 ("tracing: fprobe-events: Register fprobe-events only when it is enabled")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_fprobe.c | 14 ++++-------
kernel/trace/trace_uprobe.c | 56 +++++++++++++++++++++++++++++---------------
2 files changed, 43 insertions(+), 27 deletions(-)
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -937,7 +937,10 @@ static int append_trace_fprobe_event(str
if (ret)
return ret;
- ret = trace_fprobe_verify_target(tf);
+ if (trace_probe_is_enabled(&tf->tp))
+ ret = __register_trace_fprobe(tf);
+ else
+ ret = trace_fprobe_verify_target(tf);
if (ret)
trace_probe_unlink(&tf->tp);
else
@@ -1522,13 +1525,8 @@ static int disable_trace_fprobe(struct t
trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
if (!trace_probe_is_enabled(tp)) {
- list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) {
- unregister_fprobe(&tf->fp);
- if (tf->tuser) {
- tracepoint_user_put(tf->tuser);
- tf->tuser = NULL;
- }
- }
+ list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list)
+ __unregister_trace_fprobe(tf);
}
out:
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -447,6 +447,28 @@ static bool trace_uprobe_has_same_uprobe
return false;
}
+typedef bool (*filter_func_t)(struct uprobe_consumer *self, struct mm_struct *mm);
+
+#ifdef CONFIG_PERF_EVENTS
+static bool uprobe_perf_filter(struct uprobe_consumer *uc, struct mm_struct *mm);
+#else
+#define uprobe_perf_filter NULL
+#endif
+
+static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter)
+{
+ struct inode *inode = d_real_inode(tu->path.dentry);
+ struct uprobe *uprobe;
+
+ tu->consumer.filter = filter;
+ uprobe = uprobe_register(inode, tu->offset, tu->ref_ctr_offset, &tu->consumer);
+ if (IS_ERR(uprobe))
+ return PTR_ERR(uprobe);
+
+ tu->uprobe = uprobe;
+ return 0;
+}
+
static int append_trace_uprobe(struct trace_uprobe *tu, struct trace_uprobe *to)
{
int ret;
@@ -466,10 +488,22 @@ static int append_trace_uprobe(struct tr
/* Append to existing event */
ret = trace_probe_append(&tu->tp, &to->tp);
- if (!ret)
- dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp));
+ if (ret)
+ return ret;
- return ret;
+ if (trace_probe_is_enabled(&tu->tp)) {
+ ret = trace_uprobe_enable(tu,
+ trace_probe_test_flag(&tu->tp, TP_FLAG_PROFILE) ?
+ uprobe_perf_filter : NULL);
+ if (ret) {
+ trace_probe_unlink(&tu->tp);
+ return ret;
+ }
+ }
+
+ dyn_event_add(&tu->devent, trace_probe_event_call(&tu->tp));
+
+ return 0;
}
/*
@@ -1118,22 +1152,6 @@ print_uprobe_event(struct trace_iterator
return trace_handle_return(s);
}
-typedef bool (*filter_func_t)(struct uprobe_consumer *self, struct mm_struct *mm);
-
-static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter)
-{
- struct inode *inode = d_real_inode(tu->path.dentry);
- struct uprobe *uprobe;
-
- tu->consumer.filter = filter;
- uprobe = uprobe_register(inode, tu->offset, tu->ref_ctr_offset, &tu->consumer);
- if (IS_ERR(uprobe))
- return PTR_ERR(uprobe);
-
- tu->uprobe = uprobe;
- return 0;
-}
-
static void __probe_event_disable(struct trace_probe *tp)
{
struct trace_uprobe *tu;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 806/990] tracing/probes: Fix missing BTF kind checks in char pointer/array helpers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (804 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 805/990] tracing/probes: Enable newly appended probe when target event is enabled Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 807/990] tracing/probes: Fix user-space dereference string array store type Greg Kroah-Hartman
` (46 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit c1e2c63e65421068566db3dde44dfd4fe7adb46d upstream.
In struct btf_type, the type ID and byte size share a union, and only
BTF_KIND_INT types are followed by a 32-bit integer encoding word.
Because btf_type_is_char_ptr() and btf_type_is_char_array() do not
verify that the outer type is BTF_KIND_PTR or that the resolved element
type is a non-NULL BTF_KIND_INT before inspecting it, non-pointer BTF
types can have their byte size misinterpreted as a BTF type ID, and
arrays of non-integer types read out-of-bounds or misinterpret trailing
BTF metadata as BTF_INT_* encoding bits.
Validate the BTF type kinds and NULL pointers before reading inner type
metadata in both helpers.
Link: https://lore.kernel.org/all/179455851632.403392.258264246782960594.stgit@devnote2/
Fixes: 27973e5c64b9 ("tracing/probes: Add string type check with BTF")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_probe.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -356,6 +356,9 @@ static bool btf_type_is_char_ptr(struct
const struct btf_type *real_type;
u32 intdata;
+ if (BTF_INFO_KIND(type->info) != BTF_KIND_PTR)
+ return false;
+
real_type = btf_type_skip_modifiers(btf, type->type, NULL);
if (!real_type)
return false;
@@ -380,6 +383,11 @@ static bool btf_type_is_char_array(struc
array = (const struct btf_array *)(type + 1);
real_type = btf_type_skip_modifiers(btf, array->type, NULL);
+ if (!real_type)
+ return false;
+
+ if (BTF_INFO_KIND(real_type->info) != BTF_KIND_INT)
+ return false;
intdata = btf_type_int(real_type);
return !(BTF_INT_ENCODING(intdata) & BTF_INT_SIGNED)
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 807/990] tracing/probes: Fix user-space dereference string array store type
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (805 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 806/990] tracing/probes: Fix missing BTF kind checks in char pointer/array helpers Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 808/990] tracing/probes: Reject array count on non-dereference string sources Greg Kroah-Hartman
` (45 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit 2721573e6c6faaba2e31f352f2c02ec5f3ecf5e9 upstream.
When finalizing a string array argument (e.g. +0u(%reg):string[N]),
finalize_fetch_insn() advances the instruction pointer to a new slot
for the store operation before checking whether the preceding operation
was FETCH_OP_UDEREF. As a result, user-space dereference string arrays
with type "string" emit FETCH_OP_ST_STRING (kernel memory read) instead
of FETCH_OP_ST_USTRING.
Check for FETCH_OP_UDEREF before advancing the instruction pointer.
Link: https://lore.kernel.org/all/179455854396.403392.18073771811100192405.stgit@devnote2/
Fixes: e65f7ae7f4da ("tracing/probe: Support user-space dereference")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_probe.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1484,6 +1484,8 @@ static int finalize_fetch_insn(struct fe
/* Store operation */
if (parg->type->is_string) {
+ bool is_uderef;
+
/* Check bad combination of the type and the last fetch_insn. */
if (!strcmp(parg->type->name, "symstr")) {
if (code->op != FETCH_OP_REG && code->op != FETCH_OP_STACK &&
@@ -1503,6 +1505,7 @@ static int finalize_fetch_insn(struct fe
}
}
+ is_uderef = (code->op == FETCH_OP_UDEREF);
if (!strcmp(parg->type->name, "symstr") ||
(code->op == FETCH_OP_IMM || code->op == FETCH_OP_COMM ||
code->op == FETCH_OP_DATA) || code->op == FETCH_OP_TP_ARG ||
@@ -1523,8 +1526,7 @@ static int finalize_fetch_insn(struct fe
}
/* If op == DEREF, replace it with STRING */
- if (!strcmp(parg->type->name, "ustring") ||
- code->op == FETCH_OP_UDEREF)
+ if (!strcmp(parg->type->name, "ustring") || is_uderef)
code->op = FETCH_OP_ST_USTRING;
else if (!strcmp(parg->type->name, "symstr"))
code->op = FETCH_OP_ST_SYMSTR;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 808/990] tracing/probes: Reject array count on non-dereference string sources
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (806 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 807/990] tracing/probes: Fix user-space dereference string array store type Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 809/990] wifi: ath12k: assign device id from the WSI index Greg Kroah-Hartman
` (44 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Masami Hiramatsu (Google)
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
commit 0941144ebeaf3ce46c80711f00e935921eb28b21 upstream.
The runtime array loop (FETCH_OP_LP_ARRAY) for string types requires a
preceding memory dereference instruction so it can advance the pointer
address on each iteration. Non-dereference string sources such as $comm,
immediate strings, and eprobe event fields cannot be indexed as pointer
arrays, but finalize_fetch_insn() still accepts an array count on them
and emits an invalid FETCH_OP_LP_ARRAY sequence.
Reject string array counts when the preceding operation is not a memory
dereference.
Link: https://lore.kernel.org/all/179455855309.403392.4197028577158545202.stgit@devnote2/
Fixes: 40b53b771806 ("tracing: probeevent: Add array type support")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/trace/trace_probe.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1518,6 +1518,12 @@ static int finalize_fetch_insn(struct fe
* For the symstr, it doesn't need to dereference, thus
* it just get the value.
*/
+ if (parg->count && (code->op != FETCH_OP_DEREF &&
+ code->op != FETCH_OP_UDEREF)) {
+ trace_probe_log_err(ctx->offset + type_offset,
+ BAD_STRING);
+ return -EINVAL;
+ }
code++;
if (code->op != FETCH_OP_NOP) {
trace_probe_log_err(ctx->offset, TOO_MANY_OPS);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 809/990] wifi: ath12k: assign device id from the WSI index
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (807 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 808/990] tracing/probes: Reject array count on non-dereference string sources Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 810/990] wifi: ath9k_htc: do not start ANI before the first channel is set Greg Kroah-Hartman
` (43 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Rameshkumar Sundaram, Benoit Masson,
Jeff Johnson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoit Masson <yahoo@perenite.com>
commit 81986a81f09fae73926c7c44863b335880269c90 upstream.
Devices of a hardware group are added to ag->ab[] in PCI probe
completion order (ab->device_id = ag->num_probed++), which is not
stable across boots. The wiphy radio array is built from ag->ab[] and
the wiphy device is taken from its first entry, so the wiphy sysfs
path and the mapping of radio indices to bands change on every boot.
Persisted wireless configurations reference radios by index (e.g.
OpenWrt/hostapd "radio0"), so such a configuration attaches to a
random band at each boot. This affects any multi-chip group with
single-band radios, e.g. TP-Link Archer BE800 (three QCN9274/QCN9224
radios in one group).
Store each ab in ag->ab[] at its wsi_info.index, which is derived from
the device tree WSI ring and is therefore deterministic.
ag->num_probed remains the group device counter. The unassign path is
unchanged, it already indexes ag->ab[] by ab->device_id.
Suggested-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Fixes: 6f245ea0ec6c ("wifi: ath12k: introduce device group abstraction")
Cc: stable@vger.kernel.org # 6.14+
Signed-off-by: Benoit Masson <yahoo@perenite.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20260928213322.98949-1-yahoo@perenite.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/wireless/ath/ath12k/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -1943,7 +1943,8 @@ exit:
goto invalid_group;
}
- ab->device_id = ag->num_probed++;
+ ag->num_probed++;
+ ab->device_id = wsi->index;
ag->ab[ab->device_id] = ab;
ab->ag = ag;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 810/990] wifi: ath9k_htc: do not start ANI before the first channel is set
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (808 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 809/990] wifi: ath12k: assign device id from the WSI index Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 811/990] wifi: cfg80211: release rejected nontransmitted BSS reference Greg Kroah-Hartman
` (42 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mehmet Fide,
Toke Høiland-Jørgensen, Jeff Johnson
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
commit dda63dd136ba2bc3b297079b190ac81a0aea40ae upstream.
ath9k_htc_add_interface() starts ANI for the first AP interface, before
any channel is configured. The per-channel calibration data only gets
attached by the first ath9k_htc_set_channel() that is not a fast
channel change, and that same call cancels the ANI work a few
milliseconds after add_interface, so normally the work never runs.
When the bring-up stalls for more than the 100 ms ANI poll interval in
between, it does run, and ar9002_hw_per_calibration() records the IQ
calibration result in the calibration data that does not exist yet:
Unable to handle kernel NULL pointer dereference at virtual address
00000008
PC is at ar9002_hw_calibrate+0x1f8/0x570 [ath9k_hw]
Workqueue: phy0 ath9k_htc_ani_work [ath9k_htc]
Seen about once per thousand AP starts with an AR9271 on a Cortex-A5
board that starts hostapd while still booting; a 500 ms delay after
add_interface reproduces it on every start. The crashed work never
completes, so the next cancel_delayed_work_sync() blocks for good.
Drop the start; it has nothing to calibrate against and is cancelled
anyway. The TSF adjust bit that shared its condition is now set for
every AP interface, which is harmless: the next reset applies it. The
next patch starts ANI once the interface beacons.
Fixes: a236254c35f0 ("ath9k_htc: Add ANI for AP mode")
Cc: stable@vger.kernel.org
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20261005072209.4101009-2-mehmet.fide@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1098,11 +1098,8 @@ static int ath9k_htc_add_interface(struc
ath9k_htc_set_opmode(priv);
- if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
- !test_bit(ATH_OP_ANI_RUN, &common->op_flags)) {
+ if (priv->ah->opmode == NL80211_IFTYPE_AP)
ath9k_hw_set_tsfadjust(priv->ah, true);
- ath9k_htc_start_ani(priv);
- }
ath_dbg(common, CONFIG, "Attach a VIF of type: %d at idx: %d\n",
vif->type, avp->index);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 811/990] wifi: cfg80211: release rejected nontransmitted BSS reference
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (809 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 810/990] wifi: ath9k_htc: do not start ANI before the first channel is set Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 812/990] wifi: cfg80211: preserve mesh A-MSDU lengths when adding mesh headers Greg Kroah-Hartman
` (41 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit f3c45d5b741a7d7586e639c2f55d2557029f2e1a upstream.
Repeated MBSSID reports without an SSID can leak BSS entries outside the
scan cache, where the BSS entry limit cannot account for them.
__cfg80211_bss_update() returns a referenced BSS. If adding it to the
transmitting BSS list fails, unlinking drops the cache reference, but the
caller reference is lost when res is cleared.
Release the caller reference before discarding the unlinked BSS.
LLM assistance was used to find the bug and review.
Fixes: 0b7808818cb9 ("wifi: cfg80211: fix BSS refcounting bugs")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028141731.6185-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/wireless/scan.c | 1 +
1 file changed, 1 insertion(+)
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2437,6 +2437,7 @@ cfg80211_inform_single_bss_data(struct w
if (cfg80211_add_nontrans_list(data->source_bss, &res->pub)) {
if (__cfg80211_unlink_bss(rdev, res)) {
rdev->bss_generation++;
+ bss_ref_put(rdev, res);
res = NULL;
}
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 812/990] wifi: cfg80211: preserve mesh A-MSDU lengths when adding mesh headers
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (810 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 811/990] wifi: cfg80211: release rejected nontransmitted BSS reference Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 813/990] wifi: cfg80211: dont truncate the merged MBSSID profile length Greg Kroah-Hartman
` (40 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 9083da9dd3223068237395432323b407012aec1f upstream.
A malformed mesh A-MSDU subframe with a declared payload length near
65535 bytes can pass validation against a much shorter aggregate.
ieee80211_amsdu_subframe_length() adds the mesh control length to the
declared length in a u16, and ieee80211_is_valid_amsdu() stores the
result in a u16 local. The sum therefore wraps before either walker
compares it with the remaining aggregate length. The decomposer then
splits and delivers the malformed aggregate instead of rejecting it.
Keep the computed length in unsigned int in both the helper and the
validator so oversized subframes cannot wrap.
LLM assistance was used to find the bug and review.
Fixes: 6e4c0d0460bd ("wifi: mac80211: add a workaround for receiving non-standard mesh A-MSDU")
Fixes: fe4a6d2db3ba ("wifi: mac80211: implement support for yet another mesh A-MSDU format")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142149.13834-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/wireless/util.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -745,12 +745,12 @@ __ieee80211_amsdu_copy(struct sk_buff *s
return frame;
}
-static u16
+static unsigned int
ieee80211_amsdu_subframe_length(void *field, u8 mesh_flags, u8 hdr_type)
{
__le16 *field_le = field;
__be16 *field_be = field;
- u16 len;
+ unsigned int len;
if (hdr_type >= 2)
len = le16_to_cpu(*field_le);
@@ -772,7 +772,7 @@ bool ieee80211_is_valid_amsdu(struct sk_
__be16 len;
u8 mesh_flags;
} hdr;
- u16 len;
+ unsigned int len;
if (sizeof(hdr) > remaining)
return false;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 813/990] wifi: cfg80211: dont truncate the merged MBSSID profile length
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (811 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 812/990] wifi: cfg80211: preserve mesh A-MSDU lengths when adding mesh headers Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 814/990] wifi: mac80211: fix use-after-free when MLO link setup is rolled back Greg Kroah-Hartman
` (39 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Wahid Khan, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wahid Khan <wahidzk0091@gmail.com>
commit 3ea152f3f77eeffc37b2f4423688b4df9136f90c upstream.
cfg80211_parse_mbssid_data() keeps the length of a non-transmitted BSSID
profile in a u8. cfg80211_merge_profile() returns a size_t, and it
concatenates a profile that is split over several Multiple BSSID
elements, so the merged length can be well above 255 even though every
single sub-element is at most 255 bytes long.
The value is then cut to its low 8 bits. A 300 byte profile is handled
as a 44 byte one: the elements after the cut are lost from the generated
non-transmitted BSS, and if the Multiple BSSID-Index element lies past
the cut the BSS is dropped altogether. Any AP in range can send such a
profile.
The multi-link code further down in the same file already uses a signed
size type for the profile length. Do the same here, cfg80211_find_ie()
and cfg80211_gen_new_ie() take a size_t anyway.
Fixes: fe806e4992c9 ("cfg80211: support profile split between elements")
Cc: stable@vger.kernel.org
Signed-off-by: Wahid Khan <wahidzk0091@gmail.com>
Link: https://patch.msgid.link/20261104211451.693451-1-wahidzk0091@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/wireless/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2580,7 +2580,7 @@ cfg80211_parse_mbssid_data(struct wiphy
if (elem->data[0] < 1 || (int)elem->data[0] > 8)
continue;
for_each_element(sub, elem->data + 1, elem->datalen - 1) {
- u8 profile_len;
+ size_t profile_len;
if (sub->id != 0 || sub->datalen < 4) {
/* not a valid BSS profile */
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 814/990] wifi: mac80211: fix use-after-free when MLO link setup is rolled back
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (812 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 813/990] wifi: cfg80211: dont truncate the merged MBSSID profile length Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 815/990] wifi: mac80211: drain link readers before stopping removed links Greg Kroah-Hartman
` (38 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit a155ef2ef79531c139244289c5b8f15c05d16a0e upstream.
Rolling back an MLO link addition can free link containers while RCU
readers still hold pointers to them. ieee80211_vif_update_links()
publishes new links before checking for duplicate addresses and calling
drv_change_vif_links(). If either fails, it restores the old pointers
and frees the new containers without waiting for readers.
During a non-MLO to MLO transition, the published link 0 replaces the
deflink, so existing link 0 users can acquire the new container. Readers
such as ieee80211_csa_finish() and
ieee80211_obss_color_collision_notify() can also queue work embedded in
the link. If they queue after ieee80211_link_stop() cancels that work,
it remains queued when the container is freed.
Wait for RCU readers after restoring the old pointers and before
stopping the new links, so their work is queued before it is cancelled.
Fixes: d3e2439b0f33 ("wifi: mac80211: fix link manipulation")
Cc: stable@vger.kernel.org # 7.2.x
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261026152654.80697-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/link.c | 2 ++
1 file changed, 2 insertions(+)
--- a/net/mac80211/link.c
+++ b/net/mac80211/link.c
@@ -385,6 +385,8 @@ static int ieee80211_vif_update_links(st
memcpy(sdata->link, old_data, sizeof(old_data));
memcpy(sdata->vif.link_conf, old, sizeof(old));
ieee80211_set_vif_links_bitmaps(sdata, old_links, dormant_links);
+ /* drain RCU readers before cancelling work they may queue */
+ synchronize_rcu();
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
ieee80211_link_debugfs_remove(&links[link_id]->data);
ieee80211_link_stop(&links[link_id]->data);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 815/990] wifi: mac80211: drain link readers before stopping removed links
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (813 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 814/990] wifi: mac80211: fix use-after-free when MLO link setup is rolled back Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 816/990] wifi: mac80211: recheck injected headers after removing FCS Greg Kroah-Hartman
` (37 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 745f5d04395dfc4c311f443c7c04ccb00c436984 upstream.
Removing an MLO link can leave work queued on its link container after
the container is freed.
ieee80211_tear_down_links() stops each link before the RCU grace period.
A reader that fetched the link earlier can therefore queue work after
ieee80211_link_stop() has canceled it. ieee80211_request_smps() and
ieee80211_csa_finish() can both reach this window.
Record each removed link while removing its keys and debugfs state. Wait
for RCU readers, then stop the recorded links so cancellation includes
work queued by those readers. Free the detached keys after the grace
period as before.
LLM assistance was used to find the bug and review.
Fixes: efe9c2bfd1a8 ("wifi: mac80211: isolate driver from inactive links")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028141708.5532-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/link.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/net/mac80211/link.c
+++ b/net/mac80211/link.c
@@ -179,6 +179,7 @@ struct link_container {
static void ieee80211_tear_down_links(struct ieee80211_sub_if_data *sdata,
struct link_container **links, u16 mask)
{
+ struct ieee80211_link_data *stop[IEEE80211_MLD_MAX_NUM_LINKS] = {};
struct ieee80211_link_data *link;
LIST_HEAD(keys);
unsigned int link_id;
@@ -193,11 +194,16 @@ static void ieee80211_tear_down_links(st
continue;
ieee80211_remove_link_keys(link, &keys);
ieee80211_link_debugfs_remove(link);
- ieee80211_link_stop(link);
+ stop[link_id] = link;
}
+ /* drain RCU readers before cancelling work they may queue */
synchronize_rcu();
+ for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++)
+ if (stop[link_id])
+ ieee80211_link_stop(stop[link_id]);
+
ieee80211_free_key_list(sdata->local, &keys);
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 816/990] wifi: mac80211: recheck injected headers after removing FCS
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (814 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 815/990] wifi: mac80211: drain link readers before stopping removed links Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 817/990] wifi: mac80211: recheck the IBSS station limit before insertion Greg Kroah-Hartman
` (36 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 339564c7ac50464695dfed847f89d118f4cc1dc5 upstream.
Injecting a short frame with IEEE80211_RADIOTAP_F_FCS on a monitor
interface can pass a truncated 802.11 header to transmit handlers.
ieee80211_monitor_start_xmit() validates the linear 802.11 header before
parsing radiotap. Radiotap parsing then removes the four-byte FCS without
rechecking the remaining header length. Software encryption can subtract
the larger header length and pass the resulting negative length as an
unsigned size.
Recheck the required linear header length after pulling the radiotap
header and before handing the frame to the transmit path. Require at
least addr1, which the transmit path reads even for extension frames
whose header is shorter.
LLM assistance was used to find the bug and review.
Fixes: bddc0c411a45 ("mac80211: Fix NULL ptr deref for injected rate info")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142101.11994-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/tx.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2552,6 +2552,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
/* remove the injection radiotap header */
skb_pull(skb, len_rthdr);
+ /* FCS removal may have shortened the 802.11 header. */
+ hdrlen = max_t(int, hdrlen,
+ offsetofend(struct ieee80211_hdr, addr1));
+ if (skb_headlen(skb) < hdrlen)
+ goto fail_rcu;
+
ieee80211_xmit(sdata, NULL, skb);
rcu_read_unlock();
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 817/990] wifi: mac80211: recheck the IBSS station limit before insertion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (815 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 816/990] wifi: mac80211: recheck injected headers after removing FCS Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 818/990] wifi: mac80211: recheck the OCB " Greg Kroah-Hartman
` (35 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit f7670bcdf650b37551a9c5d084521f877d939f11 upstream.
Frames from successive unknown IBSS peers can make the deferred worker
install more than 128 stations.
The receive path checks local->num_sta before allocating each station,
but pending stations are not included in that count. Several allocations
can therefore pass before the worker inserts any of them, and the worker
then drains the list without rechecking the limit.
Recheck the installed-station limit in the worker under the wiphy mutex
and free entries that no longer fit.
LLM assistance was used to find the bug and review.
Fixes: 8bf11d8d0811 ("mac80211: delay IBSS station insertion")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142235.15428-2-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ibss.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1656,8 +1656,12 @@ void ieee80211_ibss_work(struct ieee8021
list_del(&sta->list);
spin_unlock_bh(&ifibss->incomplete_lock);
- ieee80211_ibss_finish_sta(sta);
- rcu_read_unlock();
+ if (sdata->local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
+ sta_info_free(sdata->local, sta);
+ } else {
+ ieee80211_ibss_finish_sta(sta);
+ rcu_read_unlock();
+ }
spin_lock_bh(&ifibss->incomplete_lock);
}
spin_unlock_bh(&ifibss->incomplete_lock);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 818/990] wifi: mac80211: recheck the OCB station limit before insertion
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (816 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 817/990] wifi: mac80211: recheck the IBSS station limit before insertion Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 819/990] wifi: mac80211: reject invalid EHT guard intervals in airtime estimates Greg Kroah-Hartman
` (34 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 27e29a077b4887d0e0a813337f8b7e06bd020c81 upstream.
Frames from successive unknown OCB peers can make the deferred worker
install more than 128 stations.
The receive path checks local->num_sta before allocating each station,
but pending stations are not included in that count. Several allocations
can therefore pass before the worker inserts any of them, and the worker
then drains the list without rechecking the limit.
Recheck the installed-station limit in the worker under the wiphy mutex
and free entries that no longer fit.
LLM assistance was used to find the bug and review.
Fixes: 239281f803e2 ("mac80211: 802.11p OCB mode support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142302.16634-2-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ocb.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/net/mac80211/ocb.c
+++ b/net/mac80211/ocb.c
@@ -136,8 +136,12 @@ void ieee80211_ocb_work(struct ieee80211
list_del(&sta->list);
spin_unlock_bh(&ifocb->incomplete_lock);
- ieee80211_ocb_finish_sta(sta);
- rcu_read_unlock();
+ if (sdata->local->num_sta >= IEEE80211_OCB_MAX_STA_ENTRIES) {
+ sta_info_free(sdata->local, sta);
+ } else {
+ ieee80211_ocb_finish_sta(sta);
+ rcu_read_unlock();
+ }
spin_lock_bh(&ifocb->incomplete_lock);
}
spin_unlock_bh(&ifocb->incomplete_lock);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 819/990] wifi: mac80211: reject invalid EHT guard intervals in airtime estimates
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (817 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 818/990] wifi: mac80211: recheck the OCB " Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 820/990] wifi: mac80211: restore dormant links when link updates fail Greg Kroah-Hartman
` (33 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 582edbdbc5d288bd128b54935738fe38f15c8c29 upstream.
An invalid EHT guard interval can select the wrong airtime group and, at
320 MHz, read beyond airtime_mcs_groups.
Guard interval 3 advances EHT_GROUP_IDX() into the next bandwidth group
at narrower widths. With one spatial stream and 320 MHz, it evaluates to
264, one past the 264-entry table. RX rate parsing rejects the value, but
the common TX-status validator has no EHT check and last_rate_info can
carry it to the airtime helper.
Reject values above NL80211_RATE_INFO_EHT_GI_3_2 in the helper. This also
protects exported ieee80211_calc_rx_airtime() callers that do not pass
through the TX-status validator.
LLM assistance was used to find the bug and review.
Fixes: 3702a33216e6 ("wifi: mac80211: introduce EHT rate support in AQL airtime")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142212.14523-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/airtime.c | 2 ++
1 file changed, 2 insertions(+)
--- a/net/mac80211/airtime.c
+++ b/net/mac80211/airtime.c
@@ -550,6 +550,8 @@ static u32 ieee80211_get_rate_duration(s
group = HE_GROUP_IDX(streams, status->he_gi, bw);
break;
case RX_ENC_EHT:
+ if (status->eht.gi > NL80211_RATE_INFO_EHT_GI_3_2)
+ return 0;
streams = status->nss;
idx = status->rate_idx;
group = EHT_GROUP_IDX(streams, status->eht.gi, bw);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 820/990] wifi: mac80211: restore dormant links when link updates fail
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (818 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 819/990] wifi: mac80211: reject invalid EHT guard intervals in airtime estimates Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 821/990] wifi: mac80211: fix use-after-free on TTLM disconnect Greg Kroah-Hartman
` (32 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit bb22f3b2d8f8a2f883944f24678cf84e18b162e8 upstream.
A failed MLO link update can leave the interface with the requested
dormant-links bitmap instead of its previous one. This can disable active
links or trigger a bitmap warning during rollback.
The error path restores the old valid-links bitmap but passes the new
dormant_links argument to ieee80211_set_vif_links_bitmaps().
Save the old dormant bitmap before changing link state and use it when
restoring the old configuration.
LLM assistance was used to find the bug and review.
Fixes: 6d543b34dbcf ("wifi: mac80211: Support disabled links during association")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142123.13072-1-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/link.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/net/mac80211/link.c
+++ b/net/mac80211/link.c
@@ -284,6 +284,7 @@ static int ieee80211_vif_update_links(st
{
u16 old_links = sdata->vif.valid_links;
u16 old_active = sdata->vif.active_links;
+ u16 old_dormant = sdata->vif.dormant_links;
unsigned long add = new_links & ~old_links;
unsigned long rem = old_links & ~new_links;
unsigned long sta_rem = rem;
@@ -390,7 +391,7 @@ static int ieee80211_vif_update_links(st
/* restore config */
memcpy(sdata->link, old_data, sizeof(old_data));
memcpy(sdata->vif.link_conf, old, sizeof(old));
- ieee80211_set_vif_links_bitmaps(sdata, old_links, dormant_links);
+ ieee80211_set_vif_links_bitmaps(sdata, old_links, old_dormant);
/* drain RCU readers before cancelling work they may queue */
synchronize_rcu();
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 821/990] wifi: mac80211: fix use-after-free on TTLM disconnect
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (819 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 820/990] wifi: mac80211: restore dormant links when link updates fail Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 822/990] wifi: mac80211: bound pending IBSS station allocations Greg Kroah-Hartman
` (31 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Benjamin Berg, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <johannes.berg@intel.com>
commit 4af2b71495a3f12196cbea1c9a502c62ada867be upstream.
If ieee80211_process_adv_ttlm() disconnects, and some other
changes were also detected in the beacon, the link update
to the driver is still done, leading to use-after-free. Fix
this by returning, like other functions, whether or not the
update was accepted by the function.
Cc: stable@vger.kernel.org
Fixes: 702e80470a33 ("wifi: mac80211: support handling of advertised TID-to-link mapping")
Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20261102220313.3cf5e709417b.I339967c7e614057253aa68c005d9ae220577f99a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/mlme.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -7127,15 +7127,15 @@ static void ieee80211_tid_to_link_map_wo
sdata->u.mgd.ttlm_info.switch_time = 0;
}
-static void ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata,
- struct ieee802_11_elems *elems,
- u64 beacon_ts)
+static bool ieee80211_process_adv_ttlm(struct ieee80211_sub_if_data *sdata,
+ struct ieee802_11_elems *elems,
+ u64 beacon_ts)
{
u8 i;
int ret;
if (!ieee80211_vif_is_mld(&sdata->vif))
- return;
+ return true;
if (!elems->ttlm_num) {
if (sdata->u.mgd.ttlm_info.switch_time) {
@@ -7153,14 +7153,14 @@ static void ieee80211_process_adv_ttlm(s
0);
if (ret) {
sdata_info(sdata, "Failed setting valid/dormant links\n");
- return;
+ return true;
}
ieee80211_vif_cfg_change_notify(sdata,
BSS_CHANGED_MLD_VALID_LINKS);
}
memset(&sdata->u.mgd.ttlm_info, 0,
sizeof(sdata->u.mgd.ttlm_info));
- return;
+ return true;
}
for (i = 0; i < elems->ttlm_num; i++) {
@@ -7172,7 +7172,7 @@ static void ieee80211_process_adv_ttlm(s
if (res) {
__ieee80211_disconnect(sdata);
- return;
+ return false;
}
if (ttlm_info.switch_time) {
@@ -7197,7 +7197,7 @@ static void ieee80211_process_adv_ttlm(s
* switch the AP will continue to announce it anyway.
*/
if (delay > IEEE80211_ADV_TTLM_ST_UNDERFLOW)
- return;
+ return true;
delay_usec = ieee80211_tu_to_usec(delay);
@@ -7216,9 +7216,11 @@ static void ieee80211_process_adv_ttlm(s
wiphy_hrtimer_work_queue(sdata->local->hw.wiphy,
&sdata->u.mgd.ttlm_work,
us_to_ktime(delay_usec));
- return;
+ return true;
}
}
+
+ return true;
}
static void
@@ -7738,8 +7740,9 @@ static void ieee80211_rx_mgmt_beacon(str
elems->cisco_dtpc_elem);
ieee80211_ml_reconfiguration(sdata, elems);
- ieee80211_process_adv_ttlm(sdata, elems,
- le64_to_cpu(mgmt->u.beacon.timestamp));
+ if (!ieee80211_process_adv_ttlm(sdata, elems,
+ le64_to_cpu(mgmt->u.beacon.timestamp)))
+ goto free;
apply:
ieee80211_link_info_change_notify(sdata, link, changed);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 822/990] wifi: mac80211: bound pending IBSS station allocations
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (820 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 821/990] wifi: mac80211: fix use-after-free on TTLM disconnect Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 823/990] wifi: mac80211: bound pending OCB " Greg Kroah-Hartman
` (30 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit 3029ca2112d7bee4d3e3eadd02decdb3eddb9485 upstream.
Delaying the IBSS station worker while frames arrive from new peers can
retain an unbounded number of station allocations.
The receive-side limit counts installed stations, while new allocations
wait on incomplete_stations until process context inserts them. The list
lock does not cover the interval between allocation and list insertion.
Reserve one of 128 pending slots per interface before allocation. Release
the reservation on allocation failure, after the worker inserts or frees
the station, and when disconnect frees the pending list.
LLM assistance was used to find the bug and review.
Fixes: 8bf11d8d0811 ("mac80211: delay IBSS station insertion")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142235.15428-3-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ibss.c | 13 ++++++++++++-
net/mac80211/ieee80211_i.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -691,6 +691,7 @@ static void ieee80211_ibss_disconnect(st
spin_unlock_bh(&ifibss->incomplete_lock);
sta_info_free(local, sta);
+ atomic_dec(&ifibss->incomplete_sta_count);
spin_lock_bh(&ifibss->incomplete_lock);
}
spin_unlock_bh(&ifibss->incomplete_lock);
@@ -1207,9 +1208,18 @@ void ieee80211_ibss_rx_no_sta(struct iee
band = chanctx_conf->def.chan->band;
rcu_read_unlock();
+ if (!atomic_add_unless(&ifibss->incomplete_sta_count, 1,
+ IEEE80211_IBSS_MAX_STA_ENTRIES)) {
+ net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
+ sdata->name, addr);
+ return;
+ }
+
sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
- if (!sta)
+ if (!sta) {
+ atomic_dec(&ifibss->incomplete_sta_count);
return;
+ }
/* make sure mandatory rates are always added */
sband = local->hw.wiphy->bands[band];
@@ -1662,6 +1672,7 @@ void ieee80211_ibss_work(struct ieee8021
ieee80211_ibss_finish_sta(sta);
rcu_read_unlock();
}
+ atomic_dec(&ifibss->incomplete_sta_count);
spin_lock_bh(&ifibss->incomplete_lock);
}
spin_unlock_bh(&ifibss->incomplete_lock);
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -668,6 +668,7 @@ struct ieee80211_if_ibss {
spinlock_t incomplete_lock;
struct list_head incomplete_stations;
+ atomic_t incomplete_sta_count;
enum {
IEEE80211_IBSS_MLME_SEARCH,
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 823/990] wifi: mac80211: bound pending OCB station allocations
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (821 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 822/990] wifi: mac80211: bound pending IBSS station allocations Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 824/990] gpio: aspeed: Clear only the acked lines G4 interrupt status Greg Kroah-Hartman
` (29 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Zhao Li, Johannes Berg
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Li <enderaoelyther@gmail.com>
commit ee1a5e92dba0a98cabe476c780e3af4f0ab88b27 upstream.
Delaying the OCB station worker while frames arrive from new peers can
retain an unbounded number of station allocations.
The receive-side limit counts installed stations, while new allocations
wait on incomplete_stations until process context inserts them. The list
lock does not cover the interval between allocation and list insertion.
Reserve one of 128 pending slots per interface before allocation. Release
the reservation on allocation failure, after the worker inserts or frees
the station, and when leave frees the pending list.
LLM assistance was used to find the bug and review.
Fixes: 239281f803e2 ("mac80211: 802.11p OCB mode support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
Link: https://patch.msgid.link/20261028142302.16634-3-enderaoelyther@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/mac80211/ieee80211_i.h | 2 ++
net/mac80211/ocb.c | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -683,6 +683,7 @@ struct ieee80211_if_ibss {
* @wrkq_flags: OCB deferred task action
* @incomplete_lock: delayed STA insertion lock
* @incomplete_stations: list of STAs waiting for delayed insertion
+ * @incomplete_sta_count: pending entries and reserved allocations
* @joined: indication if the interface is connected to an OCB network
*/
struct ieee80211_if_ocb {
@@ -691,6 +692,7 @@ struct ieee80211_if_ocb {
spinlock_t incomplete_lock;
struct list_head incomplete_stations;
+ atomic_t incomplete_sta_count;
bool joined;
};
--- a/net/mac80211/ocb.c
+++ b/net/mac80211/ocb.c
@@ -70,9 +70,18 @@ void ieee80211_ocb_rx_no_sta(struct ieee
band = chanctx_conf->def.chan->band;
rcu_read_unlock();
+ if (!atomic_add_unless(&ifocb->incomplete_sta_count, 1,
+ IEEE80211_OCB_MAX_STA_ENTRIES)) {
+ net_info_ratelimited("%s: No room for a new OCB STA entry %pM\n",
+ sdata->name, addr);
+ return;
+ }
+
sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
- if (!sta)
+ if (!sta) {
+ atomic_dec(&ifocb->incomplete_sta_count);
return;
+ }
/* Add only mandatory rates for now */
sband = local->hw.wiphy->bands[band];
@@ -142,6 +151,7 @@ void ieee80211_ocb_work(struct ieee80211
ieee80211_ocb_finish_sta(sta);
rcu_read_unlock();
}
+ atomic_dec(&ifocb->incomplete_sta_count);
spin_lock_bh(&ifocb->incomplete_lock);
}
spin_unlock_bh(&ifocb->incomplete_lock);
@@ -225,6 +235,7 @@ int ieee80211_ocb_leave(struct ieee80211
spin_unlock_bh(&ifocb->incomplete_lock);
sta_info_free(local, sta);
+ atomic_dec(&ifocb->incomplete_sta_count);
spin_lock_bh(&ifocb->incomplete_lock);
}
spin_unlock_bh(&ifocb->incomplete_lock);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 824/990] gpio: aspeed: Clear only the acked lines G4 interrupt status
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (822 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 823/990] wifi: mac80211: bound pending OCB " Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 825/990] gpio: aspeed: Preserve the pending G7 interrupt status on control writes Greg Kroah-Hartman
` (28 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Aaron Antone, Billy Tsai,
Andrew Jeffery, Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <billy_tsai@aspeedtech.com>
commit 5d362564bd2982def7e80d7f1e756a97440c7adb upstream.
The G4 interrupt status registers are write-1-to-clear: writing 0 to a
bit has no effect and writing 1 clears that line's status flag.
aspeed_gpio_irq_ack() clears a line's status through
aspeed_g4_reg_bit_set(), which reads the bank's status register, sets
the line's bit and writes the whole value back. That write clears every
interrupt pending in the 32-line bank, not just the acked one.
aspeed_gpio_irq_handler() reads each bank's status register once and
dispatches the lines that were set. If another line in the same bank
latches an edge after that read and before an ack in the bank, the ack
clears its status and the handler is never called for it, so the edge
is lost.
Write only the line's own bit when clearing the interrupt status on G4.
Fixes: 79fc9a2fcc45 ("gpio: aspeed: Create llops to handle hardware access")
Cc: stable@vger.kernel.org
Reported-by: Aaron Antone <aae@amazon.com>
Suggested-by: Aaron Antone <aae@amazon.com>
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Tested-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://patch.msgid.link/20261104-gpio-aspeed-irq-status-v1-1-9805645f856d@aspeedtech.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-aspeed.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1045,6 +1045,17 @@ static void aspeed_g4_reg_bit_set(struct
void __iomem *addr = aspeed_gpio_g4_bank_reg(gpio, bank, reg);
u32 temp;
+ /*
+ * The interrupt status register is write-1-to-clear. Write only this
+ * line's bit so that interrupts pending on the other lines of the bank
+ * stay latched.
+ */
+ if (reg == reg_irq_status) {
+ if (val)
+ iowrite32(GPIO_BIT(offset), addr);
+ return;
+ }
+
if (reg == reg_val)
temp = gpio->dcache[GPIO_BANK(offset)];
else
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 825/990] gpio: aspeed: Preserve the pending G7 interrupt status on control writes
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (823 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 824/990] gpio: aspeed: Clear only the acked lines G4 interrupt status Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 826/990] gpio: brcmstb: fix UAF after IRQ domain setup failure Greg Kroah-Hartman
` (27 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Billy Tsai, Andrew Jeffery,
Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <billy_tsai@aspeedtech.com>
commit 18cc1d1ad94df8a6760fff2617d3d6923550cba0 upstream.
On G7 each line has its own control register, and its interrupt status
bit (bit 12) is write-1-to-clear. aspeed_g7_reg_bit_set() updates a
field by reading the control register, replacing that field and writing
the value back. When the line's interrupt is pending, the status bit
reads as 1 and is written back as 1, so updating an unrelated field
such as the interrupt enable, trigger type, direction or debounce
selection also clears the pending interrupt.
Mask out the status bit when composing the value to write, so it is
written as 1 only when the status field itself is being set to ack the
interrupt.
Fixes: b2e861bd1eaf ("gpio: aspeed: Support G7 Aspeed gpio controller")
Cc: stable@vger.kernel.org
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://patch.msgid.link/20261104-gpio-aspeed-irq-status-v1-2-9805645f856d@aspeedtech.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-aspeed.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1172,7 +1172,13 @@ static void aspeed_g7_reg_bit_set(struct
u32 write_val;
if (mask) {
- write_val = (ioread32(addr) & ~(mask)) | field_prep(mask, val);
+ /*
+ * The interrupt status bit is write-1-to-clear. Keep it zero
+ * unless it is the field being written, so that updating any
+ * other field leaves a pending interrupt latched.
+ */
+ write_val = ioread32(addr) & ~(mask | GPIO_G7_CTRL_IRQ_STS);
+ write_val |= field_prep(mask, val);
iowrite32(write_val, addr);
}
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 826/990] gpio: brcmstb: fix UAF after IRQ domain setup failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (824 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 825/990] gpio: aspeed: Preserve the pending G7 interrupt status on control writes Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 827/990] gpio: rockchip: Fix debounce arithmetic for GPIO v2 Greg Kroah-Hartman
` (26 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Guangshuo Li, Florian Fainelli,
Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <lgs201920130244@gmail.com>
commit baa14758afb3e2828de1f76511edc1de50216f39 upstream.
When devm_request_irq() fails in brcmstb_gpio_irq_setup(), the error
path removes the IRQ domain but leaves priv->irq_domain non-NULL.
The probe error path subsequently calls brcmstb_gpio_remove(), which
checks priv->irq_domain and attempts to access the already-freed
domain through irq_find_mapping(). It also attempts to remove the
domain again, resulting in a use-after-free and potentially further
memory corruption.
Set priv->irq_domain to NULL after removing it so that the common
cleanup path skips the already-freed IRQ domain.
This issue was found by our static analysis tool under development.
Fixes: 0ba31dc201de ("gpio: brcmstb: consolidate interrupt domains")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20261026115227.41779-1-lgs201920130244@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-brcmstb.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -486,6 +486,7 @@ static int brcmstb_gpio_irq_setup(struct
out_free_domain:
irq_domain_remove(priv->irq_domain);
+ priv->irq_domain = NULL;
return err;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 827/990] gpio: rockchip: Fix debounce arithmetic for GPIO v2
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (825 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 826/990] gpio: brcmstb: fix UAF after IRQ domain setup failure Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 828/990] gpio: sodaville: fix use-after-free bug when registering the irqchip Greg Kroah-Hartman
` (25 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Cunhao Lu, Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cunhao Lu <1579567540@qq.com>
commit 13467fd6998f5da4f5b4f172f1af3d9c48d5de8f upstream.
The debounce interval calculations use unsigned long operands. On 32-bit
systems, the numerator used to calculate the maximum interval overflows
before division, while multiplying the requested interval by the clock
rate overflows before it is assigned to a u64. A zero debounce clock rate
also causes division by zero.
Use 64-bit arithmetic for both calculations and reject a zero clock rate
before division.
At 32768 Hz, a 1 us request rounds to zero divider periods. Subtracting
one then wraps the divider value to ULONG_MAX. Decrement only a nonzero
rounded period count so that such requests use the smallest divider
value.
Fixes: 3bcbd1a85b68 ("gpio/rockchip: support next version gpio controller")
Cc: stable@vger.kernel.org
Signed-off-by: Cunhao Lu <1579567540@qq.com>
Link: https://patch.msgid.link/20261023-fix-rockchip-gpio-v2-debounce-v1-1-f1141bd5b58f@qq.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-rockchip.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -201,20 +201,25 @@ static int rockchip_gpio_set_debounce(st
{
struct rockchip_pin_bank *bank = gpiochip_get_data(gc);
const struct rockchip_gpio_regs *reg = bank->gpio_regs;
- unsigned long flags, div_reg, freq, max_debounce;
+ unsigned long flags, div_reg, freq;
bool div_debounce_support;
unsigned int cur_div_reg;
- u64 div;
+ u64 div, max_debounce;
if (bank->gpio_type == GPIO_TYPE_V2 && !IS_ERR(bank->db_clk)) {
div_debounce_support = true;
freq = clk_get_rate(bank->db_clk);
- max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
+ if (!freq)
+ return -EINVAL;
+
+ div = (u64)(GENMASK(23, 0) + 1) * 2 * USEC_PER_SEC;
+ max_debounce = div64_u64(div, freq);
if (debounce > max_debounce)
return -EINVAL;
- div = debounce * freq;
- div_reg = DIV_ROUND_CLOSEST_ULL(div, 2 * USEC_PER_SEC) - 1;
+ div = (u64)debounce * freq;
+ div_reg = DIV_ROUND_CLOSEST_ULL(div, 2 * USEC_PER_SEC);
+ div_reg = div_reg ? div_reg - 1 : 0;
} else {
div_debounce_support = false;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 828/990] gpio: sodaville: fix use-after-free bug when registering the irqchip
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (826 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 827/990] gpio: rockchip: Fix debounce arithmetic for GPIO v2 Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 829/990] gpio: virtuser: fix interrupt leak and UAF Greg Kroah-Hartman
` (24 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Linus Walleij, Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
commit ab9102375b7c77e0c4d33c7594e514454dc9f2b3 upstream.
In sdv_register_irqsupport(), if irq_domain_create_legacy() fails during
device probing, a generic IRQ chip is left registered in the global gc_list
while its underlying memory is freed, leading to a use-after-free. Use
the managed variant of irq_setup_generic_chip() to ensure that the chip
gets unregistered before the memory it uses is freed.
Cc: stable@vger.kernel.org
Fixes: 9381fc5d655d ("gpio: sodaville: Convert to use managed functions pcim_* and devm_*")
Closes: https://sashiko.dev/#/bug/linux-2f7ac8b6-5034-4ff1-9afa-5700ff44e3e9
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20261105-gpio-sodaville-use-after-free-v1-1-f572f40feedd@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-sodaville.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/drivers/gpio/gpio-sodaville.c
+++ b/drivers/gpio/gpio-sodaville.c
@@ -166,9 +166,12 @@ static int sdv_register_irqsupport(struc
ct->chip.irq_eoi = irq_gc_eoi;
ct->chip.irq_set_type = sdv_gpio_pub_set_type;
- irq_setup_generic_chip(sd->gc, IRQ_MSK(SDV_NUM_PUB_GPIOS),
- IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST,
- IRQ_LEVEL | IRQ_NOPROBE);
+ ret = devm_irq_setup_generic_chip(&pdev->dev, sd->gc,
+ IRQ_MSK(SDV_NUM_PUB_GPIOS),
+ IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST,
+ IRQ_LEVEL | IRQ_NOPROBE);
+ if (ret)
+ return ret;
sd->id = irq_domain_create_legacy(dev_fwnode(&pdev->dev), SDV_NUM_PUB_GPIOS, sd->irq_base,
0, &irq_domain_sdv_ops, sd);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 829/990] gpio: virtuser: fix interrupt leak and UAF
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (827 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 828/990] gpio: sodaville: fix use-after-free bug when registering the irqchip Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 830/990] gpio: virtuser: remove the debugfs files before freeing the line data Greg Kroah-Hartman
` (23 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
commit 24cafd9580627f9f066296f4a6ce1b282a3f425d upstream.
When configuring interrupt handlers for GPIOs requested by virtual
users, we never verify if an interrupt has been previously requested and
just leak it if it was.
We also never free the interrupts at device unbind. This is both a leak
and a potential UAF bug.
We use atomic_t for the irq field for now reason, it can't be modifying
or read from atomic context. Let's repurpose the existing consumer_lock
mutex and serialize access to the irq field. Let's add sanitization of
input and schedule a tear-down action.
Cc: stable@vger.kernel.org
Fixes: 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GPIO API")
Closes: https://sashiko.dev/#/bug/linux-d8935133-0e80-487a-9e00-e748056f595e
Link: https://patch.msgid.link/20261106-gpio-virtuser-irq-uaf-leak-v1-1-ce9772d8ad0d@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-virtuser.c | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
--- a/drivers/gpio/gpio-virtuser.c
+++ b/drivers/gpio/gpio-virtuser.c
@@ -58,9 +58,9 @@ struct gpio_virtuser_line_array_data {
struct gpio_virtuser_line_data {
struct gpio_virtuser_attr_data ad;
char consumer[GPIO_VIRTUSER_NAME_BUF_LEN];
- struct mutex consumer_lock;
+ struct mutex lock;
unsigned int debounce;
- atomic_t irq;
+ int irq;
atomic_t irq_count;
};
@@ -612,7 +612,7 @@ static ssize_t gpio_virtuser_consumer_re
memset(buf, 0x0, sizeof(buf));
- scoped_guard(mutex, &data->consumer_lock)
+ scoped_guard(mutex, &data->lock)
ret = snprintf(buf, sizeof(buf), "%s\n", data->consumer);
return simple_read_from_buffer(user_buf, size, ppos, buf, ret);
@@ -640,7 +640,7 @@ static ssize_t gpio_virtuser_consumer_wr
if (ret)
return ret;
- scoped_guard(mutex, &data->consumer_lock)
+ scoped_guard(mutex, &data->lock)
strscpy(data->consumer, buf, sizeof(data->consumer));
return count;
@@ -680,7 +680,12 @@ static int gpio_virtuser_interrupts_set(
if (val > 1)
return -EINVAL;
+ guard(mutex)(&ld->lock);
+
if (val) {
+ if (ld->irq >= 0)
+ return -EBUSY;
+
irq = gpiod_to_irq(ld->ad.desc);
if (irq < 0)
return irq;
@@ -694,11 +699,13 @@ static int gpio_virtuser_interrupts_set(
if (ret)
return ret;
- atomic_set(&ld->irq, irq);
+ ld->irq = irq;
} else {
- irq = atomic_xchg(&ld->irq, 0);
- if (irq)
- free_irq(irq, ld);
+ if (ld->irq < 0)
+ return -EBUSY;
+
+ free_irq(ld->irq, ld);
+ ld->irq = -1;
}
return 0;
@@ -798,6 +805,14 @@ static int gpio_virtuser_dbgfs_init_line
data->ad.dbgfs_dir, data);
}
+static void gpio_virtuser_free_irq(void *data)
+{
+ struct gpio_virtuser_line_data *ld = data;
+
+ if (ld->irq >= 0)
+ free_irq(ld->irq, ld);
+}
+
static int gpio_virtuser_dbgfs_init_line_attrs(struct device *dev,
struct gpio_desc *desc,
const char *id,
@@ -814,14 +829,18 @@ static int gpio_virtuser_dbgfs_init_line
data->ad.desc = desc;
strscpy(data->consumer, id);
- atomic_set(&data->irq, 0);
+ data->irq = -1;
atomic_set(&data->irq_count, 0);
+ ret = devm_add_action_or_reset(dev, gpio_virtuser_free_irq, data);
+ if (ret)
+ return ret;
+
name = devm_kasprintf(dev, GFP_KERNEL, "gpiod:%s:%u", id, index);
if (!name)
return -ENOMEM;
- ret = devm_mutex_init(dev, &data->consumer_lock);
+ ret = devm_mutex_init(dev, &data->lock);
if (ret)
return ret;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 830/990] gpio: virtuser: remove the debugfs files before freeing the line data
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (828 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 829/990] gpio: virtuser: fix interrupt leak and UAF Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 832/990] ovl: reject different lower idmaps on the same fs Greg Kroah-Hartman
` (22 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yu Zhang, Bartosz Golaszewski
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Zhang <yuz08559@gmail.com>
commit c2d0710318b8cd57d0ef6088d0ee4bbc1e827fd3 upstream.
gpio_virtuser_probe() registers the devm action that removes the debugfs
directory before it allocates the per-line and per-array data that the
debugfs files point to. devres releases resources in reverse order, so
on unbind the line data is freed, the consumer_lock mutex is destroyed
and the GPIO descriptors are put first, and the debugfs files are only
removed afterwards.
A read or write of any of the per-line debugfs files (value, direction,
consumer, interrupts, ...) that runs in that window dereferences the
freed data. debugfs_remove_recursive() waits for in-flight file
operations, but by then the data has already been freed.
Running eight threads that read the per-line debugfs files while
another task writes 1 and 0 to the configfs "live" attribute triggers
this within a second on a KASAN kernel, with gpio-sim as the provider:
BUG: KASAN: slab-use-after-free in gpio_virtuser_value_get+0x19/0x60
Read of size 8 at addr ffff888005109e38 by task vu_race/3479
Call Trace:
gpio_virtuser_value_get+0x19/0x60
simple_attr_read+0x109/0x290
debugfs_attr_read+0x5e/0x80
full_proxy_read+0xae/0xe0
vfs_read+0x1bc/0x7a0
Allocated by task 1:
devm_kmalloc+0x89/0x1d0
gpio_virtuser_probe+0x56f/0x910
Freed by task 1:
kfree+0x196/0x430
release_nodes+0x77/0xa0
devres_release_all+0xf3/0x150
device_unbind_cleanup+0x18/0x130
...
platform_device_unregister+0x3c/0x50
gpio_virtuser_device_deactivate+0x3c/0xc0
The same run also reports use-after-free on the freed consumer_lock
from the consumer attribute.
Register the debugfs removal action after the line data has been set
up, so that it runs first on unbind, and remove the directory by hand
on the probe error paths before that point.
Fixes: 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GPIO API")
Cc: stable@vger.kernel.org
Signed-off-by: Yu Zhang <yuz08559@gmail.com>
Link: https://patch.msgid.link/20261102075707.41742-1-yuz08559@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-virtuser.c | 46 +++++++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 17 deletions(-)
--- a/drivers/gpio/gpio-virtuser.c
+++ b/drivers/gpio/gpio-virtuser.c
@@ -951,38 +951,50 @@ static int gpio_virtuser_probe(struct pl
"Failed to get the IDs of GPIOs to request\n");
dbgfs_entry = debugfs_create_dir(dev_name(dev), gpio_virtuser_dbg_root);
- ret = devm_add_action_or_reset(dev, gpio_virtuser_debugfs_remove,
- dbgfs_entry);
- if (ret)
- return ret;
for (i = 0; i < num_ids; i++) {
descs = devm_gpiod_get_array(dev, ids[i], GPIOD_ASIS);
- if (IS_ERR(descs))
- return dev_err_probe(dev, PTR_ERR(descs),
- "Failed to request the '%s' GPIOs\n",
- ids[i]);
+ if (IS_ERR(descs)) {
+ ret = dev_err_probe(dev, PTR_ERR(descs),
+ "Failed to request the '%s' GPIOs\n",
+ ids[i]);
+ goto err_remove_debugfs;
+ }
ret = gpio_virtuser_dbgfs_init_line_array_attrs(dev, descs,
ids[i],
dbgfs_entry);
- if (ret)
- return dev_err_probe(dev, ret,
- "Failed to setup the debugfs array interface for the '%s' GPIOs\n",
- ids[i]);
+ if (ret) {
+ dev_err_probe(dev, ret,
+ "Failed to setup the debugfs array interface for the '%s' GPIOs\n",
+ ids[i]);
+ goto err_remove_debugfs;
+ }
for (j = 0; j < descs->ndescs; j++) {
ret = gpio_virtuser_dbgfs_init_line_attrs(dev,
descs->desc[j], ids[i],
j, dbgfs_entry);
- if (ret)
- return dev_err_probe(dev, ret,
- "Failed to setup the debugfs line interface for the '%s' GPIOs\n",
- ids[i]);
+ if (ret) {
+ dev_err_probe(dev, ret,
+ "Failed to setup the debugfs line interface for the '%s' GPIOs\n",
+ ids[i]);
+ goto err_remove_debugfs;
+ }
}
}
- return 0;
+ /*
+ * The debugfs files point to the devres-managed line data allocated
+ * above. Register the removal last so that it runs first on unbind,
+ * before any of that data is released.
+ */
+ return devm_add_action_or_reset(dev, gpio_virtuser_debugfs_remove,
+ dbgfs_entry);
+
+err_remove_debugfs:
+ debugfs_remove_recursive(dbgfs_entry);
+ return ret;
}
static const struct of_device_id gpio_virtuser_of_match[] = {
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 832/990] ovl: reject different lower idmaps on the same fs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (829 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 830/990] gpio: virtuser: remove the debugfs files before freeing the line data Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 833/990] ovl: report the requested redirect_dir mode in conflicting options Greg Kroah-Hartman
` (21 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Christian Brauner,
Jérémy Jean, Amir Goldstein
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>
commit 720f40c05b2785406121da0151543751204f2953 upstream.
Overayfs mounted with index=on or nfs_export=on require file handle
support from backing filesystems.
Overlay file handles identify a backing filesystem, but not the lower
mount used to decode it. If lower layers share a superblock and use
different idmaps, a handle can decode through the wrong layer.
Record the first idmap on a private lower clone for each backing
filesystem. Fail if another clone has a different idmap. Comparing
the private clones prevents mount_setattr() from changing the checked
state. Distinct idmap objects are treated as ambiguous.
Fixes: bc70682a497c ("ovl: support idmapped layers")
Suggested-by: Christian Brauner <brauner@kernel.org>
Link: Link: https://lore.kernel.org/all/20260925-server-hager-riskieren-06116eded213@brauner/
Cc: stable@vger.kernel.org
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/overlayfs/ovl_entry.h | 2 ++
fs/overlayfs/super.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+)
--- a/fs/overlayfs/ovl_entry.h
+++ b/fs/overlayfs/ovl_entry.h
@@ -24,6 +24,8 @@ struct ovl_config {
struct ovl_sb {
struct super_block *sb;
dev_t pseudo_dev;
+ /* Idmap of the first lower layer on this fs */
+ const struct mnt_idmap *lower_idmap;
/* Unusable (conflicting) uuid */
bool bad_uuid;
/* Used as a lower layer (but maybe also as upper) */
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1125,6 +1125,29 @@ static int ovl_get_layers(struct super_b
}
/*
+ * Lower file handles identify the lower fs, but not the layer,
+ * so with different idmaps on the same lower fs, index and
+ * nfs_export may decode a file handle through a layer with the
+ * wrong idmap. Following copy up origin without index is only
+ * used for st_ino, which does not depend on the idmap.
+ */
+ if (i < nr_merged_lower &&
+ (ofs->config.index || ofs->config.nfs_export)) {
+ const struct mnt_idmap *idmap = mnt_idmap(mnt);
+ struct ovl_sb *fs = &ofs->fs[fsid];
+
+ if (!fs->lower_idmap) {
+ fs->lower_idmap = idmap;
+ } else if (fs->lower_idmap != idmap) {
+ pr_err("lower layer '%pd2' conflicts with idmap of another lower layer on the same fs, mount with '-o index=off,nfs_export=off' to override.\n",
+ l->path.dentry);
+ iput(trap);
+ kern_unmount(mnt);
+ return -EINVAL;
+ }
+ }
+
+ /*
* Make lower layers R/O. That way fchmod/fchown on lower file
* will fail instead of modifying lower fs.
*/
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 833/990] ovl: report the requested redirect_dir mode in conflicting options
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (830 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 832/990] ovl: reject different lower idmaps on the same fs Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 841/990] smb: client: fix OOB write when compounding SMB2_IOCTL with encryption Greg Kroah-Hartman
` (20 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Amir Goldstein
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <amir73il@gmail.com>
commit 248503755b3cab89742edcc3cfd53adbcf7bfec2 upstream.
Since the redirect_dir mode is stored as an enum, "off" is translated to
"follow" or "nofollow" when parsing the option and redirect_dir=follow is
translated to "on" for a non-upper mount, so the errors about options
that conflict with an explicit redirect_dir= report a mode that the user
did not request.
Translate "off" when verifying the mount options instead of when parsing
them and report the requested mode in those errors.
Fixes: af5f2396b671 ("ovl: store enum redirect_mode in config instead of a string")
Cc: stable@vger.kernel.org
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/overlayfs/overlayfs.h | 10 +++++++---
fs/overlayfs/params.c | 43 ++++++++++++++++++++++++++++++-------------
2 files changed, 37 insertions(+), 16 deletions(-)
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -74,9 +74,13 @@ enum ovl_entry_flag {
};
enum {
- OVL_REDIRECT_OFF, /* "off" mode is never used. In effect */
- OVL_REDIRECT_FOLLOW, /* ...it translates to either "follow" */
- OVL_REDIRECT_NOFOLLOW, /* ...or "nofollow". */
+ /*
+ * "off" mode is never used after mount options are verified. In effect
+ * it translates to either "follow" or "nofollow".
+ */
+ OVL_REDIRECT_OFF,
+ OVL_REDIRECT_FOLLOW,
+ OVL_REDIRECT_NOFOLLOW,
OVL_REDIRECT_ON,
};
--- a/fs/overlayfs/params.c
+++ b/fs/overlayfs/params.c
@@ -112,18 +112,28 @@ const struct constant_table ovl_paramete
{}
};
+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)
{
- return ovl_parameter_redirect_dir[config->redirect_mode].name;
+ return ovl_redirect_mode_name(config->redirect_mode);
}
-static int ovl_redirect_mode_def(void)
+static int ovl_redirect_follow_mode(void)
{
- return ovl_redirect_dir_def ? OVL_REDIRECT_ON :
- ovl_redirect_always_follow ? OVL_REDIRECT_FOLLOW :
+ return ovl_redirect_always_follow ? OVL_REDIRECT_FOLLOW :
OVL_REDIRECT_NOFOLLOW;
}
+static int ovl_redirect_mode_def(void)
+{
+ return ovl_redirect_dir_def ? OVL_REDIRECT_ON :
+ ovl_redirect_follow_mode();
+}
+
static const struct constant_table ovl_parameter_verity[] = {
{ "off", OVL_VERITY_OFF },
{ "on", OVL_VERITY_ON },
@@ -656,11 +666,6 @@ static int ovl_parse_param(struct fs_con
break;
case Opt_redirect_dir:
config->redirect_mode = result.uint_32;
- if (config->redirect_mode == OVL_REDIRECT_OFF) {
- config->redirect_mode = ovl_redirect_always_follow ?
- OVL_REDIRECT_FOLLOW :
- OVL_REDIRECT_NOFOLLOW;
- }
ctx->set.redirect = true;
break;
case Opt_index:
@@ -816,7 +821,13 @@ int ovl_init_fs_context(struct fs_contex
if (!ofs)
goto out_err;
- ofs->config.redirect_mode = ovl_redirect_mode_def();
+ /*
+ * The module default determines only if new redirects are created in
+ * upper dir. If they are not, the redirect follow mode will be
+ * determined after parsing mount options.
+ */
+ ofs->config.redirect_mode = ovl_redirect_dir_def ?
+ OVL_REDIRECT_ON : OVL_REDIRECT_OFF;
ofs->config.index = ovl_index_def;
ofs->config.uuid = ovl_uuid_def();
ofs->config.nfs_export = ovl_nfs_export_def;
@@ -874,6 +885,8 @@ int ovl_fs_params_verify(const struct ov
struct ovl_config *config)
{
struct ovl_opt_set set = ctx->set;
+ /* The requested redirect_dir=, for reporting conflicts with it */
+ int redirect_opt = config->redirect_mode;
/* Workdir/index are useless in non-upper mount */
if (!config->upperdir) {
@@ -900,6 +913,10 @@ int ovl_fs_params_verify(const struct ov
config->uuid = OVL_UUID_NULL;
}
+ /* Resolve redirect_dir=off to the default redirect follow mode */
+ if (config->redirect_mode == OVL_REDIRECT_OFF)
+ config->redirect_mode = ovl_redirect_follow_mode();
+
/*
* This is to make the logic below simpler. It doesn't make any other
* difference, since redirect_dir=on is only used for upper.
@@ -911,7 +928,7 @@ int ovl_fs_params_verify(const struct ov
if (config->metacopy && config->redirect_mode != OVL_REDIRECT_ON) {
if (set.metacopy && set.redirect) {
pr_err("conflicting options: metacopy=on,redirect_dir=%s\n",
- ovl_redirect_mode(config));
+ ovl_redirect_mode_name(redirect_opt));
return -EINVAL;
}
if (set.redirect) {
@@ -920,7 +937,7 @@ int ovl_fs_params_verify(const struct ov
* in this conflict.
*/
pr_info("disabling metacopy due to redirect_dir=%s\n",
- ovl_redirect_mode(config));
+ ovl_redirect_mode_name(redirect_opt));
config->metacopy = false;
} else {
/* Automatically enable redirect otherwise. */
@@ -987,7 +1004,7 @@ int ovl_fs_params_verify(const struct ov
if (set.redirect &&
config->redirect_mode != OVL_REDIRECT_NOFOLLOW) {
pr_err("conflicting options: userxattr,redirect_dir=%s\n",
- ovl_redirect_mode(config));
+ ovl_redirect_mode_name(redirect_opt));
return -EINVAL;
}
if (config->metacopy && set.metacopy) {
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 841/990] smb: client: fix OOB write when compounding SMB2_IOCTL with encryption
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (831 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 833/990] ovl: report the requested redirect_dir mode in conflicting options Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 842/990] smb: client: fix out-of-bounds read in dfs_parse_target_referral() Greg Kroah-Hartman
` (19 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Andrey Misiurov, Namjae Jeon,
Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Misiurov <andrey.misyrov@gmail.com>
commit 73a0060cb22a1d2bd8bff364c18a4259ec0cb528 upstream.
On an encrypted ("seal") mount, SMB2_ioctl_init() keeps the IOCTL input
in a separate iov (iov[1]); iov[0] is a 448-byte buffer from
cifs_small_buf_get(). When such an IOCTL is not the last request of a
compound, smb2_set_next_command() pads it for alignment by copying the
whole request into iov[0]. A large enough input overflows that 448-byte
buffer and corrupts the slab; the copy also sets rq_nvec to 1, so the
input buffer is leaked too.
An unprivileged user can trigger it by creating a symlink with a long
target on such a mount: the native symlink is sent as
FSCTL_SET_REPARSE_POINT + QUERY_INFO + CLOSE in one compound, so the
IOCTL is not the last request.
With slub_debug red zones on the cifs_small_rq cache, the overflow is
caught on the next allocation from that cache in the same compound (the
0x61 bytes are the 'a' characters of the symlink target):
BUG cifs_small_rq (Not tainted): Object corrupt
[Left Redzone overwritten] 0xffff8a59c7790500-0xffff8a59c779053f
First byte 0x61 instead of 0xbb
Call Trace:
check_object+0x1a8/0x350
alloc_debug_processing+0xab/0x110
___slab_alloc+0x7e/0x2f0
kmem_cache_alloc_noprof+0x28d/0x4b0
mempool_alloc_slab+0x16/0x30
cifs_small_buf_get+0x1a/0x30 [cifs]
SMB2_close_init+0x8a/0x100 [cifs]
smb2_compound_op+0x2571/0x2b50 [cifs]
smb2_create_reparse_inode+0x27e/0x490 [cifs]
mknod_nfs+0x1ce/0x2e0 [cifs]
create_reparse_symlink+0x119/0x180 [cifs]
cifs_symlink+0x19f/0x8e0 [cifs]
vfs_symlink+0xa3/0x1b0
__x64_sys_symlink+0x41/0x70
Pad the input to a multiple of 8 bytes when encryption is required. The
request is then already aligned and smb2_set_next_command() no longer
copies it; InputCount still carries the real length.
Fixes: 90f7c100d2dd ("smb: client: fix compound alignment with encryption")
Cc: stable@vger.kernel.org
Signed-off-by: Andrey Misiurov <andrey.misyrov@gmail.com>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/smb2pdu.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -3354,11 +3354,12 @@ SMB2_ioctl_init(struct cifs_tcon *tcon,
char *in_data, u32 indatalen,
__u32 max_response_size)
{
- struct smb2_ioctl_req *req;
struct kvec *iov = rqst->rq_iov;
+ struct smb2_ioctl_req *req;
+ u32 in_buf_len = indatalen;
unsigned int total_len;
- int rc;
char *in_data_buf;
+ int rc;
rc = smb2_ioctl_req_init(opcode, tcon, server,
(void **) &req, &total_len);
@@ -3366,15 +3367,18 @@ SMB2_ioctl_init(struct cifs_tcon *tcon,
return rc;
if (indatalen) {
+ if (smb3_encryption_required(tcon))
+ in_buf_len = ALIGN(indatalen, 8);
/*
* indatalen is usually small at a couple of bytes max, so
* just allocate through generic pool
*/
- in_data_buf = kmemdup(in_data, indatalen, GFP_NOFS);
+ in_data_buf = kzalloc(in_buf_len, GFP_NOFS);
if (!in_data_buf) {
cifs_small_buf_release(req);
return -ENOMEM;
}
+ memcpy(in_data_buf, in_data, indatalen);
}
req->CtlCode = cpu_to_le32(opcode);
@@ -3398,7 +3402,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon,
rqst->rq_nvec = 2;
iov[0].iov_len = total_len - 1;
iov[1].iov_base = in_data_buf;
- iov[1].iov_len = indatalen;
+ iov[1].iov_len = in_buf_len;
} else {
rqst->rq_nvec = 1;
iov[0].iov_len = total_len;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 842/990] smb: client: fix out-of-bounds read in dfs_parse_target_referral()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (832 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 841/990] smb: client: fix OOB write when compounding SMB2_IOCTL with encryption Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 843/990] smb: client: flush deferred handles of other names before a hard link open Greg Kroah-Hartman
` (18 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Fredric Cover, Namjae Jeon,
Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fredric Cover <fredric.cover.lkernel@gmail.com>
commit 86aacc2f3f6ba18e1d87feee24f37c94b3ce863a upstream.
dfs_parse_target_referral() decides whether a prefix path remains after
the consumed part of full_path with:
if (strlen(full_path) - ref->path_consumed)
strlen() returns size_t, so if path_consumed is larger than the length
of full_path, the subtraction wraps around to a huge non-zero value.
The branch is then taken, prepath is set to a pointer past the
terminating NUL of full_path, and *prepath reads out of bounds.
path_consumed can exceed strlen(full_path) when the mount charset is
not utf8. The referral code derives path_consumed from the canonical
path, which is in the DFS cache charset (utf8), but it is applied here
to full_path, which is in the mount charset. Each non-ASCII character
in the consumed part of the path that is longer in utf8 than in the
mount charset makes the count too large by the difference.
This was reproduced with iocharset=iso8859-1 against a Samba DFS root
containing a link named "café", mounting with the single Latin-1 byte
0xe9 in the path. On an unmodified tree such a mount fails earlier
with -ENOENT because the path is converted to utf8 twice in
setup_dfs_ref(); with that fixed ("smb: client: fix double conversion
of DFS path in setup_dfs_ref()"), the mount reaches this code.
full_path was 29 bytes while path_consumed was 30:
BUG: KASAN: slab-out-of-bounds in dfs_parse_target_referral+0x26a/0x270
Read of size 1 at addr ffff88810db89d5f by task mount/1743
...
The buggy address is located 0 bytes to the right of
allocated 31-byte region [ffff88810db89d40, ffff88810db89d5f)
Compare path_consumed against the string length instead of subtracting,
so that no prefix path is used when the consumed count covers the whole
string. With the bounds check in place the same mount succeeds and no
KASAN report is produced.
This only prevents the out-of-bounds access. path_consumed is still in
the wrong units, so a non-ASCII link followed by a path component can
still produce a wrong prefix path. That needs a separate fix.
Signed-off-by: Fredric Cover <fredric.cover.lkernel@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/dfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -33,7 +33,7 @@ int dfs_parse_target_referral(const char
if (WARN_ON_ONCE(!ref->node_name || ref->path_consumed < 0))
return -EINVAL;
- if (strlen(full_path) - ref->path_consumed) {
+ if ((size_t)ref->path_consumed < strlen(full_path)) {
prepath = full_path + ref->path_consumed;
/* skip initial delimiter */
if (*prepath == '/' || *prepath == '\\')
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 843/990] smb: client: flush deferred handles of other names before a hard link open
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (833 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 842/990] smb: client: fix out-of-bounds read in dfs_parse_target_referral() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 844/990] smb: client: hold the inode across cifs_oplock_break() Greg Kroah-Hartman
` (17 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Giuseppe Piscitelli, Namjae Jeon,
Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit 25912ed3b75dcf5ff623dcb549b925dd0d0948f7 upstream.
Opening a hard link of a file whose other name still holds a deferred,
leased handle fails with EINVAL over SMB3. The client caches lease keys
per inode, but the server ties a lease to the file name it was granted
under, so reusing the inode's lease key to open a different name of the
same inode is rejected with STATUS_INVALID_PARAMETER (MS-SMB2 3.3.5.9.11).
Commit 262b73ef442e ("smb3 client: fix open hardlink on deferred close
file error") already closes the inode's deferred handles before such an
open so the new name can take a fresh lease, but cifs_get_hardlink_path()
only triggered that flush when a cached handle had the same open flags as
the new open, so a differently accessed name - written then read, say -
slipped through and still failed.
Match on the name instead: flush when a cached handle for another name of
the inode is open, regardless of access mode.
Reported-by: Giuseppe Piscitelli <ooonea@gmail.com>
Closes: https://lore.kernel.org/r/CACmoRBbDZR3eyEM65j73sWMS7A=T89z1QAvCP=+u0WGzZhwW6g@mail.gmail.com
Fixes: 262b73ef442e ("smb3 client: fix open hardlink on deferred close file error")
Cc: stable@vger.kernel.org
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -2206,7 +2206,7 @@ cifs_get_hardlink_path(struct cifs_tcon
spin_lock(&cinode->open_file_lock);
list_for_each_entry(open_file, &cinode->openFileList, flist) {
- if (file->f_flags == open_file->f_flags) {
+ if (open_file->dentry != file_dentry(file)) {
rc = -EINVAL;
break;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 844/990] smb: client: hold the inode across cifs_oplock_break()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (834 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 843/990] smb: client: flush deferred handles of other names before a hard link open Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 845/990] smb: client: issue writes from a worker if the task is dying Greg Kroah-Hartman
` (16 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joseph Qi, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <joseph.qi@linux.alibaba.com>
commit fce78321f1b59531cf6fc94860550db1db8dec55 upstream.
cifs_oplock_break() drops the handle reference in the middle of the
handler and keeps using cinode afterwards, to send the break
acknowledgment and again in cifs_done_oplock_break(). The reference
cifs_queue_oplock_break() takes is the only pin: the handle holds the
dentry and the dentry is what keeps the inode alive.
When that put is the last reference, the dput() in
cifsFileInfo_put_final() kills an unhashed dentry, drops the last
i_count and evicts the inode, so the rest of the handler runs on an
object whose free is only RCU-deferred. An unhashed dentry that a
handle still references is an ordinary state: unlinking an open file
leaves the dentry that way, and so does the dcache teardown at unmount.
Take a reference on the inode for the lifetime of the handler and drop
it once the break has been reported. This also covers the
cifs_get_tlink() failure path, where the put is followed directly by
the out label.
Fixes: b98749cac4a6 ("CIFS: keep FileInfo handle live during oplock break")
Fixes: 23b26f4408ac ("smb: client: avoid leaking refcount when cifs_sb_tlink() fails")
Cc: stable@vger.kernel.org
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/file.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3284,6 +3284,14 @@ void cifs_oplock_break(struct work_struc
__u64 persistent_fid, volatile_fid;
__u16 net_fid;
+ /*
+ * Dropping the handle reference below also drops the dentry
+ * reference that pins this inode, and cinode is still needed to
+ * acknowledge the break and to report it as complete. Hold the inode
+ * until that is done.
+ */
+ ihold(inode);
+
wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
TASK_UNINTERRUPTIBLE);
@@ -3359,6 +3367,7 @@ oplock_break_ack:
cifs_put_tlink(tlink);
out:
cifs_done_oplock_break(cinode);
+ iput(inode);
}
static int cifs_swap_activate(struct swap_info_struct *sis,
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 845/990] smb: client: issue writes from a worker if the task is dying
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (835 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 844/990] smb: client: hold the inode across cifs_oplock_break() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 846/990] smb: client: retry writes that couldnt be issued due to a reconnect Greg Kroah-Hartman
` (15 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit 1a747bacf250959703c68fed1bb643f888dd3ad2 upstream.
A task with a fatal signal pending can't send on the socket:
__smb_send_rqst() refuses it upfront with -ERESTARTSYS, as SIGKILL can't
be blocked and a send interrupted halfway forces a reconnect. Writeback,
however, runs in the context of whoever starts it, so when a dying task
flushes dirty pages - close() racing with SIGKILL, or fd teardown during
exit_group() - every write subrequest gets refused:
smb3_write_err: ... offset=0x1400000 len=0x400000 rc=-512
cifs_flush_err: ino=... rc=-512
Since the switch to netfslib, a failed upload ends writeback with the
folios clean, so the data is silently lost: the server ends up with
20MiB of a 64MiB file while stat(2) reports the full size.
Issue writeback subrequests of dying tasks from a new cifswritebackd
workqueue instead, like afs does for all of its writes, so they get sent
from a context with no signals. Leave direct and unbuffered writes
alone, as their callers get the error. Use a dedicated WQ_UNBOUND
workqueue as the writes may block for long on credits, sends or reopens,
e.g. on hard mounts with an unresponsive server, and must not hold up
other cifs work such as reconnects, nor starve the WQ_MEM_RECLAIM
rescuer of cifsiod_wq.
Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/cifsfs.c | 13 ++++++++++++-
fs/smb/client/cifsglob.h | 1 +
fs/smb/client/file.c | 26 +++++++++++++++++++++++++-
3 files changed, 38 insertions(+), 2 deletions(-)
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -198,6 +198,7 @@ struct workqueue_struct *cifsoplockd_wq;
struct workqueue_struct *deferredclose_wq;
struct workqueue_struct *serverclose_wq;
struct workqueue_struct *cfid_put_wq;
+struct workqueue_struct *cifs_writeback_wq;
__u32 cifs_lock_secret;
/*
@@ -2076,9 +2077,16 @@ init_cifs(void)
goto out_destroy_serverclose_wq;
}
+ cifs_writeback_wq = alloc_workqueue("cifswritebackd",
+ WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
+ if (!cifs_writeback_wq) {
+ rc = -ENOMEM;
+ goto out_destroy_cfid_put_wq;
+ }
+
rc = cifs_init_inodecache();
if (rc)
- goto out_destroy_cfid_put_wq;
+ goto out_destroy_writeback_wq;
rc = cifs_init_netfs();
if (rc)
@@ -2149,6 +2157,8 @@ out_destroy_netfs:
cifs_destroy_netfs();
out_destroy_inodecache:
cifs_destroy_inodecache();
+out_destroy_writeback_wq:
+ destroy_workqueue(cifs_writeback_wq);
out_destroy_cfid_put_wq:
destroy_workqueue(cfid_put_wq);
out_destroy_serverclose_wq:
@@ -2194,6 +2204,7 @@ exit_cifs(void)
destroy_workqueue(fileinfo_put_wq);
destroy_workqueue(serverclose_wq);
destroy_workqueue(cfid_put_wq);
+ destroy_workqueue(cifs_writeback_wq);
destroy_workqueue(cifsiod_wq);
}
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -2108,6 +2108,7 @@ extern struct workqueue_struct *cifsoplo
extern struct workqueue_struct *deferredclose_wq;
extern struct workqueue_struct *serverclose_wq;
extern struct workqueue_struct *cfid_put_wq;
+extern struct workqueue_struct *cifs_writeback_wq;
extern __u32 cifs_lock_secret;
extern mempool_t *cifs_sm_req_poolp;
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -106,10 +106,16 @@ retry:
#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.
*/
-static void cifs_issue_write(struct netfs_io_subrequest *subreq)
+static void __cifs_issue_write(struct netfs_io_subrequest *subreq)
{
struct cifs_io_subrequest *wdata =
container_of(subreq, struct cifs_io_subrequest, subreq);
@@ -143,6 +149,24 @@ fail:
goto out;
}
+static void cifs_issue_write_worker(struct work_struct *work)
+{
+ struct netfs_io_subrequest *subreq;
+
+ subreq = container_of(work, struct netfs_io_subrequest, work);
+ __cifs_issue_write(subreq);
+}
+
+static void cifs_issue_write(struct netfs_io_subrequest *subreq)
+{
+ if (unlikely(cifs_writeback_dying(subreq))) {
+ subreq->work.func = cifs_issue_write_worker;
+ WARN_ON_ONCE(!queue_work(cifs_writeback_wq, &subreq->work));
+ return;
+ }
+ __cifs_issue_write(subreq);
+}
+
static void cifs_netfs_invalidate_cache(struct netfs_io_request *wreq)
{
cifs_invalidate_cache(wreq->inode, 0);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 846/990] smb: client: retry writes that couldnt be issued due to a reconnect
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (836 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 845/990] smb: client: issue writes from a worker if the task is dying Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 847/990] smb: client: skip NULL channel in __cifs_put_smb_ses() Greg Kroah-Hartman
` (14 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, David Howells, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <pc@manguebit.org>
commit 64db0dc1f3e689145e698bc1b20ee70b1724b945 upstream.
__cifs_issue_write() fails a subrequest with -EAGAIN when its handle got
invalidated or its credits belong to a session from before a reconnect,
both before sending anything. netfs used to retry any -EAGAIN by itself,
but now only retries subrequests marked for it, so these writes fail and
their folios end writeback clean, losing the data.
Mark them for retry instead. The retry gets the handle reopened and
fresh credits in cifs_prepare_write().
Fixes: 82e8885bd763 ("netfs: when subreq is marked for retry, do not check if it faced an error")
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -140,10 +140,12 @@ out:
return;
fail:
- if (rc == -EAGAIN)
+ if (rc == -EAGAIN) {
trace_netfs_sreq(subreq, netfs_sreq_trace_retry);
- else
+ __set_bit(NETFS_SREQ_NEED_RETRY, &subreq->flags);
+ } else {
trace_netfs_sreq(subreq, netfs_sreq_trace_fail);
+ }
add_credits_and_wake_if(wdata->server, &wdata->credits, 0);
cifs_write_subrequest_terminated(wdata, rc);
goto out;
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 847/990] smb: client: skip NULL channel in __cifs_put_smb_ses()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (837 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 846/990] smb: client: retry writes that couldnt be issued due to a reconnect Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 848/990] smb: client: validate descriptor headers before query result allocation Greg Kroah-Hartman
` (13 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Joseph Qi, Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <joseph.qi@linux.alibaba.com>
commit 8deaf64a59a263161dfc5128f8398fb3dcba4fac upstream.
cifs_chan_skip_or_disable() clears a secondary channel's slot in the
session (ses->chans[chan_index].server = NULL) without lowering
chan_count when the server stops supporting multichannel. When the
session is later released, __cifs_put_smb_ses() walks every slot up to
chan_count and calls cifs_put_tcp_session() on it, which dereferences
the server pointer immediately, so a slot left NULL by the skip path
makes the release crash with a NULL pointer dereference.
Clearing a slot without lowering chan_count is older than
cifs_chan_skip_or_disable(): cifs_chan_update_iface() could already do
the same since commit b54034a73baf9 ("cifs: during reconnect, update
interface if necessary"), and the release loop has been unguarded
since then. Commit 12d1e301bdfd1 ("cifs: do not let
cifs_chan_update_iface deallocate channels") later removed that
trigger, but the crash is reachable through it on older kernels.
cifs_decrease_secondary_channels() already guards the same put with
if (server). Add the same guard to the release loop so a skipped
channel slot is left alone.
Fixes: b54034a73baf9 ("cifs: during reconnect, update interface if necessary")
Cc: stable@vger.kernel.org
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/connect.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2178,7 +2178,8 @@ void __cifs_put_smb_ses(struct cifs_ses
kref_put(&ses->chans[i].iface->refcount, release_iface);
ses->chans[i].iface = NULL;
}
- cifs_put_tcp_session(ses->chans[i].server, 0);
+ if (ses->chans[i].server)
+ cifs_put_tcp_session(ses->chans[i].server, 0);
ses->chans[i].server = NULL;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 848/990] smb: client: validate descriptor headers before query result allocation
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (838 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 847/990] smb: client: skip NULL channel in __cifs_put_smb_ses() Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 849/990] dm log userspace: drop the device reference on error Greg Kroah-Hartman
` (12 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, liuyong, Namjae Jeon,
Paulo Alcantara
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: liuyong <pkfxxxing@gmail.com>
commit ffb59029c0d52bf76fdd2678f5d6fd13e26220dd upstream.
query_info() uses the server's returned length instead of the caller's
minimum when a dynamic result is requested. A zero-length ACL response
can therefore return ZERO_SIZE_PTR to id_mode_to_cifs_acl(), whose
ownership-change path reads dacloffset before checking the header size.
A KASAN-enabled test shows a read at address 0x20 and a kernel Oops.
Validate the returned range and the caller's minimum before allocating
the dynamic result. Keep the reported length zero if validation fails.
Use the security descriptor header size as the minimum in SMB2_query_acl().
DACL-only and SACL-only xattr queries do not require owner and group SIDs,
so enforcing MIN_SEC_DESC_LEN would reject short descriptors that these
queries could previously return. The rewrite paths validate the required
owner/group SIDs and DACL separately before using their contents.
These issues were discovered and fixed by Qihoo 360's Tulongfeng
multi-agent system.
Fixes: 9ee2afe5207b ("cifs: prevent copying past input buffer boundaries")
Cc: stable@vger.kernel.org
Signed-off-by: liuyong <pkfxxxing@gmail.com>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/smb/client/cifsacl.h | 14 --------------
fs/smb/client/smb2pdu.c | 11 ++++++++++-
2 files changed, 10 insertions(+), 15 deletions(-)
--- a/fs/smb/client/cifsacl.h
+++ b/fs/smb/client/cifsacl.h
@@ -93,18 +93,4 @@ struct owner_group_sids {
struct owner_sid group;
} __packed;
-/*
- * Minimum security identifier can be one for system defined Users
- * and Groups such as NULL SID and World or Built-in accounts such
- * as Administrator and Guest and consists of
- * Revision + Num (Sub)Auths + Authority + Domain (one Subauthority)
- */
-#define MIN_SID_LEN (1 + 1 + 6 + 4) /* in bytes */
-
-/*
- * Minimum security descriptor can be one without any SACL and DACL and can
- * consist of revision, type, and two sids of minimum size for owner and group
- */
-#define MIN_SEC_DESC_LEN (sizeof(struct smb_ntsd) + (2 * MIN_SID_LEN))
-
#endif /* _CIFSACL_H */
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -3940,6 +3940,14 @@ replay_again:
ses->Suid, info_class, (__u32)info_type);
if (dlen) {
+ rc = smb2_validate_iov(le16_to_cpu(rsp->OutputBufferOffset),
+ le32_to_cpu(rsp->OutputBufferLength),
+ &rsp_iov, min_len);
+ if (rc) {
+ *dlen = 0;
+ goto qinf_exit;
+ }
+
*dlen = le32_to_cpu(rsp->OutputBufferLength);
if (!*data) {
*data = kmalloc(*dlen, GFP_KERNEL);
@@ -4012,7 +4020,8 @@ SMB2_query_acl(const unsigned int xid, s
return query_info(xid, tcon, persistent_fid, volatile_fid,
0, SMB2_O_INFO_SECURITY, extra_info,
- SMB2_MAX_BUFFER_SIZE, MIN_SEC_DESC_LEN, data, plen);
+ SMB2_MAX_BUFFER_SIZE, sizeof(struct smb_ntsd),
+ data, plen);
}
int
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 849/990] dm log userspace: drop the device reference on error
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (839 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 848/990] smb: client: validate descriptor headers before query result allocation Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 850/990] dm: avoid double-dropping the zone reset submission reference Greg Kroah-Hartman
` (11 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: shao.mingyin@zte.com.cn <shao.mingyin@zte.com.cn>
commit 0550d3b14e008b033b02cfce668008ec6addffe4 upstream.
userspace_ctr() takes a reference on the log device with
dm_get_device(). When the integrated-flush workqueue allocation fails it
jumps to the shared error path, which frees the log context without
dropping that reference, so the device stays busy and cannot be removed.
userspace_dtr() drops the reference correctly; do the same here.
Fixes: 5066a4df1f42 ("dm log userspace: allow mark requests to piggyback on flush requests")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-log-userspace-base.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -294,9 +294,11 @@ static int userspace_ctr(struct dm_dirty
}
r = dm_get_device(ti, devices_rdata,
dm_table_get_mode(ti->table), &lc->log_dev);
- if (r)
+ if (r) {
DMERR("Failed to register %s with device-mapper",
devices_rdata);
+ goto out;
+ }
}
if (lc->integrated_flush) {
@@ -315,6 +317,8 @@ static int userspace_ctr(struct dm_dirty
out:
kfree(devices_rdata);
if (r) {
+ if (lc->log_dev)
+ dm_put_device(lc->ti, lc->log_dev);
mempool_exit(&lc->flush_entry_pool);
kfree(lc);
kfree(ctr_str);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 850/990] dm: avoid double-dropping the zone reset submission reference
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (840 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 849/990] dm log userspace: drop the device reference on error Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 851/990] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Greg Kroah-Hartman
` (10 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yaohan Li, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yaohan Li <shunsheng1218@gmail.com>
commit c4965effbe15f837a8089e79c0fc17ab19363cce upstream.
On an error in __send_zone_reset_all(), the submission reference
held by the dm_io can be decremented there and again by the caller's
error path. If another clone is still outstanding, the second drop
can release the dm_io before that clone completes.
Only drop the submission reference in __send_zone_reset_all() on
success. On failure, leave the reference for the caller's existing
error handling to release once.
The error path was reproduced under KASAN with an injected GFP_NOIO
allocation failure while another zone-reset clone remained in
flight. With the change, the same failure was reported normally,
without the observed use-after-free, and ordinary zone resets
continued to work.
Fixes: 81e7706345f06 ("dm: handle REQ_OP_ZONE_RESET_ALL")
Cc: stable@vger.kernel.org
Assisted-by: ZCode:GLM-4
Signed-off-by: Yaohan Li <shunsheng1218@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1924,8 +1924,13 @@ static blk_status_t __send_zone_reset_al
break;
}
- /* Release the reference that alloc_io() took for submission. */
- atomic_sub(1, &ci->io->io_count);
+ /*
+ * Release the reference that alloc_io() took for submission. On error,
+ * that reference was not consumed: dm_split_and_process_bio() releases
+ * it on the error path, so do not release it here a second time.
+ */
+ if (sts == BLK_STS_OK)
+ atomic_dec(&ci->io->io_count);
return sts;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 851/990] dm: fail a REQ_PREFLUSH bio with data when its preflush fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (841 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 850/990] dm: avoid double-dropping the zone reset submission reference Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 852/990] dm: fix infinite loop in dm_blk_do_report_zones() Greg Kroah-Hartman
` (9 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Daejun Park, Tejun Heo,
Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daejun Park <daejun7.park@samsung.com>
commit e92cd41e8e5ee5616c6c7cd4378661d942f0a7c0 upstream.
For a bio with REQ_PREFLUSH and data, dm core may send an empty flush
first. If the flush fails, __dm_io_complete() still reissues the bio
without REQ_PREFLUSH and drops the error. When that write succeeds,
the XFS log keeps running and fsync() can return 0.
End the bio with the flush error instead of writing the data, as
blk-mq does.
Fixes: 6a8736d10cb4 ("dm: relax ordering of bio-based flush implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -983,7 +983,7 @@ static void __dm_io_complete(struct dm_i
if (requeued)
return;
- if (unlikely(requeue_flush_with_data)) {
+ if (unlikely(requeue_flush_with_data) && !io_error) {
/*
* Preflush done for flush with data, reissue
* without REQ_PREFLUSH.
@@ -991,7 +991,7 @@ static void __dm_io_complete(struct dm_i
bio->bi_opf &= ~REQ_PREFLUSH;
queue_io(md, bio);
} else {
- /* done with normal IO or empty flush */
+ /* done with normal IO, empty flush or failed preflush */
if (io_error)
bio->bi_status = io_error;
bio_endio(bio);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 852/990] dm: fix infinite loop in dm_blk_do_report_zones()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (842 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 851/990] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Greg Kroah-Hartman
@ 2026-11-25 14:36 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 853/990] dm: Reject table setup after queue or disk teardown Greg Kroah-Hartman
` (8 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:36 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Mark Bundschuh, Mikulas Patocka,
Damien Le Moal
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Bundschuh <mkbund@amazon.com>
commit 648320de920b30ae1730bbf0e8b86c0df0fb490a upstream.
If the device underlying a zoned target is removed, its capacity is set
to 0 and blkdev_report_zones() returns 0 without reporting any zones.
The mapped device keeps its old capacity, so args->zone_idx and
args->next_sector never advance and dm_blk_do_report_zones() loops
forever. On non-preemptible kernels this causes soft lockups and RCU
stalls.
The following sequence of commands triggers the hang:
modprobe scsi_debug zbc=managed dev_size_mb=1024 zone_size_mb=64
udevadm settle
echo '0 2097152 linear /dev/sda 0' | dmsetup create lin
echo 1 > /sys/block/sda/device/delete
blkzone report -o 0 -c 1 /dev/mapper/lin
Fix this by returning -EIO when a target reports no zones. The target
always maps args->next_sector, so a zero return means the underlying
device no longer covers that sector.
Fixes: d41003513e61 ("block: rework zone reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-zone.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/md/dm-zone.c
+++ b/drivers/md/dm-zone.c
@@ -33,6 +33,8 @@ static int dm_blk_do_report_zones(struct
nr_zones - args->zone_idx);
if (ret < 0)
return ret;
+ if (!ret)
+ return -EIO;
} while (args->zone_idx < nr_zones &&
args->next_sector < get_capacity(md->disk));
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 853/990] dm: Reject table setup after queue or disk teardown
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (843 preceding siblings ...)
2026-11-25 14:36 ` [PATCH 6.18 852/990] dm: fix infinite loop in dm_blk_do_report_zones() Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 854/990] dm cache: reject kcopyd client destory if it setup failed Greg Kroah-Hartman
` (7 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+5307e3bcacec2ce4c2f0,
Kirtikumar Anandrao Ramchandani, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
commit ae310e4ad872a42f4707a596e66417f2aaa52826 upstream.
A failed table load can leave a mapped device in a state where its
queue has already been initialized or its disk has been removed, while
md->type is still DM_TYPE_NONE. A later table load then calls
blk_mq_init_allocated_queue() on the same queue. If del_gendisk() exited
the old hardware contexts, blk_mq_exit_hctx() dereferences their cleared
flush queue pointer.
Reject setup attempts after queue initialization or disk removal. A
failed request queue initialization still leaves md->tag_set NULL and
can be retried. Set the request-based disk operations only after that
initialization succeeds, so an unsuccessful attempt cannot leave a
bio-based retry with request-based operations.
Reported-by: syzbot+5307e3bcacec2ce4c2f0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5307e3bcacec2ce4c2f0
Cc: stable@vger.kernel.org
Signed-off-by: Kirtikumar Anandrao Ramchandani <kirtiar15502@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2596,13 +2596,17 @@ int dm_setup_md_queue(struct mapped_devi
WARN_ON_ONCE(type == DM_TYPE_NONE);
+ /* A failed setup may have left the queue initialized or the disk dead. */
+ if (md->tag_set || test_bit(GD_DEAD, &md->disk->state))
+ return -ENODEV;
+
if (type == DM_TYPE_REQUEST_BASED) {
- md->disk->fops = &dm_rq_blk_dops;
r = dm_mq_init_request_queue(md, t);
if (r) {
DMERR("Cannot initialize queue for request-based dm mapped device");
return r;
}
+ md->disk->fops = &dm_rq_blk_dops;
}
r = dm_calculate_queue_limits(t, &limits);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 854/990] dm cache: reject kcopyd client destory if it setup failed
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (844 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 853/990] dm: Reject table setup after queue or disk teardown Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 855/990] dm crypt: fix use of uninitialized percpu_counter in ctr error path Greg Kroah-Hartman
` (6 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+a2626a25eb2595e3ec3c,
Edward Adam Davis, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Adam Davis <eadavis@sina.com>
commit 8b97b168eb4d3affcf23d2980a0c3f35ed9262e2 upstream.
The value of cache->copier is -EINTR when failed to create a rescuer
kthread for wq kcopyd, in cache_create(), the code jumps directly to
__destroy(cache), it merely performs a simple check to see whether copier
is NULL, potentially hitting:
BUG: KASAN: null-ptr-deref in dm_kcopyd_client_destroy+0xae/0x480 drivers/md/dm-kcopyd.c:980
Read of size 4 at addr 0000000000000174 by task syz.2.19/6560
Call Trace:
dm_kcopyd_client_destroy+0xae/0x480 drivers/md/dm-kcopyd.c:980
__destroy+0x172/0x2f0 drivers/md/dm-cache-target.c:1973
cache_create drivers/md/dm-cache-target.c:2604 [inline]
cache_ctr+0x1674/0x2bf0 drivers/md/dm-cache-target.c:2649
dm_table_add_target+0x58d/0xc70 drivers/md/dm-table.c:749
populate_table drivers/md/dm-ioctl.c:1602 [inline]
table_load+0x325/0x8a0 drivers/md/dm-ioctl.c:1645
ctl_ioctl drivers/md/dm-ioctl.c:2221 [inline]
Set copier to NULL to avoid destroying a invalid kcopy client.
Cc: stable@vger.kernel.org
Fixes: c6b4fcbad044 ("dm: add cache target")
Reported-by: syzbot+a2626a25eb2595e3ec3c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a2626a25eb2595e3ec3c
Signed-off-by: Edward Adam Davis <eadavis@sina.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-cache-target.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -2550,6 +2550,7 @@ static int cache_create(struct cache_arg
if (IS_ERR(cache->copier)) {
*error = "could not create kcopyd client";
r = PTR_ERR(cache->copier);
+ cache->copier = NULL;
goto bad;
}
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 855/990] dm crypt: fix use of uninitialized percpu_counter in ctr error path
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (845 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 854/990] dm cache: reject kcopyd client destory if it setup failed Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 856/990] dm mpath: fix buffer overflow in parse_hw_handler() Greg Kroah-Hartman
` (5 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, syzbot+4b232570d625662eaab4,
Zhao Feng, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
commit 8ba1ade3e6b595b9091040feaa3341d7e45ba95d upstream.
If percpu_counter_init() fails in crypt_ctr() (e.g. when the
underlying percpu allocation fails under memory pressure or fault
injection), the error path jumps to "bad", which calls
crypt_dtr(). crypt_dtr() then evaluates
WARN_ON(percpu_counter_sum(&cc->n_allocated_pages) != 0) and calls
percpu_counter_destroy() on a counter that was never initialized,
because __percpu_counter_init_many() returns -ENOMEM before
calling raw_spin_lock_init() on fbc->lock.
With lockdep enabled this triggers "INFO: trying to register
non-static key" in __percpu_counter_sum(), as reported by syzbot.
The console additionally shows "crypt: Unknown error (-ENOMEM)"
because this failure path sets no ti->error.
Move percpu_counter_init() to right after the allocation of cc,
before ti->private is set and before any "goto bad" can happen.
On failure, set ti->error and free cc directly, so that
crypt_dtr() is only ever called with an initialized counter.
Reported-by: syzbot+4b232570d625662eaab4@syzkaller.appspotmail.com
Closes: https://syzbot.org/bug?extid=4b232570d625662eaab4
Fixes: 5059353df86e ("dm crypt: limit the number of allocated pages")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-crypt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -3287,6 +3287,14 @@ static int crypt_ctr(struct dm_target *t
ti->error = "Cannot allocate encryption context";
return -ENOMEM;
}
+
+ ret = percpu_counter_init(&cc->n_allocated_pages, 0, GFP_KERNEL);
+ if (ret < 0) {
+ ti->error = "Cannot initialize page counter";
+ kfree_sensitive(cc);
+ return ret;
+ }
+
cc->key_size = key_size;
cc->sector_size = (1 << SECTOR_SHIFT);
cc->sector_shift = 0;
@@ -3298,10 +3306,6 @@ static int crypt_ctr(struct dm_target *t
crypt_calculate_pages_per_client();
spin_unlock(&dm_crypt_clients_lock);
- ret = percpu_counter_init(&cc->n_allocated_pages, 0, GFP_KERNEL);
- if (ret < 0)
- goto bad;
-
/* Optional parameters need to be read before cipher constructor */
if (argc > 5) {
ret = crypt_ctr_optional(ti, argc - 5, &argv[5]);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 856/990] dm mpath: fix buffer overflow in parse_hw_handler()
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (846 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 855/990] dm crypt: fix use of uninitialized percpu_counter in ctr error path Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 857/990] dm mpath: cap queue_if_no_path_timeout_secs Greg Kroah-Hartman
` (4 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Shao Mingyin, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: shao.mingyin@zte.com.cn <shao.mingyin@zte.com.cn>
commit 8f611fe94a781c6fb658488cc7eab4e4923e6df6 upstream.
parse_hw_handler() builds the hw_handler parameter string in a buffer
sized with
len = 4;
plus one byte per argument. Those four bytes were meant for the decimal
form of the parameter count, three digits plus the terminating NUL.
dm_read_arg_group() accepts up to 1024 arguments and the count written is
'hw_argc - 1', so a count of 1000 or more needs four digits plus the NUL
and sprintf() writes one byte past the allocation.
Size the buffer from the actual string length instead.
Fixes: 2bfd2e1337f0 ("[SCSI] scsi_dh: Use scsi_dh_set_params() in multipath.")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-mpath.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1084,8 +1084,9 @@ static int parse_hw_handler(struct dm_ar
if (hw_argc > 1) {
char *p;
- int i, j, len = 4;
+ int i, j, len;
+ len = snprintf(NULL, 0, "%d", hw_argc - 1) + 1;
for (i = 0; i <= hw_argc - 2; i++)
len += strlen(as->argv[i]) + 1;
p = m->hw_handler_params = kzalloc(len, GFP_KERNEL);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 857/990] dm mpath: cap queue_if_no_path_timeout_secs
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (847 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 856/990] dm mpath: fix buffer overflow in parse_hw_handler() Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 858/990] dm thin: avoid wrapping no_space_timeout Greg Kroah-Hartman
` (3 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yingjie Wang, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <x-professor@outlook.com>
commit ae5b40accbc06f93e6a513e0e9a07fd32b197e49 upstream.
enable_nopath_timeout() arms the no-path timer with
jiffies + queue_if_no_path_timeout_secs * HZ. The module parameter is an
unbounded unsigned long, so the delay can exceed what mod_timer()
handles: a delay above LONG_MAX is treated as already expired, and
values above ULONG_MAX / HZ also wrap in the multiplication. The timer
then clears queue_if_no_path right away, and I/O queued after the last
path fails gets -EIO instead of waiting for the configured time.
On x86-64 with HZ=1000, 9223372036854776 seconds failed a write after
124 ms while one second less remained queued throughout a 4.2-second
observation window. A value of 18446744073709552 seconds wrapped to 384
jiffies and failed the write after 455 ms. On 32-bit kernels with
HZ=1000 the delay passes LONG_MAX above 2147483 seconds, a little under
25 days.
Cap the seconds value at the largest whole-second delay not exceeding
MAX_JIFFY_OFFSET before multiplying by HZ. This prevents signed-delta
overflow and multiplication wrap. The timer wheel's existing handling
of very long delays is unchanged.
Fixes: be240ff5e402 ("dm mpath: Add timeout mechanism for queue_if_no_path")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <x-professor@outlook.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-mpath.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -803,7 +803,8 @@ static void queue_if_no_path_timeout_wor
static void enable_nopath_timeout(struct multipath *m)
{
unsigned long queue_if_no_path_timeout =
- READ_ONCE(queue_if_no_path_timeout_secs) * HZ;
+ min_t(unsigned long, READ_ONCE(queue_if_no_path_timeout_secs),
+ MAX_JIFFY_OFFSET / HZ) * HZ;
lockdep_assert_held(&m->lock);
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 858/990] dm thin: avoid wrapping no_space_timeout
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (848 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 857/990] dm mpath: cap queue_if_no_path_timeout_secs Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 859/990] dm-pcache: do not advance dirty_tail after backing flush failure Greg Kroah-Hartman
` (2 subsequent siblings)
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Yingjie Wang, Mikulas Patocka
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yingjie Wang <1075151112@qq.com>
commit bcb78d49620f666b4a9d62997691e8d031fd4ebc upstream.
set_pool_mode() converts the no_space_timeout module parameter with
READ_ONCE(no_space_timeout_secs) * HZ. The usual arithmetic conversions
evaluate the product as unsigned int, so it can wrap before being stored
in the unsigned long delay. With HZ=1000, 4294968 seconds becomes 704
jiffies: a pool that runs out of data space switches to
error_if_no_space and fails queued writes with -ENOSPC after about 0.7
seconds.
Widen the value before the multiplication and cap it at
MAX_JIFFY_OFFSET / HZ, so large timeouts no longer wrap into short
delays. On 32-bit kernels, values beyond the supported jiffies range
saturate at the largest whole-second delay not exceeding
MAX_JIFFY_OFFSET. The timer wheel's existing handling of very long
delays is unchanged.
Fixes: 80c578930ce7 ("dm thin: add 'no_space_timeout' dm-thin-pool module param")
Cc: stable@vger.kernel.org
Signed-off-by: Yingjie Wang <1075151112@qq.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-thin.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2544,7 +2544,9 @@ static void set_pool_mode(struct pool *p
struct pool_c *pt = pool->ti->private;
bool needs_check = dm_pool_metadata_needs_check(pool->pmd);
enum pool_mode old_mode = get_pool_mode(pool);
- unsigned long no_space_timeout = READ_ONCE(no_space_timeout_secs) * HZ;
+ unsigned long no_space_timeout =
+ min_t(unsigned long, READ_ONCE(no_space_timeout_secs),
+ MAX_JIFFY_OFFSET / HZ) * HZ;
/*
* Never allow the pool to transition to PM_WRITE mode if user
^ permalink raw reply [flat|nested] 854+ messages in thread
* [PATCH 6.18 859/990] dm-pcache: do not advance dirty_tail after backing flush failure
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (849 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 858/990] dm thin: avoid wrapping no_space_timeout Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 860/990] dm-sysfs: fix misbehavior if kobject_init_and_add fails Greg Kroah-Hartman
2026-11-25 15:36 ` [PATCH 6.18 000/990] 6.18.66-rc1 review SJ Park
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, guolingxing, Mikulas Patocka,
Dongsheng Yang
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: guolingxing <guolingxing@tju.edu.cn>
commit b1310cb291935c788f34ed6eb1e7e9b42cfac045 upstream.
After all writeback bios for a kset complete, writeback_ctx_end()
flushes the backing device and then advances the persistent dirty_tail.
However, backing_dev_flush() discards the error returned by
blkdev_issue_flush(), so dirty_tail is advanced even when the written
data is not known to be durable.
dirty_tail points to the first kset that still requires writeback.
Advancing it causes recovery to treat the preceding kset as clean and
allows its cache copy to eventually be reclaimed by garbage collection.
If the backing device flush failed, a subsequent power failure may
therefore result in data loss.
Make backing_dev_flush() return the flush status and handle a flush
failure like a writeback I/O failure. Leave dirty_tail unchanged so
that the same kset will be retried.
Fixes: 1d57628ff95b ("dm-pcache: add persistent cache target in device-mapper")
Cc: stable@vger.kernel.org
Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Dongsheng Yang <dongsheng.yang@linux.dev>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-pcache/backing_dev.c | 4 ++--
drivers/md/dm-pcache/backing_dev.h | 2 +-
drivers/md/dm-pcache/cache_writeback.c | 28 +++++++++++++++++++-------
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/drivers/md/dm-pcache/backing_dev.c b/drivers/md/dm-pcache/backing_dev.c
index 23002beb192a..84b4e76367fa 100644
--- a/drivers/md/dm-pcache/backing_dev.c
+++ b/drivers/md/dm-pcache/backing_dev.c
@@ -336,9 +336,9 @@ struct pcache_backing_dev_req *backing_dev_req_create(struct pcache_backing_dev
return backing_req;
}
-void backing_dev_flush(struct pcache_backing_dev *backing_dev)
+int backing_dev_flush(struct pcache_backing_dev *backing_dev)
{
- blkdev_issue_flush(backing_dev->dm_dev->bdev);
+ return blkdev_issue_flush(backing_dev->dm_dev->bdev);
}
int pcache_backing_init(void)
diff --git a/drivers/md/dm-pcache/backing_dev.h b/drivers/md/dm-pcache/backing_dev.h
index b371cba483b9..8422e5e76e29 100644
--- a/drivers/md/dm-pcache/backing_dev.h
+++ b/drivers/md/dm-pcache/backing_dev.h
@@ -120,7 +120,7 @@ struct pcache_backing_dev_req *backing_dev_req_alloc(struct pcache_backing_dev *
struct pcache_backing_dev_req_opts *opts);
void backing_dev_req_init(struct pcache_backing_dev_req *backing_req,
struct pcache_backing_dev_req_opts *opts);
-void backing_dev_flush(struct pcache_backing_dev *backing_dev);
+int backing_dev_flush(struct pcache_backing_dev *backing_dev);
int pcache_backing_init(void);
void pcache_backing_exit(void);
diff --git a/drivers/md/dm-pcache/cache_writeback.c b/drivers/md/dm-pcache/cache_writeback.c
index c8a4c8110a58..e09560f172dd 100644
--- a/drivers/md/dm-pcache/cache_writeback.c
+++ b/drivers/md/dm-pcache/cache_writeback.c
@@ -18,12 +18,18 @@ static void writeback_ctx_end(struct pcache_cache *cache, int ret)
return;
if (!cache->writeback_ctx.ret) {
- backing_dev_flush(cache->backing_dev);
-
- mutex_lock(&cache->dirty_tail_lock);
- cache_pos_advance(&cache->dirty_tail, cache->writeback_ctx.advance);
- cache_encode_dirty_tail(cache);
- mutex_unlock(&cache->dirty_tail_lock);
+ ret = backing_dev_flush(cache->backing_dev);
+ if (ret) {
+ pcache_dev_err(CACHE_TO_PCACHE(cache),
+ "failed to flush backing device: %d", ret);
+ cache->writeback_ctx.ret = ret;
+ } else {
+ mutex_lock(&cache->dirty_tail_lock);
+ cache_pos_advance(&cache->dirty_tail,
+ cache->writeback_ctx.advance);
+ cache_encode_dirty_tail(cache);
+ mutex_unlock(&cache->dirty_tail_lock);
+ }
}
queue_delayed_work(cache_get_wq(cache), &cache->writeback_work, 0);
}
@@ -76,8 +82,16 @@ static inline bool is_cache_clean(struct pcache_cache *cache, struct pcache_cach
void cache_writeback_exit(struct pcache_cache *cache)
{
+ int ret;
+
cancel_delayed_work_sync(&cache->writeback_work);
- backing_dev_flush(cache->backing_dev);
+
+ ret = backing_dev_flush(cache->backing_dev);
+ if (ret)
+ pcache_dev_err(CACHE_TO_PCACHE(cache),
+ "failed to flush backing device during exit: %d",
+ ret);
+
cache_tree_exit(&cache->writeback_key_tree);
}
--
2.56.1
^ permalink raw reply related [flat|nested] 854+ messages in thread
* [PATCH 6.18 860/990] dm-sysfs: fix misbehavior if kobject_init_and_add fails
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (850 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 859/990] dm-pcache: do not advance dirty_tail after backing flush failure Greg Kroah-Hartman
@ 2026-11-25 14:37 ` Greg Kroah-Hartman
2026-11-25 15:36 ` [PATCH 6.18 000/990] 6.18.66-rc1 review SJ Park
852 siblings, 0 replies; 854+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-25 14:37 UTC (permalink / raw)
To: stable; +Cc: Greg Kroah-Hartman, patches, Mikulas Patocka, Wentao Liang
6.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 406d576cc457203cf86eac7f17839b2efec81db4 upstream.
If kobject_init_and_add fails, we must call kobject_put (see the comment
at kobject_init_and_add).
Before calling kobject_init_and_add, we must zero the kobject (see
https://lwn.net/Articles/52085/). If the first call to dm_sysfs_init
failed, it may be called again, and that second call would see an
uninitialized kobject.
Cc: stable@vger.kernel.org
Fixes: 784aae735d9b ("dm: add name and uuid to sysfs")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/dm-sysfs.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/drivers/md/dm-sysfs.c
+++ b/drivers/md/dm-sysfs.c
@@ -132,9 +132,20 @@ static const struct kobj_type dm_ktype =
*/
int dm_sysfs_init(struct mapped_device *md)
{
- return kobject_init_and_add(dm_kobject(md), &dm_ktype,
- &disk_to_dev(dm_disk(md))->kobj,
- "%s", "dm");
+ struct kobject *kobj = dm_kobject(md);
+ int r;
+
+ /* The kobject must be zeroed before calling kobject_init */
+ memset(kobj, 0, sizeof(struct kobject));
+ r = kobject_init_and_add(kobj, &dm_ktype,
+ &disk_to_dev(dm_disk(md))->kobj,
+ "%s", "dm");
+ if (unlikely(r)) {
+ /* Weird semantics - we must call kobject_put on failure */
+ dm_sysfs_exit(md);
+ return r;
+ }
+ return 0;
}
/*
^ permalink raw reply [flat|nested] 854+ messages in thread
* Re: [PATCH 6.18 000/990] 6.18.66-rc1 review
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
` (851 preceding siblings ...)
2026-11-25 14:37 ` [PATCH 6.18 860/990] dm-sysfs: fix misbehavior if kobject_init_and_add fails Greg Kroah-Hartman
@ 2026-11-25 15:36 ` SJ Park
852 siblings, 0 replies; 854+ messages in thread
From: SJ Park @ 2026-11-25 15:36 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: SJ Park, stable, patches, linux-kernel, torvalds, akpm, linux,
shuah, patches, lkft-triage, pavel, jonathanh, f.fainelli,
sudipm.mukherjee, rwarsow, conor, hargar, broonie, achill, sr
On Wed, 25 Nov 2026 15:22:47 +0100 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> This is the start of the stable review cycle for the 6.18.66 release.
> There are 990 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.
This rc kernel passes DAMON functionality test [1] on my test machine.
Tested-by: SJ Park <sj@kernel.org>
[1] https://github.com/damonitor/damon-tests/tree/next/corr
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 854+ messages in thread
end of thread, other threads:[~2026-11-25 16:17 UTC | newest]
Thread overview: 854+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 14:22 [PATCH 6.18 000/990] 6.18.66-rc1 review Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 001/990] netfilter: nft_ct: expectation timeouts are passed in milliseconds Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 002/990] netfilter: nft_ct: move custom expectation support to helper Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 003/990] bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 004/990] irqchip/sifive-plic: Avoid signed shift in interrupt enable mask Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 005/990] mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 006/990] net: always dissect GSO packets in __virtio_net_hdr_to_skb() Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 007/990] tun: clear stale skb->protocol of NAPI frags skbs Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 008/990] net: virtio: validate outer protocol of UDP tunnel GSO packets Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 009/990] soundwire: dmi-quirks: add Lenovo Yoga Slim 7i 14IPH11 Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 010/990] soundwire: dmi-quirks: Disable ghost Realtek on Lenovo Pro 9 Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 011/990] soundwire: dmi-quirks: drop the ghost RT1320 on the Surface Pro 11 (Intel) Greg Kroah-Hartman
2026-11-25 14:22 ` [PATCH 6.18 012/990] libceph: generalize ceph_x_encrypt_offset() and ceph_x_encrypt_buflen() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 013/990] libceph: introduce ceph_crypto_key_prepare() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 014/990] libceph: add support for CEPH_CRYPTO_AES256KRB5 Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 015/990] libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 016/990] writeback: use a per-sb counter to drain inode wb switches at umount Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 017/990] KVM: TDX: Enable Bus Lock VM exit Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 018/990] ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250) Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 019/990] ACPI: PM: Add unused power resource quirk for Casper Excalibur G900 Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 020/990] ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[] Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 021/990] fs: aio: reject partial mremap to avoid Null-pointer-dereference error Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 022/990] ACPI: platform: Use acpi_bus_get_primary_device() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 023/990] virtio_net: check RX buffer length before DMA sync Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 024/990] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 025/990] sched/deadline: Fix dl_server time accounting Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 026/990] sched/deadline: Fix dl_server stop condition Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 027/990] sched: Provide idle_rq() helper Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 028/990] sched/deadline: Fix server stopping with runnable tasks Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 029/990] xfs: only assert new size for datafork during truncate extents Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 030/990] fbdev: bound mode sysfs output to the sysfs buffer Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 031/990] fbdev: clear fb_info->mode before deleting a videomode Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 032/990] fbdev: serialize mode sysfs access with lock_fb_info() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 033/990] Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts" Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 034/990] netrom: send the unacknowledged frames again when T1 or T4 expires Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 035/990] ax25: drop a message being reassembled when a new one starts Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 036/990] rose: reset a call when a DATA packet arrives out of sequence Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 037/990] ax25: end a REJ recovery count once frames are acknowledged Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 038/990] netrom: keep T1 running after answering a NAK Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 039/990] netrom: give the sysctl timer limits in milliseconds Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 040/990] mm/ksm: fix userfaultfd protection during merge and unmerge Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 041/990] udf: validate VAT inode size for old VAT format Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 042/990] udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 043/990] io_uring/napi: dont end the single NAPI busy poll early on need_resched() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 044/990] io_uring: fail soft links on negative IOU_COMPLETE results Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 045/990] io_uring/futex: fail soft links when cancelling a wait Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 046/990] io_uring/rw: fail soft links on IOPOLL short or error IO Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 047/990] io_uring/timeout: dont rearm a multishot timeout on cancel Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 048/990] io_uring/rsrc: keep the old file when a file update fails Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 049/990] io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 050/990] io_uring/io-wq: apply the current cpuset to new workers Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 051/990] bnxt_en: Take RTNL before netif_close() when aborting FW reset Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 052/990] bpqether: reserve the Ethernet devices own header room on transmit Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 053/990] bpqether: set both addresses or none in SIOCSBPQETHADDR Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 054/990] bpqether: keep a bpq device in step with its Ethernet device Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 055/990] Input: destroy force-feedback device on input unregistration Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 056/990] staging: media: atomisp: use array3_size() for overflow-safe allocation Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 057/990] wifi: rtw89: usb: Avoid crash with dynamically added device ID Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 058/990] fs/fs_parse: add back fsparam_u32hex Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 059/990] net/9p: move structures and macros to header files Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 060/990] 9p: create a v9fs_context structure to hold parsed options Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 061/990] 9p: convert to the new mount API Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 062/990] net/9p: Replace strlen() strcpy() pair with strscpy() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 063/990] 9p: use fc->net_ns for network namespace in RDMA and socket transports Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 064/990] net/9p/usbg: fix descriptor cleanup use-after-free Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 065/990] net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 066/990] 9p: skip intermediate directory entry name copy in p9dirent_read() Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 067/990] xfrm: zero-initialise km_event in the replay-notify path Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 068/990] batman-adv: avoid WARN_ON for orig_ifinfo allocation failure Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 069/990] wifi: wext: Limit notifier event flushes to the devices netns Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 070/990] fsnotify: preserve 64-bit pre-content ranges Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 071/990] wifi: ath9k_htc: start ANI when an AP interface begins to beacon Greg Kroah-Hartman
2026-11-25 14:23 ` [PATCH 6.18 072/990] scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 073/990] scsi: scsi_debug: Drain target cleanup before module exit Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 074/990] scsi: aha1542: Remove unneeded scsi_dma_unmap() call Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 075/990] 9p: Enable symlink caching in page cache Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 076/990] 9p: treat read return values of 0 as EOF Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 077/990] 9p: Cache negative dentries for lookup performance Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 078/990] 9p: Add mount option for negative dentry cache retention Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 079/990] 9p: fix kernel-doc warning for enum p9_session_flags Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 080/990] 9p: fall back to the normal open path for non-regular files Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 081/990] 9p: do not store the create fid on special files Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 082/990] wifi: ath10k: Stop unanswered temperature reads Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 083/990] wifi: ath12k: fix IRQ disable imbalance in AHB ext interrupt handler Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 084/990] seg6: fix transport header for inner IPv4 with IP options Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 085/990] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 086/990] gpio: omap: Propagate runtime PM failures in probe and request Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 087/990] bpf: Fix jited line info off by the CFI preamble Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 088/990] btrfs: verity: propagate orphan insertion errors when enabling verity Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 089/990] btrfs: fix fiemap merging compressed extents Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 090/990] btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 091/990] btrfs: zoned: fix double free of bitmaps on clone failure Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 092/990] bpf: Drop percpu_counter from the htab element count Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 093/990] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 094/990] net: ethernet: mtk_wed: fix reset condition for rx wdma Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 095/990] net: ethernet: mtk_wed: free up rings during detach Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 096/990] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 097/990] ptp: drain virtual clock sysfs operations before unregistering children Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 098/990] ptp: unwind partially completed virtual clock creation Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 099/990] ptp: vclock: propagate physical clock sampling errors Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 100/990] ptp: vclock: serialize extended samples with counter updates Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 101/990] ptp: vclock: preserve missing hardware timestamps Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 102/990] net/smc: fix limit_smc_hs sysctl on big-endian architecture Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 103/990] scsi: target: Validate REGISTER AND MOVE TransportID length Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 104/990] tipc: reject attaching bearer of different media to the same occupied device Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 105/990] net: ipa: Fix double free of the interrupt structure on config error Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 106/990] ALSA: memalloc: Free the new pages when WC DMA mapping fails Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 107/990] netfilter: nft_reject: prevent unbounded recursion in output hooks Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 108/990] spi: pic32-sqi: fail transfer when the BD ring is exhausted Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 109/990] bpf: Avoid changing callchain in bpf_get_stack_pe Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 110/990] bpf: Clamp the trace length in __bpf_get_stack() again Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 111/990] bpf: Avoid changing callchain in bpf_get_stackid_pe Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 112/990] bpf: Clamp the trace length before the skip test in stackid_init() Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 113/990] bpf: Refuse to map an arena at address 0 Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 114/990] bpf: Refuse an arena mmap() longer than max_entries pages Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 115/990] bpf: Remove the WARN from arena_get_unmapped_area() Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 116/990] bpf: Require prog fd or capability for cgroup detach Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 117/990] bpf, cgroup: Keep the skb network offset signed Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 118/990] bpf: Dont let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 119/990] bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6 Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 120/990] bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 121/990] bpf: Dont look for the SRH again in the End.BPF helpers Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 122/990] bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh() Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 123/990] bpf: Dont leave a stale MAC header in bpf_lwt_push_ip_encap() Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 124/990] bpf: Reset skb->cb after an lwt prog pushes an IP header Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 125/990] bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 126/990] bpf: Move the transport header with the moved headers Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 127/990] bpf: Check the offset in bpf_skb_generic_{push,pop}() Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 128/990] spi: Fix ACPI SPI resources using relative path Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 129/990] spi: acpi: only look up the IRQ of confirmed SPI devices Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 130/990] bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 131/990] net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period Greg Kroah-Hartman
2026-11-25 14:24 ` [PATCH 6.18 132/990] bnxt_en: Dont keep MSI-X vectors added before FW reserves them Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 133/990] ipv6: fix fib6 walker UAF on NLM_F_REPLACE Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 134/990] tcp: do not let tcp_collapse() drive sk_forward_alloc negative Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 135/990] ata: libata-sata: allow re-enabling NCQ with the same queue_depth Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 136/990] ata: libata-eh: Retry non-NCQ commands when their sense data asks for it Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 137/990] net: stmmac: take ownership of saved RX state at poll entry Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 138/990] net: stmmac: drop split frames on AF_XDP zero-copy RX Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 139/990] net: stmmac: drop multi-buffer frames in XDP mode Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 140/990] net: stmmac: copy XDP metadata in AF_XDP zero-copy RX Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 141/990] net: stmmac: fix VLAN tag stripping on short and non-linear RX frames Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 142/990] net: stmmac: fix XDP RX buffer DMA sync length Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 143/990] ata: libata-core: Check device support before querying power state Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 144/990] net: lan966x: dont free XDP buffers in fdma tx clear with budget 0 Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 145/990] drm/panel: visionox-r66451: Send the brightness value MSB first Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 146/990] drm/panel: visionox-r66451: Wait longer after the panel reset Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 147/990] sfc: ptp: drop the stale frequency reset in efx_ptp_start() Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 148/990] sfc: ptp: serialize host and MC synchronization transactions Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 149/990] sfc: ptp: avoid racing PPS timestamp updates Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 150/990] virtio-spi: Fix virtio_spi_config kernel-doc Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 151/990] vdpa_sim: serialize IOTLB updates with dataplane access Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 152/990] vdpa: invalidate DMA mappings before releasing memory Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 153/990] vhost-scsi: preserve event ordering Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 154/990] vhost-scsi: do not relock event vq mutex on send_evt fallback Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 155/990] vhost: fix dirty logging for in-order used ring entries Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 156/990] virtio_pci: add missing newline to the pmcsr error message Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 157/990] vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit() Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 158/990] vhost: reject invalid IOTLB update permissions Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 159/990] vhost-vdpa: drop the parents vq callback before the call fd is released Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 160/990] virtio-blk: clamp max_segments to virtqueue ring size Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 161/990] vduse: avoid infinite loop when no affinity CPU is online Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 162/990] virtio_blk: Reset device on probe error paths after DRIVER_OK Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 163/990] regulator: qcom_spmi: dont take a sleeping lock in the SAW IPI Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 164/990] net: sparx5/lan969x: release the in-flight slot of a stale TX skb Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 165/990] gpio: mpc8xxx: Fix potential use-after-free of IRQ domain Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 166/990] net/iucv: take a private, writable frame before rewriting it in place Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 167/990] wifi: ath12k: generalize GI and LTF fixed rate functions Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 168/990] wifi: ath12k: add EHT rate handling to existing set " Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 169/990] wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 170/990] wifi: ath12k: dont advertise EHT-MCS15 to firmware unless we support it Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 171/990] ASoC: meson: axg-fifo: request the irq with the clock enabled Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 172/990] Bluetooth: hci_core: Initialize IRK before publication Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 173/990] Bluetooth: hci_core: Initialize link key " Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 174/990] Bluetooth: hci_core: Initialize LTK " Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 175/990] Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 176/990] Bluetooth: btintel: fix buffer over-read in fw payload Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 177/990] Bluetooth: hci_event: Clear explicit connect state on LE connection Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 178/990] Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 179/990] Bluetooth: btmtk: bound the ISO payload length by the controllers MTU Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 180/990] Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 181/990] Bluetooth: hci_sync: Copy the LE accept list under hdev->lock Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 182/990] Bluetooth: hci_sync: Protect resolving-list lookups Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 183/990] Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 184/990] Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 185/990] Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init() Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 186/990] Bluetooth: hci_core: Keep link-key filtering inside RCU Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 187/990] Bluetooth: hci_sync: Copy the resolving-list IRK under RCU Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 188/990] Bluetooth: MGMT: Clear disabled connection parameters when loading none Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 189/990] Bluetooth: hci_core: Initialize advertising RPA work only once Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 190/990] Bluetooth: validate retained LE Create CIS command length Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 191/990] Bluetooth: validate retained LE Set CIG Parameters " Greg Kroah-Hartman
2026-11-25 14:25 ` [PATCH 6.18 192/990] Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 193/990] selftests/mm: merge: keep the far mremap() targets in the carveout Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 194/990] mctp i3c: Fix locking in an error path Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 195/990] ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 196/990] ksmbd: require NUL-terminated EA names Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 197/990] soreuseport: annotate data-races around reuse->socks[] and num_socks Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 198/990] vhost-scsi: do not count PI bytes in the data length Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 199/990] xfrm: iptfs: fix skb leak on error in __input_process_payload() Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 200/990] power: sequencing: qcom-wcn: increase WCN7850 power-up delay Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 201/990] vhost-scsi: validate event queue descriptor direction Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 202/990] virtio_ring: code cleanup in detach_buf_split Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 203/990] virtio_ring: factor out split indirect detaching logic Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 204/990] virtio_ring: use shadow flags when detaching split descriptors Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 205/990] vhost-scsi: reject delayed virtqueue setup Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 206/990] vhost: reject backend enable without a kick file Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 207/990] vhost-vdpa: initialize state before publishing cdev Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 208/990] virtio_balloon: initialize wakeup_lock before virtqueues are set up Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 209/990] vhost-scsi: fix page reference leak in misaligned I/O fallback Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 210/990] ext2: only flush DIRSYNC directories on every change Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 211/990] printk: Avoid multiple unregistration in unregister_console_locked() Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 212/990] block: convert nr_requests to unsigned int Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 213/990] blk-mq: add a new queue sysfs attribute async_depth Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 214/990] blk-mq: reset queue state on scheduler teardown Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 215/990] virtio-blk: Fix zone append sector reporting in batched completion Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 216/990] block: partitions: reject GPT entries with starting_lba > ending_lba Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 217/990] block: report the correct discard alignment in sysfs Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 218/990] zloop: fix the error code in the blk_mq_alloc_disk message Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 219/990] zloop: reject mismatched conventional zone files on restore Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 220/990] vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 221/990] null_blk: fix opening closed zones at the active zone limit Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 222/990] null_blk: dont finish zones to set them read-only or offline Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 223/990] tcp: wait for TIME_WAIT teardown before freeing per-netns ehash Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 224/990] nvmet: fix arbitration burst field mask Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 225/990] net: dsa: b53: Enable IGMP and MLD control packet CPU copies Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 226/990] net: ethernet: mediatek: preserve sibling PPE bindings Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 227/990] nvmet-loop: do not alloc admin tag set during reset Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 228/990] nvme-loop: delete the controller if a reset fails Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 229/990] nvmet-tcp: ask for the TLS record type on every receive Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 230/990] nvme-auth: add NVME_AUTH_MAX_DIGEST_SIZE constant Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 231/990] nvme-auth: use proper argument types Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 232/990] nvme-auth: common: add KUnit tests for TLS key derivation Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 233/990] nvme-auth: common: add HMAC helper functions Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 234/990] nvme-auth: common: use crypto library in nvme_auth_augmented_challenge() Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 235/990] nvme-auth: Hash DH shared secret to create session key Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 236/990] nvmet-auth: Do not print DH-HMAC-CHAP secrets Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 237/990] nvmet-auth: keep the old keys if the new ones fail Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 238/990] nvmet-rdma: disconnect only established queues Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 239/990] nvmet-tcp: limit the connections accepted per work run Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 240/990] nvmet-rdma: take a device off the list last Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 241/990] nvmet-rdma: queue the release work under the mutex Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 242/990] nvmet-rdma: disconnect a queue on device removal Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 243/990] ASoC: rockchip_i2s: select REGMAP_MMIO Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 244/990] ASoC: rockchip_i2s_tdm: " Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 245/990] ASoC: rockchip_pdm: " Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 246/990] ASoC: rockchip_sai: " Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 247/990] ASoC: rockchip: spdif: Add support for set mclk rate Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 248/990] ASoC: rockchip: spdif: Add support for format S32_LE Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 249/990] ASoC: rockchip: spdif: Fill IEC958 CS info per params Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 250/990] ASoC: rockchip_spdif: select REGMAP_MMIO Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 251/990] net: ethernet: ti: am65-cpts: adjust perout genf following ptp changes Greg Kroah-Hartman
2026-11-25 14:26 ` [PATCH 6.18 252/990] isofs: handle Rock Ridge long-form dates before 1900 Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 253/990] tcp: Fix dup-ack detection on non-SACK bidirectional data transfer Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 254/990] cpufreq: Hold the policy write lock when changing boost state Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 255/990] net: skbuff: reject zero MPLS TTL before decrementing Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 256/990] PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 257/990] ipv6: Flush exception route while replacing nexthop Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 258/990] ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 259/990] tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 260/990] drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 261/990] firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 262/990] ACPI: scan: Print the offline failure message in acpi_bus_offline() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 263/990] ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 264/990] ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 265/990] Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 266/990] Bluetooth: L2CAP: Clear request identifiers on incoming LE connections Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 267/990] Bluetooth: qca: Disable SoC debug logging for WCN3950 Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 268/990] net: ethernet: bgmac: preserve forced 2.5 Gbps link speed Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 269/990] net: dsa: b53: restore the NSP IMP port 2 Gbps mode Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 270/990] Bluetooth: Fix not updating of hdev->commands[] after reset Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 271/990] spi: cadence-quadspi: Fix race between DMA completion and transfer start Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 272/990] drm/nouveau/fifo: map Kepler video engine contexts non-privileged Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 273/990] drm/nouveau: Fix CE channel creation on pre-Kepler GPUs Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 274/990] ALSA: hda/core: Stop capability walk on empty capability header Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 275/990] ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 276/990] net: 8139cp: keep Rx masked while NAPI is scheduled Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 277/990] bonding: 3ad: dont set BOND_LINK_FAIL on a slave that is not up Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 278/990] ip6mr: Serialize multicast router socket ownership Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 279/990] net: ethtool: add netif_get_link_ksettings() for correct ops-locked use Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 280/990] net: bonding: dont recurse on the slaves netdev ops lock Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 281/990] bonding: fix missing down path on speed/duplex failure after FAIL->UP Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 282/990] net: stmmac: set XDP metadata length on the page_pool RX path Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 283/990] net: bridge: disable MRP ports before the FDB flush in del_nbp() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 284/990] tcp: initialize send sequence numbers before deferring TFO Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 285/990] netfilter: nft_set_rbtree: check catchall_sync return before queue_done Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 286/990] netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 287/990] netfilter: x_tables: check target name before accessing verdict Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 288/990] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 289/990] netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 290/990] netfilter: nat: zero newrange before filling it in Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 291/990] gpio: regmap: Support sparsed fixed direction Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 292/990] gpio: regmap: free the irqchip if adding the irq domain fails Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 293/990] tcp: ipv6: free ireq->ipv6_opt after an RCU grace period Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 294/990] MIPS: Avoid dead code/data elimination when using recordmcount Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 295/990] MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 296/990] MIPS: Alchemy: Save the Ethernet address before reusing PROM memory Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 297/990] MIPS: Cobalt: Include legacy IDE ports in the PCI I/O window Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 298/990] MIPS: SB1250: Validate and update IRQ affinity Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 299/990] introduce a flag for explicitly marking persistently pinned dentries Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 300/990] libfs: walk offset directories in offset order Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 301/990] libfs: end offset readdir at positions past DIR_OFFSET_EOD Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 302/990] initrd: flush deferred fput() before mounting root Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 303/990] iov_iter: take an unsigned long segment count in import_iovec() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 304/990] vfs: preserve subsecond timestamps at filesystem time limits Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 305/990] statx: dont leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 306/990] fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek() Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 307/990] perf: Add perf_event_attr::config4 Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 308/990] perf: Add APIs to create/release mediated guest vPMUs Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 309/990] perf: Eliminate duplicate arch-specific function definitions Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 310/990] perf: Move and enhance has_extended_regs() for arch-specific use Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 311/990] perf: Add sampling support for SIMD registers Greg Kroah-Hartman
2026-11-25 14:27 ` [PATCH 6.18 312/990] perf/amd/ibs: Fix kernel address leak via REGS_USER and REGS_INTR Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 313/990] sched/pelt: Fix u32 truncation of the PELT period count Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 314/990] sched/topology: Balance cluster static-key updates Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 315/990] tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 316/990] x86/kcfi: Dont emit KCFI_REFERENCE() in modules Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 317/990] net/mlx5e: TC, Fix double free of branch in failure Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 318/990] locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 319/990] locking/osq: Fix unlink queue corruption Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 320/990] perf/x86/amd/uncore: Avoid context migration from non-owners Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 321/990] perf: Fix racy update of cpc->hrtimer_interval Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 322/990] iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 323/990] cpufreq: Return -EOPNOTSUPP if no policy supports boost Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 324/990] cpufreq: Preserve global boost state on failed updates Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 325/990] cpufreq: Serialize global boost updates Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 326/990] Bluetooth: reject invalid LE supervision timeout relationships Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 327/990] net/mlx5e: IPoIB, Fix QPN lookup race Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 328/990] netlink: Do not call the unbind callback with the table locked Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 329/990] net/mlx5e: Add missing Ethernet multicast octets to vport_rx_bytes sum Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 330/990] calipso: do not charge request socket options to the listener Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 331/990] ipv6: Check the Home Address option again before its address is used Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 332/990] ata: libata-scsi: fix MODE SELECT handling of data after the mode page Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 333/990] ata: libata-scsi: do not accept subpage code FFh in MODE SELECT Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 334/990] ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 335/990] ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 336/990] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 337/990] ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 338/990] ata: libata-scsi: set the field pointer when rejecting CDL Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 339/990] tracing/probes: bound symstr stores to reserved length Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 340/990] liveupdate: kho: move to kernel/liveupdate Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 341/990] kho: check fdt_phys in is_kho_boot() Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 342/990] drm/xe: Prevent VF memory IRQ from accessing a torn-down engine Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 343/990] drm/xe/tuning: Restrict Anyhit NULL-query tuning to render engines Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 344/990] drm/xe/lrc: Restore CTX_CS_INDIRECT_CTX_OFFSET programming for pre-Xe2 Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 345/990] drm/xe: Fix build with DRM_XE=y and CONFIGFS_FS=m Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 346/990] drm/xe/xe_survivability: Redesign survivability mode Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 347/990] drm/xe/xe_survivability: Simplify runtime survivability error handling Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 348/990] drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 349/990] drm/xe: Rebind BOs evicted before the first LR queue Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 350/990] drm/xe: Toggle the D3Cold enable flag at runtime resume Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 351/990] drm/xe/xe_late_bind_fw: Fix firmware leak on missing manifest entry Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 352/990] gpiolib: fix GPIO descriptor leak in gpiod_get_array() Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 353/990] gpiolib: fix fast-path cancellation " Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 354/990] gpiolib: of: return -ENOENT from of_gpio_count() stub Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 355/990] ASoC: soc-core: copy the DAI link names into the card Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 356/990] ASoC: qcom: sdw: remove redundant code Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 357/990] ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 358/990] ASoC: qcom: common: validate cpu dai id during parsing Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 359/990] ASoC: qcom: common: add DAI-node TDM slot helpers Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 360/990] ASoC: qcom: common: Add generic headset jack helpers Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 361/990] ASoC: qcom: x1e80100: recreate the headset jack on card rebind Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 362/990] ASoC: amd: ps: guard adata->sdw dereferences with NULL check in IRQ handler Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 363/990] ASoC: SOF: amd: " Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 364/990] ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 365/990] btrfs: zoned: only change active zone counter on successful (de)activation Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 366/990] btrfs: zoned: fix possible UAF in wait_eb_writebacks() Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 367/990] btrfs: zoned: requeue block group if zone reset bails out Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 368/990] btrfs: zoned: dont wait for ordered extents in do_zone_finish() Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 369/990] btrfs: zoned: fix lockdep splat on mount Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 370/990] btrfs: zstd: prevent leak of workspace below maximum level Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 371/990] btrfs: handle zero num_stripes in btrfs_chunk_item_size() Greg Kroah-Hartman
2026-11-25 14:28 ` [PATCH 6.18 372/990] tcp: try to avoid safer when ACKs are thinned Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 373/990] tcp: move tp->delivered and tp->delivered_ce to tcp_sock_write_tx group Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 374/990] tcp: move tp->segs_in and tp->segs_out to tcp_sock_write_txrx group Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 375/990] tcp: move tp->first_tx_mstamp and tp->delivered_mstamp to tcp_sock_write_tx Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 376/990] tcp: move tp->bytes_acked to tcp_sock_write_tx group Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 377/990] tcp: rate limit receive queue collapsing Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 378/990] NFSv4.1: retain MDS I/O until both thresholds are met Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 379/990] NFS: honor UTIME_NOW atime with explicit mtime Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 380/990] nfs: fix utimensat() for atime with delegated timestamps Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 381/990] NFS: update ctime for atime-only UTIME_NOW requests Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 382/990] NFS: Fix inverted cross-directory rename check Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 383/990] NFS: restore directory index when resuming readdir Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 384/990] SUNRPC: wake poll waiters when an empty pipe is unlinked Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 385/990] SUNRPC: preserve fatal network errors during RPC binding Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 386/990] SUNRPC: preserve timeout policy when cloning clients Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 387/990] SUNRPC: preserve transport security " Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 388/990] SUNRPC: Balance switch queue length on transport removal Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 389/990] SUNRPC: Balance queue accounting when relocating a task Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 390/990] NFS/localio: hold the client across an asynchronous LOCALIO probe Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 391/990] ublk: publish a new device by its id only once it is set up Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 392/990] net: skbuff: preserve fclone lifetime when freeing stolen heads Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 393/990] xsk: fix list corruption in xsk_buff_add_frag() Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 394/990] i40e: xsk: fix xsk_buff_add_frag() error handling in Rx Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 395/990] ice: xsk: fix leaking Rx buffers in multi-buffer path Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 396/990] ice: xsk: do not free in-flight frags on XDP_TX completion Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 397/990] libeth: " Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 398/990] i40e: xsk: fix multi-buffer XDP_PASS skb construction Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 399/990] ice: xsk: free stashed Rx frame when cleaning the ring Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 400/990] idpf: free stashed XSk Rx frame when releasing the queue Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 401/990] net: usb: lan78xx: resume phylink on non-reset USB resume Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 402/990] net: raw: fix ICMP unreachable sent when receive queue is full Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 403/990] spi: virtio: move teardown to .remove() Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 404/990] af_unix: Convert unsigned long to u64 for GC Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 405/990] af_unix: Remove gc_in_progress check in unix_peek_fpl() Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 406/990] net/mlx5: Bridge, fix bogus MDB offload errors Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 407/990] ipv6: ignore link state in gateway check Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 408/990] team: Add matching error label for failed action Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 409/990] team: fix promisc/allmulti leak in team_port_add error path Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 410/990] net/mlx5: Use only loaded devices for PTP clock operations Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 411/990] net/mlx5: Lag, free steering resources on LAG destroy failure Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 412/990] net: protect negative destination advice with RCU Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 413/990] net: require a full socket in sock_confirm_neigh() Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 414/990] ipvlan: make outbound skb headers writable Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 415/990] wifi: mac80211: mesh: dont linearize SKBs unnecessarily Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 416/990] wifi: mac80211: abort chanswitch when leaving an IBSS Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 417/990] net: fix mac_len of skbs copied by generic XDP Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 418/990] ovl: allow idmapping overlay mounts Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 419/990] ovl: release the upperdir/workdir in-use locks before the umount sync Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 420/990] bonding: fix slave_cnt leak on XDP enslave failure Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 421/990] NFSv4: wake blocking lock waiters when a delegated lock is released Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 422/990] tun: delete the flow entries of the moved queue on detach Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 423/990] fbnic: Rename PCS IRQ to MAC IRQ as it is actually a MAC interrupt Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 424/990] fbnic: Add logic to track PMD state via MAC/PCS signals Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 425/990] fbnic: Fix service task races with ndo_stop and PM suspend Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 426/990] fbnic: Disable PTP completions during the Tx force-flush Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 427/990] fbnic: Suspend phylink after taking the datapath down in ndo_stop Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 428/990] fbnic: Wait for the outbound flush to complete on mailbox teardown Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 429/990] net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 430/990] net/mlx5: macsec: Dont remove fs_id when adding a rule fails Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 431/990] dpll: notify about a reference sync pair only if it was added Greg Kroah-Hartman
2026-11-25 14:29 ` [PATCH 6.18 432/990] ipv4: route: dont blackhole in-use routes when retiring fnhe routes Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 433/990] ptp: kvm: x86: Leak clock_pair page if changing its encryption fails Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 434/990] net: skbuff: uncharge trimmed zerocopy frags on error Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 435/990] net/mlx5e: Release IPsec root table reference on RX setup failure Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 436/990] net/mlx5e: Fix ipsec core device access during profile changes Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 437/990] net/mlx5e: Serialize TC and IPsec offload exclusion counters Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 438/990] fou: gue: check IP version of held packets for direct IP encapsulation Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 439/990] tcp: Do not allow buggy transitions between ehash and lhash2 Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 440/990] tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 441/990] udp: do not use a cross-family sk_rx_dst in early demux Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 442/990] net: gro: compare skb->protocol in gro_list_prepare() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 443/990] net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 444/990] udp: check frag_list IP family before using skb_segment_list() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 445/990] drm/bridge: sii902x: validate I2S data lane values Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 446/990] xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 447/990] ASoC: max98090: keep the MIC boost across mic input power-up Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 448/990] tcp: Drop any segments if DEFER_CONNECT is set Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 449/990] amt: tear down every amt device on an unregistering lower Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 450/990] net: ena: Keep the RX buffer mapped if skb allocation fails Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 451/990] net: ena: avoid RX copybreak for multi-descriptor packets Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 452/990] tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 453/990] tls: fix async encryption race on weakly ordered architectures Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 454/990] net/mlx5: HWS, fix flow meter release on FTE update Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 455/990] drm/xe/xe3: Add support for graphics IP versions 30.04 & 30.05 Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 456/990] drm/xe/guc: Eliminate RPe caching for SLPC parameter handling Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 457/990] drm/xe/forcewake: Add scope-based cleanup for forcewake Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 458/990] drm/xe/guc_pc: Use scope-based cleanup Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 459/990] drm/xe: Decouple GuC RC code from xe_guc_pc Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 460/990] drm/xe: Add a wrapper for SLPC set/unset params Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 461/990] drm/xe/pvc: Drop pre-prod workarounds Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 462/990] drm/xe/wa_oob: Consolidate some OOB rules Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 463/990] drm/xe: Sync Wa_16023105232 in xe_was to match OOB rule Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 464/990] igmp: use the joined device when leaving a multicast group Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 465/990] udp_tunnel: dont treat IPv4 sockets bound to an address as wildcard Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 466/990] net/mlx5: Lag, Return error when enabling MPESW without LAG support Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 467/990] net: virtio: fix UDP tunnel GSO header of VLAN tagged packets Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 468/990] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 469/990] net: scm: move scm_detach_fds() from common path to scm_recv_unix() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 470/990] net: af_unix: useful handling of LSM denials on SCM_RIGHTS Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 471/990] af_unix: Inherit SO_INQ in unix_stream_connect() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 472/990] amt: use ipv6_hdr() in amt_mldv1_leave_handler() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 473/990] net: usb: cdc_ncm: dont underflow the NDP room check Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 474/990] net/mlx5e: IPsec, dont match upper proto selectors in crypto offload TX Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 475/990] net: phy: c45: select BASE-T1 type for the forced speed Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 476/990] selftests: tls: Skip the zero_len tests when TLS is unavailable Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 477/990] nsh: limit recursion in nsh_gso_segment() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 478/990] tracing: skip boot kprobe setup when no events were requested Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 479/990] docs, kprobes: Fix bracket Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 480/990] KEYS: do not let an unmatched key decide the search result Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 481/990] ALSA: aw2-alsa: select SND_PCM Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 482/990] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 483/990] s390/zcrypt: Make apfs a real unsigned int field Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 484/990] s390/zcrypt: Fix and improve zcrypt reply message verification checks Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 485/990] s390/zcrypt: Explicitly use a card variable in _zcrypt_send_cprb Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 486/990] s390/zcrypt: Guard domain index uses against speculative bypass Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 487/990] mm: khugepaged: fix folio is used after pte_unmap_unlock() Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 488/990] NFSD: Destroy a recalled delegation the client does not hold Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 489/990] media: rc: Replace open coded krealloc() for keymap Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 490/990] media: rc: Add missing locking " Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 491/990] powerpc/bpf: fix alignment of long branch trampoline address Greg Kroah-Hartman
2026-11-25 14:30 ` [PATCH 6.18 492/990] misc: fastrpc: Allocate entire reserved memory for Audio PD in probe Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 493/990] ublk: let STOP_DEV cancel the servers commands before its release Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 494/990] drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7 Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 495/990] inet: frags: prevent acceptance of partially authenticated reassembly Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 496/990] drm/i915/display: Disable pipe joiner on WCL Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 497/990] can: skb: make echo skb freeing safe in any IRQ context Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 498/990] mm/userfaultfd: wake all waiters on unregister Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 499/990] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 500/990] nvme-tcp: Validate the queue state under the queue lock in the address attribute Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 501/990] nvme-tcp: fix use-after-free in nvme_tcp_free_ctrl() Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 502/990] drm/panthor: Revisit reqs_lock handling in flush/reset paths Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 503/990] cxl/test: Map mock device nodes to an online node Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 504/990] accel/amdxdna: Fix unexpected wait when flushing notifier_wq Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 505/990] fuse: dont bump attr_version for async direct read completion Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 506/990] ACPI: APEI: GHES: Validate memory error section length before payload access Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 507/990] perf thread: Fix live-session detection in thread__e_machine() Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 508/990] dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 509/990] dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v " Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 510/990] wifi: ath12k: fix truncated TX buffer DMA address in MSDU ext descriptor Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 511/990] wifi: ath12k: preserve PPDU state across monitor status buffers Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 512/990] sit: charge ip_tunnel_prl_entry allocations to memcg Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 513/990] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 514/990] ACPI: glue: Rearrange acpi_bind_one() to avoid breakage Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 515/990] accel/amdxdna: Fix unsafe use of handle_mm_fault() Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 516/990] phy: samsung: usbdrd: propagate GS101 PIPE3 lock failures Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 517/990] accel/amdxdna: Fix race between unmap and free BO Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 518/990] cxl/cdat: Fix uninitialized stack use in bandwidth gathering Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 519/990] cxl/region: Unregister the pmem region when the bridge is unbound Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 520/990] thermal/drivers/airoha: Request the EN7581 IRQ after zone registration Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 521/990] perf dso: Separate libbfd and cmd addr2line caches to fix confusion Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 522/990] drm/connector: hdmi: Handle reset() state allocation failure Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 523/990] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 524/990] wifi: rtl8xxxu: unwind incomplete receive startup Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 525/990] wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 526/990] crypto: qat - hold cfg->lock when accessing config sections Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 527/990] serial: 8250: export and rename wait_for_xmitr() Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 528/990] serial: 8250_mid: wait for LSR tx empty before setting termios Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 529/990] bpf: Keep target extended until its last freplace link detaches Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 530/990] mfd: cs42l43: Move cancel_work_sync() into remove Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 531/990] accel/amdxdna: Preallocate hardware context schedulers Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 532/990] bpf: Check fastcall stack contract once for all stack accesses Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 533/990] bpf: Look at frame 0 when telling async callback entries apart Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 534/990] ASoC: mediatek: mt8188: fix clk leak on error in audsys_clk_register Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 535/990] bpf, x86: Fix timed may_goto with private stack Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 536/990] bpf: Adjust pc-relative insn copied into its own patch Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 537/990] bpf: Fix overflow of jump offset in may_goto expansion Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 538/990] bpf: Dont converge a loop on an iterator that was created anew Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 539/990] bpf: Fix uninit read for non-fetch atomics on partially spilled slots Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 540/990] bpf: Fix uninit read for helper mem args " Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 541/990] fuse: zero the correct range on a short read reply Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 542/990] platform/x86/intel/pmt: complete pcidev to device update Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 543/990] perf machine: Add session back pointer to fix out of bounds read Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 544/990] arm64: dts: qcom: x1-asus-vivobook-s15: Mark the EC reset gpio as reserved Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 545/990] wifi: ath12k: fix skb leak on paddr mismatch in wifi7 mon RX pop Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 546/990] wifi: ath12k: free pending MSDUs on duplicate mon link descriptor Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 547/990] wifi: ath12k: fix stale tail_msdu pointer returned from mpdu_pop Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 548/990] wifi: ath12k: place dp_mon_mpdu on stack in mon dst reap loop Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 549/990] wifi: ath12k: fix skb leak on monitor PPDU ID wraparound Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 550/990] wifi: ath12k: fix out-of-bounds access on TX stats arrays Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 551/990] ACPI: PCC: Free channel on OpRegion deactivation Greg Kroah-Hartman
2026-11-25 14:31 ` [PATCH 6.18 552/990] arm64: dts: qcom: lemans-evk: fix SerDes PHY regulator supplies Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 553/990] bpf: Rebase the exception callback subprog when dead subprogs are removed Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 554/990] tools/nolibc: fix readdir_r() with 64-bit directory offsets Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 555/990] RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 556/990] RDMA/mlx5: Set QP event handler before firmware QPC insertion Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 557/990] RDMA/bnxt_re: Serialize dcb_wq access against async notifier Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 558/990] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 559/990] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 560/990] perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 561/990] ALSA: usb-audio: Fix UAC2 mixer unit request handling Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 562/990] serial: 8250_mid: Add missing module namespace import for SERIAL_8250 Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 563/990] mm/memory_hotplug: fix missing rollback in __add_pages() Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 564/990] bpf: Roll back freplace link state when bpf_arch_text_poke() fails Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 565/990] scsi: scsi_debug: Enforce physical block alignment of zoned writes Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 566/990] iommu/arm-smmu-v3: Dont rb_erase() a never-inserted stream node Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 567/990] drm/msm/a5xx: dont read the GPMU registers on GPUs without a GPMU Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 568/990] dlm: validate node weights before building member array Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 569/990] dmaengine: ste_dma40: Fix cyclic transfer residue Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 570/990] dmaengine: ste_dma40: Recover coalesced cyclic callbacks Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 571/990] wifi: mt76: mt7996: free the WTBL index if a link allocation fails Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 572/990] wifi: mt76: mt7921: fix of_node reference leaks in regd update Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 573/990] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 574/990] fs/ntfs3: check return values in indx_delete_entry() Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 575/990] net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 576/990] ALSA: pcmtest: Fix leak at probe error Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 577/990] ALSA: aloop: Avoid a bad mixure of guard() and goto Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 578/990] net: macb: configure ENST registers for all queues Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 579/990] wifi: nl80211: reject zero RNR/MBSSID elements Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 580/990] dma-direct: Restore arch_dma_alloc() for the DMA_ATTR_NO_KERNEL_MAPPING case Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 581/990] cxl/port: Attach endpoints to a dport under the lock that pins it Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 582/990] ALSA: hda/realtek: Fix mute LEDs on HP ENVY 17-cr1xxx Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 583/990] RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 584/990] RDMA/core: Clear driver_udata before destroying objects in rdma_core Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 585/990] dmaengine: ste_dma40: Preserve the LCPA I/O address space Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 586/990] net: devmem: check uid and netns in net_devmem_get_binding() Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 587/990] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 588/990] net: stmmac: set real_num_tx_queues to max(offset + count) Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 589/990] net: stmmac: align real_num_tx_queues to mqprio configuration Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 590/990] wifi: ath12k: Fix NAPI resource leaks in AHB external IRQ paths Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 591/990] wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 592/990] bnge: skip dev_addr when building the VNIC unicast list Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 593/990] RDMA/bnxt_re: Use kvzalloc for QP table allocation Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 594/990] RDMA/bnxt_re: Unpublish QP table before freeing it Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 595/990] Bluetooth: btintel_pcie: remove duplicate BTINTEL_PCIE_MAGIC_NUM definition Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 596/990] Bluetooth: btintel_pcie: fix PM flow for S0ix, S3 and S4 Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 597/990] Bluetooth: hci_event: Fix LE link drop on remote features command status Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 598/990] irqchip/mst-intc: Validate the DT interrupt range Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 599/990] pinctrl: stm32: Fix the unit of the hwspinlock timeout Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 600/990] dpll: zl3073x: make embedded sync follow the output carrier frequency Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 601/990] bpf: Dont hand out a linked element as extra element Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 602/990] bpf: Keep a program until its bpf_wq callback has ended Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 603/990] bpf: Count sleepable callbacks as sleepable map users Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 604/990] bpf: Assume no bounds for buffers behind a tail call Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 605/990] bpf: Assume no bounds for a writable tp with tail calls Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 606/990] bpf: Free what map_free() unlinks for sleepable readers Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 607/990] bpf: Let bpf_dynptr_write() mark a global function Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 608/990] bpf: Dont take a dynptr argument for a local dynptr Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 609/990] locking/atomic: arc, hexagon, openrisc: Define arch_cmpxchg_local() Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 610/990] bpf: Zero-extend the index in inlined bpf_get_func_arg() Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 611/990] netfilter: flowtable: reset transport header after nf_flow_encap_pop() Greg Kroah-Hartman
2026-11-25 14:32 ` [PATCH 6.18 612/990] cgroup/cpuset: Fix a missing isolated_cpus update in update_cpumasks_hier() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 613/990] cgroup/cpuset: Consolidate isolated_cpus_can_update() into prstate_housekeeping_conflict() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 614/990] cgroup/cpuset: Consider all the exclusive CPUs when doing housekeeping check Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 615/990] cgroup/cpuset: Do housekeeping check before converting invalid partition to valid Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 616/990] cgroup/cpuset: Properly disabling partition when partition state switching fails Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 617/990] RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 618/990] xsk: freeze deferred pool teardown without blocking unregister Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 619/990] ip6mr: clear skb->cb[] in reg_vif_xmit() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 620/990] exfat: fix used_clusters accounting during cluster allocation Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 621/990] exfat: take bitmap_lock at the start of exfat_alloc_cluster() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 622/990] ksmbd: disconnect on invalid encryption transform flags Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 623/990] ksmbd: cache the resolved share path for durable reconnects Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 624/990] ksmbd: fix durable reconnects for root shares Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 625/990] ALSA: hda/realtek: Add mute and mic-mute LEDs for HP ENVY 16 (103c:8be5) Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 626/990] perf lock contention: Filter events before creating lock_stat Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 627/990] zram: fix short reads from block_state Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 628/990] cgroup/cpuset: Find furthest isolated ancestor for invalidated isolated partition Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 629/990] cgroup/cpuset: Properly compute effective xcpus in update_parent_effective_cpumask() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 630/990] cgroup/cpuset: Minor fixes to prstate_housekeeping_conflict() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 631/990] cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 632/990] cgroup/cpuset: Release invalid isolated CPUs in compute_partition_effective_cpumask() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 633/990] cgroup/cpuset: Release invalid isolated CPUs with a shrunk root partition parent Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 634/990] ksmbd: use the resolved share path for the share root Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 635/990] sched_ext: Reject rq-lock-taking kfuncs in tracing programs Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 636/990] net-sysfs: reject a one-entry RPS flow table Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 637/990] tls: keep TX and RX hardware offload on the same device Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 638/990] ksmbd: return complete and aligned stream information Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 639/990] block: dont enter reclaim under rq_qos_mutex Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 640/990] tls: Honor O_NONBLOCK in tls_sw_splice_read() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 641/990] ipv6: Protect multiple routes insertion by table lock Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 642/990] ice: use reference counting and SRCU for PTP port access Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 643/990] blk-mq-dma: initialize the dma state for P2P, too Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 644/990] pidfs: do not report fields that do not fit into the callers struct Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 645/990] Bluetooth: 6lowpan: avoid concurrent peer_del() in bt_6lowpan_disconnect Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 646/990] mm/slub: refill prefilled sheaves from the barn Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 647/990] tracing/eprobe: Install the trigger for every instance that enables the eprobe Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 648/990] KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 649/990] KEYS: Verify the key identity in __key_unlink_begin Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 650/990] bootconfig: Allow keys with the maximum supported depth Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 651/990] ALSA: caiaq: Kill EP1 URB before unregistering the input device Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 652/990] ALSA: hda/realtek: Fix the Dell XPS 8940 headset microphone Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 653/990] ALSA: usb-audio: Drop capture packets with bogus actual_length Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 654/990] ALSA: hda: Fix [codec] ID matching in patch files for IDs with bit 31 set Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 655/990] selftests/ftrace: Add missing spaces after ! in probe syntax tests Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 656/990] tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 657/990] kprobes: Fix error return and slot leak in __register_kprobe() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 658/990] kprobes: Fix double free and NULL deref in unregister_kretprobes() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 659/990] kprobes: Validate re-registration earlier in register_kretprobe() Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 660/990] mmc: jz4740: Remove the host before resetting the controller Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 661/990] mmc: sunxi: fix clock and runtime PM leaks on probe failure Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 662/990] mmc: mmci: fix DMA channel leak when mmc_add_host() fails Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 663/990] mmc: omap: synchronize clock timer before disabling fclk Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 664/990] mmc: sdhci-esdhc-imx: map unsupported driver type to Type B Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 665/990] mmc: meson-gx: report busy from DAT0 alone Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 666/990] mmc: meson-gx: honour the busy timeout for R1b commands Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 667/990] mmc: meson-gx: report the longest busy wait the controller can do Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 668/990] mmc: meson-gx: name the limit of the CMD_CFG timeout field Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 669/990] errseq: dont let errseq_check_and_advance() hide later errors Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 670/990] backing-file: pass RWF_NOAPPEND to synchronous writes Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 671/990] pidfd: restrict task access ioctls to the callers pid namespace Greg Kroah-Hartman
2026-11-25 14:33 ` [PATCH 6.18 672/990] eventpoll: wake the next waiter when a woken waiter is killed Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 673/990] aio: dont let exit_aio() return before complete() is done Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 674/990] fs: fix the SEEK_CUR f_lock condition Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 675/990] splice, net: avoid MSG_MORE when the bvec array fills Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 676/990] libfs: make i_rwsem the lock of the offset tree Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 677/990] mm/mmzone: read the zoneref slot once in zonelist_zone() Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 678/990] mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 679/990] mm: page_frag: refill the cache for large fragments Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 680/990] mm/mempolicy: read the zoneref slot once in mempolicy_slab_node() Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 681/990] mm/memory_hotplug: resize zones under their seqlock Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 682/990] mm/page_alloc: dont undo another isolation in alloc_contig_range Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 683/990] mm/page_alloc: keep the pagesets of an empty zone Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 684/990] mm/page_alloc: detect zonelist rebuilds from memory hot-add Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 685/990] mm/page_alloc: snapshot the preferred zone against shrink rebuilds Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 686/990] mm/page_alloc: clear ->private of deferred free pages Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 687/990] btrfs: fix bio counter and bioc leak when async checksumming fails Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 688/990] coda: honor the append state of each write Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 689/990] net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 690/990] macsec: reject frames that decapsulate into runt Ethernet frames Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 691/990] mctp: accept MSG_CMSG_COMPAT in recvmsg Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 692/990] net/mlx5e: Fix queue stats access to queues without stats Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 693/990] net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 694/990] net/rds: Do not unpin a page after a failed atomic pin Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 695/990] net/smc: fix lgr/lnk lifetime vs diag reader race Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 696/990] net/smc: fix link group ownership in handshake abort Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 697/990] net: bridge: use one headroom snapshot for ND replies Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 698/990] net: dsa: microchip: initialize the IRQ access mutex Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 699/990] net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 700/990] net: mana: report RX checksum offload for IPv6 Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 701/990] net: stmmac: ptp: fix support for PTP_EXTTS_REQUEST2 ioctl Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 702/990] net: usb: lan78xx: let unregister_netdev() stop phylink Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 703/990] xsk: defer software checksum until the skb is complete Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 704/990] vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 705/990] tsacct: Keep task begin times stable across suspend Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 706/990] tls: only install push_pending_record for a TX context Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 707/990] tcp: do not coalesce segments after FIN Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 708/990] tcp: fix authentication bypass via unsupported TCP auth options Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 709/990] tcp: fix request_sock use-after-free during Fast Open accept() Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 710/990] seg6: validate state in netfilter continuations Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 711/990] mptcp: reject DATA_ACKs against a reversed send interval Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 712/990] ipv4: keep XFRM headers out of corked skb lengths Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 713/990] ipv4: fib_trie: prevent speculative out-of-bounds child access Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 714/990] ipv6: fix cached route reuse for control messages Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 715/990] ipv6: reject routes without an inet6_dev Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 716/990] ipvs: Defer application parent freeing until after RCU readers Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 717/990] ipvs: fix protocol data lifetime during namespace teardown Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 718/990] gtp: free the skb after handling an echo response Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 719/990] hv_netvsc: Stop PPI parsing on invalid metadata Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 720/990] hv_sock: Report no unread data before a channel is available Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 721/990] net: gro: avoid parsing headers from shared fragments Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 722/990] net: gro: do not undo remote checksum offload on merged packets Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 723/990] net: gro: invalidate frag0 after a pull Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 724/990] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 725/990] netfilter: xt_recent: do not call remove_proc_entry() under recent_lock Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 726/990] netfilter: flowtable: extend ct timeout of offloaded GRE flows Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 727/990] netfs: preserve prepare_write errno on reissue Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 728/990] netfs: keep the prepare_read errno when abandoning read retries Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 729/990] netfs: dont hang a read whose retry is abandoned Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 730/990] net/sched: sch_teql: reject qdiscs from another network namespace Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 731/990] net/sched: act_ife: encode configured zero metadata values Greg Kroah-Hartman
2026-11-25 14:34 ` [PATCH 6.18 732/990] net/sched: act_ife: require a full Ethernet header on egress Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 733/990] NFSv4: Prevent indefinite waits for out-of-order OPEN stateids Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 734/990] openvswitch: advance by the real header length in get_ipv6_ext_hdrs() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 735/990] perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 736/990] perf/hw_breakpoint: Clear stop state in hw_breakpoint_add() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 737/990] PM: runtime: Update last_busy in rpm_resume() for active devices Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 738/990] ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 739/990] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 740/990] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 741/990] cgroup/cpuset: Dont revive invalid partition without active CPU on hotplug Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 742/990] crypto: caam - reject overlong RSA CRT parameters Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 743/990] crypto: essiv - fix use-after-free in AEAD path Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 744/990] dcache: let d_invalidate() wait for a d_set_mounted() in flight Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 745/990] fs/adfs: bound directory entry name length in adfs_fplus_getnext() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 746/990] fs/proc: fix the write length returned by proc_sys_call_handler() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 747/990] fs/splice: clamp an over-reported write_iter result Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 748/990] arm64/gcs: Ignore attempts to change GCS mode during signal return Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 749/990] arm64: errata: Add Cortex-A715/A720 AMU core counter workaround Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 750/990] arm64: kexec_file: Do not use CMA for images with a non-zero text_offset Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 751/990] arm64: ptrace: dont warn on missing siginfo in a group-stop Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 752/990] arm64: suspend: Save POR_EL0 over suspend Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 753/990] arm64: suspend: Save GCS state " Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 754/990] cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 755/990] cpufreq: Improve suspend-resume synchronization Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 756/990] cpufreq: intel_pstate: Clear last written P-state value on suspend Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 757/990] cpufreq: intel_pstate: Use rdmsrq_safe() to read MSR_MISC_PWR_MGMT Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 758/990] cpufreq: Cache post-resolution target frequency in __resolve_freq() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 759/990] software node: only let the owner release a managed node Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 760/990] SUNRPC: Fix TCP-with-TLS transport class identification Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 761/990] timekeeping: Read getboottime64() offsets under the sequence counter Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 762/990] timekeeping: Refresh auxiliary base before offset validation Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 763/990] tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 764/990] tpm: Check return value of crypto_kpp_set_secret() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 765/990] tpm: eventlog: check the payload size before reading tag events Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 766/990] tpm: flush timeout work outside buffer_mutex to avoid deadlock Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 767/990] spi: tegra210-quad: Track DMA mapping state Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 768/990] watchdog: npcm: fix clock prepare leak when setting timeout on a running watchdog Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 769/990] x86/CPU/AMD: Dont print reset reason in VMs Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 770/990] x86/mm: Ensure write visibility during LDT installation Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 771/990] x86/video: Preserve the default VGA fallback for legacy modes Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 772/990] xen/gntdev: fix deadlock between map ioctl and mmap Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 773/990] xen/privcmd: fix double free when an irqfd is shut down twice Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 774/990] xen/pvcalls: unwind pvcalls_new_active_socket() step by step Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 775/990] xen/pvcalls: destroy the per-socket workqueue on release Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 776/990] hwmon: (aht10) Fix update_interval overflow on 64-bit Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 777/990] hwmon: (gpio-fan) Fix runtime PM imbalance in probe and teardown Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 778/990] hwmon: (pmbus/mp2975) Get vout fault limits dynamically Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 779/990] hwmon: (sy7636a) fix negative temperatures Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 780/990] hwmon: (scmi) Check channel config allocation Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 781/990] hwmon: (max31760) Fix the local temperature limit registers Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 782/990] hwmon: (max31760) Leave standby mode at probe Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 783/990] hwmon: (max31760) Report 0 RPM before the first fan speed measurement Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 784/990] s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 785/990] s390/dasd: Dont trust userspace-supplied result field in format check Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 786/990] sched/deadline: Fix spurious -EPERM for migration-disabled tasks Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 787/990] sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 788/990] sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler() Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 789/990] sctp: abort unordered partial delivery when its message is skipped Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 790/990] sctp: avoid requeueing pending control chunks Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 791/990] sctp: fix ASCONF address change on single-homed hosts Greg Kroah-Hartman
2026-11-25 14:35 ` [PATCH 6.18 792/990] sctp: fix I-FORWARD-TSN handling of fragments on other streams Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 793/990] sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 794/990] sctp: reset stored flag for each association Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 795/990] LoongArch: kexec_file: Fix a modified cmdline leak Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 796/990] LoongArch: kexec_file: Fix elf_headers memory leak in retry loop Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 797/990] LoongArch: Restore KFENCE pages through DMW on resume Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 798/990] LoongArch: KVM: Propagate real error code in kvm_pch_pic_create() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 799/990] LoongArch: KVM: Reject repeated PCH-PIC CTRL_INIT Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 800/990] tracing/perf: Clear stop state in perf_trace_add() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 801/990] tracing/uprobes: Fix memory leak of tail in __trace_uprobe_create() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 802/990] tracing/eprobe: Fix 1-byte signed field fetch in get_event_field() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 803/990] tracing/eprobe: Disallow attaching eprobes to fprobe events Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 804/990] tracing/probes: Check enabled and busy state before unlinking sibling probes Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 805/990] tracing/probes: Enable newly appended probe when target event is enabled Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 806/990] tracing/probes: Fix missing BTF kind checks in char pointer/array helpers Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 807/990] tracing/probes: Fix user-space dereference string array store type Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 808/990] tracing/probes: Reject array count on non-dereference string sources Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 809/990] wifi: ath12k: assign device id from the WSI index Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 810/990] wifi: ath9k_htc: do not start ANI before the first channel is set Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 811/990] wifi: cfg80211: release rejected nontransmitted BSS reference Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 812/990] wifi: cfg80211: preserve mesh A-MSDU lengths when adding mesh headers Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 813/990] wifi: cfg80211: dont truncate the merged MBSSID profile length Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 814/990] wifi: mac80211: fix use-after-free when MLO link setup is rolled back Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 815/990] wifi: mac80211: drain link readers before stopping removed links Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 816/990] wifi: mac80211: recheck injected headers after removing FCS Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 817/990] wifi: mac80211: recheck the IBSS station limit before insertion Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 818/990] wifi: mac80211: recheck the OCB " Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 819/990] wifi: mac80211: reject invalid EHT guard intervals in airtime estimates Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 820/990] wifi: mac80211: restore dormant links when link updates fail Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 821/990] wifi: mac80211: fix use-after-free on TTLM disconnect Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 822/990] wifi: mac80211: bound pending IBSS station allocations Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 823/990] wifi: mac80211: bound pending OCB " Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 824/990] gpio: aspeed: Clear only the acked lines G4 interrupt status Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 825/990] gpio: aspeed: Preserve the pending G7 interrupt status on control writes Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 826/990] gpio: brcmstb: fix UAF after IRQ domain setup failure Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 827/990] gpio: rockchip: Fix debounce arithmetic for GPIO v2 Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 828/990] gpio: sodaville: fix use-after-free bug when registering the irqchip Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 829/990] gpio: virtuser: fix interrupt leak and UAF Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 830/990] gpio: virtuser: remove the debugfs files before freeing the line data Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 832/990] ovl: reject different lower idmaps on the same fs Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 833/990] ovl: report the requested redirect_dir mode in conflicting options Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 841/990] smb: client: fix OOB write when compounding SMB2_IOCTL with encryption Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 842/990] smb: client: fix out-of-bounds read in dfs_parse_target_referral() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 843/990] smb: client: flush deferred handles of other names before a hard link open Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 844/990] smb: client: hold the inode across cifs_oplock_break() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 845/990] smb: client: issue writes from a worker if the task is dying Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 846/990] smb: client: retry writes that couldnt be issued due to a reconnect Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 847/990] smb: client: skip NULL channel in __cifs_put_smb_ses() Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 848/990] smb: client: validate descriptor headers before query result allocation Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 849/990] dm log userspace: drop the device reference on error Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 850/990] dm: avoid double-dropping the zone reset submission reference Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 851/990] dm: fail a REQ_PREFLUSH bio with data when its preflush fails Greg Kroah-Hartman
2026-11-25 14:36 ` [PATCH 6.18 852/990] dm: fix infinite loop in dm_blk_do_report_zones() Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 853/990] dm: Reject table setup after queue or disk teardown Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 854/990] dm cache: reject kcopyd client destory if it setup failed Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 855/990] dm crypt: fix use of uninitialized percpu_counter in ctr error path Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 856/990] dm mpath: fix buffer overflow in parse_hw_handler() Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 857/990] dm mpath: cap queue_if_no_path_timeout_secs Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 858/990] dm thin: avoid wrapping no_space_timeout Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 859/990] dm-pcache: do not advance dirty_tail after backing flush failure Greg Kroah-Hartman
2026-11-25 14:37 ` [PATCH 6.18 860/990] dm-sysfs: fix misbehavior if kobject_init_and_add fails Greg Kroah-Hartman
2026-11-25 15:36 ` [PATCH 6.18 000/990] 6.18.66-rc1 review SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox