Skip to contentSkip to conversation

6.12.120-rc1 review

PATCH In review Greg Kroah-Hartman 3 participants 821 messages Nov 25 Page 1 of 7

Subsystems (3)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 6.12.120-rc1 review

This is the start of the stable review cycle for the 6.12.120 release. There are 816 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:37:39 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.12.120-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.12.y
and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <[email protected]>

    Linux 6.12.120-rc1

Christian Loehle <[email protected]>
cpufreq: Preserve global boost state on failed updates

Konrad Dybcio <[email protected]>
power: sequencing: qcom-wcn: fix bluetooth-wifi copypasta for WCN6855

Lorenzo Bianconi <[email protected]>

    net: stmmac: clear stale buf->page after recycling on skb build failure

Pascal Kneuper <[email protected]>
net: stmmac: restore NET_IP_ALIGN in the RX DMA offset

Furong Xu <[email protected]>
net: stmmac: Apply new page pool parameters when SPH is enabled

Daniel Gomez <[email protected]>
radix-tree: add missing cleanup.h

Kuniyuki Iwashima <[email protected]>
tcp: Set unhashed_state in inet_twsk_hashdance_schedule().

Stefano Garzarella <[email protected]>
9p: fix privport option setting wrong RDMA field

Pierre Barre <[email protected]>
9p: fix access mode flags being ORed instead of replaced

Sasha Levin <[email protected]>
9p: fix memory leak in v9fs_init_fs_context error path

Luiz Capitulino (Red Hat) <[email protected]>
powerpc/watchdog: disable watchdog when watchdog_thresh=0

Hyunwoo Kim <[email protected]>
tcp: fix NULL pointer dereference when restarting a Fast Open listener

Mani Tofigh <[email protected]>
nvme: fix deadlock on nvme_subsystems_lock in nvme_init_subsystem()

Henry Martin <[email protected]>
sctp: fix skb_over_panic when adding addresses with a pending delete of another family

Karol Wachowski <[email protected]>
accel/ivpu: Defer recovery until probe completes

Mani Tofigh <[email protected]>
blk-mq: take quiesce_lock when removing a queue from the tag set

Theodor Arsenij Larionov Trichkine <[email protected]>
fou: reserve headroom before pushing the encap header

Karl Mehltretter <[email protected]>
iio: trigger: Return an error when the trigger has no free irq

Changyul Lee <[email protected]>
iio: trigger: free the trigger ID after device_del()

Salah Triki <[email protected]>
iio: temperature: mlx90614: Fix dual channel probe condition check

Arnav Kapoor <[email protected]>
iio: proximity: sx9324: fix out-of-bounds read of scan period table

Shashank Mohan Jain <[email protected]>
iio: magnetometer: mmc35240: leave cache-only mode before the cache sync

Alexander Sarmanow <[email protected]>
iio: light: vcnl4035: Fix reversed ALS mode bit

Jan Remes <[email protected]>
iio: light: tsl2591: don't divide by zero

Jiale Yao <[email protected]>
iio: imu: kmx61: reject duplicate event disable

Arnav Kapoor <[email protected]>
iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes

Jean-Baptiste Maneyrol <[email protected]>
iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change

Vidhu Sarwal <[email protected]>
iio: humidity: am2315: fix negative temperature decoding

Srinivas Pandruvada <[email protected]>
iio: hid-sensors: fix fractional part for unit exponents -7 and -8

Maximilian Czirr <[email protected]>
iio: hid-sensor: Fix scale for magnetic north heading

Jiale Yao <[email protected]>
iio: gyro: bmg160: reject duplicate event disable

Baek Kyu, Kim <[email protected]>
iio: dac: mcp4725: Update the cached DAC value only on success

Nikhil Gautam <[email protected]>
iio: atlas-ezo: Fix humidity channel read support

Andrea Amer <[email protected]>
iio: afe: rescale: expose offset if rescaler or source has one

Yu-Hsiang Tseng <[email protected]>
iio: acpi: Accept comma separated values in ROTM strings

Guangshuo Li <[email protected]>
iio: accel: kxsd9: Fix potential use-after-free on removal

Billy Tsai <[email protected]>
dt-bindings: iio: adc: Add syscon property for multi-SCU SoCs

Johan Hovold <[email protected]>
USB: serial: io_edgeport: serialise MCR accesses

Johan Hovold <[email protected]>
USB: serial: io_edgeport: fix potential use-after-free on disconnect

Johan Hovold <[email protected]>
USB: serial: io_edgeport: fix potential fifo corruption

Johan Hovold <[email protected]>
USB: serial: io_edgeport: move initial termios update to open()

Johan Hovold <[email protected]>
USB: serial: io_edgeport: fix potential NULL-deref at open

Johan Hovold <[email protected]>
USB: serial: io_edgeport: fix potential close() use-after-free

Johan Hovold <[email protected]>
USB: serial: io_edgeport: fix NULL-deref on early status

Johan Hovold <[email protected]>
USB: serial: upd78f0730: fix NULL-deref on hangup

Tristan Madani <[email protected]>
USB: serial: sierra: validate URB length in instat callback

Hui Peng <[email protected]>
USB: serial: garmin_gps: validate packet data length in nat_receive()

Jesse Zhang <[email protected]>
drm/amdgpu: fix the error handling of amdgpu_vm_init_entities()

Jesse Zhang <[email protected]>
drm/amdkfd: skip GPUs without a VM when checkpointing the BO mappings

Josef Bacik <[email protected]>
w1: w1_therm: leave the slaves of other families alone

Josef Bacik <[email protected]>
w1: use the bus mutex for the "rw" file

Josef Bacik <[email protected]>
w1: remove the master's files before taking its locks

Josef Bacik <[email protected]>
w1: netlink: drop the slave after the bus is unlocked

Josef Bacik <[email protected]>
w1: ds28e04: use the bus mutex to talk on the bus

Josef Bacik <[email protected]>
w1: ds2805: use the bus mutex to talk on the bus

Josef Bacik <[email protected]>
w1: ds2482: set the strong pull-up with its byte

Josef Bacik <[email protected]>
w1: don't hold list_mutex while a slave is torn down

Radhey Shyam Pandey <[email protected]>
usb: dwc3: xilinx: fix system suspend and resume PHY handling

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Wait for End Transfer completion on ep disable

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Track a timed out End Transfer

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Reset endpoint flags on controller start

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Reject requests to a disabled endpoint

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Recover from End Transfer timeout

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Issue no-op Start Transfer only for stream endpoints

Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Clear delayed stop on End Transfer completion

Krystian Kaniewski <[email protected]>
usb: gadget: u_serial: pin ports while TTYs are installed

Brian Ellis <[email protected]>
usb: gadget: u_serial: fix NULL deref in gs_close() after failed open

Cosmin Tanislav <[email protected]>
usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty

Sonali Pradhan <[email protected]>
usb: gadget: f_midi: fix UAF race during IN request handling

Yu Zhang <[email protected]>
usb: gadget: f_mass_storage: take filesem in nofua store to fix backing-file UAF

Xu Rao <[email protected]>
usb: xhci: disable the correct slot on alloc_dev failure

Uttkarsh Aggarwal <[email protected]>

    usb: typec: ucsi: Set ucsi->connector before enabling notifications

YuanZhe Liu <[email protected]>
usb: usbtest: prevent divide by zero in simple_io() with zero length

Olivier Kaloudoff <[email protected]>
usb: uas: ignore UAS for ASMT135x bridges (174c:55aa)

Chaz Bailey <[email protected]>
usb: typec: nb7vpq904m: Set client data in probe to avoid crash on remove

Joonhoe Kim <[email protected]>
usb: typec: mux: fsa4480: Keep the USB 2.0 switch on in DP-only modes

Josef Bacik <[email protected]>
USB: serial: oti6858: fix the teardown order in close

Johan Hovold <[email protected]>
USB: serial: garmin_gps: fix deadlock on reset request

Rishabh Jain <[email protected]>
usb: pci-quirks: always assert xHCI OS ownership

Johan Hovold <[email protected]>
USB: cdc-acm: fix NULL-deref on hangup

Jiri Slaby (SUSE) <[email protected]>
tty: fix misapplied compat_ptr() in tty_compat_ioctl()

Josef Bacik <[email protected]>
serial: samsung: put the previous baud clock

Josef Bacik <[email protected]>
serial: samsung: don't leak the tty on an RX IRQ

Josef Bacik <[email protected]>
serial: rda: free the interrupt on shutdown

Josef Bacik <[email protected]>
serial: 8250_lpss: don't divide by 0 above 6.25 Mbaud

Josef Bacik <[email protected]>
misc: vmw_vmci: wait for callbacks in event unsubscribe

Jiale Yao <[email protected]>
misc: ibmvmc: initialize HMC state before device registration

Guangshuo Li <[email protected]>
misc: bcm-vk: fix DMA allocation memory leak

Josef Bacik <[email protected]>
iio: sx9310: use the data of the I2C table

Josef Bacik <[email protected]>
iio: hid-sensors: fix a division by zero

Josef Bacik <[email protected]>
iio: addac: ad74413r: fix the values of set_multiple

Josef Bacik <[email protected]>
iio: accel: adxl380: don't stay in standby on -EINVAL

Josef Bacik <[email protected]>

    comedi: vmk80xx: report failed transfers of the K8061

Josef Bacik <[email protected]>
comedi: ni_tio: Fix overflow of the clock period

Josef Bacik <[email protected]>

    comedi: ni_660x: don't poll without a DMA channel

Josef Bacik <[email protected]>
comedi: addi_apci_1500: fix clearing of the gate enable

Chris Mason <[email protected]>
vt: serialise the producers of the flip buffer

Mikulas Patocka <[email protected]>
dm-thin: fix parsing of feature arguments

Mikulas Patocka <[email protected]>
dm-thin: fix leak if __set_snapshot_details fails

Mikulas Patocka <[email protected]>
dm-thin: fix data corruption if discard races with regular I/O

Li Youhong <[email protected]>
dm-raid: fix use-after-free in raid_dtr()

Jay Vadayath <[email protected]>
dm-raid: bound array_position before indexing failed_devices

Mikulas Patocka <[email protected]>
dm-integrity: don't attempt to commit journal on disabled device

Sinan Polat <[email protected]>
dm-integrity: don't recalculate with HMAC because of a dirty bitmap

Josef Schlehofer <[email protected]>
dm-crypt: defer async write submission to write thread

xietangxin <[email protected]>
dm-crypt: reject integrity_key_size with non-authenc AEAD ciphers

Mikulas Patocka <[email protected]>
dm-cache: fix ending a cursor that never began

Mikulas Patocka <[email protected]>
dm-cache: fix NULL pointer dereference on open failure

Kyrylo Biryuk <[email protected]>
dm zoned: do not reclaim a random zone into another random zone

Kyrylo Biryuk <[email protected]>
dm zoned: back off when reclaim cannot make progress

Chen Cheng <[email protected]>
dm snapshot: fix discard writing into the next COW chunk

Chen Cheng <[email protected]>
dm snapshot: split discards on chunk boundaries

wuyuehong <[email protected]>
dm snapshot: fix discard_granularity unit in snapshot_io_hints

Mikulas Patocka <[email protected]>
dm persistent data: don't leak bufio buffer if find_leaf fails

Mikulas Patocka <[email protected]>
dm persistent data: don't ignore writeback errors

Mikulas Patocka <[email protected]>
dm persistent data: test return value of node_copy

Weijiang Zhou <[email protected]>
dm-verity: don't restart or panic on errors during system shutdown

Mikulas Patocka <[email protected]>
dm-sysfs: fix misbehavior if kobject_init_and_add fails

Yingjie Wang <[email protected]>
dm thin: avoid wrapping no_space_timeout

Yingjie Wang <[email protected]>
dm mpath: cap queue_if_no_path_timeout_secs

[email protected] <[email protected]>
dm mpath: fix buffer overflow in parse_hw_handler()

Zhao Feng <[email protected]>
dm crypt: fix use of uninitialized percpu_counter in ctr error path

Edward Adam Davis <[email protected]>
dm cache: reject kcopyd client destory if it setup failed

Kirtikumar Anandrao Ramchandani <[email protected]>
dm: Reject table setup after queue or disk teardown

Yaohan Li <[email protected]>
dm: avoid double-dropping the zone reset submission reference

[email protected] <[email protected]>
dm log userspace: drop the device reference on error

Joseph Qi <[email protected]>
smb: client: skip NULL channel in __cifs_put_smb_ses()

Paulo Alcantara <[email protected]>
smb: client: issue writes from a worker if the task is dying

Joseph Qi <[email protected]>
smb: client: hold the inode across cifs_oplock_break()

Paulo Alcantara <[email protected]>
smb: client: flush deferred handles of other names before a hard link open

Fredric Cover <[email protected]>
smb: client: fix out-of-bounds read in dfs_parse_target_referral()

Andrey Misiurov <[email protected]>
smb: client: fix OOB write when compounding SMB2_IOCTL with encryption

Paulo Alcantara <[email protected]>
smb: client: don't block dying tasks waiting for writeback on fsync

Paulo Alcantara <[email protected]>
smb: client: don't block dying tasks waiting for writeback on close

liuyong <[email protected]>
smb: client: compare owner and group SIDs using their encoded lengths

Yifan Zhang <[email protected]>
smb: client: bound invalid NTLMSSP signature diagnostic

Giuseppe Scrivano <[email protected]>
ovl: return EIO if the lowerdata is missing

Amir Goldstein <[email protected]>
ovl: report the requested redirect_dir mode in conflicting options

Jérémy Jean <[email protected]>
ovl: reject different lower idmaps on the same fs

Giuseppe Scrivano <[email protected]>
ovl: do not always clear absolute_redirect

Yu Zhang <[email protected]>
gpio: virtuser: remove the debugfs files before freeing the line data

Bartosz Golaszewski <[email protected]>
gpio: virtuser: fix interrupt leak and UAF

Bartosz Golaszewski <[email protected]>
gpio: sodaville: fix use-after-free bug when registering the irqchip

Cunhao Lu <[email protected]>
gpio: rockchip: Fix debounce arithmetic for GPIO v2

Guangshuo Li <[email protected]>
gpio: brcmstb: fix UAF after IRQ domain setup failure

Zhao Li <[email protected]>
wifi: mac80211: bound pending OCB station allocations

Zhao Li <[email protected]>
wifi: mac80211: bound pending IBSS station allocations

Zhao Li <[email protected]>
wifi: mac80211: restore dormant links when link updates fail

Zhao Li <[email protected]>
wifi: mac80211: reject invalid EHT guard intervals in airtime estimates

Zhao Li <[email protected]>
wifi: mac80211: recheck the OCB station limit before insertion

Zhao Li <[email protected]>
wifi: mac80211: recheck the IBSS station limit before insertion

Zhao Li <[email protected]>
wifi: mac80211: recheck injected headers after removing FCS

Zhao Li <[email protected]>
wifi: mac80211: drain link readers before stopping removed links

Zhao Li <[email protected]>
wifi: mac80211: fix use-after-free when MLO link setup is rolled back

Wahid Khan <[email protected]>
wifi: cfg80211: don't truncate the merged MBSSID profile length

Zhao Li <[email protected]>
wifi: cfg80211: preserve mesh A-MSDU lengths when adding mesh headers

Zhao Li <[email protected]>
wifi: cfg80211: release rejected nontransmitted BSS reference

Mehmet Fide <[email protected]>
wifi: ath9k_htc: do not start ANI before the first channel is set

Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Reject array count on non-dereference string sources

Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix user-space dereference string array store type

Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Check enabled and busy state before unlinking sibling probes

Masami Hiramatsu (Google) <[email protected]>
tracing/eprobe: Disallow attaching eprobes to fprobe events

Masami Hiramatsu (Google) <[email protected]>
tracing/eprobe: Fix 1-byte signed field fetch in get_event_field()

Mike Rapoport (Microsoft) <[email protected]>
LoongArch: Restore KFENCE pages through DMW on resume

Weiming Shi <[email protected]>
sctp: reset stored flag for each association

Tim Budding <[email protected]>
sctp: report the partially delivered MID in PARTIAL_DELIVERY_ABORTED

Tim Budding <[email protected]>
sctp: fix I-FORWARD-TSN handling of fragments on other streams

Andrey Misiurov <[email protected]>
sctp: fix ASCONF address change on single-homed hosts

Kyle Zeng <[email protected]>
sctp: avoid requeueing pending control chunks

Tim Budding <[email protected]>
sctp: abort unordered partial delivery when its message is skipped

Andrea Parri <[email protected]>
sched/core: Fix cpuset_mutex double unlock in __sched_setscheduler()

Andrea Parri <[email protected]>
sched/uclamp: Reject clamp values above SCHED_CAPACITY_SCALE

Andrea Parri <[email protected]>
sched/deadline: Fix spurious -EPERM for migration-disabled tasks

Stefan Haberland <[email protected]>
s390/dasd: Don't trust userspace-supplied result field in format check

Stefan Haberland <[email protected]>
s390/dasd: Fix wrong free and refcount leak in build_check_tcw error path

Stanislav Aleksandrov <[email protected]>
hwmon: (max31760) Report 0 RPM before the first fan speed measurement

Stanislav Aleksandrov <[email protected]>
hwmon: (max31760) Leave standby mode at probe

Stanislav Aleksandrov <[email protected]>
hwmon: (max31760) Fix the local temperature limit registers

Sudeep Holla <[email protected]>
hwmon: (scmi) Check channel config allocation

Pablo Mazzini <[email protected]>
hwmon: (sy7636a) fix negative temperatures

Felix Radensky <[email protected]>
hwmon: (pmbus/mp2975) Get vout fault limits dynamically

Rupesh Majhi <[email protected]>
hwmon: (aht10) Fix update_interval overflow on 64-bit

Yehyeong Lee <[email protected]>
xen/pvcalls: destroy the per-socket workqueue on release

Yehyeong Lee <[email protected]>
xen/pvcalls: unwind pvcalls_new_active_socket() step by step

Qihang <[email protected]>
xen/privcmd: fix double free when an irqfd is shut down twice

Andrey Misiurov <[email protected]>
xen/gntdev: fix deadlock between map ioctl and mmap

Dave Hansen <[email protected]>
x86/mm: Ensure write visibility during LDT installation

Guanglei Zhu <[email protected]>
tpm: eventlog: check the payload size before reading tag events

Eric Biggers <[email protected]>
tpm: Check return value of crypto_kpp_set_secret()

Takashi Iwai <[email protected]>
tpm: acpi: Fix memory leak at tpm_read_log_acpi() error path

Hungyu Lin <[email protected]>
timekeeping: Read getboottime64() offsets under the sequence counter

Avi Weiss <[email protected]>
SUNRPC: Fix TCP-with-TLS transport class identification

Bartosz Golaszewski <[email protected]>
software node: only let the owner release a managed node

Rafael J. Wysocki <[email protected]>
cpufreq: Cache post-resolution target frequency in __resolve_freq()

Rafael J. Wysocki <[email protected]>
cpufreq: intel_pstate: Clear last written P-state value on suspend

Li RongQing <[email protected]>
cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io()

Mark Brown <[email protected]>
arm64: suspend: Save POR_EL0 over suspend

Zhao Gongyi <[email protected]>
arm64: ptrace: don't warn on missing siginfo in a group-stop

Beata Michalska <[email protected]>
arm64: errata: Add Cortex-A715/A720 AMU core counter workaround

Cheng Yongkang <[email protected]>
fs/splice: clamp an over-reported write_iter result

Cheng Yongkang <[email protected]>
fs/proc: fix the write length returned by proc_sys_call_handler()

HyeongJun An <[email protected]>
fs/adfs: bound directory entry name length in adfs_fplus_getnext()

Jérémy Jean <[email protected]>
crypto: essiv - fix use-after-free in AEAD path

Jérémy Jean <[email protected]>
crypto: caam - reject overlong RSA CRT parameters

Ridong Chen <[email protected]>
cgroup/cpuset: Don't revive invalid partition without active CPU on hotplug

Zhao Li <[email protected]>
Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel

YuanZhe Liu <[email protected]>
Bluetooth: hci_qca: fix use-after-free in ibs debugfs files

Baoli Zhang <[email protected]>
ASoC: SOF: ipc4-topology: Fix pin format leak in process widget setup

Rafael J. Wysocki <[email protected]>
PM: runtime: Update last_busy in rpm_resume() for active devices

Phat Dinh <[email protected]>

    perf/core: Do not resurrect cpuctx->cgrp after last cgroup event exit

Joas Antonio dos Santos <[email protected]>
openvswitch: advance by the real header length in get_ipv6_ext_hdrs()

Tim Menninger <[email protected]>
NFSv4: Prevent indefinite waits for out-of-order OPEN stateids

Jamal Hadi Salim <[email protected]>
net/sched: act_ife: require a full Ethernet header on egress

Jamal Hadi Salim <[email protected]>
net/sched: act_ife: encode configured zero metadata values

Jamal Hadi Salim <[email protected]>
net/sched: sch_teql: reject qdiscs from another network namespace

Michail Andreas Michalopoulos <[email protected]>
netfilter: flowtable: extend ct timeout of offloaded GRE flows

Cen Zhang (Microsoft) <[email protected]>
netfilter: xt_recent: do not call remove_proc_entry() under recent_lock

Eric Dumazet <[email protected]>
net: gro: do not undo remote checksum offload on merged packets

Kyle Zeng <[email protected]>
net: gro: avoid parsing headers from shared fragments

Erni Sri Satya Vennela <[email protected]>
hv_netvsc: Stop PPI parsing on invalid metadata

Joas Antonio dos Santos <[email protected]>
gtp: free the skb after handling an echo response

Chengfeng Ye <[email protected]>
ipvs: fix protocol data lifetime during namespace teardown

Chengfeng Ye <[email protected]>
ipvs: Defer application parent freeing until after RCU readers

Yingjie Wang <[email protected]>
ipv6: reject routes without an inet6_dev

Xia Yan <[email protected]>
ipv6: fix cached route reuse for control messages

Daniël Trujillo <[email protected]>
ipv4: fib_trie: prevent speculative out-of-bounds child access

Kyle Zeng <[email protected]>
ipv4: keep XFRM headers out of corked skb lengths

Kyle Zeng <[email protected]>
mptcp: reject DATA_ACKs against a reversed send interval

Zixuan Chai <[email protected]>
seg6: validate state in netfilter continuations

Jérémy Jean <[email protected]>
tcp: fix authentication bypass via unsupported TCP auth options

Rishikesh Jethwani <[email protected]>
tls: only install push_pending_record for a TX context

Hungyu Lin <[email protected]>
tsacct: Keep task begin times stable across suspend

Jerome Mohm <[email protected]>

    vsock/virtio: clear vqs[] to avoid a UAF on a failed PM restore

Hamza Mahfooz <[email protected]>
net: mana: report RX checksum offload for IPv6

Jens Axboe <[email protected]>
net: leave O_NONBLOCK to the sendmsg and recvmsg syscalls

Tapio Reijonen <[email protected]>
net: dsa: microchip: initialize the IRQ access mutex

Jun Yang <[email protected]>
net: bridge: use one headroom snapshot for ND replies

Mahanta Jambigi <[email protected]>
net/smc: fix lgr/lnk lifetime vs diag reader race

Kyle Zeng <[email protected]>
net/rds: Do not unpin a page after a failed atomic pin

Jiabin Deng <[email protected]>
net/mlx5e: SHAMPO, Disable end padding when relaxed ordering is supported

Davidlohr Bueso <[email protected]>
mctp: accept MSG_CMSG_COMPAT in recvmsg

Kyle Zeng <[email protected]>
macsec: reject frames that decapsulate into runt Ethernet frames

Jean-Paul Sergent <[email protected]>
net: dst_metadata: fix memcmp overread in skb_metadata_dst_cmp

Hungyu Lin <[email protected]>
coda: honor the append state of each write

Gregory Price (Meta) <[email protected]>
mm/page_alloc: detect zonelist rebuilds from memory hot-add

Josef Bacik <[email protected]>
mm/page_alloc: keep the pagesets of an empty zone

Josef Bacik <[email protected]>
mm/memory_hotplug: resize zones under their seqlock

Gregory Price (Meta) <[email protected]>
mm/mempolicy: read the zoneref slot once in mempolicy_slab_node()

Josef Bacik <[email protected]>
mm, page_alloc: pass zone pointer to trace_reclaim_retry_zone

Gregory Price (Meta) <[email protected]>
mm/mmzone: read the zoneref slot once in zonelist_zone()

Avi Weiss <[email protected]>
splice, net: avoid MSG_MORE when the bvec array fills

Christian Brauner <[email protected]>
aio: don't let exit_aio() return before complete() is done

Mani Tofigh <[email protected]>
eventpoll: wake the next waiter when a woken waiter is killed

Chris Mason <[email protected]>
backing-file: pass RWF_NOAPPEND to synchronous writes

Igor Velkov <[email protected]>
mmc: meson-gx: name the limit of the CMD_CFG timeout field

Igor Velkov <[email protected]>
mmc: meson-gx: report the longest busy wait the controller can do

Igor Velkov <[email protected]>
mmc: meson-gx: honour the busy timeout for R1b commands

Igor Velkov <[email protected]>
mmc: meson-gx: report busy from DAT0 alone

Ian Ray <[email protected]>
mmc: sdhci-esdhc-imx: map unsupported driver type to Type B

Anfernee Cao <[email protected]>
mmc: mmci: fix DMA channel leak when mmc_add_host() fails

Steven Rostedt <[email protected]>
tracing/selftests: Fix false bashism in kprobe_non_uniq_symbol.tc

Jaewon Jung <[email protected]>
selftests/ftrace: Add missing spaces after ! in probe syntax tests

Gichoon Han <[email protected]>
ALSA: usb-audio: Drop capture packets with bogus actual_length

Sergei Nizovtsev <[email protected]>
ALSA: caiaq: Kill EP1 URB before unregistering the input device

Zhiqi Zhang <[email protected]>
bootconfig: Allow keys with the maximum supported depth

Jarkko Sakkinen <[email protected]>
KEYS: Verify the key identity in __key_unlink_begin

Jarkko Sakkinen <[email protected]>
KEYS: Reject descriptions larger than KEY_MAX_DESC_SIZE

David Carlier <[email protected]>
tracing/eprobe: Install the trigger for every instance that enables the eprobe

Eric Dumazet <[email protected]>

    tun: clear stale skb->protocol of NAPI frags skbs

Jakub Kicinski <[email protected]>
eth: bnxt: don't leak buffers when XDP agg buffer allocation fails

Naman Gulati <[email protected]>
netdev-genl: ignore NETDEV_UNREGISTER rebroadcasts

Josef Bacik <[email protected]>
blk-mq: don't trust the cookie in blk_mq_poll()

Eric Dumazet <[email protected]>
ppp: linearize and segment bridged packets when required

Chuck Lever <[email protected]>
tls: Honor O_NONBLOCK in tls_sw_splice_read()

Josef Bacik <[email protected]>
block: don't enter reclaim under rq_qos_mutex

Namjae Jeon <[email protected]>
ksmbd: return complete and aligned stream information

Rishikesh Jethwani <[email protected]>
tls: keep TX and RX hardware offload on the same device

Zhewei Yuan <[email protected]>
tcp: Fix fastreuse cache initialization on first bind

Tao Gong <[email protected]>
net: dsa: mt7530: trap frames to conduit in MFC on EN7581 and AN7583

Waiman Long <[email protected]>
cgroup/cpuset: Prevent recursive call of remote_cpus_update() via update_cpumasks_hier()

Tal Zussman <[email protected]>
ceph: wait for pending fscache write in write_folio_nounlock()

Pooyan Azad <[email protected]>
zram: fix short reads from block_state

Baek Kyu, Kim <[email protected]>
gpiolib: Propagate emulated drive errors when setting arrays

Ian Rogers <[email protected]>
perf lock contention: Filter events before creating lock_stat

Ajanesh Lal <[email protected]>
ALSA: hda/realtek: Add mute and mic-mute LEDs for HP ENVY 16 (103c:8be5)

Sasha Levin <[email protected]>
selftests/proc: proc-pid-vm: fix unused variable warning on non-x86

Namjae Jeon <[email protected]>
ksmbd: fix durable reconnects for root shares

Namjae Jeon <[email protected]>
ksmbd: cache the resolved share path for durable reconnects

Namjae Jeon <[email protected]>
ksmbd: disconnect on invalid encryption transform flags

Henry Hu <[email protected]>
ksmbd: fix iface_list use-after-free during server reset

Chi Zhiling <[email protected]>
exfat: take bitmap_lock at the start of exfat_alloc_cluster()

Chi Zhiling <[email protected]>
exfat: fix used_clusters accounting during cluster allocation

Eric Dumazet <[email protected]>

    ip6mr: clear skb->cb[] in reg_vif_xmit()

James Hilliard <[email protected]>
xsk: freeze deferred pool teardown without blocking unregister

Serhat Kumral <[email protected]>
RDMA/mlx5: Validate priority in STEERING_ANCHOR_CREATE handler

Waiman Long <[email protected]>
cgroup/cpuset: Do housekeeping check before converting invalid partition to valid

Cen Zhang <[email protected]>
ALSA: aloop: Keep shared timer callbacks alive through close

Lorenzo Bianconi <[email protected]>
netfilter: flowtable: reset transport header after nf_flow_encap_pop()

Adrian Ambrozewicz <[email protected]>
gpiolib: clear the event clock flags when a line is released

Woojin Ji <[email protected]>
bpf: Zero-extend the index in inlined bpf_get_func_arg()

Sasha Levin <[email protected]>
locking/atomic: arc, hexagon, openrisc: Define arch_cmpxchg_local()

Josef Bacik <[email protected]>
bpf: Follow the head if an skb is written from a slice

Josef Bacik <[email protected]>
bpf: Don't take a dynptr argument for a local dynptr

Josef Bacik <[email protected]>
bpf: Let bpf_dynptr_write() mark a global function

Josef Bacik <[email protected]>
bpf, cpumap: Hold the device of frames in the queue

Alexei Starovoitov <[email protected]>
bpf: Don't let an extension reach further into the context than its target

Josef Bacik <[email protected]>
bpf: Assume no bounds for a writable tp with tail calls

Josef Bacik <[email protected]>
bpf: Assume no bounds for buffers behind a tail call

Josef Bacik <[email protected]>
bpf: Count sleepable callbacks as sleepable map users

Josef Bacik <[email protected]>
bpf: Keep a program until its bpf_wq callback has ended

Josef Bacik <[email protected]>
bpf: Don't hand out a linked element as extra element

Josef Bacik <[email protected]>
bpf: Use the frame mem type in devmap egress XDP

Viktor Menshin <[email protected]>
ALSA: hda/realtek: Fix hiss/crackle on Lenovo Xiaoxin 14 GT (17aa:3912)

Ju Nan <[email protected]>
pinctrl: stm32: Fix the unit of the hwspinlock timeout

Eric Dumazet <[email protected]>
tcp: use the echoed source route in cookie_v4_check()

Li RongQing <[email protected]>
ublk: use global index for reported zones

Myeonghun Pak <[email protected]>
ASoC: rt5645: Shut down the button timer on removal

Pengpeng Hou <[email protected]>
irqchip/mst-intc: Validate the DT interrupt range

David Howells <[email protected]>
rxrpc: Fix sendmsg length

David Howells <[email protected]>
rxrpc: Fix aborting in rxperf test server

Donggeun Yoo <[email protected]>
iommufd: Keep reserved IOVA ranges when a replace within one IOAS fails

Kevin Dewald <[email protected]>
Bluetooth: hci_event: Fix LE link drop on remote features command status

Pauli Virtanen <[email protected]>
Bluetooth: hci_sync: fix mesh adv timeout units

Namhyung Kim <[email protected]>
perf symbol: Add missing symsrc__destroy() for libbfd

Namhyung Kim <[email protected]>
perf symbol: Fix symbol loading from libbfd

Jiale Yao <[email protected]>
wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup

Joonhoe Kim <[email protected]>
ASoC: codecs: wcd939x: read the SoundWire port switches per channel

Guanghui Yang <[email protected]>
btrfs: roll back sprout setup after device add failure

Lorenzo Bianconi <[email protected]>
net: stmmac: align real_num_tx_queues to mqprio configuration

Lorenzo Bianconi <[email protected]>
net: stmmac: set real_num_tx_queues to max(offset + count)

Adrián Larumbe <[email protected]>
drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove

Kees Cook <[email protected]>
seq_buf: Do not print an empty line from an overflowed seq_buf_do_printk()

Anup Vishwakarma <[email protected]>
mailbox: arm_mhu_db: Remove redundant mbox_controller_unregister() on probe failure

Anup Vishwakarma <[email protected]>
mailbox: qcom-ipcc: Remove redundant mbox_controller_unregister() on probe failure

Linus Walleij <[email protected]>
dmaengine: ste_dma40: Preserve the LCPA I/O address space

Jacob Moroni <[email protected]>
RDMA/core: Clear driver_udata before destroying objects in rdma_core

Quanye Yang <[email protected]>
RDMA/rtrs-clt: Fix recv repost to satisfy ib_drain_rq

Maksim Krasutski <[email protected]>
ALSA: hda/realtek: Fix mute LEDs on HP ENVY 17-cr1xxx

Matthew Wood <[email protected]>
bpf, arm64: Fix racy plt target update in bpf_arch_text_poke()

Tony Luck <[email protected]>
fs/resctrl: Ensure default group reports tasks on monitor-only systems

Leon Romanovsky <[email protected]>
PCI/P2PDMA: Do not tear down the allocate attribute on registration failure

Marek Szyprowski <[email protected]>
dma-direct: Restore arch_dma_alloc() for the DMA_ATTR_NO_KERNEL_MAPPING case

Johannes Berg <[email protected]>
wifi: nl80211: reject zero RNR/MBSSID elements

Takashi Iwai <[email protected]>
ALSA: hda: Use linked list for jack table

Takashi Iwai <[email protected]>
ALSA: aloop: Avoid a bad mixure of guard() and goto

Takashi Iwai <[email protected]>
ALSA: pcmtest: Fix leak at probe error

Lorenzo Bianconi <[email protected]>
net: stmmac: fix TX coalesce race and div-by-zero in XDP/legacy path

Dmitry Morgun <[email protected]>
fs/ntfs3: check return values in indx_delete_entry()

Melissa Wen <[email protected]>
drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class

Felix Fietkau <[email protected]>
wifi: mt76: mt7921: fix of_node reference leaks in regd update

Felix Fietkau <[email protected]>
wifi: mt76: mt7996: fix the hw-queues debugfs queue requests

Felix Fietkau <[email protected]>
wifi: mt76: mt7996: enable the SKU power limit table

Aamir Ahmed <[email protected]>

    wifi: mt76: mt7996: validate TLV length in mt7996_mcu_ie_countdown()

Andrei Vagin <[email protected]>
proc: report SIGEV_NONE in /proc/pid/timers if target task has died

Linus Walleij <[email protected]>
dmaengine: ste_dma40: Recover coalesced cyclic callbacks

Linus Walleij <[email protected]>
dmaengine: ste_dma40: Fix cyclic transfer residue

Roman Demidov <[email protected]>
drm/msm/a6xx: check pm_runtime_resume_and_get during resume

Qing Ming <[email protected]>
dlm: validate node weights before building member array

Dmitry Baryshkov <[email protected]>
drm/msm/a5xx: don't read the GPMU registers on GPUs without a GPMU

Marco Giunta <[email protected]>
ASoC: aw88399: skip BSTS check when boost converter is bypassed

Nicolin Chen <[email protected]>
iommu/arm-smmu-v3: Don't rb_erase() a never-inserted stream node

Shawn Lin <[email protected]>
phy: rockchip: naneng-combphy: Fix TX detect RX termination errata

Yao Zi <[email protected]>
phy: rockchip: naneng-combphy: Add SoC prefix to register definitions

Niklas Cassel <[email protected]>
scsi: scsi_debug: Advance the write pointer over the data written

Niklas Cassel <[email protected]>
scsi: scsi_debug: Enforce physical block alignment of zoned writes

Niklas Cassel <[email protected]>
scsi: scsi_debug: Avoid 32-bit overflow in WRITE SCATTERED offsets

Yuan Chen <[email protected]>
bpf: Roll back freplace link state when bpf_arch_text_poke() fails

Hal Feng <[email protected]>
riscv: dts: starfive: Correct pwm nodes

Guodong Xu <[email protected]>
riscv: dts: starfive: jh7110-common: revised device node

Yichong Chen <[email protected]>
debugfs: make debugfs_create_str() read-only

Runyu Xiao <[email protected]>
mei: vsc-tp: initialize IRQ state before requesting interrupt

Alexandra Winter <[email protected]>
s390/ism: Zerorize dmb at allocation

Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix UAC2 mixer unit request handling

Ian Rogers <[email protected]>
perf evsel: Clamp sample_id size for ksymbol, bpf, and text_poke events

Venkat Rao Bagalkote <[email protected]>
powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard

Yishai Hadas <[email protected]>
RDMA/mlx5: Set QP event handler before firmware QPC insertion

Yishai Hadas <[email protected]>
RDMA/mlx5: Fix mlx5_ib_dev_res_init() failure when XRC cap is absent

Yishai Hadas <[email protected]>
RDMA/vmw_pvrdma: Pin QP and SRQ rings writable to match device DMA write access

Phil Sutter <[email protected]>
netfilter: nfnetlink: Fix for interrupted hook dumps

Danish Khateeb <[email protected]>
tools/nolibc: fix FD_SET(), FD_CLR() and FD_ISSET() on 64-bit

Daniel Borkmann <[email protected]>
bpf: Rebase the exception callback subprog when dead subprogs are removed

Andrei Vagin <[email protected]>
x86/fpu: Fix potential underflow in xstate_calculate_size()

Sudeep Holla <[email protected]>
ACPI: PCC: Free channel on OpRegion deactivation

Abel Vesa <[email protected]>
arm64: dts: qcom: x1-asus-vivobook-s15: Mark the EC reset gpio as reserved

Abel Vesa <[email protected]>
arm64: dts: qcom: x1e78100-t14s: Mark the EC reset gpio as reserved

Abel Vesa <[email protected]>
arm64: dts: qcom: x1-crd: Mark the EC reset gpio as reserved

Yibo Tan <[email protected]>
sysctl: unregister tables before freeing bitmap

Tengda Wu <[email protected]>

    perf llvm: Fix memory leak of args->fileloc in symbol__disassemble_llvm()

Hao Sun <[email protected]>
bpf: Fix uninit read for helper mem args on partially spilled slots

Hao Sun <[email protected]>
bpf: Fix uninit read for non-fetch atomics on partially spilled slots

Alexei Starovoitov <[email protected]>
bpf: Don't converge a loop on an iterator that was created anew

Alexei Starovoitov <[email protected]>
bpf: Fix overflow of jump offset in may_goto expansion

Alexei Starovoitov <[email protected]>
bpf: Adjust pc-relative insn copied into its own patch

bui duc phuc <[email protected]>
ASoC: mediatek: mt8188: fix clk leak on error in audsys_clk_register

Puranjay Mohan <[email protected]>
bpf: Look at frame 0 when telling async callback entries apart

Kumar Kartikeya Dwivedi <[email protected]>
bpf: Check fastcall stack contract once for all stack accesses

Yuan Chen <[email protected]>
bpf: Keep target extended until its last freplace link detaches

Myeonghun Pak <[email protected]>
serial: sh-sci: Unregister UART on sysfs setup failure

Ahsan Atta <[email protected]>

    crypto: qat - hold cfg->lock when accessing config sections

Kim Wooseok <[email protected]>
wifi: rtl8xxxu: preserve RX requests across recoverable transfer errors

Kim Wooseok <[email protected]>
wifi: rtl8xxxu: unwind incomplete receive startup

Greg Kroah-Hartman <[email protected]>
mm/gup: honour FOLL_PIN in NOMMU __get_user_pages_locked()

Adrian Hunter <[email protected]>
i3c: mipi-i3c-hci: Process multiple IBIs per interrupt

Cristian Ciocaltea <[email protected]>
drm/connector: hdmi: Handle reset() state allocation failure

Guixin Liu <[email protected]>
cxl/region: Unregister the pmem region when the bridge is unbound

Guixin Liu <[email protected]>
cxl/cdat: Fix uninitialized stack use in bandwidth gathering

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: fix amd_sof_acp_probe() error unwind ordering

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: fix amd_sof_acp_remove() teardown ordering

Shakeel Butt <[email protected]>
kernfs: don't repeat or skip an entry when readdir resumes

Pengpeng Hou <[email protected]>
ASoC: rt1015: make control calibration failures observable

Alison Schofield <[email protected]>
cxl/port: Bound switch decoder target array access by nr_targets

Alison Schofield <[email protected]>
cxl/hdm: Restore commit_end when decoder enumeration fails

Pengpeng Hou <[email protected]>
phy: samsung: usbdrd: propagate GS101 PIPE3 lock failures

Rafael J. Wysocki <[email protected]>
ACPI: glue: Rearrange acpi_bind_one() to avoid breakage

Rafael J. Wysocki <[email protected]>
ACPI: glue: Carry out companion lookup under bus_type_sem

Rafael J. Wysocki <[email protected]>
ACPI: glue: Rework the success message in acpi_device_notify()

Rafael J. Wysocki <[email protected]>
ACPI: glue: Reduce debug noise from acpi_device_notify()

Thomas Huth <[email protected]>
crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data

Eric Dumazet <[email protected]>
sit: charge ip_tunnel_prl_entry allocations to memcg

Baochen Qiang <[email protected]>
wifi: ath12k: fix truncated TX buffer DMA address in MSDU ext descriptor

Golla Nagendra <[email protected]>
dmaengine: zynqmp_dma: Free sw_desc_pool on desc_pool_v alloc failure

Golla Nagendra <[email protected]>
dmaengine: zynqmp_dma: Fix PM rollback on sw_desc_pool alloc failure

Pengpeng Hou <[email protected]>
ASoC: sta32x: make power restoration transactional

Dave Jiang <[email protected]>
ACPI: APEI: GHES: Validate memory error section length before payload access

Lachlan Hodges <[email protected]>
wifi: mac80211: don't seed an S1G sta's last_rate

Miaoqing Pan <[email protected]>
wifi: ath11k: fix NULL dereference in ahb remove when QMI init incomplete

Jingbo Xu <[email protected]>
fuse: don't bump attr_version for async direct read completion

Davidlohr Bueso <[email protected]>
cxl/test: Map mock device nodes to an online node

Nicolas Frattaroli <[email protected]>
drm/panthor: Revisit reqs_lock handling in flush/reset paths

Christian Aurich Zanettini Martins <[email protected]>
nvme-tcp: fix use-after-free in nvme_tcp_free_ctrl()

Guixin Liu <[email protected]>
nvme-tcp: Validate the queue state under the queue lock in the address attribute

Hui Su <[email protected]>
perf evsel: Restrict incremental open error unwind

Salvatore Dipietro <[email protected]>
mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations

Alexandr <[email protected]>

    ALSA: hda/realtek: Enable mute and mic-mute LEDs on HP ENVY 17-cr0xxx

Josef Bacik <[email protected]>
mm/userfaultfd: wake all waiters on unregister

Cunhao Lu <[email protected]>
can: skb: make echo skb freeing safe in any IRQ context

Daejun Park <[email protected]>
xfs: refuse a pNFS LAYOUTCOMMIT of a range without blocks

Jouni Högander <[email protected]>
drm/i915/psr: Disable linked plane sel fetch as well

Yingjie Wang <[email protected]>
nvmet-tcp: validate the TLS handshake timeout

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

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

Shen Lichuan <[email protected]>
power: supply: Correct multiple typos in comments

Jianping Li <[email protected]>
misc: fastrpc: Allocate entire reserved memory for Audio PD in probe

Devin Wittmayer <[email protected]>
wifi: mt76: take rcu_read_lock in the USB/SDIO tx completion path

Sean Young <[email protected]>
media: rc: Add missing locking for keymap

Sean Young <[email protected]>
media: rc: Replace open coded krealloc() for keymap

Sean Christopherson <[email protected]>

    x86/cpuid: Mark CPUID function 0x23 as being indexed

David Howells <[email protected]>
rxrpc: Fix lack of short-send handling in rxrpc_kernel_send_data()

Ratnaker Gautam <[email protected]>
smb: client: validate NT transaction response layout and offsets

Paulo Alcantara <[email protected]>
smb: client: reclaim credits for decrypted reads with no matching mid

Vernon Yang <[email protected]>
mm: khugepaged: fix folio is used after pte_unmap_unlock()

Harald Freudenberger <[email protected]>
s390/zcrypt: Fix and improve zcrypt reply message verification checks

Harald Freudenberger <[email protected]>
s390/zcrypt: Make apfs a real unsigned int field

Christian Brauner <[email protected]>
coredump: prevent TIF_NOTIFY_SIGNAL from interrupting coredumps

Jan Beulich <[email protected]>
Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages()

Jude Gyimah <[email protected]>
ALSA: aw2-alsa: select SND_PCM

Guixiong Wei <[email protected]>
KEYS: do not let an unmatched key decide the search result

Manuel Ebner <[email protected]>
docs, kprobes: Fix bracket

Wenwen Fu <[email protected]>
tracing: skip boot kprobe setup when no events were requested

Eric Dumazet <[email protected]>
nsh: limit recursion in nsh_gso_segment()

Iustin Stolniceanu <[email protected]>
net: phy: c45: select BASE-T1 type for the forced speed

Cosmin Ratiu <[email protected]>
net/mlx5e: IPsec, don't match upper proto selectors in crypto offload TX

Jiahao Xu <[email protected]>
net: usb: cdc_ncm: don't underflow the NDP room check

Wenbo Sun <[email protected]>
amt: use ipv6_hdr() in amt_mldv1_leave_handler()

Kuniyuki Iwashima <[email protected]>

    tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().

Uri Dar <[email protected]>
net/mlx5: Lag, Return error when enabling MPESW without LAG support

Junyoung Jang <[email protected]>
igmp: use the joined device when leaving a multicast group

Ofri Zangi <[email protected]>
tls: fix async encryption race on weakly ordered architectures

Kalpesh Solanki <[email protected]>
tun: disallow setting IEEE 802.15.4 and 6LoWPAN link types via TUNSETLINK

Avi Weiss <[email protected]>
net: ena: avoid RX copybreak for multi-descriptor packets

Breno Leitao <[email protected]>
net: ena: Keep the RX buffer mapped if skb allocation fails

Omar Ramadan <[email protected]>
amt: tear down every amt device on an unregistering lower

Chris Mason <[email protected]>
tcp: Drop any segments if DEFER_CONNECT is set.

LiangCheng Wang <[email protected]>
ASoC: max98090: keep the MIC boost across mic input power-up

Kavitha Daula <[email protected]>
xen/grant-table: annotate on-stack work in gnttab_unmap_refs_sync()

Pengpeng Hou <[email protected]>
drm/bridge: sii902x: validate I2S data lane values

Kyle Zeng <[email protected]>
udp: check frag_list IP family before using skb_segment_list()

Anandu Padinhare <[email protected]>
net: stmmac: count XDP_PASS frames in rx_packets on the XSK zero-copy path

Eric Dumazet <[email protected]>

    net: gro: compare skb->protocol in gro_list_prepare()

Eric Dumazet <[email protected]>
udp: do not use a cross-family sk_rx_dst in early demux

Eric Dumazet <[email protected]>
tcp: do not resurrect a former listener with SO_ATTACH_REUSEPORT_[CE]BPF

Kuniyuki Iwashima <[email protected]>
tcp: Do not allow buggy transitions between ehash and lhash2.

Eric Dumazet <[email protected]>
net: rfs: add sock_rps_delete_flow() helper

Eric Dumazet <[email protected]>
fou: gue: check IP version of held packets for direct IP encapsulation

Cosmin Ratiu <[email protected]>
net/mlx5e: Serialize TC and IPsec offload exclusion counters

Chris Mason <[email protected]>
net: skbuff: uncharge trimmed zerocopy frags on error

Yuho Choi <[email protected]>
ptp: kvm: x86: Leak clock_pair page if changing its encryption fails

Chase Hiltz <[email protected]>
ipv4: route: don't blackhole in-use routes when retiring fnhe routes

Ivan Vecera <[email protected]>
dpll: notify about a reference sync pair only if it was added

Changyul Lee <[email protected]>
net/mlx5: macsec: Don't remove fs_id when adding a rule fails

Alexander Duyck <[email protected]>
net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist

Alexander Duyck <[email protected]>
fbnic: Wait for the outbound flush to complete on mailbox teardown

Umang Pokhriyal <[email protected]>
tun: delete the flow entries of the moved queue on detach

Olga Kornievskaia <[email protected]>
NFSv4: wake blocking lock waiters when a delegated lock is released

Eric Dumazet <[email protected]>
bonding: fix slave_cnt leak on XDP enslave failure

Denis V. Lunev <[email protected]>
ovl: release the upperdir/workdir in-use locks before the umount sync

Christian Brauner <[email protected]>
ovl: allow idmapping overlay mounts

Tianyi Gao <[email protected]>
net: fix mac_len of skbs copied by generic XDP

Mehmet Fide <[email protected]>
wifi: mac80211: abort chanswitch when leaving an IBSS

Johannes Berg <[email protected]>
wifi: mac80211: mesh: don't linearize SKBs unnecessarily

Kyle Zeng <[email protected]>
ipvlan: make outbound skb headers writable

Kyle Zeng <[email protected]>
net: require a full socket in sock_confirm_neigh()

Kyle Zeng <[email protected]>
net: protect negative destination advice with RCU

Mark Bloch <[email protected]>
net/mlx5: Lag, free steering resources on LAG destroy failure

Li RongQing <[email protected]>
team: fix promisc/allmulti leak in team_port_add error path

Nikola Z. Ivanov <[email protected]>
team: Add matching error label for failed action

Yaroslav Dudkov <[email protected]>
ipv6: ignore link state in gateway check

Gal Pressman <[email protected]>
net/mlx5: Bridge, fix bogus MDB offload errors

Kuniyuki Iwashima <[email protected]>
af_unix: Remove gc_in_progress check in unix_peek_fpl().

Chenguang Zhao <[email protected]>
i40e: xsk: fix multi-buffer XDP_PASS skb construction

Kyle Zeng <[email protected]>
net: skbuff: preserve fclone lifetime when freeing stolen heads

Mark Korenberg <[email protected]>
ublk: publish a new device by its id only once it is set up

Avi Weiss <[email protected]>
SUNRPC: Balance queue accounting when relocating a task

Avi Weiss <[email protected]>
SUNRPC: Balance switch queue length on transport removal

Avi Weiss <[email protected]>
SUNRPC: preserve transport security policy when cloning clients

Avi Weiss <[email protected]>
SUNRPC: preserve timeout policy when cloning clients

Avi Weiss <[email protected]>
SUNRPC: wake poll waiters when an empty pipe is unlinked

Avi Weiss <[email protected]>
NFS: restore directory index when resuming readdir

Avi Weiss <[email protected]>
NFS: Fix inverted cross-directory rename check

Avi Weiss <[email protected]>
NFS: update ctime for atime-only UTIME_NOW requests

Jeff Layton <[email protected]>
nfs: fix utimensat() for atime with delegated timestamps

Avi Weiss <[email protected]>
NFS: honor UTIME_NOW atime with explicit mtime

Avi Weiss <[email protected]>
NFSv4.1: retain MDS I/O until both thresholds are met

Johannes Thumshirn <[email protected]>
btrfs: zoned: don't wait for ordered extents in do_zone_finish()

Johannes Thumshirn <[email protected]>
btrfs: zoned: only change active zone counter on successful (de)activation

Samuel Leyva <[email protected]>
ASoC: amd: acp: es83xx: Enable speaker amplifier after the codec output

Vijendar Mukunda <[email protected]>

    ASoC: SOF: amd: guard adata->sdw dereferences with NULL check in IRQ handler

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: add soundwire wake irq handling

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: enable soundwire host wake irq mask

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: enable ACP_PME_EN register for ACP7.0 & ACP7.1 platforms

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: add ACP7.1 platform support

Vijendar Mukunda <[email protected]>
ASoC: SOF: amd: remove else condition in resume sequence

Tyler Baker <[email protected]>
ASoC: soc-core: copy the DAI link names into the card

Dmitry Torokhov <[email protected]>
gpiolib: of: return -ENOENT from of_gpio_count() stub

Vinay Belgaumkar <[email protected]>
drm/xe: Toggle the D3Cold enable flag at runtime resume

Arvind Yadav <[email protected]>
drm/xe: Rebind BOs evicted before the first LR queue

Yifan Zhang <[email protected]>
tracing/probes: bound symstr stores to reserved length

Shao Mingyin <[email protected]>
ata: libata-scsi: set the field pointer when rejecting CDL

Niklas Cassel <[email protected]>
ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers

Niklas Cassel <[email protected]>
ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length

Niklas Cassel <[email protected]>
ata: libata-scsi: fix MODE SELECT field pointer for unsupported subpages

Niklas Cassel <[email protected]>
ata: libata-scsi: reject MODE SELECT mode pages with a wrong SPF bit

Niklas Cassel <[email protected]>
ata: libata-scsi: do not accept subpage code FFh in MODE SELECT

Niklas Cassel <[email protected]>
ata: libata-scsi: fix MODE SELECT handling of data after the mode page

Alexei Starovoitov <[email protected]>
ipv6: Check the Home Address option again before its address is used

Eric Dumazet <[email protected]>
calipso: do not charge request socket options to the listener

Or Har-Toov <[email protected]>
net/mlx5e: Add missing Ethernet multicast octets to vport_rx_bytes sum

Anil Kaushik <[email protected]>
netlink: Do not call the unbind callback with the table locked

Prathamesh Deshpande <[email protected]>
net/mlx5e: IPoIB, Fix QPN lookup race

Kyle Pepper <[email protected]>
Bluetooth: reject invalid LE supervision timeout relationships

Christian Loehle <[email protected]>
cpufreq: Serialize global boost updates

Viresh Kumar <[email protected]>
cpufreq: Force sync policy boost with global boost on sysfs update

Viresh Kumar <[email protected]>
cpufreq: staticize cpufreq_boost_trigger_state()

Dheeraj Kumar Srivastava <[email protected]>
iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails

Benjamin Segall <[email protected]>

    perf: Fix racy update of cpc->hrtimer_interval

Peter Zijlstra <[email protected]>
perf/core: Detach 'struct perf_cpu_pmu_context' and 'struct pmu' lifetimes

Peter Zijlstra <[email protected]>
perf/core: Add this_cpc() helper

Peter Zijlstra <[email protected]>
perf/core: Merge struct pmu::pmu_disable_count into struct perf_cpu_pmu_context::pmu_disable_count

Peter Zijlstra <[email protected]>
perf/core: Simplify perf_pmu_register()

Peter Zijlstra <[email protected]>
perf/core: Simplify the perf_pmu_register() error path

Sandipan Das <[email protected]>
perf/x86/amd/uncore: Avoid context migration from non-owners

Peter Zijlstra <[email protected]>
locking/osq: Fix unlink queue corruption

Peter Zijlstra <[email protected]>
locking/osq: Switch osq_wait_next()/atomic_cmpxchg() ordering

Thomas Fourier <[email protected]>
net/mlx5e: TC, Fix double free of branch in failure

Eric Dumazet <[email protected]>
tcp: bound snd_cwnd_clamp to TCP_MAX_SND_CWND

Hui Su <[email protected]>
sched/topology: Balance cluster static-key updates

Hui Su <[email protected]>
sched/pelt: Fix u32 truncation of the PELT period count

Siddharth Chintamaneni <[email protected]>
fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek()

Max Kellermann <[email protected]>
fs/read_write: make default_llseek() killable

Jeff Layton <[email protected]>
statx: don't leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask

Hungyu Lin <[email protected]>
vfs: preserve subsecond timestamps at filesystem time limits

Andrea Parri <[email protected]>
iov_iter: take an unsigned long segment count in import_iovec()

Abbott Liu <[email protected]>
initrd: flush deferred fput() before mounting root

Christian Brauner <[email protected]>
libfs: end offset readdir at positions past DIR_OFFSET_EOD

Florian Fainelli <[email protected]>
MIPS: SB1250: Validate and update IRQ affinity

Florian Fainelli <[email protected]>
MIPS: Alchemy: Save the Ethernet address before reusing PROM memory

Imre Kaloz <[email protected]>
MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC

Rosen Penev <[email protected]>
MIPS: Avoid dead code/data elimination when using recordmcount

Eric Dumazet <[email protected]>

    tcp: ipv6: free ireq->ipv6_opt after an RCU grace period

Florian Westphal <[email protected]>
netfilter: nat: zero newrange before filling it in

Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: fix memleak when rule deletion fails with hardware offload

Joas Antonio dos Santos <[email protected]>
netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport()

Fernando Fernandez Mancera <[email protected]>
netfilter: x_tables: check target name before accessing verdict

Laveesh Bansal <[email protected]>
netfilter: bridge: use DEBUG_NET_WARN_ON_ONCE in nf_ct_bridge_refrag()

Qingfang Deng <[email protected]>
tcp: initialize send sequence numbers before deferring TFO

Cheng Yongkang <[email protected]>
net: bridge: disable MRP ports before the FDB flush in del_nbp()

Lorenzo Bianconi <[email protected]>
net: stmmac: set XDP metadata length on the page_pool RX path

Furong Xu <[email protected]>
net: stmmac: Switch to zero-copy in non-XDP RX path

Furong Xu <[email protected]>
net: stmmac: Unexport stmmac_rx_offset() from stmmac.h

Kyle Zeng <[email protected]>
ip6mr: Serialize multicast router socket ownership

Timur Stukan <[email protected]>
bonding: 3ad: don't set BOND_LINK_FAIL on a slave that is not up

Colton Pawielski <[email protected]>
net: 8139cp: keep Rx masked while NAPI is scheduled

Richard Fitzgerald <[email protected]>
ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down()

Michał Kopeć <[email protected]>
ALSA: hda/core: Stop capability walk on empty capability header

Munique Feitoza <[email protected]>
drm/nouveau: Fix CE channel creation on pre-Kepler GPUs

Rosen Penev <[email protected]>
drm/nouveau/fifo: map Kepler video engine contexts non-privileged

Frederic Konrad <[email protected]>
spi: cadence-quadspi: Fix race between DMA completion and transfer start

Luiz Augusto von Dentz <[email protected]>

    Bluetooth: Fix not updating of hdev->commands[] after reset

Florian Fainelli <[email protected]>
net: dsa: b53: restore the NSP IMP port 2 Gbps mode

Florian Fainelli <[email protected]>
net: ethernet: bgmac: preserve forced 2.5 Gbps link speed

Zhao Li <[email protected]>
Bluetooth: L2CAP: Clear request identifiers on incoming LE connections

Zijun Hu <[email protected]>
Bluetooth: hci_conn: Fix SCO/eSCO Transport_Unit_Size for HCI data path

Richard Fitzgerald <[email protected]>
ASoC: wm_adsp: Prevent negative string length in wm_adsp_control_add()

Sasha Levin <[email protected]>
ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()

Sasha Levin <[email protected]>
ACPI: scan: Print the offline failure message in acpi_bus_offline()

Richard Fitzgerald <[email protected]>
firmware: cs_dsp: Fix memory leak on cs_dsp_power_up() error path

Mario Limonciello <[email protected]>
drm/amd/pm: track BACO state in the SMU v11 ArmD3 sequence

Eric Dumazet <[email protected]>

    tcp: ipv6: do not read ireq->pktopts from tcp_v6_send_synack()

Eric Dumazet <[email protected]>
inet: consolidate inet_csk_clone_lock()

Eric Dumazet <[email protected]>
inet: reduce inet_csk_clone_lock() indent level

Kuniyuki Iwashima <[email protected]>
ipv4: Call rt_add_uncached_list() if !do_cache in ip_route_input_slow().

Kuniyuki Iwashima <[email protected]>
ipv6: Flush exception route while replacing nexthop.

Zhou Minqiang <[email protected]>
PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove

Avi Weiss <[email protected]>
net: skbuff: reject zero MPLS TTL before decrementing

Guillaume Nault <[email protected]>
tcp: Fix dup-ack detection on non-SACK bidirectional data transfer.

Hungyu Lin <[email protected]>
isofs: handle Rock Ridge long-form dates before 1900

James Clark <[email protected]>
net: ethernet: ti: am65-cpts: adjust perout genf following ptp changes

Chris Mason <[email protected]>
nvmet-rdma: disconnect a queue on device removal

Bjorn Helgaas <[email protected]>
nvme: fix various comment typos

Chris Mason <[email protected]>
nvmet-rdma: queue the release work under the mutex

Chris Mason <[email protected]>
nvmet-rdma: take a device off the list last

Josef Bacik <[email protected]>
nvmet-tcp: limit the connections accepted per work run

Chris Mason <[email protected]>
nvmet-rdma: disconnect only established queues

Josef Bacik <[email protected]>
nvmet-tcp: ask for the TLS record type on every receive

Alexander Goodkind <[email protected]>
net: ethernet: mediatek: preserve sibling PPE bindings

Florian Fainelli <[email protected]>
net: dsa: b53: Enable IGMP and MLD control packet CPU copies

Kyle Zeng <[email protected]>
tcp: wait for TIME_WAIT teardown before freeing per-netns ehash

Niklas Cassel <[email protected]>
null_blk: don't finish zones to set them read-only or offline

Niklas Cassel <[email protected]>
null_blk: fix opening closed zones at the active zone limit

Nguyen Dinh Phi <[email protected]>
vsock: reject negative tv_usec in SO_VM_SOCKETS_CONNECT_TIMEOUT

Avi Weiss <[email protected]>
block: report the correct discard alignment in sysfs

zhangguopeng <[email protected]>
block: Replace sprintf() with sysfs_emit()

Zizhi Wo <[email protected]>
block: partitions: reject GPT entries with starting_lba > ending_lba

Shao Mingyin <[email protected]>
virtio-blk: Fix zone append sector reporting in batched completion

John Ogness <[email protected]>
printk: Avoid multiple unregistration in unregister_console_locked()

Petr Mladek <[email protected]>
printk: Allow to use the printk kthread immediately even for 1st nbcon

Josef Bacik <[email protected]>
ext2: only flush DIRSYNC directories on every change

Mingbing Zhai <[email protected]>
virtio_balloon: initialize wakeup_lock before virtqueues are set up

Linfeng Sun <[email protected]>
vhost-vdpa: initialize state before publishing cdev

Linfeng Sun <[email protected]>
vhost: reject backend enable without a kick file

Linfeng Sun <[email protected]>
vhost-scsi: reject delayed virtqueue setup

Linfeng Sun <[email protected]>
vhost-scsi: validate event queue descriptor direction

Shuai Zhang <[email protected]>
power: sequencing: qcom-wcn: increase WCN7850 power-up delay

Bartosz Golaszewski <[email protected]>
power: sequencing: qcom-wcn: improve support for wcn6855

Eric Dumazet <[email protected]>

    soreuseport: annotate data-races around reuse->socks[] and num_socks

Yifan Zhang <[email protected]>
ksmbd: require NUL-terminated EA names

Aaditya Kansal <[email protected]>
ksmbd: implement error handling for STATUS_INFO_LENGTH_MISMATCH in smb server

Bart Van Assche <[email protected]>
mctp i3c: Fix locking in an error path

Kevin Dewald <[email protected]>
Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery

Yifan Zhang <[email protected]>
Bluetooth: validate retained LE Set CIG Parameters command length

Yifan Zhang <[email protected]>
Bluetooth: validate retained LE Create CIS command length

Cen Zhang <[email protected]>
Bluetooth: hci_core: Initialize advertising RPA work only once

Kevin Dewald <[email protected]>
Bluetooth: MGMT: Clear disabled connection parameters when loading none

Cen Zhang <[email protected]>
Bluetooth: hci_sync: Copy the resolving-list IRK under RCU

Cen Zhang <[email protected]>
Bluetooth: hci_core: Keep link-key filtering inside RCU

Ismail Tarim <[email protected]>
Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init()

Tobias Wilken <[email protected]>
Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller

Shuai Zhang <[email protected]>
Bluetooth: mgmt: reply to cancelled mgmt commands instead of silently dropping

Cen Zhang <[email protected]>
Bluetooth: hci_sync: Protect resolving-list lookups

Cen Zhang <[email protected]>

    Bluetooth: hci_sync: Copy the LE accept list under hdev->lock

Chris Lu <[email protected]>
Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD

Chris Lu <[email protected]>
Bluetooth: btmtk: bound the ISO payload length by the controller's MTU

Chris Lu <[email protected]>
Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding

Kevin Dewald <[email protected]>
Bluetooth: hci_event: Clear explicit connect state on LE connection

Catherine L <[email protected]>
Bluetooth: btintel: fix buffer over-read in fw payload

Akhil Arul <[email protected]>
Bluetooth: hci_core: Fix queuing rx_work while workqueue is drained

Binbin Deng <[email protected]>
Bluetooth: hci_core: Initialize LTK before publication

Binbin Deng <[email protected]>
Bluetooth: hci_core: Initialize link key before publication

Binbin Deng <[email protected]>
Bluetooth: hci_core: Initialize IRK before publication

Jerome Brunet <[email protected]>
ASoC: meson: axg-fifo: request the irq with the clock enabled

Bryam Vargas <[email protected]>
net/iucv: take a private, writable frame before rewriting it in place

Guangshuo Li <[email protected]>
gpio: mpc8xxx: Fix potential use-after-free of IRQ domain

Bartosz Golaszewski <[email protected]>

    gpio: mpc8xxx: use a helper variable to store the address of pdev->dev

Daniel Machon <[email protected]>
net: sparx5/lan969x: release the in-flight slot of a stale TX skb

Dmitry Baryshkov <[email protected]>
regulator: qcom_spmi: don't take a sleeping lock in the SAW IPI

Yuho Choi <[email protected]>
virtio_blk: Reset device on probe error paths after DRIVER_OK

Sergii Ushakov <[email protected]>
virtio-blk: clamp max_segments to virtqueue ring size

Yu Zhang <[email protected]>
vhost-vdpa: drop the parent's vq callback before the call fd is released

Sean Christopherson <[email protected]>
irqbypass: Take ownership of producer/consumer token tracking

Linfeng Sun <[email protected]>
vhost: reject invalid IOTLB update permissions

Xiang Mei <[email protected]>
vdpa: fix double free of the reply skb in vdpa_nl_cmd_dev_config_get_doit()

Maoxia <[email protected]>
virtio_pci: add missing newline to the pmcsr error message

Jia Jia <[email protected]>
vhost-scsi: do not relock event vq mutex on send_evt fallback

Jia Jia <[email protected]>
vhost-scsi: preserve event ordering

Linfeng Sun <[email protected]>
vdpa: invalidate DMA mappings before releasing memory

Linfeng Sun <[email protected]>
vdpa_sim: serialize IOTLB updates with dataplane access

Alex Austin <[email protected]>
sfc: ptp: avoid racing PPS timestamp updates

Alex Austin <[email protected]>
sfc: ptp: serialize host and MC synchronization transactions

Alex Austin <[email protected]>
sfc: ptp: drop the stale frequency reset in efx_ptp_start()

Vladimir Zapolskiy <[email protected]>
drm/panel: visionox-r66451: Wait longer after the panel reset

Vladimir Zapolskiy <[email protected]>
drm/panel: visionox-r66451: Send the brightness value MSB first

Daniel Machon <[email protected]>
net: lan966x: don't free XDP buffers in fdma tx clear with budget 0

Giuseppe Piscitelli <[email protected]>
ata: libata-core: Check device support before querying power state

Lorenzo Bianconi <[email protected]>
net: stmmac: copy XDP metadata in AF_XDP zero-copy RX

Lorenzo Bianconi <[email protected]>
net: stmmac: drop split frames on AF_XDP zero-copy RX

Furong Xu <[email protected]>
net: stmmac: Set dma_sync_size to zero for discarded frames

Niklas Cassel <[email protected]>
ata: libata-eh: Retry non-NCQ commands when their sense data asks for it

Igor Pylypiv <[email protected]>
ata: libata-sata: allow re-enabling NCQ with the same queue_depth

Eric Dumazet <[email protected]>
tcp: do not let tcp_collapse() drive sk_forward_alloc negative

Cen Zhang (Microsoft) <[email protected]>
ipv6: fix fib6 walker UAF on NLM_F_REPLACE

Vlad Poenaru <[email protected]>
bnxt_en: Don't keep MSI-X vectors added before FW reserves them

Joas Antonio dos Santos <[email protected]>
net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period

Yuqiang Sun <[email protected]>
bpf: lwt: Free the skb when bpf_xmit() fails to expand the headroom

Rosen Penev <[email protected]>
spi: acpi: only look up the IRQ of confirmed SPI devices

Alban Bedel <[email protected]>
spi: Fix ACPI SPI resources using relative path

Chris Mason <[email protected]>
bpf: Check the offset in bpf_skb_generic_{push,pop}()

Chris Mason <[email protected]>
bpf: Move the transport header with the moved headers

Alexei Starovoitov <[email protected]>
bpf: Require BPF_LWT_REROUTE when an lwt_in prog changes the protocol

Alexei Starovoitov <[email protected]>

    bpf: Reset skb->cb after an lwt prog pushes an IP header

Guillaume Nault <[email protected]>
ipv4: Convert ip_route_input_noref() to dscp_t.

Alexei Starovoitov <[email protected]>
bpf: Don't leave a stale MAC header in bpf_lwt_push_ip_encap()

Chris Mason <[email protected]>
bpf: Move the MAC header in bpf_lwt_seg6_adjust_srh()

Alexei Starovoitov <[email protected]>
bpf: Don't look for the SRH again in the End.BPF helpers

Chris Mason <[email protected]>
bpf: Limit the SRH length in bpf_lwt_seg6_adjust_srh()

Chris Mason <[email protected]>
bpf: Reject non-IPv6 packets in BPF_LWT_ENCAP_SEG6

Alexei Starovoitov <[email protected]>
bpf: Don't let bpf_skb_adjust_room() raise gso_size to GSO_BY_FRAGS

Chris Mason <[email protected]>
bpf, cgroup: Keep the skb network offset signed

Chris Mason <[email protected]>
bpf: Require prog fd or capability for cgroup detach

Alexei Starovoitov <[email protected]>
bpf: Remove the WARN from arena_get_unmapped_area()

Alexei Starovoitov <[email protected]>
bpf: Refuse an arena mmap() longer than max_entries pages

Alexei Starovoitov <[email protected]>
bpf: Refuse to map an arena at address 0

Alexei Starovoitov <[email protected]>
bpf: Clamp the trace length before the skip test in stackid_init()

Jiri Olsa <[email protected]>
bpf: Avoid changing callchain in bpf_get_stackid_pe

Josef Bacik <[email protected]>
bpf: Clamp the trace length in __bpf_get_stack() again

Jiri Olsa <[email protected]>
bpf: Avoid changing callchain in bpf_get_stack_pe

Hongjian Dai <[email protected]>
spi: pic32-sqi: fail transfer when the BD ring is exhausted

Fernando Fernandez Mancera <[email protected]>
netfilter: nft_reject: prevent unbounded recursion in output hooks

Pablo Neira Ayuso <[email protected]>
netfilter: nf_dup_netdev: add nf_dev_xmit_recursion*() helpers and use them

Weiming Shi <[email protected]>
netfilter: nft_fwd_netdev: use recursion counter in neigh egress path

Pablo Neira Ayuso <[email protected]>
netfilter: nft_fwd_netdev: add device and headroom validate with neigh forwarding

Sebastian Andrzej Siewior <[email protected]>
netfilter: nf_dup_netdev: Move the recursion counter struct netdev_xmit

Sasha Levin <[email protected]>
ALSA: memalloc: Free the new pages when WC DMA mapping fails

Thomas Fourier <[email protected]>
net: ipa: Fix double free of the interrupt structure on config error

Tung Nguyen <[email protected]>
tipc: reject attaching bearer of different media to the same occupied device

Jia Jia <[email protected]>
scsi: target: Validate REGISTER AND MOVE TransportID length

Fernando Fernandez Mancera <[email protected]>
net/smc: fix limit_smc_hs sysctl on big-endian architecture

James Hilliard <[email protected]>
ptp: vclock: serialize extended samples with counter updates

James Hilliard <[email protected]>
ptp: vclock: propagate physical clock sampling errors

James Hilliard <[email protected]>
ptp: unwind partially completed virtual clock creation

James Hilliard <[email protected]>
ptp: drain virtual clock sysfs operations before unregistering children

Zhi-Jun You <[email protected]>
net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986

Zhi-Jun You <[email protected]>
net: ethernet: mtk_wed: free up rings during detach

Zhi-Jun You <[email protected]>
net: ethernet: mtk_wed: fix reset condition for rx wdma

Zhi-Jun You <[email protected]>
net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3

Thomas Fourier <[email protected]>
btrfs: zoned: fix double free of bitmaps on clone failure

Filipe Manana <[email protected]>
btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing

Filipe Manana <[email protected]>
btrfs: fix fiemap merging compressed extents

guolingxing <[email protected]>
btrfs: verity: propagate orphan insertion errors when enabling verity

Jose Fernandez (Anthropic) <[email protected]>
bpf: Fix jited line info off by the CFI preamble

Avi Weiss <[email protected]>
gpio: omap: Propagate runtime PM failures in probe and request

Michal Wilczynski <[email protected]>
drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes

Andrea Mayer <[email protected]>
seg6: fix transport header for inner IPv4 with IP options

Filippo Falezza <[email protected]>
wifi: ath10k: Stop unanswered temperature reads

Yuanfu Xie <[email protected]>
9p: do not store the create fid on special files

Yuanfu Xie <[email protected]>
9p: fall back to the normal open path for non-regular files

Matthew Whitehead <[email protected]>
scsi: aha1542: Remove unneeded scsi_dma_unmap() call

Giuseppe Piscitelli <[email protected]>
scsi: scsi_debug: Drain target cleanup before module exit

Imre Kaloz <[email protected]>
scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts

Mehmet Fide <[email protected]>
wifi: ath9k_htc: start ANI when an AP interface begins to beacon

Deepanshu Kartikey <[email protected]>
batman-adv: avoid WARN_ON for orig_ifinfo allocation failure

Shubham Antil <[email protected]>
xfrm: zero-initialise km_event in the replay-notify path

Haobin Wu <[email protected]>
9p: skip intermediate directory entry name copy in p9dirent_read()

Yizhou Zhao <[email protected]>
net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx

Yizhou Zhao <[email protected]>
net/9p/usbg: fix descriptor cleanup use-after-free

Yizhou Zhao <[email protected]>

    9p: use fc->net_ns for network namespace in RDMA and socket transports

David Laight <[email protected]>
net/9p: Replace strlen() strcpy() pair with strscpy()

Eric Sandeen <[email protected]>
9p: convert to the new mount API

Eric Sandeen <[email protected]>
9p: create a v9fs_context structure to hold parsed options

Eric Sandeen <[email protected]>
net/9p: move structures and macros to header files

Eric Sandeen <[email protected]>
fs/fs_parse: add back fsparam_u32hex

Zijun Hu <[email protected]>
fs/fs_parse: Delete macro fsparam_u32hex()

Joshua Murphy <[email protected]>
net/9p/fd: support ipv6 for trans=tcp

Feng Ning <[email protected]>
staging: media: atomisp: use array3_size() for overflow-safe allocation

Dmitry Torokhov <[email protected]>
Input: destroy force-feedback device on input unregistration

Bernard Pidoux <[email protected]>
bpqether: keep a bpq device in step with its Ethernet device

Bernard Pidoux <[email protected]>
bpqether: set both addresses or none in SIOCSBPQETHADDR

Bernard Pidoux <[email protected]>
bpqether: reserve the Ethernet device's own header room on transmit

Mikhail Malyshev <[email protected]>
io_uring/io-wq: apply the current cpuset to new workers

Siddharth Chintamaneni <[email protected]>

    io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select()

Cheng Yongkang <[email protected]>
io_uring/rsrc: keep the old file when a file update fails

Cheng Yongkang <[email protected]>
io_uring/timeout: don't rearm a multishot timeout on cancel

Yang Xiuwei <[email protected]>
io_uring/rw: fail soft links on IOPOLL short or error IO

Yang Xiuwei <[email protected]>
io_uring/futex: fail soft links when cancelling a wait

Yang Xiuwei <[email protected]>
io_uring: fail soft links on negative IOU_COMPLETE results

Cinq Prairie <[email protected]>
io_uring/napi: don't end the single NAPI busy poll early on need_resched()

Jens Axboe <[email protected]>
io_uring: enable toggle of iowait usage when waiting on CQEs

Hui Peng <[email protected]>

    udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat()

Jan Kara <[email protected]>
udf: validate VAT inode size for old VAT format

Lance Yang <[email protected]>
mm/ksm: fix userfaultfd protection during merge and unmerge

Bernard Pidoux <[email protected]>
netrom: give the sysctl timer limits in milliseconds

Bernard Pidoux <[email protected]>
netrom: keep T1 running after answering a NAK

Bernard Pidoux <[email protected]>
ax25: end a REJ recovery count once frames are acknowledged

Bernard Pidoux <[email protected]>
rose: reset a call when a DATA packet arrives out of sequence

Bernard Pidoux <[email protected]>
ax25: drop a message being reassembled when a new one starts

Bernard Pidoux <[email protected]>
netrom: send the unacknowledged frames again when T1 or T4 expires

Sasha Levin <[email protected]>
Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts"

Long Li <[email protected]>
xfs: only assert new size for datafork during truncate extents

Gabriele Monaco <[email protected]>
sched/deadline: Fix server stopping with runnable tasks

Peter Zijlstra <[email protected]>
sched: Provide idle_rq() helper

Peter Zijlstra <[email protected]>
sched/deadline: Fix dl_server stop condition

Peter Zijlstra <[email protected]>
sched/deadline: Fix dl_server time accounting

KP Singh <[email protected]>
bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature

Zizhi Wo <[email protected]>
fs: aio: reject partial mremap to avoid Null-pointer-dereference error

Krittikun Wongnin <[email protected]>

    ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[]

Hakan Abay <[email protected]>
ACPI: PM: Add unused power resource quirk for Casper Excalibur G900

Matthias Dittrich <[email protected]>

    ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250)

Baokun Li <[email protected]>
writeback: use a per-sb counter to drain inode wb switches at umount

Jerome Marchand <[email protected]>
bpf: Specify access type of bpf_sysctl_get_name args

Shuran Liu <[email protected]>
bpf: Fix verifier assumptions of bpf_d_path's output buffer

Zesen Liu <[email protected]>
bpf: Fix memory access flags in helper prototypes

Johannes Weiner <[email protected]>
mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES

Pengpeng Hou <[email protected]>
irqchip/sifive-plic: Avoid signed shift in interrupt enable mask

Bas Nieuwenhuizen <[email protected]>
drm/amdgpu: Check cs flags.

Chris Mason <[email protected]>
mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs

Pablo Neira Ayuso <[email protected]>
netfilter: nft_ct: move custom expectation support to helper

Florian Westphal <[email protected]>
netfilter: nft_ct: expectation timeouts are passed in milliseconds

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

Diffstat:

 Documentation/admin-guide/kernel-parameters.txt    |   5 +
 Documentation/arch/arm64/silicon-errata.rst        |   4 +
 .../bindings/iio/adc/aspeed,ast2600-adc.yaml       |  17 +
 Documentation/filesystems/mount_api.rst            |   1 -
 Documentation/networking/rxrpc.rst                 |   8 +-
 Documentation/networking/tls-offload.rst           |  16 +-
 Documentation/trace/kprobes.rst                    |   2 +-
 Makefile                                           |   4 +-
 arch/arc/include/asm/cmpxchg.h                     |   4 +
 arch/arm64/Kconfig                                 |  32 ++
 .../dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts     |   1 +
 .../boot/dts/qcom/x1e80100-asus-vivobook-s15.dts   |   1 +
 arch/arm64/boot/dts/qcom/x1e80100-crd.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/ptrace.c                         |   8 +-
 arch/arm64/kernel/topology.c                       |   3 +-
 arch/arm64/mm/proc.S                               |   8 +
 arch/arm64/net/bpf_jit_comp.c                      |  32 +-
 arch/arm64/tools/cpucaps                           |   1 +
 arch/hexagon/include/asm/cmpxchg.h                 |   6 +
 arch/loongarch/power/hibernate.c                   |   6 +
 arch/mips/Kconfig                                  |   2 +-
 arch/mips/alchemy/common/prom.c                    |  23 +-
 arch/mips/configs/ip30_defconfig                   |   9 +-
 arch/mips/sibyte/sb1250/irq.c                      |   3 +
 arch/openrisc/include/asm/cmpxchg.h                |   2 +
 arch/powerpc/include/asm/interrupt.h               |   5 +-
 arch/powerpc/kernel/watchdog.c                     |   3 +
 arch/riscv/boot/dts/starfive/jh7100-common.dtsi    |  28 +-
 arch/riscv/boot/dts/starfive/jh7100.dtsi           |  67 ++-
 arch/riscv/boot/dts/starfive/jh7110-common.dtsi    |  32 +-
 arch/riscv/boot/dts/starfive/jh7110-milkv-mars.dts |  21 +
 .../boot/dts/starfive/jh7110-pine64-star64.dts     |  21 +
 .../dts/starfive/jh7110-starfive-visionfive-2.dtsi |  24 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi           |  67 ++-
 arch/x86/events/amd/uncore.c                       |   2 +-
 arch/x86/include/asm/cpuid.h                       |   1 +
 arch/x86/kernel/cpu/resctrl/rdtgroup.c             |   2 +-
 arch/x86/kernel/fpu/xstate.c                       |   8 +-
 arch/x86/kernel/ldt.c                              |  12 +-
 arch/x86/kvm/x86.c                                 |   4 +-
 block/blk-cgroup.c                                 |  13 +-
 block/blk-iocost.c                                 |   5 +-
 block/blk-iolatency.c                              |   3 +-
 block/blk-mq.c                                     |  18 +-
 block/blk-sysfs.c                                  |  24 +-
 block/blk-throttle.c                               |   3 +-
 block/genhd.c                                      |  30 +-
 block/partitions/efi.c                             |   1 +
 crypto/essiv.c                                     |   2 +-
 drivers/accel/ivpu/ivpu_pm.c                       |   9 +-
 drivers/acpi/acpi_pcc.c                            |  13 +
 drivers/acpi/apei/ghes.c                           |  41 ++
 drivers/acpi/glue.c                                | 132 +++--
 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                           |  25 +-
 drivers/block/virtio_blk.c                         |  69 ++-
 drivers/block/zram/zram_drv.c                      | 115 +++--
 drivers/bluetooth/btintel.c                        |  24 +-
 drivers/bluetooth/btmtk.c                          |  49 +-
 drivers/bluetooth/hci_qca.c                        |   5 +
 drivers/char/tpm/eventlog/acpi.c                   |   4 +-
 drivers/char/tpm/eventlog/tpm1.c                   |   7 +
 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                          |  21 +-
 drivers/cpufreq/intel_pstate.c                     |  14 +-
 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/hdm.c                             |  23 +-
 drivers/cxl/core/port.c                            |  20 +-
 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/firmware/cirrus/cs_dsp.c                   |   6 +
 drivers/gpio/gpio-brcmstb.c                        |   1 +
 drivers/gpio/gpio-mpc8xxx.c                        |  68 +--
 drivers/gpio/gpio-omap.c                           |  13 +-
 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                             |  11 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c             |   3 +
 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 +-
 drivers/gpu/drm/bridge/sii902x.c                   |   8 +-
 drivers/gpu/drm/drm_connector.c                    |   5 +-
 drivers/gpu/drm/i915/display/intel_psr.c           |  27 +-
 drivers/gpu/drm/imagination/pvr_rogue_fwif.h       |   2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c              |  49 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c              |  33 +-
 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            |  12 +
 drivers/gpu/drm/panthor/panthor_gpu.c              |  61 +--
 drivers/gpu/drm/xe/xe_pci.c                        |   3 +
 drivers/gpu/drm/xe/xe_vm.c                         |   9 +-
 drivers/hwmon/aht10.c                              |   2 +-
 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/adxl380.c                        |  11 +-
 drivers/iio/accel/kxsd9.c                          |   2 +-
 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/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         |   2 +
 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/proximity/sx9310.c                     |   2 +-
 drivers/iio/proximity/sx9324.c                     |  13 +-
 drivers/iio/temperature/mlx90614.c                 |   2 +-
 drivers/infiniband/core/rdma_core.c                |   2 +
 drivers/infiniband/hw/mlx5/fs.c                    |   3 +
 drivers/infiniband/hw/mlx5/main.c                  |  50 +-
 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/iommu/iommufd/device.c                     |   8 +-
 drivers/irqchip/irq-mst-intc.c                     |   3 +
 drivers/irqchip/irq-sifive-plic.c                  |   2 +-
 drivers/mailbox/arm_mhu_db.c                       |   1 -
 drivers/mailbox/qcom-ipcc.c                        |   5 +-
 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-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-zoned-reclaim.c                      |  18 +-
 drivers/md/dm.c                                    |  15 +-
 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/misc/bcm-vk/bcm_vk_sg.c                    |  43 +-
 drivers/misc/fastrpc.c                             | 198 +++----
 drivers/misc/ibmvmc.c                              |  16 +-
 drivers/misc/mei/vsc-tp.c                          |  15 +-
 drivers/misc/vmw_vmci/vmci_event.c                 |   7 +-
 drivers/mmc/host/meson-gx-mmc.c                    |  26 +-
 drivers/mmc/host/mmci.c                            |   4 +-
 drivers/mmc/host/sdhci-esdhc-imx.c                 |  17 +
 drivers/net/amt.c                                  |  61 +--
 drivers/net/bonding/bond_main.c                    |  24 +-
 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/dsa/mt7530.c                           |   6 +-
 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/bnxt/bnxt.c          |  51 +-
 drivers/net/ethernet/intel/i40e/i40e_xsk.c         |  13 +-
 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 +-
 .../mellanox/mlx5/core/en_accel/ipsec_fs.c         |  45 +-
 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/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 +-
 .../ethernet/mellanox/mlx5/core/lib/macsec_fs.c    |  41 +-
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |   1 +
 drivers/net/ethernet/meta/fbnic/fbnic_csr.h        |   4 +
 drivers/net/ethernet/meta/fbnic/fbnic_fw.c         |  16 +
 .../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       |  15 +-
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  11 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 121 +++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c    |  18 +-
 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/ipvlan/ipvlan_l3s.c                    |   6 +-
 drivers/net/macsec.c                               |  15 +-
 drivers/net/mctp/mctp-i3c.c                        |   3 +-
 drivers/net/phy/phy-c45.c                          |  46 +-
 drivers/net/ppp/ppp_generic.c                      |  95 +++-
 drivers/net/ppp/pppoe.c                            |   1 +
 drivers/net/team/team_core.c                       |  12 +-
 drivers/net/tun.c                                  |  12 +-
 drivers/net/usb/cdc_ncm.c                          |   4 +-
 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/ath11k/ahb.c              |   5 +-
 drivers/net/wireless/ath/ath12k/core.c             |   3 +-
 drivers/net/wireless/ath/ath12k/dp_tx.c            |   2 +-
 drivers/net/wireless/ath/ath12k/mac.c              |  12 +-
 drivers/net/wireless/ath/ath12k/mac.h              |   2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c      |   8 +-
 drivers/net/wireless/mediatek/mt76/mt7921/init.c   |  26 +-
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c    |   3 +
 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c    |   7 +-
 drivers/net/wireless/mediatek/mt76/mt7925/mac.c    |   3 +
 .../net/wireless/mediatek/mt76/mt7996/debugfs.c    | 296 +++++++----
 drivers/net/wireless/mediatek/mt76/mt7996/main.c   |   5 +
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c    |  46 +-
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.h    |  23 +
 drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h |   1 +
 drivers/net/wireless/mediatek/mt76/mt7996/regs.h   |  28 +
 drivers/net/wireless/realtek/rtl8xxxu/core.c       | 140 ++---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h   |   2 +-
 drivers/nvme/host/core.c                           |   4 +
 drivers/nvme/host/fc.c                             |   4 +-
 drivers/nvme/host/tcp.c                            |  57 +-
 drivers/nvme/target/fc.c                           |   6 +-
 drivers/nvme/target/rdma.c                         |  57 +-
 drivers/nvme/target/tcp.c                          |  39 +-
 drivers/pci/p2pdma.c                               |   8 +-
 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 294 ++++++-----
 drivers/phy/samsung/phy-exynos5-usbdrd.c           |  51 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c              |  12 +-
 drivers/power/sequencing/pwrseq-qcom-wcn.c         | 103 +++-
 drivers/power/supply/88pm860x_battery.c            |   4 +-
 drivers/power/supply/ab8500_btemp.c                |   2 +-
 drivers/power/supply/charger-manager.c             |   2 +-
 drivers/power/supply/da9030_battery.c              |   4 +-
 drivers/power/supply/max8925_power.c               |   2 +-
 drivers/power/supply/qcom_battmgr.c                |   2 +-
 drivers/power/supply/qcom_smbx.c                   |  13 +-
 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                           | 121 +++--
 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_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/s390/net/ism_drv.c                         |   3 +-
 drivers/scsi/aha1542.c                             |   2 -
 drivers/scsi/aic7xxx/aic7xxx_core.c                |   2 +-
 drivers/scsi/scsi_debug.c                          |  38 +-
 drivers/spi/spi-cadence-quadspi.c                  |   4 +-
 drivers/spi/spi-pic32-sqi.c                        |   3 +-
 drivers/spi/spi.c                                  |  40 +-
 .../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/tty/serial/8250/8250_lpss.c                |   3 +
 drivers/tty/serial/rda-uart.c                      |   2 +
 drivers/tty/serial/samsung_tty.c                   |   8 +-
 drivers/tty/serial/sh-sci.c                        |   8 +-
 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/vfio/pci/vfio_pci_intrs.c                  |   9 +-
 drivers/vhost/scsi.c                               |  42 +-
 drivers/vhost/test.c                               |   4 +
 drivers/vhost/vdpa.c                               |  95 +++-
 drivers/vhost/vhost.c                              |   3 +-
 drivers/virtio/virtio_balloon.c                    |   3 +-
 drivers/virtio/virtio_pci_common.c                 |   2 +-
 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/xen/gntdev.c                               |   8 +-
 drivers/xen/grant-table.c                          |  37 +-
 drivers/xen/privcmd.c                              |  15 +
 drivers/xen/pvcalls-back.c                         |  26 +-
 fs/9p/v9fs.c                                       | 572 +++++++++++----------
 fs/9p/v9fs.h                                       |   7 +-
 fs/9p/vfs_dir.c                                    |   6 +-
 fs/9p/vfs_inode.c                                  |  10 +
 fs/9p/vfs_inode_dotl.c                             |  36 +-
 fs/9p/vfs_super.c                                  | 130 +++--
 fs/adfs/dir_fplus.c                                |   2 +
 fs/afs/rxrpc.c                                     |   8 +-
 fs/aio.c                                           |   7 +-
 fs/backing-file.c                                  |   7 +-
 fs/btrfs/fiemap.c                                  |   3 +-
 fs/btrfs/scrub.c                                   |   8 +-
 fs/btrfs/verity.c                                  |   2 +-
 fs/btrfs/volumes.c                                 |  37 ++
 fs/btrfs/zoned.c                                   |  38 +-
 fs/ceph/addr.c                                     |  12 +
 fs/coda/file.c                                     |   3 +-
 fs/coredump.c                                      |   5 +
 fs/debugfs/file.c                                  |  81 +--
 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/fs-writeback.c                                  |  97 ++--
 fs/fuse/file.c                                     |   2 +-
 fs/inode.c                                         |   3 +-
 fs/isofs/util.c                                    |   8 +-
 fs/kernfs/dir.c                                    |  40 +-
 fs/libfs.c                                         |   2 +-
 fs/nfs/dir.c                                       |   4 +-
 fs/nfs/inode.c                                     |  11 +-
 fs/nfs/nfs4proc.c                                  |  24 +-
 fs/nfs/pnfs.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                              |  48 +-
 fs/overlayfs/super.c                               |  37 +-
 fs/overlayfs/util.c                                |  12 +
 fs/proc/base.c                                     |  10 +-
 fs/proc/proc_sysctl.c                              |   5 +-
 fs/read_write.c                                    |  14 +-
 fs/smb/client/cifsacl.c                            |   5 +-
 fs/smb/client/cifsfs.c                             |  13 +-
 fs/smb/client/cifsglob.h                           |   1 +
 fs/smb/client/cifsproto.h                          |   1 +
 fs/smb/client/cifssmb.c                            |  32 +-
 fs/smb/client/connect.c                            |   6 +-
 fs/smb/client/dfs.c                                |   2 +-
 fs/smb/client/file.c                               |  94 +++-
 fs/smb/client/sess.c                               |   4 +-
 fs/smb/client/smb2ops.c                            |   6 +-
 fs/smb/client/smb2pdu.c                            |  12 +-
 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/transport_tcp.c                      |   7 +-
 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_aops.c                                  |   2 +-
 fs/xfs/xfs_file.c                                  |   2 +-
 fs/xfs/xfs_inode.c                                 |   3 +-
 fs/xfs/xfs_iomap.c                                 |  20 +-
 fs/xfs/xfs_iomap.h                                 |   3 +-
 fs/xfs/xfs_pnfs.c                                  |   9 +-
 include/acpi/acpi_bus.h                            |   1 +
 include/linux/blk-mq.h                             |   3 +-
 include/linux/bpf.h                                |  14 +-
 include/linux/can/dev.h                            |   2 +-
 include/linux/can/skb.h                            |   4 +-
 include/linux/cpufreq.h                            |   5 -
 include/linux/fs.h                                 |   8 +
 include/linux/fs_parser.h                          |   2 +-
 include/linux/idr.h                                |  17 +
 include/linux/irqbypass.h                          |  35 +-
 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                     |   3 +
 include/linux/perf_event.h                         |   6 +-
 include/linux/ppp_channel.h                        |   1 +
 include/linux/sched.h                              |  16 +-
 include/linux/stat.h                               |   3 +
 include/linux/tcp.h                                |   3 +
 include/linux/uio.h                                |   8 +-
 include/media/rc-map.h                             |   2 -
 include/net/9p/client.h                            | 100 +++-
 include/net/9p/transport.h                         |   9 +-
 include/net/af_rxrpc.h                             |   5 +-
 include/net/bluetooth/hci_core.h                   |  15 +-
 include/net/dst_metadata.h                         |   2 +
 include/net/gro.h                                  |   8 +-
 include/net/gso.h                                  |   2 +-
 include/net/inet_connection_sock.h                 |   2 +
 include/net/netfilter/nf_conntrack_helper.h        |   1 +
 include/net/netfilter/nf_dup_netdev.h              |   2 +
 include/net/netfilter/nf_recursion.h               |  42 ++
 include/net/netns/netfilter.h                      |   1 +
 include/net/route.h                                |   7 +-
 include/net/rps.h                                  |  24 +
 include/net/sock.h                                 |  24 +-
 include/net/tcp.h                                  |   9 +
 include/net/tcp_ao.h                               |   3 +-
 include/net/xsk_buff_pool.h                        |   3 +
 include/sound/hda_codec.h                          |   6 +-
 include/trace/events/huge_memory.h                 |   6 +-
 include/trace/events/oom.h                         |   8 +-
 include/trace/events/rxrpc.h                       |   2 +-
 include/uapi/linux/io_uring.h                      |   2 +
 include/uapi/linux/mdio.h                          |  13 +-
 init/do_mounts_rd.c                                |   5 +
 io_uring/futex.c                                   |   1 +
 io_uring/io-wq.c                                   |  44 +-
 io_uring/io_uring.c                                |  39 +-
 io_uring/io_uring.h                                |   1 +
 io_uring/kbuf.c                                    |   1 +
 io_uring/napi.c                                    |  31 +-
 io_uring/rsrc.c                                    |  25 +-
 io_uring/rw.c                                      |   4 +-
 io_uring/timeout.c                                 |   3 +-
 kernel/bpf/arena.c                                 |  10 +-
 kernel/bpf/arraymap.c                              |   2 +-
 kernel/bpf/cgroup.c                                |  28 +-
 kernel/bpf/core.c                                  |  10 +-
 kernel/bpf/cpumap.c                                |  30 +-
 kernel/bpf/devmap.c                                |   1 +
 kernel/bpf/hashtab.c                               |  23 +-
 kernel/bpf/helpers.c                               |  11 +-
 kernel/bpf/stackmap.c                              | 102 ++--
 kernel/bpf/syscall.c                               |  19 +-
 kernel/bpf/trampoline.c                            |  19 +-
 kernel/bpf/verifier.c                              | 173 ++++++-
 kernel/cgroup/cpuset-internal.h                    |   5 +
 kernel/cgroup/cpuset.c                             |  27 +-
 kernel/dma/direct.c                                |  21 +-
 kernel/events/core.c                               | 215 ++++----
 kernel/locking/osq_lock.c                          |  62 ++-
 kernel/printk/internal.h                           |   2 +
 kernel/printk/nbcon.c                              |  26 +-
 kernel/printk/printk.c                             |  52 +-
 kernel/sched/deadline.c                            |  89 ++--
 kernel/sched/fair.c                                |   9 +-
 kernel/sched/idle.c                                |  16 +-
 kernel/sched/pelt.c                                |   2 +-
 kernel/sched/sched.h                               |  31 +-
 kernel/sched/syscalls.c                            |  42 +-
 kernel/sched/topology.c                            |  16 +-
 kernel/time/timekeeping.c                          |   8 +-
 kernel/trace/bpf_trace.c                           |  13 +-
 kernel/trace/trace_eprobe.c                        |  83 ++-
 kernel/trace/trace_fprobe.c                        |   8 +-
 kernel/trace/trace_kprobe.c                        |  11 +-
 kernel/trace/trace_probe.c                         |  12 +-
 kernel/trace/trace_probe_tmpl.h                    |  14 +-
 kernel/trace/trace_uprobe.c                        |   8 +-
 kernel/tsacct.c                                    |  10 +-
 lib/bootconfig.c                                   |   2 +-
 lib/iov_iter.c                                     |   6 +-
 lib/seq_buf.c                                      |   2 +-
 lib/test_sysctl.c                                  |   2 +-
 mm/gup.c                                           |  17 +-
 mm/internal.h                                      |  11 +-
 mm/khugepaged.c                                    |  14 +-
 mm/ksm.c                                           |   4 +
 mm/memory_hotplug.c                                |  44 +-
 mm/mempolicy.c                                     |   4 +-
 mm/page_alloc.c                                    |  44 +-
 net/9p/client.c                                    | 154 +-----
 net/9p/mod.c                                       |   2 +-
 net/9p/protocol.c                                  |  12 +-
 net/9p/trans_fd.c                                  | 194 ++-----
 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/hci_conn.c                           |  23 +-
 net/bluetooth/hci_core.c                           |  66 ++-
 net/bluetooth/hci_event.c                          |  68 ++-
 net/bluetooth/hci_sync.c                           | 122 ++++-
 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/netfilter/nf_conntrack_bridge.c         |   2 +-
 net/core/dev.c                                     |  12 +
 net/core/filter.c                                  | 143 ++++--
 net/core/gro.c                                     |  11 +-
 net/core/lwt_bpf.c                                 |  60 ++-
 net/core/netdev-genl.c                             |   6 +
 net/core/skbuff.c                                  |  18 +-
 net/core/sock_reuseport.c                          |  26 +-
 net/dccp/ipv4.c                                    |   3 -
 net/dccp/ipv6.c                                    |   9 +-
 net/ipv4/fib_trie.c                                |  14 +-
 net/ipv4/fou_core.c                                |  31 +-
 net/ipv4/igmp.c                                    |   2 +
 net/ipv4/inet_connection_sock.c                    |  93 ++--
 net/ipv4/inet_hashtables.c                         |  19 +-
 net/ipv4/inet_timewait_sock.c                      |   6 +-
 net/ipv4/ip_fragment.c                             |   4 +-
 net/ipv4/ip_input.c                                |   2 +-
 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/route.c                                   |  31 +-
 net/ipv4/syncookies.c                              |  12 +-
 net/ipv4/tcp.c                                     |   5 +-
 net/ipv4/tcp_fastopen.c                            |   2 +
 net/ipv4/tcp_input.c                               |  19 +-
 net/ipv4/tcp_ipv4.c                                |  27 +-
 net/ipv4/tcp_metrics.c                             |   3 +-
 net/ipv4/tcp_minisocks.c                           |   2 +-
 net/ipv4/udp.c                                     |   7 +-
 net/ipv4/udp_offload.c                             |   9 +-
 net/ipv4/xfrm4_input.c                             |   2 +-
 net/ipv4/xfrm4_protocol.c                          |   2 +-
 net/ipv6/calipso.c                                 |  12 +-
 net/ipv6/exthdrs.c                                 |   5 +-
 net/ipv6/exthdrs_core.c                            |   7 +-
 net/ipv6/icmp.c                                    |   7 +-
 net/ipv6/ip6_fib.c                                 |  50 +-
 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/route.c                                   |  16 +-
 net/ipv6/seg6_iptunnel.c                           |  46 +-
 net/ipv6/seg6_local.c                              | 124 ++++-
 net/ipv6/sit.c                                     |   2 +-
 net/ipv6/tcp_ipv6.c                                |  17 +-
 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                         |   4 +-
 net/mac80211/link.c                                |  13 +-
 net/mac80211/mlme.c                                |  12 +-
 net/mac80211/ocb.c                                 |  23 +-
 net/mac80211/rate.c                                |   1 -
 net/mac80211/rx.c                                  |   7 +-
 net/mac80211/s1g.c                                 |   8 -
 net/mac80211/tx.c                                  |   6 +
 net/mctp/af_mctp.c                                 |   2 +-
 net/mptcp/options.c                                |  12 +-
 net/netfilter/core.c                               |  17 +-
 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                      |  18 +-
 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_tables_api.c                      |  21 +-
 net/netfilter/nf_tables_offload.c                  |   3 +
 net/netfilter/nfnetlink_hook.c                     |  20 +-
 net/netfilter/nft_ct.c                             | 119 ++++-
 net/netfilter/nft_fwd_netdev.c                     |  28 +-
 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/rxrpc/rxperf.c                                 |  32 +-
 net/rxrpc/sendmsg.c                                |  44 +-
 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                                  |   4 +-
 net/sctp/stream.c                                  |   2 +
 net/sctp/stream_interleave.c                       |  38 +-
 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 +-
 net/smc/smc_sysctl.c                               |   6 +-
 net/socket.c                                       |  11 +-
 net/sunrpc/clnt.c                                  |   6 +-
 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/garbage.c                                 |   3 -
 net/vmw_vsock/af_vsock.c                           |   3 +-
 net/vmw_vsock/virtio_transport.c                   |  16 +-
 net/wireless/nl80211.c                             |   9 +-
 net/wireless/scan.c                                |   3 +-
 net/wireless/util.c                                |   6 +-
 net/xdp/xsk.c                                      |   5 +
 net/xdp/xsk_buff_pool.c                            |  43 +-
 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                              |  23 +-
 sound/drivers/pcmtest.c                            |  66 +--
 sound/hda/hdac_controller.c                        |  10 +-
 sound/pci/Kconfig                                  |   1 +
 sound/pci/hda/cs35l56_hda.c                        |   2 +
 sound/pci/hda/hda_codec.c                          |   1 -
 sound/pci/hda/hda_jack.c                           |  79 +--
 sound/pci/hda/hda_jack.h                           |   1 +
 sound/pci/hda/patch_realtek.c                      |  52 +-
 sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c      |  16 +-
 sound/soc/codecs/aw88399.c                         |  13 +
 sound/soc/codecs/aw88399.h                         |   5 +
 sound/soc/codecs/max98090.c                        |  22 +-
 sound/soc/codecs/rt1015.c                          |  81 ++-
 sound/soc/codecs/rt5645.c                          |   7 +-
 sound/soc/codecs/sta32x.c                          | 101 +++-
 sound/soc/codecs/wcd939x.c                         |  10 +-
 sound/soc/codecs/wcd939x.h                         |   1 -
 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/soc-core.c                               |  16 +
 sound/soc/sof/amd/Kconfig                          |   6 +-
 sound/soc/sof/amd/acp-dsp-offset.h                 |  10 +
 sound/soc/sof/amd/acp.c                            | 141 ++++-
 sound/soc/sof/amd/acp.h                            |   5 +
 sound/soc/sof/amd/pci-acp70.c                      |   7 +-
 sound/soc/sof/intel/hda-codec.c                    |   4 +-
 sound/soc/sof/ipc4-topology.c                      |   2 +-
 sound/usb/caiaq/device.c                           |  11 +-
 sound/usb/misc/ua101.c                             |  29 +-
 sound/usb/mixer.c                                  |  23 +
 sound/usb/mixer.h                                  |   2 +
 sound/usb/pcm.c                                    |   6 +
 tools/include/nolibc/types.h                       |   6 +-
 tools/perf/builtin-lock.c                          |  61 ++-
 tools/perf/tests/pe-file-parsing.c                 |   2 +-
 tools/perf/util/disasm.c                           |   4 +-
 tools/perf/util/evlist.c                           |   6 +-
 tools/perf/util/evsel.c                            |  61 ++-
 tools/perf/util/evsel.h                            |   1 +
 tools/perf/util/symbol.c                           |   9 +-
 tools/testing/cxl/test/cxl.c                       |   6 +-
 .../selftests/bpf/prog_tests/kfunc_dynptr_param.c  |   2 +-
 tools/testing/selftests/cgroup/test_cpuset_prs.sh  |   1 +
 .../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 +-
 .../tcp_bidir_fast_retransmit_nosack.pkt           |  42 ++
 tools/testing/selftests/proc/proc-pid-vm.c         |   2 -
 tools/testing/shared/linux/cleanup.h               |   2 +
 virt/kvm/eventfd.c                                 |   7 +-
 virt/lib/irqbypass.c                               |  44 +-
 731 files changed, 10854 insertions(+), 5123 deletions(-)
author maintainer
#1 lore raw

PATCH 1/816 netfilter: nft_ct: expectation timeouts are passed in milliseconds

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

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

From: Florian Westphal <[email protected]>

[ 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")

Stable-dep-of: 3679da4ad8be ("netfilter: nft_ct: move custom expectation support to helper")

---
 net/netfilter/nft_ct.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
net/netfilter/nft_ct.c +18 -3
index 07a879f66fabe..206cfa2734c68 100644
@@ -1198,11 +1198,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] ||
@@ -1238,8 +1250,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);
@@ -1259,7 +1274,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;
 
@@ -1309,7 +1324,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;
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH 2/816 netfilter: nft_ct: move custom expectation support to helper

In reply to Greg Kroah-Hartman

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

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

From: Pablo Neira Ayuso <[email protected]>

[ 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")

[ - 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 ]

---
 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(-)
include/net/netfilter/nf_conntrack_helper.h +1 -0
index 24cf3d2d97450..5b76fa57fd76c 100644
@@ -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 *,
net/netfilter/nf_conntrack_helper.c +13 -7
index 2cef826e20fb9..17538e3382dd1 100644
@@ -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);
 
net/netfilter/nft_ct.c +75 -25

149 lines not on this page · raw message

Signature · 1 line
2.53.0
Tested-by on the v1 series
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 4 lines · On Wed, 25 Nov 2026 15:25:48 +0100 Greg Kroah-Hartman…

This is the start of the stable review cycle for the 6.12.120 release. There are 816 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.

[1] https://github.com/damonitor/damon-tests/tree/next/corr

Thanks,
SJ

[...]

author maintainer
#4 lore raw

PATCH 3/816 mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs

In reply to Greg Kroah-Hartman

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

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

From: Chris Mason <[email protected]>

[ Upstream commit fe2817e3d5ea347214342c9a5cd8bcbff20c0574 ]

try_collapse_pte_mapped_thp() clears PTEs without transferring their dirty bits to the folio. A shmem read fault can map a clean folio writable, so a later store only dirties the PTE. Losing that dirty bit allows reclaim to discard modified data.

The assumption that regular files are read-only is also obsolete since commit 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse for writable files"). In any case, transferring PTE dirty bits to the folio when removing mappings (and while the folio is still mapped) is the right thing to do.

Use get_and_clear_ptes() to collect the dirty bits and mark the folio dirty before unmapping it. Update the comment.

This was reproduced with shmem using MADV_COLLAPSE followed by MADV_PAGEOUT.

Fix generated by an LLM and sent by Chris Mason in private.

Fixes 27e1f8273113 ("khugepaged: enable collapse pmd for pte-mapped THP")
Fixes 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse for writable files")
[ david: adjust comment; simplify description; cover file-thp as well ]
[ sashal: Adapted batched get_and_clear_ptes() handling to the existing single-PTE loop using ptep_get_and_clear(). ]
---
 mm/khugepaged.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/khugepaged.c +3 -2
index 9b8021d440289..ea94f66cd0377 100644
@@ -1636,9 +1636,10 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr,
 		/*
 		 * Must clear entry, or a racing truncate may re-remove it.
 		 * TLB flush can be left until pmdp_collapse_flush() does it.
-		 * PTE dirty? Shmem page is already dirty; file is read-only.
 		 */
-		ptep_clear(mm, addr, pte);
+		ptent = ptep_get_and_clear(mm, addr, pte);
+		if (pte_dirty(ptent))
+			folio_mark_dirty(folio);
 		folio_remove_rmap_pte(folio, page, vma);
 		nr_ptes++;
 	}
Signature · 1 line
2.53.0
author maintainer
#5 lore raw

PATCH 4/816 drm/amdgpu: Check cs flags.

In reply to Greg Kroah-Hartman

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

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

From: Bas Nieuwenhuizen <[email protected]>

[ Upstream commit f5ea64f9fcd921bc4e2307a262e19450b8a58524 ]

Had no validation before. libdrm_amdgpu memsets this, even for the raw/raw2 functions.

We have a lot of functions touching the ioctl struct, no strong opinion on where this is placed, but I thought early would be good.

(cherry picked from commit 4d01e15e76358f60ef6734462d2b6d9972b9dfbc)
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
index 364fbaf4e0fa5..4ad34def4cd13 100644
@@ -209,6 +209,9 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
 	int ret;
 	int i;
 
+	if (cs->in.flags)
+		return -EINVAL;
+
 	chunk_array = memdup_array_user(u64_to_user_ptr(cs->in.chunks),
 					cs->in.num_chunks,
 					sizeof(uint64_t));
Signature · 1 line
2.53.0
author maintainer
#6 lore raw

PATCH 5/816 irqchip/sifive-plic: Avoid signed shift in interrupt enable mask

In reply to Greg Kroah-Hartman

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

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

From: Pengpeng Hou <[email protected]>

[ 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")
Assisted-by gpt 5
[ sashal: Context lines were rebased onto this tree's older __plic_toggle() (direct read-modify-write via reg), and only the 1 << (hwirq % 32) to BIT(hwirq % 32) change was applied. ]
---
 drivers/irqchip/irq-sifive-plic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-sifive-plic.c +1 -1
index d57e9b25d0b4d..b061062f47c58 100644
@@ -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);
Signature · 1 line
2.53.0
author maintainer
#7 lore raw

PATCH 6/816 mm: page_alloc: remove ALLOC_NON_BLOCK from ALLOC_RESERVES

In reply to Greg Kroah-Hartman

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

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

From: Johannes Weiner <[email protected]>

[ 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.

Fixes 1ebbb21811b7 ("mm/page_alloc: explicitly define how __GFP_HIGH non-blocking allocations accesses reserves")
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Salvatore Dipietro <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Dave Chinner <[email protected]>
Cc Matt Fleming <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Brendan Jackman <[email protected]>
Cc Zi Yan <[email protected]>
[ sashal: adjusted the hunk to edit ALLOC_* flags in mm/internal.h instead of mm/page_alloc.h, with context changed since ALLOC_NO_CODETAG is absent ]
---
 mm/internal.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
mm/internal.h +5 -6
index ba332da196e43..41a0b79fd71d3 100644
@@ -1209,12 +1209,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 */
@@ -1227,7 +1226,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)
Signature · 1 line
2.53.0
author maintainer
#8 lore raw

PATCH 7/816 bpf: Fix memory access flags in helper prototypes

In reply to Greg Kroah-Hartman

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

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

From: Zesen Liu <[email protected]>

[ Upstream commit 802eef5afb1865bc5536a5302c068ba2215a1f72 ]

After commit 37cce22dbd51 ("bpf: verifier: Refactor helper access type tracking"), the verifier started relying on the access type flags in helper function prototypes to perform memory access optimizations.

Currently, several helper functions utilizing ARG_PTR_TO_MEM lack the corresponding MEM_RDONLY or MEM_WRITE flags. This omission causes the verifier to incorrectly assume that the buffer contents are unchanged across the helper call. Consequently, the verifier may optimize away subsequent reads based on this wrong assumption, leading to correctness issues.

For bpf_get_stack_proto_raw_tp, the original MEM_RDONLY was incorrect since the helper writes to the buffer. Change it to ARG_PTR_TO_UNINIT_MEM which correctly indicates write access to potentially uninitialized memory.

Similar issues were recently addressed for specific helpers in commit ac44dcc788b9 ("bpf: Fix verifier assumptions of bpf_d_path's output buffer") and commit 2eb7648558a7 ("bpf: Specify access type of bpf_sysctl_get_name args").

Fix these prototypes by adding the correct memory access flags.

---
 kernel/bpf/helpers.c     |    2 +-
 kernel/bpf/syscall.c     |    2 +-
 kernel/trace/bpf_trace.c |    6 +++---
 net/core/filter.c        |   20 ++++++++++----------
 4 files changed, 15 insertions(+), 15 deletions(-)
kernel/bpf/helpers.c +1 -1
@@ -1090,7 +1090,7 @@ const struct bpf_func_proto bpf_snprintf
 	.func		= bpf_snprintf,
 	.gpl_only	= true,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_MEM_OR_NULL,
+	.arg1_type	= ARG_PTR_TO_MEM_OR_NULL | MEM_WRITE,
 	.arg2_type	= ARG_CONST_SIZE_OR_ZERO,
 	.arg3_type	= ARG_PTR_TO_CONST_STR,
 	.arg4_type	= ARG_PTR_TO_MEM | PTR_MAYBE_NULL | MEM_RDONLY,
kernel/bpf/syscall.c +1 -1
@@ -6073,7 +6073,7 @@ static const struct bpf_func_proto bpf_k
 	.func		= bpf_kallsyms_lookup_name,
 	.gpl_only	= false,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_MEM,
+	.arg1_type	= ARG_PTR_TO_MEM | MEM_RDONLY,
 	.arg2_type	= ARG_CONST_SIZE_OR_ZERO,
 	.arg3_type	= ARG_ANYTHING,
 	.arg4_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED,
kernel/trace/bpf_trace.c +3 -3
@@ -1030,7 +1030,7 @@ const struct bpf_func_proto bpf_snprintf
 	.func		= bpf_snprintf_btf,
 	.gpl_only	= false,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_MEM,
+	.arg1_type	= ARG_PTR_TO_MEM | MEM_WRITE,
 	.arg2_type	= ARG_CONST_SIZE,
 	.arg3_type	= ARG_PTR_TO_MEM | MEM_RDONLY,
 	.arg4_type	= ARG_CONST_SIZE,
@@ -1808,7 +1808,7 @@ static const struct bpf_func_proto bpf_r
 	.gpl_only       = true,
 	.ret_type       = RET_INTEGER,
 	.arg1_type      = ARG_PTR_TO_CTX,
-	.arg2_type      = ARG_PTR_TO_MEM_OR_NULL,
+	.arg2_type      = ARG_PTR_TO_MEM_OR_NULL | MEM_WRITE,
 	.arg3_type      = ARG_CONST_SIZE_OR_ZERO,
 	.arg4_type      = ARG_ANYTHING,
 };
@@ -1943,7 +1943,7 @@ static const struct bpf_func_proto bpf_g
 	.gpl_only	= true,
 	.ret_type	= RET_INTEGER,
 	.arg1_type	= ARG_PTR_TO_CTX,
-	.arg2_type	= ARG_PTR_TO_MEM | MEM_RDONLY,
+	.arg2_type	= ARG_PTR_TO_UNINIT_MEM,
 	.arg3_type	= ARG_CONST_SIZE_OR_ZERO,
 	.arg4_type	= ARG_ANYTHING,
 };
net/core/filter.c +10 -10
@@ -6334,7 +6334,7 @@ static const struct bpf_func_proto bpf_x
 	.gpl_only	= true,
 	.ret_type	= RET_INTEGER,
 	.arg1_type      = ARG_PTR_TO_CTX,
-	.arg2_type      = ARG_PTR_TO_MEM,
+	.arg2_type      = ARG_PTR_TO_MEM | MEM_WRITE,
 	.arg3_type      = ARG_CONST_SIZE,
 	.arg4_type	= ARG_ANYTHING,
 };
@@ -6389,7 +6389,7 @@ static const struct bpf_func_proto bpf_s
 	.gpl_only	= true,
 	.ret_type	= RET_INTEGER,
 	.arg1_type      = ARG_PTR_TO_CTX,
-	.arg2_type      = ARG_PTR_TO_MEM,
+	.arg2_type      = ARG_PTR_TO_MEM | MEM_WRITE,
 	.arg3_type      = ARG_CONST_SIZE,
 	.arg4_type	= ARG_ANYTHING,
 };
@@ -7948,9 +7948,9 @@ static const struct bpf_func_proto bpf_t
 	.gpl_only	= true, /* __cookie_v4_init_sequence() is GPL */
 	.pkt_access	= true,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM,
+	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_RDONLY,
 	.arg1_size	= sizeof(struct iphdr),
-	.arg2_type	= ARG_PTR_TO_MEM,
+	.arg2_type	= ARG_PTR_TO_MEM | MEM_RDONLY,
 	.arg3_type	= ARG_CONST_SIZE_OR_ZERO,
 };
 
@@ -7980,9 +7980,9 @@ static const struct bpf_func_proto bpf_t
 	.gpl_only	= true, /* __cookie_v6_init_sequence() is GPL */
 	.pkt_access	= true,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM,
+	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_RDONLY,
 	.arg1_size	= sizeof(struct ipv6hdr),
-	.arg2_type	= ARG_PTR_TO_MEM,
+	.arg2_type	= ARG_PTR_TO_MEM | MEM_RDONLY,
 	.arg3_type	= ARG_CONST_SIZE_OR_ZERO,
 };
 
@@ -8000,9 +8000,9 @@ static const struct bpf_func_proto bpf_t
 	.gpl_only	= true, /* __cookie_v4_check is GPL */
 	.pkt_access	= true,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM,
+	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_RDONLY,
 	.arg1_size	= sizeof(struct iphdr),
-	.arg2_type	= ARG_PTR_TO_FIXED_SIZE_MEM,
+	.arg2_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_RDONLY,
 	.arg2_size	= sizeof(struct tcphdr),
 };
 
@@ -8024,9 +8024,9 @@ static const struct bpf_func_proto bpf_t
 	.gpl_only	= true, /* __cookie_v6_check is GPL */
 	.pkt_access	= true,
 	.ret_type	= RET_INTEGER,
-	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM,
+	.arg1_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_RDONLY,
 	.arg1_size	= sizeof(struct ipv6hdr),
-	.arg2_type	= ARG_PTR_TO_FIXED_SIZE_MEM,
+	.arg2_type	= ARG_PTR_TO_FIXED_SIZE_MEM | MEM_RDONLY,
 	.arg2_size	= sizeof(struct tcphdr),
 };
 #endif /* CONFIG_SYN_COOKIES */
author maintainer
#9 lore raw

PATCH 8/816 bpf: Fix verifier assumptions of bpf_d_paths output buffer

In reply to Greg Kroah-Hartman

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

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

From: Shuran Liu <[email protected]>

[ Upstream commit ac44dcc788b950606793e8f9690c30925f59df02 ]

Commit 37cce22dbd51 ("bpf: verifier: Refactor helper access type tracking") started distinguishing read vs write accesses performed by helpers.

The second argument of bpf_d_path() is a pointer to a buffer that the helper fills with the resulting path. However, its prototype currently uses ARG_PTR_TO_MEM without MEM_WRITE.

Before 37cce22dbd51, helper accesses were conservatively treated as potential writes, so this mismatch did not cause issues. Since that commit, the verifier may incorrectly assume that the buffer contents are unchanged across the helper call and base its optimizations on this wrong assumption. This can lead to misbehaviour in BPF programs that read back the buffer, such as prefix comparisons on the returned path.

Fix this by marking the second argument of bpf_d_path() as ARG_PTR_TO_MEM | MEM_WRITE so that the verifier correctly models the write to the caller-provided buffer.

---
 kernel/trace/bpf_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/bpf_trace.c +1 -1
index 2fe05b3d84000..1d6709e261b8c 100644
@@ -973,7 +973,7 @@ static const struct bpf_func_proto bpf_d_path_proto = {
 	.ret_type	= RET_INTEGER,
 	.arg1_type	= ARG_PTR_TO_BTF_ID,
 	.arg1_btf_id	= &bpf_d_path_btf_ids[0],
-	.arg2_type	= ARG_PTR_TO_MEM,
+	.arg2_type	= ARG_PTR_TO_MEM | MEM_WRITE,
 	.arg3_type	= ARG_CONST_SIZE_OR_ZERO,
 	.allowed	= bpf_d_path_allowed,
 };
Signature · 1 line
2.53.0
author maintainer
#10 lore raw

PATCH 9/816 bpf: Specify access type of bpf_sysctl_get_name args

In reply to Greg Kroah-Hartman

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

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

From: Jerome Marchand <[email protected]>

[ Upstream commit 2eb7648558a7911f2208e8940cd22ca40e93cc76 ]

The second argument of bpf_sysctl_get_name() helper is a pointer to a buffer that is being written to. However that isn't specify in the prototype.

Until commit 37cce22dbd51a ("bpf: verifier: Refactor helper access type tracking"), all helper accesses were considered as a possible write access by the verifier, so no big harm was done. However, since then, the verifier might make wrong asssumption about the content of that address which might lead it to make faulty optimizations (such as removing code that was wrongly labeled dead). This is what happens in test_sysctl selftest to the tests related to sysctl_get_name.

Add MEM_WRITE flag the second argument of bpf_sysctl_get_name().

---
 kernel/bpf/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/cgroup.c +1 -1
index 0674785e86767..bd47c4cb19910 100644
@@ -2284,7 +2284,7 @@ static const struct bpf_func_proto bpf_sysctl_get_name_proto = {
 	.gpl_only	= false,
 	.ret_type	= RET_INTEGER,
 	.arg1_type	= ARG_PTR_TO_CTX,
-	.arg2_type	= ARG_PTR_TO_MEM,
+	.arg2_type	= ARG_PTR_TO_MEM | MEM_WRITE,
 	.arg3_type	= ARG_CONST_SIZE,
 	.arg4_type	= ARG_ANYTHING,
 };
Signature · 1 line
2.53.0
author maintainer
#11 lore raw

PATCH 10/816 writeback: use a per-sb counter to drain inode wb switches at umount

In reply to Greg Kroah-Hartman

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

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

From: Baokun Li <[email protected]>

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)

[ ehagberg: Backported to 6.12.y. struct super_block lives in
include/linux/fs.h here, so add the field there. 6.12.y predates the inode_state_read()/inode_state_set() accessors and the trace_inode_switch_wbs_queue() tracepoint, 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. ]

---
 fs/fs-writeback.c  | 97 ++++++++++++++++++++++------------------------
 include/linux/fs.h |  8 ++++
 2 files changed, 55 insertions(+), 50 deletions(-)
fs/fs-writeback.c +47 -50
index c195c97717396..eb7f3a525e39b 100644
@@ -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;
 
@@ -679,11 +700,9 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)
 	isw->inodes[0] = inode;
 
 	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);
@@ -764,14 +783,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
@@ -790,7 +801,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);
@@ -798,7 +808,6 @@ bool cleanup_offline_cgwb(struct bdi_writeback *wb)
 	}
 
 	wb_queue_isw(new_wb, isw);
-	rcu_read_unlock();
 
 	return restart;
 }
@@ -1208,39 +1217,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)
include/linux/fs.h +8 -0
index 67b57ce46b203..fc63611ac3c6c 100644
@@ -1443,6 +1443,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)
Signature · 1 line
2.53.0
author maintainer
#12 lore raw

PATCH 11/816 ACPI: PM: Add quirk for Acer Swift 3 SF314-56G (MX250)

In reply to Greg Kroah-Hartman

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

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

From: Matthias Dittrich <[email protected]>

[ 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.

---
 drivers/acpi/power.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/acpi/power.c +13 -0
index 9f9f580e393c7..754c3936db099 100644
@@ -1047,6 +1047,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"),
+		}
+
 	},
 	{}
 };
Signature · 1 line
2.53.0
author maintainer
#13 lore raw

PATCH 12/816 ACPI: PM: Add unused power resource quirk for Casper Excalibur G900

In reply to Greg Kroah-Hartman

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

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

From: Hakan Abay <[email protected]>

[ 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.

---
 drivers/acpi/power.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/acpi/power.c +12 -0
index 754c3936db099..aaa07997fdf31 100644
@@ -1061,6 +1061,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"),
+		},
+	},
 	{}
 };
 
Signature · 1 line
2.53.0
author maintainer
#14 lore raw

PATCH 13/816 ACPI: PM: Add Acer Aspire A515-53G to dmi_leave_unused_power_resources_on[]

In reply to Greg Kroah-Hartman

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

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

From: Krittikun Wongnin <[email protected]>

[ 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.

---
 drivers/acpi/power.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/acpi/power.c +13 -0
index aaa07997fdf31..d2c3ec958e4aa 100644
@@ -1073,6 +1073,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"),
+		},
+	},
 	{}
 };
 
Signature · 1 line
2.53.0
author maintainer
#15 lore raw

PATCH 14/816 fs: aio: reject partial mremap to avoid Null-pointer-dereference error

In reply to Greg Kroah-Hartman

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

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

From: Zizhi Wo <[email protected]>

[ 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/[email protected]/

---
 fs/aio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/aio.c +2 -1
index 44447e4af6286..eac137a3a2b30 100644
@@ -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;
 			}
Signature · 1 line
2.53.0
author maintainer
#16 lore raw

PATCH 15/816 bpf: Reject NULL data/sig in bpf_verify_pkcs7_signature

In reply to Greg Kroah-Hartman

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

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

From: KP Singh <[email protected]>

[ 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.

[ In 6.12.y, bpf_verify_pkcs7_signature() lives in kernel/trace/bpf_trace.c
instead of kernel/bpf/helpers.c. Adapt to kernel/trace/bpf_trace.c. ]

---
 kernel/trace/bpf_trace.c                                    | 5 +++++
 tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
kernel/trace/bpf_trace.c +5 -0
index 1d6709e261b8c..a174d4b27d662 100644
@@ -1408,8 +1408,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,
tools/testing/selftests/bpf/prog_tests/kfunc_dynptr_param.c +1 -1
index 8cd298b78e44a..04aaf4c9cf5ee 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#17 lore raw

PATCH 16/816 sched/deadline: Fix dl_server time accounting

In reply to Greg Kroah-Hartman

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

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

From: Peter Zijlstra <[email protected]>

commit e636ffb9e31b4f7dde7fef5358669266b9ce02ec upstream.

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.

---
 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(-)
kernel/sched/deadline.c +15 -25
index f5c64d1a019d5..2e3bd43afd535 100644
@@ -1216,8 +1216,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->curr->sched_class->update_curr(rq);
 
 		if (dl_se->dl_defer_armed) {
 			/*
@@ -1594,35 +1598,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);
 }
 
@@ -1849,6 +1834,11 @@ void dl_server_start(struct sched_dl_entity *dl_se)
 	if (!dl_se->dl_runtime || dl_se->dl_server_active)
 		return;
 
+	/*
+	 * Update the current task to 'now'.
+	 */
+	rq->curr->sched_class->update_curr(rq);
+
 	if (WARN_ON_ONCE(!cpu_online(cpu_of(rq))))
 		return;
 
kernel/sched/fair.c +2 -7
index 020a39fe0e7b3..7e5179189660b 100644
@@ -1259,8 +1259,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);
@@ -7114,12 +7113,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
 			goto enqueue_throttle;
 	}
 
-	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);
kernel/sched/idle.c +15 -1
index 1f0f0d9a5a5cf..a2ab252e7d53e 100644
@@ -471,9 +471,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);
 }
 
@@ -521,6 +523,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 switched_to_idle(struct rq *rq, struct task_struct *p)
@@ -536,6 +539,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);
 }
 
 /*
kernel/sched/sched.h +1 -2
index 5e788dc39f630..598dd26fe5a69 100644
@@ -411,14 +411,13 @@ 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);
 extern void dl_server_init(struct sched_dl_entity *dl_se, struct rq *rq,
 		    dl_server_pick_f pick_task);
 
-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,
Signature · 1 line
2.53.0
author maintainer
#18 lore raw

PATCH 17/816 sched/deadline: Fix dl_server stop condition

In reply to Greg Kroah-Hartman

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

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

From: Peter Zijlstra <[email protected]>

commit f5a538c07df26f5c601e41f7b9c7ade3e1e75803 upstream.

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.

---
 include/linux/sched.h   | 15 +++++++++------
 kernel/sched/deadline.c | 40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 47 insertions(+), 8 deletions(-)
include/linux/sched.h +9 -6
index 1c584a1f0b835..7f0fb62df348e 100644
@@ -650,20 +650,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;
@@ -674,6 +676,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
kernel/sched/deadline.c +38 -2
index 2e3bd43afd535..ea64ab4364f77 100644
@@ -1223,6 +1223,11 @@ static enum hrtimer_restart dl_server_timer(struct hrtimer *timer, struct sched_
 		 */
 		rq->curr->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.
@@ -1473,10 +1478,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)) {
@@ -1497,6 +1503,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).
@@ -1506,6 +1515,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
@@ -1518,6 +1550,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
@@ -1857,6 +1892,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;
 }
 
Signature · 1 line
2.53.0
author maintainer
#19 lore raw

PATCH 18/816 sched: Provide idle_rq() helper

In reply to Greg Kroah-Hartman

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

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

From: Peter Zijlstra <[email protected]>

commit 1e0a2ba7afb1b60f02599093d84b72ce62ad11c0 upstream.

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.

[ Florent: rq->ttwu_pending only exists with CONFIG_SMP in 6.12 ]
---
 include/linux/sched.h   |  1 -
 kernel/sched/sched.h    | 28 ++++++++++++++++++++++++++++
 kernel/sched/syscalls.c | 32 +-------------------------------
 3 files changed, 29 insertions(+), 32 deletions(-)
include/linux/sched.h +0 -1
index 7f0fb62df348e..efee6139c6af6 100644
@@ -1895,7 +1895,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);
kernel/sched/sched.h +28 -0
index 598dd26fe5a69..27de9290235e7 100644
@@ -1390,6 +1390,34 @@ 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)
+{
+	if (rq->curr != rq->idle || rq->nr_running)
+		return false;
+#ifdef CONFIG_SMP
+	if (rq->ttwu_pending)
+		return false;
+#endif
+	return true;
+}
+
+/**
+ * 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_CORE
 static inline struct cpumask *sched_group_span(struct sched_group *sg);
 
kernel/sched/syscalls.c +1 -31
index b51b39a109e01..f31fcdcfe6734 100644
@@ -201,37 +201,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;
-
-#ifdef CONFIG_SMP
-	if (rq->ttwu_pending)
-		return 0;
-#endif
-
-	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));
 }
 
 /**
Signature · 1 line
2.53.0
author maintainer
#20 lore raw

PATCH 19/816 sched/deadline: Fix server stopping with runnable tasks

In reply to Greg Kroah-Hartman

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

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

From: Gabriele Monaco <[email protected]>

commit ca1e8eede4fc68ce85a9fdce1a6c13ad64933318 upstream.

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")

[ Florent: context conflict in dl_server_start(), which still
initializes the fair server in 6.12 ]

---
 kernel/sched/deadline.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/sched/deadline.c +9 -4
index ea64ab4364f77..2da68de709135 100644
@@ -1482,7 +1482,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)) {
@@ -1663,8 +1663,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 | -+
@@ -1709,8 +1709,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)
@@ -1825,6 +1828,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"]
@@ -1850,6 +1854,7 @@ void dl_server_start(struct sched_dl_entity *dl_se)
 {
 	struct rq *rq = dl_se->rq;
 
+	dl_se->dl_defer_idle = 0;
 	/*
 	 * XXX: the apply do not work fine at the init phase for the
 	 * fair server because things are not yet set. We need to improve
Signature · 1 line
2.53.0
author maintainer
#21 lore raw

PATCH 20/816 xfs: only assert new size for datafork during truncate extents

In reply to Greg Kroah-Hartman

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

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

From: Long Li <[email protected]>

[ 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.

---
 fs/xfs/xfs_inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_inode.c +2 -1
index 3b487341348a0..5abdcf1f46c96 100644
@@ -1025,7 +1025,8 @@ xfs_itruncate_extents_flags(
 	xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
 	if (atomic_read(&VFS_I(ip)->i_count))
 		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);
Signature · 1 line
2.53.0
author maintainer
#22 lore raw

PATCH 21/816 Revert "drm/nouveau/devinit/gf100-: try to avoid double-running vbios scripts"

In reply to Greg Kroah-Hartman

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

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

This reverts commit 3bc8829ce42925dc384b4d5c4fb355e380ad1cb7.

---
 .../drm/nouveau/nvkm/subdev/devinit/gf100.c   | 20 -------------------
 1 file changed, 20 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +0 -20
index 186e09ea0cb10..5368e705e7fd6 100644
@@ -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
Signature · 1 line
2.53.0
author maintainer
#23 lore raw

PATCH 22/816 netrom: send the unacknowledged frames again when T1 or T4 expires

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit d07ed33f39eca24db1f1b15e00ef7c4447408a0d)
---
 net/netrom/nr_subr.c  | 6 +++---
 net/netrom/nr_timer.c | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)
net/netrom/nr_subr.c +3 -3
index c3bbd5880850b..144d9c5ea5b17 100644
@@ -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)
 {
net/netrom/nr_timer.c +4 -0
index 5e3ca068f04e0..efa5cf6d7bf55 100644
@@ -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;
 	}
Signature · 1 line
2.53.0
author maintainer
#24 lore raw

PATCH 23/816 ax25: drop a message being reassembled when a new one starts

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit bb9180c5adfc874ec340caca45b5f3f4d448fcf8)
---
 net/ax25/ax25_in.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
net/ax25/ax25_in.c +20 -10
index fd8669e5b7313..068f0c6c54cef 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#25 lore raw

PATCH 24/816 rose: reset a call when a DATA packet arrives out of sequence

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit e15162d237ddecc2c1215f49b76f4cba06bbc2c8)
---
 net/rose/rose_in.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
net/rose/rose_in.c +21 -0
index 84025b4b498fe..980f82655c12e 100644
@@ -193,6 +193,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
Signature · 1 line
2.53.0
author maintainer
#26 lore raw

PATCH 25/816 ax25: end a REJ recovery count once frames are acknowledged

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit 6f10bf991bc130b56339200965d87512b443954a)
---
 net/ax25/ax25_std_in.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
net/ax25/ax25_std_in.c +19 -4
index d0269ece4fc58..92d89d4df0f83 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#27 lore raw

PATCH 26/816 netrom: keep T1 running after answering a NAK

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit e18a382a74b93a3c0ab52e0fedc8343d9d4facc9)
---
 net/netrom/nr_out.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
net/netrom/nr_out.c +6 -1
index 150cb4263d314..1c6b4386c86b4 100644
@@ -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)
Signature · 1 line
2.53.0
author maintainer
#28 lore raw

PATCH 27/816 netrom: give the sysctl timer limits in milliseconds

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit e59d8b990552be401ace7750a4617ffa07c86637)
---
 net/netrom/sysctl_net_netrom.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
net/netrom/sysctl_net_netrom.c +9 -8
index 7dc0fa628f2e7..bccc165a4a2ec 100644
@@ -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};
Signature · 1 line
2.53.0
author maintainer
#29 lore raw

PATCH 28/816 mm/ksm: fix userfaultfd protection during merge and unmerge

In reply to Greg Kroah-Hartman

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

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

From: Lance Yang <[email protected]>

[ 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.

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")
Cc Mel Gorman <[email protected]>
Cc Xu Xin <[email protected]>"
Cc Chengming Zhou <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Jérôme Glisse <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Peter Xu <[email protected]>
Cc Bobby Powers <[email protected]>
Cc Brian Geffon <[email protected]>
Cc Denis Plotnikov <[email protected]>
Cc Doug Gilbert <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Martin Cracauer <[email protected]>
Cc Marty McFadden <[email protected]>
Cc Maya Gokhale <[email protected]>
Cc Pavel Emelyanov <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Shaohua Li <[email protected]>
Cc James Houghton <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Sean Christopherson <[email protected]>
Cc SJ Park <[email protected]>
Cc Zi Yan <[email protected]>
Cc Mohammed EL Kadiri <[email protected]>
---
 mm/ksm.c | 4 ++++
 1 file changed, 4 insertions(+)
mm/ksm.c +4 -0
index 9a98aa97317a4..6d7b21636f549 100644
@@ -1413,6 +1413,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
Signature · 1 line
2.53.0
author maintainer
#30 lore raw

PATCH 29/816 udf: validate VAT inode size for old VAT format

In reply to Greg Kroah-Hartman

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

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

From: Jan Kara <[email protected]>

[ Upstream commit 5163e6ee1ea744d412fe516235bfd9cab15141dc ]

Validate VAT inode is large enough to contain at least the header for pre-2.00 UDF media format.

---
 fs/udf/super.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/udf/super.c +5 -0
index 8d3d758714da2..ea9cd593ffbbb 100644
@@ -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) {
Signature · 1 line
2.53.0
author maintainer
#31 lore raw

PATCH 30/816 udf: validate vat20->lengthHeader and VAT inode size in udf_load_vat()

In reply to Greg Kroah-Hartman

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

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

From: Hui Peng <[email protected]>

[ 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.

---
 fs/udf/super.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
fs/udf/super.c +12 -2
index ea9cd593ffbbb..09905f6c9ee1c 100644
@@ -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);
Signature · 1 line
2.53.0
author maintainer
#32 lore raw

PATCH 31/816 io_uring: enable toggle of iowait usage when waiting on CQEs

In reply to Greg Kroah-Hartman

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

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

From: Jens Axboe <[email protected]>

Commit 07754bfd9aee59063f8549f6e4d455eae636ecc7 upstream.

By default, io_uring marks a waiting task as being in iowait, if it's sleeping waiting on events and there are pending requests. This isn't necessarily always useful, and may be confusing on non-storage setups where iowait isn't expected. It can also cause extra power usage, by preventing the CPU from entering lower sleep states.

This adds a new enter flag, IORING_ENTER_NO_IOWAIT. If set, then io_uring will not account the sleeping task as being in iowait. If the kernel supports this feature, then it will be marked by having the IORING_FEAT_NO_IOWAIT feature flag set.

As the kernel currently does not support separating the iowait accounting and CPU frequency boosting, the IORING_ENTER_NO_IOWAIT controls both of these at the same time. In the future, if those do end up being split, then it'd be possible to control them separately. However, it seems more likely that the kernel will decouple iowait and CPU frequency boosting anyway.

[ 6.12: only the NO_IOWAIT flag bits are added, the EXT_ARG_REG and
RW_ATTR bits before them don't exist here. io_get_ext_arg() has no ctx argument. ]

---
 include/uapi/linux/io_uring.h |  2 ++
 io_uring/io_uring.c           | 31 +++++++++++++++++++------------
 2 files changed, 21 insertions(+), 12 deletions(-)
include/uapi/linux/io_uring.h +2 -0
index fdd7b931ea1d4..e777e6b128e85 100644
@@ -518,6 +518,7 @@ struct io_cqring_offsets {
 #define IORING_ENTER_EXT_ARG		(1U << 3)
 #define IORING_ENTER_REGISTERED_RING	(1U << 4)
 #define IORING_ENTER_ABS_TIMER		(1U << 5)
+#define IORING_ENTER_NO_IOWAIT		(1U << 7)
 
 /*
  * Passed in for io_uring_setup(2). Copied back with updated info on success
@@ -554,6 +555,7 @@ struct io_uring_params {
 #define IORING_FEAT_REG_REG_RING	(1U << 13)
 #define IORING_FEAT_RECVSEND_BUNDLE	(1U << 14)
 #define IORING_FEAT_MIN_TIMEOUT		(1U << 15)
+#define IORING_FEAT_NO_IOWAIT		(1U << 17)
 
 /*
  * io_uring_register(2) opcodes and arguments
io_uring/io_uring.c +19 -12
index 09551e3907f91..630b306a849f0 100644
@@ -2532,8 +2532,17 @@ static int io_cqring_schedule_timeout(struct io_wait_queue *iowq,
 	return READ_ONCE(iowq->hit_timeout) ? -ETIME : 0;
 }
 
+struct ext_arg {
+	size_t argsz;
+	struct __kernel_timespec __user *ts;
+	const sigset_t __user *sig;
+	ktime_t min_time;
+	bool iowait;
+};
+
 static int __io_cqring_wait_schedule(struct io_ring_ctx *ctx,
 				     struct io_wait_queue *iowq,
+				     struct ext_arg *ext_arg,
 				     ktime_t start_time)
 {
 	int ret = 0;
@@ -2543,7 +2552,7 @@ static int __io_cqring_wait_schedule(struct io_ring_ctx *ctx,
 	 * can take into account that the task is waiting for IO - turns out
 	 * to be important for low QD IO.
 	 */
-	if (current_pending_io())
+	if (ext_arg->iowait && current_pending_io())
 		current->in_iowait = 1;
 	if (iowq->timeout != KTIME_MAX || iowq->min_timeout)
 		ret = io_cqring_schedule_timeout(iowq, ctx->clockid, start_time);
@@ -2556,6 +2565,7 @@ static int __io_cqring_wait_schedule(struct io_ring_ctx *ctx,
 /* If this returns > 0, the caller should retry */
 static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
 					  struct io_wait_queue *iowq,
+					  struct ext_arg *ext_arg,
 					  ktime_t start_time)
 {
 	if (unlikely(READ_ONCE(ctx->check_cq)))
@@ -2569,16 +2579,9 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
 	if (unlikely(io_should_wake(iowq)))
 		return 0;
 
-	return __io_cqring_wait_schedule(ctx, iowq, start_time);
+	return __io_cqring_wait_schedule(ctx, iowq, ext_arg, start_time);
 }
 
-struct ext_arg {
-	size_t argsz;
-	struct __kernel_timespec __user *ts;
-	const sigset_t __user *sig;
-	ktime_t min_time;
-};
-
 /*
  * Wait until events become available, if we don't already have some. The
  * application must reap them itself, as they reside on the shared cq ring.
@@ -2660,7 +2663,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,
 							TASK_INTERRUPTIBLE);
 		}
 
-		ret = io_cqring_wait_schedule(ctx, &iowq, start_time);
+		ret = io_cqring_wait_schedule(ctx, &iowq, ext_arg, start_time);
 		__set_current_state(TASK_RUNNING);
 		atomic_set(&ctx->cq_wait_nr, IO_CQ_WAKE_INIT);
 
@@ -3363,6 +3366,8 @@ static int io_get_ext_arg(unsigned flags, const void __user *argp,
 {
 	struct io_uring_getevents_arg arg;
 
+	ext_arg->iowait = !(flags & IORING_ENTER_NO_IOWAIT);
+
 	/*
 	 * If EXT_ARG isn't set, then we have no timespec and the argp pointer
 	 * is just a pointer to the sigset_t.
@@ -3399,7 +3404,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
 	if (unlikely(flags & ~(IORING_ENTER_GETEVENTS | IORING_ENTER_SQ_WAKEUP |
 			       IORING_ENTER_SQ_WAIT | IORING_ENTER_EXT_ARG |
 			       IORING_ENTER_REGISTERED_RING |
-			       IORING_ENTER_ABS_TIMER)))
+			       IORING_ENTER_ABS_TIMER |
+			       IORING_ENTER_NO_IOWAIT)))
 		return -EINVAL;
 
 	/*
@@ -3786,7 +3792,8 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
 			IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS |
 			IORING_FEAT_RSRC_TAGS | IORING_FEAT_CQE_SKIP |
 			IORING_FEAT_LINKED_FILE | IORING_FEAT_REG_REG_RING |
-			IORING_FEAT_RECVSEND_BUNDLE | IORING_FEAT_MIN_TIMEOUT;
+			IORING_FEAT_RECVSEND_BUNDLE | IORING_FEAT_MIN_TIMEOUT |
+			IORING_FEAT_NO_IOWAIT;
 
 	if (copy_to_user(params, p, sizeof(*p))) {
 		ret = -EFAULT;
Signature · 1 line
2.53.0
author maintainer
#33 lore raw

PATCH 32/816 io_uring/napi: dont end the single NAPI busy poll early on need_resched()

In reply to Greg Kroah-Hartman

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

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

From: Cinq Prairie <[email protected]>

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")
[axboe: trim comments, drop __always_unused]
---
 io_uring/io_uring.h |  1 +
 io_uring/napi.c     | 31 ++++++++++++++-----------------
 2 files changed, 15 insertions(+), 17 deletions(-)
io_uring/io_uring.h +1 -0
index 628ced4b44b22..1cdfc5725e014 100644
@@ -48,6 +48,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
 };
io_uring/napi.c +14 -17
index bdae13367e0fc..ade35aff63752 100644
@@ -107,19 +107,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)
 {
@@ -129,8 +125,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;
@@ -157,13 +152,16 @@ static bool __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;
@@ -174,8 +172,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);
Signature · 1 line
2.53.0
author maintainer
#34 lore raw

PATCH 33/816 io_uring: fail soft links on negative IOU_COMPLETE results

In reply to Greg Kroah-Hartman

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

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

From: Yang Xiuwei <[email protected]>

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")
[axboe: 6.12 has IOU_OK rather than IOU_COMPLETE]
---
 io_uring/io_uring.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
io_uring/io_uring.c +5 -3
index 630b306a849f0..3f8a0f7e84f62 100644
@@ -1789,9 +1789,11 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
 	}
 
 	if (ret == IOU_OK) {
-		/* 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
Signature · 1 line
2.53.0
author maintainer
#35 lore raw

PATCH 34/816 io_uring/futex: fail soft links when cancelling a wait

In reply to Greg Kroah-Hartman

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

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

From: Yang Xiuwei <[email protected]>

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")
---
 io_uring/futex.c | 1 +
 1 file changed, 1 insertion(+)
io_uring/futex.c +1 -0
index 990568baf393a..59b679e1e26f2 100644
@@ -108,6 +108,7 @@ static bool __io_futex_cancel(struct io_ring_ctx *ctx, 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;
Signature · 1 line
2.53.0
author maintainer
#36 lore raw

PATCH 35/816 io_uring/rw: fail soft links on IOPOLL short or error IO

In reply to Greg Kroah-Hartman

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

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

From: Yang Xiuwei <[email protected]>

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")
---
 io_uring/rw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
io_uring/rw.c +3 -1
index b18b10cdbb524..688ce923f6a3c 100644
@@ -553,8 +553,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);
Signature · 1 line
2.53.0
author maintainer
#37 lore raw

PATCH 36/816 io_uring/timeout: dont rearm a multishot timeout on cancel

In reply to Greg Kroah-Hartman

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

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

From: Cheng Yongkang <[email protected]>

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")

[axboe: 6.12 has no tw.cancel, use io_should_terminate_tw() like io_req_task_link_timeout() does]

---
 io_uring/timeout.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
io_uring/timeout.c +2 -1
index d71b0fdbb0663..e99709c4089db 100644
@@ -72,7 +72,8 @@ static void io_timeout_complete(struct io_kiocb *req, struct io_tw_state *ts)
 	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 (!io_should_terminate_tw(ctx) &&
+		    io_req_post_cqe(req, -ETIME, IORING_CQE_F_MORE)) {
 			/* re-arm timer */
 			spin_lock_irq(&ctx->timeout_lock);
 			list_add(&timeout->list, ctx->timeout_list.prev);
Signature · 1 line
2.53.0
author maintainer
#38 lore raw

PATCH 37/816 io_uring/rsrc: keep the old file when a file update fails

In reply to Greg Kroah-Hartman

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

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

From: Cheng Yongkang <[email protected]>

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")

[axboe: 6.12 has no rsrc nodes for files, the old file is queued for removal with io_queue_rsrc_removal(), which can fail. Get and check the new file first, and only remove the old one once that has succeeded]

---
 io_uring/rsrc.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
io_uring/rsrc.c +15 -10
index 168c6987435ed..5a3f3e4e3fa11 100644
@@ -348,6 +348,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
 		return -EINVAL;
 
 	for (done = 0; done < nr_args; done++) {
+		struct file *file = NULL;
 		u64 tag = 0;
 
 		if ((tags && copy_from_user(&tag, &tags[done], sizeof(tag))) ||
@@ -365,17 +366,8 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
 		i = array_index_nospec(up->offset + done, ctx->nr_user_files);
 		file_slot = io_fixed_file_slot(&ctx->file_table, i);
 
-		if (file_slot->file_ptr) {
-			err = io_queue_rsrc_removal(data, i,
-						    io_slot_file(file_slot));
-			if (err)
-				break;
-			file_slot->file_ptr = 0;
-			io_file_bitmap_clear(&ctx->file_table, i);
-		}
 		if (fd != -1) {
-			struct file *file = fget(fd);
-
+			file = fget(fd);
 			if (!file) {
 				err = -EBADF;
 				break;
@@ -388,6 +380,19 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
 				err = -EBADF;
 				break;
 			}
+		}
+		if (file_slot->file_ptr) {
+			err = io_queue_rsrc_removal(data, i,
+						    io_slot_file(file_slot));
+			if (err) {
+				if (file)
+					fput(file);
+				break;
+			}
+			file_slot->file_ptr = 0;
+			io_file_bitmap_clear(&ctx->file_table, i);
+		}
+		if (file) {
 			*io_get_tag_slot(data, i) = tag;
 			io_fixed_file_set(file_slot, file);
 			io_file_bitmap_set(&ctx->file_table, i);
Signature · 1 line
2.53.0
author maintainer
#39 lore raw

PATCH 38/816 io_uring/kbuf: initialize arg->out_len from arg->max_len in io_buffers_select()

In reply to Greg Kroah-Hartman

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

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

From: Siddharth Chintamaneni <[email protected]>

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")
---
 io_uring/kbuf.c | 1 +
 1 file changed, 1 insertion(+)
io_uring/kbuf.c +1 -0
index da6b46244e6de..9d6b7c433eeaf 100644
@@ -343,6 +343,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:
Signature · 1 line
2.53.0
author maintainer
#40 lore raw

PATCH 39/816 io_uring/io-wq: apply the current cpuset to new workers

In reply to Greg Kroah-Hartman

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

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

From: Mikhail Malyshev <[email protected]>

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")
---
 io_uring/io-wq.c | 44 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 5 deletions(-)
io_uring/io-wq.c +39 -5
index 181eecdb32c04..91b83751795f2 100644
@@ -687,6 +687,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;
@@ -748,8 +776,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);
 		}
 	}
 
@@ -799,9 +826,16 @@ void io_wq_worker_sleeping(struct task_struct *tsk)
 static void io_init_new_worker(struct io_wq *wq, 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(&wq->lock);
 	hlist_nulls_add_head_rcu(&worker->nulls_node, &wq->free_list);
@@ -1269,7 +1303,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);
@@ -1453,7 +1487,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();
 
Signature · 1 line
2.53.0
author maintainer
#41 lore raw

PATCH 40/816 bpqether: reserve the Ethernet devices own header room on transmit

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit 6b7e0767b46d918b5c8a5a2fbb8a9c8a2531d698)
---
 drivers/net/hamradio/bpqether.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/net/hamradio/bpqether.c +14 -11
index f027205347d34..ea6bee45e2a4d 100644
@@ -257,12 +257,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);
@@ -275,15 +287,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);
Signature · 1 line
2.53.0
author maintainer
#42 lore raw

PATCH 41/816 bpqether: set both addresses or none in SIOCSBPQETHADDR

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit 431bb7f4a7d347ccda32319aa346346664858289)
---
 drivers/net/hamradio/bpqether.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/hamradio/bpqether.c +4 -4
index ea6bee45e2a4d..4a04c3b4bdb93 100644
@@ -319,8 +319,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))
@@ -340,10 +340,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(&ethaddr, data, sizeof(ethaddr)))
 				return -EFAULT;
+			memcpy(bpq->dest_addr, ethaddr.destination, ETH_ALEN);
+			memcpy(bpq->acpt_addr, ethaddr.accept, ETH_ALEN);
 			break;
 
 		default:
Signature · 1 line
2.53.0
author maintainer
#43 lore raw

PATCH 42/816 bpqether: keep a bpq device in step with its Ethernet device

In reply to Greg Kroah-Hartman

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

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

From: Bernard Pidoux <[email protected]>

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")
Assisted-by Claude:claude-opus-5-5
(cherry picked from commit 888935e9c7aa8d8de66dd76111ef0875f8c90663)
---
 drivers/net/hamradio/bpqether.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
drivers/net/hamradio/bpqether.c +25 -4
index 4a04c3b4bdb93..41b145693ff93 100644
@@ -103,6 +103,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);
@@ -358,6 +359,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;
 }
@@ -532,6 +538,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;
@@ -540,14 +548,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 */
Signature · 1 line
2.53.0
author maintainer
#44 lore raw

PATCH 43/816 Input: destroy force-feedback device on input unregistration

In reply to Greg Kroah-Hartman

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

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

From: Dmitry Torokhov <[email protected]>

[ 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")
[ sashal: Dropped the ->stop removal hunks and adapted ml_ff_destroy() to the bare timer_shutdown_sync() end state, since this tree lacks the ->stop code and uses older mutex_unlock context. ]
---
 drivers/input/ff-core.c    |  2 +-
 drivers/input/ff-memless.c | 10 +---------
 drivers/input/input.c      |  2 ++
 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/input/ff-core.c +1 -1
index 609a5f01761bd..624f8defa5432 100644
@@ -358,7 +358,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)
 {
drivers/input/ff-memless.c +1 -9
index c321cdabd2141..852ec2d4ddcda 100644
@@ -486,15 +486,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.
-	 */
-	del_timer_sync(&ml->timer);
-
+	timer_shutdown_sync(&ml->timer);
 	kfree(ml->private);
 }
 
drivers/input/input.c +2 -0
index 05366b82f722e..0220b913b9ac4 100644
@@ -2283,6 +2283,8 @@ static void __input_unregister_device(struct input_dev *dev)
 	mutex_unlock(&input_mutex);
 
 	device_del(&dev->dev);
+
+	input_ff_destroy(dev);
 }
 
 static void devm_input_device_unregister(struct device *dev, void *res)
Signature · 1 line
2.53.0
author maintainer
#45 lore raw

PATCH 44/816 staging: media: atomisp: use array3_size() for overflow-safe allocation

In reply to Greg Kroah-Hartman

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

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

From: Feng Ning <[email protected]>

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.

---
 .../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(-)
drivers/staging/media/atomisp/pci/sh_css_param_dvs.c +7 -4
index 5174bc210ae17..f70dd99030e9e 100644
@@ -13,6 +13,7 @@
  * more details.
  */
 
+#include <linux/overflow.h>
 #include "sh_css_param_dvs.h"
 #include <assert_support.h>
 #include <type_support.h>
@@ -58,7 +59,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");
@@ -66,7 +67,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");
@@ -77,7 +78,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");
@@ -85,7 +87,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");
drivers/staging/media/atomisp/pci/sh_css_param_shading.c +3 -1
index 5b43cc6562690..0441d7f47a610 100644
@@ -13,6 +13,7 @@
  * more details.
  */
 
+#include <linux/overflow.h>
 #include <linux/math.h>
 #include <linux/slab.h>
 
@@ -348,7 +349,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;
drivers/staging/media/atomisp/pci/sh_css_params.c +21 -14
index b1feb6f6ebe89..76e0b475b12e9 100644
@@ -13,6 +13,7 @@
  * more details.
  */
 
+#include <linux/overflow.h>
 #include "gdc_device.h"		/* gdc_lut_store(), ... */
 #include "isp.h"			/* ISP_VEC_ELEMBITS */
 #include "vamem.h"
@@ -1390,11 +1391,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]) ||
@@ -4215,13 +4216,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;
 
@@ -4488,24 +4493,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;
Signature · 1 line
2.53.0
author maintainer
#46 lore raw

PATCH 45/816 net/9p/fd: support ipv6 for trans=tcp

In reply to Greg Kroah-Hartman

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

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

From: Joshua Murphy <[email protected]>

[ Upstream commit a22a29655c42d0263a7a84d5d808bfd55f20c53a ]

Allows specifying an IPv6 address when mounting a remote 9p file system.

Message-ID: <[email protected]>

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 net/9p/trans_fd.c | 56 ++++++++++++++++++++---------------------------
 1 file changed, 24 insertions(+), 32 deletions(-)
net/9p/trans_fd.c +24 -32
index 5bdfc25689169..a516745f732f7 100644
@@ -11,6 +11,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/in.h>
+#include <linux/in6.h>
 #include <linux/module.h>
 #include <linux/net.h>
 #include <linux/ipv6.h>
@@ -950,64 +951,55 @@ static void p9_fd_close(struct p9_client *client)
 	kfree(ts);
 }
 
-/*
- * stolen from NFS - maybe should be made a generic function?
- */
-static inline int valid_ipaddr4(const char *buf)
-{
-	int rc, count, in[4];
-
-	rc = sscanf(buf, "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]);
-	if (rc != 4)
-		return -EINVAL;
-	for (count = 0; count < 4; count++) {
-		if (in[count] > 255)
-			return -EINVAL;
-	}
-	return 0;
-}
-
 static int p9_bind_privport(struct socket *sock)
 {
-	struct sockaddr_in cl;
+	struct sockaddr_storage stor = { 0 };
 	int port, err = -EINVAL;
 
-	memset(&cl, 0, sizeof(cl));
-	cl.sin_family = AF_INET;
-	cl.sin_addr.s_addr = htonl(INADDR_ANY);
+	stor.ss_family = sock->ops->family;
+	if (stor.ss_family == AF_INET)
+		((struct sockaddr_in *)&stor)->sin_addr.s_addr = htonl(INADDR_ANY);
+	else
+		((struct sockaddr_in6 *)&stor)->sin6_addr = in6addr_any;
 	for (port = p9_ipport_resv_max; port >= p9_ipport_resv_min; port--) {
-		cl.sin_port = htons((ushort)port);
-		err = kernel_bind(sock, (struct sockaddr *)&cl, sizeof(cl));
+		if (stor.ss_family == AF_INET)
+			((struct sockaddr_in *)&stor)->sin_port = htons((ushort)port);
+		else
+			((struct sockaddr_in6 *)&stor)->sin6_port = htons((ushort)port);
+		err = kernel_bind(sock, (struct sockaddr *)&stor, sizeof(stor));
 		if (err != -EADDRINUSE)
 			break;
 	}
 	return err;
 }
 
-
 static int
 p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
 {
 	int err;
+	char port_str[6];
 	struct socket *csocket;
-	struct sockaddr_in sin_server;
+	struct sockaddr_storage stor = { 0 };
 	struct p9_fd_opts opts;
 
 	err = parse_opts(args, &opts);
 	if (err < 0)
 		return err;
 
-	if (addr == NULL || valid_ipaddr4(addr) < 0)
+	if (!addr)
 		return -EINVAL;
 
+	sprintf(port_str, "%u", opts.port);
+	err = inet_pton_with_scope(current->nsproxy->net_ns, AF_UNSPEC, addr,
+				   port_str, &stor);
+	if (err < 0)
+		return err;
+
 	csocket = NULL;
 
 	client->trans_opts.tcp.port = opts.port;
 	client->trans_opts.tcp.privport = opts.privport;
-	sin_server.sin_family = AF_INET;
-	sin_server.sin_addr.s_addr = in_aton(addr);
-	sin_server.sin_port = htons(opts.port);
-	err = __sock_create(current->nsproxy->net_ns, PF_INET,
+	err = __sock_create(current->nsproxy->net_ns, stor.ss_family,
 			    SOCK_STREAM, IPPROTO_TCP, &csocket, 1);
 	if (err) {
 		pr_err("%s (%d): problem creating socket\n",
@@ -1026,8 +1018,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
 	}
 
 	err = READ_ONCE(csocket->ops)->connect(csocket,
-				    (struct sockaddr *)&sin_server,
-				    sizeof(struct sockaddr_in), 0);
+					       (struct sockaddr *)&stor,
+					       sizeof(stor), 0);
 	if (err < 0) {
 		pr_err("%s (%d): problem connecting socket to %s\n",
 		       __func__, task_pid_nr(current), addr);
Signature · 1 line
2.53.0
author maintainer
#47 lore raw

PATCH 46/816 fs/fs_parse: Delete macro fsparam_u32hex()

In reply to Greg Kroah-Hartman

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

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

From: Zijun Hu <[email protected]>

[ Upstream commit 296b67059e3026125a1ca942f5506e6ca051749e ]

Delete macro fsparam_u32hex() since:

- it has no caller.

- it uses as type @fs_param_is_u32_hex which is never defined, so will cause compile error when caller uses it.

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 Documentation/filesystems/mount_api.rst | 1 -
 include/linux/fs_parser.h               | 2 --
 2 files changed, 3 deletions(-)
Documentation/filesystems/mount_api.rst +0 -1
index d92c276f1575a..47dafbb7427e6 100644
@@ -671,7 +671,6 @@ The members are as follows:
 	fsparam_bool()		fs_param_is_bool
 	fsparam_u32()		fs_param_is_u32
 	fsparam_u32oct()	fs_param_is_u32_octal
-	fsparam_u32hex()	fs_param_is_u32_hex
 	fsparam_s32()		fs_param_is_s32
 	fsparam_u64()		fs_param_is_u64
 	fsparam_enum()		fs_param_is_enum
include/linux/fs_parser.h +0 -2
index 6cf713a7e6c6f..b093348613ddd 100644
@@ -122,8 +122,6 @@ 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_hex, 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)
Signature · 1 line
2.53.0
author maintainer
#48 lore raw

PATCH 47/816 fs/fs_parse: add back fsparam_u32hex

In reply to Greg Kroah-Hartman

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

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

From: Eric Sandeen <[email protected]>

[ 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).

Message-ID: <[email protected]>

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 include/linux/fs_parser.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/fs_parser.h +2 -0
index b093348613ddd..7ce7bdcf5ae39 100644
@@ -122,6 +122,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)
Signature · 1 line
2.53.0
author maintainer
#49 lore raw

PATCH 48/816 net/9p: move structures and macros to header files

In reply to Greg Kroah-Hartman

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

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

From: Eric Sandeen <[email protected]>

[ 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.

Message-ID: <[email protected]>

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 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(-)
include/net/9p/client.h +6 -0
index 4f785098c67a1..2d46f8017bd57 100644
@@ -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
include/net/9p/transport.h +39 -0
index 766ec07c95999..88702953b1ef2 100644
@@ -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
net/9p/client.c +0 -6
index 17f7b1290f6b9..d7802d67724cd 100644
@@ -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
  */
net/9p/trans_fd.c +2 -18
index a516745f732f7..fdaebb549aa8f 100644
@@ -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;
net/9p/trans_rdma.c +2 -23
index d9f53f1da2c21..92b166a4a1e52 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#50 lore raw

PATCH 49/816 9p: create a v9fs_context structure to hold parsed options

In reply to Greg Kroah-Hartman

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

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

From: Eric Sandeen <[email protected]>

[ 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.

Message-ID: <[email protected]>

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 include/net/9p/client.h    | 90 ++++++++++++++++++++++++++++++++++++++
 include/net/9p/transport.h | 32 --------------
 2 files changed, 90 insertions(+), 32 deletions(-)
include/net/9p/client.h +90 -0
index 2d46f8017bd57..cc18443f7d516 100644
@@ -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
include/net/9p/transport.h +0 -32
index 88702953b1ef2..ebbb4b50ee205 100644
@@ -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
Signature · 1 line
2.53.0
author maintainer
#51 lore raw

PATCH 50/816 9p: convert to the new mount API

In reply to Greg Kroah-Hartman

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

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

From: Eric Sandeen <[email protected]>

[ 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.

Message-ID: <[email protected]>

[ Dominique: handled source explicitly as per follow-up discussion ]

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 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(-)
fs/9p/v9fs.c +283 -269
index 66b072152745a..213167f74a993 100644
@@ -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;
 
-		default:
-			continue;
+	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;
+
+	/* 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;
 
@@ -473,7 +487,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;
 	}
fs/9p/v9fs.h +6 -1
index 698c43dd5dc86..135598d5a68f2 100644
@@ -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);
fs/9p/vfs_super.c +91 -39

197 lines not on this page · raw message

include/net/9p/client.h +1 -1
index cc18443f7d516..838a94218b593 100644
@@ -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);
include/net/9p/transport.h +1 -1
index ebbb4b50ee205..e53f312191b6e 100644
@@ -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);
net/9p/client.c +12 -136

188 lines not on this page · raw message

net/9p/mod.c +1 -1
index 55576c1866fa6..85160b52da556 100644
@@ -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
net/9p/trans_fd.c +11 -98

156 lines not on this page · raw message

net/9p/trans_rdma.c +8 -100

142 lines not on this page · raw message

net/9p/trans_usbg.c +3 -1
index 938e3130ab81a..dd5d833f2c827 100644
@@ -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;
net/9p/trans_virtio.c +4 -4
index d1a680f699115..6c2a134e7d85c 100644
@@ -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;
net/9p/trans_xen.c +3 -1
index ef9bac5f4a24a..95f314f0285ef 100644
@@ -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)
Signature · 1 line
2.53.0
author maintainer
#52 lore raw

PATCH 51/816 net/9p: Replace strlen() strcpy() pair with strscpy()

In reply to Greg Kroah-Hartman

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

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

From: David Laight <[email protected]>

[ Upstream commit cc8b15a2c435bd1caf19741ba85286846a115764 ]

Use the result of strscpy() for the overflow check.

Message-ID: <[email protected]>

Stable-dep-of: 37dce65a0b43 ("9p: use fc->net_ns for network namespace in RDMA and socket transports")

---
 net/9p/trans_fd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/9p/trans_fd.c +2 -4
index 8a03e62992508..f31b2a81ef8bd 100644
@@ -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) {
Signature · 1 line
2.53.0
author maintainer
#53 lore raw

PATCH 52/816 9p: use fc->net_ns for network namespace in RDMA and socket transports

In reply to Greg Kroah-Hartman

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

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

From: Yizhou Zhao <[email protected]>

[ 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")
Assisted-by GLM:GLM-5.1

Message-ID: <[email protected]>

---
 net/9p/trans_fd.c   | 11 +++++------
 net/9p/trans_rdma.c |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)
net/9p/trans_fd.c +5 -6
index f31b2a81ef8bd..780d4ee397f86 100644
@@ -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));
net/9p/trans_rdma.c +1 -1
index 4a779b3a56987..e5c5575849d62 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#54 lore raw

PATCH 53/816 net/9p/usbg: fix descriptor cleanup use-after-free

In reply to Greg Kroah-Hartman

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

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

From: Yizhou Zhao <[email protected]>

[ 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")
Assisted-by GLM:GLM-5.1

Message-ID: <[email protected]>
Message-ID: <[email protected]>

---
 net/9p/trans_usbg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/9p/trans_usbg.c +2 -2
index dd5d833f2c827..1592b99ae00c7 100644
@@ -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,
Signature · 1 line
2.53.0
author maintainer
#55 lore raw

PATCH 54/816 net/9p/usbg: Fix use-after-free on usb9pfs_clear_tx

In reply to Greg Kroah-Hartman

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

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

From: Yizhou Zhao <[email protected]>

[ 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")
Assisted-by GLM:GLM-5.1

Message-ID: <[email protected]>

---
 net/9p/trans_usbg.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/9p/trans_usbg.c +6 -0
index 1592b99ae00c7..79735bbe739ac 100644
@@ -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);
Signature · 1 line
2.53.0
author maintainer
#56 lore raw

PATCH 55/816 9p: skip intermediate directory entry name copy in p9dirent_read()

In reply to Greg Kroah-Hartman

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

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

From: Haobin Wu <[email protected]>

[ 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")

Message-ID: <[email protected]>

---
 fs/9p/vfs_dir.c         |  6 +++++-
 include/net/9p/client.h |  2 +-
 net/9p/protocol.c       | 12 ++----------
 3 files changed, 8 insertions(+), 12 deletions(-)
fs/9p/vfs_dir.c +5 -1
index 323f85352f6a4..733ec42258bc6 100644
@@ -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;
include/net/9p/client.h +1 -1
index 838a94218b593..9f3079c6f3867 100644
@@ -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;
net/9p/protocol.c +2 -10
index 0e6603b1ec906..0a97b4de243ab 100644
@@ -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;
 }
Signature · 1 line
2.53.0
author maintainer
#57 lore raw

PATCH 56/816 xfrm: zero-initialise km_event in the replay-notify path

In reply to Greg Kroah-Hartman

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

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

From: Shubham Antil <[email protected]>

[ 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")
Assisted-by Claude:claude-opus-4-8
---
 net/xfrm/xfrm_replay.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/xfrm/xfrm_replay.c +3 -3
index 235bbefc2abae..b8a55af7ca055 100644
@@ -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;
 
Signature · 1 line
2.53.0
author maintainer
#58 lore raw

PATCH 57/816 batman-adv: avoid WARN_ON for orig_ifinfo allocation failure

In reply to Greg Kroah-Hartman

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

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

From: Deepanshu Kartikey <[email protected]>

[ 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 [email protected]
---
 net/batman-adv/bat_iv_ogm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +1 -1
index dd1f88af5b961..cf6ff9848a7bc 100644
@@ -1296,7 +1296,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;
 	}
Signature · 1 line
2.53.0
author maintainer
#59 lore raw

PATCH 58/816 wifi: ath9k_htc: start ANI when an AP interface begins to beacon

In reply to Greg Kroah-Hartman

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

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

From: Mehmet Fide <[email protected]>

[ 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.

---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_main.c +3 -0
index 8a03bcc2789e8..afddfac699ce6 100644
@@ -1552,6 +1552,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) {
Signature · 1 line
2.53.0
author maintainer
#60 lore raw

PATCH 59/816 scsi: aic7xxx: Fix REQUEST SENSE allocation length on big-endian hosts

In reply to Greg Kroah-Hartman

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

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

From: Imre Kaloz <[email protected]>

[ 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.

---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aic7xxx/aic7xxx_core.c +1 -1
index d747d0b72a13a..989e8c9bda4ac 100644
@@ -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;
 
 			/*
Signature · 1 line
2.53.0
author maintainer
#61 lore raw

PATCH 60/816 scsi: scsi_debug: Drain target cleanup before module exit

In reply to Greg Kroah-Hartman

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

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

From: Giuseppe Piscitelli <[email protected]>

[ 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")
---
 drivers/scsi/scsi_debug.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/scsi_debug.c +1 -0
index 27e882a6244d9..7a1ad88669eeb 100644
@@ -8315,6 +8315,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);
 }
 
Signature · 1 line
2.53.0
author maintainer
#62 lore raw

PATCH 61/816 scsi: aha1542: Remove unneeded scsi_dma_unmap() call

In reply to Greg Kroah-Hartman

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

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

From: Matthew Whitehead <[email protected]>

[ 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.

---
 drivers/scsi/aha1542.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/aha1542.c +0 -2
index 389499d3e00aa..4feea64ce24cb 100644
@@ -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)
Signature · 1 line
2.53.0
author maintainer
#63 lore raw

PATCH 62/816 9p: fall back to the normal open path for non-regular files

In reply to Greg Kroah-Hartman

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

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

From: Yuanfu Xie <[email protected]>

[ 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")

Message-ID: <[email protected]>

---
 fs/9p/vfs_inode.c      | 10 ++++++++++
 fs/9p/vfs_inode_dotl.c | 12 ++++++++++++
 2 files changed, 22 insertions(+)
fs/9p/vfs_inode.c +10 -0
index 7cb3f4b89dcc3..f0c1805d60c42 100644
@@ -821,6 +821,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 (err)
 		goto error;
fs/9p/vfs_inode_dotl.c +12 -0
index 40a4fc65a5441..3f916a8d10540 100644
@@ -317,6 +317,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)
Signature · 1 line
2.53.0
author maintainer
#64 lore raw

PATCH 63/816 9p: do not store the create fid on special files

In reply to Greg Kroah-Hartman

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

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

From: Yuanfu Xie <[email protected]>

[ 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")

Message-ID: <[email protected]>

---
 fs/9p/vfs_inode_dotl.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
fs/9p/vfs_inode_dotl.c +16 -8
index 3f916a8d10540..50327c01da430 100644
@@ -333,16 +333,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);
Signature · 1 line
2.53.0
author maintainer
#65 lore raw

PATCH 64/816 wifi: ath10k: Stop unanswered temperature reads

In reply to Greg Kroah-Hartman

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

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

From: Filippo Falezza <[email protected]>

[ 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")
---
 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(-)
drivers/net/wireless/ath/ath10k/core.c +1 -0
index f9b51d98d20bb..e3dcf034c8725 100644
@@ -2979,6 +2979,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)) {
drivers/net/wireless/ath/ath10k/thermal.c +8 -1
index 8b15ec07b1071..9b81f9ae58d74 100644
@@ -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;
 	}
drivers/net/wireless/ath/ath10k/thermal.h +2 -0
index 1f4de9fbf2b30..d1fb5b958c37c 100644
@@ -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
 	 */
Signature · 1 line
2.53.0
author maintainer
#66 lore raw

PATCH 65/816 seg6: fix transport header for inner IPv4 with IP options

In reply to Greg Kroah-Hartman

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

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

From: Andrea Mayer <[email protected]>

[ 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")
---
 net/ipv6/seg6_local.c | 69 +++++++++++++++++++++++++++++++++----------
 1 file changed, 53 insertions(+), 16 deletions(-)
net/ipv6/seg6_local.c +53 -16
index 9259b2d2da059..7c0d98a65c8b7 100644
@@ -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;
 };
 
@@ -969,6 +967,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)
 {
@@ -998,14 +1030,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))
@@ -1015,7 +1051,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;
 }
 
@@ -1150,16 +1186,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);
@@ -1171,11 +1215,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);
@@ -1186,7 +1225,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);
 }
 
@@ -1199,9 +1238,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 */
Signature · 1 line
2.53.0
author maintainer
#67 lore raw

PATCH 66/816 drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes

In reply to Greg Kroah-Hartman

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

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

From: Michal Wilczynski <[email protected]>

[ 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.

---
 drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/imagination/pvr_rogue_fwif.h +1 -1
index 5d590c4c25663..2f8daa93c9e68 100644
@@ -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);
 
 /*
  ******************************************************************************
Signature · 1 line
2.53.0
author maintainer
#68 lore raw

PATCH 67/816 gpio: omap: Propagate runtime PM failures in probe and request

In reply to Greg Kroah-Hartman

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

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

From: Avi Weiss <[email protected]>

[ 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")
---
 drivers/gpio/gpio-omap.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpio/gpio-omap.c +11 -2
index 595ef20084049..a808ddbd8773c 100644
@@ -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);
@@ -1465,7 +1468,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);
Signature · 1 line
2.53.0
author maintainer
#69 lore raw

PATCH 68/816 bpf: Fix jited line info off by the CFI preamble

In reply to Greg Kroah-Hartman

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

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

From: Jose Fernandez (Anthropic) <[email protected]>

[ 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")
---
 kernel/bpf/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/bpf/core.c +5 -3
index 643ccb230ddda..df529db44f35c 100644
@@ -199,7 +199,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:
@@ -213,7 +215,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,
@@ -241,7 +243,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];
 }
 
Signature · 1 line
2.53.0
author maintainer
#70 lore raw

PATCH 69/816 btrfs: verity: propagate orphan insertion errors when enabling verity

In reply to Greg Kroah-Hartman

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

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

From: guolingxing <[email protected]>

[ 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")
---
 fs/btrfs/verity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/verity.c +1 -1
index fb0eb6c4fd221..65a17d7e4e53f 100644
@@ -604,7 +604,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;
 }
 
 /*
Signature · 1 line
2.53.0
author maintainer
#71 lore raw

PATCH 70/816 btrfs: fix fiemap merging compressed extents

In reply to Greg Kroah-Hartman

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

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

From: Filipe Manana <[email protected]>

[ 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")
---
 fs/btrfs/fiemap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/fiemap.c +2 -1
index 7364bae6b1720..cf93318d14080 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#72 lore raw

PATCH 71/816 btrfs: scrub: fix lost wakeup and hang when cancelling a scrub that is finishing

In reply to Greg Kroah-Hartman

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

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

From: Filipe Manana <[email protected]>

[ 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")
---
 fs/btrfs/scrub.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
fs/btrfs/scrub.c +7 -1
index 9afe36341d8a3..fc01ae2dcb69d 100644
@@ -3067,7 +3067,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));
@@ -3080,6 +3079,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);
 
Signature · 1 line
2.53.0
author maintainer
#73 lore raw

PATCH 72/816 btrfs: zoned: fix double free of bitmaps on clone failure

In reply to Greg Kroah-Hartman

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

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

From: Thomas Fourier <[email protected]>

[ 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")
---
 fs/btrfs/zoned.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/btrfs/zoned.c +5 -0
index e417613ca9c60..b4bb02bd99ae5 100644
@@ -615,6 +615,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;
Signature · 1 line
2.53.0
author maintainer
#74 lore raw

PATCH 73/816 net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3

In reply to Greg Kroah-Hartman

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

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

From: Zhi-Jun You <[email protected]>

[ 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.

---
 drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_wed.c +1 -1
index 8d95765a3813f..544bf35990c17 100644
@@ -1939,7 +1939,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)  {
Signature · 1 line
2.53.0
author maintainer
#75 lore raw

PATCH 74/816 net: ethernet: mtk_wed: fix reset condition for rx wdma

In reply to Greg Kroah-Hartman

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

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

From: Zhi-Jun You <[email protected]>

[ 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.

---
 drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_wed.c +1 -1
index 544bf35990c17..c2c684fbbb164 100644
@@ -250,7 +250,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,
Signature · 1 line
2.53.0
author maintainer
#76 lore raw

PATCH 75/816 net: ethernet: mtk_wed: free up rings during detach

In reply to Greg Kroah-Hartman

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

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

From: Zhi-Jun You <[email protected]>

[ 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.

---
 drivers/net/ethernet/mediatek/mtk_wed.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/ethernet/mediatek/mtk_wed.c +8 -0
index c2c684fbbb164..005b653a7e3a9 100644
@@ -942,6 +942,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);
 }
Signature · 1 line
2.53.0
author maintainer
#77 lore raw

PATCH 76/816 net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986

In reply to Greg Kroah-Hartman

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

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

From: Zhi-Jun You <[email protected]>

[ 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")
---
 drivers/net/ethernet/mediatek/mtk_wed.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_wed.c +14 -1
index 005b653a7e3a9..a8a78ea9f2352 100644
@@ -2346,7 +2346,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;
+		}
 
 	mtk_wed_hw_init(dev);
 	mtk_wed_configure_irq(dev, irq_mask);
Signature · 1 line
2.53.0
author maintainer
#78 lore raw

PATCH 77/816 ptp: drain virtual clock sysfs operations before unregistering children

In reply to Greg Kroah-Hartman

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

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

From: James Hilliard <[email protected]>

[ 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.")
---
 drivers/ptp/ptp_clock.c   | 5 +++++
 drivers/ptp/ptp_private.h | 1 +
 drivers/ptp/ptp_sysfs.c   | 6 ++++++
 3 files changed, 12 insertions(+)
drivers/ptp/ptp_clock.c +5 -0
index 03c17b1db7aac..52849072e4372 100644
@@ -424,6 +424,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);
 	}
drivers/ptp/ptp_private.h +1 -0
index f329263f33aa1..5ac416074ad26 100644
@@ -167,6 +167,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);
drivers/ptp/ptp_sysfs.c +6 -0
index 0d4b081daf639..998de4be08ebd 100644
@@ -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)
 {
Signature · 1 line
2.53.0
author maintainer
#79 lore raw

PATCH 78/816 ptp: unwind partially completed virtual clock creation

In reply to Greg Kroah-Hartman

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

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

From: James Hilliard <[email protected]>

[ 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")
---
 drivers/ptp/ptp_sysfs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/ptp/ptp_sysfs.c +7 -1
index 998de4be08ebd..b07274b67294a 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#80 lore raw

PATCH 79/816 ptp: vclock: propagate physical clock sampling errors

In reply to Greg Kroah-Hartman

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

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

From: James Hilliard <[email protected]>

[ 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")
---
 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(-)
drivers/ptp/ptp_private.h +5 -1
index 5ac416074ad26..104474956a844 100644
@@ -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;
 };
 
 /*
drivers/ptp/ptp_sysfs.c +3 -1
index b07274b67294a..de073b21f1f72 100644
@@ -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;
drivers/ptp/ptp_vclock.c +68 -21

179 lines not on this page · raw message

Signature · 1 line
2.53.0
author maintainer
#81 lore raw

PATCH 80/816 ptp: vclock: serialize extended samples with counter updates

In reply to Greg Kroah-Hartman

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

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

From: James Hilliard <[email protected]>

[ 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.")
---
 drivers/ptp/ptp_vclock.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)
drivers/ptp/ptp_vclock.c +14 -18
index 2016e2481580e..c047a1222ea43 100644
@@ -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)
Signature · 1 line
2.53.0
author maintainer
#82 lore raw

PATCH 81/816 net/smc: fix limit_smc_hs sysctl on big-endian architecture

In reply to Greg Kroah-Hartman

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

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

From: Fernando Fernandez Mancera <[email protected]>

[ 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.

---
 net/smc/smc_sysctl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/smc/smc_sysctl.c +2 -4
index 2fab6456f7654..7da98bd5287ae 100644
@@ -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,
 	},
 };
 
Signature · 1 line
2.53.0
author maintainer
#83 lore raw

PATCH 82/816 scsi: target: Validate REGISTER AND MOVE TransportID length

In reply to Greg Kroah-Hartman

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

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

From: Jia Jia <[email protected]>

[ 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")
---
 drivers/target/target_core_pr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/target/target_core_pr.c +5 -4
index c7f16c2ccf1e4..25df74b2e3559 100644
@@ -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;
 	}
Signature · 1 line
2.53.0
author maintainer
#84 lore raw

PATCH 83/816 tipc: reject attaching bearer of different media to the same occupied device

In reply to Greg Kroah-Hartman

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

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

From: Tung Nguyen <[email protected]>

[ 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.

---
 net/tipc/bearer.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
net/tipc/bearer.c +33 -0
index 24dcb8aa32330..e057d0c6786c4 100644
@@ -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",
Signature · 1 line
2.53.0
author maintainer
#85 lore raw

PATCH 84/816 net: ipa: Fix double free of the interrupt structure on config error

In reply to Greg Kroah-Hartman

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

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

From: Thomas Fourier <[email protected]>

[ 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.

---
 drivers/net/ipa/ipa_interrupt.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/net/ipa/ipa_interrupt.c +2 -10
index 245a069970556..dc5315ce31d32 100644
@@ -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);
Signature · 1 line
2.53.0
author maintainer
#86 lore raw

PATCH 85/816 ALSA: memalloc: Free the new pages when WC DMA mapping fails

In reply to Greg Kroah-Hartman

6.12-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")
---
 sound/core/memalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/memalloc.c +1 -1
index b3853583d2ae1..e2887c9a24631 100644
@@ -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;
Signature · 1 line
2.53.0
author maintainer
#87 lore raw

PATCH 86/816 netfilter: nf_dup_netdev: Move the recursion counter struct netdev_xmit

In reply to Greg Kroah-Hartman

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

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

From: Sebastian Andrzej Siewior <[email protected]>

[ Upstream commit f37ad91270397a6d053e8623bdb3cf79859691d2 ]

nf_dup_skb_recursion is a per-CPU variable and relies on disabled BH for its locking. Without per-CPU locking in local_bh_disable() on PREEMPT_RT this data structure requires explicit locking.

Move nf_dup_skb_recursion to struct netdev_xmit, provide wrappers.

Stable-dep-of: d6c18cadfc6c ("netfilter: nft_reject: prevent unbounded recursion in output hooks")

---
 include/linux/netdevice_xmit.h |  3 +++
 net/netfilter/nf_dup_netdev.c  | 22 ++++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)
include/linux/netdevice_xmit.h +3 -0
index 59726e6cd2cc6..cc232508e695e 100644
@@ -18,6 +18,9 @@ struct netdev_xmit {
 	u8			sched_mirred_nest;
 	struct net_device	*sched_mirred_dev[MIRRED_NEST_LIMIT];
 #endif
+#if IS_ENABLED(CONFIG_NF_DUP_NETDEV)
+	u8 nf_dup_skb_recursion;
+#endif
 };
 
 #endif
net/netfilter/nf_dup_netdev.c +18 -4
index a8e2425e43b0d..fab8b9011098f 100644
@@ -15,12 +15,26 @@
 
 #define NF_RECURSION_LIMIT	2
 
-static DEFINE_PER_CPU(u8, nf_dup_skb_recursion);
+#ifndef CONFIG_PREEMPT_RT
+static u8 *nf_get_nf_dup_skb_recursion(void)
+{
+	return this_cpu_ptr(&softnet_data.xmit.nf_dup_skb_recursion);
+}
+#else
+
+static u8 *nf_get_nf_dup_skb_recursion(void)
+{
+	return &current->net_xmit.nf_dup_skb_recursion;
+}
+
+#endif
 
 static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
 				enum nf_dev_hooks hook)
 {
-	if (__this_cpu_read(nf_dup_skb_recursion) > NF_RECURSION_LIMIT)
+	u8 *nf_dup_skb_recursion = nf_get_nf_dup_skb_recursion();
+
+	if (*nf_dup_skb_recursion > NF_RECURSION_LIMIT)
 		goto err;
 
 	if (hook == NF_NETDEV_INGRESS && skb_mac_header_was_set(skb)) {
@@ -32,9 +46,9 @@ static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
 
 	skb->dev = dev;
 	skb_clear_tstamp(skb);
-	__this_cpu_inc(nf_dup_skb_recursion);
+	(*nf_dup_skb_recursion)++;
 	dev_queue_xmit(skb);
-	__this_cpu_dec(nf_dup_skb_recursion);
+	(*nf_dup_skb_recursion)--;
 	return;
 err:
 	kfree_skb(skb);
Signature · 1 line
2.53.0
author maintainer
#88 lore raw

PATCH 87/816 netfilter: nft_fwd_netdev: add device and headroom validate with neigh forwarding

In reply to Greg Kroah-Hartman

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

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

From: Pablo Neira Ayuso <[email protected]>

[ Upstream commit 0a0b35f0bf10b4c2be607465f5c9c12c8681305b ]

The ttl field has been decremented already and evaluation of this rule would proceed, just drop this packet instead if there is no destination device to forwards this packet. This is exactly what nf_dup already does in this case.

Moreover, check for headroom and call skb_expand_head() like in the IP output path to ensure there is sufficient headroom when forwarding this via neigh_xmit().

Fixes d32de98ea70f ("netfilter: nft_fwd_netdev: allow to forward packets via neighbour layer")

Stable-dep-of: d6c18cadfc6c ("netfilter: nft_reject: prevent unbounded recursion in output hooks")

---
 net/netfilter/nft_fwd_netdev.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
net/netfilter/nft_fwd_netdev.c +14 -2
index 4bce36c3a6a07..8468bed3e87d2 100644
@@ -101,6 +101,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 	unsigned int verdict = NF_STOLEN;
 	struct sk_buff *skb = pkt->skb;
 	struct net_device *dev;
+	unsigned int hh_len;
 	int neigh_table;
 
 	switch (priv->nfproto) {
@@ -152,8 +153,19 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 	}
 
 	dev = dev_get_by_index_rcu(nft_net(pkt), oif);
-	if (dev == NULL)
-		return;
+	if (dev == NULL) {
+		verdict = NF_DROP;
+		goto out;
+	}
+
+	hh_len = LL_RESERVED_SPACE(dev);
+	if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
+		skb = skb_expand_head(skb, hh_len);
+		if (!skb) {
+			verdict = NF_STOLEN;
+			goto out;
+		}
+	}
 
 	skb->dev = dev;
 	skb_clear_tstamp(skb);
Signature · 1 line
2.53.0
author maintainer
#89 lore raw

PATCH 88/816 netfilter: nft_fwd_netdev: use recursion counter in neigh egress path

In reply to Greg Kroah-Hartman

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

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

From: Weiming Shi <[email protected]>

[ Upstream commit 1d47b55b36d2ec73fe6901212c8b28a593c3b27c ]

nft_fwd_neigh can be used in egress chains (NF_NETDEV_EGRESS). When the forwarding rule targets the same device or two devices forward to each other, neigh_xmit() triggers dev_queue_xmit() which re-enters nf_hook_egress(), causing infinite recursion and stack overflow.

Move the nf_get_nf_dup_skb_recursion() accessor and NF_RECURSION_LIMIT to the shared header nf_dup_netdev.h as a static inline, so that nft_fwd_netdev can use the recursion counter directly without exported function call overhead. Guard neigh_xmit() with the same recursion limit already used in nf_do_netdev_egress().

[ Updated to cache the nf_get_nf_dup_skb_recursion pointer. --pablo ]

Fixes f87b9464d152 ("netfilter: nft_fwd_netdev: Support egress hook")

Stable-dep-of: d6c18cadfc6c ("netfilter: nft_reject: prevent unbounded recursion in output hooks")

---
 include/net/netfilter/nf_dup_netdev.h | 13 +++++++++++++
 net/netfilter/nf_dup_netdev.c         | 16 ----------------
 net/netfilter/nft_fwd_netdev.c        |  8 ++++++++
 3 files changed, 21 insertions(+), 16 deletions(-)
include/net/netfilter/nf_dup_netdev.h +13 -0
index b175d271aec95..609bcf422a9b3 100644
@@ -3,10 +3,23 @@
 #define _NF_DUP_NETDEV_H_
 
 #include <net/netfilter/nf_tables.h>
+#include <linux/netdevice.h>
+#include <linux/sched.h>
 
 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
+
+static inline u8 *nf_get_nf_dup_skb_recursion(void)
+{
+#ifndef CONFIG_PREEMPT_RT
+	return this_cpu_ptr(&softnet_data.xmit.nf_dup_skb_recursion);
+#else
+	return &current->net_xmit.nf_dup_skb_recursion;
+#endif
+}
+
 struct nft_offload_ctx;
 struct nft_flow_rule;
 
net/netfilter/nf_dup_netdev.c +0 -16
index fab8b9011098f..a958a1b0c5bee 100644
@@ -13,22 +13,6 @@
 #include <net/netfilter/nf_tables_offload.h>
 #include <net/netfilter/nf_dup_netdev.h>
 
-#define NF_RECURSION_LIMIT	2
-
-#ifndef CONFIG_PREEMPT_RT
-static u8 *nf_get_nf_dup_skb_recursion(void)
-{
-	return this_cpu_ptr(&softnet_data.xmit.nf_dup_skb_recursion);
-}
-#else
-
-static u8 *nf_get_nf_dup_skb_recursion(void)
-{
-	return &current->net_xmit.nf_dup_skb_recursion;
-}
-
-#endif
-
 static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
 				enum nf_dev_hooks hook)
 {
net/netfilter/nft_fwd_netdev.c +8 -0
index 8468bed3e87d2..14c1ac9f20b6a 100644
@@ -95,6 +95,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 			      struct nft_regs *regs,
 			      const struct nft_pktinfo *pkt)
 {
+	u8 *nf_dup_skb_recursion = nf_get_nf_dup_skb_recursion();
 	struct nft_fwd_neigh *priv = nft_expr_priv(expr);
 	void *addr = &regs->data[priv->sreg_addr];
 	int oif = regs->data[priv->sreg_dev];
@@ -152,6 +153,11 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 		goto out;
 	}
 
+	if (*nf_dup_skb_recursion > NF_RECURSION_LIMIT) {
+		verdict = NF_DROP;
+		goto out;
+	}
+
 	dev = dev_get_by_index_rcu(nft_net(pkt), oif);
 	if (dev == NULL) {
 		verdict = NF_DROP;
@@ -169,7 +175,9 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 
 	skb->dev = dev;
 	skb_clear_tstamp(skb);
+	(*nf_dup_skb_recursion)++;
 	neigh_xmit(neigh_table, dev, addr, skb);
+	(*nf_dup_skb_recursion)--;
 out:
 	regs->verdict.code = verdict;
 }
Signature · 1 line
2.53.0
author maintainer
#90 lore raw

PATCH 89/816 netfilter: nf_dup_netdev: add nf_dev_xmit_recursion*() helpers and use them

In reply to Greg Kroah-Hartman

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

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

From: Pablo Neira Ayuso <[email protected]>

[ Upstream commit 2354e975932dabb06fad239f07a3b68fd1809737 ]

Update nft_dup and nft_fwd to use the nf_dev_xmit_recursion() helpers. This patch also disables BH when transmitting the skb to address a possible migration to different CPU leading to imbalanced decrementation of the recursion counters.

This is modeled after Florian Westphal's dev_xmit_recursion*() API available since commit 97cdcf37b57e ("net: place xmit recursion in softnet data") according to its current state in the tree.

Fixes 1d47b55b36d2 ("netfilter: nft_fwd_netdev: use recursion counter in neigh egress path")
Fixes f37ad9127039 ("netfilter: nf_dup_netdev: Move the recursion counter struct netdev_xmit")

Stable-dep-of: d6c18cadfc6c ("netfilter: nft_reject: prevent unbounded recursion in output hooks")

---
 include/net/netfilter/nf_dup_netdev.h | 34 +++++++++++++++++++++++----
 net/netfilter/nf_dup_netdev.c         | 15 ++++++------
 net/netfilter/nft_fwd_netdev.c        | 17 ++++++++------
 3 files changed, 47 insertions(+), 19 deletions(-)
include/net/netfilter/nf_dup_netdev.h +29 -5
index 609bcf422a9b3..f6b05bd80c3fe 100644
@@ -11,15 +11,39 @@ void nf_fwd_netdev_egress(const struct nft_pktinfo *pkt, int oif);
 
 #define NF_RECURSION_LIMIT	2
 
-static inline u8 *nf_get_nf_dup_skb_recursion(void)
-{
 #ifndef CONFIG_PREEMPT_RT
-	return this_cpu_ptr(&softnet_data.xmit.nf_dup_skb_recursion);
+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
-	return &current->net_xmit.nf_dup_skb_recursion;
-#endif
+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;
 
net/netfilter/nf_dup_netdev.c +8 -7
index a958a1b0c5bee..02d1880bab6b3 100644
@@ -16,11 +16,6 @@
 static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
 				enum nf_dev_hooks hook)
 {
-	u8 *nf_dup_skb_recursion = nf_get_nf_dup_skb_recursion();
-
-	if (*nf_dup_skb_recursion > NF_RECURSION_LIMIT)
-		goto err;
-
 	if (hook == NF_NETDEV_INGRESS && skb_mac_header_was_set(skb)) {
 		if (skb_cow_head(skb, skb->mac_len))
 			goto err;
@@ -30,9 +25,15 @@ static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,
 
 	skb->dev = dev;
 	skb_clear_tstamp(skb);
-	(*nf_dup_skb_recursion)++;
+	local_bh_disable();
+	if (nf_dev_xmit_recursion()) {
+		local_bh_enable();
+		goto err;
+	}
+	nf_dev_xmit_recursion_inc();
 	dev_queue_xmit(skb);
-	(*nf_dup_skb_recursion)--;
+	nf_dev_xmit_recursion_dec();
+	local_bh_enable();
 	return;
 err:
 	kfree_skb(skb);
net/netfilter/nft_fwd_netdev.c +10 -7
index 14c1ac9f20b6a..eceab479bd8c4 100644
@@ -95,7 +95,6 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 			      struct nft_regs *regs,
 			      const struct nft_pktinfo *pkt)
 {
-	u8 *nf_dup_skb_recursion = nf_get_nf_dup_skb_recursion();
 	struct nft_fwd_neigh *priv = nft_expr_priv(expr);
 	void *addr = &regs->data[priv->sreg_addr];
 	int oif = regs->data[priv->sreg_dev];
@@ -153,13 +152,15 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 		goto out;
 	}
 
-	if (*nf_dup_skb_recursion > NF_RECURSION_LIMIT) {
+	dev = dev_get_by_index_rcu(nft_net(pkt), oif);
+	if (!dev) {
 		verdict = NF_DROP;
 		goto out;
 	}
 
-	dev = dev_get_by_index_rcu(nft_net(pkt), oif);
-	if (dev == NULL) {
+	local_bh_disable();
+	if (nf_dev_xmit_recursion()) {
+		local_bh_enable();
 		verdict = NF_DROP;
 		goto out;
 	}
@@ -168,16 +169,18 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,
 	if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
 		skb = skb_expand_head(skb, hh_len);
 		if (!skb) {
-			verdict = NF_STOLEN;
+			local_bh_enable();
 			goto out;
 		}
 	}
 
 	skb->dev = dev;
 	skb_clear_tstamp(skb);
-	(*nf_dup_skb_recursion)++;
+
+	nf_dev_xmit_recursion_inc();
 	neigh_xmit(neigh_table, dev, addr, skb);
-	(*nf_dup_skb_recursion)--;
+	nf_dev_xmit_recursion_dec();
+	local_bh_enable();
 out:
 	regs->verdict.code = verdict;
 }
Signature · 1 line
2.53.0
author maintainer
#91 lore raw

PATCH 90/816 netfilter: nft_reject: prevent unbounded recursion in output hooks

In reply to Greg Kroah-Hartman

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

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

From: Fernando Fernandez Mancera <[email protected]>

[ 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.

---
 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
include/linux/netdevice_xmit.h +2 -2
index cc232508e695e..286ae5a6101e8 100644
@@ -18,8 +18,8 @@ struct netdev_xmit {
 	u8			sched_mirred_nest;
 	struct net_device	*sched_mirred_dev[MIRRED_NEST_LIMIT];
 #endif
-#if IS_ENABLED(CONFIG_NF_DUP_NETDEV)
-	u8 nf_dup_skb_recursion;
+#if IS_ENABLED(CONFIG_NETFILTER)
+	u8 nf_xmit_skb_recursion;
 #endif
 };
 
include/net/netfilter/nf_dup_netdev.h +0 -35
index f6b05bd80c3fe..a394112646144 100644
@@ -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;
 
include/net/netfilter/nf_recursion.h new file +42 -0

42 lines not on this page · raw message

net/ipv4/netfilter/nf_reject_ipv4.c +12 -0
index 29c70e92a1722..ccdbbae6ff513 100644
@@ -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>
 
@@ -329,7 +330,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;
 
net/ipv6/netfilter/nf_reject_ipv6.c +13 -0
index 7beb12046486f..6d897bf698abd 100644
@@ -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>
 
@@ -396,7 +397,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);
 
net/netfilter/nf_dup_netdev.c +1 -0
index 02d1880bab6b3..c47508b54ba9c 100644
@@ -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)
net/netfilter/nft_fwd_netdev.c +1 -0
index eceab479bd8c4..84ae30cd208b7 100644
@@ -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>
 
Signature · 1 line
2.53.0
author maintainer
#92 lore raw

PATCH 91/816 spi: pic32-sqi: fail transfer when the BD ring is exhausted

In reply to Greg Kroah-Hartman

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

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

From: Hongjian Dai <[email protected]>

[ 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.

---
 drivers/spi/spi-pic32-sqi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-pic32-sqi.c +2 -1
index 569d1e55c8ca9..3cb7e407bf717 100644
@@ -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;
 		}
 	}
Signature · 1 line
2.53.0
author maintainer
#93 lore raw

PATCH 92/816 bpf: Avoid changing callchain in bpf_get_stack_pe

In reply to Greg Kroah-Hartman

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

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

From: Jiri Olsa <[email protected]>

[ 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

Stable-dep-of: 007fd460798b ("bpf: Clamp the trace length in __bpf_get_stack() again")

---
 kernel/bpf/stackmap.c | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)
kernel/bpf/stackmap.c +15 -21
index a43b2d8b13e04..e57f092437800 100644
@@ -408,7 +408,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;
 
@@ -488,15 +488,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;
@@ -580,7 +580,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)
@@ -684,8 +684,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;
@@ -701,12 +701,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 */);
 }
 
@@ -714,8 +714,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;
@@ -738,13 +738,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;
 
@@ -752,7 +746,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:
Signature · 1 line
2.53.0
author maintainer
#94 lore raw

PATCH 93/816 bpf: Clamp the trace length in __bpf_get_stack() again

In reply to Greg Kroah-Hartman

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

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

From: Josef Bacik <[email protected]>

[ 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")
---
 kernel/bpf/stackmap.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
kernel/bpf/stackmap.c +17 -7
index e57f092437800..d38d8e49a789d 100644
@@ -573,14 +573,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 = callchain_store(trace, trace->nr, buf, elem_size, flags);
+	/*
+	 * 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 should not be dereferenced after this point */
 	if (may_fault)
@@ -589,6 +595,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:
Signature · 1 line
2.53.0
author maintainer
#95 lore raw

PATCH 94/816 bpf: Avoid changing callchain in bpf_get_stackid_pe

In reply to Greg Kroah-Hartman

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

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

From: Jiri Olsa <[email protected]>

[ 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

Stable-dep-of: a08ba2ab79df ("bpf: Clamp the trace length before the skip test in stackid_init()")

---
 kernel/bpf/stackmap.c | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)
kernel/bpf/stackmap.c +17 -22
index d38d8e49a789d..43e27cd278c4a 100644
@@ -253,7 +253,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;
@@ -262,21 +262,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;
@@ -284,11 +284,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;
 
@@ -387,7 +388,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;
 
@@ -423,12 +424,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 */
@@ -448,13 +450,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;
@@ -462,21 +464,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 = {
Signature · 1 line
2.53.0
author maintainer
#96 lore raw

PATCH 95/816 bpf: Clamp the trace length before the skip test in stackid_init()

In reply to Greg Kroah-Hartman

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

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

From: Alexei Starovoitov <[email protected]>

[ 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()")
---
 kernel/bpf/stackmap.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/stackmap.c +6 -3
index 43e27cd278c4a..5baf657ccb785 100644
@@ -268,12 +268,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);
@@ -388,7 +390,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;
 
Signature · 1 line
2.53.0
author maintainer
#97 lore raw

PATCH 96/816 bpf: Refuse to map an arena at address 0

In reply to Greg Kroah-Hartman

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

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

From: Alexei Starovoitov <[email protected]>

[ 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.")
---
 kernel/bpf/arena.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/bpf/arena.c +3 -0
index c62c6f261ca07..598920ac256dc 100644
@@ -341,6 +341,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))
Signature · 1 line
2.53.0
author maintainer
#98 lore raw

PATCH 97/816 bpf: Refuse an arena mmap() longer than max_entries pages

In reply to Greg Kroah-Hartman

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

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

From: Alexei Starovoitov <[email protected]>

[ 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.")
---
 kernel/bpf/arena.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/arena.c +2 -2
index 598920ac256dc..345c77f7cd2b5 100644
@@ -325,7 +325,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 */
@@ -373,7 +373,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))
Signature · 1 line
2.53.0
author maintainer
#99 lore raw

PATCH 98/816 bpf: Remove the WARN from arena_get_unmapped_area()

In reply to Greg Kroah-Hartman

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

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

From: Alexei Starovoitov <[email protected]>

[ 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.")
---
 kernel/bpf/arena.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/bpf/arena.c +0 -3
index 345c77f7cd2b5..5daffb7167925 100644
@@ -346,9 +346,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);
 }
 
Signature · 1 line
2.53.0
author maintainer
#100 lore raw

PATCH 99/816 bpf: Require prog fd or capability for cgroup detach

In reply to Greg Kroah-Hartman

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

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

From: Chris Mason <[email protected]>

[ 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.

---
 kernel/bpf/cgroup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/bpf/cgroup.c +7 -2
index bd47c4cb19910..f075f3a8cda30 100644
@@ -1071,9 +1071,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)
Signature · 1 line
2.53.0