6.7.6-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 6.7.6-rc1 review
This is the start of the stable review cycle for the 6.7.6 release. There are 309 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 22 Feb 2024 20:55:42 +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.7.6-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.7.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.7.6-rc1
NeilBrown <[email protected]>
nfsd: don't take fi_lock in nfsd_break_deleg_cb()
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: Missing gc cancellations fixed
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: fix performance regression in swap operation
Mark Brown <[email protected]>
usb: typec: tpcm: Fix issues with power being removed during reset
Damien Le Moal <[email protected]>
block: fix partial zone append completion handling in req_bio_endio()
Junxiao Bi <[email protected]>
md: bypass block throttle for superblock update
Steven Rostedt (Google) <[email protected]>
tracing: Inform kmemleak of saved_cmdlines allocation
Petr Pavlu <[email protected]>
tracing: Fix HAVE_DYNAMIC_FTRACE_WITH_REGS ifdef
Oleg Nesterov <[email protected]>
fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats
Oleg Nesterov <[email protected]>
fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of lock_task_sighand()
Konrad Dybcio <[email protected]>
pmdomain: core: Move the unused cleanup to a _sync initcall
Oleksij Rempel <[email protected]>
can: j1939: Fix UAF in j1939_sk_match_filter during setsockopt(SO_J1939_FILTER)
Ziqi Zhao <[email protected]>
can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock
Maxime Jayat <[email protected]>
can: netlink: Fix TDCO calculation using the old data bittiming
Maximilian Heyne <[email protected]>
xen/events: close evtchn after mapping cleanup
Nuno Sa <[email protected]>
of: property: fix typo in io-channels
Vegard Nossum <[email protected]>
docs: kernel_feat.py: fix build error for missing files
Jan Kara <[email protected]>
blk-wbt: Fix detection of dirty-throttled tasks
Huacai Chen <[email protected]>
LoongArch: Fix earlycon parameter if KASAN enabled
Prakash Sangappa <[email protected]>
mm: hugetlb pages should not be reserved by shmat() if SHM_NORESERVE
Oscar Salvador <[email protected]>
fs,hugetlb: fix NULL pointer dereference in hugetlbs_fill_super
Dave Airlie <[email protected]>
nouveau/gsp: use correct size for registry rpc.
Rishabh Dave <[email protected]>
ceph: prevent use-after-free in encode_cap_msg()
Shradha Gupta <[email protected]>
hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed
Petr Tesarik <[email protected]>
net: stmmac: protect updates of 64-bit statistics counters
Jan Kiszka <[email protected]>
riscv/efistub: Ensure GP-relative addressing is not used
Geert Uytterhoeven <[email protected]>
pmdomain: renesas: r8a77980-sysc: CR7 must be always on
Sinthu Raja <[email protected]>
net: ethernet: ti: cpsw_new: enable mac_managed_pm to fix mdio
SeongJae Park <[email protected]>
mm/damon/sysfs-schemes: fix wrong DAMOS tried regions update timeout setup
Alexandra Winter <[email protected]>
s390/qeth: Fix potential loss of L3-IP@ in case of network issues
Sinthu Raja <[email protected]>
net: ethernet: ti: cpsw: enable mac_managed_pm to fix mdio
Christian Brauner <[email protected]>
fs: relax mount_setattr() permission checks
Daniel Bristot de Oliveira <[email protected]>
tools/rtla: Fix Makefile compiler options for clang
Daniel Bristot de Oliveira <[email protected]>
tools/rtla: Fix uninitialized bucket/data->bucket_size warning
John Kacur <[email protected]>
tools/rtla: Exit with EXIT_SUCCESS when help is invoked
Daniel Bristot de Oliveira <[email protected]>
tools/rtla: Fix clang warning about mount_point var size
limingming3 <[email protected]>
tools/rtla: Replace setting prio with nice for SCHED_OTHER
Daniel Bristot de Oliveira <[email protected]>
tools/rtla: Remove unused sched_getattr() function
Daniel Bristot de Oliveira <[email protected]>
tools/rv: Fix Makefile compiler options for clang
Daniel Bristot de Oliveira <[email protected]>
tools/rv: Fix curr_reactor uninitialized variable
Mario Limonciello <[email protected]>
ASoC: amd: yc: Add DMI quirk for Lenovo Ideapad Pro 5 16ARP8
Gergo Koteles <[email protected]>
ASoC: tas2781: add module parameter to tascodec_init()
Curtis Malainey <[email protected]>
ASoC: SOF: IPC3: fix message bounds on ipc ops
Easwar Hariharan <[email protected]>
arm64: Subscribe Microsoft Azure Cobalt 100 to ARM Neoverse N2 errata
Mark Brown <[email protected]>
arm64/signal: Don't assume that TIF_SVE means we saved SVE state
Fred Ai <[email protected]>
mmc: sdhci-pci-o2micro: Fix a warm reboot issue that disk can't be detected by BIOS
Damien Le Moal <[email protected]>
zonefs: Improve error handling
Sebastian Ene <[email protected]>
KVM: arm64: Fix circular locking dependency
Christian Borntraeger <[email protected]>
KVM: s390: vsie: fix race during shadow creation
Steve French <[email protected]>
smb: Fix regression in writes when non-standard maximum write size negotiated
Paulo Alcantara <[email protected]>
smb: client: set correct id, uid and cruid for multiuser automounts
Mohammad Rahimi <[email protected]>
thunderbolt: Fix setting the CNS bit in ROUTER_CS_5
Marc Zyngier <[email protected]>
irqchip/gic-v3-its: Fix GICv4.1 VPE affinity update
Marc Zyngier <[email protected]>
irqchip/gic-v3-its: Restore quirk probing for ACPI-based systems
Doug Berger <[email protected]>
irqchip/irq-brcmstb-l2: Add write memory barrier before exit
Dan Carpenter <[email protected]>
PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
Emmanuel Grumbach <[email protected]>
wifi: iwlwifi: mvm: fix a crash when we run out of stations
Johannes Berg <[email protected]>
wifi: mac80211: reload info pointer in ieee80211_tx_dequeue()
Johannes Berg <[email protected]>
wifi: cfg80211: fix wiphy delayed work queueing
Johannes Berg <[email protected]>
wifi: iwlwifi: fix double-free bug
Daniel de Villiers <[email protected]>
nfp: flower: prevent re-adding mac index for bonded port
James Hershaw <[email protected]>
nfp: enable NETDEV_XDP_ACT_REDIRECT feature flag
Daniel Basilio <[email protected]>
nfp: use correct macro for LengthSelect in BAR config
Herbert Xu <[email protected]>
crypto: algif_hash - Remove bogus SGL free on zero-length error path
Kim Phillips <[email protected]>
crypto: ccp - Fix null pointer dereference in __sev_platform_shutdown_locked
Ryusuke Konishi <[email protected]>
nilfs2: fix hang in nilfs_lookup_dirty_data_buffers()
Ryusuke Konishi <[email protected]>
nilfs2: fix data corruption in dsync block recovery for small block sizes
Shuming Fan <[email protected]>
ALSA: hda/realtek: add IDs for Dell dual spk platform
bo liu <[email protected]>
ALSA: hda/conexant: Add quirk for SWS JS201D
Eniac Zhang <[email protected]>
ALSA: hda/realtek: fix mute/micmute LED For HP mt645
Krzysztof Kozlowski <[email protected]>
gpiolib: add gpiod_to_gpio_device() stub for !GPIOLIB
Krzysztof Kozlowski <[email protected]>
gpiolib: add gpio_device_get_base() stub for !GPIOLIB
Alexander Stein <[email protected]>
mmc: slot-gpio: Allow non-sleeping GPIO ro
Jens Axboe <[email protected]>
io_uring/net: fix multishot accept overflow handling
Steve Wahl <[email protected]>
x86/mm/ident_map: Use gbpages only where full GB page should be mapped.
Mingwei Zhang <[email protected]>
KVM: x86/pmu: Fix type length error when reading pmu->fixed_ctr_ctrl
Prasad Pandit <[email protected]>
KVM: x86: make KVM_REQ_NMI request iff NMI pending for vcpu
Andrei Vagin <[email protected]>
x86/fpu: Stop relying on userspace for info to fault in xsave buffer
Aleksander Mazur <[email protected]>
x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6
Jiri Slaby (SUSE) <[email protected]>
serial: mxs-auart: fix tx
Jiri Slaby (SUSE) <[email protected]>
serial: core: introduce uart_port_tx_flags()
Shrikanth Hegde <[email protected]>
powerpc/pseries: fix accuracy of stolen time
David Engraf <[email protected]>
powerpc/cputable: Add missing PPC_FEATURE_BOOKE on PPC64 Book-E
Naveen N Rao <[email protected]>
powerpc/64: Set task pt_regs->link to the LR value on scv entry
Masami Hiramatsu (Google) <[email protected]>
ftrace: Fix DIRECT_CALLS to use SAVE_REGS by default
Hugo Villeneuve <[email protected]>
serial: max310x: prevent infinite while() loop in port startup
Hugo Villeneuve <[email protected]>
serial: max310x: fail probe if clock crystal is unstable
Hugo Villeneuve <[email protected]>
serial: max310x: improve crystal stable clock detection
Hugo Villeneuve <[email protected]>
serial: max310x: set default value when reading clock ready bit
Gui-Dong Han <[email protected]>
serial: core: Fix atomicity violation in uart_tiocmget
Hui Zhou <[email protected]>
nfp: flower: fix hardware offload for the transfer layer port
Hui Zhou <[email protected]>
nfp: flower: add hardware offload check for post ct entry
Andrew Lunn <[email protected]>
net: dsa: mv88e6xxx: Fix failed probe due to unsupported C45 reads
Vincent Donnefort <[email protected]>
ring-buffer: Clean ring_buffer_poll_wait() error return
Souradeep Chakrabarti <[email protected]>
hv_netvsc: Fix race condition between netvsc_probe and netvsc_remove
Lijo Lazar <[email protected]>
drm/amdgpu: Avoid fetching VRAM vendor info
Tom Chung <[email protected]>
drm/amd/display: Preserve original aspect ratio in create stream
Roman Li <[email protected]>
drm/amd/display: Fix array-index-out-of-bounds in dcn35_clkmgr
Nathan Chancellor <[email protected]>
drm/amd/display: Increase frame-larger-than for all display_mode_vba files
Fangzhi Zuo <[email protected]>
drm/amd/display: Fix MST Null Ptr for RV
Thong <[email protected]>
drm/amdgpu/soc21: update VCN 4 max HEVC encoding resolution
Philip Yang <[email protected]>
drm/prime: Support page array >= 4GB
Ville Syrjälä <[email protected]>
drm/i915/dp: Limit SST link rate to <=8.1Gbps
Zhikai Zhai <[email protected]>
drm/amd/display: Add align done check
Rob Clark <[email protected]>
drm/msm: Wire up tlb ops
Arunpravin Paneer Selvam <[email protected]>
drm/buddy: Fix alloc_range() error handling code
Timur Tabi <[email protected]>
drm/nouveau: fix several DMA buffer leaks
Fedor Pchelkin <[email protected]>
ksmbd: free aux buffer if ksmbd_iov_pin_rsp_read fails
Oleg Nesterov <[email protected]>
getrusage: use sig->stats_lock rather than lock_task_sighand()
Oleg Nesterov <[email protected]>
getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand()
Steven Rostedt (Google) <[email protected]>
eventfs: Keep all directory links at 1
Steven Rostedt (Google) <[email protected]>
eventfs: Remove fsnotify*() functions from lookup()
Steven Rostedt (Google) <[email protected]>
eventfs: Restructure eventfs_inode structure to be more condensed
Steven Rostedt (Google) <[email protected]>
eventfs: Warn if an eventfs_inode is freed without is_freed being set
Linus Torvalds <[email protected]>
eventfs: Get rid of dentry pointers without refcounts
Linus Torvalds <[email protected]>
eventfs: Clean up dentry ops and add revalidate function
Linus Torvalds <[email protected]>
eventfs: Remove unused d_parent pointer field
Linus Torvalds <[email protected]>
tracefs: dentry lookup crapectomy
Linus Torvalds <[email protected]>
tracefs: Avoid using the ei->dentry pointer unnecessarily
Linus Torvalds <[email protected]>
eventfs: Initialize the tracefs inode properly
Steven Rostedt (Google) <[email protected]>
tracefs: Zero out the tracefs_inode when allocating it
Steven Rostedt (Google) <[email protected]>
eventfs: Save directory inodes in the eventfs_inode structure
Erick Archer <[email protected]>
eventfs: Use kcalloc() instead of kzalloc()
Steven Rostedt (Google) <[email protected]>
eventfs: Do not create dentries nor inodes in iterate_shared
Steven Rostedt (Google) <[email protected]>
eventfs: Have the inodes all for files and directories all be the same
Steven Rostedt (Google) <[email protected]>
eventfs: Shortcut eventfs_iterate() by skipping entries already read
Steven Rostedt (Google) <[email protected]>
eventfs: Read ei->entries before ei->children in eventfs_iterate()
Steven Rostedt (Google) <[email protected]>
eventfs: Do ctx->pos update for all iterations in eventfs_iterate()
Steven Rostedt (Google) <[email protected]>
eventfs: Have eventfs_iterate() stop immediately if ei->is_freed is set
Steven Rostedt (Google) <[email protected]>
eventfs: Stop using dcache_readdir() for getdents()
Steven Rostedt (Google) <[email protected]>
eventfs: Remove "lookup" parameter from create_dir/file_dentry()
Sean Young <[email protected]>
media: rc: bpf attach/detach requires write permission
Eugen Hristev <[email protected]>
pmdomain: mediatek: fix race conditions with genpd
Sam Protsenko <[email protected]>
iio: pressure: bmp280: Add missing bmp085 to SPI id table
Randy Dunlap <[email protected]>
iio: imu: bno055: serdev requires REGMAP
Nuno Sa <[email protected]>
iio: imu: adis: ensure proper DMA alignment
Nuno Sa <[email protected]>
iio: adc: ad_sigma_delta: ensure proper DMA alignment
Mario Limonciello <[email protected]>
iio: accel: bma400: Fix a compilation problem
Nuno Sa <[email protected]>
iio: commom: st_sensors: ensure proper DMA alignment
Dinghao Liu <[email protected]>
iio: core: fix memleak in iio_device_register_sysfs
zhili.liu <[email protected]>
iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC
David Schiller <[email protected]>
staging: iio: ad5933: fix type mismatch regression
Tejun Heo <[email protected]>
Revert "workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()"
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to search structure fields correctly
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to set arg size and fmt after setting type from BTF
Masami Hiramatsu (Google) <[email protected]>
tracing/probes: Fix to show a parse error for bad type for $comm
Thorsten Blum <[email protected]>
tracing/synthetic: Fix trace_string() return value
Steven Rostedt (Google) <[email protected]>
tracing: Fix wasted memory in saved_cmdlines logic
Daniel Bristot de Oliveira <[email protected]>
tracing/timerlat: Move hrtimer_init to timerlat_fd open()
Baokun Li <[email protected]>
ext4: avoid bb_free and bb_fragments inconsistency in mb_free_blocks()
Baokun Li <[email protected]>
ext4: fix double-free of blocks due to wrong extents moved_len
Ekansh Gupta <[email protected]>
misc: fastrpc: Mark all sessions as invalid in cb_remove
Carlos Llamas <[email protected]>
binder: signal epoll threads of self-work
Andy Chi <[email protected]>
ALSA: hda/realtek: fix mute/micmute LEDs for HP ZBook Power
Vitaly Rodionov <[email protected]>
ALSA: hda/cs8409: Suppress vmaster control for Dolphin models
Krzysztof Kozlowski <[email protected]>
ASoC: codecs: wcd938x: handle deferred probe
Kailang Yang <[email protected]>
ALSA: hda/realtek - Add speaker pin verbtable for Dell dual speaker platform
Edson Juliano Drosdeck <[email protected]>
ALSA: hda/realtek: Enable headset mic on Vaio VJFE-ADL
Nathan Chancellor <[email protected]>
modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS
Nathan Chancellor <[email protected]>
um: Fix adding '-no-pie' for clang
Jan Beulich <[email protected]>
xen-netback: properly sync TX responses
Helge Deller <[email protected]>
parisc: BTLB: Fix crash when setting up BTLB at CPU bringup
Helge Deller <[email protected]>
parisc: Fix random data corruption from exception handler
Esben Haabendal <[email protected]>
net: stmmac: do not clear TBS enable bit on link up/down
Nikita Zhandarovich <[email protected]>
net: hsr: remove WARN_ONCE() in send_hsr_supervision_frame()
Fedor Pchelkin <[email protected]>
nfc: nci: free rx_data_reassembly skb on NCI device cleanup
Nathan Chancellor <[email protected]>
kbuild: Fix changing ELF file type for output of gen_btf for big endian
José Relvas <[email protected]>
ALSA: hda/realtek: Apply headset jack quirk for non-bass alc287 thinkpads
Takashi Sakamoto <[email protected]>
firewire: core: correct documentation of fw_csr_string() kernel API
Ondrej Mosnacek <[email protected]>
lsm: fix the logic in security_inode_getsecctx()
Ondrej Mosnacek <[email protected]>
lsm: fix default return value of the socket_getpeersec_*() hooks
Fangzhi Zuo <[email protected]>
drm/amd/display: Fix dcn35 8k30 Underflow/Corruption Issue
Wenjing Liu <[email protected]>
drm/amd/display: fix incorrect mpc_combine array size
David McFarland <[email protected]>
drm/amd: Don't init MEC2 firmware when it fails to load
Friedrich Vock <[email protected]>
drm/amdgpu: Reset IH OVERFLOW_CLEAR bit
Sebastian Ott <[email protected]>
drm/virtio: Set segment size for virtio_gpu device
Vaishnav Achath <[email protected]>
spi: omap2-mcspi: Revert FIFO support without DMA
Keqi Wang <[email protected]>
connector/cn_proc: revert "connector: Fix proc_event_num_listeners count not cleared"
Rob Clark <[email protected]>
Revert "drm/msm/gpu: Push gpu lock down past runpm"
Mario Limonciello <[email protected]>
Revert "drm/amd: flush any delayed gfxoff on suspend entry"
Lee Duncan <[email protected]>
scsi: Revert "scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock"
Tomi Valkeinen <[email protected]>
media: Revert "media: rkisp1: Drop IRQF_SHARED"
Michael Ellerman <[email protected]>
Revert "powerpc/pseries/iommu: Fix iommu initialisation during DLPAR add"
Paolo Abeni <[email protected]>
mptcp: really cope with fastopen race
Geliang Tang <[email protected]>
mptcp: check addrs list in userspace_pm_get_local_id
Paolo Abeni <[email protected]>
mptcp: fix rcv space initialization
Paolo Abeni <[email protected]>
mptcp: drop the push_pending field
Geliang Tang <[email protected]>
selftests: mptcp: add mptcp_lib_kill_wait
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: allow changing subtests prefix
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: increase timeout to 30 min
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: add missing kconfig for NF Mangle
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: add missing kconfig for NF Filter in v6
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: add missing kconfig for NF Filter
Paolo Abeni <[email protected]>
mptcp: fix data re-injection from stale subflow
Arnd Bergmann <[email protected]>
kallsyms: ignore ARMv4 thunks along with others
Radek Krejci <[email protected]>
modpost: trim leading spaces when processing source files list
Jean Delvare <[email protected]>
i2c: i801: Fix block process call transactions
Arnd Bergmann <[email protected]>
i2c: pasemi: split driver into two separate modules
Shivaprasad G Bhat <[email protected]>
powerpc/iommu: Fix the missing iommu_group_put() during platform domain attach
Michael Ellerman <[email protected]>
powerpc/kasan: Limit KASAN thread size increase to 32KB
Marc Zyngier <[email protected]>
irqchip/gic-v3-its: Handle non-coherent GICv4 redistributors
Bibo Mao <[email protected]>
irqchip/loongson-eiointc: Use correct struct type in eiointc_domain_alloc()
Viken Dadhaniya <[email protected]>
i2c: qcom-geni: Correct I2C TRE sequence
Dan Carpenter <[email protected]>
cifs: fix underflow in parse_server_interfaces()
Cosmin Tanislav <[email protected]>
iio: adc: ad4130: only set GPIO_CTRL if pin is unused
Cosmin Tanislav <[email protected]>
iio: adc: ad4130: zero-initialize clock init data
Alex Williamson <[email protected]>
PCI: Fix active state requirement in PME polling
Greg Kroah-Hartman <[email protected]>
Revert "kobject: Remove redundant checks for whether ktype is NULL"
Jiangfeng Xiao <[email protected]>
powerpc/kasan: Fix addr error caused by page alignment
Matthias Schiffer <[email protected]>
powerpc/6xx: set High BAT Enable flag on G2_LE cores
Gaurav Batra <[email protected]>
powerpc/pseries/iommu: Fix iommu initialisation during DLPAR add
Saravana Kannan <[email protected]>
driver core: fw_devlink: Improve detection of overlapping cycles
Zhipeng Lu <[email protected]>
media: ir_toy: fix a memleak in irtoy_tx
Konrad Dybcio <[email protected]>
interconnect: qcom: sm8550: Enable sync_state
Konrad Dybcio <[email protected]>
interconnect: qcom: sc8180x: Mark CO0 BCM keepalive
Uttkarsh Aggarwal <[email protected]>
usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
Udipto Goswami <[email protected]>
usb: core: Prevent null pointer dereference in update_port_device_state
Xu Yang <[email protected]>
usb: chipidea: core: handle power lost in workqueue
yuan linyu <[email protected]>
usb: f_mass_storage: forbid async queue when shutdown happen
Oliver Neukum <[email protected]>
USB: hub: check for alternate port before enabling A_ALT_HNP_SUPPORT
Christian A. Ehrhardt <[email protected]>
usb: ucsi_acpi: Fix command completion handling
Sean Anderson <[email protected]>
usb: ulpi: Fix debugfs directory leak
Christian A. Ehrhardt <[email protected]>
usb: ucsi: Add missing ppm_lock
Srinivas Pandruvada <[email protected]>
iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP
Jason Gerecke <[email protected]>
HID: wacom: Do not register input devices until after hid_hw_start
Tatsunosuke Tobita <[email protected]>
HID: wacom: generic: Avoid reporting a serial of '0' to userspace
Johan Hovold <[email protected]>
HID: i2c-hid-of: fix NULL-deref on failed power up
Benjamin Tissoires <[email protected]>
HID: bpf: actually free hdev memory after attaching a HID-BPF program
Benjamin Tissoires <[email protected]>
HID: bpf: remove double fdget()
Luka Guzenko <[email protected]>
ALSA: hda/realtek: Enable Mute LED on HP Laptop 14-fq0xxx
David Senoner <[email protected]>
ALSA: hda/realtek: Fix the external mic not being recognised for Acer Swift 1 SF114-32
Helge Deller <[email protected]>
parisc: Prevent hung tasks when printing inventory on serial console
Techno Mooney <[email protected]>
ASoC: amd: yc: Add DMI quirk for MSI Bravo 15 C7VF
Mikulas Patocka <[email protected]>
dm-crypt, dm-verity: disable tasklets
Dave Airlie <[email protected]>
nouveau: offload fence uevents work to workqueue
Michael Kelley <[email protected]>
scsi: storvsc: Fix ring buffer size calculation
Nico Pache <[email protected]>
selftests: mm: fix map_hugetlb failure on 64K page size systems
Audra Mitchell <[email protected]>
selftests/mm: Update va_high_addr_switch.sh to check CPU for la57 flag
Zach O'Keefe <[email protected]>
mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
Jan Kara <[email protected]>
readahead: avoid multiple marked readahead pages
Muhammad Usama Anjum <[email protected]>
selftests/mm: switch to bash from sh
Sidhartha Kumar <[email protected]>
fs/hugetlbfs/inode.c: mm/memory-failure.c: fix hugetlbfs hwpoison handling
Masami Hiramatsu (Google) <[email protected]>
tracing/trigger: Fix to return error if failed to alloc snapshot
Samuel Holland <[email protected]>
scs: add CONFIG_MMU dependency for vfree_atomic()
Ryan Roberts <[email protected]>
selftests/mm: ksm_tests should only MADV_HUGEPAGE valid memory
Lokesh Gidra <[email protected]>
userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb
Ryan Roberts <[email protected]>
mm: thp_get_unmapped_area must honour topdown preference
Ivan Vecera <[email protected]>
i40e: Fix waiting for queues of all VSIs to be disabled
Ivan Vecera <[email protected]>
i40e: Do not allow untrusted VF to remove administratively set MAC
Jiaxun Yang <[email protected]>
mm/memory: Use exception ip to search exception tables
Jiaxun Yang <[email protected]>
ptrace: Introduce exception_ip arch hook
Guenter Roeck <[email protected]>
MIPS: Add 'memory' clobber to csum_ipv6_magic() inline assembler
Arnd Bergmann <[email protected]>
nouveau/svm: fix kvcalloc() argument order
Breno Leitao <[email protected]>
net: sysfs: Fix /sys/class/net/<iface> path for statistics
Manasi Navare <[email protected]>
drm/i915/dsc: Fix the macro that calculates DSCC_/DSCA_ PPS reg address
Alexey Khoroshilov <[email protected]>
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
Uwe Kleine-König <[email protected]>
spi: ppc4xx: Drop write-only variable
Jakub Kicinski <[email protected]>
net: tls: fix returned read length with async decrypt
Sabrina Dubroca <[email protected]>
net: tls: fix use-after-free with partial reads and async decrypt
Jakub Kicinski <[email protected]>
net: tls: handle backlogging of crypto requests
Jakub Kicinski <[email protected]>
tls: fix race between tx work scheduling and socket close
Jakub Kicinski <[email protected]>
tls: fix race between async notify and socket close
Jakub Kicinski <[email protected]>
net: tls: factor out tls_*crypt_async_wait()
Horatiu Vultur <[email protected]>
lan966x: Fix crash when adding interface under a lag
Aaron Conole <[email protected]>
net: openvswitch: limit the number of recursions from action sets
Ido Schimmel <[email protected]>
selftests: forwarding: Fix bridge locked port test flakiness
Ido Schimmel <[email protected]>
selftests: forwarding: Suppress grep warnings
Ido Schimmel <[email protected]>
selftests: forwarding: Fix bridge MDB test flakiness
Ido Schimmel <[email protected]>
selftests: forwarding: Fix layer 2 miss test flakiness
Ido Schimmel <[email protected]>
selftests: net: Fix bridge backup port test flakiness
Hangbin Liu <[email protected]>
selftests/net: convert test_bridge_backup_port.sh to run it in unique namespace
Hojin Nam <[email protected]>
perf: CXL: fix mismatched cpmu event opcode
Lukas Bulwahn <[email protected]>
ALSA: hda/cs35l56: select intended config FW_CS_DSP
Saravana Kannan <[email protected]>
of: property: Improve finding the supplier of a remote-endpoint property
Saravana Kannan <[email protected]>
of: property: Improve finding the consumer of a remote-endpoint property
Parav Pandit <[email protected]>
devlink: Fix command annotation documentation
Magnus Karlsson <[email protected]>
bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
Chuck Lever <[email protected]>
net/handshake: Fix handshake_req_destroy_test1
Jiri Pirko <[email protected]>
net/mlx5: DPLL, Fix possible use after free after delayed work timer triggers
Jiri Pirko <[email protected]>
dpll: fix possible deadlock during netlink dump operation
Ranjani Sridharan <[email protected]>
ASoC: SOF: ipc3-topology: Fix pipeline tear down logic
Dan Carpenter <[email protected]>
wifi: iwlwifi: uninitialized variable in iwl_acpi_get_ppag_table()
Dan Carpenter <[email protected]>
wifi: iwlwifi: Fix some error codes
Miri Korenblit <[email protected]>
wifi: iwlwifi: clear link_id in time_event
Amadeusz Sławiński <[email protected]>
ASoC: Intel: avs: Fix dynamic port assignment when TDM is set
Carlos Song <[email protected]>
spi: imx: fix the burst length at DMA mode and CPU mode
Cezary Rojewski <[email protected]>
ASoC: Intel: avs: Fix pci_probe() error path
Mickaël Salaün <[email protected]>
selftests/landlock: Fix capability for net_test
Rob Clark <[email protected]>
drm/msm/gem: Fix double resv lock aquire
Christian A. Ehrhardt <[email protected]>
of: unittest: Fix compile in the non-dynamic case
Hu Yadi <[email protected]>
selftests/landlock: Fix fs_test build with old libc
Hu Yadi <[email protected]>
selftests/landlock: Fix net_test build with old libc
Nícolas F. R. A. Prado <[email protected]>
kselftest: dt: Stop relying on dirname to improve performance
Saravana Kannan <[email protected]>
driver core: Fix device_link_flag_is_sync_state_only()
Josef Bacik <[email protected]>
btrfs: don't drop extent_map for free space inode on write error
Filipe Manana <[email protected]>
btrfs: reject encoded write if inode has nodatasum flag set
Filipe Manana <[email protected]>
btrfs: don't reserve space for checksums when writing to nocow files
David Sterba <[email protected]>
btrfs: send: return EOPNOTSUPP on unknown flags
Boris Burkov <[email protected]>
btrfs: forbid deleting live subvol qgroup
Qu Wenruo <[email protected]>
btrfs: do not ASSERT() if the newly created subvolume already got read
Boris Burkov <[email protected]>
btrfs: forbid creating subvol qgroups
Filipe Manana <[email protected]>
btrfs: don't refill whole delayed refs block reserve when starting transaction
Filipe Manana <[email protected]>
btrfs: add new unused block groups to the list of unused block groups
Filipe Manana <[email protected]>
btrfs: do not delete unused block group if it may be used soon
Filipe Manana <[email protected]>
btrfs: add and use helper to check if block group is used
Yang Shi <[email protected]>
mm: mmap: map MAP_STACK to VM_NOHUGEPAGE
Yang Shi <[email protected]>
mm: huge_memory: don't force huge page alignment on 32 bit
Linus Torvalds <[email protected]>
update workarounds for gcc "asm goto" issue
Linus Torvalds <[email protected]>
work around gcc bugs with 'asm goto' with outputs
-------------
Diffstat:
.../ABI/testing/sysfs-class-net-statistics | 48 +- Documentation/arch/arm64/silicon-errata.rst | 7 + Documentation/netlink/specs/dpll.yaml | 4 - Documentation/networking/devlink/devlink-port.rst | 2 +- Documentation/sphinx/kernel_feat.py | 2 +- Makefile | 4 +- arch/Kconfig | 1 + arch/arc/include/asm/jump_label.h | 4 +- arch/arm/include/asm/jump_label.h | 4 +- arch/arm64/include/asm/alternative-macros.h | 4 +- arch/arm64/include/asm/cputype.h | 4 + arch/arm64/include/asm/jump_label.h | 4 +- arch/arm64/kernel/cpu_errata.c | 3 + arch/arm64/kernel/fpsimd.c | 2 +- arch/arm64/kernel/signal.c | 4 +- arch/arm64/kvm/pkvm.c | 27 +- arch/csky/include/asm/jump_label.h | 4 +- arch/loongarch/include/asm/jump_label.h | 4 +- arch/loongarch/mm/kasan_init.c | 3 + arch/mips/include/asm/checksum.h | 3 +- arch/mips/include/asm/jump_label.h | 4 +- arch/mips/include/asm/ptrace.h | 2 + arch/mips/kernel/ptrace.c | 7 + arch/parisc/Kconfig | 1 - arch/parisc/include/asm/assembly.h | 1 + arch/parisc/include/asm/extable.h | 64 ++ arch/parisc/include/asm/jump_label.h | 4 +- arch/parisc/include/asm/special_insns.h | 6 +- arch/parisc/include/asm/uaccess.h | 48 +- arch/parisc/kernel/cache.c | 6 +- arch/parisc/kernel/drivers.c | 3 + arch/parisc/kernel/unaligned.c | 44 +- arch/parisc/mm/fault.c | 11 +- arch/powerpc/include/asm/jump_label.h | 4 +- arch/powerpc/include/asm/reg.h | 2 + arch/powerpc/include/asm/thread_info.h | 2 +- arch/powerpc/include/asm/uaccess.h | 12 +- arch/powerpc/kernel/cpu_setup_6xx.S | 20 +- arch/powerpc/kernel/cpu_specs_e500mc.h | 3 +- arch/powerpc/kernel/interrupt_64.S | 4 +- arch/powerpc/kernel/iommu.c | 4 +- arch/powerpc/kernel/irq_64.c | 2 +- arch/powerpc/mm/kasan/init_32.c | 1 + arch/powerpc/platforms/pseries/lpar.c | 8 +- arch/riscv/include/asm/bitops.h | 8 +- arch/riscv/include/asm/cpufeature.h | 4 +- arch/riscv/include/asm/jump_label.h | 4 +- arch/s390/include/asm/jump_label.h | 4 +- arch/s390/kvm/vsie.c | 1 - arch/s390/mm/gmap.c | 1 + arch/sparc/include/asm/jump_label.h | 4 +- arch/um/Makefile | 4 +- arch/um/include/asm/cpufeature.h | 2 +- arch/x86/Kconfig.cpu | 2 +- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/jump_label.h | 6 +- arch/x86/include/asm/rmwcc.h | 2 +- arch/x86/include/asm/special_insns.h | 2 +- arch/x86/include/asm/uaccess.h | 10 +- arch/x86/kernel/fpu/signal.c | 13 +- arch/x86/kvm/svm/svm_ops.h | 6 +- arch/x86/kvm/vmx/pmu_intel.c | 2 +- arch/x86/kvm/vmx/vmx.c | 4 +- arch/x86/kvm/vmx/vmx_ops.h | 6 +- arch/x86/kvm/x86.c | 3 +- arch/x86/mm/ident_map.c | 23 +- arch/xtensa/include/asm/jump_label.h | 4 +- block/blk-mq.c | 9 +- block/blk-wbt.c | 4 +- crypto/algif_hash.c | 5 +- drivers/android/binder.c | 10 + drivers/base/core.c | 15 +- drivers/base/power/domain.c | 2 +- drivers/connector/cn_proc.c | 5 +- drivers/crypto/ccp/sev-dev.c | 10 +- drivers/dpll/dpll_netlink.c | 20 +- drivers/dpll/dpll_nl.c | 4 - drivers/dpll/dpll_nl.h | 2 - drivers/firewire/core-device.c | 7 +- drivers/firmware/efi/libstub/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 +- drivers/gpu/drm/amd/amdgpu/cik_ih.c | 6 + drivers/gpu/drm/amd/amdgpu/cz_ih.c | 5 + drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 - drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 8 - drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 5 + drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 6 + drivers/gpu/drm/amd/amdgpu/ih_v6_1.c | 7 + drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 6 + drivers/gpu/drm/amd/amdgpu/si_ih.c | 6 + drivers/gpu/drm/amd/amdgpu/soc21.c | 4 +- drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 6 + drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 6 + drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 6 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +- .../amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c | 15 +- drivers/gpu/drm/amd/display/dc/dml/Makefile | 6 +- .../gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 2 +- .../amd/display/dc/dml2/dml2_translation_helper.c | 27 +- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 2 + .../display/dc/link/protocols/link_dp_training.c | 5 +- drivers/gpu/drm/drm_buddy.c | 6 + drivers/gpu/drm/drm_prime.c | 2 +- drivers/gpu/drm/i915/display/intel_dp.c | 3 + drivers/gpu/drm/i915/display/intel_vdsc_regs.h | 4 +- drivers/gpu/drm/msm/msm_gem_prime.c | 4 +- drivers/gpu/drm/msm/msm_gpu.c | 11 +- drivers/gpu/drm/msm/msm_iommu.c | 32 +- drivers/gpu/drm/msm/msm_ringbuffer.c | 7 +- drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 2 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 26 +- drivers/gpu/drm/nouveau/nouveau_fence.h | 1 + drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 61 +- drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/hid/bpf/hid_bpf_dispatch.c | 83 ++- drivers/hid/bpf/hid_bpf_dispatch.h | 4 +- drivers/hid/bpf/hid_bpf_jmp_table.c | 40 +- drivers/hid/i2c-hid/i2c-hid-of.c | 1 + drivers/hid/wacom_sys.c | 63 +- drivers/hid/wacom_wac.c | 9 +- drivers/i2c/busses/Makefile | 6 +- drivers/i2c/busses/i2c-i801.c | 4 +- drivers/i2c/busses/i2c-pasemi-core.c | 6 + drivers/i2c/busses/i2c-qcom-geni.c | 16 +- drivers/iio/accel/Kconfig | 2 + drivers/iio/adc/ad4130.c | 12 +- drivers/iio/imu/bno055/Kconfig | 1 + drivers/iio/industrialio-core.c | 5 +- drivers/iio/light/hid-sensor-als.c | 1 + drivers/iio/magnetometer/rm3100-core.c | 10 +- drivers/iio/pressure/bmp280-spi.c | 1 + drivers/interconnect/qcom/sc8180x.c | 1 + drivers/interconnect/qcom/sm8550.c | 1 + drivers/irqchip/irq-brcmstb-l2.c | 5 +- drivers/irqchip/irq-gic-v3-its.c | 62 +- drivers/irqchip/irq-loongson-eiointc.c | 2 +- drivers/md/dm-crypt.c | 38 +- drivers/md/dm-verity-target.c | 26 +- drivers/md/dm-verity.h | 1 - drivers/md/md.c | 7 +- .../media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- drivers/media/rc/bpf-lirc.c | 6 +- drivers/media/rc/ir_toy.c | 2 + drivers/media/rc/lirc_dev.c | 5 +- drivers/media/rc/rc-core-priv.h | 2 +- drivers/misc/fastrpc.c | 2 +- drivers/mmc/core/slot-gpio.c | 6 +- drivers/mmc/host/sdhci-pci-o2micro.c | 30 + drivers/net/bonding/bond_main.c | 5 +- drivers/net/can/dev/netlink.c | 2 +- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 38 +- drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 2 +- .../net/ethernet/microchip/lan966x/lan966x_lag.c | 9 +- .../net/ethernet/netronome/nfp/flower/conntrack.c | 46 +- .../ethernet/netronome/nfp/flower/tunnel_conf.c | 2 +- .../net/ethernet/netronome/nfp/nfp_net_common.c | 1 + .../ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c | 6 +- drivers/net/ethernet/stmicro/stmmac/common.h | 56 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 15 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 15 +- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 15 +- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 15 +- .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 125 +++- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 136 ++-- drivers/net/ethernet/ti/cpsw.c | 2 + drivers/net/ethernet/ti/cpsw_new.c | 3 + drivers/net/hyperv/netvsc.c | 5 +- drivers/net/hyperv/netvsc_drv.c | 82 ++- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 15 +- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 3 + drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 4 + .../net/wireless/intel/iwlwifi/mvm/time-event.c | 3 +- drivers/net/xen-netback/netback.c | 100 ++- drivers/of/property.c | 61 +- drivers/of/unittest.c | 12 +- drivers/pci/controller/dwc/pcie-designware-ep.c | 3 +- drivers/pci/pci.c | 37 +- drivers/perf/cxl_pmu.c | 2 +- drivers/pmdomain/mediatek/mtk-pm-domains.c | 15 +- drivers/pmdomain/renesas/r8a77980-sysc.c | 3 +- drivers/s390/net/qeth_l3_main.c | 9 +- drivers/scsi/fcoe/fcoe_ctlr.c | 20 +- drivers/scsi/storvsc_drv.c | 12 +- drivers/spi/spi-imx.c | 9 +- drivers/spi/spi-omap2-mcspi.c | 137 +--- drivers/spi/spi-ppc4xx.c | 5 - drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- drivers/thunderbolt/tb_regs.h | 2 +- drivers/thunderbolt/usb4.c | 2 +- drivers/tty/serial/max310x.c | 53 +- drivers/tty/serial/mxs-auart.c | 5 +- drivers/tty/serial/serial_core.c | 2 +- drivers/usb/chipidea/ci.h | 2 + drivers/usb/chipidea/core.c | 44 +- drivers/usb/common/ulpi.c | 2 +- drivers/usb/core/hub.c | 46 +- drivers/usb/dwc3/gadget.c | 6 +- drivers/usb/gadget/function/f_mass_storage.c | 20 +- drivers/usb/typec/tcpm/tcpm.c | 3 +- drivers/usb/typec/ucsi/ucsi.c | 2 + drivers/usb/typec/ucsi/ucsi_acpi.c | 17 +- drivers/xen/events/events_base.c | 8 +- fs/btrfs/block-group.c | 80 +- fs/btrfs/block-group.h | 7 + fs/btrfs/delalloc-space.c | 29 +- fs/btrfs/disk-io.c | 13 +- fs/btrfs/inode.c | 26 +- fs/btrfs/ioctl.c | 5 + fs/btrfs/qgroup.c | 14 + fs/btrfs/send.c | 2 +- fs/btrfs/transaction.c | 38 +- fs/ceph/caps.c | 3 +- fs/ext4/mballoc.c | 39 +- fs/ext4/move_extent.c | 6 +- fs/hugetlbfs/inode.c | 21 +- fs/namespace.c | 11 +- fs/nfsd/nfs4state.c | 11 +- fs/nilfs2/file.c | 8 +- fs/nilfs2/recovery.c | 7 +- fs/proc/array.c | 66 +- fs/smb/client/connect.c | 14 +- fs/smb/client/fs_context.c | 11 + fs/smb/client/namespace.c | 16 + fs/smb/client/smb2ops.c | 2 +- fs/smb/server/smb2pdu.c | 8 +- fs/tracefs/event_inode.c | 814 ++++++--------------- fs/tracefs/inode.c | 102 +-- fs/tracefs/internal.h | 46 +- fs/zonefs/file.c | 42 +- fs/zonefs/super.c | 66 +- include/linux/backing-dev-defs.h | 7 +- include/linux/compiler-gcc.h | 20 + include/linux/compiler_types.h | 11 +- include/linux/gpio/driver.h | 12 + include/linux/iio/adc/ad_sigma_delta.h | 4 +- include/linux/iio/common/st_sensors.h | 4 +- include/linux/iio/imu/adis.h | 3 +- include/linux/lsm_hook_defs.h | 4 +- include/linux/mman.h | 1 + include/linux/netfilter/ipset/ip_set.h | 4 + include/linux/ptrace.h | 4 + include/linux/serial_core.h | 32 +- include/net/tls.h | 5 - include/sound/tas2781.h | 1 + init/Kconfig | 9 + io_uring/net.c | 5 +- kernel/sys.c | 54 +- kernel/trace/ftrace.c | 10 + kernel/trace/ring_buffer.c | 2 +- kernel/trace/trace.c | 78 +- kernel/trace/trace_btf.c | 4 +- kernel/trace/trace_events_synth.c | 3 +- kernel/trace/trace_events_trigger.c | 6 +- kernel/trace/trace_osnoise.c | 6 +- kernel/trace/trace_probe.c | 32 +- kernel/trace/trace_probe.h | 3 +- kernel/workqueue.c | 8 +- lib/kobject.c | 24 +- mm/backing-dev.c | 2 +- mm/damon/sysfs-schemes.c | 2 +- mm/huge_memory.c | 14 +- mm/memory-failure.c | 2 +- mm/memory.c | 4 +- mm/mmap.c | 6 +- mm/page-writeback.c | 4 +- mm/readahead.c | 4 +- mm/userfaultfd.c | 15 +- net/can/j1939/j1939-priv.h | 3 +- net/can/j1939/main.c | 2 +- net/can/j1939/socket.c | 46 +- net/handshake/handshake-test.c | 5 +- net/hsr/hsr_device.c | 4 +- net/mac80211/tx.c | 5 +- net/mptcp/pm_userspace.c | 13 +- net/mptcp/protocol.c | 25 +- net/mptcp/protocol.h | 7 +- net/mptcp/subflow.c | 4 +- net/netfilter/ipset/ip_set_bitmap_gen.h | 14 +- net/netfilter/ipset/ip_set_core.c | 39 +- net/netfilter/ipset/ip_set_hash_gen.h | 19 +- net/netfilter/ipset/ip_set_list_set.c | 13 +- net/netfilter/nft_set_pipapo_avx2.c | 2 +- net/nfc/nci/core.c | 4 + net/openvswitch/flow_netlink.c | 49 +- net/tls/tls_sw.c | 135 ++-- net/wireless/core.c | 3 +- samples/bpf/asm_goto_workaround.h | 8 +- scripts/link-vmlinux.sh | 9 +- scripts/mksysmap | 13 +- scripts/mod/modpost.c | 3 +- scripts/mod/sumversion.c | 7 +- security/security.c | 45 +- sound/pci/hda/Kconfig | 4 +- sound/pci/hda/patch_conexant.c | 18 + sound/pci/hda/patch_cs8409.c | 1 + sound/pci/hda/patch_realtek.c | 20 +- sound/pci/hda/tas2781_hda_i2c.c | 2 +- sound/soc/amd/yc/acp6x-mach.c | 14 + sound/soc/codecs/rt5645.c | 1 + sound/soc/codecs/tas2781-comlib.c | 3 +- sound/soc/codecs/tas2781-i2c.c | 2 +- sound/soc/codecs/wcd938x.c | 2 +- sound/soc/intel/avs/core.c | 3 + sound/soc/intel/avs/topology.c | 2 +- sound/soc/sof/ipc3-topology.c | 69 +- sound/soc/sof/ipc3.c | 2 +- tools/arch/x86/include/asm/rmwcc.h | 2 +- tools/include/linux/compiler_types.h | 4 +- .../testing/selftests/dt/test_unprobed_devices.sh | 13 +- tools/testing/selftests/landlock/common.h | 48 +- tools/testing/selftests/landlock/fs_test.c | 11 +- tools/testing/selftests/landlock/net_test.c | 13 +- .../selftests/mm/charge_reserved_hugetlb.sh | 2 +- tools/testing/selftests/mm/ksm_tests.c | 2 +- tools/testing/selftests/mm/map_hugetlb.c | 7 + tools/testing/selftests/mm/va_high_addr_switch.sh | 6 + tools/testing/selftests/mm/write_hugetlb_memory.sh | 2 +- .../selftests/net/forwarding/bridge_locked_port.sh | 4 +- .../testing/selftests/net/forwarding/bridge_mdb.sh | 14 +- .../selftests/net/forwarding/tc_flower_l2_miss.sh | 8 +- tools/testing/selftests/net/mptcp/config | 3 + tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 +- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 11 +- tools/testing/selftests/net/mptcp/settings | 2 +- tools/testing/selftests/net/mptcp/userspace_pm.sh | 31 +- .../selftests/net/test_bridge_backup_port.sh | 394 +++++----- tools/tracing/rtla/Makefile | 7 +- tools/tracing/rtla/src/osnoise_hist.c | 9 +- tools/tracing/rtla/src/osnoise_top.c | 6 +- tools/tracing/rtla/src/timerlat_hist.c | 9 +- tools/tracing/rtla/src/timerlat_top.c | 6 +- tools/tracing/rtla/src/utils.c | 14 +- tools/tracing/rtla/src/utils.h | 2 + tools/verification/rv/Makefile | 7 +- tools/verification/rv/src/in_kernel.c | 2 +- 340 files changed, 3297 insertions(+), 2530 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/309 work around gcc bugs with asm goto with outputs
6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 4356e9f841f7fbb945521cef3577ba394c65f3fc upstream.
We've had issues with gcc and 'asm goto' before, and we created a 'asm_volatile_goto()' macro for that in the past: see commits 3f0116c3238a ("compiler/gcc4: Add quirk for 'asm goto' miscompilation bug") and a9f180345f53 ("compiler/gcc4: Make quirk for asm_volatile_goto() unconditional").
Then, much later, we ended up removing the workaround in commit 43c249ea0b1e ("compiler-gcc.h: remove ancient workaround for gcc PR 58670") because we no longer supported building the kernel with the affected gcc versions, but we left the macro uses around.
Now, Sean Christopherson reports a new version of a very similar problem, which is fixed by re-applying that ancient workaround. But the problem in question is limited to only the 'asm goto with outputs' cases, so instead of re-introducing the old workaround as-is, let's rename and limit the workaround to just that much less common case.
It looks like there are at least two separate issues that all hit in this area:
(a) some versions of gcc don't mark the asm goto as 'volatile' when it
has outputs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98619
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420
which is easy to work around by just adding the 'volatile' by hand.(b) Internal compiler errors:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110422
which are worked around by adding the extra empty 'asm' as a barrier, as in the original workaround.
but the problem Sean sees may be a third thing since it involves bad code generation (not an ICE) even with the manually added 'volatile'.
but the same old workaround works for this case, even if this feels a bit like voodoo programming and may only be hiding the issue.
--- arch/arc/include/asm/jump_label.h | 4 ++-- arch/arm/include/asm/jump_label.h | 4 ++-- arch/arm64/include/asm/alternative-macros.h | 4 ++-- arch/arm64/include/asm/jump_label.h | 4 ++-- arch/csky/include/asm/jump_label.h | 4 ++-- arch/loongarch/include/asm/jump_label.h | 4 ++-- arch/mips/include/asm/jump_label.h | 4 ++-- arch/parisc/include/asm/jump_label.h | 4 ++-- arch/powerpc/include/asm/jump_label.h | 4 ++-- arch/powerpc/include/asm/uaccess.h | 12 ++++++------ arch/powerpc/kernel/irq_64.c | 2 +- arch/riscv/include/asm/bitops.h | 8 ++++---- arch/riscv/include/asm/cpufeature.h | 4 ++-- arch/riscv/include/asm/jump_label.h | 4 ++-- arch/s390/include/asm/jump_label.h | 4 ++-- arch/sparc/include/asm/jump_label.h | 4 ++-- arch/um/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/jump_label.h | 6 +++--- arch/x86/include/asm/rmwcc.h | 2 +- arch/x86/include/asm/special_insns.h | 2 +- arch/x86/include/asm/uaccess.h | 10 +++++----- arch/x86/kvm/svm/svm_ops.h | 6 +++--- arch/x86/kvm/vmx/vmx.c | 4 ++-- arch/x86/kvm/vmx/vmx_ops.h | 6 +++--- arch/xtensa/include/asm/jump_label.h | 4 ++-- include/linux/compiler-gcc.h | 19 +++++++++++++++++++ include/linux/compiler_types.h | 4 ++-- net/netfilter/nft_set_pipapo_avx2.c | 2 +- samples/bpf/asm_goto_workaround.h | 8 ++++---- tools/arch/x86/include/asm/rmwcc.h | 2 +- tools/include/linux/compiler_types.h | 4 ++-- 32 files changed, 88 insertions(+), 69 deletions(-)
arch/arc/include/asm/jump_label.h +2 -2
@@ -31,7 +31,7 @@ static __always_inline bool arch_static_branch(struct static_key *key,bool branch) { - asm_volatile_goto(".balign "__stringify(JUMP_LABEL_NOP_SIZE)" \n" + asm goto(".balign "__stringify(JUMP_LABEL_NOP_SIZE)" \n""1: \n" "nop \n" ".pushsection __jump_table, \"aw\" \n"
@@ -47,7 +47,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key *key,bool branch) { - asm_volatile_goto(".balign "__stringify(JUMP_LABEL_NOP_SIZE)" \n" + asm goto(".balign "__stringify(JUMP_LABEL_NOP_SIZE)" \n""1: \n" "b %l[l_yes] \n" ".pushsection __jump_table, \"aw\" \n"
arch/arm/include/asm/jump_label.h +2 -2
@@ -11,7 +11,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { - asm_volatile_goto("1:\n\t" + asm goto("1:\n\t" WASM(nop) "\n\t"".pushsection __jump_table, \"aw\"\n\t" ".word 1b, %l[l_yes], %c0\n\t"
@@ -25,7 +25,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { - asm_volatile_goto("1:\n\t" + asm goto("1:\n\t" WASM(b) " %l[l_yes]\n\t"".pushsection __jump_table, \"aw\"\n\t" ".word 1b, %l[l_yes], %c0\n\t"
arch/arm64/include/asm/alternative-macros.h +2 -2
@@ -229,7 +229,7 @@ alternative_has_cap_likely(const unsigneif (!cpucap_is_possible (cpucap))return false; -asm_volatile_goto ( + asm goto( ALTERNATIVE_CB("b %l[l_no]", %[cpucap], alt_cb_patch_nops) : : [cpucap] "i" (cpucap)
@@ -247,7 +247,7 @@ alternative_has_cap_unlikely(const unsigif (!cpucap_is_possible (cpucap))return false; -asm_volatile_goto ( + asm goto( ALTERNATIVE("nop", "b %l[l_yes]", %[cpucap]) : : [cpucap] "i" (cpucap)
arch/arm64/include/asm/jump_label.h +2 -2
@@ -18,7 +18,7 @@ static __always_inline bool arch_static_branch(struct static_key * const key,const bool branch) { -asm_volatile_goto ( + asm goto("1: nop \n\t" " .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t"
@@ -35,7 +35,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key * const key,const bool branch) { -asm_volatile_goto ( + asm goto("1: b %l[l_yes] \n\t" " .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t"
arch/csky/include/asm/jump_label.h +2 -2
@@ -12,7 +12,7 @@ static __always_inline bool arch_static_branch(struct static_key *key,bool branch) { -asm_volatile_goto ( + asm goto("1: nop32 \n" " .pushsection __jump_table, \"aw\" \n" " .align 2 \n"
@@ -29,7 +29,7 @@ label: static __always_inline bool arch_static_branch_jump(struct static_key *key,bool branch) { -asm_volatile_goto ( + asm goto("1: bsr32 %l[label] \n" " .pushsection __jump_table, \"aw\" \n" " .align 2 \n"
arch/loongarch/include/asm/jump_label.h +2 -2
@@ -22,7 +22,7 @@ static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch) { -asm_volatile_goto ( + asm goto("1: nop \n\t" JUMP_TABLE_ENTRY : :"i" (&((char *)key)[branch]) : : l_yes);
@@ -35,7 +35,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch) { -asm_volatile_goto ( + asm goto("1: b %l[l_yes] \n\t" JUMP_TABLE_ENTRY : :"i" (&((char *)key)[branch]) : : l_yes);
arch/mips/include/asm/jump_label.h +2 -2
@@ -36,7 +36,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\t" B_INSN " 2f\n\t" + asm goto("1:\t" B_INSN " 2f\n\t" "2:\t.insn\n\t" ".pushsection __jump_table, \"aw\"\n\t" WORD_INSN " 1b, %l[l_yes], %0\n\t"
@@ -50,7 +50,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\t" J_INSN " %l[l_yes]\n\t" + asm goto("1:\t" J_INSN " %l[l_yes]\n\t" ".pushsection __jump_table, \"aw\"\n\t" WORD_INSN " 1b, %l[l_yes], %0\n\t" ".popsection\n\t"
arch/parisc/include/asm/jump_label.h +2 -2
@@ -12,7 +12,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" ".align %1\n\t"
@@ -29,7 +29,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "b,n %l[l_yes]\n\t" ".pushsection __jump_table, \"aw\"\n\t" ".align %1\n\t"
arch/powerpc/include/asm/jump_label.h +2 -2
@@ -17,7 +17,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "nop # arch_static_branch\n\t" ".pushsection __jump_table, \"aw\"\n\t" ".long 1b - ., %l[l_yes] - .\n\t"
@@ -32,7 +32,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "b %l[l_yes] # arch_static_branch_jump\n\t" ".pushsection __jump_table, \"aw\"\n\t" ".long 1b - ., %l[l_yes] - .\n\t"
arch/powerpc/include/asm/uaccess.h +6 -6
@@ -74,7 +74,7 @@ __pu_failed: \/* -mprefixed can generate offsets beyond range, fall back hack */ #ifdef CONFIG_PPC_KERNEL_PREFIXED #define __put_user_asm_goto (x, addr, label, op) \ - asm_volatile_goto( \ + asm goto( \ "1: " op " %0,0(%1) # put_user\n" \ EX_TABLE(1b, %l2) \ : \
@@ -83,7 +83,7 @@ __pu_failed: \ : label)#else #define __put_user_asm_goto (x, addr, label, op) \ - asm_volatile_goto( \ + asm goto( \ "1: " op "%U1%X1 %0,%1 # put_user\n" \ EX_TABLE(1b, %l2) \ : \
@@ -97,7 +97,7 @@ __pu_failed: \ __put_user_asm_goto(x, ptr, label, "std")#else /* __powerpc64__ */ #define __put_user_asm2_goto (x, addr, label) \ - asm_volatile_goto( \ + asm goto( \ "1: stw%X1 %0, %1\n" \ "2: stw%X1 %L0, %L1\n" \ EX_TABLE(1b, %l2) \
@@ -146,7 +146,7 @@ do { \/* -mprefixed can generate offsets beyond range, fall back hack */ #ifdef CONFIG_PPC_KERNEL_PREFIXED #define __get_user_asm_goto (x, addr, label, op) \ - asm_volatile_goto( \ + asm_goto_output( \ "1: "op" %0,0(%1) # get_user\n" \ EX_TABLE(1b, %l2) \ : "=r" (x) \
@@ -155,7 +155,7 @@ do { \ : label)#else #define __get_user_asm_goto (x, addr, label, op) \ - asm_volatile_goto( \ + asm_goto_output( \ "1: "op"%U1%X1 %0, %1 # get_user\n" \ EX_TABLE(1b, %l2) \ : "=r" (x) \
@@ -169,7 +169,7 @@ do { \ __get_user_asm_goto(x, addr, label, "ld")#else /* __powerpc64__ */ #define __get_user_asm2_goto (x, addr, label) \ - asm_volatile_goto( \ + asm_goto_output( \ "1: lwz%X1 %0, %1\n" \ "2: lwz%X1 %L0, %L1\n" \ EX_TABLE(1b, %l2) \
arch/powerpc/kernel/irq_64.c +1 -1
@@ -230,7 +230,7 @@ again:* This allows interrupts to be unmasked without hard disabling, and * also without new hard interrupts coming in ahead of pending ones. */ -asm_volatile_goto ( + asm goto("1: \n" " lbz 9,%0(13) \n" " cmpwi 9,0 \n"
arch/riscv/include/asm/bitops.h +4 -4
@@ -39,7 +39,7 @@ static __always_inline unsigned long var {int num; -asm_volatile_goto (ALTERNATIVE ("j %l[legacy]" ,"nop" ,0 , + asm goto(ALTERNATIVE("j %l[legacy]", "nop", 0, RISCV_ISA_EXT_ZBB, 1) : : : : legacy);
@@ -95,7 +95,7 @@ static __always_inline unsigned long var {int num; -asm_volatile_goto (ALTERNATIVE ("j %l[legacy]" ,"nop" ,0 , + asm goto(ALTERNATIVE("j %l[legacy]", "nop", 0, RISCV_ISA_EXT_ZBB, 1) : : : : legacy);
@@ -154,7 +154,7 @@ static __always_inline int variable_ffs(if (!x)return 0 ; -asm_volatile_goto (ALTERNATIVE ("j %l[legacy]" ,"nop" ,0 , + asm goto(ALTERNATIVE("j %l[legacy]", "nop", 0, RISCV_ISA_EXT_ZBB, 1) : : : : legacy);
@@ -209,7 +209,7 @@ static __always_inline int variable_fls(if (!x)return 0 ; -asm_volatile_goto (ALTERNATIVE ("j %l[legacy]" ,"nop" ,0 , + asm goto(ALTERNATIVE("j %l[legacy]", "nop", 0, RISCV_ISA_EXT_ZBB, 1) : : : : legacy);
arch/riscv/include/asm/cpufeature.h +2 -2
@@ -78,7 +78,7 @@ riscv_has_extension_likely(const unsigne "ext must be < RISCV_ISA_EXT_MAX");if (IS_ENABLED (CONFIG_RISCV_ALTERNATIVE )) { -asm_volatile_goto ( + asm goto( ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1) : : [ext] "i" (ext)
@@ -101,7 +101,7 @@ riscv_has_extension_unlikely(const unsig "ext must be < RISCV_ISA_EXT_MAX");if (IS_ENABLED (CONFIG_RISCV_ALTERNATIVE )) { -asm_volatile_goto ( + asm goto( ALTERNATIVE("nop", "j %l[l_yes]", 0, %[ext], 1) : : [ext] "i" (ext)
arch/riscv/include/asm/jump_label.h +2 -2
@@ -17,7 +17,7 @@ static __always_inline bool arch_static_branch(struct static_key * const key,const bool branch) { -asm_volatile_goto ( + asm goto(" .align 2 \n\t" " .option push \n\t" " .option norelax \n\t"
@@ -39,7 +39,7 @@ label: static __always_inline bool arch_static_branch_jump(struct static_key * const key,const bool branch) { -asm_volatile_goto ( + asm goto(" .align 2 \n\t" " .option push \n\t" " .option norelax \n\t"
arch/s390/include/asm/jump_label.h +2 -2
@@ -25,7 +25,7 @@*/ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { -asm_volatile_goto ("0: brcl 0,%l[label]\n" + asm goto("0: brcl 0,%l[label]\n" ".pushsection __jump_table,\"aw\"\n" ".balign 8\n" ".long 0b-.,%l[label]-.\n"
@@ -39,7 +39,7 @@ label: static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { -asm_volatile_goto ("0: brcl 15,%l[label]\n" + asm goto("0: brcl 15,%l[label]\n" ".pushsection __jump_table,\"aw\"\n" ".balign 8\n" ".long 0b-.,%l[label]-.\n"
arch/sparc/include/asm/jump_label.h +2 -2
@@ -10,7 +10,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "nop\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t"
@@ -26,7 +26,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "b %l[l_yes]\n\t" "nop\n\t" ".pushsection __jump_table, \"aw\"\n\t"
arch/um/include/asm/cpufeature.h +1 -1
@@ -75,7 +75,7 @@ extern void setup_clear_cpu_cap(unsigned*/ static __always_inline bool _static_cpu_has(u16 bit) { -asm_volatile_goto ("1: jmp 6f\n" + asm goto("1: jmp 6f\n" "2:\n" ".skip -(((5f-4f) - (2b-1b)) > 0) * " "((5f-4f) - (2b-1b)),0x90\n"
arch/x86/include/asm/cpufeature.h +1 -1
@@ -168,7 +168,7 @@ extern void clear_cpu_cap(struct cpuinfo*/ static __always_inline bool _static_cpu_has(u16 bit) { -asm_volatile_goto ( + asm goto( ALTERNATIVE_TERNARY("jmp 6f", %P[feature], "", "jmp %l[t_no]")".pushsection .altinstr_aux,\"ax\"\n" "6:\n"
arch/x86/include/asm/jump_label.h +3 -3
@@ -24,7 +24,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { - asm_volatile_goto("1:" + asm goto("1:" "jmp %l[l_yes] # objtool NOPs this \n\t" JUMP_TABLE_ENTRY : :"i" (key),"i" (2 | branch) : : l_yes);
@@ -38,7 +38,7 @@ l_yes: static __always_inline bool arch_static_branch(struct static_key * const key, const bool branch) { - asm_volatile_goto("1:" + asm goto("1:" ".byte " __stringify(BYTES_NOP5) "\n\t" JUMP_TABLE_ENTRY : : "i" (key), "i" (branch) : : l_yes);
@@ -52,7 +52,7 @@ l_yes: static __always_inline bool arch_static_branch_jump(struct static_key * const key, const bool branch) { - asm_volatile_goto("1:" + asm goto("1:" "jmp %l[l_yes]\n\t" JUMP_TABLE_ENTRY : :"i" (key),"i" (branch) : : l_yes);
arch/x86/include/asm/rmwcc.h +1 -1
@@ -13,7 +13,7 @@#define __GEN_RMWcc (fullop, _var, cc, clobbers, ...) \ ({ \ bool c = false; \ - asm_volatile_goto (fullop "; j" #cc " %l[cc_label]" \ + asm goto (fullop "; j" #cc " %l[cc_label]" \ : : [var] "m" (_var), ## __VA_ARGS__ \ : clobbers : cc_label); \ if (0) { \
arch/x86/include/asm/special_insns.h +1 -1
@@ -205,7 +205,7 @@ static inline void clwb(volatile void *_#ifdef CONFIG_X86_USER_SHADOW_STACK static inline int write_user_shstk_64 (u64 __user *addr,u64 val) { - asm_volatile_goto("1: wrussq %[val], (%[addr])\n" + asm goto("1: wrussq %[val], (%[addr])\n" _ASM_EXTABLE(1b, %l[fail]) :: [addr] "r" (addr), [val] "r" (val) :: fail);
arch/x86/include/asm/uaccess.h +5 -5
@@ -133,7 +133,7 @@ extern int __get_user_bad(void);#ifdef CONFIG_X86_32 #define __put_user_goto_u64 (x, addr, label) \ - asm_volatile_goto("\n" \ + asm goto("\n" \ "1: movl %%eax,0(%1)\n" \ "2: movl %%edx,4(%1)\n" \ _ASM_EXTABLE_UA(1b, %l2) \
@@ -295,7 +295,7 @@ do { \ } while (0)#define __get_user_asm (x, addr, itype, ltype, label) \ - asm_volatile_goto("\n" \ + asm_goto_output("\n" \ "1: mov"itype" %[umem],%[output]\n" \ _ASM_EXTABLE_UA(1b, %l2) \ : [output] ltype(x) \
@@ -375,7 +375,7 @@ do { \__typeof__ (_ptr) _old = (__typeof__ (_ptr))(_pold); \ __typeof__(*(_ptr)) __old = *_old; \ __typeof__(*(_ptr)) __new = (_new); \ -asm_volatile_goto ("\n" \ +asm_goto_output ("\n" \"1: " LOCK_PREFIX "cmpxchg" itype" %[new], %[ptr]\n" \ _ASM_EXTABLE_UA(1b, %l[label]) \ : CC_OUT(z) (success), \
@@ -394,7 +394,7 @@ do { \__typeof__ (_ptr) _old = (__typeof__ (_ptr))(_pold); \ __typeof__(*(_ptr)) __old = *_old; \ __typeof__(*(_ptr)) __new = (_new); \ - asm_volatile_goto("\n" \ + asm_goto_output("\n" \ "1: " LOCK_PREFIX "cmpxchg8b %[ptr]\n" \ _ASM_EXTABLE_UA(1b, %l[label]) \ : CC_OUT(z) (success), \
@@ -477,7 +477,7 @@ struct __large_struct { unsigned long bu* aliasing issues. */ #define __put_user_goto (x, addr, itype, ltype, label) \ - asm_volatile_goto("\n" \ + asm goto("\n" \ "1: mov"itype" %0,%1\n" \ _ASM_EXTABLE_UA(1b, %l2) \ : : ltype(x), "m" (__m(addr)) \
arch/x86/kvm/svm/svm_ops.h +3 -3
@@ -8,7 +8,7 @@ #define svm_asm(insn, clobber...) \ do { \ - asm_volatile_goto("1: " __stringify(insn) "\n\t" \ + asm goto("1: " __stringify(insn) "\n\t" \ _ASM_EXTABLE(1b, %l[fault]) \ ::: clobber : fault); \ return; \
@@ -18,7 +18,7 @@ fault: \ #define svm_asm1(insn, op1, clobber...) \ do { \ - asm_volatile_goto("1: " __stringify(insn) " %0\n\t" \ + asm goto("1: " __stringify(insn) " %0\n\t" \ _ASM_EXTABLE(1b, %l[fault]) \ :: op1 : clobber : fault); \ return; \
@@ -28,7 +28,7 @@ fault: \ #define svm_asm2(insn, op1, op2, clobber...) \ do { \ - asm_volatile_goto("1: " __stringify(insn) " %1, %0\n\t" \ + asm goto("1: " __stringify(insn) " %1, %0\n\t" \ _ASM_EXTABLE(1b, %l[fault]) \ :: op1, op2 : clobber : fault); \ return; \
arch/x86/kvm/vmx/vmx.c +2 -2
@@ -745,7 +745,7 @@ static int vmx_set_guest_uret_msr(struct*/ static int kvm_cpu_vmxoff (void ) { - asm_volatile_goto("1: vmxoff\n\t" + asm goto("1: vmxoff\n\t" _ASM_EXTABLE(1b, %l[fault]) ::: "cc", "memory" : fault);
@@ -2789,7 +2789,7 @@ static int kvm_cpu_vmxon(u64 vmxon_pointcr4_set_bits (X86_CR4_VMXE ); - asm_volatile_goto("1: vmxon %[vmxon_pointer]\n\t" + asm goto("1: vmxon %[vmxon_pointer]\n\t" _ASM_EXTABLE(1b, %l[fault]) : : [vmxon_pointer] "m"(vmxon_pointer) : : fault);
arch/x86/kvm/vmx/vmx_ops.h +3 -3
@@ -94,7 +94,7 @@ static __always_inline unsigned long __v#ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT -asm_volatile_goto ("1: vmread %[field], %[output]\n\t" +asm_goto_output ("1: vmread %[field], %[output]\n\t" "jna %l[do_fail]\n\t" _ASM_EXTABLE(1b, %l[do_exception])
@@ -188,7 +188,7 @@ static __always_inline unsigned long vmc #define vmx_asm1(insn, op1, error_args...) \ do { \ - asm_volatile_goto("1: " __stringify(insn) " %0\n\t" \ + asm goto("1: " __stringify(insn) " %0\n\t" \ ".byte 0x2e\n\t"/* branch not taken hint */ \"jna %l[error]\n\t" \ _ASM_EXTABLE(1b, %l[fault]) \
@@ -205,7 +205,7 @@ fault: \ #define vmx_asm2(insn, op1, op2, error_args...) \ do { \ - asm_volatile_goto("1: " __stringify(insn) " %1, %0\n\t" \ + asm goto("1: " __stringify(insn) " %1, %0\n\t" \ ".byte 0x2e\n\t"/* branch not taken hint */ \"jna %l[error]\n\t" \ _ASM_EXTABLE(1b, %l[fault]) \
arch/xtensa/include/asm/jump_label.h +2 -2
@@ -13,7 +13,7 @@ static __always_inline bool arch_static_branch(struct static_key *key,bool branch) { -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" "_nop\n\t" ".pushsection __jump_table, \"aw\"\n\t" ".word 1b, %l[l_yes], %c0\n\t"
@@ -38,7 +38,7 @@ static __always_inline bool arch_static_* make it reachable and wrap both into a no-transform block * to avoid any assembler interference with this. */ -asm_volatile_goto ("1:\n\t" + asm goto("1:\n\t" ".begin no-transform\n\t" "_j %l[l_yes]\n\t" "2:\n\t"
include/linux/compiler-gcc.h +19 -0
@@ -64,6 +64,25 @@__builtin_unreachable (); \ }while (0 ) +/* +* GCC 'asm goto' with outputs miscompiles certain code sequences: +* +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420 +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110422 +* +* Work it around via the same compiler barrier quirk that we used +* to use for the old 'asm goto' workaround. +* +* Also, always mark such 'asm goto' statements as volatile: all +* asm goto statements are supposed to be volatile as per the +* documentation, but some versions of gcc didn't actually do +* that for asms with outputs: +* +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98619 +*/ +#define asm_goto_output(x...) \ + do { asm volatile goto(x); asm (""); } while (0) +#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP )#define __HAVE_BUILTIN_BSWAP32__#define __HAVE_BUILTIN_BSWAP64__
include/linux/compiler_types.h +2 -2
@@ -362,8 +362,8 @@ struct ftrace_likely_data {#define __member_size (p) __builtin_object_size(p, 1)#endif -#ifndef asm_volatile_goto -#define asm_volatile_goto(x...) asm goto(x) +#ifndef asm_goto_output +#define asm_goto_output(x...) asm goto(x)#endif #ifdef CONFIG_CC_HAS_ASM_INLINE
net/netfilter/nft_set_pipapo_avx2.c +1 -1
@@ -57,7 +57,7 @@/* Jump to label if @reg is zero */ #define NFT_PIPAPO_AVX2_NOMATCH_GOTO (reg, label) \ - asm_volatile_goto("vptest %%ymm" #reg ", %%ymm" #reg ";" \ + asm goto("vptest %%ymm" #reg ", %%ymm" #reg ";" \ "je %l[" #label "]" : : : : label)/* Store 256 bits from YMM register into memory. Contrary to bucket load
samples/bpf/asm_goto_workaround.h +4 -4
@@ -4,14 +4,14 @@#define __ASM_GOTO_WORKAROUND_H/* -* This will bring in asm_volatile_goto and asm_inline macro definitions +* This will bring in asm_goto_output and asm_inline macro definitions * if enabled by compiler and config options. */ #include <linux/types.h> -#ifdef asm_volatile_goto -#undef asm_volatile_goto -#define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") +#ifdef asm_goto_output +#undef asm_goto_output +#define asm_goto_output(x...) asm volatile("invalid use of asm_goto_output")#endif /*
tools/arch/x86/include/asm/rmwcc.h +1 -1
@@ -4,7 +4,7 @@#define __GEN_RMWcc (fullop, var, cc, ...) \ do { \ - asm_volatile_goto (fullop "; j" cc " %l[cc_label]" \ + asm goto (fullop "; j" cc " %l[cc_label]" \ : : "m" (var), ## __VA_ARGS__ \ : "memory" : cc_label); \ return 0; \
tools/include/linux/compiler_types.h +2 -2
@@ -36,8 +36,8 @@#include <linux/compiler-gcc.h> #endif -#ifndef asm_volatile_goto -#define asm_volatile_goto(x...) asm goto(x) +#ifndef asm_goto_output +#define asm_goto_output(x...) asm goto(x)#endif #endif /* __LINUX_COMPILER_TYPES_H */
Greg Kroah-Hartman
maintainerPATCH 2/309 update workarounds for gcc "asm goto" issue
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 68fb3ca0e408e00db1c3f8fccdfa19e274c033be upstream.
In commit 4356e9f841f7 ("work around gcc bugs with 'asm goto' with outputs") I did the gcc workaround unconditionally, because the cause of the bad code generation wasn't entirely clear.
In the meantime, Jakub Jelinek debugged the issue, and has come up with a fix in gcc [2], which also got backported to the still maintained branches of gcc-11, gcc-12 and gcc-13.
Note that while the fix technically wasn't in the original gcc-14 branch, Jakub says:
"while it is true that no GCC 14 snapshots until today (or whenever the
fix will be committed) have the fix, for GCC trunk it is up to the distros to use the latest snapshot if they use it at all and would allow better testing of the kernel code without the workaround, so that if there are other issues they won't be discovered years later. Most userland code doesn't actually use asm goto with outputs..."
so we will consider gcc-14 to be fixed - if somebody is using gcc snapshots of the gcc-14 before the fix, they should upgrade.
Note that while the bug goes back to gcc-11, in practice other gcc changes seem to have effectively hidden it since gcc-12.1 as per a bisect by Jakub. So even a gcc-14 snapshot without the fix likely doesn't show actual problems.
Also, make the default 'asm_goto_output()' macro mark the asm as volatile by hand, because of an unrelated gcc issue [1] where it doesn't match the documented behavior ("asm goto is always volatile").
--- include/linux/compiler-gcc.h | 7 ++++--- include/linux/compiler_types.h | 9 ++++++++- init/Kconfig | 9 +++++++++ 3 files changed, 21 insertions(+), 4 deletions(-)
include/linux/compiler-gcc.h +4 -3
@@ -67,10 +67,9 @@/* * GCC 'asm goto' with outputs miscompiles certain code sequences: * -* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110420 -* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110422 +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921 * -* Work it around via the same compiler barrier quirk that we used +* Work around it via the same compiler barrier quirk that we used * to use for the old 'asm goto' workaround. * * Also, always mark such 'asm goto' statements as volatile: all
@@ -80,8 +79,10 @@* * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98619 */ +#ifdef CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND #define asm_goto_output(x...) \ do { asm volatile goto(x); asm (""); } while (0) +#endif #if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP )#define __HAVE_BUILTIN_BSWAP32__
include/linux/compiler_types.h +8 -1
@@ -362,8 +362,15 @@ struct ftrace_likely_data {#define __member_size (p) __builtin_object_size(p, 1)#endif +/* +* Some versions of gcc do not mark 'asm goto' volatile: +* +* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103979 +* +* We do it here by hand, because it doesn't hurt. +*/ #ifndef asm_goto_output -#define asm_goto_output(x...) asm goto(x) +#define asm_goto_output(x...) asm volatile goto(x)#endif #ifdef CONFIG_CC_HAS_ASM_INLINE
init/Kconfig +9 -0
@@ -89,6 +89,15 @@ config CC_HAS_ASM_GOTO_TIED_OUTPUT # Detect buggy gcc and clang, fixed in gcc-11 clang-14. def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null) +config GCC_ASM_GOTO_OUTPUT_WORKAROUND + bool + depends on CC_IS_GCC && CC_HAS_ASM_GOTO_OUTPUT + # Fixed in GCC 14, 13.3, 12.4 and 11.5 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921 + default y if GCC_VERSION < 110500 + default y if GCC_VERSION >= 120000 && GCC_VERSION < 120400 + default y if GCC_VERSION >= 130000 && GCC_VERSION < 130300 + config TOOLS_SUPPORT_RELR def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
Greg Kroah-Hartman
maintainerPATCH 3/309 mm: huge_memory: dont force huge page alignment on 32 bit
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Shi <[email protected]>
commit 4ef9ad19e17676b9ef071309bc62020e2373705d upstream.
commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries") caused two issues [1] [2] reported on 32 bit system or compat userspace.
It doesn't make too much sense to force huge page alignment on 32 bit system due to the constrained virtual address space.
[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/CAJuCfpHXLdQy1a2B6xN2d7quTYwg2OoZseYPZTRpU0eHHKD-sQ@mail.gmail.com/
--- mm/huge_memory.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/huge_memory.c +4 -0
@@ -37,6 +37,7 @@#include <linux/page_owner.h> #include <linux/sched/sysctl.h> #include <linux/memory-tiers.h> +#include <linux/compat.h> #include <asm/tlb.h> #include <asm/pgalloc.h>
@@ -634,6 +635,9 @@ static unsigned long __thp_get_unmapped_loff_t off_align =round_up (off, size);unsigned long len_pad, ret; +if (IS_ENABLED (CONFIG_32BIT ) ||in_compat_syscall ()) +return 0 ; +if (off_end <= off_align || (off_end - off_align) < size)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 4/309 mm: mmap: map MAP_STACK to VM_NOHUGEPAGE
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Shi <[email protected]>
commit c4608d1bf7c6536d1a3d233eb21e50678681564e upstream.
commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries") incured regression for stress-ng pthread benchmark [1]. It is because THP get allocated to pthread's stack area much more possible than before. Pthread's stack area is allocated by mmap without VM_GROWSDOWN or VM_GROWSUP flag, so kernel can't tell whether it is a stack area or not.
The MAP_STACK flag is used to mark the stack area, but it is a no-op on Linux. Mapping MAP_STACK to VM_NOHUGEPAGE to prevent from allocating THP for such stack area.
With this change the stack area looks like:
fffd18e10000-fffd19610000 rw-p 00000000 00:00 0
Size: 8192 kB KernelPageSize: 4 kB MMUPageSize: 4 kB Rss: 12 kB Pss: 12 kB Pss_Dirty: 12 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 12 kB Referenced: 12 kB Anonymous: 12 kB KSM: 0 kB LazyFree: 0 kB AnonHugePages: 0 kB ShmemPmdMapped: 0 kB FilePmdMapped: 0 kB Shared_Hugetlb: 0 kB Private_Hugetlb: 0 kB Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 VmFlags: rd wr mr mw me ac nh
The "nh" flag is set.
[1] https://lore.kernel.org/linux-mm/[email protected]/
--- include/linux/mman.h | 1 + 1 file changed, 1 insertion(+)
include/linux/mman.h +1 -0
@@ -156,6 +156,7 @@ calc_vm_flag_bits(unsigned long flags)return _calc_vm_trans (flags,MAP_GROWSDOWN ,VM_GROWSDOWN ) |_calc_vm_trans (flags,MAP_LOCKED ,VM_LOCKED ) |_calc_vm_trans (flags,MAP_SYNC ,VM_SYNC ) | +_calc_vm_trans (flags,MAP_STACK ,VM_NOHUGEPAGE ) |arch_calc_vm_flag_bits (flags); }
Greg Kroah-Hartman
maintainerPATCH 5/309 btrfs: add and use helper to check if block group is used
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 1693d5442c458ae8d5b0d58463b873cd879569ed upstream.
Add a helper function to determine if a block group is being used and make use of it at btrfs_delete_unused_bgs(). This helper will also be used in future code changes.
--- fs/btrfs/block-group.c | 3 +-- fs/btrfs/block-group.h | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/block-group.c +1 -2
@@ -1524,8 +1524,7 @@ void btrfs_delete_unused_bgs(struct btrf }spin_lock (&block_group->lock); -if (block_group->reserved || block_group->pinned || - block_group->used || block_group->ro || +if (btrfs_is_block_group_used (block_group) || block_group->ro ||list_is_singular (&block_group->list)) {/* * We want to bail if we made new allocations or have
fs/btrfs/block-group.h +7 -0
@@ -255,6 +255,13 @@ static inline u64 btrfs_block_group_end(return (block_group->start + block_group->length); } +static inline bool btrfs_is_block_group_used (const struct btrfs_block_group *bg) +{ +lockdep_assert_held (&bg->lock); + +return (bg->used >0 || bg->reserved >0 || bg->pinned >0 ); +} +static inline bool btrfs_is_block_group_data_only (struct btrfs_block_group *block_group) {
Greg Kroah-Hartman
maintainerPATCH 6/309 btrfs: do not delete unused block group if it may be used soon
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit f4a9f219411f318ae60d6ff7f129082a75686c6c upstream.
Before deleting a block group that is in the list of unused block groups (fs_info->unused_bgs), we check if the block group became used before deleting it, as extents from it may have been allocated after it was added to the list.
However even if the block group was not yet used, there may be tasks that have only reserved space and have not yet allocated extents, and they might be relying on the availability of the unused block group in order to allocate extents. The reservation works first by increasing the "bytes_may_use" field of the corresponding space_info object (which may first require flushing delayed items, allocating a new block group, etc), and only later a task does the actual allocation of extents.
For metadata we usually don't end up using all reserved space, as we are pessimistic and typically account for the worst cases (need to COW every single node in a path of a tree at maximum possible height, etc). For data we usually reserve the exact amount of space we're going to allocate later, except when using compression where we always reserve space based on the uncompressed size, as compression is only triggered when writeback starts so we don't know in advance how much space we'll actually need, or if the data is compressible.
So don't delete an unused block group if the total size of its space_info object minus the block group's size is less then the sum of used space and space that may be used (space_info->bytes_may_use), as that means we have tasks that reserved space and may need to allocate extents from the block group. In this case, besides skipping the deletion, re-add the block group to the list of unused block groups so that it may be reconsidered later, in case the tasks that reserved space end up not needing to allocate extents from it.
Allowing the deletion of the block group while we have reserved space, can result in tasks failing to allocate metadata extents (-ENOSPC) while under a transaction handle, resulting in a transaction abort, or failure during writeback for the case of data extents.
--- fs/btrfs/block-group.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
fs/btrfs/block-group.c +46 -0
@@ -1467,6 +1467,7 @@ out:*/ void btrfs_delete_unused_bgs (struct btrfs_fs_info *fs_info) { +LIST_HEAD (retry_list);struct btrfs_block_group *block_group;struct btrfs_space_info *space_info;struct btrfs_trans_handle *trans;
@@ -1488,6 +1489,7 @@ void btrfs_delete_unused_bgs(struct btrfspin_lock (&fs_info->unused_bgs_lock);while (!list_empty (&fs_info->unused_bgs)) { +u64 used;int trimming; block_group = list_first_entry(&fs_info->unused_bgs,
@@ -1523,6 +1525,7 @@ void btrfs_delete_unused_bgs(struct btrf goto next; } +spin_lock (&space_info->lock);spin_lock (&block_group->lock);if (btrfs_is_block_group_used (block_group) || block_group->ro ||list_is_singular (&block_group->list)) {
@@ -1534,10 +1537,49 @@ void btrfs_delete_unused_bgs(struct btrf*/ trace_btrfs_skip_unused_block_group (block_group);spin_unlock (&block_group->lock); +spin_unlock (&space_info->lock);up_write (&space_info->groups_sem); goto next; } + +/* +* The block group may be unused but there may be space reserved +* accounting with the existence of that block group, that is, +* space_info->bytes_may_use was incremented by a task but no +* space was yet allocated from the block group by the task. +* That space may or may not be allocated, as we are generally +* pessimistic about space reservation for metadata as well as +* for data when using compression (as we reserve space based on +* the worst case, when data can't be compressed, and before +* actually attempting compression, before starting writeback). +* +* So check if the total space of the space_info minus the size +* of this block group is less than the used space of the +* space_info - if that's the case, then it means we have tasks +* that might be relying on the block group in order to allocate +* extents, and add back the block group to the unused list when +* we finish, so that we retry later in case no tasks ended up +* needing to allocate extents from the block group. +*/ + used =btrfs_space_info_used (space_info, true); +if (space_info->total_bytes - block_group->length < used) { +/* +* Add a reference for the list, compensate for the ref +* drop under the "next" label for the +* fs_info->unused_bgs list. +*/ +btrfs_get_block_group (block_group); +list_add_tail (&block_group->bg_list, &retry_list); + +trace_btrfs_skip_unused_block_group (block_group); +spin_unlock (&block_group->lock); +spin_unlock (&space_info->lock); +up_write (&space_info->groups_sem); + goto next; + } +spin_unlock (&block_group->lock); +spin_unlock (&space_info->lock);/* We don't want to force the issue, only flip if it's ok. */ ret =inc_block_group_ro (block_group,0 );
@@ -1661,12 +1703,16 @@ next:btrfs_put_block_group (block_group);spin_lock (&fs_info->unused_bgs_lock); } +list_splice_tail (&retry_list, &fs_info->unused_bgs);spin_unlock (&fs_info->unused_bgs_lock);mutex_unlock (&fs_info->reclaim_bgs_lock);return ; flip_async:btrfs_end_transaction (trans); +spin_lock (&fs_info->unused_bgs_lock); +list_splice_tail (&retry_list, &fs_info->unused_bgs); +spin_unlock (&fs_info->unused_bgs_lock);mutex_unlock (&fs_info->reclaim_bgs_lock);btrfs_put_block_group (block_group);btrfs_discard_punt_unused_bgs_list (fs_info);
Greg Kroah-Hartman
maintainerPATCH 7/309 btrfs: add new unused block groups to the list of unused block groups
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 12c5128f101bfa47a08e4c0e1a75cfa2d0872bcd upstream.
Space reservations for metadata are, most of the time, pessimistic as we reserve space for worst possible cases - where tree heights are at the maximum possible height (8), we need to COW every extent buffer in a tree path, need to split extent buffers, etc.
For data, we generally reserve the exact amount of space we are going to allocate. The exception here is when using compression, in which case we reserve space matching the uncompressed size, as the compression only happens at writeback time and in the worst possible case we need that amount of space in case the data is not compressible.
This means that when there's not available space in the corresponding space_info object, we may need to allocate a new block group, and then that block group might not be used after all. In this case the block group is never added to the list of unused block groups and ends up never being deleted - except if we unmount and mount again the fs, as when reading block groups from disk we add unused ones to the list of unused block groups (fs_info->unused_bgs). Otherwise a block group is only added to the list of unused block groups when we deallocate the last extent from it, so if no extent is ever allocated, the block group is kept around forever.
This also means that if we have a bunch of tasks reserving space in parallel we can end up allocating many block groups that end up never being used or kept around for too long without being used, which has the potential to result in ENOSPC failures in case for example we over allocate too many metadata block groups and then end up in a state without enough unallocated space to allocate a new data block group.
This is more likely to happen with metadata reservations as of kernel 6.7, namely since commit 28270e25c69a ("btrfs: always reserve space for delayed refs when starting transaction"), because we started to always reserve space for delayed references when starting a transaction handle for a non-zero number of items, and also to try to reserve space to fill the gap between the delayed block reserve's reserved space and its size.
So to avoid this, when finishing the creation a new block group, add the block group to the list of unused block groups if it's still unused at that time. This way the next time the cleaner kthread runs, it will delete the block group if it's still unused and not needed to satisfy existing space reservations.
--- fs/btrfs/block-group.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
fs/btrfs/block-group.c +31 -0
@@ -2757,6 +2757,37 @@ next:btrfs_dec_delayed_refs_rsv_bg_inserts (fs_info);list_del_init (&block_group->bg_list);clear_bit (BLOCK_GROUP_FLAG_NEW , &block_group->runtime_flags); + +/* +* If the block group is still unused, add it to the list of +* unused block groups. The block group may have been created in +* order to satisfy a space reservation, in which case the +* extent allocation only happens later. But often we don't +* actually need to allocate space that we previously reserved, +* so the block group may become unused for a long time. For +* example for metadata we generally reserve space for a worst +* possible scenario, but then don't end up allocating all that +* space or none at all (due to no need to COW, extent buffers +* were already COWed in the current transaction and still +* unwritten, tree heights lower than the maximum possible +* height, etc). For data we generally reserve the axact amount +* of space we are going to allocate later, the exception is +* when using compression, as we must reserve space based on the +* uncompressed data size, because the compression is only done +* when writeback triggered and we don't know how much space we +* are actually going to need, so we reserve the uncompressed +* size because the data may be uncompressible in the worst case. +*/ +if (ret ==0 ) { +bool used; + +spin_lock (&block_group->lock); + used =btrfs_is_block_group_used (block_group); +spin_unlock (&block_group->lock); + +if (!used) +btrfs_mark_bg_unused (block_group); + } }btrfs_trans_release_chunk_metadata (trans); }
Greg Kroah-Hartman
maintainerPATCH 8/309 btrfs: dont refill whole delayed refs block reserve when starting transaction
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 2f6397e448e689adf57e6788c90f913abd7e1af8 upstream.
Since commit 28270e25c69a ("btrfs: always reserve space for delayed refs when starting transaction") we started not only to reserve metadata space for the delayed refs a caller of btrfs_start_transaction() might generate but also to try to fully refill the delayed refs block reserve, because there are several case where we generate delayed refs and haven't reserved space for them, relying on the global block reserve. Relying too much on the global block reserve is not always safe, and can result in hitting -ENOSPC during transaction commits or worst, in rare cases, being unable to mount a filesystem that needs to do orphan cleanup or anything that requires modifying the filesystem during mount, and has no more unallocated space and the metadata space is nearly full. This was explained in detail in that commit's change log.
However the gap between the reserved amount and the size of the delayed refs block reserve can be huge, so attempting to reserve space for such a gap can result in allocating many metadata block groups that end up not being used. After a recent patch, with the subject:
"btrfs: add new unused block groups to the list of unused block groups"
We started to add new block groups that are unused to the list of unused block groups, to avoid having them around for a very long time in case they are never used, because a block group is only added to the list of unused block groups when we deallocate the last extent or when mounting the filesystem and the block group has 0 bytes used. This is not a problem introduced by the commit mentioned earlier, it always existed as our metadata space reservations are, most of the time, pessimistic and end up not using all the space they reserved, so we can occasionally end up with one or two unused metadata block groups for a long period. However after that commit mentioned earlier, we are just more pessimistic in the metadata space reservations when starting a transaction and therefore the issue is more likely to happen.
This however is not always enough because we might create unused metadata block groups when reserving metadata space at a high rate if there's always a gap in the delayed refs block reserve and the cleaner kthread isn't triggered often enough or is busy with other work (running delayed iputs, cleaning deleted roots, etc), not to mention the block group's allocated space is only usable for a new block group after the transaction used to remove it is committed.
A user reported that he's getting a lot of allocated metadata block groups but the usage percentage of metadata space was very low compared to the total allocated space, specially after running a series of block group relocations.
So for now stop trying to refill the gap in the delayed refs block reserve and reserve space only for the delayed refs we are expected to generate when starting a transaction.
--- fs/btrfs/transaction.c | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-)
fs/btrfs/transaction.c +2 -36
@@ -564,56 +564,22 @@ static int btrfs_reserve_trans_metadata(u64 num_bytes, u64 *delayed_refs_bytes) { - struct btrfs_block_rsv *delayed_refs_rsv = &fs_info->delayed_refs_rsv; struct btrfs_space_info *si = fs_info->trans_block_rsv.space_info; -u64 extra_delayed_refs_bytes =0 ; -u64 bytes; +u64 bytes = num_bytes + *delayed_refs_bytes;int ret;/* -* If there's a gap between the size of the delayed refs reserve and -* its reserved space, than some tasks have added delayed refs or bumped -* its size otherwise (due to block group creation or removal, or block -* group item update). Also try to allocate that gap in order to prevent -* using (and possibly abusing) the global reserve when committing the -* transaction. -*/ -if (flush ==BTRFS_RESERVE_FLUSH_ALL && - !btrfs_block_rsv_full (delayed_refs_rsv)) { -spin_lock (&delayed_refs_rsv->lock); -if (delayed_refs_rsv->size > delayed_refs_rsv->reserved) - extra_delayed_refs_bytes = delayed_refs_rsv->size - - delayed_refs_rsv->reserved; -spin_unlock (&delayed_refs_rsv->lock); - } - - bytes = num_bytes + *delayed_refs_bytes + extra_delayed_refs_bytes; - -/* * We want to reserve all the bytes we may need all at once, so we only * do 1 enospc flushing cycle per transaction start. */ ret =btrfs_reserve_metadata_bytes (fs_info, si, bytes, flush); -if (ret ==0 ) { -if (extra_delayed_refs_bytes >0 ) -btrfs_migrate_to_delayed_refs_rsv (fs_info, - extra_delayed_refs_bytes); -return 0 ; - } - -if (extra_delayed_refs_bytes >0 ) { - bytes -= extra_delayed_refs_bytes; - ret =btrfs_reserve_metadata_bytes (fs_info, si, bytes, flush); -if (ret ==0 ) -return 0 ; - }/* * If we are an emergency flush, which can steal from the global block * reserve, then attempt to not reserve space for the delayed refs, as * we will consume space for them from the global block reserve. */ -if (flush ==BTRFS_RESERVE_FLUSH_ALL_STEAL ) { +if (ret && flush ==BTRFS_RESERVE_FLUSH_ALL_STEAL ) { bytes -= *delayed_refs_bytes; *delayed_refs_bytes =0 ; ret =btrfs_reserve_metadata_bytes (fs_info, si, bytes, flush);
Greg Kroah-Hartman
maintainerPATCH 9/309 btrfs: forbid creating subvol qgroups
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
commit 0c309d66dacddf8ce939b891d9ead4a8e21ad6f0 upstream.
Creating a qgroup 0/subvolid leads to various races and it isn't helpful, because you can't specify a subvol id when creating a subvol, so you can't be sure it will be the right one. Any requirements on the automatic subvol can be gratified by using a higher level qgroup and the inheritance parameters of subvol creation.
--- fs/btrfs/ioctl.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/btrfs/ioctl.c +5 -0
@@ -3815,6 +3815,11 @@ static long btrfs_ioctl_qgroup_create(st goto out; } +if (sa->create &&is_fstree (sa->qgroupid)) { + ret = -EINVAL ; + goto out; + } + trans =btrfs_join_transaction (root);if (IS_ERR (trans)) { ret =PTR_ERR (trans);
Greg Kroah-Hartman
maintainerPATCH 10/309 btrfs: do not ASSERT() if the newly created subvolume already got read
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb upstream.
[BUG]
There is a syzbot crash, triggered by the ASSERT() during subvolume creation:
assertion failed: !anon_dev, in fs/btrfs/disk-io.c:1319
------------[ cut here ]------------ kernel BUG at fs/btrfs/disk-io.c:1319! invalid opcode: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:btrfs_get_root_ref.part.0+0x9aa/0xa60 <TASK> btrfs_get_new_fs_root+0xd3/0xf0 create_subvol+0xd02/0x1650 btrfs_mksubvol+0xe95/0x12b0 __btrfs_ioctl_snap_create+0x2f9/0x4f0 btrfs_ioctl_snap_create+0x16b/0x200 btrfs_ioctl+0x35f0/0x5cf0 __x64_sys_ioctl+0x19d/0x210 do_syscall_64+0x3f/0xe0 entry_SYSCALL_64_after_hwframe+0x63/0x6b ---[ end trace 0000000000000000 ]---
[CAUSE]
During create_subvol(), after inserting root item for the newly created subvolume, we would trigger btrfs_get_new_fs_root() to get the btrfs_root of that subvolume.
The idea here is, we have preallocated an anonymous device number for the subvolume, thus we can assign it to the new subvolume.
But there is really nothing preventing things like backref walk to read the new subvolume.
If that happens before we call btrfs_get_new_fs_root(), the subvolume would be read out, with a new anonymous device number assigned already.
In that case, we would trigger ASSERT(), as we really expect no one to read out that subvolume (which is not yet accessible from the fs). But things like backref walk is still possible to trigger the read on the subvolume.
Thus our assumption on the ASSERT() is not correct in the first place.
[FIX]
Fix it by removing the ASSERT(), and just free the @anon_dev, reset it to 0, and continue.
If the subvolume tree is read out by something else, it should have already get a new anon_dev assigned thus we only need to free the preallocated one.
--- fs/btrfs/disk-io.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +11 -2
@@ -1315,8 +1315,17 @@ static struct btrfs_root *btrfs_get_root again: root =btrfs_lookup_fs_root (fs_info, objectid);if (root) { -/* Shouldn't get preallocated anon_dev for cached roots */ -ASSERT (!anon_dev); +/* +* Some other caller may have read out the newly inserted +* subvolume already (for things like backref walk etc). Not +* that common but still possible. In that case, we just need +* to free the anon_dev. +*/ +if (unlikely (anon_dev)) { +free_anon_bdev (anon_dev); + anon_dev =0 ; + } +if (check_ref &&btrfs_root_refs (&root->root_item) ==0 ) {btrfs_put_root (root);return ERR_PTR (-ENOENT );
Greg Kroah-Hartman
maintainerPATCH 11/309 btrfs: forbid deleting live subvol qgroup
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
commit a8df35619948bd8363d330c20a90c9a7fbff28c0 upstream.
If a subvolume still exists, forbid deleting its qgroup 0/subvolid. This behavior generally leads to incorrect behavior in squotas and doesn't have a legitimate purpose.
--- fs/btrfs/qgroup.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/qgroup.c +14 -0
@@ -1736,6 +1736,15 @@ out:return ret; } +static bool qgroup_has_usage (struct btrfs_qgroup *qgroup) +{ +return (qgroup->rfer >0 || qgroup->rfer_cmpr >0 || + qgroup->excl >0 || qgroup->excl_cmpr >0 || + qgroup->rsv.values[BTRFS_QGROUP_RSV_DATA ] >0 || + qgroup->rsv.values[BTRFS_QGROUP_RSV_META_PREALLOC ] >0 || + qgroup->rsv.values[BTRFS_QGROUP_RSV_META_PERTRANS ] >0 ); +} +int btrfs_remove_qgroup (struct btrfs_trans_handle *trans,u64 qgroupid) {struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -1755,6 +1764,11 @@ int btrfs_remove_qgroup(struct btrfs_tra goto out; } +if (is_fstree (qgroupid) &&qgroup_has_usage (qgroup)) { + ret = -EBUSY ; + goto out; + } +/* Check if there are no children of this qgroup */ if (!list_empty (&qgroup->members)) { ret = -EBUSY ;
Greg Kroah-Hartman
maintainerPATCH 12/309 btrfs: send: return EOPNOTSUPP on unknown flags
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit f884a9f9e59206a2d41f265e7e403f080d10b493 upstream.
When some ioctl flags are checked we return EOPNOTSUPP, like for BTRFS_SCRUB_SUPPORTED_FLAGS, BTRFS_SUBVOL_CREATE_ARGS_MASK or fallocate modes. The EINVAL is supposed to be for a supported but invalid values or combination of options. Fix that when checking send flags so it's consistent with the rest.
--- fs/btrfs/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/send.c +1 -1
@@ -8111,7 +8111,7 @@ long btrfs_ioctl_send(struct inode *inod }if (arg->flags & ~BTRFS_SEND_FLAG_MASK ) { - ret = -EINVAL ; + ret = -EOPNOTSUPP ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 13/309 btrfs: dont reserve space for checksums when writing to nocow files
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit feefe1f49d26bad9d8997096e3a200280fa7b1c5 upstream.
Currently when doing a write to a file we always reserve metadata space for inserting data checksums. However we don't need to do it if we have a nodatacow file (-o nodatacow mount option or chattr +C) or if checksums are disabled (-o nodatasum mount option), as in that case we are only adding unnecessary pressure to metadata reservations.
For example on x86_64, with the default node size of 16K, a 4K buffered write into a nodatacow file is reserving 655360 bytes of metadata space, as it's accounting for checksums. After this change, which stops reserving space for checksums if we have a nodatacow file or checksums are disabled, we only need to reserve 393216 bytes of metadata.
--- fs/btrfs/delalloc-space.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
fs/btrfs/delalloc-space.c +19 -10
@@ -245,7 +245,6 @@ static void btrfs_calculate_inode_block_struct btrfs_block_rsv *block_rsv = &inode->block_rsv;u64 reserve_size =0 ;u64 qgroup_rsv_size =0 ; -u64 csum_leaves;unsigned outstanding_extents;lockdep_assert_held (&inode->lock);
@@ -260,10 +259,12 @@ static void btrfs_calculate_inode_block_ outstanding_extents); reserve_size +=btrfs_calc_metadata_size (fs_info,1 ); } - csum_leaves =btrfs_csum_bytes_to_leaves (fs_info, - inode->csum_bytes); - reserve_size +=btrfs_calc_insert_metadata_size (fs_info, - csum_leaves); +if (!(inode->flags &BTRFS_INODE_NODATASUM )) { +u64 csum_leaves; + + csum_leaves =btrfs_csum_bytes_to_leaves (fs_info, inode->csum_bytes); + reserve_size +=btrfs_calc_insert_metadata_size (fs_info, csum_leaves); + }/* * For qgroup rsv, the calculation is very simple: * account one nodesize for each outstanding extent
@@ -278,14 +279,20 @@ static void btrfs_calculate_inode_block_spin_unlock (&block_rsv->lock); } -static void calc_inode_reservations (struct btrfs_fs_info *fs_info, +static void calc_inode_reservations (struct btrfs_inode *inode,u64 num_bytes,u64 disk_num_bytes,u64 *meta_reserve,u64 *qgroup_reserve) { +struct btrfs_fs_info *fs_info = inode->root->fs_info;u64 nr_extents =count_max_extents (fs_info, num_bytes); -u64 csum_leaves =btrfs_csum_bytes_to_leaves (fs_info, disk_num_bytes); +u64 csum_leaves;u64 inode_update =btrfs_calc_metadata_size (fs_info,1 ); +if (inode->flags &BTRFS_INODE_NODATASUM ) + csum_leaves =0 ; +else + csum_leaves =btrfs_csum_bytes_to_leaves (fs_info, disk_num_bytes); + *meta_reserve =btrfs_calc_insert_metadata_size (fs_info, nr_extents + csum_leaves);
@@ -337,7 +344,7 @@ int btrfs_delalloc_reserve_metadata(stru* everything out and try again, which is bad. This way we just * over-reserve slightly, and clean up the mess when we are done. */ -calc_inode_reservations (fs_info, num_bytes, disk_num_bytes, +calc_inode_reservations (inode, num_bytes, disk_num_bytes, &meta_reserve, &qgroup_reserve); ret =btrfs_qgroup_reserve_meta_prealloc (root, qgroup_reserve, true, noflush);
@@ -359,7 +366,8 @@ int btrfs_delalloc_reserve_metadata(stru nr_extents =count_max_extents (fs_info, num_bytes);spin_lock (&inode->lock);btrfs_mod_outstanding_extents (inode, nr_extents); - inode->csum_bytes += disk_num_bytes; +if (!(inode->flags &BTRFS_INODE_NODATASUM )) + inode->csum_bytes += disk_num_bytes;btrfs_calculate_inode_block_rsv_size (fs_info, inode);spin_unlock (&inode->lock);
@@ -393,7 +401,8 @@ void btrfs_delalloc_release_metadata(str num_bytes =ALIGN (num_bytes, fs_info->sectorsize);spin_lock (&inode->lock); - inode->csum_bytes -= num_bytes; +if (!(inode->flags &BTRFS_INODE_NODATASUM )) + inode->csum_bytes -= num_bytes;btrfs_calculate_inode_block_rsv_size (fs_info, inode);spin_unlock (&inode->lock);
Greg Kroah-Hartman
maintainerPATCH 14/309 btrfs: reject encoded write if inode has nodatasum flag set
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 1bd96c92c6a0a4d43815eb685c15aa4b78879dc9 upstream.
Currently we allow an encoded write against inodes that have the NODATASUM flag set, either because they are NOCOW files or they were created while the filesystem was mounted with "-o nodatasum". This results in having compressed extents without corresponding checksums, which is a filesystem inconsistency reported by 'btrfs check'.
For example, running btrfs/281 with MOUNT_OPTIONS="-o nodatacow" triggers this and 'btrfs check' errors out with:
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space tree
[4/7] checking fs roots
root 256 inode 257 errors 1040, bad file extent, some csum missing root 256 inode 258 errors 1040, bad file extent, some csum missing
ERROR: errors found in fs roots
(...)
So reject encoded writes if the target inode has NODATASUM set.
--- fs/btrfs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/btrfs/inode.c +7 -0
@@ -10233,6 +10233,13 @@ ssize_t btrfs_do_encoded_write(struct kiif (encoded->encryption !=BTRFS_ENCODED_IO_ENCRYPTION_NONE )return -EINVAL ; +/* +* Compressed extents should always have checksums, so error out if we +* have a NOCOW file or inode was created while mounted with NODATASUM. +*/ +if (inode->flags &BTRFS_INODE_NODATASUM ) +return -EINVAL ; + orig_count =iov_iter_count (from);/* The extent size must be sane. */
Greg Kroah-Hartman
maintainerPATCH 15/309 btrfs: dont drop extent_map for free space inode on write error
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 5571e41ec6e56e35f34ae9f5b3a335ef510e0ade upstream.
While running the CI for an unrelated change I hit the following panic with generic/648 on btrfs_holes_spacecache.
assertion failed: block_start != EXTENT_MAP_HOLE, in fs/btrfs/extent_io.c:1385
------------[ cut here ]------------ kernel BUG at fs/btrfs/extent_io.c:1385! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 2695096 Comm: fsstress Kdump: loaded Tainted: G W 6.8.0-rc2+ #1 RIP: 0010:__extent_writepage_io.constprop.0+0x4c1/0x5c0 Call Trace: <TASK> extent_write_cache_pages+0x2ac/0x8f0 extent_writepages+0x87/0x110 do_writepages+0xd5/0x1f0 filemap_fdatawrite_wbc+0x63/0x90 __filemap_fdatawrite_range+0x5c/0x80 btrfs_fdatawrite_range+0x1f/0x50 btrfs_write_out_cache+0x507/0x560 btrfs_write_dirty_block_groups+0x32a/0x420 commit_cowonly_roots+0x21b/0x290 btrfs_commit_transaction+0x813/0x1360 btrfs_sync_file+0x51a/0x640 __x64_sys_fdatasync+0x52/0x90 do_syscall_64+0x9c/0x190 entry_SYSCALL_64_after_hwframe+0x6e/0x76
This happens because we fail to write out the free space cache in one instance, come back around and attempt to write it again. However on the second pass through we go to call btrfs_get_extent() on the inode to get the extent mapping. Because this is a new block group, and with the free space inode we always search the commit root to avoid deadlocking with the tree, we find nothing and return a EXTENT_MAP_HOLE for the requested range.
This happens because the first time we try to write the space cache out we hit an error, and on an error we drop the extent mapping. This is normal for normal files, but the free space cache inode is special. We always expect the extent map to be correct. Thus the second time through we end up with a bogus extent map.
Since we're deprecating this feature, the most straightforward way to fix this is to simply skip dropping the extent map range for this failed range.
I shortened the test by using error injection to stress the area to make it easier to reproduce. With this patch in place we no longer panic with my error injection test.
--- fs/btrfs/inode.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +17 -2
@@ -3175,8 +3175,23 @@ out: unwritten_start += logical_len;clear_extent_uptodate (io_tree, unwritten_start, end,NULL ); -/* Drop extent maps for the part of the extent we didn't write. */ -btrfs_drop_extent_map_range (inode, unwritten_start, end, false); +/* +* Drop extent maps for the part of the extent we didn't write. +* +* We have an exception here for the free_space_inode, this is +* because when we do btrfs_get_extent() on the free space inode +* we will search the commit root. If this is a new block group +* we won't find anything, and we will trip over the assert in +* writepage where we do ASSERT(em->block_start != +* EXTENT_MAP_HOLE). +* +* Theoretically we could also skip this for any NOCOW extent as +* we don't mess with the extent map tree in the NOCOW case, but +* for now simply skip this if we are the free space inode. +*/ +if (!btrfs_is_free_space_inode (inode)) +btrfs_drop_extent_map_range (inode, unwritten_start, + end, false);/* * If the ordered extent had an IOERR or something else went
Greg Kroah-Hartman
maintainerPATCH 16/309 driver core: Fix device_link_flag_is_sync_state_only()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravana Kannan <[email protected]>
commit 7fddac12c38237252431d5b8af7b6d5771b6d125 upstream.
device_link_flag_is_sync_state_only() correctly returns true on the flags of an existing device link that only implements sync_state() functionality. However, it incorrectly and confusingly returns false if it's called with DL_FLAG_SYNC_STATE_ONLY.
This bug doesn't manifest in any of the existing calls to this function, but fix this confusing behavior to avoid future bugs.
--- drivers/base/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/core.c +4 -2
@@ -284,10 +284,12 @@ static bool device_is_ancestor(struct dereturn false; } +#define DL_MARKER_FLAGS (DL_FLAG_INFERRED | \ + DL_FLAG_CYCLE | \ + DL_FLAG_MANAGED)static inline bool device_link_flag_is_sync_state_only (u32 flags) { -return (flags & ~(DL_FLAG_INFERRED |DL_FLAG_CYCLE )) == - (DL_FLAG_SYNC_STATE_ONLY |DL_FLAG_MANAGED ); +return (flags & ~DL_MARKER_FLAGS ) ==DL_FLAG_SYNC_STATE_ONLY ; }/**
Greg Kroah-Hartman
maintainerPATCH 17/309 kselftest: dt: Stop relying on dirname to improve performance
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 6154fb9c2134f8d9534b2de10491aa3a22f3c9ff ]
When walking directory trees, instead of looking for specific files and running dirname to get the parent folder, traverse all folders and ignore the ones not containing the desired files. This avoids the need to call dirname inside the loop, which drastically decreases run time:
Running locally on a mt8192-asurada-spherion, which reports 160 test cases, has gone from 5.5s to 2.9s, while running remotely with an nfsroot has gone from 13.5s to 5.5s.
This change has a side-effect, which is that the root DT node now also shows in the output, even though it isn't expected to bind to a driver. However there shouldn't be a matching driver for the board compatible, so the end result will be just an extra skipped test:
ok 1 / # SKIP
--- tools/testing/selftests/dt/test_unprobed_devices.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tools/testing/selftests/dt/test_unprobed_devices.sh +7 -6
@@ -33,8 +33,8 @@ if [[ ! -d "${PDT}" ]]; then fi nodes_compatible=$( - for node_compat in $(find ${PDT} -name compatible); do - node=$(dirname "${node_compat}") + for node in $(find ${PDT} -type d); do + [ ! -f "${node}"/compatible ] && continue # Check if node is available if [[ -e "${node}"/status ]]; then status=$(tr -d '\000' < "${node}"/status)
@@ -46,10 +46,11 @@ nodes_compatible=$( nodes_dev_bound=$( IFS=$'\n' - for uevent in $(find /sys/devices -name uevent); do - if [[ -d "$(dirname "${uevent}")"/driver ]]; then - grep '^OF_FULLNAME=' "${uevent}" | sed -e 's|OF_FULLNAME=||' - fi + for dev_dir in $(find /sys/devices -type d); do + [ ! -f "${dev_dir}"/uevent ] && continue + [ ! -d "${dev_dir}"/driver ] && continue + + grep '^OF_FULLNAME=' "${dev_dir}"/uevent | sed -e 's|OF_FULLNAME=||' done )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 18/309 selftests/landlock: Fix net_test build with old libc
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hu Yadi <[email protected]>
[ Upstream commit 116099ed345c932a8ae4a0d884a8f6cc54fd5fed ]
One issue comes up while building selftest/landlock/net_test on my side (gcc 7.3/glibc-2.28/kernel-4.19).
net_test.c: In function ‘set_service’:
net_test.c:91:45: warning: implicit declaration of function ‘gettid’; [-Wimplicit-function-declaration]
"_selftests-landlock-net-tid%d-index%d", gettid(),
^~~~~~
getgidnet_test.c:(.text+0x4e0): undefined reference to `gettid'
--- tools/testing/selftests/landlock/net_test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/testing/selftests/landlock/net_test.c +7 -1
@@ -17,6 +17,7 @@#include <string.h> #include <sys/prctl.h> #include <sys/socket.h> +#include <sys/syscall.h> #include <sys/un.h> #include "common.h"
@@ -54,6 +55,11 @@ struct service_fixture { }; }; +static pid_t sys_gettid (void ) +{ +return syscall (__NR_gettid); +} +static int set_service (struct service_fixture *const srv,const struct protocol_variant prot,const unsigned short index)
@@ -88,7 +94,7 @@ static int set_service(struct service_fixture *const srv,case AF_UNIX : srv->unix_addr.sun_family = prot.domain;sprintf (srv->unix_addr.sun_path, -"_selftests-landlock-net-tid%d-index%d" ,gettid (), +"_selftests-landlock-net-tid%d-index%d" ,sys_gettid (), index); srv->unix_addr_len =SUN_LEN (&srv->unix_addr); srv->unix_addr.sun_path[0 ] ='\0' ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 19/309 selftests/landlock: Fix fs_test build with old libc
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hu Yadi <[email protected]>
[ Upstream commit 40b7835e74e0383be308d528c5e0e41b3bf72ade ]
One issue comes up while building selftest/landlock/fs_test on my side (gcc 7.3/glibc-2.28/kernel-4.19).
gcc -Wall -O2 -isystem fs_test.c -lcap -o selftests/landlock/fs_test
fs_test.c:4575:9: error: initializer element is not constant
.mnt = mnt_tmp,
^~~~~~~
--- tools/testing/selftests/landlock/fs_test.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/landlock/fs_test.c +8 -3
@@ -241,9 +241,11 @@ struct mnt_opt {const char *const data; }; -const struct mnt_opt mnt_tmp = { +#define MNT_TMP_DATA "size=4m,mode=700" + +static const struct mnt_opt mnt_tmp = { .type ="tmpfs" , - .data ="size=4m,mode=700" , + .data =MNT_TMP_DATA , };static int mount_opt (const struct mnt_opt *const mnt,const char *const target)
@@ -4572,7 +4574,10 @@ FIXTURE_VARIANT(layout3_fs)/* clang-format off */ FIXTURE_VARIANT_ADD(layout3_fs, tmpfs) {/* clang-format on */ - .mnt = mnt_tmp, + .mnt = { + .type = "tmpfs", + .data = MNT_TMP_DATA, + }, .file_path = file1_s1d1, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 20/309 of: unittest: Fix compile in the non-dynamic case
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
[ Upstream commit 607aad1e4356c210dbef9022955a3089377909b2 ]
If CONFIG_OF_KOBJ is not set, a device_node does not contain a kobj and attempts to access the embedded kobj via kref_read break the compile.
Replace affected kref_read calls with a macro that reads the refcount if it exists and returns 1 if there is no embedded kobj.
--- drivers/of/unittest.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/of/unittest.c +9 -3
@@ -50,6 +50,12 @@ static struct unittest_results { failed; \ }) +#ifdef CONFIG_OF_KOBJ +#define OF_KREF_READ (NODE ) kref_read(&(NODE)->kobj.kref) +#else +#define OF_KREF_READ (NODE ) 1 +#endif +/* * Expected message may have a message level other than KERN_INFO. * Print the expected message only if the current loglevel will allow
@@ -570,7 +576,7 @@ static void __init of_unittest_parse_phandle_with_args_map(void)pr_err ("missing testcase data\n" );return ; } - prefs[i] =kref_read (&p[i]->kobj.kref); + prefs[i] =OF_KREF_READ (p[i]); } rc =of_count_phandle_with_args (np,"phandle-list" ,"#phandle-cells" );
@@ -693,9 +699,9 @@ static void __init of_unittest_parse_phandle_with_args_map(void)unittest (rc == -EINVAL ,"expected:%i got:%i\n" , -EINVAL , rc);for (i =0 ; i <ARRAY_SIZE (p); ++i) { -unittest (prefs[i] ==kref_read (&p[i]->kobj.kref), +unittest (prefs[i] ==OF_KREF_READ (p[i]),"provider%d: expected:%d got:%d\n" , - i, prefs[i],kref_read (&p[i]->kobj.kref)); + i, prefs[i],OF_KREF_READ (p[i]));of_node_put (p[i]); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 21/309 drm/msm/gem: Fix double resv lock aquire
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 03facb39d6c6433a78d0f79c7a146b1e6a61943e ]
Since commit 79e2cf2e7a19 ("drm/gem: Take reservation lock for vmap/vunmap operations"), the resv lock is already held in the prime vmap path, so don't try to grab it again.
v2: This applies to vunmap path as well
v3: Fix fixes commit
Patchwork: https://patchwork.freedesktop.org/patch/576642/
--- drivers/gpu/drm/msm/msm_gem_prime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_gem_prime.c +2 -2
@@ -26,7 +26,7 @@ int msm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map) {void *vaddr; - vaddr =msm_gem_get_vaddr (obj); + vaddr =msm_gem_get_vaddr_locked (obj);if (IS_ERR (vaddr))return PTR_ERR (vaddr);iosys_map_set_vaddr (map, vaddr);
@@ -36,7 +36,7 @@ int msm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map)void msm_gem_prime_vunmap (struct drm_gem_object *obj,struct iosys_map *map) { -msm_gem_put_vaddr (obj); +msm_gem_put_vaddr_locked (obj); } struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 22/309 selftests/landlock: Fix capability for net_test
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
[ Upstream commit bb6f4dbe2639d5b8a9fde4bfb6fefecfd3f18df3 ]
CAP_NET_ADMIN allows to configure network interfaces, not CAP_SYS_ADMIN which only allows to call unshare(2). Without this change, running network tests as a non-root user but with all capabilities would fail at the setup_loopback() step with "RTNETLINK answers: Operation not permitted".
The issue is only visible when running tests with non-root users (i.e. only relying on ambient capabilities). Indeed, when configuring the network interface, the "ip" command is called, which may lead to the special handling of capabilities for the root user by execve(2). If root is the caller, then the inherited, permitted and effective capabilities are all reset, which then includes CAP_NET_ADMIN. However, if a non-root user is the caller, then ambient capabilities are masked by the inherited ones, which were explicitly dropped.
To make execution deterministic whatever users are running the tests, set the noroot secure bit for each test, and set the inheritable and ambient capabilities to CAP_NET_ADMIN, the only capability that may be required after an execve(2).
Factor out _effective_cap() into _change_cap(), and use it to manage ambient capabilities with the new set_ambient_cap() and clear_ambient_cap() helpers.
This makes it possible to run all Landlock tests with check-linux.sh from https://github.com/landlock-lsm/landlock-test-tools
--- tools/testing/selftests/landlock/common.h | 48 +++++++++++++++++---- tools/testing/selftests/landlock/net_test.c | 5 ++- 2 files changed, 44 insertions(+), 9 deletions(-)
tools/testing/selftests/landlock/common.h +40 -8
@@ -9,6 +9,7 @@#include <errno.h> #include <linux/landlock.h> +#include <linux/securebits.h> #include <sys/capability.h> #include <sys/socket.h> #include <sys/syscall.h>
@@ -115,11 +116,16 @@ static void _init_caps(struct __test_metadata *const _metadata, bool drop_all)/* clang-format off */ CAP_DAC_OVERRIDE ,CAP_MKNOD , +CAP_NET_ADMIN , +CAP_NET_BIND_SERVICE ,CAP_SYS_ADMIN , CAP_SYS_CHROOT, -CAP_NET_BIND_SERVICE , /* clang-format on */ }; +const unsigned int noroot =SECBIT_NOROOT |SECBIT_NOROOT_LOCKED ; + +if ((cap_get_secbits () & noroot) != noroot) +EXPECT_EQ (0 ,cap_set_secbits (noroot)); cap_p =cap_get_proc ();EXPECT_NE (NULL , cap_p)
@@ -137,6 +143,8 @@ static void _init_caps(struct __test_metadata *const _metadata, bool drop_all)TH_LOG ("Failed to cap_set_flag: %s" ,strerror (errno)); } } + +/* Automatically resets ambient capabilities. */ EXPECT_NE(-1, cap_set_proc(cap_p)) {TH_LOG ("Failed to cap_set_proc: %s" ,strerror (errno));
@@ -145,6 +153,9 @@ static void _init_caps(struct __test_metadata *const _metadata, bool drop_all) {TH_LOG ("Failed to cap_free: %s" ,strerror (errno)); } + +/* Quickly checks that ambient capabilities are cleared. */ +EXPECT_NE (-1 ,cap_get_ambient (caps[0 ])); }/* We cannot put such helpers in a library because of kselftest_harness.h . */
@@ -158,8 +169,9 @@ static void __maybe_unused drop_caps(struct __test_metadata *const _metadata)_init_caps (_metadata, true); } -static void _effective_cap (struct __test_metadata *const _metadata, -const cap_value_t caps,const cap_flag_value_t value) +static void _change_cap (struct __test_metadata *const _metadata, +const cap_flag_t flag,const cap_value_t cap, +const cap_flag_value_t value) {cap_t cap_p;
@@ -168,7 +180,7 @@ static void _effective_cap(struct __test_metadata *const _metadata, {TH_LOG ("Failed to cap_get_proc: %s" ,strerror (errno)); } - EXPECT_NE(-1, cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &caps, value)) + EXPECT_NE(-1, cap_set_flag(cap_p, flag, 1, &cap, value)) {TH_LOG ("Failed to cap_set_flag: %s" ,strerror (errno)); }
@@ -183,15 +195,35 @@ static void _effective_cap(struct __test_metadata *const _metadata, }static void __maybe_unused set_cap (struct __test_metadata *const _metadata, -const cap_value_t caps) +const cap_value_t cap) { -_effective_cap (_metadata, caps,CAP_SET ); +_change_cap (_metadata,CAP_EFFECTIVE , cap,CAP_SET ); }static void __maybe_unused clear_cap (struct __test_metadata *const _metadata, -const cap_value_t caps) +const cap_value_t cap) +{ +_change_cap (_metadata,CAP_EFFECTIVE , cap,CAP_CLEAR ); +} + +static void __maybe_unused +set_ambient_cap (struct __test_metadata *const _metadata,const cap_value_t cap) +{ +_change_cap (_metadata,CAP_INHERITABLE , cap,CAP_SET ); + + EXPECT_NE(-1, cap_set_ambient(cap, CAP_SET)) + { +TH_LOG ("Failed to set ambient capability %d: %s" , cap, +strerror (errno)); + } +} + +static void __maybe_unused clear_ambient_cap ( +struct __test_metadata *const _metadata,const cap_value_t cap) { -_effective_cap (_metadata, caps,CAP_CLEAR ); +EXPECT_EQ (1 ,cap_get_ambient (cap)); +_change_cap (_metadata,CAP_INHERITABLE , cap,CAP_CLEAR ); +EXPECT_EQ (0 ,cap_get_ambient (cap)); }/* Receives an FD from a UNIX socket. Returns the received FD, or -errno. */
tools/testing/selftests/landlock/net_test.c +4 -1
@@ -107,8 +107,11 @@ static void setup_loopback(struct __test_metadata *const _metadata) {set_cap (_metadata,CAP_SYS_ADMIN );ASSERT_EQ (0 ,unshare (CLONE_NEWNET )); -ASSERT_EQ (0 ,system ("ip link set dev lo up" ));clear_cap (_metadata,CAP_SYS_ADMIN ); + +set_ambient_cap (_metadata,CAP_NET_ADMIN ); +ASSERT_EQ (0 ,system ("ip link set dev lo up" )); +clear_ambient_cap (_metadata,CAP_NET_ADMIN ); } static bool is_restricted(const struct protocol_variant *const prot,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 23/309 ASoC: Intel: avs: Fix pci_probe() error path
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit b5fbde22684af5456d1de60758950944d69d69ad ]
Recent changes modified operation-order in the probe() function without updating its error path accordingly. If snd_hdac_i915_init() exists with status EPROBE_DEFER the error path must cleanup allocated IRQs before leaving the scope.
--- sound/soc/intel/avs/core.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/avs/core.c +3 -0
@@ -477,6 +477,9 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)return 0 ; err_i915_init: +pci_free_irq (pci,0 , adev); +pci_free_irq (pci,0 , bus); +pci_free_irq_vectors (pci);pci_clear_master (pci);pci_set_drvdata (pci,NULL ); err_acquire_irq:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 24/309 spi: imx: fix the burst length at DMA mode and CPU mode
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Song <[email protected]>
[ Upstream commit c712c05e46c8ce550842951e9e2606e24dbf0475 ]
For DMA mode, the bus width of the DMA is equal to the size of data word, so burst length should be configured as bits per word.
For CPU mode, because of the spi transfer len is in byte, so calculate the total number of words according to spi transfer len and bits per word, burst length should be configured as total data bits.
--- drivers/spi/spi-imx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/spi/spi-imx.c +5 -4
@@ -2,6 +2,7 @@// Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. // Copyright (C) 2008 Juergen Beisert +#include <linux/bits.h> #include <linux/clk.h> #include <linux/completion.h> #include <linux/delay.h>
@@ -660,15 +661,15 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, << MX51_ECSPI_CTRL_BL_OFFSET; else {if (spi_imx->usedma) { - ctrl |= (spi_imx->bits_per_word * -spi_imx_bytes_per_word (spi_imx->bits_per_word) -1 ) + ctrl |= (spi_imx->bits_per_word -1 ) <<MX51_ECSPI_CTRL_BL_OFFSET ; }else {if (spi_imx->count >=MX51_ECSPI_CTRL_MAX_BURST ) - ctrl |= (MX51_ECSPI_CTRL_MAX_BURST -1 ) + ctrl |= (MX51_ECSPI_CTRL_MAX_BURST *BITS_PER_BYTE -1 ) <<MX51_ECSPI_CTRL_BL_OFFSET ;else - ctrl |= (spi_imx->count * spi_imx->bits_per_word -1 ) + ctrl |= spi_imx->count /DIV_ROUND_UP (spi_imx->bits_per_word, +BITS_PER_BYTE ) * spi_imx->bits_per_word <<MX51_ECSPI_CTRL_BL_OFFSET ; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 25/309 ASoC: Intel: avs: Fix dynamic port assignment when TDM is set
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amadeusz Sławiński <[email protected]>
[ Upstream commit 44d3b8a19b91cd2af11f918b2fd05628383172de ]
In case TDM is set in topology on SSP0, parser will overwrite vindex value, because it only checks if port is set. Fix this by checking whole field value.
--- sound/soc/intel/avs/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/topology.c +1 -1
@@ -857,7 +857,7 @@ assign_copier_gtw_instance(struct snd_soc_component *comp, struct avs_tplg_modcf }/* If topology sets value don't overwrite it */ -if (cfg->copier.vindex.i2s.instance) +if (cfg->copier.vindex.val)return ; mach =dev_get_platdata (comp->card->dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/309 wifi: iwlwifi: clear link_id in time_event
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <[email protected]>
[ Upstream commit 3012477cd510044d346c5e0465ead4732aef8349 ]
Before sending a SESSION PROTECTION cmd the driver checks if the link_id indicated in the time event (and for which the cmd will be sent) is valid and exists.
Clear the te_data::link_id when FW notifies that a session protection ended, so the check will actually fail when it should.
--- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +2 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2012-2014, 2018-2023 Intel Corporation +* Copyright (C) 2012-2014, 2018-2024 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2017 Intel Deutschland GmbH */
@@ -972,6 +972,7 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm,if (!le32_to_cpu (notif->status) || !le32_to_cpu (notif->start)) {/* End TE, notify mac80211 */ mvmvif->time_event_data.id =SESSION_PROTECT_CONF_MAX_ID ; + mvmvif->time_event_data.link_id =-1 ;iwl_mvm_p2p_roc_finished (mvm);ieee80211_remain_on_channel_expired (mvm->hw); }else if (le32_to_cpu (notif->start)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 27/309 wifi: iwlwifi: Fix some error codes
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit c6ebb5b67641994de8bc486b33457fe0b681d6fe ]
This saves the error as PTR_ERR(wifi_pkg). The problem is that "wifi_pkg" is a valid pointer, not an error pointer. Set the error code to -EINVAL instead.
--- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/acpi.c +6 -6
@@ -618,7 +618,7 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) &tbl_rev);if (!IS_ERR (wifi_pkg)) {if (tbl_rev !=2 ) { - ret =PTR_ERR (wifi_pkg); + ret = -EINVAL ; goto out_free; }
@@ -634,7 +634,7 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) &tbl_rev);if (!IS_ERR (wifi_pkg)) {if (tbl_rev !=1 ) { - ret =PTR_ERR (wifi_pkg); + ret = -EINVAL ; goto out_free; }
@@ -650,7 +650,7 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) &tbl_rev);if (!IS_ERR (wifi_pkg)) {if (tbl_rev !=0 ) { - ret =PTR_ERR (wifi_pkg); + ret = -EINVAL ; goto out_free; }
@@ -707,7 +707,7 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt) &tbl_rev);if (!IS_ERR (wifi_pkg)) {if (tbl_rev !=2 ) { - ret =PTR_ERR (wifi_pkg); + ret = -EINVAL ; goto out_free; }
@@ -723,7 +723,7 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt) &tbl_rev);if (!IS_ERR (wifi_pkg)) {if (tbl_rev !=1 ) { - ret =PTR_ERR (wifi_pkg); + ret = -EINVAL ; goto out_free; }
@@ -739,7 +739,7 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt) &tbl_rev);if (!IS_ERR (wifi_pkg)) {if (tbl_rev !=0 ) { - ret =PTR_ERR (wifi_pkg); + ret = -EINVAL ; goto out_free; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/309 wifi: iwlwifi: uninitialized variable in iwl_acpi_get_ppag_table()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 65c6ee90455053cfd3067c17aaa4a42b0c766543 ]
This is an error path and Smatch complains that "tbl_rev" is uninitialized on this path. All the other functions follow this same patter where they set the error code and goto out_free so that's probably what was intended here as well.
--- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/fw/acpi.c +3 -0
@@ -1116,6 +1116,9 @@ int iwl_acpi_get_ppag_table(struct iwl_fw_runtime *fwrt) goto read_table; } + ret =PTR_ERR (wifi_pkg); + goto out_free; + read_table: fwrt->ppag_ver = tbl_rev; flags = &wifi_pkg->package.elements[1 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 29/309 ASoC: SOF: ipc3-topology: Fix pipeline tear down logic
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjani Sridharan <[email protected]>
[ Upstream commit d7332c4a4f1a7d16f054c6357fb65c597b6a86a7 ]
With the change in the widget free logic to power down the cores only when the scheduler widgets are freed, we need to ensure that the scheduler widget is freed only after all the widgets associated with the scheduler are freed. This is to ensure that the secondary core that the scheduler is scheduled to run on is kept powered on until all widgets that need them are in use. While this works well for dynamic pipelines, in the case of static pipelines the current logic does not take this into account and frees all widgets in the order they occur in the widget_list. So, modify this to ensure that the scheduler widgets are freed only after all other types of widgets in the widget_list are freed.
--- sound/soc/sof/ipc3-topology.c | 55 ++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 14 deletions(-)
sound/soc/sof/ipc3-topology.c +41 -14
@@ -2309,27 +2309,16 @@ static int sof_tear_down_left_over_pipelines(struct snd_sof_dev *sdev)return 0 ; } -/* -* For older firmware, this function doesn't free widgets for static pipelines during suspend. -* It only resets use_count for all widgets. -*/ -static int sof_ipc3_tear_down_all_pipelines (struct snd_sof_dev *sdev,bool verify) +static int sof_ipc3_free_widgets_in_list (struct snd_sof_dev *sdev,bool include_scheduler, +bool *dyn_widgets,bool verify) {struct sof_ipc_fw_version *v = &sdev->fw_ready.version;struct snd_sof_widget *swidget; -struct snd_sof_route *sroute; -bool dyn_widgets = false;int ret; -/* -* This function is called during suspend and for one-time topology verification during -* first boot. In both cases, there is no need to protect swidget->use_count and -* sroute->setup because during suspend all running streams are suspended and during -* topology loading the sound card unavailable to open PCMs. -*/ list_for_each_entry (swidget, &sdev->widget_list, list) {if (swidget->dynamic_pipeline_widget) { - dyn_widgets = true; + *dyn_widgets = true;continue ; }
@@ -2344,11 +2333,49 @@ static int sof_ipc3_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verifcontinue ; } +if (include_scheduler && swidget->id != snd_soc_dapm_scheduler) +continue ; + +if (!include_scheduler && swidget->id == snd_soc_dapm_scheduler) +continue ; + ret =sof_widget_free (sdev, swidget);if (ret <0 )return ret; } +return 0 ; +} + +/* +* For older firmware, this function doesn't free widgets for static pipelines during suspend. +* It only resets use_count for all widgets. +*/ +static int sof_ipc3_tear_down_all_pipelines (struct snd_sof_dev *sdev,bool verify) +{ +struct sof_ipc_fw_version *v = &sdev->fw_ready.version; +struct snd_sof_widget *swidget; +struct snd_sof_route *sroute; +bool dyn_widgets = false; +int ret; + +/* +* This function is called during suspend and for one-time topology verification during +* first boot. In both cases, there is no need to protect swidget->use_count and +* sroute->setup because during suspend all running streams are suspended and during +* topology loading the sound card unavailable to open PCMs. Do not free the scheduler +* widgets yet so that the secondary cores do not get powered down before all the widgets +* associated with the scheduler are freed. +*/ + ret =sof_ipc3_free_widgets_in_list (sdev, false, &dyn_widgets, verify); +if (ret <0 ) +return ret; + +/* free all the scheduler widgets now */ + ret =sof_ipc3_free_widgets_in_list (sdev, true, &dyn_widgets, verify); +if (ret <0 ) +return ret; +/* * Tear down all pipelines associated with PCMs that did not get suspended * and unset the prepare flag so that they can be set up again during resume.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 30/309 dpll: fix possible deadlock during netlink dump operation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 53c0441dd2c44ee93fddb5473885fd41e4bc2361 ]
Recently, I've been hitting following deadlock warning during dpll pin dump:
[52804.637962] ======================================================
[52804.638536] WARNING: possible circular locking dependency detected
[52804.639111] 6.8.0-rc2jiri+ #1 Not tainted
[52804.639529] ------------------------------------------------------
[52804.640104] python3/2984 is trying to acquire lock:
[52804.640581] ffff88810e642678 (nlk_cb_mutex-GENERIC){+.+.}-{3:3}, at: netlink_dump+0xb3/0x780
[52804.641417]
but task is already holding lock:
[52804.642010] ffffffff83bde4c8 (dpll_lock){+.+.}-{3:3}, at: dpll_lock_dumpit+0x13/0x20
[52804.642747]
which lock already depends on the new lock.[52804.643551]
the existing dependency chain (in reverse order) is:
[52804.644259]
-> #1 (dpll_lock){+.+.}-{3:3}:
[52804.644836] lock_acquire+0x174/0x3e0
[52804.645271] __mutex_lock+0x119/0x1150
[52804.645723] dpll_lock_dumpit+0x13/0x20
[52804.646169] genl_start+0x266/0x320
[52804.646578] __netlink_dump_start+0x321/0x450
[52804.647056] genl_family_rcv_msg_dumpit+0x155/0x1e0
[52804.647575] genl_rcv_msg+0x1ed/0x3b0
[52804.648001] netlink_rcv_skb+0xdc/0x210
[52804.648440] genl_rcv+0x24/0x40
[52804.648831] netlink_unicast+0x2f1/0x490
[52804.649290] netlink_sendmsg+0x36d/0x660
[52804.649742] __sock_sendmsg+0x73/0xc0
[52804.650165] __sys_sendto+0x184/0x210
[52804.650597] __x64_sys_sendto+0x72/0x80
[52804.651045] do_syscall_64+0x6f/0x140
[52804.651474] entry_SYSCALL_64_after_hwframe+0x46/0x4e
[52804.652001]
-> #0 (nlk_cb_mutex-GENERIC){+.+.}-{3:3}:
[52804.652650] check_prev_add+0x1ae/0x1280
[52804.653107] __lock_acquire+0x1ed3/0x29a0
[52804.653559] lock_acquire+0x174/0x3e0
[52804.653984] __mutex_lock+0x119/0x1150
[52804.654423] netlink_dump+0xb3/0x780
[52804.654845] __netlink_dump_start+0x389/0x450
[52804.655321] genl_family_rcv_msg_dumpit+0x155/0x1e0
[52804.655842] genl_rcv_msg+0x1ed/0x3b0
[52804.656272] netlink_rcv_skb+0xdc/0x210
[52804.656721] genl_rcv+0x24/0x40
[52804.657119] netlink_unicast+0x2f1/0x490
[52804.657570] netlink_sendmsg+0x36d/0x660
[52804.658022] __sock_sendmsg+0x73/0xc0
[52804.658450] __sys_sendto+0x184/0x210
[52804.658877] __x64_sys_sendto+0x72/0x80
[52804.659322] do_syscall_64+0x6f/0x140
[52804.659752] entry_SYSCALL_64_after_hwframe+0x46/0x4e
[52804.660281]
other info that might help us debug this:[52804.661077] Possible unsafe locking scenario:
[52804.661671] CPU0 CPU1 [52804.662129] ---- ---- [52804.662577] lock(dpll_lock); [52804.662924] lock(nlk_cb_mutex-GENERIC); [52804.663538] lock(dpll_lock); [52804.664073] lock(nlk_cb_mutex-GENERIC); [52804.664490]
The issue as follows: __netlink_dump_start() calls control->start(cb) with nlk->cb_mutex held. In control->start(cb) the dpll_lock is taken. Then nlk->cb_mutex is released and taken again in netlink_dump(), while dpll_lock still being held. That leads to ABBA deadlock when another CPU races with the same operation.
Fix this by moving dpll_lock taking into dumpit() callback which ensures correct lock taking order.
--- Documentation/netlink/specs/dpll.yaml | 4 ---- drivers/dpll/dpll_netlink.c | 20 ++++++-------------- drivers/dpll/dpll_nl.c | 4 ---- drivers/dpll/dpll_nl.h | 2 -- 4 files changed, 6 insertions(+), 24 deletions(-)
Documentation/netlink/specs/dpll.yaml +0 -4
@@ -374,8 +374,6 @@ operations: - type dump: - pre: dpll-lock-dumpit - post: dpll-unlock-dumpit reply: *dev-attrs -
@@ -462,8 +460,6 @@ operations: - phase-adjust dump: - pre: dpll-lock-dumpit - post: dpll-unlock-dumpit request: attributes: - id
drivers/dpll/dpll_netlink.c +6 -14
@@ -1171,6 +1171,7 @@ int dpll_nl_pin_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)unsigned long i;int ret =0 ; +mutex_lock (&dpll_lock);xa_for_each_marked_start (&dpll_pin_xa, i, pin,DPLL_REGISTERED , ctx->idx) {if (!dpll_pin_available (pin))
@@ -1190,6 +1191,8 @@ int dpll_nl_pin_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb) }genlmsg_end (skb, hdr); } +mutex_unlock (&dpll_lock); +if (ret == -EMSGSIZE ) { ctx->idx = i;return skb->len;
@@ -1345,6 +1348,7 @@ int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)unsigned long i;int ret =0 ; +mutex_lock (&dpll_lock);xa_for_each_marked_start (&dpll_device_xa, i, dpll,DPLL_REGISTERED , ctx->idx) { hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid,
@@ -1361,6 +1365,8 @@ int dpll_nl_device_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb) }genlmsg_end (skb, hdr); } +mutex_unlock (&dpll_lock); +if (ret == -EMSGSIZE ) { ctx->idx = i;return skb->len;
@@ -1411,20 +1417,6 @@ dpll_unlock_doit(const struct genl_split_ops *ops, struct sk_buff *skb,mutex_unlock (&dpll_lock); } -int dpll_lock_dumpit (struct netlink_callback *cb) -{ -mutex_lock (&dpll_lock); - -return 0 ; -} - -int dpll_unlock_dumpit (struct netlink_callback *cb) -{ -mutex_unlock (&dpll_lock); - -return 0 ; -} -int dpll_pin_pre_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info) {
drivers/dpll/dpll_nl.c +0 -4
@@ -95,9 +95,7 @@ static const struct genl_split_ops dpll_nl_ops[] = { }, { .cmd = DPLL_CMD_DEVICE_GET, - .start = dpll_lock_dumpit, .dumpit = dpll_nl_device_get_dumpit, - .done = dpll_unlock_dumpit, .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP, }, {
@@ -129,9 +127,7 @@ static const struct genl_split_ops dpll_nl_ops[] = { }, { .cmd = DPLL_CMD_PIN_GET, - .start = dpll_lock_dumpit, .dumpit = dpll_nl_pin_get_dumpit, - .done = dpll_unlock_dumpit, .policy = dpll_pin_get_dump_nl_policy, .maxattr = DPLL_A_PIN_ID, .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
drivers/dpll/dpll_nl.h +0 -2
@@ -30,8 +30,6 @@ dpll_post_doit(const struct genl_split_ops *ops, struct sk_buff *skb,void dpll_pin_post_doit (const struct genl_split_ops *ops,struct sk_buff *skb,struct genl_info *info); -int dpll_lock_dumpit (struct netlink_callback *cb); -int dpll_unlock_dumpit (struct netlink_callback *cb);int dpll_nl_device_id_get_doit (struct sk_buff *skb,struct genl_info *info);int dpll_nl_device_get_doit (struct sk_buff *skb,struct genl_info *info);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 31/309 net/mlx5: DPLL, Fix possible use after free after delayed work timer triggers
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit aa1eec2f546f2afa8c98ec41e5d8ee488165d685 ]
I managed to hit following use after free warning recently:
[ 2169.711665] ================================================================== [ 2169.714009] BUG: KASAN: slab-use-after-free in __run_timers.part.0+0x179/0x4c0 [ 2169.716293] Write of size 8 at addr ffff88812b326a70 by task swapper/4/0
[ 2169.719022] CPU: 4 PID: 0 Comm: swapper/4 Not tainted 6.8.0-rc2jiri+ #2 [ 2169.720974] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 2169.722457] Call Trace: [ 2169.722756] <IRQ> [ 2169.723024] dump_stack_lvl+0x58/0xb0 [ 2169.723417] print_report+0xc5/0x630 [ 2169.723807] ? __virt_addr_valid+0x126/0x2b0 [ 2169.724268] kasan_report+0xbe/0xf0 [ 2169.724667] ? __run_timers.part.0+0x179/0x4c0 [ 2169.725116] ? __run_timers.part.0+0x179/0x4c0 [ 2169.725570] __run_timers.part.0+0x179/0x4c0 [ 2169.726003] ? call_timer_fn+0x320/0x320 [ 2169.726404] ? lock_downgrade+0x3a0/0x3a0 [ 2169.726820] ? kvm_clock_get_cycles+0x14/0x20 [ 2169.727257] ? ktime_get+0x92/0x150 [ 2169.727630] ? lapic_next_deadline+0x35/0x60 [ 2169.728069] run_timer_softirq+0x40/0x80 [ 2169.728475] __do_softirq+0x1a1/0x509 [ 2169.728866] irq_exit_rcu+0x95/0xc0 [ 2169.729241] sysvec_apic_timer_interrupt+0x6b/0x80 [ 2169.729718] </IRQ> [ 2169.729993] <TASK> [ 2169.730259] asm_sysvec_apic_timer_interrupt+0x16/0x20 [ 2169.730755] RIP: 0010:default_idle+0x13/0x20 [ 2169.731190] Code: c0 08 00 00 00 4d 29 c8 4c 01 c7 4c 29 c2 e9 72 ff ff ff cc cc cc cc 8b 05 9a 7f 1f 02 85 c0 7e 07 0f 00 2d cf 69 43 00 fb f4 <fa> c3 66 66 2e 0f 1f 84 00 00 00 00 00 65 48 8b 04 25 c0 93 04 00 [ 2169.732759] RSP: 0018:ffff888100dbfe10 EFLAGS: 00000242 [ 2169.733264] RAX: 0000000000000001 RBX: ffff888100d9c200 RCX: ffffffff8241bd62 [ 2169.733925] RDX: ffffed109a848b15 RSI: 0000000000000004 RDI: ffffffff8127ac55 [ 2169.734566] RBP: 0000000000000004 R08: 0000000000000000 R09: ffffed109a848b14 [ 2169.735200] R10: ffff8884d42458a3 R11: 000000000000ba7e R12: ffffffff83d7d3a0 [ 2169.735835] R13: 1ffff110201b7fc6 R14: 0000000000000000 R15: ffff888100d9c200 [ 2169.736478] ? ct_kernel_exit.constprop.0+0xa2/0xc0 [ 2169.736954] ? do_idle+0x285/0x290 [ 2169.737323] default_idle_call+0x63/0x90 [ 2169.737730] do_idle+0x285/0x290 [ 2169.738089] ? arch_cpu_idle_exit+0x30/0x30 [ 2169.738511] ? mark_held_locks+0x1a/0x80 [ 2169.738917] ? lockdep_hardirqs_on_prepare+0x12e/0x200 [ 2169.739417] cpu_startup_entry+0x30/0x40 [ 2169.739825] start_secondary+0x19a/0x1c0 [ 2169.740229] ? set_cpu_sibling_map+0xbd0/0xbd0 [ 2169.740673] secondary_startup_64_no_verify+0x15d/0x16b [ 2169.741179] </TASK>
[ 2169.741686] Allocated by task 1098: [ 2169.742058] kasan_save_stack+0x1c/0x40 [ 2169.742456] kasan_save_track+0x10/0x30 [ 2169.742852] __kasan_kmalloc+0x83/0x90 [ 2169.743246] mlx5_dpll_probe+0xf5/0x3c0 [mlx5_dpll] [ 2169.743730] auxiliary_bus_probe+0x62/0xb0 [ 2169.744148] really_probe+0x127/0x590 [ 2169.744534] __driver_probe_device+0xd2/0x200 [ 2169.744973] device_driver_attach+0x6b/0xf0 [ 2169.745402] bind_store+0x90/0xe0 [ 2169.745761] kernfs_fop_write_iter+0x1df/0x2a0 [ 2169.746210] vfs_write+0x41f/0x790 [ 2169.746579] ksys_write+0xc7/0x160 [ 2169.746947] do_syscall_64+0x6f/0x140 [ 2169.747333] entry_SYSCALL_64_after_hwframe+0x46/0x4e
[ 2169.748049] Freed by task 1220: [ 2169.748393] kasan_save_stack+0x1c/0x40 [ 2169.748789] kasan_save_track+0x10/0x30 [ 2169.749188] kasan_save_free_info+0x3b/0x50 [ 2169.749621] poison_slab_object+0x106/0x180 [ 2169.750044] __kasan_slab_free+0x14/0x50 [ 2169.750451] kfree+0x118/0x330 [ 2169.750792] mlx5_dpll_remove+0xf5/0x110 [mlx5_dpll] [ 2169.751271] auxiliary_bus_remove+0x2e/0x40 [ 2169.751694] device_release_driver_internal+0x24b/0x2e0 [ 2169.752191] unbind_store+0xa6/0xb0 [ 2169.752563] kernfs_fop_write_iter+0x1df/0x2a0 [ 2169.753004] vfs_write+0x41f/0x790 [ 2169.753381] ksys_write+0xc7/0x160 [ 2169.753750] do_syscall_64+0x6f/0x140 [ 2169.754132] entry_SYSCALL_64_after_hwframe+0x46/0x4e
[ 2169.754847] Last potentially related work creation: [ 2169.755315] kasan_save_stack+0x1c/0x40 [ 2169.755709] __kasan_record_aux_stack+0x9b/0xf0 [ 2169.756165] __queue_work+0x382/0x8f0 [ 2169.756552] call_timer_fn+0x126/0x320 [ 2169.756941] __run_timers.part.0+0x2ea/0x4c0 [ 2169.757376] run_timer_softirq+0x40/0x80 [ 2169.757782] __do_softirq+0x1a1/0x509
[ 2169.758387] Second to last potentially related work creation: [ 2169.758924] kasan_save_stack+0x1c/0x40 [ 2169.759322] __kasan_record_aux_stack+0x9b/0xf0 [ 2169.759773] __queue_work+0x382/0x8f0 [ 2169.760156] call_timer_fn+0x126/0x320 [ 2169.760550] __run_timers.part.0+0x2ea/0x4c0 [ 2169.760978] run_timer_softirq+0x40/0x80 [ 2169.761381] __do_softirq+0x1a1/0x509
[ 2169.761998] The buggy address belongs to the object at ffff88812b326a00
which belongs to the cache kmalloc-256 of size 256
[ 2169.763061] The buggy address is located 112 bytes inside of
freed 256-byte region [ffff88812b326a00, ffff88812b326b00)[ 2169.764346] The buggy address belongs to the physical page: [ 2169.764866] page:000000000f2b1e89 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12b324 [ 2169.765731] head:000000000f2b1e89 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 2169.766484] anon flags: 0x200000000000840(slab|head|node=0|zone=2) [ 2169.767048] page_type: 0xffffffff() [ 2169.767422] raw: 0200000000000840 ffff888100042b40 0000000000000000 dead000000000001 [ 2169.768183] raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 [ 2169.768899] page dumped because: kasan: bad access detected
[ 2169.769649] Memory state around the buggy address: [ 2169.770116] ffff88812b326900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 2169.770805] ffff88812b326980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 2169.771485] >ffff88812b326a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2169.772173] ^ [ 2169.772787] ffff88812b326a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2169.773477] ffff88812b326b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 2169.774160] ================================================================== [ 2169.774845] ==================================================================
I didn't manage to reproduce it. Though the issue seems to be obvious. There is a chance that the mlx5_dpll_remove() calls cancel_delayed_work() when the work runs and manages to re-arm itself. In that case, after delay timer triggers next attempt to queue it, it works with freed memory.
Fix this by using cancel_delayed_work_sync() instead which makes sure that work is done when it returns.
--- drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/dpll.c +1 -1
@@ -374,7 +374,7 @@ static void mlx5_dpll_remove(struct auxiliary_device *adev)struct mlx5_dpll *mdpll =auxiliary_get_drvdata (adev);struct mlx5_core_dev *mdev = mdpll->mdev; -cancel_delayed_work (&mdpll->work); +cancel_delayed_work_sync (&mdpll->work);mlx5_dpll_mdev_netdev_untrack (mdpll, mdev);destroy_workqueue (mdpll->wq); dpll_pin_unregister(mdpll->dpll, mdpll->dpll_pin,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 32/309 net/handshake: Fix handshake_req_destroy_test1
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 4e1d71cabb19ec2586827adfc60d68689c68c194 ]
Recently, handshake_req_destroy_test1 started failing:
Expected handshake_req_destroy_test == req, but
handshake_req_destroy_test == 0000000000000000
req == 0000000060f99b40not ok 11 req_destroy works
This is because "sock_release(sock)" was replaced with "fput(filp)" to address a memory leak. Note that sock_release() is synchronous but fput() usually delays the final close and clean-up.
The delay is not consequential in the other cases that were changed but handshake_req_destroy_test1 is testing that handshake_req_cancel() followed by closing the file actually does call the ->hp_destroy method. Thus the PTR_EQ test at the end has to be sure that the final close is complete before it checks the pointer.
We cannot use a completion here because if ->hp_destroy is never called (ie, there is an API bug) then the test will hang.
Reported by: Guenter Roeck <[email protected]>
--- net/handshake/handshake-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/handshake/handshake-test.c +4 -1
@@ -471,7 +471,10 @@ static void handshake_req_destroy_test1(struct kunit *test)handshake_req_cancel (sock->sk);/* Act */ -fput (filp); +/* Ensure the close/release/put process has run to +* completion before checking the result. +*/ +__fput_sync (filp);/* Assert */ KUNIT_EXPECT_PTR_EQ (test, handshake_req_destroy_test, req);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 33/309 bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Magnus Karlsson <[email protected]>
[ Upstream commit 9b0ed890ac2ae233efd8b27d11aee28a19437bb8 ]
Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the bonding driver does not support XDP and AF_XDP in zero-copy mode even if the real NIC drivers do.
Note that the driver used to report everything as supported before a device was bonded. Instead of just masking out the zero-copy support from this, have the driver report that no XDP feature is supported until a real device is bonded. This seems to be more truthful as it is the real drivers that decide what XDP features are supported.
--- drivers/net/bonding/bond_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/bonding/bond_main.c +2 -3
@@ -1819,6 +1819,8 @@ void bond_xdp_set_features(struct net_device *bond_dev)bond_for_each_slave (bond, slave, iter) val &= slave->dev->xdp_features; + val &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY ; +xdp_set_features_flag (bond_dev, val); }
@@ -5934,9 +5936,6 @@ void bond_setup(struct net_device *bond_dev)if (BOND_MODE (bond) ==BOND_MODE_ACTIVEBACKUP ) bond_dev->features |=BOND_XFRM_FEATURES ;#endif /* CONFIG_XFRM_OFFLOAD */ - -if (bond_xdp_check (bond)) - bond_dev->xdp_features =NETDEV_XDP_ACT_MASK ; }/* Destroy a bonding device.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 34/309 devlink: Fix command annotation documentation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
[ Upstream commit 4ab18af47a2c2a80ac11674122935700caf80cc6 ]
Command example string is not read as command.
Fix command annotation.
--- Documentation/networking/devlink/devlink-port.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/networking/devlink/devlink-port.rst +1 -1
@@ -126,7 +126,7 @@ Users may also set the RoCE capability of the function using `devlink port function set roce` command. Users may also set the function as migratable using -'devlink port function set migratable' command. +`devlink port function set migratable` command. Users may also set the IPsec crypto capability of the function using `devlink port function set ipsec_crypto` command.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 35/309 of: property: Improve finding the consumer of a remote-endpoint property
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravana Kannan <[email protected]>
[ Upstream commit f4653ec9861cd96a1a6a3258c4a807898ee8cf3c ]
We have a more accurate function to find the right consumer of a remote-endpoint property instead of searching for a parent with compatible string property. So, use that instead. While at it, make the code to find the consumer a bit more flexible and based on the property being parsed.
--- drivers/of/property.c | 47 +++++++++---------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-)
drivers/of/property.c +10 -37
@@ -1062,36 +1062,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,return of_device_get_match_data (dev); } -static struct device_node *of_get_compat_node (struct device_node *np) -{ -of_node_get (np); - -while (np) { -if (!of_device_is_available (np)) { -of_node_put (np); - np =NULL ; - } - -if (of_property_present (np,"compatible" )) -break ; - - np =of_get_next_parent (np); - } - -return np; -} - -static struct device_node *of_get_compat_node_parent (struct device_node *np) -{ -struct device_node *parent, *node; - - parent =of_get_parent (np); - node =of_get_compat_node (parent); -of_node_put (parent); - -return node; -} -static void of_link_to_phandle (struct device_node *con_np,struct device_node *sup_np) {
@@ -1221,10 +1191,10 @@ static struct device_node *parse_##fname(struct device_node *np, \* @parse_prop.prop_name: Name of property holding a phandle value * @parse_prop.index: For properties holding a list of phandles, this is the * index into the list +* @get_con_dev: If the consumer node containing the property is never converted +* to a struct device, implement this ops so fw_devlink can use it +* to find the true consumer. * @optional: Describes whether a supplier is mandatory or not -* @node_not_dev: The consumer node containing the property is never converted -* to a struct device. Instead, parse ancestor nodes for the -* compatible property to find a node corresponding to a device. * * Returns: * parse_prop() return values are
@@ -1235,8 +1205,8 @@ static struct device_node *parse_##fname(struct device_node *np, \struct supplier_bindings {struct device_node *(*parse_prop)(struct device_node *np,const char *prop_name,int index); +struct device_node *(*get_con_dev)(struct device_node *np);bool optional; -bool node_not_dev; };DEFINE_SIMPLE_PROP (clocks,"clocks" ,"#clock-cells" )
@@ -1351,7 +1321,10 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl6, }, { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, - { .parse_prop = parse_remote_endpoint, .node_not_dev = true, }, + { + .parse_prop = parse_remote_endpoint, + .get_con_dev = of_graph_get_port_parent, + }, { .parse_prop = parse_pwms, }, { .parse_prop = parse_resets, }, { .parse_prop = parse_leds, },
@@ -1402,8 +1375,8 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)while ((phandle = s->parse_prop (con_np, prop_name, i))) {struct device_node *con_dev_np; - con_dev_np = s->node_not_dev - ?of_get_compat_node_parent (con_np) + con_dev_np = s->get_con_dev + ? s->get_con_dev (con_np) :of_node_get (con_np); matched = true; i++;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 36/309 of: property: Improve finding the supplier of a remote-endpoint property
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravana Kannan <[email protected]>
[ Upstream commit 782bfd03c3ae2c0e6e01b661b8e18f1de50357be ]
After commit 4a032827daa8 ("of: property: Simplify of_link_to_phandle()"), remote-endpoint properties created a fwnode link from the consumer device to the supplier endpoint. This is a tiny bit inefficient (not buggy) when trying to create device links or detecting cycles. So, improve this the same way we improved finding the consumer of a remote-endpoint property.
--- drivers/of/property.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/of/property.c +11 -1
@@ -1231,7 +1231,6 @@ DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL) DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL) DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL) -DEFINE_SIMPLE_PROP(remote_endpoint, "remote-endpoint", NULL) DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-cells") DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells")DEFINE_SIMPLE_PROP (leds,"leds" ,NULL )
@@ -1297,6 +1296,17 @@ static struct device_node *parse_interrupts(struct device_node *np,return of_irq_parse_one (np, index, &sup_args) ?NULL : sup_args.np; } +static struct device_node *parse_remote_endpoint (struct device_node *np, +const char *prop_name, +int index) +{ +/* Return NULL for index > 0 to signify end of remote-endpoints. */ +if (!index ||strcmp (prop_name,"remote-endpoint" )) +return NULL ; + +return of_graph_get_remote_port_parent (np); +} +static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 37/309 ALSA: hda/cs35l56: select intended config FW_CS_DSP
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Bulwahn <[email protected]>
[ Upstream commit e5aa6d51a2ef8c7ef7e3fe76bebe530fb68e7f08 ]
Commit 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier") adds configs SND_HDA_SCODEC_CS35L56_{I2C,SPI}, which selects the non-existing config CS_DSP. Note the renaming in commit d7cfdf17cb9d ("firmware: cs_dsp: Rename KConfig symbol CS_DSP -> FW_CS_DSP"), though.
Select the intended config FW_CS_DSP.
This broken select command probably was not noticed as the configs also select SND_HDA_CS_DSP_CONTROLS and this then selects FW_CS_DSP. So, the select FW_CS_DSP could actually be dropped, but we will keep this redundancy in place as the author originally also intended to have this redundancy of selects in place.
--- sound/pci/hda/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/Kconfig +2 -2
@@ -156,7 +156,7 @@ config SND_HDA_SCODEC_CS35L56_I2C depends on I2C depends on ACPI || COMPILE_TEST depends on SND_SOC - select CS_DSP + select FW_CS_DSP select SND_HDA_GENERIC select SND_SOC_CS35L56_SHARED select SND_HDA_SCODEC_CS35L56
@@ -171,7 +171,7 @@ config SND_HDA_SCODEC_CS35L56_SPI depends on SPI_MASTER depends on ACPI || COMPILE_TEST depends on SND_SOC - select CS_DSP + select FW_CS_DSP select SND_HDA_GENERIC select SND_SOC_CS35L56_SHARED select SND_HDA_SCODEC_CS35L56
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 38/309 perf: CXL: fix mismatched cpmu event opcode
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hojin Nam <[email protected]>
[ Upstream commit 719da04f2d1285922abca72b074fb6fa75d464ea ]
S2M NDR BI-ConflictAck opcode is described as 4 in the CXL r3.0 3.3.9 Table 3.43. However, it is defined as 3 in macro definition.
--- drivers/perf/cxl_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/cxl_pmu.c +1 -1
@@ -419,7 +419,7 @@ static struct attribute *cxl_pmu_event_attrs[] = {CXL_PMU_EVENT_CXL_ATTR (s2m_ndr_cmp,CXL_PMU_GID_S2M_NDR ,BIT (0 )),CXL_PMU_EVENT_CXL_ATTR (s2m_ndr_cmps,CXL_PMU_GID_S2M_NDR ,BIT (1 )),CXL_PMU_EVENT_CXL_ATTR (s2m_ndr_cmpe,CXL_PMU_GID_S2M_NDR ,BIT (2 )), -CXL_PMU_EVENT_CXL_ATTR (s2m_ndr_biconflictack,CXL_PMU_GID_S2M_NDR ,BIT (3 )), +CXL_PMU_EVENT_CXL_ATTR (s2m_ndr_biconflictack,CXL_PMU_GID_S2M_NDR ,BIT (4 )),/* CXL rev 3.0 Table 3-46 S2M DRS opcodes */ CXL_PMU_EVENT_CXL_ATTR (s2m_drs_memdata,CXL_PMU_GID_S2M_DRS ,BIT (0 )), CXL_PMU_EVENT_CXL_ATTR(s2m_drs_memdatanxm, CXL_PMU_GID_S2M_DRS, BIT(1)),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 39/309 selftests/net: convert test_bridge_backup_port.sh to run it in unique namespace
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 4624a78c18c62da815f3253966b7a87995f77e1b ]
There is no h1 h2 actually. Remove it. Here is the test result after conversion.
]# ./test_bridge_backup_port.sh
Backup port
-----------
TEST: Forwarding out of swp1 [ OK ]
TEST: No forwarding out of vx0 [ OK ]
TEST: swp1 carrier off [ OK ]
TEST: No forwarding out of swp1 [ OK ]
...
Backup nexthop ID - ping
------------------------
TEST: Ping with backup nexthop ID [ OK ]
TEST: Ping after disabling backup nexthop ID [ OK ]
Backup nexthop ID - torture test
--------------------------------
TEST: Torture test [ OK ]
Tests passed: 83 Tests failed: 0
Stable-dep-of: 38ee0cb2a2e2 ("selftests: net: Fix bridge backup port test flakiness")
--- .../selftests/net/test_bridge_backup_port.sh | 371 +++++++++--------- 1 file changed, 182 insertions(+), 189 deletions(-)
tools/testing/selftests/net/test_bridge_backup_port.sh +182 -189
@@ -35,9 +35,8 @@ # | sw1 | | sw2 | # +------------------------------------+ +------------------------------------+ +source lib.sh ret=0 -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 # All tests in this script. Can be overridden with -t option. TESTS="
@@ -132,9 +131,6 @@ setup_topo_ns() { local ns=$1; shift - ip netns add $ns - ip -n $ns link set dev lo up - ip netns exec $ns sysctl -qw net.ipv6.conf.all.keep_addr_on_down=1 ip netns exec $ns sysctl -qw net.ipv6.conf.default.ignore_routes_with_linkdown=1 ip netns exec $ns sysctl -qw net.ipv6.conf.all.accept_dad=0
@@ -145,13 +141,14 @@ setup_topo() { local ns - for ns in sw1 sw2; do + setup_ns sw1 sw2 + for ns in $sw1 $sw2; do setup_topo_ns $ns done ip link add name veth0 type veth peer name veth1 - ip link set dev veth0 netns sw1 name veth0 - ip link set dev veth1 netns sw2 name veth0 + ip link set dev veth0 netns $sw1 name veth0 + ip link set dev veth1 netns $sw2 name veth0 } setup_sw_common()
@@ -190,7 +187,7 @@ setup_sw_common() setup_sw1() { - local ns=sw1 + local ns=$sw1 local local_addr=192.0.2.33 local remote_addr=192.0.2.34 local veth_addr=192.0.2.49
@@ -203,7 +200,7 @@ setup_sw1() setup_sw2() { - local ns=sw2 + local ns=$sw2 local local_addr=192.0.2.34 local remote_addr=192.0.2.33 local veth_addr=192.0.2.50
@@ -229,11 +226,7 @@ setup() cleanup() { - local ns - - for ns in h1 h2 sw1 sw2; do - ip netns del $ns &> /dev/null - done + cleanup_ns $sw1 $sw2 } ################################################################################
@@ -248,85 +241,85 @@ backup_port() echo "Backup port" echo "-----------" - run_cmd "tc -n sw1 qdisc replace dev swp1 clsact" - run_cmd "tc -n sw1 filter replace dev swp1 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" + run_cmd "tc -n $sw1 qdisc replace dev swp1 clsact" + run_cmd "tc -n $sw1 filter replace dev swp1 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" - run_cmd "bridge -n sw1 fdb replace $dmac dev swp1 master static vlan 10" + run_cmd "bridge -n $sw1 fdb replace $dmac dev swp1 master static vlan 10" # Initial state - check that packets are forwarded out of swp1 when it # has a carrier and not forwarded out of any port when it does not have # a carrier. - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 1 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 1 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 0 + tc_check_packets $sw1 "dev vx0 egress" 101 0 log_test $? 0 "No forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 1 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 1 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 0 + tc_check_packets $sw1 "dev vx0 egress" 101 0 log_test $? 0 "No forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier on" + run_cmd "ip -n $sw1 link set dev swp1 carrier on" log_test $? 0 "swp1 carrier on" # Configure vx0 as the backup port of swp1 and check that packets are # forwarded out of swp1 when it has a carrier and out of vx0 when swp1 # does not have a carrier. - run_cmd "bridge -n sw1 link set dev swp1 backup_port vx0" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_port vx0\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_port vx0" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_port vx0\"" log_test $? 0 "vx0 configured as backup port of swp1" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 2 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 2 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 0 + tc_check_packets $sw1 "dev vx0 egress" 101 0 log_test $? 0 "No forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 2 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 2 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "Forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier on" + run_cmd "ip -n $sw1 link set dev swp1 carrier on" log_test $? 0 "swp1 carrier on" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 3 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 3 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "No forwarding out of vx0" # Remove vx0 as the backup port of swp1 and check that packets are no # longer forwarded out of vx0 when swp1 does not have a carrier. - run_cmd "bridge -n sw1 link set dev swp1 nobackup_port" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_port vx0\"" + run_cmd "bridge -n $sw1 link set dev swp1 nobackup_port" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_port vx0\"" log_test $? 1 "vx0 not configured as backup port of swp1" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 4 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 4 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "No forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 4 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 4 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "No forwarding out of vx0" }
@@ -339,125 +332,125 @@ backup_nhid() echo "Backup nexthop ID" echo "-----------------" - run_cmd "tc -n sw1 qdisc replace dev swp1 clsact" - run_cmd "tc -n sw1 filter replace dev swp1 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" + run_cmd "tc -n $sw1 qdisc replace dev swp1 clsact" + run_cmd "tc -n $sw1 filter replace dev swp1 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" - run_cmd "ip -n sw1 nexthop replace id 1 via 192.0.2.34 fdb" - run_cmd "ip -n sw1 nexthop replace id 2 via 192.0.2.34 fdb" - run_cmd "ip -n sw1 nexthop replace id 10 group 1/2 fdb" + run_cmd "ip -n $sw1 nexthop replace id 1 via 192.0.2.34 fdb" + run_cmd "ip -n $sw1 nexthop replace id 2 via 192.0.2.34 fdb" + run_cmd "ip -n $sw1 nexthop replace id 10 group 1/2 fdb" - run_cmd "bridge -n sw1 fdb replace $dmac dev swp1 master static vlan 10" - run_cmd "bridge -n sw1 fdb replace $dmac dev vx0 self static dst 192.0.2.36 src_vni 10010" + run_cmd "bridge -n $sw1 fdb replace $dmac dev swp1 master static vlan 10" + run_cmd "bridge -n $sw1 fdb replace $dmac dev vx0 self static dst 192.0.2.36 src_vni 10010" - run_cmd "ip -n sw2 address replace 192.0.2.36/32 dev lo" + run_cmd "ip -n $sw2 address replace 192.0.2.36/32 dev lo" # The first filter matches on packets forwarded using the backup # nexthop ID and the second filter matches on packets forwarded using a # regular VXLAN FDB entry. - run_cmd "tc -n sw2 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw2 filter replace dev vx0 ingress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac enc_key_id 10010 enc_dst_ip 192.0.2.34 action pass" - run_cmd "tc -n sw2 filter replace dev vx0 ingress pref 1 handle 102 proto ip flower src_mac $smac dst_mac $dmac enc_key_id 10010 enc_dst_ip 192.0.2.36 action pass" + run_cmd "tc -n $sw2 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw2 filter replace dev vx0 ingress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac enc_key_id 10010 enc_dst_ip 192.0.2.34 action pass" + run_cmd "tc -n $sw2 filter replace dev vx0 ingress pref 1 handle 102 proto ip flower src_mac $smac dst_mac $dmac enc_key_id 10010 enc_dst_ip 192.0.2.36 action pass" # Configure vx0 as the backup port of swp1 and check that packets are # forwarded out of swp1 when it has a carrier and out of vx0 when swp1 # does not have a carrier. When packets are forwarded out of vx0, check # that they are forwarded by the VXLAN FDB entry. - run_cmd "bridge -n sw1 link set dev swp1 backup_port vx0" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_port vx0\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_port vx0" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_port vx0\"" log_test $? 0 "vx0 configured as backup port of swp1" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 1 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 1 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 0 + tc_check_packets $sw1 "dev vx0 egress" 101 0 log_test $? 0 "No forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 1 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 1 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 0 + tc_check_packets $sw2 "dev vx0 ingress" 101 0 log_test $? 0 "No forwarding using backup nexthop ID" - tc_check_packets sw2 "dev vx0 ingress" 102 1 + tc_check_packets $sw2 "dev vx0 ingress" 102 1 log_test $? 0 "Forwarding using VXLAN FDB entry" - run_cmd "ip -n sw1 link set dev swp1 carrier on" + run_cmd "ip -n $sw1 link set dev swp1 carrier on" log_test $? 0 "swp1 carrier on" # Configure nexthop ID 10 as the backup nexthop ID of swp1 and check # that when packets are forwarded out of vx0, they are forwarded using # the backup nexthop ID. - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 10" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid 10\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 10" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid 10\"" log_test $? 0 "nexthop ID 10 configured as backup nexthop ID of swp1" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 2 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 2 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "No forwarding out of vx0" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 2 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 2 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "Forwarding using backup nexthop ID" - tc_check_packets sw2 "dev vx0 ingress" 102 1 + tc_check_packets $sw2 "dev vx0 ingress" 102 1 log_test $? 0 "No forwarding using VXLAN FDB entry" - run_cmd "ip -n sw1 link set dev swp1 carrier on" + run_cmd "ip -n $sw1 link set dev swp1 carrier on" log_test $? 0 "swp1 carrier on" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 3 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 3 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "No forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - tc_check_packets sw2 "dev vx0 ingress" 102 1 + tc_check_packets $sw2 "dev vx0 ingress" 102 1 log_test $? 0 "No forwarding using VXLAN FDB entry" # Reset the backup nexthop ID to 0 and check that packets are no longer # forwarded using the backup nexthop ID when swp1 does not have a # carrier and are instead forwarded by the VXLAN FDB. - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 0" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 0" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid\"" log_test $? 1 "No backup nexthop ID configured for swp1" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 4 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 4 log_test $? 0 "Forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "No forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - tc_check_packets sw2 "dev vx0 ingress" 102 1 + tc_check_packets $sw2 "dev vx0 ingress" 102 1 log_test $? 0 "No forwarding using VXLAN FDB entry" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 4 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 4 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - tc_check_packets sw2 "dev vx0 ingress" 102 2 + tc_check_packets $sw2 "dev vx0 ingress" 102 2 log_test $? 0 "Forwarding using VXLAN FDB entry" }
@@ -475,109 +468,109 @@ backup_nhid_invalid() # is forwarded out of the VXLAN port, but dropped by the VXLAN driver # and does not crash the host. - run_cmd "tc -n sw1 qdisc replace dev swp1 clsact" - run_cmd "tc -n sw1 filter replace dev swp1 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" + run_cmd "tc -n $sw1 qdisc replace dev swp1 clsact" + run_cmd "tc -n $sw1 filter replace dev swp1 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" - run_cmd "tc -n sw1 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" + run_cmd "tc -n $sw1 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac action pass" # Drop all other Tx traffic to avoid changes to Tx drop counter. - run_cmd "tc -n sw1 filter replace dev vx0 egress pref 2 handle 102 proto all matchall action drop" + run_cmd "tc -n $sw1 filter replace dev vx0 egress pref 2 handle 102 proto all matchall action drop" - tx_drop=$(ip -n sw1 -s -j link show dev vx0 | jq '.[]["stats64"]["tx"]["dropped"]') + tx_drop=$(ip -n $sw1 -s -j link show dev vx0 | jq '.[]["stats64"]["tx"]["dropped"]') - run_cmd "ip -n sw1 nexthop replace id 1 via 192.0.2.34 fdb" - run_cmd "ip -n sw1 nexthop replace id 2 via 192.0.2.34 fdb" - run_cmd "ip -n sw1 nexthop replace id 10 group 1/2 fdb" + run_cmd "ip -n $sw1 nexthop replace id 1 via 192.0.2.34 fdb" + run_cmd "ip -n $sw1 nexthop replace id 2 via 192.0.2.34 fdb" + run_cmd "ip -n $sw1 nexthop replace id 10 group 1/2 fdb" - run_cmd "bridge -n sw1 fdb replace $dmac dev swp1 master static vlan 10" + run_cmd "bridge -n $sw1 fdb replace $dmac dev swp1 master static vlan 10" - run_cmd "tc -n sw2 qdisc replace dev vx0 clsact" - run_cmd "tc -n sw2 filter replace dev vx0 ingress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac enc_key_id 10010 enc_dst_ip 192.0.2.34 action pass" + run_cmd "tc -n $sw2 qdisc replace dev vx0 clsact" + run_cmd "tc -n $sw2 filter replace dev vx0 ingress pref 1 handle 101 proto ip flower src_mac $smac dst_mac $dmac enc_key_id 10010 enc_dst_ip 192.0.2.34 action pass" # First, check that redirection works. - run_cmd "bridge -n sw1 link set dev swp1 backup_port vx0" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_port vx0\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_port vx0" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_port vx0\"" log_test $? 0 "vx0 configured as backup port of swp1" - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 10" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid 10\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 10" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid 10\"" log_test $? 0 "Valid nexthop as backup nexthop" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" log_test $? 0 "swp1 carrier off" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 0 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 0 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 1 + tc_check_packets $sw1 "dev vx0 egress" 101 1 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "Forwarding using backup nexthop ID" - run_cmd "ip -n sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $tx_drop'" + run_cmd "ip -n $sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $tx_drop'" log_test $? 0 "No Tx drop increase" # Use a non-existent nexthop ID. - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 20" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid 20\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 20" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid 20\"" log_test $? 0 "Non-existent nexthop as backup nexthop" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 0 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 0 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 2 + tc_check_packets $sw1 "dev vx0 egress" 101 2 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - run_cmd "ip -n sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 1))'" + run_cmd "ip -n $sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 1))'" log_test $? 0 "Tx drop increased" # Use a blckhole nexthop. - run_cmd "ip -n sw1 nexthop replace id 30 blackhole" - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 30" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid 30\"" + run_cmd "ip -n $sw1 nexthop replace id 30 blackhole" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 30" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid 30\"" log_test $? 0 "Blackhole nexthop as backup nexthop" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 0 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 0 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 3 + tc_check_packets $sw1 "dev vx0 egress" 101 3 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - run_cmd "ip -n sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 2))'" + run_cmd "ip -n $sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 2))'" log_test $? 0 "Tx drop increased" # Non-group FDB nexthop. - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 1" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid 1\"" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 1" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid 1\"" log_test $? 0 "Non-group FDB nexthop as backup nexthop" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 0 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 0 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 4 + tc_check_packets $sw1 "dev vx0 egress" 101 4 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - run_cmd "ip -n sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 3))'" + run_cmd "ip -n $sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 3))'" log_test $? 0 "Tx drop increased" # IPv6 address family nexthop. - run_cmd "ip -n sw1 nexthop replace id 100 via 2001:db8:100::1 fdb" - run_cmd "ip -n sw1 nexthop replace id 200 via 2001:db8:100::1 fdb" - run_cmd "ip -n sw1 nexthop replace id 300 group 100/200 fdb" - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 300" - run_cmd "bridge -n sw1 -d link show dev swp1 | grep \"backup_nhid 300\"" + run_cmd "ip -n $sw1 nexthop replace id 100 via 2001:db8:100::1 fdb" + run_cmd "ip -n $sw1 nexthop replace id 200 via 2001:db8:100::1 fdb" + run_cmd "ip -n $sw1 nexthop replace id 300 group 100/200 fdb" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 300" + run_cmd "bridge -n $sw1 -d link show dev swp1 | grep \"backup_nhid 300\"" log_test $? 0 "IPv6 address family nexthop as backup nexthop" - run_cmd "ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" - tc_check_packets sw1 "dev swp1 egress" 101 0 + run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1" + tc_check_packets $sw1 "dev swp1 egress" 101 0 log_test $? 0 "No forwarding out of swp1" - tc_check_packets sw1 "dev vx0 egress" 101 5 + tc_check_packets $sw1 "dev vx0 egress" 101 5 log_test $? 0 "Forwarding out of vx0" - tc_check_packets sw2 "dev vx0 ingress" 101 1 + tc_check_packets $sw2 "dev vx0 ingress" 101 1 log_test $? 0 "No forwarding using backup nexthop ID" - run_cmd "ip -n sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 4))'" + run_cmd "ip -n $sw1 -s -j link show dev vx0 | jq -e '.[][\"stats64\"][\"tx\"][\"dropped\"] == $((tx_drop + 4))'" log_test $? 0 "Tx drop increased" }
@@ -591,44 +584,44 @@ backup_nhid_ping() echo "------------------------" # Test bidirectional traffic when traffic is redirected in both VTEPs. - sw1_mac=$(ip -n sw1 -j -p link show br0.10 | jq -r '.[]["address"]') - sw2_mac=$(ip -n sw2 -j -p link show br0.10 | jq -r '.[]["address"]') + sw1_mac=$(ip -n $sw1 -j -p link show br0.10 | jq -r '.[]["address"]') + sw2_mac=$(ip -n $sw2 -j -p link show br0.10 | jq -r '.[]["address"]') - run_cmd "bridge -n sw1 fdb replace $sw2_mac dev swp1 master static vlan 10" - run_cmd "bridge -n sw2 fdb replace $sw1_mac dev swp1 master static vlan 10" + run_cmd "bridge -n $sw1 fdb replace $sw2_mac dev swp1 master static vlan 10" + run_cmd "bridge -n $sw2 fdb replace $sw1_mac dev swp1 master static vlan 10" - run_cmd "ip -n sw1 neigh replace 192.0.2.66 lladdr $sw2_mac nud perm dev br0.10" - run_cmd "ip -n sw2 neigh replace 192.0.2.65 lladdr $sw1_mac nud perm dev br0.10" + run_cmd "ip -n $sw1 neigh replace 192.0.2.66 lladdr $sw2_mac nud perm dev br0.10" + run_cmd "ip -n $sw2 neigh replace 192.0.2.65 lladdr $sw1_mac nud perm dev br0.10" - run_cmd "ip -n sw1 nexthop replace id 1 via 192.0.2.34 fdb" - run_cmd "ip -n sw2 nexthop replace id 1 via 192.0.2.33 fdb" - run_cmd "ip -n sw1 nexthop replace id 10 group 1 fdb" - run_cmd "ip -n sw2 nexthop replace id 10 group 1 fdb" + run_cmd "ip -n $sw1 nexthop replace id 1 via 192.0.2.34 fdb" + run_cmd "ip -n $sw2 nexthop replace id 1 via 192.0.2.33 fdb" + run_cmd "ip -n $sw1 nexthop replace id 10 group 1 fdb" + run_cmd "ip -n $sw2 nexthop replace id 10 group 1 fdb" - run_cmd "bridge -n sw1 link set dev swp1 backup_port vx0" - run_cmd "bridge -n sw2 link set dev swp1 backup_port vx0" - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 10" - run_cmd "bridge -n sw2 link set dev swp1 backup_nhid 10" + run_cmd "bridge -n $sw1 link set dev swp1 backup_port vx0" + run_cmd "bridge -n $sw2 link set dev swp1 backup_port vx0" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 10" + run_cmd "bridge -n $sw2 link set dev swp1 backup_nhid 10" - run_cmd "ip -n sw1 link set dev swp1 carrier off" - run_cmd "ip -n sw2 link set dev swp1 carrier off" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" + run_cmd "ip -n $sw2 link set dev swp1 carrier off" - run_cmd "ip netns exec sw1 ping -i 0.1 -c 10 -w $PING_TIMEOUT 192.0.2.66" + run_cmd "ip netns exec $sw1 ping -i 0.1 -c 10 -w $PING_TIMEOUT 192.0.2.66" log_test $? 0 "Ping with backup nexthop ID" # Reset the backup nexthop ID to 0 and check that ping fails. - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 0" - run_cmd "bridge -n sw2 link set dev swp1 backup_nhid 0" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 0" + run_cmd "bridge -n $sw2 link set dev swp1 backup_nhid 0" - run_cmd "ip netns exec sw1 ping -i 0.1 -c 10 -w $PING_TIMEOUT 192.0.2.66" + run_cmd "ip netns exec $sw1 ping -i 0.1 -c 10 -w $PING_TIMEOUT 192.0.2.66" log_test $? 1 "Ping after disabling backup nexthop ID" } backup_nhid_add_del_loop() { while true; do - ip -n sw1 nexthop del id 10 - ip -n sw1 nexthop replace id 10 group 1/2 fdb + ip -n $sw1 nexthop del id 10 + ip -n $sw1 nexthop replace id 10 group 1/2 fdb done >/dev/null 2>&1 }
@@ -648,19 +641,19 @@ backup_nhid_torture() # deleting the group. The test is considered successful if nothing # crashed. - run_cmd "ip -n sw1 nexthop replace id 1 via 192.0.2.34 fdb" - run_cmd "ip -n sw1 nexthop replace id 2 via 192.0.2.34 fdb" - run_cmd "ip -n sw1 nexthop replace id 10 group 1/2 fdb" + run_cmd "ip -n $sw1 nexthop replace id 1 via 192.0.2.34 fdb" + run_cmd "ip -n $sw1 nexthop replace id 2 via 192.0.2.34 fdb" + run_cmd "ip -n $sw1 nexthop replace id 10 group 1/2 fdb" - run_cmd "bridge -n sw1 fdb replace $dmac dev swp1 master static vlan 10" + run_cmd "bridge -n $sw1 fdb replace $dmac dev swp1 master static vlan 10" - run_cmd "bridge -n sw1 link set dev swp1 backup_port vx0" - run_cmd "bridge -n sw1 link set dev swp1 backup_nhid 10" - run_cmd "ip -n sw1 link set dev swp1 carrier off" + run_cmd "bridge -n $sw1 link set dev swp1 backup_port vx0" + run_cmd "bridge -n $sw1 link set dev swp1 backup_nhid 10" + run_cmd "ip -n $sw1 link set dev swp1 carrier off" backup_nhid_add_del_loop & pid1=$! - ip netns exec sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 0 & + ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 0 & pid2=$! sleep 30
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 40/309 selftests: net: Fix bridge backup port test flakiness
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 38ee0cb2a2e2ade077442085638eb181b0562971 ]
The test toggles the carrier of a bridge port in order to test the bridge backup port feature.
Due to the linkwatch delayed work the carrier change is not always reflected fast enough to the bridge driver and packets are not forwarded as the test expects, resulting in failures [1].
Fix by busy waiting on the bridge port state until it changes to the desired state following the carrier change.
[1]
# Backup port
# -----------
[...]
# TEST: swp1 carrier off [ OK ]
# TEST: No forwarding out of swp1 [FAIL]
[ 641.995910] br0: port 1(swp1) entered disabled state # TEST: No forwarding out of vx0 [ OK ]
--- .../selftests/net/test_bridge_backup_port.sh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
tools/testing/selftests/net/test_bridge_backup_port.sh +23 -0
@@ -124,6 +124,16 @@ tc_check_packets() [[ $pkts == $count ]] } +bridge_link_check() +{ + local ns=$1; shift + local dev=$1; shift + local state=$1; shift + + bridge -n $ns -d -j link show dev $dev | \ + jq -e ".[][\"state\"] == \"$state\"" &> /dev/null +} + ################################################################################ # Setup
@@ -259,6 +269,7 @@ backup_port() log_test $? 0 "No forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -268,6 +279,7 @@ backup_port() log_test $? 0 "No forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier on" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 forwarding log_test $? 0 "swp1 carrier on" # Configure vx0 as the backup port of swp1 and check that packets are
@@ -284,6 +296,7 @@ backup_port() log_test $? 0 "No forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -293,6 +306,7 @@ backup_port() log_test $? 0 "Forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier on" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 forwarding log_test $? 0 "swp1 carrier on" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -314,6 +328,7 @@ backup_port() log_test $? 0 "No forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -369,6 +384,7 @@ backup_nhid() log_test $? 0 "No forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -382,6 +398,7 @@ backup_nhid() log_test $? 0 "Forwarding using VXLAN FDB entry" run_cmd "ip -n $sw1 link set dev swp1 carrier on" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 forwarding log_test $? 0 "swp1 carrier on" # Configure nexthop ID 10 as the backup nexthop ID of swp1 and check
@@ -398,6 +415,7 @@ backup_nhid() log_test $? 0 "No forwarding out of vx0" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -411,6 +429,7 @@ backup_nhid() log_test $? 0 "No forwarding using VXLAN FDB entry" run_cmd "ip -n $sw1 link set dev swp1 carrier on" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 forwarding log_test $? 0 "swp1 carrier on" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -441,6 +460,7 @@ backup_nhid() log_test $? 0 "No forwarding using VXLAN FDB entry" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -497,6 +517,7 @@ backup_nhid_invalid() log_test $? 0 "Valid nexthop as backup nexthop" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled log_test $? 0 "swp1 carrier off" run_cmd "ip netns exec $sw1 mausezahn br0.10 -a $smac -b $dmac -A 198.51.100.1 -B 198.51.100.2 -t ip -p 100 -q -c 1"
@@ -604,7 +625,9 @@ backup_nhid_ping() run_cmd "bridge -n $sw2 link set dev swp1 backup_nhid 10" run_cmd "ip -n $sw1 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw1 swp1 disabled run_cmd "ip -n $sw2 link set dev swp1 carrier off" + busywait $BUSYWAIT_TIMEOUT bridge_link_check $sw2 swp1 disabled run_cmd "ip netns exec $sw1 ping -i 0.1 -c 10 -w $PING_TIMEOUT 192.0.2.66" log_test $? 0 "Ping with backup nexthop ID"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 41/309 selftests: forwarding: Fix layer 2 miss test flakiness
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 93590849a05edffaefa11695fab98f621259ded2 ]
After enabling a multicast querier on the bridge (like the test is doing), the bridge will wait for the Max Response Delay before starting to forward according to its MDB in order to let Membership Reports enough time to be received and processed.
Currently, the test is waiting for exactly the default Max Response Delay (10 seconds) which is racy and leads to failures [1].
Fix by reducing the Max Response Delay to 1 second.
[1]
[...]
# TEST: L2 miss - Multicast (IPv4) [FAIL]
# Unregistered multicast filter was hit after adding MDB entry
--- .../testing/selftests/net/forwarding/tc_flower_l2_miss.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/net/forwarding/tc_flower_l2_miss.sh +6 -2
@@ -209,14 +209,17 @@ test_l2_miss_multicast() # both registered and unregistered multicast traffic. bridge link set dev $swp2 mcast_router 2 + # Set the Max Response Delay to 100 centiseconds (1 second) so that the + # bridge will start forwarding according to its MDB soon after a + # multicast querier is enabled. + ip link set dev br1 type bridge mcast_query_response_interval 100 + # Forwarding according to MDB entries only takes place when the bridge # detects that there is a valid querier in the network. Set the bridge # as the querier and assign it a valid IPv6 link-local address to be # used as the source address for MLD queries. ip link set dev br1 type bridge mcast_querier 1 ip -6 address add fe80::1/64 nodad dev br1 - # Wait the default Query Response Interval (10 seconds) for the bridge - # to determine that there are no other queriers in the network. sleep 10 test_l2_miss_multicast_ipv4
@@ -224,6 +227,7 @@ test_l2_miss_multicast() ip -6 address del fe80::1/64 dev br1 ip link set dev br1 type bridge mcast_querier 0 + ip link set dev br1 type bridge mcast_query_response_interval 1000 bridge link set dev $swp2 mcast_router 1 }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 42/309 selftests: forwarding: Fix bridge MDB test flakiness
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 7399e2ce4d424f426417496eb289458780eea985 ]
After enabling a multicast querier on the bridge (like the test is doing), the bridge will wait for the Max Response Delay before starting to forward according to its MDB in order to let Membership Reports enough time to be received and processed.
Currently, the test is waiting for exactly the default Max Response Delay (10 seconds) which is racy and leads to failures [1].
Fix by reducing the Max Response Delay to 1 second.
[1]
[...]
# TEST: IPv4 host entries forwarding tests [FAIL]
# Packet locally received after flood
--- tools/testing/selftests/net/forwarding/bridge_mdb.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/net/forwarding/bridge_mdb.sh +6 -2
@@ -1065,14 +1065,17 @@ fwd_test() echo log_info "# Forwarding tests" + # Set the Max Response Delay to 100 centiseconds (1 second) so that the + # bridge will start forwarding according to its MDB soon after a + # multicast querier is enabled. + ip link set dev br0 type bridge mcast_query_response_interval 100 + # Forwarding according to MDB entries only takes place when the bridge # detects that there is a valid querier in the network. Set the bridge # as the querier and assign it a valid IPv6 link-local address to be # used as the source address for MLD queries. ip -6 address add fe80::1/64 nodad dev br0 ip link set dev br0 type bridge mcast_querier 1 - # Wait the default Query Response Interval (10 seconds) for the bridge - # to determine that there are no other queriers in the network. sleep 10 fwd_test_host
@@ -1080,6 +1083,7 @@ fwd_test() ip link set dev br0 type bridge mcast_querier 0 ip -6 address del fe80::1/64 dev br0 + ip link set dev br0 type bridge mcast_query_response_interval 1000 } ctrl_igmpv3_is_in_test()
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 43/309 selftests: forwarding: Suppress grep warnings
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit dd6b34589441f2ad4698dd88a664811550148b41 ]
Suppress the following grep warnings:
[...]
INFO: # Port group entries configuration tests - (*, G)
TEST: Common port group entries configuration tests (IPv4 (*, G)) [ OK ]
TEST: Common port group entries configuration tests (IPv6 (*, G)) [ OK ]
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
TEST: IPv4 (*, G) port group entries configuration tests [ OK ]
grep: warning: stray \ before /
grep: warning: stray \ before /
grep: warning: stray \ before /
TEST: IPv6 (*, G) port group entries configuration tests [ OK ]
[...]
They do not fail the test, but do clutter the output.
--- tools/testing/selftests/net/forwarding/bridge_mdb.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/net/forwarding/bridge_mdb.sh +3 -3
@@ -329,7 +329,7 @@ __cfg_test_port_ip_star_g() bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q " 0.00" check_err $? "(*, G) \"permanent\" entry has a pending group timer" - bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "\/0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "/0.00" check_err $? "\"permanent\" source entry has a pending source timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10
@@ -346,7 +346,7 @@ __cfg_test_port_ip_star_g() bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q " 0.00" check_fail $? "(*, G) EXCLUDE entry does not have a pending group timer" - bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "\/0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "/0.00" check_err $? "\"blocked\" source entry has a pending source timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10
@@ -363,7 +363,7 @@ __cfg_test_port_ip_star_g() bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q " 0.00" check_err $? "(*, G) INCLUDE entry has a pending group timer" - bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "\/0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "/0.00" check_fail $? "Source entry does not have a pending source timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 44/309 selftests: forwarding: Fix bridge locked port test flakiness
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit f97f1fcc96908c97a240ff6cb4474e155abfa0d7 ]
The redirection test case fails in the netdev CI on debug kernels because an FDB entry is learned despite the presence of a tc filter that redirects incoming traffic [1].
I am unable to reproduce the failure locally, but I can see how it can happen given that learning is first enabled and only then the ingress tc filter is configured. On debug kernels the time window between these two operations is longer compared to regular kernels, allowing random packets to be transmitted and trigger learning.
Fix by reversing the order and configure the ingress tc filter before enabling learning.
[1]
[...]
# TEST: Locked port MAB redirect [FAIL]
# Locked entry created for redirected traffic
--- tools/testing/selftests/net/forwarding/bridge_locked_port.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/forwarding/bridge_locked_port.sh +2 -2
@@ -327,10 +327,10 @@ locked_port_mab_redirect() RET=0 check_port_mab_support || return 0 - bridge link set dev $swp1 learning on locked on mab on tc qdisc add dev $swp1 clsact tc filter add dev $swp1 ingress protocol all pref 1 handle 101 flower \ action mirred egress redirect dev $swp2 + bridge link set dev $swp1 learning on locked on mab on ping_do $h1 192.0.2.2 check_err $? "Ping did not work with redirection"
@@ -349,8 +349,8 @@ locked_port_mab_redirect() check_err $? "Locked entry not created after deleting filter" bridge fdb del `mac_get $h1` vlan 1 dev $swp1 master - tc qdisc del dev $swp1 clsact bridge link set dev $swp1 learning off locked off mab off + tc qdisc del dev $swp1 clsact log_test "Locked port MAB redirect" }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 45/309 net: openvswitch: limit the number of recursions from action sets
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Conole <[email protected]>
[ Upstream commit 6e2f90d31fe09f2b852de25125ca875aabd81367 ]
The ovs module allows for some actions to recursively contain an action list for complex scenarios, such as sampling, checking lengths, etc. When these actions are copied into the internal flow table, they are evaluated to validate that such actions make sense, and these calls happen recursively.
The ovs-vswitchd userspace won't emit more than 16 recursion levels deep. However, the module has no such limit and will happily accept limits larger than 16 levels nested. Prevent this by tracking the number of recursions happening and manually limiting it to 16 levels nested.
The initial implementation of the sample action would track this depth and prevent more than 3 levels of recursion, but this was removed to support the clone use case, rather than limited at the current userspace limit.
--- net/openvswitch/flow_netlink.c | 49 +++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 16 deletions(-)
net/openvswitch/flow_netlink.c +33 -16
@@ -48,6 +48,7 @@ struct ovs_len_tbl {#define OVS_ATTR_NESTED -1#define OVS_ATTR_VARIABLE -2 +#define OVS_COPY_ACTIONS_MAX_DEPTH 16static bool actions_may_change_flow (const struct nlattr *actions) {
@@ -2545,13 +2546,15 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,const struct sw_flow_key *key, struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, - u32 mpls_label_count, bool log); + u32 mpls_label_count, bool log, + u32 depth);static int validate_and_copy_sample (struct net *net,const struct nlattr *attr,const struct sw_flow_key *key,struct sw_flow_actions **sfa,__be16 eth_type,__be16 vlan_tci, -u32 mpls_label_count,bool log,bool last) +u32 mpls_label_count,bool log,bool last, +u32 depth) {const struct nlattr *attrs[OVS_SAMPLE_ATTR_MAX +1 ];const struct nlattr *probability, *actions;
@@ -2602,7 +2605,8 @@ static int validate_and_copy_sample(struct net *net, const struct nlattr *attr,return err; err =__ovs_nla_copy_actions (net, actions, key, sfa, - eth_type, vlan_tci, mpls_label_count, log); + eth_type, vlan_tci, mpls_label_count, log, + depth +1 );if (err)return err;
@@ -2617,7 +2621,8 @@ static int validate_and_copy_dec_ttl(struct net *net,const struct sw_flow_key *key, struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, - u32 mpls_label_count, bool log) + u32 mpls_label_count, bool log, + u32 depth) { const struct nlattr *attrs[OVS_DEC_TTL_ATTR_MAX + 1];int start, action_start, err, rem;
@@ -2660,7 +2665,8 @@ static int validate_and_copy_dec_ttl(struct net *net,return action_start; err =__ovs_nla_copy_actions (net, actions, key, sfa, eth_type, - vlan_tci, mpls_label_count, log); + vlan_tci, mpls_label_count, log, + depth +1 );if (err)return err;
@@ -2674,7 +2680,8 @@ static int validate_and_copy_clone(struct net *net,const struct sw_flow_key *key, struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, - u32 mpls_label_count, bool log, bool last) + u32 mpls_label_count, bool log, bool last, + u32 depth) { int start, err;u32 exec;
@@ -2694,7 +2701,8 @@ static int validate_and_copy_clone(struct net *net,return err; err =__ovs_nla_copy_actions (net, attr, key, sfa, - eth_type, vlan_tci, mpls_label_count, log); + eth_type, vlan_tci, mpls_label_count, log, + depth +1 );if (err)return err;
@@ -3063,7 +3071,7 @@ static int validate_and_copy_check_pkt_len(struct net *net,struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, u32 mpls_label_count, - bool log, bool last) + bool log, bool last, u32 depth) { const struct nlattr *acts_if_greater, *acts_if_lesser_eq;struct nlattr *a[OVS_CHECK_PKT_LEN_ATTR_MAX +1 ];
@@ -3111,7 +3119,8 @@ static int validate_and_copy_check_pkt_len(struct net *net,return nested_acts_start; err =__ovs_nla_copy_actions (net, acts_if_lesser_eq, key, sfa, - eth_type, vlan_tci, mpls_label_count, log); + eth_type, vlan_tci, mpls_label_count, log, + depth +1 );if (err)return err;
@@ -3124,7 +3133,8 @@ static int validate_and_copy_check_pkt_len(struct net *net,return nested_acts_start; err =__ovs_nla_copy_actions (net, acts_if_greater, key, sfa, - eth_type, vlan_tci, mpls_label_count, log); + eth_type, vlan_tci, mpls_label_count, log, + depth +1 );if (err)return err;
@@ -3152,12 +3162,16 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,const struct sw_flow_key *key, struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, - u32 mpls_label_count, bool log) + u32 mpls_label_count, bool log, + u32 depth) { u8 mac_proto = ovs_key_mac_proto(key);const struct nlattr *a;int rem, err; +if (depth >OVS_COPY_ACTIONS_MAX_DEPTH ) +return -EOVERFLOW ; +nla_for_each_nested (a, attr, rem) {/* Expected argument lengths, (u32)-1 for variable length. */ static const u32 action_lens[OVS_ACTION_ATTR_MAX + 1] = {
@@ -3355,7 +3369,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, err =validate_and_copy_sample (net, a, key, sfa, eth_type, vlan_tci, mpls_label_count, - log, last); + log, last, depth);if (err)return err; skip_copy = true;
@@ -3426,7 +3440,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, err =validate_and_copy_clone (net, a, key, sfa, eth_type, vlan_tci, mpls_label_count, - log, last); + log, last, depth);if (err)return err; skip_copy = true;
@@ -3440,7 +3454,8 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, eth_type, vlan_tci, mpls_label_count, - log, last); + log, last, + depth);if (err)return err; skip_copy = true;
@@ -3450,7 +3465,8 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,case OVS_ACTION_ATTR_DEC_TTL : err =validate_and_copy_dec_ttl (net, a, key, sfa, eth_type, vlan_tci, - mpls_label_count, log); + mpls_label_count, log, + depth);if (err)return err; skip_copy = true;
@@ -3495,7 +3511,8 @@ int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, (*sfa)->orig_len =nla_len (attr); err =__ovs_nla_copy_actions (net, attr, key, sfa, key->eth.type, - key->eth.vlan.tci, mpls_label_count, log); + key->eth.vlan.tci, mpls_label_count, log, +0 );if (err)ovs_nla_free_flow_actions (*sfa);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/309 lan966x: Fix crash when adding interface under a lag
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 15faa1f67ab405d47789d4702f587ec7df7ef03e ]
There is a crash when adding one of the lan966x interfaces under a lag interface. The issue can be reproduced like this:
ip link add name bond0 type bond miimon 100 mode balance-xor ip link set dev eth0 master bond0
The reason is because when adding a interface under the lag it would go through all the ports and try to figure out which other ports are under that lag interface. And the issue is that lan966x can have ports that are NULL pointer as they are not probed. So then iterating over these ports it would just crash as they are NULL pointers.
The fix consists in actually checking for NULL pointers before accessing something from the ports. Like we do in other places.
--- drivers/net/ethernet/microchip/lan966x/lan966x_lag.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/lan966x/lan966x_lag.c +7 -2
@@ -37,19 +37,24 @@ static void lan966x_lag_set_aggr_pgids(struct lan966x *lan966x)/* Now, set PGIDs for each active LAG */ for (lag =0 ; lag < lan966x->num_phys_ports; ++lag) { -struct net_device *bond = lan966x->ports[lag]->bond; +struct lan966x_port *port = lan966x->ports[lag];int num_active_ports =0 ; +struct net_device *bond;unsigned long bond_mask;u8 aggr_idx[16 ]; -if (!bond || (visited &BIT (lag))) +if (!port || !port->bond || (visited &BIT (lag)))continue ; + bond = port->bond; bond_mask =lan966x_lag_get_mask (lan966x, bond);for_each_set_bit (p, &bond_mask, lan966x->num_phys_ports) {struct lan966x_port *port = lan966x->ports[p]; +if (!port) +continue ; +lan_wr (ANA_PGID_PGID_SET (bond_mask), lan966x,ANA_PGID (p));if (port->lag_tx_active)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 47/309 net: tls: factor out tls_*crypt_async_wait()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit c57ca512f3b68ddcd62bda9cc24a8f5584ab01b1 ]
Factor out waiting for async encrypt and decrypt to finish. There are already multiple copies and a subsequent fix will need more. No functional changes.
Note that crypto_wait_req() returns wait->err
Stable-dep-of: aec7961916f3 ("tls: fix race between async notify and socket close")
--- net/tls/tls_sw.c | 96 +++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 51 deletions(-)
net/tls/tls_sw.c +45 -51
@@ -230,6 +230,20 @@ static void tls_decrypt_done(void *data, int err)spin_unlock_bh (&ctx->decrypt_compl_lock); } +static int tls_decrypt_async_wait (struct tls_sw_context_rx *ctx) +{ +int pending; + +spin_lock_bh (&ctx->decrypt_compl_lock); +reinit_completion (&ctx->async_wait.completion); + pending =atomic_read (&ctx->decrypt_pending); +spin_unlock_bh (&ctx->decrypt_compl_lock); +if (pending) +crypto_wait_req (-EINPROGRESS , &ctx->async_wait); + +return ctx->async_wait.err; +} + static int tls_do_decryption(struct sock *sk, struct scatterlist *sgin, struct scatterlist *sgout,
@@ -495,6 +509,28 @@ static void tls_encrypt_done(void *data, int err)schedule_delayed_work (&ctx->tx_work.work,1 ); } +static int tls_encrypt_async_wait (struct tls_sw_context_tx *ctx) +{ +int pending; + +spin_lock_bh (&ctx->encrypt_compl_lock); + ctx->async_notify = true; + + pending =atomic_read (&ctx->encrypt_pending); +spin_unlock_bh (&ctx->encrypt_compl_lock); +if (pending) +crypto_wait_req (-EINPROGRESS , &ctx->async_wait); +else +reinit_completion (&ctx->async_wait.completion); + +/* There can be no concurrent accesses, since we have no +* pending encrypt operations +*/ +WRITE_ONCE (ctx->async_notify, false); + +return ctx->async_wait.err; +} + static int tls_do_encryption(struct sock *sk, struct tls_context *tls_ctx, struct tls_sw_context_tx *ctx,
@@ -984,7 +1020,6 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,int num_zc =0 ;int orig_size;int ret =0 ; -int pending;if (!eor && (msg->msg_flags &MSG_EOR ))return -EINVAL ;
@@ -1163,24 +1198,12 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg,if (!num_async) { goto send_end; }else if (num_zc) { -/* Wait for pending encryptions to get completed */ -spin_lock_bh (&ctx->encrypt_compl_lock); - ctx->async_notify = true; - - pending =atomic_read (&ctx->encrypt_pending); -spin_unlock_bh (&ctx->encrypt_compl_lock); -if (pending) -crypto_wait_req (-EINPROGRESS , &ctx->async_wait); -else -reinit_completion (&ctx->async_wait.completion); - -/* There can be no concurrent accesses, since we have no -* pending encrypt operations -*/ -WRITE_ONCE (ctx->async_notify, false); +int err; -if (ctx->async_wait.err) { - ret = ctx->async_wait.err; +/* Wait for pending encryptions to get completed */ + err =tls_encrypt_async_wait (ctx); +if (err) { + ret = err; copied =0 ; } }
@@ -1229,7 +1252,6 @@ void tls_sw_splice_eof(struct socket *sock)ssize_t copied =0 ;bool retrying = false;int ret =0 ; -int pending;if (!ctx->open_rec)return ;
@@ -1264,22 +1286,7 @@ void tls_sw_splice_eof(struct socket *sock) }/* Wait for pending encryptions to get completed */ -spin_lock_bh (&ctx->encrypt_compl_lock); - ctx->async_notify = true; - - pending =atomic_read (&ctx->encrypt_pending); -spin_unlock_bh (&ctx->encrypt_compl_lock); -if (pending) -crypto_wait_req (-EINPROGRESS , &ctx->async_wait); -else -reinit_completion (&ctx->async_wait.completion); - -/* There can be no concurrent accesses, since we have no pending -* encrypt operations -*/ -WRITE_ONCE (ctx->async_notify, false); - -if (ctx->async_wait.err) +if (tls_encrypt_async_wait (ctx)) goto unlock;/* Transmit if any encryptions have completed */
@@ -2109,16 +2116,10 @@ int tls_sw_recvmsg(struct sock *sk, recv_end:if (async) { -int ret, pending; +int ret;/* Wait for all previously submitted records to be decrypted */ -spin_lock_bh (&ctx->decrypt_compl_lock); -reinit_completion (&ctx->async_wait.completion); - pending =atomic_read (&ctx->decrypt_pending); -spin_unlock_bh (&ctx->decrypt_compl_lock); - ret =0 ; -if (pending) - ret =crypto_wait_req (-EINPROGRESS , &ctx->async_wait); + ret =tls_decrypt_async_wait (ctx);__skb_queue_purge (&ctx->async_hold);if (ret) {
@@ -2435,16 +2436,9 @@ void tls_sw_release_resources_tx(struct sock *sk)struct tls_context *tls_ctx =tls_get_ctx (sk);struct tls_sw_context_tx *ctx =tls_sw_ctx_tx (tls_ctx);struct tls_rec *rec, *tmp; -int pending;/* Wait for any pending async encryptions to complete */ -spin_lock_bh (&ctx->encrypt_compl_lock); - ctx->async_notify = true; - pending =atomic_read (&ctx->encrypt_pending); -spin_unlock_bh (&ctx->encrypt_compl_lock); - -if (pending) -crypto_wait_req (-EINPROGRESS , &ctx->async_wait); +tls_encrypt_async_wait (ctx);tls_tx_records (sk,-1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 48/309 tls: fix race between async notify and socket close
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit aec7961916f3f9e88766e2688992da6980f11b8d ]
The submitting thread (one which called recvmsg/sendmsg) may exit as soon as the async crypto handler calls complete() so any code past that point risks touching already freed data.
Try to avoid the locking and extra flags altogether. Have the main thread hold an extra reference, this way we can depend solely on the atomic ref counter for synchronization.
Don't futz with reiniting the completion, either, we are now tightly controlling when completion fires.
--- include/net/tls.h | 5 ----- net/tls/tls_sw.c | 43 ++++++++++--------------------------------- 2 files changed, 10 insertions(+), 38 deletions(-)
include/net/tls.h +0 -5
@@ -97,9 +97,6 @@ struct tls_sw_context_tx {struct tls_rec *open_rec;struct list_head tx_list;atomic_t encrypt_pending; -/* protect crypto_wait with encrypt_pending */ -spinlock_t encrypt_compl_lock; -int async_notify; u8 async_capable:1;#define BIT_TX_SCHEDULED 0
@@ -136,8 +133,6 @@ struct tls_sw_context_rx {struct tls_strparser strp;atomic_t decrypt_pending; -/* protect crypto_wait with decrypt_pending*/ -spinlock_t decrypt_compl_lock;struct sk_buff_head async_hold;struct wait_queue_head wq; };
net/tls/tls_sw.c +10 -33
99 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 49/309 tls: fix race between tx work scheduling and socket close
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit e01e3934a1b2d122919f73bc6ddbe1cdafc4bbdb ]
Similarly to previous commit, the submitting thread (recvmsg/sendmsg) may exit as soon as the async crypto handler calls complete(). Reorder scheduling the work before calling complete(). This seems more logical in the first place, as it's
the inverse order of what the submitting thread will do.
--- net/tls/tls_sw.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
net/tls/tls_sw.c +6 -10
@@ -447,7 +447,6 @@ static void tls_encrypt_done(void *data, int err)struct tls_rec *rec = data;struct scatterlist *sge;struct sk_msg *msg_en; -bool ready = false;struct sock *sk; msg_en = &rec->msg_encrypted;
@@ -483,19 +482,16 @@ static void tls_encrypt_done(void *data, int err)/* If received record is at head of tx_list, schedule tx */ first_rec =list_first_entry (&ctx->tx_list, struct tls_rec, list); -if (rec == first_rec) - ready = true; +if (rec == first_rec) { +/* Schedule the transmission */ +if (!test_and_set_bit (BIT_TX_SCHEDULED , + &ctx->tx_bitmask)) +schedule_delayed_work (&ctx->tx_work.work,1 ); + } }if (atomic_dec_and_test (&ctx->encrypt_pending))complete (&ctx->async_wait.completion); - -if (!ready) -return ; - -/* Schedule the transmission */ -if (!test_and_set_bit (BIT_TX_SCHEDULED , &ctx->tx_bitmask)) -schedule_delayed_work (&ctx->tx_work.work,1 ); }static int tls_encrypt_async_wait (struct tls_sw_context_tx *ctx)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 50/309 net: tls: handle backlogging of crypto requests
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 8590541473188741055d27b955db0777569438e3 ]
Since we're setting the CRYPTO_TFM_REQ_MAY_BACKLOG flag on our requests to the crypto API, crypto_aead_{encrypt,decrypt} can return
-EBUSY instead of -EINPROGRESS in valid situations. For example, when
the cryptd queue for AESNI is full (easy to trigger with an artificially low cryptd.cryptd_max_cpu_qlen), requests will be enqueued to the backlog but still processed. In that case, the async callback will also be called twice: first with err == -EINPROGRESS, which it seems we can just ignore, then with err == 0.
Compared to Sabrina's original patch this version uses the new tls_*crypt_async_wait() helpers and converts the EBUSY to EINPROGRESS to avoid having to modify all the error handling paths. The handling is identical.
--- net/tls/tls_sw.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
net/tls/tls_sw.c +22 -0
@@ -196,6 +196,17 @@ static void tls_decrypt_done(void *data, int err)struct sock *sk;int aead_size; +/* If requests get too backlogged crypto API returns -EBUSY and calls +* ->complete(-EINPROGRESS) immediately followed by ->complete(0) +* to make waiting for backlog to flush with crypto_wait_req() easier. +* First wait converts -EBUSY -> -EINPROGRESS, and the second one +* -EINPROGRESS -> 0. +* We have a single struct crypto_async_request per direction, this +* scheme doesn't help us, so just ignore the first ->complete(). +*/ +if (err == -EINPROGRESS ) +return ; + aead_size =sizeof (*aead_req) +crypto_aead_reqsize (aead); aead_size = ALIGN(aead_size, __alignof__(*dctx)); dctx = (void *)((u8 *)aead_req + aead_size);
@@ -269,6 +280,10 @@ static int tls_do_decryption(struct sock *sk, } ret =crypto_aead_decrypt (aead_req); +if (ret == -EBUSY ) { + ret =tls_decrypt_async_wait (ctx); + ret = ret ?: -EINPROGRESS ; + }if (ret == -EINPROGRESS ) {if (darg->async)return 0 ;
@@ -449,6 +464,9 @@ static void tls_encrypt_done(void *data, int err)struct sk_msg *msg_en;struct sock *sk; +if (err == -EINPROGRESS )/* see the comment in tls_decrypt_done() */ +return ; + msg_en = &rec->msg_encrypted; sk = rec->sk;
@@ -553,6 +571,10 @@ static int tls_do_encryption(struct sock *sk,atomic_inc (&ctx->encrypt_pending); rc =crypto_aead_encrypt (aead_req); +if (rc == -EBUSY ) { + rc =tls_encrypt_async_wait (ctx); + rc = rc ?: -EINPROGRESS ; + }if (!rc || rc != -EINPROGRESS ) {atomic_dec (&ctx->encrypt_pending); sge->offset -= prot->prepend_size;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/309 net: tls: fix use-after-free with partial reads and async decrypt
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 32b55c5ff9103b8508c1e04bfa5a08c64e7a925f ]
tls_decrypt_sg doesn't take a reference on the pages from clear_skb, so the put_page() in tls_decrypt_done releases them, and we trigger a use-after-free in process_rx_list when we try to read from the partially-read skb.
--- net/tls/tls_sw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/tls/tls_sw.c +3 -2
@@ -63,6 +63,7 @@ struct tls_decrypt_ctx {u8 iv[TLS_MAX_IV_SIZE ];u8 aad[TLS_MAX_AAD_SIZE ];u8 tail; +bool free_sgout;struct scatterlist sg[]; };
@@ -187,7 +188,6 @@ static void tls_decrypt_done(void *data, int err)struct aead_request *aead_req = data;struct crypto_aead *aead =crypto_aead_reqtfm (aead_req);struct scatterlist *sgout = aead_req->dst; -struct scatterlist *sgin = aead_req->src;struct tls_sw_context_rx *ctx;struct tls_decrypt_ctx *dctx;struct tls_context *tls_ctx;
@@ -224,7 +224,7 @@ static void tls_decrypt_done(void *data, int err) }/* Free the destination pages if skb was not decrypted inplace */ -if (sgout != sgin) { +if (dctx->free_sgout) {/* Skip the first S/G entry as it points to AAD */ for_each_sg (sg_next (sgout), sg,UINT_MAX , pages) {if (!sg)
@@ -1583,6 +1583,7 @@ static int tls_decrypt_sg(struct sock *sk, struct iov_iter *out_iov, }else if (out_sg) {memcpy (sgout, out_sg, n_sgout *sizeof (*sgout)); } + dctx->free_sgout = !!pages;/* Prepare and submit AEAD request */ err = tls_do_decryption(sk, sgin, sgout, dctx->iv,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/309 net: tls: fix returned read length with async decrypt
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit ac437a51ce662364062f704e321227f6728e6adc ]
We double count async, non-zc rx data. The previous fix was lucky because if we fully zc async_copy_bytes is 0 so we add 0. Decrypted already has all the bytes we handled, in all cases. We don't have to adjust anything, delete the erroneous line.
--- net/tls/tls_sw.c | 1 - 1 file changed, 1 deletion(-)
net/tls/tls_sw.c +0 -1
@@ -2132,7 +2132,6 @@ int tls_sw_recvmsg(struct sock *sk,else err =process_rx_list (ctx, msg, &control,0 , async_copy_bytes, is_peek); - decrypted +=max (err,0 ); } copied += decrypted;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 53/309 spi: ppc4xx: Drop write-only variable
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit b3aa619a8b4706f35cb62f780c14e68796b37f3f ]
Since commit 24778be20f87 ("spi: convert drivers to use bits_per_word_mask") the bits_per_word variable is only written to. The check that was there before isn't needed any more as the spi core ensures that only 8 bit transfers are used, so the variable can go away together with all assignments to it.
--- drivers/spi/spi-ppc4xx.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/spi/spi-ppc4xx.c +0 -5
@@ -166,10 +166,8 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t)int scr;u8 cdm =0 ;u32 speed; -u8 bits_per_word;/* Start with the generic configuration for this device. */ - bits_per_word = spi->bits_per_word; speed = spi->max_speed_hz;/*
@@ -177,9 +175,6 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t)* the transfer to overwrite the generic configuration with zeros. */ if (t) { -if (t->bits_per_word) - bits_per_word = t->bits_per_word; -if (t->speed_hz) speed =min (t->speed_hz, spi->max_speed_hz); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 54/309 ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
[ Upstream commit 6ef5d5b92f7117b324efaac72b3db27ae8bb3082 ]
There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex is left locked forever. That may lead to deadlock
when rt5645_jack_detect_work() is called for the second time.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/codecs/rt5645.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5645.c +1 -0
@@ -3314,6 +3314,7 @@ static void rt5645_jack_detect_work(struct work_struct *work) report, SND_JACK_HEADPHONE);snd_soc_jack_report (rt5645->mic_jack, report,SND_JACK_MICROPHONE ); +mutex_unlock (&rt5645->jd_mutex);return ;case 4 : val =snd_soc_component_read (rt5645->component,RT5645_A_JD_CTRL1 ) &0x0020 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/309 drm/i915/dsc: Fix the macro that calculates DSCC_/DSCA_ PPS reg address
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manasi Navare <[email protected]>
[ Upstream commit 962ac2dce56bb3aad1f82a4bbe3ada57a020287c ]
Commit bd077259d0a9 ("drm/i915/vdsc: Add function to read any PPS register") defines a new macro to calculate the DSC PPS register addresses with PPS number as an input. This macro correctly calculates the addresses till PPS 11 since the addresses increment by 4. So in that case the following macro works correctly to give correct register address:
_MMIO(_DSCA_PPS_0 + (pps) * 4)
However after PPS 11, the register address for PPS 12 increments by 12 because of RC Buffer memory allocation in between. Because of this discontinuity in the address space, the macro calculates wrong addresses for PPS 12 - 16 resulting into incorrect DSC PPS parameter value read/writes causing DSC corruption.
This fixes it by correcting this macro to add the offset of 12 for PPS
Quoted 1 line
=12.
v3: Add correct paranthesis for pps argument (Jani Nikula)
--- drivers/gpu/drm/i915/display/intel_vdsc_regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_vdsc_regs.h +2 -2
@@ -51,8 +51,8 @@#define DSCC_PICTURE_PARAMETER_SET_0 _MMIO(0x6BA00)#define _DSCA_PPS_0 0x6B200#define _DSCC_PPS_0 0x6BA00 -#define DSCA_PPS (pps) _MMIO(_DSCA_PPS_0 + (pps) * 4) -#define DSCC_PPS (pps) _MMIO(_DSCC_PPS_0 + (pps) * 4) +#define DSCA_PPS (pps) _MMIO(_DSCA_PPS_0 + ((pps) < 12 ? (pps) : (pps) + 12) * 4) +#define DSCC_PPS (pps) _MMIO(_DSCC_PPS_0 + ((pps) < 12 ? (pps) : (pps) + 12) * 4)#define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PB 0x78270#define _ICL_DSC1_PICTURE_PARAMETER_SET_0_PB 0x78370#define _ICL_DSC0_PICTURE_PARAMETER_SET_0_PC 0x78470
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/309 net: sysfs: Fix /sys/class/net/<iface> path for statistics
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 5b3fbd61b9d1f4ed2db95aaf03f9adae0373784d ]
The Documentation/ABI/testing/sysfs-class-net-statistics documentation is pointing to the wrong path for the interface. Documentation is pointing to /sys/class/<iface>, instead of /sys/class/net/<iface>.
Fix it by adding the net/ directory before the interface.
--- .../ABI/testing/sysfs-class-net-statistics | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-)
Documentation/ABI/testing/sysfs-class-net-statistics +24 -24
@@ -1,4 +1,4 @@ -What: /sys/class/<iface>/statistics/collisions +What: /sys/class/net/<iface>/statistics/collisions Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -6,7 +6,7 @@ Description: Indicates the number of collisions seen by this network device. This value might not be relevant with all MAC layers. -What: /sys/class/<iface>/statistics/multicast +What: /sys/class/net/<iface>/statistics/multicast Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -14,7 +14,7 @@ Description: Indicates the number of multicast packets received by this network device. -What: /sys/class/<iface>/statistics/rx_bytes +What: /sys/class/net/<iface>/statistics/rx_bytes Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -23,7 +23,7 @@ Description: See the network driver for the exact meaning of when this value is incremented. -What: /sys/class/<iface>/statistics/rx_compressed +What: /sys/class/net/<iface>/statistics/rx_compressed Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -32,7 +32,7 @@ Description: network device. This value might only be relevant for interfaces that support packet compression (e.g: PPP). -What: /sys/class/<iface>/statistics/rx_crc_errors +What: /sys/class/net/<iface>/statistics/rx_crc_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -41,7 +41,7 @@ Description: by this network device. Note that the specific meaning might depend on the MAC layer used by the interface. -What: /sys/class/<iface>/statistics/rx_dropped +What: /sys/class/net/<iface>/statistics/rx_dropped Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -51,7 +51,7 @@ Description: packet processing. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_errors +What: /sys/class/net/<iface>/statistics/rx_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -59,7 +59,7 @@ Description: Indicates the number of receive errors on this network device. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_fifo_errors +What: /sys/class/net/<iface>/statistics/rx_fifo_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -68,7 +68,7 @@ Description: network device. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_frame_errors +What: /sys/class/net/<iface>/statistics/rx_frame_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -78,7 +78,7 @@ Description: on the MAC layer protocol used. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_length_errors +What: /sys/class/net/<iface>/statistics/rx_length_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -87,7 +87,7 @@ Description: error, oversized or undersized. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_missed_errors +What: /sys/class/net/<iface>/statistics/rx_missed_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -96,7 +96,7 @@ Description: due to lack of capacity in the receive side. See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_nohandler +What: /sys/class/net/<iface>/statistics/rx_nohandler Date: February 2016 KernelVersion: 4.6 Contact: [email protected]
@@ -104,7 +104,7 @@ Description: Indicates the number of received packets that were dropped on an inactive device by the network core. -What: /sys/class/<iface>/statistics/rx_over_errors +What: /sys/class/net/<iface>/statistics/rx_over_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -114,7 +114,7 @@ Description: (e.g: larger than MTU). See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/rx_packets +What: /sys/class/net/<iface>/statistics/rx_packets Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -122,7 +122,7 @@ Description: Indicates the total number of good packets received by this network device. -What: /sys/class/<iface>/statistics/tx_aborted_errors +What: /sys/class/net/<iface>/statistics/tx_aborted_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -132,7 +132,7 @@ Description: a medium collision). See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/tx_bytes +What: /sys/class/net/<iface>/statistics/tx_bytes Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -143,7 +143,7 @@ Description: transmitted packets or all packets that have been queued for transmission. -What: /sys/class/<iface>/statistics/tx_carrier_errors +What: /sys/class/net/<iface>/statistics/tx_carrier_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -152,7 +152,7 @@ Description: because of carrier errors (e.g: physical link down). See the network driver for the exact meaning of this value. -What: /sys/class/<iface>/statistics/tx_compressed +What: /sys/class/net/<iface>/statistics/tx_compressed Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -161,7 +161,7 @@ Description: this might only be relevant for devices that support compression (e.g: PPP). -What: /sys/class/<iface>/statistics/tx_dropped +What: /sys/class/net/<iface>/statistics/tx_dropped Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -170,7 +170,7 @@ Description: See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_errors +What: /sys/class/net/<iface>/statistics/tx_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -179,7 +179,7 @@ Description: a network device. See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_fifo_errors +What: /sys/class/net/<iface>/statistics/tx_fifo_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -188,7 +188,7 @@ Description: FIFO error. See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_heartbeat_errors +What: /sys/class/net/<iface>/statistics/tx_heartbeat_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -197,7 +197,7 @@ Description: reported as heartbeat errors. See the driver for the exact reasons as to why the packets were dropped. -What: /sys/class/<iface>/statistics/tx_packets +What: /sys/class/net/<iface>/statistics/tx_packets Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
@@ -206,7 +206,7 @@ Description: device. See the driver for whether this reports the number of all attempted or successful transmissions. -What: /sys/class/<iface>/statistics/tx_window_errors +What: /sys/class/net/<iface>/statistics/tx_window_errors Date: April 2005 KernelVersion: 2.6.12 Contact: [email protected]
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/309 nouveau/svm: fix kvcalloc() argument order
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 2c80a2b715df75881359d07dbaacff8ad411f40e ]
The conversion to kvcalloc() mixed up the object size and count arguments, causing a warning:
drivers/gpu/drm/nouveau/nouveau_svm.c: In function 'nouveau_svm_fault_buffer_ctor':drivers/gpu/drm/nouveau/nouveau_svm.c:1010:40: error: 'kvcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
1010 | buffer->fault = kvcalloc(sizeof(*buffer->fault), buffer->entries, GFP_KERNEL);
| ^drivers/gpu/drm/nouveau/nouveau_svm.c:1010:40: note: earlier argument should specify number of elements, later size of each element
The behavior is still correct aside from the warning, but fixing it avoids the warnings and can help the compiler track the individual objects better.
--- drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_svm.c +1 -1
@@ -1011,7 +1011,7 @@ nouveau_svm_fault_buffer_ctor(struct nouveau_svm *svm, s32 oclass, int id)if (ret)return ret; - buffer->fault =kvcalloc (sizeof (*buffer->fault), buffer->entries,GFP_KERNEL ); + buffer->fault =kvcalloc (buffer->entries,sizeof (*buffer->fault),GFP_KERNEL );if (!buffer->fault)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/309 MIPS: Add memory clobber to csum_ipv6_magic() inline assembler
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit d55347bfe4e66dce2e1e7501e5492f4af3e315f8 ]
After 'lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests' was applied, the test_csum_ipv6_magic unit test started failing for all mips platforms, both little and bit endian. Oddly enough, adding debug code into test_csum_ipv6_magic() made the problem disappear.
The gcc manual says:
"The "memory" clobber tells the compiler that the assembly code performs
memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters)
"
This is definitely the case for csum_ipv6_magic(). Indeed, adding the 'memory' clobber fixes the problem.
--- arch/mips/include/asm/checksum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/include/asm/checksum.h +2 -1
@@ -241,7 +241,8 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, " .set pop" : "=&r" (sum), "=&r" (tmp) : "r" (saddr), "r" (daddr), - "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); + "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) + : "memory");return csum_fold (sum); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/309 ptrace: Introduce exception_ip arch hook
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
[ Upstream commit 11ba1728be3edb6928791f4c622f154ebe228ae6 ]
On architectures with delay slot, architecture level instruction pointer (or program counter) in pt_regs may differ from where exception was triggered.
Introduce exception_ip hook to invoke architecture code and determine actual instruction pointer to the exception.
Stable-dep-of: 8fa507083388 ("mm/memory: Use exception ip to search exception tables")
--- arch/mips/include/asm/ptrace.h | 2 ++ arch/mips/kernel/ptrace.c | 7 +++++++ include/linux/ptrace.h | 4 ++++ 3 files changed, 13 insertions(+)
arch/mips/include/asm/ptrace.h +2 -0
@@ -154,6 +154,8 @@ static inline long regs_return_value(struct pt_regs *regs) }#define instruction_pointer (regs) ((regs)->cp0_epc) +extern unsigned long exception_ip (struct pt_regs *regs); +#define exception_ip (regs) exception_ip(regs)#define profile_pc (regs) instruction_pointer(regs)extern asmlinkage long syscall_trace_enter (struct pt_regs *regs,long syscall);
arch/mips/kernel/ptrace.c +7 -0
@@ -31,6 +31,7 @@#include <linux/seccomp.h> #include <linux/ftrace.h> +#include <asm/branch.h> #include <asm/byteorder.h> #include <asm/cpu.h> #include <asm/cpu-info.h>
@@ -48,6 +49,12 @@#define CREATE_TRACE_POINTS #include <trace/events/syscalls.h> +unsigned long exception_ip (struct pt_regs *regs) +{ +return exception_epc (regs); +} +EXPORT_SYMBOL (exception_ip); +/* * Called by kernel/ptrace.c when detaching.. *
include/linux/ptrace.h +4 -0
@@ -393,6 +393,10 @@ static inline void user_single_step_report(struct pt_regs *regs)#define current_user_stack_pointer () user_stack_pointer(current_pt_regs())#endif +#ifndef exception_ip +#define exception_ip (x) instruction_pointer(x) +#endif +extern int task_current_syscall (struct task_struct *target,struct syscall_info *info);extern void sigaction_compat_abi (struct k_sigaction *act,struct k_sigaction *oact);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/309 mm/memory: Use exception ip to search exception tables
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
[ Upstream commit 8fa5070833886268e4fb646daaca99f725b378e9 ]
On architectures with delay slot, instruction_pointer() may differ from where exception was triggered.
Use exception_ip we just introduced to search exception tables to get rid of the problem.
--- mm/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/memory.c +2 -2
@@ -5373,7 +5373,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regsreturn true;if (regs && !user_mode (regs)) { -unsigned long ip =instruction_pointer (regs); +unsigned long ip =exception_ip (regs);if (!search_exception_tables (ip))return false; }
@@ -5398,7 +5398,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r {mmap_read_unlock (mm);if (regs && !user_mode (regs)) { -unsigned long ip =instruction_pointer (regs); +unsigned long ip =exception_ip (regs);if (!search_exception_tables (ip))return false; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/309 i40e: Do not allow untrusted VF to remove administratively set MAC
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
[ Upstream commit 73d9629e1c8c1982f13688c4d1019c3994647ccc ]
Currently when PF administratively sets VF's MAC address and the VF is put down (VF tries to delete all MACs) then the MAC is removed from MAC filters and primary VF MAC is zeroed.
Do not allow untrusted VF to remove primary MAC when it was set administratively by PF.
Reproducer:
1) Create VF
2) Set VF interface up
3) Administratively set the VF's MAC
4) Put VF interface down
[root@host ~]# echo 1 > /sys/class/net/enp2s0f0/device/sriov_numvfs
[root@host ~]# ip link set enp2s0f0v0 up
[root@host ~]# ip link set enp2s0f0 vf 0 mac fe:6c:b5:da:c7:7d
[root@host ~]# ip link show enp2s0f0
23: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 3c:ec:ef:b7:dd:04 brd ff:ff:ff:ff:ff:ff
vf 0 link/ether fe:6c:b5:da:c7:7d brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off
[root@host ~]# ip link set enp2s0f0v0 down
[root@host ~]# ip link show enp2s0f0
23: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 3c:ec:ef:b7:dd:04 brd ff:ff:ff:ff:ff:ff
vf 0 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +33 -5
@@ -2850,6 +2850,24 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg) (u8 *)&stats, sizeof(stats)); } +/** +* i40e_can_vf_change_mac +* @vf: pointer to the VF info +* +* Return true if the VF is allowed to change its MAC filters, false otherwise +*/ +static bool i40e_can_vf_change_mac (struct i40e_vf *vf) +{ +/* If the VF MAC address has been set administratively (via the +* ndo_set_vf_mac command), then deny permission to the VF to +* add/delete unicast MAC addresses, unless the VF is trusted +*/ +if (vf->pf_set_mac && !vf->trusted) +return false; + +return true; +} +#define I40E_MAX_MACVLAN_PER_HW 3072#define I40E_MAX_MACVLAN_PER_PF (num_ports) (I40E_MAX_MACVLAN_PER_HW / \ (num_ports))
@@ -2909,8 +2927,8 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,* The VF may request to set the MAC address filter already * assigned to it so do not return an error in that case. */ -if (!test_bit (I40E_VIRTCHNL_VF_CAP_PRIVILEGE , &vf->vf_caps) && - !is_multicast_ether_addr (addr) && vf->pf_set_mac && +if (!i40e_can_vf_change_mac (vf) && + !is_multicast_ether_addr (addr) && !ether_addr_equal (addr, vf->default_lan_addr.addr)) {dev_err (&pf->pdev->dev,"VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\n" );
@@ -3116,19 +3134,29 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg) ret = -EINVAL ; goto error_param; } -if (ether_addr_equal (al->list[i].addr, vf->default_lan_addr.addr)) - was_unimac_deleted = true; } vsi = pf->vsi[vf->lan_vsi_idx];spin_lock_bh (&vsi->mac_filter_hash_lock);/* delete addresses from the list */ -for (i =0 ; i < al->num_elements; i++) +for (i =0 ; i < al->num_elements; i++) { +const u8 *addr = al->list[i].addr; + +/* Allow to delete VF primary MAC only if it was not set +* administratively by PF or if VF is trusted. +*/ +if (ether_addr_equal (addr, vf->default_lan_addr.addr) && +i40e_can_vf_change_mac (vf)) + was_unimac_deleted = true; +else +continue ; +if (i40e_del_mac_filter (vsi, al->list[i].addr)) { ret = -EINVAL ;spin_unlock_bh (&vsi->mac_filter_hash_lock); goto error_param; } + }spin_unlock_bh (&vsi->mac_filter_hash_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/309 i40e: Fix waiting for queues of all VSIs to be disabled
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
[ Upstream commit c73729b64bb692186da080602cd13612783f52ac ]
The function i40e_pf_wait_queues_disabled() iterates all PF's VSIs up to 'pf->hw.func_caps.num_vsis' but this is incorrect because the real number of VSIs can be up to 'pf->num_alloc_vsi' that can be higher. Fix this loop.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -5361,7 +5361,7 @@ static int i40e_pf_wait_queues_disabled(struct i40e_pf *pf) {int v, ret =0 ; -for (v =0 ; v < pf->hw.func_caps.num_vsis; v++) { +for (v =0 ; v < pf->num_alloc_vsi; v++) {if (pf->vsi[v]) { ret =i40e_vsi_wait_queues_disabled (pf->vsi[v]);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/309 mm: thp_get_unmapped_area must honour topdown preference
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Roberts <[email protected]>
commit 96204e15310c218fd9355bdcacd02fed1d18070e upstream.
The addition of commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries") caused the "virtual_address_range" mm selftest to start failing on arm64. Let's fix that regression.
There were 2 visible problems when running the test; 1) it takes much longer to execute, and 2) the test fails. Both are related:
The (first part of the) test allocates as many 1GB anonymous blocks as it can in the low 256TB of address space, passing NULL as the addr hint to mmap. Before the faulty patch, all allocations were abutted and contained in a single, merged VMA. However, after this patch, each allocation is in its own VMA, and there is a 2M gap between each VMA. This causes the 2 problems in the test: 1) mmap becomes MUCH slower because there are so many VMAs to check to find a new 1G gap. 2) mmap fails once it hits the VMA limit (/proc/sys/vm/max_map_count). Hitting this limit then causes a subsequent calloc() to fail, which causes the test to fail.
The problem is that arm64 (unlike x86) selects ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT. But __thp_get_unmapped_area() allocates len+2M then always aligns to the bottom of the discovered gap. That causes the 2M hole.
Fix this by detecting cases where we can still achive the alignment goal when moved to the top of the allocated area, if configured to prefer top-down allocation.
While we are at it, fix thp_get_unmapped_area's use of pgoff, which should always be zero for anonymous mappings. Prior to the faulty change, while it was possible for user space to pass in pgoff!=0, the old mm->get_unmapped_area() handler would not use it. thp_get_unmapped_area() does use it, so let's explicitly zero it before calling the handler. This should also be the correct behavior for arches that define their own get_unmapped_area() handler.
--- mm/huge_memory.c | 10 ++++++++-- mm/mmap.c | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
mm/huge_memory.c +8 -2
@@ -633,7 +633,7 @@ static unsigned long __thp_get_unmapped_ {loff_t off_end = off + len;loff_t off_align =round_up (off, size); -unsigned long len_pad, ret; +unsigned long len_pad, ret, off_sub;if (IS_ENABLED (CONFIG_32BIT ) ||in_compat_syscall ())return 0 ;
@@ -662,7 +662,13 @@ static unsigned long __thp_get_unmapped_if (ret == addr)return addr; - ret += (off - ret) & (size -1 ); + off_sub = (off - ret) & (size -1 ); + +if (current->mm->get_unmapped_area == arch_get_unmapped_area_topdown && + !off_sub) +return ret + size; + + ret += off_sub;return ret; }
mm/mmap.c +4 -2
@@ -1825,15 +1825,17 @@ get_unmapped_area(struct file *file, uns/* * mmap_region() will call shmem_zero_setup() to create a file, * so use shmem's get_unmapped_area in case it can be huge. -* do_mmap() will clear pgoff, so match alignment. */ - pgoff =0 ; get_area = shmem_get_unmapped_area; }else if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) {/* Ensures that larger anonymous mappings are THP aligned. */ get_area = thp_get_unmapped_area; } +/* Always treat pgoff as zero for anonymous memory. */ +if (!file) + pgoff =0 ; + addr =get_area (file, addr, len, pgoff, flags);if (IS_ERR_VALUE (addr))return addr;
Greg Kroah-Hartman
maintainerPATCH 64/309 userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lokesh Gidra <[email protected]>
commit 67695f18d55924b2013534ef3bdc363bc9e14605 upstream.
In mfill_atomic_hugetlb(), mmap_changing isn't being checked again if we drop mmap_lock and reacquire it. When the lock is not held, mmap_changing could have been incremented. This is also inconsistent with the behavior in mfill_atomic().
--- mm/userfaultfd.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
mm/userfaultfd.c +13 -2
@@ -357,6 +357,7 @@ static __always_inline ssize_t mfill_atounsigned long dst_start, unsigned long src_start, unsigned long len, + atomic_t *mmap_changing, uffd_flags_t flags) { struct mm_struct *dst_mm = dst_vma->vm_mm;
@@ -472,6 +473,15 @@ retry: goto out; }mmap_read_lock (dst_mm); +/* +* If memory mappings are changing because of non-cooperative +* operation (e.g. mremap) running in parallel, bail out and +* request the user to retry later +*/ +if (mmap_changing &&atomic_read (mmap_changing)) { + err = -EAGAIN ; +break ; + } dst_vma =NULL ; goto retry;
@@ -506,6 +516,7 @@ extern ssize_t mfill_atomic_hugetlb(struunsigned long dst_start, unsigned long src_start, unsigned long len, + atomic_t *mmap_changing, uffd_flags_t flags);#endif /* CONFIG_HUGETLB_PAGE */
@@ -622,8 +633,8 @@ retry:* If this is a HUGETLB vma, pass off to appropriate routine */ if (is_vm_hugetlb_page (dst_vma)) -return mfill_atomic_hugetlb (dst_vma, dst_start, - src_start, len, flags); +return mfill_atomic_hugetlb (dst_vma, dst_start, src_start, + len, mmap_changing, flags);if (!vma_is_anonymous (dst_vma) && !vma_is_shmem (dst_vma)) goto out_unlock;
Greg Kroah-Hartman
maintainerPATCH 65/309 selftests/mm: ksm_tests should only MADV_HUGEPAGE valid memory
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Roberts <[email protected]>
commit d021b442cf312664811783e92b3d5e4548e92a53 upstream.
ksm_tests was previously mmapping a region of memory, aligning the returned pointer to a PMD boundary, then setting MADV_HUGEPAGE, but was setting it past the end of the mmapped area due to not taking the pointer alignment into consideration. Fix this behaviour.
Up until commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries"), this buggy behavior was (usually) masked because the alignment difference was always less than PMD-size. But since the mentioned commit, ksm_tests -H -s 100 started failing.
--- tools/testing/selftests/mm/ksm_tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/ksm_tests.c +1 -1
@@ -566,7 +566,7 @@ static int ksm_merge_hugepages_time(intif (map_ptr_orig ==MAP_FAILED )err (2 ,"initial mmap" ); -if (madvise (map_ptr, len +HPAGE_SIZE ,MADV_HUGEPAGE )) +if (madvise (map_ptr, len,MADV_HUGEPAGE ))err (2 ,"MADV_HUGEPAGE" ); pagemap_fd =open ("/proc/self/pagemap" ,O_RDONLY );
Greg Kroah-Hartman
maintainerPATCH 66/309 scs: add CONFIG_MMU dependency for vfree_atomic()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Holland <[email protected]>
commit 6f9dc684cae638dda0570154509884ee78d0f75c upstream.
The shadow call stack implementation fails to build without CONFIG_MMU:
ld.lld: error: undefined symbol: vfree_atomic
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
scs.c
kernel/scs.o:(scs_free) in archive vmlinux.a
--- arch/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/Kconfig +1 -0
@@ -681,6 +681,7 @@ config SHADOW_CALL_STACK bool "Shadow Call Stack" depends on ARCH_SUPPORTS_SHADOW_CALL_STACK depends on DYNAMIC_FTRACE_WITH_ARGS || DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER + depends on MMU help This option enables the compiler's Shadow Call Stack, which uses a shadow stack to protect function return addresses from
Greg Kroah-Hartman
maintainerPATCH 67/309 tracing/trigger: Fix to return error if failed to alloc snapshot
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
commit 0958b33ef5a04ed91f61cef4760ac412080c4e08 upstream.
Fix register_snapshot_trigger() to return error code if it failed to allocate a snapshot instead of 0 (success). Unless that, it will register snapshot trigger without an error.
--- kernel/trace/trace_events_trigger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_events_trigger.c +4 -2
@@ -1470,8 +1470,10 @@ register_snapshot_trigger(char *glob,struct event_trigger_data *data, struct trace_event_file *file) { - if (tracing_alloc_snapshot_instance(file->tr) != 0) - return 0; + int ret = tracing_alloc_snapshot_instance(file->tr); + +if (ret <0 ) +return ret;return register_trigger (glob, data, file); }
Greg Kroah-Hartman
maintainerPATCH 68/309 fs/hugetlbfs/inode.c: mm/memory-failure.c: fix hugetlbfs hwpoison handling
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sidhartha Kumar <[email protected]>
commit 19d3e221807772f8443e565234a6fdc5a2b09d26 upstream.
has_extra_refcount() makes the assumption that the page cache adds a ref count of 1 and subtracts this in the extra_pins case. Commit a08c7193e4f1 (mm/filemap: remove hugetlb special casing in filemap.c) modifies __filemap_add_folio() by calling folio_ref_add(folio, nr); for all cases (including hugtetlb) where nr is the number of pages in the folio. We should adjust the number of references coming from the page cache by subtracing the number of pages rather than 1.
In hugetlbfs_read_iter(), folio_test_has_hwpoisoned() is testing the wrong flag as, in the hugetlb case, memory-failure code calls folio_test_set_hwpoison() to indicate poison. folio_test_hwpoison() is the correct function to test for that flag.
After these fixes, the hugetlb hwpoison read selftest passes all cases.
--- fs/hugetlbfs/inode.c | 2 +- mm/memory-failure.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/hugetlbfs/inode.c +1 -1
@@ -340,7 +340,7 @@ static ssize_t hugetlbfs_read_iter(struc }else {folio_unlock (folio); -if (!folio_test_has_hwpoisoned (folio)) +if (!folio_test_hwpoison (folio)) want = nr;else {/*
mm/memory-failure.c +1 -1
@@ -976,7 +976,7 @@ static bool has_extra_refcount(struct paint count =page_count (p) -1 ;if (extra_pins) - count -=1 ; + count -=folio_nr_pages (page_folio (p));if (count >0 ) { pr_err("%#lx: %s still referenced by %d users\n",
Greg Kroah-Hartman
maintainerPATCH 69/309 selftests/mm: switch to bash from sh
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
commit bc29036e1da1cf66e5f8312649aeec2d51ea3d86 upstream.
Running charge_reserved_hugetlb.sh generates errors if sh is set to dash:
./charge_reserved_hugetlb.sh: 9: [[: not found ./charge_reserved_hugetlb.sh: 19: [[: not found ./charge_reserved_hugetlb.sh: 27: [[: not found ./charge_reserved_hugetlb.sh: 37: [[: not found ./charge_reserved_hugetlb.sh: 45: Syntax error: "(" unexpected
Switch to using /bin/bash instead of /bin/sh. Make the switch for write_hugetlb_memory.sh as well which is called from charge_reserved_hugetlb.sh.
--- tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 2 +- tools/testing/selftests/mm/write_hugetlb_memory.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/mm/charge_reserved_hugetlb.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # Kselftest framework requirement - SKIP code is 4.
tools/testing/selftests/mm/write_hugetlb_memory.sh +1 -1
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 set -e
Greg Kroah-Hartman
maintainerPATCH 70/309 readahead: avoid multiple marked readahead pages
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit ab4443fe3ca6298663a55c4a70efc6c3ce913ca6 upstream.
ra_alloc_folio() marks a page that should trigger next round of async readahead. However it rounds up computed index to the order of page being allocated. This can however lead to multiple consecutive pages being marked with readahead flag. Consider situation with index == 1, mark == 1, order == 0. We insert order 0 page at index 1 and mark it. Then we bump order to 1, index to 2, mark (still == 1) is rounded up to 2 so page at index 2 is marked as well. Then we bump order to 2, index is incremented to 4, mark gets rounded to 4 so page at index 4 is marked as well. The fact that multiple pages get marked within a single readahead window confuses the readahead logic and results in readahead window being trimmed back to 1. This situation is triggered in particular when maximum readahead window size is not a power of two (in the observed case it was 768 KB) and as a result sequential read throughput suffers.
Fix the problem by rounding 'mark' down instead of up. Because the index is naturally aligned to 'order', we are guaranteed 'rounded mark' == index iff 'mark' is within the page we are allocating at 'index' and thus exactly one page is marked with readahead flag as required by the readahead code and sequential read performance is restored.
This effectively reverts part of commit b9ff43dd2743 ("mm/readahead: Fix readahead with large folios"). The commit changed the rounding with the rationale:
"... we were setting the readahead flag on the folio which contains the last byte read from the block. This is wrong because we will trigger readahead at the end of the read without waiting to see if a subsequent read is going to use the pages we just read."
Although this is true, the fact is this was always the case with read sizes not aligned to folio boundaries and large folios in the page cache just make the situation more obvious (and frequent). Also for sequential read workloads it is better to trigger the readahead earlier rather than later. It is true that the difference in the rounding and thus earlier triggering of the readahead can result in reading more for semi-random workloads. However workloads really suffering from this seem to be rare. In particular I have verified that the workload described in commit b9ff43dd2743 ("mm/readahead: Fix readahead with large folios") of reading random 100k blocks from a file like:
[reader]
bs=100k
rw=randread
numjobs=1
size=64g
runtime=60s
is not impacted by the rounding change and achieves ~70MB/s in both cases.
--- mm/readahead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/readahead.c +2 -2
@@ -469,7 +469,7 @@ static inline int ra_alloc_folio(structif (!folio)return -ENOMEM ; - mark =round_up (mark,1UL << order); + mark =round_down (mark,1UL << order);if (index == mark)folio_set_readahead (folio); err =filemap_add_folio (ractl->mapping, folio, index, gfp);
@@ -577,7 +577,7 @@ static void ondemand_readahead(struct re* It's the expected callback index, assume sequential access. * Ramp up sizes, and push forward the readahead window. */ - expected =round_up (ra->start + ra->size - ra->async_size, + expected =round_down (ra->start + ra->size - ra->async_size,1UL << order);if (index == expected || index == (ra->start + ra->size)) { ra->start += ra->size;
Re: [PATCH 6.7 070/309] readahead: avoid multiple marked readahead pages
Quoted 7 lines · Greg Kroah-Hartman
6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit
ab4443fe3ca6298663a55c4a70efc6c3ce913ca6upstream.
ibid
Greg Kroah-Hartman
maintainerPATCH 71/309 mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zach O'Keefe <[email protected]>
commit 9319b647902cbd5cc884ac08a8a6d54ce111fc78 upstream.
(struct dirty_throttle_control *)->thresh is an unsigned long, but is passed as the u32 divisor argument to div_u64(). On architectures where unsigned long is 64 bytes, the argument will be implicitly truncated.
Use div64_u64() instead of div_u64() so that the value used in the "is this a safe division" check is the same as the divisor.
Also, remove redundant cast of the numerator to u64, as that should happen implicitly.
This would be difficult to exploit in memcg domain, given the ratio-based arithmetic domain_drity_limits() uses, but is much easier in global writeback domain with a BDI_CAP_STRICTLIMIT-backing device, using e.g. vm.dirty_bytes=(1<<32)*PAGE_SIZE so that dtc->thresh == (1<<32)
--- mm/page-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page-writeback.c +1 -1
@@ -1638,7 +1638,7 @@ static inline void wb_dirty_limits(struc*/ dtc->wb_thresh =__wb_calc_thresh (dtc); dtc->wb_bg_thresh = dtc->thresh ? -div_u64 ((u64 )dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) :0 ; +div64_u64 (dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) :0 ;/* * In order to avoid the stacked BDI deadlock we need
Greg Kroah-Hartman
maintainerPATCH 72/309 selftests/mm: Update va_high_addr_switch.sh to check CPU for la57 flag
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Audra Mitchell <[email protected]>
commit 52e63d67b5bb423b33d7a262ac7f8bd375a90145 upstream.
In order for the page table level 5 to be in use, the CPU must have the setting enabled in addition to the CONFIG option. Check for the flag to be set to avoid false test failures on systems that do not have this cpu flag set.
The test does a series of mmap calls including three using the MAP_FIXED flag and specifying an address that is 1<<47 or 1<<48. These addresses are only available if you are using level 5 page tables, which requires both the CPU to have the capabiltiy (la57 flag) and the kernel to be configured. Currently the test only checks for the kernel configuration option, so this test can still report a false positive. Here are the three failing lines:
$ ./va_high_addr_switch | grep FAILED mmap(ADDR_SWITCH_HINT, 2 * PAGE_SIZE, MAP_FIXED): 0xffffffffffffffff - FAILED mmap(HIGH_ADDR, MAP_FIXED): 0xffffffffffffffff - FAILED mmap(ADDR_SWITCH_HINT, 2 * PAGE_SIZE, MAP_FIXED): 0xffffffffffffffff - FAILED
I thought (for about a second) refactoring the test so that these three mmap calls will only be run on systems with the level 5 page tables available, but the whole point of the test is to check the level 5 feature...
--- tools/testing/selftests/mm/va_high_addr_switch.sh | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/mm/va_high_addr_switch.sh +6 -0
@@ -29,9 +29,15 @@ check_supported_x86_64() # See man 1 gzip under '-f'. local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2) + local cpu_supports_pl5=$(awk '/^flags/ {if (/la57/) {print 0;} + else {print 1}; exit}' /proc/cpuinfo 2>/dev/null) + if [[ "${pg_table_levels}" -lt 5 ]]; then echo "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test" exit $ksft_skip + elif [[ "${cpu_supports_pl5}" -ne 0 ]]; then + echo "$0: CPU does not have the necessary la57 flag to support page table level 5" + exit $ksft_skip fi }
Greg Kroah-Hartman
maintainerPATCH 73/309 selftests: mm: fix map_hugetlb failure on 64K page size systems
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nico Pache <[email protected]>
commit 91b80cc5b39f00399e8e2d17527cad2c7fa535e2 upstream.
On systems with 64k page size and 512M huge page sizes, the allocation and test succeeds but errors out at the munmap. As the comment states, munmap will failure if its not HUGEPAGE aligned. This is due to the length of the mapping being 1/2 the size of the hugepage causing the munmap to not be hugepage aligned. Fix this by making the mapping length the full hugepage if the hugepage is larger than the length of the mapping.
--- tools/testing/selftests/mm/map_hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/mm/map_hugetlb.c +7 -0
@@ -15,6 +15,7 @@#include <unistd.h> #include <sys/mman.h> #include <fcntl.h> +#include "vm_util.h" #define LENGTH (256UL*1024*1024)#define PROTECTION (PROT_READ | PROT_WRITE)
@@ -58,10 +59,16 @@ int main(int argc, char **argv) {void *addr;int ret; +size_t hugepage_size;size_t length =LENGTH ;int flags =FLAGS ;int shift =0 ; + hugepage_size =default_huge_page_size (); +/* munmap with fail if the length is not page aligned */ +if (hugepage_size > length) + length = hugepage_size; +if (argc >1 ) length =atol (argv[1 ]) <<20 ;if (argc >2 ) {
Greg Kroah-Hartman
maintainerPATCH 74/309 scsi: storvsc: Fix ring buffer size calculation
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit f4469f3858352ad1197434557150b1f7086762a0 upstream.
Current code uses the specified ring buffer size (either the default of 128 Kbytes or a module parameter specified value) to encompass the one page ring buffer header plus the actual ring itself. When the page size is 4K, carving off one page for the header isn't significant. But when the page size is 64K on ARM64, only half of the default 128 Kbytes is left for the actual ring. While this doesn't break anything, the smaller ring size could be a performance bottleneck.
Fix this by applying the VMBUS_RING_SIZE macro to the specified ring buffer size. This macro adds a page for the header, and rounds up the size to a page boundary, using the page size for which the kernel is built. Use this new size for subsequent ring buffer calculations. For example, on ARM64 with 64K page size and the default ring size, this results in the actual ring being 128 Kbytes, which is intended.
--- drivers/scsi/storvsc_drv.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/storvsc_drv.c +7 -5
@@ -330,6 +330,7 @@ enum storvsc_request_type {*/ static int storvsc_ringbuffer_size = (128 *1024 ); +static int aligned_ringbuffer_size;static u32 max_outstanding_req_per_channel;static int storvsc_change_queue_depth (struct scsi_device *sdev,int queue_depth);
@@ -687,8 +688,8 @@ static void handle_sc_creation(struct vm new_sc->next_request_id_callback = storvsc_next_request_id; ret =vmbus_open (new_sc, - storvsc_ringbuffer_size, - storvsc_ringbuffer_size, + aligned_ringbuffer_size, + aligned_ringbuffer_size, (void *)&props,sizeof (struct vmstorage_channel_properties ), storvsc_on_channel_callback, new_sc);
@@ -1973,7 +1974,7 @@ static int storvsc_probe(struct hv_devicdma_set_min_align_mask (&device->device,HV_HYP_PAGE_SIZE -1 ); stor_device->port_number = host->host_no; - ret =storvsc_connect_to_vsp (device, storvsc_ringbuffer_size, is_fc); + ret =storvsc_connect_to_vsp (device, aligned_ringbuffer_size, is_fc);if (ret) goto err_out1;
@@ -2164,7 +2165,7 @@ static int storvsc_resume(struct hv_devi {int ret; - ret =storvsc_connect_to_vsp (hv_dev, storvsc_ringbuffer_size, + ret =storvsc_connect_to_vsp (hv_dev, aligned_ringbuffer_size,hv_dev_is_fc (hv_dev));return ret; }
@@ -2198,8 +2199,9 @@ static int __init storvsc_drv_init(void)* the ring buffer indices) by the max request size (which is * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) */ + aligned_ringbuffer_size =VMBUS_RING_SIZE (storvsc_ringbuffer_size); max_outstanding_req_per_channel = - ((storvsc_ringbuffer_size -PAGE_SIZE ) / + ((aligned_ringbuffer_size -PAGE_SIZE ) /ALIGN (MAX_MULTIPAGE_BUFFER_PACKET +sizeof (struct vstor_packet ) +sizeof (u64),sizeof (u64)));
Greg Kroah-Hartman
maintainerPATCH 75/309 nouveau: offload fence uevents work to workqueue
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 39126abc5e20611579602f03b66627d7cd1422f0 upstream.
This should break the deadlock between the fctx lock and the irq lock.
This offloads the processing off the work from the irq into a workqueue.
--- drivers/gpu/drm/nouveau/nouveau_fence.c | 24 ++++++++++++++++++------ drivers/gpu/drm/nouveau/nouveau_fence.h | 1 + 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nouveau_fence.c +18 -6
@@ -103,6 +103,7 @@ nouveau_fence_context_kill(struct nouveavoid nouveau_fence_context_del (struct nouveau_fence_chan *fctx) { +cancel_work_sync (&fctx->uevent_work);nouveau_fence_context_kill (fctx,0 );nvif_event_dtor (&fctx->event); fctx->dead =1 ;
@@ -145,12 +146,13 @@ nouveau_fence_update(struct nouveau_chanreturn drop; } -static int -nouveau_fence_wait_uevent_handler (struct nvif_event *event,void *repv,u32 repc) +static void +nouveau_fence_uevent_work (struct work_struct *work) { -struct nouveau_fence_chan *fctx =container_of (event,typeof (*fctx), event); + struct nouveau_fence_chan *fctx = container_of(work, struct nouveau_fence_chan, + uevent_work);unsigned long flags; -int ret =NVIF_EVENT_KEEP ; +int drop =0 ;spin_lock_irqsave (&fctx->lock, flags);if (!list_empty (&fctx->pending)) {
@@ -160,11 +162,20 @@ nouveau_fence_wait_uevent_handler(struct fence =list_entry (fctx->pending.next,typeof (*fence), head); chan =rcu_dereference_protected (fence->channel,lockdep_is_held (&fctx->lock));if (nouveau_fence_update (chan, fctx)) - ret =NVIF_EVENT_DROP ; + drop =1 ; } +if (drop) +nvif_event_block (&fctx->event); +spin_unlock_irqrestore (&fctx->lock, flags); +} -return ret; +static int +nouveau_fence_wait_uevent_handler (struct nvif_event *event,void *repv,u32 repc) +{ +struct nouveau_fence_chan *fctx =container_of (event,typeof (*fctx), event); +schedule_work (&fctx->uevent_work); +return NVIF_EVENT_KEEP ; }void
@@ -178,6 +189,7 @@ nouveau_fence_context_new(struct nouveau } args;int ret; +INIT_WORK (&fctx->uevent_work, nouveau_fence_uevent_work);INIT_LIST_HEAD (&fctx->flip);INIT_LIST_HEAD (&fctx->pending);spin_lock_init (&fctx->lock);
drivers/gpu/drm/nouveau/nouveau_fence.h +1 -0
@@ -44,6 +44,7 @@ struct nouveau_fence_chan {u32 context;char name[32 ]; +struct work_struct uevent_work;struct nvif_event event;int notify_ref, dead, killed; };
Greg Kroah-Hartman
maintainerPATCH 76/309 dm-crypt, dm-verity: disable tasklets
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 0a9bab391e336489169b95cb0d4553d921302189 upstream.
Tasklets have an inherent problem with memory corruption. The function tasklet_action_common calls tasklet_trylock, then it calls the tasklet callback and then it calls tasklet_unlock. If the tasklet callback frees the structure that contains the tasklet or if it calls some code that may free it, tasklet_unlock will write into free memory.
The commits 8e14f610159d and d9a02e016aaf try to fix it for dm-crypt, but it is not a sufficient fix and the data corruption can still happen [1]. There is no fix for dm-verity and dm-verity will write into free memory with every tasklet-processed bio.
There will be atomic workqueues implemented in the kernel 6.9 [2]. They will have better interface and they will not suffer from the memory corruption problem.
But we need something that stops the memory corruption now and that can be backported to the stable kernels. So, I'm proposing this commit that disables tasklets in both dm-crypt and dm-verity. This commit doesn't remove the tasklet support, because the tasklet code will be reused when atomic workqueues will be implemented.
[1] https://lore.kernel.org/all/[email protected]/T/
[2] https://lore.kernel.org/lkml/[email protected]/
--- drivers/md/dm-crypt.c | 38 ++------------------------------------ drivers/md/dm-verity-target.c | 26 ++------------------------ drivers/md/dm-verity.h | 1 - 3 files changed, 4 insertions(+), 61 deletions(-)
drivers/md/dm-crypt.c +2 -36
@@ -73,10 +73,8 @@ struct dm_crypt_io {struct bio *base_bio;u8 *integrity_metadata; bool integrity_metadata_from_pool:1; - bool in_tasklet:1;struct work_struct work; -struct tasklet_struct tasklet;struct convert_context ctx;
@@ -1762,7 +1760,6 @@ static void crypt_io_init(struct dm_cryp io->ctx.r.req =NULL ; io->integrity_metadata =NULL ; io->integrity_metadata_from_pool = false; - io->in_tasklet = false;atomic_set (&io->io_pending,0 ); }
@@ -1771,13 +1768,6 @@ static void crypt_inc_pending(struct dm_atomic_inc (&io->io_pending); } -static void kcryptd_io_bio_endio (struct work_struct *work) -{ - struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); - -bio_endio (io->base_bio); -} -/* * One of the bios was finished. Check for completion of * the whole request and correctly clean up the buffer.
@@ -1801,20 +1791,6 @@ static void crypt_dec_pending(struct dm_ base_bio->bi_status = error; -/* -* If we are running this function from our tasklet, -* we can't call bio_endio() here, because it will call -* clone_endio() from dm.c, which in turn will -* free the current struct dm_crypt_io structure with -* our tasklet. In this case we need to delay bio_endio() -* execution to after the tasklet is done and dequeued. -*/ -if (io->in_tasklet) { -INIT_WORK (&io->work, kcryptd_io_bio_endio); -queue_work (cc->io_queue, &io->work); -return ; - } -bio_endio (base_bio); }
@@ -2246,11 +2222,6 @@ static void kcryptd_crypt(struct work_stkcryptd_crypt_write_convert (io); } -static void kcryptd_crypt_tasklet (unsigned long work) -{ -kcryptd_crypt ((struct work_struct *)work); -} -static void kcryptd_queue_crypt (struct dm_crypt_io *io) {struct crypt_config *cc = io->cc;
@@ -2262,15 +2233,10 @@ static void kcryptd_queue_crypt(struct d* irqs_disabled(): the kernel may run some IO completion from the idle thread, but * it is being executed with irqs disabled. */ -if (in_hardirq () ||irqs_disabled ()) { - io->in_tasklet = true; -tasklet_init (&io->tasklet, kcryptd_crypt_tasklet, (unsigned long )&io->work); -tasklet_schedule (&io->tasklet); +if (!(in_hardirq () ||irqs_disabled ())) { +kcryptd_crypt (&io->work);return ; } - -kcryptd_crypt (&io->work); -return ; }INIT_WORK (&io->work, kcryptd_crypt);
drivers/md/dm-verity-target.c +2 -24
@@ -645,23 +645,6 @@ static void verity_work(struct work_struverity_finish_io (io,errno_to_blk_status (verity_verify_io (io))); } -static void verity_tasklet (unsigned long data) -{ -struct dm_verity_io *io = (struct dm_verity_io *)data; -int err; - - io->in_tasklet = true; - err =verity_verify_io (io); -if (err == -EAGAIN || err == -ENOMEM ) { -/* fallback to retrying with work-queue */ -INIT_WORK (&io->work, verity_work); -queue_work (io->v->verify_wq, &io->work); -return ; - } - -verity_finish_io (io,errno_to_blk_status (err)); -} -static void verity_end_io (struct bio *bio) {struct dm_verity_io *io = bio->bi_private;
@@ -674,13 +657,8 @@ static void verity_end_io(struct bio *bireturn ; } -if (static_branch_unlikely (&use_tasklet_enabled) && io->v->use_tasklet) { -tasklet_init (&io->tasklet, verity_tasklet, (unsigned long )io); -tasklet_schedule (&io->tasklet); - }else { -INIT_WORK (&io->work, verity_work); -queue_work (io->v->verify_wq, &io->work); - } +INIT_WORK (&io->work, verity_work); +queue_work (io->v->verify_wq, &io->work); }/*
drivers/md/dm-verity.h +0 -1
@@ -83,7 +83,6 @@ struct dm_verity_io {struct bvec_iter iter;struct work_struct work; -struct tasklet_struct tasklet;/* * Three variably-size fields follow this struct:
Greg Kroah-Hartman
maintainerPATCH 77/309 ASoC: amd: yc: Add DMI quirk for MSI Bravo 15 C7VF
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Techno Mooney <[email protected]>
commit c6dce23ec993f7da7790a9eadb36864ceb60e942 upstream.
The laptop requires a quirk ID to enable its internal microphone. Add it to the DMI quirk table.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -300,6 +300,13 @@ static const struct dmi_system_id yc_acp { .driver_data = &acp6x_card, .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Micro-Star International Co., Ltd." ), + DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 C7VF"), + } + }, + { + .driver_data = &acp6x_card, + .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"Alienware" ), DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), }
Greg Kroah-Hartman
maintainerPATCH 78/309 parisc: Prevent hung tasks when printing inventory on serial console
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit c8708d758e715c3824a73bf0cda97292b52be44d upstream.
Printing the inventory on a serial console can be quite slow and thus may trigger the hung task detector (CONFIG_DETECT_HUNG_TASK=y) and possibly reboot the machine. Adding a cond_resched() prevents this.
--- arch/parisc/kernel/drivers.c | 3 +++ 1 file changed, 3 insertions(+)
arch/parisc/kernel/drivers.c +3 -0
@@ -1004,6 +1004,9 @@ static __init int qemu_print_iodc_data(spr_info ("\n" ); +/* Prevent hung task messages when printing on serial console */ +cond_resched (); +pr_info ("#define HPA_%08lx_DESCRIPTION \"%s\"\n" , hpa,parisc_hardware_description (&dev->id));
Greg Kroah-Hartman
maintainerPATCH 79/309 ALSA: hda/realtek: Fix the external mic not being recognised for Acer Swift 1 SF114-32
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Senoner <[email protected]>
commit efb56d84dd9c3de3c99fc396abb57c6d330038b5 upstream.
If you connect an external headset/microphone to the 3.5mm jack on the Acer Swift 1 SF114-32 it does not recognize the microphone. This fixes that and gives the user the ability to choose between internal and headset mic.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9640,6 +9640,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1025 ,0x1247 ,"Acer vCopperbox" ,ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS ),SND_PCI_QUIRK (0x1025 ,0x1248 ,"Acer Veriton N4660G" ,ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x1269 ,"Acer SWIFT SF314-54" ,ALC256_FIXUP_ACER_HEADSET_MIC ), +SND_PCI_QUIRK (0x1025 ,0x126a ,"Acer Swift SF114-32" ,ALC256_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x128f ,"Acer Veriton Z6860G" ,ALC286_FIXUP_ACER_AIO_HEADSET_MIC ),SND_PCI_QUIRK (0x1025 ,0x1290 ,"Acer Veriton Z4860G" ,ALC286_FIXUP_ACER_AIO_HEADSET_MIC ), SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Greg Kroah-Hartman
maintainerPATCH 80/309 ALSA: hda/realtek: Enable Mute LED on HP Laptop 14-fq0xxx
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luka Guzenko <[email protected]>
commit f0d78972f27dc1d1d51fbace2713ad3cdc60a877 upstream.
This HP Laptop uses ALC236 codec with COEF 0x07 controlling the mute LED. Enable existing quirk for this device.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -9840,6 +9840,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x103c ,0x8786 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x8787 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x8788 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x87b7 ,"HP Laptop 14-fq0xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x87c8 ,"HP" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87e5 ,"HP ProBook 440 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Greg Kroah-Hartman
maintainerPATCH 81/309 HID: bpf: remove double fdget()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit 7cdd2108903a4e369eb37579830afc12a6877ec2 upstream.
When the kfunc hid_bpf_attach_prog() is called, we called twice fdget():
one for fetching the type of the bpf program, and one for actually attaching the program to the device.
The problem is that between those two calls, we have no guarantees that the prog_fd is still the same file descriptor for the given program.
Solve this by calling bpf_prog_get() earlier, and use this to fetch the program type.
--- drivers/hid/bpf/hid_bpf_dispatch.c | 66 ++++++++++++++++++++++++------------ drivers/hid/bpf/hid_bpf_dispatch.h | 4 +- drivers/hid/bpf/hid_bpf_jmp_table.c | 20 +--------- 3 files changed, 49 insertions(+), 41 deletions(-)
drivers/hid/bpf/hid_bpf_dispatch.c +44 -22
@@ -241,6 +241,39 @@ int hid_bpf_reconnect(struct hid_devicereturn 0 ; } +static int do_hid_bpf_attach_prog (struct hid_device *hdev,int prog_fd,struct bpf_prog *prog, +__u32 flags) +{ +int fd, err, prog_type; + + prog_type =hid_bpf_get_prog_attach_type (prog); +if (prog_type <0 ) +return prog_type; + +if (prog_type >=HID_BPF_PROG_TYPE_MAX ) +return -EINVAL ; + +if (prog_type ==HID_BPF_PROG_TYPE_DEVICE_EVENT ) { + err =hid_bpf_allocate_event_data (hdev); +if (err) +return err; + } + + fd =__hid_bpf_attach_prog (hdev, prog_type, prog_fd, prog, flags); +if (fd <0 ) +return fd; + +if (prog_type ==HID_BPF_PROG_TYPE_RDESC_FIXUP ) { + err =hid_bpf_reconnect (hdev); +if (err) { +close_fd (fd); +return err; + } + } + +return fd; +} +/** * hid_bpf_attach_prog - Attach the given @prog_fd to the given HID device *
@@ -257,18 +290,13 @@ noinline int hid_bpf_attach_prog(unsigned int hid_id, int prog_fd, __u32 flags) { struct hid_device *hdev; +struct bpf_prog *prog;struct device *dev; -int fd, err, prog_type =hid_bpf_get_prog_attach_type (prog_fd); +int fd;if (!hid_bpf_ops)return -EINVAL ; -if (prog_type <0 ) -return prog_type; - -if (prog_type >=HID_BPF_PROG_TYPE_MAX ) -return -EINVAL ; -if ((flags & ~HID_BPF_FLAG_MASK ))return -EINVAL ;
@@ -278,23 +306,17 @@ hid_bpf_attach_prog(unsigned int hid_id, hdev =to_hid_device (dev); -if (prog_type ==HID_BPF_PROG_TYPE_DEVICE_EVENT ) { - err =hid_bpf_allocate_event_data (hdev); -if (err) -return err; - } +/* +* take a ref on the prog itself, it will be released +* on errors or when it'll be detached +*/ + prog =bpf_prog_get (prog_fd); +if (IS_ERR (prog)) +return PTR_ERR (prog); - fd =__hid_bpf_attach_prog (hdev, prog_type, prog_fd, flags); + fd =do_hid_bpf_attach_prog (hdev, prog_fd, prog, flags);if (fd <0 ) -return fd; - -if (prog_type ==HID_BPF_PROG_TYPE_RDESC_FIXUP ) { - err =hid_bpf_reconnect (hdev); -if (err) { -close_fd (fd); -return err; - } - } +bpf_prog_put (prog);return fd; }
drivers/hid/bpf/hid_bpf_dispatch.h +2 -2
@@ -12,9 +12,9 @@ struct hid_bpf_ctx_kern {int hid_bpf_preload_skel (void );void hid_bpf_free_links_and_skel (void ); -int hid_bpf_get_prog_attach_type (int prog_fd); +int hid_bpf_get_prog_attach_type (struct bpf_prog *prog);int __hid_bpf_attach_prog (struct hid_device *hdev,enum hid_bpf_prog_type prog_type,int prog_fd, -__u32 flags); +struct bpf_prog *prog,__u32 flags);void __hid_bpf_destroy_device (struct hid_device *hdev);int hid_bpf_prog_run (struct hid_device *hdev,enum hid_bpf_prog_type type,struct hid_bpf_ctx_kern *ctx_kern);
drivers/hid/bpf/hid_bpf_jmp_table.c +3 -17
@@ -333,15 +333,10 @@ static int hid_bpf_insert_prog(int prog_return err; } -int hid_bpf_get_prog_attach_type (int prog_fd) +int hid_bpf_get_prog_attach_type (struct bpf_prog *prog) { -struct bpf_prog *prog =NULL ; -int i;int prog_type =HID_BPF_PROG_TYPE_UNDEF ; - - prog =bpf_prog_get (prog_fd); -if (IS_ERR (prog)) -return PTR_ERR (prog); +int i;for (i =0 ; i <HID_BPF_PROG_TYPE_MAX ; i++) {if (hid_bpf_btf_ids[i] == prog->aux->attach_btf_id) {
@@ -350,8 +345,6 @@ int hid_bpf_get_prog_attach_type(int pro } } -bpf_prog_put (prog); -return prog_type; }
@@ -388,19 +381,13 @@ static const struct bpf_link_ops hid_bpf/* called from syscall */ noinline int__hid_bpf_attach_prog (struct hid_device *hdev,enum hid_bpf_prog_type prog_type, -int prog_fd,__u32 flags) +int prog_fd,struct bpf_prog *prog,__u32 flags) {struct bpf_link_primer link_primer;struct hid_bpf_link *link; -struct bpf_prog *prog =NULL ;struct hid_bpf_prog_entry *prog_entry;int cnt, err = -EINVAL , prog_table_idx =-1 ; -/* take a ref on the prog itself */ - prog =bpf_prog_get (prog_fd); -if (IS_ERR (prog)) -return PTR_ERR (prog); -mutex_lock (&hid_bpf_attach_lock); link =kzalloc (sizeof (*link),GFP_USER );
@@ -467,7 +454,6 @@ __hid_bpf_attach_prog(struct hid_device err_unlock:mutex_unlock (&hid_bpf_attach_lock); -bpf_prog_put (prog);kfree (link);return err;
Greg Kroah-Hartman
maintainerPATCH 82/309 HID: bpf: actually free hdev memory after attaching a HID-BPF program
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit 89be8aa5b0ecb3b729c7bcff64bb2af7921fec63 upstream.
Turns out that I got my reference counts wrong and each successful bus_find_device() actually calls get_device(), and we need to manually call put_device().
Ensure each bus_find_device() gets a matching put_device() when releasing the bpf programs and fix all the error paths.
--- drivers/hid/bpf/hid_bpf_dispatch.c | 29 +++++++++++++++++++++++------ drivers/hid/bpf/hid_bpf_jmp_table.c | 20 +++++++++++++++++--- 2 files changed, 40 insertions(+), 9 deletions(-)
drivers/hid/bpf/hid_bpf_dispatch.c +23 -6
@@ -292,7 +292,7 @@ hid_bpf_attach_prog(unsigned int hid_id,struct hid_device *hdev;struct bpf_prog *prog;struct device *dev; -int fd; +int err, fd;if (!hid_bpf_ops)return -EINVAL ;
@@ -311,14 +311,24 @@ hid_bpf_attach_prog(unsigned int hid_id,* on errors or when it'll be detached */ prog =bpf_prog_get (prog_fd); -if (IS_ERR (prog)) -return PTR_ERR (prog); +if (IS_ERR (prog)) { + err =PTR_ERR (prog); + goto out_dev_put; + } fd =do_hid_bpf_attach_prog (hdev, prog_fd, prog, flags); -if (fd <0 ) -bpf_prog_put (prog); +if (fd <0 ) { + err = fd; + goto out_prog_put; + }return fd; + + out_prog_put: +bpf_prog_put (prog); + out_dev_put: +put_device (dev); +return err; }/**
@@ -345,8 +355,10 @@ hid_bpf_allocate_context(unsigned int hi hdev =to_hid_device (dev); ctx_kern =kzalloc (sizeof (*ctx_kern),GFP_KERNEL ); -if (!ctx_kern) +if (!ctx_kern) { +put_device (dev);return NULL ; + } ctx_kern->ctx.hid = hdev;
@@ -363,10 +375,15 @@ noinline void hid_bpf_release_context(struct hid_bpf_ctx *ctx) {struct hid_bpf_ctx_kern *ctx_kern; +struct hid_device *hid; ctx_kern = container_of(ctx, struct hid_bpf_ctx_kern, ctx); + hid = (struct hid_device *)ctx_kern->ctx.hid;/* ignore const */ kfree (ctx_kern); + +/* get_device() is called by bus_find_device() */ +put_device (&hid->dev); }/**
drivers/hid/bpf/hid_bpf_jmp_table.c +17 -3
@@ -196,6 +196,7 @@ static void __hid_bpf_do_release_prog(instatic void hid_bpf_release_progs (struct work_struct *work) {int i, j, n, map_fd =-1 ; +bool hdev_destroyed;if (!jmp_table.map)return ;
@@ -220,6 +221,12 @@ static void hid_bpf_release_progs(structif (entry->hdev) { hdev = entry->hdev; type = entry->type; +/* +* hdev is still valid, even if we are called after hid_destroy_device(): +* when hid_bpf_attach() gets called, it takes a ref on the dev through +* bus_find_device() +*/ + hdev_destroyed = hdev->bpf.destroyed;hid_bpf_populate_hdev (hdev, type);
@@ -232,12 +239,19 @@ static void hid_bpf_release_progs(structif (test_bit (next->idx, jmp_table.enabled))continue ; -if (next->hdev == hdev && next->type == type) +if (next->hdev == hdev && next->type == type) { +/* +* clear the hdev reference and decrement the device ref +* that was taken during bus_find_device() while calling +* hid_bpf_attach() +*/ next->hdev =NULL ; +put_device (&hdev->dev); + } } -/* if type was rdesc fixup, reconnect device */ -if (type ==HID_BPF_PROG_TYPE_RDESC_FIXUP ) +/* if type was rdesc fixup and the device is not gone, reconnect device */ +if (type ==HID_BPF_PROG_TYPE_RDESC_FIXUP && !hdev_destroyed)hid_bpf_reconnect (hdev); } }
Greg Kroah-Hartman
maintainerPATCH 83/309 HID: i2c-hid-of: fix NULL-deref on failed power up
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 00aab7dcb2267f2aef59447602f34501efe1a07f upstream.
A while back the I2C HID implementation was split in an ACPI and OF part, but the new OF driver never initialises the client pointer which is dereferenced on power-up failures.
--- drivers/hid/i2c-hid/i2c-hid-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/i2c-hid/i2c-hid-of.c +1 -0
@@ -87,6 +87,7 @@ static int i2c_hid_of_probe(struct i2c_cif (!ihid_of)return -ENOMEM ; + ihid_of->client = client; ihid_of->ops.power_up = i2c_hid_of_power_up; ihid_of->ops.power_down = i2c_hid_of_power_down;
Greg Kroah-Hartman
maintainerPATCH 84/309 HID: wacom: generic: Avoid reporting a serial of 0 to userspace
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tatsunosuke Tobita <[email protected]>
commit ab41a31dd5e2681803642b6d08590b61867840ec upstream.
The xf86-input-wacom driver does not treat '0' as a valid serial number and will drop any input report which contains an MSC_SERIAL = 0 event. The kernel driver already takes care to avoid sending any MSC_SERIAL event if the value of serial[0] == 0 (which is the case for devices that don't actually report a serial number), but this is not quite sufficient.
Only the lower 32 bits of the serial get reported to userspace, so if this portion of the serial is zero then there can still be problems.
This commit allows the driver to report either the lower 32 bits if they are non-zero or the upper 32 bits otherwise.
--- drivers/hid/wacom_wac.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/hid/wacom_wac.c +8 -1
@@ -2574,7 +2574,14 @@ static void wacom_wac_pen_report(struct wacom_wac->hid_data.tipswitch);input_report_key (input, wacom_wac->tool[0 ], sense);if (wacom_wac->serial[0 ]) { -input_event (input,EV_MSC ,MSC_SERIAL , wacom_wac->serial[0 ]); +/* +* xf86-input-wacom does not accept a serial number +* of '0'. Report the low 32 bits if possible, but +* if they are zero, report the upper ones instead. +*/ +__u32 serial_lo = wacom_wac->serial[0 ] &0xFFFFFFFFu ; +__u32 serial_hi = wacom_wac->serial[0 ] >>32 ; +input_event (input,EV_MSC ,MSC_SERIAL , (int )(serial_lo ? serial_lo : serial_hi));input_report_abs (input,ABS_MISC , sense ? id :0 ); }
Greg Kroah-Hartman
maintainerPATCH 85/309 HID: wacom: Do not register input devices until after hid_hw_start
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
commit c1d6708bf0d3dd976460d435373cf5abf21ce258 upstream.
If a input device is opened before hid_hw_start is called, events may not be received from the hardware. In the case of USB-backed devices, for example, the hid_hw_start function is responsible for filling in the URB which is submitted when the input device is opened. If a device is opened prematurely, polling will never start because the device will not have been in the correct state to send the URB.
Because the wacom driver registers its input devices before calling hid_hw_start, there is a window of time where a device can be opened and end up in an inoperable state. Some ARM-based Chromebooks in particular reliably trigger this bug.
This commit splits the wacom_register_inputs function into two pieces. One which is responsible for setting up the allocated inputs (and runs prior to hid_hw_start so that devices are ready for any input events they may end up receiving) and another which only registers the devices (and runs after hid_hw_start to ensure devices can be immediately opened without issue). Note that the functions to initialize the LEDs and remotes are also moved after hid_hw_start to maintain their own dependency chains.
--- drivers/hid/wacom_sys.c | 63 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 20 deletions(-)
drivers/hid/wacom_sys.c +43 -20
@@ -2080,7 +2080,7 @@ static int wacom_allocate_inputs(structreturn 0 ; } -static int wacom_register_inputs (struct wacom *wacom) +static int wacom_setup_inputs (struct wacom *wacom) {struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev;struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
@@ -2099,10 +2099,6 @@ static int wacom_register_inputs(structinput_free_device (pen_input_dev); wacom_wac->pen_input =NULL ; pen_input_dev =NULL ; - }else { - error =input_register_device (pen_input_dev); -if (error) - goto fail; } error =wacom_setup_touch_input_capabilities (touch_input_dev, wacom_wac);
@@ -2111,10 +2107,6 @@ static int wacom_register_inputs(structinput_free_device (touch_input_dev); wacom_wac->touch_input =NULL ; touch_input_dev =NULL ; - }else { - error =input_register_device (touch_input_dev); -if (error) - goto fail; } error =wacom_setup_pad_input_capabilities (pad_input_dev, wacom_wac);
@@ -2123,7 +2115,34 @@ static int wacom_register_inputs(structinput_free_device (pad_input_dev); wacom_wac->pad_input =NULL ; pad_input_dev =NULL ; - }else { + } + +return 0 ; +} + +static int wacom_register_inputs (struct wacom *wacom) +{ +struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev; +struct wacom_wac *wacom_wac = &(wacom->wacom_wac); +int error =0 ; + + pen_input_dev = wacom_wac->pen_input; + touch_input_dev = wacom_wac->touch_input; + pad_input_dev = wacom_wac->pad_input; + +if (pen_input_dev) { + error =input_register_device (pen_input_dev); +if (error) + goto fail; + } + +if (touch_input_dev) { + error =input_register_device (touch_input_dev); +if (error) + goto fail; + } + +if (pad_input_dev) { error =input_register_device (pad_input_dev);if (error) goto fail;
@@ -2376,6 +2395,20 @@ static int wacom_parse_and_register(struif (error) goto fail; + error =wacom_setup_inputs (wacom); +if (error) + goto fail; + +if (features->type ==HID_GENERIC ) + connect_mask |=HID_CONNECT_DRIVER ; + +/* Regular HID work starts now */ + error =hid_hw_start (hdev, connect_mask); +if (error) { +hid_err (hdev,"hw start failed\n" ); + goto fail; + } + error =wacom_register_inputs (wacom);if (error) goto fail;
@@ -2390,16 +2423,6 @@ static int wacom_parse_and_register(stru goto fail; } -if (features->type ==HID_GENERIC ) - connect_mask |=HID_CONNECT_DRIVER ; - -/* Regular HID work starts now */ - error =hid_hw_start (hdev, connect_mask); -if (error) { -hid_err (hdev,"hw start failed\n" ); - goto fail; - } -if (!wireless) {/* Note that if query fails it is not a hard failure */ wacom_query_tablet_data (wacom);
Greg Kroah-Hartman
maintainerPATCH 86/309 iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
commit 621c6257128149e45b36ffb973a01c3f3461b893 upstream.
When als_capture_sample() is called with usage ID HID_USAGE_SENSOR_TIME_TIMESTAMP, return 0. The HID sensor core ignores the return value for capture_sample() callback, so return value doesn't make difference. But correct the return value to return success instead of -EINVAL.
--- drivers/iio/light/hid-sensor-als.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/light/hid-sensor-als.c +1 -0
@@ -226,6 +226,7 @@ static int als_capture_sample(struct hidcase HID_USAGE_SENSOR_TIME_TIMESTAMP : als_state->timestamp =hid_sensor_convert_timestamp (&als_state->common_attributes, *(s64 *)raw_data); + ret =0 ;break ;default :break ;
Greg Kroah-Hartman
maintainerPATCH 87/309 usb: ucsi: Add missing ppm_lock
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
commit c9aed03a0a683fd1600ea92f2ad32232d4736272 upstream.
Calling ->sync_write must be done while holding the PPM lock as the mailbox logic does not support concurrent commands.
At least since the addition of partner task this means that ucsi_acknowledge_connector_change should be called with the PPM lock held as it calls ->sync_write.
Thus protect the only call to ucsi_acknowledge_connector_change with the PPM. All other calls to ->sync_write already happen under the PPM lock.
--- drivers/usb/typec/ucsi/ucsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/ucsi/ucsi.c +2 -0
@@ -935,7 +935,9 @@ static void ucsi_handle_connector_changeclear_bit (EVENT_PENDING , &con->ucsi->flags); +mutex_lock (&ucsi->ppm_lock); ret =ucsi_acknowledge_connector_change (ucsi); +mutex_unlock (&ucsi->ppm_lock);if (ret)dev_err (ucsi->dev,"%s: ACK failed (%d)" , __func__, ret);
Greg Kroah-Hartman
maintainerPATCH 88/309 usb: ulpi: Fix debugfs directory leak
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
commit 3caf2b2ad7334ef35f55b95f3e1b138c6f77b368 upstream.
The ULPI per-device debugfs root is named after the ulpi device's parent, but ulpi_unregister_interface tries to remove a debugfs directory named after the ulpi device itself. This results in the directory sticking around and preventing subsequent (deferred) probes from succeeding. Change the directory name to match the ulpi device.
--- drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/common/ulpi.c +1 -1
@@ -301,7 +301,7 @@ static int ulpi_register(struct device *return ret; } - root =debugfs_create_dir (dev_name (dev), ulpi_root); + root =debugfs_create_dir (dev_name (&ulpi->dev), ulpi_root);debugfs_create_file ("regs" ,0444 , root, ulpi, &ulpi_regs_fops); dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n",
Greg Kroah-Hartman
maintainerPATCH 89/309 usb: ucsi_acpi: Fix command completion handling
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian A. Ehrhardt <[email protected]>
commit 2840143e393a4ddc1caab4372969ea337371168c upstream.
In case of a spurious or otherwise delayed notification it is possible that CCI still reports the previous completion. The UCSI spec is aware of this and provides two completion bits in CCI, one for normal commands and one for acks. As acks and commands alternate the notification handler can determine if the completion bit is from the current command.
The initial UCSI code correctly handled this but the distinction between the two completion bits was lost with the introduction of the new API.
To fix this revive the ACK_PENDING bit for ucsi_acpi and only complete commands if the completion bit matches.
--- drivers/usb/typec/ucsi/ucsi_acpi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/usb/typec/ucsi/ucsi_acpi.c +13 -4
@@ -73,9 +73,13 @@ static int ucsi_acpi_sync_write(struct u const void *val, size_t val_len) {struct ucsi_acpi *ua =ucsi_get_drvdata (ucsi); +bool ack =UCSI_COMMAND (*(u64 *)val) ==UCSI_ACK_CC_CI ;int ret; -set_bit (COMMAND_PENDING , &ua->flags); +if (ack) +set_bit (ACK_PENDING , &ua->flags); +else +set_bit (COMMAND_PENDING , &ua->flags); ret =ucsi_acpi_async_write (ucsi, offset, val, val_len);if (ret)
@@ -85,7 +89,10 @@ static int ucsi_acpi_sync_write(struct u ret = -ETIMEDOUT ; out_clear_bit: -clear_bit (COMMAND_PENDING , &ua->flags); +if (ack) +clear_bit (ACK_PENDING , &ua->flags); +else +clear_bit (COMMAND_PENDING , &ua->flags);return ret; }
@@ -142,8 +149,10 @@ static void ucsi_acpi_notify(acpi_handleif (UCSI_CCI_CONNECTOR (cci))ucsi_connector_change (ua->ucsi,UCSI_CCI_CONNECTOR (cci)); -if (test_bit (COMMAND_PENDING , &ua->flags) && - cci & (UCSI_CCI_ACK_COMPLETE |UCSI_CCI_COMMAND_COMPLETE )) +if (cci &UCSI_CCI_ACK_COMPLETE &&test_bit (ACK_PENDING , &ua->flags)) +complete (&ua->complete); +if (cci &UCSI_CCI_COMMAND_COMPLETE && +test_bit (COMMAND_PENDING , &ua->flags))complete (&ua->complete); }
Greg Kroah-Hartman
maintainerPATCH 90/309 USB: hub: check for alternate port before enabling A_ALT_HNP_SUPPORT
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit f17c34ffc792bbb520e4b61baa16b6cfc7d44b13 upstream.
The OTG 1.3 spec has the feature A_ALT_HNP_SUPPORT, which tells a device that it is connected to the wrong port. Some devices refuse to operate if you enable that feature, because it indicates to them that they ought to request to be connected to another port.
According to the spec this feature may be used based only the following three conditions:
6.5.3 a_alt_hnp_support
Setting this feature indicates to the B-device that it is connected to an A-device port that is not capable of HNP, but that the A-device does have an alternate port that is capable of HNP.
The A-device is required to set this feature under the following conditions:
• the A-device has multiple receptacles
• the A-device port that connects to the B-device does not support HNP
• the A-device has another port that does support HNP
A check for the third and first condition is missing. Add it.
--- drivers/usb/core/hub.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/usb/core/hub.c +19 -11
@@ -2382,17 +2382,25 @@ static int usb_enumerate_device_otg(stru } }else if (desc->bLength ==sizeof (struct usb_otg_descriptor )) { -/* Set a_alt_hnp_support for legacy otg device */ - err =usb_control_msg (udev, -usb_sndctrlpipe (udev,0 ), -USB_REQ_SET_FEATURE ,0 , -USB_DEVICE_A_ALT_HNP_SUPPORT , -0 ,NULL ,0 , -USB_CTRL_SET_TIMEOUT ); -if (err <0 ) -dev_err (&udev->dev, -"set a_alt_hnp_support failed: %d\n" , - err); +/* +* We are operating on a legacy OTP device +* These should be told that they are operating +* on the wrong port if we have another port that does +* support HNP +*/ +if (bus->otg_port !=0 ) { +/* Set a_alt_hnp_support for legacy otg device */ + err =usb_control_msg (udev, +usb_sndctrlpipe (udev,0 ), +USB_REQ_SET_FEATURE ,0 , +USB_DEVICE_A_ALT_HNP_SUPPORT , +0 ,NULL ,0 , +USB_CTRL_SET_TIMEOUT ); +if (err <0 ) +dev_err (&udev->dev, +"set a_alt_hnp_support failed: %d\n" , + err); + } } }#endif
Greg Kroah-Hartman
maintainerPATCH 91/309 usb: f_mass_storage: forbid async queue when shutdown happen
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: yuan linyu <[email protected]>
commit b2d2d7ea0dd09802cf5a0545bf54d8ad8987d20c upstream.
When write UDC to empty and unbind gadget driver from gadget device, it is possible that there are many queue failures for mass storage function.
The root cause is mass storage main thread alaways try to queue request to receive a command from host if running flag is on, on platform like dwc3, if pull down called, it will not queue request again and return -ESHUTDOWN, but it not affect running flag of mass storage function.
Check return code from mass storage function and clear running flag if it is -ESHUTDOWN, also indicate start in/out transfer failure to break loops.
--- drivers/usb/gadget/function/f_mass_storage.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_mass_storage.c +18 -2
@@ -545,21 +545,37 @@ static int start_transfer(struct fsg_devstatic bool start_in_transfer (struct fsg_common *common,struct fsg_buffhd *bh) { +int rc; +if (!fsg_is_set (common))return false; bh->state =BUF_STATE_SENDING ; -if (start_transfer (common->fsg, common->fsg->bulk_in, bh->inreq)) + rc =start_transfer (common->fsg, common->fsg->bulk_in, bh->inreq); +if (rc) { bh->state =BUF_STATE_EMPTY ; +if (rc == -ESHUTDOWN ) { + common->running =0 ; +return false; + } + }return true; }static bool start_out_transfer (struct fsg_common *common,struct fsg_buffhd *bh) { +int rc; +if (!fsg_is_set (common))return false; bh->state =BUF_STATE_RECEIVING ; -if (start_transfer (common->fsg, common->fsg->bulk_out, bh->outreq)) + rc =start_transfer (common->fsg, common->fsg->bulk_out, bh->outreq); +if (rc) { bh->state =BUF_STATE_FULL ; +if (rc == -ESHUTDOWN ) { + common->running =0 ; +return false; + } + }return true; }
Greg Kroah-Hartman
maintainerPATCH 92/309 usb: chipidea: core: handle power lost in workqueue
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit cc509b6a47e7c8998d9e41c273191299d5d9d631 upstream.
When power is recycled in usb controller during system power management, the controller will recognize it and switch role if role has been changed during power lost. In current design, it will be completed in resume() function. However, this may bring issues since usb class devices have their pm operations too and these device's resume() functions are still not being called at this point. When usb controller recognized host role should be stopped, these usb class devices will be removed at this point. But these usb class devices can't be removed in some cases, such as scsi devices. Since scsi driver may sync data to U-disk, however it will block there because scsi drvier can only handle pm request when is in suspended state. Therefore, there may exist a dependency between ci_resume() and usb class device's resume(). To break this potential dependency, we need to handle power lost work in a workqueue.
--- drivers/usb/chipidea/ci.h | 2 ++ drivers/usb/chipidea/core.c | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 20 deletions(-)
drivers/usb/chipidea/ci.h +2 -0
@@ -176,6 +176,7 @@ struct hw_bank {* @enabled_otg_timer_bits: bits of enabled otg timers * @next_otg_timer: next nearest enabled timer to be expired * @work: work for role changing +* @power_lost_work: work for power lost handling * @wq: workqueue thread * @qh_pool: allocation pool for queue heads * @td_pool: allocation pool for transfer descriptors
@@ -226,6 +227,7 @@ struct ci_hdrc {enum otg_fsm_timer next_otg_timer;struct usb_role_switch *role_switch;struct work_struct work; +struct work_struct power_lost_work;struct workqueue_struct *wq;struct dma_pool *qh_pool;
drivers/usb/chipidea/core.c +24 -20
68 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 93/309 usb: core: Prevent null pointer dereference in update_port_device_state
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Udipto Goswami <[email protected]>
commit 12783c0b9e2c7915a50d5ec829630ff2da50472c upstream.
Currently, the function update_port_device_state gets the usb_hub from udev->parent by calling usb_hub_to_struct_hub.
However, in case the actconfig or the maxchild is 0, the usb_hub would be NULL and upon further accessing to get port_dev would result in null pointer dereference.
Fix this by introducing an if check after the usb_hub is populated.
--- drivers/usb/core/hub.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/usb/core/hub.c +13 -3
@@ -2047,9 +2047,19 @@ static void update_port_device_state(strif (udev->parent) { hub =usb_hub_to_struct_hub (udev->parent); - port_dev = hub->ports[udev->portnum -1 ]; -WRITE_ONCE (port_dev->state, udev->state); -sysfs_notify_dirent (port_dev->state_kn); + +/* +* The Link Layer Validation System Driver (lvstest) +* has a test step to unbind the hub before running the +* rest of the procedure. This triggers hub_disconnect +* which will set the hub's maxchild to 0, further +* resulting in usb_hub_to_struct_hub returning NULL. +*/ +if (hub) { + port_dev = hub->ports[udev->portnum -1 ]; +WRITE_ONCE (port_dev->state, udev->state); +sysfs_notify_dirent (port_dev->state_kn); + } } }
Greg Kroah-Hartman
maintainerPATCH 94/309 usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uttkarsh Aggarwal <[email protected]>
commit 61a348857e869432e6a920ad8ea9132e8d44c316 upstream.
In current scenario if Plug-out and Plug-In performed continuously there could be a chance while checking for dwc->gadget_driver in dwc3_gadget_suspend, a NULL pointer dereference may occur.
Call Stack:
CPU1: CPU2: gadget_unbind_driver dwc3_suspend_common dwc3_gadget_stop dwc3_gadget_suspend
dwc3_disconnect_gadget
CPU1 basically clears the variable and CPU2 checks the variable. Consider CPU1 is running and right before gadget_driver is cleared and in parallel CPU2 executes dwc3_gadget_suspend where it finds dwc->gadget_driver which is not NULL and resumes execution and then CPU1 completes execution. CPU2 executes dwc3_disconnect_gadget where it checks dwc->gadget_driver is already NULL because of which the NULL pointer deference occur.
--- drivers/usb/dwc3/gadget.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/dwc3/gadget.c +2 -4
@@ -4703,15 +4703,13 @@ int dwc3_gadget_suspend(struct dwc3 *dwcunsigned long flags;int ret; -if (!dwc->gadget_driver) -return 0 ; - ret =dwc3_gadget_soft_disconnect (dwc);if (ret) goto err;spin_lock_irqsave (&dwc->lock, flags); -dwc3_disconnect_gadget (dwc); +if (dwc->gadget_driver) +dwc3_disconnect_gadget (dwc);spin_unlock_irqrestore (&dwc->lock, flags);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 95/309 interconnect: qcom: sc8180x: Mark CO0 BCM keepalive
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 85e985a4f46e462a37f1875cb74ed380e7c0c2e0 ]
The CO0 BCM needs to be up at all times, otherwise some hardware (like the UFS controller) loses its connection to the rest of the SoC, resulting in a hang of the platform, accompanied by a spectacular logspam.
Mark it as keepalive to prevent such cases.
--- drivers/interconnect/qcom/sc8180x.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sc8180x.c +1 -0
@@ -1372,6 +1372,7 @@ static struct qcom_icc_bcm bcm_mm0 = {static struct qcom_icc_bcm bcm_co0 = { .name ="CO0" , + .keepalive = true, .num_nodes =1 , .nodes = { &slv_qns_cdsp_mem_noc } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 96/309 interconnect: qcom: sm8550: Enable sync_state
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 24406f6794aa631516241deb9e19de333d6a0600 ]
To ensure the interconnect votes are actually meaningful and in order to prevent holding all buses at FMAX, introduce the sync state callback.
--- drivers/interconnect/qcom/sm8550.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sm8550.c +1 -0
@@ -2223,6 +2223,7 @@ static struct platform_driver qnoc_driver = { .driver = { .name = "qnoc-sm8550", .of_match_table = qnoc_of_match, + .sync_state = icc_sync_state, }, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/309 media: ir_toy: fix a memleak in irtoy_tx
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit dc9ceb90c4b42c6e5c6757df1d6257110433788e ]
When irtoy_command fails, buf should be freed since it is allocated by irtoy_tx, or there is a memleak.
--- drivers/media/rc/ir_toy.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/ir_toy.c +2 -0
@@ -332,6 +332,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) sizeof(COMMAND_SMODE_EXIT), STATE_COMMAND_NO_RESP);if (err) {dev_err (irtoy->dev,"exit sample mode: %d\n" , err); +kfree (buf);return err; }
@@ -339,6 +340,7 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count) sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND);if (err) {dev_err (irtoy->dev,"enter sample mode: %d\n" , err); +kfree (buf);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 98/309 driver core: fw_devlink: Improve detection of overlapping cycles
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saravana Kannan <[email protected]>
[ Upstream commit 6442d79d880cf7a2fff18779265d657fef0cce4c ]
fw_devlink can detect most overlapping/intersecting cycles. However it was missing a few corner cases because of an incorrect optimization logic that tries to avoid repeating cycle detection for devices that are already marked as part of a cycle.
Here's an example provided by Xu Yang (edited for clarity):
usb
+-----+
tcpc | |
+-----+ | +--|
| |----------->|EP|
|--+ | | +--|
|EP|<-----------| |
|--+ | | B |
| | +-----+
| A | |
+-----+ |
^ +-----+ |
| | | |
+-----| C |<--+
| |
+-----+usb-phy
Node A (tcpc) will be populated as device 1-0050. Node B (usb) will be populated as device 38100000.usb. Node C (usb-phy) will be populated as device 381f0040.usb-phy.
The description below uses the notation:
consumer --> supplier
child ==> parent
1. Node C is populated as device C. No cycles detected because cycle detection is only run when a fwnode link is converted to a device link.
2. Node B is populated as device B. As we convert B --> C into a device link we run cycle detection and find and mark the device link/fwnode link cycle:
C--> A --> B.EP ==> B --> C
3. Node A is populated as device A. As we convert C --> A into a device link, we see it's already part of a cycle (from step 2) and don't run cycle detection. Thus we miss detecting the cycle:
A --> B.EP ==> B --> A.EP ==> A
Looking at it another way, A depends on B in one way:
A --> B.EP ==> B
But B depends on A in two ways and we only detect the first:
B --> C --> A
B --> A.EP ==> A
To detect both of these, we remove the incorrect optimization attempt in step 3 and run cycle detection even if the fwnode link from which the device link is being created has already been marked as part of a cycle.
--- drivers/base/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/base/core.c +7 -2
@@ -2060,9 +2060,14 @@ static int fw_devlink_create_devlink(struct device *con,/* * SYNC_STATE_ONLY device links don't block probing and supports cycles. -* So cycle detection isn't necessary and shouldn't be done. +* So, one might expect that cycle detection isn't necessary for them. +* However, if the device link was marked as SYNC_STATE_ONLY because +* it's part of a cycle, then we still need to do cycle detection. This +* is because the consumer and supplier might be part of multiple cycles +* and we need to detect all those cycles. */ -if (!(flags &DL_FLAG_SYNC_STATE_ONLY )) { +if (!device_link_flag_is_sync_state_only (flags) || + flags &DL_FLAG_CYCLE ) {device_links_write_lock ();if (__fw_devlink_relax_cycles (con, sup_handle)) {__fwnode_link_cycle (link);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/309 powerpc/pseries/iommu: Fix iommu initialisation during DLPAR add
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Batra <[email protected]>
[ Upstream commit ed8b94f6e0acd652ce69bd69d678a0c769172df8 ]
When a PCI device is dynamically added, the kernel oopses with a NULL pointer dereference:
BUG: Kernel NULL pointer dereference on read at 0x00000030 Faulting instruction address: 0xc0000000006bbe5c Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries Modules linked in: rpadlpar_io rpaphp rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs xsk_diag bonding nft_compat nf_tables nfnetlink rfkill binfmt_misc dm_multipath rpcrdma sunrpc rdma_ucm ib_srpt ib_isert iscsi_target_mod target_core_mod ib_umad ib_iser libiscsi scsi_transport_iscsi ib_ipoib rdma_cm iw_cm ib_cm mlx5_ib ib_uverbs ib_core pseries_rng drm drm_panel_orientation_quirks xfs libcrc32c mlx5_core mlxfw sd_mod t10_pi sg tls ibmvscsi ibmveth scsi_transport_srp vmx_crypto pseries_wdt psample dm_mirror dm_region_hash dm_log dm_mod fuse CPU: 17 PID: 2685 Comm: drmgr Not tainted 6.7.0-203405+ #66 Hardware name: IBM,9080-HEX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_008) hv:phyp pSeries NIP: c0000000006bbe5c LR: c000000000a13e68 CTR: c0000000000579f8 REGS: c00000009924f240 TRAP: 0300 Not tainted (6.7.0-203405+) MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 24002220 XER: 20040006 CFAR: c000000000a13e64 DAR: 0000000000000030 DSISR: 40000000 IRQMASK: 0 ... NIP sysfs_add_link_to_group+0x34/0x94 LR iommu_device_link+0x5c/0x118 Call Trace: iommu_init_device+0x26c/0x318 (unreliable) iommu_device_link+0x5c/0x118 iommu_init_device+0xa8/0x318 iommu_probe_device+0xc0/0x134 iommu_bus_notifier+0x44/0x104 notifier_call_chain+0xb8/0x19c blocking_notifier_call_chain+0x64/0x98 bus_notify+0x50/0x7c device_add+0x640/0x918 pci_device_add+0x23c/0x298 of_create_pci_dev+0x400/0x884 of_scan_pci_dev+0x124/0x1b0 __of_scan_bus+0x78/0x18c pcibios_scan_phb+0x2a4/0x3b0 init_phb_dynamic+0xb8/0x110 dlpar_add_slot+0x170/0x3b8 [rpadlpar_io] add_slot_store.part.0+0xb4/0x130 [rpadlpar_io] kobj_attr_store+0x2c/0x48 sysfs_kf_write+0x64/0x78 kernfs_fop_write_iter+0x1b0/0x290 vfs_write+0x350/0x4a0 ksys_write+0x84/0x140 system_call_exception+0x124/0x330 system_call_vectored_common+0x15c/0x2ec
Commit a940904443e4 ("powerpc/iommu: Add iommu_ops to report capabilities and allow blocking domains") broke DLPAR add of PCI devices.
The above added iommu_device structure to pci_controller. During system boot, PCI devices are discovered and this newly added iommu_device structure is initialized by a call to iommu_device_register().
During DLPAR add of a PCI device, a new pci_controller structure is allocated but there are no calls made to iommu_device_register() interface.
Fix is to register the iommu device during DLPAR add as well.
--- arch/powerpc/include/asm/ppc-pci.h | 3 +++ arch/powerpc/kernel/iommu.c | 21 ++++++++++++++++----- arch/powerpc/platforms/pseries/pci_dlpar.c | 4 ++++ 3 files changed, 23 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/ppc-pci.h +3 -0
@@ -29,6 +29,9 @@ void *pci_traverse_device_nodes(struct device_node *start,void *(*fn)(struct device_node *,void *), void *data);extern void pci_devs_phb_init_dynamic (struct pci_controller *phb); +extern void ppc_iommu_register_device (struct pci_controller *phb); +extern void ppc_iommu_unregister_device (struct pci_controller *phb); +/* From rtas_pci.h */ extern void init_pci_config_tokens (void );
arch/powerpc/kernel/iommu.c +16 -5
@@ -1388,6 +1388,21 @@ static const struct attribute_group *spapr_tce_iommu_groups[] = { NULL, }; +void ppc_iommu_register_device (struct pci_controller *phb) +{ +iommu_device_sysfs_add (&phb->iommu, phb->parent, + spapr_tce_iommu_groups,"iommu-phb%04x" , + phb->global_number); +iommu_device_register (&phb->iommu, &spapr_tce_iommu_ops, + phb->parent); +} + +void ppc_iommu_unregister_device (struct pci_controller *phb) +{ +iommu_device_unregister (&phb->iommu); +iommu_device_sysfs_remove (&phb->iommu); +} +/* * This registers IOMMU devices of PHBs. This needs to happen * after core_initcall(iommu_init) + postcore_initcall(pci_driver_init) and
@@ -1398,11 +1413,7 @@ static int __init spapr_tce_setup_phb_iommus_initcall(void)struct pci_controller *hose;list_for_each_entry (hose, &hose_list, list_node) { -iommu_device_sysfs_add (&hose->iommu, hose->parent, - spapr_tce_iommu_groups,"iommu-phb%04x" , - hose->global_number); -iommu_device_register (&hose->iommu, &spapr_tce_iommu_ops, - hose->parent); +ppc_iommu_register_device (hose); }return 0 ; }
arch/powerpc/platforms/pseries/pci_dlpar.c +4 -0
@@ -35,6 +35,8 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn)pseries_msi_allocate_domains (phb); +ppc_iommu_register_device (phb); +/* Create EEH devices for the PHB */ eeh_phb_pe_create (phb);
@@ -76,6 +78,8 @@ int remove_phb_dynamic(struct pci_controller *phb) } } +ppc_iommu_unregister_device (phb); +pseries_msi_free_domains (phb);/* Keep a reference so phb isn't freed yet */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 100/309 powerpc/6xx: set High BAT Enable flag on G2_LE cores
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit a038a3ff8c6582404834852c043dadc73a5b68b4 ]
MMU_FTR_USE_HIGH_BATS is set for G2_LE cores and derivatives like e300cX, but the high BATs need to be enabled in HID2 to work. Add register definitions and add the needed setup to __setup_cpu_603.
This fixes boot on CPUs like the MPC5200B with STRICT_KERNEL_RWX enabled on systems where the flag has not been set by the bootloader already.
--- arch/powerpc/include/asm/reg.h | 2 ++ arch/powerpc/kernel/cpu_setup_6xx.S | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/reg.h +2 -0
@@ -617,6 +617,8 @@#endif #define SPRN_HID2 0x3F8/* Hardware Implementation Register 2 */ #define SPRN_HID2_GEKKO 0x398/* Gekko HID2 Register */ +#define SPRN_HID2_G2_LE 0x3F3/* G2_LE HID2 Register */ +#define HID2_G2_LE_HBE (1<<18)/* High BAT Enable (G2_LE) */ #define SPRN_IABR 0x3F2/* Instruction Address Breakpoint Register */ #define SPRN_IABR2 0x3FA/* 83xx */ #define SPRN_IBCR 0x135/* 83xx Insn Breakpoint Control Reg */
arch/powerpc/kernel/cpu_setup_6xx.S +19 -1
@@ -26,6 +26,15 @@ BEGIN_FTR_SECTION bl __init_fpu_registers END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) bl setup_common_caches + + /* + * This assumes that all cores using __setup_cpu_603 with + * MMU_FTR_USE_HIGH_BATS are G2_LE compatible + */ +BEGIN_MMU_FTR_SECTION + bl setup_g2_le_hid2 +END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_HIGH_BATS) + mtlr r5 blr _GLOBAL(__setup_cpu_604)
@@ -115,6 +124,16 @@ SYM_FUNC_START_LOCAL(setup_604_hid0) blr SYM_FUNC_END(setup_604_hid0) +/* Enable high BATs for G2_LE and derivatives like e300cX */ +SYM_FUNC_START_LOCAL(setup_g2_le_hid2) + mfspr r11,SPRN_HID2_G2_LE + oris r11,r11,HID2_G2_LE_HBE@h + mtspr SPRN_HID2_G2_LE,r11 + sync + isync + blr +SYM_FUNC_END(setup_g2_le_hid2) + /* 7400 <= rev 2.7 and 7410 rev = 1.0 suffer from some * erratas we work around here. * Moto MPC710CE.pdf describes them, those are errata
@@ -495,4 +514,3 @@ _GLOBAL(__restore_cpu_setup) mtcr r7 blr _ASM_NOKPROBE_SYMBOL(__restore_cpu_setup) -
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 101/309 powerpc/kasan: Fix addr error caused by page alignment
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiangfeng Xiao <[email protected]>
[ Upstream commit 4a7aee96200ad281a5cc4cf5c7a2e2a49d2b97b0 ]
In kasan_init_region, when k_start is not page aligned, at the begin of for loop, k_cur = k_start & PAGE_MASK is less than k_start, and then va = block + k_cur - k_start is less than block, the addr va is invalid, because the memory address space from va to block is not alloced by memblock_alloc, which will not be reserved by memblock_reserve later, it will be used by other places.
As a result, memory overwriting occurs.
for example:
int __init __weak kasan_init_region(void *start, size_t size) {
[...]
/* if say block(dcd97000) k_start(feef7400) k_end(feeff3fe) */
block = memblock_alloc(k_end - k_start, PAGE_SIZE);
[...]
for (k_cur = k_start & PAGE_MASK; k_cur < k_end; k_cur += PAGE_SIZE) {
/* at the begin of for loop
* block(dcd97000) va(dcd96c00) k_cur(feef7000) k_start(feef7400)
* va(dcd96c00) is less than block(dcd97000), va is invalid
*/
void *va = block + k_cur - k_start;
[...]
}[...]
}
Therefore, page alignment is performed on k_start before memblock_alloc() to ensure the validity of the VA address.
--- arch/powerpc/mm/kasan/init_32.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/mm/kasan/init_32.c +1 -0
@@ -64,6 +64,7 @@ int __init __weak kasan_init_region(void *start, size_t size)if (ret)return ret; + k_start = k_start &PAGE_MASK ; block =memblock_alloc (k_end - k_start,PAGE_SIZE );if (!block)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 102/309 Revert "kobject: Remove redundant checks for whether ktype is NULL"
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 3ca8fbabcceb8bfe44f7f50640092fd8f1de375c ]
This reverts commit 1b28cb81dab7c1eedc6034206f4e8d644046ad31.
It is reported to cause problems, so revert it for now until the root cause can be found.
--- lib/kobject.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
lib/kobject.c +14 -10
@@ -74,10 +74,12 @@ static int create_dir(struct kobject *kobj)if (error)return error; - error =sysfs_create_groups (kobj, ktype->default_groups); -if (error) { -sysfs_remove_dir (kobj); -return error; +if (ktype) { + error =sysfs_create_groups (kobj, ktype->default_groups); +if (error) { +sysfs_remove_dir (kobj); +return error; + } }/*
@@ -589,7 +591,8 @@ static void __kobject_del(struct kobject *kobj) sd = kobj->sd; ktype =get_ktype (kobj); -sysfs_remove_groups (kobj, ktype->default_groups); +if (ktype) +sysfs_remove_groups (kobj, ktype->default_groups);/* send "remove" if the caller did not do it but sent "add" */ if (kobj->state_add_uevent_sent && !kobj->state_remove_uevent_sent) {
@@ -666,6 +669,10 @@ static void kobject_cleanup(struct kobject *kobj)pr_debug ("'%s' (%p): %s, parent %p\n" ,kobject_name (kobj), kobj, __func__, kobj->parent); +if (t && !t->release) +pr_debug ("'%s' (%p): does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.\n" , +kobject_name (kobj), kobj); +/* remove from sysfs if the caller did not do it */ if (kobj->state_in_sysfs) { pr_debug("'%s' (%p): auto cleanup kobject_del\n",
@@ -676,13 +683,10 @@ static void kobject_cleanup(struct kobject *kobj) parent =NULL ; } -if (t->release) { +if (t && t->release) {pr_debug ("'%s' (%p): calling ktype release\n" ,kobject_name (kobj), kobj); t->release (kobj); - }else { -pr_debug ("'%s' (%p): does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.\n" , -kobject_name (kobj), kobj); }/* free name if we allocated it */
@@ -1056,7 +1060,7 @@ const struct kobj_ns_type_operations *kobj_child_ns_ops(const struct kobject *pa {const struct kobj_ns_type_operations *ops =NULL ; -if (parent && parent->ktype->child_ns_type) +if (parent && parent->ktype && parent->ktype->child_ns_type) ops = parent->ktype->child_ns_type (parent);return ops;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 103/309 PCI: Fix active state requirement in PME polling
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
[ Upstream commit 41044d5360685e78a869d40a168491a70cdb7e73 ]
The commit noted in fixes added a bogus requirement that runtime PM managed devices need to be in the RPM_ACTIVE state for PME polling. In fact, only devices in low power states should be polled.
However there's still a requirement that the device config space must be accessible, which has implications for both the current state of the polled device and the parent bridge, when present. It's not sufficient to assume the bridge remains in D0 and cases have been observed where the bridge passes the D0 test, but the PM state indicates RPM_SUSPENDING and config space of the polled device becomes inaccessible during pci_pme_wakeup().
Therefore, since the bridge is already effectively required to be in the RPM_ACTIVE state, formalize this in the code and elevate the PM usage count to maintain the state while polling the subordinate device.
This resolves a regression reported in the bugzilla below where a Thunderbolt/USB4 hierarchy fails to scan for an attached NVMe endpoint downstream of a bridge in a D3hot power state.
--- drivers/pci/pci.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
drivers/pci/pci.c +22 -15
@@ -2459,29 +2459,36 @@ static void pci_pme_list_scan(struct work_struct *work)if (pdev->pme_poll) {struct pci_dev *bridge = pdev->bus->self;struct device *dev = &pdev->dev; -int pm_status; +struct device *bdev = bridge ? &bridge->dev :NULL ; +int bref =0 ;/* -* If bridge is in low power state, the -* configuration space of subordinate devices -* may be not accessible +* If we have a bridge, it should be in an active/D0 +* state or the configuration space of subordinate +* devices may not be accessible or stable over the +* course of the call. */ -if (bridge && bridge->current_state !=PCI_D0 ) -continue ; +if (bdev) { + bref =pm_runtime_get_if_active (bdev, true); +if (!bref) +continue ; + +if (bridge->current_state !=PCI_D0 ) + goto put_bridge; + }/* -* If the device is in a low power state it -* should not be polled either. +* The device itself should be suspended but config +* space must be accessible, therefore it cannot be in +* D3cold. */ - pm_status =pm_runtime_get_if_active (dev, true); -if (!pm_status) -continue ; - -if (pdev->current_state != PCI_D3cold) +if (pm_runtime_suspended (dev) && + pdev->current_state != PCI_D3cold)pci_pme_wakeup (pdev,NULL ); -if (pm_status >0 ) -pm_runtime_put (dev); +put_bridge: +if (bref >0 ) +pm_runtime_put (bdev); }else {list_del (&pme_dev->list);kfree (pme_dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 104/309 iio: adc: ad4130: zero-initialize clock init data
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
[ Upstream commit a22b0a2be69a36511cb5b37d948b651ddf7debf3 ]
The clk_init_data struct does not have all its members initialized, causing issues when trying to expose the internal clock on the CLK pin.
Fix this by zero-initializing the clk_init_data struct.
--- drivers/iio/adc/ad4130.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad4130.c +1 -1
@@ -1821,7 +1821,7 @@ static int ad4130_setup_int_clk(struct ad4130_state *st) {struct device *dev = &st->spi->dev;struct device_node *of_node =dev_of_node (dev); -struct clk_init_data init; +struct clk_init_data init = {};const char *clk_name;int ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 105/309 iio: adc: ad4130: only set GPIO_CTRL if pin is unused
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
[ Upstream commit 78367c32bebfe833cd30c855755d863a4ff3fdee ]
Currently, GPIO_CTRL bits are set even if the pins are used for measurements.
GPIO_CTRL bits should only be set if the pin is not used for other functionality.
Fix this by only setting the GPIO_CTRL bits if the pin has no other function.
--- drivers/iio/adc/ad4130.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/adc/ad4130.c +7 -3
@@ -1891,10 +1891,14 @@ static int ad4130_setup(struct iio_dev *indio_dev)return ret;/* -* Configure all GPIOs for output. If configured, the interrupt function -* of P2 takes priority over the GPIO out function. +* Configure unused GPIOs for output. If configured, the interrupt +* function of P2 takes priority over the GPIO out function. */ - val =AD4130_IO_CONTROL_GPIO_CTRL_MASK ; + val =0 ; +for (i =0 ; i <AD4130_MAX_GPIOS ; i++) +if (st->pins_fn[i +AD4130_AIN2_P1 ] ==AD4130_PIN_FN_NONE ) + val |=FIELD_PREP (AD4130_IO_CONTROL_GPIO_CTRL_MASK ,BIT (i)); + val |=FIELD_PREP (AD4130_IO_CONTROL_INT_PIN_SEL_MASK , st->int_pin_sel); ret =regmap_write (st->regmap,AD4130_IO_CONTROL_REG , val);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 106/309 cifs: fix underflow in parse_server_interfaces()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit cffe487026be13eaf37ea28b783d9638ab147204 ]
In this loop, we step through the buffer and after each item we check if the size_left is greater than the minimum size we need. However, the problem is that "bytes_left" is type ssize_t while sizeof() is type size_t. That means that because of type promotion, the comparison is done as an unsigned and if we have negative bytes left the loop continues instead of ending.
--- fs/smb/client/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/smb2ops.c +1 -1
@@ -619,7 +619,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, goto out; } -while (bytes_left >=sizeof (*p)) { +while (bytes_left >= (ssize_t )sizeof (*p)) {memset (&tmp_iface,0 ,sizeof (tmp_iface)); tmp_iface.speed =le64_to_cpu (p->LinkSpeed); tmp_iface.rdma_capable =le32_to_cpu (p->Capability &RDMA_CAPABLE ) ?1 :0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 107/309 i2c: qcom-geni: Correct I2C TRE sequence
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viken Dadhaniya <[email protected]>
[ Upstream commit 83ef106fa732aea8558253641cd98e8a895604d7 ]
For i2c read operation in GSI mode, we are getting timeout due to malformed TRE basically incorrect TRE sequence in gpi(drivers/dma/qcom/gpi.c) driver.
I2C driver has geni_i2c_gpi(I2C_WRITE) function which generates GO TRE and geni_i2c_gpi(I2C_READ)generates DMA TRE. Hence to generate GO TRE before DMA TRE, we should move geni_i2c_gpi(I2C_WRITE) before geni_i2c_gpi(I2C_READ) inside the I2C GSI mode transfer function i.e. geni_i2c_gpi_xfer().
TRE stands for Transfer Ring Element - which is basically an element with size of 4 words. It contains all information like slave address, clk divider, dma address value data size etc).
Mainly we have 3 TREs(Config, GO and DMA tre).
- CONFIG TRE : consists of internal register configuration which is required before start of the transfer.
- DMA TRE : contains DDR/Memory address, called as DMA descriptor.
- GO TRE : contains Transfer directions, slave ID, Delay flags, Length
of the transfer.
I2c driver calls GPI driver API to config each TRE depending on the protocol.
For read operation tre sequence will be as below which is not aligned to hardware programming guide.
- CONFIG tre
- DMA tre
- GO tre
As per Qualcomm's internal Hardware Programming Guide, we should configure TREs in below sequence for any RX only transfer.
- CONFIG tre
- GO tre
- DMA tre
--- drivers/i2c/busses/i2c-qcom-geni.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +7 -7
@@ -613,20 +613,20 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i peripheral.addr = msgs[i].addr; + ret =geni_i2c_gpi (gi2c, &msgs[i], &config, + &tx_addr, &tx_buf,I2C_WRITE , gi2c->tx_c); +if (ret) + goto err; +if (msgs[i].flags &I2C_M_RD ) { ret =geni_i2c_gpi (gi2c, &msgs[i], &config, &rx_addr, &rx_buf,I2C_READ , gi2c->rx_c);if (ret) goto err; - } - - ret =geni_i2c_gpi (gi2c, &msgs[i], &config, - &tx_addr, &tx_buf,I2C_WRITE , gi2c->tx_c); -if (ret) - goto err; -if (msgs[i].flags &I2C_M_RD )dma_async_issue_pending (gi2c->rx_c); + } +dma_async_issue_pending (gi2c->tx_c); timeout =wait_for_completion_timeout (&gi2c->done,XFER_TIMEOUT );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 108/309 irqchip/loongson-eiointc: Use correct struct type in eiointc_domain_alloc()
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bibo Mao <[email protected]>
[ Upstream commit f1c2765c6afcd1f71f76ed8c9bf94acedab4cecb ]
eiointc_domain_alloc() uses struct eiointc, which is not defined, for a pointer. Older compilers treat that as a forward declaration and due to assignment of a void pointer there is no warning emitted. As the variable is then handed in as a void pointer argument to irq_domain_set_info() the code is functional.
Use struct eiointc_priv instead.
[ tglx: Rewrote changelog ]
--- drivers/irqchip/irq-loongson-eiointc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-loongson-eiointc.c +1 -1
@@ -241,7 +241,7 @@ static int eiointc_domain_alloc(struct irq_domain *domain, unsigned int virq,int ret;unsigned int i, type;unsigned long hwirq =0 ; -struct eiointc *priv = domain->host_data; +struct eiointc_priv *priv = domain->host_data; ret =irq_domain_translate_onecell (domain, arg, &hwirq, &type);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 109/309 irqchip/gic-v3-its: Handle non-coherent GICv4 redistributors
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
[ Upstream commit 846297e11e8ae428f8b00156a0cfe2db58100702 ]
Although the GICv3 code base has gained some handling of systems failing to handle the shareability attributes, the GICv4 side of things has been firmly ignored.
This is unfortunate, as the new recent addition of the "dma-noncoherent" is supposed to apply to all of the GICR tables, and not just the ones that are common to v3 and v4.
Add some checks to handle the VPROPBASE/VPENDBASE shareability and cacheability attributes in the same way we deal with the other GICR_BASE registers, wrapping the flag check in a helper for improved readability.
Note that this has been found by inspection only, as I don't have access to HW that suffers from this particular issue.
--- drivers/irqchip/irq-gic-v3-its.c | 37 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +25 -12
@@ -207,6 +207,11 @@ static bool require_its_list_vmovp(struct its_vm *vm, struct its_node *its)return (gic_rdists->has_rvpeid || vm->vlpi_count[its->list_nr]); } +static bool rdists_support_shareable (void ) +{ +return !(gic_rdists->flags &RDIST_FLAGS_FORCE_NON_SHAREABLE ); +} +static u16 get_its_list (struct its_vm *vm) {struct its_node *its;
@@ -2710,10 +2715,12 @@ static u64 inherit_vpe_l1_table_from_its(void)break ; } val |=FIELD_PREP (GICR_VPROPBASER_4_1_ADDR , addr >>12 ); - val |=FIELD_PREP (GICR_VPROPBASER_SHAREABILITY_MASK , -FIELD_GET (GITS_BASER_SHAREABILITY_MASK , baser)); - val |=FIELD_PREP (GICR_VPROPBASER_INNER_CACHEABILITY_MASK , -FIELD_GET (GITS_BASER_INNER_CACHEABILITY_MASK , baser)); +if (rdists_support_shareable ()) { + val |=FIELD_PREP (GICR_VPROPBASER_SHAREABILITY_MASK , +FIELD_GET (GITS_BASER_SHAREABILITY_MASK , baser)); + val |=FIELD_PREP (GICR_VPROPBASER_INNER_CACHEABILITY_MASK , +FIELD_GET (GITS_BASER_INNER_CACHEABILITY_MASK , baser)); + } val |=FIELD_PREP (GICR_VPROPBASER_4_1_SIZE ,GITS_BASER_NR_PAGES (baser) -1 );return val;
@@ -2936,8 +2943,10 @@ static int allocate_vpe_l1_table(void)WARN_ON (!IS_ALIGNED (pa, psz)); val |=FIELD_PREP (GICR_VPROPBASER_4_1_ADDR , pa >>12 ); - val |= GICR_VPROPBASER_RaWb; - val |= GICR_VPROPBASER_InnerShareable; +if (rdists_support_shareable ()) { + val |= GICR_VPROPBASER_RaWb; + val |= GICR_VPROPBASER_InnerShareable; + } val |=GICR_VPROPBASER_4_1_Z ; val |=GICR_VPROPBASER_4_1_VALID ;
@@ -3126,7 +3135,7 @@ static void its_cpu_init_lpis(void)gicr_write_propbaser (val, rbase +GICR_PROPBASER ); tmp =gicr_read_propbaser (rbase +GICR_PROPBASER ); -if (gic_rdists->flags &RDIST_FLAGS_FORCE_NON_SHAREABLE ) +if (!rdists_support_shareable ()) tmp &= ~GICR_PROPBASER_SHAREABILITY_MASK ;if ((tmp ^ val) &GICR_PROPBASER_SHAREABILITY_MASK ) {
@@ -3153,7 +3162,7 @@ static void its_cpu_init_lpis(void)gicr_write_pendbaser (val, rbase +GICR_PENDBASER ); tmp =gicr_read_pendbaser (rbase +GICR_PENDBASER ); -if (gic_rdists->flags &RDIST_FLAGS_FORCE_NON_SHAREABLE ) +if (!rdists_support_shareable ()) tmp &= ~GICR_PENDBASER_SHAREABILITY_MASK ;if (!(tmp &GICR_PENDBASER_SHAREABILITY_MASK )) {
@@ -3880,14 +3889,18 @@ static void its_vpe_schedule(struct its_vpe *vpe) val =virt_to_phys (page_address (vpe->its_vm->vprop_page)) &GENMASK_ULL (51 ,12 ); val |= (LPI_NRBITS -1 ) &GICR_VPROPBASER_IDBITS_MASK ; - val |= GICR_VPROPBASER_RaWb; - val |= GICR_VPROPBASER_InnerShareable; +if (rdists_support_shareable ()) { + val |= GICR_VPROPBASER_RaWb; + val |= GICR_VPROPBASER_InnerShareable; + }gicr_write_vpropbaser (val, vlpi_base +GICR_VPROPBASER ); val =virt_to_phys (page_address (vpe->vpt_page)) &GENMASK_ULL (51 ,16 ); - val |= GICR_VPENDBASER_RaWaWb; - val |= GICR_VPENDBASER_InnerShareable; +if (rdists_support_shareable ()) { + val |= GICR_VPENDBASER_RaWaWb; + val |= GICR_VPENDBASER_InnerShareable; + }/* * There is no good way of finding out if the pending table is * empty as we can race against the doorbell interrupt very
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 110/309 powerpc/kasan: Limit KASAN thread size increase to 32KB
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit f1acb109505d983779bbb7e20a1ee6244d2b5736 ]
KASAN is seen to increase stack usage, to the point that it was reported to lead to stack overflow on some 32-bit machines (see link).
To avoid overflows the stack size was doubled for KASAN builds in commit 3e8635fb2e07 ("powerpc/kasan: Force thread size increase with KASAN").
However with a 32KB stack size to begin with, the doubling leads to a
64KB stack, which causes build errors:
arch/powerpc/kernel/switch.S:249: Error: operand out of range (0x000000000000fe50 is not between 0xffffffffffff8000 and 0x0000000000007fff)
Although the asm could be reworked, in practice a 32KB stack seems sufficient even for KASAN builds - the additional usage seems to be in the 2-3KB range for a 64-bit KASAN build.
So only increase the stack for KASAN if the stack size is < 32KB.
--- arch/powerpc/include/asm/thread_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/thread_info.h +1 -1
@@ -14,7 +14,7 @@#ifdef __KERNEL__ -#ifdef CONFIG_KASAN +#if defined(CONFIG_KASAN ) &&CONFIG_THREAD_SHIFT <15 #define MIN_THREAD_SHIFT (CONFIG_THREAD_SHIFT + 1)#else #define MIN_THREAD_SHIFT CONFIG_THREAD_SHIFT
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 111/309 powerpc/iommu: Fix the missing iommu_group_put() during platform domain attach
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shivaprasad G Bhat <[email protected]>
[ Upstream commit 0846dd77c8349ec92ca0079c9c71d130f34cb192 ]
The function spapr_tce_platform_iommu_attach_dev() is missing to call iommu_group_put() when the domain is already set. This refcount leak shows up with BUG_ON() during DLPAR remove operation as:
KernelBug: Kernel bug in state 'None': kernel BUG at arch/powerpc/platforms/pseries/iommu.c:100!
Oops: Exception in kernel mode, sig: 5 [#1]
LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=8192 NUMA pSeries
<snip>
Hardware name: IBM,9080-HEX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_016) hv:phyp pSeries
NIP: c0000000000ff4d4 LR: c0000000000ff4cc CTR: 0000000000000000
REGS: c0000013aed5f840 TRAP: 0700 Tainted: G I (6.8.0-rc3-autotest-g99bd3cb0d12e)
MSR: 8000000000029033 <SF,EE,ME,IR,DR,RI,LE> CR: 44002402 XER: 20040000
CFAR: c000000000a0d170 IRQMASK: 0
...
NIP iommu_reconfig_notifier+0x94/0x200
LR iommu_reconfig_notifier+0x8c/0x200
Call Trace:
iommu_reconfig_notifier+0x8c/0x200 (unreliable)
notifier_call_chain+0xb8/0x19c
blocking_notifier_call_chain+0x64/0x98
of_reconfig_notify+0x44/0xdc
of_detach_node+0x78/0xb0
ofdt_write.part.0+0x86c/0xbb8
proc_reg_write+0xf4/0x150
vfs_write+0xf8/0x488
ksys_write+0x84/0x140
system_call_exception+0x138/0x330
system_call_vectored_common+0x15c/0x2ecThe patch adds the missing iommu_group_put() call.
--- arch/powerpc/kernel/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/kernel/iommu.c +3 -1
@@ -1290,8 +1290,10 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain,int ret = -EINVAL ;/* At first attach the ownership is already set */ -if (!domain) +if (!domain) { +iommu_group_put (grp);return 0 ; + }if (!grp)return -ENODEV ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 112/309 i2c: pasemi: split driver into two separate modules
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit f44bff19268517ee98e80e944cad0f04f1db72e3 ]
On powerpc, it is possible to compile test both the new apple (arm) and old pasemi (powerpc) drivers for the i2c hardware at the same time, which leads to a warning about linking the same object file twice:
scripts/Makefile.build:244: drivers/i2c/busses/Makefile: i2c-pasemi-core.o is added to multiple modules: i2c-apple i2c-pasemi
Rework the driver to have an explicit helper module, letting Kbuild take care of whether this should be built-in or a loadable driver.
--- drivers/i2c/busses/Makefile | 6 ++---- drivers/i2c/busses/i2c-pasemi-core.c | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/i2c/busses/Makefile +2 -4
@@ -90,10 +90,8 @@ obj-$(CONFIG_I2C_NPCM) += i2c-npcm7xx.o obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o obj-$(CONFIG_I2C_OMAP) += i2c-omap.o obj-$(CONFIG_I2C_OWL) += i2c-owl.o -i2c-pasemi-objs := i2c-pasemi-core.o i2c-pasemi-pci.o -obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o -i2c-apple-objs := i2c-pasemi-core.o i2c-pasemi-platform.o -obj-$(CONFIG_I2C_APPLE) += i2c-apple.o +obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi-core.o i2c-pasemi-pci.o +obj-$(CONFIG_I2C_APPLE) += i2c-pasemi-core.o i2c-pasemi-platform.o obj-$(CONFIG_I2C_PCA_PLATFORM) += i2c-pca-platform.o obj-$(CONFIG_I2C_PNX) += i2c-pnx.o obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
drivers/i2c/busses/i2c-pasemi-core.c +6 -0
@@ -369,6 +369,7 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)return 0 ; } +EXPORT_SYMBOL_GPL (pasemi_i2c_common_probe);irqreturn_t pasemi_irq_handler (int irq,void *dev_id) {
@@ -378,3 +379,8 @@ irqreturn_t pasemi_irq_handler(int irq, void *dev_id)complete (&smbus->irq_completion);return IRQ_HANDLED ; } +EXPORT_SYMBOL_GPL (pasemi_irq_handler); + +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Olof Johansson <[email protected]>" ); +MODULE_DESCRIPTION ("PA Semi PWRficient SMBus driver" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 113/309 i2c: i801: Fix block process call transactions
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
[ Upstream commit c1c9d0f6f7f1dbf29db996bd8e166242843a5f21 ]
According to the Intel datasheets, software must reset the block buffer index twice for block process call transactions: once before writing the outgoing data to the buffer, and once again before reading the incoming data from the buffer.
The driver is currently missing the second reset, causing the wrong portion of the block buffer to be read.
--- drivers/i2c/busses/i2c-i801.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-i801.c +2 -2
@@ -498,11 +498,10 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,/* Set block buffer mode */ outb_p (inb_p (SMBAUXCTL (priv)) |SMBAUXCTL_E32B ,SMBAUXCTL (priv)); -inb_p (SMBHSTCNT (priv));/* reset the data buffer index */ -if (read_write ==I2C_SMBUS_WRITE ) { len = data->block[0 ];outb_p (len,SMBHSTDAT0 (priv)); +inb_p (SMBHSTCNT (priv));/* reset the data buffer index */ for (i =0 ; i < len; i++)outb_p (data->block[i+1 ],SMBBLKDAT (priv)); }
@@ -520,6 +519,7 @@ static int i801_block_transaction_by_block(struct i801_priv *priv, } data->block[0 ] = len; +inb_p (SMBHSTCNT (priv));/* reset the data buffer index */ for (i =0 ; i < len; i++) data->block[i +1 ] =inb_p (SMBBLKDAT (priv)); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 114/309 modpost: trim leading spaces when processing source files list
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radek Krejci <[email protected]>
[ Upstream commit 5d9a16b2a4d9e8fa028892ded43f6501bc2969e5 ]
get_line() does not trim the leading spaces, but the parse_source_files() expects to get lines with source files paths where the first space occurs after the file path.
--- scripts/mod/sumversion.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/mod/sumversion.c +6 -1
@@ -326,7 +326,12 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)/* Sum all files in the same dir or subdirs. */ while ((line =get_line (&pos))) { -char * p = line; +char * p; + +/* trim the leading spaces away */ +while (isspace (*line)) + line++; + p = line;if (strncmp (line,"source_" ,sizeof ("source_" )-1 ) ==0 ) { p =strrchr (line,' ' );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 115/309 kallsyms: ignore ARMv4 thunks along with others
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a951884d82886d8453d489f84f20ac168d062b38 ]
lld is now able to build ARMv4 and ARMv4T kernels, which means it can generate thunks for those (__ARMv4PILongThunk_*, __ARMv4PILongBXThunk_*) that can interfere with kallsyms table generation since they do not get ignore like the corresponding ARMv5+ ones are:
Inconsistent kallsyms data
Try "make KALLSYMS_EXTRA_PASS=1" as a workaround
Replace the hardcoded list of thunk symbols with a more general regex that covers this one along with future symbols that follow the same pattern.
--- scripts/mksysmap | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
scripts/mksysmap +2 -11
@@ -48,17 +48,8 @@ ${NM} -n ${1} | sed >${2} -e " / __kvm_nvhe_\\$/d / __kvm_nvhe_\.L/d -# arm64 lld -/ __AArch64ADRPThunk_/d - -# arm lld -/ __ARMV5PILongThunk_/d -/ __ARMV7PILongThunk_/d -/ __ThumbV7PILongThunk_/d - -# mips lld -/ __LA25Thunk_/d -/ __microLA25Thunk_/d +# lld arm/aarch64/mips thunks +/ __[[:alnum:]]*Thunk_/d # CFI type identifiers / __kcfi_typeid_/d
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 116/309 mptcp: fix data re-injection from stale subflow
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit b6c620dc43ccb4e802894e54b651cf81495e9598 upstream.
When the MPTCP PM detects that a subflow is stale, all the packet scheduler must re-inject all the mptcp-level unacked data. To avoid acquiring unneeded locks, it first try to check if any unacked data is present at all in the RTX queue, but such check is currently broken, as it uses TCP-specific helper on an MPTCP socket.
Funnily enough fuzzers and static checkers are happy, as the accessed memory still belongs to the mptcp_sock struct, and even from a functional perspective the recovery completed successfully, as the short-cut test always failed.
A recent unrelated TCP change - commit d5fed5addb2b ("tcp: reorganize tcp_sock fast path variables") - exposed the issue, as the tcp field reorganization makes the mptcp code always skip the re-inection.
Fix the issue dropping the bogus call: we are on a slow path, the early optimization proved once again to be evil.
--- net/mptcp/protocol.c | 3 --- 1 file changed, 3 deletions(-)
net/mptcp/protocol.c +0 -3
@@ -2328,9 +2328,6 @@ bool __mptcp_retransmit_pending_data(strif (__mptcp_check_fallback (msk))return false; -if (tcp_rtx_and_write_queues_empty (sk)) -return false; -/* the closing socket has some data untransmitted and/or unacked: * some data in the mptcp rtx queue has not really xmitted yet. * keep it simple and re-inject the whole mptcp level rtx queue
Greg Kroah-Hartman
maintainerPATCH 117/309 selftests: mptcp: add missing kconfig for NF Filter
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 3645c844902bd4e173d6704fc2a37e8746904d67 upstream.
Since the commit mentioned below, 'mptcp_join' selftests is using IPTables to add rules to the Filter table.
It is then required to have IP_NF_FILTER KConfig.
This KConfig is usually enabled by default in many defconfig, but we recently noticed that some CI were running our selftests without them enabled.
--- tools/testing/selftests/net/mptcp/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/config +1 -0
@@ -22,6 +22,7 @@ CONFIG_NFT_TPROXY=m CONFIG_NFT_SOCKET=m CONFIG_IP_ADVANCED_ROUTER=y CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_NET_ACT_CSUM=m
Greg Kroah-Hartman
maintainerPATCH 118/309 selftests: mptcp: add missing kconfig for NF Filter in v6
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 8c86fad2cecdc6bf7283ecd298b4d0555bd8b8aa upstream.
Since the commit mentioned below, 'mptcp_join' selftests is using IPTables to add rules to the Filter table for IPv6.
It is then required to have IP6_NF_FILTER KConfig.
This KConfig is usually enabled by default in many defconfig, but we recently noticed that some CI were running our selftests without them enabled.
--- tools/testing/selftests/net/mptcp/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/config +1 -0
@@ -25,6 +25,7 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_IP6_NF_FILTER=m CONFIG_NET_ACT_CSUM=m CONFIG_NET_ACT_PEDIT=m CONFIG_NET_CLS_ACT=y
Greg Kroah-Hartman
maintainerPATCH 119/309 selftests: mptcp: add missing kconfig for NF Mangle
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 2d41f10fa497182df9012d3e95d9cea24eb42e61 upstream.
Since the commit mentioned below, 'mptcp_join' selftests is using IPTables to add rules to the Mangle table, only in IPv4.
This KConfig is usually enabled by default in many defconfig, but we recently noticed that some CI were running our selftests without them enabled.
--- tools/testing/selftests/net/mptcp/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/mptcp/config +1 -0
@@ -23,6 +23,7 @@ CONFIG_NFT_SOCKET=m CONFIG_IP_ADVANCED_ROUTER=y CONFIG_IP_MULTIPLE_TABLES=y CONFIG_IP_NF_FILTER=m +CONFIG_IP_NF_MANGLE=m CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IP6_NF_FILTER=m
Greg Kroah-Hartman
maintainerPATCH 120/309 selftests: mptcp: increase timeout to 30 min
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 4d4dfb2019d7010efb65926d9d1c1793f9a367c6 upstream.
On very slow environments -- e.g. when QEmu is used without KVM --, mptcp_join.sh selftest can take a bit more than 20 minutes. Bump the default timeout by 50% as it seems normal to take that long on some environments.
When a debug kernel config is used, this selftest will take even longer, but that's certainly not a common test env to consider for the timeout.
The Fixes tag that has been picked here is there simply to help having this patch backported to older stable versions. It is difficult to point to the exact commit that made some env reaching the timeout from time to time.
--- tools/testing/selftests/net/mptcp/settings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/settings +1 -1
@@ -1 +1 @@ -timeout=1200 +timeout=1800
Greg Kroah-Hartman
maintainerPATCH 121/309 selftests: mptcp: allow changing subtests prefix
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit de46d138e7735eded9756906747fd3a8c3a42225 upstream.
If a CI executes the same selftest multiple times with different options, all results from the same subtests will have the same title, which confuse the CI. With the same title printed in TAP, the tests are considered as the same ones.
Now, it is possible to override this prefix by using MPTCP_LIB_KSFT_TEST env var, and have a different title.
While at it, use 'basename' to remove the suffix as well instead of using an extra 'sed'.
--- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_lib.sh +1 -1
@@ -6,7 +6,7 @@ readonly KSFT_FAIL=1 readonly KSFT_SKIP=4 # shellcheck disable=SC2155 # declare and assign separately -readonly KSFT_TEST=$(basename "${0}" | sed 's/\.sh$//g') +readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}" MPTCP_LIB_SUBTESTS=()
Greg Kroah-Hartman
maintainerPATCH 122/309 selftests: mptcp: add mptcp_lib_kill_wait
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit bdbef0a6ff10603895b0ba39f56bf874cb2b551a upstream.
To avoid duplicated code in different MPTCP selftests, we can add and use helpers defined in mptcp_lib.sh.
Export kill_wait() helper in userspace_pm.sh into mptcp_lib.sh and rename it as mptcp_lib_kill_wait(). It can be used to instead of kill_wait() in mptcp_join.sh. Use the new helper in both scripts.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 +------ tools/testing/selftests/net/mptcp/mptcp_lib.sh | 9 ++++++ tools/testing/selftests/net/mptcp/userspace_pm.sh | 31 +++++++--------------- 3 files changed, 22 insertions(+), 28 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -8
@@ -682,16 +682,10 @@ wait_mpj() done } -kill_wait() -{ - kill $1 > /dev/null 2>&1 - wait $1 2>/dev/null -} - kill_events_pids() { - kill_wait $evts_ns1_pid - kill_wait $evts_ns2_pid + mptcp_lib_kill_wait $evts_ns1_pid + mptcp_lib_kill_wait $evts_ns2_pid } kill_tests_wait()
tools/testing/selftests/net/mptcp/mptcp_lib.sh +9 -0
@@ -207,3 +207,12 @@ mptcp_lib_result_print_all_tap() { printf "%s\n" "${subtest}" done } + +# $1: PID +mptcp_lib_kill_wait() { + [ "${1}" -eq 0 ] && return 0 + + kill -SIGUSR1 "${1}" > /dev/null 2>&1 + kill "${1}" > /dev/null 2>&1 + wait "${1}" 2>/dev/null +}
tools/testing/selftests/net/mptcp/userspace_pm.sh +11 -20
@@ -108,15 +108,6 @@ test_fail() mptcp_lib_result_fail "${test_name}" } -kill_wait() -{ - [ $1 -eq 0 ] && return 0 - - kill -SIGUSR1 $1 > /dev/null 2>&1 - kill $1 > /dev/null 2>&1 - wait $1 2>/dev/null -} - # This function is used in the cleanup trap #shellcheck disable=SC2317 cleanup()
@@ -128,7 +119,7 @@ cleanup() for pid in $client4_pid $server4_pid $client6_pid $server6_pid\ $server_evts_pid $client_evts_pid do - kill_wait $pid + mptcp_lib_kill_wait $pid done local netns
@@ -210,7 +201,7 @@ make_connection() fi :>"$client_evts" if [ $client_evts_pid -ne 0 ]; then - kill_wait $client_evts_pid + mptcp_lib_kill_wait $client_evts_pid fi ip netns exec "$ns2" ./pm_nl_ctl events >> "$client_evts" 2>&1 & client_evts_pid=$!
@@ -219,7 +210,7 @@ make_connection() fi :>"$server_evts" if [ $server_evts_pid -ne 0 ]; then - kill_wait $server_evts_pid + mptcp_lib_kill_wait $server_evts_pid fi ip netns exec "$ns1" ./pm_nl_ctl events >> "$server_evts" 2>&1 & server_evts_pid=$!
@@ -627,7 +618,7 @@ test_subflows() "10.0.2.2" "$client4_port" "23" "$client_addr_id" "ns1" "ns2" # Delete the listener from the client ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid local sport sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts")
@@ -666,7 +657,7 @@ test_subflows() "$client_addr_id" "ns1" "ns2" # Delete the listener from the client ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts")
@@ -705,7 +696,7 @@ test_subflows() "$client_addr_id" "ns1" "ns2" # Delete the listener from the client ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$server_evts")
@@ -743,7 +734,7 @@ test_subflows() "10.0.2.1" "$app4_port" "23" "$server_addr_id" "ns2" "ns1" # Delete the listener from the server ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
@@ -782,7 +773,7 @@ test_subflows() "$server_addr_id" "ns2" "ns1" # Delete the listener from the server ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
@@ -819,7 +810,7 @@ test_subflows() "10.0.2.2" "10.0.2.1" "$new4_port" "23" "$server_addr_id" "ns2" "ns1" # Delete the listener from the server ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
@@ -865,7 +856,7 @@ test_subflows_v4_v6_mix() "$server_addr_id" "ns2" "ns1" # Delete the listener from the server ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sport=$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' "$client_evts")
@@ -982,7 +973,7 @@ test_listener() sleep 0.5 # Delete the listener from the client ns, if one was created - kill_wait $listener_pid + mptcp_lib_kill_wait $listener_pid sleep 0.5 verify_listener_events $client_evts $LISTENER_CLOSED $AF_INET 10.0.2.2 $client4_port
Greg Kroah-Hartman
maintainerPATCH 123/309 mptcp: drop the push_pending field
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit bdd70eb68913c960acb895b00a8c62eb64715b1f upstream.
Such field is there to avoid acquiring the data lock in a few spots, but it adds complexity to the already non trivial locking schema.
All the relevant call sites (mptcp-level re-injection, set socket options), are slow-path, drop such field in favor of 'cb_flags', adding the relevant locking.
This patch could be seen as an improvement, instead of a fix. But it simplifies the next patch. The 'Fixes' tag has been added to help having this series backported to stable.
--- net/mptcp/protocol.c | 12 ++++++------ net/mptcp/protocol.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +6 -6
@@ -1519,8 +1519,11 @@ static void mptcp_update_post_push(strucvoid mptcp_check_and_set_pending (struct sock *sk) { -if (mptcp_send_head (sk)) -mptcp_sk (sk)->push_pending |=BIT (MPTCP_PUSH_PENDING ); +if (mptcp_send_head (sk)) { +mptcp_data_lock (sk); +mptcp_sk (sk)->cb_flags |=BIT (MPTCP_PUSH_PENDING ); +mptcp_data_unlock (sk); + } } static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
@@ -3138,7 +3141,6 @@ static int mptcp_disconnect(struct sockmptcp_destroy_common (msk,MPTCP_CF_FASTCLOSE );WRITE_ONCE (msk->flags,0 ); msk->cb_flags =0 ; - msk->push_pending =0 ; msk->recovery = false; msk->can_ack = false; msk->fully_established = false;
@@ -3364,8 +3366,7 @@ static void mptcp_release_cb(struct sockstruct mptcp_sock *msk =mptcp_sk (sk);for (;;) { -unsigned long flags = (msk->cb_flags &MPTCP_FLAGS_PROCESS_CTX_NEED ) | - msk->push_pending; +unsigned long flags = (msk->cb_flags &MPTCP_FLAGS_PROCESS_CTX_NEED );struct list_head join_list;if (!flags)
@@ -3381,7 +3382,6 @@ static void mptcp_release_cb(struct sock* datapath acquires the msk socket spinlock while helding * the subflow socket lock */ - msk->push_pending =0 ; msk->cb_flags &= ~flags;spin_unlock_bh (&sk->sk_lock.slock);
net/mptcp/protocol.h +0 -1
@@ -286,7 +286,6 @@ struct mptcp_sock {int rmem_released;unsigned long flags;unsigned long cb_flags; -unsigned long push_pending;bool recovery;/* closing subflow write queue reinjected */ bool can_ack;bool fully_established;
Greg Kroah-Hartman
maintainerPATCH 124/309 mptcp: fix rcv space initialization
In reply to Greg Kroah-Hartman6.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 013e3179dbd2bc756ce1dd90354abac62f65b739 upstream.
mptcp_rcv_space_init() is supposed to happen under the msk socket lock, but active msk socket does that without such protection.
Leverage the existing mptcp_propagate_state() helper to that extent. We need to ensure mptcp_rcv_space_init will happen before mptcp_rcv_space_adjust(), and the release_cb does not assure that:
explicitly check for such condition.
While at it, move the wnd_end initialization out of mptcp_rcv_space_init(), it never belonged there.
Note that the race does not produce ill effect in practice, but change allows cleaning-up and defying better the locking model.
--- net/mptcp/protocol.c | 10 ++++++---- net/mptcp/protocol.h | 3 ++- net/mptcp/subflow.c | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +6 -4
@@ -1977,6 +1977,9 @@ static void mptcp_rcv_space_adjust(strucif (copied <=0 )return ; +if (!msk->rcvspace_init) +mptcp_rcv_space_init (msk, msk->first); + msk->rcvq_space.copied += copied; mstamp =div_u64 (tcp_clock_ns (),NSEC_PER_USEC );
@@ -3156,6 +3159,7 @@ static int mptcp_disconnect(struct sock msk->bytes_received =0 ; msk->bytes_sent =0 ; msk->bytes_retrans =0 ; + msk->rcvspace_init =0 ;WRITE_ONCE (sk->sk_shutdown,0 );sk_error_report (sk);
@@ -3243,6 +3247,7 @@ void mptcp_rcv_space_init(struct mptcp_s {const struct tcp_sock *tp =tcp_sk (ssk); + msk->rcvspace_init =1 ; msk->rcvq_space.copied =0 ; msk->rcvq_space.rtt_us =0 ;
@@ -3253,8 +3258,6 @@ void mptcp_rcv_space_init(struct mptcp_s TCP_INIT_CWND * tp->advmss);if (msk->rcvq_space.space ==0 ) msk->rcvq_space.space =TCP_INIT_CWND *TCP_MSS_DEFAULT ; - -WRITE_ONCE (msk->wnd_end, msk->snd_nxt +tcp_sk (ssk)->snd_wnd); } static struct sock *mptcp_accept(struct sock *ssk, int flags, int *err,
@@ -3512,10 +3515,9 @@ void mptcp_finish_connect(struct sock *sWRITE_ONCE (msk->write_seq, subflow->idsn +1 );WRITE_ONCE (msk->snd_nxt, msk->write_seq);WRITE_ONCE (msk->snd_una, msk->write_seq); +WRITE_ONCE (msk->wnd_end, msk->snd_nxt +tcp_sk (ssk)->snd_wnd);mptcp_pm_new_connection (msk, ssk,0 ); - -mptcp_rcv_space_init (msk, ssk); }void mptcp_sock_graft (struct sock *sk,struct socket *parent)
net/mptcp/protocol.h +2 -1
@@ -304,7 +304,8 @@ struct mptcp_sock { nodelay:1, fastopening:1, in_accept_queue:1, - free_first:1; + free_first:1, + rcvspace_init:1;struct work_struct work;struct sk_buff *ooo_last_skb;struct rb_root out_of_order_queue;
net/mptcp/subflow.c +2 -2
@@ -424,6 +424,8 @@ void __mptcp_sync_state(struct sock *sk,struct mptcp_sock *msk =mptcp_sk (sk);__mptcp_propagate_sndbuf (sk, msk->first); +if (!msk->rcvspace_init) +mptcp_rcv_space_init (msk, msk->first);if (sk->sk_state ==TCP_SYN_SENT ) {inet_sk_state_store (sk, state); sk->sk_state_change (sk);
@@ -545,7 +547,6 @@ static void subflow_finish_connect(struc } }else if (mptcp_check_fallback (sk)) { fallback: -mptcp_rcv_space_init (msk, sk);mptcp_propagate_state (parent, sk); }return ;
@@ -1744,7 +1745,6 @@ static void subflow_state_change(struct msk =mptcp_sk (parent);if (subflow_simultaneous_connect (sk)) {mptcp_do_fallback (sk); -mptcp_rcv_space_init (msk, sk);pr_fallback (msk); subflow->conn_finished =1 ;mptcp_propagate_state (parent, sk);